public void calcImports() { // operations for (OJOperation oper : getOperations()) { addAll(oper.getParamTypes()); this.addToImports(oper.getReturnType()); addImportsRecursively(oper.getBody()); } }
public void copyDeepInfoInto(OJClassifier copy) { super.copyDeepInfoInto(copy); copy.setUniqueNumber(getUniqueNumber()); copy.setDerived(isDerived()); copy.setAbstract(isAbstract()); Iterator operationsIt = new ArrayList<OJOperation>(getOperations()).iterator(); while (operationsIt.hasNext()) { OJOperation elem = (OJOperation) operationsIt.next(); copy.addToOperations(elem.getDeepCopy()); } Iterator importsIt = new ArrayList<OJPathName>(getImports()).iterator(); while (importsIt.hasNext()) { OJPathName elem = (OJPathName) importsIt.next(); copy.addToImports(elem.getCopy()); } }
@Override public void finalize(){ super.finalize(); pns.remove(pn); } /**
/** * Copies all attributes and associations of this instance into 'copy'. 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 'copy' will refer to the same objects as the original (this) instance. * * @param copy */ public void copyInfoInto(OJClassifier copy){ super.copyInfoInto(copy); copy.setUniqueNumber(getUniqueNumber()); copy.setDerived(isDerived()); copy.setAbstract(isAbstract()); Iterator operationsIt = new ArrayList<OJOperation>(getOperations()).iterator(); while(operationsIt.hasNext()){ OJOperation elem = (OJOperation) operationsIt.next(); copy.addToOperations(elem); } Iterator importsIt = new ArrayList<OJPathName>(getImports()).iterator(); while(importsIt.hasNext()){ OJPathName elem = (OJPathName) importsIt.next(); copy.addToImports(elem); } } }
private void addAll(List<OJPathName> types) { for (OJPathName type : types) { if (type != null) { this.addToImports(type); if (!type.getElementTypes().isEmpty()) { addAll(type.getElementTypes()); } } } }
protected void addImportsRecursively(OJBlock body) { if (body != null) { for (OJField ojField : body.getLocals()) { this.addToImports(ojField.getType()); } for (OJStatement s : body.getStatements()) { if (s instanceof OJIfStatement) { addImportsRecursively(((OJIfStatement) s).getThenPart()); addImportsRecursively(((OJIfStatement) s).getElsePart()); } else if (s instanceof OJBlock) { addImportsRecursively(((OJBlock) s)); } else if (s instanceof OJTryStatement) { addImportsRecursively(((OJTryStatement) s).getTryPart()); addImportsRecursively(((OJTryStatement) s).getCatchPart()); } else if (s instanceof OJWhileStatement) { addImportsRecursively(((OJWhileStatement) s).getBody()); } else if (s instanceof OJForStatement) { addImportsRecursively(((OJForStatement) s).getBody()); addToImports(((OJForStatement) s).getElemType()); } else if (s instanceof OJSwitchStatement) { for (OJSwitchCase ojSwitchCase : ((OJSwitchStatement) s).getCases()) { addImportsRecursively(ojSwitchCase.getBody()); } } } } }
/** Returns the default identifier for OJInterface */ public String getIdString() { String result = ""; result = super.getIdString(); return result; }
public OJAnnotatedOperation findOperation(String name) { return (OJAnnotatedOperation) findOperation(name, Collections.<OJPathName>emptyList()); }
/** * @param result */ protected void addJavaDocComment(StringBuilder result) { String comment = JavaStringHelpers.firstCharToUpper(getComment()); result.append("/** " + comment); result.append("\n */\n"); }
public void addToImports(String pathName) { if (pathName == null) return; OJPathName path = new OJPathName(pathName); addToImports(path); }
/** Copies all attributes and associations of this instance into 'copy'. 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 'copy' will refer to the same objects as the original (this) instance. * * @param copy */ public void copyInfoInto(OJInterface copy) { super.copyInfoInto(copy); if ( getMyPackage() != null ) { copy.setMyPackage(getMyPackage()); } Iterator superInterfacesIt = new ArrayList<OJPathName>(getSuperInterfaces()).iterator(); while ( superInterfacesIt.hasNext() ) { OJPathName elem = (OJPathName) superInterfacesIt.next(); copy.addToSuperInterfaces(elem); } }
@Override public boolean equals(Object other){ if(other instanceof OJOperation){ OJOperation o = (OJOperation) other; List<OJPathName> oParamTypes = o.getParamTypes(); if(o.getOwner().equals(getOwner()) && o.getName().equals(getName())){ return paramsEquals(oParamTypes); } } return false; } public boolean paramsEquals(List<OJPathName> oParamTypes){
this.addToImports(path2); for (OJPathName generic : path.getGenerics()) { addToImports(generic); OJPathName path2 = path.getCopy().getHead(); path2.addToNames(lastEntry); this.addToImports(path2); } else { addAll(path.getElementTypes()); addToImports(generic);
/** * Returns the default identifier for OJClass */ public String getIdString(){ String result = ""; result = super.getIdString(); return result; } /**