|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectca.uhn.hl7v2.preparser.DatumPath
public class DatumPath
An object of this class represents a variable-size path for identifying the location of a datum within an HL7 message, which we can use for maintaining parser state and for generating a suitable string key (in the ZYX[a]-b[c]-d-e style) for a piece of data in the message (see toString()). The elements are: segmentID / segmentRepIdx / fieldIdx / fieldRepIdx / compIdx / subcompIdx ("rep" means "repetition") segmentID is a String, the rest are Integers. It is variable-size path-style in that if it has a size of 1, the one element will be the segmentID; if it has a size of two, element 0 will be the segmentID and element 1 will be the segmentRepIdx, etc. This class can't represent a fieldIdx without having segmentID / segmentRepIdx, etc. etc. possible sizes: 0 to 6 inclusive As toString() simply converts this's integer values to strings (1 => "1"), and since for some reason the ZYX[a]-b[c]-d-e style counts b, d, e starting from 1 and a, c from 0 -- it is intended that one store the numeric values in this class starting from 1 for fieldIdx (element 2), compIdx (4) and subcompIdx (5), and from 0 for segmentRepIdx (1) and fieldRepIdx (3). default values provided by setSize() and by toString() do this.
Field Summary | |
---|---|
protected java.util.Vector |
m_path
|
static int |
s_maxSize
|
Constructor Summary | |
---|---|
DatumPath()
|
|
DatumPath(DatumPath other)
copy constructor |
Method Summary | |
---|---|
DatumPath |
add(int new_value)
Like add(String). |
DatumPath |
add(java.lang.Object newValue)
add() grows this by 1, inserting newValue at the end. |
DatumPath |
add(java.lang.String new_value)
convenience! Like add(int), but the other way around. |
DatumPath |
clear()
setSize(0). |
java.lang.Object |
clone()
|
void |
copy(DatumPath other)
like a copy constructor without the constructor |
boolean |
equals(java.lang.Object otherObject)
|
java.lang.Object |
get(int idx)
get() returns an element, which will be either a String or an Integer. |
static void |
main(java.lang.String[] args)
|
boolean |
numbersLessThan(DatumPath other)
|
void |
set(int idx,
java.lang.Object new_value)
set() sets an element of the path. |
DatumPath |
setSize(int newSize)
setSize(): resize. |
int |
size()
|
boolean |
startsWith(DatumPath prefix)
Works like String.startsWith: returns true iff prefix.size() <= this.size() AND if, for 0 <= i < prefix.size(), this.get(i).equals(prefix.get(i)) |
java.lang.String |
toString()
toString() outputs the path (from segmentID onward) in the ZYX[a]-b[c]-d-e style (TODO: give it a name), suitable for a key in a map of message datum paths to values. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int s_maxSize
protected java.util.Vector m_path
Constructor Detail |
---|
public DatumPath()
public DatumPath(DatumPath other)
Method Detail |
---|
public boolean equals(java.lang.Object otherObject)
equals
in class java.lang.Object
public boolean startsWith(DatumPath prefix)
public void copy(DatumPath other)
public void set(int idx, java.lang.Object new_value)
public java.lang.Object get(int idx)
public int size()
public java.lang.String toString()
toString
in class java.lang.Object
public DatumPath add(java.lang.Object newValue)
public DatumPath add(int new_value)
public DatumPath add(java.lang.String new_value)
public DatumPath setSize(int newSize)
public DatumPath clear()
public java.lang.Object clone()
clone
in class java.lang.Object
public boolean numbersLessThan(DatumPath other)
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |