Skip to content

Commit 500c9e9

Browse files
committed
Simplified DataDictionary
1 parent 70d97af commit 500c9e9

File tree

1 file changed

+8
-25
lines changed

1 file changed

+8
-25
lines changed

quickfixj-core/src/main/java/quickfix/DataDictionary.java

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,7 @@ public boolean isMsgField(String msgType, int field) {
272272
* @return true if field is a header field, false otherwise.
273273
*/
274274
public boolean isHeaderField(int field) {
275-
Set<Integer> fields = messageFields.get(HEADER_ID);
276-
return fields != null && fields.contains(field);
275+
return isMsgField(HEADER_ID, field);
277276
}
278277

279278
/**
@@ -283,8 +282,7 @@ public boolean isHeaderField(int field) {
283282
* @return true if field is a trailer field, false otherwise.
284283
*/
285284
public boolean isTrailerField(int field) {
286-
Set<Integer> fields = messageFields.get(TRAILER_ID);
287-
return fields != null && fields.contains(field);
285+
return isMsgField(TRAILER_ID, field);
288286
}
289287

290288
private void addFieldType(int field, FieldType fieldType) {
@@ -542,7 +540,7 @@ private void copyFrom(DataDictionary rhs) {
542540
}
543541

544542
@SuppressWarnings("unchecked")
545-
private <K, V> void copyMap(Map<K, V> lhs, Map<K, V> rhs) {
543+
private static <K, V> void copyMap(Map<K, V> lhs, Map<K, V> rhs) {
546544
lhs.clear();
547545
for (Map.Entry<K, V> entry : rhs.entrySet()) {
548546
Object value = entry.getValue();
@@ -562,7 +560,7 @@ private <K, V> void copyMap(Map<K, V> lhs, Map<K, V> rhs) {
562560
}
563561
}
564562

565-
private <V> void copyCollection(Collection<V> lhs, Collection<V> rhs) {
563+
private static <V> void copyCollection(Collection<V> lhs, Collection<V> rhs) {
566564
lhs.clear();
567565
lhs.addAll(rhs);
568566
}
@@ -752,13 +750,8 @@ private void checkValidFormat(StringField field) throws IncorrectDataFormat {
752750
}
753751

754752
private void checkValue(StringField field) throws IncorrectTagValue {
755-
final int tag = field.getField();
756-
if (!hasFieldValue(tag)) {
757-
return;
758-
}
759-
760-
final String value = field.getValue();
761-
if (!isFieldValue(tag, value)) {
753+
int tag = field.getField();
754+
if (hasFieldValue(tag) && !isFieldValue(tag, field.getValue())) {
762755
throw new IncorrectTagValue(tag);
763756
}
764757
}
@@ -1056,11 +1049,9 @@ private void load(Document document, String msgtype, Node node) throws ConfigErr
10561049
public int[] getOrderedFields() {
10571050
if (orderedFieldsArray == null) {
10581051
orderedFieldsArray = new int[fields.size()];
1059-
1060-
final Iterator<Integer> fieldItr = fields.iterator();
10611052
int i = 0;
1062-
while (fieldItr.hasNext()) {
1063-
orderedFieldsArray[i++] = fieldItr.next();
1053+
for (Integer field : fields) {
1054+
orderedFieldsArray[i++] = field;
10641055
}
10651056
}
10661057

@@ -1216,14 +1207,6 @@ public IntStringPair(int value, String value2) {
12161207
stringValue = value2;
12171208
}
12181209

1219-
//public int getIntValue() {
1220-
// return intValue;
1221-
//}
1222-
1223-
//public String getStringValue() {
1224-
// return stringValue;
1225-
//}
1226-
12271210
@Override
12281211
public boolean equals(Object other) {
12291212
return this == other

0 commit comments

Comments
 (0)