Top Description Inners Fields Constructors Methods
org.jruby.util

public Class StrptimeParser

extends Object
Class Inheritance
Imports
java.io.IOException, .Reader, .StringReader, java.math.BigInteger, java.util.EnumSet, .LinkedList, .List, .Arrays, java.util.regex.Matcher, .Pattern, org.jruby.lexer.StrptimeLexer

This is Java implementation of ext/date/date_strptime.c in Ruby 2.3.1. see https://github.com/ruby/ruby/blob/394fa89c67722d35bdda89f10c7de5c304a5efb1/ext/date/date_strptime.c

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
StrptimeParser.FormatBag

Ported Date::Format::Bag from lib/ruby/stdlib/date/format.rb in JRuby 9.1.5.0.

private static class

Field Summary

Modifier and TypeField and Description
private static final String[]
private static final String[]
private static final String[]

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private void
addToPattern(final List<StrptimeToken> compiledPattern, final String str)

Ported from RubyDateFormatter#addToPattern in JRuby 9.1.5.0.

public List<StrptimeToken>
compilePattern(final String pattern)

Ported from RubyDateFormatter#compilePattern in JRuby 9.1.5.0.

public StrptimeParser.FormatBag
parse(final List<StrptimeToken> compiledPattern, final String text)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DAY_NAMESback to summary
private static final String[] DAY_NAMES
MERID_NAMESback to summary
private static final String[] MERID_NAMES
MONTH_NAMESback to summary
private static final String[] MONTH_NAMES

Constructor Detail

StrptimeParserback to summary
public StrptimeParser()

Method Detail

addToPatternback to summary
private void addToPattern(final List<StrptimeToken> compiledPattern, final String str)

Ported from RubyDateFormatter#addToPattern in JRuby 9.1.5.0. see https://github.com/jruby/jruby/blob/036ce39f0476d4bd718e23e64caff36bb50b8dbc/core/src/main/java/org/jruby/util/RubyDateFormatter.java

compilePatternback to summary
public List<StrptimeToken> compilePattern(final String pattern)

Ported from RubyDateFormatter#compilePattern in JRuby 9.1.5.0. see https://github.com/jruby/jruby/blob/036ce39f0476d4bd718e23e64caff36bb50b8dbc/core/src/main/java/org/jruby/util/RubyDateFormatter.java

parseback to summary
public StrptimeParser.FormatBag parse(final List<StrptimeToken> compiledPattern, final String text)
org.jruby.util back to summary

public Class StrptimeParser.FormatBag

extends Object
Class Inheritance

Ported Date::Format::Bag from lib/ruby/stdlib/date/format.rb in JRuby 9.1.5.0. see https://github.com/jruby/jruby/blob/036ce39f0476d4bd718e23e64caff36bb50b8dbc/lib/ruby/stdlib/date/format.rb

Field Summary

Modifier and TypeField and Description
private long
private int
private int
private long
private int
private String
private int
private int
private int
private int
private int
private Number
private int
private Number
private int
private int
private int
private int
private int
private long
private String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public long
public int
public int
public long
public int
public String
public int
public int
public int
public int
public int
public Number
public int
public Number
public int
public int
public int
public int
public int
public long
public String
public static boolean
has(int v)

public static boolean
has(long v)

public static boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

centback to summary
private long cent
cWDayback to summary
private int cWDay
cWeekback to summary
private int cWeek
cWYearback to summary
private long cWYear
hourback to summary
private int hour
leftoverback to summary
private String leftover
mDayback to summary
private int mDay
meridback to summary
private int merid
minback to summary
private int min
monback to summary
private int mon
secback to summary
private int sec
secFractionback to summary
private Number secFraction
secFractionSizeback to summary
private int secFractionSize
secondsback to summary
private Number seconds
secondsSizeback to summary
private int secondsSize
wDayback to summary
private int wDay
wNum0back to summary
private int wNum0
wNum1back to summary
private int wNum1
yDayback to summary
private int yDay
yearback to summary
private long year
zoneback to summary
private String zone

Constructor Detail

FormatBagback to summary
public FormatBag()

Method Detail

