blob: 65815d5df08b79b9fd565e372c21c6602f0771d4 [file] [log] [blame]
/**
* <copyright>
*
* Copyright (c) 2012 E.D.Willink and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* E.D.Willink - Initial API and implementation
*
* </copyright>
*************************************************************************
* This code is 100% auto-generated
* from: pivot
* using: org.eclipse.ocl.examples.codegen.tables.model2tables.mtl
*
* Do not edit it.
*/
package org.eclipse.ocl.examples.pivot.bodies;
import org.eclipse.ocl.examples.domain.elements.DomainStandardLibrary;
import org.eclipse.ocl.examples.domain.elements.DomainType;
import org.eclipse.ocl.examples.domain.evaluation.DomainEvaluator;
import org.eclipse.ocl.examples.domain.evaluation.InvalidValueException;
import org.eclipse.ocl.examples.domain.library.AbstractUnaryOperation;
import org.eclipse.ocl.examples.domain.library.LibraryBinaryOperation;
import org.eclipse.ocl.examples.domain.library.LibraryProperty;
import org.eclipse.ocl.examples.domain.values.Value;
import org.eclipse.ocl.examples.domain.values.ValueFactory;
import org.eclipse.ocl.examples.library.executor.ExecutorOperation;
import org.eclipse.ocl.examples.library.executor.ExecutorProperty;
import org.eclipse.ocl.examples.library.executor.ExecutorType;
import org.eclipse.ocl.examples.library.oclstdlib.OCLstdlibTables;
import org.eclipse.ocl.examples.pivot.PivotTables;
/**
* CollectionLiteralExpBodies provides the Java implementation bodies of OCL-defined CollectionLiteralExp operations and properties.
*/
@SuppressWarnings("nls")
public class CollectionLiteralExpBodies
{
/**
* Implementation of the CollectionLiteralExp 'BagKindIsBag' invariant.
*/
public static class _invariant_BagKindIsBag extends AbstractUnaryOperation
{
public static _invariant_BagKindIsBag INSTANCE = new _invariant_BagKindIsBag();
/*
kind = CollectionKind::Bag implies type.oclIsKindOf(BagType)
*/
public Value evaluate(DomainEvaluator evaluator, DomainType returnType, final Value self) throws InvalidValueException {
final ValueFactory valueFactory = evaluator.getValueFactory();
final DomainStandardLibrary standardLibrary = valueFactory.getStandardLibrary();
final ExecutorType T_Boolean = OCLstdlibTables.Types._Boolean;
final ExecutorOperation O_Boolean_implies = OCLstdlibTables.Operations._Boolean__implies;
final ExecutorOperation O_OclAny__eq_ = OCLstdlibTables.Operations._OclAny___eq_;
final ExecutorType T_Pivot_ecore__pivot__CollectionKind = PivotTables.Types._CollectionKind;
final ExecutorProperty P_CollectionLiteralExp_kind = PivotTables.Properties._CollectionLiteralExp__kind;
final LibraryProperty IP_CollectionLiteralExp_kind = P_CollectionLiteralExp_kind.getImplementation();
final Value A_symbol_57 = valueFactory.createEnumerationLiteralValue(PivotTables.EnumerationLiterals._CollectionKind__Bag);
final ExecutorOperation O_OclAny_oclIsKindOf = OCLstdlibTables.Operations._OclAny__oclIsKindOf;
final ExecutorType T_Pivot_ecore__pivot__Type = PivotTables.Types._Type;
final ExecutorProperty P_TypedElement_type = PivotTables.Properties._TypedElement__type;
final LibraryProperty IP_TypedElement_type = P_TypedElement_type.getImplementation();
final Value T_ClassClassifier_Pivot_ecore__pivot__BagType_ = valueFactory.createTypeValue(PivotTables.Types._BagType);
Value leftA_symbol_58;
try {
Value A_symbol_59 = IP_CollectionLiteralExp_kind.evaluate(evaluator, T_Pivot_ecore__pivot__CollectionKind, self, P_CollectionLiteralExp_kind);
DomainType static_A_symbol_60 = valueFactory.typeOf(A_symbol_59, A_symbol_57);
LibraryBinaryOperation dynamic_A_symbol_60 = (LibraryBinaryOperation)static_A_symbol_60.lookupImplementation(standardLibrary, O_OclAny__eq_);
Value A_symbol_60 = dynamic_A_symbol_60.evaluate(evaluator, T_Boolean, A_symbol_59, A_symbol_57);
leftA_symbol_58 = A_symbol_60;
} catch (InvalidValueException e) {
leftA_symbol_58 = valueFactory.createInvalidValue(e);
}
Value A_symbol_60 = leftA_symbol_58;
Value rightA_symbol_58;
try {
Value A_symbol_61 = IP_TypedElement_type.evaluate(evaluator, T_Pivot_ecore__pivot__Type, self, P_TypedElement_type);
DomainType static_A_symbol_62 = valueFactory.typeOf(A_symbol_61);
LibraryBinaryOperation dynamic_A_symbol_62 = (LibraryBinaryOperation)static_A_symbol_62.lookupImplementation(standardLibrary, O_OclAny_oclIsKindOf);
Value A_symbol_62 = dynamic_A_symbol_62.evaluate(evaluator, T_Boolean, A_symbol_61, T_ClassClassifier_Pivot_ecore__pivot__BagType_);
rightA_symbol_58 = A_symbol_62;
} catch (InvalidValueException e) {
rightA_symbol_58 = valueFactory.createInvalidValue(e);
}
Value A_symbol_62 = rightA_symbol_58;
DomainType static_A_symbol_58 = valueFactory.typeOf(A_symbol_60);
LibraryBinaryOperation dynamic_A_symbol_58 = (LibraryBinaryOperation)static_A_symbol_58.lookupImplementation(standardLibrary, O_Boolean_implies);
Value A_symbol_58 = dynamic_A_symbol_58.evaluate(evaluator, T_Boolean, A_symbol_60, A_symbol_62);
return A_symbol_58;
}
}
/**
* Implementation of the CollectionLiteralExp 'CollectionKindIsConcrete' invariant.
*/
public static class _invariant_CollectionKindIsConcrete extends AbstractUnaryOperation
{
public static _invariant_CollectionKindIsConcrete INSTANCE = new _invariant_CollectionKindIsConcrete();
/*
kind <> CollectionKind::Collection
*/
public Value evaluate(DomainEvaluator evaluator, DomainType returnType, final Value self) throws InvalidValueException {
final ValueFactory valueFactory = evaluator.getValueFactory();
final DomainStandardLibrary standardLibrary = valueFactory.getStandardLibrary();
final ExecutorType T_Boolean = OCLstdlibTables.Types._Boolean;
final ExecutorOperation O_OclAny__lt__gt_ = OCLstdlibTables.Operations._OclAny___lt__gt_;
final ExecutorType T_Pivot_ecore__pivot__CollectionKind = PivotTables.Types._CollectionKind;
final ExecutorProperty P_CollectionLiteralExp_kind = PivotTables.Properties._CollectionLiteralExp__kind;
final LibraryProperty IP_CollectionLiteralExp_kind = P_CollectionLiteralExp_kind.getImplementation();
final Value A_symbol_63 = valueFactory.createEnumerationLiteralValue(PivotTables.EnumerationLiterals._CollectionKind__Collection);
Value A_symbol_64 = IP_CollectionLiteralExp_kind.evaluate(evaluator, T_Pivot_ecore__pivot__CollectionKind, self, P_CollectionLiteralExp_kind);
DomainType static_A_symbol_65 = valueFactory.typeOf(A_symbol_64, A_symbol_63);
LibraryBinaryOperation dynamic_A_symbol_65 = (LibraryBinaryOperation)static_A_symbol_65.lookupImplementation(standardLibrary, O_OclAny__lt__gt_);
Value A_symbol_65 = dynamic_A_symbol_65.evaluate(evaluator, T_Boolean, A_symbol_64, A_symbol_63);
return A_symbol_65;
}
}
/**
* Implementation of the CollectionLiteralExp 'OrderedSetKindIsOrderedSet' invariant.
*/
public static class _invariant_OrderedSetKindIsOrderedSet extends AbstractUnaryOperation
{
public static _invariant_OrderedSetKindIsOrderedSet INSTANCE = new _invariant_OrderedSetKindIsOrderedSet();
/*
kind = CollectionKind::OrderedSet implies
type.oclIsKindOf(OrderedSetType)
*/
public Value evaluate(DomainEvaluator evaluator, DomainType returnType, final Value self) throws InvalidValueException {
final ValueFactory valueFactory = evaluator.getValueFactory();
final DomainStandardLibrary standardLibrary = valueFactory.getStandardLibrary();
final ExecutorType T_Boolean = OCLstdlibTables.Types._Boolean;
final ExecutorOperation O_Boolean_implies = OCLstdlibTables.Operations._Boolean__implies;
final ExecutorOperation O_OclAny__eq_ = OCLstdlibTables.Operations._OclAny___eq_;
final ExecutorType T_Pivot_ecore__pivot__CollectionKind = PivotTables.Types._CollectionKind;
final ExecutorProperty P_CollectionLiteralExp_kind = PivotTables.Properties._CollectionLiteralExp__kind;
final LibraryProperty IP_CollectionLiteralExp_kind = P_CollectionLiteralExp_kind.getImplementation();
final Value A_symbol_66 = valueFactory.createEnumerationLiteralValue(PivotTables.EnumerationLiterals._CollectionKind__OrderedSet);
final ExecutorOperation O_OclAny_oclIsKindOf = OCLstdlibTables.Operations._OclAny__oclIsKindOf;
final ExecutorType T_Pivot_ecore__pivot__Type = PivotTables.Types._Type;
final ExecutorProperty P_TypedElement_type = PivotTables.Properties._TypedElement__type;
final LibraryProperty IP_TypedElement_type = P_TypedElement_type.getImplementation();
final Value T_ClassClassifier_Pivot_ecore__pivot__OrderedSetType_ = valueFactory.createTypeValue(PivotTables.Types._OrderedSetType);
Value leftA_symbol_67;
try {
Value A_symbol_68 = IP_CollectionLiteralExp_kind.evaluate(evaluator, T_Pivot_ecore__pivot__CollectionKind, self, P_CollectionLiteralExp_kind);
DomainType static_A_symbol_69 = valueFactory.typeOf(A_symbol_68, A_symbol_66);
LibraryBinaryOperation dynamic_A_symbol_69 = (LibraryBinaryOperation)static_A_symbol_69.lookupImplementation(standardLibrary, O_OclAny__eq_);
Value A_symbol_69 = dynamic_A_symbol_69.evaluate(evaluator, T_Boolean, A_symbol_68, A_symbol_66);
leftA_symbol_67 = A_symbol_69;
} catch (InvalidValueException e) {
leftA_symbol_67 = valueFactory.createInvalidValue(e);
}
Value A_symbol_69 = leftA_symbol_67;
Value rightA_symbol_67;
try {
Value A_symbol_70 = IP_TypedElement_type.evaluate(evaluator, T_Pivot_ecore__pivot__Type, self, P_TypedElement_type);
DomainType static_A_symbol_71 = valueFactory.typeOf(A_symbol_70);
LibraryBinaryOperation dynamic_A_symbol_71 = (LibraryBinaryOperation)static_A_symbol_71.lookupImplementation(standardLibrary, O_OclAny_oclIsKindOf);
Value A_symbol_71 = dynamic_A_symbol_71.evaluate(evaluator, T_Boolean, A_symbol_70, T_ClassClassifier_Pivot_ecore__pivot__OrderedSetType_);
rightA_symbol_67 = A_symbol_71;
} catch (InvalidValueException e) {
rightA_symbol_67 = valueFactory.createInvalidValue(e);
}
Value A_symbol_71 = rightA_symbol_67;
DomainType static_A_symbol_67 = valueFactory.typeOf(A_symbol_69);
LibraryBinaryOperation dynamic_A_symbol_67 = (LibraryBinaryOperation)static_A_symbol_67.lookupImplementation(standardLibrary, O_Boolean_implies);
Value A_symbol_67 = dynamic_A_symbol_67.evaluate(evaluator, T_Boolean, A_symbol_69, A_symbol_71);
return A_symbol_67;
}
}
/**
* Implementation of the CollectionLiteralExp 'SequenceKindIsSequence' invariant.
*/
public static class _invariant_SequenceKindIsSequence extends AbstractUnaryOperation
{
public static _invariant_SequenceKindIsSequence INSTANCE = new _invariant_SequenceKindIsSequence();
/*
kind = CollectionKind::Sequence implies
type.oclIsKindOf(SequenceType)
*/
public Value evaluate(DomainEvaluator evaluator, DomainType returnType, final Value self) throws InvalidValueException {
final ValueFactory valueFactory = evaluator.getValueFactory();
final DomainStandardLibrary standardLibrary = valueFactory.getStandardLibrary();
final ExecutorType T_Boolean = OCLstdlibTables.Types._Boolean;
final ExecutorOperation O_Boolean_implies = OCLstdlibTables.Operations._Boolean__implies;
final ExecutorOperation O_OclAny__eq_ = OCLstdlibTables.Operations._OclAny___eq_;
final ExecutorType T_Pivot_ecore__pivot__CollectionKind = PivotTables.Types._CollectionKind;
final ExecutorProperty P_CollectionLiteralExp_kind = PivotTables.Properties._CollectionLiteralExp__kind;
final LibraryProperty IP_CollectionLiteralExp_kind = P_CollectionLiteralExp_kind.getImplementation();
final Value A_symbol_72 = valueFactory.createEnumerationLiteralValue(PivotTables.EnumerationLiterals._CollectionKind__Sequence);
final ExecutorOperation O_OclAny_oclIsKindOf = OCLstdlibTables.Operations._OclAny__oclIsKindOf;
final ExecutorType T_Pivot_ecore__pivot__Type = PivotTables.Types._Type;
final ExecutorProperty P_TypedElement_type = PivotTables.Properties._TypedElement__type;
final LibraryProperty IP_TypedElement_type = P_TypedElement_type.getImplementation();
final Value T_ClassClassifier_Pivot_ecore__pivot__SequenceType_ = valueFactory.createTypeValue(PivotTables.Types._SequenceType);
Value leftA_symbol_73;
try {
Value A_symbol_74 = IP_CollectionLiteralExp_kind.evaluate(evaluator, T_Pivot_ecore__pivot__CollectionKind, self, P_CollectionLiteralExp_kind);
DomainType static_A_symbol_75 = valueFactory.typeOf(A_symbol_74, A_symbol_72);
LibraryBinaryOperation dynamic_A_symbol_75 = (LibraryBinaryOperation)static_A_symbol_75.lookupImplementation(standardLibrary, O_OclAny__eq_);
Value A_symbol_75 = dynamic_A_symbol_75.evaluate(evaluator, T_Boolean, A_symbol_74, A_symbol_72);
leftA_symbol_73 = A_symbol_75;
} catch (InvalidValueException e) {
leftA_symbol_73 = valueFactory.createInvalidValue(e);
}
Value A_symbol_75 = leftA_symbol_73;
Value rightA_symbol_73;
try {
Value A_symbol_76 = IP_TypedElement_type.evaluate(evaluator, T_Pivot_ecore__pivot__Type, self, P_TypedElement_type);
DomainType static_A_symbol_77 = valueFactory.typeOf(A_symbol_76);
LibraryBinaryOperation dynamic_A_symbol_77 = (LibraryBinaryOperation)static_A_symbol_77.lookupImplementation(standardLibrary, O_OclAny_oclIsKindOf);
Value A_symbol_77 = dynamic_A_symbol_77.evaluate(evaluator, T_Boolean, A_symbol_76, T_ClassClassifier_Pivot_ecore__pivot__SequenceType_);
rightA_symbol_73 = A_symbol_77;
} catch (InvalidValueException e) {
rightA_symbol_73 = valueFactory.createInvalidValue(e);
}
Value A_symbol_77 = rightA_symbol_73;
DomainType static_A_symbol_73 = valueFactory.typeOf(A_symbol_75);
LibraryBinaryOperation dynamic_A_symbol_73 = (LibraryBinaryOperation)static_A_symbol_73.lookupImplementation(standardLibrary, O_Boolean_implies);
Value A_symbol_73 = dynamic_A_symbol_73.evaluate(evaluator, T_Boolean, A_symbol_75, A_symbol_77);
return A_symbol_73;
}
}
/**
* Implementation of the CollectionLiteralExp 'SetKindIsSet' invariant.
*/
public static class _invariant_SetKindIsSet extends AbstractUnaryOperation
{
public static _invariant_SetKindIsSet INSTANCE = new _invariant_SetKindIsSet();
/*
kind = CollectionKind::Set implies type.oclIsKindOf(SetType)
*/
public Value evaluate(DomainEvaluator evaluator, DomainType returnType, final Value self) throws InvalidValueException {
final ValueFactory valueFactory = evaluator.getValueFactory();
final DomainStandardLibrary standardLibrary = valueFactory.getStandardLibrary();
final ExecutorType T_Boolean = OCLstdlibTables.Types._Boolean;
final ExecutorOperation O_Boolean_implies = OCLstdlibTables.Operations._Boolean__implies;
final ExecutorOperation O_OclAny__eq_ = OCLstdlibTables.Operations._OclAny___eq_;
final ExecutorType T_Pivot_ecore__pivot__CollectionKind = PivotTables.Types._CollectionKind;
final ExecutorProperty P_CollectionLiteralExp_kind = PivotTables.Properties._CollectionLiteralExp__kind;
final LibraryProperty IP_CollectionLiteralExp_kind = P_CollectionLiteralExp_kind.getImplementation();
final Value A_symbol_78 = valueFactory.createEnumerationLiteralValue(PivotTables.EnumerationLiterals._CollectionKind__Set);
final ExecutorOperation O_OclAny_oclIsKindOf = OCLstdlibTables.Operations._OclAny__oclIsKindOf;
final ExecutorType T_Pivot_ecore__pivot__Type = PivotTables.Types._Type;
final ExecutorProperty P_TypedElement_type = PivotTables.Properties._TypedElement__type;
final LibraryProperty IP_TypedElement_type = P_TypedElement_type.getImplementation();
final Value T_ClassClassifier_Pivot_ecore__pivot__SetType_ = valueFactory.createTypeValue(PivotTables.Types._SetType);
Value leftA_symbol_79;
try {
Value A_symbol_80 = IP_CollectionLiteralExp_kind.evaluate(evaluator, T_Pivot_ecore__pivot__CollectionKind, self, P_CollectionLiteralExp_kind);
DomainType static_A_symbol_81 = valueFactory.typeOf(A_symbol_80, A_symbol_78);
LibraryBinaryOperation dynamic_A_symbol_81 = (LibraryBinaryOperation)static_A_symbol_81.lookupImplementation(standardLibrary, O_OclAny__eq_);
Value A_symbol_81 = dynamic_A_symbol_81.evaluate(evaluator, T_Boolean, A_symbol_80, A_symbol_78);
leftA_symbol_79 = A_symbol_81;
} catch (InvalidValueException e) {
leftA_symbol_79 = valueFactory.createInvalidValue(e);
}
Value A_symbol_81 = leftA_symbol_79;
Value rightA_symbol_79;
try {
Value A_symbol_82 = IP_TypedElement_type.evaluate(evaluator, T_Pivot_ecore__pivot__Type, self, P_TypedElement_type);
DomainType static_A_symbol_83 = valueFactory.typeOf(A_symbol_82);
LibraryBinaryOperation dynamic_A_symbol_83 = (LibraryBinaryOperation)static_A_symbol_83.lookupImplementation(standardLibrary, O_OclAny_oclIsKindOf);
Value A_symbol_83 = dynamic_A_symbol_83.evaluate(evaluator, T_Boolean, A_symbol_82, T_ClassClassifier_Pivot_ecore__pivot__SetType_);
rightA_symbol_79 = A_symbol_83;
} catch (InvalidValueException e) {
rightA_symbol_79 = valueFactory.createInvalidValue(e);
}
Value A_symbol_83 = rightA_symbol_79;
DomainType static_A_symbol_79 = valueFactory.typeOf(A_symbol_81);
LibraryBinaryOperation dynamic_A_symbol_79 = (LibraryBinaryOperation)static_A_symbol_79.lookupImplementation(standardLibrary, O_Boolean_implies);
Value A_symbol_79 = dynamic_A_symbol_79.evaluate(evaluator, T_Boolean, A_symbol_81, A_symbol_83);
return A_symbol_79;
}
}
}