com.wcohen.ss
Class MultiStringWrapper

java.lang.Object
  extended by com.wcohen.ss.BasicStringWrapper
      extended by com.wcohen.ss.MultiStringWrapper
All Implemented Interfaces:
StringWrapper

public class MultiStringWrapper
extends BasicStringWrapper

A StringWrapper that stores a version of the string that has been either (a) split into a number of distinct fields, or (b) duplicated k times, so that k different StringDistance's can preprocess it, of (b) both of the above.


Constructor Summary
MultiStringWrapper(java.lang.String s, int numCopies)
          Create a MultiStringWrapper by making k copies of s.
MultiStringWrapper(java.lang.String s, int numCopies, java.lang.String delim)
          Create a MultiStringWrapper by making k copies of each field of s.
MultiStringWrapper(java.lang.String s, java.lang.String delim)
          Create a MultiStringWrapper by splitting s into fields based on the given delimiter.
 
Method Summary
 StringWrapper get(int i)
          Return the i-th field.
 int getDistanceLearnerIndex(int i)
          Return the index of the learner that will process internal field i
 int getFieldIndex(int i)
          Return the field i of the original string associated with internal field i
static void main(java.lang.String[] args)
           
 void prepare(StringDistance[] innerDistances)
          Prepare each field with the appropriate distance
 void set(int i, StringWrapper w)
          Set the i-th field.
 int size()
          Return number of fields.
 java.lang.String toString()
           
 
Methods inherited from class com.wcohen.ss.BasicStringWrapper
charAt, hashCode, length, unwrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MultiStringWrapper

public MultiStringWrapper(java.lang.String s,
                          java.lang.String delim)
Create a MultiStringWrapper by splitting s into fields based on the given delimiter.


MultiStringWrapper

public MultiStringWrapper(java.lang.String s,
                          int numCopies)
Create a MultiStringWrapper by making k copies of s.


MultiStringWrapper

public MultiStringWrapper(java.lang.String s,
                          int numCopies,
                          java.lang.String delim)
Create a MultiStringWrapper by making k copies of each field of s.

Method Detail

size

public int size()
Return number of fields.


getDistanceLearnerIndex

public int getDistanceLearnerIndex(int i)
Return the index of the learner that will process internal field i


getFieldIndex

public int getFieldIndex(int i)
Return the field i of the original string associated with internal field i


get

public StringWrapper get(int i)
Return the i-th field.


set

public void set(int i,
                StringWrapper w)
Set the i-th field.


prepare

public void prepare(StringDistance[] innerDistances)
Prepare each field with the appropriate distance


toString

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

main

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