package models.algebra; public class Symbol { private String name; private int arity = 0; private Type operatorType = Type.PREFIX; private Symbol inverses[] = null; public Symbol(String name) { this.name = name; this.arity = 0; } public Symbol(String name, int arity) { this.name = name; this.arity = arity; } public Symbol(String name, int arity, Type operatorType) { this.name = name; this.arity = arity; this.operatorType = operatorType; } public void setArity(int arity) { this.arity = arity; } public int getArity() { return arity; } public String getName() { return name; } public boolean isInfix() { return (operatorType == Type.INFIX); } public boolean isMethod() { return (operatorType == Type.METHOD); } public Symbol[] getInverses() { return inverses; } public void setInverses(Symbol[] inverses) { this.inverses = inverses; } public boolean equals(Object another) { if (!(another instanceof Symbol)) return false; return name.equals(((Symbol) another).name) && arity == ((Symbol) another).arity; } @Override public int hashCode() { return name.hashCode(); } public String toString() { return name; } public enum Type { PREFIX, INFIX, METHOD } }