Coverage Report - org.galagosearch.core.types.AdditionalDocumentText
 
Classes in this File Line Coverage Branch Coverage Complexity
AdditionalDocumentText
36%
4/11
50%
2/4
0
AdditionalDocumentText$IdentifierOrder
17%
4/23
0%
0/4
0
AdditionalDocumentText$IdentifierOrder$1
0%
0/5
0%
0/2
0
AdditionalDocumentText$IdentifierOrder$2
0%
0/5
0%
0/2
0
AdditionalDocumentText$IdentifierOrder$DuplicateEliminator
0%
0/19
0%
0/4
0
AdditionalDocumentText$IdentifierOrder$OrderedWriterClass
0%
0/14
0%
0/6
0
AdditionalDocumentText$IdentifierOrder$ShreddedBuffer
0%
0/74
0%
0/46
0
AdditionalDocumentText$IdentifierOrder$ShreddedCombiner
0%
0/55
0%
0/36
0
AdditionalDocumentText$IdentifierOrder$ShreddedProcessor
N/A
N/A
0
AdditionalDocumentText$IdentifierOrder$ShreddedReader
0%
0/69
0%
0/34
0
AdditionalDocumentText$IdentifierOrder$ShreddedSource
N/A
N/A
0
AdditionalDocumentText$IdentifierOrder$ShreddedWriter
0%
0/36
0%
0/14
0
AdditionalDocumentText$IdentifierOrder$TupleShredder
0%
0/17
0%
0/8
0
AdditionalDocumentText$IdentifierOrder$TupleUnshredder
0%
0/19
0%
0/2
0
AdditionalDocumentText$Processor
N/A
N/A
0
AdditionalDocumentText$Source
N/A
N/A
0
AdditionalDocumentText$Unordered
0%
0/22
0%
0/4
0
AdditionalDocumentText$Unordered$1
0%
0/3
N/A
0
AdditionalDocumentText$Unordered$2
0%
0/3
N/A
0
AdditionalDocumentText$Unordered$DuplicateEliminator
0%
0/11
N/A
0
AdditionalDocumentText$Unordered$OrderedWriterClass
0%
0/13
N/A
0
AdditionalDocumentText$Unordered$ShreddedBuffer
0%
0/37
0%
0/16
0
AdditionalDocumentText$Unordered$ShreddedCombiner
0%
0/55
0%
0/36
0
AdditionalDocumentText$Unordered$ShreddedProcessor
N/A
N/A
0
AdditionalDocumentText$Unordered$ShreddedReader
0%
0/55
0%
0/28
0
AdditionalDocumentText$Unordered$ShreddedSource
N/A
N/A
0
AdditionalDocumentText$Unordered$ShreddedWriter
0%
0/22
0%
0/6
0
AdditionalDocumentText$Unordered$TupleShredder
0%
0/16
0%
0/2
0
AdditionalDocumentText$Unordered$TupleUnshredder
0%
0/18
0%
0/2
0
 
 1  
 // This file was automatically generated with the command: 
 2  
 //     java org.galagosearch.tupleflow.typebuilder.TypeBuilderMojo ...
 3  
 package org.galagosearch.core.types;
 4  
 
 5  
 import org.galagosearch.tupleflow.Utility;
 6  
 import org.galagosearch.tupleflow.ArrayInput;
 7  
 import org.galagosearch.tupleflow.ArrayOutput;
 8  
 import org.galagosearch.tupleflow.Order;   
 9  
 import org.galagosearch.tupleflow.OrderedWriter;
 10  
 import org.galagosearch.tupleflow.Type; 
 11  
 import org.galagosearch.tupleflow.TypeReader;
 12  
 import org.galagosearch.tupleflow.Step; 
 13  
 import org.galagosearch.tupleflow.IncompatibleProcessorException;
 14  
 import org.galagosearch.tupleflow.ReaderSource;
 15  
 import java.io.IOException;             
 16  
 import java.io.EOFException;
 17  
 import java.io.UnsupportedEncodingException;
 18  
 import java.util.ArrayList;
 19  
 import java.util.Arrays;   
 20  
 import java.util.Comparator;
 21  
 import java.util.PriorityQueue;
 22  
 import java.util.Collection;
 23  
 
 24  
 public class AdditionalDocumentText implements Type<AdditionalDocumentText> {
 25  
     public String identifier;
 26  
     public String text; 
 27  
     
 28  12
     public AdditionalDocumentText() {}
 29  0
     public AdditionalDocumentText(String identifier, String text) {
 30  0
         this.identifier = identifier;
 31  0
         this.text = text;
 32  0
     }  
 33  
     
 34  
     public String toString() {
 35  0
             return String.format("%s,%s",
 36  
                                    identifier, text);
 37  
     } 
 38  
 
 39  
     public Order<AdditionalDocumentText> getOrder(String... spec) {
 40  12
         if (Arrays.equals(spec, new String[] {  })) {
 41  0
             return new Unordered();
 42  
         }
 43  12
         if (Arrays.equals(spec, new String[] { "+identifier" })) {
 44  12
             return new IdentifierOrder();
 45  
         }
 46  0
         return null;
 47  
     } 
 48  
       
 49  
     public interface Processor extends Step, org.galagosearch.tupleflow.Processor<AdditionalDocumentText> {
 50  
         public void process(AdditionalDocumentText object) throws IOException;
 51  
         public void close() throws IOException;
 52  
     }                        
 53  
     public interface Source extends Step {
 54  
     }
 55  0
     public static class Unordered implements Order<AdditionalDocumentText> {
 56  
         public int hash(AdditionalDocumentText object) {
 57  0
             int h = 0;
 58  0
             return h;
 59  
         } 
 60  
         public Comparator<AdditionalDocumentText> greaterThan() {
 61  0
             return new Comparator<AdditionalDocumentText>() {
 62  0
                 public int compare(AdditionalDocumentText one, AdditionalDocumentText two) {
 63  0
                     int result = 0;
 64  
                     do {
 65  
                     } while (false);
 66  0
                     return -result;
 67  
                 }
 68  
             };
 69  
         }     
 70  
         public Comparator<AdditionalDocumentText> lessThan() {
 71  0
             return new Comparator<AdditionalDocumentText>() {
 72  0
                 public int compare(AdditionalDocumentText one, AdditionalDocumentText two) {
 73  0
                     int result = 0;
 74  
                     do {
 75  
                     } while (false);
 76  0
                     return result;
 77  
                 }
 78  
             };
 79  
         }     
 80  
         public TypeReader<AdditionalDocumentText> orderedReader(ArrayInput _input) {
 81  0
             return new ShreddedReader(_input);
 82  
         }    
 83  
 
 84  
         public TypeReader<AdditionalDocumentText> orderedReader(ArrayInput _input, int bufferSize) {
 85  0
             return new ShreddedReader(_input, bufferSize);
 86  
         }    
 87  
         public OrderedWriter<AdditionalDocumentText> orderedWriter(ArrayOutput _output) {
 88  0
             ShreddedWriter w = new ShreddedWriter(_output);
 89  0
             return new OrderedWriterClass(w); 
 90  
         }                                    
 91  0
         public static class OrderedWriterClass extends OrderedWriter< AdditionalDocumentText > {
 92  0
             AdditionalDocumentText last = null;
 93  0
             ShreddedWriter shreddedWriter = null; 
 94  
             
 95  0
             public OrderedWriterClass(ShreddedWriter s) {
 96  0
                 this.shreddedWriter = s;
 97  0
             }
 98  
             
 99  
             public void process(AdditionalDocumentText object) throws IOException {
 100  0
                boolean processAll = false;
 101  0
                shreddedWriter.processTuple(object.identifier, object.text);
 102  0
                last = object;
 103  0
             }           
 104  
                  
 105  
             public void close() throws IOException {
 106  0
                 shreddedWriter.close();
 107  0
             }
 108  
             
 109  
             public Class<AdditionalDocumentText> getInputClass() {
 110  0
                 return AdditionalDocumentText.class;
 111  
             }
 112  
         } 
 113  
         public ReaderSource<AdditionalDocumentText> orderedCombiner(Collection<TypeReader<AdditionalDocumentText>> readers, boolean closeOnExit) {
 114  0
             ArrayList<ShreddedReader> shreddedReaders = new ArrayList();
 115  
             
 116  0
             for (TypeReader<AdditionalDocumentText> reader : readers) {
 117  0
                 shreddedReaders.add((ShreddedReader)reader);
 118  
             }
 119  
             
 120  0
             return new ShreddedCombiner(shreddedReaders, closeOnExit);
 121  
         }                  
 122  
         public AdditionalDocumentText clone(AdditionalDocumentText object) {
 123  0
             AdditionalDocumentText result = new AdditionalDocumentText();
 124  0
             if (object == null) return result;
 125  0
             result.identifier = object.identifier; 
 126  0
             result.text = object.text; 
 127  0
             return result;
 128  
         }                 
 129  
         public Class<AdditionalDocumentText> getOrderedClass() {
 130  0
             return AdditionalDocumentText.class;
 131  
         }                           
 132  
         public String[] getOrderSpec() {
 133  0
             return new String[] {};
 134  
         }
 135  
 
 136  
         public static String getSpecString() {
 137  0
             return "";
 138  
         }
 139  
                            
 140  
         public interface ShreddedProcessor extends Step {
 141  
             public void processTuple(String identifier, String text) throws IOException;
 142  
             public void close() throws IOException;
 143  
         }    
 144  
         public interface ShreddedSource extends Step {
 145  
         }                                              
 146  
         
 147  
         public static class ShreddedWriter implements ShreddedProcessor {
 148  
             ArrayOutput output;
 149  0
             ShreddedBuffer buffer = new ShreddedBuffer();
 150  0
             boolean lastFlush = false;
 151  
             
 152  0
             public ShreddedWriter(ArrayOutput output) {
 153  0
                 this.output = output;
 154  0
             }                        
 155  
             
 156  
             public void close() throws IOException {
 157  0
                 flush();
 158  0
             }
 159  
             
 160  
             public final void processTuple(String identifier, String text) throws IOException {
 161  0
                 if (lastFlush) {
 162  0
                     lastFlush = false;
 163  
                 }
 164  0
                 buffer.processTuple(identifier, text);
 165  0
                 if (buffer.isFull())
 166  0
                     flush();
 167  0
             }
 168  
             public final void flushTuples(int pauseIndex) throws IOException {
 169  
                 
 170  0
                 while (buffer.getReadIndex() < pauseIndex) {
 171  
                            
 172  0
                     output.writeString(buffer.getIdentifier());
 173  0
                     output.writeString(buffer.getText());
 174  0
                     buffer.incrementTuple();
 175  
                 }
 176  0
             }  
 177  
             public void flush() throws IOException { 
 178  0
                 flushTuples(buffer.getWriteIndex());
 179  0
                 buffer.reset(); 
 180  0
                 lastFlush = true;
 181  0
             }                           
 182  
         }
 183  0
         public static class ShreddedBuffer {
 184  
                             
 185  
             String[] identifiers;
 186  
             String[] texts;
 187  0
             int writeTupleIndex = 0;
 188  0
             int readTupleIndex = 0;
 189  
             int batchSize;
 190  
 
 191  0
             public ShreddedBuffer(int batchSize) {
 192  0
                 this.batchSize = batchSize;
 193  
 
 194  0
                 identifiers = new String[batchSize];
 195  0
                 texts = new String[batchSize];
 196  0
             }                              
 197  
 
 198  
             public ShreddedBuffer() {    
 199  0
                 this(10000);
 200  0
             }                                                                                                                    
 201  
             
 202  
             public void processTuple(String identifier, String text) {
 203  0
                 identifiers[writeTupleIndex] = identifier;
 204  0
                 texts[writeTupleIndex] = text;
 205  0
                 writeTupleIndex++;
 206  0
             }
 207  
             public void resetData() {
 208  0
                 writeTupleIndex = 0;
 209  0
             }                  
 210  
                                  
 211  
             public void resetRead() {
 212  0
                 readTupleIndex = 0;
 213  0
             } 
 214  
 
 215  
             public void reset() {
 216  0
                 resetData();
 217  0
                 resetRead();
 218  0
             } 
 219  
             public boolean isFull() {
 220  0
                 return writeTupleIndex >= batchSize;
 221  
             }
 222  
 
 223  
             public boolean isEmpty() {
 224  0
                 return writeTupleIndex == 0;
 225  
             }                          
 226  
 
 227  
             public boolean isAtEnd() {
 228  0
                 return readTupleIndex >= writeTupleIndex;
 229  
             }           
 230  
             public void incrementTuple() {
 231  0
                 readTupleIndex++;
 232  0
             }                    
 233  
             public int getReadIndex() {
 234  0
                 return readTupleIndex;
 235  
             }   
 236  
 
 237  
             public int getWriteIndex() {
 238  0
                 return writeTupleIndex;
 239  
             } 
 240  
             public String getIdentifier() {
 241  0
                 assert readTupleIndex < writeTupleIndex;
 242  0
                 return identifiers[readTupleIndex];
 243  
             }                                         
 244  
             public String getText() {
 245  0
                 assert readTupleIndex < writeTupleIndex;
 246  0
                 return texts[readTupleIndex];
 247  
             }                                         
 248  
             public void copyTuples(int endIndex, ShreddedProcessor output) throws IOException {
 249  0
                 while (getReadIndex() < endIndex) {
 250  0
                    output.processTuple(getIdentifier(), getText());
 251  0
                    incrementTuple();
 252  
                 }
 253  0
             }                                                                           
 254  
              
 255  
             public void copyUntil(ShreddedBuffer other, ShreddedProcessor output) throws IOException {
 256  0
             }
 257  
             
 258  
         }                         
 259  0
         public static class ShreddedCombiner implements ReaderSource<AdditionalDocumentText>, ShreddedSource {   
 260  
             public ShreddedProcessor processor;
 261  
             Collection<ShreddedReader> readers;       
 262  0
             boolean closeOnExit = false;
 263  0
             boolean uninitialized = true;
 264  0
             PriorityQueue<ShreddedReader> queue = new PriorityQueue<ShreddedReader>();
 265  
             
 266  0
             public ShreddedCombiner(Collection<ShreddedReader> readers, boolean closeOnExit) {
 267  0
                 this.readers = readers;                                                       
 268  0
                 this.closeOnExit = closeOnExit;
 269  0
             }
 270  
                                   
 271  
             public void setProcessor(Step processor) throws IncompatibleProcessorException {  
 272  0
                 if (processor instanceof ShreddedProcessor) {
 273  0
                     this.processor = new DuplicateEliminator((ShreddedProcessor) processor);
 274  0
                 } else if (processor instanceof AdditionalDocumentText.Processor) {
 275  0
                     this.processor = new DuplicateEliminator(new TupleUnshredder((AdditionalDocumentText.Processor) processor));
 276  0
                 } else if (processor instanceof org.galagosearch.tupleflow.Processor) {
 277  0
                     this.processor = new DuplicateEliminator(new TupleUnshredder((org.galagosearch.tupleflow.Processor<AdditionalDocumentText>) processor));
 278  
                 } else {
 279  0
                     throw new IncompatibleProcessorException(processor.getClass().getName() + " is not supported by " + this.getClass().getName());                                                                       
 280  
                 }
 281  0
             }                                
 282  
             
 283  
             public Class<AdditionalDocumentText> getOutputClass() {
 284  0
                 return AdditionalDocumentText.class;
 285  
             }
 286  
             
 287  
             public void initialize() throws IOException {
 288  0
                 for (ShreddedReader reader : readers) {
 289  0
                     reader.fill();                                        
 290  
                     
 291  0
                     if (!reader.getBuffer().isAtEnd())
 292  0
                         queue.add(reader);
 293  
                 }   
 294  
 
 295  0
                 uninitialized = false;
 296  0
             }
 297  
 
 298  
             public void run() throws IOException {
 299  0
                 initialize();
 300  
                
 301  0
                 while (queue.size() > 0) {
 302  0
                     ShreddedReader top = queue.poll();
 303  0
                     ShreddedReader next = null;
 304  0
                     ShreddedBuffer nextBuffer = null; 
 305  
                     
 306  0
                     assert !top.getBuffer().isAtEnd();
 307  
                                                   
 308  0
                     if (queue.size() > 0) {
 309  0
                         next = queue.peek();
 310  0
                         nextBuffer = next.getBuffer();
 311  0
                         assert !nextBuffer.isAtEnd();
 312  
                     }
 313  
                     
 314  0
                     top.getBuffer().copyUntil(nextBuffer, processor);
 315  0
                     if (top.getBuffer().isAtEnd())
 316  0
                         top.fill();                 
 317  
                         
 318  0
                     if (!top.getBuffer().isAtEnd())
 319  0
                         queue.add(top);
 320  0
                 }              
 321  
                 
 322  0
                 if (closeOnExit)
 323  0
                     processor.close();
 324  0
             }
 325  
 
 326  
             public AdditionalDocumentText read() throws IOException {
 327  0
                 if (uninitialized)
 328  0
                     initialize();
 329  
 
 330  0
                 AdditionalDocumentText result = null;
 331  
 
 332  0
                 while (queue.size() > 0) {
 333  0
                     ShreddedReader top = queue.poll();
 334  0
                     result = top.read();
 335  
 
 336  0
                     if (result != null) {
 337  0
                         if (top.getBuffer().isAtEnd())
 338  0
                             top.fill();
 339  
 
 340  0
                         queue.offer(top);
 341  0
                         break;
 342  
                     } 
 343  0
                 }
 344  
 
 345  0
                 return result;
 346  
             }
 347  
         } 
 348  0
         public static class ShreddedReader implements Step, Comparable<ShreddedReader>, TypeReader<AdditionalDocumentText>, ShreddedSource {      
 349  
             public ShreddedProcessor processor;
 350  
             ShreddedBuffer buffer;
 351  0
             AdditionalDocumentText last = new AdditionalDocumentText();         
 352  0
             long tupleCount = 0;
 353  0
             long bufferStartCount = 0;  
 354  
             ArrayInput input;
 355  
             
 356  0
             public ShreddedReader(ArrayInput input) {
 357  0
                 this.input = input; 
 358  0
                 this.buffer = new ShreddedBuffer();
 359  0
             }                               
 360  
             
 361  0
             public ShreddedReader(ArrayInput input, int bufferSize) { 
 362  0
                 this.input = input;
 363  0
                 this.buffer = new ShreddedBuffer(bufferSize);
 364  0
             }
 365  
                  
 366  
             public final int compareTo(ShreddedReader other) {
 367  0
                 ShreddedBuffer otherBuffer = other.getBuffer();
 368  
                 
 369  0
                 if (buffer.isAtEnd() && otherBuffer.isAtEnd()) {
 370  0
                     return 0;                 
 371  0
                 } else if (buffer.isAtEnd()) {
 372  0
                     return -1;
 373  0
                 } else if (otherBuffer.isAtEnd()) {
 374  0
                     return 1;
 375  
                 }
 376  
                                    
 377  0
                 int result = 0;
 378  
                 do {
 379  
                 } while (false);                                             
 380  
                 
 381  0
                 return result;
 382  
             }
 383  
             
 384  
             public final ShreddedBuffer getBuffer() {
 385  0
                 return buffer;
 386  
             }                
 387  
             
 388  
             public final AdditionalDocumentText read() throws IOException {
 389  0
                 if (buffer.isAtEnd()) {
 390  0
                     fill();             
 391  
                 
 392  0
                     if (buffer.isAtEnd()) {
 393  0
                         return null;
 394  
                     }
 395  
                 }
 396  
                       
 397  0
                 assert !buffer.isAtEnd();
 398  0
                 AdditionalDocumentText result = new AdditionalDocumentText();
 399  
                 
 400  0
                 result.identifier = buffer.getIdentifier();
 401  0
                 result.text = buffer.getText();
 402  
                 
 403  0
                 buffer.incrementTuple();
 404  
                 
 405  0
                 return result;
 406  
             }           
 407  
             
 408  
             public final void fill() throws IOException {
 409  
                 try {   
 410  0
                     buffer.reset();
 411  
                     
 412  0
                     if (tupleCount != 0) {
 413  0
                         bufferStartCount = tupleCount;
 414  
                     }
 415  
                     
 416  0
                     while (!buffer.isFull()) {
 417  0
                         buffer.processTuple(input.readString(), input.readString());
 418  0
                         tupleCount++;
 419  
                     }
 420  0
                 } catch(EOFException e) {}
 421  0
             }
 422  
 
 423  
 
 424  
             public void run() throws IOException {
 425  
                 while (true) {
 426  0
                     fill();
 427  
                     
 428  0
                     if (buffer.isAtEnd())
 429  0
                         break;
 430  
                     
 431  0
                     buffer.copyUntil(null, processor);
 432  
                 }      
 433  0
                 processor.close();
 434  0
             }
 435  
             
 436  
             public void setProcessor(Step processor) throws IncompatibleProcessorException {  
 437  0
                 if (processor instanceof ShreddedProcessor) {
 438  0
                     this.processor = new DuplicateEliminator((ShreddedProcessor) processor);
 439  0
                 } else if (processor instanceof AdditionalDocumentText.Processor) {
 440  0
                     this.processor = new DuplicateEliminator(new TupleUnshredder((AdditionalDocumentText.Processor) processor));
 441  0
                 } else if (processor instanceof org.galagosearch.tupleflow.Processor) {
 442  0
                     this.processor = new DuplicateEliminator(new TupleUnshredder((org.galagosearch.tupleflow.Processor<AdditionalDocumentText>) processor));
 443  
                 } else {
 444  0
                     throw new IncompatibleProcessorException(processor.getClass().getName() + " is not supported by " + this.getClass().getName());                                                                       
 445  
                 }
 446  0
             }                                
 447  
             
 448  
             public Class<AdditionalDocumentText> getOutputClass() {
 449  0
                 return AdditionalDocumentText.class;
 450  
             }                
 451  
         }
 452  
         
 453  
         public static class DuplicateEliminator implements ShreddedProcessor {
 454  
             public ShreddedProcessor processor;
 455  0
             AdditionalDocumentText last = new AdditionalDocumentText();
 456  
                                            
 457  0
             public DuplicateEliminator() {}
 458  0
             public DuplicateEliminator(ShreddedProcessor processor) {
 459  0
                 this.processor = processor;
 460  0
             }
 461  
             
 462  
             public void setShreddedProcessor(ShreddedProcessor processor) {
 463  0
                 this.processor = processor;
 464  0
             }
 465  
 
 466  
           
 467  
             
 468  
                                
 469  
             public void processTuple(String identifier, String text) throws IOException {
 470  0
                 processor.processTuple(identifier, text);
 471  0
             } 
 472  
             
 473  
             public void close() throws IOException {
 474  0
                 processor.close();
 475  0
             }                    
 476  
         }
 477  
         public static class TupleUnshredder implements ShreddedProcessor {
 478  0
             AdditionalDocumentText last = new AdditionalDocumentText();
 479  
             public org.galagosearch.tupleflow.Processor<AdditionalDocumentText> processor;                               
 480  
             
 481  0
             public TupleUnshredder(AdditionalDocumentText.Processor processor) {
 482  0
                 this.processor = processor;
 483  0
             }         
 484  
             
 485  0
             public TupleUnshredder(org.galagosearch.tupleflow.Processor<AdditionalDocumentText> processor) {
 486  0
                 this.processor = processor;
 487  0
             }
 488  
             
 489  
             public AdditionalDocumentText clone(AdditionalDocumentText object) {
 490  0
                 AdditionalDocumentText result = new AdditionalDocumentText();
 491  0
                 if (object == null) return result;
 492  0
                 result.identifier = object.identifier; 
 493  0
                 result.text = object.text; 
 494  0
                 return result;
 495  
             }                 
 496  
             
 497  
             
 498  
             public void processTuple(String identifier, String text) throws IOException {
 499  0
                 last.identifier = identifier;
 500  0
                 last.text = text;
 501  0
                 processor.process(clone(last));
 502  0
             }               
 503  
             
 504  
             public void close() throws IOException {
 505  0
                 processor.close();
 506  0
             }
 507  
         }     
 508  0
         public static class TupleShredder implements Processor {
 509  0
             AdditionalDocumentText last = new AdditionalDocumentText();
 510  
             public ShreddedProcessor processor;
 511  
             
 512  0
             public TupleShredder(ShreddedProcessor processor) {
 513  0
                 this.processor = processor;
 514  0
             }                              
 515  
             
 516  
             public AdditionalDocumentText clone(AdditionalDocumentText object) {
 517  0
                 AdditionalDocumentText result = new AdditionalDocumentText();
 518  0
                 if (object == null) return result;
 519  0
                 result.identifier = object.identifier; 
 520  0
                 result.text = object.text; 
 521  0
                 return result;
 522  
             }                 
 523  
             
 524  
             public void process(AdditionalDocumentText object) throws IOException {                                                                                                                                                   
 525  0
                 boolean processAll = false;
 526  0
                 processor.processTuple(object.identifier, object.text);                                         
 527  0
             }
 528  
                           
 529  
             public Class<AdditionalDocumentText> getInputClass() {
 530  0
                 return AdditionalDocumentText.class;
 531  
             }
 532  
             
 533  
             public void close() throws IOException {
 534  0
                 processor.close();
 535  0
             }                     
 536  
         }
 537  
     } 
 538  44
     public static class IdentifierOrder implements Order<AdditionalDocumentText> {
 539  
         public int hash(AdditionalDocumentText object) {
 540  0
             int h = 0;
 541  0
             h += Utility.hash(object.identifier);
 542  0
             return h;
 543  
         } 
 544  
         public Comparator<AdditionalDocumentText> greaterThan() {
 545  0
             return new Comparator<AdditionalDocumentText>() {
 546  0
                 public int compare(AdditionalDocumentText one, AdditionalDocumentText two) {
 547  0
                     int result = 0;
 548  
                     do {
 549  0
                         result = + Utility.compare(one.identifier, two.identifier);
 550  0
                         if(result != 0) break;
 551  
                     } while (false);
 552  0
                     return -result;
 553  
                 }
 554  
             };
 555  
         }     
 556  
         public Comparator<AdditionalDocumentText> lessThan() {
 557  0
             return new Comparator<AdditionalDocumentText>() {
 558  0
                 public int compare(AdditionalDocumentText one, AdditionalDocumentText two) {
 559  0
                     int result = 0;
 560  
                     do {
 561  0
                         result = + Utility.compare(one.identifier, two.identifier);
 562  0
                         if(result != 0) break;
 563  
                     } while (false);
 564  0
                     return result;
 565  
                 }
 566  
             };
 567  
         }     
 568  
         public TypeReader<AdditionalDocumentText> orderedReader(ArrayInput _input) {
 569  0
             return new ShreddedReader(_input);
 570  
         }    
 571  
 
 572  
         public TypeReader<AdditionalDocumentText> orderedReader(ArrayInput _input, int bufferSize) {
 573  0
             return new ShreddedReader(_input, bufferSize);
 574  
         }    
 575  
         public OrderedWriter<AdditionalDocumentText> orderedWriter(ArrayOutput _output) {
 576  0
             ShreddedWriter w = new ShreddedWriter(_output);
 577  0
             return new OrderedWriterClass(w); 
 578  
         }                                    
 579  0
         public static class OrderedWriterClass extends OrderedWriter< AdditionalDocumentText > {
 580  0
             AdditionalDocumentText last = null;
 581  0
             ShreddedWriter shreddedWriter = null; 
 582  
             
 583  0
             public OrderedWriterClass(ShreddedWriter s) {
 584  0
                 this.shreddedWriter = s;
 585  0
             }
 586  
             
 587  
             public void process(AdditionalDocumentText object) throws IOException {
 588  0
                boolean processAll = false;
 589  0
                if (processAll || last == null || 0 != Utility.compare(object.identifier, last.identifier)) { processAll = true; shreddedWriter.processIdentifier(object.identifier); }
 590  0
                shreddedWriter.processTuple(object.text);
 591  0
                last = object;
 592  0
             }           
 593  
                  
 594  
             public void close() throws IOException {
 595  0
                 shreddedWriter.close();
 596  0
             }
 597  
             
 598  
             public Class<AdditionalDocumentText> getInputClass() {
 599  0
                 return AdditionalDocumentText.class;
 600  
             }
 601  
         } 
 602  
         public ReaderSource<AdditionalDocumentText> orderedCombiner(Collection<TypeReader<AdditionalDocumentText>> readers, boolean closeOnExit) {
 603  0
             ArrayList<ShreddedReader> shreddedReaders = new ArrayList();
 604  
             
 605  0
             for (TypeReader<AdditionalDocumentText> reader : readers) {
 606  0
                 shreddedReaders.add((ShreddedReader)reader);
 607  
             }
 608  
             
 609  0
             return new ShreddedCombiner(shreddedReaders, closeOnExit);
 610  
         }                  
 611  
         public AdditionalDocumentText clone(AdditionalDocumentText object) {
 612  0
             AdditionalDocumentText result = new AdditionalDocumentText();
 613  0
             if (object == null) return result;
 614  0
             result.identifier = object.identifier; 
 615  0
             result.text = object.text; 
 616  0
             return result;
 617  
         }                 
 618  
         public Class<AdditionalDocumentText> getOrderedClass() {
 619  32
             return AdditionalDocumentText.class;
 620  
         }                           
 621  
         public String[] getOrderSpec() {
 622  32
             return new String[] {"+identifier"};
 623  
         }
 624  
 
 625  
         public static String getSpecString() {
 626  0
             return "+identifier";
 627  
         }
 628  
                            
 629  
         public interface ShreddedProcessor extends Step {
 630  
             public void processIdentifier(String identifier) throws IOException;
 631  
             public void processTuple(String text) throws IOException;
 632  
             public void close() throws IOException;
 633  
         }    
 634  
         public interface ShreddedSource extends Step {
 635  
         }                                              
 636  
         
 637  0
         public static class ShreddedWriter implements ShreddedProcessor {
 638  
             ArrayOutput output;
 639  0
             ShreddedBuffer buffer = new ShreddedBuffer();
 640  
             String lastIdentifier;
 641  0
             boolean lastFlush = false;
 642  
             
 643  0
             public ShreddedWriter(ArrayOutput output) {
 644  0
                 this.output = output;
 645  0
             }                        
 646  
             
 647  
             public void close() throws IOException {
 648  0
                 flush();
 649  0
             }
 650  
             
 651  
             public void processIdentifier(String identifier) {
 652  0
                 lastIdentifier = identifier;
 653  0
                 buffer.processIdentifier(identifier);
 654  0
             }
 655  
             public final void processTuple(String text) throws IOException {
 656  0
                 if (lastFlush) {
 657  0
                     if(buffer.identifiers.size() == 0) buffer.processIdentifier(lastIdentifier);
 658  0
                     lastFlush = false;
 659  
                 }
 660  0
                 buffer.processTuple(text);
 661  0
                 if (buffer.isFull())
 662  0
                     flush();
 663  0
             }
 664  
             public final void flushTuples(int pauseIndex) throws IOException {
 665  
                 
 666  0
                 while (buffer.getReadIndex() < pauseIndex) {
 667  
                            
 668  0
                     output.writeString(buffer.getText());
 669  0
                     buffer.incrementTuple();
 670  
                 }
 671  0
             }  
 672  
             public final void flushIdentifier(int pauseIndex) throws IOException {
 673  0
                 while (buffer.getReadIndex() < pauseIndex) {
 674  0
                     int nextPause = buffer.getIdentifierEndIndex();
 675  0
                     int count = nextPause - buffer.getReadIndex();
 676  
                     
 677  0
                     output.writeString(buffer.getIdentifier());
 678  0
                     output.writeInt(count);
 679  0
                     buffer.incrementIdentifier();
 680  
                       
 681  0
                     flushTuples(nextPause);
 682  0
                     assert nextPause == buffer.getReadIndex();
 683  0
                 }
 684  0
             }
 685  
             public void flush() throws IOException { 
 686  0
                 flushIdentifier(buffer.getWriteIndex());
 687  0
                 buffer.reset(); 
 688  0
                 lastFlush = true;
 689  0
             }                           
 690  
         }
 691  0
         public static class ShreddedBuffer {
 692  0
             ArrayList<String> identifiers = new ArrayList();
 693  0
             ArrayList<Integer> identifierTupleIdx = new ArrayList();
 694  0
             int identifierReadIdx = 0;
 695  
                             
 696  
             String[] texts;
 697  0
             int writeTupleIndex = 0;
 698  0
             int readTupleIndex = 0;
 699  
             int batchSize;
 700  
 
 701  0
             public ShreddedBuffer(int batchSize) {
 702  0
                 this.batchSize = batchSize;
 703  
 
 704  0
                 texts = new String[batchSize];
 705  0
             }                              
 706  
 
 707  
             public ShreddedBuffer() {    
 708  0
                 this(10000);
 709  0
             }                                                                                                                    
 710  
             
 711  
             public void processIdentifier(String identifier) {
 712  0
                 identifiers.add(identifier);
 713  0
                 identifierTupleIdx.add(writeTupleIndex);
 714  0
             }                                      
 715  
             public void processTuple(String text) {
 716  0
                 assert identifiers.size() > 0;
 717  0
                 texts[writeTupleIndex] = text;
 718  0
                 writeTupleIndex++;
 719  0
             }
 720  
             public void resetData() {
 721  0
                 identifiers.clear();
 722  0
                 identifierTupleIdx.clear();
 723  0
                 writeTupleIndex = 0;
 724  0
             }                  
 725  
                                  
 726  
             public void resetRead() {
 727  0
                 readTupleIndex = 0;
 728  0
                 identifierReadIdx = 0;
 729  0
             } 
 730  
 
 731  
             public void reset() {
 732  0
                 resetData();
 733  0
                 resetRead();
 734  0
             } 
 735  
             public boolean isFull() {
 736  0
                 return writeTupleIndex >= batchSize;
 737  
             }
 738  
 
 739  
             public boolean isEmpty() {
 740  0
                 return writeTupleIndex == 0;
 741  
             }                          
 742  
 
 743  
             public boolean isAtEnd() {
 744  0
                 return readTupleIndex >= writeTupleIndex;
 745  
             }           
 746  
             public void incrementIdentifier() {
 747  0
                 identifierReadIdx++;  
 748  0
             }                                                                                              
 749  
 
 750  
             public void autoIncrementIdentifier() {
 751  0
                 while (readTupleIndex >= getIdentifierEndIndex() && readTupleIndex < writeTupleIndex)
 752  0
                     identifierReadIdx++;
 753  0
             }                 
 754  
             public void incrementTuple() {
 755  0
                 readTupleIndex++;
 756  0
             }                    
 757  
             public int getIdentifierEndIndex() {
 758  0
                 if ((identifierReadIdx+1) >= identifierTupleIdx.size())
 759  0
                     return writeTupleIndex;
 760  0
                 return identifierTupleIdx.get(identifierReadIdx+1);
 761  
             }
 762  
             public int getReadIndex() {
 763  0
                 return readTupleIndex;
 764  
             }   
 765  
 
 766  
             public int getWriteIndex() {
 767  0
                 return writeTupleIndex;
 768  
             } 
 769  
             public String getIdentifier() {
 770  0
                 assert readTupleIndex < writeTupleIndex;
 771  0
                 assert identifierReadIdx < identifiers.size();
 772  
                 
 773  0
                 return identifiers.get(identifierReadIdx);
 774  
             }
 775  
             public String getText() {
 776  0
                 assert readTupleIndex < writeTupleIndex;
 777  0
                 return texts[readTupleIndex];
 778  
             }                                         
 779  
             public void copyTuples(int endIndex, ShreddedProcessor output) throws IOException {
 780  0
                 while (getReadIndex() < endIndex) {
 781  0
                    output.processTuple(getText());
 782  0
                    incrementTuple();
 783  
                 }
 784  0
             }                                                                           
 785  
             public void copyUntilIndexIdentifier(int endIndex, ShreddedProcessor output) throws IOException {
 786  0
                 while (getReadIndex() < endIndex) {
 787  0
                     output.processIdentifier(getIdentifier());
 788  0
                     assert getIdentifierEndIndex() <= endIndex;
 789  0
                     copyTuples(getIdentifierEndIndex(), output);
 790  0
                     incrementIdentifier();
 791  
                 }
 792  0
             }  
 793  
             public void copyUntilIdentifier(ShreddedBuffer other, ShreddedProcessor output) throws IOException {
 794  0
                 while (!isAtEnd()) {
 795  0
                     if (other != null) {   
 796  0
                         assert !other.isAtEnd();
 797  0
                         int c = + Utility.compare(getIdentifier(), other.getIdentifier());
 798  
                     
 799  0
                         if (c > 0) {
 800  0
                             break;   
 801  
                         }
 802  
                         
 803  0
                         output.processIdentifier(getIdentifier());
 804  
                                       
 805  0
                         copyTuples(getIdentifierEndIndex(), output);
 806  0
                     } else {
 807  0
                         output.processIdentifier(getIdentifier());
 808  0
                         copyTuples(getIdentifierEndIndex(), output);
 809  
                     }
 810  0
                     incrementIdentifier();  
 811  
                     
 812  
                
 813  
                 }
 814  0
             }
 815  
             public void copyUntil(ShreddedBuffer other, ShreddedProcessor output) throws IOException {
 816  0
                 copyUntilIdentifier(other, output);
 817  0
             }
 818  
             
 819  
         }                         
 820  0
         public static class ShreddedCombiner implements ReaderSource<AdditionalDocumentText>, ShreddedSource {   
 821  
             public ShreddedProcessor processor;
 822  
             Collection<ShreddedReader> readers;       
 823  0
             boolean closeOnExit = false;
 824  0
             boolean uninitialized = true;
 825  0
             PriorityQueue<ShreddedReader> queue = new PriorityQueue<ShreddedReader>();
 826  
             
 827  0
             public ShreddedCombiner(Collection<ShreddedReader> readers, boolean closeOnExit) {
 828  0
                 this.readers = readers;                                                       
 829  0
                 this.closeOnExit = closeOnExit;
 830  0
             }
 831  
                                   
 832  
             public void setProcessor(Step processor) throws IncompatibleProcessorException {  
 833  0
                 if (processor instanceof ShreddedProcessor) {
 834  0
                     this.processor = new DuplicateEliminator((ShreddedProcessor) processor);
 835  0
                 } else if (processor instanceof AdditionalDocumentText.Processor) {
 836  0
                     this.processor = new DuplicateEliminator(new TupleUnshredder((AdditionalDocumentText.Processor) processor));
 837  0
                 } else if (processor instanceof org.galagosearch.tupleflow.Processor) {
 838  0
                     this.processor = new DuplicateEliminator(new TupleUnshredder((org.galagosearch.tupleflow.Processor<AdditionalDocumentText>) processor));
 839  
                 } else {
 840  0
                     throw new IncompatibleProcessorException(processor.getClass().getName() + " is not supported by " + this.getClass().getName());                                                                       
 841  
                 }
 842  0
             }                                
 843  
             
 844  
             public Class<AdditionalDocumentText> getOutputClass() {
 845  0
                 return AdditionalDocumentText.class;
 846  
             }
 847  
             
 848  
             public void initialize() throws IOException {
 849  0
                 for (ShreddedReader reader : readers) {
 850  0
                     reader.fill();                                        
 851  
                     
 852  0
                     if (!reader.getBuffer().isAtEnd())
 853  0
                         queue.add(reader);
 854  
                 }   
 855  
 
 856  0
                 uninitialized = false;
 857  0
             }
 858  
 
 859  
             public void run() throws IOException {
 860  0
                 initialize();
 861  
                
 862  0
                 while (queue.size() > 0) {
 863  0
                     ShreddedReader top = queue.poll();
 864  0
                     ShreddedReader next = null;
 865  0
                     ShreddedBuffer nextBuffer = null; 
 866  
                     
 867  0
                     assert !top.getBuffer().isAtEnd();
 868  
                                                   
 869  0
                     if (queue.size() > 0) {
 870  0
                         next = queue.peek();
 871  0
                         nextBuffer = next.getBuffer();
 872  0
                         assert !nextBuffer.isAtEnd();
 873  
                     }
 874  
                     
 875  0
                     top.getBuffer().copyUntil(nextBuffer, processor);
 876  0
                     if (top.getBuffer().isAtEnd())
 877  0
                         top.fill();                 
 878  
                         
 879  0
                     if (!top.getBuffer().isAtEnd())
 880  0
                         queue.add(top);
 881  0
                 }              
 882  
                 
 883  0
                 if (closeOnExit)
 884  0
                     processor.close();
 885  0
             }
 886  
 
 887  
             public AdditionalDocumentText read() throws IOException {
 888  0
                 if (uninitialized)
 889  0
                     initialize();
 890  
 
 891  0
                 AdditionalDocumentText result = null;
 892  
 
 893  0
                 while (queue.size() > 0) {
 894  0
                     ShreddedReader top = queue.poll();
 895  0
                     result = top.read();
 896  
 
 897  0
                     if (result != null) {
 898  0
                         if (top.getBuffer().isAtEnd())
 899  0
                             top.fill();
 900  
 
 901  0
                         queue.offer(top);
 902  0
                         break;
 903  
                     } 
 904  0
                 }
 905  
 
 906  0
                 return result;
 907  
             }
 908  
         } 
 909  0
         public static class ShreddedReader implements Step, Comparable<ShreddedReader>, TypeReader<AdditionalDocumentText>, ShreddedSource {      
 910  
             public ShreddedProcessor processor;
 911  
             ShreddedBuffer buffer;
 912  0
             AdditionalDocumentText last = new AdditionalDocumentText();         
 913  0
             long updateIdentifierCount = -1;
 914  0
             long tupleCount = 0;
 915  0
             long bufferStartCount = 0;  
 916  
             ArrayInput input;
 917  
             
 918  0
             public ShreddedReader(ArrayInput input) {
 919  0
                 this.input = input; 
 920  0
                 this.buffer = new ShreddedBuffer();
 921  0
             }                               
 922  
             
 923  0
             public ShreddedReader(ArrayInput input, int bufferSize) { 
 924  0
                 this.input = input;
 925  0
                 this.buffer = new ShreddedBuffer(bufferSize);
 926  0
             }
 927  
                  
 928  
             public final int compareTo(ShreddedReader other) {
 929  0
                 ShreddedBuffer otherBuffer = other.getBuffer();
 930  
                 
 931  0
                 if (buffer.isAtEnd() && otherBuffer.isAtEnd()) {
 932  0
                     return 0;                 
 933  0
                 } else if (buffer.isAtEnd()) {
 934  0
                     return -1;
 935  0
                 } else if (otherBuffer.isAtEnd()) {
 936  0
                     return 1;
 937  
                 }
 938  
                                    
 939  0
                 int result = 0;
 940  
                 do {
 941  0
                     result = + Utility.compare(buffer.getIdentifier(), otherBuffer.getIdentifier());
 942  0
                     if(result != 0) break;
 943  
                 } while (false);                                             
 944  
                 
 945  0
                 return result;
 946  
             }
 947  
             
 948  
             public final ShreddedBuffer getBuffer() {
 949  0
                 return buffer;
 950  
             }                
 951  
             
 952  
             public final AdditionalDocumentText read() throws IOException {
 953  0
                 if (buffer.isAtEnd()) {
 954  0
                     fill();             
 955  
                 
 956  0
                     if (buffer.isAtEnd()) {
 957  0
                         return null;
 958  
                     }
 959  
                 }
 960  
                       
 961  0
                 assert !buffer.isAtEnd();
 962  0
                 AdditionalDocumentText result = new AdditionalDocumentText();
 963  
                 
 964  0
                 result.identifier = buffer.getIdentifier();
 965  0
                 result.text = buffer.getText();
 966  
                 
 967  0
                 buffer.incrementTuple();
 968  0
                 buffer.autoIncrementIdentifier();
 969  
                 
 970  0
                 return result;
 971  
             }           
 972  
             
 973  
             public final void fill() throws IOException {
 974  
                 try {   
 975  0
                     buffer.reset();
 976  
                     
 977  0
                     if (tupleCount != 0) {
 978  
                                                       
 979  0
                         if(updateIdentifierCount - tupleCount > 0) {
 980  0
                             buffer.identifiers.add(last.identifier);
 981  0
                             buffer.identifierTupleIdx.add((int) (updateIdentifierCount - tupleCount));
 982  
                         }
 983  0
                         bufferStartCount = tupleCount;
 984  
                     }
 985  
                     
 986  0
                     while (!buffer.isFull()) {
 987  0
                         updateIdentifier();
 988  0
                         buffer.processTuple(input.readString());
 989  0
                         tupleCount++;
 990  
                     }
 991  0
                 } catch(EOFException e) {}
 992  0
             }
 993  
 
 994  
             public final void updateIdentifier() throws IOException {
 995  0
                 if (updateIdentifierCount > tupleCount)
 996  0
                     return;
 997  
                      
 998  0
                 last.identifier = input.readString();
 999  0
                 updateIdentifierCount = tupleCount + input.readInt();
 1000  
                                       
 1001  0
                 buffer.processIdentifier(last.identifier);
 1002  0
             }
 1003  
 
 1004  
             public void run() throws IOException {
 1005  
                 while (true) {
 1006  0
                     fill();
 1007  
                     
 1008  0
                     if (buffer.isAtEnd())
 1009  0
                         break;
 1010  
                     
 1011  0
                     buffer.copyUntil(null, processor);
 1012  
                 }      
 1013  0
                 processor.close();
 1014  0
             }
 1015  
             
 1016  
             public void setProcessor(Step processor) throws IncompatibleProcessorException {  
 1017  0
                 if (processor instanceof ShreddedProcessor) {
 1018  0
                     this.processor = new DuplicateEliminator((ShreddedProcessor) processor);
 1019  0
                 } else if (processor instanceof AdditionalDocumentText.Processor) {
 1020  0
                     this.processor = new DuplicateEliminator(new TupleUnshredder((AdditionalDocumentText.Processor) processor));
 1021  0
                 } else if (processor instanceof org.galagosearch.tupleflow.Processor) {
 1022  0
                     this.processor = new DuplicateEliminator(new TupleUnshredder((org.galagosearch.tupleflow.Processor<AdditionalDocumentText>) processor));
 1023  
                 } else {
 1024  0
                     throw new IncompatibleProcessorException(processor.getClass().getName() + " is not supported by " + this.getClass().getName());                                                                       
 1025  
                 }
 1026  0
             }                                
 1027  
             
 1028  
             public Class<AdditionalDocumentText> getOutputClass() {
 1029  0
                 return AdditionalDocumentText.class;
 1030  
             }                
 1031  
         }
 1032  
         
 1033  
         public static class DuplicateEliminator implements ShreddedProcessor {
 1034  
             public ShreddedProcessor processor;
 1035  0
             AdditionalDocumentText last = new AdditionalDocumentText();
 1036  0
             boolean identifierProcess = true;
 1037  
                                            
 1038  0
             public DuplicateEliminator() {}
 1039  0
             public DuplicateEliminator(ShreddedProcessor processor) {
 1040  0
                 this.processor = processor;
 1041  0
             }
 1042  
             
 1043  
             public void setShreddedProcessor(ShreddedProcessor processor) {
 1044  0
                 this.processor = processor;
 1045  0
             }
 1046  
 
 1047  
             public void processIdentifier(String identifier) throws IOException {  
 1048  0
                 if (identifierProcess || Utility.compare(identifier, last.identifier) != 0) {
 1049  0
                     last.identifier = identifier;
 1050  0
                     processor.processIdentifier(identifier);
 1051  0
                     identifierProcess = false;
 1052  
                 }
 1053  0
             }  
 1054  
             
 1055  
             public void resetIdentifier() {
 1056  0
                  identifierProcess = true;
 1057  0
             }                                                
 1058  
                                
 1059  
             public void processTuple(String text) throws IOException {
 1060  0
                 processor.processTuple(text);
 1061  0
             } 
 1062  
             
 1063  
             public void close() throws IOException {
 1064  0
                 processor.close();
 1065  0
             }                    
 1066  
         }
 1067  
         public static class TupleUnshredder implements ShreddedProcessor {
 1068  0
             AdditionalDocumentText last = new AdditionalDocumentText();
 1069  
             public org.galagosearch.tupleflow.Processor<AdditionalDocumentText> processor;                               
 1070  
             
 1071  0
             public TupleUnshredder(AdditionalDocumentText.Processor processor) {
 1072  0
                 this.processor = processor;
 1073  0
             }         
 1074  
             
 1075  0
             public TupleUnshredder(org.galagosearch.tupleflow.Processor<AdditionalDocumentText> processor) {
 1076  0
                 this.processor = processor;
 1077  0
             }
 1078  
             
 1079  
             public AdditionalDocumentText clone(AdditionalDocumentText object) {
 1080  0
                 AdditionalDocumentText result = new AdditionalDocumentText();
 1081  0
                 if (object == null) return result;
 1082  0
                 result.identifier = object.identifier; 
 1083  0
                 result.text = object.text; 
 1084  0
                 return result;
 1085  
             }                 
 1086  
             
 1087  
             public void processIdentifier(String identifier) throws IOException {
 1088  0
                 last.identifier = identifier;
 1089  0
             }   
 1090  
                 
 1091  
             
 1092  
             public void processTuple(String text) throws IOException {
 1093  0
                 last.text = text;
 1094  0
                 processor.process(clone(last));
 1095  0
             }               
 1096  
             
 1097  
             public void close() throws IOException {
 1098  0
                 processor.close();
 1099  0
             }
 1100  
         }     
 1101  44
         public static class TupleShredder implements Processor {
 1102  0
             AdditionalDocumentText last = new AdditionalDocumentText();
 1103  
             public ShreddedProcessor processor;
 1104  
             
 1105  0
             public TupleShredder(ShreddedProcessor processor) {
 1106  0
                 this.processor = processor;
 1107  0
             }                              
 1108  
             
 1109  
             public AdditionalDocumentText clone(AdditionalDocumentText object) {
 1110  0
                 AdditionalDocumentText result = new AdditionalDocumentText();
 1111  0
                 if (object == null) return result;
 1112  0
                 result.identifier = object.identifier; 
 1113  0
                 result.text = object.text; 
 1114  0
                 return result;
 1115  
             }                 
 1116  
             
 1117  
             public void process(AdditionalDocumentText object) throws IOException {                                                                                                                                                   
 1118  0
                 boolean processAll = false;
 1119  0
                 if(last == null || Utility.compare(last.identifier, object.identifier) != 0 || processAll) { processor.processIdentifier(object.identifier); processAll = true; }
 1120  0
                 processor.processTuple(object.text);                                         
 1121  0
             }
 1122  
                           
 1123  
             public Class<AdditionalDocumentText> getInputClass() {
 1124  0
                 return AdditionalDocumentText.class;
 1125  
             }
 1126  
             
 1127  
             public void close() throws IOException {
 1128  0
                 processor.close();
 1129  0
             }                     
 1130  
         }
 1131  
     } 
 1132  
 }