本文整理汇总了Java中org.eclipse.emf.common.util.BasicEList类的典型用法代码示例。如果您正苦于以下问题:Java BasicEList类的具体用法?Java BasicEList怎么用?Java BasicEList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BasicEList类属于org.eclipse.emf.common.util包,在下文中一共展示了BasicEList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addSyntaxErrors
import org.eclipse.emf.common.util.BasicEList; //导入依赖的package包/类
/**
* This is aware of warnings from the {@link N4JSStringValueConverter}.
*
* Issues from the parser are commonly treated as errors but here we want to create a warning.
*/
@Override
protected void addSyntaxErrors() {
if (isValidationDisabled())
return;
// EList.add unnecessarily checks for uniqueness by default
// so we use #addUnique below to save some CPU cycles for heavily broken
// models
BasicEList<Diagnostic> errorList = (BasicEList<Diagnostic>) getErrors();
BasicEList<Diagnostic> warningList = (BasicEList<Diagnostic>) getWarnings();
for (INode error : getParseResult().getSyntaxErrors()) {
XtextSyntaxDiagnostic diagnostic = createSyntaxDiagnostic(error);
String code = diagnostic.getCode();
if (AbstractN4JSStringValueConverter.WARN_ISSUE_CODE.equals(code)
|| RegExLiteralConverter.ISSUE_CODE.equals(code)
|| LegacyOctalIntValueConverter.ISSUE_CODE.equals(code)) {
warningList.addUnique(diagnostic);
} else if (!InternalSemicolonInjectingParser.SEMICOLON_INSERTED.equals(code)) {
errorList.addUnique(diagnostic);
}
}
}
示例2: findReferences
import org.eclipse.emf.common.util.BasicEList; //导入依赖的package包/类
@Override
public void findReferences(Predicate<URI> targetURIs, Resource resource, Acceptor acceptor,
IProgressMonitor monitor) {
// make sure data is present
keys.getData((TargetURIs) targetURIs, new SimpleResourceAccess(resource.getResourceSet()));
EList<EObject> astContents;
if (resource instanceof N4JSResource) {
// In case of N4JSResource, we search only in the AST but NOT in TModule tree!
Script script = (Script) ((N4JSResource) resource).getContents().get(0);
astContents = new BasicEList<>();
astContents.add(script);
} else {
astContents = resource.getContents();
}
for (EObject content : astContents) {
findReferences(targetURIs, content, acceptor, monitor);
}
}
示例3: handleFParameters
import org.eclipse.emf.common.util.BasicEList; //导入依赖的package包/类
private void handleFParameters(TMember member, RuleEnvironment G) {
EList<TFormalParameter> fpars = null;
if (member instanceof TMethod) {
TMethod method = (TMethod) member;
fpars = method.getFpars();
}
if (member instanceof TSetter) {
TSetter setter = (TSetter) member;
fpars = new BasicEList<>();
fpars.add(setter.getFpar());
}
if (fpars != null) {
for (int i = 0; i < fpars.size(); i++) {
TFormalParameter fpar = fpars.get(i);
if (fParameters.size() <= i) {
fParameters.add(new ComposedFParInfo());
}
ComposedFParInfo fpAggr = fParameters.get(i);
Pair<TFormalParameter, RuleEnvironment> fpPair = new Pair<>(fpar, G);
fpAggr.fpSiblings.add(fpPair);
}
}
}
示例4: updatePart
import org.eclipse.emf.common.util.BasicEList; //导入依赖的package包/类
/**
* {@inheritDoc}
* @see org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification)
*/
public void updatePart(Notification msg) {
super.updatePart(msg);
if (editingPart.isVisible()) {
TimingPropertiesEditionPart timingPart = (TimingPropertiesEditionPart)editingPart;
if (HrmPackage.eINSTANCE.getHardwareResource_Clock().equals(msg.getFeature()) && timingPart != null && isAccessible(HrmViewsRepository.Timing.TimingProperties.clock))
timingPart.setClock((EObject)msg.getNewValue());
if (HrmPackage.eINSTANCE.getHardwareMemory_Timings().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && timingPart != null && isAccessible(HrmViewsRepository.Timing.TimingProperties.timings)) {
if (msg.getNewValue() instanceof EList<?>) {
timingPart.setTimings((EList<?>)msg.getNewValue());
} else if (msg.getNewValue() == null) {
timingPart.setTimings(new BasicEList<Object>());
} else {
BasicEList<Object> newValueAsList = new BasicEList<Object>();
newValueAsList.add(msg.getNewValue());
timingPart.setTimings(newValueAsList);
}
}
}
}
示例5: getPrecedenceRelations
import org.eclipse.emf.common.util.BasicEList; //导入依赖的package包/类
public List<EObject> getPrecedenceRelations(EObject view, ConnectorKind kind) {
List<EObject> precedenceRelations = new BasicEList<EObject>();
if (view instanceof ExecutionStep) {
ExecutionStep execStep = (ExecutionStep) view;
PrecedenceRelation inputRelation = execStep.getInputRel();
if (inputRelation != null) {
if (inputRelation.getConnectorKind().equals(kind)) {
precedenceRelations.add(inputRelation);
}
}
PrecedenceRelation outputRelation = execStep.getOutputRel();
if (outputRelation != null) {
if (outputRelation.getConnectorKind().equals(kind)) {
precedenceRelations.add(outputRelation);
}
}
}
return precedenceRelations;
}
示例6: getSwSchedulableResourcesOrderedByPriority
import org.eclipse.emf.common.util.BasicEList; //导入依赖的package包/类
public List<SoftwareSchedulableResource> getSwSchedulableResourcesOrderedByPriority(EObject context) {
List<SoftwareSchedulableResource> sortedSwSchedRes = new BasicEList<SoftwareSchedulableResource>();
if (context instanceof HardwareComputingResource) {
HardwareComputingResource hcr = (HardwareComputingResource) context;
for (Resource resource : hcr.getOwnedResource()) {
if (resource instanceof SoftwareSchedulableResource) {
SoftwareSchedulableResource swSchedRes = (SoftwareSchedulableResource) resource;
int insertionIndex = 0;
// WARNING First SchedulingParameter value considered as
// priority
int priority = Integer.parseInt(swSchedRes.getSchedParams().get(0).getValue());
for (SoftwareSchedulableResource sortedSwSched : sortedSwSchedRes) {
int sortedSwSchedPriority = Integer.parseInt(sortedSwSched.getSchedParams().get(0).getValue());
if (sortedSwSchedPriority < priority) {
insertionIndex++;
} else {
break;
}
}
sortedSwSchedRes.add(insertionIndex, swSchedRes);
}
}
}
return sortedSwSchedRes;
}
示例7: getTasksOrderedByPriority
import org.eclipse.emf.common.util.BasicEList; //导入依赖的package包/类
public List<Task> getTasksOrderedByPriority(EObject context_p) {
List<Task> sortedTasks = new BasicEList<Task>();
if (context_p instanceof ComputingResource) {
ComputingResource cr = (ComputingResource) context_p;
for (Task task : cr.getTasksAffectedOn()) {
int insertionIndex = 0;
// WARNING First SchedulingParameter value considered as
// priority
if ((task.getSchedulingParameters() != null) && (task.getSchedulingParameters().size() != 0)) {
int priority = Integer.parseInt(task.getSchedulingParameters().get(0).getValue());
for (Task sortedTask : sortedTasks) {
int sortedTaskPriority = Integer
.parseInt(sortedTask.getSchedulingParameters().get(0).getValue());
if (sortedTaskPriority < priority) {
insertionIndex++;
} else {
break;
}
}
sortedTasks.add(insertionIndex, task);
}
}
}
return sortedTasks;
}
示例8: getValues
import org.eclipse.emf.common.util.BasicEList; //导入依赖的package包/类
@Override
public EList<JvmAnnotationValue> getValues() {
EList<JvmAnnotationValue> explicitValues = getExplicitValues();
List<JvmOperation> operations = Lists.newArrayList(getAnnotation().getDeclaredOperations());
if (operations.size() <= explicitValues.size()) {
return ECollections.unmodifiableEList(explicitValues);
}
Set<JvmOperation> seenOperations = Sets.newHashSetWithExpectedSize(operations.size());
BasicEList<JvmAnnotationValue> result = new BasicEList<JvmAnnotationValue>(operations.size());
for(JvmAnnotationValue value: explicitValues) {
seenOperations.add(value.getOperation());
result.add(value);
}
for(JvmOperation operation: operations) {
if (seenOperations.add(operation)) {
JvmAnnotationValue defaultValue = operation.getDefaultValue();
if (defaultValue != null) {
result.add(defaultValue);
}
}
}
return ECollections.unmodifiableEList(result);
}
示例9: resolve
import org.eclipse.emf.common.util.BasicEList; //导入依赖的package包/类
public void resolve(String identifier, eu.hyvar.mspl.manifest.HyTimedImplementationEnumLink container, EReference reference, int position, boolean resolveFuzzy, final eu.hyvar.mspl.manifest.resource.hymanifest.IHymanifestReferenceResolveResult<eu.hyvar.dataValues.HyEnum> result) {
//System.out.println("UNITO DEBUG EnumLinkLocal: identifier= "+identifier);
HyEnum elementEnum = HyExpressionResolverUtil.resolveEnum(identifier, container);
if(elementEnum!=null) {
EList<eu.hyvar.evolution.HyTemporalElement> elements = new BasicEList<eu.hyvar.evolution.HyTemporalElement>();
elements.add(container);
elements.add((eu.hyvar.evolution.HyTemporalElement)container.eContainer());
HyInterval interval = HyEvolutionUtil.computeTemporalIntersection(elements);
if(HyEvolutionUtil.isWithinValidityOf(interval, elementEnum)) {
//System.out.println("UNITO DEBUG EnumLinkLocal: enum= "+elementEnum);
result.addMapping(identifier, elementEnum);
}
}
//delegate.resolve(identifier, container, reference, position, resolveFuzzy, result);
}
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:21,代码来源:HyTimedImplementationEnumLinkLocalReferenceResolver.java
示例10: run
import org.eclipse.emf.common.util.BasicEList; //导入依赖的package包/类
@Override
public void run(){
Shell shell = this.getWorkbenchPart().getSite().getShell();
StructuredSelection selection = (StructuredSelection)this.getSelection();
DwAttributeEditPart part = (DwAttributeEditPart)selection.getFirstElement();
HyFeatureAttribute attribute = (HyFeatureAttribute)part.getModel();
EList<HyName> names = attribute.getNames();
EList<EObject> items = new BasicEList<EObject>();
for(int i=0; i<names.size(); i++){
HyName name = names.get(i);
items.add(name);
}
DwNameDialog dialog = new DwNameDialog(shell);
dialog.setElement(attribute);
dialog.setItems(items);
dialog.open();
}
示例11: execute
import org.eclipse.emf.common.util.BasicEList; //导入依赖的package包/类
@Override
public void execute() {
//get the group and the containing features of the group composition
this.group = oldGroupComposition.getCompositionOf();
EList<HyFeature> features = new BasicEList<HyFeature>();
features.addAll(oldGroupComposition.getFeatures());
features.remove(feature);
DeleteGroupComposition deleteOldComposition = new DeleteGroupComposition(oldGroupComposition, timestamp);
AddGroupComposition addNewComposition = new AddGroupComposition(group, features , timestamp);
//the order of the append is important for the execute, so first delete then add
addToComposition(deleteOldComposition);
addToComposition(addNewComposition);
for (EvolutionOperation operation : evoOps) {
operation.execute();
}
newGroupComposition = addNewComposition.getGroupComposition();
}
示例12: execute
import org.eclipse.emf.common.util.BasicEList; //导入依赖的package包/类
@Override
public void execute() {
//get the group and the containing features of the group composition
this.group = oldGroupComposition.getCompositionOf();
//create a new List and add all necessary elements
EList<HyFeature> features = new BasicEList<HyFeature>();
features.addAll(oldGroupComposition.getFeatures());
features.add(feature);
DeleteGroupComposition deleteOldComposition = new DeleteGroupComposition(oldGroupComposition, timestamp);
AddGroupComposition addNewComposition = new AddGroupComposition(group, features , timestamp);
//the order of the append is important for the execute, so first delete then add
addToComposition(deleteOldComposition);
addToComposition(addNewComposition);
for (EvolutionOperation operation : evoOps) {
operation.execute();
}
newGroupComposition = addNewComposition.getGroupComposition();
}
示例13: execute
import org.eclipse.emf.common.util.BasicEList; //导入依赖的package包/类
@Override
public void execute() {
DeleteGroupWithTypeChildAndComposition deleteGroup = new DeleteGroupWithTypeChildAndComposition(oldGroup, timestamp);
EList<HyFeature> features = new BasicEList<HyFeature>();
features.add(feature);
//add a new group for the feature und the parent. The group type must be AND because at this point the group will only have one feature in his composition
AddGroupWithTypeChildAndComposition addGroup = new AddGroupWithTypeChildAndComposition(HyGroupTypeEnum.AND, parent, features, timestamp, tfm);
addToComposition(deleteGroup);
addToComposition(addGroup);
for (EvolutionOperation operation : evoOps) {
operation.execute();
}
this.newGroup = addGroup.getGroup();
}
示例14: mockSelectedElement
import org.eclipse.emf.common.util.BasicEList; //导入依赖的package包/类
/**
* Mocks XtextEditor and XtextElementSelectionListener to return an element selection that has:
* - given EAttribute with a specific value (AttributeValuePair)
* - given EStructuralFeature
* - given EOperation.
*
* @param attributeValuePair
* EAttribute with a specific value
* @param feature
* the EStructuralFeature
* @param operation
* the EOperation
* @return the EClass of the "selected" element
*/
@SuppressWarnings("unchecked")
private EClass mockSelectedElement(final AttributeValuePair attributeValuePair, final EStructuralFeature feature, final EOperation operation) {
EClass mockSelectionEClass = mock(EClass.class);
when(mockSelectionListener.getSelectedElementType()).thenReturn(mockSelectionEClass);
// Mockups for returning AttributeValuePair
URI elementUri = URI.createURI("");
when(mockSelectionListener.getSelectedElementUri()).thenReturn(elementUri);
XtextEditor mockEditor = mock(XtextEditor.class);
when(mockSelectionListener.getEditor()).thenReturn(mockEditor);
IXtextDocument mockDocument = mock(IXtextDocument.class);
when(mockEditor.getDocument()).thenReturn(mockDocument);
when(mockDocument.<ArrayList<AttributeValuePair>> readOnly(any(IUnitOfWork.class))).thenReturn(newArrayList(attributeValuePair));
// Mockups for returning EOperation
BasicEList<EOperation> mockEOperationsList = new BasicEList<EOperation>();
mockEOperationsList.add(operation);
when(mockSelectionEClass.getEAllOperations()).thenReturn(mockEOperationsList);
// Mockups for returning EStructuralFeature
BasicEList<EStructuralFeature> mockEStructuralFeatureList = new BasicEList<EStructuralFeature>();
mockEStructuralFeatureList.add(feature);
mockEStructuralFeatureList.add(attributeValuePair.getAttribute());
when(mockSelectionEClass.getEAllStructuralFeatures()).thenReturn(mockEStructuralFeatureList);
return mockSelectionEClass;
}
示例15: filter
import org.eclipse.emf.common.util.BasicEList; //导入依赖的package包/类
/**
* Filters an {@link EList} of type T to contain only elements matching the provided predicate.
*
* @param <T>
* list element type
* @param unfiltered
* unfiltered list
* @param predicate
* to apply
* @return filtered list
*/
public static <T> EList<T> filter(final EList<T> unfiltered, final Predicate<? super T> predicate) {
if (unfiltered == null) {
return ECollections.emptyEList();
}
if (predicate == null) {
throw new IllegalArgumentException("predicate must not be null"); //$NON-NLS-1$
}
EList<T> filtered = new BasicEList<T>(unfiltered.size() / 2); // Initial guess: half the original size
for (T t : unfiltered) {
if (predicate.apply(t)) {
filtered.add(t);
}
}
return filtered;
}