14 package cz.vutbr.fit.knot.annotations.app;
16 import java.util.ArrayList;
17 import java.util.Iterator;
40 private ArrayList<ArrayList<TextModification>>
appliedModifications =
new ArrayList<ArrayList<TextModification>>();
58 this.modificationsID.add(firstModificationID);
59 this.appliedModifications.add(firstModifications);
70 this.appliedModifications.add(modifications);
71 this.modificationsID.add(modificationID);
73 this.appliedModifications.remove(0);
74 this.modificationsID.remove(0);
84 return this.modificationsID.contains(modificationID);
97 ArrayList<TextModification> modifications)
99 if(modifications.isEmpty()){
102 int modIndex = this.modificationsID.indexOf(setID);
105 for(
int i = modIndex; i < this.modificationsID.size(); i++){
124 ArrayList<TextModification> secondModSet)
126 Iterator<TextModification> firstIT = firstModSet.iterator();
127 while(firstIT.hasNext()){
129 Iterator<TextModification> secondIT = secondModSet.iterator();
130 while(secondIT.hasNext()){
158 int pathComp = (firstMod.getPath() +
"z").compareTo(secondMod.getPath() +
"z");
160 case Constants.TEXT_MOD_REPLACE:
162 case Constants.TEXT_MOD_REPLACE:
168 else if(pathComp < 0){
171 if(firstMod.
getOffset() == null && firstMod.getLength() == null){
176 case Constants.TEXT_MOD_INS_BEFORE:
181 if(firstMod.
getOffset() == null && firstMod.getLength() == null){
186 else if(pathComp == 0 && firstMod.
getOffset() == null &&
187 firstMod.getLength() == null && firstMod.
getNewContent() == null)
192 case Constants.TEXT_MOD_INS_AFTER:
197 if(firstMod.
getOffset() == null && firstMod.getLength() == null){
204 case Constants.TEXT_MOD_INS_BEFORE:
210 case Constants.TEXT_MOD_INS_AFTER:
212 case Constants.TEXT_MOD_REPLACE:
213 case Constants.TEXT_MOD_INS_BEFORE:
219 case Constants.TEXT_MOD_INS_AFTER:
synchronized void addNextModificationSet(int modificationID, ArrayList< TextModification > modifications)
synchronized boolean compareTwoModsForConflicts(TextModification firstMod, TextModification secondMod)
LastTextModifications(int documentID, int firstModificationID, ArrayList< TextModification > firstModifications)
ArrayList< ArrayList< TextModification > > appliedModifications
ArrayList< Integer > modificationsID
Class representing modification of annotated document text.
synchronized boolean containsSet(int modificationID)
Class representing last applied modifications on a document.
synchronized boolean hasModificationSetsConflicts(int setID, ArrayList< TextModification > modifications)
synchronized boolean compareTwoSetsForConflicts(ArrayList< TextModification > firstModSet, ArrayList< TextModification > secondModSet)