/** * Clear an association *-to-one * @see net.mdatools.modelant.core.operation.element.NavigateObjectPath#processLast(javax.jmi.reflect.RefFeatured, javax.jmi.reflect.RefFeatured, java.lang.String, javax.jmi.reflect.RefFeatured) */ protected RefFeatured processLast(RefFeatured start, RefFeatured current, String itemName, RefFeatured associated) { current.refSetValue( itemName, value ); return current; }
public RefPackage execute(RefPackage refPackage) throws RuntimeException, IllegalArgumentException { for (RefClass metaClass : (Collection<RefClass>) refPackage.refAllClasses()) { result.addAll( metaClass.refAllOfClass() ); } return null; } });
public void execute(RefAssociationLink source) throws RuntimeException, IllegalArgumentException { RefObject targetFirst; RefObject targetSecond; targetFirst = objectsMap.get(source.refFirstEnd()); targetSecond = objectsMap.get(source.refSecondEnd()); assoc.refAddLink(targetFirst, targetSecond); }
/** * @param result is the buffer where to add the obect's description * @param object non-null enum to print */ private void append(StringBuilder result, RefEnum object, Set visited) { result.append( "RefEnum ") .append( object.refTypeName() ) .append( " " ) .append( object.toString() ); }
/** * @param source Navigate from this element, down the path */ public RefObject execute(RefObject source) throws IllegalArgumentException { RefObject result; // fond the source object if ( source == null ) { throw new IllegalArgumentException("Expected a non-null model element"); } // find the target extent result = source.refClass().refCreateInstance( null ); return result; } }
/** * @return the result of eval() method of the class provided */ public final boolean eval(RefObject value) { boolean result; RefPackage extent; RefClass metaclass; extent = value.refOutermostPackage(); metaclass = Navigator.getMetaClass( extent, metaClassName ); result = value.refIsInstanceOf( metaclass.refMetaObject(), true ); return result; } }
/** * This method requires an M1 object object and a StringBuilder where to describe the object. * * @param result is the buffer where to add the obect's description * @param object is the M1 object to investigate */ private void append(StringBuilder result, RefPackage object, Set visited) { result.append( "RefPackage ") .append( object.refMetaObject().refGetValue( "name" ) ); }
/** * This method requires an M1 object object and a StringBuilder where to describe the object. * * @param result is the buffer where to add the obect's description * @param object is the M1 object to investigate */ private void append(StringBuilder result, RefClass object, Set visited) { result.append( "RefClass ") .append( object.refMetaObject().refGetValue( "name" ) ); }
public void execute(RefObject sourceObject) throws RuntimeException, IllegalArgumentException { RefObject result; result = targetRefClass.refCreateInstance(null); objectsMap.put( sourceObject, result ); }
/** * @param sourceExtent not null extent */ public Collection<RefObject> execute(RefPackage sourceExtent) throws JmiException { Collection<RefObject> result; // locate the meta class (in metaClass) within the metamodel result = Navigator.getMetaClass( sourceExtent, metaclass ).refAllOfClass(); return result; } }
/** * This method constructs the name of the metaclass of the model element provided. * @param element is the non-null object to find metaclass of * @return the non-null metaclass name * @throws JmiException if the metaclass name is not a valid one */ public static String getMetaClassName(RefObject element) throws JmiException { assert element != null : "Expected a non-null model element"; return constructQualifiedName((ModelElement) element.refMetaObject()); }
/** * @param struct not null * @return the name of the Struct's class from its qualified name */ private static String getStructName(RefStruct struct) { String result; List<String> names; names = struct.refTypeName(); result = names.get(names.size()-1); return result; }
public RefPackage execute(RefPackage refPackage) throws RuntimeException, IllegalArgumentException { result.addAll( refPackage.refAllClasses() ); return null; } });
public RefPackage execute(RefPackage refPackage) throws RuntimeException, IllegalArgumentException { result.addAll( refPackage.refAllAssociations() ); return null; } });
public int compare(RefBaseObject o1, RefBaseObject o2) { int index1; int index2; index1 = getIndexOf((GeneralizableElement) o1.refMetaObject()); index2 = getIndexOf((GeneralizableElement) o2.refMetaObject()); return index1-index2; }
/** * Clear an association *-to-one * @see net.mdatools.modelant.core.operation.element.NavigateObjectPath#processLast(javax.jmi.reflect.RefFeatured, javax.jmi.reflect.RefFeatured, java.lang.String, javax.jmi.reflect.RefFeatured) */ protected RefFeatured processLast(RefFeatured start, RefFeatured current, String itemName, RefFeatured associated) { current.refSetValue( itemName, value ); return current; }
/** * @param modelElement non-null model element * @return the qualified name of the meta object (MOF element (class) of the metamodel), that describes * the provided model element */ public static ClassName constructQualifiedMetaObjectName(RefObject modelElement) { return (ClassName) constructQualifiedElementName( (ModelElement) modelElement.refMetaObject() ); }
public StructNameImpl(RefPackage extent, RefStruct struct) { this(constructOwnerClassName(struct.refTypeName(), extent), getStructName(struct)); }
/** * Clear an association *-to-one * @see net.mdatools.modelant.core.operation.element.NavigateObjectPath#processLast(javax.jmi.reflect.RefFeatured, javax.jmi.reflect.RefFeatured, java.lang.String, javax.jmi.reflect.RefFeatured) */ protected RefFeatured processLast(RefFeatured start, RefFeatured current, String itemName, RefFeatured associated) { current.refSetValue( itemName, null ); return current; }
/** * @see net.mdatools.modelant.core.operation.element.NavigateObjectPath#processLast(javax.jmi.reflect.RefFeatured, javax.jmi.reflect.RefFeatured, java.lang.String, java.lang.Object) */ protected RefFeatured processLast(RefFeatured start, RefFeatured current, String itemName, Object value) { if ( value instanceof Collection ) { // clear association to many ((Collection) value).clear(); } else { // clearing an attribute current.refSetValue( itemName, null ); } return current; } }