com.wcohen.ss.expt
Class MatchData

java.lang.Object
  extended by com.wcohen.ss.expt.MatchData

public class MatchData
extends java.lang.Object

Holds data for evaluating a distance metric.


Nested Class Summary
static class MatchData.InputFormatException
          Signals an incorrectly formatted MatchData file.
static class MatchData.Instance
          A single item (aka record, string, etc) to match against others.
static class MatchData.MatchIterator
          Iterates over all stored StringWrappers
 
Constructor Summary
MatchData()
           
MatchData(java.lang.String filename)
          Read match data from a file.
 
Method Summary
 void addInstance(java.lang.String src, java.lang.String id, java.lang.String text)
          Add a single instance, with given src and id, to the datafile
 java.lang.String getFilename()
           
 MatchData.Instance getInstance(java.lang.String src, int j)
          Get the j-th record for the named source.
 StringWrapperIterator getIterator()
           
 java.lang.String getSource(int i)
          Get string identifier for i-th source
static void main(java.lang.String[] argv)
           
 int numInstances(java.lang.String src)
          Number of records for source with given string id
 int numSources()
          Number of sources in data set
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MatchData

public MatchData(java.lang.String filename)
          throws MatchData.InputFormatException
Read match data from a file. Format should be: sourceRelation TAB instanceID TAB field1 TAB ... fieldn LF

Throws:
MatchData.InputFormatException

MatchData

public MatchData()
Method Detail

addInstance

public void addInstance(java.lang.String src,
                        java.lang.String id,
                        java.lang.String text)
Add a single instance, with given src and id, to the datafile


numSources

public int numSources()
Number of sources in data set


getSource

public java.lang.String getSource(int i)
Get string identifier for i-th source


numInstances

public int numInstances(java.lang.String src)
Number of records for source with given string id


getInstance

public MatchData.Instance getInstance(java.lang.String src,
                                      int j)
Get the j-th record for the named source.


getIterator

public StringWrapperIterator getIterator()

getFilename

public java.lang.String getFilename()

toString

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

main

public static void main(java.lang.String[] argv)