package innovimax.mixthem.operation;

import java.util.EnumSet;

/**
* <p>Describes the result of an line operation on two files.</p>
* @author Innovimax
* @version 1.0
*/
public class LineResult {
    
    private final EnumSet<ResultType> types;
    private String result;
    private String line1;
    private String line2;    
    
    /**
    * Creates a line result.    
    */
    public LineResult() {
        this.types = EnumSet.noneOf(ResultType.class);
        this.result = null;
        this.line1 = null;
        this.line2 = null;        
    }

    /**
    * Reset the result.
    */
    void reset() {        
        this.types.clear();
        this.result = null;
    }
    
    /**
    * Set the result (maybe null).
    */
    void setResult(String result) {
        this.result = result;
        if (result != null) {
            this.types.add(ResultType.HAS_RESULT);
        }
    }

    /**
    * Returns the result (maybe null).
    */
    String getResult() {
        return this.result;
    }

    /**
    * Has a result ?
    */
    boolean hasResult() {
        return this.types.contains(ResultType.HAS_RESULT);     
    }
    
    /**
    * Set the first line.
    */
    void setFirstLine(String line) {
        this.line1 = line;        
    }
    
    /**
    * Get the first line.
    */
    String getFirstLine() {
        return this.line1;
    }
    
    /**
    * Has first line?
    */
    boolean hasFirstLine() {
        return this.line1 != null;
    }
    
    /**
    * Set the second line.
    */
    void setSecondLine(String line) {
        this.line2 = line;        
    }
    
    /**
    * Get the second line.
    */
    String getSecondLine() {
        return this.line2;
    }
    
    /**
    * Has second line?
    */
    boolean hasSecondLine() {
        return this.line2 != null;
    }
    
    /**
    * Preserves first file from reading
    */
    void preserveFirstLine() {
        this.types.add(ResultType.PRESERVE_FIRST_LINE);        
    }

    /**
    * Has to read first file ?
    */
    boolean readingFirstFile() {
        return !this.types.contains(ResultType.PRESERVE_FIRST_LINE);
    }

    /**
    * Preserves second file from reading
    */
    void preserveSecondLine() {
        this.types.add(ResultType.PRESERVE_SECOND_LINE);        
    }

    /**
    * Has to read second file ?
    */
    boolean readingSecondFile() {
        return !this.types.contains(ResultType.PRESERVE_SECOND_LINE);
    }

}

@@ -1171,673 +1171,197 @@
   * 
-Set the first line.%0A    */%0A    void setFirstLine(String line) %7B%0A        this.line1 = line;        %0A    %7D%0A    %0A    /**%0A    * Get the first line.%0A    */%0A    String getFirstLine() %7B%0A        return this.line1;%0A    %7D%0A    %0A    /**%0A    * Has first line?%0A    */%0A    boolean hasFirstLine() %7B%0A        return this.line1 != null;%0A    %7D%0A    %0A    /**%0A    * Set the second line.%0A    */%0A    void setSecondLine(String line) %7B%0A        this.line2 = line;        %0A    %7D%0A    %0A    /**%0A    * Get the second line.%0A    */%0A    String getSecondLine() %7B%0A        return this.line2;%0A    %7D%0A    %0A    /**%0A    * Has second line?%0A    */%0A    boolean hasSecondLine() %7B%0A        return this.line2 != null
+Get the first line.%0A    */%0A    String getFirstLine() %7B%0A        return this.line1;%0A    %7D%0A    %0A    /**%0A    * Get the second line.%0A    */%0A    String getSecondLine() %7B%0A        return this.line2
 ;%0A  
@@ -1443,35 +1443,54 @@
 eserveFirstLine(
-) %7B
+String line) %7B        
 %0A        this.ty
@@ -1525,32 +1525,33 @@
 FIRST_LINE);
+%0A
         
 %0A    %7D%0A%0A    
@@ -1530,32 +1530,50 @@
 _LINE);%0A        
+this.line1 = line;
 %0A    %7D%0A%0A    /**%0A
@@ -1795,32 +1795,43 @@
 serveSecondLine(
+String line
 ) %7B%0A        this
@@ -1874,24 +1874,25 @@
 D_LINE);
+%0A
         
 %0A    %7D%0A%0A
@@ -1875,32 +1875,50 @@
 _LINE);%0A        
+this.line2 = line;
 %0A    %7D%0A%0A    /**%0A

Update LineResult.java