Package org.processmining.logprojection
Class DataManager<T extends org.deckfour.xes.model.XAttributable>
- java.lang.Object
-
- org.processmining.logprojection.DataManager<T>
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
XEventDataManager,XLogDataManager,XTraceDataManager
public abstract class DataManager<T extends org.deckfour.xes.model.XAttributable> extends java.lang.Object implements java.io.Serializable- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceDataManager.AttributeValueCalculator<T extends org.deckfour.xes.model.XAttributable>Utility class to add attributes to all objects.static interfaceDataManager.StringHandler
-
Field Summary
Fields Modifier and Type Field Description protected intblocksprotected intblockSizeprotected intbytesReservedPerObjectprotected static org.deckfour.xes.factory.XFactoryFACTORYprotected booleanhandlesEventAttributesprotected intheaderSizeprotected gnu.trove.map.TObjectIntMap<Attribute>key2indexprotected Attribute[]keysprotected intmaskprotected static longMAXHASHprotected intnumberOfObjectsprotected intshiftprotected byte[][]storeprotected DataManager.StringHandlerstringHandlerprotected int[]type2countprotected intusedBytesPerObject
-
Constructor Summary
Constructors Constructor Description DataManager(DataManager.StringHandler stringHandler, java.util.Collection<org.deckfour.xes.model.XAttribute> attributes, gnu.trove.map.TObjectIntMap<java.lang.String> lit2index, int preferredBlockSize, int headerSize, boolean handlesEventAttributes)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddAttributes(DataManager.AttributeValueCalculator<T> calculator, Attribute... newAttribute)adds an attribute to each object in the store.voidaddObject(T object, gnu.trove.map.TObjectIntMap<java.lang.String> lit2index, java.util.Set<java.lang.String> errorKeys, int... headerData)protected intbuildAttributeIndices(java.util.Collection<? extends org.deckfour.xes.model.XAttribute> attributes, int index, gnu.trove.map.TObjectIntMap<Attribute> key2index, int[] key2count, gnu.trove.map.TObjectIntMap<java.lang.String> lit2index)protected voidcheckSizeForInsertion()booleancontainsKey(Attribute key)intcountValuesLiteral(int attributeIndex, java.lang.String s)org.deckfour.xes.model.XAttributegetAttribute(int number, Attribute attribute, java.util.Map<java.lang.String,org.deckfour.xes.extension.XExtension> key2extension)AttributegetAttributeForKey(java.lang.String attribute)booleangetAttributeValueBoolean(int object, int attrIndex)booleangetAttributeValueBoolean(int object, Attribute key)doublegetAttributeValueContinuous(int object, int attrIndex)doublegetAttributeValueContinuous(int object, Attribute key)longgetAttributeValueDiscrete(int object, int attrIndex)longgetAttributeValueDiscrete(int object, Attribute key)int[]getAttributeValueIndicesLiteral(Attribute attribute, boolean sort)java.lang.StringgetAttributeValueLiteral(int object, int attrIndex)java.lang.StringgetAttributeValueLiteral(int object, Attribute key)intgetAttributeValueLiteralIndex(int object, int attrIndex)intgetAttributeValueLiteralIndex(int object, Attribute key)boolean[]getAttributeValuesBoolean(Attribute attribute, boolean sort)double[]getAttributeValuesContinuous(Attribute attribute, boolean sort)long[]getAttributeValuesDiscrete(Attribute attribute, boolean sort)java.lang.String[]getAttributeValuesLiteral(Attribute attribute, boolean sort)java.lang.String[]getAttributeValuesLiteral(Attribute attribute, int[] indices)long[]getAttributeValuesTimestamp(Attribute attribute, boolean sort)longgetAttributeValueTimestamp(int object, int attrIndex)longgetAttributeValueTimestamp(int object, Attribute key)byte[]getBytes(int index, int length, int number)byte[]getBytes(Attribute attribute, int number)intgetHeader(int number, int headerIndex)Histogram.DoublegetHistogramContinuous(Attribute attribute, Statistics.Double s, int buckets)Histogram.LonggetHistogramDiscrete(Attribute attribute, Statistics.Long s, int buckets)Histogram.LonggetHistogramTimestamp(Attribute attribute, Statistics.Long s, int buckets)intgetKeyIndex(Attribute attribute)int[]getKeyIndices()int[]getKeyIndices(byte type)Attribute[]getKeys()returns a list of global keys.Attribute[]getKeySortedByIndex(byte type)returns a sorted list of attribute keys of type type.Attribute[]getKeysSortedAlphabetically()returns a sorted list of attribute keys.Attribute[]getKeysSortedAlphabetically(byte type)returns a sorted list of attribute keys of type type.Attribute[]getKeysSortedByIndex()returns a sorted list of attribute keys.intgetObjectByteSize()intgetObjectCount()Statistics.DoublegetStatisticsContinuous(Attribute attribute)Statistics.LonggetStatisticsDiscrete(Attribute attribute)Statistics.LonggetStatisticsTimestamp(Attribute attribute)DataManager.StringHandlergetStringHandler()booleanisType(Attribute key, byte type)protected voidreadAttributeIntoScope(Attribute[] globalKeys, int ptr, byte[] storage, int keyIndex, org.deckfour.xes.model.XAttributeMap attributes, java.util.Map<java.lang.String,org.deckfour.xes.extension.XExtension> key2extension, boolean forAddingAttributes)protected booleanreadBoolean(byte[] array, int index)protected doublereadDouble(byte[] array, int index)protected intreadInt(byte[] array, int index)protected longreadLong(byte[] array, int index)TreadObject(int number)protected abstract TreadObjectFromBlock(byte[] block, int number, boolean forAddingAttributes)protected shortreadShort(byte[] array, int index)voidswap(int index1, int index2)java.lang.StringtoString(int number)voidupdateHeader(int number, int... headerData)protected intwriteAttributeContents(org.deckfour.xes.model.XAttributeMap attributes, byte[] storage, int ptr, int keyIndex, gnu.trove.map.TObjectIntMap<Attribute> key2Index, gnu.trove.map.TObjectIntMap<java.lang.String> lit2index, java.util.Set<java.lang.String> errorKeys)protected intwriteBoolean(byte[] array, int index, boolean value)protected intwriteDouble(byte[] array, int index, double value)protected intwriteInt(byte[] array, int index, int value)protected intwriteLong(byte[] array, int index, long value)protected intwriteShort(byte[] array, int index, short value)
-
-
-
Field Detail
-
MAXHASH
protected static final long MAXHASH
- See Also:
- Constant Field Values
-
FACTORY
protected static final org.deckfour.xes.factory.XFactory FACTORY
-
stringHandler
protected DataManager.StringHandler stringHandler
-
key2index
protected final gnu.trove.map.TObjectIntMap<Attribute> key2index
-
keys
protected Attribute[] keys
-
type2count
protected int[] type2count
-
usedBytesPerObject
protected int usedBytesPerObject
-
bytesReservedPerObject
protected int bytesReservedPerObject
-
blockSize
protected int blockSize
-
blocks
protected int blocks
-
store
protected byte[][] store
-
numberOfObjects
protected int numberOfObjects
-
headerSize
protected final int headerSize
-
handlesEventAttributes
protected final boolean handlesEventAttributes
-
shift
protected int shift
-
mask
protected int mask
-
-
Constructor Detail
-
DataManager
public DataManager(DataManager.StringHandler stringHandler, java.util.Collection<org.deckfour.xes.model.XAttribute> attributes, gnu.trove.map.TObjectIntMap<java.lang.String> lit2index, int preferredBlockSize, int headerSize, boolean handlesEventAttributes)
-
-
Method Detail
-
getAttributeValueBoolean
public boolean getAttributeValueBoolean(int object, Attribute key)
-
getAttributeValueBoolean
public boolean getAttributeValueBoolean(int object, int attrIndex)
-
getAttributeValueDiscrete
public long getAttributeValueDiscrete(int object, Attribute key)
-
getAttributeValueDiscrete
public long getAttributeValueDiscrete(int object, int attrIndex)
-
getAttributeValueContinuous
public double getAttributeValueContinuous(int object, Attribute key)
-
getAttributeValueContinuous
public double getAttributeValueContinuous(int object, int attrIndex)
-
getAttributeValueTimestamp
public long getAttributeValueTimestamp(int object, Attribute key)
-
getAttributeValueTimestamp
public long getAttributeValueTimestamp(int object, int attrIndex)
-
getAttributeValueLiteral
public java.lang.String getAttributeValueLiteral(int object, Attribute key)
-
getAttributeValueLiteral
public java.lang.String getAttributeValueLiteral(int object, int attrIndex)
-
getAttributeValueLiteralIndex
public int getAttributeValueLiteralIndex(int object, Attribute key)
-
getAttributeValueLiteralIndex
public int getAttributeValueLiteralIndex(int object, int attrIndex)
-
writeInt
protected int writeInt(byte[] array, int index, int value)
-
readInt
protected int readInt(byte[] array, int index)
-
writeShort
protected int writeShort(byte[] array, int index, short value)
-
readShort
protected short readShort(byte[] array, int index)
-
writeBoolean
protected int writeBoolean(byte[] array, int index, boolean value)
-
readBoolean
protected boolean readBoolean(byte[] array, int index)
-
writeLong
protected int writeLong(byte[] array, int index, long value)
-
readLong
protected long readLong(byte[] array, int index)
-
writeDouble
protected int writeDouble(byte[] array, int index, double value)
-
readDouble
protected double readDouble(byte[] array, int index)
-
buildAttributeIndices
protected int buildAttributeIndices(java.util.Collection<? extends org.deckfour.xes.model.XAttribute> attributes, int index, gnu.trove.map.TObjectIntMap<Attribute> key2index, int[] key2count, gnu.trove.map.TObjectIntMap<java.lang.String> lit2index)
-
checkSizeForInsertion
protected void checkSizeForInsertion()
-
addObject
public void addObject(T object, gnu.trove.map.TObjectIntMap<java.lang.String> lit2index, java.util.Set<java.lang.String> errorKeys, int... headerData)
-
updateHeader
public void updateHeader(int number, int... headerData)
-
readObject
public T readObject(int number)
-
readObjectFromBlock
protected abstract T readObjectFromBlock(byte[] block, int number, boolean forAddingAttributes)
-
writeAttributeContents
protected int writeAttributeContents(org.deckfour.xes.model.XAttributeMap attributes, byte[] storage, int ptr, int keyIndex, gnu.trove.map.TObjectIntMap<Attribute> key2Index, gnu.trove.map.TObjectIntMap<java.lang.String> lit2index, java.util.Set<java.lang.String> errorKeys)
-
getKeysSortedByIndex
public Attribute[] getKeysSortedByIndex()
returns a sorted list of attribute keys. The list is sorted based on the index in the array used to store event data.- Returns:
-
getKeysSortedAlphabetically
public Attribute[] getKeysSortedAlphabetically()
returns a sorted list of attribute keys. The list is sorted based on the index in the array used to store event data.- Returns:
-
getKeys
public Attribute[] getKeys()
returns a list of global keys. The list is sorted.- Returns:
-
getKeySortedByIndex
public Attribute[] getKeySortedByIndex(byte type)
returns a sorted list of attribute keys of type type. The list is sorted based on the index in the array used to store data.- Returns:
-
getKeysSortedAlphabetically
public Attribute[] getKeysSortedAlphabetically(byte type)
returns a sorted list of attribute keys of type type. The list is sorted based on the index in the array used to store data.- Returns:
-
getKeyIndices
public int[] getKeyIndices()
-
getKeyIndices
public int[] getKeyIndices(byte type)
-
getAttribute
public org.deckfour.xes.model.XAttribute getAttribute(int number, Attribute attribute, java.util.Map<java.lang.String,org.deckfour.xes.extension.XExtension> key2extension)
-
readAttributeIntoScope
protected void readAttributeIntoScope(Attribute[] globalKeys, int ptr, byte[] storage, int keyIndex, org.deckfour.xes.model.XAttributeMap attributes, java.util.Map<java.lang.String,org.deckfour.xes.extension.XExtension> key2extension, boolean forAddingAttributes)
-
getHeader
public int getHeader(int number, int headerIndex)
-
isType
public boolean isType(Attribute key, byte type)
-
getStatisticsDiscrete
public Statistics.Long getStatisticsDiscrete(Attribute attribute)
-
getStatisticsContinuous
public Statistics.Double getStatisticsContinuous(Attribute attribute)
-
getStatisticsTimestamp
public Statistics.Long getStatisticsTimestamp(Attribute attribute)
-
getHistogramTimestamp
public Histogram.Long getHistogramTimestamp(Attribute attribute, Statistics.Long s, int buckets)
-
getHistogramDiscrete
public Histogram.Long getHistogramDiscrete(Attribute attribute, Statistics.Long s, int buckets)
-
getHistogramContinuous
public Histogram.Double getHistogramContinuous(Attribute attribute, Statistics.Double s, int buckets)
-
getAttributeValueIndicesLiteral
public int[] getAttributeValueIndicesLiteral(Attribute attribute, boolean sort)
-
getAttributeValuesLiteral
public java.lang.String[] getAttributeValuesLiteral(Attribute attribute, int[] indices)
-
getAttributeValuesLiteral
public java.lang.String[] getAttributeValuesLiteral(Attribute attribute, boolean sort)
-
getAttributeValuesDiscrete
public long[] getAttributeValuesDiscrete(Attribute attribute, boolean sort)
-
getAttributeValuesTimestamp
public long[] getAttributeValuesTimestamp(Attribute attribute, boolean sort)
-
getAttributeValuesContinuous
public double[] getAttributeValuesContinuous(Attribute attribute, boolean sort)
-
getAttributeValuesBoolean
public boolean[] getAttributeValuesBoolean(Attribute attribute, boolean sort)
-
addAttributes
public void addAttributes(DataManager.AttributeValueCalculator<T> calculator, Attribute... newAttribute)
adds an attribute to each object in the store. The calculator computes the value of the attribute for each object.- Parameters:
calculator- Objects will be given to the calculator in the order in which they appeared in the original lognewAttribute- the new attributes to be added to each object (a default value is not provided since the calculator returns a result for each event)
-
containsKey
public boolean containsKey(Attribute key)
-
getObjectCount
public int getObjectCount()
-
getKeyIndex
public int getKeyIndex(Attribute attribute)
-
swap
public void swap(int index1, int index2)
-
getStringHandler
public DataManager.StringHandler getStringHandler()
-
toString
public java.lang.String toString(int number)
-
getAttributeForKey
public Attribute getAttributeForKey(java.lang.String attribute)
-
getObjectByteSize
public int getObjectByteSize()
-
getBytes
public byte[] getBytes(Attribute attribute, int number)
-
getBytes
public byte[] getBytes(int index, int length, int number)
-
countValuesLiteral
public int countValuesLiteral(int attributeIndex, java.lang.String s)
-
-