repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 196 | func_name stringlengths 7 107 | whole_func_string stringlengths 76 3.82k | language stringclasses 1
value | func_code_string stringlengths 76 3.82k | func_code_tokens listlengths 22 717 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 508 | split_name stringclasses 1
value | func_code_url stringlengths 111 310 |
|---|---|---|---|---|---|---|---|---|---|---|
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java | SVGPath.quadTo | public SVGPath quadTo(double[] c1xy, double[] xy) {
return append(PATH_QUAD_TO).append(c1xy[0]).append(c1xy[1]).append(xy[0]).append(xy[1]);
} | java | public SVGPath quadTo(double[] c1xy, double[] xy) {
return append(PATH_QUAD_TO).append(c1xy[0]).append(c1xy[1]).append(xy[0]).append(xy[1]);
} | [
"public",
"SVGPath",
"quadTo",
"(",
"double",
"[",
"]",
"c1xy",
",",
"double",
"[",
"]",
"xy",
")",
"{",
"return",
"append",
"(",
"PATH_QUAD_TO",
")",
".",
"append",
"(",
"c1xy",
"[",
"0",
"]",
")",
".",
"append",
"(",
"c1xy",
"[",
"1",
"]",
")",... | Quadratic Bezier line to the given coordinates.
@param c1xy first control point
@param xy new coordinates
@return path object, for compact syntax. | [
"Quadratic",
"Bezier",
"line",
"to",
"the",
"given",
"coordinates",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java#L468-L470 |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/geometric/PGpoint.java | PGpoint.toBytes | public void toBytes(byte[] b, int offset) {
ByteConverter.float8(b, offset, x);
ByteConverter.float8(b, offset + 8, y);
} | java | public void toBytes(byte[] b, int offset) {
ByteConverter.float8(b, offset, x);
ByteConverter.float8(b, offset + 8, y);
} | [
"public",
"void",
"toBytes",
"(",
"byte",
"[",
"]",
"b",
",",
"int",
"offset",
")",
"{",
"ByteConverter",
".",
"float8",
"(",
"b",
",",
"offset",
",",
"x",
")",
";",
"ByteConverter",
".",
"float8",
"(",
"b",
",",
"offset",
"+",
"8",
",",
"y",
")"... | Populate the byte array with PGpoint in the binary syntax expected by org.postgresql. | [
"Populate",
"the",
"byte",
"array",
"with",
"PGpoint",
"in",
"the",
"binary",
"syntax",
"expected",
"by",
"org",
".",
"postgresql",
"."
] | train | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/geometric/PGpoint.java#L121-L124 |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/deps/DepTreeNode.java | DepTreeNode.populateDepMap | void populateDepMap(Map<String, DependencyInfo> depMap) {
if (uri != null) {
depMap.put(getFullPathName(), new DependencyInfo(defineDependencies, requireDependencies, dependentFeatures, uri));
}
if (children != null) {
for (Entry<String, DepTreeNode> entry : children.entrySet()) {
entry.getValue().populateDepMap(depMap);
}
}
} | java | void populateDepMap(Map<String, DependencyInfo> depMap) {
if (uri != null) {
depMap.put(getFullPathName(), new DependencyInfo(defineDependencies, requireDependencies, dependentFeatures, uri));
}
if (children != null) {
for (Entry<String, DepTreeNode> entry : children.entrySet()) {
entry.getValue().populateDepMap(depMap);
}
}
} | [
"void",
"populateDepMap",
"(",
"Map",
"<",
"String",
",",
"DependencyInfo",
">",
"depMap",
")",
"{",
"if",
"(",
"uri",
"!=",
"null",
")",
"{",
"depMap",
".",
"put",
"(",
"getFullPathName",
"(",
")",
",",
"new",
"DependencyInfo",
"(",
"defineDependencies",
... | Populates the provided map with the dependencies, keyed by
full path name. This is done to facilitate more efficient
lookups of the dependencies.
@param depMap | [
"Populates",
"the",
"provided",
"map",
"with",
"the",
"dependencies",
"keyed",
"by",
"full",
"path",
"name",
".",
"This",
"is",
"done",
"to",
"facilitate",
"more",
"efficient",
"lookups",
"of",
"the",
"dependencies",
"."
] | train | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/deps/DepTreeNode.java#L612-L621 |
rundeck/rundeck | core/src/main/java/com/dtolabs/rundeck/core/rules/Rules.java | Rules.conditionsRule | public static Rule conditionsRule(final Set<Condition> conditions, final Map<String, String> results) {
return conditionsRule(conditions, States.state(results));
} | java | public static Rule conditionsRule(final Set<Condition> conditions, final Map<String, String> results) {
return conditionsRule(conditions, States.state(results));
} | [
"public",
"static",
"Rule",
"conditionsRule",
"(",
"final",
"Set",
"<",
"Condition",
">",
"conditions",
",",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"results",
")",
"{",
"return",
"conditionsRule",
"(",
"conditions",
",",
"States",
".",
"state",
... | Create a rule: predicate(conditions) => new state(results)
@param conditions conditions
@param results results
@return rule | [
"Create",
"a",
"rule",
":",
"predicate",
"(",
"conditions",
")",
"=",
">",
"new",
"state",
"(",
"results",
")"
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/rules/Rules.java#L140-L142 |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/deployment/reflect/ClassReflectionIndexUtil.java | ClassReflectionIndexUtil.findAllMethods | public static Collection<Method> findAllMethods(final DeploymentReflectionIndex deploymentReflectionIndex, final ClassReflectionIndex classReflectionIndex, final String methodName, int paramCount) {
Collection<Method> methods = classReflectionIndex.getAllMethods(methodName, paramCount);
if (!methods.isEmpty()) {
return methods;
}
// find on super class
Class<?> superClass = classReflectionIndex.getIndexedClass().getSuperclass();
if (superClass != null) {
ClassReflectionIndex superClassIndex = deploymentReflectionIndex.getClassIndex(superClass);
if (superClassIndex != null) {
return findAllMethods(deploymentReflectionIndex, superClassIndex, methodName, paramCount);
}
}
return methods;
} | java | public static Collection<Method> findAllMethods(final DeploymentReflectionIndex deploymentReflectionIndex, final ClassReflectionIndex classReflectionIndex, final String methodName, int paramCount) {
Collection<Method> methods = classReflectionIndex.getAllMethods(methodName, paramCount);
if (!methods.isEmpty()) {
return methods;
}
// find on super class
Class<?> superClass = classReflectionIndex.getIndexedClass().getSuperclass();
if (superClass != null) {
ClassReflectionIndex superClassIndex = deploymentReflectionIndex.getClassIndex(superClass);
if (superClassIndex != null) {
return findAllMethods(deploymentReflectionIndex, superClassIndex, methodName, paramCount);
}
}
return methods;
} | [
"public",
"static",
"Collection",
"<",
"Method",
">",
"findAllMethods",
"(",
"final",
"DeploymentReflectionIndex",
"deploymentReflectionIndex",
",",
"final",
"ClassReflectionIndex",
"classReflectionIndex",
",",
"final",
"String",
"methodName",
",",
"int",
"paramCount",
")... | Finds and returns all methods corresponding to the passed method <code>name</code> and method <code>paramCount</code>.
The passed <code>classReflectionIndex</code> will be used to traverse the class hierarchy while finding the method.
<p/>
Returns empty collection if no such method is found
@param deploymentReflectionIndex The deployment reflection index
@param classReflectionIndex The class reflection index which will be used to traverse the class hierarchy to find the method
@param methodName The name of the method
@param paramCount The number of params accepted by the method
@return | [
"Finds",
"and",
"returns",
"all",
"methods",
"corresponding",
"to",
"the",
"passed",
"method",
"<code",
">",
"name<",
"/",
"code",
">",
"and",
"method",
"<code",
">",
"paramCount<",
"/",
"code",
">",
".",
"The",
"passed",
"<code",
">",
"classReflectionIndex<... | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/reflect/ClassReflectionIndexUtil.java#L183-L198 |
xcesco/kripton | kripton/src/main/java/com/abubusoft/kripton/persistence/xml/internal/StringPool.java | StringPool.get | public String get(char[] array, int start, int length) {
// Compute an arbitrary hash of the content
int hashCode = 0;
for (int i = start; i < start + length; i++) {
hashCode = (hashCode * 31) + array[i];
}
// Pick a bucket using Doug Lea's supplemental secondaryHash function
// (from HashMap)
hashCode ^= (hashCode >>> 20) ^ (hashCode >>> 12);
hashCode ^= (hashCode >>> 7) ^ (hashCode >>> 4);
int index = hashCode & (pool.length - 1);
String pooled = pool[index];
if (pooled != null && contentEquals(pooled, array, start, length)) {
return pooled;
}
String result = new String(array, start, length);
pool[index] = result;
return result;
} | java | public String get(char[] array, int start, int length) {
// Compute an arbitrary hash of the content
int hashCode = 0;
for (int i = start; i < start + length; i++) {
hashCode = (hashCode * 31) + array[i];
}
// Pick a bucket using Doug Lea's supplemental secondaryHash function
// (from HashMap)
hashCode ^= (hashCode >>> 20) ^ (hashCode >>> 12);
hashCode ^= (hashCode >>> 7) ^ (hashCode >>> 4);
int index = hashCode & (pool.length - 1);
String pooled = pool[index];
if (pooled != null && contentEquals(pooled, array, start, length)) {
return pooled;
}
String result = new String(array, start, length);
pool[index] = result;
return result;
} | [
"public",
"String",
"get",
"(",
"char",
"[",
"]",
"array",
",",
"int",
"start",
",",
"int",
"length",
")",
"{",
"// Compute an arbitrary hash of the content",
"int",
"hashCode",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"start",
";",
"i",
"<",
"start",... | Returns a string equal to {@code new String(array, start, length)}.
@param array the array
@param start the start
@param length the length
@return value | [
"Returns",
"a",
"string",
"equal",
"to",
"{",
"@code",
"new",
"String",
"(",
"array",
"start",
"length",
")",
"}",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton/src/main/java/com/abubusoft/kripton/persistence/xml/internal/StringPool.java#L59-L80 |
cdk/cdk | descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/XLogPDescriptor.java | XLogPDescriptor.getAromaticNitrogensCount | private int getAromaticNitrogensCount(IAtomContainer ac, IAtom atom) {
List<IAtom> neighbours = ac.getConnectedAtomsList(atom);
int narocounter = 0;
for (IAtom neighbour : neighbours) {
if (neighbour.getSymbol().equals("N") && (Boolean) neighbour.getProperty("IS_IN_AROMATIC_RING")) {
narocounter += 1;
}
}
return narocounter;
} | java | private int getAromaticNitrogensCount(IAtomContainer ac, IAtom atom) {
List<IAtom> neighbours = ac.getConnectedAtomsList(atom);
int narocounter = 0;
for (IAtom neighbour : neighbours) {
if (neighbour.getSymbol().equals("N") && (Boolean) neighbour.getProperty("IS_IN_AROMATIC_RING")) {
narocounter += 1;
}
}
return narocounter;
} | [
"private",
"int",
"getAromaticNitrogensCount",
"(",
"IAtomContainer",
"ac",
",",
"IAtom",
"atom",
")",
"{",
"List",
"<",
"IAtom",
">",
"neighbours",
"=",
"ac",
".",
"getConnectedAtomsList",
"(",
"atom",
")",
";",
"int",
"narocounter",
"=",
"0",
";",
"for",
... | Gets the aromaticNitrogensCount attribute of the XLogPDescriptor object.
@param ac Description of the Parameter
@param atom Description of the Parameter
@return The aromaticNitrogensCount value | [
"Gets",
"the",
"aromaticNitrogensCount",
"attribute",
"of",
"the",
"XLogPDescriptor",
"object",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/XLogPDescriptor.java#L1236-L1245 |
pavlospt/RxFile | rxfile/src/main/java/com/pavlospt/rxfile/RxFile.java | RxFile.createFileFromUri | public static Observable<File> createFileFromUri(final Context context, final Uri data) {
return createFileFromUri(context, data, MimeMap.UrlConnection);
} | java | public static Observable<File> createFileFromUri(final Context context, final Uri data) {
return createFileFromUri(context, data, MimeMap.UrlConnection);
} | [
"public",
"static",
"Observable",
"<",
"File",
">",
"createFileFromUri",
"(",
"final",
"Context",
"context",
",",
"final",
"Uri",
"data",
")",
"{",
"return",
"createFileFromUri",
"(",
"context",
",",
"data",
",",
"MimeMap",
".",
"UrlConnection",
")",
";",
"}... | /*
Create a copy of the file found under the provided Uri, in the Library's cache folder.
The mime type of the resource will be determined by URLConnection.guessContentTypeFromName() method. | [
"/",
"*",
"Create",
"a",
"copy",
"of",
"the",
"file",
"found",
"under",
"the",
"provided",
"Uri",
"in",
"the",
"Library",
"s",
"cache",
"folder",
"."
] | train | https://github.com/pavlospt/RxFile/blob/54210b02631f4b27d31bea040eca86183136cf46/rxfile/src/main/java/com/pavlospt/rxfile/RxFile.java#L64-L66 |
kite-sdk/kite | kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/ColumnMappingParser.java | ColumnMappingParser.parseFieldMapping | public static FieldMapping parseFieldMapping(JsonNode mappingNode) {
ValidationException.check(mappingNode.isObject(),
"A column mapping must be a JSON record");
ValidationException.check(mappingNode.has(SOURCE),
"Partitioners must have a %s.", SOURCE);
String source = mappingNode.get("source").asText();
return parseFieldMapping(source, mappingNode);
} | java | public static FieldMapping parseFieldMapping(JsonNode mappingNode) {
ValidationException.check(mappingNode.isObject(),
"A column mapping must be a JSON record");
ValidationException.check(mappingNode.has(SOURCE),
"Partitioners must have a %s.", SOURCE);
String source = mappingNode.get("source").asText();
return parseFieldMapping(source, mappingNode);
} | [
"public",
"static",
"FieldMapping",
"parseFieldMapping",
"(",
"JsonNode",
"mappingNode",
")",
"{",
"ValidationException",
".",
"check",
"(",
"mappingNode",
".",
"isObject",
"(",
")",
",",
"\"A column mapping must be a JSON record\"",
")",
";",
"ValidationException",
"."... | Parses the FieldMapping from an annotated schema field.
@param mappingNode
The value of the "mapping" node
@return FieldMapping | [
"Parses",
"the",
"FieldMapping",
"from",
"an",
"annotated",
"schema",
"field",
"."
] | train | https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/ColumnMappingParser.java#L187-L196 |
casbin/jcasbin | src/main/java/org/casbin/jcasbin/main/Enforcer.java | Enforcer.addRoleForUserInDomain | public boolean addRoleForUserInDomain(String user, String role, String domain) {
return addGroupingPolicy(user, role, domain);
} | java | public boolean addRoleForUserInDomain(String user, String role, String domain) {
return addGroupingPolicy(user, role, domain);
} | [
"public",
"boolean",
"addRoleForUserInDomain",
"(",
"String",
"user",
",",
"String",
"role",
",",
"String",
"domain",
")",
"{",
"return",
"addGroupingPolicy",
"(",
"user",
",",
"role",
",",
"domain",
")",
";",
"}"
] | addRoleForUserInDomain adds a role for a user inside a domain.
Returns false if the user already has the role (aka not affected).
@param user the user.
@param role the role.
@param domain the domain.
@return succeeds or not. | [
"addRoleForUserInDomain",
"adds",
"a",
"role",
"for",
"a",
"user",
"inside",
"a",
"domain",
".",
"Returns",
"false",
"if",
"the",
"user",
"already",
"has",
"the",
"role",
"(",
"aka",
"not",
"affected",
")",
"."
] | train | https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/main/Enforcer.java#L387-L389 |
knowm/Sundial | src/main/java/org/knowm/sundial/SundialJobScheduler.java | SundialJobScheduler.startScheduler | public static void startScheduler(int threadPoolSize, String annotatedJobsPackageName)
throws SundialSchedulerException {
try {
createScheduler(threadPoolSize, annotatedJobsPackageName);
getScheduler().start();
} catch (SchedulerException e) {
throw new SundialSchedulerException("COULD NOT START SUNDIAL SCHEDULER!!!", e);
}
} | java | public static void startScheduler(int threadPoolSize, String annotatedJobsPackageName)
throws SundialSchedulerException {
try {
createScheduler(threadPoolSize, annotatedJobsPackageName);
getScheduler().start();
} catch (SchedulerException e) {
throw new SundialSchedulerException("COULD NOT START SUNDIAL SCHEDULER!!!", e);
}
} | [
"public",
"static",
"void",
"startScheduler",
"(",
"int",
"threadPoolSize",
",",
"String",
"annotatedJobsPackageName",
")",
"throws",
"SundialSchedulerException",
"{",
"try",
"{",
"createScheduler",
"(",
"threadPoolSize",
",",
"annotatedJobsPackageName",
")",
";",
"getS... | Starts the Sundial Scheduler
@param threadPoolSize
@param annotatedJobsPackageName A comma(,) or colon(:) can be used to specify multiple packages
to scan for Jobs. | [
"Starts",
"the",
"Sundial",
"Scheduler"
] | train | https://github.com/knowm/Sundial/blob/0d61549fdfb8d6f884a1f2eed7e32ad39e2f4c62/src/main/java/org/knowm/sundial/SundialJobScheduler.java#L84-L93 |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/util/annotation/AnnotationUtils.java | AnnotationUtils.findAnnotationInAnnotations | private static <A extends Annotation> A findAnnotationInAnnotations(final AnnotatedElement source, final Class<A> targetAnnotationClass) {
final Annotation[] allAnnotations = source.getAnnotations();
for (final Annotation annotation : allAnnotations) {
final A result = findAnnotation(annotation, targetAnnotationClass);
if (result != null)
return result;
}
return null;
} | java | private static <A extends Annotation> A findAnnotationInAnnotations(final AnnotatedElement source, final Class<A> targetAnnotationClass) {
final Annotation[] allAnnotations = source.getAnnotations();
for (final Annotation annotation : allAnnotations) {
final A result = findAnnotation(annotation, targetAnnotationClass);
if (result != null)
return result;
}
return null;
} | [
"private",
"static",
"<",
"A",
"extends",
"Annotation",
">",
"A",
"findAnnotationInAnnotations",
"(",
"final",
"AnnotatedElement",
"source",
",",
"final",
"Class",
"<",
"A",
">",
"targetAnnotationClass",
")",
"{",
"final",
"Annotation",
"[",
"]",
"allAnnotations",... | Tries to find required annotation in scope of all annotations of incoming 'source'.
@param source
{@link AnnotatedElement}
@param targetAnnotationClass
{@link Class} - actually required annotation class
@param <A>
- type param
@return {@link A} in case if found, {@code null} otherwise | [
"Tries",
"to",
"find",
"required",
"annotation",
"in",
"scope",
"of",
"all",
"annotations",
"of",
"incoming",
"source",
"."
] | train | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/util/annotation/AnnotationUtils.java#L54-L63 |
alkacon/opencms-core | src/org/opencms/jlan/CmsJlanDiskInterface.java | CmsJlanDiskInterface.translateName | protected String translateName(String path) {
return CmsStringUtil.substitute(Pattern.compile("/([^/]+)$"), path, new I_CmsRegexSubstitution() {
public String substituteMatch(String text, Matcher matcher) {
String name = text.substring(matcher.start(1), matcher.end(1));
return "/" + OpenCms.getResourceManager().getFileTranslator().translateResource(name);
}
});
} | java | protected String translateName(String path) {
return CmsStringUtil.substitute(Pattern.compile("/([^/]+)$"), path, new I_CmsRegexSubstitution() {
public String substituteMatch(String text, Matcher matcher) {
String name = text.substring(matcher.start(1), matcher.end(1));
return "/" + OpenCms.getResourceManager().getFileTranslator().translateResource(name);
}
});
} | [
"protected",
"String",
"translateName",
"(",
"String",
"path",
")",
"{",
"return",
"CmsStringUtil",
".",
"substitute",
"(",
"Pattern",
".",
"compile",
"(",
"\"/([^/]+)$\"",
")",
",",
"path",
",",
"new",
"I_CmsRegexSubstitution",
"(",
")",
"{",
"public",
"Strin... | Translates the last path segment of a path using the configured OpenCms file translations.<p>
@param path the path for which the last segment should be translated
@return the path with the translated last segment | [
"Translates",
"the",
"last",
"path",
"segment",
"of",
"a",
"path",
"using",
"the",
"configured",
"OpenCms",
"file",
"translations",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jlan/CmsJlanDiskInterface.java#L528-L538 |
craterdog/java-general-utilities | src/main/java/craterdog/utils/ByteUtils.java | ByteUtils.stringToBytes | static public int stringToBytes(String string, byte[] buffer, int index) {
byte[] bytes = string.getBytes();
int length = bytes.length;
System.arraycopy(bytes, 0, buffer, index, length);
return length;
} | java | static public int stringToBytes(String string, byte[] buffer, int index) {
byte[] bytes = string.getBytes();
int length = bytes.length;
System.arraycopy(bytes, 0, buffer, index, length);
return length;
} | [
"static",
"public",
"int",
"stringToBytes",
"(",
"String",
"string",
",",
"byte",
"[",
"]",
"buffer",
",",
"int",
"index",
")",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"string",
".",
"getBytes",
"(",
")",
";",
"int",
"length",
"=",
"bytes",
".",
"length... | This function converts a string into its corresponding byte format and inserts
it into the specified buffer at the specified index.
@param string The string to be converted.
@param buffer The byte array.
@param index The index in the array to begin inserting bytes.
@return The number of bytes inserted. | [
"This",
"function",
"converts",
"a",
"string",
"into",
"its",
"corresponding",
"byte",
"format",
"and",
"inserts",
"it",
"into",
"the",
"specified",
"buffer",
"at",
"the",
"specified",
"index",
"."
] | train | https://github.com/craterdog/java-general-utilities/blob/a3ff45eaa00c2b8ed5c53efe9fe5166065fc1f57/src/main/java/craterdog/utils/ByteUtils.java#L581-L586 |
UrielCh/ovh-java-sdk | ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java | ApiOvhXdsl.serviceName_lines_number_dslamPort_availableProfiles_GET | public ArrayList<OvhDslamLineProfile> serviceName_lines_number_dslamPort_availableProfiles_GET(String serviceName, String number) throws IOException {
String qPath = "/xdsl/{serviceName}/lines/{number}/dslamPort/availableProfiles";
StringBuilder sb = path(qPath, serviceName, number);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t14);
} | java | public ArrayList<OvhDslamLineProfile> serviceName_lines_number_dslamPort_availableProfiles_GET(String serviceName, String number) throws IOException {
String qPath = "/xdsl/{serviceName}/lines/{number}/dslamPort/availableProfiles";
StringBuilder sb = path(qPath, serviceName, number);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t14);
} | [
"public",
"ArrayList",
"<",
"OvhDslamLineProfile",
">",
"serviceName_lines_number_dslamPort_availableProfiles_GET",
"(",
"String",
"serviceName",
",",
"String",
"number",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/xdsl/{serviceName}/lines/{number}/dslamPort/... | List all availables profiles for this port
REST: GET /xdsl/{serviceName}/lines/{number}/dslamPort/availableProfiles
@param serviceName [required] The internal name of your XDSL offer
@param number [required] The number of the line | [
"List",
"all",
"availables",
"profiles",
"for",
"this",
"port"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java#L538-L543 |
Azure/azure-sdk-for-java | logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/PartnersInner.java | PartnersInner.getAsync | public Observable<IntegrationAccountPartnerInner> getAsync(String resourceGroupName, String integrationAccountName, String partnerName) {
return getWithServiceResponseAsync(resourceGroupName, integrationAccountName, partnerName).map(new Func1<ServiceResponse<IntegrationAccountPartnerInner>, IntegrationAccountPartnerInner>() {
@Override
public IntegrationAccountPartnerInner call(ServiceResponse<IntegrationAccountPartnerInner> response) {
return response.body();
}
});
} | java | public Observable<IntegrationAccountPartnerInner> getAsync(String resourceGroupName, String integrationAccountName, String partnerName) {
return getWithServiceResponseAsync(resourceGroupName, integrationAccountName, partnerName).map(new Func1<ServiceResponse<IntegrationAccountPartnerInner>, IntegrationAccountPartnerInner>() {
@Override
public IntegrationAccountPartnerInner call(ServiceResponse<IntegrationAccountPartnerInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"IntegrationAccountPartnerInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"integrationAccountName",
",",
"String",
"partnerName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"in... | Gets an integration account partner.
@param resourceGroupName The resource group name.
@param integrationAccountName The integration account name.
@param partnerName The integration account partner name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the IntegrationAccountPartnerInner object | [
"Gets",
"an",
"integration",
"account",
"partner",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/PartnersInner.java#L381-L388 |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.checkVariableDeclarations | private Environment checkVariableDeclarations(Tuple<Decl.Variable> decls, Environment environment) {
for (int i = 0; i != decls.size(); ++i) {
environment = checkVariableDeclaration(decls.get(i), environment);
}
return environment;
} | java | private Environment checkVariableDeclarations(Tuple<Decl.Variable> decls, Environment environment) {
for (int i = 0; i != decls.size(); ++i) {
environment = checkVariableDeclaration(decls.get(i), environment);
}
return environment;
} | [
"private",
"Environment",
"checkVariableDeclarations",
"(",
"Tuple",
"<",
"Decl",
".",
"Variable",
">",
"decls",
",",
"Environment",
"environment",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"!=",
"decls",
".",
"size",
"(",
")",
";",
"++",
"... | Type check a given sequence of variable declarations.
@param decls
@param environment
Determines the type of all variables immediately going into this
statement.
@return
@throws IOException | [
"Type",
"check",
"a",
"given",
"sequence",
"of",
"variable",
"declarations",
"."
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L400-L405 |
box/box-java-sdk | src/main/java/com/box/sdk/BoxFolder.java | BoxFolder.createMetadata | public Metadata createMetadata(String templateName, String scope, Metadata metadata) {
URL url = METADATA_URL_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID(), scope, templateName);
BoxAPIRequest request = new BoxAPIRequest(this.getAPI(), url, "POST");
request.addHeader("Content-Type", "application/json");
request.setBody(metadata.toString());
BoxJSONResponse response = (BoxJSONResponse) request.send();
return new Metadata(JsonObject.readFrom(response.getJSON()));
} | java | public Metadata createMetadata(String templateName, String scope, Metadata metadata) {
URL url = METADATA_URL_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID(), scope, templateName);
BoxAPIRequest request = new BoxAPIRequest(this.getAPI(), url, "POST");
request.addHeader("Content-Type", "application/json");
request.setBody(metadata.toString());
BoxJSONResponse response = (BoxJSONResponse) request.send();
return new Metadata(JsonObject.readFrom(response.getJSON()));
} | [
"public",
"Metadata",
"createMetadata",
"(",
"String",
"templateName",
",",
"String",
"scope",
",",
"Metadata",
"metadata",
")",
"{",
"URL",
"url",
"=",
"METADATA_URL_TEMPLATE",
".",
"build",
"(",
"this",
".",
"getAPI",
"(",
")",
".",
"getBaseURL",
"(",
")",... | Creates metadata on this folder using a specified scope and template.
@param templateName the name of the metadata template.
@param scope the scope of the template (usually "global" or "enterprise").
@param metadata the new metadata values.
@return the metadata returned from the server. | [
"Creates",
"metadata",
"on",
"this",
"folder",
"using",
"a",
"specified",
"scope",
"and",
"template",
"."
] | train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxFolder.java#L850-L857 |
pf4j/pf4j-update | src/main/java/org/pf4j/update/SimpleFileDownloader.java | SimpleFileDownloader.copyLocalFile | protected Path copyLocalFile(URL fileUrl) throws IOException, PluginException {
Path destination = Files.createTempDirectory("pf4j-update-downloader");
destination.toFile().deleteOnExit();
try {
Path fromFile = Paths.get(fileUrl.toURI());
String path = fileUrl.getPath();
String fileName = path.substring(path.lastIndexOf('/') + 1);
Path toFile = destination.resolve(fileName);
Files.copy(fromFile, toFile, StandardCopyOption.COPY_ATTRIBUTES, StandardCopyOption.REPLACE_EXISTING);
return toFile;
} catch (URISyntaxException e) {
throw new PluginException("Something wrong with given URL", e);
}
} | java | protected Path copyLocalFile(URL fileUrl) throws IOException, PluginException {
Path destination = Files.createTempDirectory("pf4j-update-downloader");
destination.toFile().deleteOnExit();
try {
Path fromFile = Paths.get(fileUrl.toURI());
String path = fileUrl.getPath();
String fileName = path.substring(path.lastIndexOf('/') + 1);
Path toFile = destination.resolve(fileName);
Files.copy(fromFile, toFile, StandardCopyOption.COPY_ATTRIBUTES, StandardCopyOption.REPLACE_EXISTING);
return toFile;
} catch (URISyntaxException e) {
throw new PluginException("Something wrong with given URL", e);
}
} | [
"protected",
"Path",
"copyLocalFile",
"(",
"URL",
"fileUrl",
")",
"throws",
"IOException",
",",
"PluginException",
"{",
"Path",
"destination",
"=",
"Files",
".",
"createTempDirectory",
"(",
"\"pf4j-update-downloader\"",
")",
";",
"destination",
".",
"toFile",
"(",
... | Efficient copy of file in case of local file system.
@param fileUrl source file
@return path of target file
@throws IOException if problems during copy
@throws PluginException in case of other problems | [
"Efficient",
"copy",
"of",
"file",
"in",
"case",
"of",
"local",
"file",
"system",
"."
] | train | https://github.com/pf4j/pf4j-update/blob/80cf04b8f2790808d0cf9dff3602dc5d730ac979/src/main/java/org/pf4j/update/SimpleFileDownloader.java#L75-L90 |
Impetus/Kundera | src/kundera-hbase/kundera-hbase-v2/src/main/java/com/impetus/client/hbase/utils/HBaseUtils.java | HBaseUtils.isFindKeyOnly | public static boolean isFindKeyOnly(EntityMetadata metadata, List<Map<String, Object>> colToOutput)
{
if (colToOutput != null && colToOutput.size() == 1)
{
String idCol = ((AbstractAttribute) metadata.getIdAttribute()).getJPAColumnName();
return idCol.equals(colToOutput.get(0).get(Constants.DB_COL_NAME)) && !(boolean) colToOutput.get(0).get(Constants.IS_EMBEDDABLE);
}
else
{
return false;
}
} | java | public static boolean isFindKeyOnly(EntityMetadata metadata, List<Map<String, Object>> colToOutput)
{
if (colToOutput != null && colToOutput.size() == 1)
{
String idCol = ((AbstractAttribute) metadata.getIdAttribute()).getJPAColumnName();
return idCol.equals(colToOutput.get(0).get(Constants.DB_COL_NAME)) && !(boolean) colToOutput.get(0).get(Constants.IS_EMBEDDABLE);
}
else
{
return false;
}
} | [
"public",
"static",
"boolean",
"isFindKeyOnly",
"(",
"EntityMetadata",
"metadata",
",",
"List",
"<",
"Map",
"<",
"String",
",",
"Object",
">",
">",
"colToOutput",
")",
"{",
"if",
"(",
"colToOutput",
"!=",
"null",
"&&",
"colToOutput",
".",
"size",
"(",
")",... | Checks if is find key only.
@param metadata
the metadata
@param colToOutput
the col to output
@return true, if is find key only | [
"Checks",
"if",
"is",
"find",
"key",
"only",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-hbase/kundera-hbase-v2/src/main/java/com/impetus/client/hbase/utils/HBaseUtils.java#L305-L316 |
jbossws/jbossws-cxf | modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java | BusHolder.createServerConfigurer | public Configurer createServerConfigurer(BindingCustomization customization, WSDLFilePublisher wsdlPublisher, ArchiveDeployment dep)
{
ServerBeanCustomizer customizer = new ServerBeanCustomizer();
customizer.setBindingCustomization(customization);
customizer.setWsdlPublisher(wsdlPublisher);
customizer.setDeployment(dep);
return new JBossWSConfigurerImpl(customizer);
} | java | public Configurer createServerConfigurer(BindingCustomization customization, WSDLFilePublisher wsdlPublisher, ArchiveDeployment dep)
{
ServerBeanCustomizer customizer = new ServerBeanCustomizer();
customizer.setBindingCustomization(customization);
customizer.setWsdlPublisher(wsdlPublisher);
customizer.setDeployment(dep);
return new JBossWSConfigurerImpl(customizer);
} | [
"public",
"Configurer",
"createServerConfigurer",
"(",
"BindingCustomization",
"customization",
",",
"WSDLFilePublisher",
"wsdlPublisher",
",",
"ArchiveDeployment",
"dep",
")",
"{",
"ServerBeanCustomizer",
"customizer",
"=",
"new",
"ServerBeanCustomizer",
"(",
")",
";",
"... | A convenient method for getting a jbossws cxf server configurer
@param customization The binding customization to set in the configurer, if any
@param wsdlPublisher The wsdl file publisher to set in the configurer, if any
@param dep The deployment
@return The new jbossws cxf configurer | [
"A",
"convenient",
"method",
"for",
"getting",
"a",
"jbossws",
"cxf",
"server",
"configurer"
] | train | https://github.com/jbossws/jbossws-cxf/blob/e1d5df3664cbc2482ebc83cafd355a4d60d12150/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java#L342-L349 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.ipOrganisation_organisationId_PUT | public void ipOrganisation_organisationId_PUT(String organisationId, OvhIpv4Org body) throws IOException {
String qPath = "/me/ipOrganisation/{organisationId}";
StringBuilder sb = path(qPath, organisationId);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void ipOrganisation_organisationId_PUT(String organisationId, OvhIpv4Org body) throws IOException {
String qPath = "/me/ipOrganisation/{organisationId}";
StringBuilder sb = path(qPath, organisationId);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"ipOrganisation_organisationId_PUT",
"(",
"String",
"organisationId",
",",
"OvhIpv4Org",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/ipOrganisation/{organisationId}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath"... | Alter this object properties
REST: PUT /me/ipOrganisation/{organisationId}
@param body [required] New object properties
@param organisationId [required] | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L2210-L2214 |
FedericoPecora/meta-csp-framework | src/main/java/org/metacsp/utility/logging/LinePainter.java | LinePainter.setLighter | public void setLighter(Color color)
{
int red = Math.min(255, (int)(color.getRed() * 1.2));
int green = Math.min(255, (int)(color.getGreen() * 1.2));
int blue = Math.min(255, (int)(color.getBlue() * 1.2));
setColor(new Color(red, green, blue));
} | java | public void setLighter(Color color)
{
int red = Math.min(255, (int)(color.getRed() * 1.2));
int green = Math.min(255, (int)(color.getGreen() * 1.2));
int blue = Math.min(255, (int)(color.getBlue() * 1.2));
setColor(new Color(red, green, blue));
} | [
"public",
"void",
"setLighter",
"(",
"Color",
"color",
")",
"{",
"int",
"red",
"=",
"Math",
".",
"min",
"(",
"255",
",",
"(",
"int",
")",
"(",
"color",
".",
"getRed",
"(",
")",
"*",
"1.2",
")",
")",
";",
"int",
"green",
"=",
"Math",
".",
"min",... | /*
Calculate the line color by making the selection color lighter
@return the color of the background line | [
"/",
"*",
"Calculate",
"the",
"line",
"color",
"by",
"making",
"the",
"selection",
"color",
"lighter"
] | train | https://github.com/FedericoPecora/meta-csp-framework/blob/42aaef2e2b76d0f738427f0dd9653c4f62b40517/src/main/java/org/metacsp/utility/logging/LinePainter.java#L84-L90 |
google/j2objc | jre_emul/android/platform/external/okhttp/okio/okio/src/main/java/okio/Segment.java | Segment.writeTo | public void writeTo(Segment sink, int byteCount) {
if (!sink.owner) throw new IllegalArgumentException();
if (sink.limit + byteCount > SIZE) {
// We can't fit byteCount bytes at the sink's current position. Shift sink first.
if (sink.shared) throw new IllegalArgumentException();
if (sink.limit + byteCount - sink.pos > SIZE) throw new IllegalArgumentException();
System.arraycopy(sink.data, sink.pos, sink.data, 0, sink.limit - sink.pos);
sink.limit -= sink.pos;
sink.pos = 0;
}
System.arraycopy(data, pos, sink.data, sink.limit, byteCount);
sink.limit += byteCount;
pos += byteCount;
} | java | public void writeTo(Segment sink, int byteCount) {
if (!sink.owner) throw new IllegalArgumentException();
if (sink.limit + byteCount > SIZE) {
// We can't fit byteCount bytes at the sink's current position. Shift sink first.
if (sink.shared) throw new IllegalArgumentException();
if (sink.limit + byteCount - sink.pos > SIZE) throw new IllegalArgumentException();
System.arraycopy(sink.data, sink.pos, sink.data, 0, sink.limit - sink.pos);
sink.limit -= sink.pos;
sink.pos = 0;
}
System.arraycopy(data, pos, sink.data, sink.limit, byteCount);
sink.limit += byteCount;
pos += byteCount;
} | [
"public",
"void",
"writeTo",
"(",
"Segment",
"sink",
",",
"int",
"byteCount",
")",
"{",
"if",
"(",
"!",
"sink",
".",
"owner",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"if",
"(",
"sink",
".",
"limit",
"+",
"byteCount",
">",
"SIZE"... | Moves {@code byteCount} bytes from this segment to {@code sink}. | [
"Moves",
"{"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/okhttp/okio/okio/src/main/java/okio/Segment.java#L134-L148 |
gitblit/fathom | fathom-security/src/main/java/fathom/realm/Account.java | Account.checkPermissions | public void checkPermissions(Collection<String> permissions) throws AuthorizationException {
if (!isPermittedAll(permissions)) {
throw new AuthorizationException("'{}' does not have the permissions {}", toString(), permissions);
}
} | java | public void checkPermissions(Collection<String> permissions) throws AuthorizationException {
if (!isPermittedAll(permissions)) {
throw new AuthorizationException("'{}' does not have the permissions {}", toString(), permissions);
}
} | [
"public",
"void",
"checkPermissions",
"(",
"Collection",
"<",
"String",
">",
"permissions",
")",
"throws",
"AuthorizationException",
"{",
"if",
"(",
"!",
"isPermittedAll",
"(",
"permissions",
")",
")",
"{",
"throw",
"new",
"AuthorizationException",
"(",
"\"'{}' do... | Ensures this Account
{@link fathom.authz.Permission#implies(fathom.authz.Permission) implies} all of the
specified permission strings.
<p>
If this Account's existing associated permissions do not
{@link fathom.authz.Permission#implies(fathom.authz.Permission) imply} all of the given permissions,
an {@link fathom.authz.AuthorizationException} will be thrown.
<p>
This is an overloaded method for the corresponding type-safe {@link fathom.authz.Permission Permission} variant.
Please see the class-level JavaDoc for more information on these String-based permission methods.
@param permissions the string representations of Permissions to check.
@throws AuthorizationException if this Account does not have all of the given permissions. | [
"Ensures",
"this",
"Account",
"{",
"@link",
"fathom",
".",
"authz",
".",
"Permission#implies",
"(",
"fathom",
".",
"authz",
".",
"Permission",
")",
"implies",
"}",
"all",
"of",
"the",
"specified",
"permission",
"strings",
".",
"<p",
">",
"If",
"this",
"Acc... | train | https://github.com/gitblit/fathom/blob/f2f820eb16e9fea1e36ad4eda4ed51b35f056538/fathom-security/src/main/java/fathom/realm/Account.java#L350-L354 |
buschmais/jqa-maven3-plugin | src/main/java/com/buschmais/jqassistant/plugin/maven3/impl/scanner/MavenProjectScannerPlugin.java | MavenProjectScannerPlugin.addModules | private void addModules(MavenProject project, MavenProjectDirectoryDescriptor projectDescriptor, ScannerContext scannerContext) {
File projectDirectory = project.getBasedir();
Set<File> modules = new HashSet<>();
for (String moduleName : project.getModules()) {
File module = new File(projectDirectory, moduleName);
modules.add(module);
}
for (MavenProject module : project.getCollectedProjects()) {
if (modules.contains(module.getBasedir())) {
MavenProjectDescriptor moduleDescriptor = resolveProject(module, MavenProjectDescriptor.class, scannerContext);
projectDescriptor.getModules().add(moduleDescriptor);
}
}
} | java | private void addModules(MavenProject project, MavenProjectDirectoryDescriptor projectDescriptor, ScannerContext scannerContext) {
File projectDirectory = project.getBasedir();
Set<File> modules = new HashSet<>();
for (String moduleName : project.getModules()) {
File module = new File(projectDirectory, moduleName);
modules.add(module);
}
for (MavenProject module : project.getCollectedProjects()) {
if (modules.contains(module.getBasedir())) {
MavenProjectDescriptor moduleDescriptor = resolveProject(module, MavenProjectDescriptor.class, scannerContext);
projectDescriptor.getModules().add(moduleDescriptor);
}
}
} | [
"private",
"void",
"addModules",
"(",
"MavenProject",
"project",
",",
"MavenProjectDirectoryDescriptor",
"projectDescriptor",
",",
"ScannerContext",
"scannerContext",
")",
"{",
"File",
"projectDirectory",
"=",
"project",
".",
"getBasedir",
"(",
")",
";",
"Set",
"<",
... | Add relations to the modules.
@param project
The project.
@param projectDescriptor
The project descriptor.
@param scannerContext
The scanner context. | [
"Add",
"relations",
"to",
"the",
"modules",
"."
] | train | https://github.com/buschmais/jqa-maven3-plugin/blob/6c6e2dca56de6d5b8ceeb2f28982fb6d7c98778f/src/main/java/com/buschmais/jqassistant/plugin/maven3/impl/scanner/MavenProjectScannerPlugin.java#L255-L268 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/Graphics.java | Graphics.drawAnimation | public void drawAnimation(Animation anim, float x, float y) {
drawAnimation(anim, x, y, Color.white);
} | java | public void drawAnimation(Animation anim, float x, float y) {
drawAnimation(anim, x, y, Color.white);
} | [
"public",
"void",
"drawAnimation",
"(",
"Animation",
"anim",
",",
"float",
"x",
",",
"float",
"y",
")",
"{",
"drawAnimation",
"(",
"anim",
",",
"x",
",",
"y",
",",
"Color",
".",
"white",
")",
";",
"}"
] | Draw an animation to this graphics context
@param anim
The animation to be drawn
@param x
The x position to draw the animation at
@param y
The y position to draw the animation at | [
"Draw",
"an",
"animation",
"to",
"this",
"graphics",
"context"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Graphics.java#L1399-L1401 |
ReactiveX/RxJavaGuava | src/main/java/rx/transformer/GuavaTransformers.java | GuavaTransformers.toImmutableMap | public static <T,K,V> Observable.Transformer<T,ImmutableMap<K,V>> toImmutableMap(final Func1<T,K> keyMapper, final Func1<T,V> valueMapper) {
return new Observable.Transformer<T,ImmutableMap<K,V>>() {
@Override
public Observable<ImmutableMap<K, V>> call(Observable<T> observable) {
return observable.collect(new Func0<ImmutableMap.Builder<K, V>>() {
@Override
public ImmutableMap.Builder<K, V> call() {
return ImmutableMap.builder();
}
}, new Action2<ImmutableMap.Builder<K, V>, T>() {
@Override
public void call(ImmutableMap.Builder<K, V> builder, T t) {
builder.put(keyMapper.call(t), valueMapper.call(t));
}
})
.map(new Func1<ImmutableMap.Builder<K, V>, ImmutableMap<K, V>>() {
@Override
public ImmutableMap<K, V> call(ImmutableMap.Builder<K, V> builder) {
return builder.build();
}
});
}
};
} | java | public static <T,K,V> Observable.Transformer<T,ImmutableMap<K,V>> toImmutableMap(final Func1<T,K> keyMapper, final Func1<T,V> valueMapper) {
return new Observable.Transformer<T,ImmutableMap<K,V>>() {
@Override
public Observable<ImmutableMap<K, V>> call(Observable<T> observable) {
return observable.collect(new Func0<ImmutableMap.Builder<K, V>>() {
@Override
public ImmutableMap.Builder<K, V> call() {
return ImmutableMap.builder();
}
}, new Action2<ImmutableMap.Builder<K, V>, T>() {
@Override
public void call(ImmutableMap.Builder<K, V> builder, T t) {
builder.put(keyMapper.call(t), valueMapper.call(t));
}
})
.map(new Func1<ImmutableMap.Builder<K, V>, ImmutableMap<K, V>>() {
@Override
public ImmutableMap<K, V> call(ImmutableMap.Builder<K, V> builder) {
return builder.build();
}
});
}
};
} | [
"public",
"static",
"<",
"T",
",",
"K",
",",
"V",
">",
"Observable",
".",
"Transformer",
"<",
"T",
",",
"ImmutableMap",
"<",
"K",
",",
"V",
">",
">",
"toImmutableMap",
"(",
"final",
"Func1",
"<",
"T",
",",
"K",
">",
"keyMapper",
",",
"final",
"Func... | Returns a Transformer<T,ImmutableMap<K,V>> that maps an Observable<T> to an Observable<ImmutableMap<K,V>>><br><br>
with a given Func1<T,K> keyMapper and Func1<T,V> valueMapper | [
"Returns",
"a",
"Transformer<",
";",
"T",
"ImmutableMap<",
";",
"K",
"V>",
";",
">",
"that",
"maps",
"an",
"Observable<",
";",
"T>",
";",
"to",
"an",
"Observable<",
";",
"ImmutableMap<",
";",
"K",
"V>",
";",
">",
">",
"<br",
">",
"<br... | train | https://github.com/ReactiveX/RxJavaGuava/blob/bfb5da6e073364a96da23d57f47c6b706fb733aa/src/main/java/rx/transformer/GuavaTransformers.java#L93-L116 |
apache/incubator-shardingsphere | sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/extractor/util/ExtractorUtils.java | ExtractorUtils.getFirstChildNode | public static ParserRuleContext getFirstChildNode(final ParserRuleContext node, final RuleName ruleName) {
Optional<ParserRuleContext> result = findFirstChildNode(node, ruleName);
Preconditions.checkState(result.isPresent());
return result.get();
} | java | public static ParserRuleContext getFirstChildNode(final ParserRuleContext node, final RuleName ruleName) {
Optional<ParserRuleContext> result = findFirstChildNode(node, ruleName);
Preconditions.checkState(result.isPresent());
return result.get();
} | [
"public",
"static",
"ParserRuleContext",
"getFirstChildNode",
"(",
"final",
"ParserRuleContext",
"node",
",",
"final",
"RuleName",
"ruleName",
")",
"{",
"Optional",
"<",
"ParserRuleContext",
">",
"result",
"=",
"findFirstChildNode",
"(",
"node",
",",
"ruleName",
")"... | Get first child node.
@param node start node
@param ruleName rule name
@return matched node | [
"Get",
"first",
"child",
"node",
"."
] | train | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/extractor/util/ExtractorUtils.java#L46-L50 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java | AsynchronousRequest.getAllContinentSectorID | public void getAllContinentSectorID(int continentID, int floorID, int regionID, int mapID, Callback<List<Integer>> callback) throws NullPointerException {
gw2API.getAllContinentSectorIDs(Integer.toString(continentID), Integer.toString(floorID), Integer.toString(regionID), Integer.toString(mapID)).enqueue(callback);
} | java | public void getAllContinentSectorID(int continentID, int floorID, int regionID, int mapID, Callback<List<Integer>> callback) throws NullPointerException {
gw2API.getAllContinentSectorIDs(Integer.toString(continentID), Integer.toString(floorID), Integer.toString(regionID), Integer.toString(mapID)).enqueue(callback);
} | [
"public",
"void",
"getAllContinentSectorID",
"(",
"int",
"continentID",
",",
"int",
"floorID",
",",
"int",
"regionID",
",",
"int",
"mapID",
",",
"Callback",
"<",
"List",
"<",
"Integer",
">",
">",
"callback",
")",
"throws",
"NullPointerException",
"{",
"gw2API"... | For more info on continents API go <a href="https://wiki.guildwars2.com/wiki/API:2/continents">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions
@param continentID {@link Continent#id}
@param floorID {@link ContinentFloor#id}
@param regionID {@link ContinentRegion#id}
@param mapID {@link ContinentMap#id}
@param callback callback that is going to be used for {@link Call#enqueue(Callback)}
@throws NullPointerException if given {@link Callback} is empty
@see ContinentMap.Sector continents map sector info | [
"For",
"more",
"info",
"on",
"continents",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"continents",
">",
"here<",
"/",
"a",
">",
"<br",
"/",
">",
"Give",
"use... | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L1142-L1144 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.importCertificate | public CertificateBundle importCertificate(String vaultBaseUrl, String certificateName, String base64EncodedCertificate) {
return importCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName, base64EncodedCertificate).toBlocking().single().body();
} | java | public CertificateBundle importCertificate(String vaultBaseUrl, String certificateName, String base64EncodedCertificate) {
return importCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName, base64EncodedCertificate).toBlocking().single().body();
} | [
"public",
"CertificateBundle",
"importCertificate",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"certificateName",
",",
"String",
"base64EncodedCertificate",
")",
"{",
"return",
"importCertificateWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"certificateName",
",",
... | Imports a certificate into a specified key vault.
Imports an existing valid certificate, containing a private key, into Azure Key Vault. The certificate to be imported can be in either PFX or PEM format. If the certificate is in PEM format the PEM file must contain the key as well as x509 certificates. This operation requires the certificates/import permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param certificateName The name of the certificate.
@param base64EncodedCertificate Base64 encoded representation of the certificate object to import. This certificate needs to contain the private key.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws KeyVaultErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the CertificateBundle object if successful. | [
"Imports",
"a",
"certificate",
"into",
"a",
"specified",
"key",
"vault",
".",
"Imports",
"an",
"existing",
"valid",
"certificate",
"containing",
"a",
"private",
"key",
"into",
"Azure",
"Key",
"Vault",
".",
"The",
"certificate",
"to",
"be",
"imported",
"can",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L6684-L6686 |
census-instrumentation/opencensus-java | api/src/main/java/io/opencensus/trace/Span.java | Span.putAttributes | public void putAttributes(Map<String, AttributeValue> attributes) {
// Not final because we want to start overriding this method from the beginning, this will
// allow us to remove the addAttributes faster. All implementations MUST override this method.
Utils.checkNotNull(attributes, "attributes");
addAttributes(attributes);
} | java | public void putAttributes(Map<String, AttributeValue> attributes) {
// Not final because we want to start overriding this method from the beginning, this will
// allow us to remove the addAttributes faster. All implementations MUST override this method.
Utils.checkNotNull(attributes, "attributes");
addAttributes(attributes);
} | [
"public",
"void",
"putAttributes",
"(",
"Map",
"<",
"String",
",",
"AttributeValue",
">",
"attributes",
")",
"{",
"// Not final because we want to start overriding this method from the beginning, this will",
"// allow us to remove the addAttributes faster. All implementations MUST overri... | Sets a set of attributes to the {@code Span}. The effect of this call is equivalent to that of
calling {@link #putAttribute(String, AttributeValue)} once for each element in the specified
map.
@param attributes the attributes that will be added and associated with the {@code Span}.
@since 0.6 | [
"Sets",
"a",
"set",
"of",
"attributes",
"to",
"the",
"{",
"@code",
"Span",
"}",
".",
"The",
"effect",
"of",
"this",
"call",
"is",
"equivalent",
"to",
"that",
"of",
"calling",
"{",
"@link",
"#putAttribute",
"(",
"String",
"AttributeValue",
")",
"}",
"once... | train | https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/api/src/main/java/io/opencensus/trace/Span.java#L112-L117 |
google/error-prone | check_api/src/main/java/com/google/errorprone/matchers/Matchers.java | Matchers.enhancedForLoop | public static Matcher<EnhancedForLoopTree> enhancedForLoop(
final Matcher<VariableTree> variableMatcher,
final Matcher<ExpressionTree> expressionMatcher,
final Matcher<StatementTree> statementMatcher) {
return new Matcher<EnhancedForLoopTree>() {
@Override
public boolean matches(EnhancedForLoopTree t, VisitorState state) {
return variableMatcher.matches(t.getVariable(), state)
&& expressionMatcher.matches(t.getExpression(), state)
&& statementMatcher.matches(t.getStatement(), state);
}
};
} | java | public static Matcher<EnhancedForLoopTree> enhancedForLoop(
final Matcher<VariableTree> variableMatcher,
final Matcher<ExpressionTree> expressionMatcher,
final Matcher<StatementTree> statementMatcher) {
return new Matcher<EnhancedForLoopTree>() {
@Override
public boolean matches(EnhancedForLoopTree t, VisitorState state) {
return variableMatcher.matches(t.getVariable(), state)
&& expressionMatcher.matches(t.getExpression(), state)
&& statementMatcher.matches(t.getStatement(), state);
}
};
} | [
"public",
"static",
"Matcher",
"<",
"EnhancedForLoopTree",
">",
"enhancedForLoop",
"(",
"final",
"Matcher",
"<",
"VariableTree",
">",
"variableMatcher",
",",
"final",
"Matcher",
"<",
"ExpressionTree",
">",
"expressionMatcher",
",",
"final",
"Matcher",
"<",
"Statemen... | Matches an enhanced for loop if all the given matchers match.
@param variableMatcher The matcher to apply to the variable.
@param expressionMatcher The matcher to apply to the expression.
@param statementMatcher The matcher to apply to the statement. | [
"Matches",
"an",
"enhanced",
"for",
"loop",
"if",
"all",
"the",
"given",
"matchers",
"match",
"."
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/matchers/Matchers.java#L1301-L1313 |
atomix/atomix | protocols/raft/src/main/java/io/atomix/protocols/raft/session/impl/RaftSessionSequencer.java | RaftSessionSequencer.sequenceResponse | public void sequenceResponse(long sequence, OperationResponse response, Runnable callback) {
// If the request sequence number is equal to the next response sequence number, attempt to complete the response.
if (sequence == responseSequence + 1) {
if (completeResponse(response, callback)) {
++responseSequence;
completeResponses();
} else {
responseCallbacks.put(sequence, new ResponseCallback(response, callback));
}
}
// If the response has not yet been sequenced, store it in the response callbacks map.
// Otherwise, the response for the operation with this sequence number has already been handled.
else if (sequence > responseSequence) {
responseCallbacks.put(sequence, new ResponseCallback(response, callback));
}
} | java | public void sequenceResponse(long sequence, OperationResponse response, Runnable callback) {
// If the request sequence number is equal to the next response sequence number, attempt to complete the response.
if (sequence == responseSequence + 1) {
if (completeResponse(response, callback)) {
++responseSequence;
completeResponses();
} else {
responseCallbacks.put(sequence, new ResponseCallback(response, callback));
}
}
// If the response has not yet been sequenced, store it in the response callbacks map.
// Otherwise, the response for the operation with this sequence number has already been handled.
else if (sequence > responseSequence) {
responseCallbacks.put(sequence, new ResponseCallback(response, callback));
}
} | [
"public",
"void",
"sequenceResponse",
"(",
"long",
"sequence",
",",
"OperationResponse",
"response",
",",
"Runnable",
"callback",
")",
"{",
"// If the request sequence number is equal to the next response sequence number, attempt to complete the response.",
"if",
"(",
"sequence",
... | Sequences a response.
<p>
When an operation is sequenced, it's first sequenced in the order in which it was submitted to the cluster.
Once placed in sequential request order, if a response's {@code eventIndex} is greater than the last completed
{@code eventIndex}, we attempt to sequence pending events. If after sequencing pending events the response's
{@code eventIndex} is equal to the last completed {@code eventIndex} then the response can be immediately
completed. If not enough events are pending to meet the sequence requirement, the sequencing of responses is
stopped until events are received.
@param sequence The request sequence number.
@param response The response to sequence.
@param callback The callback to sequence. | [
"Sequences",
"a",
"response",
".",
"<p",
">",
"When",
"an",
"operation",
"is",
"sequenced",
"it",
"s",
"first",
"sequenced",
"in",
"the",
"order",
"in",
"which",
"it",
"was",
"submitted",
"to",
"the",
"cluster",
".",
"Once",
"placed",
"in",
"sequential",
... | train | https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/protocols/raft/src/main/java/io/atomix/protocols/raft/session/impl/RaftSessionSequencer.java#L127-L142 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jca.inbound.security/src/com/ibm/ws/jca/security/internal/J2CSecurityHelper.java | J2CSecurityHelper.getCustomCredentials | public static Hashtable<String, Object> getCustomCredentials(Subject callSubject, String cacheKey) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "getCustomCredentials", cacheKey);
}
if (callSubject == null || cacheKey == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "getCustomCredentials", " null");
}
return null;
}
GetCustomCredentials action = new GetCustomCredentials(callSubject, cacheKey);
Hashtable<String, Object> cred = (Hashtable<String, Object>) AccessController.doPrivileged(action);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "getCustomCredentials", objectId(cred));
}
return cred;
} | java | public static Hashtable<String, Object> getCustomCredentials(Subject callSubject, String cacheKey) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "getCustomCredentials", cacheKey);
}
if (callSubject == null || cacheKey == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "getCustomCredentials", " null");
}
return null;
}
GetCustomCredentials action = new GetCustomCredentials(callSubject, cacheKey);
Hashtable<String, Object> cred = (Hashtable<String, Object>) AccessController.doPrivileged(action);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "getCustomCredentials", objectId(cred));
}
return cred;
} | [
"public",
"static",
"Hashtable",
"<",
"String",
",",
"Object",
">",
"getCustomCredentials",
"(",
"Subject",
"callSubject",
",",
"String",
"cacheKey",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
... | This method extracts the custom hashtable from the provided Subject using the
cacheKey.
@param callSubject The Subject which is checked for the custom hashtable
@param cacheKey The cache key for the entries in the custom hashtable
@return The custom hashtable containing the security information. | [
"This",
"method",
"extracts",
"the",
"custom",
"hashtable",
"from",
"the",
"provided",
"Subject",
"using",
"the",
"cacheKey",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.inbound.security/src/com/ibm/ws/jca/security/internal/J2CSecurityHelper.java#L224-L240 |
bazaarvoice/emodb | table/src/main/java/com/bazaarvoice/emodb/table/db/astyanax/AstyanaxTableDAO.java | AstyanaxTableDAO.updateTableMetadata | private void updateTableMetadata(String table, Delta delta, Audit audit, @Nullable InvalidationScope scope) {
_backingStore.update(_systemTable, table, TimeUUIDs.newUUID(), delta, audit,
scope == InvalidationScope.GLOBAL ? WriteConsistency.GLOBAL : WriteConsistency.STRONG);
// Synchronously notify other emodb servers of the table change.
if (scope != null) {
_tableCacheHandle.invalidate(scope, table);
}
} | java | private void updateTableMetadata(String table, Delta delta, Audit audit, @Nullable InvalidationScope scope) {
_backingStore.update(_systemTable, table, TimeUUIDs.newUUID(), delta, audit,
scope == InvalidationScope.GLOBAL ? WriteConsistency.GLOBAL : WriteConsistency.STRONG);
// Synchronously notify other emodb servers of the table change.
if (scope != null) {
_tableCacheHandle.invalidate(scope, table);
}
} | [
"private",
"void",
"updateTableMetadata",
"(",
"String",
"table",
",",
"Delta",
"delta",
",",
"Audit",
"audit",
",",
"@",
"Nullable",
"InvalidationScope",
"scope",
")",
"{",
"_backingStore",
".",
"update",
"(",
"_systemTable",
",",
"table",
",",
"TimeUUIDs",
"... | Write the delta to the system table and invalidate caches in the specified scope. | [
"Write",
"the",
"delta",
"to",
"the",
"system",
"table",
"and",
"invalidate",
"caches",
"in",
"the",
"specified",
"scope",
"."
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/table/src/main/java/com/bazaarvoice/emodb/table/db/astyanax/AstyanaxTableDAO.java#L545-L553 |
pip-services3-java/pip-services3-commons-java | src/org/pipservices3/commons/data/AnyValueMap.java | AnyValueMap.getAsIntegerWithDefault | public int getAsIntegerWithDefault(String key, int defaultValue) {
Object value = getAsObject(key);
return IntegerConverter.toIntegerWithDefault(value, defaultValue);
} | java | public int getAsIntegerWithDefault(String key, int defaultValue) {
Object value = getAsObject(key);
return IntegerConverter.toIntegerWithDefault(value, defaultValue);
} | [
"public",
"int",
"getAsIntegerWithDefault",
"(",
"String",
"key",
",",
"int",
"defaultValue",
")",
"{",
"Object",
"value",
"=",
"getAsObject",
"(",
"key",
")",
";",
"return",
"IntegerConverter",
".",
"toIntegerWithDefault",
"(",
"value",
",",
"defaultValue",
")"... | Converts map element into an integer or returns default value if conversion
is not possible.
@param key a key of element to get.
@param defaultValue the default value
@return integer value of the element or default value if conversion is not
supported.
@see IntegerConverter#toIntegerWithDefault(Object, int) | [
"Converts",
"map",
"element",
"into",
"an",
"integer",
"or",
"returns",
"default",
"value",
"if",
"conversion",
"is",
"not",
"possible",
"."
] | train | https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValueMap.java#L248-L251 |
buschmais/jqa-javaee6-plugin | src/main/java/com/buschmais/jqassistant/plugin/javaee6/impl/scanner/WebXmlScannerPlugin.java | WebXmlScannerPlugin.createServletMapping | private ServletMappingDescriptor createServletMapping(ServletMappingType servletMappingType, Map<String, ServletDescriptor> servlets, Store store) {
ServletMappingDescriptor servletMappingDescriptor = store.create(ServletMappingDescriptor.class);
ServletNameType servletName = servletMappingType.getServletName();
ServletDescriptor servletDescriptor = getOrCreateNamedDescriptor(ServletDescriptor.class, servletName.getValue(), servlets, store);
servletDescriptor.getMappings().add(servletMappingDescriptor);
for (UrlPatternType urlPatternType : servletMappingType.getUrlPattern()) {
UrlPatternDescriptor urlPatternDescriptor = createUrlPattern(urlPatternType, store);
servletMappingDescriptor.getUrlPatterns().add(urlPatternDescriptor);
}
return servletMappingDescriptor;
} | java | private ServletMappingDescriptor createServletMapping(ServletMappingType servletMappingType, Map<String, ServletDescriptor> servlets, Store store) {
ServletMappingDescriptor servletMappingDescriptor = store.create(ServletMappingDescriptor.class);
ServletNameType servletName = servletMappingType.getServletName();
ServletDescriptor servletDescriptor = getOrCreateNamedDescriptor(ServletDescriptor.class, servletName.getValue(), servlets, store);
servletDescriptor.getMappings().add(servletMappingDescriptor);
for (UrlPatternType urlPatternType : servletMappingType.getUrlPattern()) {
UrlPatternDescriptor urlPatternDescriptor = createUrlPattern(urlPatternType, store);
servletMappingDescriptor.getUrlPatterns().add(urlPatternDescriptor);
}
return servletMappingDescriptor;
} | [
"private",
"ServletMappingDescriptor",
"createServletMapping",
"(",
"ServletMappingType",
"servletMappingType",
",",
"Map",
"<",
"String",
",",
"ServletDescriptor",
">",
"servlets",
",",
"Store",
"store",
")",
"{",
"ServletMappingDescriptor",
"servletMappingDescriptor",
"="... | Create a servlet mapping descriptor.
@param servletMappingType
The XML servlet mapping type.
@param store
The store.
@return The servlet mapping descriptor. | [
"Create",
"a",
"servlet",
"mapping",
"descriptor",
"."
] | train | https://github.com/buschmais/jqa-javaee6-plugin/blob/f5776604d9255206807e5aca90b8767bde494e14/src/main/java/com/buschmais/jqassistant/plugin/javaee6/impl/scanner/WebXmlScannerPlugin.java#L495-L505 |
zandero/http | src/main/java/com/zandero/http/RequestUtils.java | RequestUtils.getHeader | public static String getHeader(HttpServletRequest request, String header) {
// noting to search in or nothing to be found
if (request == null || StringUtils.isNullOrEmptyTrimmed(header)) {
return null;
}
return request.getHeader(header);
} | java | public static String getHeader(HttpServletRequest request, String header) {
// noting to search in or nothing to be found
if (request == null || StringUtils.isNullOrEmptyTrimmed(header)) {
return null;
}
return request.getHeader(header);
} | [
"public",
"static",
"String",
"getHeader",
"(",
"HttpServletRequest",
"request",
",",
"String",
"header",
")",
"{",
"// noting to search in or nothing to be found",
"if",
"(",
"request",
"==",
"null",
"||",
"StringUtils",
".",
"isNullOrEmptyTrimmed",
"(",
"header",
")... | Returns header from given request
@param request to search for header
@param header name
@return header value or null if not found | [
"Returns",
"header",
"from",
"given",
"request"
] | train | https://github.com/zandero/http/blob/909eb879f1193adf24545360c3b76bd813865f65/src/main/java/com/zandero/http/RequestUtils.java#L46-L54 |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/BootstrapConfig.java | BootstrapConfig.setProcessName | protected void setProcessName(String newProcessName) {
if (newProcessName == null) {
processName = getDefaultProcessName();
return;
} else if (!newProcessName.matches("[\\p{L}\\p{N}\\+\\_][\\p{L}\\p{N}\\-\\+\\.\\_]*")) {
// Translation of the above regex for the faint of heart:
// The first character can be a +, an _, a unicode letter \p{L}, or a unicode number \\p{N}
// Subsequent characters can be any of the above, in addition to a . and a -
throw new LocationException("Bad server name: " + newProcessName, MessageFormat.format(BootstrapConstants.messages.getString(getErrorProcessNameCharacterMessageKey()),
newProcessName));
} else
// use the new server name
processName = newProcessName;
} | java | protected void setProcessName(String newProcessName) {
if (newProcessName == null) {
processName = getDefaultProcessName();
return;
} else if (!newProcessName.matches("[\\p{L}\\p{N}\\+\\_][\\p{L}\\p{N}\\-\\+\\.\\_]*")) {
// Translation of the above regex for the faint of heart:
// The first character can be a +, an _, a unicode letter \p{L}, or a unicode number \\p{N}
// Subsequent characters can be any of the above, in addition to a . and a -
throw new LocationException("Bad server name: " + newProcessName, MessageFormat.format(BootstrapConstants.messages.getString(getErrorProcessNameCharacterMessageKey()),
newProcessName));
} else
// use the new server name
processName = newProcessName;
} | [
"protected",
"void",
"setProcessName",
"(",
"String",
"newProcessName",
")",
"{",
"if",
"(",
"newProcessName",
"==",
"null",
")",
"{",
"processName",
"=",
"getDefaultProcessName",
"(",
")",
";",
"return",
";",
"}",
"else",
"if",
"(",
"!",
"newProcessName",
"... | A process (server/client) name must be specified on the command line.
It must be looked for (and set as a member variable) before we calculate locations.
This method looks at the provided process name, if it is not null it checks to make
sure the provided process name contains only valid characters. If the process name is
specified and uses valid characters, it will be used as the process name, if it contains
invalid characters, an exception will be thrown preventing the process from starting.
If no process name was specified, "defaultServer" or "defaultClient" will be used.
@param newProcessName A process name being used. | [
"A",
"process",
"(",
"server",
"/",
"client",
")",
"name",
"must",
"be",
"specified",
"on",
"the",
"command",
"line",
".",
"It",
"must",
"be",
"looked",
"for",
"(",
"and",
"set",
"as",
"a",
"member",
"variable",
")",
"before",
"we",
"calculate",
"locat... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/BootstrapConfig.java#L393-L406 |
alkacon/opencms-core | src-modules/org/opencms/workplace/tools/searchindex/CmsDocumentTypeAddList.java | CmsDocumentTypeAddList.fillDetailResourceTypes | private void fillDetailResourceTypes(CmsListItem item, String detailId) {
CmsSearchManager searchManager = OpenCms.getSearchManager();
StringBuffer html = new StringBuffer();
String doctypeName = (String)item.get(LIST_COLUMN_NAME);
CmsSearchDocumentType docType = searchManager.getDocumentTypeConfig(doctypeName);
// output of resource types
Iterator<String> itResourcetypes = docType.getResourceTypes().iterator();
html.append("<ul>\n");
while (itResourcetypes.hasNext()) {
html.append(" <li>\n").append(" ").append(itResourcetypes.next()).append("\n");
html.append(" </li>");
}
html.append("</ul>\n");
item.set(detailId, html.toString());
} | java | private void fillDetailResourceTypes(CmsListItem item, String detailId) {
CmsSearchManager searchManager = OpenCms.getSearchManager();
StringBuffer html = new StringBuffer();
String doctypeName = (String)item.get(LIST_COLUMN_NAME);
CmsSearchDocumentType docType = searchManager.getDocumentTypeConfig(doctypeName);
// output of resource types
Iterator<String> itResourcetypes = docType.getResourceTypes().iterator();
html.append("<ul>\n");
while (itResourcetypes.hasNext()) {
html.append(" <li>\n").append(" ").append(itResourcetypes.next()).append("\n");
html.append(" </li>");
}
html.append("</ul>\n");
item.set(detailId, html.toString());
} | [
"private",
"void",
"fillDetailResourceTypes",
"(",
"CmsListItem",
"item",
",",
"String",
"detailId",
")",
"{",
"CmsSearchManager",
"searchManager",
"=",
"OpenCms",
".",
"getSearchManager",
"(",
")",
";",
"StringBuffer",
"html",
"=",
"new",
"StringBuffer",
"(",
")"... | Fills details about resource types of the document type into the given item. <p>
@param item the list item to fill
@param detailId the id for the detail to fill | [
"Fills",
"details",
"about",
"resource",
"types",
"of",
"the",
"document",
"type",
"into",
"the",
"given",
"item",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/searchindex/CmsDocumentTypeAddList.java#L519-L537 |
grails/grails-core | grails-core/src/main/groovy/grails/core/DefaultGrailsApplication.java | DefaultGrailsApplication.isArtefactOfType | public boolean isArtefactOfType(String artefactType, @SuppressWarnings("rawtypes") Class theClazz) {
ArtefactHandler handler = artefactHandlersByName.get(artefactType);
if (handler == null) {
throw new GrailsConfigurationException(
"Unable to locate arefact handler for specified type: " + artefactType);
}
return handler.isArtefact(theClazz);
} | java | public boolean isArtefactOfType(String artefactType, @SuppressWarnings("rawtypes") Class theClazz) {
ArtefactHandler handler = artefactHandlersByName.get(artefactType);
if (handler == null) {
throw new GrailsConfigurationException(
"Unable to locate arefact handler for specified type: " + artefactType);
}
return handler.isArtefact(theClazz);
} | [
"public",
"boolean",
"isArtefactOfType",
"(",
"String",
"artefactType",
",",
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"Class",
"theClazz",
")",
"{",
"ArtefactHandler",
"handler",
"=",
"artefactHandlersByName",
".",
"get",
"(",
"artefactType",
")",
";",
"... | Returns true if the specified class is of the given artefact type as defined by the ArtefactHandler.
@param artefactType The type of the artefact
@param theClazz The class
@return true if it is of the specified artefactType
@see grails.core.ArtefactHandler | [
"Returns",
"true",
"if",
"the",
"specified",
"class",
"is",
"of",
"the",
"given",
"artefact",
"type",
"as",
"defined",
"by",
"the",
"ArtefactHandler",
"."
] | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/grails/core/DefaultGrailsApplication.java#L435-L443 |
rundeck/rundeck | core/src/main/java/com/dtolabs/rundeck/core/rules/WorkflowEngineOperationsProcessor.java | WorkflowEngineOperationsProcessor.getAvailableChanges | private void getAvailableChanges( final Map<String, String> changes) {
WorkflowSystem.OperationCompleted<DAT> task = stateChangeQueue.poll();
while (task != null && task.getNewState() != null) {
changes.putAll(task.getNewState().getState());
DAT result = task.getResult();
if (null != sharedData && null != result) {
sharedData.addData(result);
}
task = stateChangeQueue.poll();
}
} | java | private void getAvailableChanges( final Map<String, String> changes) {
WorkflowSystem.OperationCompleted<DAT> task = stateChangeQueue.poll();
while (task != null && task.getNewState() != null) {
changes.putAll(task.getNewState().getState());
DAT result = task.getResult();
if (null != sharedData && null != result) {
sharedData.addData(result);
}
task = stateChangeQueue.poll();
}
} | [
"private",
"void",
"getAvailableChanges",
"(",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"changes",
")",
"{",
"WorkflowSystem",
".",
"OperationCompleted",
"<",
"DAT",
">",
"task",
"=",
"stateChangeQueue",
".",
"poll",
"(",
")",
";",
"while",
"(",
... | Poll for changes from the queue, and process all changes that are immediately available without waiting
@param changes changes map | [
"Poll",
"for",
"changes",
"from",
"the",
"queue",
"and",
"process",
"all",
"changes",
"that",
"are",
"immediately",
"available",
"without",
"waiting"
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/rules/WorkflowEngineOperationsProcessor.java#L143-L153 |
dita-ot/dita-ot | src/main/java/org/dita/dost/reader/MergeTopicParser.java | MergeTopicParser.handleHref | private void handleHref(final String classValue, final AttributesImpl atts) {
final URI attValue = toURI(atts.getValue(ATTRIBUTE_NAME_HREF));
if (attValue != null) {
final String scopeValue = atts.getValue(ATTRIBUTE_NAME_SCOPE);
if ((scopeValue == null || ATTR_SCOPE_VALUE_LOCAL.equals(scopeValue))
&& attValue.getScheme() == null) {
final String formatValue = atts.getValue(ATTRIBUTE_NAME_FORMAT);
// The scope for @href is local
if ((TOPIC_XREF.matches(classValue) || TOPIC_LINK.matches(classValue) || TOPIC_LQ.matches(classValue)
// term, keyword, cite, ph, and dt are resolved as keyref can make them links
|| TOPIC_TERM.matches(classValue) || TOPIC_KEYWORD.matches(classValue)
|| TOPIC_CITE.matches(classValue) || TOPIC_PH.matches(classValue)
|| TOPIC_DT.matches(classValue))
&& (formatValue == null || ATTR_FORMAT_VALUE_DITA.equals(formatValue))) {
// local xref or link that refers to dita file
XMLUtils.addOrSetAttribute(atts, ATTRIBUTE_NAME_HREF, handleLocalDita(attValue, atts).toString());
} else {
// local @href other than local xref and link that refers to
// dita file
XMLUtils.addOrSetAttribute(atts, ATTRIBUTE_NAME_HREF, handleLocalHref(attValue).toString());
}
}
}
} | java | private void handleHref(final String classValue, final AttributesImpl atts) {
final URI attValue = toURI(atts.getValue(ATTRIBUTE_NAME_HREF));
if (attValue != null) {
final String scopeValue = atts.getValue(ATTRIBUTE_NAME_SCOPE);
if ((scopeValue == null || ATTR_SCOPE_VALUE_LOCAL.equals(scopeValue))
&& attValue.getScheme() == null) {
final String formatValue = atts.getValue(ATTRIBUTE_NAME_FORMAT);
// The scope for @href is local
if ((TOPIC_XREF.matches(classValue) || TOPIC_LINK.matches(classValue) || TOPIC_LQ.matches(classValue)
// term, keyword, cite, ph, and dt are resolved as keyref can make them links
|| TOPIC_TERM.matches(classValue) || TOPIC_KEYWORD.matches(classValue)
|| TOPIC_CITE.matches(classValue) || TOPIC_PH.matches(classValue)
|| TOPIC_DT.matches(classValue))
&& (formatValue == null || ATTR_FORMAT_VALUE_DITA.equals(formatValue))) {
// local xref or link that refers to dita file
XMLUtils.addOrSetAttribute(atts, ATTRIBUTE_NAME_HREF, handleLocalDita(attValue, atts).toString());
} else {
// local @href other than local xref and link that refers to
// dita file
XMLUtils.addOrSetAttribute(atts, ATTRIBUTE_NAME_HREF, handleLocalHref(attValue).toString());
}
}
}
} | [
"private",
"void",
"handleHref",
"(",
"final",
"String",
"classValue",
",",
"final",
"AttributesImpl",
"atts",
")",
"{",
"final",
"URI",
"attValue",
"=",
"toURI",
"(",
"atts",
".",
"getValue",
"(",
"ATTRIBUTE_NAME_HREF",
")",
")",
";",
"if",
"(",
"attValue",... | Rewrite href attribute.
@param classValue element class value
@param atts attributes | [
"Rewrite",
"href",
"attribute",
"."
] | train | https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/reader/MergeTopicParser.java#L228-L251 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/internal/json/JsonObject.java | JsonObject.getFloat | public float getFloat(String name, float defaultValue) {
JsonValue value = get(name);
return value != null ? value.asFloat() : defaultValue;
} | java | public float getFloat(String name, float defaultValue) {
JsonValue value = get(name);
return value != null ? value.asFloat() : defaultValue;
} | [
"public",
"float",
"getFloat",
"(",
"String",
"name",
",",
"float",
"defaultValue",
")",
"{",
"JsonValue",
"value",
"=",
"get",
"(",
"name",
")",
";",
"return",
"value",
"!=",
"null",
"?",
"value",
".",
"asFloat",
"(",
")",
":",
"defaultValue",
";",
"}... | Returns the <code>float</code> value of the member with the specified name in this object. If
this object does not contain a member with this name, the given default value is returned. If
this object contains multiple members with the given name, the last one will be picked. If this
member's value does not represent a JSON number or if it cannot be interpreted as Java
<code>float</code>, an exception is thrown.
@param name
the name of the member whose value is to be returned
@param defaultValue
the value to be returned if the requested member is missing
@return the value of the last member with the specified name, or the given default value if
this object does not contain a member with that name | [
"Returns",
"the",
"<code",
">",
"float<",
"/",
"code",
">",
"value",
"of",
"the",
"member",
"with",
"the",
"specified",
"name",
"in",
"this",
"object",
".",
"If",
"this",
"object",
"does",
"not",
"contain",
"a",
"member",
"with",
"this",
"name",
"the",
... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/json/JsonObject.java#L619-L622 |
Alluxio/alluxio | core/common/src/main/java/alluxio/cli/CommandUtils.java | CommandUtils.checkNumOfArgsNoMoreThan | public static void checkNumOfArgsNoMoreThan(Command cmd, CommandLine cl, int n) throws
InvalidArgumentException {
if (cl.getArgs().length > n) {
throw new InvalidArgumentException(ExceptionMessage.INVALID_ARGS_NUM_TOO_MANY
.getMessage(cmd.getCommandName(), n, cl.getArgs().length));
}
} | java | public static void checkNumOfArgsNoMoreThan(Command cmd, CommandLine cl, int n) throws
InvalidArgumentException {
if (cl.getArgs().length > n) {
throw new InvalidArgumentException(ExceptionMessage.INVALID_ARGS_NUM_TOO_MANY
.getMessage(cmd.getCommandName(), n, cl.getArgs().length));
}
} | [
"public",
"static",
"void",
"checkNumOfArgsNoMoreThan",
"(",
"Command",
"cmd",
",",
"CommandLine",
"cl",
",",
"int",
"n",
")",
"throws",
"InvalidArgumentException",
"{",
"if",
"(",
"cl",
".",
"getArgs",
"(",
")",
".",
"length",
">",
"n",
")",
"{",
"throw",... | Checks the number of non-option arguments is no more than n for command.
@param cmd command instance
@param cl parsed commandline arguments
@param n an integer
@throws InvalidArgumentException if the number is greater than n | [
"Checks",
"the",
"number",
"of",
"non",
"-",
"option",
"arguments",
"is",
"no",
"more",
"than",
"n",
"for",
"command",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/cli/CommandUtils.java#L100-L106 |
virgo47/javasimon | console-embed/src/main/java/org/javasimon/console/SimonConsoleRequestProcessor.java | SimonConsoleRequestProcessor.addResourceActionBinding | public void addResourceActionBinding(final String actionPath, final String resourcePath) {
this.addActionBinding(new ActionBinding() {
public boolean supports(ActionContext actionContext) {
return actionContext.getPath().equals(actionPath);
}
public Action create(ActionContext actionContext) {
return new ResourceAction(actionContext, resourcePath);
}
});
} | java | public void addResourceActionBinding(final String actionPath, final String resourcePath) {
this.addActionBinding(new ActionBinding() {
public boolean supports(ActionContext actionContext) {
return actionContext.getPath().equals(actionPath);
}
public Action create(ActionContext actionContext) {
return new ResourceAction(actionContext, resourcePath);
}
});
} | [
"public",
"void",
"addResourceActionBinding",
"(",
"final",
"String",
"actionPath",
",",
"final",
"String",
"resourcePath",
")",
"{",
"this",
".",
"addActionBinding",
"(",
"new",
"ActionBinding",
"(",
")",
"{",
"public",
"boolean",
"supports",
"(",
"ActionContext"... | Add a resource action binding to the {@link #actionBindings} list.
@param actionPath Path of the action
@param resourcePath Path of a resource located under | [
"Add",
"a",
"resource",
"action",
"binding",
"to",
"the",
"{",
"@link",
"#actionBindings",
"}",
"list",
"."
] | train | https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/console-embed/src/main/java/org/javasimon/console/SimonConsoleRequestProcessor.java#L108-L118 |
OpenBEL/openbel-framework | org.openbel.framework.common/src/main/java/org/openbel/framework/common/util/BELPathFilters.java | BELPathFilters.accept | private static boolean accept(final String extension, final File pathname) {
if (nulls(extension, pathname)) return false;
String absPath = pathname.getAbsolutePath();
final int extLength = extension.length();
int start = absPath.length() - extLength, end = absPath.length();
String ext = absPath.substring(start, end);
if (extension.equalsIgnoreCase(ext)) return true;
return false;
} | java | private static boolean accept(final String extension, final File pathname) {
if (nulls(extension, pathname)) return false;
String absPath = pathname.getAbsolutePath();
final int extLength = extension.length();
int start = absPath.length() - extLength, end = absPath.length();
String ext = absPath.substring(start, end);
if (extension.equalsIgnoreCase(ext)) return true;
return false;
} | [
"private",
"static",
"boolean",
"accept",
"(",
"final",
"String",
"extension",
",",
"final",
"File",
"pathname",
")",
"{",
"if",
"(",
"nulls",
"(",
"extension",
",",
"pathname",
")",
")",
"return",
"false",
";",
"String",
"absPath",
"=",
"pathname",
".",
... | Returns {@code true} if {@code pathname} ends with {@code extension},
ignoring case, {@code false} otherwise.
@param extension File extension
@param pathname Path name
@return boolean | [
"Returns",
"{",
"@code",
"true",
"}",
"if",
"{",
"@code",
"pathname",
"}",
"ends",
"with",
"{",
"@code",
"extension",
"}",
"ignoring",
"case",
"{",
"@code",
"false",
"}",
"otherwise",
"."
] | train | https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.common/src/main/java/org/openbel/framework/common/util/BELPathFilters.java#L62-L70 |
actorapp/actor-platform | actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java | Messenger.sendCustomJsonMessage | @ObjectiveCName("sendCustomJsonMessageWithPeer:withJson:")
public void sendCustomJsonMessage(@NotNull Peer peer, @NotNull JsonContent content) {
modules.getMessagesModule().sendJson(peer, content);
} | java | @ObjectiveCName("sendCustomJsonMessageWithPeer:withJson:")
public void sendCustomJsonMessage(@NotNull Peer peer, @NotNull JsonContent content) {
modules.getMessagesModule().sendJson(peer, content);
} | [
"@",
"ObjectiveCName",
"(",
"\"sendCustomJsonMessageWithPeer:withJson:\"",
")",
"public",
"void",
"sendCustomJsonMessage",
"(",
"@",
"NotNull",
"Peer",
"peer",
",",
"@",
"NotNull",
"JsonContent",
"content",
")",
"{",
"modules",
".",
"getMessagesModule",
"(",
")",
".... | Send json message
@param peer destination peer
@param content json content | [
"Send",
"json",
"message"
] | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java#L930-L933 |
dihedron/dihedron-commons | src/main/java/org/dihedron/core/streams/TeeOutputStream.java | TeeOutputStream.with | public TeeOutputStream with(OutputStream stream, boolean autoclose) {
if(stream != null) {
this.streams.put(stream, autoclose);
}
return this;
} | java | public TeeOutputStream with(OutputStream stream, boolean autoclose) {
if(stream != null) {
this.streams.put(stream, autoclose);
}
return this;
} | [
"public",
"TeeOutputStream",
"with",
"(",
"OutputStream",
"stream",
",",
"boolean",
"autoclose",
")",
"{",
"if",
"(",
"stream",
"!=",
"null",
")",
"{",
"this",
".",
"streams",
".",
"put",
"(",
"stream",
",",
"autoclose",
")",
";",
"}",
"return",
"this",
... | Adds an output stream; this method allows to specify whether the
stream should be closed when the T stream is closed. If you want to
use standard output as one of the streams in the T, this is the method
to use, passing in {@code false} for parameter {@code autoclose}.
@param stream
the stream to add to the T.
@param autoclose
whether the stream should be closed automatically when the T is closed.
@return
the object itself, for method chaining. | [
"Adds",
"an",
"output",
"stream",
";",
"this",
"method",
"allows",
"to",
"specify",
"whether",
"the",
"stream",
"should",
"be",
"closed",
"when",
"the",
"T",
"stream",
"is",
"closed",
".",
"If",
"you",
"want",
"to",
"use",
"standard",
"output",
"as",
"on... | train | https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/core/streams/TeeOutputStream.java#L84-L89 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfDate.java | PdfDate.setLength | private String setLength(int i, int length) { // 1.3-1.4 problem fixed by Finn Bock
StringBuffer tmp = new StringBuffer();
tmp.append(i);
while (tmp.length() < length) {
tmp.insert(0, "0");
}
tmp.setLength(length);
return tmp.toString();
} | java | private String setLength(int i, int length) { // 1.3-1.4 problem fixed by Finn Bock
StringBuffer tmp = new StringBuffer();
tmp.append(i);
while (tmp.length() < length) {
tmp.insert(0, "0");
}
tmp.setLength(length);
return tmp.toString();
} | [
"private",
"String",
"setLength",
"(",
"int",
"i",
",",
"int",
"length",
")",
"{",
"// 1.3-1.4 problem fixed by Finn Bock",
"StringBuffer",
"tmp",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"tmp",
".",
"append",
"(",
"i",
")",
";",
"while",
"(",
"tmp",
"."... | Adds a number of leading zeros to a given <CODE>String</CODE> in order to get a <CODE>String</CODE>
of a certain length.
@param i a given number
@param length the length of the resulting <CODE>String</CODE>
@return the resulting <CODE>String</CODE> | [
"Adds",
"a",
"number",
"of",
"leading",
"zeros",
"to",
"a",
"given",
"<CODE",
">",
"String<",
"/",
"CODE",
">",
"in",
"order",
"to",
"get",
"a",
"<CODE",
">",
"String<",
"/",
"CODE",
">",
"of",
"a",
"certain",
"length",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfDate.java#L130-L138 |
biezhi/anima | src/main/java/io/github/biezhi/anima/core/AnimaQuery.java | AnimaQuery.updateByModel | public <S extends Model> int updateByModel(S model) {
this.beforeCheck();
Object primaryKey = AnimaUtils.getAndRemovePrimaryKey(model);
StringBuilder sql = new StringBuilder(this.buildUpdateSQL(model, null));
List<Object> columnValueList = AnimaUtils.toColumnValues(model, false);
ifNotNullThen(primaryKey, () -> {
sql.append(" WHERE ").append(this.primaryKeyColumn).append(" = ?");
columnValueList.add(primaryKey);
});
return this.execute(sql.toString(), columnValueList);
} | java | public <S extends Model> int updateByModel(S model) {
this.beforeCheck();
Object primaryKey = AnimaUtils.getAndRemovePrimaryKey(model);
StringBuilder sql = new StringBuilder(this.buildUpdateSQL(model, null));
List<Object> columnValueList = AnimaUtils.toColumnValues(model, false);
ifNotNullThen(primaryKey, () -> {
sql.append(" WHERE ").append(this.primaryKeyColumn).append(" = ?");
columnValueList.add(primaryKey);
});
return this.execute(sql.toString(), columnValueList);
} | [
"public",
"<",
"S",
"extends",
"Model",
">",
"int",
"updateByModel",
"(",
"S",
"model",
")",
"{",
"this",
".",
"beforeCheck",
"(",
")",
";",
"Object",
"primaryKey",
"=",
"AnimaUtils",
".",
"getAndRemovePrimaryKey",
"(",
"model",
")",
";",
"StringBuilder",
... | Update a model
@param model model instance
@param <S>
@return affect the number of rows | [
"Update",
"a",
"model"
] | train | https://github.com/biezhi/anima/blob/d6655e47ac4c08d9d7f961ac0569062bead8b1ed/src/main/java/io/github/biezhi/anima/core/AnimaQuery.java#L1333-L1348 |
mikepenz/FastAdapter | app/src/main/java/com/mikepenz/fastadapter/app/items/expandable/SimpleSubItem.java | SimpleSubItem.bindView | @Override
public void bindView(ViewHolder viewHolder, List<Object> payloads) {
super.bindView(viewHolder, payloads);
//get the context
Context ctx = viewHolder.itemView.getContext();
//set the background for the item
viewHolder.view.clearAnimation();
ViewCompat.setBackground(viewHolder.view, FastAdapterUIUtils.getSelectableBackground(ctx, Color.RED, true));
//set the text for the name
StringHolder.applyTo(name, viewHolder.name);
//set the text for the description or hide
StringHolder.applyToOrHide(description, viewHolder.description);
} | java | @Override
public void bindView(ViewHolder viewHolder, List<Object> payloads) {
super.bindView(viewHolder, payloads);
//get the context
Context ctx = viewHolder.itemView.getContext();
//set the background for the item
viewHolder.view.clearAnimation();
ViewCompat.setBackground(viewHolder.view, FastAdapterUIUtils.getSelectableBackground(ctx, Color.RED, true));
//set the text for the name
StringHolder.applyTo(name, viewHolder.name);
//set the text for the description or hide
StringHolder.applyToOrHide(description, viewHolder.description);
} | [
"@",
"Override",
"public",
"void",
"bindView",
"(",
"ViewHolder",
"viewHolder",
",",
"List",
"<",
"Object",
">",
"payloads",
")",
"{",
"super",
".",
"bindView",
"(",
"viewHolder",
",",
"payloads",
")",
";",
"//get the context",
"Context",
"ctx",
"=",
"viewHo... | binds the data of this item onto the viewHolder
@param viewHolder the viewHolder of this item | [
"binds",
"the",
"data",
"of",
"this",
"item",
"onto",
"the",
"viewHolder"
] | train | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/app/src/main/java/com/mikepenz/fastadapter/app/items/expandable/SimpleSubItem.java#L95-L109 |
AltBeacon/android-beacon-library | lib/src/main/java/org/altbeacon/beacon/AltBeaconParser.java | AltBeaconParser.fromScanData | @Override
public Beacon fromScanData(byte[] scanData, int rssi, BluetoothDevice device) {
return fromScanData(scanData, rssi, device, new AltBeacon());
} | java | @Override
public Beacon fromScanData(byte[] scanData, int rssi, BluetoothDevice device) {
return fromScanData(scanData, rssi, device, new AltBeacon());
} | [
"@",
"Override",
"public",
"Beacon",
"fromScanData",
"(",
"byte",
"[",
"]",
"scanData",
",",
"int",
"rssi",
",",
"BluetoothDevice",
"device",
")",
"{",
"return",
"fromScanData",
"(",
"scanData",
",",
"rssi",
",",
"device",
",",
"new",
"AltBeacon",
"(",
")"... | Construct an AltBeacon from a Bluetooth LE packet collected by Android's Bluetooth APIs,
including the raw Bluetooth device info
@param scanData The actual packet bytes
@param rssi The measured signal strength of the packet
@param device The Bluetooth device that was detected
@return An instance of an <code>Beacon</code> | [
"Construct",
"an",
"AltBeacon",
"from",
"a",
"Bluetooth",
"LE",
"packet",
"collected",
"by",
"Android",
"s",
"Bluetooth",
"APIs",
"including",
"the",
"raw",
"Bluetooth",
"device",
"info"
] | train | https://github.com/AltBeacon/android-beacon-library/blob/f7f3a323ea7415d53e7bd695ff6a01f1501d5dc3/lib/src/main/java/org/altbeacon/beacon/AltBeaconParser.java#L65-L68 |
Netflix/conductor | grpc-client/src/main/java/com/netflix/conductor/client/grpc/WorkflowClient.java | WorkflowClient.getWorkflow | public Workflow getWorkflow(String workflowId, boolean includeTasks) {
Preconditions.checkArgument(StringUtils.isNotBlank(workflowId), "workflow id cannot be blank");
WorkflowPb.Workflow workflow = stub.getWorkflowStatus(
WorkflowServicePb.GetWorkflowStatusRequest.newBuilder()
.setWorkflowId(workflowId)
.setIncludeTasks(includeTasks)
.build()
);
return protoMapper.fromProto(workflow);
} | java | public Workflow getWorkflow(String workflowId, boolean includeTasks) {
Preconditions.checkArgument(StringUtils.isNotBlank(workflowId), "workflow id cannot be blank");
WorkflowPb.Workflow workflow = stub.getWorkflowStatus(
WorkflowServicePb.GetWorkflowStatusRequest.newBuilder()
.setWorkflowId(workflowId)
.setIncludeTasks(includeTasks)
.build()
);
return protoMapper.fromProto(workflow);
} | [
"public",
"Workflow",
"getWorkflow",
"(",
"String",
"workflowId",
",",
"boolean",
"includeTasks",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"StringUtils",
".",
"isNotBlank",
"(",
"workflowId",
")",
",",
"\"workflow id cannot be blank\"",
")",
";",
"Workf... | Retrieve a workflow by workflow id
@param workflowId the id of the workflow
@param includeTasks specify if the tasks in the workflow need to be returned
@return the requested workflow | [
"Retrieve",
"a",
"workflow",
"by",
"workflow",
"id"
] | train | https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/grpc-client/src/main/java/com/netflix/conductor/client/grpc/WorkflowClient.java#L48-L57 |
craftercms/core | src/main/java/org/craftercms/core/cache/impl/store/EhCacheStoreAdapter.java | EhCacheStoreAdapter.addScope | @Override
public void addScope(String scope, int maxItemsInMemory) throws Exception {
CacheConfiguration scopeConfig = new CacheConfiguration(scope, maxItemsInMemory);
scopeManager.addCache(new Cache(scopeConfig));
} | java | @Override
public void addScope(String scope, int maxItemsInMemory) throws Exception {
CacheConfiguration scopeConfig = new CacheConfiguration(scope, maxItemsInMemory);
scopeManager.addCache(new Cache(scopeConfig));
} | [
"@",
"Override",
"public",
"void",
"addScope",
"(",
"String",
"scope",
",",
"int",
"maxItemsInMemory",
")",
"throws",
"Exception",
"{",
"CacheConfiguration",
"scopeConfig",
"=",
"new",
"CacheConfiguration",
"(",
"scope",
",",
"maxItemsInMemory",
")",
";",
"scopeMa... | Adds a new scope. The scope is an instance of EhCache's {@link Cache}.
@param scope the name of the scope
@param maxItemsInMemory the maximum number of items in memory, before they are evicted
@throws Exception | [
"Adds",
"a",
"new",
"scope",
".",
"The",
"scope",
"is",
"an",
"instance",
"of",
"EhCache",
"s",
"{",
"@link",
"Cache",
"}",
"."
] | train | https://github.com/craftercms/core/blob/d3ec74d669d3f8cfcf995177615d5f126edfa237/src/main/java/org/craftercms/core/cache/impl/store/EhCacheStoreAdapter.java#L104-L109 |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/ResourceCopy.java | ResourceCopy.computeRelativeFile | public static File computeRelativeFile(File file, File rel, File dir) {
String path = file.getAbsolutePath();
String relativePath = path.substring(rel.getAbsolutePath().length());
return new File(dir, relativePath);
} | java | public static File computeRelativeFile(File file, File rel, File dir) {
String path = file.getAbsolutePath();
String relativePath = path.substring(rel.getAbsolutePath().length());
return new File(dir, relativePath);
} | [
"public",
"static",
"File",
"computeRelativeFile",
"(",
"File",
"file",
",",
"File",
"rel",
",",
"File",
"dir",
")",
"{",
"String",
"path",
"=",
"file",
".",
"getAbsolutePath",
"(",
")",
";",
"String",
"relativePath",
"=",
"path",
".",
"substring",
"(",
... | Gets a File object representing a File in the directory <tt>dir</tt> which has the same path as the file
<tt>file</tt> from the directory <tt>rel</tt>.
<p>
For example, copying root/foo/bar.txt to out with rel set to root returns the file out/foo/bar.txt.
@param file the file to copy
@param rel the base 'relative'
@param dir the output directory
@return the destination file | [
"Gets",
"a",
"File",
"object",
"representing",
"a",
"File",
"in",
"the",
"directory",
"<tt",
">",
"dir<",
"/",
"tt",
">",
"which",
"has",
"the",
"same",
"path",
"as",
"the",
"file",
"<tt",
">",
"file<",
"/",
"tt",
">",
"from",
"the",
"directory",
"<t... | train | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/ResourceCopy.java#L176-L180 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/parser/PdfContentStreamProcessor.java | PdfContentStreamProcessor.invokeOperator | public void invokeOperator(PdfLiteral operator, ArrayList operands) {
ContentOperator op = operators.get(operator.toString());
if (op == null) {
// skipping unssupported operator
return;
}
op.invoke(this, operator, operands);
} | java | public void invokeOperator(PdfLiteral operator, ArrayList operands) {
ContentOperator op = operators.get(operator.toString());
if (op == null) {
// skipping unssupported operator
return;
}
op.invoke(this, operator, operands);
} | [
"public",
"void",
"invokeOperator",
"(",
"PdfLiteral",
"operator",
",",
"ArrayList",
"operands",
")",
"{",
"ContentOperator",
"op",
"=",
"operators",
".",
"get",
"(",
"operator",
".",
"toString",
"(",
")",
")",
";",
"if",
"(",
"op",
"==",
"null",
")",
"{... | Invokes an operator.
@param operator the PDF Syntax of the operator
@param operands a list with operands | [
"Invokes",
"an",
"operator",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/parser/PdfContentStreamProcessor.java#L191-L198 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/factory/H2GISFunctions.java | H2GISFunctions.getStringProperty | private static String getStringProperty(Function function, String propertyKey) {
Object value = function.getProperty(propertyKey);
return value instanceof String ? (String)value : "";
} | java | private static String getStringProperty(Function function, String propertyKey) {
Object value = function.getProperty(propertyKey);
return value instanceof String ? (String)value : "";
} | [
"private",
"static",
"String",
"getStringProperty",
"(",
"Function",
"function",
",",
"String",
"propertyKey",
")",
"{",
"Object",
"value",
"=",
"function",
".",
"getProperty",
"(",
"propertyKey",
")",
";",
"return",
"value",
"instanceof",
"String",
"?",
"(",
... | Return a string property of the function
@param function
@param propertyKey
@return | [
"Return",
"a",
"string",
"property",
"of",
"the",
"function"
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/factory/H2GISFunctions.java#L417-L420 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/config/jmx/JawrApplicationConfigManager.java | JawrApplicationConfigManager.areEquals | public boolean areEquals(String str1, String str2) {
return (str1 == null && str2 == null || str1 != null && str2 != null && str1.equals(str2));
} | java | public boolean areEquals(String str1, String str2) {
return (str1 == null && str2 == null || str1 != null && str2 != null && str1.equals(str2));
} | [
"public",
"boolean",
"areEquals",
"(",
"String",
"str1",
",",
"String",
"str2",
")",
"{",
"return",
"(",
"str1",
"==",
"null",
"&&",
"str2",
"==",
"null",
"||",
"str1",
"!=",
"null",
"&&",
"str2",
"!=",
"null",
"&&",
"str1",
".",
"equals",
"(",
"str2... | Returns true if the 2 string are equals.
@param str1
the first string
@param str2
the 2nd string
@return true if the 2 string are equals. | [
"Returns",
"true",
"if",
"the",
"2",
"string",
"are",
"equals",
"."
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/config/jmx/JawrApplicationConfigManager.java#L606-L609 |
algolia/algoliasearch-client-java | src/main/java/com/algolia/search/saas/Index.java | Index.addObject | public JSONObject addObject(JSONObject obj, String objectID) throws AlgoliaException {
return this.addObject(obj, objectID, RequestOptions.empty);
} | java | public JSONObject addObject(JSONObject obj, String objectID) throws AlgoliaException {
return this.addObject(obj, objectID, RequestOptions.empty);
} | [
"public",
"JSONObject",
"addObject",
"(",
"JSONObject",
"obj",
",",
"String",
"objectID",
")",
"throws",
"AlgoliaException",
"{",
"return",
"this",
".",
"addObject",
"(",
"obj",
",",
"objectID",
",",
"RequestOptions",
".",
"empty",
")",
";",
"}"
] | Add an object in this index with a uniq identifier
@param obj the object to add
@param objectID the objectID associated to this object
(if this objectID already exist the old object will be overriden) | [
"Add",
"an",
"object",
"in",
"this",
"index",
"with",
"a",
"uniq",
"identifier"
] | train | https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Index.java#L94-L96 |
Alluxio/alluxio | core/common/src/main/java/alluxio/util/LogUtils.java | LogUtils.warnWithException | public static void warnWithException(Logger logger, String message, Object ...args) {
if (logger.isDebugEnabled()) {
logger.debug(message, args);
} else {
if (args.length > 0 && args[args.length - 1] instanceof Throwable) {
args[args.length - 1] = ((Throwable) args[args.length - 1]).getMessage();
}
logger.warn(message + ": {}", args);
}
} | java | public static void warnWithException(Logger logger, String message, Object ...args) {
if (logger.isDebugEnabled()) {
logger.debug(message, args);
} else {
if (args.length > 0 && args[args.length - 1] instanceof Throwable) {
args[args.length - 1] = ((Throwable) args[args.length - 1]).getMessage();
}
logger.warn(message + ": {}", args);
}
} | [
"public",
"static",
"void",
"warnWithException",
"(",
"Logger",
"logger",
",",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"message",
",",
"args... | Log a warning message with full exception if debug logging is enabled,
or just the message otherwise.
@param logger the logger to be used
@param message the message to be logged
@param args the arguments for the message | [
"Log",
"a",
"warning",
"message",
"with",
"full",
"exception",
"if",
"debug",
"logging",
"is",
"enabled",
"or",
"just",
"the",
"message",
"otherwise",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/LogUtils.java#L125-L134 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/utils/GrassLegacyUtilities.java | GrassLegacyUtilities.removeGrassRasterMap | public static boolean removeGrassRasterMap( String mapsetPath, String mapName ) throws IOException {
// list of files to remove
String mappaths[] = filesOfRasterMap(mapsetPath, mapName);
// first delete the list above, which are just files
for( int j = 0; j < mappaths.length; j++ ) {
File filetoremove = new File(mappaths[j]);
if (filetoremove.exists()) {
if (!FileUtilities.deleteFileOrDir(filetoremove)) {
return false;
}
}
}
return true;
} | java | public static boolean removeGrassRasterMap( String mapsetPath, String mapName ) throws IOException {
// list of files to remove
String mappaths[] = filesOfRasterMap(mapsetPath, mapName);
// first delete the list above, which are just files
for( int j = 0; j < mappaths.length; j++ ) {
File filetoremove = new File(mappaths[j]);
if (filetoremove.exists()) {
if (!FileUtilities.deleteFileOrDir(filetoremove)) {
return false;
}
}
}
return true;
} | [
"public",
"static",
"boolean",
"removeGrassRasterMap",
"(",
"String",
"mapsetPath",
",",
"String",
"mapName",
")",
"throws",
"IOException",
"{",
"// list of files to remove",
"String",
"mappaths",
"[",
"]",
"=",
"filesOfRasterMap",
"(",
"mapsetPath",
",",
"mapName",
... | Given the mapsetpath and the mapname, the map is removed with all its accessor files
@param mapsetPath
@param mapName
@throws IOException | [
"Given",
"the",
"mapsetpath",
"and",
"the",
"mapname",
"the",
"map",
"is",
"removed",
"with",
"all",
"its",
"accessor",
"files"
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/utils/GrassLegacyUtilities.java#L658-L673 |
contentful/contentful-management.java | src/main/java/com/contentful/java/cma/ModuleAssets.java | ModuleAssets.fetchOne | public CMAAsset fetchOne(String spaceId, String environmentId, String assetId) {
assertNotNull(spaceId, "spaceId");
assertNotNull(environmentId, "environmentId");
assertNotNull(assetId, "assetId");
return service.fetchOne(spaceId, environmentId, assetId).blockingFirst();
} | java | public CMAAsset fetchOne(String spaceId, String environmentId, String assetId) {
assertNotNull(spaceId, "spaceId");
assertNotNull(environmentId, "environmentId");
assertNotNull(assetId, "assetId");
return service.fetchOne(spaceId, environmentId, assetId).blockingFirst();
} | [
"public",
"CMAAsset",
"fetchOne",
"(",
"String",
"spaceId",
",",
"String",
"environmentId",
",",
"String",
"assetId",
")",
"{",
"assertNotNull",
"(",
"spaceId",
",",
"\"spaceId\"",
")",
";",
"assertNotNull",
"(",
"environmentId",
",",
"\"environmentId\"",
")",
"... | Fetch an Asset with the given {@code assetId} from the given space and environment.
@param spaceId Space ID
@param environmentId Environment ID
@param assetId Asset ID
@return {@link CMAAsset} result instance
@throws IllegalArgumentException if spaceId is null.
@throws IllegalArgumentException if assetId is null. | [
"Fetch",
"an",
"Asset",
"with",
"the",
"given",
"{",
"@code",
"assetId",
"}",
"from",
"the",
"given",
"space",
"and",
"environment",
"."
] | train | https://github.com/contentful/contentful-management.java/blob/ca310fb9ea9577fcff0ca57949ab7c2315fa2534/src/main/java/com/contentful/java/cma/ModuleAssets.java#L242-L248 |
lucee/Lucee | core/src/main/java/lucee/runtime/tag/Schedule.java | Schedule.setStartdate | public void setStartdate(Object objStartDate) throws PageException {
if (StringUtil.isEmpty(objStartDate)) return;
this.startdate = new DateImpl(DateCaster.toDateAdvanced(objStartDate, pageContext.getTimeZone()));
} | java | public void setStartdate(Object objStartDate) throws PageException {
if (StringUtil.isEmpty(objStartDate)) return;
this.startdate = new DateImpl(DateCaster.toDateAdvanced(objStartDate, pageContext.getTimeZone()));
} | [
"public",
"void",
"setStartdate",
"(",
"Object",
"objStartDate",
")",
"throws",
"PageException",
"{",
"if",
"(",
"StringUtil",
".",
"isEmpty",
"(",
"objStartDate",
")",
")",
"return",
";",
"this",
".",
"startdate",
"=",
"new",
"DateImpl",
"(",
"DateCaster",
... | set the value startdate Required when action ='update'. The date when scheduling of the task
should start.
@param objStartDate value to set
@throws PageException | [
"set",
"the",
"value",
"startdate",
"Required",
"when",
"action",
"=",
"update",
".",
"The",
"date",
"when",
"scheduling",
"of",
"the",
"task",
"should",
"start",
"."
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Schedule.java#L204-L207 |
thinkaurelius/titan | titan-core/src/main/java/com/thinkaurelius/titan/graphdb/database/management/AbstractIndexStatusWatcher.java | AbstractIndexStatusWatcher.pollInterval | public S pollInterval(long poll, TemporalUnit pollUnit) {
Preconditions.checkArgument(0 <= poll);
this.poll = Duration.of(poll, pollUnit);
return self();
} | java | public S pollInterval(long poll, TemporalUnit pollUnit) {
Preconditions.checkArgument(0 <= poll);
this.poll = Duration.of(poll, pollUnit);
return self();
} | [
"public",
"S",
"pollInterval",
"(",
"long",
"poll",
",",
"TemporalUnit",
"pollUnit",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"0",
"<=",
"poll",
")",
";",
"this",
".",
"poll",
"=",
"Duration",
".",
"of",
"(",
"poll",
",",
"pollUnit",
")",
... | Set the index information polling interval. {@link #call()} waits
at least this long between repeated attempts to read schema information
and determine whether the index has reached its target state. | [
"Set",
"the",
"index",
"information",
"polling",
"interval",
".",
"{"
] | train | https://github.com/thinkaurelius/titan/blob/ee226e52415b8bf43b700afac75fa5b9767993a5/titan-core/src/main/java/com/thinkaurelius/titan/graphdb/database/management/AbstractIndexStatusWatcher.java#L70-L74 |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/event/EventSubscriptions.java | EventSubscriptions.addSubscriber | public synchronized int addSubscriber(String eventName, IGenericEvent<T> subscriber) {
List<IGenericEvent<T>> subscribers = getSubscribers(eventName, true);
subscribers.add(subscriber);
return subscribers.size();
} | java | public synchronized int addSubscriber(String eventName, IGenericEvent<T> subscriber) {
List<IGenericEvent<T>> subscribers = getSubscribers(eventName, true);
subscribers.add(subscriber);
return subscribers.size();
} | [
"public",
"synchronized",
"int",
"addSubscriber",
"(",
"String",
"eventName",
",",
"IGenericEvent",
"<",
"T",
">",
"subscriber",
")",
"{",
"List",
"<",
"IGenericEvent",
"<",
"T",
">>",
"subscribers",
"=",
"getSubscribers",
"(",
"eventName",
",",
"true",
")",
... | Adds a subscriber to the specified event.
@param eventName Name of the event.
@param subscriber Subscriber to add.
@return Count of subscribers after the operation. | [
"Adds",
"a",
"subscriber",
"to",
"the",
"specified",
"event",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/event/EventSubscriptions.java#L56-L60 |
alibaba/ARouter | arouter-api/src/main/java/com/alibaba/android/arouter/facade/Postcard.java | Postcard.withShort | public Postcard withShort(@Nullable String key, short value) {
mBundle.putShort(key, value);
return this;
} | java | public Postcard withShort(@Nullable String key, short value) {
mBundle.putShort(key, value);
return this;
} | [
"public",
"Postcard",
"withShort",
"(",
"@",
"Nullable",
"String",
"key",
",",
"short",
"value",
")",
"{",
"mBundle",
".",
"putShort",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Inserts a short value into the mapping of this Bundle, replacing
any existing value for the given key.
@param key a String, or null
@param value a short
@return current | [
"Inserts",
"a",
"short",
"value",
"into",
"the",
"mapping",
"of",
"this",
"Bundle",
"replacing",
"any",
"existing",
"value",
"for",
"the",
"given",
"key",
"."
] | train | https://github.com/alibaba/ARouter/blob/1a06912a6e14a57112db1204b43f81c43d721732/arouter-api/src/main/java/com/alibaba/android/arouter/facade/Postcard.java#L270-L273 |
JodaOrg/joda-beans | src/main/java/org/joda/beans/ser/SerTypeMapper.java | SerTypeMapper.decodeType | public static Class<?> decodeType(
String className,
JodaBeanSer settings,
String basePackage,
Map<String, Class<?>> knownTypes) throws ClassNotFoundException {
return decodeType0(className, settings, basePackage, knownTypes, null);
} | java | public static Class<?> decodeType(
String className,
JodaBeanSer settings,
String basePackage,
Map<String, Class<?>> knownTypes) throws ClassNotFoundException {
return decodeType0(className, settings, basePackage, knownTypes, null);
} | [
"public",
"static",
"Class",
"<",
"?",
">",
"decodeType",
"(",
"String",
"className",
",",
"JodaBeanSer",
"settings",
",",
"String",
"basePackage",
",",
"Map",
"<",
"String",
",",
"Class",
"<",
"?",
">",
">",
"knownTypes",
")",
"throws",
"ClassNotFoundExcept... | Decodes a class, throwing an exception if not found.
<p>
This uses the context class loader.
This handles known simple types, like String, Integer or File, and prefixing.
It also allows a map of message specific shorter forms.
@param className the class name, not null
@param settings the settings object, not null
@param basePackage the base package to use with trailing dot, null if none
@param knownTypes the known types map, null if not using known type shortening
@return the class object, not null
@throws ClassNotFoundException if not found | [
"Decodes",
"a",
"class",
"throwing",
"an",
"exception",
"if",
"not",
"found",
".",
"<p",
">",
"This",
"uses",
"the",
"context",
"class",
"loader",
".",
"This",
"handles",
"known",
"simple",
"types",
"like",
"String",
"Integer",
"or",
"File",
"and",
"prefix... | train | https://github.com/JodaOrg/joda-beans/blob/f07dbe42947150b23a173f35984c6ab33c5529bf/src/main/java/org/joda/beans/ser/SerTypeMapper.java#L158-L165 |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java | Widget.setRotationByAxis | @SuppressWarnings("unused")
public void setRotationByAxis(float angle, float x, float y, float z) {
getTransform().setRotationByAxis(angle, x, y, z);
if (mTransformCache.setRotationByAxis(angle, x, y, z)) {
onTransformChanged();
}
} | java | @SuppressWarnings("unused")
public void setRotationByAxis(float angle, float x, float y, float z) {
getTransform().setRotationByAxis(angle, x, y, z);
if (mTransformCache.setRotationByAxis(angle, x, y, z)) {
onTransformChanged();
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"public",
"void",
"setRotationByAxis",
"(",
"float",
"angle",
",",
"float",
"x",
",",
"float",
"y",
",",
"float",
"z",
")",
"{",
"getTransform",
"(",
")",
".",
"setRotationByAxis",
"(",
"angle",
",",
"x",
... | Sets the absolute rotation in angle/axis terms.
Rotates using the right hand rule.
<p>
Contrast this with {@link #rotate(float, float, float, float) rotate()},
{@link #rotateByAxis(float, float, float, float) rotateByAxis()}, or
{@link #rotateByAxisWithPivot(float, float, float, float, float, float, float)
rotateByAxisWithPivot()}, which all do relative rotations.
@param angle
Angle of rotation in degrees.
@param x
'X' component of the axis.
@param y
'Y' component of the axis.
@param z
'Z' component of the axis. | [
"Sets",
"the",
"absolute",
"rotation",
"in",
"angle",
"/",
"axis",
"terms",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java#L1572-L1578 |
jbundle/jbundle | thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/ReceiveQueueProxy.java | ReceiveQueueProxy.removeRemoteMessageFilter | public boolean removeRemoteMessageFilter(BaseMessageFilter messageFilter, boolean bFreeFilter) throws RemoteException
{
BaseTransport transport = this.createProxyTransport(REMOVE_REMOTE_MESSAGE_FILTER);
transport.addParam(FILTER, messageFilter); // Don't use COMMAND
transport.addParam(FREE, bFreeFilter);
Object strReturn = transport.sendMessageAndGetReply();
Object objReturn = transport.convertReturnObject(strReturn);
if (objReturn instanceof Boolean)
return ((Boolean)objReturn).booleanValue();
return true;
} | java | public boolean removeRemoteMessageFilter(BaseMessageFilter messageFilter, boolean bFreeFilter) throws RemoteException
{
BaseTransport transport = this.createProxyTransport(REMOVE_REMOTE_MESSAGE_FILTER);
transport.addParam(FILTER, messageFilter); // Don't use COMMAND
transport.addParam(FREE, bFreeFilter);
Object strReturn = transport.sendMessageAndGetReply();
Object objReturn = transport.convertReturnObject(strReturn);
if (objReturn instanceof Boolean)
return ((Boolean)objReturn).booleanValue();
return true;
} | [
"public",
"boolean",
"removeRemoteMessageFilter",
"(",
"BaseMessageFilter",
"messageFilter",
",",
"boolean",
"bFreeFilter",
")",
"throws",
"RemoteException",
"{",
"BaseTransport",
"transport",
"=",
"this",
".",
"createProxyTransport",
"(",
"REMOVE_REMOTE_MESSAGE_FILTER",
")... | Remove this remote message filter.
@param messageFilter The message filter to remove.
@param bFreeFilter If true, free the remote filter. | [
"Remove",
"this",
"remote",
"message",
"filter",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/ReceiveQueueProxy.java#L98-L108 |
ops4j/org.ops4j.base | ops4j-base-util/src/main/java/org/ops4j/util/i18n/Resources.java | Resources.getFloat | public float getFloat( String key, float defaultValue )
throws MissingResourceException
{
try
{
return getFloat( key );
}
catch( MissingResourceException mre )
{
return defaultValue;
}
} | java | public float getFloat( String key, float defaultValue )
throws MissingResourceException
{
try
{
return getFloat( key );
}
catch( MissingResourceException mre )
{
return defaultValue;
}
} | [
"public",
"float",
"getFloat",
"(",
"String",
"key",
",",
"float",
"defaultValue",
")",
"throws",
"MissingResourceException",
"{",
"try",
"{",
"return",
"getFloat",
"(",
"key",
")",
";",
"}",
"catch",
"(",
"MissingResourceException",
"mre",
")",
"{",
"return",... | Retrieve a float from bundle.
@param key the key of resource
@param defaultValue the default value if key is missing
@return the resource float
@throws MissingResourceException if the requested key is unknown | [
"Retrieve",
"a",
"float",
"from",
"bundle",
"."
] | train | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util/src/main/java/org/ops4j/util/i18n/Resources.java#L427-L438 |
augustd/burp-suite-utils | src/main/java/com/codemagi/burp/Utils.java | Utils.noNulls | public static String noNulls(String test, String output, String defaultOutput) {
if (isEmpty(test)) {
return defaultOutput;
}
return output;
} | java | public static String noNulls(String test, String output, String defaultOutput) {
if (isEmpty(test)) {
return defaultOutput;
}
return output;
} | [
"public",
"static",
"String",
"noNulls",
"(",
"String",
"test",
",",
"String",
"output",
",",
"String",
"defaultOutput",
")",
"{",
"if",
"(",
"isEmpty",
"(",
"test",
")",
")",
"{",
"return",
"defaultOutput",
";",
"}",
"return",
"output",
";",
"}"
] | Outputs the String output if the test String is not empty, otherwise
outputs default
@param test String to test for emptyness
@param output String to output if the test String is not empty
@param defaultOutput String to output if the test String is empty
@return Object Empty String if the input was null, the input unchanged
otherwise | [
"Outputs",
"the",
"String",
"output",
"if",
"the",
"test",
"String",
"is",
"not",
"empty",
"otherwise",
"outputs",
"default"
] | train | https://github.com/augustd/burp-suite-utils/blob/5e34a6b9147f5705382f98049dd9e4f387b78629/src/main/java/com/codemagi/burp/Utils.java#L153-L159 |
fuzzylite/jfuzzylite | jfuzzylite/src/main/java/com/fuzzylite/Benchmark.java | Benchmark.prepare | public void prepare(Reader reader, long numberOfLines) throws IOException {
this.expected = new ArrayList<double[]>();
BufferedReader bufferedReader = new BufferedReader(reader);
try {
String line;
int lineNumber = 0;
while (lineNumber != numberOfLines
&& (line = bufferedReader.readLine()) != null) {
++lineNumber;
line = line.trim();
if (line.isEmpty() || line.charAt(0) == '#') {
continue;
}
double[] expectedValues;
if (lineNumber == 1) { //automatic detection of header.
try {
expectedValues = Op.toDoubles(line);
} catch (Exception ex) {
continue;
}
} else {
expectedValues = Op.toDoubles(line);
}
this.expected.add(expectedValues);
}
} catch (IOException ex) {
throw ex;
} finally {
bufferedReader.close();
}
} | java | public void prepare(Reader reader, long numberOfLines) throws IOException {
this.expected = new ArrayList<double[]>();
BufferedReader bufferedReader = new BufferedReader(reader);
try {
String line;
int lineNumber = 0;
while (lineNumber != numberOfLines
&& (line = bufferedReader.readLine()) != null) {
++lineNumber;
line = line.trim();
if (line.isEmpty() || line.charAt(0) == '#') {
continue;
}
double[] expectedValues;
if (lineNumber == 1) { //automatic detection of header.
try {
expectedValues = Op.toDoubles(line);
} catch (Exception ex) {
continue;
}
} else {
expectedValues = Op.toDoubles(line);
}
this.expected.add(expectedValues);
}
} catch (IOException ex) {
throw ex;
} finally {
bufferedReader.close();
}
} | [
"public",
"void",
"prepare",
"(",
"Reader",
"reader",
",",
"long",
"numberOfLines",
")",
"throws",
"IOException",
"{",
"this",
".",
"expected",
"=",
"new",
"ArrayList",
"<",
"double",
"[",
"]",
">",
"(",
")",
";",
"BufferedReader",
"bufferedReader",
"=",
"... | Reads and loads into memory the set of expected values from the engine
@param reader is the reader of a set of lines containing space-separated
values
@param numberOfLines is the maximum number of lines to read from the
reader, and a value $f@n=(\infty, -1]$f@ reads the entire file.
@throws IOException if the reader cannot be read | [
"Reads",
"and",
"loads",
"into",
"memory",
"the",
"set",
"of",
"expected",
"values",
"from",
"the",
"engine"
] | train | https://github.com/fuzzylite/jfuzzylite/blob/583ac1928f39512af75de80d560e67448039595a/jfuzzylite/src/main/java/com/fuzzylite/Benchmark.java#L284-L315 |
dnault/therapi-runtime-javadoc | therapi-runtime-javadoc/src/main/java/com/github/therapi/runtimejavadoc/RuntimeJavadoc.java | RuntimeJavadoc.getJavadoc | public static ClassJavadoc getJavadoc(String qualifiedClassName, ClassLoader classLoader) {
final String resourceName = getResourceName(qualifiedClassName);
try (InputStream is = classLoader.getResourceAsStream(resourceName)) {
return parseJavadocResource(qualifiedClassName, is);
} catch (IOException e) {
throw new RuntimeException(e);
}
} | java | public static ClassJavadoc getJavadoc(String qualifiedClassName, ClassLoader classLoader) {
final String resourceName = getResourceName(qualifiedClassName);
try (InputStream is = classLoader.getResourceAsStream(resourceName)) {
return parseJavadocResource(qualifiedClassName, is);
} catch (IOException e) {
throw new RuntimeException(e);
}
} | [
"public",
"static",
"ClassJavadoc",
"getJavadoc",
"(",
"String",
"qualifiedClassName",
",",
"ClassLoader",
"classLoader",
")",
"{",
"final",
"String",
"resourceName",
"=",
"getResourceName",
"(",
"qualifiedClassName",
")",
";",
"try",
"(",
"InputStream",
"is",
"=",
... | Gets the Javadoc of the given class, using the given {@link ClassLoader} to find the Javadoc resource.
<p>
The return value is always non-null. If no Javadoc is available, the returned object's
{@link BaseJavadoc#isEmpty isEmpty()} method will return {@code true}.
@param qualifiedClassName the fully qualified name of the class whose Javadoc you want to retrieve
@param classLoader the class loader to use to find the Javadoc resource file
@return the Javadoc of the given class | [
"Gets",
"the",
"Javadoc",
"of",
"the",
"given",
"class",
"using",
"the",
"given",
"{",
"@link",
"ClassLoader",
"}",
"to",
"find",
"the",
"Javadoc",
"resource",
".",
"<p",
">",
"The",
"return",
"value",
"is",
"always",
"non",
"-",
"null",
".",
"If",
"no... | train | https://github.com/dnault/therapi-runtime-javadoc/blob/74902191dcf74b870e296653b2adf7dbb747c189/therapi-runtime-javadoc/src/main/java/com/github/therapi/runtimejavadoc/RuntimeJavadoc.java#L63-L70 |
orbisgis/h2gis | h2gis-utilities/src/main/java/org/h2gis/utilities/SFSUtilities.java | SFSUtilities.getGeometryFields | public static List<String> getGeometryFields(Connection connection,TableLocation location) throws SQLException {
return getGeometryFields(connection, location.getCatalog(), location.getSchema(), location.getTable());
} | java | public static List<String> getGeometryFields(Connection connection,TableLocation location) throws SQLException {
return getGeometryFields(connection, location.getCatalog(), location.getSchema(), location.getTable());
} | [
"public",
"static",
"List",
"<",
"String",
">",
"getGeometryFields",
"(",
"Connection",
"connection",
",",
"TableLocation",
"location",
")",
"throws",
"SQLException",
"{",
"return",
"getGeometryFields",
"(",
"connection",
",",
"location",
".",
"getCatalog",
"(",
"... | Find geometry fields name of a table.
@param connection Active connection
@param location Table location
@return A list of Geometry fields name
@throws SQLException | [
"Find",
"geometry",
"fields",
"name",
"of",
"a",
"table",
"."
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-utilities/src/main/java/org/h2gis/utilities/SFSUtilities.java#L241-L243 |
sailthru/sailthru-java-client | src/main/com/sailthru/client/AbstractSailthruClient.java | AbstractSailthruClient.apiGet | public JsonResponse apiGet(ApiAction action, Map<String, Object> data) throws IOException {
return httpRequestJson(action, HttpRequestMethod.GET, data);
} | java | public JsonResponse apiGet(ApiAction action, Map<String, Object> data) throws IOException {
return httpRequestJson(action, HttpRequestMethod.GET, data);
} | [
"public",
"JsonResponse",
"apiGet",
"(",
"ApiAction",
"action",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"data",
")",
"throws",
"IOException",
"{",
"return",
"httpRequestJson",
"(",
"action",
",",
"HttpRequestMethod",
".",
"GET",
",",
"data",
")",
";",... | HTTP GET Request with Map
@param action API action
@param data Parameter data
@throws IOException | [
"HTTP",
"GET",
"Request",
"with",
"Map"
] | train | https://github.com/sailthru/sailthru-java-client/blob/62b491f6a39b41b836bfc021779200d29b6d2069/src/main/com/sailthru/client/AbstractSailthruClient.java#L252-L254 |
biezhi/anima | src/main/java/io/github/biezhi/anima/core/AnimaQuery.java | AnimaQuery.buildUpdateSQL | private <S extends Model> String buildUpdateSQL(S model, Map<String, Object> updateColumns) {
SQLParams sqlParams = SQLParams.builder()
.model(model)
.modelClass(this.modelClass)
.tableName(this.tableName)
.pkName(this.primaryKeyColumn)
.updateColumns(updateColumns)
.conditionSQL(this.conditionSQL)
.build();
return Anima.of().dialect().update(sqlParams);
} | java | private <S extends Model> String buildUpdateSQL(S model, Map<String, Object> updateColumns) {
SQLParams sqlParams = SQLParams.builder()
.model(model)
.modelClass(this.modelClass)
.tableName(this.tableName)
.pkName(this.primaryKeyColumn)
.updateColumns(updateColumns)
.conditionSQL(this.conditionSQL)
.build();
return Anima.of().dialect().update(sqlParams);
} | [
"private",
"<",
"S",
"extends",
"Model",
">",
"String",
"buildUpdateSQL",
"(",
"S",
"model",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"updateColumns",
")",
"{",
"SQLParams",
"sqlParams",
"=",
"SQLParams",
".",
"builder",
"(",
")",
".",
"model",
"("... | Build a update statement.
@param model model instance
@param updateColumns update columns
@param <S>
@return update sql | [
"Build",
"a",
"update",
"statement",
"."
] | train | https://github.com/biezhi/anima/blob/d6655e47ac4c08d9d7f961ac0569062bead8b1ed/src/main/java/io/github/biezhi/anima/core/AnimaQuery.java#L1446-L1457 |
aws/aws-sdk-java | aws-java-sdk-sqs/src/main/java/com/amazonaws/services/sqs/model/Message.java | Message.withAttributes | public Message withAttributes(java.util.Map<String, String> attributes) {
setAttributes(attributes);
return this;
} | java | public Message withAttributes(java.util.Map<String, String> attributes) {
setAttributes(attributes);
return this;
} | [
"public",
"Message",
"withAttributes",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"attributes",
")",
"{",
"setAttributes",
"(",
"attributes",
")",
";",
"return",
"this",
";",
"}"
] | <p>
A map of the attributes requested in <code> <a>ReceiveMessage</a> </code> to their respective values. Supported
attributes:
</p>
<ul>
<li>
<p>
<code>ApproximateReceiveCount</code>
</p>
</li>
<li>
<p>
<code>ApproximateFirstReceiveTimestamp</code>
</p>
</li>
<li>
<p>
<code>MessageDeduplicationId</code>
</p>
</li>
<li>
<p>
<code>MessageGroupId</code>
</p>
</li>
<li>
<p>
<code>SenderId</code>
</p>
</li>
<li>
<p>
<code>SentTimestamp</code>
</p>
</li>
<li>
<p>
<code>SequenceNumber</code>
</p>
</li>
</ul>
<p>
<code>ApproximateFirstReceiveTimestamp</code> and <code>SentTimestamp</code> are each returned as an integer
representing the <a href="http://en.wikipedia.org/wiki/Unix_time">epoch time</a> in milliseconds.
</p>
@param attributes
A map of the attributes requested in <code> <a>ReceiveMessage</a> </code> to their respective values.
Supported attributes:</p>
<ul>
<li>
<p>
<code>ApproximateReceiveCount</code>
</p>
</li>
<li>
<p>
<code>ApproximateFirstReceiveTimestamp</code>
</p>
</li>
<li>
<p>
<code>MessageDeduplicationId</code>
</p>
</li>
<li>
<p>
<code>MessageGroupId</code>
</p>
</li>
<li>
<p>
<code>SenderId</code>
</p>
</li>
<li>
<p>
<code>SentTimestamp</code>
</p>
</li>
<li>
<p>
<code>SequenceNumber</code>
</p>
</li>
</ul>
<p>
<code>ApproximateFirstReceiveTimestamp</code> and <code>SentTimestamp</code> are each returned as an
integer representing the <a href="http://en.wikipedia.org/wiki/Unix_time">epoch time</a> in milliseconds.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"A",
"map",
"of",
"the",
"attributes",
"requested",
"in",
"<code",
">",
"<a",
">",
"ReceiveMessage<",
"/",
"a",
">",
"<",
"/",
"code",
">",
"to",
"their",
"respective",
"values",
".",
"Supported",
"attributes",
":",
"<",
"/",
"p",
">",
"<u... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-sqs/src/main/java/com/amazonaws/services/sqs/model/Message.java#L582-L585 |
wkgcass/Style | src/main/java/net/cassite/style/SwitchBlock.java | SwitchBlock.Case | @SuppressWarnings("unchecked")
public SwitchBlock<T, R> Case(T ca, VFunc0 func) {
return Case(ca, (def<R>) $(func));
} | java | @SuppressWarnings("unchecked")
public SwitchBlock<T, R> Case(T ca, VFunc0 func) {
return Case(ca, (def<R>) $(func));
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"SwitchBlock",
"<",
"T",
",",
"R",
">",
"Case",
"(",
"T",
"ca",
",",
"VFunc0",
"func",
")",
"{",
"return",
"Case",
"(",
"ca",
",",
"(",
"def",
"<",
"R",
">",
")",
"$",
"(",
"func",
")"... | add a Case block to the expression
@param ca the object for switch-expression to match
@param func function to apply when matches
@return <code>this</code> | [
"add",
"a",
"Case",
"block",
"to",
"the",
"expression"
] | train | https://github.com/wkgcass/Style/blob/db3ea64337251f46f734279480e365293bececbd/src/main/java/net/cassite/style/SwitchBlock.java#L64-L67 |
DJCordhose/jmte | src/com/floreysoft/jmte/TemplateContext.java | TemplateContext.notifyProcessListener | public void notifyProcessListener(Token token, Action action) {
if (processListener != null) {
processListener.log(this, token, action);
}
} | java | public void notifyProcessListener(Token token, Action action) {
if (processListener != null) {
processListener.log(this, token, action);
}
} | [
"public",
"void",
"notifyProcessListener",
"(",
"Token",
"token",
",",
"Action",
"action",
")",
"{",
"if",
"(",
"processListener",
"!=",
"null",
")",
"{",
"processListener",
".",
"log",
"(",
"this",
",",
"token",
",",
"action",
")",
";",
"}",
"}"
] | Allows you to send additional notifications of executed processing steps.
@param token
the token that is handled
@param action
the action that is executed on the action | [
"Allows",
"you",
"to",
"send",
"additional",
"notifications",
"of",
"executed",
"processing",
"steps",
"."
] | train | https://github.com/DJCordhose/jmte/blob/7334e6d111cc2198c5cf69ee336584ab9e192fe5/src/com/floreysoft/jmte/TemplateContext.java#L100-L104 |
amzn/ion-java | src/com/amazon/ion/impl/IonUTF8.java | IonUTF8.convertToUTF8Bytes | public final static int convertToUTF8Bytes(int unicodeScalar, byte[] outputBytes, int offset, int maxLength)
{
int dst = offset;
int end = offset + maxLength;
switch (getUTF8ByteCount(unicodeScalar)) {
case 1:
if (dst >= end) throw new ArrayIndexOutOfBoundsException();
outputBytes[dst++] = (byte)(unicodeScalar & 0xff);
break;
case 2:
if (dst+1 >= end) throw new ArrayIndexOutOfBoundsException();
outputBytes[dst++] = getByte1Of2(unicodeScalar);
outputBytes[dst++] = getByte2Of2(unicodeScalar);
break;
case 3:
if (dst+2 >= end) throw new ArrayIndexOutOfBoundsException();
outputBytes[dst++] = getByte1Of3(unicodeScalar);
outputBytes[dst++] = getByte2Of3(unicodeScalar);
outputBytes[dst++] = getByte3Of3(unicodeScalar);
break;
case 4:
if (dst+3 >= end) throw new ArrayIndexOutOfBoundsException();
outputBytes[dst++] = getByte1Of4(unicodeScalar);
outputBytes[dst++] = getByte2Of4(unicodeScalar);
outputBytes[dst++] = getByte3Of4(unicodeScalar);
outputBytes[dst++] = getByte4Of4(unicodeScalar);
break;
}
return dst - offset;
} | java | public final static int convertToUTF8Bytes(int unicodeScalar, byte[] outputBytes, int offset, int maxLength)
{
int dst = offset;
int end = offset + maxLength;
switch (getUTF8ByteCount(unicodeScalar)) {
case 1:
if (dst >= end) throw new ArrayIndexOutOfBoundsException();
outputBytes[dst++] = (byte)(unicodeScalar & 0xff);
break;
case 2:
if (dst+1 >= end) throw new ArrayIndexOutOfBoundsException();
outputBytes[dst++] = getByte1Of2(unicodeScalar);
outputBytes[dst++] = getByte2Of2(unicodeScalar);
break;
case 3:
if (dst+2 >= end) throw new ArrayIndexOutOfBoundsException();
outputBytes[dst++] = getByte1Of3(unicodeScalar);
outputBytes[dst++] = getByte2Of3(unicodeScalar);
outputBytes[dst++] = getByte3Of3(unicodeScalar);
break;
case 4:
if (dst+3 >= end) throw new ArrayIndexOutOfBoundsException();
outputBytes[dst++] = getByte1Of4(unicodeScalar);
outputBytes[dst++] = getByte2Of4(unicodeScalar);
outputBytes[dst++] = getByte3Of4(unicodeScalar);
outputBytes[dst++] = getByte4Of4(unicodeScalar);
break;
}
return dst - offset;
} | [
"public",
"final",
"static",
"int",
"convertToUTF8Bytes",
"(",
"int",
"unicodeScalar",
",",
"byte",
"[",
"]",
"outputBytes",
",",
"int",
"offset",
",",
"int",
"maxLength",
")",
"{",
"int",
"dst",
"=",
"offset",
";",
"int",
"end",
"=",
"offset",
"+",
"max... | this helper converts the unicodeScalar to a sequence of utf8 bytes
and copies those bytes into the supplied outputBytes array. If there
is insufficient room in the array to hold the generated bytes it will
throw an ArrayIndexOutOfBoundsException. It does not check for the
validity of the passed in unicodeScalar thoroughly, however it will
throw an InvalidUnicodeCodePoint if the value is less than negative
or the UTF8 encoding would exceed 4 bytes.
@param unicodeScalar scalar to convert
@param outputBytes user output array to fill with UTF8 bytes
@param offset first array element to fill
@param maxLength maximum number of array elements to fill
@return number of bytes written to the output array | [
"this",
"helper",
"converts",
"the",
"unicodeScalar",
"to",
"a",
"sequence",
"of",
"utf8",
"bytes",
"and",
"copies",
"those",
"bytes",
"into",
"the",
"supplied",
"outputBytes",
"array",
".",
"If",
"there",
"is",
"insufficient",
"room",
"in",
"the",
"array",
... | train | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/IonUTF8.java#L209-L239 |
alkacon/opencms-core | src-gwt/org/opencms/ade/publish/client/CmsPublishSelectPanel.java | CmsPublishSelectPanel.addGroupPanel | private CmsPublishGroupPanel addGroupPanel(CmsPublishGroup group, int currentIndex) {
String header = group.getName();
CmsPublishGroupPanel groupPanel = new CmsPublishGroupPanel(
group,
header,
currentIndex,
this,
m_model,
m_selectionControllers,
getContextMenuHandler(),
getEditorHandler(),
m_showProblemsOnly);
if (m_model.hasSingleGroup()) {
groupPanel.hideGroupSelectCheckBox();
}
m_groupPanels.add(groupPanel);
m_groupPanelContainer.add(groupPanel);
return groupPanel;
} | java | private CmsPublishGroupPanel addGroupPanel(CmsPublishGroup group, int currentIndex) {
String header = group.getName();
CmsPublishGroupPanel groupPanel = new CmsPublishGroupPanel(
group,
header,
currentIndex,
this,
m_model,
m_selectionControllers,
getContextMenuHandler(),
getEditorHandler(),
m_showProblemsOnly);
if (m_model.hasSingleGroup()) {
groupPanel.hideGroupSelectCheckBox();
}
m_groupPanels.add(groupPanel);
m_groupPanelContainer.add(groupPanel);
return groupPanel;
} | [
"private",
"CmsPublishGroupPanel",
"addGroupPanel",
"(",
"CmsPublishGroup",
"group",
",",
"int",
"currentIndex",
")",
"{",
"String",
"header",
"=",
"group",
".",
"getName",
"(",
")",
";",
"CmsPublishGroupPanel",
"groupPanel",
"=",
"new",
"CmsPublishGroupPanel",
"(",... | Adds a new group panel.<p>
@param group the publish group for which a panel should be added
@param currentIndex the index of the publish group
@return the publish group panel which has been added | [
"Adds",
"a",
"new",
"group",
"panel",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/publish/client/CmsPublishSelectPanel.java#L1058-L1077 |
VoltDB/voltdb | third_party/java/src/org/apache/commons_voltpatches/cli/HelpFormatter.java | HelpFormatter.printHelp | public void printHelp(String cmdLineSyntax, Options options, boolean autoUsage)
{
printHelp(getWidth(), cmdLineSyntax, null, options, null, autoUsage);
} | java | public void printHelp(String cmdLineSyntax, Options options, boolean autoUsage)
{
printHelp(getWidth(), cmdLineSyntax, null, options, null, autoUsage);
} | [
"public",
"void",
"printHelp",
"(",
"String",
"cmdLineSyntax",
",",
"Options",
"options",
",",
"boolean",
"autoUsage",
")",
"{",
"printHelp",
"(",
"getWidth",
"(",
")",
",",
"cmdLineSyntax",
",",
"null",
",",
"options",
",",
"null",
",",
"autoUsage",
")",
... | Print the help for <code>options</code> with the specified
command line syntax. This method prints help information to
System.out.
@param cmdLineSyntax the syntax for this application
@param options the Options instance
@param autoUsage whether to print an automatically generated
usage statement | [
"Print",
"the",
"help",
"for",
"<code",
">",
"options<",
"/",
"code",
">",
"with",
"the",
"specified",
"command",
"line",
"syntax",
".",
"This",
"method",
"prints",
"help",
"information",
"to",
"System",
".",
"out",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/commons_voltpatches/cli/HelpFormatter.java#L421-L424 |
Stratio/stratio-connector-commons | connector-commons/src/main/java/com/stratio/connector/commons/metadata/IndexMetadataBuilder.java | IndexMetadataBuilder.addOption | @TimerJ
public IndexMetadataBuilder addOption(String option, Boolean value) {
if (options == null) {
options = new HashMap<Selector, Selector>();
}
options.put(new StringSelector(option), new BooleanSelector(value));
return this;
} | java | @TimerJ
public IndexMetadataBuilder addOption(String option, Boolean value) {
if (options == null) {
options = new HashMap<Selector, Selector>();
}
options.put(new StringSelector(option), new BooleanSelector(value));
return this;
} | [
"@",
"TimerJ",
"public",
"IndexMetadataBuilder",
"addOption",
"(",
"String",
"option",
",",
"Boolean",
"value",
")",
"{",
"if",
"(",
"options",
"==",
"null",
")",
"{",
"options",
"=",
"new",
"HashMap",
"<",
"Selector",
",",
"Selector",
">",
"(",
")",
";"... | Adds a new boolean option.
@param option the option
@param value the value
@return the index metadata builder | [
"Adds",
"a",
"new",
"boolean",
"option",
"."
] | train | https://github.com/Stratio/stratio-connector-commons/blob/d7cc66cb9591344a13055962e87a91f01c3707d1/connector-commons/src/main/java/com/stratio/connector/commons/metadata/IndexMetadataBuilder.java#L166-L173 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/overlays/AbstractContainerOverlay.java | AbstractContainerOverlay.addPathRecursively | protected void addPathRecursively(
final File sourcePath, final Path targetPath, final ContainerSpecification env) throws IOException {
final java.nio.file.Path sourceRoot = sourcePath.toPath().getParent();
Files.walkFileTree(sourcePath.toPath(), new SimpleFileVisitor<java.nio.file.Path>() {
@Override
public FileVisitResult visitFile(java.nio.file.Path file, BasicFileAttributes attrs) throws IOException {
java.nio.file.Path relativePath = sourceRoot.relativize(file);
ContainerSpecification.Artifact.Builder artifact = ContainerSpecification.Artifact.newBuilder()
.setSource(new Path(file.toUri()))
.setDest(new Path(targetPath, relativePath.toString()))
.setExecutable(Files.isExecutable(file))
.setCachable(true)
.setExtract(false);
env.getArtifacts().add(artifact.build());
return super.visitFile(file, attrs);
}
});
} | java | protected void addPathRecursively(
final File sourcePath, final Path targetPath, final ContainerSpecification env) throws IOException {
final java.nio.file.Path sourceRoot = sourcePath.toPath().getParent();
Files.walkFileTree(sourcePath.toPath(), new SimpleFileVisitor<java.nio.file.Path>() {
@Override
public FileVisitResult visitFile(java.nio.file.Path file, BasicFileAttributes attrs) throws IOException {
java.nio.file.Path relativePath = sourceRoot.relativize(file);
ContainerSpecification.Artifact.Builder artifact = ContainerSpecification.Artifact.newBuilder()
.setSource(new Path(file.toUri()))
.setDest(new Path(targetPath, relativePath.toString()))
.setExecutable(Files.isExecutable(file))
.setCachable(true)
.setExtract(false);
env.getArtifacts().add(artifact.build());
return super.visitFile(file, attrs);
}
});
} | [
"protected",
"void",
"addPathRecursively",
"(",
"final",
"File",
"sourcePath",
",",
"final",
"Path",
"targetPath",
",",
"final",
"ContainerSpecification",
"env",
")",
"throws",
"IOException",
"{",
"final",
"java",
".",
"nio",
".",
"file",
".",
"Path",
"sourceRoo... | Add a path recursively to the container specification.
If the path is a directory, the directory itself (not just its contents) is added to the target path.
The execute bit is preserved; permissions aren't.
@param sourcePath the path to add.
@param targetPath the target path.
@param env the specification to mutate.
@throws IOException | [
"Add",
"a",
"path",
"recursively",
"to",
"the",
"container",
"specification",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/overlays/AbstractContainerOverlay.java#L48-L71 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java | Types.isSameTypes | public boolean isSameTypes(List<Type> ts, List<Type> ss) {
return isSameTypes(ts, ss, false);
} | java | public boolean isSameTypes(List<Type> ts, List<Type> ss) {
return isSameTypes(ts, ss, false);
} | [
"public",
"boolean",
"isSameTypes",
"(",
"List",
"<",
"Type",
">",
"ts",
",",
"List",
"<",
"Type",
">",
"ss",
")",
"{",
"return",
"isSameTypes",
"(",
"ts",
",",
"ss",
",",
"false",
")",
";",
"}"
] | Are corresponding elements of the lists the same type? If
lists are of different length, return false. | [
"Are",
"corresponding",
"elements",
"of",
"the",
"lists",
"the",
"same",
"type?",
"If",
"lists",
"are",
"of",
"different",
"length",
"return",
"false",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L984-L986 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ConnectionMonitorsInner.java | ConnectionMonitorsInner.beginQueryAsync | public Observable<ConnectionMonitorQueryResultInner> beginQueryAsync(String resourceGroupName, String networkWatcherName, String connectionMonitorName) {
return beginQueryWithServiceResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName).map(new Func1<ServiceResponse<ConnectionMonitorQueryResultInner>, ConnectionMonitorQueryResultInner>() {
@Override
public ConnectionMonitorQueryResultInner call(ServiceResponse<ConnectionMonitorQueryResultInner> response) {
return response.body();
}
});
} | java | public Observable<ConnectionMonitorQueryResultInner> beginQueryAsync(String resourceGroupName, String networkWatcherName, String connectionMonitorName) {
return beginQueryWithServiceResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName).map(new Func1<ServiceResponse<ConnectionMonitorQueryResultInner>, ConnectionMonitorQueryResultInner>() {
@Override
public ConnectionMonitorQueryResultInner call(ServiceResponse<ConnectionMonitorQueryResultInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ConnectionMonitorQueryResultInner",
">",
"beginQueryAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkWatcherName",
",",
"String",
"connectionMonitorName",
")",
"{",
"return",
"beginQueryWithServiceResponseAsync",
"(",
"resourceG... | Query a snapshot of the most recent connection states.
@param resourceGroupName The name of the resource group containing Network Watcher.
@param networkWatcherName The name of the Network Watcher resource.
@param connectionMonitorName The name given to the connection monitor.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ConnectionMonitorQueryResultInner object | [
"Query",
"a",
"snapshot",
"of",
"the",
"most",
"recent",
"connection",
"states",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ConnectionMonitorsInner.java#L987-L994 |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/util/XMLUtils.java | XMLUtils.buildNodeName | private static void buildNodeName(Node node, StringBuffer buffer) {
if (node.getParentNode() == null) {
return;
}
buildNodeName(node.getParentNode(), buffer);
if (node.getParentNode() != null
&& node.getParentNode().getParentNode() != null) {
buffer.append(".");
}
buffer.append(node.getLocalName());
} | java | private static void buildNodeName(Node node, StringBuffer buffer) {
if (node.getParentNode() == null) {
return;
}
buildNodeName(node.getParentNode(), buffer);
if (node.getParentNode() != null
&& node.getParentNode().getParentNode() != null) {
buffer.append(".");
}
buffer.append(node.getLocalName());
} | [
"private",
"static",
"void",
"buildNodeName",
"(",
"Node",
"node",
",",
"StringBuffer",
"buffer",
")",
"{",
"if",
"(",
"node",
".",
"getParentNode",
"(",
")",
"==",
"null",
")",
"{",
"return",
";",
"}",
"buildNodeName",
"(",
"node",
".",
"getParentNode",
... | Builds the node path expression for a node in the DOM tree.
@param node in a DOM tree.
@param buffer string buffer. | [
"Builds",
"the",
"node",
"path",
"expression",
"for",
"a",
"node",
"in",
"the",
"DOM",
"tree",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/util/XMLUtils.java#L192-L205 |
google/closure-templates | java/src/com/google/template/soy/jssrc/internal/GenJsCodeVisitorAssistantForMsgs.java | GenJsCodeVisitorAssistantForMsgs.genGoogGetMsgCallHelper | private GoogMsgCodeGenInfo genGoogGetMsgCallHelper(String googMsgVarName, MsgNode msgNode) {
// Build the code for the message content.
// TODO: We could build the msg parts once and save it as a field on the MsgNode or save it some
// other way, but it would increase memory usage a little bit. It's probably not a big deal,
// since it's not per-locale, but I'm not going to do this right now since we're trying to
// decrease memory usage right now. The same memoization possibility also applies to the msg
// parts with embedded ICU syntax (created in helper buildGoogMsgContentStr()).
ImmutableList<SoyMsgPart> msgParts = MsgUtils.buildMsgParts(msgNode);
Expression googMsgContent =
stringLiteral(buildGoogMsgContentStr(msgParts, msgNode.isPlrselMsg()));
// Build the individual code bits for each placeholder (i.e. "<placeholderName>: <exprCode>")
// and each plural/select (i.e. "<varName>: <exprCode>").
GoogMsgPlaceholderCodeGenInfo placeholderInfo =
new GoogMsgPlaceholderCodeGenInfo(msgNode.isPlrselMsg());
genGoogMsgCodeForChildren(msgParts, msgNode, placeholderInfo);
// Generate JS comment (JSDoc) block for the goog.getMsg() call.
JsDoc.Builder jsDocBuilder = JsDoc.builder();
if (msgNode.getMeaning() != null) {
jsDocBuilder.addAnnotation("meaning", msgNode.getMeaning());
}
jsDocBuilder.addAnnotation("desc", msgNode.getDesc());
if (msgNode.isHidden()) {
jsDocBuilder.addAnnotation("hidden");
}
// Generate goog.getMsg() call.
VariableDeclaration.Builder builder =
VariableDeclaration.builder(googMsgVarName).setJsDoc(jsDocBuilder.build());
if (msgNode.isPlrselMsg() || placeholderInfo.placeholders.isEmpty()) {
// For plural/select msgs, we're letting goog.i18n.MessageFormat handle all placeholder
// replacements, even ones that have nothing to do with plural/select. Therefore, this case
// is the same as having no placeholder replacements.
builder.setRhs(GOOG_GET_MSG.call(googMsgContent));
return new GoogMsgCodeGenInfo(
builder.build().ref(),
googMsgVarName,
msgNode.isPlrselMsg()
? placeholderInfo.pluralsAndSelects.putAll(placeholderInfo.placeholders).build()
: null);
} else {
// If there are placeholders, pass them as an arg to goog.getMsg.
builder.setRhs(GOOG_GET_MSG.call(googMsgContent, placeholderInfo.placeholders.build()));
return new GoogMsgCodeGenInfo(builder.build().ref(), googMsgVarName, null);
}
} | java | private GoogMsgCodeGenInfo genGoogGetMsgCallHelper(String googMsgVarName, MsgNode msgNode) {
// Build the code for the message content.
// TODO: We could build the msg parts once and save it as a field on the MsgNode or save it some
// other way, but it would increase memory usage a little bit. It's probably not a big deal,
// since it's not per-locale, but I'm not going to do this right now since we're trying to
// decrease memory usage right now. The same memoization possibility also applies to the msg
// parts with embedded ICU syntax (created in helper buildGoogMsgContentStr()).
ImmutableList<SoyMsgPart> msgParts = MsgUtils.buildMsgParts(msgNode);
Expression googMsgContent =
stringLiteral(buildGoogMsgContentStr(msgParts, msgNode.isPlrselMsg()));
// Build the individual code bits for each placeholder (i.e. "<placeholderName>: <exprCode>")
// and each plural/select (i.e. "<varName>: <exprCode>").
GoogMsgPlaceholderCodeGenInfo placeholderInfo =
new GoogMsgPlaceholderCodeGenInfo(msgNode.isPlrselMsg());
genGoogMsgCodeForChildren(msgParts, msgNode, placeholderInfo);
// Generate JS comment (JSDoc) block for the goog.getMsg() call.
JsDoc.Builder jsDocBuilder = JsDoc.builder();
if (msgNode.getMeaning() != null) {
jsDocBuilder.addAnnotation("meaning", msgNode.getMeaning());
}
jsDocBuilder.addAnnotation("desc", msgNode.getDesc());
if (msgNode.isHidden()) {
jsDocBuilder.addAnnotation("hidden");
}
// Generate goog.getMsg() call.
VariableDeclaration.Builder builder =
VariableDeclaration.builder(googMsgVarName).setJsDoc(jsDocBuilder.build());
if (msgNode.isPlrselMsg() || placeholderInfo.placeholders.isEmpty()) {
// For plural/select msgs, we're letting goog.i18n.MessageFormat handle all placeholder
// replacements, even ones that have nothing to do with plural/select. Therefore, this case
// is the same as having no placeholder replacements.
builder.setRhs(GOOG_GET_MSG.call(googMsgContent));
return new GoogMsgCodeGenInfo(
builder.build().ref(),
googMsgVarName,
msgNode.isPlrselMsg()
? placeholderInfo.pluralsAndSelects.putAll(placeholderInfo.placeholders).build()
: null);
} else {
// If there are placeholders, pass them as an arg to goog.getMsg.
builder.setRhs(GOOG_GET_MSG.call(googMsgContent, placeholderInfo.placeholders.build()));
return new GoogMsgCodeGenInfo(builder.build().ref(), googMsgVarName, null);
}
} | [
"private",
"GoogMsgCodeGenInfo",
"genGoogGetMsgCallHelper",
"(",
"String",
"googMsgVarName",
",",
"MsgNode",
"msgNode",
")",
"{",
"// Build the code for the message content.",
"// TODO: We could build the msg parts once and save it as a field on the MsgNode or save it some",
"// other way,... | Generates the goog.getMsg call for an MsgNode. The goog.getMsg call (including JsDoc) will be
appended to the jsCodeBuilder.
@return The GoogMsgCodeGenInfo object created in the process, which may be needed for
generating postprocessing code (if the message is plural/select). | [
"Generates",
"the",
"goog",
".",
"getMsg",
"call",
"for",
"an",
"MsgNode",
".",
"The",
"goog",
".",
"getMsg",
"call",
"(",
"including",
"JsDoc",
")",
"will",
"be",
"appended",
"to",
"the",
"jsCodeBuilder",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/internal/GenJsCodeVisitorAssistantForMsgs.java#L283-L329 |
apache/groovy | subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java | SwingGroovyMethods.leftShift | public static JMenu leftShift(JMenu self, GString gstr) {
self.add(gstr.toString());
return self;
} | java | public static JMenu leftShift(JMenu self, GString gstr) {
self.add(gstr.toString());
return self;
} | [
"public",
"static",
"JMenu",
"leftShift",
"(",
"JMenu",
"self",
",",
"GString",
"gstr",
")",
"{",
"self",
".",
"add",
"(",
"gstr",
".",
"toString",
"(",
")",
")",
";",
"return",
"self",
";",
"}"
] | Overloads the left shift operator to provide an easy way to add
components to a menu.<p>
@param self a JMenu
@param gstr a GString to be added to the menu.
@return same menu, after the value was added to it.
@since 1.6.4 | [
"Overloads",
"the",
"left",
"shift",
"operator",
"to",
"provide",
"an",
"easy",
"way",
"to",
"add",
"components",
"to",
"a",
"menu",
".",
"<p",
">"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java#L823-L826 |
tvesalainen/util | util/src/main/java/org/vesalainen/bean/BeanHelper.java | BeanHelper.assignList | public static final <T> T assignList(Object bean, String property, String hint, BiFunction<Class<T>,String,T> factory)
{
Class[] pt = getParameterTypes(bean, prefix(property));
Class type = pt != null && pt.length > 0 ? pt[0] : null;
T value = (T) factory.apply(type, hint);
doFor(
bean,
property,
null,
(Object a, int i)->{Array.set(a, i, value);return null;},
(List l, int i)->{l.set(i, value);return null;},
(Object b, Class c, String p)->{throw new UnsupportedOperationException("not supported");},
(Object b, Method m)->{throw new UnsupportedOperationException("not supported");}
);
return value;
} | java | public static final <T> T assignList(Object bean, String property, String hint, BiFunction<Class<T>,String,T> factory)
{
Class[] pt = getParameterTypes(bean, prefix(property));
Class type = pt != null && pt.length > 0 ? pt[0] : null;
T value = (T) factory.apply(type, hint);
doFor(
bean,
property,
null,
(Object a, int i)->{Array.set(a, i, value);return null;},
(List l, int i)->{l.set(i, value);return null;},
(Object b, Class c, String p)->{throw new UnsupportedOperationException("not supported");},
(Object b, Method m)->{throw new UnsupportedOperationException("not supported");}
);
return value;
} | [
"public",
"static",
"final",
"<",
"T",
">",
"T",
"assignList",
"(",
"Object",
"bean",
",",
"String",
"property",
",",
"String",
"hint",
",",
"BiFunction",
"<",
"Class",
"<",
"T",
">",
",",
"String",
",",
"T",
">",
"factory",
")",
"{",
"Class",
"[",
... | Assign pattern item a new value using given factory (and hint)
@param <T>
@param bean
@param property
@param hint
@param factory | [
"Assign",
"pattern",
"item",
"a",
"new",
"value",
"using",
"given",
"factory",
"(",
"and",
"hint",
")"
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/bean/BeanHelper.java#L622-L637 |
mojohaus/jaxb2-maven-plugin | src/main/java/org/codehaus/mojo/jaxb2/schemageneration/XsdGeneratorHelper.java | XsdGeneratorHelper.insertJavaDocAsAnnotations | public static int insertJavaDocAsAnnotations(final Log log,
final String encoding,
final File outputDir,
final SearchableDocumentation docs,
final JavaDocRenderer renderer) {
// Check sanity
Validate.notNull(docs, "docs");
Validate.notNull(log, "log");
Validate.notNull(outputDir, "outputDir");
Validate.isTrue(outputDir.isDirectory(), "'outputDir' must be a Directory.");
Validate.notNull(renderer, "renderer");
int processedXSDs = 0;
final List<File> foundFiles = new ArrayList<File>();
addRecursively(foundFiles, RECURSIVE_XSD_FILTER, outputDir);
if (foundFiles.size() > 0) {
// Create the processors.
final XsdAnnotationProcessor classProcessor = new XsdAnnotationProcessor(docs, renderer);
final XsdEnumerationAnnotationProcessor enumProcessor
= new XsdEnumerationAnnotationProcessor(docs, renderer);
for (File current : foundFiles) {
// Create an XSD document from the current File.
final Document generatedSchemaFileDocument = parseXmlToDocument(current);
// Replace all namespace prefixes within the provided document.
process(generatedSchemaFileDocument.getFirstChild(), true, classProcessor);
processedXSDs++;
// Overwrite the vanilla file.
savePrettyPrintedDocument(generatedSchemaFileDocument, current, encoding);
}
} else {
if (log.isWarnEnabled()) {
log.warn("Found no generated 'vanilla' XSD files to process under ["
+ FileSystemUtilities.getCanonicalPath(outputDir) + "]. Aborting processing.");
}
}
// All done.
return processedXSDs;
} | java | public static int insertJavaDocAsAnnotations(final Log log,
final String encoding,
final File outputDir,
final SearchableDocumentation docs,
final JavaDocRenderer renderer) {
// Check sanity
Validate.notNull(docs, "docs");
Validate.notNull(log, "log");
Validate.notNull(outputDir, "outputDir");
Validate.isTrue(outputDir.isDirectory(), "'outputDir' must be a Directory.");
Validate.notNull(renderer, "renderer");
int processedXSDs = 0;
final List<File> foundFiles = new ArrayList<File>();
addRecursively(foundFiles, RECURSIVE_XSD_FILTER, outputDir);
if (foundFiles.size() > 0) {
// Create the processors.
final XsdAnnotationProcessor classProcessor = new XsdAnnotationProcessor(docs, renderer);
final XsdEnumerationAnnotationProcessor enumProcessor
= new XsdEnumerationAnnotationProcessor(docs, renderer);
for (File current : foundFiles) {
// Create an XSD document from the current File.
final Document generatedSchemaFileDocument = parseXmlToDocument(current);
// Replace all namespace prefixes within the provided document.
process(generatedSchemaFileDocument.getFirstChild(), true, classProcessor);
processedXSDs++;
// Overwrite the vanilla file.
savePrettyPrintedDocument(generatedSchemaFileDocument, current, encoding);
}
} else {
if (log.isWarnEnabled()) {
log.warn("Found no generated 'vanilla' XSD files to process under ["
+ FileSystemUtilities.getCanonicalPath(outputDir) + "]. Aborting processing.");
}
}
// All done.
return processedXSDs;
} | [
"public",
"static",
"int",
"insertJavaDocAsAnnotations",
"(",
"final",
"Log",
"log",
",",
"final",
"String",
"encoding",
",",
"final",
"File",
"outputDir",
",",
"final",
"SearchableDocumentation",
"docs",
",",
"final",
"JavaDocRenderer",
"renderer",
")",
"{",
"// ... | Inserts XML documentation annotations into all generated XSD files found
within the supplied outputDir.
@param log A Maven Log.
@param outputDir The outputDir, where generated XSD files are found.
@param docs The SearchableDocumentation for the source files within the compilation unit.
@param renderer The JavaDocRenderer used to convert JavaDoc annotations into XML documentation annotations.
@return The number of processed XSDs. | [
"Inserts",
"XML",
"documentation",
"annotations",
"into",
"all",
"generated",
"XSD",
"files",
"found",
"within",
"the",
"supplied",
"outputDir",
"."
] | train | https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/schemageneration/XsdGeneratorHelper.java#L206-L252 |
alkacon/opencms-core | src/org/opencms/file/CmsObject.java | CmsObject.getSubFolders | public List<CmsResource> getSubFolders(String resourcename) throws CmsException {
return getSubFolders(resourcename, CmsResourceFilter.DEFAULT);
} | java | public List<CmsResource> getSubFolders(String resourcename) throws CmsException {
return getSubFolders(resourcename, CmsResourceFilter.DEFAULT);
} | [
"public",
"List",
"<",
"CmsResource",
">",
"getSubFolders",
"(",
"String",
"resourcename",
")",
"throws",
"CmsException",
"{",
"return",
"getSubFolders",
"(",
"resourcename",
",",
"CmsResourceFilter",
".",
"DEFAULT",
")",
";",
"}"
] | Returns all folder resources contained in a folder.<p>
The result is filtered according to the rules of
the <code>{@link CmsResourceFilter#DEFAULT}</code> filter.<p>
@param resourcename the full current site relative path of the resource to return the child resources for.
@return a list of all child file as <code>{@link CmsResource}</code> objects
@throws CmsException if something goes wrong
@see #getSubFolders(String, CmsResourceFilter) | [
"Returns",
"all",
"folder",
"resources",
"contained",
"in",
"a",
"folder",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L1834-L1837 |
windup/windup | ui/addon/src/main/java/org/jboss/windup/ui/DistributionUpdater.java | DistributionUpdater.replaceWindupDirectoryWithDistribution | public void replaceWindupDirectoryWithDistribution(Coordinate distCoordinate)
throws WindupException
{
try
{
final CoordinateBuilder coord = CoordinateBuilder.create(distCoordinate);
File tempFolder = OperatingSystemUtils.createTempDir();
this.updater.extractArtifact(coord, tempFolder);
File newDistWindupDir = getWindupDistributionSubdir(tempFolder);
if (null == newDistWindupDir)
throw new WindupException("Distribution update failed: "
+ "The distribution archive did not contain the windup-distribution-* directory: " + coord.toString());
Path addonsDir = PathUtil.getWindupAddonsDir();
Path binDir = PathUtil.getWindupHome().resolve(PathUtil.BINARY_DIRECTORY_NAME);
Path libDir = PathUtil.getWindupHome().resolve(PathUtil.LIBRARY_DIRECTORY_NAME);
FileUtils.deleteDirectory(addonsDir.toFile());
FileUtils.deleteDirectory(libDir.toFile());
FileUtils.deleteDirectory(binDir.toFile());
FileUtils.moveDirectory(new File(newDistWindupDir, PathUtil.ADDONS_DIRECTORY_NAME), addonsDir.toFile());
FileUtils.moveDirectory(new File(newDistWindupDir, PathUtil.BINARY_DIRECTORY_NAME), binDir.toFile());
FileUtils.moveDirectory(new File(newDistWindupDir, PathUtil.LIBRARY_DIRECTORY_NAME), libDir.toFile());
// Rulesets
Path rulesDir = PathUtil.getWindupHome().resolve(PathUtil.RULES_DIRECTORY_NAME); //PathUtil.getWindupRulesDir();
File coreDir = rulesDir.resolve(RulesetsUpdater.RULESET_CORE_DIRECTORY).toFile();
// This is for testing purposes. The releases do not contain migration-core/ .
if (coreDir.exists())
{
// migration-core/ exists -> Only replace that one.
FileUtils.deleteDirectory(coreDir);
final File coreDirNew = newDistWindupDir.toPath().resolve(PathUtil.RULES_DIRECTORY_NAME).resolve(RulesetsUpdater.RULESET_CORE_DIRECTORY).toFile();
FileUtils.moveDirectory(coreDirNew, rulesDir.resolve(RulesetsUpdater.RULESET_CORE_DIRECTORY).toFile());
}
else
{
// Otherwise replace the whole rules directory (backing up the old one).
final String newName = "rules-" + new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss").format(new Date());
FileUtils.moveDirectory(rulesDir.toFile(), rulesDir.getParent().resolve(newName).toFile());
FileUtils.moveDirectory(new File(newDistWindupDir, PathUtil.RULES_DIRECTORY_NAME), rulesDir.toFile());
}
FileUtils.deleteDirectory(tempFolder);
}
catch (IllegalStateException | DependencyException | IOException ex)
{
throw new WindupException("Distribution update failed: " + ex.getMessage(), ex);
}
} | java | public void replaceWindupDirectoryWithDistribution(Coordinate distCoordinate)
throws WindupException
{
try
{
final CoordinateBuilder coord = CoordinateBuilder.create(distCoordinate);
File tempFolder = OperatingSystemUtils.createTempDir();
this.updater.extractArtifact(coord, tempFolder);
File newDistWindupDir = getWindupDistributionSubdir(tempFolder);
if (null == newDistWindupDir)
throw new WindupException("Distribution update failed: "
+ "The distribution archive did not contain the windup-distribution-* directory: " + coord.toString());
Path addonsDir = PathUtil.getWindupAddonsDir();
Path binDir = PathUtil.getWindupHome().resolve(PathUtil.BINARY_DIRECTORY_NAME);
Path libDir = PathUtil.getWindupHome().resolve(PathUtil.LIBRARY_DIRECTORY_NAME);
FileUtils.deleteDirectory(addonsDir.toFile());
FileUtils.deleteDirectory(libDir.toFile());
FileUtils.deleteDirectory(binDir.toFile());
FileUtils.moveDirectory(new File(newDistWindupDir, PathUtil.ADDONS_DIRECTORY_NAME), addonsDir.toFile());
FileUtils.moveDirectory(new File(newDistWindupDir, PathUtil.BINARY_DIRECTORY_NAME), binDir.toFile());
FileUtils.moveDirectory(new File(newDistWindupDir, PathUtil.LIBRARY_DIRECTORY_NAME), libDir.toFile());
// Rulesets
Path rulesDir = PathUtil.getWindupHome().resolve(PathUtil.RULES_DIRECTORY_NAME); //PathUtil.getWindupRulesDir();
File coreDir = rulesDir.resolve(RulesetsUpdater.RULESET_CORE_DIRECTORY).toFile();
// This is for testing purposes. The releases do not contain migration-core/ .
if (coreDir.exists())
{
// migration-core/ exists -> Only replace that one.
FileUtils.deleteDirectory(coreDir);
final File coreDirNew = newDistWindupDir.toPath().resolve(PathUtil.RULES_DIRECTORY_NAME).resolve(RulesetsUpdater.RULESET_CORE_DIRECTORY).toFile();
FileUtils.moveDirectory(coreDirNew, rulesDir.resolve(RulesetsUpdater.RULESET_CORE_DIRECTORY).toFile());
}
else
{
// Otherwise replace the whole rules directory (backing up the old one).
final String newName = "rules-" + new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss").format(new Date());
FileUtils.moveDirectory(rulesDir.toFile(), rulesDir.getParent().resolve(newName).toFile());
FileUtils.moveDirectory(new File(newDistWindupDir, PathUtil.RULES_DIRECTORY_NAME), rulesDir.toFile());
}
FileUtils.deleteDirectory(tempFolder);
}
catch (IllegalStateException | DependencyException | IOException ex)
{
throw new WindupException("Distribution update failed: " + ex.getMessage(), ex);
}
} | [
"public",
"void",
"replaceWindupDirectoryWithDistribution",
"(",
"Coordinate",
"distCoordinate",
")",
"throws",
"WindupException",
"{",
"try",
"{",
"final",
"CoordinateBuilder",
"coord",
"=",
"CoordinateBuilder",
".",
"create",
"(",
"distCoordinate",
")",
";",
"File",
... | Downloads the given artifact, extracts it and replaces current Windup directory (as given by PathUtil)
with the content from the artifact (assuming it really is a Windup distribution zip). | [
"Downloads",
"the",
"given",
"artifact",
"extracts",
"it",
"and",
"replaces",
"current",
"Windup",
"directory",
"(",
"as",
"given",
"by",
"PathUtil",
")",
"with",
"the",
"content",
"from",
"the",
"artifact",
"(",
"assuming",
"it",
"really",
"is",
"a",
"Windu... | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/ui/addon/src/main/java/org/jboss/windup/ui/DistributionUpdater.java#L52-L106 |
phax/ph-commons | ph-cli/src/main/java/com/helger/cli/HelpFormatter.java | HelpFormatter.printHelp | public void printHelp (@Nonnull @Nonempty final String sCmdLineSyntax, @Nonnull final Options aOptions)
{
printHelp (getWidth (), sCmdLineSyntax, null, aOptions, null, false);
} | java | public void printHelp (@Nonnull @Nonempty final String sCmdLineSyntax, @Nonnull final Options aOptions)
{
printHelp (getWidth (), sCmdLineSyntax, null, aOptions, null, false);
} | [
"public",
"void",
"printHelp",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sCmdLineSyntax",
",",
"@",
"Nonnull",
"final",
"Options",
"aOptions",
")",
"{",
"printHelp",
"(",
"getWidth",
"(",
")",
",",
"sCmdLineSyntax",
",",
"null",
",",
"aOption... | Print the help for <code>options</code> with the specified command line
syntax. This method prints help information to System.out.
@param sCmdLineSyntax
the syntax for this application
@param aOptions
the Options instance | [
"Print",
"the",
"help",
"for",
"<code",
">",
"options<",
"/",
"code",
">",
"with",
"the",
"specified",
"command",
"line",
"syntax",
".",
"This",
"method",
"prints",
"help",
"information",
"to",
"System",
".",
"out",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-cli/src/main/java/com/helger/cli/HelpFormatter.java#L397-L400 |
progolden/vraptor-boilerplate | vraptor-boilerplate-usercontrol/src/main/java/br/com/caelum/vraptor/boilerplate/user/UserBS.java | UserBS.resetPassword | public boolean resetPassword(String password, String token) {
UserRecoverRequest req = this.retrieveRecoverRequest(token);
if (req == null)
return false;
User user = req.getUser();
user.setPassword(CryptManager.passwordHash(password));
this.dao.persist(user);
req.setRecover(new Date());
req.setRecoverIp(this.request.getRemoteAddr());
req.setUsed(true);
this.dao.persist(req);
return true;
} | java | public boolean resetPassword(String password, String token) {
UserRecoverRequest req = this.retrieveRecoverRequest(token);
if (req == null)
return false;
User user = req.getUser();
user.setPassword(CryptManager.passwordHash(password));
this.dao.persist(user);
req.setRecover(new Date());
req.setRecoverIp(this.request.getRemoteAddr());
req.setUsed(true);
this.dao.persist(req);
return true;
} | [
"public",
"boolean",
"resetPassword",
"(",
"String",
"password",
",",
"String",
"token",
")",
"{",
"UserRecoverRequest",
"req",
"=",
"this",
".",
"retrieveRecoverRequest",
"(",
"token",
")",
";",
"if",
"(",
"req",
"==",
"null",
")",
"return",
"false",
";",
... | Trocar o password do usuário.
@param password
Novo password
@param token
Token de identificação do usuário.
@return boolean true Troca de password do usuário ocorreu com sucesso. | [
"Trocar",
"o",
"password",
"do",
"usuário",
"."
] | train | https://github.com/progolden/vraptor-boilerplate/blob/3edf45cc0dc5aec61b16ca326b4d72c82d1d3e07/vraptor-boilerplate-usercontrol/src/main/java/br/com/caelum/vraptor/boilerplate/user/UserBS.java#L99-L111 |
Impetus/Kundera | src/kundera-mongo/src/main/java/com/impetus/client/mongodb/utils/MongoDBUtils.java | MongoDBUtils.populateCompoundKey | public static void populateCompoundKey(DBObject dbObj, EntityMetadata m, MetamodelImpl metaModel, Object id)
{
EmbeddableType compoundKey = metaModel.embeddable(m.getIdAttribute().getBindableJavaType());
// Iterator<Attribute> iter = compoundKey.getAttributes().iterator();
BasicDBObject compoundKeyObj = new BasicDBObject();
compoundKeyObj = getCompoundKeyColumns(m, id, compoundKey, metaModel);
dbObj.put("_id", compoundKeyObj);
} | java | public static void populateCompoundKey(DBObject dbObj, EntityMetadata m, MetamodelImpl metaModel, Object id)
{
EmbeddableType compoundKey = metaModel.embeddable(m.getIdAttribute().getBindableJavaType());
// Iterator<Attribute> iter = compoundKey.getAttributes().iterator();
BasicDBObject compoundKeyObj = new BasicDBObject();
compoundKeyObj = getCompoundKeyColumns(m, id, compoundKey, metaModel);
dbObj.put("_id", compoundKeyObj);
} | [
"public",
"static",
"void",
"populateCompoundKey",
"(",
"DBObject",
"dbObj",
",",
"EntityMetadata",
"m",
",",
"MetamodelImpl",
"metaModel",
",",
"Object",
"id",
")",
"{",
"EmbeddableType",
"compoundKey",
"=",
"metaModel",
".",
"embeddable",
"(",
"m",
".",
"getId... | Populate compound key.
@param dbObj
the db obj
@param m
the m
@param metaModel
the meta model
@param id
the id | [
"Populate",
"compound",
"key",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-mongo/src/main/java/com/impetus/client/mongodb/utils/MongoDBUtils.java#L73-L82 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UTF16.java | UTF16.findCodePointOffset | public static int findCodePointOffset(char source[], int start, int limit, int offset16) {
offset16 += start;
if (offset16 > limit) {
throw new StringIndexOutOfBoundsException(offset16);
}
int result = 0;
char ch;
boolean hadLeadSurrogate = false;
for (int i = start; i < offset16; ++i) {
ch = source[i];
if (hadLeadSurrogate && isTrailSurrogate(ch)) {
hadLeadSurrogate = false; // count valid trail as zero
} else {
hadLeadSurrogate = isLeadSurrogate(ch);
++result; // count others as 1
}
}
if (offset16 == limit) {
return result;
}
// end of source being the less significant surrogate character
// shift result back to the start of the supplementary character
if (hadLeadSurrogate && (isTrailSurrogate(source[offset16]))) {
result--;
}
return result;
} | java | public static int findCodePointOffset(char source[], int start, int limit, int offset16) {
offset16 += start;
if (offset16 > limit) {
throw new StringIndexOutOfBoundsException(offset16);
}
int result = 0;
char ch;
boolean hadLeadSurrogate = false;
for (int i = start; i < offset16; ++i) {
ch = source[i];
if (hadLeadSurrogate && isTrailSurrogate(ch)) {
hadLeadSurrogate = false; // count valid trail as zero
} else {
hadLeadSurrogate = isLeadSurrogate(ch);
++result; // count others as 1
}
}
if (offset16 == limit) {
return result;
}
// end of source being the less significant surrogate character
// shift result back to the start of the supplementary character
if (hadLeadSurrogate && (isTrailSurrogate(source[offset16]))) {
result--;
}
return result;
} | [
"public",
"static",
"int",
"findCodePointOffset",
"(",
"char",
"source",
"[",
"]",
",",
"int",
"start",
",",
"int",
"limit",
",",
"int",
"offset16",
")",
"{",
"offset16",
"+=",
"start",
";",
"if",
"(",
"offset16",
">",
"limit",
")",
"{",
"throw",
"new"... | Returns the UTF-32 offset corresponding to the first UTF-32 boundary at the given UTF-16
offset. Used for random access. See the {@link UTF16 class description} for notes on
roundtripping.<br>
<i>Note: If the UTF-16 offset is into the middle of a surrogate pair, then the UTF-32 offset
of the <strong>lead</strong> of the pair is returned. </i>
<p>
To find the UTF-32 length of a substring, use:
<pre>
len32 = countCodePoint(source, start, limit);
</pre>
@param source Text to analyse
@param start Offset of the substring
@param limit Offset of the substring
@param offset16 UTF-16 relative to start
@return UTF-32 offset relative to start
@exception IndexOutOfBoundsException If offset16 is not within the range of start and limit. | [
"Returns",
"the",
"UTF",
"-",
"32",
"offset",
"corresponding",
"to",
"the",
"first",
"UTF",
"-",
"32",
"boundary",
"at",
"the",
"given",
"UTF",
"-",
"16",
"offset",
".",
"Used",
"for",
"random",
"access",
".",
"See",
"the",
"{",
"@link",
"UTF16",
"clas... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UTF16.java#L935-L966 |
google/error-prone | core/src/main/java/com/google/errorprone/bugpatterns/inject/InvalidTargetingOnScopingAnnotation.java | InvalidTargetingOnScopingAnnotation.replaceTargetAnnotation | private static Fix replaceTargetAnnotation(
Target annotation, AnnotationTree targetAnnotationTree) {
Set<ElementType> types = EnumSet.copyOf(REQUIRED_ELEMENT_TYPES);
types.addAll(Arrays.asList(annotation.value()));
return replaceTargetAnnotation(targetAnnotationTree, types);
} | java | private static Fix replaceTargetAnnotation(
Target annotation, AnnotationTree targetAnnotationTree) {
Set<ElementType> types = EnumSet.copyOf(REQUIRED_ELEMENT_TYPES);
types.addAll(Arrays.asList(annotation.value()));
return replaceTargetAnnotation(targetAnnotationTree, types);
} | [
"private",
"static",
"Fix",
"replaceTargetAnnotation",
"(",
"Target",
"annotation",
",",
"AnnotationTree",
"targetAnnotationTree",
")",
"{",
"Set",
"<",
"ElementType",
">",
"types",
"=",
"EnumSet",
".",
"copyOf",
"(",
"REQUIRED_ELEMENT_TYPES",
")",
";",
"types",
"... | Rewrite the annotation with static imports, adding TYPE and METHOD to the @Target annotation
value (and reordering them to their declaration order in ElementType). | [
"Rewrite",
"the",
"annotation",
"with",
"static",
"imports",
"adding",
"TYPE",
"and",
"METHOD",
"to",
"the"
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/inject/InvalidTargetingOnScopingAnnotation.java#L98-L104 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.