id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
106,700
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/parse/PluralRulePrinter.java
PluralRulePrinter.print
public static String print(Node<PluralType> node) { StringBuilder buf = new StringBuilder(); print(buf, node); return buf.toString(); }
java
public static String print(Node<PluralType> node) { StringBuilder buf = new StringBuilder(); print(buf, node); return buf.toString(); }
[ "public", "static", "String", "print", "(", "Node", "<", "PluralType", ">", "node", ")", "{", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", ")", ";", "print", "(", "buf", ",", "node", ")", ";", "return", "buf", ".", "toString", "(", ")", ...
Return a recursive representation of the given pluralization node or tree.
[ "Return", "a", "recursive", "representation", "of", "the", "given", "pluralization", "node", "or", "tree", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/parse/PluralRulePrinter.java#L17-L21
106,701
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/parse/PluralRulePrinter.java
PluralRulePrinter.print
private static void print(StringBuilder buf, Node<PluralType> node) { switch (node.type()) { case RULE: join(buf, node, " "); break; case AND_CONDITION: join(buf, node, " and "); break; case OR_CONDITION: join(buf, node, " or "); break; case...
java
private static void print(StringBuilder buf, Node<PluralType> node) { switch (node.type()) { case RULE: join(buf, node, " "); break; case AND_CONDITION: join(buf, node, " and "); break; case OR_CONDITION: join(buf, node, " or "); break; case...
[ "private", "static", "void", "print", "(", "StringBuilder", "buf", ",", "Node", "<", "PluralType", ">", "node", ")", "{", "switch", "(", "node", ".", "type", "(", ")", ")", "{", "case", "RULE", ":", "join", "(", "buf", ",", "node", ",", "\" \"", ")...
Recursively visit the structs and atoms in the pluralization node or tree, appending the representations to a string buffer.
[ "Recursively", "visit", "the", "structs", "and", "atoms", "in", "the", "pluralization", "node", "or", "tree", "appending", "the", "representations", "to", "a", "string", "buffer", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/parse/PluralRulePrinter.java#L27-L64
106,702
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/parse/PluralRulePrinter.java
PluralRulePrinter.join
private static void join(StringBuilder buf, Node<PluralType> parent, String delimiter) { List<Node<PluralType>> nodes = parent.asStruct().nodes(); int size = nodes.size(); for (int i = 0; i < size; i++) { if (i > 0) { buf.append(delimiter); } print(buf, nodes.get(i)); } }
java
private static void join(StringBuilder buf, Node<PluralType> parent, String delimiter) { List<Node<PluralType>> nodes = parent.asStruct().nodes(); int size = nodes.size(); for (int i = 0; i < size; i++) { if (i > 0) { buf.append(delimiter); } print(buf, nodes.get(i)); } }
[ "private", "static", "void", "join", "(", "StringBuilder", "buf", ",", "Node", "<", "PluralType", ">", "parent", ",", "String", "delimiter", ")", "{", "List", "<", "Node", "<", "PluralType", ">>", "nodes", "=", "parent", ".", "asStruct", "(", ")", ".", ...
Print each child node of a struct, joining them together with a delimiter string.
[ "Print", "each", "child", "node", "of", "a", "struct", "joining", "them", "together", "with", "a", "delimiter", "string", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/parse/PluralRulePrinter.java#L70-L79
106,703
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java
CalendarFormatterBase.format
@Override public void format(ZonedDateTime datetime, CalendarFormatOptions options, StringBuilder buffer) { String dateSkeleton = options.dateSkeleton() == null ? null : options.dateSkeleton().skeleton(); String timeSkeleton = options.timeSkeleton() == null ? null : options.timeSkeleton().skeleton(); Cal...
java
@Override public void format(ZonedDateTime datetime, CalendarFormatOptions options, StringBuilder buffer) { String dateSkeleton = options.dateSkeleton() == null ? null : options.dateSkeleton().skeleton(); String timeSkeleton = options.timeSkeleton() == null ? null : options.timeSkeleton().skeleton(); Cal...
[ "@", "Override", "public", "void", "format", "(", "ZonedDateTime", "datetime", ",", "CalendarFormatOptions", "options", ",", "StringBuilder", "buffer", ")", "{", "String", "dateSkeleton", "=", "options", ".", "dateSkeleton", "(", ")", "==", "null", "?", "null", ...
Main entry point for date time formatting.
[ "Main", "entry", "point", "for", "date", "time", "formatting", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java#L137-L175
106,704
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java
CalendarFormatterBase.format
@Override public void format( ZonedDateTime start, ZonedDateTime end, DateTimeIntervalSkeleton skeleton, StringBuilder buffer) { DateTimeField field = CalendarFormattingUtils.greatestDifference(start, end); if (skeleton == null) { switch (field) { case YEAR: case MONTH: ...
java
@Override public void format( ZonedDateTime start, ZonedDateTime end, DateTimeIntervalSkeleton skeleton, StringBuilder buffer) { DateTimeField field = CalendarFormattingUtils.greatestDifference(start, end); if (skeleton == null) { switch (field) { case YEAR: case MONTH: ...
[ "@", "Override", "public", "void", "format", "(", "ZonedDateTime", "start", ",", "ZonedDateTime", "end", ",", "DateTimeIntervalSkeleton", "skeleton", ",", "StringBuilder", "buffer", ")", "{", "DateTimeField", "field", "=", "CalendarFormattingUtils", ".", "greatestDiff...
Format a date time interval, guessing at the best skeleton to use based on the field of greatest difference between the start and end date-time. If the end date-time has a different time zone than the start, this is corrected for comparison. If the skeleton is null, one is selected automatically using the field of gre...
[ "Format", "a", "date", "time", "interval", "guessing", "at", "the", "best", "skeleton", "to", "use", "based", "on", "the", "field", "of", "greatest", "difference", "between", "the", "start", "and", "end", "date", "-", "time", ".", "If", "the", "end", "da...
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java#L187-L206
106,705
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java
CalendarFormatterBase.resolveTimeZoneId
public String resolveTimeZoneId(String zoneId) { String alias = _CalendarUtils.getTimeZoneAlias(zoneId); if (alias != null) { zoneId = alias; } alias = TimeZoneAliases.getAlias(zoneId); if (alias != null) { zoneId = alias; } return zoneId; }
java
public String resolveTimeZoneId(String zoneId) { String alias = _CalendarUtils.getTimeZoneAlias(zoneId); if (alias != null) { zoneId = alias; } alias = TimeZoneAliases.getAlias(zoneId); if (alias != null) { zoneId = alias; } return zoneId; }
[ "public", "String", "resolveTimeZoneId", "(", "String", "zoneId", ")", "{", "String", "alias", "=", "_CalendarUtils", ".", "getTimeZoneAlias", "(", "zoneId", ")", ";", "if", "(", "alias", "!=", "null", ")", "{", "zoneId", "=", "alias", ";", "}", "alias", ...
Check if the zoneId has an alias in the CLDR data.
[ "Check", "if", "the", "zoneId", "has", "an", "alias", "in", "the", "CLDR", "data", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java#L219-L229
106,706
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java
CalendarFormatterBase.formatField
public void formatField(ZonedDateTime datetime, String pattern, StringBuilder buffer) { int length = pattern.length(); if (length == 0) { return; } // Current position in pattern int i = 0; // Skip over prefix indicating we want to format a single field. if (pattern.charAt(i) == '+')...
java
public void formatField(ZonedDateTime datetime, String pattern, StringBuilder buffer) { int length = pattern.length(); if (length == 0) { return; } // Current position in pattern int i = 0; // Skip over prefix indicating we want to format a single field. if (pattern.charAt(i) == '+')...
[ "public", "void", "formatField", "(", "ZonedDateTime", "datetime", ",", "String", "pattern", ",", "StringBuilder", "buffer", ")", "{", "int", "length", "=", "pattern", ".", "length", "(", ")", ";", "if", "(", "length", "==", "0", ")", "{", "return", ";",...
Formats a single field, based on the first character in the pattern string, with repeated characters indicating the field width.
[ "Formats", "a", "single", "field", "based", "on", "the", "first", "character", "in", "the", "pattern", "string", "with", "repeated", "characters", "indicating", "the", "field", "width", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java#L255-L283
106,707
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java
CalendarFormatterBase.formatField
public void formatField(ZonedDateTime datetime, char field, int width, StringBuilder buffer) { switch (field) { case 'G': formatEra(buffer, datetime, width, eras); break; case 'y': formatYear(buffer, datetime, width); break; case 'Y': formatISOYearWeekOfYe...
java
public void formatField(ZonedDateTime datetime, char field, int width, StringBuilder buffer) { switch (field) { case 'G': formatEra(buffer, datetime, width, eras); break; case 'y': formatYear(buffer, datetime, width); break; case 'Y': formatISOYearWeekOfYe...
[ "public", "void", "formatField", "(", "ZonedDateTime", "datetime", ",", "char", "field", ",", "int", "width", ",", "StringBuilder", "buffer", ")", "{", "switch", "(", "field", ")", "{", "case", "'", "'", ":", "formatEra", "(", "buffer", ",", "datetime", ...
Format a single field of a given width.
[ "Format", "a", "single", "field", "of", "a", "given", "width", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java#L288-L441
106,708
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java
CalendarFormatterBase.formatEra
void formatEra(StringBuilder b, ZonedDateTime d, int width, FieldVariants eras) { int year = d.getYear(); int index = year < 0 ? 0 : 1; switch (width) { case 5: b.append(eras.narrow[index]); break; case 4: b.append(eras.wide[index]); break; case 3: c...
java
void formatEra(StringBuilder b, ZonedDateTime d, int width, FieldVariants eras) { int year = d.getYear(); int index = year < 0 ? 0 : 1; switch (width) { case 5: b.append(eras.narrow[index]); break; case 4: b.append(eras.wide[index]); break; case 3: c...
[ "void", "formatEra", "(", "StringBuilder", "b", ",", "ZonedDateTime", "d", ",", "int", "width", ",", "FieldVariants", "eras", ")", "{", "int", "year", "=", "d", ".", "getYear", "(", ")", ";", "int", "index", "=", "year", "<", "0", "?", "0", ":", "1...
Format the era based on the year.
[ "Format", "the", "era", "based", "on", "the", "year", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java#L446-L464
106,709
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java
CalendarFormatterBase.formatYear
void formatYear(StringBuilder b, ZonedDateTime d, int width) { int year = d.getYear(); _formatYearValue(b, year, width); }
java
void formatYear(StringBuilder b, ZonedDateTime d, int width) { int year = d.getYear(); _formatYearValue(b, year, width); }
[ "void", "formatYear", "(", "StringBuilder", "b", ",", "ZonedDateTime", "d", ",", "int", "width", ")", "{", "int", "year", "=", "d", ".", "getYear", "(", ")", ";", "_formatYearValue", "(", "b", ",", "year", ",", "width", ")", ";", "}" ]
Format the numeric year, zero padding as necessary.
[ "Format", "the", "numeric", "year", "zero", "padding", "as", "necessary", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java#L469-L472
106,710
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java
CalendarFormatterBase.formatISOYearWeekOfYear
void formatISOYearWeekOfYear(StringBuilder b, ZonedDateTime d, int width) { int year = d.get(IsoFields.WEEK_BASED_YEAR); _formatYearValue(b, year, width); }
java
void formatISOYearWeekOfYear(StringBuilder b, ZonedDateTime d, int width) { int year = d.get(IsoFields.WEEK_BASED_YEAR); _formatYearValue(b, year, width); }
[ "void", "formatISOYearWeekOfYear", "(", "StringBuilder", "b", ",", "ZonedDateTime", "d", ",", "int", "width", ")", "{", "int", "year", "=", "d", ".", "get", "(", "IsoFields", ".", "WEEK_BASED_YEAR", ")", ";", "_formatYearValue", "(", "b", ",", "year", ",",...
Formats the year according to ISO week-year.
[ "Formats", "the", "year", "according", "to", "ISO", "week", "-", "year", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java#L477-L480
106,711
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java
CalendarFormatterBase.formatQuarter
void formatQuarter(StringBuilder b, ZonedDateTime d, int width, FieldVariants quarters) { int quarter = (d.getMonth().getValue() - 1) / 3; switch (width) { case 5: b.append(quarters.narrow[quarter]); break; case 4: b.append(quarters.wide[quarter]); break; case...
java
void formatQuarter(StringBuilder b, ZonedDateTime d, int width, FieldVariants quarters) { int quarter = (d.getMonth().getValue() - 1) / 3; switch (width) { case 5: b.append(quarters.narrow[quarter]); break; case 4: b.append(quarters.wide[quarter]); break; case...
[ "void", "formatQuarter", "(", "StringBuilder", "b", ",", "ZonedDateTime", "d", ",", "int", "width", ",", "FieldVariants", "quarters", ")", "{", "int", "quarter", "=", "(", "d", ".", "getMonth", "(", ")", ".", "getValue", "(", ")", "-", "1", ")", "/", ...
Format the quarter based on the month.
[ "Format", "the", "quarter", "based", "on", "the", "month", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java#L503-L526
106,712
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java
CalendarFormatterBase.formatMonth
void formatMonth(StringBuilder b, ZonedDateTime d, int width, FieldVariants months) { int month = d.getMonth().getValue(); switch (width) { case 5: b.append(months.narrow[month-1]); break; case 4: b.append(months.wide[month-1]); break; case 3: b.append...
java
void formatMonth(StringBuilder b, ZonedDateTime d, int width, FieldVariants months) { int month = d.getMonth().getValue(); switch (width) { case 5: b.append(months.narrow[month-1]); break; case 4: b.append(months.wide[month-1]); break; case 3: b.append...
[ "void", "formatMonth", "(", "StringBuilder", "b", ",", "ZonedDateTime", "d", ",", "int", "width", ",", "FieldVariants", "months", ")", "{", "int", "month", "=", "d", ".", "getMonth", "(", ")", ".", "getValue", "(", ")", ";", "switch", "(", "width", ")"...
Format the month, numeric or a string name variant.
[ "Format", "the", "month", "numeric", "or", "a", "string", "name", "variant", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java#L531-L556
106,713
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java
CalendarFormatterBase.formatWeekOfMonth
void formatWeekOfMonth(StringBuilder b, ZonedDateTime d, int width) { int w = d.get(ChronoField.ALIGNED_WEEK_OF_MONTH); if (width == 1) { b.append(w); } }
java
void formatWeekOfMonth(StringBuilder b, ZonedDateTime d, int width) { int w = d.get(ChronoField.ALIGNED_WEEK_OF_MONTH); if (width == 1) { b.append(w); } }
[ "void", "formatWeekOfMonth", "(", "StringBuilder", "b", ",", "ZonedDateTime", "d", ",", "int", "width", ")", "{", "int", "w", "=", "d", ".", "get", "(", "ChronoField", ".", "ALIGNED_WEEK_OF_MONTH", ")", ";", "if", "(", "width", "==", "1", ")", "{", "b"...
Format the week number of the month.
[ "Format", "the", "week", "number", "of", "the", "month", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java#L561-L566
106,714
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java
CalendarFormatterBase.formatISOWeekOfYear
void formatISOWeekOfYear(StringBuilder b, ZonedDateTime d, int width) { int w = d.get(IsoFields.WEEK_OF_WEEK_BASED_YEAR); switch (width) { case 2: zeroPad2(b, w, 2); break; case 1: b.append(w); break; } }
java
void formatISOWeekOfYear(StringBuilder b, ZonedDateTime d, int width) { int w = d.get(IsoFields.WEEK_OF_WEEK_BASED_YEAR); switch (width) { case 2: zeroPad2(b, w, 2); break; case 1: b.append(w); break; } }
[ "void", "formatISOWeekOfYear", "(", "StringBuilder", "b", ",", "ZonedDateTime", "d", ",", "int", "width", ")", "{", "int", "w", "=", "d", ".", "get", "(", "IsoFields", ".", "WEEK_OF_WEEK_BASED_YEAR", ")", ";", "switch", "(", "width", ")", "{", "case", "2...
Format the week number of the year.
[ "Format", "the", "week", "number", "of", "the", "year", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java#L571-L582
106,715
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java
CalendarFormatterBase.formatWeekday
void formatWeekday(StringBuilder b, ZonedDateTime d, int width, FieldVariants weekdays) { int weekday = d.getDayOfWeek().getValue() % 7; switch (width) { case 6: b.append(weekdays.short_[weekday]); break; case 5: b.append(weekdays.narrow[weekday]); break; case...
java
void formatWeekday(StringBuilder b, ZonedDateTime d, int width, FieldVariants weekdays) { int weekday = d.getDayOfWeek().getValue() % 7; switch (width) { case 6: b.append(weekdays.short_[weekday]); break; case 5: b.append(weekdays.narrow[weekday]); break; case...
[ "void", "formatWeekday", "(", "StringBuilder", "b", ",", "ZonedDateTime", "d", ",", "int", "width", ",", "FieldVariants", "weekdays", ")", "{", "int", "weekday", "=", "d", ".", "getDayOfWeek", "(", ")", ".", "getValue", "(", ")", "%", "7", ";", "switch",...
Format the weekday name.
[ "Format", "the", "weekday", "name", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java#L587-L608
106,716
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java
CalendarFormatterBase.formatLocalWeekday
void formatLocalWeekday(StringBuilder b, ZonedDateTime d, int width, FieldVariants weekdays, int firstDay) { if (width > 2) { formatWeekday(b, d, width, weekdays); return; } if (width == 2) { b.append('0'); } formatWeekdayNumeric(b, d, firstDay); }
java
void formatLocalWeekday(StringBuilder b, ZonedDateTime d, int width, FieldVariants weekdays, int firstDay) { if (width > 2) { formatWeekday(b, d, width, weekdays); return; } if (width == 2) { b.append('0'); } formatWeekdayNumeric(b, d, firstDay); }
[ "void", "formatLocalWeekday", "(", "StringBuilder", "b", ",", "ZonedDateTime", "d", ",", "int", "width", ",", "FieldVariants", "weekdays", ",", "int", "firstDay", ")", "{", "if", "(", "width", ">", "2", ")", "{", "formatWeekday", "(", "b", ",", "d", ",",...
Format the numeric weekday, or the format name variant.
[ "Format", "the", "numeric", "weekday", "or", "the", "format", "name", "variant", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java#L613-L622
106,717
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java
CalendarFormatterBase.formatLocalWeekdayStandalone
void formatLocalWeekdayStandalone(StringBuilder b, ZonedDateTime d, int width, FieldVariants weekdays, int firstDay) { if (width > 2) { formatWeekday(b, d, width, weekdays); return; } formatWeekdayNumeric(b, d, firstDay); }
java
void formatLocalWeekdayStandalone(StringBuilder b, ZonedDateTime d, int width, FieldVariants weekdays, int firstDay) { if (width > 2) { formatWeekday(b, d, width, weekdays); return; } formatWeekdayNumeric(b, d, firstDay); }
[ "void", "formatLocalWeekdayStandalone", "(", "StringBuilder", "b", ",", "ZonedDateTime", "d", ",", "int", "width", ",", "FieldVariants", "weekdays", ",", "int", "firstDay", ")", "{", "if", "(", "width", ">", "2", ")", "{", "formatWeekday", "(", "b", ",", "...
Format the numeric weekday, or the stand-alone name variant.
[ "Format", "the", "numeric", "weekday", "or", "the", "stand", "-", "alone", "name", "variant", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java#L627-L633
106,718
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java
CalendarFormatterBase.formatWeekdayNumeric
private void formatWeekdayNumeric(StringBuilder b, ZonedDateTime d, int firstDay) { // Java returns ISO-8601 where Monday = 1 and Sunday = 7. int weekday = d.getDayOfWeek().getValue(); // Adjust to the localized "first day of the week" int w = (7 - firstDay + weekday) % 7 + 1; b.append(w); }
java
private void formatWeekdayNumeric(StringBuilder b, ZonedDateTime d, int firstDay) { // Java returns ISO-8601 where Monday = 1 and Sunday = 7. int weekday = d.getDayOfWeek().getValue(); // Adjust to the localized "first day of the week" int w = (7 - firstDay + weekday) % 7 + 1; b.append(w); }
[ "private", "void", "formatWeekdayNumeric", "(", "StringBuilder", "b", ",", "ZonedDateTime", "d", ",", "int", "firstDay", ")", "{", "// Java returns ISO-8601 where Monday = 1 and Sunday = 7.", "int", "weekday", "=", "d", ".", "getDayOfWeek", "(", ")", ".", "getValue", ...
Convert from Java's ISO-8601 week number, where Monday = 1 and Sunday = 7. We need to adjust this according to the locale's "first day of the week" which in the US is Sunday = 0. In the US, Tuesday will produce '3' or the 3rd day of the week: weekday = 2 (ISO-8601 Tuesday == 2) int w = (7 - 0 + weekday) % 7 + 1 w ==...
[ "Convert", "from", "Java", "s", "ISO", "-", "8601", "week", "number", "where", "Monday", "=", "1", "and", "Sunday", "=", "7", ".", "We", "need", "to", "adjust", "this", "according", "to", "the", "locale", "s", "first", "day", "of", "the", "week", "wh...
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java#L653-L660
106,719
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java
CalendarFormatterBase.formatDayOfMonth
void formatDayOfMonth(StringBuilder b, ZonedDateTime d, int width) { int day = d.getDayOfMonth(); zeroPad2(b, day, width); }
java
void formatDayOfMonth(StringBuilder b, ZonedDateTime d, int width) { int day = d.getDayOfMonth(); zeroPad2(b, day, width); }
[ "void", "formatDayOfMonth", "(", "StringBuilder", "b", ",", "ZonedDateTime", "d", ",", "int", "width", ")", "{", "int", "day", "=", "d", ".", "getDayOfMonth", "(", ")", ";", "zeroPad2", "(", "b", ",", "day", ",", "width", ")", ";", "}" ]
Format the day of the month, optionally zero-padded.
[ "Format", "the", "day", "of", "the", "month", "optionally", "zero", "-", "padded", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java#L665-L668
106,720
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java
CalendarFormatterBase.formatDayOfYear
void formatDayOfYear(StringBuilder b, ZonedDateTime d, int width) { int day = d.getDayOfYear(); int digits = day < 10 ? 1 : day < 100 ? 2 : 3; switch (digits) { case 1: if (width > 1) { b.append('0'); } // fall through case 2: if (width > 2) { ...
java
void formatDayOfYear(StringBuilder b, ZonedDateTime d, int width) { int day = d.getDayOfYear(); int digits = day < 10 ? 1 : day < 100 ? 2 : 3; switch (digits) { case 1: if (width > 1) { b.append('0'); } // fall through case 2: if (width > 2) { ...
[ "void", "formatDayOfYear", "(", "StringBuilder", "b", ",", "ZonedDateTime", "d", ",", "int", "width", ")", "{", "int", "day", "=", "d", ".", "getDayOfYear", "(", ")", ";", "int", "digits", "=", "day", "<", "10", "?", "1", ":", "day", "<", "100", "?...
Format the 3-digit day of the year, zero padded.
[ "Format", "the", "3", "-", "digit", "day", "of", "the", "year", "zero", "padded", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java#L673-L693
106,721
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java
CalendarFormatterBase.formatDayOfWeekInMonth
void formatDayOfWeekInMonth(StringBuilder b, ZonedDateTime d, int width) { int day = ((d.getDayOfMonth() - 1) / 7) + 1; b.append(day); }
java
void formatDayOfWeekInMonth(StringBuilder b, ZonedDateTime d, int width) { int day = ((d.getDayOfMonth() - 1) / 7) + 1; b.append(day); }
[ "void", "formatDayOfWeekInMonth", "(", "StringBuilder", "b", ",", "ZonedDateTime", "d", ",", "int", "width", ")", "{", "int", "day", "=", "(", "(", "d", ".", "getDayOfMonth", "(", ")", "-", "1", ")", "/", "7", ")", "+", "1", ";", "b", ".", "append"...
Numeric day of week in month, as in "2nd Wednesday in July".
[ "Numeric", "day", "of", "week", "in", "month", "as", "in", "2nd", "Wednesday", "in", "July", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java#L698-L701
106,722
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java
CalendarFormatterBase.formatDayPeriod
void formatDayPeriod(StringBuilder b, ZonedDateTime d, int width, FieldVariants dayPeriods) { int hours = d.getHour(); int index = hours < 12 ? 0 : 1; switch (width) { case 5: b.append(dayPeriods.narrow[index]); break; case 4: b.append(dayPeriods.wide[index]); br...
java
void formatDayPeriod(StringBuilder b, ZonedDateTime d, int width, FieldVariants dayPeriods) { int hours = d.getHour(); int index = hours < 12 ? 0 : 1; switch (width) { case 5: b.append(dayPeriods.narrow[index]); break; case 4: b.append(dayPeriods.wide[index]); br...
[ "void", "formatDayPeriod", "(", "StringBuilder", "b", ",", "ZonedDateTime", "d", ",", "int", "width", ",", "FieldVariants", "dayPeriods", ")", "{", "int", "hours", "=", "d", ".", "getHour", "(", ")", ";", "int", "index", "=", "hours", "<", "12", "?", "...
Format the day period variant.
[ "Format", "the", "day", "period", "variant", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java#L706-L724
106,723
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java
CalendarFormatterBase.formatHours
void formatHours(StringBuilder b, ZonedDateTime d, int width, boolean twelveHour) { int hours = d.getHour(); if (twelveHour && hours > 12) { hours = hours - 12; } if (twelveHour && hours == 0) { hours = 12; } zeroPad2(b, hours, width); }
java
void formatHours(StringBuilder b, ZonedDateTime d, int width, boolean twelveHour) { int hours = d.getHour(); if (twelveHour && hours > 12) { hours = hours - 12; } if (twelveHour && hours == 0) { hours = 12; } zeroPad2(b, hours, width); }
[ "void", "formatHours", "(", "StringBuilder", "b", ",", "ZonedDateTime", "d", ",", "int", "width", ",", "boolean", "twelveHour", ")", "{", "int", "hours", "=", "d", ".", "getHour", "(", ")", ";", "if", "(", "twelveHour", "&&", "hours", ">", "12", ")", ...
Format the hours in 12- or 24-hour format, optionally zero-padded.
[ "Format", "the", "hours", "in", "12", "-", "or", "24", "-", "hour", "format", "optionally", "zero", "-", "padded", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java#L729-L738
106,724
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java
CalendarFormatterBase.formatMinutes
void formatMinutes(StringBuilder b, ZonedDateTime d, int width) { zeroPad2(b, d.getMinute(), width); }
java
void formatMinutes(StringBuilder b, ZonedDateTime d, int width) { zeroPad2(b, d.getMinute(), width); }
[ "void", "formatMinutes", "(", "StringBuilder", "b", ",", "ZonedDateTime", "d", ",", "int", "width", ")", "{", "zeroPad2", "(", "b", ",", "d", ".", "getMinute", "(", ")", ",", "width", ")", ";", "}" ]
Format the minutes, optionally zero-padded.
[ "Format", "the", "minutes", "optionally", "zero", "-", "padded", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java#L758-L760
106,725
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java
CalendarFormatterBase.formatSeconds
void formatSeconds(StringBuilder b, ZonedDateTime d, int width) { zeroPad2(b, d.getSecond(), width); }
java
void formatSeconds(StringBuilder b, ZonedDateTime d, int width) { zeroPad2(b, d.getSecond(), width); }
[ "void", "formatSeconds", "(", "StringBuilder", "b", ",", "ZonedDateTime", "d", ",", "int", "width", ")", "{", "zeroPad2", "(", "b", ",", "d", ".", "getSecond", "(", ")", ",", "width", ")", ";", "}" ]
Format the seconds, optionally zero-padded.
[ "Format", "the", "seconds", "optionally", "zero", "-", "padded", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java#L765-L767
106,726
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java
CalendarFormatterBase.formatFractionalSeconds
void formatFractionalSeconds(StringBuilder b, ZonedDateTime d, int width) { // format up to 9 digits at nanosecond resolution. int nano = d.getNano(); int f = 100000000; while (width > 0 && f > 0) { int digit = nano / f; nano -= (digit * f); f /= 10; b.append(digit); width-...
java
void formatFractionalSeconds(StringBuilder b, ZonedDateTime d, int width) { // format up to 9 digits at nanosecond resolution. int nano = d.getNano(); int f = 100000000; while (width > 0 && f > 0) { int digit = nano / f; nano -= (digit * f); f /= 10; b.append(digit); width-...
[ "void", "formatFractionalSeconds", "(", "StringBuilder", "b", ",", "ZonedDateTime", "d", ",", "int", "width", ")", "{", "// format up to 9 digits at nanosecond resolution.", "int", "nano", "=", "d", ".", "getNano", "(", ")", ";", "int", "f", "=", "100000000", ";...
Format fractional seconds up to N digits.
[ "Format", "fractional", "seconds", "up", "to", "N", "digits", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java#L772-L789
106,727
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java
CalendarFormatterBase.formatTimeZone_O
void formatTimeZone_O(StringBuilder b, ZonedDateTime d, int width) { int[] tz = getTzComponents(d); switch (width) { case 1: wrapTimeZoneGMT(b, tz[TZNEG] == -1, tz[TZHOURS], tz[TZMINS], true); break; case 4: wrapTimeZoneGMT(b, tz[TZNEG] == -1, tz[TZHOURS], tz[TZMINS]...
java
void formatTimeZone_O(StringBuilder b, ZonedDateTime d, int width) { int[] tz = getTzComponents(d); switch (width) { case 1: wrapTimeZoneGMT(b, tz[TZNEG] == -1, tz[TZHOURS], tz[TZMINS], true); break; case 4: wrapTimeZoneGMT(b, tz[TZNEG] == -1, tz[TZHOURS], tz[TZMINS]...
[ "void", "formatTimeZone_O", "(", "StringBuilder", "b", ",", "ZonedDateTime", "d", ",", "int", "width", ")", "{", "int", "[", "]", "tz", "=", "getTzComponents", "(", "d", ")", ";", "switch", "(", "width", ")", "{", "case", "1", ":", "wrapTimeZoneGMT", "...
Format timezone in localized GMT format for field 'O'.
[ "Format", "timezone", "in", "localized", "GMT", "format", "for", "field", "O", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java#L795-L806
106,728
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java
CalendarFormatterBase.formatTimeZone_z
void formatTimeZone_z(StringBuilder b, ZonedDateTime d, int width) { if (width > 4) { return; } ZoneId zone = d.getZone(); ZoneRules zoneRules = null; try { zoneRules = zone.getRules(); } catch (ZoneRulesException e) { // not expected, but catching for safety return; ...
java
void formatTimeZone_z(StringBuilder b, ZonedDateTime d, int width) { if (width > 4) { return; } ZoneId zone = d.getZone(); ZoneRules zoneRules = null; try { zoneRules = zone.getRules(); } catch (ZoneRulesException e) { // not expected, but catching for safety return; ...
[ "void", "formatTimeZone_z", "(", "StringBuilder", "b", ",", "ZonedDateTime", "d", ",", "int", "width", ")", "{", "if", "(", "width", ">", "4", ")", "{", "return", ";", "}", "ZoneId", "zone", "=", "d", ".", "getZone", "(", ")", ";", "ZoneRules", "zone...
Format a time zone using a non-location format.
[ "Format", "a", "time", "zone", "using", "a", "non", "-", "location", "format", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java#L916-L961
106,729
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java
CalendarFormatterBase.getTzComponents
private int[] getTzComponents(ZonedDateTime d) { ZoneOffset offset = d.getOffset(); int secs = offset.getTotalSeconds(); boolean negative = secs < 0; if (negative) { secs = -secs; } int hours = secs / 3600; int mins = (secs % 3600) / 60; return new int[] { negative ? -1 : 1, secs, ...
java
private int[] getTzComponents(ZonedDateTime d) { ZoneOffset offset = d.getOffset(); int secs = offset.getTotalSeconds(); boolean negative = secs < 0; if (negative) { secs = -secs; } int hours = secs / 3600; int mins = (secs % 3600) / 60; return new int[] { negative ? -1 : 1, secs, ...
[ "private", "int", "[", "]", "getTzComponents", "(", "ZonedDateTime", "d", ")", "{", "ZoneOffset", "offset", "=", "d", ".", "getOffset", "(", ")", ";", "int", "secs", "=", "offset", ".", "getTotalSeconds", "(", ")", ";", "boolean", "negative", "=", "secs"...
Decode some fields about a time zone.
[ "Decode", "some", "fields", "about", "a", "time", "zone", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java#L1013-L1023
106,730
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java
CalendarFormatterBase.zeroPad2
void zeroPad2(StringBuilder b, int value, int width) { switch (width) { case 2: if (value < 10) { b.append('0'); } // fall through case 1: b.append(value); break; } }
java
void zeroPad2(StringBuilder b, int value, int width) { switch (width) { case 2: if (value < 10) { b.append('0'); } // fall through case 1: b.append(value); break; } }
[ "void", "zeroPad2", "(", "StringBuilder", "b", ",", "int", "value", ",", "int", "width", ")", "{", "switch", "(", "width", ")", "{", "case", "2", ":", "if", "(", "value", "<", "10", ")", "{", "b", ".", "append", "(", "'", "'", ")", ";", "}", ...
Format 2-digit number with 0-padding.
[ "Format", "2", "-", "digit", "number", "with", "0", "-", "padding", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java#L1028-L1040
106,731
Squarespace/cldr
examples/src/main/java/com/squarespace/cldr/examples/NumberFormatterDemo.java
NumberFormatterDemo.decimal
private static void decimal(CLDR.Locale locale, String[] numbers, DecimalFormatOptions opts) { for (String num : numbers) { BigDecimal n = new BigDecimal(num); StringBuilder buf = new StringBuilder(" "); NumberFormatter fmt = CLDR.get().getNumberFormatter(locale); fmt.formatDecimal(n, buf, ...
java
private static void decimal(CLDR.Locale locale, String[] numbers, DecimalFormatOptions opts) { for (String num : numbers) { BigDecimal n = new BigDecimal(num); StringBuilder buf = new StringBuilder(" "); NumberFormatter fmt = CLDR.get().getNumberFormatter(locale); fmt.formatDecimal(n, buf, ...
[ "private", "static", "void", "decimal", "(", "CLDR", ".", "Locale", "locale", ",", "String", "[", "]", "numbers", ",", "DecimalFormatOptions", "opts", ")", "{", "for", "(", "String", "num", ":", "numbers", ")", "{", "BigDecimal", "n", "=", "new", "BigDec...
Format decimal numbers in this locale.
[ "Format", "decimal", "numbers", "in", "this", "locale", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/examples/src/main/java/com/squarespace/cldr/examples/NumberFormatterDemo.java#L111-L119
106,732
Squarespace/cldr
examples/src/main/java/com/squarespace/cldr/examples/NumberFormatterDemo.java
NumberFormatterDemo.money
private static void money( CLDR.Locale locale, CLDR.Currency[] currencies, String[] numbers, CurrencyFormatOptions opts) { for (CLDR.Currency currency : currencies) { System.out.println("Currency " + currency); for (String num : numbers) { BigDecimal n = new BigDecimal(num); N...
java
private static void money( CLDR.Locale locale, CLDR.Currency[] currencies, String[] numbers, CurrencyFormatOptions opts) { for (CLDR.Currency currency : currencies) { System.out.println("Currency " + currency); for (String num : numbers) { BigDecimal n = new BigDecimal(num); N...
[ "private", "static", "void", "money", "(", "CLDR", ".", "Locale", "locale", ",", "CLDR", ".", "Currency", "[", "]", "currencies", ",", "String", "[", "]", "numbers", ",", "CurrencyFormatOptions", "opts", ")", "{", "for", "(", "CLDR", ".", "Currency", "cu...
Format numbers in this locale for several currencies.
[ "Format", "numbers", "in", "this", "locale", "for", "several", "currencies", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/examples/src/main/java/com/squarespace/cldr/examples/NumberFormatterDemo.java#L124-L139
106,733
Squarespace/cldr
core/src/main/java/com/squarespace/cldr/units/UnitFactorMap.java
UnitFactorMap.getFactors
public List<UnitValue> getFactors(Unit base, RoundingMode mode, Unit...units) { List<UnitValue> result = new ArrayList<>(); for (int i = 0; i < units.length; i++) { UnitFactor factor = resolve(units[i], base); if (factor != null) { BigDecimal n = factor.rational().compute(mode); resu...
java
public List<UnitValue> getFactors(Unit base, RoundingMode mode, Unit...units) { List<UnitValue> result = new ArrayList<>(); for (int i = 0; i < units.length; i++) { UnitFactor factor = resolve(units[i], base); if (factor != null) { BigDecimal n = factor.rational().compute(mode); resu...
[ "public", "List", "<", "UnitValue", ">", "getFactors", "(", "Unit", "base", ",", "RoundingMode", "mode", ",", "Unit", "...", "units", ")", "{", "List", "<", "UnitValue", ">", "result", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "int", ...
Return an array of factors to convert the array of units to the given base.
[ "Return", "an", "array", "of", "factors", "to", "convert", "the", "array", "of", "units", "to", "the", "given", "base", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/core/src/main/java/com/squarespace/cldr/units/UnitFactorMap.java#L87-L97
106,734
Squarespace/cldr
core/src/main/java/com/squarespace/cldr/units/UnitFactorMap.java
UnitFactorMap.add
protected UnitFactorMap add(Unit unit, String n, Unit base) { check(unit); check(base); if (unit == base) { throw new IllegalArgumentException("Attempt to define a unit " + unit + " in terms of itself."); } // Set the factor and its inverse if nothing already exists. Rational rational = n...
java
protected UnitFactorMap add(Unit unit, String n, Unit base) { check(unit); check(base); if (unit == base) { throw new IllegalArgumentException("Attempt to define a unit " + unit + " in terms of itself."); } // Set the factor and its inverse if nothing already exists. Rational rational = n...
[ "protected", "UnitFactorMap", "add", "(", "Unit", "unit", ",", "String", "n", ",", "Unit", "base", ")", "{", "check", "(", "unit", ")", ";", "check", "(", "base", ")", ";", "if", "(", "unit", "==", "base", ")", "{", "throw", "new", "IllegalArgumentEx...
Set a factor to convert the unit into a given base.
[ "Set", "a", "factor", "to", "convert", "the", "unit", "into", "a", "given", "base", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/core/src/main/java/com/squarespace/cldr/units/UnitFactorMap.java#L102-L113
106,735
Squarespace/cldr
core/src/main/java/com/squarespace/cldr/units/UnitFactorMap.java
UnitFactorMap.complete
protected UnitFactorMap complete() { Set<Unit> units = new LinkedHashSet<>(); // Add reverse mappings for all populated units. for (Unit from : factors.keySet()) { units.add(from); for (Map.Entry<Unit, UnitFactor> entry : factors.get(from).entrySet()) { Unit to = entry.getKey(); ...
java
protected UnitFactorMap complete() { Set<Unit> units = new LinkedHashSet<>(); // Add reverse mappings for all populated units. for (Unit from : factors.keySet()) { units.add(from); for (Map.Entry<Unit, UnitFactor> entry : factors.get(from).entrySet()) { Unit to = entry.getKey(); ...
[ "protected", "UnitFactorMap", "complete", "(", ")", "{", "Set", "<", "Unit", ">", "units", "=", "new", "LinkedHashSet", "<>", "(", ")", ";", "// Add reverse mappings for all populated units.", "for", "(", "Unit", "from", ":", "factors", ".", "keySet", "(", ")"...
Creates direct conversion factors between all units by resolving the best conversion path and setting an explicit mapping if one does not already exist.
[ "Creates", "direct", "conversion", "factors", "between", "all", "units", "by", "resolving", "the", "best", "conversion", "path", "and", "setting", "an", "explicit", "mapping", "if", "one", "does", "not", "already", "exist", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/core/src/main/java/com/squarespace/cldr/units/UnitFactorMap.java#L127-L195
106,736
Squarespace/cldr
core/src/main/java/com/squarespace/cldr/units/UnitFactorMap.java
UnitFactorMap.resolve
protected UnitFactor resolve(Unit from, Unit to) { if (from == to) { return new UnitFactor(Rational.ONE, to); } List<UnitFactor> path = getPath(from, to); if (path.isEmpty()) { throw new IllegalStateException("Can't find a path to convert " + from + " units into " + to); } UnitFacto...
java
protected UnitFactor resolve(Unit from, Unit to) { if (from == to) { return new UnitFactor(Rational.ONE, to); } List<UnitFactor> path = getPath(from, to); if (path.isEmpty()) { throw new IllegalStateException("Can't find a path to convert " + from + " units into " + to); } UnitFacto...
[ "protected", "UnitFactor", "resolve", "(", "Unit", "from", ",", "Unit", "to", ")", "{", "if", "(", "from", "==", "to", ")", "{", "return", "new", "UnitFactor", "(", "Rational", ".", "ONE", ",", "to", ")", ";", "}", "List", "<", "UnitFactor", ">", "...
Find the best conversion factor path between the FROM and TO units, multiply them together and return the resulting factor.
[ "Find", "the", "best", "conversion", "factor", "path", "between", "the", "FROM", "and", "TO", "units", "multiply", "them", "together", "and", "return", "the", "resulting", "factor", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/core/src/main/java/com/squarespace/cldr/units/UnitFactorMap.java#L201-L216
106,737
Squarespace/cldr
core/src/main/java/com/squarespace/cldr/units/UnitFactorMap.java
UnitFactorMap.precisionSum
private int precisionSum(List<UnitFactor> factors) { return factors.stream().map(f -> totalPrecision(f.rational())).reduce(0, Math::addExact); }
java
private int precisionSum(List<UnitFactor> factors) { return factors.stream().map(f -> totalPrecision(f.rational())).reduce(0, Math::addExact); }
[ "private", "int", "precisionSum", "(", "List", "<", "UnitFactor", ">", "factors", ")", "{", "return", "factors", ".", "stream", "(", ")", ".", "map", "(", "f", "->", "totalPrecision", "(", "f", ".", "rational", "(", ")", ")", ")", ".", "reduce", "(",...
Reduces the list of factors by adding together the precision for all numerators and denominators.
[ "Reduces", "the", "list", "of", "factors", "by", "adding", "together", "the", "precision", "for", "all", "numerators", "and", "denominators", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/core/src/main/java/com/squarespace/cldr/units/UnitFactorMap.java#L250-L252
106,738
Squarespace/cldr
core/src/main/java/com/squarespace/cldr/units/UnitFactorMap.java
UnitFactorMap.get
public UnitFactor get(Unit from, Unit to) { Map<Unit, UnitFactor> map = factors.get(from); if (map != null) { UnitFactor factor = map.get(to); if (factor != null) { return factor; } } return null; }
java
public UnitFactor get(Unit from, Unit to) { Map<Unit, UnitFactor> map = factors.get(from); if (map != null) { UnitFactor factor = map.get(to); if (factor != null) { return factor; } } return null; }
[ "public", "UnitFactor", "get", "(", "Unit", "from", ",", "Unit", "to", ")", "{", "Map", "<", "Unit", ",", "UnitFactor", ">", "map", "=", "factors", ".", "get", "(", "from", ")", ";", "if", "(", "map", "!=", "null", ")", "{", "UnitFactor", "factor",...
Find an exact conversion factor between the from and to units, or return null if none exists.
[ "Find", "an", "exact", "conversion", "factor", "between", "the", "from", "and", "to", "units", "or", "return", "null", "if", "none", "exists", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/core/src/main/java/com/squarespace/cldr/units/UnitFactorMap.java#L305-L314
106,739
Squarespace/cldr
core/src/main/java/com/squarespace/cldr/units/UnitFactorMap.java
UnitFactorMap.dump
public String dump(Unit unit) { StringBuilder buf = new StringBuilder(); buf.append(unit).append(":\n"); Map<Unit, UnitFactor> map = factors.get(unit); for (Unit base : map.keySet()) { UnitFactor factor = map.get(base); buf.append(" ").append(factor).append(" "); buf.append(factor.ra...
java
public String dump(Unit unit) { StringBuilder buf = new StringBuilder(); buf.append(unit).append(":\n"); Map<Unit, UnitFactor> map = factors.get(unit); for (Unit base : map.keySet()) { UnitFactor factor = map.get(base); buf.append(" ").append(factor).append(" "); buf.append(factor.ra...
[ "public", "String", "dump", "(", "Unit", "unit", ")", "{", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", ")", ";", "buf", ".", "append", "(", "unit", ")", ".", "append", "(", "\":\\n\"", ")", ";", "Map", "<", "Unit", ",", "UnitFactor", ">...
Debugging conversion factors.
[ "Debugging", "conversion", "factors", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/core/src/main/java/com/squarespace/cldr/units/UnitFactorMap.java#L319-L329
106,740
Squarespace/cldr
core/src/main/java/com/squarespace/cldr/units/UnitFactorMap.java
UnitFactorMap.set
private void set(Unit unit, Rational rational, Unit base, boolean replace) { Map<Unit, UnitFactor> map = factors.get(unit); if (map == null) { map = new EnumMap<>(Unit.class); factors.put(unit, map); } if (replace || !map.containsKey(base)) { map.put(base, new UnitFactor(rational, bas...
java
private void set(Unit unit, Rational rational, Unit base, boolean replace) { Map<Unit, UnitFactor> map = factors.get(unit); if (map == null) { map = new EnumMap<>(Unit.class); factors.put(unit, map); } if (replace || !map.containsKey(base)) { map.put(base, new UnitFactor(rational, bas...
[ "private", "void", "set", "(", "Unit", "unit", ",", "Rational", "rational", ",", "Unit", "base", ",", "boolean", "replace", ")", "{", "Map", "<", "Unit", ",", "UnitFactor", ">", "map", "=", "factors", ".", "get", "(", "unit", ")", ";", "if", "(", "...
Set a conversion factor that converts UNIT to BASE. If the replace flag is true we always overwrite the mapping.
[ "Set", "a", "conversion", "factor", "that", "converts", "UNIT", "to", "BASE", ".", "If", "the", "replace", "flag", "is", "true", "we", "always", "overwrite", "the", "mapping", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/core/src/main/java/com/squarespace/cldr/units/UnitFactorMap.java#L335-L344
106,741
Squarespace/cldr
core/src/main/java/com/squarespace/cldr/units/UnitFactorMap.java
UnitFactorMap.list
private List<UnitFactor> list(UnitFactor factor) { List<UnitFactor> list = new ArrayList<>(); list.add(factor); return list; }
java
private List<UnitFactor> list(UnitFactor factor) { List<UnitFactor> list = new ArrayList<>(); list.add(factor); return list; }
[ "private", "List", "<", "UnitFactor", ">", "list", "(", "UnitFactor", "factor", ")", "{", "List", "<", "UnitFactor", ">", "list", "=", "new", "ArrayList", "<>", "(", ")", ";", "list", ".", "add", "(", "factor", ")", ";", "return", "list", ";", "}" ]
Construct a list containing just this factor.
[ "Construct", "a", "list", "containing", "just", "this", "factor", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/core/src/main/java/com/squarespace/cldr/units/UnitFactorMap.java#L349-L353
106,742
Squarespace/cldr
core/src/main/java/com/squarespace/cldr/units/UnitFactorMap.java
UnitFactorMap.getBases
private List<Unit> getBases(Unit unit) { Map<Unit, UnitFactor> map = factors.get(unit); if (map != null) { return map.values().stream().map(u -> u.unit()).collect(Collectors.toList()); } return Collections.emptyList(); }
java
private List<Unit> getBases(Unit unit) { Map<Unit, UnitFactor> map = factors.get(unit); if (map != null) { return map.values().stream().map(u -> u.unit()).collect(Collectors.toList()); } return Collections.emptyList(); }
[ "private", "List", "<", "Unit", ">", "getBases", "(", "Unit", "unit", ")", "{", "Map", "<", "Unit", ",", "UnitFactor", ">", "map", "=", "factors", ".", "get", "(", "unit", ")", ";", "if", "(", "map", "!=", "null", ")", "{", "return", "map", ".", ...
Fetch all of the existing bases for the given unit. A base is a conversion factor that was directly added, or the inverse of one that was directly added.
[ "Fetch", "all", "of", "the", "existing", "bases", "for", "the", "given", "unit", ".", "A", "base", "is", "a", "conversion", "factor", "that", "was", "directly", "added", "or", "the", "inverse", "of", "one", "that", "was", "directly", "added", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/core/src/main/java/com/squarespace/cldr/units/UnitFactorMap.java#L369-L375
106,743
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/DistanceMap.java
DistanceMap.hash
private static int hash(String k1, String k2) { int h = (k1.hashCode() * 33) + k2.hashCode(); return h ^ (h >>> 16); }
java
private static int hash(String k1, String k2) { int h = (k1.hashCode() * 33) + k2.hashCode(); return h ^ (h >>> 16); }
[ "private", "static", "int", "hash", "(", "String", "k1", ",", "String", "k2", ")", "{", "int", "h", "=", "(", "k1", ".", "hashCode", "(", ")", "*", "33", ")", "+", "k2", ".", "hashCode", "(", ")", ";", "return", "h", "^", "(", "h", ">>>", "16...
Combine the hash codes for the two keys, then mix.
[ "Combine", "the", "hash", "codes", "for", "the", "two", "keys", "then", "mix", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/DistanceMap.java#L103-L106
106,744
Squarespace/cldr
core/src/main/java/com/squarespace/cldr/numbers/NumberFormatContext.java
NumberFormatContext.setPattern
public void setPattern(NumberPattern pattern, int _maxSigDigits, int _minSigDigits) { Format format = pattern.format(); minIntDigits = orDefault(options.minimumIntegerDigits(), format.minimumIntegerDigits()); maxFracDigits = currencyDigits == -1 ? format.maximumFractionDigits() : currencyDigits; maxFra...
java
public void setPattern(NumberPattern pattern, int _maxSigDigits, int _minSigDigits) { Format format = pattern.format(); minIntDigits = orDefault(options.minimumIntegerDigits(), format.minimumIntegerDigits()); maxFracDigits = currencyDigits == -1 ? format.maximumFractionDigits() : currencyDigits; maxFra...
[ "public", "void", "setPattern", "(", "NumberPattern", "pattern", ",", "int", "_maxSigDigits", ",", "int", "_minSigDigits", ")", "{", "Format", "format", "=", "pattern", ".", "format", "(", ")", ";", "minIntDigits", "=", "orDefault", "(", "options", ".", "min...
Set the pattern and initialize parameters based on the arguments, pattern and options settings.
[ "Set", "the", "pattern", "and", "initialize", "parameters", "based", "on", "the", "arguments", "pattern", "and", "options", "settings", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/core/src/main/java/com/squarespace/cldr/numbers/NumberFormatContext.java#L54-L72
106,745
Squarespace/cldr
core/src/main/java/com/squarespace/cldr/numbers/NumberFormatContext.java
NumberFormatContext.adjust
public BigDecimal adjust(BigDecimal n) { return NumberFormattingUtils.setup(n, options.roundMode(), formatMode, minIntDigits, maxFracDigits, minFracDigits, maxSigDigits, minSigDigits); }
java
public BigDecimal adjust(BigDecimal n) { return NumberFormattingUtils.setup(n, options.roundMode(), formatMode, minIntDigits, maxFracDigits, minFracDigits, maxSigDigits, minSigDigits); }
[ "public", "BigDecimal", "adjust", "(", "BigDecimal", "n", ")", "{", "return", "NumberFormattingUtils", ".", "setup", "(", "n", ",", "options", ".", "roundMode", "(", ")", ",", "formatMode", ",", "minIntDigits", ",", "maxFracDigits", ",", "minFracDigits", ",", ...
Adjust the number using all of the options.
[ "Adjust", "the", "number", "using", "all", "of", "the", "options", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/core/src/main/java/com/squarespace/cldr/numbers/NumberFormatContext.java#L77-L80
106,746
Squarespace/cldr
core/src/main/java/com/squarespace/cldr/parse/DateTimePatternParser.java
DateTimePatternParser.splitIntervalPattern
public Pair<List<Node>, List<Node>> splitIntervalPattern(String raw) { List<Node> pattern = parse(raw); Set<Character> seen = new HashSet<>(); List<Node> fst = new ArrayList<>(); List<Node> snd = new ArrayList<>(); // Indicates we've seen a repeated field. boolean boundary = false; for (N...
java
public Pair<List<Node>, List<Node>> splitIntervalPattern(String raw) { List<Node> pattern = parse(raw); Set<Character> seen = new HashSet<>(); List<Node> fst = new ArrayList<>(); List<Node> snd = new ArrayList<>(); // Indicates we've seen a repeated field. boolean boundary = false; for (N...
[ "public", "Pair", "<", "List", "<", "Node", ">", ",", "List", "<", "Node", ">", ">", "splitIntervalPattern", "(", "String", "raw", ")", "{", "List", "<", "Node", ">", "pattern", "=", "parse", "(", "raw", ")", ";", "Set", "<", "Character", ">", "see...
Looks for the first repeated field in the pattern, splitting it into two parts on that boundary. For example, the pattern "HH:mm - HH:mm v" will be split into two patterns: "HH:mm - " and "HH:mm v" when we see the 'H' field for the 2nd time.
[ "Looks", "for", "the", "first", "repeated", "field", "in", "the", "pattern", "splitting", "it", "into", "two", "parts", "on", "that", "boundary", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/core/src/main/java/com/squarespace/cldr/parse/DateTimePatternParser.java#L27-L54
106,747
Squarespace/cldr
core/src/main/java/com/squarespace/cldr/parse/DateTimePatternParser.java
DateTimePatternParser.render
public static String render(List<Node> nodes) { StringBuilder buf = new StringBuilder(); for (Node node : nodes) { if (node instanceof Text) { String text = ((Text) node).text; boolean inquote = false; for (int i = 0; i < text.length(); i++) { char ch = text.charAt(i); ...
java
public static String render(List<Node> nodes) { StringBuilder buf = new StringBuilder(); for (Node node : nodes) { if (node instanceof Text) { String text = ((Text) node).text; boolean inquote = false; for (int i = 0; i < text.length(); i++) { char ch = text.charAt(i); ...
[ "public", "static", "String", "render", "(", "List", "<", "Node", ">", "nodes", ")", "{", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "Node", "node", ":", "nodes", ")", "{", "if", "(", "node", "instanceof", "Text", ...
Render the compiled pattern back into string form.
[ "Render", "the", "compiled", "pattern", "back", "into", "string", "form", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/core/src/main/java/com/squarespace/cldr/parse/DateTimePatternParser.java#L59-L131
106,748
Squarespace/cldr
core/src/main/java/com/squarespace/cldr/parse/DateTimePatternParser.java
DateTimePatternParser.parse
public List<Node> parse(String raw) { // holds literal text as we parse StringBuilder buf = new StringBuilder(); // current field character, \0 if none char field = '\0'; // current field width int width = 0; // flag indicating we're inside a literal string boolean inquote = false; ...
java
public List<Node> parse(String raw) { // holds literal text as we parse StringBuilder buf = new StringBuilder(); // current field character, \0 if none char field = '\0'; // current field width int width = 0; // flag indicating we're inside a literal string boolean inquote = false; ...
[ "public", "List", "<", "Node", ">", "parse", "(", "String", "raw", ")", "{", "// holds literal text as we parse", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", ")", ";", "// current field character, \\0 if none", "char", "field", "=", "'", "'", ";", ...
Parses a CLDR date-time pattern into a series of Text and Field nodes.
[ "Parses", "a", "CLDR", "date", "-", "time", "pattern", "into", "a", "series", "of", "Text", "and", "Field", "nodes", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/core/src/main/java/com/squarespace/cldr/parse/DateTimePatternParser.java#L136-L272
106,749
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/CodeGenerator.java
CodeGenerator.generate
public static void generate(Path outputDir) throws IOException { DataReader reader = DataReader.get(); CalendarCodeGenerator datetimeGenerator = new CalendarCodeGenerator(); Map<LocaleID, ClassName> dateClasses = datetimeGenerator.generate(outputDir, reader); PluralCodeGenerator pluralGenerator = new P...
java
public static void generate(Path outputDir) throws IOException { DataReader reader = DataReader.get(); CalendarCodeGenerator datetimeGenerator = new CalendarCodeGenerator(); Map<LocaleID, ClassName> dateClasses = datetimeGenerator.generate(outputDir, reader); PluralCodeGenerator pluralGenerator = new P...
[ "public", "static", "void", "generate", "(", "Path", "outputDir", ")", "throws", "IOException", "{", "DataReader", "reader", "=", "DataReader", ".", "get", "(", ")", ";", "CalendarCodeGenerator", "datetimeGenerator", "=", "new", "CalendarCodeGenerator", "(", ")", ...
Loads all CLDR data and invokes the code generators for each data type. Output is a series of Java classes under the outputDir.
[ "Loads", "all", "CLDR", "data", "and", "invokes", "the", "code", "generators", "for", "each", "data", "type", ".", "Output", "is", "a", "series", "of", "Java", "classes", "under", "the", "outputDir", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/CodeGenerator.java#L59-L123
106,750
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/CodeGenerator.java
CodeGenerator.saveClass
public static void saveClass(Path rootDir, String packageName, String className, TypeSpec type) throws IOException { List<String> packagePath = Splitter.on('.').splitToList(packageName); Path classPath = Paths.get(rootDir.toString(), packagePath.toArray(EMPTY)); Path outputFile = classPath.resolve(cl...
java
public static void saveClass(Path rootDir, String packageName, String className, TypeSpec type) throws IOException { List<String> packagePath = Splitter.on('.').splitToList(packageName); Path classPath = Paths.get(rootDir.toString(), packagePath.toArray(EMPTY)); Path outputFile = classPath.resolve(cl...
[ "public", "static", "void", "saveClass", "(", "Path", "rootDir", ",", "String", "packageName", ",", "String", "className", ",", "TypeSpec", "type", ")", "throws", "IOException", "{", "List", "<", "String", ">", "packagePath", "=", "Splitter", ".", "on", "(",...
Saves a Java class file to a path for the given package, rooted in rootDir.
[ "Saves", "a", "Java", "class", "file", "to", "a", "path", "for", "the", "given", "package", "rooted", "in", "rootDir", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/CodeGenerator.java#L128-L144
106,751
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/CodeGenerator.java
CodeGenerator.addPluralRules
private static void addPluralRules(TypeSpec.Builder type) { FieldSpec field = FieldSpec.builder(PLURAL_RULES, "pluralRules", PRIVATE, STATIC, FINAL) .initializer("new $T()", PLURAL_RULES) .build(); MethodSpec method = MethodSpec.methodBuilder("getPluralRules") .addModifiers(PUBLIC) ...
java
private static void addPluralRules(TypeSpec.Builder type) { FieldSpec field = FieldSpec.builder(PLURAL_RULES, "pluralRules", PRIVATE, STATIC, FINAL) .initializer("new $T()", PLURAL_RULES) .build(); MethodSpec method = MethodSpec.methodBuilder("getPluralRules") .addModifiers(PUBLIC) ...
[ "private", "static", "void", "addPluralRules", "(", "TypeSpec", ".", "Builder", "type", ")", "{", "FieldSpec", "field", "=", "FieldSpec", ".", "builder", "(", "PLURAL_RULES", ",", "\"pluralRules\"", ",", "PRIVATE", ",", "STATIC", ",", "FINAL", ")", ".", "ini...
Add static instance of plural rules and accessor method.
[ "Add", "static", "instance", "of", "plural", "rules", "and", "accessor", "method", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/CodeGenerator.java#L149-L162
106,752
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/CodeGenerator.java
CodeGenerator.indexFormatters
private static MethodSpec indexFormatters( String methodName, String registerMethodName, Map<LocaleID, ClassName> dateClasses) { MethodSpec.Builder method = MethodSpec.methodBuilder(methodName) .addModifiers(PRIVATE, STATIC); for (Map.Entry<LocaleID, ClassName> entry : dateClasses.entryS...
java
private static MethodSpec indexFormatters( String methodName, String registerMethodName, Map<LocaleID, ClassName> dateClasses) { MethodSpec.Builder method = MethodSpec.methodBuilder(methodName) .addModifiers(PRIVATE, STATIC); for (Map.Entry<LocaleID, ClassName> entry : dateClasses.entryS...
[ "private", "static", "MethodSpec", "indexFormatters", "(", "String", "methodName", ",", "String", "registerMethodName", ",", "Map", "<", "LocaleID", ",", "ClassName", ">", "dateClasses", ")", "{", "MethodSpec", ".", "Builder", "method", "=", "MethodSpec", ".", "...
Generates a static code block that populates the formatter map.
[ "Generates", "a", "static", "code", "block", "that", "populates", "the", "formatter", "map", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/CodeGenerator.java#L167-L180
106,753
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/CodeGenerator.java
CodeGenerator.addLocaleField
private static void addLocaleField(TypeSpec.Builder type, String name, LocaleID locale) { FieldSpec.Builder field = FieldSpec.builder(CLDR_LOCALE_IF, name, PUBLIC, STATIC, FINAL) .initializer("new $T($S, $S, $S, $S)", META_LOCALE, strOrNull(locale.language), strOrNull(lo...
java
private static void addLocaleField(TypeSpec.Builder type, String name, LocaleID locale) { FieldSpec.Builder field = FieldSpec.builder(CLDR_LOCALE_IF, name, PUBLIC, STATIC, FINAL) .initializer("new $T($S, $S, $S, $S)", META_LOCALE, strOrNull(locale.language), strOrNull(lo...
[ "private", "static", "void", "addLocaleField", "(", "TypeSpec", ".", "Builder", "type", ",", "String", "name", ",", "LocaleID", "locale", ")", "{", "FieldSpec", ".", "Builder", "field", "=", "FieldSpec", ".", "builder", "(", "CLDR_LOCALE_IF", ",", "name", ",...
Create a public locale field.
[ "Create", "a", "public", "locale", "field", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/CodeGenerator.java#L297-L306
106,754
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/CodeGenerator.java
CodeGenerator.createLanguageAliases
private static void createLanguageAliases(TypeSpec.Builder type, Map<String, String> languageAliases) { MethodSpec.Builder method = MethodSpec.methodBuilder("registerLanguageAliases") .addModifiers(PRIVATE, STATIC); for (Map.Entry<String, String> entry : languageAliases.entrySet()) { method.a...
java
private static void createLanguageAliases(TypeSpec.Builder type, Map<String, String> languageAliases) { MethodSpec.Builder method = MethodSpec.methodBuilder("registerLanguageAliases") .addModifiers(PRIVATE, STATIC); for (Map.Entry<String, String> entry : languageAliases.entrySet()) { method.a...
[ "private", "static", "void", "createLanguageAliases", "(", "TypeSpec", ".", "Builder", "type", ",", "Map", "<", "String", ",", "String", ">", "languageAliases", ")", "{", "MethodSpec", ".", "Builder", "method", "=", "MethodSpec", ".", "methodBuilder", "(", "\"...
Create language alias mapping.
[ "Create", "language", "alias", "mapping", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/CodeGenerator.java#L311-L321
106,755
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/CodeGenerator.java
CodeGenerator.createLikelySubtags
private static void createLikelySubtags(TypeSpec.Builder type, Map<String, String> likelySubtags) { MethodSpec.Builder method = MethodSpec.methodBuilder("registerLikelySubtags") .addModifiers(PRIVATE, STATIC); for (Map.Entry<String, String> entry : likelySubtags.entrySet()) { method.addStatem...
java
private static void createLikelySubtags(TypeSpec.Builder type, Map<String, String> likelySubtags) { MethodSpec.Builder method = MethodSpec.methodBuilder("registerLikelySubtags") .addModifiers(PRIVATE, STATIC); for (Map.Entry<String, String> entry : likelySubtags.entrySet()) { method.addStatem...
[ "private", "static", "void", "createLikelySubtags", "(", "TypeSpec", ".", "Builder", "type", ",", "Map", "<", "String", ",", "String", ">", "likelySubtags", ")", "{", "MethodSpec", ".", "Builder", "method", "=", "MethodSpec", ".", "methodBuilder", "(", "\"regi...
Create likely subtags mapping.
[ "Create", "likely", "subtags", "mapping", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/CodeGenerator.java#L338-L348
106,756
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/CodeGenerator.java
CodeGenerator.createCurrencies
private static void createCurrencies(TypeSpec.Builder type, List<String> currencies) { TypeSpec.Builder currencyType = TypeSpec.enumBuilder("Currency") .addModifiers(PUBLIC, STATIC); List<String> codes = new ArrayList<>(); codes.addAll(currencies); Collections.sort(codes); StringBuilde...
java
private static void createCurrencies(TypeSpec.Builder type, List<String> currencies) { TypeSpec.Builder currencyType = TypeSpec.enumBuilder("Currency") .addModifiers(PUBLIC, STATIC); List<String> codes = new ArrayList<>(); codes.addAll(currencies); Collections.sort(codes); StringBuilde...
[ "private", "static", "void", "createCurrencies", "(", "TypeSpec", ".", "Builder", "type", ",", "List", "<", "String", ">", "currencies", ")", "{", "TypeSpec", ".", "Builder", "currencyType", "=", "TypeSpec", ".", "enumBuilder", "(", "\"Currency\"", ")", ".", ...
Create top-level container to hold currency constants.
[ "Create", "top", "-", "level", "container", "to", "hold", "currency", "constants", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/CodeGenerator.java#L357-L400
106,757
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/MessageArgsUnitParser.java
MessageArgsUnitParser.selectExactUnit
protected static Unit selectExactUnit(String compact, UnitConverter converter) { if (compact != null) { switch (compact) { case "consumption": return converter.consumptionUnit(); case "light": return Unit.LUX; case "speed": return converter.speedUnit(); ...
java
protected static Unit selectExactUnit(String compact, UnitConverter converter) { if (compact != null) { switch (compact) { case "consumption": return converter.consumptionUnit(); case "light": return Unit.LUX; case "speed": return converter.speedUnit(); ...
[ "protected", "static", "Unit", "selectExactUnit", "(", "String", "compact", ",", "UnitConverter", "converter", ")", "{", "if", "(", "compact", "!=", "null", ")", "{", "switch", "(", "compact", ")", "{", "case", "\"consumption\"", ":", "return", "converter", ...
Some categories only have a single possible unit depending the locale.
[ "Some", "categories", "only", "have", "a", "single", "possible", "unit", "depending", "the", "locale", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/MessageArgsUnitParser.java#L93-L110
106,758
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/MessageArgsUnitParser.java
MessageArgsUnitParser.inputFromExactUnit
protected static Unit inputFromExactUnit(Unit exact, UnitConverter converter) { switch (exact) { case TERABIT: case GIGABIT: case MEGABIT: case KILOBIT: case BIT: return Unit.BIT; case TERABYTE: case GIGABYTE: case MEGABYTE: case KILOBYTE: case BY...
java
protected static Unit inputFromExactUnit(Unit exact, UnitConverter converter) { switch (exact) { case TERABIT: case GIGABIT: case MEGABIT: case KILOBIT: case BIT: return Unit.BIT; case TERABYTE: case GIGABYTE: case MEGABYTE: case KILOBYTE: case BY...
[ "protected", "static", "Unit", "inputFromExactUnit", "(", "Unit", "exact", ",", "UnitConverter", "converter", ")", "{", "switch", "(", "exact", ")", "{", "case", "TERABIT", ":", "case", "GIGABIT", ":", "case", "MEGABIT", ":", "case", "KILOBIT", ":", "case", ...
Based on the unit we're converting to, guess the input unit. For example, if we're converting to MEGABIT and no input unit was specified, assume BIT.
[ "Based", "on", "the", "unit", "we", "re", "converting", "to", "guess", "the", "input", "unit", ".", "For", "example", "if", "we", "re", "converting", "to", "MEGABIT", "and", "no", "input", "unit", "was", "specified", "assume", "BIT", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/MessageArgsUnitParser.java#L164-L209
106,759
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/MessageArgsUnitParser.java
MessageArgsUnitParser.getDefaultFactorSet
protected static UnitFactorSet getDefaultFactorSet(UnitCategory category, UnitConverter converter) { switch (category) { case ANGLE: return UnitFactorSets.ANGLE; case AREA: return converter.areaFactors(); case DURATION: return UnitFactorSets.DURATION; case ELECTRIC: ...
java
protected static UnitFactorSet getDefaultFactorSet(UnitCategory category, UnitConverter converter) { switch (category) { case ANGLE: return UnitFactorSets.ANGLE; case AREA: return converter.areaFactors(); case DURATION: return UnitFactorSets.DURATION; case ELECTRIC: ...
[ "protected", "static", "UnitFactorSet", "getDefaultFactorSet", "(", "UnitCategory", "category", ",", "UnitConverter", "converter", ")", "{", "switch", "(", "category", ")", "{", "case", "ANGLE", ":", "return", "UnitFactorSets", ".", "ANGLE", ";", "case", "AREA", ...
Default conversion factors for each category. Some of these differ based on the locale of the converter.
[ "Default", "conversion", "factors", "for", "each", "category", ".", "Some", "of", "these", "differ", "based", "on", "the", "locale", "of", "the", "converter", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/MessageArgsUnitParser.java#L215-L241
106,760
Squarespace/cldr
core/src/main/java/com/squarespace/cldr/numbers/NumberPattern.java
NumberPattern.render
public String render() { StringBuilder buf = new StringBuilder(); for (Node node : parsed) { if (node instanceof Symbol) { switch ((Symbol)node) { case MINUS: buf.append('-'); break; case CURRENCY: buf.append(CURRENCY_SYM); break...
java
public String render() { StringBuilder buf = new StringBuilder(); for (Node node : parsed) { if (node instanceof Symbol) { switch ((Symbol)node) { case MINUS: buf.append('-'); break; case CURRENCY: buf.append(CURRENCY_SYM); break...
[ "public", "String", "render", "(", ")", "{", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "Node", "node", ":", "parsed", ")", "{", "if", "(", "node", "instanceof", "Symbol", ")", "{", "switch", "(", "(", "Symbol", "...
Render a parseable representation of this pattern.
[ "Render", "a", "parseable", "representation", "of", "this", "pattern", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/core/src/main/java/com/squarespace/cldr/numbers/NumberPattern.java#L38-L81
106,761
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/BundleMatcher.java
BundleMatcher.dump
public String dump() { StringBuilder buf = new StringBuilder(); buf.append(" LOCALE MATCHED BUNDLE\n"); buf.append(" ====== ==============\n"); List<MetaLocale> keys = availableBundlesMap.keySet().stream() .map(k -> (MetaLocale)k).collect(Collectors.toList());...
java
public String dump() { StringBuilder buf = new StringBuilder(); buf.append(" LOCALE MATCHED BUNDLE\n"); buf.append(" ====== ==============\n"); List<MetaLocale> keys = availableBundlesMap.keySet().stream() .map(k -> (MetaLocale)k).collect(Collectors.toList());...
[ "public", "String", "dump", "(", ")", "{", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", ")", ";", "buf", ".", "append", "(", "\" LOCALE MATCHED BUNDLE\\n\"", ")", ";", "buf", ".", "append", "(", "\" ====== ===========...
Inspect the mapping between permutations of locale fields and bundle identifiers.
[ "Inspect", "the", "mapping", "between", "permutations", "of", "locale", "fields", "and", "bundle", "identifiers", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/BundleMatcher.java#L80-L91
106,762
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/BundleMatcher.java
BundleMatcher.buildMap
private void buildMap(List<CLDR.Locale> availableBundles) { // Index all bundles by their original bundle identifier and the maximum // bundle identifier. List<MetaLocale> maxBundleIds = new ArrayList<>(); for (CLDR.Locale locale : availableBundles) { MetaLocale source = (MetaLocale) locale; ...
java
private void buildMap(List<CLDR.Locale> availableBundles) { // Index all bundles by their original bundle identifier and the maximum // bundle identifier. List<MetaLocale> maxBundleIds = new ArrayList<>(); for (CLDR.Locale locale : availableBundles) { MetaLocale source = (MetaLocale) locale; ...
[ "private", "void", "buildMap", "(", "List", "<", "CLDR", ".", "Locale", ">", "availableBundles", ")", "{", "// Index all bundles by their original bundle identifier and the maximum", "// bundle identifier.", "List", "<", "MetaLocale", ">", "maxBundleIds", "=", "new", "Arr...
Iterate over the available bundle identifiers, expand them and index all permutations to enable a fast direct lookup.
[ "Iterate", "over", "the", "available", "bundle", "identifiers", "expand", "them", "and", "index", "all", "permutations", "to", "enable", "a", "fast", "direct", "lookup", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/BundleMatcher.java#L97-L120
106,763
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/BundleMatcher.java
BundleMatcher.indexPermutations
private void indexPermutations(MetaLocale bundleId) { MetaLocale key = bundleId.copy(); for (int flags : LanguageResolver.MATCH_ORDER) { LanguageResolver.set(bundleId, key, flags); MetaLocale maxBundleId = languageResolver.addLikelySubtags(key); MetaLocale source = availableBundlesMap.get(maxB...
java
private void indexPermutations(MetaLocale bundleId) { MetaLocale key = bundleId.copy(); for (int flags : LanguageResolver.MATCH_ORDER) { LanguageResolver.set(bundleId, key, flags); MetaLocale maxBundleId = languageResolver.addLikelySubtags(key); MetaLocale source = availableBundlesMap.get(maxB...
[ "private", "void", "indexPermutations", "(", "MetaLocale", "bundleId", ")", "{", "MetaLocale", "key", "=", "bundleId", ".", "copy", "(", ")", ";", "for", "(", "int", "flags", ":", "LanguageResolver", ".", "MATCH_ORDER", ")", "{", "LanguageResolver", ".", "se...
Index permutations of the given bundle identifier. We iterate over the field permutations and expand each to the maximum bundle identifier, then query to see if that max bundle identifier matches a bundle. Then we index the permutation to that bundle. This creates a static mapping mimicking a dynamic lookup.
[ "Index", "permutations", "of", "the", "given", "bundle", "identifier", ".", "We", "iterate", "over", "the", "field", "permutations", "and", "expand", "each", "to", "the", "maximum", "bundle", "identifier", "then", "query", "to", "see", "if", "that", "max", "...
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/BundleMatcher.java#L128-L144
106,764
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java
CalendarCodeGenerator.generate
public Map<LocaleID, ClassName> generate(Path outputDir, DataReader reader) throws IOException { Map<LocaleID, ClassName> dateClasses = new TreeMap<>(); List<DateTimeData> dateTimeDataList = new ArrayList<>(); for (Map.Entry<LocaleID, DateTimeData> entry : reader.calendars().entrySet()) { Date...
java
public Map<LocaleID, ClassName> generate(Path outputDir, DataReader reader) throws IOException { Map<LocaleID, ClassName> dateClasses = new TreeMap<>(); List<DateTimeData> dateTimeDataList = new ArrayList<>(); for (Map.Entry<LocaleID, DateTimeData> entry : reader.calendars().entrySet()) { Date...
[ "public", "Map", "<", "LocaleID", ",", "ClassName", ">", "generate", "(", "Path", "outputDir", ",", "DataReader", "reader", ")", "throws", "IOException", "{", "Map", "<", "LocaleID", ",", "ClassName", ">", "dateClasses", "=", "new", "TreeMap", "<>", "(", "...
Generates the date-time classes into the given output directory.
[ "Generates", "the", "date", "-", "time", "classes", "into", "the", "given", "output", "directory", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java#L75-L108
106,765
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java
CalendarCodeGenerator.addSkeletonClassifierMethod
private void addSkeletonClassifierMethod(TypeSpec.Builder type, List<DateTimeData> dataList) { Set<String> dates = new LinkedHashSet<>(); Set<String> times = new LinkedHashSet<>(); for (DateTimeData data : dataList) { for (Skeleton skeleton : data.dateTimeSkeletons) { if (isDateSkeleton(skelet...
java
private void addSkeletonClassifierMethod(TypeSpec.Builder type, List<DateTimeData> dataList) { Set<String> dates = new LinkedHashSet<>(); Set<String> times = new LinkedHashSet<>(); for (DateTimeData data : dataList) { for (Skeleton skeleton : data.dateTimeSkeletons) { if (isDateSkeleton(skelet...
[ "private", "void", "addSkeletonClassifierMethod", "(", "TypeSpec", ".", "Builder", "type", ",", "List", "<", "DateTimeData", ">", "dataList", ")", "{", "Set", "<", "String", ">", "dates", "=", "new", "LinkedHashSet", "<>", "(", ")", ";", "Set", "<", "Strin...
Create a helper class to classify skeletons as either DATE or TIME.
[ "Create", "a", "helper", "class", "to", "classify", "skeletons", "as", "either", "DATE", "or", "TIME", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java#L113-L128
106,766
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java
CalendarCodeGenerator.addMetaZones
private void addMetaZones(TypeSpec.Builder type, Map<String, MetaZone> metazones) { ClassName metazoneType = ClassName.get(Types.PACKAGE_CLDR_DATES, "MetaZone"); TypeName mapType = ParameterizedTypeName.get(MAP, STRING, metazoneType); FieldSpec.Builder field = FieldSpec.builder(mapType, "metazones", PROTECT...
java
private void addMetaZones(TypeSpec.Builder type, Map<String, MetaZone> metazones) { ClassName metazoneType = ClassName.get(Types.PACKAGE_CLDR_DATES, "MetaZone"); TypeName mapType = ParameterizedTypeName.get(MAP, STRING, metazoneType); FieldSpec.Builder field = FieldSpec.builder(mapType, "metazones", PROTECT...
[ "private", "void", "addMetaZones", "(", "TypeSpec", ".", "Builder", "type", ",", "Map", "<", "String", ",", "MetaZone", ">", "metazones", ")", "{", "ClassName", "metazoneType", "=", "ClassName", ".", "get", "(", "Types", ".", "PACKAGE_CLDR_DATES", ",", "\"Me...
Populate the metaZone mapping.
[ "Populate", "the", "metaZone", "mapping", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java#L133-L181
106,767
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java
CalendarCodeGenerator.buildTimeZoneAliases
private void buildTimeZoneAliases(TypeSpec.Builder type, Map<String, String> map) { MethodSpec.Builder method = MethodSpec.methodBuilder("getTimeZoneAlias") .addModifiers(PUBLIC, STATIC) .addParameter(String.class, "zoneId") .returns(String.class); method.beginControlFlow("switch (zoneI...
java
private void buildTimeZoneAliases(TypeSpec.Builder type, Map<String, String> map) { MethodSpec.Builder method = MethodSpec.methodBuilder("getTimeZoneAlias") .addModifiers(PUBLIC, STATIC) .addParameter(String.class, "zoneId") .returns(String.class); method.beginControlFlow("switch (zoneI...
[ "private", "void", "buildTimeZoneAliases", "(", "TypeSpec", ".", "Builder", "type", ",", "Map", "<", "String", ",", "String", ">", "map", ")", "{", "MethodSpec", ".", "Builder", "method", "=", "MethodSpec", ".", "methodBuilder", "(", "\"getTimeZoneAlias\"", ")...
Creates a switch table to resolve a retired time zone to a valid one.
[ "Creates", "a", "switch", "table", "to", "resolve", "a", "retired", "time", "zone", "to", "a", "valid", "one", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java#L186-L199
106,768
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java
CalendarCodeGenerator.createFormatter
private TypeSpec createFormatter(DateTimeData dateTimeData, TimeZoneData timeZoneData, String className) { LocaleID id = dateTimeData.id; MethodSpec.Builder constructor = MethodSpec.constructorBuilder() .addModifiers(PUBLIC); constructor.addStatement("this.bundleId = $T.$L", CLDR_LOCALE_IF, id.saf...
java
private TypeSpec createFormatter(DateTimeData dateTimeData, TimeZoneData timeZoneData, String className) { LocaleID id = dateTimeData.id; MethodSpec.Builder constructor = MethodSpec.constructorBuilder() .addModifiers(PUBLIC); constructor.addStatement("this.bundleId = $T.$L", CLDR_LOCALE_IF, id.saf...
[ "private", "TypeSpec", "createFormatter", "(", "DateTimeData", "dateTimeData", ",", "TimeZoneData", "timeZoneData", ",", "String", "className", ")", "{", "LocaleID", "id", "=", "dateTimeData", ".", "id", ";", "MethodSpec", ".", "Builder", "constructor", "=", "Meth...
Create a Java class that captures all data formats for a given locale.
[ "Create", "a", "Java", "class", "that", "captures", "all", "data", "formats", "for", "a", "given", "locale", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java#L204-L253
106,769
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java
CalendarCodeGenerator.addTypedPattern
private void addTypedPattern(MethodSpec.Builder method, String formatType, String pattern) { method.beginControlFlow("case $L:", formatType); method.addComment("$S", pattern); addPattern(method, pattern); method.addStatement("break"); method.endControlFlow(); }
java
private void addTypedPattern(MethodSpec.Builder method, String formatType, String pattern) { method.beginControlFlow("case $L:", formatType); method.addComment("$S", pattern); addPattern(method, pattern); method.addStatement("break"); method.endControlFlow(); }
[ "private", "void", "addTypedPattern", "(", "MethodSpec", ".", "Builder", "method", ",", "String", "formatType", ",", "String", "pattern", ")", "{", "method", ".", "beginControlFlow", "(", "\"case $L:\"", ",", "formatType", ")", ";", "method", ".", "addComment", ...
Adds the pattern builder statements for a typed pattern.
[ "Adds", "the", "pattern", "builder", "statements", "for", "a", "typed", "pattern", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java#L285-L291
106,770
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java
CalendarCodeGenerator.addPattern
private void addPattern(MethodSpec.Builder method, String pattern) { // Parse the pattern and populate the method body with instructions to format the date. for (Node node : DATETIME_PARSER.parse(pattern)) { if (node instanceof Text) { method.addStatement("b.append($S)", ((Text)node).text()); ...
java
private void addPattern(MethodSpec.Builder method, String pattern) { // Parse the pattern and populate the method body with instructions to format the date. for (Node node : DATETIME_PARSER.parse(pattern)) { if (node instanceof Text) { method.addStatement("b.append($S)", ((Text)node).text()); ...
[ "private", "void", "addPattern", "(", "MethodSpec", ".", "Builder", "method", ",", "String", "pattern", ")", "{", "// Parse the pattern and populate the method body with instructions to format the date.", "for", "(", "Node", "node", ":", "DATETIME_PARSER", ".", "parse", "...
Add a named date-time pattern, adding statements to the formatting and indexing methods. Returns true if the pattern corresponds to a date; false if a time.
[ "Add", "a", "named", "date", "-", "time", "pattern", "adding", "statements", "to", "the", "formatting", "and", "indexing", "methods", ".", "Returns", "true", "if", "the", "pattern", "corresponds", "to", "a", "date", ";", "false", "if", "a", "time", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java#L297-L307
106,771
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java
CalendarCodeGenerator.buildSkeletonFormatter
private MethodSpec buildSkeletonFormatter(List<Skeleton> skeletons) { MethodSpec.Builder method = MethodSpec.methodBuilder("formatSkeleton") .addAnnotation(Override.class) .addModifiers(PUBLIC) .addParameter(String.class, "skeleton") .addParameter(ZonedDateTime.class, "d") .a...
java
private MethodSpec buildSkeletonFormatter(List<Skeleton> skeletons) { MethodSpec.Builder method = MethodSpec.methodBuilder("formatSkeleton") .addAnnotation(Override.class) .addModifiers(PUBLIC) .addParameter(String.class, "skeleton") .addParameter(ZonedDateTime.class, "d") .a...
[ "private", "MethodSpec", "buildSkeletonFormatter", "(", "List", "<", "Skeleton", ">", "skeletons", ")", "{", "MethodSpec", ".", "Builder", "method", "=", "MethodSpec", ".", "methodBuilder", "(", "\"formatSkeleton\"", ")", ".", "addAnnotation", "(", "Override", "."...
Implements the formatSkeleton method.
[ "Implements", "the", "formatSkeleton", "method", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java#L377-L411
106,772
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java
CalendarCodeGenerator.buildIntervalMethod
private MethodSpec buildIntervalMethod(Map<String, Map<String, String>> intervalFormats, String fallback) { MethodSpec.Builder method = MethodSpec.methodBuilder("formatInterval") .addAnnotation(Override.class) .addModifiers(PUBLIC) .addParameter(ZonedDateTime.class, "s") .addParamete...
java
private MethodSpec buildIntervalMethod(Map<String, Map<String, String>> intervalFormats, String fallback) { MethodSpec.Builder method = MethodSpec.methodBuilder("formatInterval") .addAnnotation(Override.class) .addModifiers(PUBLIC) .addParameter(ZonedDateTime.class, "s") .addParamete...
[ "private", "MethodSpec", "buildIntervalMethod", "(", "Map", "<", "String", ",", "Map", "<", "String", ",", "String", ">", ">", "intervalFormats", ",", "String", "fallback", ")", "{", "MethodSpec", ".", "Builder", "method", "=", "MethodSpec", ".", "methodBuilde...
Build methods to format date time intervals using the field of greatest difference.
[ "Build", "methods", "to", "format", "date", "time", "intervals", "using", "the", "field", "of", "greatest", "difference", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java#L416-L474
106,773
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java
CalendarCodeGenerator.addIntervalPattern
private void addIntervalPattern(MethodSpec.Builder method, List<Node> pattern, String which) { for (Node node : pattern) { if (node instanceof Text) { method.addStatement("b.append($S)", ((Text)node).text()); } else if (node instanceof Field) { Field field = (Field)node; method.a...
java
private void addIntervalPattern(MethodSpec.Builder method, List<Node> pattern, String which) { for (Node node : pattern) { if (node instanceof Text) { method.addStatement("b.append($S)", ((Text)node).text()); } else if (node instanceof Field) { Field field = (Field)node; method.a...
[ "private", "void", "addIntervalPattern", "(", "MethodSpec", ".", "Builder", "method", ",", "List", "<", "Node", ">", "pattern", ",", "String", "which", ")", "{", "for", "(", "Node", "node", ":", "pattern", ")", "{", "if", "(", "node", "instanceof", "Text...
Adds code to format a date time interval pattern, which may be the start or end date time, signified by the 'which' parameter.
[ "Adds", "code", "to", "format", "a", "date", "time", "interval", "pattern", "which", "may", "be", "the", "start", "or", "end", "date", "time", "signified", "by", "the", "which", "parameter", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java#L480-L489
106,774
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java
CalendarCodeGenerator.addIntervalFallback
private void addIntervalFallback(MethodSpec.Builder method, String pattern) { method.addComment("$S", pattern); for (Node node : WRAPPER_PARSER.parseWrapper(pattern)) { if (node instanceof Text) { method.addStatement("b.append($S)", ((Text)node).text()); } else if (node instanceof Field) { ...
java
private void addIntervalFallback(MethodSpec.Builder method, String pattern) { method.addComment("$S", pattern); for (Node node : WRAPPER_PARSER.parseWrapper(pattern)) { if (node instanceof Text) { method.addStatement("b.append($S)", ((Text)node).text()); } else if (node instanceof Field) { ...
[ "private", "void", "addIntervalFallback", "(", "MethodSpec", ".", "Builder", "method", ",", "String", "pattern", ")", "{", "method", ".", "addComment", "(", "\"$S\"", ",", "pattern", ")", ";", "for", "(", "Node", "node", ":", "WRAPPER_PARSER", ".", "parseWra...
Adds code to render the fallback pattern.
[ "Adds", "code", "to", "render", "the", "fallback", "pattern", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java#L494-L509
106,775
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java
CalendarCodeGenerator.isDateSkeleton
private boolean isDateSkeleton(String skeleton) { List<String> parts = Splitter.on('-').splitToList(skeleton); if (parts.size() > 1) { skeleton = parts.get(0); } for (Node node : DATETIME_PARSER.parse(skeleton)) { if (node instanceof Field) { Field field = (Field) node; switc...
java
private boolean isDateSkeleton(String skeleton) { List<String> parts = Splitter.on('-').splitToList(skeleton); if (parts.size() > 1) { skeleton = parts.get(0); } for (Node node : DATETIME_PARSER.parse(skeleton)) { if (node instanceof Field) { Field field = (Field) node; switc...
[ "private", "boolean", "isDateSkeleton", "(", "String", "skeleton", ")", "{", "List", "<", "String", ">", "parts", "=", "Splitter", ".", "on", "(", "'", "'", ")", ".", "splitToList", "(", "skeleton", ")", ";", "if", "(", "parts", ".", "size", "(", ")"...
Indicates a skeleton represents a date based on the fields it contains. Any time-related field will cause this to return false.
[ "Indicates", "a", "skeleton", "represents", "a", "date", "based", "on", "the", "fields", "it", "contains", ".", "Any", "time", "-", "related", "field", "will", "cause", "this", "to", "return", "false", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java#L515-L533
106,776
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java
CalendarCodeGenerator.buildSkeletonType
private MethodSpec.Builder buildSkeletonType(Set<String> dateSkeletons, Set<String> timeSkeletons) { MethodSpec.Builder method = MethodSpec.methodBuilder("skeletonType") .addJavadoc("Indicates whether a given skeleton pattern is a DATE or TIME.\n") .addModifiers(PUBLIC, STATIC) .addParameter...
java
private MethodSpec.Builder buildSkeletonType(Set<String> dateSkeletons, Set<String> timeSkeletons) { MethodSpec.Builder method = MethodSpec.methodBuilder("skeletonType") .addJavadoc("Indicates whether a given skeleton pattern is a DATE or TIME.\n") .addModifiers(PUBLIC, STATIC) .addParameter...
[ "private", "MethodSpec", ".", "Builder", "buildSkeletonType", "(", "Set", "<", "String", ">", "dateSkeletons", ",", "Set", "<", "String", ">", "timeSkeletons", ")", "{", "MethodSpec", ".", "Builder", "method", "=", "MethodSpec", ".", "methodBuilder", "(", "\"s...
Constructs a method to indicate if the skeleton is a DATE or TIME, or null if unsupported.
[ "Constructs", "a", "method", "to", "indicate", "if", "the", "skeleton", "is", "a", "DATE", "or", "TIME", "or", "null", "if", "unsupported", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java#L538-L562
106,777
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java
CalendarCodeGenerator.variantsFieldInit
private void variantsFieldInit(MethodSpec.Builder method, String fieldName, Variants v) { Stmt b = new Stmt(); b.append("$L = new $T(", fieldName, FIELD_VARIANTS); b.append("\n ").append(v.abbreviated).comma(); b.append("\n ").append(v.narrow).comma(); b.append("\n ").append(v.short_).comma(); ...
java
private void variantsFieldInit(MethodSpec.Builder method, String fieldName, Variants v) { Stmt b = new Stmt(); b.append("$L = new $T(", fieldName, FIELD_VARIANTS); b.append("\n ").append(v.abbreviated).comma(); b.append("\n ").append(v.narrow).comma(); b.append("\n ").append(v.short_).comma(); ...
[ "private", "void", "variantsFieldInit", "(", "MethodSpec", ".", "Builder", "method", ",", "String", "fieldName", ",", "Variants", "v", ")", "{", "Stmt", "b", "=", "new", "Stmt", "(", ")", ";", "b", ".", "append", "(", "\"$L = new $T(\"", ",", "fieldName", ...
Appends a statement that initializes a FieldVariants field in the superclass.
[ "Appends", "a", "statement", "that", "initializes", "a", "FieldVariants", "field", "in", "the", "superclass", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java#L567-L576
106,778
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java
CalendarCodeGenerator.buildTimeZoneExemplarCities
private void buildTimeZoneExemplarCities(MethodSpec.Builder method, TimeZoneData data) { CodeBlock.Builder code = CodeBlock.builder(); code.beginControlFlow("this.exemplarCities = new $T<$T, $T>() {", HashMap.class, String.class, String.class); for (TimeZoneInfo info : data.timeZoneInfo) { code.addSta...
java
private void buildTimeZoneExemplarCities(MethodSpec.Builder method, TimeZoneData data) { CodeBlock.Builder code = CodeBlock.builder(); code.beginControlFlow("this.exemplarCities = new $T<$T, $T>() {", HashMap.class, String.class, String.class); for (TimeZoneInfo info : data.timeZoneInfo) { code.addSta...
[ "private", "void", "buildTimeZoneExemplarCities", "(", "MethodSpec", ".", "Builder", "method", ",", "TimeZoneData", "data", ")", "{", "CodeBlock", ".", "Builder", "code", "=", "CodeBlock", ".", "builder", "(", ")", ";", "code", ".", "beginControlFlow", "(", "\...
Mapping locale identifiers to their localized exemplar cities.
[ "Mapping", "locale", "identifiers", "to", "their", "localized", "exemplar", "cities", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java#L581-L589
106,779
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java
CalendarCodeGenerator.buildMetaZoneNames
private void buildMetaZoneNames(MethodSpec.Builder method, TimeZoneData data) { CodeBlock.Builder code = CodeBlock.builder(); code.beginControlFlow("\nthis.$L = new $T<$T, $T>() {", "metazoneNames", HASHMAP, STRING, TIMEZONE_NAMES); for (MetaZoneInfo info : data.metaZoneInfo) { if (info....
java
private void buildMetaZoneNames(MethodSpec.Builder method, TimeZoneData data) { CodeBlock.Builder code = CodeBlock.builder(); code.beginControlFlow("\nthis.$L = new $T<$T, $T>() {", "metazoneNames", HASHMAP, STRING, TIMEZONE_NAMES); for (MetaZoneInfo info : data.metaZoneInfo) { if (info....
[ "private", "void", "buildMetaZoneNames", "(", "MethodSpec", ".", "Builder", "method", ",", "TimeZoneData", "data", ")", "{", "CodeBlock", ".", "Builder", "code", "=", "CodeBlock", ".", "builder", "(", ")", ";", "code", ".", "beginControlFlow", "(", "\"\\nthis....
Builds localized metazone name mapping.
[ "Builds", "localized", "metazone", "name", "mapping", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java#L625-L651
106,780
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java
CalendarCodeGenerator.buildWrapTimeZoneGMTMethod
private MethodSpec buildWrapTimeZoneGMTMethod(TimeZoneData data) { String[] hourFormat = data.hourFormat.split(";"); List<Node> positive = DATETIME_PARSER.parse(hourFormat[0]); List<Node> negative = DATETIME_PARSER.parse(hourFormat[1]); List<Node> format = WRAPPER_PARSER.parseWrapper(data.gmtFormat); ...
java
private MethodSpec buildWrapTimeZoneGMTMethod(TimeZoneData data) { String[] hourFormat = data.hourFormat.split(";"); List<Node> positive = DATETIME_PARSER.parse(hourFormat[0]); List<Node> negative = DATETIME_PARSER.parse(hourFormat[1]); List<Node> format = WRAPPER_PARSER.parseWrapper(data.gmtFormat); ...
[ "private", "MethodSpec", "buildWrapTimeZoneGMTMethod", "(", "TimeZoneData", "data", ")", "{", "String", "[", "]", "hourFormat", "=", "data", ".", "hourFormat", ".", "split", "(", "\";\"", ")", ";", "List", "<", "Node", ">", "positive", "=", "DATETIME_PARSER", ...
Builds a method to format the timezone as hourFormat with a GMT wrapper.
[ "Builds", "a", "method", "to", "format", "the", "timezone", "as", "hourFormat", "with", "a", "GMT", "wrapper", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java#L656-L692
106,781
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java
CalendarCodeGenerator.buildWrapTimeZoneRegionMethod
private MethodSpec buildWrapTimeZoneRegionMethod(TimeZoneData data) { MethodSpec.Builder method = MethodSpec.methodBuilder("wrapTimeZoneRegion") .addModifiers(PROTECTED) .addParameter(StringBuilder.class, "b") .addParameter(String.class, "region"); List<Node> format = WRAPPER_PA...
java
private MethodSpec buildWrapTimeZoneRegionMethod(TimeZoneData data) { MethodSpec.Builder method = MethodSpec.methodBuilder("wrapTimeZoneRegion") .addModifiers(PROTECTED) .addParameter(StringBuilder.class, "b") .addParameter(String.class, "region"); List<Node> format = WRAPPER_PA...
[ "private", "MethodSpec", "buildWrapTimeZoneRegionMethod", "(", "TimeZoneData", "data", ")", "{", "MethodSpec", ".", "Builder", "method", "=", "MethodSpec", ".", "methodBuilder", "(", "\"wrapTimeZoneRegion\"", ")", ".", "addModifiers", "(", "PROTECTED", ")", ".", "ad...
Build a method to wrap a region in the regionFormat.
[ "Build", "a", "method", "to", "wrap", "a", "region", "in", "the", "regionFormat", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java#L697-L715
106,782
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java
CalendarCodeGenerator.appendHourFormat
private void appendHourFormat(MethodSpec.Builder method, List<Node> fmt) { for (Node n : fmt) { if (n instanceof Text) { String t = ((Text)n).text(); boolean minute = t.equals(":") || t.equals("."); if (minute) { method.beginControlFlow("if (emitMins)"); } met...
java
private void appendHourFormat(MethodSpec.Builder method, List<Node> fmt) { for (Node n : fmt) { if (n instanceof Text) { String t = ((Text)n).text(); boolean minute = t.equals(":") || t.equals("."); if (minute) { method.beginControlFlow("if (emitMins)"); } met...
[ "private", "void", "appendHourFormat", "(", "MethodSpec", ".", "Builder", "method", ",", "List", "<", "Node", ">", "fmt", ")", "{", "for", "(", "Node", "n", ":", "fmt", ")", "{", "if", "(", "n", "instanceof", "Text", ")", "{", "String", "t", "=", "...
Appends code to emit the hourFormat for positive or negative.
[ "Appends", "code", "to", "emit", "the", "hourFormat", "for", "positive", "or", "negative", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java#L720-L747
106,783
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java
CalendarCodeGenerator.deduplicateFormats
public static Map<String, List<String>> deduplicateFormats(Format format) { Map<String, List<String>> res = new LinkedHashMap<>(); mapAdd(res, format.short_, "SHORT"); mapAdd(res, format.medium, "MEDIUM"); mapAdd(res, format.long_, "LONG"); mapAdd(res, format.full, "FULL"); return res; }
java
public static Map<String, List<String>> deduplicateFormats(Format format) { Map<String, List<String>> res = new LinkedHashMap<>(); mapAdd(res, format.short_, "SHORT"); mapAdd(res, format.medium, "MEDIUM"); mapAdd(res, format.long_, "LONG"); mapAdd(res, format.full, "FULL"); return res; }
[ "public", "static", "Map", "<", "String", ",", "List", "<", "String", ">", ">", "deduplicateFormats", "(", "Format", "format", ")", "{", "Map", "<", "String", ",", "List", "<", "String", ">", ">", "res", "=", "new", "LinkedHashMap", "<>", "(", ")", "...
De-duplication of formats.
[ "De", "-", "duplication", "of", "formats", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java#L753-L760
106,784
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/Utils.java
Utils.listResources
public static List<Path> listResources(String ...prefixes) throws IOException { List<Path> result = new ArrayList<>(); ClassPath classPath = ClassPath.from(Utils.class.getClassLoader()); for (ResourceInfo info : classPath.getResources()) { String path = info.getResourceName(); for (String prefix...
java
public static List<Path> listResources(String ...prefixes) throws IOException { List<Path> result = new ArrayList<>(); ClassPath classPath = ClassPath.from(Utils.class.getClassLoader()); for (ResourceInfo info : classPath.getResources()) { String path = info.getResourceName(); for (String prefix...
[ "public", "static", "List", "<", "Path", ">", "listResources", "(", "String", "...", "prefixes", ")", "throws", "IOException", "{", "List", "<", "Path", ">", "result", "=", "new", "ArrayList", "<>", "(", ")", ";", "ClassPath", "classPath", "=", "ClassPath"...
Recursively list all resources under the given path prefixes.
[ "Recursively", "list", "all", "resources", "under", "the", "given", "path", "prefixes", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/Utils.java#L21-L33
106,785
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/Utils.java
Utils.findChild
public static Node<PluralType> findChild(Struct<PluralType> parent, PluralType type) { for (Node<PluralType> n : parent.nodes()) { if (n.type() == type) { return n; } } return null; }
java
public static Node<PluralType> findChild(Struct<PluralType> parent, PluralType type) { for (Node<PluralType> n : parent.nodes()) { if (n.type() == type) { return n; } } return null; }
[ "public", "static", "Node", "<", "PluralType", ">", "findChild", "(", "Struct", "<", "PluralType", ">", "parent", ",", "PluralType", "type", ")", "{", "for", "(", "Node", "<", "PluralType", ">", "n", ":", "parent", ".", "nodes", "(", ")", ")", "{", "...
Find a child node of a given type in a parent struct, or return null.
[ "Find", "a", "child", "node", "of", "a", "given", "type", "in", "a", "parent", "struct", "or", "return", "null", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/Utils.java#L38-L45
106,786
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/parse/PluralRuleGrammar.java
PluralRuleGrammar.parse
public static Maybe<Pair<Node<PluralType>, CharSequence>> parse(String input) { return P_RULE.parse(input); }
java
public static Maybe<Pair<Node<PluralType>, CharSequence>> parse(String input) { return P_RULE.parse(input); }
[ "public", "static", "Maybe", "<", "Pair", "<", "Node", "<", "PluralType", ">", ",", "CharSequence", ">", ">", "parse", "(", "String", "input", ")", "{", "return", "P_RULE", ".", "parse", "(", "input", ")", ";", "}" ]
Parse a plural rule into an abstract syntax tree.
[ "Parse", "a", "plural", "rule", "into", "an", "abstract", "syntax", "tree", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/parse/PluralRuleGrammar.java#L107-L109
106,787
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/units/UnitConverters.java
UnitConverters.get
public static UnitConverter get(CLDR.Locale locale) { MeasurementSystem system = MeasurementSystem.fromLocale(locale); return SYSTEMS.getOrDefault(system, METRIC_SYSTEM); }
java
public static UnitConverter get(CLDR.Locale locale) { MeasurementSystem system = MeasurementSystem.fromLocale(locale); return SYSTEMS.getOrDefault(system, METRIC_SYSTEM); }
[ "public", "static", "UnitConverter", "get", "(", "CLDR", ".", "Locale", "locale", ")", "{", "MeasurementSystem", "system", "=", "MeasurementSystem", ".", "fromLocale", "(", "locale", ")", ";", "return", "SYSTEMS", ".", "getOrDefault", "(", "system", ",", "METR...
Retrieves the correct measurement system for a given locale.
[ "Retrieves", "the", "correct", "measurement", "system", "for", "a", "given", "locale", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/units/UnitConverters.java#L20-L23
106,788
Squarespace/cldr
core/src/main/java/com/squarespace/cldr/numbers/NumberFormatOptions.java
NumberFormatOptions.reset
public void reset() { this.formatMode = null; this.roundMode = NumberRoundMode.ROUND; this.grouping = null; this.minimumIntegerDigits = null; this.maximumFractionDigits = null; this.minimumFractionDigits = null; this.maximumSignificantDigits = null; this.minimumSignificantDigits = null; ...
java
public void reset() { this.formatMode = null; this.roundMode = NumberRoundMode.ROUND; this.grouping = null; this.minimumIntegerDigits = null; this.maximumFractionDigits = null; this.minimumFractionDigits = null; this.maximumSignificantDigits = null; this.minimumSignificantDigits = null; ...
[ "public", "void", "reset", "(", ")", "{", "this", ".", "formatMode", "=", "null", ";", "this", ".", "roundMode", "=", "NumberRoundMode", ".", "ROUND", ";", "this", ".", "grouping", "=", "null", ";", "this", ".", "minimumIntegerDigits", "=", "null", ";", ...
Reset the options to their defaults.
[ "Reset", "the", "options", "to", "their", "defaults", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/core/src/main/java/com/squarespace/cldr/numbers/NumberFormatOptions.java#L26-L35
106,789
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/MessageFormat.java
MessageFormat.setFormat
public void setFormat(String format) { this.format = format; // Track multiple streams over the format string. Scanner scanner = new Scanner(format); this.streams[0] = scanner.stream(); this.streams[1] = scanner.stream(); for (int i = 2; i < this.streams.length; i++) { this.streams[i] = n...
java
public void setFormat(String format) { this.format = format; // Track multiple streams over the format string. Scanner scanner = new Scanner(format); this.streams[0] = scanner.stream(); this.streams[1] = scanner.stream(); for (int i = 2; i < this.streams.length; i++) { this.streams[i] = n...
[ "public", "void", "setFormat", "(", "String", "format", ")", "{", "this", ".", "format", "=", "format", ";", "// Track multiple streams over the format string.", "Scanner", "scanner", "=", "new", "Scanner", "(", "format", ")", ";", "this", ".", "streams", "[", ...
Sets the message format.
[ "Sets", "the", "message", "format", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/MessageFormat.java#L218-L232
106,790
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/MessageFormat.java
MessageFormat.format
public void format(MessageArgs args, StringBuilder buf) { this.args = args; this.buf = buf; this.reset(); format(streams[0], null); }
java
public void format(MessageArgs args, StringBuilder buf) { this.args = args; this.buf = buf; this.reset(); format(streams[0], null); }
[ "public", "void", "format", "(", "MessageArgs", "args", ",", "StringBuilder", "buf", ")", "{", "this", ".", "args", "=", "args", ";", "this", ".", "buf", "=", "buf", ";", "this", ".", "reset", "(", ")", ";", "format", "(", "streams", "[", "0", "]",...
Formats the message using the given arguments, and writing the output to the buffer.
[ "Formats", "the", "message", "using", "the", "given", "arguments", "and", "writing", "the", "output", "to", "the", "buffer", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/MessageFormat.java#L237-L242
106,791
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/MessageFormat.java
MessageFormat.recurse
private void recurse(Stream bounds, String arg) { // Refuse if we've reached our recursion limit. streamIndex++; if (streamIndex == streams.length) { return; } // Trim the '{' and '}' bounding characters. bounds.pos++; bounds.end--; // Set the bounds of the tag, allocating a new ...
java
private void recurse(Stream bounds, String arg) { // Refuse if we've reached our recursion limit. streamIndex++; if (streamIndex == streams.length) { return; } // Trim the '{' and '}' bounding characters. bounds.pos++; bounds.end--; // Set the bounds of the tag, allocating a new ...
[ "private", "void", "recurse", "(", "Stream", "bounds", ",", "String", "arg", ")", "{", "// Refuse if we've reached our recursion limit.", "streamIndex", "++", ";", "if", "(", "streamIndex", "==", "streams", ".", "length", ")", "{", "return", ";", "}", "// Trim t...
Push a stream onto the stack and format it.
[ "Push", "a", "stream", "onto", "the", "stack", "and", "format", "it", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/MessageFormat.java#L292-L314
106,792
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/MessageFormat.java
MessageFormat.evaluateTag
private void evaluateTag(StringBuilder buf) { // Trim the '{' and '}' bounding characters. tag.pos++; tag.end--; // If this tag has been hidden from the processor, skip over the '-' and // emit the tag body. if (tag.peek() == Chars.MINUS_SIGN) { tag.pos++; buf.append('{'); buf...
java
private void evaluateTag(StringBuilder buf) { // Trim the '{' and '}' bounding characters. tag.pos++; tag.end--; // If this tag has been hidden from the processor, skip over the '-' and // emit the tag body. if (tag.peek() == Chars.MINUS_SIGN) { tag.pos++; buf.append('{'); buf...
[ "private", "void", "evaluateTag", "(", "StringBuilder", "buf", ")", "{", "// Trim the '{' and '}' bounding characters.", "tag", ".", "pos", "++", ";", "tag", ".", "end", "--", ";", "// If this tag has been hidden from the processor, skip over the '-' and", "// emit the tag bo...
Parse and evaluate a tag.
[ "Parse", "and", "evaluate", "a", "tag", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/MessageFormat.java#L320-L390
106,793
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/MessageFormat.java
MessageFormat.evalPlural
private void evalPlural(MessageArg arg, boolean cardinal) { tag.skip(COMMA_WS); if (!arg.resolve()) { return; } String value = arg.asString(); String offsetValue = value; // Look for optional "offset:<number>" argument. This modifies the argument value, // changing the plural operand...
java
private void evalPlural(MessageArg arg, boolean cardinal) { tag.skip(COMMA_WS); if (!arg.resolve()) { return; } String value = arg.asString(); String offsetValue = value; // Look for optional "offset:<number>" argument. This modifies the argument value, // changing the plural operand...
[ "private", "void", "evalPlural", "(", "MessageArg", "arg", ",", "boolean", "cardinal", ")", "{", "tag", ".", "skip", "(", "COMMA_WS", ")", ";", "if", "(", "!", "arg", ".", "resolve", "(", ")", ")", "{", "return", ";", "}", "String", "value", "=", "...
PLURAL - Evaluate the argument as a plural, either cardinal or ordinal.
[ "PLURAL", "-", "Evaluate", "the", "argument", "as", "a", "plural", "either", "cardinal", "or", "ordinal", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/MessageFormat.java#L430-L502
106,794
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/MessageFormat.java
MessageFormat.evalSelect
private void evalSelect(MessageArg arg) { tag.skip(COMMA_WS); int pos = -1; int end = -1; String value = arg.asString(); while (tag.peek() != Chars.EOF) { if (!tag.seek(NON_WS, choice)) { break; } String token = choice.token().toString(); tag.jump(choice); ...
java
private void evalSelect(MessageArg arg) { tag.skip(COMMA_WS); int pos = -1; int end = -1; String value = arg.asString(); while (tag.peek() != Chars.EOF) { if (!tag.seek(NON_WS, choice)) { break; } String token = choice.token().toString(); tag.jump(choice); ...
[ "private", "void", "evalSelect", "(", "MessageArg", "arg", ")", "{", "tag", ".", "skip", "(", "COMMA_WS", ")", ";", "int", "pos", "=", "-", "1", ";", "int", "end", "=", "-", "1", ";", "String", "value", "=", "arg", ".", "asString", "(", ")", ";",...
SELECT - Evaluate the tag that matches the argument's value.
[ "SELECT", "-", "Evaluate", "the", "tag", "that", "matches", "the", "argument", "s", "value", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/MessageFormat.java#L507-L541
106,795
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/MessageFormat.java
MessageFormat.evalNumber
private void evalNumber(MessageArg arg) { initDecimalArgsParser(); parseArgs(decimalArgsParser); BigDecimal number = arg.asBigDecimal(); NumberFormatter formatter = CLDR_INSTANCE.getNumberFormatter(locale); formatter.formatDecimal(number, buf, decimalArgsParser.options()); }
java
private void evalNumber(MessageArg arg) { initDecimalArgsParser(); parseArgs(decimalArgsParser); BigDecimal number = arg.asBigDecimal(); NumberFormatter formatter = CLDR_INSTANCE.getNumberFormatter(locale); formatter.formatDecimal(number, buf, decimalArgsParser.options()); }
[ "private", "void", "evalNumber", "(", "MessageArg", "arg", ")", "{", "initDecimalArgsParser", "(", ")", ";", "parseArgs", "(", "decimalArgsParser", ")", ";", "BigDecimal", "number", "=", "arg", ".", "asBigDecimal", "(", ")", ";", "NumberFormatter", "formatter", ...
NUMBER - Evaluate the argument as a number, with options specified as key=value.
[ "NUMBER", "-", "Evaluate", "the", "argument", "as", "a", "number", "with", "options", "specified", "as", "key", "=", "value", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/MessageFormat.java#L546-L553
106,796
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/MessageFormat.java
MessageFormat.evalCurrency
private void evalCurrency(MessageArg arg) { String currencyCode = arg.currency(); if (currencyCode == null) { return; } CLDR.Currency currency = CLDR.Currency.fromString(currencyCode); if (currency == null) { return; } initCurrencyArgsParser(); parseArgs(currencyArgsPars...
java
private void evalCurrency(MessageArg arg) { String currencyCode = arg.currency(); if (currencyCode == null) { return; } CLDR.Currency currency = CLDR.Currency.fromString(currencyCode); if (currency == null) { return; } initCurrencyArgsParser(); parseArgs(currencyArgsPars...
[ "private", "void", "evalCurrency", "(", "MessageArg", "arg", ")", "{", "String", "currencyCode", "=", "arg", ".", "currency", "(", ")", ";", "if", "(", "currencyCode", "==", "null", ")", "{", "return", ";", "}", "CLDR", ".", "Currency", "currency", "=", ...
CURRENCY - Evaluate the argument as a currency, with options specified as key=value.
[ "CURRENCY", "-", "Evaluate", "the", "argument", "as", "a", "currency", "with", "options", "specified", "as", "key", "=", "value", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/MessageFormat.java#L558-L574
106,797
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/MessageFormat.java
MessageFormat.evalDateTime
private void evalDateTime(MessageArg arg) { if (!arg.resolve()) { return; } initCalendarArgsParser(); parseArgs(calendarArgsParser); ZonedDateTime datetime = parseDateTime(arg); CalendarFormatter formatter = CLDR_INSTANCE.getCalendarFormatter(locale); formatter.format(datetim...
java
private void evalDateTime(MessageArg arg) { if (!arg.resolve()) { return; } initCalendarArgsParser(); parseArgs(calendarArgsParser); ZonedDateTime datetime = parseDateTime(arg); CalendarFormatter formatter = CLDR_INSTANCE.getCalendarFormatter(locale); formatter.format(datetim...
[ "private", "void", "evalDateTime", "(", "MessageArg", "arg", ")", "{", "if", "(", "!", "arg", ".", "resolve", "(", ")", ")", "{", "return", ";", "}", "initCalendarArgsParser", "(", ")", ";", "parseArgs", "(", "calendarArgsParser", ")", ";", "ZonedDateTime"...
DATETIME - Evaluate the argument as a datetime, with options specified as key=value.
[ "DATETIME", "-", "Evaluate", "the", "argument", "as", "a", "datetime", "with", "options", "specified", "as", "key", "=", "value", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/MessageFormat.java#L579-L590
106,798
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/MessageFormat.java
MessageFormat.evalDateTimeInterval
private void evalDateTimeInterval(List<MessageArg> args) { int size = args.size(); if (size != 2) { return; } for (int i = 0; i < size; i++) { if (!args.get(i).resolve()) { return; } } ZonedDateTime start = parseDateTime(args.get(0)); ZonedDateTime end = parseDateT...
java
private void evalDateTimeInterval(List<MessageArg> args) { int size = args.size(); if (size != 2) { return; } for (int i = 0; i < size; i++) { if (!args.get(i).resolve()) { return; } } ZonedDateTime start = parseDateTime(args.get(0)); ZonedDateTime end = parseDateT...
[ "private", "void", "evalDateTimeInterval", "(", "List", "<", "MessageArg", ">", "args", ")", "{", "int", "size", "=", "args", ".", "size", "(", ")", ";", "if", "(", "size", "!=", "2", ")", "{", "return", ";", "}", "for", "(", "int", "i", "=", "0"...
DATETIME-INTERVAL - Evaluate the argument as a date-time interval with an optional skeleton argument.
[ "DATETIME", "-", "INTERVAL", "-", "Evaluate", "the", "argument", "as", "a", "date", "-", "time", "interval", "with", "an", "optional", "skeleton", "argument", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/MessageFormat.java#L596-L621
106,799
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/MessageFormat.java
MessageFormat.parseDateTime
private ZonedDateTime parseDateTime(MessageArg arg) { long instant = arg.asLong(); ZoneId timeZone = arg.timeZone() != null ? arg.timeZone() : this.timeZone; return ZonedDateTime.ofInstant(Instant.ofEpochMilli(instant), timeZone); }
java
private ZonedDateTime parseDateTime(MessageArg arg) { long instant = arg.asLong(); ZoneId timeZone = arg.timeZone() != null ? arg.timeZone() : this.timeZone; return ZonedDateTime.ofInstant(Instant.ofEpochMilli(instant), timeZone); }
[ "private", "ZonedDateTime", "parseDateTime", "(", "MessageArg", "arg", ")", "{", "long", "instant", "=", "arg", ".", "asLong", "(", ")", ";", "ZoneId", "timeZone", "=", "arg", ".", "timeZone", "(", ")", "!=", "null", "?", "arg", ".", "timeZone", "(", "...
Parse the argument as a date-time with the format-wide time zone.
[ "Parse", "the", "argument", "as", "a", "date", "-", "time", "with", "the", "format", "-", "wide", "time", "zone", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/MessageFormat.java#L739-L743