window
Class ExractFingerprints

java.lang.Object
  extended bywindow.ExractFingerprints

public class ExractFingerprints
extends java.lang.Object

This is the heart of the application which will apply winnowing algorithm to one document and will extract fingerprints


Field Summary
private  java.lang.String content
          The string representation of document
private  int offset
          The offset of the begining of the window
private  java.lang.String path
          The path to file
 
Constructor Summary
ExractFingerprints(java.lang.String path)
           
 
Method Summary
 java.util.ArrayList extract()
          The center and the heart of the application which roll the window and fingerprints
private  void fileToString()
          Convert file to string
private  int globalPosition(int min, int rightEnd)
          Compute the global position for one gram
private  boolean hasNext()
          Determine if the window can be slipped more to he right
private  int nextHash()
          Getting the next gram
private  Fingerprint record(int hashValue, int position)
          Save the fingerprint
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

path

private java.lang.String path
The path to file


content

private java.lang.String content
The string representation of document


offset

private int offset
The offset of the begining of the window

Constructor Detail

ExractFingerprints

public ExractFingerprints(java.lang.String path)
                   throws java.io.FileNotFoundException,
                          FileTooShort
Method Detail

extract

public java.util.ArrayList extract()
                            throws KGramOutOfBound
The center and the heart of the application which roll the window and fingerprints

Returns:
the fingerprints of the document
Throws:
KGramOutOfBound

fileToString

private void fileToString()
                   throws java.io.FileNotFoundException,
                          FileTooShort
Convert file to string

Throws:
java.io.FileNotFoundException - file must exist
FileTooShort - file must not be less than W + K - 1

hasNext

private boolean hasNext()
Determine if the window can be slipped more to he right

Returns:
the condition

nextHash

private int nextHash()
              throws KGramOutOfBound
Getting the next gram

Returns:
the next K-Gram
Throws:
KGramOutOfBound - there's no more gram

globalPosition

private int globalPosition(int min,
                           int rightEnd)
Compute the global position for one gram

Parameters:
min - the offset of the gram
rightEnd - the offset of the right end of the window
Returns:
the global offset in the document

record

private Fingerprint record(int hashValue,
                           int position)
Save the fingerprint

Parameters:
hashValue - the int value corresponding to K-Gram
position - the place in the document
Returns:
the fingerprint