Tabnine Logo
Token
Code IndexAdd Tabnine to your IDE (free)

How to use
Token
in
com.mdimension.jchronic.utils

Best Java code snippets using com.mdimension.jchronic.utils.Token (Showing top 20 results out of 315)

origin: samtingleff/jchronic

 public static ScalarDay scan(Token token, Token postToken, Options options) {
  if (ScalarDay.DAY_PATTERN.matcher(token.getWord()).matches()) {
   int scalarValue = Integer.parseInt(token.getWord());
   if (!(scalarValue > 31 || (postToken != null && Scalar.TIMES.contains(postToken.getWord())))) {
    return new ScalarDay(Integer.valueOf(scalarValue));
   }
  }
  return null;
 }
}
origin: samtingleff/jchronic

/**
 * Split the text on spaces and convert each word into
 * a Token
 */
protected static List<Token> baseTokenize(String text) {
 String[] words = text.split(" ");
 List<Token> tokens = new LinkedList<Token>();
 for (String word : words) {
  tokens.add(new Token(word));
 }
 return tokens;
}
origin: stackoverflow.com

 for( Token token: tokenList ){
  System.out.print( token.getWord() + ":" );
  for( RefCount refCount: token.getReferences() ){
    System.out.print( " " + refCount.getFileId() +
             "*" + refCount.getCount() );
  }
  System.out.println();
}
origin: samtingleff/jchronic

