Search in sources :

Example 6 with MemberType

use of org.eclipse.n4js.ts.types.MemberType in project n4js by eclipse.

the class MemberMatrix method toString.

@Override
public String toString() {
    if (!allMembers().hasNext()) {
        return "MemberMatrix not initialized yet.";
    }
    TMember first = allMembers().next();
    StringBuilder strb = new StringBuilder("MemberMatrix: ");
    if (first.isStatic()) {
        strb.append("static ");
    }
    strb.append(first.getName());
    strb.append("\n");
    final int tab = 15;
    StringBuilder row = new StringBuilder();
    tab(row, 10);
    for (int source = 0; source < SOURCE_COUNT_WITHOUT_CONSUMED; source++) {
        row.append(COLS[source]);
        if (source < 2) {
            tab(row, 10 + (1 + source) * tab);
        }
    }
    strb.append(row);
    for (MemberType type : MemberType.values()) {
        row.setLength(0);
        row.append(type.getName()).append(": ");
        tab(row, 10);
        for (int source = 0; source < SOURCE_COUNT_WITHOUT_CONSUMED; source++) {
            row.append(members(source, type).stream().map(m -> m.getContainingType().getName()).collect(Collectors.joining(",")));
            if (source < 2) {
                tab(row, 10 + (1 + source) * tab);
            }
        }
        strb.append("\n").append(row);
    }
    strb.append("\n");
    if (!consumed.isEmpty()) {
        strb.append("consumed: ");
        strb.append(consumed.stream().map(m -> m != null ? m.getMemberType() + " " + m.getContainingType().getName() + "." + m.getName() : "null").collect(Collectors.joining(",")));
    }
    return strb.toString();
}
Also used : MemberType(org.eclipse.n4js.ts.types.MemberType) TMember(org.eclipse.n4js.ts.types.TMember)

Aggregations

MemberType (org.eclipse.n4js.ts.types.MemberType)6 TypeRef (org.eclipse.n4js.ts.typeRefs.TypeRef)3 UnknownTypeRef (org.eclipse.n4js.ts.typeRefs.UnknownTypeRef)3 LinkedList (java.util.LinkedList)2 TMember (org.eclipse.n4js.ts.types.TMember)2 RuleEnvironment (org.eclipse.xsemantics.runtime.RuleEnvironment)1