Search in sources :

Example 1 with GraalUsageCrossReferencer

use of org.obeonetwork.graal.util.GraalUsageCrossReferencer in project InformationSystem by ObeoNetwork.

the class TaskImpl method getUsedBy.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated NOT
 */
public EList<Task> getUsedBy() {
    Collection<Setting> usingTasksSettings = new GraalUsageCrossReferencer() {

        @Override
        protected boolean crossReference(EObject eObject, EReference eReference, EObject crossReferencedEObject) {
            return eReference == GraalPackage.Literals.TASK__USES;
        }

        @Override
        protected boolean containment(EObject eObject) {
            // (We use Resource instead of CDOResource to avoid dependency on CDO)
            return (eObject instanceof Resource) || (eObject instanceof System) || (eObject instanceof TasksGroup) || (eObject instanceof Task);
        }
    }.findUsage(this);
    List<Task> foundTasks = new ArrayList<Task>();
    for (Setting setting : usingTasksSettings) {
        foundTasks.add((Task) setting.getEObject());
    }
    return ECollections.unmodifiableEList(new BasicEList<Task>(foundTasks));
}
Also used : AbstractTask(org.obeonetwork.graal.AbstractTask) Task(org.obeonetwork.graal.Task) Setting(org.eclipse.emf.ecore.EStructuralFeature.Setting) GraalUsageCrossReferencer(org.obeonetwork.graal.util.GraalUsageCrossReferencer) Resource(org.eclipse.emf.ecore.resource.Resource) ArrayList(java.util.ArrayList) System(org.obeonetwork.graal.System) TasksGroup(org.obeonetwork.graal.TasksGroup) EObject(org.eclipse.emf.ecore.EObject) EReference(org.eclipse.emf.ecore.EReference)

Example 2 with GraalUsageCrossReferencer

use of org.obeonetwork.graal.util.GraalUsageCrossReferencer in project InformationSystem by ObeoNetwork.

the class AbstractTaskImpl method getUseCase.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated NOT
 */
public UseCase getUseCase() {
    Collection<Setting> useCaseReferences = new GraalUsageCrossReferencer() {

        @Override
        protected boolean crossReference(EObject eObject, EReference eReference, EObject crossReferencedEObject) {
            return eReference == GraalPackage.Literals.USE_CASE__TASKS;
        }

        @Override
        protected boolean containment(EObject eObject) {
            // (We use Resource instead of CDOResource to avoid dependency on CDO)
            return (eObject instanceof Resource) || (eObject instanceof System) || (eObject instanceof UseCase);
        }
    }.findUsage(this);
    UseCase useCase = null;
    for (Setting setting : useCaseReferences) {
        useCase = (UseCase) setting.getEObject();
        break;
    }
    return useCase;
}
Also used : Setting(org.eclipse.emf.ecore.EStructuralFeature.Setting) EObject(org.eclipse.emf.ecore.EObject) GraalUsageCrossReferencer(org.obeonetwork.graal.util.GraalUsageCrossReferencer) Resource(org.eclipse.emf.ecore.resource.Resource) UseCase(org.obeonetwork.graal.UseCase) EReference(org.eclipse.emf.ecore.EReference) System(org.obeonetwork.graal.System)

Example 3 with GraalUsageCrossReferencer

use of org.obeonetwork.graal.util.GraalUsageCrossReferencer in project InformationSystem by ObeoNetwork.

the class TaskImpl method getReferencedBy.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated NOT
 */
public EList<TaskReference> getReferencedBy() {
    Collection<Setting> referencingTasksReferences = new GraalUsageCrossReferencer() {

        @Override
        protected boolean crossReference(EObject eObject, EReference eReference, EObject crossReferencedEObject) {
            return eReference == GraalPackage.Literals.TASK_REFERENCE__TASK;
        }

        @Override
        protected boolean containment(EObject eObject) {
            // (We use Resource instead of CDOResource to avoid dependency on CDO)
            return (eObject instanceof Resource) || (eObject instanceof System) || (eObject instanceof TasksGroup) || (eObject instanceof Task) || (eObject instanceof Loop) || (eObject instanceof TaskReference);
        }
    }.findUsage(this);
    List<TaskReference> foundTasksReferences = new ArrayList<TaskReference>();
    for (Setting setting : referencingTasksReferences) {
        foundTasksReferences.add((TaskReference) setting.getEObject());
    }
    return ECollections.unmodifiableEList(new BasicEList<TaskReference>(foundTasksReferences));
}
Also used : Loop(org.obeonetwork.graal.Loop) AbstractTask(org.obeonetwork.graal.AbstractTask) Task(org.obeonetwork.graal.Task) Setting(org.eclipse.emf.ecore.EStructuralFeature.Setting) GraalUsageCrossReferencer(org.obeonetwork.graal.util.GraalUsageCrossReferencer) Resource(org.eclipse.emf.ecore.resource.Resource) ArrayList(java.util.ArrayList) System(org.obeonetwork.graal.System) TaskReference(org.obeonetwork.graal.TaskReference) TasksGroup(org.obeonetwork.graal.TasksGroup) EObject(org.eclipse.emf.ecore.EObject) EReference(org.eclipse.emf.ecore.EReference)

Example 4 with GraalUsageCrossReferencer

use of org.obeonetwork.graal.util.GraalUsageCrossReferencer in project InformationSystem by ObeoNetwork.

the class TaskImpl method getUseCase.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated NOT
 */
public UseCase getUseCase() {
    Collection<Setting> useCaseReferences = new GraalUsageCrossReferencer() {

        @Override
        protected boolean crossReference(EObject eObject, EReference eReference, EObject crossReferencedEObject) {
            return eReference == GraalPackage.Literals.USE_CASE__TASKS;
        }

        @Override
        protected boolean containment(EObject eObject) {
            // (We use Resource instead of CDOResource to avoid dependency on CDO)
            return (eObject instanceof Resource) || (eObject instanceof System) || (eObject instanceof UseCase);
        }
    }.findUsage(this);
    UseCase useCase = null;
    for (Setting setting : useCaseReferences) {
        useCase = (UseCase) setting.getEObject();
        break;
    }
    return useCase;
}
Also used : Setting(org.eclipse.emf.ecore.EStructuralFeature.Setting) EObject(org.eclipse.emf.ecore.EObject) GraalUsageCrossReferencer(org.obeonetwork.graal.util.GraalUsageCrossReferencer) Resource(org.eclipse.emf.ecore.resource.Resource) UseCase(org.obeonetwork.graal.UseCase) EReference(org.eclipse.emf.ecore.EReference) System(org.obeonetwork.graal.System)

Aggregations

EObject (org.eclipse.emf.ecore.EObject)4 EReference (org.eclipse.emf.ecore.EReference)4 Setting (org.eclipse.emf.ecore.EStructuralFeature.Setting)4 Resource (org.eclipse.emf.ecore.resource.Resource)4 System (org.obeonetwork.graal.System)4 GraalUsageCrossReferencer (org.obeonetwork.graal.util.GraalUsageCrossReferencer)4 ArrayList (java.util.ArrayList)2 AbstractTask (org.obeonetwork.graal.AbstractTask)2 Task (org.obeonetwork.graal.Task)2 TasksGroup (org.obeonetwork.graal.TasksGroup)2 UseCase (org.obeonetwork.graal.UseCase)2 Loop (org.obeonetwork.graal.Loop)1 TaskReference (org.obeonetwork.graal.TaskReference)1