/*
 *  Team 1
 *  CS575: Software Design
 *  Project Phase I
 *  Pipe-and-Filter style
 *  PNFInput.java
 */

import java.io.*;
import java.util.Vector;

/**
 *  <p>Input class for the Pipe and Filter KWIC system.</p>
 *
 *  <p><b>PRE:</b> expects to receive the name(s) of the input file(s) and the 
 * SentenceCollection data object
 *  <br><b>POST:</b> after execution, all the files will have been parsed and 
 * data inserted into the SentenceCollection data object
 *
 *  @author Diana Tetelman
 */


public class SentenceCollection extends ObjectCollection
{
 
    public SentenceCollection()
    { 
        super();
    }
    
    public String[] toString(Object[] sentence)
    {
        String[] temp = new String[sentence.length];
        for( int i = 0; i < sentence.length; i++ )
            temp[i] = sentence[i].toString();
        
        return temp;
    }
    
    /**
     * comparison method
     */
    public boolean isGreaterThan(Object[] first, Object[] second)
    {
       boolean flag = false;

       for (int i=0; i<first.length && flag==false; i++) {
	   if( ((first[i].toString()).compareToIgnoreCase(second[i].toString())) == 0 )
           {
               flag = false;
               continue;
           }

           if( ((first[i].toString()).compareToIgnoreCase(second[i].toString())) > 0 )
               return true;
           else
               return false;           
       }
       return flag;
    }    

}