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 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
Squarespace/cldr | runtime/src/main/java/com/squarespace/cldr/MessageFormat.java | MessageFormat.emit | private void emit(int pos, int end, String arg) {
while (pos < end) {
char ch = format.charAt(pos);
if (ch == '#') {
buf.append(arg == null ? ch : arg);
} else {
buf.append(ch);
}
pos++;
}
} | java | private void emit(int pos, int end, String arg) {
while (pos < end) {
char ch = format.charAt(pos);
if (ch == '#') {
buf.append(arg == null ? ch : arg);
} else {
buf.append(ch);
}
pos++;
}
} | [
"private",
"void",
"emit",
"(",
"int",
"pos",
",",
"int",
"end",
",",
"String",
"arg",
")",
"{",
"while",
"(",
"pos",
"<",
"end",
")",
"{",
"char",
"ch",
"=",
"format",
".",
"charAt",
"(",
"pos",
")",
";",
"if",
"(",
"ch",
"==",
"'",
"'",
")"... | Append characters from 'raw' in the range [pos, end) to the output buffer. | [
"Append",
"characters",
"from",
"raw",
"in",
"the",
"range",
"[",
"pos",
"end",
")",
"to",
"the",
"output",
"buffer",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/MessageFormat.java#L813-L823 | train |
Squarespace/cldr | runtime/src/main/java/com/squarespace/cldr/LazyLoader.java | LazyLoader.get | public V get(K key) {
Entry<V> entry = classMap.get(key);
return entry == null ? null : entry.get();
} | java | public V get(K key) {
Entry<V> entry = classMap.get(key);
return entry == null ? null : entry.get();
} | [
"public",
"V",
"get",
"(",
"K",
"key",
")",
"{",
"Entry",
"<",
"V",
">",
"entry",
"=",
"classMap",
".",
"get",
"(",
"key",
")",
";",
"return",
"entry",
"==",
"null",
"?",
"null",
":",
"entry",
".",
"get",
"(",
")",
";",
"}"
] | Gets a new instance of the class corresponding to the key. | [
"Gets",
"a",
"new",
"instance",
"of",
"the",
"class",
"corresponding",
"to",
"the",
"key",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/LazyLoader.java#L18-L21 | train |
Squarespace/cldr | runtime/src/main/java/com/squarespace/cldr/LazyLoader.java | LazyLoader.put | public void put(K key, Class<? extends V> cls) {
classMap.put(key, new Entry<>(cls));
} | java | public void put(K key, Class<? extends V> cls) {
classMap.put(key, new Entry<>(cls));
} | [
"public",
"void",
"put",
"(",
"K",
"key",
",",
"Class",
"<",
"?",
"extends",
"V",
">",
"cls",
")",
"{",
"classMap",
".",
"put",
"(",
"key",
",",
"new",
"Entry",
"<>",
"(",
"cls",
")",
")",
";",
"}"
] | Puts a class into the map. | [
"Puts",
"a",
"class",
"into",
"the",
"map",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/LazyLoader.java#L26-L28 | train |
Squarespace/cldr | runtime/src/main/java/com/squarespace/cldr/LanguageResolver.java | LanguageResolver.addLikelySubtags | protected MetaLocale addLikelySubtags(MetaLocale src) {
// Always return a copy.
MetaLocale dst = src.copy();
// If the locale has all fields populated (language, script, territory)
// then do nothing.
if (src.hasAll()) {
return dst;
}
// Build a temporary locale for matching and cle... | java | protected MetaLocale addLikelySubtags(MetaLocale src) {
// Always return a copy.
MetaLocale dst = src.copy();
// If the locale has all fields populated (language, script, territory)
// then do nothing.
if (src.hasAll()) {
return dst;
}
// Build a temporary locale for matching and cle... | [
"protected",
"MetaLocale",
"addLikelySubtags",
"(",
"MetaLocale",
"src",
")",
"{",
"// Always return a copy.",
"MetaLocale",
"dst",
"=",
"src",
".",
"copy",
"(",
")",
";",
"// If the locale has all fields populated (language, script, territory)",
"// then do nothing.",
"if",
... | Add likely subtags, producing the max bundle ID. | [
"Add",
"likely",
"subtags",
"producing",
"the",
"max",
"bundle",
"ID",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/LanguageResolver.java#L53-L89 | train |
Squarespace/cldr | runtime/src/main/java/com/squarespace/cldr/LanguageResolver.java | LanguageResolver.removeLikelySubtags | protected MetaLocale removeLikelySubtags(MetaLocale src) {
// Using "en-Latn-US" for examples.
// 1. match "en-Zzzz-ZZ"
MetaLocale temp = new MetaLocale();
temp.setLanguage(src._language());
MetaLocale match = addLikelySubtags(temp);
if (match.equals(src)) {
return temp;
}
// 2. ... | java | protected MetaLocale removeLikelySubtags(MetaLocale src) {
// Using "en-Latn-US" for examples.
// 1. match "en-Zzzz-ZZ"
MetaLocale temp = new MetaLocale();
temp.setLanguage(src._language());
MetaLocale match = addLikelySubtags(temp);
if (match.equals(src)) {
return temp;
}
// 2. ... | [
"protected",
"MetaLocale",
"removeLikelySubtags",
"(",
"MetaLocale",
"src",
")",
"{",
"// Using \"en-Latn-US\" for examples.",
"// 1. match \"en-Zzzz-ZZ\"",
"MetaLocale",
"temp",
"=",
"new",
"MetaLocale",
"(",
")",
";",
"temp",
".",
"setLanguage",
"(",
"src",
".",
"_l... | Removes all subtags that would be added by addLikelySubtags. This
produces the min bundle ID. | [
"Removes",
"all",
"subtags",
"that",
"would",
"be",
"added",
"by",
"addLikelySubtags",
".",
"This",
"produces",
"the",
"min",
"bundle",
"ID",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/LanguageResolver.java#L95-L124 | train |
Squarespace/cldr | runtime/src/main/java/com/squarespace/cldr/LanguageResolver.java | LanguageResolver.set | protected static void set(MetaLocale src, MetaLocale dst, int flags) {
dst.setLanguage((flags & LANGUAGE) == 0 ? null : src._language());
dst.setScript((flags & SCRIPT) == 0 ? null : src._script());
dst.setTerritory((flags & TERRITORY) == 0 ? null : src._territory());
} | java | protected static void set(MetaLocale src, MetaLocale dst, int flags) {
dst.setLanguage((flags & LANGUAGE) == 0 ? null : src._language());
dst.setScript((flags & SCRIPT) == 0 ? null : src._script());
dst.setTerritory((flags & TERRITORY) == 0 ? null : src._territory());
} | [
"protected",
"static",
"void",
"set",
"(",
"MetaLocale",
"src",
",",
"MetaLocale",
"dst",
",",
"int",
"flags",
")",
"{",
"dst",
".",
"setLanguage",
"(",
"(",
"flags",
"&",
"LANGUAGE",
")",
"==",
"0",
"?",
"null",
":",
"src",
".",
"_language",
"(",
")... | Set or clear fields on the destination locale according to the flags. | [
"Set",
"or",
"clear",
"fields",
"on",
"the",
"destination",
"locale",
"according",
"to",
"the",
"flags",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/LanguageResolver.java#L129-L133 | train |
Squarespace/cldr | runtime/src/main/java/com/squarespace/cldr/PartitionTable.java | PartitionTable.getPartition | private String getPartition(Set<String> variables) {
String key = buildKey(variables);
return partitionIds.computeIfAbsent(key, k -> Character.toString((char)(BASE_ID + idSequence++)));
} | java | private String getPartition(Set<String> variables) {
String key = buildKey(variables);
return partitionIds.computeIfAbsent(key, k -> Character.toString((char)(BASE_ID + idSequence++)));
} | [
"private",
"String",
"getPartition",
"(",
"Set",
"<",
"String",
">",
"variables",
")",
"{",
"String",
"key",
"=",
"buildKey",
"(",
"variables",
")",
";",
"return",
"partitionIds",
".",
"computeIfAbsent",
"(",
"key",
",",
"k",
"->",
"Character",
".",
"toStr... | Retrieve the partition identifier for this set of matching variables. | [
"Retrieve",
"the",
"partition",
"identifier",
"for",
"this",
"set",
"of",
"matching",
"variables",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/PartitionTable.java#L144-L147 | train |
Squarespace/cldr | runtime/src/main/java/com/squarespace/cldr/PartitionTable.java | PartitionTable.buildKey | private static String buildKey(Set<String> variables) {
return variables.stream().sorted().collect(Collectors.joining(", "));
} | java | private static String buildKey(Set<String> variables) {
return variables.stream().sorted().collect(Collectors.joining(", "));
} | [
"private",
"static",
"String",
"buildKey",
"(",
"Set",
"<",
"String",
">",
"variables",
")",
"{",
"return",
"variables",
".",
"stream",
"(",
")",
".",
"sorted",
"(",
")",
".",
"collect",
"(",
"Collectors",
".",
"joining",
"(",
"\", \"",
")",
")",
";",
... | Sort the set of variables and join to a comma-delimited string. | [
"Sort",
"the",
"set",
"of",
"variables",
"and",
"join",
"to",
"a",
"comma",
"-",
"delimited",
"string",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/PartitionTable.java#L152-L154 | train |
Squarespace/cldr | runtime/src/main/java/com/squarespace/cldr/PartitionTable.java | PartitionTable.makeSetsImmutable | private static <K, V> void makeSetsImmutable(Map<K, Set<V>> map) {
Set<K> keys = map.keySet();
for (K key : keys) {
Set<V> value = map.get(key);
map.put(key, Collections.unmodifiableSet(value));
}
} | java | private static <K, V> void makeSetsImmutable(Map<K, Set<V>> map) {
Set<K> keys = map.keySet();
for (K key : keys) {
Set<V> value = map.get(key);
map.put(key, Collections.unmodifiableSet(value));
}
} | [
"private",
"static",
"<",
"K",
",",
"V",
">",
"void",
"makeSetsImmutable",
"(",
"Map",
"<",
"K",
",",
"Set",
"<",
"V",
">",
">",
"map",
")",
"{",
"Set",
"<",
"K",
">",
"keys",
"=",
"map",
".",
"keySet",
"(",
")",
";",
"for",
"(",
"K",
"key",
... | Convert values to immutable sets. | [
"Convert",
"values",
"to",
"immutable",
"sets",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/PartitionTable.java#L175-L181 | train |
Squarespace/cldr | runtime/src/main/java/com/squarespace/cldr/units/BaseUnitConverter.java | BaseUnitConverter.convert | @Override
public UnitValue convert(UnitValue value) {
Unit src = value.unit();
switch (src.category()) {
case CONCENTR:
case LIGHT:
// Not available
break;
case ACCELERATION:
return convert(value, Unit.METER_PER_SECOND_SQUARED, UnitFactors.ACCELERATION);
... | java | @Override
public UnitValue convert(UnitValue value) {
Unit src = value.unit();
switch (src.category()) {
case CONCENTR:
case LIGHT:
// Not available
break;
case ACCELERATION:
return convert(value, Unit.METER_PER_SECOND_SQUARED, UnitFactors.ACCELERATION);
... | [
"@",
"Override",
"public",
"UnitValue",
"convert",
"(",
"UnitValue",
"value",
")",
"{",
"Unit",
"src",
"=",
"value",
".",
"unit",
"(",
")",
";",
"switch",
"(",
"src",
".",
"category",
"(",
")",
")",
"{",
"case",
"CONCENTR",
":",
"case",
"LIGHT",
":",... | Convert the given unit value into the best unit for its category
relative to the current measurement system. | [
"Convert",
"the",
"given",
"unit",
"value",
"into",
"the",
"best",
"unit",
"for",
"its",
"category",
"relative",
"to",
"the",
"current",
"measurement",
"system",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/units/BaseUnitConverter.java#L54-L98 | train |
Squarespace/cldr | runtime/src/main/java/com/squarespace/cldr/units/BaseUnitConverter.java | BaseUnitConverter.convert | @Override
public UnitValue convert(UnitValue value, Unit target) {
Unit src = value.unit();
UnitCategory category = src.category();
if (src == target || category != target.category()) {
return value;
}
switch (category) {
case CONCENTR:
case LIGHT:
// Not available
... | java | @Override
public UnitValue convert(UnitValue value, Unit target) {
Unit src = value.unit();
UnitCategory category = src.category();
if (src == target || category != target.category()) {
return value;
}
switch (category) {
case CONCENTR:
case LIGHT:
// Not available
... | [
"@",
"Override",
"public",
"UnitValue",
"convert",
"(",
"UnitValue",
"value",
",",
"Unit",
"target",
")",
"{",
"Unit",
"src",
"=",
"value",
".",
"unit",
"(",
")",
";",
"UnitCategory",
"category",
"=",
"src",
".",
"category",
"(",
")",
";",
"if",
"(",
... | Convert the given unit value into the target unit relative to
the current measurement system. | [
"Convert",
"the",
"given",
"unit",
"value",
"into",
"the",
"target",
"unit",
"relative",
"to",
"the",
"current",
"measurement",
"system",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/units/BaseUnitConverter.java#L104-L139 | train |
Squarespace/cldr | runtime/src/main/java/com/squarespace/cldr/units/BaseUnitConverter.java | BaseUnitConverter.convert | public UnitValue convert(UnitValue value, UnitFactorSet factorSet) {
value = convert(value, factorSet.base());
BigDecimal n = value.amount();
// Use absolute value to simplify comparisons with divisors
boolean negative = false;
if (n.signum() == -1) {
negative = true;
n = n.abs();
... | java | public UnitValue convert(UnitValue value, UnitFactorSet factorSet) {
value = convert(value, factorSet.base());
BigDecimal n = value.amount();
// Use absolute value to simplify comparisons with divisors
boolean negative = false;
if (n.signum() == -1) {
negative = true;
n = n.abs();
... | [
"public",
"UnitValue",
"convert",
"(",
"UnitValue",
"value",
",",
"UnitFactorSet",
"factorSet",
")",
"{",
"value",
"=",
"convert",
"(",
"value",
",",
"factorSet",
".",
"base",
"(",
")",
")",
";",
"BigDecimal",
"n",
"=",
"value",
".",
"amount",
"(",
")",
... | Convert to the best display unit among the available factors. By "best"
we mean the most compact representation. | [
"Convert",
"to",
"the",
"best",
"display",
"unit",
"among",
"the",
"available",
"factors",
".",
"By",
"best",
"we",
"mean",
"the",
"most",
"compact",
"representation",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/units/BaseUnitConverter.java#L166-L201 | train |
Squarespace/cldr | runtime/src/main/java/com/squarespace/cldr/units/BaseUnitConverter.java | BaseUnitConverter.sequence | public List<UnitValue> sequence(UnitValue value, UnitFactorSet factorSet) {
value = convert(value, factorSet.base());
boolean negative = false;
BigDecimal n = value.amount();
// Use absolute value for all comparisons.
if (n.signum() == -1) {
negative = true;
n = n.abs();
}
... | java | public List<UnitValue> sequence(UnitValue value, UnitFactorSet factorSet) {
value = convert(value, factorSet.base());
boolean negative = false;
BigDecimal n = value.amount();
// Use absolute value for all comparisons.
if (n.signum() == -1) {
negative = true;
n = n.abs();
}
... | [
"public",
"List",
"<",
"UnitValue",
">",
"sequence",
"(",
"UnitValue",
"value",
",",
"UnitFactorSet",
"factorSet",
")",
"{",
"value",
"=",
"convert",
"(",
"value",
",",
"factorSet",
".",
"base",
"(",
")",
")",
";",
"boolean",
"negative",
"=",
"false",
";... | Breaks down the unit value into a sequence of units, using the given divisors and
allowed units. | [
"Breaks",
"down",
"the",
"unit",
"value",
"into",
"a",
"sequence",
"of",
"units",
"using",
"the",
"given",
"divisors",
"and",
"allowed",
"units",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/units/BaseUnitConverter.java#L207-L250 | train |
Squarespace/cldr | runtime/src/main/java/com/squarespace/cldr/units/BaseUnitConverter.java | BaseUnitConverter.temperature | private static UnitValue temperature(UnitValue value, Unit target) {
BigDecimal n = value.amount();
if (target == Unit.TEMPERATURE_GENERIC) {
return new UnitValue(n, Unit.TEMPERATURE_GENERIC);
}
switch (value.unit()) {
case FAHRENHEIT:
if (target == Unit.CELSIUS) {
n = n... | java | private static UnitValue temperature(UnitValue value, Unit target) {
BigDecimal n = value.amount();
if (target == Unit.TEMPERATURE_GENERIC) {
return new UnitValue(n, Unit.TEMPERATURE_GENERIC);
}
switch (value.unit()) {
case FAHRENHEIT:
if (target == Unit.CELSIUS) {
n = n... | [
"private",
"static",
"UnitValue",
"temperature",
"(",
"UnitValue",
"value",
",",
"Unit",
"target",
")",
"{",
"BigDecimal",
"n",
"=",
"value",
".",
"amount",
"(",
")",
";",
"if",
"(",
"target",
"==",
"Unit",
".",
"TEMPERATURE_GENERIC",
")",
"{",
"return",
... | Temperature conversions. | [
"Temperature",
"conversions",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/units/BaseUnitConverter.java#L403-L443 | train |
Squarespace/cldr | runtime/src/main/java/com/squarespace/cldr/MessageArgs.java | MessageArgs.get | public MessageArg get(int index) {
return index < args.size() ? args.get(index) : null;
} | java | public MessageArg get(int index) {
return index < args.size() ? args.get(index) : null;
} | [
"public",
"MessageArg",
"get",
"(",
"int",
"index",
")",
"{",
"return",
"index",
"<",
"args",
".",
"size",
"(",
")",
"?",
"args",
".",
"get",
"(",
"index",
")",
":",
"null",
";",
"}"
] | Return a positional argument, using a zero-based index, or null
if not enough arguments exist. | [
"Return",
"a",
"positional",
"argument",
"using",
"a",
"zero",
"-",
"based",
"index",
"or",
"null",
"if",
"not",
"enough",
"arguments",
"exist",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/MessageArgs.java#L21-L23 | train |
Squarespace/cldr | runtime/src/main/java/com/squarespace/cldr/MessageArgs.java | MessageArgs.get | public MessageArg get(String name) {
return map == null ? null : map.get(name);
} | java | public MessageArg get(String name) {
return map == null ? null : map.get(name);
} | [
"public",
"MessageArg",
"get",
"(",
"String",
"name",
")",
"{",
"return",
"map",
"==",
"null",
"?",
"null",
":",
"map",
".",
"get",
"(",
"name",
")",
";",
"}"
] | Return a named argument or null if does not exist. | [
"Return",
"a",
"named",
"argument",
"or",
"null",
"if",
"does",
"not",
"exist",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/MessageArgs.java#L28-L30 | train |
Squarespace/cldr | runtime/src/main/java/com/squarespace/cldr/MessageArgs.java | MessageArgs.add | public void add(String name, MessageArg arg) {
args.add(arg);
if (map == null) {
map = new HashMap<>();
}
map.put(name, arg);
} | java | public void add(String name, MessageArg arg) {
args.add(arg);
if (map == null) {
map = new HashMap<>();
}
map.put(name, arg);
} | [
"public",
"void",
"add",
"(",
"String",
"name",
",",
"MessageArg",
"arg",
")",
"{",
"args",
".",
"add",
"(",
"arg",
")",
";",
"if",
"(",
"map",
"==",
"null",
")",
"{",
"map",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"}",
"map",
".",
"put",
... | Add a named argument. Also accessible by index. | [
"Add",
"a",
"named",
"argument",
".",
"Also",
"accessible",
"by",
"index",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/MessageArgs.java#L42-L48 | train |
Squarespace/cldr | compiler/src/main/java/com/squarespace/cldr/codegen/NumberCodeGenerator.java | NumberCodeGenerator.generate | public Map<LocaleID, ClassName> generate(Path outputDir, DataReader reader) throws IOException {
Map<LocaleID, ClassName> numberClasses = new TreeMap<>();
Map<LocaleID, UnitData> unitMap = reader.units();
for (Map.Entry<LocaleID, NumberData> entry : reader.numbers().entrySet()) {
NumberData dat... | java | public Map<LocaleID, ClassName> generate(Path outputDir, DataReader reader) throws IOException {
Map<LocaleID, ClassName> numberClasses = new TreeMap<>();
Map<LocaleID, UnitData> unitMap = reader.units();
for (Map.Entry<LocaleID, NumberData> entry : reader.numbers().entrySet()) {
NumberData dat... | [
"public",
"Map",
"<",
"LocaleID",
",",
"ClassName",
">",
"generate",
"(",
"Path",
"outputDir",
",",
"DataReader",
"reader",
")",
"throws",
"IOException",
"{",
"Map",
"<",
"LocaleID",
",",
"ClassName",
">",
"numberClasses",
"=",
"new",
"TreeMap",
"<>",
"(",
... | Generate all number formatting classes. | [
"Generate",
"all",
"number",
"formatting",
"classes",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/NumberCodeGenerator.java#L70-L94 | train |
Squarespace/cldr | compiler/src/main/java/com/squarespace/cldr/codegen/NumberCodeGenerator.java | NumberCodeGenerator.create | private TypeSpec create(NumberData data, UnitData unitData, String className) {
LocaleID id = data.id();
// TODO: add descriptive javadoc to type
TypeSpec.Builder type = TypeSpec.classBuilder(className)
.superclass(NUMBER_FORMATTER_BASE)
.addModifiers(Modifier.PUBLIC);
// Build the... | java | private TypeSpec create(NumberData data, UnitData unitData, String className) {
LocaleID id = data.id();
// TODO: add descriptive javadoc to type
TypeSpec.Builder type = TypeSpec.classBuilder(className)
.superclass(NUMBER_FORMATTER_BASE)
.addModifiers(Modifier.PUBLIC);
// Build the... | [
"private",
"TypeSpec",
"create",
"(",
"NumberData",
"data",
",",
"UnitData",
"unitData",
",",
"String",
"className",
")",
"{",
"LocaleID",
"id",
"=",
"data",
".",
"id",
"(",
")",
";",
"// TODO: add descriptive javadoc to type",
"TypeSpec",
".",
"Builder",
"type"... | Creates a number formatter class. | [
"Creates",
"a",
"number",
"formatter",
"class",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/NumberCodeGenerator.java#L109-L177 | train |
Squarespace/cldr | compiler/src/main/java/com/squarespace/cldr/codegen/NumberCodeGenerator.java | NumberCodeGenerator.createCurrencyUtil | public TypeSpec createCurrencyUtil(String className, Map<String, CurrencyData> currencies) {
TypeSpec.Builder type = TypeSpec.classBuilder(className)
.addModifiers(Modifier.PUBLIC);
CurrencyData defaultData = currencies.get("DEFAULT");
currencies.remove("DEFAULT");
MethodSpec.Builder c... | java | public TypeSpec createCurrencyUtil(String className, Map<String, CurrencyData> currencies) {
TypeSpec.Builder type = TypeSpec.classBuilder(className)
.addModifiers(Modifier.PUBLIC);
CurrencyData defaultData = currencies.get("DEFAULT");
currencies.remove("DEFAULT");
MethodSpec.Builder c... | [
"public",
"TypeSpec",
"createCurrencyUtil",
"(",
"String",
"className",
",",
"Map",
"<",
"String",
",",
"CurrencyData",
">",
"currencies",
")",
"{",
"TypeSpec",
".",
"Builder",
"type",
"=",
"TypeSpec",
".",
"classBuilder",
"(",
"className",
")",
".",
"addModif... | Create class to hold global currency information. | [
"Create",
"class",
"to",
"hold",
"global",
"currency",
"information",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/NumberCodeGenerator.java#L182-L204 | train |
Squarespace/cldr | compiler/src/main/java/com/squarespace/cldr/codegen/NumberCodeGenerator.java | NumberCodeGenerator.getPatterns | private List<String> getPatterns(List<NumberPattern> patterns) {
return patterns.stream()
.map(p -> p.render())
.collect(Collectors.toList());
} | java | private List<String> getPatterns(List<NumberPattern> patterns) {
return patterns.stream()
.map(p -> p.render())
.collect(Collectors.toList());
} | [
"private",
"List",
"<",
"String",
">",
"getPatterns",
"(",
"List",
"<",
"NumberPattern",
">",
"patterns",
")",
"{",
"return",
"patterns",
".",
"stream",
"(",
")",
".",
"map",
"(",
"p",
"->",
"p",
".",
"render",
"(",
")",
")",
".",
"collect",
"(",
"... | Return a list of the string patterns embedded in the NumberPattern instances. | [
"Return",
"a",
"list",
"of",
"the",
"string",
"patterns",
"embedded",
"in",
"the",
"NumberPattern",
"instances",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/NumberCodeGenerator.java#L209-L213 | train |
Squarespace/cldr | compiler/src/main/java/com/squarespace/cldr/codegen/NumberCodeGenerator.java | NumberCodeGenerator.addParams | private void addParams(TypeSpec.Builder parent, LocaleID id, NumberData data) {
MethodSpec.Builder code = MethodSpec.constructorBuilder();
code.addStatement("this.decimal = $S", data.decimal);
code.addStatement("this.group = $S", data.group);
code.addStatement("this.percent = $S", data.percent);
cod... | java | private void addParams(TypeSpec.Builder parent, LocaleID id, NumberData data) {
MethodSpec.Builder code = MethodSpec.constructorBuilder();
code.addStatement("this.decimal = $S", data.decimal);
code.addStatement("this.group = $S", data.group);
code.addStatement("this.percent = $S", data.percent);
cod... | [
"private",
"void",
"addParams",
"(",
"TypeSpec",
".",
"Builder",
"parent",
",",
"LocaleID",
"id",
",",
"NumberData",
"data",
")",
"{",
"MethodSpec",
".",
"Builder",
"code",
"=",
"MethodSpec",
".",
"constructorBuilder",
"(",
")",
";",
"code",
".",
"addStateme... | Construct's the locale's number formatter params. | [
"Construct",
"s",
"the",
"locale",
"s",
"number",
"formatter",
"params",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/NumberCodeGenerator.java#L218-L239 | train |
Squarespace/cldr | compiler/src/main/java/com/squarespace/cldr/codegen/NumberCodeGenerator.java | NumberCodeGenerator.addCurrencyInfo | private void addCurrencyInfo(TypeSpec.Builder type, NumberData data) {
addCurrencyInfoMethod(type, "getCurrencySymbol", data.currencySymbols);
addCurrencyInfoMethod(type, "getNarrowCurrencySymbol", data.narrowCurrencySymbols);
addCurrencyInfoMethod(type, "getCurrencyDisplayName", data.currencyDisplayName);
... | java | private void addCurrencyInfo(TypeSpec.Builder type, NumberData data) {
addCurrencyInfoMethod(type, "getCurrencySymbol", data.currencySymbols);
addCurrencyInfoMethod(type, "getNarrowCurrencySymbol", data.narrowCurrencySymbols);
addCurrencyInfoMethod(type, "getCurrencyDisplayName", data.currencyDisplayName);
... | [
"private",
"void",
"addCurrencyInfo",
"(",
"TypeSpec",
".",
"Builder",
"type",
",",
"NumberData",
"data",
")",
"{",
"addCurrencyInfoMethod",
"(",
"type",
",",
"\"getCurrencySymbol\"",
",",
"data",
".",
"currencySymbols",
")",
";",
"addCurrencyInfoMethod",
"(",
"ty... | Adds methods to return information about a currency. | [
"Adds",
"methods",
"to",
"return",
"information",
"about",
"a",
"currency",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/NumberCodeGenerator.java#L425-L470 | train |
Squarespace/cldr | compiler/src/main/java/com/squarespace/cldr/codegen/NumberCodeGenerator.java | NumberCodeGenerator.addCurrencyInfoMethod | private void addCurrencyInfoMethod(TypeSpec.Builder type, String name, Map<String, String> mapping) {
MethodSpec.Builder method = MethodSpec.methodBuilder(name)
.addModifiers(PUBLIC)
.addParameter(Types.CLDR_CURRENCY_ENUM, "code")
.returns(String.class);
method.beginControlFlow("if (cod... | java | private void addCurrencyInfoMethod(TypeSpec.Builder type, String name, Map<String, String> mapping) {
MethodSpec.Builder method = MethodSpec.methodBuilder(name)
.addModifiers(PUBLIC)
.addParameter(Types.CLDR_CURRENCY_ENUM, "code")
.returns(String.class);
method.beginControlFlow("if (cod... | [
"private",
"void",
"addCurrencyInfoMethod",
"(",
"TypeSpec",
".",
"Builder",
"type",
",",
"String",
"name",
",",
"Map",
"<",
"String",
",",
"String",
">",
"mapping",
")",
"{",
"MethodSpec",
".",
"Builder",
"method",
"=",
"MethodSpec",
".",
"methodBuilder",
"... | Adds a method to return the symbol or display name for a currency. | [
"Adds",
"a",
"method",
"to",
"return",
"the",
"symbol",
"or",
"display",
"name",
"for",
"a",
"currency",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/NumberCodeGenerator.java#L475-L497 | train |
Squarespace/cldr | compiler/src/main/java/com/squarespace/cldr/codegen/LanguageCodeGenerator.java | LanguageCodeGenerator.buildMatchVariables | private static void buildMatchVariables(
TypeSpec.Builder type, Map<String, Set<String>> territoryData, LanguageMatchingData data) {
Map<String, Set<String>> territories = flatten(territoryData);
CodeBlock.Builder code = CodeBlock.builder();
code.add("new $T<$T, $T<$T>>() {{\n", HASHMAP, STR... | java | private static void buildMatchVariables(
TypeSpec.Builder type, Map<String, Set<String>> territoryData, LanguageMatchingData data) {
Map<String, Set<String>> territories = flatten(territoryData);
CodeBlock.Builder code = CodeBlock.builder();
code.add("new $T<$T, $T<$T>>() {{\n", HASHMAP, STR... | [
"private",
"static",
"void",
"buildMatchVariables",
"(",
"TypeSpec",
".",
"Builder",
"type",
",",
"Map",
"<",
"String",
",",
"Set",
"<",
"String",
">",
">",
"territoryData",
",",
"LanguageMatchingData",
"data",
")",
"{",
"Map",
"<",
"String",
",",
"Set",
"... | Build table containing language matching variables. | [
"Build",
"table",
"containing",
"language",
"matching",
"variables",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/LanguageCodeGenerator.java#L98-L153 | train |
Squarespace/cldr | compiler/src/main/java/com/squarespace/cldr/codegen/LanguageCodeGenerator.java | LanguageCodeGenerator.flatten | private static Map<String, Set<String>> flatten(Map<String, Set<String>> data) {
Map<String, Set<String>> territories = new TreeMap<>();
Set<String> keys = data.keySet();
for (String key : keys) {
Set<String> values = flatten(key, territories, data);
territories.put(key, values);
}
retur... | java | private static Map<String, Set<String>> flatten(Map<String, Set<String>> data) {
Map<String, Set<String>> territories = new TreeMap<>();
Set<String> keys = data.keySet();
for (String key : keys) {
Set<String> values = flatten(key, territories, data);
territories.put(key, values);
}
retur... | [
"private",
"static",
"Map",
"<",
"String",
",",
"Set",
"<",
"String",
">",
">",
"flatten",
"(",
"Map",
"<",
"String",
",",
"Set",
"<",
"String",
">",
">",
"data",
")",
"{",
"Map",
"<",
"String",
",",
"Set",
"<",
"String",
">",
">",
"territories",
... | Flatten the territory containment hierarchy. | [
"Flatten",
"the",
"territory",
"containment",
"hierarchy",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/LanguageCodeGenerator.java#L158-L166 | train |
Squarespace/cldr | compiler/src/main/java/com/squarespace/cldr/codegen/LanguageCodeGenerator.java | LanguageCodeGenerator.flatten | private static Set<String> flatten(
String parent, Map<String, Set<String>> flat, Map<String, Set<String>> data) {
Set<String> countries = new LinkedHashSet<>();
Set<String> keys = data.get(parent);
if (keys == null) {
return countries;
}
for (String region : keys) {
if (data.... | java | private static Set<String> flatten(
String parent, Map<String, Set<String>> flat, Map<String, Set<String>> data) {
Set<String> countries = new LinkedHashSet<>();
Set<String> keys = data.get(parent);
if (keys == null) {
return countries;
}
for (String region : keys) {
if (data.... | [
"private",
"static",
"Set",
"<",
"String",
">",
"flatten",
"(",
"String",
"parent",
",",
"Map",
"<",
"String",
",",
"Set",
"<",
"String",
">",
">",
"flat",
",",
"Map",
"<",
"String",
",",
"Set",
"<",
"String",
">",
">",
"data",
")",
"{",
"Set",
"... | Flatten one level of the territory containment hierarchy. | [
"Flatten",
"one",
"level",
"of",
"the",
"territory",
"containment",
"hierarchy",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/LanguageCodeGenerator.java#L171-L189 | train |
Squarespace/cldr | compiler/src/main/java/com/squarespace/cldr/codegen/LanguageCodeGenerator.java | LanguageCodeGenerator.addStringList | private static void addStringList(CodeBlock.Builder code, List<String> list, String indent) {
int size = list.size();
code.add("$T.asList(\n$L", Arrays.class, indent);
int width = indent.length();
for (int i = 0; i < size; i++) {
if (i != 0) {
code.add(", ");
width += 2;
}
... | java | private static void addStringList(CodeBlock.Builder code, List<String> list, String indent) {
int size = list.size();
code.add("$T.asList(\n$L", Arrays.class, indent);
int width = indent.length();
for (int i = 0; i < size; i++) {
if (i != 0) {
code.add(", ");
width += 2;
}
... | [
"private",
"static",
"void",
"addStringList",
"(",
"CodeBlock",
".",
"Builder",
"code",
",",
"List",
"<",
"String",
">",
"list",
",",
"String",
"indent",
")",
"{",
"int",
"size",
"=",
"list",
".",
"size",
"(",
")",
";",
"code",
".",
"add",
"(",
"\"$T... | Helper to add a list of strings to a code block. | [
"Helper",
"to",
"add",
"a",
"list",
"of",
"strings",
"to",
"a",
"code",
"block",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/LanguageCodeGenerator.java#L194-L212 | train |
Squarespace/cldr | core/src/main/java/com/squarespace/cldr/numbers/NumberPatternParser.java | NumberPatternParser.parse | public NumberPattern parse(String raw) {
this.buf.setLength(0);
this.nodes = new ArrayList<>();
this.attached = false;
this.format = new Format();
// Length of the pattern.
int length = raw.length();
// Position in the pattern.
int i = 0;
// Indicate we've seen a group separator a... | java | public NumberPattern parse(String raw) {
this.buf.setLength(0);
this.nodes = new ArrayList<>();
this.attached = false;
this.format = new Format();
// Length of the pattern.
int length = raw.length();
// Position in the pattern.
int i = 0;
// Indicate we've seen a group separator a... | [
"public",
"NumberPattern",
"parse",
"(",
"String",
"raw",
")",
"{",
"this",
".",
"buf",
".",
"setLength",
"(",
"0",
")",
";",
"this",
".",
"nodes",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"this",
".",
"attached",
"=",
"false",
";",
"this",
".... | Parse a number formatting pattern. | [
"Parse",
"a",
"number",
"formatting",
"pattern",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/core/src/main/java/com/squarespace/cldr/numbers/NumberPatternParser.java#L34-L135 | train |
Squarespace/cldr | core/src/main/java/com/squarespace/cldr/numbers/NumberPatternParser.java | NumberPatternParser.pushText | private void pushText() {
if (buf.length() > 0) {
nodes.add(new NumberPattern.Text(buf.toString()));
buf.setLength(0);
}
} | java | private void pushText() {
if (buf.length() > 0) {
nodes.add(new NumberPattern.Text(buf.toString()));
buf.setLength(0);
}
} | [
"private",
"void",
"pushText",
"(",
")",
"{",
"if",
"(",
"buf",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"nodes",
".",
"add",
"(",
"new",
"NumberPattern",
".",
"Text",
"(",
"buf",
".",
"toString",
"(",
")",
")",
")",
";",
"buf",
".",
"setLe... | If the buffer is not empty, push it onto the node list and reset it. | [
"If",
"the",
"buffer",
"is",
"not",
"empty",
"push",
"it",
"onto",
"the",
"node",
"list",
"and",
"reset",
"it",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/core/src/main/java/com/squarespace/cldr/numbers/NumberPatternParser.java#L151-L156 | train |
Squarespace/cldr | runtime/src/main/java/com/squarespace/cldr/CLDRBase.java | CLDRBase.fromJavaLocale | public CLDR.Locale fromJavaLocale(java.util.Locale javaLocale) {
return MetaLocale.fromJavaLocale(javaLocale);
} | java | public CLDR.Locale fromJavaLocale(java.util.Locale javaLocale) {
return MetaLocale.fromJavaLocale(javaLocale);
} | [
"public",
"CLDR",
".",
"Locale",
"fromJavaLocale",
"(",
"java",
".",
"util",
".",
"Locale",
"javaLocale",
")",
"{",
"return",
"MetaLocale",
".",
"fromJavaLocale",
"(",
"javaLocale",
")",
";",
"}"
] | Convert the Java locale to a CLDR locale object. | [
"Convert",
"the",
"Java",
"locale",
"to",
"a",
"CLDR",
"locale",
"object",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/CLDRBase.java#L80-L82 | train |
Squarespace/cldr | runtime/src/main/java/com/squarespace/cldr/CLDRBase.java | CLDRBase.minimize | public CLDR.Locale minimize(CLDR.Locale locale) {
return languageResolver.removeLikelySubtags((MetaLocale)locale);
} | java | public CLDR.Locale minimize(CLDR.Locale locale) {
return languageResolver.removeLikelySubtags((MetaLocale)locale);
} | [
"public",
"CLDR",
".",
"Locale",
"minimize",
"(",
"CLDR",
".",
"Locale",
"locale",
")",
"{",
"return",
"languageResolver",
".",
"removeLikelySubtags",
"(",
"(",
"MetaLocale",
")",
"locale",
")",
";",
"}"
] | Produce the minimal representation of this locale by removing likely subtags. | [
"Produce",
"the",
"minimal",
"representation",
"of",
"this",
"locale",
"by",
"removing",
"likely",
"subtags",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/CLDRBase.java#L87-L89 | train |
Squarespace/cldr | runtime/src/main/java/com/squarespace/cldr/CLDRBase.java | CLDRBase.getCalendarFormatter | public CalendarFormatter getCalendarFormatter(CLDR.Locale locale) {
locale = bundleMatch(locale);
CalendarFormatter formatter = CALENDAR_FORMATTERS.get(locale);
return formatter == null ? CALENDAR_FORMATTERS.get(CLDR.Locale.en_US) : formatter;
} | java | public CalendarFormatter getCalendarFormatter(CLDR.Locale locale) {
locale = bundleMatch(locale);
CalendarFormatter formatter = CALENDAR_FORMATTERS.get(locale);
return formatter == null ? CALENDAR_FORMATTERS.get(CLDR.Locale.en_US) : formatter;
} | [
"public",
"CalendarFormatter",
"getCalendarFormatter",
"(",
"CLDR",
".",
"Locale",
"locale",
")",
"{",
"locale",
"=",
"bundleMatch",
"(",
"locale",
")",
";",
"CalendarFormatter",
"formatter",
"=",
"CALENDAR_FORMATTERS",
".",
"get",
"(",
"locale",
")",
";",
"retu... | Returns a calendar formatter for the given locale, translating it before lookup. | [
"Returns",
"a",
"calendar",
"formatter",
"for",
"the",
"given",
"locale",
"translating",
"it",
"before",
"lookup",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/CLDRBase.java#L94-L98 | train |
Squarespace/cldr | runtime/src/main/java/com/squarespace/cldr/CLDRBase.java | CLDRBase.getNumberFormatter | public NumberFormatter getNumberFormatter(CLDR.Locale locale) {
locale = bundleMatch(locale);
NumberFormatter formatter = NUMBER_FORMATTERS.get(locale);
return formatter == null ? NUMBER_FORMATTERS.get(CLDR.Locale.en_US) : formatter;
} | java | public NumberFormatter getNumberFormatter(CLDR.Locale locale) {
locale = bundleMatch(locale);
NumberFormatter formatter = NUMBER_FORMATTERS.get(locale);
return formatter == null ? NUMBER_FORMATTERS.get(CLDR.Locale.en_US) : formatter;
} | [
"public",
"NumberFormatter",
"getNumberFormatter",
"(",
"CLDR",
".",
"Locale",
"locale",
")",
"{",
"locale",
"=",
"bundleMatch",
"(",
"locale",
")",
";",
"NumberFormatter",
"formatter",
"=",
"NUMBER_FORMATTERS",
".",
"get",
"(",
"locale",
")",
";",
"return",
"... | Returns a number formatter for the given locale, translating it before lookup. | [
"Returns",
"a",
"number",
"formatter",
"for",
"the",
"given",
"locale",
"translating",
"it",
"before",
"lookup",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/CLDRBase.java#L103-L107 | train |
Squarespace/cldr | runtime/src/main/java/com/squarespace/cldr/CLDRBase.java | CLDRBase.addLanguageAlias | protected static void addLanguageAlias(String rawType, String rawReplacement) {
LanguageAlias type = LanguageAlias.parse(rawType);
LanguageAlias replacement = LanguageAlias.parse(rawReplacement);
String language = type.language();
List<Pair<LanguageAlias, LanguageAlias>> aliases = LANGUAGE_ALIAS_MAP.get... | java | protected static void addLanguageAlias(String rawType, String rawReplacement) {
LanguageAlias type = LanguageAlias.parse(rawType);
LanguageAlias replacement = LanguageAlias.parse(rawReplacement);
String language = type.language();
List<Pair<LanguageAlias, LanguageAlias>> aliases = LANGUAGE_ALIAS_MAP.get... | [
"protected",
"static",
"void",
"addLanguageAlias",
"(",
"String",
"rawType",
",",
"String",
"rawReplacement",
")",
"{",
"LanguageAlias",
"type",
"=",
"LanguageAlias",
".",
"parse",
"(",
"rawType",
")",
";",
"LanguageAlias",
"replacement",
"=",
"LanguageAlias",
"."... | Add a language alias entry. | [
"Add",
"a",
"language",
"alias",
"entry",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/CLDRBase.java#L183-L193 | train |
Squarespace/cldr | runtime/src/main/java/com/squarespace/cldr/CLDRBase.java | CLDRBase.bundleMatch | protected CLDR.Locale bundleMatch(CLDR.Locale locale) {
locale = DEFAULT_CONTENT.getOrDefault(locale, locale);
return bundleMatcher.match((MetaLocale)locale);
} | java | protected CLDR.Locale bundleMatch(CLDR.Locale locale) {
locale = DEFAULT_CONTENT.getOrDefault(locale, locale);
return bundleMatcher.match((MetaLocale)locale);
} | [
"protected",
"CLDR",
".",
"Locale",
"bundleMatch",
"(",
"CLDR",
".",
"Locale",
"locale",
")",
"{",
"locale",
"=",
"DEFAULT_CONTENT",
".",
"getOrDefault",
"(",
"locale",
",",
"locale",
")",
";",
"return",
"bundleMatcher",
".",
"match",
"(",
"(",
"MetaLocale",... | Locate the correct bundle identifier for the given resolved locale. Note that
the bundle identifier is not terribly useful outside of the CLDR library, since
it may in many cases carry incomplete information for the intended public locale.
For example, the bundle used for "en-Latn-US" is "en" which is missing critical
... | [
"Locate",
"the",
"correct",
"bundle",
"identifier",
"for",
"the",
"given",
"resolved",
"locale",
".",
"Note",
"that",
"the",
"bundle",
"identifier",
"is",
"not",
"terribly",
"useful",
"outside",
"of",
"the",
"CLDR",
"library",
"since",
"it",
"may",
"in",
"ma... | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/CLDRBase.java#L208-L211 | train |
Squarespace/cldr | core/src/main/java/com/squarespace/cldr/numbers/DigitBuffer.java | DigitBuffer.append | public DigitBuffer append(String s) {
int len = s.length();
check(len);
for (int i = 0; i < len; i++) {
this.buf[size] = s.charAt(i);
size++;
}
return this;
} | java | public DigitBuffer append(String s) {
int len = s.length();
check(len);
for (int i = 0; i < len; i++) {
this.buf[size] = s.charAt(i);
size++;
}
return this;
} | [
"public",
"DigitBuffer",
"append",
"(",
"String",
"s",
")",
"{",
"int",
"len",
"=",
"s",
".",
"length",
"(",
")",
";",
"check",
"(",
"len",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"this",
... | Append a string to the buffer, expanding it if necessary. | [
"Append",
"a",
"string",
"to",
"the",
"buffer",
"expanding",
"it",
"if",
"necessary",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/core/src/main/java/com/squarespace/cldr/numbers/DigitBuffer.java#L86-L94 | train |
Squarespace/cldr | core/src/main/java/com/squarespace/cldr/numbers/DigitBuffer.java | DigitBuffer.append | public void append(DigitBuffer other) {
check(other.size);
System.arraycopy(other.buf, 0, buf, size, other.size);
size += other.size;
} | java | public void append(DigitBuffer other) {
check(other.size);
System.arraycopy(other.buf, 0, buf, size, other.size);
size += other.size;
} | [
"public",
"void",
"append",
"(",
"DigitBuffer",
"other",
")",
"{",
"check",
"(",
"other",
".",
"size",
")",
";",
"System",
".",
"arraycopy",
"(",
"other",
".",
"buf",
",",
"0",
",",
"buf",
",",
"size",
",",
"other",
".",
"size",
")",
";",
"size",
... | Append the contents of the other buffer to this one. | [
"Append",
"the",
"contents",
"of",
"the",
"other",
"buffer",
"to",
"this",
"one",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/core/src/main/java/com/squarespace/cldr/numbers/DigitBuffer.java#L99-L103 | train |
Squarespace/cldr | core/src/main/java/com/squarespace/cldr/numbers/DigitBuffer.java | DigitBuffer.reverse | public void reverse(int start) {
int end = size - 1;
int num = end - start >> 1;
for (int i = 0; i <= num; i++) {
int j = start + i;
int k = end - i;
char c = buf[k];
buf[k] = buf[j];
buf[j] = c;
}
} | java | public void reverse(int start) {
int end = size - 1;
int num = end - start >> 1;
for (int i = 0; i <= num; i++) {
int j = start + i;
int k = end - i;
char c = buf[k];
buf[k] = buf[j];
buf[j] = c;
}
} | [
"public",
"void",
"reverse",
"(",
"int",
"start",
")",
"{",
"int",
"end",
"=",
"size",
"-",
"1",
";",
"int",
"num",
"=",
"end",
"-",
"start",
">>",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<=",
"num",
";",
"i",
"++",
")",
"{",... | Reverse all characters from start to end of buffer. | [
"Reverse",
"all",
"characters",
"from",
"start",
"to",
"end",
"of",
"buffer",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/core/src/main/java/com/squarespace/cldr/numbers/DigitBuffer.java#L125-L135 | train |
Squarespace/cldr | core/src/main/java/com/squarespace/cldr/numbers/DigitBuffer.java | DigitBuffer.check | private void check(int length) {
if (size + length >= buf.length) {
buf = Arrays.copyOf(buf, buf.length + length + 16);
}
} | java | private void check(int length) {
if (size + length >= buf.length) {
buf = Arrays.copyOf(buf, buf.length + length + 16);
}
} | [
"private",
"void",
"check",
"(",
"int",
"length",
")",
"{",
"if",
"(",
"size",
"+",
"length",
">=",
"buf",
".",
"length",
")",
"{",
"buf",
"=",
"Arrays",
".",
"copyOf",
"(",
"buf",
",",
"buf",
".",
"length",
"+",
"length",
"+",
"16",
")",
";",
... | Ensure the buffer is large enough for the next append. | [
"Ensure",
"the",
"buffer",
"is",
"large",
"enough",
"for",
"the",
"next",
"append",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/core/src/main/java/com/squarespace/cldr/numbers/DigitBuffer.java#L148-L152 | train |
Squarespace/cldr | compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java | DataReader.get | public static DataReader get() throws IOException {
if (!instance.initialized) {
long start = System.currentTimeMillis();
instance.init();
long elapsed = System.currentTimeMillis() - start;
System.out.printf("Loaded CLDR data in %d ms.\n", elapsed);
}
return instance;
} | java | public static DataReader get() throws IOException {
if (!instance.initialized) {
long start = System.currentTimeMillis();
instance.init();
long elapsed = System.currentTimeMillis() - start;
System.out.printf("Loaded CLDR data in %d ms.\n", elapsed);
}
return instance;
} | [
"public",
"static",
"DataReader",
"get",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"instance",
".",
"initialized",
")",
"{",
"long",
"start",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"instance",
".",
"init",
"(",
")",
";",
... | Returns the global DataReader instance, populating it if necessary. | [
"Returns",
"the",
"global",
"DataReader",
"instance",
"populating",
"it",
"if",
"necessary",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java#L168-L176 | train |
Squarespace/cldr | compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java | DataReader.loadPatches | private void loadPatches() throws IOException {
List<Path> paths = Utils.listResources(PATCHES);
for (Path path : paths) {
String fileName = path.getFileName().toString();
if (fileName.endsWith(".json")) {
JsonObject root = load(path);
patches.put(fileName, root);
}
}
} | java | private void loadPatches() throws IOException {
List<Path> paths = Utils.listResources(PATCHES);
for (Path path : paths) {
String fileName = path.getFileName().toString();
if (fileName.endsWith(".json")) {
JsonObject root = load(path);
patches.put(fileName, root);
}
}
} | [
"private",
"void",
"loadPatches",
"(",
")",
"throws",
"IOException",
"{",
"List",
"<",
"Path",
">",
"paths",
"=",
"Utils",
".",
"listResources",
"(",
"PATCHES",
")",
";",
"for",
"(",
"Path",
"path",
":",
"paths",
")",
"{",
"String",
"fileName",
"=",
"p... | Load patches which override values in the CLDR data. Use this to restore
certain cases to our preferred form. | [
"Load",
"patches",
"which",
"override",
"values",
"in",
"the",
"CLDR",
"data",
".",
"Use",
"this",
"to",
"restore",
"certain",
"cases",
"to",
"our",
"preferred",
"form",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java#L425-L434 | train |
Squarespace/cldr | compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java | DataReader.patch | private JsonObject patch(String fileName, String code, JsonObject root) {
for (Map.Entry<String, JsonObject> entry : patches.entrySet()) {
JsonObject patch = entry.getValue();
if (!patch.get("filename").getAsString().equals(fileName)) {
continue;
}
// Check if this patch shoul... | java | private JsonObject patch(String fileName, String code, JsonObject root) {
for (Map.Entry<String, JsonObject> entry : patches.entrySet()) {
JsonObject patch = entry.getValue();
if (!patch.get("filename").getAsString().equals(fileName)) {
continue;
}
// Check if this patch shoul... | [
"private",
"JsonObject",
"patch",
"(",
"String",
"fileName",
",",
"String",
"code",
",",
"JsonObject",
"root",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"JsonObject",
">",
"entry",
":",
"patches",
".",
"entrySet",
"(",
")",
")",
"{... | Apply a patch to the given filename, if applicable. | [
"Apply",
"a",
"patch",
"to",
"the",
"given",
"filename",
"if",
"applicable",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java#L439-L476 | train |
Squarespace/cldr | compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java | DataReader.patchObject | private void patchObject(JsonObject src, JsonObject dst) {
for (String key : objectKeys(src)) {
JsonElement se = src.get(key);
JsonElement de = dst.get(key);
if (de == null) {
continue;
}
if (se.isJsonObject() && de.isJsonObject()) {
patchObject(se.getAsJsonObject(), de... | java | private void patchObject(JsonObject src, JsonObject dst) {
for (String key : objectKeys(src)) {
JsonElement se = src.get(key);
JsonElement de = dst.get(key);
if (de == null) {
continue;
}
if (se.isJsonObject() && de.isJsonObject()) {
patchObject(se.getAsJsonObject(), de... | [
"private",
"void",
"patchObject",
"(",
"JsonObject",
"src",
",",
"JsonObject",
"dst",
")",
"{",
"for",
"(",
"String",
"key",
":",
"objectKeys",
"(",
"src",
")",
")",
"{",
"JsonElement",
"se",
"=",
"src",
".",
"get",
"(",
"key",
")",
";",
"JsonElement",... | Overlay nested values from src on top of dst. | [
"Overlay",
"nested",
"values",
"from",
"src",
"on",
"top",
"of",
"dst",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java#L481-L496 | train |
Squarespace/cldr | compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java | DataReader.sanityCheck | private void sanityCheck(List<Path> resources) {
Set<String> fileNames = resources.stream()
.map(p -> p.getFileName().toString())
.collect(Collectors.toSet());
for (String name : FILENAMES_MUST_EXIST) {
if (!fileNames.contains(name)) {
String msg = String.format("CLDR DATA MISSING!... | java | private void sanityCheck(List<Path> resources) {
Set<String> fileNames = resources.stream()
.map(p -> p.getFileName().toString())
.collect(Collectors.toSet());
for (String name : FILENAMES_MUST_EXIST) {
if (!fileNames.contains(name)) {
String msg = String.format("CLDR DATA MISSING!... | [
"private",
"void",
"sanityCheck",
"(",
"List",
"<",
"Path",
">",
"resources",
")",
"{",
"Set",
"<",
"String",
">",
"fileNames",
"=",
"resources",
".",
"stream",
"(",
")",
".",
"map",
"(",
"p",
"->",
"p",
".",
"getFileName",
"(",
")",
".",
"toString",... | Blow up if required paths do not exist. | [
"Blow",
"up",
"if",
"required",
"paths",
"do",
"not",
"exist",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java#L501-L512 | train |
Squarespace/cldr | compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java | DataReader.load | private JsonObject load(Path path) throws IOException {
try (InputStream stream = Resources.getResource(path.toString()).openStream()) {
return (JsonObject) JSON_PARSER.parse(new InputStreamReader(stream));
}
} | java | private JsonObject load(Path path) throws IOException {
try (InputStream stream = Resources.getResource(path.toString()).openStream()) {
return (JsonObject) JSON_PARSER.parse(new InputStreamReader(stream));
}
} | [
"private",
"JsonObject",
"load",
"(",
"Path",
"path",
")",
"throws",
"IOException",
"{",
"try",
"(",
"InputStream",
"stream",
"=",
"Resources",
".",
"getResource",
"(",
"path",
".",
"toString",
"(",
")",
")",
".",
"openStream",
"(",
")",
")",
"{",
"retur... | Loads and parses a JSON file, returning a reference to its root object node. | [
"Loads",
"and",
"parses",
"a",
"JSON",
"file",
"returning",
"a",
"reference",
"to",
"its",
"root",
"object",
"node",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java#L517-L521 | train |
Squarespace/cldr | compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java | DataReader.parseIdentity | private LocaleID parseIdentity(String code, JsonObject root) throws IOException {
JsonObject node = resolve(root, "main", code, "identity");
return new LocaleID(
string(node, "language"),
string(node, "script"),
string(node, "territory"),
string(node, "variant"));
} | java | private LocaleID parseIdentity(String code, JsonObject root) throws IOException {
JsonObject node = resolve(root, "main", code, "identity");
return new LocaleID(
string(node, "language"),
string(node, "script"),
string(node, "territory"),
string(node, "variant"));
} | [
"private",
"LocaleID",
"parseIdentity",
"(",
"String",
"code",
",",
"JsonObject",
"root",
")",
"throws",
"IOException",
"{",
"JsonObject",
"node",
"=",
"resolve",
"(",
"root",
",",
"\"main\"",
",",
"code",
",",
"\"identity\"",
")",
";",
"return",
"new",
"Loc... | Parse the locale identity header from a calendar JSON tree. | [
"Parse",
"the",
"locale",
"identity",
"header",
"from",
"a",
"calendar",
"JSON",
"tree",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java#L526-L533 | train |
Squarespace/cldr | compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java | DataReader.parseLikelySubtags | private void parseLikelySubtags(JsonObject root) {
JsonObject node = resolve(root, "supplemental", "likelySubtags");
for (Map.Entry<String, JsonElement> entry : node.entrySet()) {
likelySubtags.put(entry.getKey(), entry.getValue().getAsString());
}
} | java | private void parseLikelySubtags(JsonObject root) {
JsonObject node = resolve(root, "supplemental", "likelySubtags");
for (Map.Entry<String, JsonElement> entry : node.entrySet()) {
likelySubtags.put(entry.getKey(), entry.getValue().getAsString());
}
} | [
"private",
"void",
"parseLikelySubtags",
"(",
"JsonObject",
"root",
")",
"{",
"JsonObject",
"node",
"=",
"resolve",
"(",
"root",
",",
"\"supplemental\"",
",",
"\"likelySubtags\"",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"JsonElement",
... | Parse likely subtags tree. | [
"Parse",
"likely",
"subtags",
"tree",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java#L548-L553 | train |
Squarespace/cldr | compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java | DataReader.parseLanguageMatchingFix | private void parseLanguageMatchingFix(JsonObject root) {
JsonObject node = resolve(root, "supplemental", "languageMatching", "written_new");
JsonArray matches = node.getAsJsonArray("languageMatch");
for (JsonElement element : matches) {
JsonObject value = (JsonObject) element;
String desired = s... | java | private void parseLanguageMatchingFix(JsonObject root) {
JsonObject node = resolve(root, "supplemental", "languageMatching", "written_new");
JsonArray matches = node.getAsJsonArray("languageMatch");
for (JsonElement element : matches) {
JsonObject value = (JsonObject) element;
String desired = s... | [
"private",
"void",
"parseLanguageMatchingFix",
"(",
"JsonObject",
"root",
")",
"{",
"JsonObject",
"node",
"=",
"resolve",
"(",
"root",
",",
"\"supplemental\"",
",",
"\"languageMatching\"",
",",
"\"written_new\"",
")",
";",
"JsonArray",
"matches",
"=",
"node",
".",... | Parse enhanced language matching fix tree. | [
"Parse",
"enhanced",
"language",
"matching",
"fix",
"tree",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java#L558-L581 | train |
Squarespace/cldr | compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java | DataReader.parseTerritoryContainment | private void parseTerritoryContainment(JsonObject root) {
JsonObject node = resolve(root, "supplemental", "territoryContainment");
for (Map.Entry<String, JsonElement> entry : node.entrySet()) {
String parentCode = entry.getKey();
if (parentCode.contains("-")) {
if (!parentCode.endsWith("-sta... | java | private void parseTerritoryContainment(JsonObject root) {
JsonObject node = resolve(root, "supplemental", "territoryContainment");
for (Map.Entry<String, JsonElement> entry : node.entrySet()) {
String parentCode = entry.getKey();
if (parentCode.contains("-")) {
if (!parentCode.endsWith("-sta... | [
"private",
"void",
"parseTerritoryContainment",
"(",
"JsonObject",
"root",
")",
"{",
"JsonObject",
"node",
"=",
"resolve",
"(",
"root",
",",
"\"supplemental\"",
",",
"\"territoryContainment\"",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"Js... | Parse territory containment tree. | [
"Parse",
"territory",
"containment",
"tree",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java#L586-L616 | train |
Squarespace/cldr | compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java | DataReader.parseCalendar | private DateTimeData parseCalendar(JsonObject root) throws IOException {
DateTimeData data = new DateTimeData();
JsonObject node = resolve(root, "dates", "calendars", "gregorian");
data.eras = parseEras(node);
data.dayPeriodsFormat = parseDayPeriods(node, "format");
data.dayPeriodsStandalone = pars... | java | private DateTimeData parseCalendar(JsonObject root) throws IOException {
DateTimeData data = new DateTimeData();
JsonObject node = resolve(root, "dates", "calendars", "gregorian");
data.eras = parseEras(node);
data.dayPeriodsFormat = parseDayPeriods(node, "format");
data.dayPeriodsStandalone = pars... | [
"private",
"DateTimeData",
"parseCalendar",
"(",
"JsonObject",
"root",
")",
"throws",
"IOException",
"{",
"DateTimeData",
"data",
"=",
"new",
"DateTimeData",
"(",
")",
";",
"JsonObject",
"node",
"=",
"resolve",
"(",
"root",
",",
"\"dates\"",
",",
"\"calendars\""... | Parse calendar date-time attributes. | [
"Parse",
"calendar",
"date",
"-",
"time",
"attributes",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java#L621-L662 | train |
Squarespace/cldr | compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java | DataReader.parseDateFormats | private Format parseDateFormats(JsonObject calendar) {
JsonObject node = resolve(calendar, "dateFormats");
return new Format(
string(node, "short"),
string(node, "medium"),
string(node, "long"),
string(node, "full"));
} | java | private Format parseDateFormats(JsonObject calendar) {
JsonObject node = resolve(calendar, "dateFormats");
return new Format(
string(node, "short"),
string(node, "medium"),
string(node, "long"),
string(node, "full"));
} | [
"private",
"Format",
"parseDateFormats",
"(",
"JsonObject",
"calendar",
")",
"{",
"JsonObject",
"node",
"=",
"resolve",
"(",
"calendar",
",",
"\"dateFormats\"",
")",
";",
"return",
"new",
"Format",
"(",
"string",
"(",
"node",
",",
"\"short\"",
")",
",",
"str... | Parse standard date formats of varying sizes. | [
"Parse",
"standard",
"date",
"formats",
"of",
"varying",
"sizes",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java#L737-L744 | train |
Squarespace/cldr | compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java | DataReader.parseTimeFormats | private Format parseTimeFormats(JsonObject calendar) {
JsonObject node = resolve(calendar, "timeFormats");
return new Format(
string(node, "short"),
string(node, "medium"),
string(node, "long"),
string(node, "full"));
} | java | private Format parseTimeFormats(JsonObject calendar) {
JsonObject node = resolve(calendar, "timeFormats");
return new Format(
string(node, "short"),
string(node, "medium"),
string(node, "long"),
string(node, "full"));
} | [
"private",
"Format",
"parseTimeFormats",
"(",
"JsonObject",
"calendar",
")",
"{",
"JsonObject",
"node",
"=",
"resolve",
"(",
"calendar",
",",
"\"timeFormats\"",
")",
";",
"return",
"new",
"Format",
"(",
"string",
"(",
"node",
",",
"\"short\"",
")",
",",
"str... | Parse standard time formats of varying sizes. | [
"Parse",
"standard",
"time",
"formats",
"of",
"varying",
"sizes",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java#L749-L756 | train |
Squarespace/cldr | compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java | DataReader.parseDateTimeFormats | private Format parseDateTimeFormats(JsonObject calendar) {
JsonObject node = resolve(calendar, "dateTimeFormats");
return new Format(
string(node, "short"),
string(node, "medium"),
string(node, "long"),
string(node, "full"));
} | java | private Format parseDateTimeFormats(JsonObject calendar) {
JsonObject node = resolve(calendar, "dateTimeFormats");
return new Format(
string(node, "short"),
string(node, "medium"),
string(node, "long"),
string(node, "full"));
} | [
"private",
"Format",
"parseDateTimeFormats",
"(",
"JsonObject",
"calendar",
")",
"{",
"JsonObject",
"node",
"=",
"resolve",
"(",
"calendar",
",",
"\"dateTimeFormats\"",
")",
";",
"return",
"new",
"Format",
"(",
"string",
"(",
"node",
",",
"\"short\"",
")",
","... | Parse standard date-time wrapper formats of varying sizes. | [
"Parse",
"standard",
"date",
"-",
"time",
"wrapper",
"formats",
"of",
"varying",
"sizes",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java#L761-L768 | train |
Squarespace/cldr | compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java | DataReader.parseDateTimeSkeletons | private List<Skeleton> parseDateTimeSkeletons(JsonObject calendar) {
JsonObject node = resolve(calendar, "dateTimeFormats", "availableFormats");
List<Skeleton> value = new ArrayList<>();
for (String key : objectKeys(node)) {
value.add(new Skeleton(key, string(node, key)));
}
return value;
} | java | private List<Skeleton> parseDateTimeSkeletons(JsonObject calendar) {
JsonObject node = resolve(calendar, "dateTimeFormats", "availableFormats");
List<Skeleton> value = new ArrayList<>();
for (String key : objectKeys(node)) {
value.add(new Skeleton(key, string(node, key)));
}
return value;
} | [
"private",
"List",
"<",
"Skeleton",
">",
"parseDateTimeSkeletons",
"(",
"JsonObject",
"calendar",
")",
"{",
"JsonObject",
"node",
"=",
"resolve",
"(",
"calendar",
",",
"\"dateTimeFormats\"",
",",
"\"availableFormats\"",
")",
";",
"List",
"<",
"Skeleton",
">",
"v... | Parse date-time skeletons. | [
"Parse",
"date",
"-",
"time",
"skeletons",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java#L773-L780 | train |
Squarespace/cldr | compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java | DataReader.parseMinDays | private Map<String, Integer> parseMinDays(JsonObject root) {
JsonObject node = resolve(root, "supplemental", "weekData", "minDays");
Map<String, Integer> m = new HashMap<>();
for (String key : objectKeys(node)) {
m.put(key, Integer.valueOf(string(node, key)));
}
return m;
} | java | private Map<String, Integer> parseMinDays(JsonObject root) {
JsonObject node = resolve(root, "supplemental", "weekData", "minDays");
Map<String, Integer> m = new HashMap<>();
for (String key : objectKeys(node)) {
m.put(key, Integer.valueOf(string(node, key)));
}
return m;
} | [
"private",
"Map",
"<",
"String",
",",
"Integer",
">",
"parseMinDays",
"(",
"JsonObject",
"root",
")",
"{",
"JsonObject",
"node",
"=",
"resolve",
"(",
"root",
",",
"\"supplemental\"",
",",
"\"weekData\"",
",",
"\"minDays\"",
")",
";",
"Map",
"<",
"String",
... | Parse the "min days" values. This indicates the minimum number of days
a week must include for it to be counted as the first week of the year;
otherwise it's the last week of the previous year. | [
"Parse",
"the",
"min",
"days",
"values",
".",
"This",
"indicates",
"the",
"minimum",
"number",
"of",
"days",
"a",
"week",
"must",
"include",
"for",
"it",
"to",
"be",
"counted",
"as",
"the",
"first",
"week",
"of",
"the",
"year",
";",
"otherwise",
"it",
... | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java#L787-L794 | train |
Squarespace/cldr | compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java | DataReader.parseFirstDays | private Map<String, Integer> parseFirstDays(JsonObject root) {
JsonObject node = resolve(root, "supplemental", "weekData", "firstDay");
Map<String, Integer> m = new HashMap<>();
for (String key : objectKeys(node)) {
String value = string(node, key);
m.put(key, NUMERIC_DAYS.get(value));
}
... | java | private Map<String, Integer> parseFirstDays(JsonObject root) {
JsonObject node = resolve(root, "supplemental", "weekData", "firstDay");
Map<String, Integer> m = new HashMap<>();
for (String key : objectKeys(node)) {
String value = string(node, key);
m.put(key, NUMERIC_DAYS.get(value));
}
... | [
"private",
"Map",
"<",
"String",
",",
"Integer",
">",
"parseFirstDays",
"(",
"JsonObject",
"root",
")",
"{",
"JsonObject",
"node",
"=",
"resolve",
"(",
"root",
",",
"\"supplemental\"",
",",
"\"weekData\"",
",",
"\"firstDay\"",
")",
";",
"Map",
"<",
"String",... | Parse the "first day" values. This is the value of the first day of the week
in a calendar view. | [
"Parse",
"the",
"first",
"day",
"values",
".",
"This",
"is",
"the",
"value",
"of",
"the",
"first",
"day",
"of",
"the",
"week",
"in",
"a",
"calendar",
"view",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java#L800-L808 | train |
Squarespace/cldr | compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java | DataReader.weekdayMap | private String[] weekdayMap(JsonObject node) {
String[] res = new String[7];
for (int i = 0; i < 7; i++) {
res[i] = node.get(WEEKDAY_KEYS[i]).getAsString();
}
return res;
} | java | private String[] weekdayMap(JsonObject node) {
String[] res = new String[7];
for (int i = 0; i < 7; i++) {
res[i] = node.get(WEEKDAY_KEYS[i]).getAsString();
}
return res;
} | [
"private",
"String",
"[",
"]",
"weekdayMap",
"(",
"JsonObject",
"node",
")",
"{",
"String",
"[",
"]",
"res",
"=",
"new",
"String",
"[",
"7",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"7",
";",
"i",
"++",
")",
"{",
"res",
"[",... | Extract weekday names from a locale's mapping. | [
"Extract",
"weekday",
"names",
"from",
"a",
"locale",
"s",
"mapping",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java#L813-L819 | train |
Squarespace/cldr | compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java | DataReader.parsePlurals | private void parsePlurals(JsonObject root, String type, Map<String, PluralData> map) {
JsonObject node = resolve(root, "supplemental", type);
for (Map.Entry<String, JsonElement> entry : node.entrySet()) {
String language = entry.getKey();
PluralData data = new PluralData();
for (Map.Entry<Stri... | java | private void parsePlurals(JsonObject root, String type, Map<String, PluralData> map) {
JsonObject node = resolve(root, "supplemental", type);
for (Map.Entry<String, JsonElement> entry : node.entrySet()) {
String language = entry.getKey();
PluralData data = new PluralData();
for (Map.Entry<Stri... | [
"private",
"void",
"parsePlurals",
"(",
"JsonObject",
"root",
",",
"String",
"type",
",",
"Map",
"<",
"String",
",",
"PluralData",
">",
"map",
")",
"{",
"JsonObject",
"node",
"=",
"resolve",
"(",
"root",
",",
"\"supplemental\"",
",",
"type",
")",
";",
"f... | Parse pluralization rules. These rules indicate which pluralization category
is in effect, based on the value of the plural operands which are computed
from an integer or decimal value. | [
"Parse",
"pluralization",
"rules",
".",
"These",
"rules",
"indicate",
"which",
"pluralization",
"category",
"is",
"in",
"effect",
"based",
"on",
"the",
"value",
"of",
"the",
"plural",
"operands",
"which",
"are",
"computed",
"from",
"an",
"integer",
"or",
"deci... | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java#L826-L848 | train |
Squarespace/cldr | compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java | DataReader.parseNumberData | private NumberData parseNumberData(LocaleID id, String code, JsonObject root) {
NumberData data = getNumberData(id);
JsonObject numbers = resolve(root, "numbers");
data.minimumGroupingDigits = Integer.valueOf(string(numbers, "minimumGroupingDigits"));
JsonObject symbols = resolve(numbers, "symbols-num... | java | private NumberData parseNumberData(LocaleID id, String code, JsonObject root) {
NumberData data = getNumberData(id);
JsonObject numbers = resolve(root, "numbers");
data.minimumGroupingDigits = Integer.valueOf(string(numbers, "minimumGroupingDigits"));
JsonObject symbols = resolve(numbers, "symbols-num... | [
"private",
"NumberData",
"parseNumberData",
"(",
"LocaleID",
"id",
",",
"String",
"code",
",",
"JsonObject",
"root",
")",
"{",
"NumberData",
"data",
"=",
"getNumberData",
"(",
"id",
")",
";",
"JsonObject",
"numbers",
"=",
"resolve",
"(",
"root",
",",
"\"numb... | Parse number and some currency data for locale. | [
"Parse",
"number",
"and",
"some",
"currency",
"data",
"for",
"locale",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java#L853-L895 | train |
Squarespace/cldr | compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java | DataReader.parseCurrencyData | private void parseCurrencyData(LocaleID id, String code, JsonObject root) {
NumberData data = getNumberData(id);
data.currencySymbols = new LinkedHashMap<>();
data.narrowCurrencySymbols = new LinkedHashMap<>();
data.currencyDisplayName = new LinkedHashMap<>();
data.currencyDisplayNames = new LinkedH... | java | private void parseCurrencyData(LocaleID id, String code, JsonObject root) {
NumberData data = getNumberData(id);
data.currencySymbols = new LinkedHashMap<>();
data.narrowCurrencySymbols = new LinkedHashMap<>();
data.currencyDisplayName = new LinkedHashMap<>();
data.currencyDisplayNames = new LinkedH... | [
"private",
"void",
"parseCurrencyData",
"(",
"LocaleID",
"id",
",",
"String",
"code",
",",
"JsonObject",
"root",
")",
"{",
"NumberData",
"data",
"=",
"getNumberData",
"(",
"id",
")",
";",
"data",
".",
"currencySymbols",
"=",
"new",
"LinkedHashMap",
"<>",
"("... | Parse locale-specific currency data. | [
"Parse",
"locale",
"-",
"specific",
"currency",
"data",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java#L900-L925 | train |
Squarespace/cldr | compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java | DataReader.parseSupplementalCurrencyData | private void parseSupplementalCurrencyData(JsonObject root) {
JsonObject fractions = resolve(root, "supplemental", "currencyData", "fractions");
for (String code : objectKeys(fractions)) {
CurrencyData data = getCurrencyData(code);
JsonObject node = fractions.get(code).getAsJsonObject();
data.... | java | private void parseSupplementalCurrencyData(JsonObject root) {
JsonObject fractions = resolve(root, "supplemental", "currencyData", "fractions");
for (String code : objectKeys(fractions)) {
CurrencyData data = getCurrencyData(code);
JsonObject node = fractions.get(code).getAsJsonObject();
data.... | [
"private",
"void",
"parseSupplementalCurrencyData",
"(",
"JsonObject",
"root",
")",
"{",
"JsonObject",
"fractions",
"=",
"resolve",
"(",
"root",
",",
"\"supplemental\"",
",",
"\"currencyData\"",
",",
"\"fractions\"",
")",
";",
"for",
"(",
"String",
"code",
":",
... | Parse supplemental currency data. | [
"Parse",
"supplemental",
"currency",
"data",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java#L930-L938 | train |
Squarespace/cldr | compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java | DataReader.getNumberData | private NumberData getNumberData(LocaleID id) {
NumberData data = numbers.get(id);
if (data == null) {
data = new NumberData();
data.setID(id);
numbers.put(id, data);
}
return data;
} | java | private NumberData getNumberData(LocaleID id) {
NumberData data = numbers.get(id);
if (data == null) {
data = new NumberData();
data.setID(id);
numbers.put(id, data);
}
return data;
} | [
"private",
"NumberData",
"getNumberData",
"(",
"LocaleID",
"id",
")",
"{",
"NumberData",
"data",
"=",
"numbers",
".",
"get",
"(",
"id",
")",
";",
"if",
"(",
"data",
"==",
"null",
")",
"{",
"data",
"=",
"new",
"NumberData",
"(",
")",
";",
"data",
".",... | Get or create the number data object for this locale. | [
"Get",
"or",
"create",
"the",
"number",
"data",
"object",
"for",
"this",
"locale",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java#L943-L951 | train |
Squarespace/cldr | compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java | DataReader.getCurrencyData | private CurrencyData getCurrencyData(String code) {
CurrencyData data = currencies.get(code);
if (data == null) {
data = new CurrencyData();
data.setCode(code);
currencies.put(code, data);
}
return data;
} | java | private CurrencyData getCurrencyData(String code) {
CurrencyData data = currencies.get(code);
if (data == null) {
data = new CurrencyData();
data.setCode(code);
currencies.put(code, data);
}
return data;
} | [
"private",
"CurrencyData",
"getCurrencyData",
"(",
"String",
"code",
")",
"{",
"CurrencyData",
"data",
"=",
"currencies",
".",
"get",
"(",
"code",
")",
";",
"if",
"(",
"data",
"==",
"null",
")",
"{",
"data",
"=",
"new",
"CurrencyData",
"(",
")",
";",
"... | Get or create the currency data object for this code. | [
"Get",
"or",
"create",
"the",
"currency",
"data",
"object",
"for",
"this",
"code",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java#L956-L964 | train |
Squarespace/cldr | compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java | DataReader.parseTimeZoneInfos | private List<TimeZoneInfo> parseTimeZoneInfos(String code, JsonObject root) {
JsonObject node = resolve(root, "main", code, "dates", "timeZoneNames", "zone");
return parseTimeZoneInfo(node, Collections.emptyList());
} | java | private List<TimeZoneInfo> parseTimeZoneInfos(String code, JsonObject root) {
JsonObject node = resolve(root, "main", code, "dates", "timeZoneNames", "zone");
return parseTimeZoneInfo(node, Collections.emptyList());
} | [
"private",
"List",
"<",
"TimeZoneInfo",
">",
"parseTimeZoneInfos",
"(",
"String",
"code",
",",
"JsonObject",
"root",
")",
"{",
"JsonObject",
"node",
"=",
"resolve",
"(",
"root",
",",
"\"main\"",
",",
"code",
",",
"\"dates\"",
",",
"\"timeZoneNames\"",
",",
"... | Parse timezone names. | [
"Parse",
"timezone",
"names",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java#L1029-L1032 | train |
Squarespace/cldr | compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java | DataReader.parseTimeZoneInfo | private List<TimeZoneInfo> parseTimeZoneInfo(JsonObject root, List<String> prefix) {
List<TimeZoneInfo> zones = new ArrayList<>();
for (String label : objectKeys(root)) {
JsonObject value = resolve(root, label);
List<String> zone = new ArrayList<>(prefix);
zone.add(label);
if (isTimeZone... | java | private List<TimeZoneInfo> parseTimeZoneInfo(JsonObject root, List<String> prefix) {
List<TimeZoneInfo> zones = new ArrayList<>();
for (String label : objectKeys(root)) {
JsonObject value = resolve(root, label);
List<String> zone = new ArrayList<>(prefix);
zone.add(label);
if (isTimeZone... | [
"private",
"List",
"<",
"TimeZoneInfo",
">",
"parseTimeZoneInfo",
"(",
"JsonObject",
"root",
",",
"List",
"<",
"String",
">",
"prefix",
")",
"{",
"List",
"<",
"TimeZoneInfo",
">",
"zones",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"String... | Recursively parse the zone labels until we get to a zone info object. | [
"Recursively",
"parse",
"the",
"zone",
"labels",
"until",
"we",
"get",
"to",
"a",
"zone",
"info",
"object",
"."
] | 54b752d4ec2457df56e98461618f9c0eec41e1e1 | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java#L1037-L1051 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.