Java Code Examples for org.eclipse.emf.common.util.EList

The following examples show how to use org.eclipse.emf.common.util.EList. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated
 */
@Override
public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException {
    switch (operationID) {
        case ModelPackage.MBRICKLET_REMOTE_SWITCH___ADD_SUB_DEVICE__STRING_STRING:
            addSubDevice((String) arguments.get(0), (String) arguments.get(1));
            return null;
        case ModelPackage.MBRICKLET_REMOTE_SWITCH___INIT_SUB_DEVICES:
            initSubDevices();
            return null;
        case ModelPackage.MBRICKLET_REMOTE_SWITCH___INIT:
            init();
            return null;
        case ModelPackage.MBRICKLET_REMOTE_SWITCH___ENABLE:
            enable();
            return null;
        case ModelPackage.MBRICKLET_REMOTE_SWITCH___DISABLE:
            disable();
            return null;
    }
    return super.eInvoke(operationID, arguments);
}
 
Example 2
Source Project: bonita-studio   Source File: InstanceImpl.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Get the value of an instance's attribute
 *
 * @param <V>
 * @param attribute
 * @return Value
 */
@SuppressWarnings("unchecked")
private <V> V getAttributeValue(EAttribute attribute) {
    final Slot slot = getSlot(attribute);
    if (slot == null) {
        if (attribute.isMany()) {
            return (V) new UpdatingList(this, attribute);
        } else if (attribute.getEType().getInstanceClass() != null
                && Collection.class.isAssignableFrom(attribute.getEType().getInstanceClass())) {//Patch for Notation model
            return (V) new UpdatingList(this, attribute);
        } else if (attribute.getDefaultValue() != null) {
            return (V) attribute.getDefaultValue();
        }
        return null;
    }
    final EList<Object> values = new UpdatingList(this, attribute,
            ((AttributeSlot) slot).getValues());
    if (attribute.isMany()) {
        return (V) values;
    } else if (!values.isEmpty()) {
        return (V) values.get(0);
    }
    return null;
}
 
Example 3
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated
 */
@Override
public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException {
    switch (operationID) {
        case ModelPackage.ROTARY_ENCODER_BUTTON___FETCH_SENSOR_VALUE:
            fetchSensorValue();
            return null;
        case ModelPackage.ROTARY_ENCODER_BUTTON___INIT:
            init();
            return null;
        case ModelPackage.ROTARY_ENCODER_BUTTON___ENABLE:
            enable();
            return null;
        case ModelPackage.ROTARY_ENCODER_BUTTON___DISABLE:
            disable();
            return null;
    }
    return super.eInvoke(operationID, arguments);
}
 
Example 4
Source Project: n4js   Source File: ASTGraphProvider.java    License: Eclipse Public License 1.0 6 votes vote down vote up
/**
 * @param eobj
 *            will be non-null and not a proxy
 * @return may return null
 */
private String getName(EObject eobj) {
	if (eobj != null) {
		// use reflection (or duck typing) to obtain the name
		EList<EAttribute> eAllAttributes = eobj.eClass().getEAllAttributes();
		for (EAttribute attr : eAllAttributes) {
			if ("name".equals(attr.getName())) {
				final Object value = eobj.eGet(attr, false);
				if (value instanceof String) {
					return (String) value;
				}
			}
		}
	}
	return null;
}
 
Example 5
Source Project: openhab1-addons   Source File: VCDevicePowerImpl.java    License: Eclipse Public License 2.0 6 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated
 */
@Override
public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException {
    switch (operationID) {
        case ModelPackage.VC_DEVICE_POWER___INIT:
            init();
            return null;
        case ModelPackage.VC_DEVICE_POWER___ENABLE:
            enable();
            return null;
        case ModelPackage.VC_DEVICE_POWER___DISABLE:
            disable();
            return null;
        case ModelPackage.VC_DEVICE_POWER___FETCH_SENSOR_VALUE:
            fetchSensorValue();
            return null;
    }
    return super.eInvoke(operationID, arguments);
}
 
