@@ -94,7 +94,7 @@ public boolean isEmpty() {
9494 *
9595 * @return list model changes acceptable by the API server
9696 */
97- public List <DataVersion > toTrasferableDelta () {
97+ public List <DataVersion > toTransferableDelta () {
9898 List <DataVersion > delta = new LinkedList <>();
9999
100100 for (Element addition : getAdditions ()) {
@@ -126,7 +126,7 @@ public List<DataVersion> toTrasferableDelta() {
126126 * @return JSON string
127127 */
128128 public String toJson (Gson gson ) {
129- return gson .toJson (toTrasferableDelta ());
129+ return gson .toJson (toTransferableDelta ());
130130 }
131131
132132 /**
@@ -136,34 +136,34 @@ public String toJson(Gson gson) {
136136 * @return JSON string
137137 */
138138 public JsonElement toJsonTree (Gson gson ) {
139- return gson .toJsonTree (toTrasferableDelta ());
139+ return gson .toJsonTree (toTransferableDelta ());
140140 }
141141
142142 /**
143143 * Creates an {@link APIModelDelta} between two {@link APIModel}s
144144 *
145- * @param thisModel model to compare with baseline
145+ * @param current model to compare with baseline
146146 * @param baseline model to use as a baseline
147147 *
148148 * @return {@link APIModelDelta} of the two models
149149 */
150- public static APIModelDelta create (APIModel thisModel , APIModel baseline ) {
151- if (thisModel == null ) thisModel = APIModel .createEmpty ();
150+ public static APIModelDelta create (APIModel current , APIModel baseline ) {
151+ if (current == null ) current = APIModel .createEmpty ();
152152 if (baseline == null ) baseline = APIModel .createEmpty ();
153153
154154 Set <Element > additions = new HashSet <>();
155155 Set <UUID > deletions = new HashSet <>();
156156 Map <UUID , ChangedElement > changes = new HashMap <>();
157157
158- Map <UUID , Element > elementsFromThis = thisModel .getModelElements ();
158+ Map <UUID , Element > currentElements = current .getModelElements ();
159159
160- for (UUID id : elementsFromThis .keySet ()) {
160+ for (UUID id : currentElements .keySet ()) {
161161 Element baselineElement = baseline .getElement (id );
162162 if (baselineElement == null ) {
163- additions .add (thisModel .getElement (id ));
163+ additions .add (current .getElement (id ));
164164 } else {
165- Element thisElement = thisModel .getElement (id );
166- ChangedElement change = createElementDelta (thisElement , baselineElement );
165+ Element currentElement = current .getElement (id );
166+ ChangedElement change = createElementDelta (currentElement , baselineElement );
167167 if (change != null ) {
168168 changes .put (id , change );
169169 }
@@ -173,7 +173,7 @@ public static APIModelDelta create(APIModel thisModel, APIModel baseline) {
173173 Map <UUID , Element > elementsFromBaseline = baseline .getModelElements ();
174174
175175 for (UUID id : elementsFromBaseline .keySet ()) {
176- Element element = thisModel .getElement (id );
176+ Element element = current .getElement (id );
177177 if (element == null ) {
178178 deletions .add (id );
179179 }
@@ -185,31 +185,31 @@ public static APIModelDelta create(APIModel thisModel, APIModel baseline) {
185185 /**
186186 * Creates a {@link Data} object which contains changed fields and their new values
187187 *
188- * @param thisElement element to compare with baseline
188+ * @param currentElement element to compare with baseline
189189 * @param baselineElement element to use as a baseline
190190 * @return changed fields and their new values wrapped in a {@link Data} object.
191191 */
192- public static ChangedElement createElementDelta (Element thisElement , Element baselineElement ) {
192+ public static ChangedElement createElementDelta (Element currentElement , Element baselineElement ) {
193193 ChangedElement change = null ;
194- Set <String > fieldsInThis = thisElement .keySet ();
194+ Set <String > fieldsInThis = currentElement .keySet ();
195195 for (String field : fieldsInThis ) {
196- Object thisValue = thisElement .get (field );
196+ Object currentValue = currentElement .get (field );
197197 Object baselineValue = baselineElement .get (field );
198- if (!Objects .equal (thisValue , baselineValue )) {
198+ if (!Objects .equal (currentValue , baselineValue )) {
199199 if (change == null ) change = new ChangedElement (baselineElement );
200- change .add (field , thisValue );
200+ change .add (field , currentValue );
201201 }
202202 }
203203
204204 return change ;
205205 }
206206
207207 private static class ChangedElement {
208- private Element originalElement ;
208+ private Element baselineElement ;
209209 private Map <String , Object > changes = new HashMap <>();
210210
211- public ChangedElement (Element originalElement ) {
212- this .originalElement = originalElement ;
211+ public ChangedElement (Element baselineElement ) {
212+ this .baselineElement = baselineElement ;
213213 }
214214
215215 public void add (String field , Object thisValue ) {
@@ -218,7 +218,7 @@ public void add(String field, Object thisValue) {
218218
219219 public Data toData () {
220220 Data data = new Data ();
221- data .putAll (originalElement );
221+ data .putAll (baselineElement );
222222 data .putAll (changes );
223223 return data ;
224224 }
0 commit comments