org.basex.index.stats
Class Stats

java.lang.Object
  extended by org.basex.index.stats.Stats

public final class Stats
extends java.lang.Object

This class provides statistical data for an indexed node.

Author:
BaseX Team 2005-12, BSD License, Christian Gruen

Field Summary
 TokenIntMap cats
          Categories.
 int count
          Number of occurrences.
 double max
          Maximum value.
 double min
          Minimum value.
 StatsType type
          Data type.
 
Constructor Summary
Stats()
          Default constructor.
Stats(DataInput in)
          Constructor, specifying an input stream.
 
Method Summary
 void add(byte[] val, MetaData meta)
          Adds a value.
 boolean isLeaf()
          Getter for leaf.
 void setLeaf(boolean l)
          Setter for leaf.
 java.lang.String toString()
           
 void write(DataOutput out)
          Writes the key statistics to the specified output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

cats

public TokenIntMap cats
Categories.


type

public StatsType type
Data type.


min

public double min
Minimum value.


max

public double max
Maximum value.


count

public int count
Number of occurrences.

Constructor Detail

Stats

public Stats()
Default constructor.


Stats

public Stats(DataInput in)
      throws java.io.IOException
Constructor, specifying an input stream.

Parameters:
in - input stream
Throws:
java.io.IOException - I/O exception
Method Detail

isLeaf

public boolean isLeaf()
Getter for leaf.

Returns:
leaf

setLeaf

public void setLeaf(boolean l)
Setter for leaf.

Parameters:
l - leaf or not

write

public void write(DataOutput out)
           throws java.io.IOException
Writes the key statistics to the specified output stream.

Parameters:
out - output stream
Throws:
java.io.IOException - I/O exception

add

public void add(byte[] val,
                MetaData meta)
Adds a value. All values are first treated as integer values. If a value can't be converted to an integer, it is treated as double value. If conversion fails again, it is handled as string category. Next, all values are cached. As soon as their number exceeds a maximum, the cached values are skipped, and contents are treated as arbitrary strings.

Parameters:
val - value to be added
meta - meta data

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object