@Override public int compareTo(FunctionSignature o) { int cmpVal = name.compareTo(o.name); if (cmpVal != 0) { return cmpVal; } cmpVal = functionType.name().compareTo(o.functionType.name()); if (cmpVal != 0) { return cmpVal; } cmpVal = returnType.getType().name().compareTo(o.returnType.getType().name()); if (cmpVal != 0) { return cmpVal; } for (int i = 0; i < Math.min(paramTypes.length, o.paramTypes.length); i++) { cmpVal = paramTypes[i].getType().name().compareTo(o.paramTypes[i].getType().name()); if (cmpVal != 0) { return cmpVal; } } return o.paramTypes.length - paramTypes.length; }
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(signature); sb.append("#").append(type.name()); sb.append("("); int i = 0; for (DataType type : arguments) { sb.append(type.getType()); sb.append("[").append(type.getLength()).append("]"); if (i < arguments.length - 1) { sb.append(","); } i++; } sb.append(")"); return sb.toString(); }