public VectorCommand(CmdType type, int x, int y) { if (type == CmdType.MOVETO || type == CmdType.LINETO) { this.type = type; this.operands = new int[] {x, y}; } else { throw new IllegalArgumentException("Wrong number of Parameters for " + type.toString()); } }
public int getY() { if (this.type == CmdType.MOVETO || this.type == CmdType.LINETO) { return operands[1]; } throw new UnsupportedOperationException("getX not supported for " + type.toString()); }