Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Write a description of class Command here.
- *
- * @author Daffa Tristan Firdaus
- * @version 18 November 2020
- */
- public class Command
- {
- private String commandWord;
- private String secondWord;
- public Command(String firstWord, String secondWord)
- {
- commandWord = firstWord;
- this.secondWord = secondWord;
- }
- /**
- * Return the command word (the first word) of this command. If the
- * command was not understood, the result is null.
- * @return String commandWord
- */
- public String getCommandWord()
- {
- return commandWord;
- }
- /**
- * Return the second word of this command. Returns null if there was no
- * second word.
- * @return String secondWord
- */
- public String getSecondWord()
- {
- return secondWord;
- }
- /**
- * Return true if this command was not understood.
- * @return bool
- */
- public boolean isUnknown()
- {
- return (commandWord == null);
- }
- /**
- * Return true if the command has a second word.
- * @return bool
- */
- public boolean hasSecondWord()
- {
- return (secondWord != null);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment