return new ResultImpl(theMessage, loopPoints.toArray(new String[0]), loopPointNames, fieldPaths.toArray(new String[0]), names,
private String[] composeLoopPoints() { String[] result = new String[myLoopPoints.length]; for (int i = 0; i < myLoopPoints.length; i++) { result[i] = myLoopPoints[i].replaceAll("\\*\\d*", String.valueOf(myIndices[i])); int ref = getLoopPointReference(myLoopPoints[i]); if (ref >= i) { throw new IllegalStateException( "Loop point must be defined after the " + "one it references: " + myLoopPoints[i]); } else if (ref >= 0) { result[i] = expandLoopPointReference(result[i], result[ref]); } } return result; }
/** * @see ca.uhn.hl7v2.util.MessageQuery.Result#get(java.lang.String) */ public String get(String theFieldName) { Integer fieldNum = myFieldNames.get(theFieldName); if (fieldNum == null) { throw new IllegalArgumentException( "Field name not recognized: " + theFieldName); } return get(fieldNum); }
return new ResultImpl(theMessage, loopPoints.toArray(new String[0]), loopPointNames, fieldPaths.toArray(new String[0]), names,
if (myNonLoopingQuery) { myNonLoopingQuery = false; myValues = getCurrentValues(myFieldPaths); myWhereValues = getCurrentValues(myWherePaths); return currentRowMatchesFilter(); while (!gotMatch && myNumEmpty[i] <= myMaxNumEmpty[i]) { myIndices[i]++; myValues = getCurrentValues(myFieldPaths); myWhereValues = getCurrentValues(myWherePaths); if (!currentRowValued(i)) { myNumEmpty[i]++; } else { myNumEmpty[i] = 0; if (currentRowMatchesFilter()) { gotMatch = true;
if (myNonLoopingQuery) { myNonLoopingQuery = false; myValues = getCurrentValues(myFieldPaths); myWhereValues = getCurrentValues(myWherePaths); return currentRowMatchesFilter(); while (!gotMatch && myNumEmpty[i] <= myMaxNumEmpty[i]) { myIndices[i]++; myValues = getCurrentValues(myFieldPaths); myWhereValues = getCurrentValues(myWherePaths); if (!currentRowValued(i)) { myNumEmpty[i]++; } else { myNumEmpty[i] = 0; if (currentRowMatchesFilter()) { gotMatch = true;
public ResultImpl(Message theMessage, String[] theLoopPoints, Map<String, Integer> theLoopPointNames, String[] theFieldPaths, Map<String, Integer> theFieldNames, String[] theWherePaths, String[] theWherePatterns, boolean[] theExactMatchFlags) { myTerser = new Terser(theMessage); myLoopPoints = theLoopPoints; myIndices = new int[theLoopPoints.length]; myNumEmpty = new int[theLoopPoints.length]; myMaxNumEmpty = getMaxNumEmpty(theLoopPoints); myLoopPointNames = theLoopPointNames; myFieldPaths = theFieldPaths; myValues = new String[theFieldPaths.length]; myFieldNames = theFieldNames; myWherePaths = theWherePaths; myWherePatterns = theWherePatterns; myExactMatchFlags = theExactMatchFlags; if (theLoopPoints.length == 0) { myNonLoopingQuery = true; // if no loops, give ourselves 1 // iteration } else { myIndices[myIndices.length - 1] = -1; // start before 1st // iteration } }
public ResultImpl(Message theMessage, String[] theLoopPoints, Map<String, Integer> theLoopPointNames, String[] theFieldPaths, Map<String, Integer> theFieldNames, String[] theWherePaths, String[] theWherePatterns, boolean[] theExactMatchFlags) { myTerser = new Terser(theMessage); myLoopPoints = theLoopPoints; myIndices = new int[theLoopPoints.length]; myNumEmpty = new int[theLoopPoints.length]; myMaxNumEmpty = getMaxNumEmpty(theLoopPoints); myLoopPointNames = theLoopPointNames; myFieldPaths = theFieldPaths; myValues = new String[theFieldPaths.length]; myFieldNames = theFieldNames; myWherePaths = theWherePaths; myWherePatterns = theWherePatterns; myExactMatchFlags = theExactMatchFlags; if (theLoopPoints.length == 0) { myNonLoopingQuery = true; // if no loops, give ourselves 1 // iteration } else { myIndices[myIndices.length - 1] = -1; // start before 1st // iteration } }
private String[] composeLoopPoints() { String[] result = new String[myLoopPoints.length]; for (int i = 0; i < myLoopPoints.length; i++) { result[i] = myLoopPoints[i].replaceAll("\\*\\d*", String.valueOf(myIndices[i])); int ref = getLoopPointReference(myLoopPoints[i]); if (ref >= i) { throw new IllegalStateException( "Loop point must be defined after the " + "one it references: " + myLoopPoints[i]); } else if (ref >= 0) { result[i] = expandLoopPointReference(result[i], result[ref]); } } return result; }
private String[] getCurrentValues(String[] thePaths) throws HL7Exception { String[] paths = composePaths(thePaths); String[] values = new String[paths.length]; for (int i = 0; i < paths.length; i++) { values[i] = myTerser.get(paths[i]); if (values[i] == null) { values[i] = ""; } } return values; }
private int[] getMaxNumEmpty(String[] theLoopPoints) { int[] retVal = new int[theLoopPoints.length]; for (int i = 0; i < theLoopPoints.length; i++) { retVal[i] = getMaxNumEmpty(theLoopPoints[i]); } return retVal; }
private String[] composePaths(String[] thePaths) { String[] currentLoopPoints = composeLoopPoints(); String[] result = new String[thePaths.length]; for (int i = 0; i < thePaths.length; i++) { result[i] = thePaths[i]; int ref = getLoopPointReference(thePaths[i]); if (ref >= 0) { result[i] = expandLoopPointReference(result[i], currentLoopPoints[ref]); } } return result; }
private String[] composePaths(String[] thePaths) { String[] currentLoopPoints = composeLoopPoints(); String[] result = new String[thePaths.length]; for (int i = 0; i < thePaths.length; i++) { result[i] = thePaths[i]; int ref = getLoopPointReference(thePaths[i]); if (ref >= 0) { result[i] = expandLoopPointReference(result[i], currentLoopPoints[ref]); } } return result; }
private boolean referencesLoop(String theFieldPath, int theLoopPoint) { String path = theFieldPath; int lp; while ((lp = getLoopPointReference(path)) >= 0) { if (lp == theLoopPoint) { return true; } else { path = myLoopPoints[lp]; } } return false; }
private boolean referencesLoop(String theFieldPath, int theLoopPoint) { String path = theFieldPath; int lp; while ((lp = getLoopPointReference(path)) >= 0) { if (lp == theLoopPoint) { return true; } else { path = myLoopPoints[lp]; } } return false; }
private int[] getMaxNumEmpty(String[] theLoopPoints) { int[] retVal = new int[theLoopPoints.length]; for (int i = 0; i < theLoopPoints.length; i++) { retVal[i] = getMaxNumEmpty(theLoopPoints[i]); } return retVal; }
private String[] getCurrentValues(String[] thePaths) throws HL7Exception { String[] paths = composePaths(thePaths); String[] values = new String[paths.length]; for (int i = 0; i < paths.length; i++) { values[i] = myTerser.get(paths[i]); if (values[i] == null) { values[i] = ""; } } return values; }
/** * @see ca.uhn.hl7v2.util.MessageQuery.Result#get(java.lang.String) */ public String get(String theFieldName) { Integer fieldNum = myFieldNames.get(theFieldName); if (fieldNum == null) { throw new IllegalArgumentException( "Field name not recognized: " + theFieldName); } return get(fieldNum); }