Package cruise.umple.compiler
Class UmpleTrait
java.lang.Object
cruise.umple.compiler.UmpleElement
cruise.umple.compiler.UmpleClassifier
cruise.umple.compiler.UmpleTrait
public class UmpleTrait extends UmpleClassifier
An UmpleTrait can contain attributes, associations, state machines and methods.
It can also have various other information such as a key (to identify uniqueness),
code to inject into generated code, and comments. It can be tagged with various
patterns.
--- before addDepend { if (depends.contains(aDepend)) { return false; } }
--- before setImmutable { if (!canBeImmutable()) { return false; } }
--- before addAssociationVariable { if (!immutabilityAssociationRulesSatisfied(aAssociationVariable, this.isImmutable())) { return false; } }
--- before setExtendsTrait { if (!enforceImmutabilityInheritanceRules(aExtendsClass)) { return false; } }
---------------------------------------------------------------------------------------------
------------------------------------class end------------------------------------------------
---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
------------------------------------class start----------------------------------------------
---------------------------------------------------------------------------------------------
-
Constructor Summary
Constructors Constructor Description UmpleTrait(java.lang.String aName, UmpleModel aSourceModel)
-
Method Summary
Methods inherited from class cruise.umple.compiler.UmpleClassifier
addConstant, addConstantAt, addDepend, addDependAt, addMethod, addMethodAt, addModelConstraint, addModelConstraintAt, addOrMoveConstantAt, addOrMoveDependAt, addOrMoveMethodAt, addOrMoveModelConstraintAt, getConstant, getConstants, getDepend, getDepends, getDistributeTechnology, getExtendsToken, getIsDistributable, getMethod, getMethods, getModelConstraint, getModelConstraints, getRelativePath, getSourceModel, hasConstants, hasDepends, hasExtendsToken, hasMethods, hasModelConstraints, indexOfConstant, indexOfDepend, indexOfMethod, indexOfModelConstraint, isIsDistributable, minimumNumberOfConstants, minimumNumberOfDepends, minimumNumberOfMethods, minimumNumberOfModelConstraints, numberOfConstants, numberOfDepends, numberOfMethods, numberOfModelConstraints, removeConstant, removeDepend, removeMethod, removeModelConstraint, setDistributeTechnology, setExtendsToken, setIsDistributable, setSourceModel
Methods inherited from class cruise.umple.compiler.UmpleElement
addEndPosition, addEndPositionAt, addNamespace, addOrMoveEndPositionAt, addOrMovePositionAt, addPosition, addPositionAt, appendExtraCode, appendExtraCode, appendExtraCode, getCoordinates, getDisplayColor, getEndPosition, getEndPositions, getExtraCode, getHasMainMethod, getIsInternal, getModifier, getName, getNamespace, getNameSpace, getNamespaces, getPackageName, getPosition, getPositions, hasEndPositions, hasExtraCode, hasNamespaces, hasPositions, indexOfEndPosition, indexOfNamespace, indexOfPosition, isHasMainMethod, isIsInternal, isUmpleClass, isUmpleInterface, minimumNumberOfEndPositions, minimumNumberOfPositions, numberOfEndPositions, numberOfNamespaces, numberOfPositions, removeEndPosition, removeNamespace, removePosition, resetExtraCode, setCoordinates, setDisplayColor, setHasMainMethod, setIsInternal, setModifier, setName, setNameSpace, setPackageName
-
Constructor Details
-
Method Details
-
setIsAbstract
public boolean setIsAbstract(boolean aIsAbstract) -
setIsSingleton
public boolean setIsSingleton(boolean aIsSingleton) -
addAssociation
-
removeAssociation
-
addUnimplementedMethod
-
removeUnimplementedMethod
-
setKey
-
getIsAbstract
public boolean getIsAbstract()Specifies whether or not the Umple class is an abstract class. -
getIsSingleton
public boolean getIsSingleton()Specifies whether or not the Umple trait is a singleton. -
getAssociation
-
getAssociations
-
numberOfAssociations
public int numberOfAssociations() -
hasAssociations
public boolean hasAssociations() -
indexOfAssociation
-
getUnimplementedMethod
-
getUnimplementedMethods
-
numberOfUnimplementedMethods
public int numberOfUnimplementedMethods() -
hasUnimplementedMethods
public boolean hasUnimplementedMethods() -
indexOfUnimplementedMethod
-
getKey
-
isIsAbstract
public boolean isIsAbstract() -
isIsSingleton
public boolean isIsSingleton() -
getCodeInjection
-
getCodeInjections
-
numberOfCodeInjections
public int numberOfCodeInjections() -
hasCodeInjections
public boolean hasCodeInjections() -
indexOfCodeInjection
-
getPreCond
-
getPreConds
The possible Preconditions related to the Umple Trait -
numberOfPreConds
public int numberOfPreConds() -
hasPreConds
public boolean hasPreConds() -
indexOfPreCond
-
getPostCond
-
getPostConds
The possible Preconditions related to the Umple Trait -
numberOfPostConds
public int numberOfPostConds() -
hasPostConds
public boolean hasPostConds() -
indexOfPostCond
-
getConstraintTree
-
getConstraintTrees
The possible Constraints related to the Umple Trait -
numberOfConstraintTrees
public int numberOfConstraintTrees() -
hasConstraintTrees
public boolean hasConstraintTrees() -
indexOfConstraintTree
-
getExtendsTrait
-
getExtendsTraits
The Umple Trait's super Traits (if there are ones). -
numberOfExtendsTraits
public int numberOfExtendsTraits() -
hasExtendsTraits
public boolean hasExtendsTraits() -
indexOfExtendsTrait
-
getUniqueIdentifier
-
hasUniqueIdentifier
public boolean hasUniqueIdentifier() -
getAttribute
-
getAttributes
The attributes contained within the Umple trait. -
numberOfAttributes
public int numberOfAttributes() -
hasAttributes
public boolean hasAttributes() -
indexOfAttribute
-
getAssociationVariable
-
getAssociationVariables
The associations contained within the Umple trait. -
numberOfAssociationVariables
public int numberOfAssociationVariables() -
hasAssociationVariables
public boolean hasAssociationVariables() -
indexOfAssociationVariable
-
getComment
-
getComments
The comments associated with the Umple Trait (such as the Javadoc above it). -
numberOfComments
public int numberOfComments() -
hasComments
public boolean hasComments() -
indexOfComment
-
getRequirement
-
getRequirements
The requirement associated with the Umple Trait (such as the Javadoc above it). -
numberOfRequirements
public int numberOfRequirements() -
hasRequirements
public boolean hasRequirements() -
indexOfRequirement
-
getGeneralTemplateParameter
-
getGeneralTemplateParameters
The template parameters which are specified when traits are defined. -
numberOfGeneralTemplateParameters
public int numberOfGeneralTemplateParameters() -
hasGeneralTemplateParameters
public boolean hasGeneralTemplateParameters() -
indexOfGeneralTemplateParameter
-
getGeneralTPApplied
-
getGeneralTPApplieds
This is used to assign inheritance parameters. -
numberOfGeneralTPApplieds
public int numberOfGeneralTPApplieds() -
hasGeneralTPApplieds
public boolean hasGeneralTPApplieds() -
indexOfGeneralTPApplied
-
getRequiredInterface
-
getRequiredInterfaces
This is used to assign required interfaces -
numberOfRequiredInterfaces
public int numberOfRequiredInterfaces() -
hasRequiredInterfaces
public boolean hasRequiredInterfaces() -
indexOfRequiredInterface
-
getUmpleTestCase
-
getUmpleTestCases
trait test cases -
numberOfUmpleTestCases
public int numberOfUmpleTestCases() -
hasUmpleTestCases
public boolean hasUmpleTestCases() -
indexOfUmpleTestCase
-
getStateMachine
-
getStateMachines
-
numberOfStateMachines
public int numberOfStateMachines() -
hasStateMachines
public boolean hasStateMachines() -
indexOfStateMachine
-
getSubClass
-
getSubClasses
-
numberOfSubClasses
public int numberOfSubClasses() -
hasSubClasses
public boolean hasSubClasses() -
indexOfSubClass
-
getSubTrait
-
getSubTraits
-
numberOfSubTraits
public int numberOfSubTraits() -
hasSubTraits
public boolean hasSubTraits() -
indexOfSubTrait
-
minimumNumberOfCodeInjections
public static int minimumNumberOfCodeInjections() -
addCodeInjection
-
removeCodeInjection
-
addCodeInjectionAt
-
addOrMoveCodeInjectionAt
-
minimumNumberOfPreConds
public static int minimumNumberOfPreConds() -
addPreCond
-
removePreCond
-
addPreCondAt
-
addOrMovePreCondAt
-
minimumNumberOfPostConds
public static int minimumNumberOfPostConds() -
addPostCond
-
removePostCond
-
addPostCondAt
-
addOrMovePostCondAt
-
minimumNumberOfConstraintTrees
public static int minimumNumberOfConstraintTrees() -
addConstraintTree
-
removeConstraintTree
-
addConstraintTreeAt
-
addOrMoveConstraintTreeAt
-
minimumNumberOfExtendsTraits
public static int minimumNumberOfExtendsTraits() -
addExtendsTrait
-
removeExtendsTrait
-
addExtendsTraitAt
-
addOrMoveExtendsTraitAt
-
setUniqueIdentifier
-
minimumNumberOfAttributes
public static int minimumNumberOfAttributes() -
addAttribute
-
removeAttribute
-
addAttributeAt
-
addOrMoveAttributeAt
-
minimumNumberOfAssociationVariables
public static int minimumNumberOfAssociationVariables() -
addAssociationVariable
-
removeAssociationVariable
-
addAssociationVariableAt
-
addOrMoveAssociationVariableAt
-
minimumNumberOfComments
public static int minimumNumberOfComments() -
addComment
-
removeComment
-
addCommentAt
-
addOrMoveCommentAt
-
minimumNumberOfRequirements
public static int minimumNumberOfRequirements() -
addRequirement
-
removeRequirement
-
addRequirementAt
-
addOrMoveRequirementAt
-
minimumNumberOfGeneralTemplateParameters
public static int minimumNumberOfGeneralTemplateParameters() -
addGeneralTemplateParameter
-
removeGeneralTemplateParameter
-
addGeneralTemplateParameterAt
public boolean addGeneralTemplateParameterAt(GeneralTemplateParameter aGeneralTemplateParameter, int index) -
addOrMoveGeneralTemplateParameterAt
public boolean addOrMoveGeneralTemplateParameterAt(GeneralTemplateParameter aGeneralTemplateParameter, int index) -
minimumNumberOfGeneralTPApplieds
public static int minimumNumberOfGeneralTPApplieds() -
addGeneralTPApplied
-
removeGeneralTPApplied
-
addGeneralTPAppliedAt
-
addOrMoveGeneralTPAppliedAt
-
minimumNumberOfRequiredInterfaces
public static int minimumNumberOfRequiredInterfaces() -
addRequiredInterface
-
removeRequiredInterface
-
addRequiredInterfaceAt
-
addOrMoveRequiredInterfaceAt
-
minimumNumberOfUmpleTestCases
public static int minimumNumberOfUmpleTestCases() -
addUmpleTestCase
-
removeUmpleTestCase
-
addUmpleTestCaseAt
-
addOrMoveUmpleTestCaseAt
-
minimumNumberOfStateMachines
public static int minimumNumberOfStateMachines() -
addStateMachine
-
removeStateMachine
-
addStateMachineAt
-
addOrMoveStateMachineAt
-
minimumNumberOfSubClasses
public static int minimumNumberOfSubClasses() -
addSubClass
-
removeSubClass
-
addSubClassAt
-
addOrMoveSubClassAt
-
minimumNumberOfSubTraits
public static int minimumNumberOfSubTraits() -
addSubTrait
-
removeSubTrait
-
addSubTraitAt
-
addOrMoveSubTraitAt
-
delete
public void delete()- Overrides:
delete
in classUmpleClassifier
-
isUmpleTrait
public boolean isUmpleTrait()- Overrides:
isUmpleTrait
in classUmpleElement
-
getGeneralTPAppliedByName
-
hasGeneralTemplateParameter
public boolean hasGeneralTemplateParameter(java.lang.String name) -
hasCascadeMethod
-
getAttribute
-
getAssociationVariable
-
isImmutable
public boolean isImmutable() -
setImmutable
public boolean setImmutable() -
immutabilityAssociationRulesSatisfied
protected boolean immutabilityAssociationRulesSatisfied(AssociationVariable myAV, boolean myTraitImmutable) -
immutabilityAssociationRulesSatisfied
protected static boolean immutabilityAssociationRulesSatisfied(AssociationVariable myAV, UmpleTrait myTrait, boolean myTraitImmutable, AssociationVariable yourAV, UmpleTrait yourTrait, boolean yourTraitImmutable) -
setAncestorIsImmutable
protected boolean setAncestorIsImmutable(boolean isImmutable) -
setExtendsTrait
-
getMethod
-
getStateMachine
-
hasMethod
- Overrides:
hasMethod
in classUmpleClassifier
-
hasDefinedParameter
public boolean hasDefinedParameter(java.lang.String name, java.lang.String type)This section is related to codes which is going to support general templates for traits -------------------------------------------------------------------------------------- ----------------------------------start----------------------------------------------- -
setDefinedParameterType
public void setDefinedParameterType(java.lang.String name, java.lang.String type) -
getGeneralTemplateParameterIndexByName
public java.lang.Integer getGeneralTemplateParameterIndexByName(java.lang.String name, java.lang.String type) -
getGeneralTemplateParameterByName
-
toString
public java.lang.String toString()- Overrides:
toString
in classUmpleClassifier
-