1
20 package org.crosswire.common.diff;
21
22
29 public class CommonMiddle {
30
45 public CommonMiddle(String sourcePrefix, String sourceSuffix, String targetPrefix, String targetSuffix, String commonality) {
46 this.sourcePrefix = sourcePrefix;
47 this.sourceSuffix = sourceSuffix;
48 this.targetPrefix = targetPrefix;
49 this.targetSuffix = targetSuffix;
50 this.commonality = commonality;
51 }
52
53
56 public String getSourcePrefix() {
57 return sourcePrefix;
58 }
59
60
63 public String getTargetPrefix() {
64 return targetPrefix;
65 }
66
67
70 public String getCommonality() {
71 return commonality;
72 }
73
74
77 public String getSourceSuffix() {
78 return sourceSuffix;
79 }
80
81
84 public String getTargetSuffix() {
85 return targetSuffix;
86 }
87
88
93 @Override
94 public String toString() {
95 StringBuilder buf = new StringBuilder();
96 buf.append(sourcePrefix);
97 buf.append(',');
98 buf.append(sourceSuffix);
99 buf.append(',');
100 buf.append(targetPrefix);
101 buf.append(',');
102 buf.append(targetSuffix);
103 buf.append(',');
104 buf.append(commonality);
105 return buf.toString();
106 }
107
108
113 @Override
114 public int hashCode() {
115 int result = 31 + ((sourcePrefix == null) ? 0 : sourcePrefix.hashCode());
116 result = 31 * result + ((sourceSuffix == null) ? 0 : sourceSuffix.hashCode());
117 result = 31 * result + ((targetPrefix == null) ? 0 : targetPrefix.hashCode());
118 result = 31 * result + ((targetSuffix == null) ? 0 : targetSuffix.hashCode());
119 return 31 * result + ((commonality == null) ? 0 : commonality.hashCode());
120 }
121
122
127 @Override
128 public boolean equals(Object obj) {
129 if (this == obj) {
130 return true;
131 }
132
133 if (obj == null || getClass() != obj.getClass()) {
134 return false;
135 }
136
137 final CommonMiddle other = (CommonMiddle) obj;
138
139 return sourcePrefix.equals(other.sourcePrefix) && sourceSuffix.equals(other.sourceSuffix) && targetPrefix.equals(other.targetPrefix)
140 && targetSuffix.equals(other.targetSuffix) && commonality.equals(other.commonality);
141 }
142
143 private String sourcePrefix;
144 private String sourceSuffix;
145 private String targetPrefix;
146 private String targetSuffix;
147 private String commonality;
148 }
149