for (int i = 0; dayPortionIndex == -1 && i < tokenSize; i++) {
 Token t = tokens.get(i);
 if (t.getTag(RepeaterDayPortion.class) != null) {
  dayPortionIndex = i;
for (int i = 0; timeIndex == -1 && i < tokenSize; i++) {
 Token t = tokens.get(i);
 if (t.getTag(RepeaterTime.class) != null) {
  timeIndex = i;
 Tag<RepeaterDayPortion<?>> t1Tag = t1.getTag(RepeaterDayPortion.class);
   System.out.println("Chronic.dealiasAndDisambiguateTimes: morning->am");
  t1.untag(RepeaterDayPortion.class);
  t1.tag(new EnumRepeaterDayPortion(RepeaterDayPortion.DayPortion.AM));
   System.out.println("Chronic.dealiasAndDisambiguateTimes: " + t1TagType + "->pm");
  t1.untag(RepeaterDayPortion.class);
  t1.tag(new EnumRepeaterDayPortion(RepeaterDayPortion.DayPortion.PM));
   t1 = tokens.get(i + 1);
  if (t0.getTag(RepeaterTime.class) != null && t0.getTag(RepeaterTime.class).getType().isAmbiguous() && (t1 == null || t1.getTag(RepeaterDayPortion.class) == null)) {
   Token distoken = new Token("disambiguator");
   distoken.tag(new IntegerRepeaterDayPortion(Integer.valueOf(options.getAmbiguousTimeRange())));
   ttokens.add(distoken);
origin: samtingleff/jchronic

public static List<Repeater<?>> getRepeaters(List<Token> tokens) {
 List<Repeater<?>> repeaters = new LinkedList<Repeater<?>>();
 for (Token token : tokens) {
  Repeater<?> tag = token.getTag(Repeater.class);
  if (tag != null) {
   repeaters.add(tag);
  }
 }
 Collections.sort(repeaters);
 Collections.reverse(repeaters);
 return repeaters;
}
origin: samtingleff/jchronic

public static List<Token> scan(List<Token> tokens, Options options) {
 for (Token token : tokens) {
  Pointer t = Pointer.scanForAll(token, options);
  if (t != null) {
   token.tag(t);
  }
 }
 return tokens;
}
origin: samtingleff/jchronic

 /**
  * Return the Tag that matches the given class
  */
 @SuppressWarnings("unchecked")
 public <T extends Tag> T getTag(Class<T> tagClass) {
  List<T> matches = getTags(tagClass);
  T matchingTag = null;
  if (matches.size() > 0) {
   matchingTag = matches.get(0);
  }
//    if (matches.size() >= 2) {
//      throw new IllegalStateException("Multiple identical tags found (" + matches + ")");
//    }
//    else if (matches.size() == 1) {
//      matchingTag = matches.get(0);
//    }
  return matchingTag;
 }

origin: samtingleff/jchronic

if (token.isTagged()) {
 taggedTokens.add(token);
origin: samtingleff/jchronic

 public Span handle(List<Token> tokens, Options options) {
  return handle(tokens.get(0).getTag(RepeaterMonthName.class), tokens.get(1).getTag(ScalarDay.class), tokens.subList(2, tokens.size()), options);
 }
}
origin: samtingleff/jchronic

public static List<Token> scan(List<Token> tokens, Options options) {
 for (Token token : tokens) {
  TimeZone t = TimeZone.scanForAll(token, options);
  if (t != null) {
   token.tag(t);
  }
 }
 return tokens;
}
origin: samtingleff/jchronic

boolean optional = pattern.isOptional();
if (pattern instanceof TagPattern) {
 boolean match = (tokenIndex < tokens.size() && tokens.get(tokenIndex).getTags(((TagPattern) pattern).getTagClass()).size() > 0);
origin: samtingleff/jchronic

 public static ScalarMonth scan(Token token, Token postToken, Options options) {
  if (ScalarMonth.MONTH_PATTERN.matcher(token.getWord()).matches()) {
   int scalarValue = Integer.parseInt(token.getWord());
   if (!(scalarValue > 12 || (postToken != null && Scalar.TIMES.contains(postToken.getWord())))) {
    return new ScalarMonth(Integer.valueOf(scalarValue));
   }
  }
  return null;
 }
}
origin: samtingleff/jchronic

 public Span handle(List<Token> tokens, Options options) {
  return handle(tokens.get(0).getTag(RepeaterMonthName.class), tokens.get(1).getTag(OrdinalDay.class), tokens.subList(2, tokens.size()), options);
 }
}
origin: samtingleff/jchronic

public static List<Token> scan(List<Token> tokens, Options options) {
 for (Token token : tokens) {
  Grabber t = Grabber.scanForAll(token, options);
  if (t != null) {
   token.tag(t);
  }
 }
 return tokens;
}
origin: samtingleff/jchronic

public static Scalar scan(Token token, Token postToken, Options options) {
 if (Scalar.SCALAR_PATTERN.matcher(token.getWord()).matches()) {
  if (token.getWord() != null && token.getWord().length() > 0 && !(postToken != null && Scalar.TIMES.contains(postToken.getWord()))) {
   return new Scalar(Integer.valueOf(token.getWord()));
  }
 }
 else {
  Integer intStrValue = StringUtils.integerValue(token.getWord());
  if (intStrValue != null) {
   return new Scalar(intStrValue);
  }
 }
 return null;
}
origin: samtingleff/jchronic

public Span handle(List<Token> tokens, Span span, Options options) {
 int distance = tokens.get(0).getTag(Scalar.class).getType().intValue();
 Repeater<?> repeater = tokens.get(1).getTag(Repeater.class);
 Pointer.PointerType pointer = tokens.get(2).getTag(Pointer.class).getType();
 return repeater.getOffset(span, distance, pointer);
}
origin: samtingleff/jchronic

public static List<Token> scan(List<Token> tokens, Options options) {
 for (Token token : tokens) {
  Ordinal t;
  t = Ordinal.scan(token, options);
  if (t != null) {
   token.tag(t);
  }
  t = OrdinalDay.scan(token);
  if (t != null) {
   token.tag(t);
  }
 }
 return tokens;
}
origin: samtingleff/jchronic

public static Ordinal scan(Token token, Options options) {
 Matcher ordinalMatcher = ORDINAL_PATTERN.matcher(token.getWord());
 if (ordinalMatcher.find()) {
  return new Ordinal(Integer.valueOf(ordinalMatcher.group(1)));
 }
 return null;
}
origin: samtingleff/jchronic

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);
 }
 catch (IllegalArgumentException e) {
  if (options.isDebug()) {
   e.printStackTrace(System.out);
  }
  span = null;
 }
 return span;
}
origin: samtingleff/jchronic

public static List<Token> scan(List<Token> tokens, Options options) {
 for (Token token : tokens) {
  Separator t;
  t = SeparatorComma.scan(token, options);
  if (t != null) {
   token.tag(t);
  }
  t = SeparatorSlashOrDash.scan(token, options);
  if (t != null) {
   token.tag(t);
  }
  t = SeparatorAt.scan(token, options);
  if (t != null) {
   token.tag(t);
  }
  t = SeparatorIn.scan(token, options);
  if (t != null) {
   token.tag(t);
  }
 }
 return tokens;
}
com.mdimension.jchronic.utilsToken

Most used methods

  • getWord
  • <init>
  • getReferences
  • getTag
    Return the Tag that matches the given class
  • getTags
    Return the Tag that matches the given class
  • isTagged
    Return true if this token has any tags
  • tag
    Tag this token with the specified tag
  • untag
    Remove all tags of the given class

Popular in Java

  • Making http requests using okhttp
  • scheduleAtFixedRate (Timer)
  • getSystemService (Context)
  • setRequestProperty (URLConnection)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Top 25 Plugins for Webstorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now