Ignore:
Timestamp:
12/23/14 11:19:04 (10 years ago)
Author:
pharms
Message:
  • rename of task instance comparator to task comparator as it actually compares tasks
  • smaller performance improvements
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/utils/TaskTraversalMyersDiff.java

    r1767 r1848  
    1515package de.ugoe.cs.autoquest.tasktrees.temporalrelation.utils; 
    1616 
    17 import de.ugoe.cs.autoquest.tasktrees.temporalrelation.TaskInstanceComparator; 
     17import de.ugoe.cs.autoquest.tasktrees.temporalrelation.TaskComparator; 
    1818import difflib.ChangeDelta; 
    1919import difflib.Chunk; 
     
    3333     
    3434    /**  */ 
    35     private final TaskInstanceComparator comparator; 
     35    private final TaskComparator comparator; 
    3636 
    3737    /** 
    3838     * 
    3939     */ 
    40     public TaskTraversalMyersDiff(TaskInstanceComparator comparator) { 
     40    public TaskTraversalMyersDiff(TaskComparator comparator) { 
    4141        this.comparator = comparator; 
    4242    } 
     
    102102                // but the algorithm is one-based 
    103103                // that's why there's no +1 when indexing the sequences 
    104                 synchronized (comparator) { 
    105                     while ((i < N) && (j < M) && comparator.equals(variant1.get(i), variant2.get(j))) 
    106                     { 
    107                         i++; 
    108                         j++; 
    109                     } 
     104                while ((i < N) && (j < M) && comparator.equals(variant1.get(i), variant2.get(j))) { 
     105                    i++; 
     106                    j++; 
    110107                } 
    111108                 
     
    169166             
    170167            Chunk original = new Chunk(ianchor, variant1.subList(ianchor, i)); 
     168            int originalSize = original.size(); 
    171169            Chunk revised = new Chunk(janchor, variant2.subList(janchor, j)); 
     170            int revisedSize = revised.size(); 
    172171            Delta delta = null; 
    173172             
    174             if ((original.size() == 0) && (revised.size() != 0)) { 
     173            if ((originalSize == 0) && (revisedSize != 0)) { 
    175174                delta = new InsertDelta(original, revised); 
    176175            } 
    177             else if ((original.size() > 0) && (revised.size() == 0)) { 
     176            else if ((originalSize > 0) && (revisedSize == 0)) { 
    178177                delta = new DeleteDelta(original, revised); 
    179178            } 
Note: See TracChangeset for help on using the changeset viewer.