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

The following examples show how to use org.eclipse.emf.common.util.EList. 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 check out the related API usage on the sidebar.
Example #1
Source File: RotaryEncoderButtonImpl.java    From openhab1-addons with 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.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 #2
Source File: InstanceImpl.java    From bonita-studio with 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
Source File: ASTGraphProvider.java    From n4js with 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 #4
Source File: VCDevicePowerImpl.java    From openhab1-addons with 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 #5
Source File: DisconnectErroHandlerMigrationTask.java    From tesb-studio-se with Apache License 2.0 6 votes vote down vote up
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 #6
Source File: MBrickletRemoteSwitchImpl.java    From openhab1-addons with 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.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 #7
Source File: Xtext2EcoreTransformerTest.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@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 #8
Source File: ErrorMessageStatementImpl.java    From yang-design-studio with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * <!-- 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 #9
Source File: TActivityImpl.java    From bonita-studio with 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
Source File: MainProcessImpl.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
    * <!-- 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 #11
Source File: TGlobalUserTaskImpl.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <!-- 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 #12
Source File: DocumentTypeMigration.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@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 #13
Source File: RolesImpl.java    From bonita-studio with 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 #14
Source File: Track.java    From nebula with 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 #15
Source File: SeriesGroupingImpl.java    From birt with 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 #16
Source File: AxisAlignedBoundingBox3D.java    From BIMserver with GNU Affero General Public License v3.0 5 votes vote down vote up
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 #17
Source File: ActivityImpl.java    From bonita-studio with 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 #18
Source File: ContractDefinitionImpl.java    From solidity-ide with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * <!-- 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 #19
Source File: ArithmeticsCodeMiningProvider.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@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 #20
Source File: StateImpl.java    From xtext-eclipse with 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;
}
 
Example #21
Source File: RailroadSynchronizer.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
private IFigure createFigure(XtextResource state) {
	EList<EObject> contents = state.getContents();
	if (!contents.isEmpty()) {
		EObject rootObject = contents.get(0);
		return transformer.transform(rootObject);
	}
	return null;
}
 
Example #22
Source File: IntermediateCatchSignalEventImpl.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
    * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
    * @generated
    */
@Override
public EList<TextAnnotationAttachment> getTextAnnotationAttachment() {
       if (textAnnotationAttachment == null) {
           textAnnotationAttachment = new EObjectContainmentWithInverseEList<TextAnnotationAttachment>(TextAnnotationAttachment.class, this, ProcessPackage.INTERMEDIATE_CATCH_SIGNAL_EVENT__TEXT_ANNOTATION_ATTACHMENT, ProcessPackage.TEXT_ANNOTATION_ATTACHMENT__TARGET);
       }
       return textAnnotationAttachment;
   }
 
Example #23
Source File: ErrorTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testErrorModel_006() throws Exception {
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("@Data class A {}");
  _builder.newLine();
  _builder.append("@");
  _builder.newLine();
  final XtendFile file = this.processWithoutException(_builder);
  final XtendTypeDeclaration typeDeclaration = IterableExtensions.<XtendTypeDeclaration>last(file.getXtendTypes());
  final EList<XAnnotation> annotations = typeDeclaration.getAnnotations();
  final IResolvedTypes resolvedTypes = this.typeResolver.resolveTypes(IterableExtensions.<XAnnotation>head(annotations));
  Assert.assertNotNull(resolvedTypes.getActualType(IterableExtensions.<XAnnotation>head(annotations)));
}
 
Example #24
Source File: ModelImpl.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public EList<ModelElement> getRefs()
{
  if (refs == null)
  {
    refs = new EObjectContainmentEList<ModelElement>(ModelElement.class, this, Bug289524TestPackage.MODEL__REFS);
  }
  return refs;
}
 
Example #25
Source File: SubModuleImpl.java    From yang-design-studio with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public EList<SubmoduleStatement> getStatements()
{
  if (statements == null)
  {
    statements = new EObjectContainmentEList<SubmoduleStatement>(SubmoduleStatement.class, this, YangPackage.SUB_MODULE__STATEMENTS);
  }
  return statements;
}
 
Example #26
Source File: CompositePipelineImpl.java    From neoscada with Eclipse Public License 1.0 5 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 ItemPackage.COMPOSITE_PIPELINE___CUSTOMIZE__CUSTOMIZATIONREQUEST:
            customize ( (CustomizationRequest)arguments.get ( 0 ) );
            return null;
    }
    return super.eInvoke ( operationID, arguments );
}
 
Example #27
Source File: DocletElementImpl.java    From n4js with Eclipse Public License 1.0 5 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 DomPackage.DOCLET_ELEMENT___SET_RANGE__INT_INT:
			setRange((Integer)arguments.get(0), (Integer)arguments.get(1));
			return null;
		case DomPackage.DOCLET_ELEMENT___COVERS__INT:
			return covers((Integer)arguments.get(0));
	}
	return super.eInvoke(operationID, arguments);
}
 
Example #28
Source File: IntermediateCatchMessageEventImpl.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
    * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
    * @generated
    */
@Override
public EList<Data> getData() {
       if (data == null) {
           data = new EObjectContainmentEList<Data>(Data.class, this, ProcessPackage.INTERMEDIATE_CATCH_MESSAGE_EVENT__DATA);
       }
       return data;
   }
 
Example #29
Source File: ParameterizedTypeRefStructural_IMImpl.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public EList<TStructMember> getAstStructuralMembers() {
	if (astStructuralMembers == null) {
		astStructuralMembers = new EObjectContainmentEList<TStructMember>(TStructMember.class, this, ImPackage.PARAMETERIZED_TYPE_REF_STRUCTURAL_IM__AST_STRUCTURAL_MEMBERS);
	}
	return astStructuralMembers;
}
 
Example #30
Source File: IndexedAccessExpressionImpl.java    From n4js with Eclipse Public License 1.0 5 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 N4JSPackage.INDEXED_ACCESS_EXPRESSION___IS_VALID_SIMPLE_ASSIGNMENT_TARGET:
			return isValidSimpleAssignmentTarget();
	}
	return super.eInvoke(operationID, arguments);
}