Package org.sindice.siren.util

Examples of org.sindice.siren.util.ReusableCharArrayReader


        final Number lowerNumber;
        try {
          if (lowerText.length == 0) { // open bound
            lowerNumber = null;
          } else {
            final ReusableCharArrayReader lowerReader = new ReusableCharArrayReader(lowerText);
            lowerNumber = parser.parse(lowerReader);
          }
        } catch (final Exception e) {
          throw new QueryNodeParseException(new MessageImpl(QueryParserMessages.COULD_NOT_PARSE_NUMBER,
            lowerText, parser.getNumericType() + " parser"), e);
        }
        final Number upperNumber;
        try {
          if (upperText.length == 0) { // open bound
            upperNumber = null;
          } else {
            final ReusableCharArrayReader upperReader = new ReusableCharArrayReader(upperText);
            upperNumber = parser.parse(upperReader);
          }
        } catch (final Exception e) {
          throw new QueryNodeParseException(new MessageImpl(QueryParserMessages.COULD_NOT_PARSE_NUMBER,
            upperText, parser.getNumericType() + " parser"), e);
View Full Code Here


      final Analyzer analyzer = dts.get(node.getTag(DatatypeQueryNode.DATATYPE_TAGID));

      if (analyzer instanceof NumericAnalyzer) {
        final NumericAnalyzer na = (NumericAnalyzer) analyzer;
        final char[] text = fieldNode.getTextAsString().toCharArray();
        final ReusableCharArrayReader textReader = new ReusableCharArrayReader(text);
        final Number number;
        try {
          number = na.getNumericParser().parse(textReader);
        } catch (final Exception e) {
          throw new QueryNodeParseException(new MessageImpl(QueryParserMessages.COULD_NOT_PARSE_NUMBER, text), e);
View Full Code Here

            + "]. Use the #register method.");
        }

        final Analyzer analyzer = dtsAnalyzer.get(dt);
        if (reusableCharArray == null) {
          reusableCharArray = new ReusableCharArrayReader(termAtt.buffer(), 0, termAtt.length());
        } else {
          reusableCharArray.reset(termAtt.buffer(), 0, termAtt.length());
        }
        currentStream = analyzer.tokenStream("", reusableCharArray);
        currentStream.reset(); // reset to prepare the stream for consumption
View Full Code Here

  public void testParser() throws IOException {
    final DateNumericAnalyzer analyzer = new DateNumericAnalyzer(8);
    final NumericParser parser = analyzer.getNumericParser();
    assertEquals(NumericType.LONG, parser.getNumericType());
    assertEquals(64, parser.getValueSize());
    final ReusableCharArrayReader input = new ReusableCharArrayReader("2012-09-21T00:00:00Z".toCharArray());
    assertEquals(1348185600000l, parser.parseAndConvert(input));
  }
View Full Code Here

TOP

Related Classes of org.sindice.siren.util.ReusableCharArrayReader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.