org.basex.data
Class StatsKey

java.lang.Object
  extended by org.basex.data.StatsKey

public final class StatsKey
extends Object

This class provides statistics for a tag or attribute name and its contents.

Author:
Workgroup DBIS, University of Konstanz 2005-10, ISC License, Christian Gruen

Nested Class Summary
static class StatsKey.Kind
          Kind of Contents.
 
Field Summary
 TokenSet cats
          Categories.
 int counter
          Number of occurrences.
 StatsKey.Kind kind
          Node kind.
 boolean leaf
          Leaf node flag.
 double len
          Average text-length.
 double max
          Maximum value.
 double min
          Minimum value.
 
Constructor Summary
StatsKey()
          Default constructor.
StatsKey(DataInput in)
          Constructor, specifying an input stream.
 
Method Summary
 void add(byte[] val)
          Adds a value.
 void finish(DataOutput out)
          Writes the key statistics to the specified output stream.
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

kind

public StatsKey.Kind kind
Node kind.


cats

public TokenSet cats
Categories.


min

public double min
Minimum value.


max

public double max
Maximum value.


len

public double len
Average text-length.


counter

public int counter
Number of occurrences.


leaf

public boolean leaf
Leaf node flag.

Constructor Detail

StatsKey

public StatsKey()
Default constructor.


StatsKey

public StatsKey(DataInput in)
         throws IOException
Constructor, specifying an input stream.

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

finish

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

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

add

public void add(byte[] val)
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 #MAXCATS, the cached values are skipped, and contents are treated as arbitrary strings.

Parameters:
val - value to be added

toString

public String toString()
Overrides:
toString in class Object