Expression: Rename getElement / getNext to getHead / getTail.

Match the methods on Sequence.
M src/main/java/nl/grauw/glass/ParameterScope.java +5 -5
@@ 11,16 11,16 @@ public class ParameterScope extends Scop
 		super(parent);
 
 		while (parameters != null) {
-			Expression parameter = parameters.getElement();
+			Expression parameter = parameters.getHead();
 			Expression argument;
 
 			if (parameter instanceof Equals) {
-				argument = arguments != null ? arguments.getElement() : ((Equals)parameter).getTerm2();
+				argument = arguments != null ? arguments.getHead() : ((Equals)parameter).getTerm2();
 				parameter = ((Equals)parameter).getTerm1();
 			} else {
 				if (arguments == null)
 					throw new ArgumentException("Not enough arguments.");
-				argument = arguments.getElement();
+				argument = arguments.getHead();
 			}
 
 			if (!(parameter instanceof Identifier))

          
@@ 28,9 28,9 @@ public class ParameterScope extends Scop
 
 			addSymbol(((Identifier)parameter).getName(), argument);
 
-			parameters = parameters.getNext();
+			parameters = parameters.getTail();
 			if (arguments != null)
-				arguments = arguments.getNext();
+				arguments = arguments.getTail();
 		}
 		if (arguments != null)
 			throw new ArgumentException("Too many arguments.");

          
M src/main/java/nl/grauw/glass/expressions/Expression.java +8 -8
@@ 81,6 81,14 @@ public abstract class Expression {
 		throw new EvaluationException("Not a section context.");
 	}
 
+	public Expression getHead() {
+		return this;
+	}
+
+	public Expression getTail() {
+		return null;
+	}
+
 	public List<Expression> getList() {
 		List<Expression> list = new ArrayList<>();
 		addToList(list);

          
@@ 91,18 99,10 @@ public abstract class Expression {
 		list.add(this);
 	}
 
-	public Expression getElement() {
-		return getElement(0);
-	}
-
 	public Expression getElement(int index) {
 		return index == 0 ? this : null;
 	}
 
-	public Expression getNext() {
-		return null;
-	}
-
 	public String getHexValue() {
 		int value = getInteger();
 		String string = Integer.toHexString(Math.abs(value)).toUpperCase();

          
M src/main/java/nl/grauw/glass/expressions/Schema.java +2 -2
@@ 10,9 10,9 @@ public class Schema implements SchemaTyp
 
 	public boolean check(Expression arguments) {
 		for (SchemaType type : types) {
-			if (arguments == null || !type.check(arguments.getElement()))
+			if (arguments == null || !type.check(arguments.getHead()))
 				return false;
-			arguments = arguments.getNext();
+			arguments = arguments.getTail();
 		}
 		return arguments == null;
 	}

          
M src/main/java/nl/grauw/glass/expressions/Sequence.java +7 -10
@@ 4,8 4,8 @@ import java.util.List;
 
 public class Sequence extends BinaryOperator {
 
-	public Sequence(Expression value, Expression tail) {
-		super(value, tail);
+	public Sequence(Expression head, Expression tail) {
+		super(head, tail);
 	}
 
 	@Override

          
@@ 13,10 13,12 @@ public class Sequence extends BinaryOper
 		return new Sequence(term1.copy(context), term2.copy(context));
 	}
 
-	public Expression getValue() {
+	@Override
+	public Expression getHead() {
 		return term1;
 	}
 
+	@Override
 	public Expression getTail() {
 		return term2;
 	}

          
@@ 26,8 28,8 @@ public class Sequence extends BinaryOper
 		term1.addToList(list);
 		Expression tail = term2;
 		while (tail != null) {
-			tail.getElement().addToList(list);
-			tail = tail.getNext();
+			tail.getHead().addToList(list);
+			tail = tail.getTail();
 		}
 	}
 

          
@@ 37,11 39,6 @@ public class Sequence extends BinaryOper
 	}
 
 	@Override
-	public Expression getNext() {
-		return term2;
-	}
-
-	@Override
 	public String getLexeme() {
 		return ",";
 	}

          
M src/main/java/nl/grauw/glass/instructions/Irp.java +4 -4
@@ 19,13 19,13 @@ public class Irp extends InstructionFact
 
 	public void expand(Line line, List<Line> lines) {
 		Expression arguments = line.getArguments();
-		if (arguments == null || !Schema.IDENTIFIER.check(arguments.getElement()))
+		if (arguments == null || !Schema.IDENTIFIER.check(arguments.getHead()))
 			throw new ArgumentException();
 
 		super.expand(line, lines);
-		Expression parameter = arguments.getElement();
-		for (int i = 0; (arguments = arguments.getNext()) != null; i++) {
-			Scope parameterScope = new ParameterScope(line.getScope(), parameter, arguments.getElement());
+		Expression parameter = arguments.getHead();
+		for (int i = 0; (arguments = arguments.getTail()) != null; i++) {
+			Scope parameterScope = new ParameterScope(line.getScope(), parameter, arguments.getHead());
 
 			// set up the number symbol
 			line.getScope().addSymbol(Integer.toString(i), parameterScope);

          
M src/main/java/nl/grauw/glass/instructions/Macro.java +2 -2
@@ 27,7 27,7 @@ public class Macro extends InstructionFa
 	public void expand(Line line, List<Line> lines) {
 		Expression parameters = line.getArguments();
 		while (parameters != null) {
-			Expression parameter = parameters.getElement();
+			Expression parameter = parameters.getHead();
 			if (!(parameter instanceof Identifier) &&
 					!(parameter instanceof Equals && ((Equals)parameter).getTerm1() instanceof Identifier))
 				throw new ArgumentException("Parameter must be an identifier.");

          
@@ 38,7 38,7 @@ public class Macro extends InstructionFa
 			} else {
 				parameterScope.addSymbol(((Identifier)parameter).getName(), IntegerLiteral.ZERO);
 			}
-			parameters = parameters.getNext();
+			parameters = parameters.getTail();
 		}
 
 		try {