Package com.mdimension.jchronic.utils

Examples of com.mdimension.jchronic.utils.Span


  if (d.compareToIgnoreCase("now")!=0) {
      Options options= new Options(false);
      options.setCompatibilityMode(true);
      options.setNow(now);
      try {
    Span span = Chronic.parse(d, options);
    l = span.getBegin()*1000;
      } catch (Exception e) {
    // exception when parsing
    log.error("parse error for: "+d);   
      }
  }
View Full Code Here


      AnnotationIndex<Annotation> annoIndex = jCas.getAnnotationIndex();
      FSIterator<Annotation> iter = annoIndex.iterator();
      while (iter.hasNext()) {
        Annotation anno = iter.next();
        try {
          Span span = Chronic.parse(anno.getCoveredText());
          if (span != null && span.getBeginCalendar() != null) {
            Date date = new Date(jCas);
            date.setBegin(anno.getBegin());
            date.setEnd(anno.getEnd());
            date.setDate(tlDateFormat.get().format(
                span.getBeginCalendar().getTime()));
            date.addToIndexes();
          }
        } catch (Exception e) {
          if (log.isDebugEnabled())
            log.debug(
View Full Code Here

   
   
    @SuppressWarnings("unchecked")
    @Override
    public <T> T generateValue() {
        Span span = Chronic.parse(dateText, options);
        return (T) (span != null ? span.getBeginCalendar() : null);
    }
View Full Code Here

  } else {
      Options options= new Options(false);
      options.setCompatibilityMode(true);
      options.setNow(now);
      try {
    Span span = Chronic.parse(d, options);
    l = span.getBegin()*1000;
      } catch (Exception e) {
    // exception when parsing
    log.error("parse error for: "+d);   
      }
  }
View Full Code Here

import com.mdimension.jchronic.utils.Token;

public class ORSRHandler extends ORRHandler {

  public Span handle(List<Token> tokens, Options options) {
    Span outerSpan = Handler.getAnchor(tokens.subList(3, 4), options);
    return handle(tokens.subList(0, 2), outerSpan, options);
  }
View Full Code Here

  public Span handle(List<Token> tokens, Options options) {
    int month = tokens.get(0).getTag(ScalarMonth.class).getType().intValue();
    int day = tokens.get(1).getTag(ScalarDay.class).getType().intValue();
    Calendar start = Time.construct(options.getNow().get(Calendar.YEAR), month, day);
    Calendar end = Time.cloneAndAdd(start, Calendar.DAY_OF_MONTH, 1);
    return new Span(start, end);
  }
View Full Code Here

    if (options.isDebug()) {
      System.out.println("Chronic.parse: " + tokens);
    }

    Span span = Handler.tokensToSpan(tokens, options);

    // guess a time within a span if required
    if (options.isGuess()) {
      span = guess(span);
    }
View Full Code Here

      guessValue = span.getBegin() + (span.getWidth() / 2);
    }
    else {
      guessValue = span.getBegin();
    }
    Span guess = new Span(guessValue, guessValue);
    return guess;
  }
View Full Code Here

  public Span handle(List<Token> tokens, Options options) {
    int month = tokens.get(0).getTag(ScalarMonth.class).getType().intValue();
    int day = tokens.get(1).getTag(ScalarDay.class).getType().intValue();
    int year = tokens.get(2).getTag(ScalarYear.class).getType().intValue();

    Span span;
    try {
      List<Token> timeTokens = tokens.subList(3, tokens.size());
      Calendar dayStart = Time.construct(year, month, day);
      span = Handler.dayOrTime(dayStart, timeTokens, options);
    }
View Full Code Here

import com.mdimension.jchronic.utils.Token;

public class ORGRHandler extends ORRHandler {

  public Span handle(List<Token> tokens, Options options) {
    Span outerSpan = Handler.getAnchor(tokens.subList(2, 4), options);
    return handle(tokens.subList(0, 2), outerSpan, options);
  }
View Full Code Here

TOP

Related Classes of com.mdimension.jchronic.utils.Span

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.