Package mondrian.olap.type
Class SetType
- java.lang.Object
-
- mondrian.olap.type.SetType
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TypecomputeCommonType(Type type, int[] conversionCount)Returns a Type which is more general than this and the given Type.booleanequals(Object obj)intgetArity()Returns the number of fields in a tuple type, or a set of tuples.DimensiongetDimension()Returns the Dimension of this Type, or null if not known.TypegetElementType()Returns the type of the elements of this set.HierarchygetHierarchy()Returns the Hierarchy of this Type, or null if not known.LevelgetLevel()Returns the Level of this Type, or null if not known.inthashCode()booleanisInstance(Object value)Returns whether a value is valid for a type.StringtoString()booleanusesDimension(Dimension dimension, boolean definitely)Returns whether this type contains a given dimension.booleanusesHierarchy(Hierarchy hierarchy, boolean definitely)Returns whether this type contains a given hierarchy.
-
-
-
Constructor Detail
-
SetType
public SetType(Type elementType)
Creates a type representing a set of elements of a given type.- Parameters:
elementType- The type of the elements in the set, or null if not known
-
-
Method Detail
-
getElementType
public Type getElementType()
Returns the type of the elements of this set.- Returns:
- the type of the elements in this set
-
usesDimension
public boolean usesDimension(Dimension dimension, boolean definitely)
Description copied from interface:TypeReturns whether this type contains a given dimension. For example:DimensionType([Gender])uses only the[Gender]dimension.TupleType(MemberType([Gender]), MemberType([Store]))uses[Gender]and[Store]dimensions.
definitelyparameter comes into play when the dimensional information is incomplete. For example, when applied toTupleType(MemberType(null), MemberType([Store])),usesDimension([Gender], false)returns true because it is possible that the expression returns a member of the[Gender]dimension; butusesDimension([Gender], true)returns true because it is possible that the expression returns a member of the[Gender]dimension.- Specified by:
usesDimensionin interfaceType- Parameters:
dimension- Dimensiondefinitely- If true, returns true only if this type definitely uses the dimension- Returns:
- whether this Type uses the given Dimension
-
usesHierarchy
public boolean usesHierarchy(Hierarchy hierarchy, boolean definitely)
Description copied from interface:TypeReturns whether this type contains a given hierarchy. For example:HierarchyType([Customer].[Gender])uses only the[Customer].[Gender]hierarchy.TupleType(MemberType([Customer].[Gender]), MemberType([Store].[Store]))uses[Gender]and[Store]dimensions.
definitelyparameter comes into play when the dimensional information is incomplete. For example, when applied toTupleType(MemberType([Customer]), MemberType([Store])),usesDimension([Customer].[Gender], false)returns true because the expression returns a member of one hierarchy of the[Customer]dimension and that might be a member of the[Customer].[Gender]hierarchy; butusesDimension([Customer].[Gender], true)returns false because might return a member of a different hierarchy, such as[Customer].[State].- Specified by:
usesHierarchyin interfaceType- Parameters:
hierarchy- Hierarchydefinitely- If true, returns true only if this type definitely uses the hierarchy- Returns:
- whether this Type uses the given Hierarchy
-
getDimension
public Dimension getDimension()
Description copied from interface:TypeReturns the Dimension of this Type, or null if not known. If not applicable, throws.- Specified by:
getDimensionin interfaceType- Returns:
- the Dimension of this Type, or null if not known.
-
getHierarchy
public Hierarchy getHierarchy()
Description copied from interface:TypeReturns the Hierarchy of this Type, or null if not known. If not applicable, throws.- Specified by:
getHierarchyin interfaceType- Returns:
- the Hierarchy of this type, or null if not known
-
getLevel
public Level getLevel()
Description copied from interface:TypeReturns the Level of this Type, or null if not known. If not applicable, throws.
-
getArity
public int getArity()
Description copied from interface:TypeReturns the number of fields in a tuple type, or a set of tuples. For most other types, in particular member type, returns 1.
-
computeCommonType
public Type computeCommonType(Type type, int[] conversionCount)
Description copied from interface:TypeReturns a Type which is more general than this and the given Type. The type returned is broad enough to hold any value of either type, but no broader. If there is no such type, returns null.Some examples:
- The common type for StringType and NumericType is ScalarType.
- The common type for NumericType and DecimalType(4, 2) is NumericType.
- DimensionType and NumericType have no common type.
If
conversionCountis not null, implicit conversions such as HierarchyType to DimensionType are considered; the parameter is incremented by the number of conversions performed.Some examples:
- The common type for HierarchyType(hierarchy=Time.Weekly) and LevelType(dimension=Time), if conversions are allowed, is HierarchyType(dimension=Time).
One use of common types is to determine the types of the arguments to the
Iiffunction. For example, the call
has type ScalarType, because DecimalType(-1, 0) is a subtype of ScalarType, and MeasureType can be converted implicitly to ScalarType.Iif(1 > 2, [Measures].[Unit Sales], 5)- Specified by:
computeCommonTypein interfaceType- Parameters:
type- TypeconversionCount- Number of conversions; output parameter that is incremented each time a conversion is performed; if null, conversions are not considered- Returns:
- More general type
-
isInstance
public boolean isInstance(Object value)
Description copied from interface:TypeReturns whether a value is valid for a type.- Specified by:
isInstancein interfaceType- Parameters:
value- Value- Returns:
- Whether value is valid for this type
-
-