philadelphia-core: Add `#valueOf(int,int)` and `#indexOf(int,int)` to `FIXMessage`
@@ -138,6 +138,24 @@ public class FIXMessage {
return null;
}
+ /**
+ * Get the value container of the first instance of a field with the
+ * specified tag, starting at the specified index.
+ *
+ * @param tag the tag
+ * @param fromIndex the index to start the search from
+ * @return the value container or {@code null} if there are no instances
+ * of a field with the specified tag
+ */
+ public FIXValue valueOf(int tag, int fromIndex) {
+ for (; fromIndex < count; fromIndex++) {
+ if (tags[fromIndex] == tag)
+ return values[fromIndex];
+ }
+
+ return null;
+ }
+
/**
* Get the index of the first instance of a field with the specified tag.
*
@@ -154,6 +172,24 @@ public class FIXMessage {
return -1;
}
+ /**
+ * Get the index of the first instance of a field with the specified tag,
+ * starting at the specified index.
+ *
+ * @param tag the tag
+ * @param fromIndex the index to start the search from
+ * @return the index or -1 if there are no instances of a field with the
+ * specified tag
+ */
+ public int indexOf(int tag, int fromIndex) {
+ for (; fromIndex < count; fromIndex++) {
+ if (tags[fromIndex] == tag)
+ return fromIndex;
+ }
+
+ return -1;
+ }
+
/**
* Add a field.
*
