public RTContainsCode(final StaticScope enclosingMethodScope) { super( "Set", "contains", "element", "T", enclosingMethodScope, StaticScope.globalScope().lookupTypeDeclaration("int")); }
public RTIsEmptyCode(final StaticScope enclosingMethodScope) { super( "Set", "isEmpty", "element", "T", enclosingMethodScope, StaticScope.globalScope().lookupTypeDeclaration("int")); }
public RTAddCode(final StaticScope enclosingMethodScope) { super( "Set", "add", "element", "T", enclosingMethodScope, StaticScope.globalScope().lookupTypeDeclaration("void")); }
public RTRemoveTCode(final StaticScope enclosingMethodScope) { super( "Set", "remove", "element", "T", enclosingMethodScope, StaticScope.globalScope().lookupTypeDeclaration("boolean")); }
public RTSizeCode(final StaticScope enclosingMethodScope) { super( "Map", "size", null, null, enclosingMethodScope, StaticScope.globalScope().lookupTypeDeclaration("int")); }
public RTRemoveCode(final StaticScope enclosingMethodScope) { super( "Map", "remove", asList("key"), asList("K"), enclosingMethodScope, StaticScope.globalScope().lookupTypeDeclaration("int")); }
public RTContainsValueCode(final StaticScope enclosingMethodScope) { super( "Map", "containsValue", asList("value"), asList("V"), enclosingMethodScope, StaticScope.globalScope().lookupTypeDeclaration("boolean")); }
public RTPutCode(final StaticScope enclosingMethodScope) { super( "Map", "put", asList("key", "value"), asList("K", "V"), enclosingMethodScope, StaticScope.globalScope().lookupTypeDeclaration("void")); }
public RTCookieObject(final Object cookie) { super( InterpretiveCodeGenerator.scopeToRTTypeDeclaration( StaticScope.globalScope().lookupTypeDeclaration("Object").enclosedScope())); cookie_ = cookie; }
public static void setup() { typeDeclarationList_ = new ArrayList<TypeDeclaration>(); final StaticScope globalScope = StaticScope.globalScope(); final Type integerType = StaticScope.globalScope().lookupTypeDeclaration("int"); assert null != integerType; final Type voidType = StaticScope.globalScope().lookupTypeDeclaration("void"); assert null != voidType; final Type booleanType = StaticScope.globalScope().lookupTypeDeclaration("boolean"); assert null != booleanType; if (null == globalScope.lookupTypeDeclaration("Set")) { final StaticScope newScope = new StaticScope(globalScope); final TemplateDeclaration templateDecl = new TemplateDeclaration("Set", newScope, /*Base Class*/ null, 0); newScope.setDeclaration(templateDecl); final Type T = new TemplateParameterType("T", null); final IdentifierExpression typeParamId = new IdentifierExpression("T", T, newScope, 0); templateDecl.addTypeParameter(typeParamId, 1); listType_ = new TemplateType("Set", newScope, null); templateDecl.setType(listType_); typeDeclarationList_.add(templateDecl); final Type intType = globalScope.lookupTypeDeclaration("int"); declareSetMethod("Set", listType_, null, null, false); declareSetMethod("add", voidType, "element", T, false); declareSetMethod("remove", booleanType, "element", T, false); declareSetMethod("contains", booleanType, "element", T, true); declareSetMethod("size", intType, null, null, true); declareSetMethod("isEmpty", booleanType, null, null, true); // Declare the type globalScope.declareType(listType_); globalScope.declareTemplate(templateDecl); } }
public static void setup() { typeDeclarationList_ = new ArrayList<TypeDeclaration>(); final StaticScope globalScope = StaticScope.globalScope(); final Type integerType = StaticScope.globalScope().lookupTypeDeclaration("int"); assert null != integerType; final Type voidType = StaticScope.globalScope().lookupTypeDeclaration("void"); assert null != voidType; final Type booleanType = StaticScope.globalScope().lookupTypeDeclaration("boolean"); assert null != booleanType; if (null == globalScope.lookupTypeDeclaration("Map")) { final StaticScope newScope = new StaticScope(globalScope); final ClassDeclaration objectBaseClass = globalScope.lookupClassDeclaration("Object"); assert null != objectBaseClass; final TemplateDeclaration templateDecl = new TemplateDeclaration("Map", newScope, objectBaseClass, 0); newScope.setDeclaration(templateDecl); final Type K = new TemplateParameterType("K", null); final Type V = new TemplateParameterType("V", null); final IdentifierExpression keyTypeParamID = new IdentifierExpression("K", K, newScope, 0); final IdentifierExpression valueTypeParamID = new IdentifierExpression("V", V, newScope, 0); templateDecl.addTypeParameter(keyTypeParamID, 2); templateDecl.addTypeParameter(valueTypeParamID, 2); mapType_ = new TemplateType("Map", newScope, null); templateDecl.setType(mapType_); typeDeclarationList_.add(templateDecl); final Type intType = globalScope.lookupTypeDeclaration("int"); declareMapMethod("Map", mapType_, null, null); declareMapMethod("put", voidType, asList("value", "key"), asList(V, K)); declareMapMethod("get", V, asList("key"), asList(K)); declareMapMethod("containsKey", booleanType, asList("key"), asList(K)); declareMapMethod("containsValue", booleanType, asList("value"), asList(V)); declareMapMethod("remove", V, asList("key"), asList(K)); declareMapMethod("size", intType, null, null); // Declare the type globalScope.declareType(mapType_); globalScope.declareTemplate(templateDecl); } }