1 package com.github.javaparser.printer.lexicalpreservation; 2 3 import com.github.javaparser.printer.concretesyntaxmodel.CsmMix; 4 5 /** 6 * Elements in a CsmMix have been reshuffled. It could also mean that 7 * some new elements have been added or removed to the mix. 8 */ 9 public class Reshuffled implements DifferenceElement { 10 private final CsmMix previousOrder; 11 private final CsmMix nextOrder; 12 Reshuffled(CsmMix previousOrder, CsmMix nextOrder)13 Reshuffled(CsmMix previousOrder, CsmMix nextOrder) { 14 this.previousOrder = previousOrder; 15 this.nextOrder = nextOrder; 16 } 17 18 @Override toString()19 public String toString() { 20 return "Reshuffled{" + nextOrder + ", previous="+ previousOrder+ '}'; 21 } 22 23 @Override equals(Object o)24 public boolean equals(Object o) { 25 if (this == o) return true; 26 if (o == null || getClass() != o.getClass()) return false; 27 28 Reshuffled that = (Reshuffled) o; 29 30 if (!previousOrder.equals(that.previousOrder)) return false; 31 return nextOrder.equals(that.nextOrder); 32 } 33 34 @Override hashCode()35 public int hashCode() { 36 int result = previousOrder.hashCode(); 37 result = 31 * result + nextOrder.hashCode(); 38 return result; 39 } 40 41 @Override getElement()42 public CsmMix getElement() { 43 return nextOrder; 44 } 45 getPreviousOrder()46 public CsmMix getPreviousOrder() { 47 return previousOrder; 48 } 49 getNextOrder()50 public CsmMix getNextOrder() { 51 return nextOrder; 52 } 53 54 @Override isAdded()55 public boolean isAdded() { 56 return false; 57 } 58 59 @Override isRemoved()60 public boolean isRemoved() { 61 return false; 62 } 63 } 64