protected void addProxy(EObject proxy, EObject context) { if (proxy.eIsProxy()) { if (proxyMap == null) { proxyMap = new HashMap<URI, List<EObject>>(); } URI uri = normalizeURI(((InternalEObject)proxy).eProxyURI(), context); List<EObject> proxies = proxyMap.get(uri); if (proxies == null) { proxyMap.put(uri, proxies = new BasicEList.FastCompare<EObject>()); } proxies.add(proxy); } }
protected void addProxy(EObject proxy, EObject context) { if (proxy.eIsProxy()) { if (proxyMap == null) { proxyMap = new HashMap<URI, List<EObject>>(); } URI uri = normalizeURI(((InternalEObject)proxy).eProxyURI(), context); List<EObject> proxies = proxyMap.get(uri); if (proxies == null) { proxyMap.put(uri, proxies = new BasicEList.FastCompare<EObject>()); } proxies.add(proxy); } }
/** * Returns the collection of objects in the given collection that are also contained by this list. * @param collection the other collection. * @return the collection of objects in the given collection that are also contained by this list. */ protected Collection<E> getDuplicates(Collection<?> collection) { if (collection.isEmpty()) { return ECollections.emptyEList(); } else { Collection<E> filteredResult = useEquals() ? new BasicEList<E>(collection.size()) : new BasicEList.FastCompare<E>(collection.size()); for (E object : this) { if (collection.contains(object)) { filteredResult.add(object); } } return filteredResult; } }
iterators = new BasicEList.FastCompare<EOperation>( OCLStandardLibraryImpl.getExistingOperations(this)); iterators = OCLStandardLibraryImpl.selectIterators(iterators);
operations = new BasicEList.FastCompare<EOperation>( OCLStandardLibraryImpl.getExistingOperations(this)); operations.removeAll(oclIterators());
/** * Parses the input as a PackageDeclarationCS. * * @param constraints * @return the parsed constraints (as many as could be parsed) */ public List<CT> parsePackageDeclarationCS(List<CT> constraints) { CSTNode cstNode = parseConcreteSyntax(); if ((cstNode != null) && !(cstNode instanceof PackageDeclarationCS)) { ERROR(cstNode, "parsePackageDeclarationCS",//$NON-NLS-1$ OCLMessages.bind(OCLMessages.ParseCSTNodeType_ERROR_, "PackageDeclarationCS",//$NON-NLS-1$ cstNode.eClass().getName())); return sanitize(constraints); } List<PackageDeclarationCS> packageDecls = new BasicEList.FastCompare<PackageDeclarationCS>( 4); // reverse the chain of package declarations to process them in the // forward order PackageDeclarationCS pkgdecl = (PackageDeclarationCS) cstNode; while (pkgdecl != null) { packageDecls.add(0, pkgdecl); pkgdecl = pkgdecl.getPackageDeclarationCS(); } for (PackageDeclarationCS packageDeclCS : packageDecls) { packageDeclarationCS(packageDeclCS, constraints); } return sanitize(constraints); }
/** * Parses the input as a PackageDeclarationCS. * * @param constraints * @return the parsed constraints (as many as could be parsed) */ public List<CT> parsePackageDeclarationCS(List<CT> constraints) { CSTNode cstNode = parseConcreteSyntax(); if ((cstNode != null) && !(cstNode instanceof PackageDeclarationCS)) { ERROR(cstNode, "parsePackageDeclarationCS",//$NON-NLS-1$ OCLMessages.bind(OCLMessages.ParseCSTNodeType_ERROR_, "PackageDeclarationCS",//$NON-NLS-1$ cstNode.eClass().getName())); return sanitize(constraints); } List<PackageDeclarationCS> packageDecls = new BasicEList.FastCompare<PackageDeclarationCS>( 4); // reverse the chain of package declarations to process them in the // forward order PackageDeclarationCS pkgdecl = (PackageDeclarationCS) cstNode; while (pkgdecl != null) { packageDecls.add(0, pkgdecl); pkgdecl = pkgdecl.getPackageDeclarationCS(); } for (PackageDeclarationCS packageDeclCS : packageDecls) { packageDeclarationCS(packageDeclCS, constraints); } return sanitize(constraints); }
public List<State> getStates(Classifier owner, List<String> pathPrefix) { EList<State> result = new BasicEList.FastCompare<State>(); collectStates(owner, pathPrefix, result); // search supertypes for (Classifier general : owner.allParents()) { collectStates(general, pathPrefix, result); } // now, filter out redefinitions, in case our prefix match found // states that are redefined by other matches (as an instance of the // owner type cannot be in a state that is redefined by a more // specific state) Set<State> redefinitions = new java.util.HashSet<State>(); for (State s : result) { State redef = s.getRedefinedState(); while (redef != null) { redefinitions.add(redef); redef = redef.getRedefinedState(); } } result.removeAll(redefinitions); return result; }
@Override protected void addProxy(EObject proxy, EObject context) { if (proxy.eIsProxy()) { if (proxyMap == null) { proxyMap = createHashMap(); } Resource resource = context.eResource(); if (resource != null) { addAdapter(resource); } URI uri = normalizeURI(((InternalEObject) proxy).eProxyURI(), resource); List<EObject> proxies = proxyMap.get(uri); if (proxies == null) { proxyMap.put(uri, proxies = new BasicEList.FastCompare<EObject>()); } proxies.add(proxy); } }
/** * Creates a collection value for the specified feature. The collection type * is arbitrary if the feature is not multi-valued (but in a context where a * collection is needed for computation). * * @param feature * a feature (property, operation, etc.) * @return a collection to store its value */ private Collection<Object> createCollection(Feature feature) { CollectionKind kind = getCollectionKind(feature); if (kind != null) { return CollectionUtil.createNewCollection(kind); } else { // doesn't matter the collection type return new BasicEList.FastCompare<Object>(); } }
/** * Selects from the specified operations those that are collection iterators. * * @param operations operations * @return the subset that are stereotyped as iterators */ public static EList<EOperation> selectIterators(Collection<EOperation> operations) { EList<EOperation> result = new BasicEList.FastCompare<EOperation>(); for (EOperation oper : operations) { EAnnotation ann = oper.getEAnnotation(Environment.OCL_NAMESPACE_URI); if ((ann != null) && "iterator".equals(ann.getDetails().get( //$NON-NLS-1$ "keywords"))) { //$NON-NLS-1$ result.add(oper); } } return result; } }
@Override protected void addProxy(EObject proxy, EObject context) { if (proxy.eIsProxy()) { if (proxyMap == null) { proxyMap = createHashMap(); } Resource resource = context.eResource(); if (resource != null) { addAdapter(resource); } URI uri = normalizeURI(((InternalEObject) proxy).eProxyURI(), resource); List<EObject> proxies = proxyMap.get(uri); if (proxies == null) { proxyMap.put(uri, proxies = new BasicEList.FastCompare<EObject>()); } proxies.add(proxy); } }
/** * <i>Foreign method</i> for the <tt>getAllReceptions()</tt> query that * is missing from the UML metamodel. * * @param clazz a UML class * * @return the receptions that it defines and/or inherits */ public static List<Reception> getAllReceptions(Class clazz) { List<Reception> result = new BasicEList.FastCompare<Reception>(); for (NamedElement m : getInheritedMembers(clazz)) { if (m instanceof Reception) { result.add((Reception) m); } } return result; }
/** * Selects from the specified operations those that are collection iterators. * * @param operations operations * @return the subset that are stereotyped as iterators */ public static EList<Operation> selectIterators(Collection<Operation> operations) { EList<Operation> result = new BasicEList.FastCompare<Operation>(); for (Operation oper : operations) { if (oper.hasKeyword(ITERATOR_KEYWORD)) { result.add(oper); } } return result; }
/** * @generated NOT */ public EList<Operation> oclIterators() { if (iterators == null) { maybeInitializeOwnedOperations(); iterators = new BasicEList.FastCompare<Operation>( getOwnedOperations()); iterators = OCLStandardLibraryImpl.selectIterators(iterators); } return iterators; }
protected void finalizeChange(ResourceChange change) { EList<Object> oldList = new BasicEList.FastCompare<Object>(change.getResource().getContents()); EList<?> newList = change.getValue(); change.getListChanges().clear(); createListChanges(oldList, newList, change.getListChanges()); }
/** * This implementation returns a copy of the {@link #getContents() contents}. * It is called by {@link #unload()} to initialize the value of {@link #unloadingContents}. * Clients populating the resource's contents on-demand * can override this implementation to return an empty list * when the resource's contents have not been accessed before the request to unload. * @since 2.11 */ protected List<EObject> getUnloadingContents() { return new BasicEList.FastCompare<EObject>(getContents()); }
/** * @generated NOT */ public EList<Operation> oclOperations() { if (operations == null) { maybeInitializeOwnedOperations(); operations = new BasicEList.FastCompare<Operation>( getOwnedOperations()); operations.removeAll(oclIterators()); } return operations; }
protected void finalizeChange(ResourceChange change) { EList<Object> oldList = new BasicEList.FastCompare<Object>(change.getResource().getContents()); EList<?> newList = change.getValue(); change.getListChanges().clear(); createListChanges(oldList, newList, change.getListChanges()); }
/** * This implementation returns a copy of the {@link #getContents() contents}. * It is called by {@link #unload()} to initialize the value of {@link #unloadingContents}. * Clients populating the resource's contents on-demand * can override this implementation to return an empty list * when the resource's contents have not been accessed before the request to unload. * @since 2.11 */ protected List<EObject> getUnloadingContents() { return new BasicEList.FastCompare<EObject>(getContents()); }