return sb.toString();
}
+ @Override
+ public int hashCode()
+ {
+ int h = command.hashCode();
+ if (parameters != null)
+ {
+ for (String p : parameters)
+ {
+ h = h * 37 + p.hashCode();
+ }
+ }
+ return h;
+ }
+
+ /**
+ * Answers true if {@code obj} is a {@code StructureCommand} with the same
+ * command and parameters as this one, else false
+ */
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == null || !(obj instanceof StructureCommand))
+ {
+ return false;
+ }
+ StructureCommand sc = (StructureCommand) obj;
+
+ if (!command.equals(sc.command))
+ {
+ return false;
+ }
+ if (parameters == null || sc.parameters == null)
+ {
+ return (parameters == null) && (sc.parameters == null);
+ }
+
+ int j = parameters.size();
+ if (j != sc.parameters.size())
+ {
+ return false;
+ }
+ for (int i = 0; i < j; i++)
+ {
+ if (!parameters.get(i).equals(sc.parameters.get(i)))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
}