@Override public boolean operateStringString(UTF8StringPointable stringp1, UTF8StringPointable stringp2) throws SystemException, IOException { return (stringp1.compareTo(stringp2) == 0); }
@Override public boolean operateNotationNotation(UTF8StringPointable stringp1, UTF8StringPointable stringp2) throws SystemException, IOException { return (stringp1.compareTo(stringp2) == 0); }
@Override public boolean operateAnyURIAnyURI(UTF8StringPointable stringp1, UTF8StringPointable stringp2) throws SystemException, IOException { return (stringp1.compareTo(stringp2) == -1); }
@Override public boolean operateStringString(UTF8StringPointable stringp1, UTF8StringPointable stringp2) throws SystemException, IOException { return (stringp1.compareTo(stringp2) == -1); }
@Override public boolean operateAnyURIAnyURI(UTF8StringPointable stringp1, UTF8StringPointable stringp2) throws SystemException, IOException { return (stringp1.compareTo(stringp2) == 0); }
/** * Parses string as double * @param textPtr input string * @param result placeholder for the result * @return {@code true} if parsing was successful, {@code false} otherwise */ public static boolean parseDouble(UTF8StringPointable textPtr, AMutableDouble result) { double v; if (POSITIVE_INF.compareTo(textPtr) == 0) { v = Double.POSITIVE_INFINITY; } else if (NEGATIVE_INF.compareTo(textPtr) == 0) { v = Double.NEGATIVE_INFINITY; } else if (NAN.compareTo(textPtr) == 0) { v = Double.NaN; } else { try { v = Double.parseDouble(textPtr.toString()); } catch (NumberFormatException e) { return false; } } result.setValue(v); return true; }
/** * Replaces the appearances of a regular expression defined pattern in a source string with a given * replacement string. * * @param replaceStrPtr * , the string for replacing the regular expression. * @param replaceLimit * , the maximum number of replacements to make * @return a new string with contained regular expressions replaced. */ public String replace(UTF8StringPointable replaceStrPtr, int replaceLimit) { if (replaceLimit < 0) { replaceLimit = Integer.MAX_VALUE; } // Sets up a new replacement string if necessary. final boolean newReplace = replaceStrPtr != null && (replaceStr == null || lastReplaceStrPtr.compareTo(replaceStrPtr) != 0); if (newReplace) { StringEvaluatorUtils.copyResetUTF8Pointable(replaceStrPtr, lastReplaceStorage, lastReplaceStrPtr); replaceStr = replaceStrPtr.toString(); } // Does the actual replacement. resultBuf.setLength(0); for (int i = 0; i < replaceLimit && matcher.find(); i++) { matcher.appendReplacement(resultBuf, replaceStr); } matcher.appendTail(resultBuf); return resultBuf.toString(); } }
@Override public int compareTo(IPointable pointer) { return compareTo(pointer.getByteArray(), pointer.getStartOffset(), pointer.getLength()); }
/** * Builds the charset from a pattern string. * * @param patternPtr * , a pattern string. */ public void build(UTF8StringPointable patternPtr) { final boolean newPattern = charSet == null || lastPatternPtr.compareTo(patternPtr) != 0; if (newPattern) { StringEvaluatorUtils.copyResetUTF8Pointable(patternPtr, lastPatternStorage, lastPatternPtr); charSet = CharSet.getInstance(patternPtr.toString()); } }
@Override public boolean accept(NodeTreePointable ntp, TaggedValuePointable tvp) { if (tvp.getTag() != ValueTag.ATTRIBUTE_NODE_TAG) { return false; } tvp.getValue(anp); anp.getName(cqp); if (urip != null) { ntp.getString(cqp.getNamespaceCode(), temp); if (urip.compareTo(temp) != 0) { return false; } } if (localp != null) { ntp.getString(cqp.getLocalCode(), temp); if (localp.compareTo(temp) != 0) { return false; } } return true; } };
IRegExpPatternGenerator patternGenerator) { final boolean newPattern = patternPtr != null && (pattern == null || lastPatternPtr.compareTo(patternPtr) != 0); final boolean newFlag = flagPtr != null && (pattern == null || lastFlagPtr.compareTo(flagPtr) != 0); if (newPattern) { StringEvaluatorUtils.copyResetUTF8Pointable(patternPtr, lastPatternStorage, lastPatternPtr);
@Override public boolean accept(NodeTreePointable ntp, TaggedValuePointable tvp) { if (tvp.getTag() != ValueTag.ELEMENT_NODE_TAG) { return false; } tvp.getValue(enp); enp.getName(cqp); if (urip != null) { ntp.getString(cqp.getNamespaceCode(), temp); if (urip.compareTo(temp) != 0) { return false; } } if (localp != null) { ntp.getString(cqp.getLocalCode(), temp); if (localp.compareTo(temp) != 0) { return false; } } return true; } };
pinp.getTarget(ntp, utf8sp); byte[] target = pit.getTarget(); return utf8sp.compareTo(target, 0, target.length) == 0;
if (stringp1.compareTo(stringp2) == 0) { booleanResult[1] = 1;