package models.dataConstraintModel; import java.util.HashMap; import models.algebra.Expression; import models.algebra.Symbol; import models.algebra.Term; public class ListTerm extends Term { public ListTerm() { super(new Symbol("list", -1)); setType(DataConstraintModel.typeList); } public void append(Expression value) { addChild(value); } public Expression get(int index) { return getChild(index); } public int size() { return children.size(); } @Override public Object clone() { ListTerm newTerm = new ListTerm(); for (Expression e: children) { newTerm.addChild((Expression) e.clone()); } return newTerm; } public String toString() { String listStr = "["; String delim = ""; for (Expression child: getChildren()) { listStr += delim + child.toString(); delim = ", "; } return listStr + "]"; } }