org.cdlib.xtf.textEngine.facet
Class GroupData

Object
  extended by GroupData
Direct Known Subclasses:
DynamicGroupData, StaticGroupData

public abstract class GroupData
extends Object

This class contains a mapping, from documents to one or more term values in each document. The mapping can be static (read from an index) or dynamic (generated by code).

Author:
Martin Haye

Constructor Summary
GroupData()
           
 
Method Summary
abstract  int child(int groupId)
          Get the first child of the given group, or -1 if it has no children
abstract  int compare(int group1, int group2)
          Compare two groups for sort order
 void debugGroups(int parent)
          Output the groups to the info trace stream
abstract  String field()
          Get the name of the grouping field
abstract  int findGroup(String name)
          Locate a group by name and return its index, or -1 if not found
abstract  int firstLink(int docId)
          Return the ID of the first link for the given document, or -1 if there are no links for that document.
 boolean isDynamic()
          Whether the data is dynamic and thus has counts and scores available
abstract  int linkGroup(int linkId)
          Returns the group number of the specified link
abstract  String name(int groupId)
          Get the name of a group given its number
abstract  int nChildren(int groupId)
          Get the number of children a group has
 int nDocHits(int groupId)
          Only called for dynamic data: get count of docs in a group
abstract  int nextLink(int linkId)
          Return the ID of the link after the specified one, or -1 if no more
abstract  int nGroups()
          Get the total number of groups
abstract  int parent(int groupId)
          Get the parent of the given group, or -1 if group is the root
 float score(int groupId)
          Only called for dynamic data: get score of a group
abstract  int sibling(int groupId)
          Get the sibling of the given group, or -1 if no more
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroupData

public GroupData()
Method Detail

firstLink

public abstract int firstLink(int docId)
Return the ID of the first link for the given document, or -1 if there are no links for that document.

Parameters:
docId - document to look for
Returns:
the first link ID, or -1 if none

nextLink

public abstract int nextLink(int linkId)
Return the ID of the link after the specified one, or -1 if no more


linkGroup

public abstract int linkGroup(int linkId)
Returns the group number of the specified link


field

public abstract String field()
Get the name of the grouping field


nGroups

public abstract int nGroups()
Get the total number of groups


name

public abstract String name(int groupId)
Get the name of a group given its number


parent

public abstract int parent(int groupId)
Get the parent of the given group, or -1 if group is the root


nChildren

public abstract int nChildren(int groupId)
Get the number of children a group has


child

public abstract int child(int groupId)
Get the first child of the given group, or -1 if it has no children


sibling

public abstract int sibling(int groupId)
Get the sibling of the given group, or -1 if no more


findGroup

public abstract int findGroup(String name)
Locate a group by name and return its index, or -1 if not found


compare

public abstract int compare(int group1,
                            int group2)
Compare two groups for sort order


debugGroups

public void debugGroups(int parent)
Output the groups to the info trace stream


isDynamic

public boolean isDynamic()
Whether the data is dynamic and thus has counts and scores available


score

public float score(int groupId)
Only called for dynamic data: get score of a group


nDocHits

public int nDocHits(int groupId)
Only called for dynamic data: get count of docs in a group