/********************************************************************* * The constructor ********************************************************************/ public OJIfStatement() { super(); this.setThenPart(new OJBlock()); }
/** * Constructor for OJForStatement * * @param name * @param comment * @param elemName * @param collection */ public OJForStatement(String name, String comment, String elemName, String collection) { super(name, comment, elemName, collection); setBody(new OJBlock()); }
private OJBlock addToElseIf(String s) { OJBlock block = new OJBlock(); block.addToStatements(s); this.elseIfPart.add(block); return block; }
/** Returns a copy of this instance. True parts, i.e. associations marked 'aggregate' or 'composite', and attributes, are copied as well. References to other objects, i.e. associations not marked 'aggregate' or 'composite', will not be copied. The returned copy will refer to the same objects as the original (this) instance. */ public OJElement getCopy() { OJBlock result = new OJBlock(); this.copyInfoInto(result); return result; }
public OJBlock getDeepCopy(){ OJBlock copy = new OJBlock(); copyDeepInfoInto(copy); return copy; } public void copyDeepInfoInto(OJBlock copy){
/********************************************************************* * The constructor ********************************************************************/ public OJSwitchCase() { super(); this.setBody(new OJBlock()); }
/** * Constructor for OJForStatement */ public OJForStatement() { super(); setBody(new OJBlock()); }
/********************************************************************* * The constructor ********************************************************************/ public OJWhileStatement() { super(); this.setBody(new OJBlock()); } /*********************************************************************
private OJBlock addToElseIf(OJField f) { OJBlock block = new OJBlock(); block.addToLocals(f); this.elseIfPart.add(block); return block; }
/** * @return */ public OJBlock getCopy(){ OJBlock newBody = new OJBlock(); List<OJStatement> stats = new ArrayList<OJStatement>(this.getStatements()); newBody.setStatements(stats); return newBody; } public OJBlock getDeepCopy(){
public OJForStatement(String elementName, OJPathName type, String collection) { this(null, null, elementName, collection); setElemType(type); setBody(new OJBlock()); }
public OJIfStatement(String condition) { this.setThenPart(new OJBlock()); this.setCondition(condition); }
public OJIfStatement(String condition, String thenPart) { super(); this.setThenPart(new OJBlock()); this.setCondition(condition); this.addToThenPart(thenPart); }
public OJIfStatement(String condition, String thenPart, String elsePart) { super(); this.setThenPart(new OJBlock()); this.setCondition(condition); this.addToThenPart(thenPart); this.addToElsePart(elsePart); }
public void addToElsePart(OJStatement stat) { if (this.getElsePart() == null) { this.setElsePart(new OJBlock()); } this.getElsePart().addToStatements(stat); }
/****************************************************** * The constructor for this classifier. *******************************************************/ public OJOperation(){ super(); this.setBody(new OJBlock()); this.setVisibility(OJVisibilityKind.PUBLIC); this.setReturnType(new OJPathName("void")); } public String getSignature(){
public void addToElsePart(String string) { if (this.getElsePart() == null) { this.setElsePart(new OJBlock()); } this.getElsePart().addToStatements(string); }
public OJConstructor getDefaultConstructor() { OJConstructor result = super.getDefaultConstructor(); if (result == null) { OJConstructor constructor = new OJConstructor(); constructor.setBody(new OJBlock()); constructor.setComment("default constructor for " + this.getName()); this.addToConstructors(constructor); result = constructor; } return result; }
private void addPutResource(PropertyWrapper pWrap, OJAnnotatedClass annotatedClass, OJPathName parentPathName) { OJAnnotatedOperation put = new OJAnnotatedOperation("put"); put.setVisibility(OJVisibilityKind.PRIVATE); put.addToParameters(new OJParameter("propertyMap", new OJPathName("java.util.Map").addToGenerics("String").addToGenerics("Object"))); annotatedClass.addToOperations(put); OJBlock firstBlock = new OJBlock(); firstBlock.addToStatements("Object id = propertyMap.get(\"id\")"); firstBlock.addToStatements(pWrap.javaBaseTypePath().getLast() + " childResource = " + UmlgGenerationUtil.UMLGAccess + "." + UmlgGenerationUtil.getEntity + "(id)"); annotatedClass.addToImports(pWrap.javaBaseTypePath()); firstBlock.addToStatements("childResource.fromJson(propertyMap)"); put.getBody().addToStatements(firstBlock); OJBlock secondBlock = new OJBlock(); OJField baseTumlClass = new OJField("baseTumlClass", new OJPathName("Class").addToGenerics("? extends " + pWrap.javaBaseTypePath().getLast())); baseTumlClass.setInitExp("childResource.getClass()"); secondBlock.addToLocals(baseTumlClass); put.getBody().addToStatements(secondBlock); }