repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 194 | func_name stringlengths 6 111 | whole_func_string stringlengths 80 3.8k | language stringclasses 1
value | func_code_string stringlengths 80 3.8k | func_code_tokens listlengths 20 697 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 434 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
GeoLatte/geolatte-common-hibernate | src/main/java/org/geolatte/common/automapper/TableRef.java | TableRef.valueOf | public static TableRef valueOf(String[] components) {
if (components == null) {
throw new IllegalArgumentException("Null argument not allowed.");
}
switch (components.length) {
case 1:
return new TableRef(null, null, components[0]);
case 2:
return new TableRef(null, components[0], components[1]);
case 3:
return new TableRef(components[0], components[1], components[2]);
default:
throw new IllegalArgumentException("String array has more than 3 elements.");
}
} | java | public static TableRef valueOf(String[] components) {
if (components == null) {
throw new IllegalArgumentException("Null argument not allowed.");
}
switch (components.length) {
case 1:
return new TableRef(null, null, components[0]);
case 2:
return new TableRef(null, components[0], components[1]);
case 3:
return new TableRef(components[0], components[1], components[2]);
default:
throw new IllegalArgumentException("String array has more than 3 elements.");
}
} | [
"public",
"static",
"TableRef",
"valueOf",
"(",
"String",
"[",
"]",
"components",
")",
"{",
"if",
"(",
"components",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Null argument not allowed.\"",
")",
";",
"}",
"switch",
"(",
"compo... | Creates an instance from an array of table ref components,
<p/>
<p>The components should be (in order): catalog (optional), schema (optional), table name. if the catalog or schema
component is an empty String, the catalog or schema will be set to <code>null</code>.</p>
@param components the components of the reference.
@return a new instance corresponding to the specified components.
@throws IllegalArgumentException if the parameter is null, or has more than 3 elements. | [
"Creates",
"an",
"instance",
"from",
"an",
"array",
"of",
"table",
"ref",
"components",
"<p",
"/",
">",
"<p",
">",
"The",
"components",
"should",
"be",
"(",
"in",
"order",
")",
":",
"catalog",
"(",
"optional",
")",
"schema",
"(",
"optional",
")",
"tabl... | train | https://github.com/GeoLatte/geolatte-common-hibernate/blob/2e871c70e506df2485d91152fbd0955c94de1d39/src/main/java/org/geolatte/common/automapper/TableRef.java#L95-L109 |
aspectran/aspectran | web/src/main/java/com/aspectran/web/support/http/HttpStatusSetter.java | HttpStatusSetter.setStatus | public static void setStatus(HttpStatus httpStatus, Translet translet) {
translet.getResponseAdapter().setStatus(httpStatus.value());
} | java | public static void setStatus(HttpStatus httpStatus, Translet translet) {
translet.getResponseAdapter().setStatus(httpStatus.value());
} | [
"public",
"static",
"void",
"setStatus",
"(",
"HttpStatus",
"httpStatus",
",",
"Translet",
"translet",
")",
"{",
"translet",
".",
"getResponseAdapter",
"(",
")",
".",
"setStatus",
"(",
"httpStatus",
".",
"value",
"(",
")",
")",
";",
"}"
] | Sets the status code.
@param httpStatus the http status code
@param translet the Translet instance | [
"Sets",
"the",
"status",
"code",
"."
] | train | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/web/src/main/java/com/aspectran/web/support/http/HttpStatusSetter.java#L31-L33 |
mapsforge/mapsforge | mapsforge-core/src/main/java/org/mapsforge/core/util/MercatorProjection.java | MercatorProjection.longitudeToTileXWithScaleFactor | public static int longitudeToTileXWithScaleFactor(double longitude, double scaleFactor) {
return pixelXToTileXWithScaleFactor(longitudeToPixelXWithScaleFactor(longitude, scaleFactor, DUMMY_TILE_SIZE), scaleFactor, DUMMY_TILE_SIZE);
} | java | public static int longitudeToTileXWithScaleFactor(double longitude, double scaleFactor) {
return pixelXToTileXWithScaleFactor(longitudeToPixelXWithScaleFactor(longitude, scaleFactor, DUMMY_TILE_SIZE), scaleFactor, DUMMY_TILE_SIZE);
} | [
"public",
"static",
"int",
"longitudeToTileXWithScaleFactor",
"(",
"double",
"longitude",
",",
"double",
"scaleFactor",
")",
"{",
"return",
"pixelXToTileXWithScaleFactor",
"(",
"longitudeToPixelXWithScaleFactor",
"(",
"longitude",
",",
"scaleFactor",
",",
"DUMMY_TILE_SIZE",... | Converts a longitude coordinate (in degrees) to the tile X number at a certain scale factor.
@param longitude the longitude coordinate that should be converted.
@param scaleFactor the scale factor at which the coordinate should be converted.
@return the tile X number of the longitude value. | [
"Converts",
"a",
"longitude",
"coordinate",
"(",
"in",
"degrees",
")",
"to",
"the",
"tile",
"X",
"number",
"at",
"a",
"certain",
"scale",
"factor",
"."
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-core/src/main/java/org/mapsforge/core/util/MercatorProjection.java#L289-L291 |
languagetool-org/languagetool | languagetool-core/src/main/java/org/languagetool/tools/StringTools.java | StringTools.uppercaseFirstChar | @Nullable
public static String uppercaseFirstChar(String str, Language language) {
if (language != null && "nl".equals(language.getShortCode()) && str != null && str.toLowerCase().startsWith("ij")) {
// hack to fix https://github.com/languagetool-org/languagetool/issues/148
return "IJ" + str.substring(2);
} else {
return changeFirstCharCase(str, true);
}
} | java | @Nullable
public static String uppercaseFirstChar(String str, Language language) {
if (language != null && "nl".equals(language.getShortCode()) && str != null && str.toLowerCase().startsWith("ij")) {
// hack to fix https://github.com/languagetool-org/languagetool/issues/148
return "IJ" + str.substring(2);
} else {
return changeFirstCharCase(str, true);
}
} | [
"@",
"Nullable",
"public",
"static",
"String",
"uppercaseFirstChar",
"(",
"String",
"str",
",",
"Language",
"language",
")",
"{",
"if",
"(",
"language",
"!=",
"null",
"&&",
"\"nl\"",
".",
"equals",
"(",
"language",
".",
"getShortCode",
"(",
")",
")",
"&&",... | Like {@link #uppercaseFirstChar(String)}, but handles a special case for Dutch (IJ in
e.g. "ijsselmeer" -> "IJsselmeer").
@param language the language, will be ignored if it's {@code null}
@since 2.7 | [
"Like",
"{"
] | train | https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/tools/StringTools.java#L206-L214 |
alkacon/opencms-core | src/org/opencms/file/CmsProperty.java | CmsProperty.createValueFromMap | private String createValueFromMap(Map<String, String> valueMap) {
if (valueMap == null) {
return null;
}
StringBuffer result = new StringBuffer(valueMap.size() * 32);
Iterator<Map.Entry<String, String>> i = valueMap.entrySet().iterator();
while (i.hasNext()) {
Map.Entry<String, String> entry = i.next();
String key = entry.getKey();
String value = entry.getValue();
key = replaceDelimiter(key, VALUE_LIST_DELIMITER, VALUE_LIST_DELIMITER_REPLACEMENT);
key = replaceDelimiter(key, VALUE_MAP_DELIMITER, VALUE_MAP_DELIMITER_REPLACEMENT);
value = replaceDelimiter(value, VALUE_LIST_DELIMITER, VALUE_LIST_DELIMITER_REPLACEMENT);
value = replaceDelimiter(value, VALUE_MAP_DELIMITER, VALUE_MAP_DELIMITER_REPLACEMENT);
result.append(key);
result.append(VALUE_MAP_DELIMITER);
result.append(value);
if (i.hasNext()) {
result.append(VALUE_LIST_DELIMITER);
}
}
return result.toString();
} | java | private String createValueFromMap(Map<String, String> valueMap) {
if (valueMap == null) {
return null;
}
StringBuffer result = new StringBuffer(valueMap.size() * 32);
Iterator<Map.Entry<String, String>> i = valueMap.entrySet().iterator();
while (i.hasNext()) {
Map.Entry<String, String> entry = i.next();
String key = entry.getKey();
String value = entry.getValue();
key = replaceDelimiter(key, VALUE_LIST_DELIMITER, VALUE_LIST_DELIMITER_REPLACEMENT);
key = replaceDelimiter(key, VALUE_MAP_DELIMITER, VALUE_MAP_DELIMITER_REPLACEMENT);
value = replaceDelimiter(value, VALUE_LIST_DELIMITER, VALUE_LIST_DELIMITER_REPLACEMENT);
value = replaceDelimiter(value, VALUE_MAP_DELIMITER, VALUE_MAP_DELIMITER_REPLACEMENT);
result.append(key);
result.append(VALUE_MAP_DELIMITER);
result.append(value);
if (i.hasNext()) {
result.append(VALUE_LIST_DELIMITER);
}
}
return result.toString();
} | [
"private",
"String",
"createValueFromMap",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"valueMap",
")",
"{",
"if",
"(",
"valueMap",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"StringBuffer",
"result",
"=",
"new",
"StringBuffer",
"(",
"valueMap"... | Returns the single String value representation for the given value map.<p>
@param valueMap the value map to create the single String value for
@return the single String value representation for the given value map | [
"Returns",
"the",
"single",
"String",
"value",
"representation",
"for",
"the",
"given",
"value",
"map",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsProperty.java#L1304-L1327 |
ksclarke/vertx-pairtree | src/main/java/info/freelibrary/pairtree/PairtreeUtils.java | PairtreeUtils.removePrefix | public static String removePrefix(final String aPrefix, final String aID) {
Objects.requireNonNull(aPrefix, LOGGER.getMessage(MessageCodes.PT_006));
Objects.requireNonNull(aID, LOGGER.getMessage(MessageCodes.PT_004));
final String id;
if (aID.indexOf(aPrefix) == 0) {
id = aID.substring(aPrefix.length());
} else {
id = aID;
}
return id;
} | java | public static String removePrefix(final String aPrefix, final String aID) {
Objects.requireNonNull(aPrefix, LOGGER.getMessage(MessageCodes.PT_006));
Objects.requireNonNull(aID, LOGGER.getMessage(MessageCodes.PT_004));
final String id;
if (aID.indexOf(aPrefix) == 0) {
id = aID.substring(aPrefix.length());
} else {
id = aID;
}
return id;
} | [
"public",
"static",
"String",
"removePrefix",
"(",
"final",
"String",
"aPrefix",
",",
"final",
"String",
"aID",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"aPrefix",
",",
"LOGGER",
".",
"getMessage",
"(",
"MessageCodes",
".",
"PT_006",
")",
")",
";",
... | Removes the supplied Pairtree prefix from the supplied ID.
@param aPrefix A Pairtree prefix
@param aID An ID
@return The ID without the Pairtree prefix prepended to it
@throws PairtreeRuntimeException If the supplied prefix or ID is null | [
"Removes",
"the",
"supplied",
"Pairtree",
"prefix",
"from",
"the",
"supplied",
"ID",
"."
] | train | https://github.com/ksclarke/vertx-pairtree/blob/b2ea1e32057e5df262e9265540d346a732b718df/src/main/java/info/freelibrary/pairtree/PairtreeUtils.java#L343-L356 |
lotaris/rox-commons-maven-plugin | src/main/java/com/lotaris/maven/plugin/AbstractGenericMojo.java | AbstractGenericMojo.useCleanPlugin | protected void useCleanPlugin(Element ... elements) throws MojoExecutionException {
List<Element> tempElems = new ArrayList<>(Arrays.asList(elements));
tempElems.add(new Element("excludeDefaultDirectories", "true"));
// Configure the Maven Clean Plugin to clean working files
executeMojo(
plugin(
groupId("org.apache.maven.plugins"),
artifactId("maven-clean-plugin"),
version("2.5")
),
goal("clean"),
configuration(
tempElems.toArray(new Element[tempElems.size()])
),
executionEnvironment(
project,
session,
pluginManager
)
);
} | java | protected void useCleanPlugin(Element ... elements) throws MojoExecutionException {
List<Element> tempElems = new ArrayList<>(Arrays.asList(elements));
tempElems.add(new Element("excludeDefaultDirectories", "true"));
// Configure the Maven Clean Plugin to clean working files
executeMojo(
plugin(
groupId("org.apache.maven.plugins"),
artifactId("maven-clean-plugin"),
version("2.5")
),
goal("clean"),
configuration(
tempElems.toArray(new Element[tempElems.size()])
),
executionEnvironment(
project,
session,
pluginManager
)
);
} | [
"protected",
"void",
"useCleanPlugin",
"(",
"Element",
"...",
"elements",
")",
"throws",
"MojoExecutionException",
"{",
"List",
"<",
"Element",
">",
"tempElems",
"=",
"new",
"ArrayList",
"<>",
"(",
"Arrays",
".",
"asList",
"(",
"elements",
")",
")",
";",
"te... | Utility method to use the clean plugin in the cleanup methods
@param elements Elements to configure the clean plugin
@throws MojoExecutionException Throws when error occurred in the clean plugin | [
"Utility",
"method",
"to",
"use",
"the",
"clean",
"plugin",
"in",
"the",
"cleanup",
"methods"
] | train | https://github.com/lotaris/rox-commons-maven-plugin/blob/e2602d7f1e8c2e6994c0df07cc0003828adfa2af/src/main/java/com/lotaris/maven/plugin/AbstractGenericMojo.java#L122-L143 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.