Commits

Christophe Furmaniak committed 02244b4

Prepare the implementation of IsOdd and IsEven

Comments (0)

Files changed (3)

src/main/java/net/awl/acacia/tagresolver/operations/IsEven.java

+package net.awl.acacia.tagresolver.operations;
+
+import net.awl.acacia.tagresolver.GroupOfServers;
+import net.awl.acacia.tagresolver.Operation;
+import net.awl.acacia.tagresolver.OperationType;
+
+/**
+ * User: cfurmaniak
+ * Date: 21/08/12
+ * Time: 11:18
+ *
+ * EVEN = pair
+ */
+public class IsEven extends OperationWith1Arg implements Operation {
+    @Override
+    public OperationType getType() {
+        return OperationType.EVEN;
+    }
+
+    @Override
+    public String getResultDescription(String... input) {
+        checkNbOfArgs(input);
+        return "Returns Even servers among the ones provided";
+    }
+
+    @Override
+    public GroupOfServers execute(GroupOfServers... groupOfServers) {
+        checkNbOfArgs(groupOfServers);
+        //TODO: implement
+        return null;
+    }
+}

src/main/java/net/awl/acacia/tagresolver/operations/IsOdd.java

+package net.awl.acacia.tagresolver.operations;
+
+import net.awl.acacia.tagresolver.GroupOfServers;
+import net.awl.acacia.tagresolver.Operation;
+import net.awl.acacia.tagresolver.OperationType;
+
+/**
+ * User: cfurmaniak
+ * Date: 21/08/12
+ * Time: 11:18
+ *
+ * ODD = impair
+ */
+public class IsOdd extends OperationWith1Arg implements Operation {
+    @Override
+    public OperationType getType() {
+        return OperationType.ODD;
+    }
+
+    @Override
+    public String getResultDescription(String... input) {
+        checkNbOfArgs(input);
+        return "Returns Odd servers among the ones provided";
+    }
+
+    @Override
+    public GroupOfServers execute(GroupOfServers... groupOfServers) {
+        checkNbOfArgs(groupOfServers);
+        //TODO: implement
+        return null;
+    }
+}

src/main/java/net/awl/acacia/tagresolver/operations/OperationWith1Arg.java

+package net.awl.acacia.tagresolver.operations;
+
+import net.awl.acacia.tagresolver.Operation;
+
+/**
+ * User: cfurmaniak
+ * Date: 21/08/12
+ * Time: 11:16
+ */
+public abstract class OperationWith1Arg extends OperationThatChecksTheNumberOfProvidedArguments implements Operation {
+    public int getNbOfArgs() {
+        return 1;
+    }
+}