/** @generated */ protected void set(SampleData src) { // children if (src.getBaseSampleData() != null) { EList<BaseSampleData> list = getBaseSampleData(); for (BaseSampleData element : src.getBaseSampleData()) { list.add(element.copyInstance()); } } if (src.getOrthogonalSampleData() != null) { EList<OrthogonalSampleData> list = getOrthogonalSampleData(); for (OrthogonalSampleData element : src.getOrthogonalSampleData()) { list.add(element.copyInstance()); } } if (src.getAncillarySampleData() != null) { EList<BaseSampleData> list = getAncillarySampleData(); for (BaseSampleData element : src.getAncillarySampleData()) { list.add(element.copyInstance()); } } }
/** Collapse edit part */ private void collapseEditPart() { final Set<ConnectionEditPart> childrenConnections = getChildrenConnections(); final Set<ConnectionEditPart> outsideConnections = excludeInternConnections(childrenConnections); final Set<ConnectionEditPart> edges = filterForDependencyConstraints(outsideConnections); for (final ConnectionEditPart outConnection : edges) { final EdgeImpl edge = (EdgeImpl) outConnection.getModel(); // it's for undo/redo operations if (outConnection.getSource().getModel() != edge.getSource() || outConnection.getTarget().getModel() != edge.getTarget()) { return; } if (compartmentChildren.contains(outConnection.getSource())) { // readjust connection and update original source history // readjust at source edge.setSource((ShapeImpl) editPartOfCompartment.getModel()); final Connection con = (Connection) edge.getElement(); con.setTemp(true); final EList<Shape> oSources = con.getOriginalSource(); oSources.add(con.getSource()); con.setSource((Shape) ((ShapeImpl) editPartOfCompartment.getModel()).getElement()); } else { // readjust at target edge.setTarget((ShapeImpl) editPartOfCompartment.getModel()); final Connection con = (Connection) edge.getElement(); con.setTemp(true); final EList<Shape> oTargets = con.getOriginalTarget(); oTargets.add(con.getTarget()); con.setTarget((Shape) ((ShapeImpl) editPartOfCompartment.getModel()).getElement()); } } }
@Override public void execute() { for (ScatterSet ds : scatterSets) { // ok, we may have to add it to the chartset first ChartSet charts = parent.getParent(); EList<SelectiveAnnotation> annots = charts.getSharedAxis().getAnnotations(); SelectiveAnnotation host = null; for (SelectiveAnnotation annot : annots) { if (annot.getAnnotation().getName() != null && annot.getAnnotation().getName().equals(ds.getName())) { host = annot; break; } } if (host == null) { StackedchartsFactory factory = new StackedchartsFactoryImpl(); host = factory.createSelectiveAnnotation(); host.setAnnotation(ds); annots.add(host); } // check we're not already in that chart EList<Chart> appearsIn = host.getAppearsIn(); if (!appearsIn.contains(parent)) { appearsIn.add(parent); } } }
private void addResultToList( org.emftext.sdk.concretesyntax.resource.cs.ICsReferenceMapping<ReferenceType> mapping, org.eclipse.emf.ecore.EObject proxy, org.eclipse.emf.common.util.EList<org.eclipse.emf.ecore.EObject> list) { org.eclipse.emf.ecore.EObject target = null; int proxyPosition = list.indexOf(proxy); if (mapping instanceof org.emftext.sdk.concretesyntax.resource.cs.ICsElementMapping<?>) { target = ((org.emftext.sdk.concretesyntax.resource.cs.ICsElementMapping<ReferenceType>) mapping) .getTargetElement(); } else if (mapping instanceof org.emftext.sdk.concretesyntax.resource.cs.ICsURIMapping<?>) { target = org.eclipse.emf.ecore.util.EcoreUtil.copy(proxy); org.eclipse.emf.common.util.URI uri = ((org.emftext.sdk.concretesyntax.resource.cs.ICsURIMapping<ReferenceType>) mapping) .getTargetIdentifier(); ((org.eclipse.emf.ecore.InternalEObject) target).eSetProxyURI(uri); } else { assert false; } try { // if target is an another proxy and list is "unique" add() will try to resolve // the new proxy to check for uniqueness. There seems to be no way to avoid that. // Until now this does not cause any problems. if (proxyPosition + 1 == list.size()) { list.add(target); } else { list.add(proxyPosition + 1, target); } } catch (Exception e1) { e1.printStackTrace(); } }
private void createModel() { EFactory factory = metamodelPackage.getEFactoryInstance(); netObject = factory.create(getNetClass()); place1Object = factory.create(getPlaceClass()); setName(place1Object, "place1"); setTokens(place1Object, 1); place2Object = factory.create(getPlaceClass()); setName(place2Object, "place2"); transitionObject = factory.create(getTransitionClass()); setIncoming(transitionObject, place1Object); setOutgoing(transitionObject, place2Object); EList<EObject> placesValue = new BasicEList<EObject>(); placesValue.add(place1Object); placesValue.add(place2Object); EReference placesReference = getPlacesReference(netObject.eClass()); netObject.eSet(placesReference, placesValue); EList<EObject> transitionsValue = new BasicEList<EObject>(); transitionsValue.add(transitionObject); EReference transitionsReference = getTransitionsReference(netObject.eClass()); netObject.eSet(transitionsReference, transitionsValue); }
private void createContainment( EObject eObject, EReference reference, JsonNode root, JsonNode node, Resource resource) { if (node.isArray()) { if (reference.isMany()) { @SuppressWarnings("unchecked") EList<EObject> values = (EList<EObject>) eObject.eGet(reference); for (Iterator<JsonNode> it = node.getElements(); it.hasNext(); ) { JsonNode current = it.next(); EObject contained = createContainedObject(reference, root, current, resource); if (contained != null) values.add(contained); } } else if (node.getElements().hasNext()) { JsonNode current = node.getElements().next(); EObject contained = createContainedObject(reference, root, current, resource); if (contained != null) eObject.eSet(reference, contained); } } else { EObject contained = createContainedObject(reference, root, node, resource); if (reference.isMany()) { @SuppressWarnings("unchecked") EList<EObject> values = (EList<EObject>) eObject.eGet(reference); if (contained != null) values.add(contained); } else { if (contained != null) eObject.eSet(reference, contained); } } }
public void testRemoveEqualValues() { E e = refFactory.createE(); String s0 = "0"; String s1 = "1"; String s2 = "2"; String s3 = new String(s1); EList<String> labels = e.getLabels(); labels.add(s0); labels.add(s1); labels.add(s3); labels.add(s2); labels.add(s1); Collection<String> collection = new ArrayList<String>(); collection.add(s1); collection.add(s1); collection.add(s1); Command remove = RemoveCommand.create(editingDomain, e, refPackage.getE_Labels(), collection); assertEquals(5, labels.size()); assertSame(s0, labels.get(0)); assertSame(s1, labels.get(1)); assertSame(s3, labels.get(2)); assertSame(s2, labels.get(3)); assertSame(s1, labels.get(4)); assertNotSame(s1, labels.get(2)); assertTrue(remove.canExecute()); CommandStack stack = editingDomain.getCommandStack(); stack.execute(remove); assertEquals(2, labels.size()); assertSame(s0, labels.get(0)); assertSame(s2, labels.get(1)); assertTrue(stack.canUndo()); stack.undo(); assertEquals(5, labels.size()); assertSame(s0, labels.get(0)); assertSame(s1, labels.get(1)); assertSame(s3, labels.get(2)); assertSame(s2, labels.get(3)); assertSame(s1, labels.get(4)); assertNotSame(s1, labels.get(2)); assertTrue(stack.canRedo()); stack.redo(); assertEquals(2, labels.size()); assertSame(s0, labels.get(0)); assertSame(s2, labels.get(1)); assertTrue(stack.canUndo()); }
public void rebuildInputTable( InputTable inputTable, IMetadataTable metadataTable, PigMapData mapData) { if (metadataTable != null && metadataTable.getListColumns() != null) { List<IMetadataColumn> listColumns = metadataTable.getListColumns(); EList<TableNode> nodes = inputTable.getNodes(); for (int i = 0; i < listColumns.size(); i++) { IMetadataColumn column = listColumns.get(i); TableNode found = null; int j = 0; for (; j < nodes.size(); j++) { TableNode node = nodes.get(j); if (node.getName() != null && node.getName().equals(column.getLabel())) { found = node; break; } } if (found != null) { // set in case talend type changed in metadata found.setType(column.getTalendType()); if (i != j) { // do switch to keep the same sequence TableNode temp = nodes.get(j); nodes.remove(j); nodes.add(i, temp); } } else { found = PigmapFactory.eINSTANCE.createTableNode(); found.setName(column.getLabel()); found.setType(column.getTalendType()); found.setNullable(column.isNullable()); nodes.add(i, found); } } if (nodes.size() > listColumns.size()) { List unUsed = new ArrayList(); for (int i = listColumns.size(); i < nodes.size(); i++) { PigMapUtil.detachNodeConnections(nodes.get(i), mapData); unUsed.add(nodes.get(i)); } nodes.removeAll(unUsed); } } // re-build the connections in case any unnecessary connections are created because of previous // bugs and can't // be deleted if (inputTable.isLookup()) { rebuildInputNodesConnections(inputTable.getNodes(), mapData); } }
public EList<PartialStateDescription> getSubFormulas() { EList<PartialStateDescription> result = new BasicEList<PartialStateDescription>(); if (leftStateFormula != null) { result.add(leftStateFormula); result.addAll(leftStateFormula.getSubFormulas()); } if (rightStateFormula != null) { result.add(rightStateFormula); result.addAll(rightStateFormula.getSubFormulas()); } return result; }
/** Tests support for attributes of ELong type. */ public void test_supportForELongAttributes_198451() { helper.setContext(thingType); long maxInt = Integer.MAX_VALUE; long maxIntMinusOne = (long) Integer.MAX_VALUE - 1; long maxIntSquared = ((long) Integer.MAX_VALUE) * ((long) Integer.MAX_VALUE); double quotient = (double) maxIntSquared / (double) maxIntMinusOne; Numero maxIntN = new Numero(maxInt); Numero maxIntMinusOneN = new Numero(maxIntMinusOne); Numero maxIntSquaredN = new Numero(maxIntSquared); @SuppressWarnings("unchecked") EList<Numero> list = (EList<Numero>) thing.eGet(enumeros); list.clear(); list.add(maxIntN); list.add(maxIntMinusOneN); list.add(maxIntSquaredN); list.add(new Numero(1)); try { // this should be OK because both values can be represented as integers assertEquals(1, evaluate(helper, thing, "numeros->at(1).asLong() - numeros->at(2).asLong()")); // same number represented in different precision assertTrue(check(helper, thing, "numeros->at(4).asLong() = 1")); // different numbers represented in different precision assertTrue(check(helper, thing, "numeros->at(4).asLong() <> 2")); // this is also OK, because we compute in high precision and coerce // the result to lower precision assertEquals( quotient, evaluate(helper, thing, "numeros->at(3).asLong() / numeros->at(2).asLong()")); // this is another case where the intermediate result is high-precision but // the result is low assertEquals( (int) maxIntMinusOne, evaluate(helper, thing, String.format("(%d + %d).div(2) - 1", maxInt, maxInt))); // finally, a case where the result is in high precision (new capability) assertEquals( maxIntSquared, evaluate(helper, thing, String.format("%d * %d", maxInt, maxInt))); } catch (Exception e) { fail("Failed to parse or evaluate: " + e.getLocalizedMessage()); } }
public void testTransientResource() throws Exception { final URI uri = URI.createURI("cdo:/test1"); msg("Creating resourceSet"); ResourceSet resourceSet = new ResourceSetImpl(); SessionUtil.prepareResourceSet(resourceSet); msg("Creating resource"); CDOResource resource = (CDOResource) resourceSet.createResource(uri); assertTransient(resource); msg("Creating supplier"); Supplier supplier = getModel1Factory().createSupplier(); assertTransient(supplier); assertEquals(null, supplier.eContainer()); msg("Verifying contents"); EList<EObject> contents = resource.getContents(); assertNotNull(contents); assertEquals(true, contents.isEmpty()); assertEquals(0, contents.size()); assertTransient(resource); msg("Adding supplier"); contents.add(supplier); assertTransient(resource); assertTransient(supplier); assertContent(resource, supplier); assertEquals(true, resourceSet.getResources().contains(resource)); resource.delete(null); assertEquals(false, resourceSet.getResources().contains(resource)); assertTransient(supplier); }
private void fillEAttribute(EObject container, JsonNode root) { final EClass eClass = container.eClass(); // Iterates over all key values of the JSON Object, // if the value is not an object then // if the key corresponds to an EAttribute, fill it // if not and the EClass contains a MapEntry, fill it with the key, value. for (Iterator<Entry<String, JsonNode>> it = root.getFields(); it.hasNext(); ) { Entry<String, JsonNode> field = it.next(); String key = field.getKey(); JsonNode value = field.getValue(); if (value.isObject()) // not an attribute continue; EAttribute attribute = getEAttribute(eClass, key); if (attribute != null && !attribute.isTransient() && !attribute.isDerived()) { if (value.isArray()) { for (Iterator<JsonNode> itValue = value.getElements(); itValue.hasNext(); ) { setEAttributeValue(container, attribute, itValue.next()); } } else { setEAttributeValue(container, attribute, value); } } else { EStructuralFeature eFeature = getDynamicMapEntryFeature(eClass); if (eFeature != null) { @SuppressWarnings("unchecked") EList<EObject> values = (EList<EObject>) container.eGet(eFeature); values.add(createEntry(key, value)); } } } }
/** * Converts a JSIDL pop to a CJSIDL pop transition * * @param pop - a JSIDL pop * @param parentTrans - the parent transition * @return - resulting CJSIDL object */ public static popTransition convert(Pop pop, transition parentTrans) { CjsidlFactoryImpl factory = new CjsidlFactoryImpl(); org.jts.eclipse.cjsidl.popTransition output = factory.createpopTransition(); output.setComment(JSIDLInterpToCJSIDLComment(pop.getInterpretation())); EList<org.jts.eclipse.cjsidl.guardParam> paramlist = output.getParam(); if (pop.getArgument() != null) { java.util.List<org.jts.jsidl.binding.Argument> args = pop.getArgument(); for (org.jts.jsidl.binding.Argument arg : args) { guardParam gp = factory.createguardParam(); if (arg.getValue().contains("'")) { gp.setGuardConst(arg.getValue()); } else { if (parentTrans != null) { gp.setParameter( (transParam) Conversion.referenceHelper.getEObjectFromTransition( arg.getValue(), parentTrans)); } else { Logger.getLogger("CJSIDL").log(Level.SEVERE, "Unexpected parameter found in guard."); } } paramlist.add(gp); } } // need to have the reference set, but the object may not exist yet, so post-process String transName = pop.getTransition(); if (transName != null && !transName.isEmpty()) { DefaultState.secondaryTransitionMap.put(transName, output); } return output; }
@Override protected void execute(IProgressMonitor monitor) throws CoreException { try { IncQueryGeneratorModel generatorModel = genmodelProvider.getGeneratorModel(project, resourceSetProvider.get(project)); EList<GeneratorModelReference> genmodelRefs = generatorModel.getGenmodels(); for (GenModel ecoreGenmodel : genmodels) { GeneratorModelReference ref = GeneratorModelFactory.eINSTANCE.createGeneratorModelReference(); ref.setGenmodel(ecoreGenmodel); genmodelRefs.add(ref); } if (genmodelRefs.isEmpty()) { IFile file = project.getFile(ViatraQueryNature.IQGENMODEL); file.create(new StringInputStream(""), false, new SubProgressMonitor(monitor, 1)); } else { genmodelProvider.saveGeneratorModel(project, generatorModel); } } catch (IOException e) { throw new CoreException( new Status( IStatus.ERROR, ViatraQueryGUIPlugin.PLUGIN_ID, "Cannot create generator model: " + e.getMessage(), e)); } }
/** * initialize before simulation begins. Rewind/forward any population model values to the start * time of the sequencer * * @param time */ public void initialize(STEMTime time) { EList<Decorator> redoList = new BasicEList<Decorator>(); boolean redo = false; for (Decorator d : this.getDecorators()) { if (d instanceof IntegrationDecorator) { EList<DynamicLabel> labels = d.getLabelsToUpdate(); for (DynamicLabel l : labels) { if (l instanceof IntegrationLabel) { IntegrationLabel il = (IntegrationLabel) l; il.reset(time); if (((SimpleDataExchangeLabelValue) il.getDeltaValue()).getArrivals().size() > 0 || ((SimpleDataExchangeLabelValue) il.getDeltaValue()).getDepartures().size() > 0) redo = true; } } } if (!redo) redoList.add(d); } // Fix decorators with unapplied deltas if (redo) { for (Decorator d : redoList) { if (d instanceof IntegrationDecorator) { EList<DynamicLabel> labels = d.getLabelsToUpdate(); for (DynamicLabel l : labels) { if (l instanceof IntegrationLabel) { IntegrationLabel il = (IntegrationLabel) l; il.reset(time); } } } } } this.setInitialized(true); }
@Test public void should_migrateAfter_update_version_in_connector_configuration() throws Exception { // Given doCallRealMethod().when(updateConnectorVersionMigration).migrateAfter(model, metamodel); final EList<Instance> connectorConfigInstanceList = connectorConfiguratiobInstanceList("id1", "id2"); final Instance oldConnectorConfInstance = aConnectorConfigurationInstance("id1", "0.9"); connectorConfigInstanceList.add(oldConnectorConfInstance); when(model.getAllInstances("connectorconfiguration.ConnectorConfiguration")) .thenReturn(connectorConfigInstanceList); when(model.getAllInstances("process.Connector")).thenReturn(new BasicEList<Instance>()); when(updateConnectorVersionMigration.shouldUpdateVersion("id1")).thenReturn(true); when(updateConnectorVersionMigration.getOldDefinitionVersion()).thenReturn("1.0"); when(updateConnectorVersionMigration.getNewDefinitionVersion()).thenReturn("2.0"); // When updateConnectorVersionMigration.migrateAfter(model, metamodel); // Then final Instance id1ConnectorConf = connectorConfigInstanceList.get(0); final Instance id2ConnectorConf = connectorConfigInstanceList.get(1); verify(id1ConnectorConf).set(UpdateConnectorVersionMigration.VERSION_FEATURE_NAME, "2.0"); verify(id2ConnectorConf, never()) .set(UpdateConnectorVersionMigration.VERSION_FEATURE_NAME, "2.0"); verify(oldConnectorConfInstance, never()) .set(UpdateConnectorVersionMigration.VERSION_FEATURE_NAME, "2.0"); }
/** Returns true if text can be inserted at the current position. */ public boolean canInsertText() { VEXDocument doc = this.getDocument(); if (doc == null) { return false; } Validator validator = this.document.getValidator(); if (validator == null) { return true; } int startOffset = this.getCaretOffset(); int endOffset = this.getCaretOffset(); if (this.hasSelection()) { startOffset = this.getSelectionStart(); endOffset = this.getSelectionEnd(); } VEXElement parent = this.getDocument().getElementAt(startOffset); EList<String> seq1 = doc.getNodeNames(parent.getStartOffset() + 1, startOffset); EList<String> seq2 = new BasicEList<String>(); seq2.add(Validator.PCDATA); EList<String> seq3 = doc.getNodeNames(endOffset, parent.getEndOffset()); return validator.isValidSequence(parent.getName(), seq1, seq2, seq3, true); }
public static boolean setStringDataFilter(Analysis analysis, String datafilterString) { EList<Domain> dataFilters = analysis.getParameters().getDataFilter(); // update existing filters if (!dataFilters.isEmpty()) { Domain domain = dataFilters.get(0); EList<RangeRestriction> ranges = domain.getRanges(); RangeRestriction rangeRestriction = (ranges.isEmpty()) ? DomainHelper.addRangeRestriction(domain) : ranges.get(0); BooleanExpressionNode expressions = rangeRestriction.getExpressions(); if (expressions == null) { expressions = BooleanExpressionHelper.createBooleanExpressionNode(datafilterString); rangeRestriction.setExpressions(expressions); } else { Expression expression = expressions.getExpression(); if (expression == null) { expression = BooleanExpressionHelper.createTdExpression( BooleanExpressionHelper.DEFAULT_LANGUAGE, datafilterString); expressions.setExpression(expression); } else { expression.setBody(datafilterString); } } return false; } // else return dataFilters.add(createDomain(analysis, datafilterString)); }
@Override public IScriptDependency addDependency(IScriptDependency dependency) { /* * Find the list of dependencies for the object of the specified dependency */ final EObject object = dependency.getObject(); EList<IScriptDependency> dList = getDependencies().get(object); if (dList == null) { final BasicEMap.Entry<EObject, EList<IScriptDependency>> entry = (Entry<EObject, EList<IScriptDependency>>) IScriptEngineFactory.eINSTANCE.create( IScriptEnginePackage.Literals.EOBJECT_TO_SCRIPT_DEPENDENCY_LIST_MAP_ENTRY); entry.setKey(object); getDependencies().add(entry); dList = entry.getValue(); object.eAdapters().add(myDependencyAdapter); } /* * See if we have an identical entry of the list */ for (final IScriptDependency d : dList) { if (d.equals(dependency)) return d; } dList.add(dependency); return dependency; }
private static void addSourceOrLibrary(EList<MindRootSrc> allsrc, MindRootSrc rs) { if (rs == null) return; if (allsrc.add(rs)) for (MindRootSrc drs : rs.getDependencies()) { addSourceOrLibrary(allsrc, drs); } }
@Test public void testAddElementAfterInlineComment() { try { StringConcatenation _builder = new StringConcatenation(); _builder.append("entities"); _builder.newLine(); _builder.append("\t"); _builder.append("Foo \"Bar\"\t//inline comment before inserted element"); _builder.newLine(); _builder.append("end"); _builder.newLine(); final Model model = this._parseHelper.parse(_builder); Entity _createEntity = HiddentokensequencertestFactory.eINSTANCE.createEntity(); final Procedure1<Entity> _function = (Entity it) -> { it.setName("Baz"); it.setDescription("Fizzle"); }; final Entity event = ObjectExtensions.<Entity>operator_doubleArrow(_createEntity, _function); DomainModel _domainModel = model.getDomainModel(); EList<Entity> _entities = _domainModel.getEntities(); _entities.add(event); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("entities"); _builder_1.newLine(); _builder_1.append("\t"); _builder_1.append("Foo \"Bar\"\t//inline comment before inserted element"); _builder_1.newLine(); _builder_1.append("Baz \"Fizzle\" end"); this.assertSerializesTo(model, _builder_1); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }
@Override public EList<EStructuralFeature> GetEStructuralFeature() { // TODO Auto-generated method stub EList<EStructuralFeature> list_feat = new BasicEList<EStructuralFeature>(); list_feat.add(GetEClass().getEStructuralFeature("name")); return list_feat; }
/** @generated */ protected void set(ChartWithoutAxes src) { super.set(src); // children if (src.getSeriesDefinitions() != null) { EList<SeriesDefinition> list = getSeriesDefinitions(); for (SeriesDefinition element : src.getSeriesDefinitions()) { list.add(element.copyInstance()); } } // attributes minSlice = src.getMinSlice(); minSliceESet = src.isSetMinSlice(); minSlicePercent = src.isMinSlicePercent(); minSlicePercentESet = src.isSetMinSlicePercent(); minSliceLabel = src.getMinSliceLabel(); coverage = src.getCoverage(); coverageESet = src.isSetCoverage(); }
public void addToOperations(Object newValue) { operationsList.add(newValue); if (newValue != null) { operations.setText(operationsList.toString()); } else { operations.setText(""); // $NON-NLS-1$ } }
protected void assertSetEList(List<?> prototypeList) { EList<Object> eList = new BasicEList<Object>(); ECollections.setEList(eList, prototypeList); assertTrue("Empty list test", TestUtil.areEqual(prototypeList, eList)); eList = new BasicEList<Object>(); eList.add(0, "String"); eList.add(Boolean.FALSE); ECollections.setEList(eList, prototypeList); assertTrue("Smaller list test", TestUtil.areEqual(prototypeList, eList)); eList = (EList<Object>) populateList(new BasicEList<Object>()); ECollections.setEList(eList, prototypeList); assertTrue("Same list test", TestUtil.areEqual(prototypeList, eList)); eList.remove(2); eList.add(3, this); ECollections.setEList(eList, prototypeList); assertTrue("Equal size list test", TestUtil.areEqual(prototypeList, eList)); eList.add(0, "String"); eList.add(2, Boolean.FALSE); eList.add(Boolean.FALSE); eList.add(this); ECollections.setEList(eList, prototypeList); assertTrue("Bigger list test", TestUtil.areEqual(prototypeList, eList)); }
/** @generated */ protected void set(Dial src) { // children if (src.getLineAttributes() != null) { setLineAttributes(src.getLineAttributes().copyInstance()); } if (src.getFill() != null) { setFill(src.getFill().copyInstance()); } if (src.getDialRegions() != null) { EList<DialRegion> list = getDialRegions(); for (DialRegion element : src.getDialRegions()) { list.add(element.copyInstance()); } } if (src.getMajorGrid() != null) { setMajorGrid(src.getMajorGrid().copyInstance()); } if (src.getMinorGrid() != null) { setMinorGrid(src.getMinorGrid().copyInstance()); } if (src.getScale() != null) { setScale(src.getScale().copyInstance()); } if (src.getLabel() != null) { setLabel(src.getLabel().copyInstance()); } if (src.getFormatSpecifier() != null) { setFormatSpecifier(src.getFormatSpecifier().copyInstance()); } // attributes startAngle = src.getStartAngle(); startAngleESet = src.isSetStartAngle(); stopAngle = src.getStopAngle(); stopAngleESet = src.isSetStopAngle(); radius = src.getRadius(); radiusESet = src.isSetRadius(); inverseScale = src.isInverseScale(); inverseScaleESet = src.isSetInverseScale(); }
/** * Return the subLines and the cells of this line. * * @param line The line * @return List of representations elements */ private EList<DRepresentationElement> getRepresentationElements(DLine line) { EList<DRepresentationElement> result = new BasicEList<DRepresentationElement>(); result.add(line); result.addAll(line.getCells()); for (DLine subLine : line.getLines()) { result.addAll(getRepresentationElements(subLine)); } return result; }
/** * Tests that the MSLUtil::addObject() method does the correct thing when adding an object that is * already in the list. It formerly attempted to move the object, but moved the wrong one. */ public void test_MSLUtil_addObject_113261() { EList list = new BasicEList(); list.add("a"); // $NON-NLS-1$ list.add("b"); // $NON-NLS-1$ list.add("c"); // $NON-NLS-1$ list.add("d"); // $NON-NLS-1$ Object object = list.get(3); // on a copy of this list, do the correct change EList expected = new BasicEList(list); expected.move(0, 3); MSLUtil.addObject(list, object, 0); // check that MSLUtil made the correct change assertEquals(expected, list); }
protected EList<ConnectionInstance> filterSameSourceConnections( EList<ConnectionInstance> connections) { EList<ConnectionInstance> result = new BasicEList<ConnectionInstance>(); for (ConnectionInstance conni : connections) { if (!hasConnectionSource(result, conni)) { result.add(conni); } } return result; }
/* * Bugzilla: 133907 */ public void testMoveIntObject() throws Exception { EList<Object> originalList = new BasicEList<Object>(); originalList.add("pos0"); originalList.add("pos1"); originalList.add(2); originalList.add("pos3"); EList<Object> eList = new BasicEList<Object>(originalList); List<Object> list = new ArrayList<Object>(originalList); int target = 2; Object object = originalList.get(3); originalList.move(target, object); ECollections.move(eList, target, object); assertTrue(TestUtil.areEqual(originalList, eList)); ECollections.move(list, target, object); assertTrue(TestUtil.areEqual(originalList, list)); target = 2; object = originalList.get(0); originalList.move(target, object); ECollections.move(eList, target, object); assertTrue(TestUtil.areEqual(originalList, eList)); ECollections.move(list, target, object); assertTrue(TestUtil.areEqual(originalList, list)); target = 1; object = originalList.get(1); originalList.move(target, object); ECollections.move(eList, target, object); assertTrue(TestUtil.areEqual(originalList, eList)); ECollections.move(list, target, object); assertTrue(TestUtil.areEqual(originalList, list)); target = 0; object = originalList.get(3); originalList.move(target, object); ECollections.move(eList, target, object); assertTrue(TestUtil.areEqual(originalList, eList)); ECollections.move(list, target, object); assertTrue(TestUtil.areEqual(originalList, list)); }