/** * This operation should NOT be used by clients. It implements the correct removal of an element in an association. * * @param element */ public void z_internalRemoveFromOperations(OJOperation element){ Set<OJOperation> set = this.f_operations.get(element.getName()); if(set != null && set.contains(element)){ set.remove(element); } } /**
/** * This operation should NOT be used by clients. It implements the correct addition of an element in an association. * * @param element */ public void z_internalAddToOperations(OJOperation element){ Set<OJOperation> set = this.f_operations.get(element.getName()); if(set == null){ set = new HashSet<OJOperation>(); this.f_operations.put(element.getName(), set); } set.add(element); } /**
public int countOperationsStartingWith(String name) { int count = 0; for (OJOperation oper : getOperations()) { if (oper.getName().startsWith(name)) { count++; } } return count; }
/** * */ public OJOperation findToString() { OJOperation result = null; Iterator it = getOperations().iterator(); while (it.hasNext()) { OJOperation oper = (OJOperation) it.next(); if (oper.getName().equals("toString")) result = oper; } return result; }
/** * */ public OJOperation findIdentOper() { OJOperation result = null; Iterator it = getOperations().iterator(); while (it.hasNext()) { OJOperation oper = (OJOperation) it.next(); if (oper.getName().equals("getIdentifyingString")) result = oper; } return result; }
public void removeFromOperations(String internalRemover, List<OJPathName> singletonList) { Set<OJOperation> methodSet = f_operations.get(internalRemover); if (methodSet != null) { Iterator<OJOperation> iterator = methodSet.iterator(); while (iterator.hasNext()) { OJOperation ojOperation = (OJOperation) iterator.next(); if (ojOperation.getName().equals(internalRemover) && ojOperation.paramsEquals(singletonList)) { iterator.remove(); break; } } } }
/** * Implements ->any( o : OJOperation | o.name = 'getIdentifyingString' ) */ private OJOperation any1(){ OJOperation result = null; Iterator it = this.getOperations().iterator(); while(it.hasNext()){ OJOperation o = (OJOperation) it.next(); if(o.getName().equals("getIdentifyingString")){ return o; } } return result; } /**
/** * Implements ->any( o : OJOperation | o.name = 'toString' ) */ private OJOperation any2(){ OJOperation result = null; Iterator it = this.getOperations().iterator(); while(it.hasNext()){ OJOperation o = (OJOperation) it.next(); if(o.getName().equals("toString")){ return o; } } return result; } /**
public String getSignature(){ StringBuilder sb = new StringBuilder(getName()); sb.append("("); for(OJParameter p:getParameters()){ sb.append(p.getType().getLast()); sb.append(","); } sb.setCharAt(sb.length() - 1, ')'); return sb.toString(); } /******************************************************
public boolean isEqual(String name,List /* (OJPathName) */types){ boolean result = false; if(this.getName().equals(name)){ List<OJParameter> myPars = this.getParameters(); if((myPars.size() == 0) && (types.size() == 0)){ result = true; }else{ if(myPars.size() == types.size()){ Iterator parsIt = myPars.iterator(); Iterator typesIt = types.iterator(); boolean loopResult = true; while(parsIt.hasNext()){ OJParameter par = (OJParameter) parsIt.next(); OJPathName type = (OJPathName) typesIt.next(); if(!(par.getType().equals(type))){ loopResult = false; } } result = loopResult; } } } return result; } public List<OJPathName> getParamTypes(){
@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){
/** * Implements addition of a single element to feature '+ operations : OrderedSet(OJOperation)' * * @param element */ public void addToOperations(OJOperation element){ if(element == null){ return; } Set<OJOperation> set = this.f_operations.get(element.getName()); if(set != null && set.contains(element)){ set.remove(element); } if(element.getOwner() != null){ element.getOwner().z_internalRemoveFromOperations(element); } z_internalAddToOperations(element); element.z_internalAddToOwner((OJClassifier) ((OJClassifier) this)); } /**
result.append(" " + getName());
protected void copyValues(OJOperation result){ result.setComment(getComment()); result.setBody(this.getBody().getCopy()); result.setReturnType(this.getReturnType()); result.setFinal(this.isFinal()); result.setStatic(this.isStatic()); result.setVolatile(this.isVolatile()); result.setName(this.getName()); List<OJParameter> params = new ArrayList<OJParameter>(this.getParameters()); result.setParameters(params); result.setVisibility(this.getVisibility()); } public boolean isEqual(String name,List /* (OJPathName) */types){
protected void copyValuesDeep(OJOperation result){ result.setComment(getComment()); result.setBody(this.getBody().getDeepCopy()); result.setReturnType(this.getReturnType().getDeepCopy()); result.setFinal(this.isFinal()); result.setStatic(this.isStatic()); result.setVolatile(this.isVolatile()); result.setName(this.getName()); result.setAbstract(isAbstract()); for(OJParameter ojParameter:this.getParameters()){ result.addToParameters(ojParameter.getDeepCopy()); } result.setVisibility(this.getVisibility()); } protected void copyValues(OJOperation result){