package seedu.bulletjournal.logic.parser;

/**
 * Provides variations of commands
 * Note: hard-coded for v0.2, will implement nlp for future versions
 * @author Tu An - arishuynhvan
 */

public class FlexibleCommand {
	private String commandFromUser = "";
	private String[] commandGroups = new String[] {
			"add a adds create creates new",
			"clear clr c clears empty empties",
			"delete d deletes del remove removes rm",
			"edit edits e change changes",
			"exit exits close closes logout logouts",
			"find finds f search searches lookup",
			"help helps h manual instruction instructions",
			"list lists l ls show shows display displays showall",
			"select selects s choose chooses",
	};

	/**
	 * Constructor must take in a valid string input
	 * @param cfu
	 */
	public FlexibleCommand(String cfu) {
		commandFromUser = cfu;
	}

	/**
	 * @return the correct command string that matches COMMAND_WORD of command classes
	 */
	public String getCommandWord() {
		for (String commandGroup: commandGroups) {
			for (String command: commandGroup.split(" ")) {
				if (commandFromUser.equals(command))
					return commandGroup.split(" ")[0];
			}
		}
		return commandFromUser;
	}

	public boolean isValidCommand() {
		for (String commandGroup: commandGroups) {
			for (String command: commandGroup.split(" ")) {
				if (commandFromUser.equals(command))
					return true;
			}
		}
		return false;
	}
}

@@ -74,19 +74,16 @@
 commands
-%0A *
  Note: h
@@ -120,16 +120,19 @@
 ment nlp
+%0A *
  for fut
@@ -212,17 +212,20 @@
 mmand %7B%0A
-%09
+    
 private 
@@ -253,17 +253,20 @@
 r = %22%22;%0A
-%09
+    
 private 
@@ -304,20 +304,17 @@
 ring%5B%5D %7B
-%0A%09%09%09
+ 
 %22add a a
@@ -337,20 +337,17 @@
 es new%22,
-%0A%09%09%09
+ 
 %22clear c
@@ -374,19 +374,24 @@
 pties%22,%0A
-%09%09%09
+        
 %22delete 
@@ -423,20 +423,17 @@
 ves rm%22,
-%0A%09%09%09
+ 
 %22edit ed
@@ -455,19 +455,24 @@
 anges%22,%0A
-%09%09%09
+        
 %22exit ex
@@ -504,20 +504,17 @@
 ogouts%22,
-%0A%09%09%09
+ 
 %22find fi
@@ -544,19 +544,24 @@
 ookup%22,%0A
-%09%09%09
+        
 %22help he
@@ -599,20 +599,17 @@
 ctions%22,
-%0A%09%09%09
+ 
 %22list li
@@ -655,19 +655,24 @@
 owall%22,%0A
-%09%09%09
+        
 %22select 
@@ -700,21 +700,25 @@
 ses%22
-,%0A%09
+ 
 %7D;%0A%0A
-%09/**%0A%09
+    /**%0A    
  * C
@@ -762,17 +762,20 @@
 g input%0A
-%09
+    
  * @para
@@ -780,22 +780,28 @@
 ram cfu%0A
-%09 */%0A%09
+     */%0A    
 public F
@@ -829,18 +829,24 @@
  cfu) %7B%0A
-%09%09
+        
 commandF
@@ -864,18 +864,27 @@
 fu;%0A
-%09%7D%0A%0A%09/**%0A%09
+    %7D%0A%0A    /**%0A    
  * @
@@ -957,23 +957,44 @@
 mand
- classes%0A%09 */%0A%09
+%0A     *         classes%0A     */%0A    
 publ
@@ -1018,26 +1018,32 @@
 andWord() %7B%0A
-%09%09
+        
 for (String 
@@ -1046,32 +1046,33 @@
 ing commandGroup
+ 
 : commandGroups)
@@ -1066,35 +1066,44 @@
 ommandGroups) %7B%0A
-%09%09%09
+            
 for (String comm
@@ -1097,32 +1097,33 @@
  (String command
+ 
 : commandGroup.s
@@ -1127,36 +1127,48 @@
 p.split(%22 %22)) %7B%0A
-%09%09%09%09
+                
 if (commandFromU
@@ -1184,29 +1184,44 @@
 s(command))%0A
-%09%09%09%09%09
+                    
 return comma
@@ -1243,27 +1243,48 @@
  %22)%5B0%5D;%0A
-%09%09%09%7D%0A%09%09%7D%0A%09%09
+            %7D%0A        %7D%0A        
 return c
@@ -1303,13 +1303,19 @@
 er;%0A
-%09%7D%0A%0A%09
+    %7D%0A%0A    
 publ
@@ -1344,18 +1344,24 @@
 and() %7B%0A
-%09%09
+        
 for (Str
@@ -1376,16 +1376,17 @@
 andGroup
+ 
 : comman
@@ -1396,19 +1396,28 @@
 oups) %7B%0A
-%09%09%09
+            
 for (Str
@@ -1427,16 +1427,17 @@
  command
+ 
 : comman
@@ -1457,20 +1457,32 @@
 %22 %22)) %7B%0A
-%09%09%09%09
+                
 if (comm
@@ -1514,37 +1514,73 @@
 d))%0A
-%09%09%09%09%09return true;%0A%09%09%09%7D%0A%09%09%7D%0A%09%09
+                    return true;%0A            %7D%0A        %7D%0A        
 retu
@@ -1593,9 +1593,12 @@
 se;%0A
-%09
+    
 %7D%0A%7D%0A

Fix checkstyle errors