Example 6
@Test
public void testParserRuleFragment_02() throws Exception {
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("grammar test with org.eclipse.xtext.common.Terminals");
  _builder.newLine();
  _builder.append("generate test \'http://test\'");
  _builder.newLine();
  _builder.append("MyRule: IntFeatureHolder;");
  _builder.newLine();
  _builder.append("fragment IntFeatureHolder: myFeature=INT;");
  _builder.newLine();
  final String grammar = _builder.toString();
  EPackage ePackage = this.getEPackageFromGrammar(grammar);
  final EList<EClassifier> classifiers = ePackage.getEClassifiers();
  Assert.assertEquals(2, classifiers.size());
  final EClassifier myRuleType = IterableExtensions.<EClassifier>head(classifiers);
  Assert.assertEquals("MyRule", myRuleType.getName());
  Assert.assertTrue(this.features(myRuleType).isEmpty());
  final EClassifier intFeatureHolder = IterableExtensions.<EClassifier>last(classifiers);
  Assert.assertEquals("EInt", this.<EStructuralFeature>feature(intFeatureHolder, "myFeature").getEType().getName());
  Assert.assertTrue(this.superTypes(myRuleType).contains(intFeatureHolder));
}
 
Example 7
private List<String> findAllErrorHandlerIds(ProcessType pt){
	List<String> errorHandlers = new ArrayList<String>();
	for(Object o: pt.getNode()){
		if(!(o instanceof NodeType)){
			continue;
		}
		NodeType nt = (NodeType) o; 
		if(!"cErrorHandler".equals(nt.getComponentName())){
			continue;
		}
		EList elementParameter = nt.getElementParameter();
		for(Object e: elementParameter){
			if(!(e instanceof ElementParameterType)){
				continue;
			}
			ElementParameterType ept = (ElementParameterType) e;
			if("UNIQUE_NAME".equals(ept.getName())){
				errorHandlers.add(ept.getValue());
			}
		}
	}
	return errorHandlers;
}
 
Example 8
Source Project: neoscada   Source File: OptionsImpl.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public EList<EventPool> getEventPools ()
{
    if ( eventPools == null )
    {
        eventPools = new EObjectContainmentEList.Resolving<EventPool> ( EventPool.class, this, InfrastructurePackage.OPTIONS__EVENT_POOLS );
    }
    return eventPools;
}
 
Example 9
Source Project: bonita-studio   Source File: TActivityImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public EList<TProperty> getProperty() {
	if (property == null) {
		property = new EObjectContainmentEList<TProperty>(TProperty.class, this, ModelPackage.TACTIVITY__PROPERTY);
	}
	return property;
}
 
Example 10
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public EList<UnknownStatement> getErrormunknownstatements()
{
  if (errormunknownstatements == null)
  {
    errormunknownstatements = new EObjectContainmentEList<UnknownStatement>(UnknownStatement.class, this, YangPackage.ERROR_MESSAGE_STATEMENT__ERRORMUNKNOWNSTATEMENTS);
  }
  return errormunknownstatements;
}
 
Example 11
/**
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * 
 * @generated
 */
@Override
public EList<BusinessIdentifier> getIdentifiers() {
	if (identifiers == null) {
		identifiers = new EObjectContainmentWithInverseEList<BusinessIdentifier>(BusinessIdentifier.class, this,
				BusinessModelPackage.BUSINESS_MODEL__IDENTIFIERS, BusinessModelPackage.BUSINESS_IDENTIFIER__MODEL);
	}
	return identifiers;
}
 
Example 12
Source Project: neoscada   Source File: ProfileImpl.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public EList<Controller> getControllers ()
{
    if ( controllers == null )
    {
        controllers = new EObjectContainmentEList.Resolving<Controller> ( Controller.class, this, ChartPackage.PROFILE__CONTROLLERS );
    }
    return controllers;
}
 
