• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java EcoreEList类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.emf.ecore.util.EcoreEList的典型用法代码示例。如果您正苦于以下问题:Java EcoreEList类的具体用法?Java EcoreEList怎么用?Java EcoreEList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EcoreEList类属于org.eclipse.emf.ecore.util包,在下文中一共展示了EcoreEList类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getReferenceParameter

import org.eclipse.emf.ecore.util.EcoreEList; //导入依赖的package包/类
private static String getReferenceParameter(EPlanElement ePlanElement, EReferenceParameter eStructuralFeature) {
	IItemPropertySource source = EMFUtils.adapt(ePlanElement, IItemPropertySource.class);
	IItemPropertyDescriptor startPD = source.getPropertyDescriptor(ePlanElement, eStructuralFeature);
	// First check the instance name
	if (startPD != null) {
		Object value = EMFUtils.getPropertyValue(startPD, ePlanElement);
		if (value != null && StringifierRegistry.hasRegisteredStringifier(eStructuralFeature.getName())) {
			IStringifier stringifier = StringifierRegistry.getStringifier(eStructuralFeature.getName());
			return stringifier.getDisplayString(value);
		}
		if(value instanceof EcoreEList) {
			List<String> valueList = new ArrayList<String>();
			for (Object o : ((EcoreEList) value).toArray()) {
				valueList.add(getChoiceText(eStructuralFeature, o));
			}
			return EEnumStringifier.formatString(valueList.toString());
		}
	}
	return "";
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:21,代码来源:TooltipShellBuilder.java


示例2: execute

import org.eclipse.emf.ecore.util.EcoreEList; //导入依赖的package包/类
public static <T> void execute(String label, EcoreEList<T> list, T object) {
	if (list.getEStructuralFeature().isUnique() && list.contains(object)) {
		return;
	}
	IUndoableOperation op = new FeatureTransactionAddOperation<T>(label, list, object);
	IUndoContext context = TransactionUtils.getUndoContext(list);
	if (context != null) {
		op.addContext(context);
		try {
	        IOperationHistory history = OperationHistoryFactory.getOperationHistory();
	    	history.execute(op, null, null);
	    } catch (Exception e) {
	    	LogUtil.error("execute", e);
	    }
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:17,代码来源:FeatureTransactionAddOperation.java


示例3: FeatureTransactionRemoveAllOperation

import org.eclipse.emf.ecore.util.EcoreEList; //导入依赖的package包/类
public FeatureTransactionRemoveAllOperation(String label, EcoreEList<T> list, List<T> objects) {
	super(label);
	this.list = list;
	this.objects = objects;
	int i = 0;
	List<T> matches = new ArrayList<T>();
	int matchIndex = -1;
	for (T object : list) {
		if (objects.contains(object)) {
			matches.add(object);
			if (matchIndex == -1) {
				matchIndex = i;
			}
		} else if (matchIndex != -1) {
			indexObjects.put(matchIndex, matches);
			matches = new ArrayList<T>();
			matchIndex = -1;
		}
		i++;
	}
	if (matchIndex != -1) {
		indexObjects.put(matchIndex, matches);
		matches = new ArrayList<T>();
		matchIndex = -1;
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:27,代码来源:FeatureTransactionRemoveAllOperation.java


示例4: execute

import org.eclipse.emf.ecore.util.EcoreEList; //导入依赖的package包/类
public static <T> void execute(String label, EcoreEList<T> list, List<T> objects) {
	boolean containsOne = false;
	for (T item : list) {
		if (objects.contains(item)) {
			containsOne = true;
			break;
		}
	}
	if (!containsOne) {
		return;
	}
	IUndoableOperation op = new FeatureTransactionRemoveAllOperation<T>(label, list, objects);
	IUndoContext context = TransactionUtils.getUndoContext(list);
	if (context != null) {
		op.addContext(context);
		try {
	        IOperationHistory history = OperationHistoryFactory.getOperationHistory();
	    	history.execute(op, null, null);
	    } catch (Exception e) {
	    	LogUtil.error("execute", e);
	    }
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:24,代码来源:FeatureTransactionRemoveAllOperation.java


示例5: execute

import org.eclipse.emf.ecore.util.EcoreEList; //导入依赖的package包/类
public static <T> void execute(String label, EcoreEList<T> list, List<T> objects) {
	if (list.getEStructuralFeature().isUnique() && list.containsAll(objects)) {
		return;
	}
	IUndoableOperation op = new FeatureTransactionAddAllOperation<T>(label, list, objects);
	IUndoContext context = TransactionUtils.getUndoContext(list);
	if (context != null) {
		op.addContext(context);
		try {
	        IOperationHistory history = OperationHistoryFactory.getOperationHistory();
	    	history.execute(op, null, null);
	    } catch (Exception e) {
	    	LogUtil.error("execute", e);
	    }
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:17,代码来源:FeatureTransactionAddAllOperation.java


示例6: execute

import org.eclipse.emf.ecore.util.EcoreEList; //导入依赖的package包/类
public static <T> void execute(String label, EcoreEList<T> list, T object) {
	if (!list.contains(object)) {
		return;
	}
	IUndoableOperation op = new FeatureTransactionRemoveOperation<T>(label, list, object);
	IUndoContext context = TransactionUtils.getUndoContext(list);
	if (context != null) {
		op.addContext(context);
		try {
	        IOperationHistory history = OperationHistoryFactory.getOperationHistory();
	    	history.execute(op, null, null);
	    } catch (Exception e) {
	    	LogUtil.error("execute", e);
	    }
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:17,代码来源:FeatureTransactionRemoveOperation.java


示例7: suggestTogglingWaiverOfRuleForElement

import org.eclipse.emf.ecore.util.EcoreEList; //导入依赖的package包/类
private void suggestTogglingWaiverOfRuleForElement(Set<Suggestion> suggestions, EPlanElement element) {
	EcoreEList<String> oldRuleNames = RuleUtils.getWaivedRuleNames(element);
	String name = rule.getName();
	if (!oldRuleNames.contains(name)) {
		String label;
		IUndoableOperation operation;
		String description;
		if (RuleUtils.isWaived(element, rule)) {
			label = "waive " + rule.getPrintName();
			operation = new FeatureTransactionAddOperation<String>(label, oldRuleNames, name);
			description = "Waive " + rule.getPrintName();
		} else {
			label = "unwaive " + rule.getPrintName();
			operation = new FeatureTransactionRemoveOperation<String>(label, oldRuleNames, name);
			description = "Unwaive " + rule.getPrintName();
		}
		if (element instanceof EPlan) {
			description += " for this plan";
		} else {
			description += " for " + element.getName();
		}
		suggestions.add(new Suggestion(description, operation));
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:25,代码来源:FlightRuleViolation.java


示例8: createAddConstraintSuggestion

import org.eclipse.emf.ecore.util.EcoreEList; //导入依赖的package包/类
private Suggestion createAddConstraintSuggestion() {
	IUndoableOperation operation = null;
	if (constraint instanceof ProfileConstraint) {
		EcoreEList<ProfileConstraint> currentConstraints = (EcoreEList)target.getMember(ProfileMember.class).getConstraints();
		// Need to make a copy so it doesn't get removed from the template
		ProfileConstraint constraintCopy = (ProfileConstraint) EMFUtils.copy(constraint);
		operation = new FeatureTransactionAddOperation("Add Profile Constraint", currentConstraints, constraintCopy);
	} else if (constraint instanceof BinaryTemporalConstraint) {
		operation = new CreateTemporalRelationOperation((BinaryTemporalConstraint)constraint);
	} else if (constraint instanceof PeriodicTemporalConstraint) {
		operation = new CreateTemporalBoundOperation((PeriodicTemporalConstraint)constraint);
	} else if (constraint instanceof TemporalChain) {
		List<EPlanChild> linked = CommonUtils.castList(EPlanChild.class, ((TemporalChain)constraint).getElements());
		operation = new ChainOperation(PlanStructureModifier.INSTANCE, linked, false);
	}
	if (operation != null) {
		return new Suggestion(UPDATE_ACTIVITY_ICON, "Add Constraint to Plan", operation);
	}
	return null;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:21,代码来源:PlanDiffViolation.java


示例9: createRemoveConstraintSuggestion

import org.eclipse.emf.ecore.util.EcoreEList; //导入依赖的package包/类
private Suggestion createRemoveConstraintSuggestion() {
	IUndoableOperation operation = null;
	if (constraint instanceof ProfileConstraint) {
		EcoreEList<ProfileConstraint> currentConstraints = (EcoreEList)target.getMember(ProfileMember.class).getConstraints();
		operation = new FeatureTransactionRemoveOperation("Remove Profile Constraint", currentConstraints, constraint);
	} else if (constraint instanceof BinaryTemporalConstraint) {
		operation = new DeleteTemporalRelationOperation((BinaryTemporalConstraint)constraint);
	} else if (constraint instanceof PeriodicTemporalConstraint) {
		operation = new DeleteTemporalBoundOperation((PeriodicTemporalConstraint)constraint);
	} else if (constraint instanceof TemporalChain) {
		operation = new UnchainOperation(((TemporalChain)constraint).getElements());
	}
	if (operation != null) {
		return new Suggestion(UPDATE_ACTIVITY_ICON, "Remove Constraint from Plan", operation);
	}
	return null;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:18,代码来源:PlanDiffViolation.java


示例10: createModifyConstraintSuggestion

import org.eclipse.emf.ecore.util.EcoreEList; //导入依赖的package包/类
private Suggestion createModifyConstraintSuggestion() {
	CompositeOperation operation = null;
	if (constraint instanceof ProfileConstraint) {
		operation = new CompositeOperation("Update Profile Constraint");
		EcoreEList<ProfileConstraint> currentConstraints = (EcoreEList)target.getMember(ProfileMember.class).getConstraints();
		for (ProfileConstraint currentConstraint : currentConstraints) {
			if (similarProfileReferences(currentConstraint, (ProfileConstraint)constraint)) {
				operation.add(new FeatureTransactionRemoveOperation("Remove Profile Constraint", currentConstraints, currentConstraint));
			}
		}
		// Need to make a copy so it doesn't get removed from the template
		ProfileConstraint constraintCopy = (ProfileConstraint) EMFUtils.copy(constraint);
		operation.add(new FeatureTransactionAddOperation("Add Profile Constraint", currentConstraints, constraintCopy));
	}
	if (operation != null) {
		return new Suggestion(UPDATE_ACTIVITY_ICON, "Update Constraint in Plan", operation);
	}
	return null;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:20,代码来源:PlanDiffViolation.java


示例11: getInsideLinkedRelations

import org.eclipse.emf.ecore.util.EcoreEList; //导入依赖的package包/类
/**
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 *
 * @generated NOT
 */
@Override
public EList<Relation> getInsideLinkedRelations() {
  List<Relation> relations = new ArrayList<>();
  for (Relation r : getLinkedRelations()) {
    if (getContainer().equals(r.getContainer())) {
      relations.add(r);
    }
  }
  return new EcoreEList.UnmodifiableEList(this, TriqPackage.eINSTANCE.getPort_InsideLinkedRelations(), relations.size(), relations.toArray());
}
 
开发者ID:eclipse,项目名称:triquetrum,代码行数:16,代码来源:PortImpl.java


示例12: getOutsideLinkedRelations

import org.eclipse.emf.ecore.util.EcoreEList; //导入依赖的package包/类
/**
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 *
 * @generated NOT
 */
@Override
public EList<Relation> getOutsideLinkedRelations() {
  List<Relation> relations = new ArrayList<>();
  for (Relation r : getLinkedRelations()) {
    if (getContainer().getContainer().equals(r.getContainer())) {
      relations.add(r);
    }
  }
  return new EcoreEList.UnmodifiableEList(this, TriqPackage.eINSTANCE.getPort_OutsideLinkedRelations(), relations.size(), relations.toArray());
}
 
开发者ID:eclipse,项目名称:triquetrum,代码行数:16,代码来源:PortImpl.java


示例13: editOnActivate

import org.eclipse.emf.ecore.util.EcoreEList; //导入依赖的package包/类
@Override
public boolean editOnActivate(DayResourceFacet facet, IUndoContext undoContext, TreeItem item, int index) {
	Object element = facet.getElement();
	if (element instanceof EActivity) {
		EActivity activity = (EActivity) element;
		EStructuralFeature feature = getFacetFeature(activity);
		if (feature == null) {
			return false;
		}
		
		String featureName = EMFUtils.getDisplayName(activity, feature);
		IUndoableOperation operation = null;
		if (feature.isMany()) {
			EcoreEList value = (EcoreEList) (activity.getData().eGet(feature));
			if (!value.contains(object)) {
				operation = new FeatureTransactionAddOperation("add "+featureName, value, object);
			} else {
				operation = new FeatureTransactionRemoveOperation("remove "+featureName, value, object);
			}
		} else {
			operation = new FeatureTransactionChangeOperation("change "+featureName, activity, feature, object);
		}
		CommonUtils.execute(operation, undoContext);
		return true;
	}
	return false;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:28,代码来源:DayResourceColumn.java


示例14: FeatureTransactionAddAllOperation

import org.eclipse.emf.ecore.util.EcoreEList; //导入依赖的package包/类
public FeatureTransactionAddAllOperation(String label, EcoreEList<T> list, List<T> objects) {
	super(label);
	this.list = list;
	if (list.getEStructuralFeature().isUnique()) {
		this.objects = new ArrayList<T>(objects);
		this.objects.removeAll(list);
	} else {
		this.objects = objects;
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:11,代码来源:FeatureTransactionAddAllOperation.java


示例15: toString

import org.eclipse.emf.ecore.util.EcoreEList; //导入依赖的package包/类
@Override
public String toString() {
	StringBuilder builder = new StringBuilder(Object.class.getSimpleName());
	builder.append(":");
	if (list instanceof EcoreEList) {
		builder.append(((EcoreEList) list).getEStructuralFeature().getName());
		builder.append(" on " + ((EcoreEList) list).getEObject());
	}
	builder.append(" remove ");
	builder.append(String.valueOf(object));
	return builder.toString();
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:13,代码来源:FeatureTransactionRemoveOperation.java


示例16: setWaived

import org.eclipse.emf.ecore.util.EcoreEList; //导入依赖的package包/类
/**
 * Set some particular rule to be waived or enabled
 * @param rule
 * @param waived
 */
public static void setWaived(EPlan element, ERule rule, boolean waived) {
	EcoreEList<String> ruleNames = getWaivedRuleNames(element);
	String name = rule.getName();
	if (waived) {
		FeatureTransactionAddOperation.execute("waive rule", ruleNames, name);
	} else if (!waived) {
		FeatureTransactionRemoveOperation.execute("unwaive rule", ruleNames, name);
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:15,代码来源:RuleUtils.java


示例17: setWaivedRules

import org.eclipse.emf.ecore.util.EcoreEList; //导入依赖的package包/类
/**
 * Set these rules to be waived or enabled
 * @param rules
 * @param waived
 */
public static void setWaivedRules(EPlan element, Set<ERule> rules, boolean waived) {
	EcoreEList<String> oldRuleNames = getWaivedRuleNames(element);
	List<String> changedRuleNames = new ArrayList<String>();
	for (ERule rule : rules) {
		changedRuleNames.add(rule.getName());
	}
	if (waived) {
		FeatureTransactionAddAllOperation.execute("waive rule(s)", oldRuleNames, changedRuleNames);
	} else {
		FeatureTransactionRemoveAllOperation.execute("unwaive rule(s)", oldRuleNames, changedRuleNames);
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:18,代码来源:RuleUtils.java


示例18: getProfileConstraintFormText

import org.eclipse.emf.ecore.util.EcoreEList; //导入依赖的package包/类
private String getProfileConstraintFormText(ProfileConstraint profileConstraint, IdentifiableRegistry<EPlanElement> identifiableRegistry) {
	PlanPrinter printer = new PlanPrinter(identifiableRegistry);
	StringBuilder builder = new StringBuilder();
	switch (getDiffType()) {
	case MODIFY:
		EcoreEList<ProfileConstraint> currentConstraints = (EcoreEList)target.getMember(ProfileMember.class).getConstraints();
		ProfileConstraint oldConstraint = null;
		for (ProfileConstraint currentConstraint : currentConstraints) {
			if (similarProfileReferences(currentConstraint, (ProfileConstraint)constraint)) {
				oldConstraint = currentConstraint;
				break;
			}
		}
		if (oldConstraint != null) {
			builder.append(getTargetSource()).append(": ");
			buildConstraintFormText(target, oldConstraint, printer, builder);
			builder.append("<BR/>");
		}
		builder.append(getUpdatedSource()).append(": ");
		buildConstraintFormText(updated, profileConstraint, printer, builder);
		break;
	case ADD:
		builder.append(getUpdatedSource()).append(": ");
		buildConstraintFormText(updated, profileConstraint, printer, builder);
		break;
	case REMOVE:
		builder.append(getTargetSource()).append(": ");
		buildConstraintFormText(target, profileConstraint, printer, builder);
		break;
	default:
	}
	return builder.toString();
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:34,代码来源:PlanDiffViolation.java


示例19: getEffectFormText

import org.eclipse.emf.ecore.util.EcoreEList; //导入依赖的package包/类
private String getEffectFormText(FormText text, IdentifiableRegistry<EPlanElement> identifiableRegistry) {
	if (text != null) {
		text.setColor("start", ColorConstants.darkGreen);
		text.setColor("end", ColorConstants.red);
	}
	PlanPrinter printer = new PlanPrinter(identifiableRegistry);
	StringBuilder builder = new StringBuilder();
	switch (getDiffType()) {
	case MODIFY:
		EcoreEList<ProfileEffect> currentEffects = (EcoreEList)target.getMember(ProfileMember.class).getEffects();
		ProfileEffect oldEffect = null;
		for (ProfileEffect currentEffect : currentEffects) {
			if (similarProfileReferences(currentEffect, effect)) {
				oldEffect = currentEffect;
				break;
			}
		}
		if (oldEffect != null) {
			builder.append(getTargetSource()).append(": ");
			buildEffectFormText(target, oldEffect, printer, builder);
			builder.append("<BR/>");
		}
		builder.append(getUpdatedSource()).append(": ");
		buildEffectFormText(updated, effect, printer, builder);
		break;
	case ADD:
		builder.append(getUpdatedSource()).append(": ");
		buildEffectFormText(updated, effect, printer, builder);
		break;
	case REMOVE:
		builder.append(getTargetSource()).append(": ");
		buildEffectFormText(target, effect, printer, builder);
		break;
	default:
	}
	return builder.toString();
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:38,代码来源:PlanDiffViolation.java


示例20: createAddEffectSuggestion

import org.eclipse.emf.ecore.util.EcoreEList; //导入依赖的package包/类
private Suggestion createAddEffectSuggestion() {
	EcoreEList<ProfileEffect> currentEffects = (EcoreEList)target.getMember(ProfileMember.class).getEffects();
	// Need to make a copy so it doesn't get removed from the template
	ProfileEffect effectCopy = EMFUtils.copy(effect);
	IUndoableOperation operation = new FeatureTransactionAddOperation("Add Profile Effect", currentEffects, effectCopy);
	return new Suggestion(UPDATE_ACTIVITY_ICON, "Add Effect to Plan", operation);
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:8,代码来源:PlanDiffViolation.java



注:本文中的org.eclipse.emf.ecore.util.EcoreEList类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TvInputInfo类代码示例发布时间:2022-05-23
下一篇:
Java LifeEventHandler类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap