Package com.mdimension.jchronic

Examples of com.mdimension.jchronic.Options


    public long parseDateShorthand(String d) {
  Calendar now = Calendar.getInstance();
  long l=now.getTimeInMillis();
  d=d.trim();
  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
View Full Code Here


   
    private Options options;
   
    public ChronicFunction(String text) {
        this.dateText = text;
        this.options = new Options();
    }
View Full Code Here

  long l=now.getTimeInMillis();
  d=d.trim();
  if (d.compareToIgnoreCase("now")==0) {
      // do nothing because it is default to now.
  } 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
View Full Code Here

    }
    else {
      throw new IllegalArgumentException("Invalid repeater: " + repeater);
    }
    */
    Span span = Chronic.parse("this second", new Options(options.getNow(), false));
    return handle(tokens, span, options);
  }
View Full Code Here

  public Repeater(T type) {
    super(type);
  }

  public static List<Token> scan(List<Token> tokens) {
    return Repeater.scan(tokens, new Options());
  }
View Full Code Here

public class ChronicFunctionTest {
   
    @Test
    public void testChronic() {
        ChronicFunction chronicFunction = new ChronicFunction("yesterday", new Options(Time.construct(2011, 10, 31, 14, 0, 0, 0)));
        Assert.assertEquals(Time.construct(2011, 10, 30, 12).getTime(), ((Calendar) chronicFunction.generateValue()).getTime());
    }
View Full Code Here

   
    private Options options;
   
    public ChronicFunction(String text) {
        this.dateText = text;
        this.options = new Options();
    }
View Full Code Here

TOP

Related Classes of com.mdimension.jchronic.Options

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.