Example 13
Source Project: n4js   Source File: DocletDescriptionParserTest.java    License: Eclipse Public License 1.0 5 votes vote down vote up
@SuppressWarnings("javadoc")
@Test
public void testDescriptionWithUnknownInlineTag() {
	String in = "/** This is the description with {@unkonwnInlineTag parsed as text} ..and finish description. \n */";
	AbstractInlineTagDefinition inlineTag = new StubInlineTagDefinition("inline");
	DocletParser docletParser = new DocletParser(null, new TagDictionary<>(Arrays.asList(inlineTag)));

	Doclet doclet = docletParser.parse(in);

	EList<ContentNode> contents = doclet.getContents();
	Text descr = (Text) contents.get(0);
	assertEquals("This is the description with {@unkonwnInlineTag parsed as text} ..and finish description.",
			descr.getText());
}
 
Example 14
Source Project: bonita-studio   Source File: GroupImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
    * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
    * @generated
    */
@Override
public EList<WidgetDependency> getDependOn() {
       if (dependOn == null) {
           dependOn = new EObjectContainmentEList<WidgetDependency>(WidgetDependency.class, this, FormPackage.GROUP__DEPEND_ON);
       }
       return dependOn;
   }
 
Example 15
Source Project: birt   Source File: SampleDataImpl.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated
 */
public EList<OrthogonalSampleData> getOrthogonalSampleData( )
{
	if ( orthogonalSampleData == null )
	{
		orthogonalSampleData = new EObjectContainmentEList<OrthogonalSampleData>( OrthogonalSampleData.class,
				this,
				DataPackage.SAMPLE_DATA__ORTHOGONAL_SAMPLE_DATA );
	}
	return orthogonalSampleData;
}
 
Example 16
Source Project: n4js   Source File: TypeUtils.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates a new union type with the given elements. The elements are copied if they have a container. The created
 * union type may contain duplicates or nested union types, that is, it is not simplified! Thus, the returned type
 * is expected to be processed further!
 *
 * @see org.eclipse.n4js.typesystem.N4JSTypeSystem#createSimplifiedUnion(List, Resource)
 * @see org.eclipse.n4js.typesystem.TypeSystemHelper#simplify(RuleEnvironment, ComposedTypeRef)
 */
@SuppressWarnings("javadoc")
public static UnionTypeExpression createNonSimplifiedUnionType(Iterable<? extends TypeRef> elements) {
	UnionTypeExpression unionType = TypeRefsFactory.eINSTANCE.createUnionTypeExpression();
	EList<TypeRef> unionElements = unionType.getTypeRefs();

	for (TypeRef e : elements) {
		unionElements.add(TypeUtils.copyIfContained(e));
	}
	return unionType;
}
 
Example 17
/**
    * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
    * @generated
    */
@Override
public EList<String> getIncludedEntries() {
       if (includedEntries == null) {
           includedEntries = new EDataTypeUniqueEList<String>(String.class, this, ProcessPackage.MAIN_PROCESS__INCLUDED_ENTRIES);
       }
       return includedEntries;
   }
 
Example 18
Source Project: neoscada   Source File: MasterItemCreatorImpl.java    License: Eclipse Public License 1.0 5 votes vote down vote up
private static void fillProperties ( final Properties properties, final EList<PropertyEntry> entries )
{
    for ( final PropertyEntry pe : entries )
    {
        properties.put ( pe.getKey (), pe.getValue () );
    }
}
 
Example 19
Source Project: neoscada   Source File: ProxyItemImpl.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public EList<Item> getItems ()
{
    if ( items == null )
    {
        items = new EObjectResolvingEList<Item> ( Item.class, this, OsgiPackage.PROXY_ITEM__ITEMS );
    }
    return items;
}
 
Example 20
Source Project: n4js   Source File: InlineTagImpl.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public EList<TagValue> getValues() {
	if (values == null) {
		values = new EObjectContainmentEList<TagValue>(TagValue.class, this, DomPackage.INLINE_TAG__VALUES);
	}
	return values;
}
 
Example 21
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public EList<TRendering> getRendering() {
	if (rendering == null) {
		rendering = new EObjectContainmentEList<TRendering>(TRendering.class, this, ModelPackage.TGLOBAL_USER_TASK__RENDERING);
	}
	return rendering;
}
 
