cc.redberry.core.indices
Class StructureOfIndices
- java.lang.Object
-
- cc.redberry.core.indices.StructureOfIndices
-
public final class StructureOfIndices extends java.lang.ObjectThe unique identification information about indices objects. This class contains information about types of indices (number of indices of each type) and about states of non metric indices (if there are any).- Since:
- 1.0
- See Also:
NameDescriptor
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static classStructureOfIndices.TypeDataContainer of information about structure of indices of a particular type.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description StructureOfIndicesappend(StructureOfIndices oth)Returns the 'sum' of this and other structuresstatic StructureOfIndicescreate(byte[] types, int[] count)Creates structure of indices from specified data about metric indices.static StructureOfIndicescreate(byte type, int count)Creates structure of indices, which contains indices only of specified metric type.static StructureOfIndicescreate(byte type, int count, boolean... states)Creates structure of indices, which contains indices only of specified type.static StructureOfIndicescreate(IndexType type, int count)Creates structure of indices, which contains indices only of specified metric type.static StructureOfIndicescreate(int[] allCount, BitArray[] allStates)Creates structure of indices from specified data.static StructureOfIndicescreate(SimpleIndices indices)Returns the structure of specified simple indices.booleanequals(java.lang.Object obj)booleanfixedStates(IndexType type)Returns whether states of specified type are set.static StructureOfIndicesgetEmpty()StructureOfIndicesgetInverted()Return the newStructure of Indiceswith inverted states of indicesint[][]getPartitionMappings(StructureOfIndices... partition)Calculates partition of this structure by the specified structures and returns the resulting map.BitArray[]getStates()Returns states.BitArraygetStates(IndexType type)Returns states of specified type.StructureOfIndices.TypeDatagetTypeData(byte type)Returns the information about specified type.int[]getTypesCounts()Returns sizes of indices of all types.inthashCode()booleanisStructureOf(SimpleIndices indices)Returnstrueif this is structure of specified indices.StructureOfIndicespow(int N)Returns the 'sum' of N-copies of thisintsize()Returns the total number of indices.StructureOfIndicessubtract(StructureOfIndices other)Subtracts some structure of indices from the right side of current structure.java.lang.StringtoString()inttypeCount(byte type)Returns the number of indices of specified type.
-
-
-
Method Detail
-
create
public static StructureOfIndices create(byte type, int count, boolean... states)
Creates structure of indices, which contains indices only of specified type.- Parameters:
type- index typecount- number of indicesstates- indices states
-
create
public static StructureOfIndices create(byte type, int count)
Creates structure of indices, which contains indices only of specified metric type.- Parameters:
type- index typecount- number of indices- Throws:
java.lang.IllegalArgumentException- if type is non metric
-
create
public static StructureOfIndices create(IndexType type, int count)
Creates structure of indices, which contains indices only of specified metric type.- Parameters:
type- index typecount- number of indices- Throws:
java.lang.IllegalArgumentException- if type is non metric
-
create
public static StructureOfIndices create(byte[] types, int[] count)
Creates structure of indices from specified data about metric indices.- Parameters:
types- array of typescount- array of sizes of indices of specified types- Throws:
java.lang.IllegalArgumentException- if any type in type is non metric
-
create
public static StructureOfIndices create(int[] allCount, BitArray[] allStates)
Creates structure of indices from specified data.- Parameters:
allCount- array of sizes of indices of all typesallStates- array of states of indices of all types- Throws:
java.lang.IllegalArgumentException-allCount.length() != allStates.length()java.lang.IllegalArgumentException- if length ofallCountnot equal the total number of available types of inddices.
-
create
public static StructureOfIndices create(SimpleIndices indices)
Returns the structure of specified simple indices.- Parameters:
indices- simple indices
-
getStates
public BitArray[] getStates()
Returns states.- Returns:
- states
-
getStates
public BitArray getStates(IndexType type)
Returns states of specified type.- Returns:
- states of specified type
-
fixedStates
public boolean fixedStates(IndexType type)
Returns whether states of specified type are set.- Returns:
- whether states of specified type are set
-
getTypesCounts
public int[] getTypesCounts()
Returns sizes of indices of all types.- Returns:
- sizes of indices of all types
-
size
public int size()
Returns the total number of indices.- Returns:
- total number of indices
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
getTypeData
public StructureOfIndices.TypeData getTypeData(byte type)
Returns the information about specified type.- Parameters:
type- index type- Returns:
- the information about specified type
-
typeCount
public int typeCount(byte type)
Returns the number of indices of specified type.- Parameters:
type- index type- Returns:
- the number of indices of specified type
-
isStructureOf
public boolean isStructureOf(SimpleIndices indices)
Returnstrueif this is structure of specified indices.- Parameters:
indices- indices- Returns:
trueif this is structure of specified indices
-
getInverted
public StructureOfIndices getInverted()
Return the newStructure of Indiceswith inverted states of indices- Returns:
- new
Structure of Indiceswith inverted states of indices
-
append
public StructureOfIndices append(StructureOfIndices oth)
Returns the 'sum' of this and other structures- Parameters:
oth- other structure- Returns:
- 'sum' of this and other structures
-
pow
public StructureOfIndices pow(int N)
Returns the 'sum' of N-copies of this- Parameters:
N- exponent- Returns:
- 'sum' of N-copies of this
-
subtract
public StructureOfIndices subtract(StructureOfIndices other)
Subtracts some structure of indices from the right side of current structure.This operation may fail if states of other structure differs from current.
- Parameters:
other- other structure- Returns:
- result of subtraction
- Throws:
java.lang.IllegalArgumentException- nonmetric states are different
-
getPartitionMappings
public int[][] getPartitionMappings(StructureOfIndices... partition)
Calculates partition of this structure by the specified structures and returns the resulting map. This map organized as follows: map[i][j] represents the index of this, which matches j-th index of i-th structure in specified partition- Parameters:
partition-- Returns:
- map which encodes partition of this structure by the specified structures
- Throws:
java.lang.IllegalArgumentException- if specified array does not form a partition
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getEmpty
public static StructureOfIndices getEmpty()
-
-
DataMelt 3.0 © DataMelt by jWork.ORG