本文整理汇总了Java中org.eclipse.emf.common.util.ECollections.asEList方法的典型用法代码示例。如果您正苦于以下问题:Java ECollections.asEList方法的具体用法?Java ECollections.asEList怎么用?Java ECollections.asEList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.emf.common.util.ECollections
的用法示例。
在下文中一共展示了ECollections.asEList方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: merge
import org.eclipse.emf.common.util.ECollections; //导入方法依赖的package包/类
private @NonNull ModelRel merge(@NonNull ModelRel rel1, @NonNull ModelRel rel2, @NonNull Model model1,
@Nullable Model model2, @NonNull MID instanceMID) throws MMINTException {
ModelRel mergedRel = null;
String mergedRelName = rel1.getName() + MERGE_SEPARATOR + rel2.getName();
if (rel1 instanceof BinaryModelRel && rel2 instanceof BinaryModelRel) { // binary merge
mergedRel = rel1.getMetatype().createBinaryInstanceAndEndpoints(null, mergedRelName, model1, model2,
instanceMID);
}
else { // unary merge, or binary merge with nary rel
EList<Model> models = (model2 == null) ?
ECollections.asEList(model1) :
ECollections.asEList(model1, model2);
mergedRel = rel1.getMetatype().createInstanceAndEndpoints(null, mergedRelName, models, instanceMID);
}
populate(mergedRel, rel1, instanceMID);
populate(mergedRel, rel2, instanceMID);
return mergedRel;
}
示例2: visitUnionType
import org.eclipse.emf.common.util.ECollections; //导入方法依赖的package包/类
@Override
public EObject visitUnionType(final TypeExpressionParser.UnionTypeContext ctx) {
final UnionType unionType = (UnionType) EcoreUtil.create(UNION_TYPE);
scope.addValue(INLINE_TYPE_CONTAINER__INLINE_TYPES, unionType);
final EList<AnyType> oneOfType = ECollections.asEList(ctx.primary_type_expr().stream()
.map(this::visit)
.filter(AnyType.class::isInstance) // TODO report errors
.map(AnyType.class::cast)
.collect(Collectors.toList()));
unionType.getOneOf().addAll(oneOfType);
return unionType;
}
示例3: getSubTypes
import org.eclipse.emf.common.util.ECollections; //导入方法依赖的package包/类
/**
* Returns the sub types of the given super type.
*
* @param superType the super type
* @return list of sub types
*/
public static EList<AnyType> getSubTypes(final AnyType superType) {
final SuperTypeCrossReferencer superTypeCrossReferencer = new SuperTypeCrossReferencer(superType.eResource());
return ECollections.asEList(superTypeCrossReferencer.findUsage(superType).stream()
.map(setting -> setting.getEObject())
.map(AnyType.class::cast)
.collect(Collectors.toList()));
}
示例4: getBundles
import org.eclipse.emf.common.util.ECollections; //导入方法依赖的package包/类
@Override
public EList<String> getBundles ()
{
return ECollections.asEList ( "org.openscada.external.postgresql" ); //$NON-NLS-1$
}
示例5: getConfigurableSections
import org.eclipse.emf.common.util.ECollections; //导入方法依赖的package包/类
@Override
public EList<ConfigurableSection> getConfigurableSections() {
return ECollections.asEList(EcoreUtil2.getAllContentsOfType(this, ConfigurableSection.class));
}
示例6: isAllowedGeneric
import org.eclipse.emf.common.util.ECollections; //导入方法依赖的package包/类
@Override
public boolean isAllowedGeneric(@NonNull GenericEndpoint genericTypeEndpoint,
@NonNull GenericElement genericType, @NonNull List<OperatorInput> inputs) {
final String FIX_URI = "http://se.cs.toronto.edu/modelepedia/Operator_Fix";
Operator fixerOperatorType = (Operator) genericType;
// no nesting
if (fixerOperatorType.getUri().equals(FIX_URI)) {
return false;
}
// would not stop from infinite cycle
if (inputs.size() == 0) {
return false;
}
// no varargs for the fixer
if (Stream.concat(fixerOperatorType.getInputs().stream(), fixerOperatorType.getOutputs().stream())
.anyMatch(modelTypeEndpoint -> modelTypeEndpoint.getUpperBound() > 1)) {
return false;
}
// must connect outputs to inputs
if (fixerOperatorType.getInputs().size() != fixerOperatorType.getOutputs().size()) {
return false;
}
// inputs must be valid for the fixer
String runtimeTypingPreference = null;
if (inputs.get(0).getModel().isWorkflowsLevel()) {
runtimeTypingPreference = MMINT
.getPreference(MMINTConstants.PREFERENCE_MENU_POLYMORPHISM_RUNTIMETYPING_ENABLED);
MMINT.setPreference(MMINTConstants.PREFERENCE_MENU_POLYMORPHISM_RUNTIMETYPING_ENABLED, "false");
}
EList<Model> inputModels = ECollections.asEList(
inputs.stream()
.map(OperatorInput::getModel)
.collect(Collectors.toList()));
try {
if (fixerOperatorType.checkAllowedInputs(inputModels) == null) {
return false;
}
return true;
}
catch (MMINTException e) {
return false;
}
finally {
if (runtimeTypingPreference != null) {
MMINT.setPreference(MMINTConstants.PREFERENCE_MENU_POLYMORPHISM_RUNTIMETYPING_ENABLED,
runtimeTypingPreference);
}
}
}
示例7: fix
import org.eclipse.emf.common.util.ECollections; //导入方法依赖的package包/类
private @NonNull List<Model> fix(@NonNull List<Model> models, @NonNull Operator fixerOperatorType,
@NonNull Map<String, MID> outputMIDsByFixerOutputs) throws Exception {
// prepare nested MID
MID fixingMID = super.getNestedInstanceMID();
if (fixingMID != null) {
super.createNestedInstanceMIDModelShortcuts(models);
}
// fixer loop
EList<Model> inModels;
EList<Model> outModels = ECollections.asEList(models);
Operator fixerOperator;
int i = 0;
do {
inModels = outModels;
EList<OperatorInput> fixerInputs = fixerOperatorType.checkAllowedInputs(inModels);
EList<OperatorGeneric> fixerGenerics = fixerOperatorType.selectAllowedGenerics(fixerInputs);
Map<String, MID> fixerOutputsByName = MIDOperatorIOUtils.createSameOutputMIDsByName(fixerOperatorType,
fixingMID);
fixerOperator = fixerOperatorType.startInstance(fixerInputs, null, fixerGenerics, fixerOutputsByName,
fixingMID);
fixerOperator.setName(fixerOperator.getName() + i);
outModels = fixerOperator.getOutputModels();
i++;
}
while (!this.areFixed(inModels, outModels));
// copy final outputs into their proper instance MIDs and make them shortcuts in the nested MID
Map<Model, Model> fixedToOutModels = super.replaceNestedModelsWithShortcuts(fixerOperator,
outputMIDsByFixerOutputs);
for (Entry<Model, Model> fixedToOut : fixedToOutModels.entrySet()) {
int j = outModels.indexOf(fixedToOut.getKey());
if (j != -1) {
outModels.set(j, fixedToOut.getValue());
}
}
// finalize nested MID
if (fixingMID != null) {
super.writeNestedInstanceMID();
}
return outModels;
}
示例8: run
import org.eclipse.emf.common.util.ECollections; //导入方法依赖的package包/类
@Override
public java.util.Map<String, Model> run(
java.util.Map<String, Model> inputsByName, java.util.Map<String, GenericElement> genericsByName,
java.util.Map<String, MID> outputMIDsByName) throws Exception {
// input
List<Model> inputMIDModels = MIDOperatorIOUtils.getVarargs(inputsByName, IN_MIDS);
EList<MID> inputMIDs = ECollections.newBasicEList();
EList<Set<Model>> modelBlacklists = ECollections.newBasicEList();
for (Model inputMIDModel : inputMIDModels) {
inputMIDs.add((MID) inputMIDModel.getEMFInstanceRoot());
modelBlacklists.add(new HashSet<>());
}
Operator mapperOperatorType = (Operator) genericsByName.get(GENERIC_OPERATORTYPE);
java.util.Map<String, MID> instanceMIDsByMapperOutput = MIDOperatorIOUtils.getVarargOutputMIDsByOtherName(outputMIDsByName, OUT_MIDS, mapperOperatorType.getOutputs());
// find all possible combinations of inputs and execute them
java.util.Map<Operator, Set<EList<OperatorInput>>> mapperSpecs = new LinkedHashMap<>(); // reproducible order
EList<Operator> polyOperators = (Boolean.parseBoolean(MMINT.getPreference(MMINTConstants.PREFERENCE_MENU_POLYMORPHISM_MULTIPLEDISPATCH_ENABLED))) ?
ECollections.asEList(MIDTypeHierarchy.getSubtypes(mapperOperatorType)) :
ECollections.emptyEList();
if (polyOperators.isEmpty()) { // multiple dispatch disabled, or the mapper operator is not a multimethod
mapperSpecs.put(mapperOperatorType, mapperOperatorType.findAllowedInputs(inputMIDs, modelBlacklists));
}
else {
polyOperators.add(mapperOperatorType);
java.util.Map<String, EList<OperatorInput>> assignedInputs = new HashMap<>();
Iterator<Operator> polyIter = MIDTypeHierarchy.getInverseTypeHierarchyIterator(polyOperators);
while (polyIter.hasNext()) { // start from the most specialized operator backwards
Operator polyMapper = polyIter.next();
// assign at each step the allowed inputs that have not been already assigned
Set<EList<OperatorInput>> mapperInputs = polyMapper.findAllowedInputs(inputMIDs, modelBlacklists);
java.util.Map<String, EList<OperatorInput>> newInputs = this.diffMultipleDispatchInputs(assignedInputs, mapperInputs);
mapperSpecs.put(polyMapper, new LinkedHashSet<>(newInputs.values())); // reproducible order
assignedInputs.putAll(newInputs);
}
}
java.util.Map<String, Model> outputsByName = this.map(inputMIDModels, inputMIDs, mapperOperatorType, mapperSpecs, instanceMIDsByMapperOutput);
return outputsByName;
}