本文整理汇总了Java中org.eclipse.ocl.pivot.values.SetValue类的典型用法代码示例。如果您正苦于以下问题:Java SetValue类的具体用法?Java SetValue怎么用?Java SetValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SetValue类属于org.eclipse.ocl.pivot.values包,在下文中一共展示了SetValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitCompany
import org.eclipse.ocl.pivot.values.SetValue; //导入依赖的package包/类
/**
* visitCompany(element : company::Company[1]) : lookup::LookupEnvironment[?]
*
* _'null' : lookup::LookupEnvironment[1]
*/
@Override
public /*@NonInvalid*/ LookupEnvironment visitCompany(final /*@NonInvalid*/ Company element) {
final /*@Thrown*/ SetValue BOXED_result = (SetValue)((ExecutorInternalExtension)executor).getCachedEvaluationResult(Company_GetEmployees.INSTANCE, null , new Object[]{element});
final /*@Thrown*/ List<Employee> ECORE_asSet = ((IdResolver.IdResolverExtension)idResolver).ecoreValueOfAll(Employee.class, BOXED_result);
final /*@Thrown*/ LookupEnvironment inner = context.addElements(ECORE_asSet);
final /*@Thrown*/ boolean hasFinalResult = inner.hasFinalResult();
/*@Thrown*/ LookupEnvironment symbol_0;
if (hasFinalResult) {
symbol_0 = inner;
}
else {
final /*@Thrown*/ LookupEnvironment parentEnv = this.parentEnv(element);
symbol_0 = parentEnv;
}
return symbol_0;
}
示例2: evaluateQuery
import org.eclipse.ocl.pivot.values.SetValue; //导入依赖的package包/类
public Object evaluateQuery(EObject modelObj, String oclConstraint) {
OCL ocl = OCL.newInstance();
try {
OCLHelper helper = ocl.createOCLHelper(modelObj.eClass());
ExpressionInOCL expression = helper.createQuery(oclConstraint);
Object evaluation = ocl.evaluate(modelObj, expression);
if (evaluation instanceof CollectionValue.Accumulator) {
evaluation = ((CollectionValue.Accumulator) evaluation).getElements();
}
if (evaluation instanceof SetValue) {
evaluation = ((SetValue) evaluation).getElements();
}
if (evaluation instanceof OrderedSetValue) {
evaluation = ((OrderedSetValue) evaluation).getElements();
}
return evaluation;
}
catch (Exception e) {
MMINTException.print(IStatus.ERROR, "OCL derivation error: " + oclConstraint, e);
return null;
}
}
示例3: getEntities
import org.eclipse.ocl.pivot.values.SetValue; //导入依赖的package包/类
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Entity> getEntities() {
/**
* Entity.allInstances()->select(kind = self)
*/
final /*@NonInvalid*/ Executor executor = PivotUtilInternal.getExecutor(this);
final /*@NonInvalid*/ IdResolver idResolver = executor.getIdResolver();
final /*@NonInvalid*/ org.eclipse.ocl.pivot.Class TYP_occi_c_c_Entity_0 = idResolver.getClass(OCCITables.CLSSid_Entity, null);
final /*@NonInvalid*/ SetValue allInstances = ClassifierAllInstancesOperation.INSTANCE.evaluate(executor, OCCITables.SET_CLSSid_Entity, TYP_occi_c_c_Entity_0);
/*@Thrown*/ SetValue.Accumulator accumulator = ValueUtil.createSetAccumulatorValue(OCCITables.SET_CLSSid_Entity);
/*@NonNull*/ Iterator<Object> ITERATOR__1 = allInstances.iterator();
/*@NonInvalid*/ SetValue select;
while (true) {
if (!ITERATOR__1.hasNext()) {
select = accumulator;
break;
}
/*@NonInvalid*/ Entity _1 = (Entity)ITERATOR__1.next();
/**
* kind = self
*/
final /*@NonInvalid*/ Kind kind_0 = _1.getKind();
final /*@NonInvalid*/ boolean eq = kind_0.equals(this);
//
if (eq == ValueUtil.TRUE_VALUE) {
accumulator.add(_1);
}
}
final /*@NonInvalid*/ List<Entity> ECORE_select = ((IdResolver.IdResolverExtension)idResolver).ecoreValueOfAll(Entity.class, select);
return (EList<Entity>)ECORE_select;
}
示例4: getMixins
import org.eclipse.ocl.pivot.values.SetValue; //导入依赖的package包/类
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Mixin> getMixins() {
/**
* parts.mixin->asSet()
*/
final /*@NonInvalid*/ Executor executor = PivotUtilInternal.getExecutor(this);
final /*@NonInvalid*/ IdResolver idResolver = executor.getIdResolver();
final /*@NonInvalid*/ List<MixinBase> parts = this.getParts();
final /*@NonInvalid*/ OrderedSetValue BOXED_parts = idResolver.createOrderedSetOfAll(OCCITables.ORD_CLSSid_MixinBase, parts);
/*@Thrown*/ SequenceValue.Accumulator accumulator = ValueUtil.createSequenceAccumulatorValue(OCCITables.SEQ_CLSSid_Mixin);
/*@NonNull*/ Iterator<Object> ITERATOR__1 = BOXED_parts.iterator();
/*@NonInvalid*/ SequenceValue collect;
while (true) {
if (!ITERATOR__1.hasNext()) {
collect = accumulator;
break;
}
/*@NonInvalid*/ MixinBase _1 = (MixinBase)ITERATOR__1.next();
/**
* mixin
*/
final /*@NonInvalid*/ Mixin mixin = _1.getMixin();
//
accumulator.add(mixin);
}
final /*@NonInvalid*/ SetValue asSet = CollectionAsSetOperation.INSTANCE.evaluate(collect);
final /*@NonInvalid*/ List<Mixin> ECORE_asSet = ((IdResolver.IdResolverExtension)idResolver).ecoreValueOfAll(Mixin.class, asSet);
return (EList<Mixin>)ECORE_asSet;
}
示例5: MAP___root__
import org.eclipse.ocl.pivot.values.SetValue; //导入依赖的package包/类
/**
*
* map __root__ in CS2ASBridge_qvtp_qvtias {
*
* where ( |)
* { |}
* for importCS : basecs::ImportCS in basecs::ImportCS.allInstances()
* {
* map cImportCS_2_Import {
* importCS := importCS;
* }}
* for importCS : basecs::ImportCS in basecs::ImportCS.allInstances()
* {
* map uImport_name {
* importCS := importCS;
* }}
* for importCS : basecs::ImportCS in basecs::ImportCS.allInstances()
* {
* map uImport_importedNamespace {
* importCS := importCS;
* }}
*/
protected boolean MAP___root__() throws ReflectiveOperationException {
// predicates
final /*@NonNull*/ /*@NonInvalid*/ IdResolver idResolver = executor.getIdResolver();
final /*@NonNull*/ /*@NonInvalid*/ Class TYP_basecs_c_c_ImportCS_2 = idResolver.getClass(CLSSid_ImportCS, null);
final /*@NonNull*/ /*@NonInvalid*/ SetValue allInstances_0 = ClassifierAllInstancesOperation.INSTANCE.evaluate(executor, SET_CLSSid_ImportCS, TYP_basecs_c_c_ImportCS_2);
// mapping statements
for (ImportCS importCS_5 : ValueUtil.typedIterable(ImportCS.class, allInstances_0)) {
if (importCS_5 != null) {
final /*@NonNull*/ /*@NonInvalid*/ ImportCS symbol_0 = (ImportCS)importCS_5;
MAP_cImportCS_2_Import(symbol_0);
}
}
for (ImportCS importCS_6 : ValueUtil.typedIterable(ImportCS.class, allInstances_0)) {
if (importCS_6 != null) {
final /*@NonNull*/ /*@NonInvalid*/ ImportCS symbol_3 = (ImportCS)importCS_6;
MAP_uImport_name(symbol_3);
}
}
for (ImportCS importCS_7 : ValueUtil.typedIterable(ImportCS.class, allInstances_0)) {
if (importCS_7 != null) {
final /*@NonNull*/ /*@NonInvalid*/ ImportCS symbol_6 = (ImportCS)importCS_7;
MAP_uImport_importedNamespace(symbol_6);
}
}
return true;
}
示例6: evaluate
import org.eclipse.ocl.pivot.values.SetValue; //导入依赖的package包/类
@Override
public @NonNull SetValue evaluate(@NonNull Executor executor, @NonNull TypeId returnTypeId, @Nullable Object sourceVal, @Nullable Object typeVal) {
org.eclipse.ocl.pivot.Class type = asClass(typeVal);
if (!(sourceVal instanceof TypedModelInstance)) {
throw new InvalidValueException(PivotMessages.TypedValueRequired, "TypedModelInstance", getTypeName(sourceVal));
}
TypedModelInstance typedModelInstance = (TypedModelInstance)sourceVal;
Collection<@NonNull ? extends Object> results = typedModelInstance.getObjectsOfType(type);
return createSetValue((CollectionTypeId)returnTypeId, results);
}
示例7: evaluate
import org.eclipse.ocl.pivot.values.SetValue; //导入依赖的package包/类
@Override
public @NonNull SetValue evaluate(@NonNull Executor executor, @NonNull TypeId returnTypeId, @Nullable Object sourceVal, @Nullable Object typeVal) {
org.eclipse.ocl.pivot.Class type = asClass(typeVal);
if (!(sourceVal instanceof TypedModelInstance)) {
throw new InvalidValueException(PivotMessages.TypedValueRequired, "TypedModelInstance", getTypeName(sourceVal));
}
TypedModelInstance typedModelInstance = (TypedModelInstance)sourceVal;
Collection<@NonNull ? extends Object> results = typedModelInstance.getObjectsOfKind(type);
return createSetValue((CollectionTypeId)returnTypeId, results);
// return createSetValue((CollectionTypeId)returnTypeId, new ArrayList<@NonNull Object>(results));
}
示例8: evaluate
import org.eclipse.ocl.pivot.values.SetValue; //导入依赖的package包/类
@Override
public @NonNull SetValue evaluate(@NonNull Executor executor, @NonNull TypeId returnTypeId, @Nullable Object sourceVal) {
if (!(sourceVal instanceof TypedModelInstance)) {
throw new InvalidValueException(PivotMessages.TypedValueRequired, "TypedModelInstance", getTypeName(sourceVal));
}
TypedModelInstance typedModelInstance = (TypedModelInstance)sourceVal;
Collection<@NonNull ? extends Object> results = typedModelInstance.getAllObjects();
return createSetValue((CollectionTypeId)returnTypeId, results);
}
示例9: evaluate
import org.eclipse.ocl.pivot.values.SetValue; //导入依赖的package包/类
@Override
public @NonNull SetValue evaluate(@NonNull Executor executor, @NonNull TypeId returnTypeId, @Nullable Object sourceVal) {
if (!(sourceVal instanceof TypedModelInstance)) {
throw new InvalidValueException(PivotMessages.TypedValueRequired, "TypedModelInstance", getTypeName(sourceVal));
}
TypedModelInstance typedModelInstance = (TypedModelInstance)sourceVal;
Collection<@NonNull ? extends Object> results = typedModelInstance.getRootObjects();
return createSetValue((CollectionTypeId)returnTypeId, results);
}
示例10: basicEvaluate
import org.eclipse.ocl.pivot.values.SetValue; //导入依赖的package包/类
@Override
public @Nullable Object basicEvaluate(@NonNull Executor executor, @NonNull TypedElement caller, @Nullable Object @NonNull [] sourceAndArgumentValues) {
@SuppressWarnings("null") final /*@NonInvalid*/ @NonNull Department self_5 = (/*@NonInvalid*/ @NonNull Department)sourceAndArgumentValues[0];
final /*@NonInvalid*/ @NonNull IdResolver idResolver = executor.getIdResolver();
@SuppressWarnings("null")
final /*@Thrown*/ @NonNull List<Department> subdepts = self_5.getSubdepts();
final /*@Thrown*/ @NonNull SetValue BOXED_subdepts = idResolver.createSetOfAll(SET_CLSSid_Department, subdepts);
/*@Thrown*/ [email protected] Accumulator accumulator = ValueUtil.createBagAccumulatorValue(BAG_CLSSid_Employee);
@NonNull Iterator<Object> ITERATOR__1 = BOXED_subdepts.iterator();
/*@Thrown*/ @NonNull BagValue collect;
while (true) {
if (!ITERATOR__1.hasNext()) {
collect = accumulator;
break;
}
@SuppressWarnings("null")
/*@NonInvalid*/ @NonNull Department _1 = (Department)ITERATOR__1.next();
/**
* getEmployees()
*/
final /*@Thrown*/ @NonNull SetValue getEmployees = INSTANCE_Department_getEmployees.evaluate(_1);
//
for (Object value : getEmployees.flatten().getElements()) {
accumulator.add(value);
}
}
@SuppressWarnings("null")
final /*@Thrown*/ @NonNull List<Employee> employees = self_5.getEmployees();
final /*@Thrown*/ @NonNull SetValue BOXED_employees = idResolver.createSetOfAll(SET_CLSSid_Employee, employees);
final /*@Thrown*/ @NonNull BagValue includingAll = (BagValue)CollectionIncludingAllOperation.INSTANCE.evaluate(collect, BOXED_employees);
@SuppressWarnings("null")
final /*@Thrown*/ @NonNull Employee manager = self_5.getManager();
final /*@Thrown*/ @NonNull BagValue including = (BagValue)CollectionIncludingOperation.INSTANCE.evaluate(includingAll, manager);
final /*@Thrown*/ @NonNull SetValue asSet = CollectionAsSetOperation.INSTANCE.evaluate(including);
return asSet;
}
示例11: evaluate
import org.eclipse.ocl.pivot.values.SetValue; //导入依赖的package包/类
@Override
public @NonNull SetValue evaluate(@NonNull Executor executor, @NonNull TypeId returnTypeId, @Nullable Object sourceVal, @Nullable Object typeVal) {
org.eclipse.ocl.pivot.Class type = asClass(typeVal);
if (!(sourceVal instanceof TypedModelInstance)) {
throw new InvalidValueException(PivotMessages.TypedValueRequired, "TypedModelInstance", getTypeName(sourceVal));
}
TypedModelInstance typedModelInstance = (TypedModelInstance)sourceVal;
Iterable<@NonNull ? extends Object> results = typedModelInstance.getObjectsOfKind(type);
return new IterableAsSetValue<Object>((CollectionTypeId)returnTypeId, Lists.newArrayList(results));
}
示例12: evaluate
import org.eclipse.ocl.pivot.values.SetValue; //导入依赖的package包/类
@Override
public @NonNull SetValue evaluate(@NonNull Executor executor, @NonNull TypeId returnTypeId, @Nullable Object sourceVal) {
if (!(sourceVal instanceof TypedModelInstance)) {
throw new InvalidValueException(PivotMessages.TypedValueRequired, "TypedModelInstance", getTypeName(sourceVal));
}
TypedModelInstance typedModelInstance = (TypedModelInstance)sourceVal;
Iterable<@NonNull ? extends Object> results = typedModelInstance.getAllObjects();
return new IterableAsSetValue<Object>((CollectionTypeId)returnTypeId, results);
}
示例13: evaluate
import org.eclipse.ocl.pivot.values.SetValue; //导入依赖的package包/类
@Override
public @NonNull SetValue evaluate(@NonNull Executor executor, @NonNull TypeId returnTypeId, @Nullable Object sourceVal, @Nullable Object typeVal) {
org.eclipse.ocl.pivot.Class type = asClass(typeVal);
if (!(sourceVal instanceof TypedModelInstance)) {
throw new InvalidValueException(PivotMessages.TypedValueRequired, "TypedModelInstance", getTypeName(sourceVal));
}
TypedModelInstance typedModelInstance = (TypedModelInstance)sourceVal;
Collection<@NonNull ? extends Object> results = typedModelInstance.getObjectsOfKind(type);
return createSetValue((CollectionTypeId)returnTypeId, new ArrayList<@NonNull Object>(results));
}
示例14: IPAdressesMustBeUnique
import org.eclipse.ocl.pivot.values.SetValue; //导入依赖的package包/类
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean IPAdressesMustBeUnique(final DiagnosticChain diagnostics, final Map<Object, Object> context) {
/**
*
* inv IPAdressesMustBeUnique:
* let
* severity : Integer[1] = 'Ipnetworkinterface::IPAdressesMustBeUnique'.getSeverity()
* in
* if severity <= 0
* then true
* else
* let
* result : occi::Boolean[1] = Ipnetworkinterface.allInstances()
* ->isUnique(occiNetworkinterfaceAddress)
* in
* 'Ipnetworkinterface::IPAdressesMustBeUnique'.logDiagnostic(self, null, diagnostics, context, null, severity, result, 0)
* endif
*/
final /*@NonInvalid*/ Executor executor = PivotUtilInternal.getExecutor(this);
final /*@NonInvalid*/ IdResolver idResolver = executor.getIdResolver();
final /*@NonInvalid*/ IntegerValue severity_0 = CGStringGetSeverityOperation.INSTANCE.evaluate(executor, InfrastructureTables.STR_Ipnetworkinterface_c_c_IPAdressesMustBeUnique);
final /*@NonInvalid*/ boolean le = OclComparableLessThanEqualOperation.INSTANCE.evaluate(executor, severity_0, InfrastructureTables.INT_0).booleanValue();
/*@NonInvalid*/ boolean symbol_0;
if (le) {
symbol_0 = ValueUtil.TRUE_VALUE;
}
else {
final /*@NonInvalid*/ org.eclipse.ocl.pivot.Class TYP_infrastructure_c_c_Ipnetworkinterface = idResolver.getClass(InfrastructureTables.CLSSid_Ipnetworkinterface, null);
final /*@NonInvalid*/ SetValue allInstances = ClassifierAllInstancesOperation.INSTANCE.evaluate(executor, InfrastructureTables.SET_CLSSid_Ipnetworkinterface, TYP_infrastructure_c_c_Ipnetworkinterface);
/*@Thrown*/ SetValue.Accumulator accumulator = ValueUtil.createSetAccumulatorValue(InfrastructureTables.SET_CLSSid_Ipnetworkinterface);
/*@NonNull*/ Iterator<Object> ITERATOR__1 = allInstances.iterator();
/*@NonInvalid*/ boolean result;
while (true) {
if (!ITERATOR__1.hasNext()) {
result = ValueUtil.TRUE_VALUE;
break;
}
/*@NonInvalid*/ Ipnetworkinterface _1 = (Ipnetworkinterface)ITERATOR__1.next();
/**
* occiNetworkinterfaceAddress
*/
final /*@NonInvalid*/ String occiNetworkinterfaceAddress = _1.getOcciNetworkinterfaceAddress();
//
if (accumulator.includes(occiNetworkinterfaceAddress) == ValueUtil.TRUE_VALUE) {
result = ValueUtil.FALSE_VALUE; // Abort after second find
break;
}
else {
accumulator.add(occiNetworkinterfaceAddress);
}
}
final /*@NonInvalid*/ boolean logDiagnostic = CGStringLogDiagnosticOperation.INSTANCE.evaluate(executor, TypeId.BOOLEAN, InfrastructureTables.STR_Ipnetworkinterface_c_c_IPAdressesMustBeUnique, this, (Object)null, diagnostics, context, (Object)null, severity_0, result, InfrastructureTables.INT_0).booleanValue();
symbol_0 = logDiagnostic;
}
return Boolean.TRUE == symbol_0;
}
示例15: UniqueVlan
import org.eclipse.ocl.pivot.values.SetValue; //导入依赖的package包/类
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean UniqueVlan(final DiagnosticChain diagnostics, final Map<Object, Object> context) {
/**
*
* inv UniqueVlan:
* let severity : Integer[1] = 'Network::UniqueVlan'.getSeverity()
* in
* if severity <= 0
* then true
* else
* let
* result : occi::Boolean[1] = Network.allInstances()
* ->isUnique(occiNetworkVlan)
* in
* 'Network::UniqueVlan'.logDiagnostic(self, null, diagnostics, context, null, severity, result, 0)
* endif
*/
final /*@NonInvalid*/ Executor executor = PivotUtilInternal.getExecutor(this);
final /*@NonInvalid*/ IdResolver idResolver = executor.getIdResolver();
final /*@NonInvalid*/ IntegerValue severity_0 = CGStringGetSeverityOperation.INSTANCE.evaluate(executor, InfrastructureTables.STR_Network_c_c_UniqueVlan);
final /*@NonInvalid*/ boolean le = OclComparableLessThanEqualOperation.INSTANCE.evaluate(executor, severity_0, InfrastructureTables.INT_0).booleanValue();
/*@NonInvalid*/ boolean symbol_0;
if (le) {
symbol_0 = ValueUtil.TRUE_VALUE;
}
else {
/*@Caught*/ /*@NonNull*/ Object CAUGHT_result;
try {
final /*@NonInvalid*/ org.eclipse.ocl.pivot.Class TYP_infrastructure_c_c_Network = idResolver.getClass(InfrastructureTables.CLSSid_Network, null);
final /*@NonInvalid*/ SetValue allInstances = ClassifierAllInstancesOperation.INSTANCE.evaluate(executor, InfrastructureTables.SET_CLSSid_Network, TYP_infrastructure_c_c_Network);
/*@Thrown*/ SetValue.Accumulator accumulator = ValueUtil.createSetAccumulatorValue(InfrastructureTables.SET_CLSSid_Network);
/*@NonNull*/ Iterator<Object> ITERATOR__1 = allInstances.iterator();
/*@Thrown*/ boolean result;
while (true) {
if (!ITERATOR__1.hasNext()) {
result = ValueUtil.TRUE_VALUE;
break;
}
/*@NonInvalid*/ Network _1 = (Network)ITERATOR__1.next();
/**
* occiNetworkVlan
*/
final /*@NonInvalid*/ Integer occiNetworkVlan = _1.getOcciNetworkVlan();
final /*@NonInvalid*/ IntegerValue BOXED_occiNetworkVlan = occiNetworkVlan == null ? null : ValueUtil.integerValueOf(occiNetworkVlan);
//
if (accumulator.includes(BOXED_occiNetworkVlan) == ValueUtil.TRUE_VALUE) {
result = ValueUtil.FALSE_VALUE; // Abort after second find
break;
}
else {
accumulator.add(BOXED_occiNetworkVlan);
}
}
CAUGHT_result = result;
}
catch (Exception e) {
CAUGHT_result = ValueUtil.createInvalidValue(e);
}
final /*@NonInvalid*/ boolean logDiagnostic = CGStringLogDiagnosticOperation.INSTANCE.evaluate(executor, TypeId.BOOLEAN, InfrastructureTables.STR_Network_c_c_UniqueVlan, this, (Object)null, diagnostics, context, (Object)null, severity_0, CAUGHT_result, InfrastructureTables.INT_0).booleanValue();
symbol_0 = logDiagnostic;
}
return Boolean.TRUE == symbol_0;
}