Class IvmlElement
- java.lang.Object
-
- net.ssehub.easy.instantiation.core.model.vilTypes.configuration.IvmlElement
-
- All Implemented Interfaces:
IResolvable,IStringValueProvider,IVilType
- Direct Known Subclasses:
AbstractIvmlVariable,Configuration,EnumValue,IvmlDeclaration
public abstract class IvmlElement extends java.lang.Object implements IVilType, IResolvable, IStringValueProvider
Denotes an element resolved in IVML. This must not be an interface as it provides implemented IVML operations.- Author:
- Holger Eichelberger
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.ssehub.easy.instantiation.core.model.vilTypes.IStringValueProvider
IStringValueProvider.StringComparator
-
-
Constructor Summary
Constructors Constructor Description IvmlElement()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected IvmlElementcheckElement(java.lang.String name, IvmlElement element)Checks the given element for equality and performs (if required) deeper search usinggetElement(String).static booleanequals(IvmlElement i1, IvmlElement i2)Represents the equality operation for IvmlElements.static booleanequals2(IvmlElement i1, java.lang.Object i2)Represents the equality operation for IvmlElements and AnyType, in particular the null value.IvmlElementgetAnnotation(java.lang.String name)Returns the attribute specified by name (matches qualified and unqualified names).IvmlElementgetAnnotation(IvmlElement element)Returns the attribute specified by element (matches qualified and unqualified names).(package private) abstract IvmlElementgetAttribute(int index)Returns the specified attribute.IvmlElementgetAttribute(java.lang.String name)Returns the attribute specified by name (matches qualified and unqualified names).IvmlElementgetAttribute(IvmlElement element)Returns the attribute specified by element (matches qualified and unqualified names).(package private) abstract intgetAttributeCount()Returns the number of attributes.abstract java.lang.BooleangetBooleanValue()Returns the boolean value of the decision variable.abstract IvmlElementgetElement(java.lang.String name)Returns the element matching the given (qualified) name.abstract EnumValuegetEnumValue()Returns the boolean value of the decision variable.java.lang.StringgetInstanceName()Returns the instance name of this element.abstract java.lang.IntegergetIntegerValue()Returns the integer value of the decision variable.abstract java.lang.StringgetName()Returns the simple name of the element.abstract java.lang.StringgetQualifiedName()Returns the qualified name of the element.abstract java.lang.StringgetQualifiedType()Returns the qualified type name of the element.abstract java.lang.DoublegetRealValue()Returns the real value of the decision variable.abstract java.lang.StringgetStringValue()Returns the string value of the decision variable.java.lang.StringgetStringValue(IStringValueProvider.StringComparator comparator)Returns the string value of this object.abstract TypeDescriptor<?>getType()Returns the VIL type of the element.(package private) static TypeDescriptor<?>getTypeDescriptor(IDatatype type)Returns the type descriptor for a given IVML datatype.abstract java.lang.StringgetTypeName()Returns the simple type name of the element.abstract java.lang.ObjectgetValue()Returns the (untyped) value of the decision variable.protected abstract voidinitializeAttributes()Lazily initializes the attributes.protected abstract voidinitializeNested()Lazily initializes the nested parts.booleanisEnacting()Returns whether this element is currently enacting.booleanisNull()Returns whether thevalueof this element is null (in the semantics of IVML).booleanisValid()Returns whether this element is valid.protected IvmlElementsearch(java.lang.String name, IvmlElement[] elements)Searches for an element denoted bynameinelements.static booleanunequals(IvmlElement i1, IvmlElement i2)Represents the unequality operation for IvmlElements.static booleanunequals2(IvmlElement i1, java.lang.Object i2)Represents the unequality operation for IvmlElements and AnyTypes, in particular the null value.
-
-
-
Method Detail
-
initializeAttributes
protected abstract void initializeAttributes()
Lazily initializes the attributes.
-
initializeNested
protected abstract void initializeNested()
Lazily initializes the nested parts.
-
getName
public abstract java.lang.String getName()
Returns the simple name of the element.- Specified by:
getNamein interfaceIResolvable- Returns:
- the simple name
-
getQualifiedName
public abstract java.lang.String getQualifiedName()
Returns the qualified name of the element.- Returns:
- the qualified name
-
getType
public abstract TypeDescriptor<?> getType()
Returns the VIL type of the element.- Returns:
- the VIL type (may be a fake descriptor if not resolved / no advice)
-
getTypeName
public abstract java.lang.String getTypeName()
Returns the simple type name of the element.- Returns:
- the simple type name
-
getQualifiedType
public abstract java.lang.String getQualifiedType()
Returns the qualified type name of the element.- Returns:
- the qualified type name
-
getAttribute
abstract IvmlElement getAttribute(int index)
Returns the specified attribute.- Parameters:
index- the 0-based index of the attribute to return- Returns:
- the specified attribute
- Throws:
java.lang.IndexOutOfBoundsException- ifindex < 0 || index >=getAttributeCount()
-
getAttributeCount
abstract int getAttributeCount()
Returns the number of attributes.- Returns:
- the number of attributes
-
getAttribute
public IvmlElement getAttribute(java.lang.String name)
Returns the attribute specified by name (matches qualified and unqualified names).- Parameters:
name- the name of the element (no regex)- Returns:
- the matching attribute or null
-
getAttribute
public IvmlElement getAttribute(IvmlElement element)
Returns the attribute specified by element (matches qualified and unqualified names).- Parameters:
element- the IvmlElement denoting the attribute- Returns:
- the matching attribute or null
-
getAnnotation
public IvmlElement getAnnotation(java.lang.String name)
Returns the attribute specified by name (matches qualified and unqualified names).- Parameters:
name- the name of the element (no regex)- Returns:
- the matching attribute or null
-
getAnnotation
public IvmlElement getAnnotation(IvmlElement element)
Returns the attribute specified by element (matches qualified and unqualified names).- Parameters:
element- the IvmlElement denoting the attribute- Returns:
- the matching attribute or null
-
isValid
public boolean isValid()
Returns whether this element is valid.- Returns:
trueif this element is valid,falseelse- See Also:
VariableValueMapping#getValidFlag(AbstractIvmlVariable)
-
isEnacting
public boolean isEnacting()
Returns whether this element is currently enacting.- Returns:
trueif this currently in enactment,falseelse- See Also:
VariableValueMapping#getValidFlag(AbstractIvmlVariable)
-
isNull
public boolean isNull()
Returns whether thevalueof this element is null (in the semantics of IVML). This does not mean undefined!- Returns:
trueif the value is null,falseelse
-
getValue
public abstract java.lang.Object getValue()
Returns the (untyped) value of the decision variable.- Returns:
- the value (may be null)
-
getStringValue
public abstract java.lang.String getStringValue()
Returns the string value of the decision variable.- Returns:
- the value (may be null)
-
getIntegerValue
public abstract java.lang.Integer getIntegerValue()
Returns the integer value of the decision variable.- Returns:
- the value (may be null)
-
getRealValue
public abstract java.lang.Double getRealValue()
Returns the real value of the decision variable.- Returns:
- the value (may be null)
-
getBooleanValue
public abstract java.lang.Boolean getBooleanValue()
Returns the boolean value of the decision variable.- Returns:
- the value (may be null)
-
getEnumValue
public abstract EnumValue getEnumValue()
Returns the boolean value of the decision variable.- Returns:
- the value (may be null)
-
getElement
public abstract IvmlElement getElement(java.lang.String name)
Returns the element matching the given (qualified) name.- Parameters:
name- the name to search for- Returns:
- the matching element or null if not found
-
search
protected IvmlElement search(java.lang.String name, IvmlElement[] elements)
Searches for an element denoted bynameinelements.- Parameters:
name- the element to search forelements- the elements to search within- Returns:
- the found element or null
-
checkElement
protected IvmlElement checkElement(java.lang.String name, IvmlElement element)
Checks the given element for equality and performs (if required) deeper search usinggetElement(String).- Parameters:
name- the element to search forelement- the element to search within- Returns:
- the found element or null
-
equals
public static boolean equals(IvmlElement i1, IvmlElement i2)
Represents the equality operation for IvmlElements.- Parameters:
i1- the first element to be consideredi2- the second element to be considered- Returns:
- i1 == i2
-
equals2
public static boolean equals2(IvmlElement i1, java.lang.Object i2)
Represents the equality operation for IvmlElements and AnyType, in particular the null value.- Parameters:
i1- the first element to be consideredi2- the second element to be considered- Returns:
- i1 == i2
-
unequals
public static boolean unequals(IvmlElement i1, IvmlElement i2)
Represents the unequality operation for IvmlElements.- Parameters:
i1- the first element to be consideredi2- the second element to be considered- Returns:
- i1 == i2
-
unequals2
public static boolean unequals2(IvmlElement i1, java.lang.Object i2)
Represents the unequality operation for IvmlElements and AnyTypes, in particular the null value.- Parameters:
i1- the first element to be consideredi2- the second element to be considered- Returns:
- i1 == i2
-
getStringValue
public java.lang.String getStringValue(IStringValueProvider.StringComparator comparator)
Description copied from interface:IStringValueProviderReturns the string value of this object.- Specified by:
getStringValuein interfaceIStringValueProvider- Parameters:
comparator- if the sequence of elements, e.g., in case of collections, shall be ordered according to the comparator, null if the original sequence shall be returned- Returns:
- the string value
-
getInstanceName
public java.lang.String getInstanceName()
Returns the instance name of this element.- Returns:
- the instance name
-
getTypeDescriptor
static TypeDescriptor<?> getTypeDescriptor(IDatatype type)
Returns the type descriptor for a given IVML datatype. May lead to a fake/fallback datatype if not known / advised.- Parameters:
type- the type- Returns:
- the type or null if unknown
-
-