Search in sources :

Example 1 with Error

use of platformSpecific.javaTranslation.Resources.Error in project L42 by ElvisResearchGroup.

the class Resources method getRes.

public static Object getRes(String key, int... ks) {
    Object o = usedRes.get(key);
    if (o == null) {
        throw new Error("Invalid resource " + key + " Valid resources are: " + usedRes.keySet());
    }
    if (!(o instanceof ClassB)) {
        return o;
    }
    int[] newK = pKeys();
    int common = 0;
    while (common < newK.length && common < ks.length) {
        if (newK[common] == ks[common]) {
            common++;
        } else {
            break;
        }
    }
    int shift = newK.length - common;
    int padding = ks.length - common;
    if (shift == 0 && padding == 0) {
        return o;
    }
    List<Ast.C> csPadding = new ArrayList<>();
    for (int i = 0; i < padding; i++) {
        csPadding.add(C.of("Padding" + i));
    }
    ClassB cb = (ClassB) FromInClass.of((ClassB) o, Path.outer(shift, csPadding));
    //Configuration.typeSystem.computeStage(p, cb);
    return cb;
}
Also used : C(ast.Ast.C) ArrayList(java.util.ArrayList) Error(platformSpecific.javaTranslation.Resources.Error) TypeError(ast.ErrorMessage.TypeError) UserLevelError(ast.ErrorMessage.UserLevelError) ClassB(ast.ExpCore.ClassB)

Aggregations

C (ast.Ast.C)1 TypeError (ast.ErrorMessage.TypeError)1 UserLevelError (ast.ErrorMessage.UserLevelError)1 ClassB (ast.ExpCore.ClassB)1 ArrayList (java.util.ArrayList)1 Error (platformSpecific.javaTranslation.Resources.Error)1