getCentback to summary
public long getCent()
getCWDayback to summary
public int getCWDay()
getCWeekback to summary
public int getCWeek()
getCWYearback to summary
public long getCWYear()
getHourback to summary
public int getHour()
getLeftoverback to summary
public String getLeftover()
getMDayback to summary
public int getMDay()
getMeridback to summary
public int getMerid()
getMinback to summary
public int getMin()
getMonback to summary
public int getMon()
getSecback to summary
public int getSec()
getSecFractionback to summary
public Number getSecFraction()
getSecFractionSizeback to summary
public int getSecFractionSize()
getSecondsback to summary
public Number getSeconds()
getSecondsSizeback to summary
public int getSecondsSize()
getWDayback to summary
public int getWDay()
getWNum0back to summary
public int getWNum0()
getWNum1back to summary
public int getWNum1()
getYDayback to summary
public int getYDay()
getYearback to summary
public long getYear()
getZoneback to summary
public String getZone()
hasback to summary
public static boolean has(int v)
hasback to summary
public static boolean has(long v)
hasback to summary
public static boolean has(Number v)
org.jruby.util back to summary

private Class StrptimeParser.StringParser

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final StrptimeParser.FormatBag
private boolean
private static final EnumSet<StrptimeFormat>
private int
private final String
private static final Pattern

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private int
findIndexInPatterns(final String[] patterns)

Returns -1 if text doesn't match with patterns.

private static boolean
isBlank(String text, int pos)

private static boolean
isDigit(char c)

private static boolean
isEndOfText(String text, int pos)

private static boolean
isMinus(String text, int pos)

private static boolean
isNumberPattern(final List<StrptimeToken> compiledPattern, final int i)

Ports num_pattern_p from ext/date/date_strptime.c in MRI 2.3.1 under BSDL.

private static boolean
isSign(String text, int pos)

private static boolean
isSpace(char c)

private static Number
private StrptimeParser.FormatBag
parse(final List<StrptimeToken> compiledPattern)

private long
readDigits(final int len)

Ports read_digits from ext/date/date_strptime.c in MRI 2.3.1 under BSDL.

private Number

Returns:

integer value (Long or BigInteger)
readDigitsMax
()

Ports READ_DIGITS_MAX from ext/date/date_strptime.c in MRI 2.3.1 under BSDL.

private long
private static int
toInt(char c)

private static boolean
validRange(long v, int lower, int upper)

Ports valid_pattern_p in ext/date/date_strptime.c in MRI 2.3.1 under BSDL.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bagback to summary
private final StrptimeParser.FormatBag bag
failback to summary
private boolean fail
NUMBER_PATTERNSback to summary
private static final EnumSet<StrptimeFormat> NUMBER_PATTERNS
posback to summary
private int pos
textback to summary
private final String text
ZONE_PARSE_REGEXback to summary
private static final Pattern ZONE_PARSE_REGEX

Constructor Detail

StringParserback to summary
private StringParser(String text)

Method Detail

findIndexInPatternsback to summary
private int findIndexInPatterns(final String[] patterns)

Returns -1 if text doesn't match with patterns.

isBlankback to summary
private static boolean isBlank(String text, int pos)
isDigitback to summary
private static boolean isDigit(char c)
isEndOfTextback to summary
private static boolean isEndOfText(String text, int pos)
isMinusback to summary
private static boolean isMinus(String text, int pos)
isNumberPatternback to summary
private static boolean isNumberPattern(final List<StrptimeToken> compiledPattern, final int i)

Ports num_pattern_p from ext/date/date_strptime.c in MRI 2.3.1 under BSDL. see https://github.com/ruby/ruby/blob/394fa89c67722d35bdda89f10c7de5c304a5efb1/ext/date/date_strftime.c

isSignback to summary
private static boolean isSign(String text, int pos)
isSpaceback to summary
private static boolean isSpace(char c)
negateIntegerback to summary
private static Number negateInteger(final Number i)
parseback to summary
private StrptimeParser.FormatBag parse(final List<StrptimeToken> compiledPattern)
readDigitsback to summary
private long readDigits(final int len)

Ports read_digits from ext/date/date_strptime.c in MRI 2.3.1 under BSDL. see https://github.com/ruby/ruby/blob/394fa89c67722d35bdda89f10c7de5c304a5efb1/ext/date/date_strftime.c

readDigitsMaxback to summary
private Number readDigitsMax()

Ports READ_DIGITS_MAX from ext/date/date_strptime.c in MRI 2.3.1 under BSDL. see https://github.com/ruby/ruby/blob/394fa89c67722d35bdda89f10c7de5c304a5efb1/ext/date/date_strftime.c

Returns:Number

integer value (Long or BigInteger)

readDigitsMaxLongback to summary
private long readDigitsMaxLong()
toIntback to summary
private static int toInt(char c)
validRangeback to summary
private static boolean validRange(long v, int lower, int upper)

Ports valid_pattern_p in ext/date/date_strptime.c in MRI 2.3.1 under BSDL. see https://github.com/ruby/ruby/blob/394fa89c67722d35bdda89f10c7de5c304a5efb1/ext/date/date_strftime.c