@Test public void firstWordFromLineWithWords() throws Exception { List<ParsedWord> words = new ArrayList<>(); words.add(new ParsedWord("command", 0)); words.add(new ParsedWord("line", 1)); words.add(new ParsedWord("text", 2)); ParsedLine pl = new ParsedLine("command line text", words, -1, 0, 0, ParserStatus.OK, "", OperatorType.NONE); assertEquals(pl.firstWord().word(), "command"); }
public ParsedWord firstWord() { if(words.size() > 0 ) return words.get(0); else return new ParsedWord("", 0); }
ParsedLine { public ParsedWord firstWord() { if(words.size() > 0 ) return words.get(0); else return new ParsedWord("", 0); } }
ParsedLine { public ParsedWord firstWord() { if(words.size() > 0 ) return words.get(0); else return new ParsedWord("", 0); } ParsedLine(String originalInput, List<ParsedWord> words,
                      int cursor, int cursorWord, int wordCursor,
                      ParserStatus status, String errorMessage, OperatorType operator); }
ParsedLine { public ParsedWord firstWord() { if(words.size() > 0 ) return words.get(0); else return new ParsedWord("", 0); } ParsedLine(String originalInput, List<ParsedWord> words,
                      int cursor, int cursorWord, int wordCursor,
                      ParserStatus status, String errorMessage, OperatorType operator); int cursor(); int selectedIndex(); ParsedWord selectedWord(); ParsedWord selectedWordToCursor(); int wordCursor(); String line(); String errorMessage(); List<ParsedWord> words(); ParserStatus status(); ParsedWord lastWord(); ParsedWord firstWord(); int size(); boolean hasWords(); ParsedLineIterator iterator(); OperatorType operator(); boolean cursorAtEnd(); boolean spaceAtEnd(); boolean isCursorAtEndOfSelectedWord(); @Override String toString(); }
ParsedLine { public ParsedWord firstWord() { if(words.size() > 0 ) return words.get(0); else return new ParsedWord("", 0); } ParsedLine(String originalInput, List<ParsedWord> words,
                      int cursor, int cursorWord, int wordCursor,
                      ParserStatus status, String errorMessage, OperatorType operator); int cursor(); int selectedIndex(); ParsedWord selectedWord(); ParsedWord selectedWordToCursor(); int wordCursor(); String line(); String errorMessage(); List<ParsedWord> words(); ParserStatus status(); ParsedWord lastWord(); ParsedWord firstWord(); int size(); boolean hasWords(); ParsedLineIterator iterator(); OperatorType operator(); boolean cursorAtEnd(); boolean spaceAtEnd(); boolean isCursorAtEndOfSelectedWord(); @Override String toString();  }