Class DelegatingType
- java.lang.Object
-
- net.ssehub.easy.varModel.model.datatypes.DelegatingType
-
- All Implemented Interfaces:
IDatatype,IDatatypeVisitable
class DelegatingType extends java.lang.Object implements IDatatype
An internal delegating type to resolve cyclic class dependencies. A delegating type represents (common) singleton type instances.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private IDatatypedelegateStores the type to delegate to.private java.util.List<Operation>operationListprivate DelegatingTypeparentprivate intparentOperationCount
-
Constructor Summary
Constructors Constructor Description DelegatingType()Creates a delegating type.DelegatingType(DelegatingType parent)Creates a delegating type.DelegatingType(IDatatype delegate)Creates a delegating type.DelegatingType(IDatatype delegate, DelegatingType parent)Creates a delegating type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(IDatatypeVisitor visitor)Accepts a specialized visitor for creating a textual representation of the identity of this type.(package private) voidaddOperation(Operation operator)Allows child classes to add Operations to itself.private OperationgetAllOperation(int index)Returns the operation at positionindexand considers also parent operations.private intgetAllOperationCount()Returns the number of operations of the parent an all parents above.IDatatypegetDelegate()Returns the delegate type.IDatatypegetGenericType(int index)Returns the specified generic type.intgetGenericTypeCount()Returns the number of generic types.java.lang.StringgetName()Method to get the name of the Datatype.java.lang.StringgetNameSpace()Returns the namespace of this datatype.OperationgetOperation(int index)Returns the operation specified byindex.intgetOperationCount()Returns the number of operations.java.lang.StringgetQualifiedName()Returns the qualified name of this element.IDatatypegetType()Returns the object realizing the type.java.lang.Class<? extends IDatatype>getTypeClass()Returns the java class realizing the type.java.lang.StringgetUniqueName()Returns the unique name of this element.booleanisAssignableFrom(IDatatype type)Determines if the data type represented by this object is either the same as, or is a supertype oftype.booleanisPrimitive()Returns whether this type is a primitive type.booleanisPseudoType()Returns whether this type is a pseudo type.(package private) voidprependOperation(Operation operator)Allows child classes to add Operations to itself.voidsetDelegate(IDatatype delegate)Changes the delegate.java.lang.StringtoString()voidupdateParentInformation()Updates the information collected about the parent.
-
-
-
Field Detail
-
operationList
private java.util.List<Operation> operationList
-
delegate
private IDatatype delegate
Stores the type to delegate to.
-
parent
private DelegatingType parent
-
parentOperationCount
private int parentOperationCount
-
-
Constructor Detail
-
DelegatingType
DelegatingType()
Creates a delegating type.
-
DelegatingType
DelegatingType(IDatatype delegate)
Creates a delegating type.- Parameters:
delegate- the delegate
-
DelegatingType
DelegatingType(DelegatingType parent)
Creates a delegating type.- Parameters:
parent- the parent delegate (considers operations)
-
DelegatingType
DelegatingType(IDatatype delegate, DelegatingType parent)
Creates a delegating type.- Parameters:
delegate- the delegateparent- the parent delegate (considers operations)
-
-
Method Detail
-
updateParentInformation
public void updateParentInformation()
Updates the information collected about the parent.
-
getAllOperationCount
private int getAllOperationCount()
Returns the number of operations of the parent an all parents above.- Returns:
- the number of operation
-
getAllOperation
private Operation getAllOperation(int index)
Returns the operation at positionindexand considers also parent operations.- Parameters:
index- the index number of the operation- Returns:
- the specified operation
- Throws:
java.lang.IndexOutOfBoundsException- ifindex<0 || index>=getAllOperationCount()
-
setDelegate
public void setDelegate(IDatatype delegate)
Changes the delegate.- Parameters:
delegate- the new delegate
-
getName
public java.lang.String getName()
Description copied from interface:IDatatypeMethod to get the name of the Datatype.
-
getNameSpace
public java.lang.String getNameSpace()
Description copied from interface:IDatatypeReturns the namespace of this datatype.- Specified by:
getNameSpacein interfaceIDatatype- Returns:
- Namespace of this datatype.
-
getQualifiedName
public java.lang.String getQualifiedName()
Description copied from interface:IDatatypeReturns the qualified name of this element.- Specified by:
getQualifiedNamein interfaceIDatatype- Returns:
- the qualified name
-
getUniqueName
public java.lang.String getUniqueName()
Description copied from interface:IDatatypeReturns the unique name of this element.- Specified by:
getUniqueNamein interfaceIDatatype- Returns:
- the unique name
-
getOperation
public Operation getOperation(int index)
Description copied from interface:IDatatypeReturns the operation specified byindex.- Specified by:
getOperationin interfaceIDatatype- Parameters:
index- a 0-based index specifying the operation to be returned- Returns:
- the operation
-
getOperationCount
public int getOperationCount()
Description copied from interface:IDatatypeReturns the number of operations.- Specified by:
getOperationCountin interfaceIDatatype- Returns:
- the number of operations
-
isAssignableFrom
public boolean isAssignableFrom(IDatatype type)
Description copied from interface:IDatatypeDetermines if the data type represented by this object is either the same as, or is a supertype oftype.- Specified by:
isAssignableFromin interfaceIDatatype- Parameters:
type- the type being checked- Returns:
trueif this type is either the same or a supertype oftype,falseelse
-
addOperation
void addOperation(Operation operator)
Allows child classes to add Operations to itself.- Parameters:
operator- One operation, which should be added.
-
prependOperation
void prependOperation(Operation operator)
Allows child classes to add Operations to itself.- Parameters:
operator- One operation, which should be added.
-
getTypeClass
public java.lang.Class<? extends IDatatype> getTypeClass()
Description copied from interface:IDatatypeReturns the java class realizing the type.- Specified by:
getTypeClassin interfaceIDatatype- Returns:
- the java class realizing the type
-
getType
public IDatatype getType()
Returns the object realizing the type.
-
getGenericType
public IDatatype getGenericType(int index)
Description copied from interface:IDatatypeReturns the specified generic type.- Specified by:
getGenericTypein interfaceIDatatype- Parameters:
index- the index of the type- Returns:
- the specified generic type
-
getGenericTypeCount
public int getGenericTypeCount()
Description copied from interface:IDatatypeReturns the number of generic types.- Specified by:
getGenericTypeCountin interfaceIDatatype- Returns:
- the number of generic types
-
accept
public void accept(IDatatypeVisitor visitor)
Description copied from interface:IDatatypeVisitableAccepts a specialized visitor for creating a textual representation of the identity of this type.- Specified by:
acceptin interfaceIDatatypeVisitable- Parameters:
visitor- the visitor to accept
-
isPseudoType
public boolean isPseudoType()
Description copied from interface:IDatatypeReturns whether this type is a pseudo type. This operation shall be used to prevent the output of internal types to the user.- Specified by:
isPseudoTypein interfaceIDatatype- Returns:
trueif it is a pseudo type,falseelse
-
getDelegate
public IDatatype getDelegate()
Returns the delegate type.- Returns:
- the delegate type
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
isPrimitive
public boolean isPrimitive()
Description copied from interface:IDatatypeReturns whether this type is a primitive type.- Specified by:
isPrimitivein interfaceIDatatype- Returns:
trueif it is a primitive type,falseelse
-
-