Example 22
@Override
public void migrateBefore(final Model model, final Metamodel metamodel) throws MigrationException {
    final EList<Instance> documents = model.getAllInstances("process.Document");
    for (final Instance inst : documents) {
        final Integer documentType = retrieveNewDocumentType(inst);
        list.put(inst.getUuid(), documentType);
    }
}
 
Example 23
Source Project: bonita-studio   Source File: RolesImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
    * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
    * @generated
    */
public EList<Role> getRole() {
       if (role == null) {
           role = new EObjectContainmentEList<Role>(Role.class, this, OrganizationPackage.ROLES__ROLE);
       }
       return role;
   }
 
Example 24
Source Project: nebula   Source File: Track.java    License: Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated
 */
@Override
public EList<ILane> getLanes() {
	if (lanes == null) {
		lanes = new EObjectContainmentWithInverseEList<ILane>(ILane.class, this, ITimelinePackage.TRACK__LANES, ITimelinePackage.LANE__TRACK);
	}
	return lanes;
}
 
Example 25
Source Project: birt   Source File: SeriesGroupingImpl.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public EList<String> getAggregateParameters( )
{
	if ( aggregateParameters == null )
	{
		aggregateParameters = new EDataTypeEList<String>( String.class,
				this,
				DataPackage.SERIES_GROUPING__AGGREGATE_PARAMETERS );
	}
	return aggregateParameters;
}
 
Example 26
public void process(EList<Double> coordinates) {
	for (int i=0; i<coordinates.size(); i++) {
		Double value = coordinates.get(i);
		if (value < min[i]) {
			min[i] = value;
		}
		if (value > max[i]) {
			max[i] = value;
		}
	}
}
 
Example 27
Source Project: bonita-studio   Source File: ActivityImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
    * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
    * @generated
    */
@Override
public EList<AbstractKPIBinding> getKpis() {
       if (kpis == null) {
           kpis = new EObjectContainmentEList<AbstractKPIBinding>(AbstractKPIBinding.class, this, ProcessPackage.ACTIVITY__KPIS);
       }
       return kpis;
   }
 
Example 28
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public EList<SuperTypeArgumentList> getArgumentList() {
	if (argumentList == null) {
		argumentList = new EObjectContainmentEList<SuperTypeArgumentList>(SuperTypeArgumentList.class, this, SolidityPackage.CONTRACT_DEFINITION__ARGUMENT_LIST);
	}
	return argumentList;
}
 
Example 29
@Override
protected void createCodeMinings(IDocument document, XtextResource resource, CancelIndicator indicator,
	IAcceptor<? super ICodeMining> acceptor) throws BadLocationException {

	EList<EObject> contents = resource.getContents();
	if (contents.isEmpty()) {
		return;
	}

	// get all evaluations contained by the open document
	List<Evaluation> allEvaluations = EcoreUtil2.eAllOfType(contents.get(0), Evaluation.class);

	// get keyword for ';'
	Keyword semicolon = grammar.getEvaluationAccess().getSemicolonKeyword_1();

	for (Evaluation evaluation : allEvaluations) {
		ICompositeNode node = NodeModelUtils.findActualNodeFor(evaluation);
		for (Iterator<INode> it = node.getAsTreeIterable().iterator(); it.hasNext();) {
			INode child = it.next();
			if (semicolon.equals(child.getGrammarElement())) {
				int annotationOffset = child.getTotalOffset();
				String annotationText = getAnnotationText(evaluation);
				acceptor.accept(createNewLineContentCodeMining(annotationOffset, annotationText));
			}
		}
	}
}
 
Example 30
Source Project: xtext-eclipse   Source File: StateImpl.java    License: Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public EList<Transition> getTransitions()
{
  if (transitions == null)
  {
    transitions = new EObjectContainmentEList<Transition>(Transition.class, this, StatemachinePackage.STATE__TRANSITIONS);
  }
  return transitions;
}