repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 218 | func_name stringlengths 4 140 | whole_func_string stringlengths 153 5.32k | language stringclasses 1
value | func_code_string stringlengths 72 4k | func_code_tokens listlengths 20 832 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 102 339 |
|---|---|---|---|---|---|---|---|---|---|---|
graphql-java/graphql-java | src/main/java/graphql/schema/idl/SchemaTypeChecker.java | SchemaTypeChecker.checkNamedUniqueness | static <T, E extends GraphQLError> void checkNamedUniqueness(List<GraphQLError> errors, List<T> listOfNamedThings, Function<T, String> namer, BiFunction<String, T, E> errorFunction) {
"""
A simple function that takes a list of things, asks for their names and checks that the
names are unique within that list. If... | java | static <T, E extends GraphQLError> void checkNamedUniqueness(List<GraphQLError> errors, List<T> listOfNamedThings, Function<T, String> namer, BiFunction<String, T, E> errorFunction) {
Set<String> names = new LinkedHashSet<>();
listOfNamedThings.forEach(thing -> {
String name = namer.apply(th... | [
"static",
"<",
"T",
",",
"E",
"extends",
"GraphQLError",
">",
"void",
"checkNamedUniqueness",
"(",
"List",
"<",
"GraphQLError",
">",
"errors",
",",
"List",
"<",
"T",
">",
"listOfNamedThings",
",",
"Function",
"<",
"T",
",",
"String",
">",
"namer",
",",
"... | A simple function that takes a list of things, asks for their names and checks that the
names are unique within that list. If not it calls the error handler function
@param errors the error list
@param listOfNamedThings the list of named things
@param namer the function naming a thing
@param er... | [
"A",
"simple",
"function",
"that",
"takes",
"a",
"list",
"of",
"things",
"asks",
"for",
"their",
"names",
"and",
"checks",
"that",
"the",
"names",
"are",
"unique",
"within",
"that",
"list",
".",
"If",
"not",
"it",
"calls",
"the",
"error",
"handler",
"fun... | train | https://github.com/graphql-java/graphql-java/blob/9214b6044317849388bd88a14b54fc1c18c9f29f/src/main/java/graphql/schema/idl/SchemaTypeChecker.java#L375-L385 |
MorphiaOrg/morphia | morphia/src/main/java/dev/morphia/mapping/MappedField.java | MappedField.getFirstFieldName | public String getFirstFieldName(final DBObject dbObj) {
"""
Gets the field name to use when converting from a DBObject
@param dbObj the DBObject to scan for alternate names
@return the value of this field mapped from the DBObject
@see AlsoLoad
"""
String fieldName = getNameToStore();
boole... | java | public String getFirstFieldName(final DBObject dbObj) {
String fieldName = getNameToStore();
boolean foundField = false;
for (final String n : getLoadNames()) {
if (dbObj.containsField(n)) {
if (!foundField) {
foundField = true;
... | [
"public",
"String",
"getFirstFieldName",
"(",
"final",
"DBObject",
"dbObj",
")",
"{",
"String",
"fieldName",
"=",
"getNameToStore",
"(",
")",
";",
"boolean",
"foundField",
"=",
"false",
";",
"for",
"(",
"final",
"String",
"n",
":",
"getLoadNames",
"(",
")",
... | Gets the field name to use when converting from a DBObject
@param dbObj the DBObject to scan for alternate names
@return the value of this field mapped from the DBObject
@see AlsoLoad | [
"Gets",
"the",
"field",
"name",
"to",
"use",
"when",
"converting",
"from",
"a",
"DBObject"
] | train | https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/mapping/MappedField.java#L258-L272 |
minio/minio-java | api/src/main/java/io/minio/MinioClient.java | MinioClient.presignedGetObject | public String presignedGetObject(String bucketName, String objectName, Integer expires)
throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException,
InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException,
InternalExcepti... | java | public String presignedGetObject(String bucketName, String objectName, Integer expires)
throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException,
InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException,
InternalExcepti... | [
"public",
"String",
"presignedGetObject",
"(",
"String",
"bucketName",
",",
"String",
"objectName",
",",
"Integer",
"expires",
")",
"throws",
"InvalidBucketNameException",
",",
"NoSuchAlgorithmException",
",",
"InsufficientDataException",
",",
"IOException",
",",
"Invalid... | Returns an presigned URL to download the object in the bucket with given expiry time.
</p><b>Example:</b><br>
<pre>{@code String url = minioClient.presignedGetObject("my-bucketname", "my-objectname", 60 * 60 * 24);
System.out.println(url); }</pre>
@param bucketName Bucket name.
@param objectName Object name in the ... | [
"Returns",
"an",
"presigned",
"URL",
"to",
"download",
"the",
"object",
"in",
"the",
"bucket",
"with",
"given",
"expiry",
"time",
"."
] | train | https://github.com/minio/minio-java/blob/b2028f56403c89ce2d5900ae813bc1314c87bc7f/api/src/main/java/io/minio/MinioClient.java#L2436-L2441 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.withStream | public static <T, U extends InputStream> T withStream(U stream, @ClosureParams(value=FirstParam.class) Closure<T> closure) throws IOException {
"""
Allows this input stream to be used within the closure, ensuring that it
is flushed and closed before this method returns.
@param stream the stream which is used ... | java | public static <T, U extends InputStream> T withStream(U stream, @ClosureParams(value=FirstParam.class) Closure<T> closure) throws IOException {
try {
T result = closure.call(stream);
InputStream temp = stream;
stream = null;
temp.close();
return resu... | [
"public",
"static",
"<",
"T",
",",
"U",
"extends",
"InputStream",
">",
"T",
"withStream",
"(",
"U",
"stream",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"FirstParam",
".",
"class",
")",
"Closure",
"<",
"T",
">",
"closure",
")",
"throws",
"IOException"... | Allows this input stream to be used within the closure, ensuring that it
is flushed and closed before this method returns.
@param stream the stream which is used and then closed
@param closure the closure that the stream is passed into
@return the value returned by the closure
@throws IOException if an IOException oc... | [
"Allows",
"this",
"input",
"stream",
"to",
"be",
"used",
"within",
"the",
"closure",
"ensuring",
"that",
"it",
"is",
"flushed",
"and",
"closed",
"before",
"this",
"method",
"returns",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L1183-L1195 |
jenetics/jpx | jpx/src/main/java/io/jenetics/jpx/IO.java | IO.writeInt | static void writeInt(final int value, final DataOutput out) throws IOException {
"""
Writes an int value to a series of bytes. The values are written using
<a href="http://lucene.apache.org/core/3_5_0/fileformats.html#VInt">variable-length</a>
<a href="https://developers.google.com/protocol-buffers/docs/encoding... | java | static void writeInt(final int value, final DataOutput out) throws IOException {
// Zig-zag encoding.
int n = (value << 1)^(value >> 31);
if ((n & ~0x7F) != 0) {
out.write((byte)((n | 0x80) & 0xFF));
n >>>= 7;
if (n > 0x7F) {
out.write((byte)((n | 0x80) & 0xFF));
n >>>= 7;
if (n > 0x7F) {
... | [
"static",
"void",
"writeInt",
"(",
"final",
"int",
"value",
",",
"final",
"DataOutput",
"out",
")",
"throws",
"IOException",
"{",
"// Zig-zag encoding.",
"int",
"n",
"=",
"(",
"value",
"<<",
"1",
")",
"^",
"(",
"value",
">>",
"31",
")",
";",
"if",
"(",... | Writes an int value to a series of bytes. The values are written using
<a href="http://lucene.apache.org/core/3_5_0/fileformats.html#VInt">variable-length</a>
<a href="https://developers.google.com/protocol-buffers/docs/encoding?csw=1#types">zig-zag</a>
coding. Each {@code int} value is written in 1 to 5 bytes.
@see #... | [
"Writes",
"an",
"int",
"value",
"to",
"a",
"series",
"of",
"bytes",
".",
"The",
"values",
"are",
"written",
"using",
"<a",
"href",
"=",
"http",
":",
"//",
"lucene",
".",
"apache",
".",
"org",
"/",
"core",
"/",
"3_5_0",
"/",
"fileformats",
".",
"html#... | train | https://github.com/jenetics/jpx/blob/58fefc10580602d07f1480d6a5886d13a553ff8f/jpx/src/main/java/io/jenetics/jpx/IO.java#L222-L242 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/util/Utils.java | Utils.isCompatibleSARLLibraryOnClasspath | public static boolean isCompatibleSARLLibraryOnClasspath(TypeReferences typeReferences, Notifier context) {
"""
Check if a compatible SARL library is available on the classpath.
@param typeReferences - the accessor to the types.
@param context - the context that is providing the access to the classpath.
@retu... | java | public static boolean isCompatibleSARLLibraryOnClasspath(TypeReferences typeReferences, Notifier context) {
final OutParameter<String> version = new OutParameter<>();
final SarlLibraryErrorCode code = getSARLLibraryVersionOnClasspath(typeReferences, context, version);
if (code == SarlLibraryErrorCode.SARL_FOUND) ... | [
"public",
"static",
"boolean",
"isCompatibleSARLLibraryOnClasspath",
"(",
"TypeReferences",
"typeReferences",
",",
"Notifier",
"context",
")",
"{",
"final",
"OutParameter",
"<",
"String",
">",
"version",
"=",
"new",
"OutParameter",
"<>",
"(",
")",
";",
"final",
"S... | Check if a compatible SARL library is available on the classpath.
@param typeReferences - the accessor to the types.
@param context - the context that is providing the access to the classpath.
@return <code>true</code> if a compatible SARL library was found.
Otherwise <code>false</code>. | [
"Check",
"if",
"a",
"compatible",
"SARL",
"library",
"is",
"available",
"on",
"the",
"classpath",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/util/Utils.java#L1047-L1054 |
visallo/vertexium | core/src/main/java/org/vertexium/ElementBuilder.java | ElementBuilder.setProperty | public ElementBuilder<T> setProperty(String name, Object value, Metadata metadata, Visibility visibility) {
"""
Sets or updates a property value. The property key will be set to a constant. This is a convenience method
which allows treating the multi-valued nature of properties as only containing a single value. ... | java | public ElementBuilder<T> setProperty(String name, Object value, Metadata metadata, Visibility visibility) {
return addPropertyValue(ElementMutation.DEFAULT_KEY, name, value, metadata, visibility);
} | [
"public",
"ElementBuilder",
"<",
"T",
">",
"setProperty",
"(",
"String",
"name",
",",
"Object",
"value",
",",
"Metadata",
"metadata",
",",
"Visibility",
"visibility",
")",
"{",
"return",
"addPropertyValue",
"(",
"ElementMutation",
".",
"DEFAULT_KEY",
",",
"name"... | Sets or updates a property value. The property key will be set to a constant. This is a convenience method
which allows treating the multi-valued nature of properties as only containing a single value. Care must be
taken when using this method because properties are not only uniquely identified by just key and name but... | [
"Sets",
"or",
"updates",
"a",
"property",
"value",
".",
"The",
"property",
"key",
"will",
"be",
"set",
"to",
"a",
"constant",
".",
"This",
"is",
"a",
"convenience",
"method",
"which",
"allows",
"treating",
"the",
"multi",
"-",
"valued",
"nature",
"of",
"... | train | https://github.com/visallo/vertexium/blob/bb132b5425ac168957667164e1409b78adbea769/core/src/main/java/org/vertexium/ElementBuilder.java#L61-L63 |
igniterealtime/REST-API-Client | src/main/java/org/igniterealtime/restclient/RestApiClient.java | RestApiClient.updateRosterEntry | public Response updateRosterEntry(String username, RosterItemEntity rosterItemEntity) {
"""
Update roster entry.
@param username
the username
@param rosterItemEntity
the roster item entity
@return the response
"""
return restClient.put("users/" + username + "/roster/" + rosterItemEntity.getJid(), rost... | java | public Response updateRosterEntry(String username, RosterItemEntity rosterItemEntity) {
return restClient.put("users/" + username + "/roster/" + rosterItemEntity.getJid(), rosterItemEntity,
new HashMap<String, String>());
} | [
"public",
"Response",
"updateRosterEntry",
"(",
"String",
"username",
",",
"RosterItemEntity",
"rosterItemEntity",
")",
"{",
"return",
"restClient",
".",
"put",
"(",
"\"users/\"",
"+",
"username",
"+",
"\"/roster/\"",
"+",
"rosterItemEntity",
".",
"getJid",
"(",
"... | Update roster entry.
@param username
the username
@param rosterItemEntity
the roster item entity
@return the response | [
"Update",
"roster",
"entry",
"."
] | train | https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L704-L707 |
metamx/emitter | src/main/java/com/metamx/emitter/core/HttpPostEmitter.java | HttpPostEmitter.onSealExclusive | void onSealExclusive(Batch batch) {
"""
Called from {@link Batch} only once for each Batch in existence.
"""
buffersToEmit.add(batch);
wakeUpEmittingThread();
if (!isTerminated()) {
int nextBatchNumber = EmittedBatchCounter.nextBatchNumber(batch.batchNumber);
if (!concurrentBatch.compar... | java | void onSealExclusive(Batch batch)
{
buffersToEmit.add(batch);
wakeUpEmittingThread();
if (!isTerminated()) {
int nextBatchNumber = EmittedBatchCounter.nextBatchNumber(batch.batchNumber);
if (!concurrentBatch.compareAndSet(batch, new Batch(this, acquireBuffer(), nextBatchNumber))) {
// ... | [
"void",
"onSealExclusive",
"(",
"Batch",
"batch",
")",
"{",
"buffersToEmit",
".",
"add",
"(",
"batch",
")",
";",
"wakeUpEmittingThread",
"(",
")",
";",
"if",
"(",
"!",
"isTerminated",
"(",
")",
")",
"{",
"int",
"nextBatchNumber",
"=",
"EmittedBatchCounter",
... | Called from {@link Batch} only once for each Batch in existence. | [
"Called",
"from",
"{"
] | train | https://github.com/metamx/emitter/blob/2a5f78a75c84ab7f55b8f95e832863a6dac9139b/src/main/java/com/metamx/emitter/core/HttpPostEmitter.java#L235-L246 |
azkaban/azkaban | az-core/src/main/java/azkaban/utils/PropsUtils.java | PropsUtils.loadPropsBySuffix | public static void loadPropsBySuffix(final File jobPath, final Props props,
final String... suffixes) {
"""
Load properties from the given path
@param jobPath The path to load from
@param props The parent properties for loaded properties
@param suffixes The suffixes of files to load
"""
try {
... | java | public static void loadPropsBySuffix(final File jobPath, final Props props,
final String... suffixes) {
try {
if (jobPath.isDirectory()) {
final File[] files = jobPath.listFiles();
if (files != null) {
for (final File file : files) {
loadPropsBySuffix(file, props, s... | [
"public",
"static",
"void",
"loadPropsBySuffix",
"(",
"final",
"File",
"jobPath",
",",
"final",
"Props",
"props",
",",
"final",
"String",
"...",
"suffixes",
")",
"{",
"try",
"{",
"if",
"(",
"jobPath",
".",
"isDirectory",
"(",
")",
")",
"{",
"final",
"Fil... | Load properties from the given path
@param jobPath The path to load from
@param props The parent properties for loaded properties
@param suffixes The suffixes of files to load | [
"Load",
"properties",
"from",
"the",
"given",
"path"
] | train | https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/az-core/src/main/java/azkaban/utils/PropsUtils.java#L175-L191 |
ironjacamar/ironjacamar | core/src/main/java/org/ironjacamar/core/tracer/Tracer.java | Tracer.getConnectionListener | public static synchronized void getConnectionListener(String poolName, Object mcp, Object cl,
boolean pooled, boolean interleaving,
Throwable callstack) {
"""
Get connection listener
@param poolName T... | java | public static synchronized void getConnectionListener(String poolName, Object mcp, Object cl,
boolean pooled, boolean interleaving,
Throwable callstack)
{
if (!interleaving)
{
if (po... | [
"public",
"static",
"synchronized",
"void",
"getConnectionListener",
"(",
"String",
"poolName",
",",
"Object",
"mcp",
",",
"Object",
"cl",
",",
"boolean",
"pooled",
",",
"boolean",
"interleaving",
",",
"Throwable",
"callstack",
")",
"{",
"if",
"(",
"!",
"inter... | Get connection listener
@param poolName The name of the pool
@param mcp The managed connection pool
@param cl The connection listener
@param pooled Is the connection pooled
@param interleaving Interleaving flag
@param callstack The call stack | [
"Get",
"connection",
"listener"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/tracer/Tracer.java#L128-L169 |
b3dgs/lionengine | lionengine-core/src/main/java/com/b3dgs/lionengine/UtilReflection.java | UtilReflection.getField | public static <T> T getField(Object object, String name) {
"""
Get the field by reflection.
@param <T> The field type.
@param object The object to use (must not be <code>null</code>).
@param name The field name (must not be <code>null</code>).
@return The field found.
@throws LionEngineException If invalid ... | java | public static <T> T getField(Object object, String name)
{
Check.notNull(object);
Check.notNull(name);
try
{
final Class<?> clazz = getClass(object);
final Field field = getDeclaredFieldSuper(clazz, name);
setAccessible(field, true);
... | [
"public",
"static",
"<",
"T",
">",
"T",
"getField",
"(",
"Object",
"object",
",",
"String",
"name",
")",
"{",
"Check",
".",
"notNull",
"(",
"object",
")",
";",
"Check",
".",
"notNull",
"(",
"name",
")",
";",
"try",
"{",
"final",
"Class",
"<",
"?",
... | Get the field by reflection.
@param <T> The field type.
@param object The object to use (must not be <code>null</code>).
@param name The field name (must not be <code>null</code>).
@return The field found.
@throws LionEngineException If invalid parameters or field not found. | [
"Get",
"the",
"field",
"by",
"reflection",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/UtilReflection.java#L254-L272 |
chen0040/java-genetic-programming | src/main/java/com/github/chen0040/gp/lgp/gp/PopulationInitialization.java | PopulationInitialization.initializeWithVariableLength | private static void initializeWithVariableLength(List<Program> programs, LGP manager, RandEngine randEngine) {
"""
the program length is distributed uniformly between iMinProgLength and iMaxProgLength
"""
int popSize = manager.getPopulationSize();
for(int i=0; i < popSize; ++i) {
Program ... | java | private static void initializeWithVariableLength(List<Program> programs, LGP manager, RandEngine randEngine) {
int popSize = manager.getPopulationSize();
for(int i=0; i < popSize; ++i) {
Program lgp= new Program();
initialize(lgp, manager, randEngine, randEngine.nextInt(manager.getPopInit... | [
"private",
"static",
"void",
"initializeWithVariableLength",
"(",
"List",
"<",
"Program",
">",
"programs",
",",
"LGP",
"manager",
",",
"RandEngine",
"randEngine",
")",
"{",
"int",
"popSize",
"=",
"manager",
".",
"getPopulationSize",
"(",
")",
";",
"for",
"(",
... | the program length is distributed uniformly between iMinProgLength and iMaxProgLength | [
"the",
"program",
"length",
"is",
"distributed",
"uniformly",
"between",
"iMinProgLength",
"and",
"iMaxProgLength"
] | train | https://github.com/chen0040/java-genetic-programming/blob/498fc8f4407ea9d45f2e0ac797a8948da337c74f/src/main/java/com/github/chen0040/gp/lgp/gp/PopulationInitialization.java#L37-L45 |
JOML-CI/JOML | src/org/joml/Intersectionf.java | Intersectionf.findClosestPointOnLineSegment | public static Vector3f findClosestPointOnLineSegment(float aX, float aY, float aZ, float bX, float bY, float bZ, float pX, float pY, float pZ, Vector3f result) {
"""
Find the point on the given line segment which is closest to the specified point <code>(pX, pY, pZ)</code>, and store the result in <code>result</cod... | java | public static Vector3f findClosestPointOnLineSegment(float aX, float aY, float aZ, float bX, float bY, float bZ, float pX, float pY, float pZ, Vector3f result) {
float abX = bX - aX, abY = bY - aY, abZ = bZ - aZ;
float t = ((pX - aX) * abX + (pY - aY) * abY + (pZ - aZ) * abZ) / (abX * abX + abY * abY + ... | [
"public",
"static",
"Vector3f",
"findClosestPointOnLineSegment",
"(",
"float",
"aX",
",",
"float",
"aY",
",",
"float",
"aZ",
",",
"float",
"bX",
",",
"float",
"bY",
",",
"float",
"bZ",
",",
"float",
"pX",
",",
"float",
"pY",
",",
"float",
"pZ",
",",
"V... | Find the point on the given line segment which is closest to the specified point <code>(pX, pY, pZ)</code>, and store the result in <code>result</code>.
@param aX
the x coordinate of the first end point of the line segment
@param aY
the y coordinate of the first end point of the line segment
@param aZ
the z coordinate... | [
"Find",
"the",
"point",
"on",
"the",
"given",
"line",
"segment",
"which",
"is",
"closest",
"to",
"the",
"specified",
"point",
"<code",
">",
"(",
"pX",
"pY",
"pZ",
")",
"<",
"/",
"code",
">",
"and",
"store",
"the",
"result",
"in",
"<code",
">",
"resul... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Intersectionf.java#L1307-L1316 |
facebook/fresco | samples/scrollperf/src/main/java/com/facebook/samples/scrollperf/util/DraweeUtil.java | DraweeUtil.setBgColor | public static void setBgColor(View view, final Config config) {
"""
Utility method which set the bgColor based on configuration values
@param view The View to change the bgColor to
@param config The Config object
"""
int[] colors = view.getContext().getResources().getIntArray(R.array.bg_colors);
fina... | java | public static void setBgColor(View view, final Config config) {
int[] colors = view.getContext().getResources().getIntArray(R.array.bg_colors);
final int bgColor = colors[config.bgColor];
view.setBackgroundColor(bgColor);
} | [
"public",
"static",
"void",
"setBgColor",
"(",
"View",
"view",
",",
"final",
"Config",
"config",
")",
"{",
"int",
"[",
"]",
"colors",
"=",
"view",
".",
"getContext",
"(",
")",
".",
"getResources",
"(",
")",
".",
"getIntArray",
"(",
"R",
".",
"array",
... | Utility method which set the bgColor based on configuration values
@param view The View to change the bgColor to
@param config The Config object | [
"Utility",
"method",
"which",
"set",
"the",
"bgColor",
"based",
"on",
"configuration",
"values"
] | train | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/samples/scrollperf/src/main/java/com/facebook/samples/scrollperf/util/DraweeUtil.java#L107-L111 |
wisdom-framework/wisdom-jdbc | wisdom-openjpa-enhancer-plugin/src/main/java/org/wisdom/openjpa/enhancer/OpenJPAEnhancerMojo.java | OpenJPAEnhancerMojo.extendRealmClasspath | protected void extendRealmClasspath()
throws MojoExecutionException {
"""
This will prepare the current ClassLoader and add all jars and local
classpaths (e.g. target/classes) needed by the OpenJPA task.
@throws MojoExecutionException on any error inside the mojo
"""
List<URL> urls = ne... | java | protected void extendRealmClasspath()
throws MojoExecutionException {
List<URL> urls = new ArrayList<>();
for (String fileName : compileClasspathElements) {
File pathElem = new File(fileName);
try {
URL url = pathElem.toURI().toURL();
... | [
"protected",
"void",
"extendRealmClasspath",
"(",
")",
"throws",
"MojoExecutionException",
"{",
"List",
"<",
"URL",
">",
"urls",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"String",
"fileName",
":",
"compileClasspathElements",
")",
"{",
"File",
... | This will prepare the current ClassLoader and add all jars and local
classpaths (e.g. target/classes) needed by the OpenJPA task.
@throws MojoExecutionException on any error inside the mojo | [
"This",
"will",
"prepare",
"the",
"current",
"ClassLoader",
"and",
"add",
"all",
"jars",
"and",
"local",
"classpaths",
"(",
"e",
".",
"g",
".",
"target",
"/",
"classes",
")",
"needed",
"by",
"the",
"OpenJPA",
"task",
"."
] | train | https://github.com/wisdom-framework/wisdom-jdbc/blob/931f5acf0b2bcb0a8f3b683d60d326caafd09a72/wisdom-openjpa-enhancer-plugin/src/main/java/org/wisdom/openjpa/enhancer/OpenJPAEnhancerMojo.java#L320-L341 |
cdk/cdk | display/renderextra/src/main/java/org/openscience/cdk/renderer/generators/HighlightGenerator.java | HighlightGenerator.createPalette | public static Palette createPalette(final Color color, final Color... colors) {
"""
Create a palette which uses the provided colors.
@param colors colors to use in the palette
@return a palette to use in highlighting
"""
Color[] cs = new Color[colors.length + 1];
cs[0] = color;
Syst... | java | public static Palette createPalette(final Color color, final Color... colors) {
Color[] cs = new Color[colors.length + 1];
cs[0] = color;
System.arraycopy(colors, 0, cs, 1, colors.length);
return new FixedPalette(cs);
} | [
"public",
"static",
"Palette",
"createPalette",
"(",
"final",
"Color",
"color",
",",
"final",
"Color",
"...",
"colors",
")",
"{",
"Color",
"[",
"]",
"cs",
"=",
"new",
"Color",
"[",
"colors",
".",
"length",
"+",
"1",
"]",
";",
"cs",
"[",
"0",
"]",
"... | Create a palette which uses the provided colors.
@param colors colors to use in the palette
@return a palette to use in highlighting | [
"Create",
"a",
"palette",
"which",
"uses",
"the",
"provided",
"colors",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderextra/src/main/java/org/openscience/cdk/renderer/generators/HighlightGenerator.java#L250-L255 |
TheHortonMachine/hortonmachine | gears/src/main/java/oms3/compiler/MemoryOutputJavaFileManager.java | MemoryOutputJavaFileManager.baseUrlOfClass | public static URL baseUrlOfClass(Class<?> clazz) {
"""
Returns the base URL of the specified class.
<p>
For example, if <code>java.lang.String</code> exists at
http://base.net/parent/java/lang/String.class, the base URL
is http://base.net/parent/.
@param clazz the class.
@return a base URL where the cl... | java | public static URL baseUrlOfClass(Class<?> clazz) {
try {
String name = clazz.getName();
URL url = clazz.getResource("/" + name.replace('.', '/') + ".class");
int curPos = 0;
do {
curPos = name.indexOf('.', curPos + 1);
if (curPos >=... | [
"public",
"static",
"URL",
"baseUrlOfClass",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"try",
"{",
"String",
"name",
"=",
"clazz",
".",
"getName",
"(",
")",
";",
"URL",
"url",
"=",
"clazz",
".",
"getResource",
"(",
"\"/\"",
"+",
"name",
".",
... | Returns the base URL of the specified class.
<p>
For example, if <code>java.lang.String</code> exists at
http://base.net/parent/java/lang/String.class, the base URL
is http://base.net/parent/.
@param clazz the class.
@return a base URL where the class is located.
@throws IllegalArgumentException if a URL cannot be ... | [
"Returns",
"the",
"base",
"URL",
"of",
"the",
"specified",
"class",
".",
"<p",
">"
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/compiler/MemoryOutputJavaFileManager.java#L75-L90 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/base/Json.java | Json.string_to_resource | public Object string_to_resource(Class<?> responseClass, String response) {
"""
Converts Json string to netscaler resource.
@param responseClass Type of the class to which the string has to be converted to.
@param response input string.
@return returns nitro resource object.
"""
Gson gson = new Gson();
... | java | public Object string_to_resource(Class<?> responseClass, String response)
{
Gson gson = new Gson();
return gson.fromJson(response, responseClass);
} | [
"public",
"Object",
"string_to_resource",
"(",
"Class",
"<",
"?",
">",
"responseClass",
",",
"String",
"response",
")",
"{",
"Gson",
"gson",
"=",
"new",
"Gson",
"(",
")",
";",
"return",
"gson",
".",
"fromJson",
"(",
"response",
",",
"responseClass",
")",
... | Converts Json string to netscaler resource.
@param responseClass Type of the class to which the string has to be converted to.
@param response input string.
@return returns nitro resource object. | [
"Converts",
"Json",
"string",
"to",
"netscaler",
"resource",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/base/Json.java#L47-L51 |
tvbarthel/Cheerleader | library/src/main/java/fr/tvbarthel/cheerleader/library/player/PlaybackService.java | PlaybackService.startTimer | private void startTimer(long duration) {
"""
Start internal timer used to propagate the playback position.
@param duration duration for which the timer should be started.
"""
if (mCountDown != null) {
mCountDown.cancel();
mCountDown = null;
}
// refresh progr... | java | private void startTimer(long duration) {
if (mCountDown != null) {
mCountDown.cancel();
mCountDown = null;
}
// refresh progress every seconds.
mCountDown = new CountDownTimer(duration, 1000) {
@Override
public void onTick(long millisUntil... | [
"private",
"void",
"startTimer",
"(",
"long",
"duration",
")",
"{",
"if",
"(",
"mCountDown",
"!=",
"null",
")",
"{",
"mCountDown",
".",
"cancel",
"(",
")",
";",
"mCountDown",
"=",
"null",
";",
"}",
"// refresh progress every seconds.",
"mCountDown",
"=",
"ne... | Start internal timer used to propagate the playback position.
@param duration duration for which the timer should be started. | [
"Start",
"internal",
"timer",
"used",
"to",
"propagate",
"the",
"playback",
"position",
"."
] | train | https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/player/PlaybackService.java#L797-L821 |
jenkinsci/jenkins | core/src/main/java/hudson/model/Descriptor.java | Descriptor.addHelpFileRedirect | protected void addHelpFileRedirect(String fieldName, Class<? extends Describable> owner, String fieldNameToRedirectTo) {
"""
Tells Jenkins that the help file for the field 'fieldName' is defined in the help file for
the 'fieldNameToRedirectTo' in the 'owner' class.
@since 1.425
"""
helpRedirect.put(f... | java | protected void addHelpFileRedirect(String fieldName, Class<? extends Describable> owner, String fieldNameToRedirectTo) {
helpRedirect.put(fieldName, new HelpRedirect(owner,fieldNameToRedirectTo));
} | [
"protected",
"void",
"addHelpFileRedirect",
"(",
"String",
"fieldName",
",",
"Class",
"<",
"?",
"extends",
"Describable",
">",
"owner",
",",
"String",
"fieldNameToRedirectTo",
")",
"{",
"helpRedirect",
".",
"put",
"(",
"fieldName",
",",
"new",
"HelpRedirect",
"(... | Tells Jenkins that the help file for the field 'fieldName' is defined in the help file for
the 'fieldNameToRedirectTo' in the 'owner' class.
@since 1.425 | [
"Tells",
"Jenkins",
"that",
"the",
"help",
"file",
"for",
"the",
"field",
"fieldName",
"is",
"defined",
"in",
"the",
"help",
"file",
"for",
"the",
"fieldNameToRedirectTo",
"in",
"the",
"owner",
"class",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/Descriptor.java#L770-L772 |
jaxio/celerio | celerio-engine/src/main/java/com/jaxio/celerio/util/MiscUtil.java | MiscUtil.startsWithIgnoreCase | public static boolean startsWithIgnoreCase(String name, Iterable<String> patterns) {
"""
Does the given column name starts with one of pattern given in parameter Not case sensitive
"""
String nameUpper = name.toUpperCase();
for (String pattern : patterns) {
String patternUpper = pat... | java | public static boolean startsWithIgnoreCase(String name, Iterable<String> patterns) {
String nameUpper = name.toUpperCase();
for (String pattern : patterns) {
String patternUpper = pattern.toUpperCase();
if (nameUpper.equals(patternUpper) || nameUpper.startsWith(patternUpper)) {
... | [
"public",
"static",
"boolean",
"startsWithIgnoreCase",
"(",
"String",
"name",
",",
"Iterable",
"<",
"String",
">",
"patterns",
")",
"{",
"String",
"nameUpper",
"=",
"name",
".",
"toUpperCase",
"(",
")",
";",
"for",
"(",
"String",
"pattern",
":",
"patterns",
... | Does the given column name starts with one of pattern given in parameter Not case sensitive | [
"Does",
"the",
"given",
"column",
"name",
"starts",
"with",
"one",
"of",
"pattern",
"given",
"in",
"parameter",
"Not",
"case",
"sensitive"
] | train | https://github.com/jaxio/celerio/blob/fbfacb639e286f9f3f3a18986f74ea275bebd887/celerio-engine/src/main/java/com/jaxio/celerio/util/MiscUtil.java#L177-L187 |
UrielCh/ovh-java-sdk | ovh-java-sdk-core/src/main/java/net/minidev/ovh/api/ApiOvhAuth.java | ApiOvhAuth.currentCredential_GET | public OvhCredential currentCredential_GET() throws IOException {
"""
Get the current credential details
REST: GET /auth/currentCredential
"""
String qPath = "/auth/currentCredential";
StringBuilder sb = path(qPath);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhCr... | java | public OvhCredential currentCredential_GET() throws IOException {
String qPath = "/auth/currentCredential";
StringBuilder sb = path(qPath);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhCredential.class);
} | [
"public",
"OvhCredential",
"currentCredential_GET",
"(",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/auth/currentCredential\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
... | Get the current credential details
REST: GET /auth/currentCredential | [
"Get",
"the",
"current",
"credential",
"details"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-core/src/main/java/net/minidev/ovh/api/ApiOvhAuth.java#L25-L30 |
alkacon/opencms-core | src/org/opencms/flex/CmsFlexResponse.java | CmsFlexResponse.addIntHeader | @Override
public void addIntHeader(String name, int value) {
"""
Method overload from the standard HttpServletRequest API.<p>
@see javax.servlet.http.HttpServletResponse#addIntHeader(java.lang.String, int)
"""
addHeader(name, String.valueOf(value));
} | java | @Override
public void addIntHeader(String name, int value) {
addHeader(name, String.valueOf(value));
} | [
"@",
"Override",
"public",
"void",
"addIntHeader",
"(",
"String",
"name",
",",
"int",
"value",
")",
"{",
"addHeader",
"(",
"name",
",",
"String",
".",
"valueOf",
"(",
"value",
")",
")",
";",
"}"
] | Method overload from the standard HttpServletRequest API.<p>
@see javax.servlet.http.HttpServletResponse#addIntHeader(java.lang.String, int) | [
"Method",
"overload",
"from",
"the",
"standard",
"HttpServletRequest",
"API",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/flex/CmsFlexResponse.java#L482-L486 |
xebia-france/xebia-servlet-extras | src/main/java/fr/xebia/servlet/filter/SecuredRemoteAddressFilter.java | SecuredRemoteAddressFilter.doFilter | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
"""
If incoming remote address matches one of the declared IP pattern, wraps
the incoming {@link HttpServletRequest} to override
{@link HttpServletRequest#isSecure()} to set it to <cod... | java | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
ServletRequest xRequest;
if (request instanceof HttpServletRequest && response instanceof HttpServletResponse) {
if (!request.isSecure() && matchesOne(request.g... | [
"public",
"void",
"doFilter",
"(",
"ServletRequest",
"request",
",",
"ServletResponse",
"response",
",",
"FilterChain",
"chain",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"ServletRequest",
"xRequest",
";",
"if",
"(",
"request",
"instanceof",
"HttpS... | If incoming remote address matches one of the declared IP pattern, wraps
the incoming {@link HttpServletRequest} to override
{@link HttpServletRequest#isSecure()} to set it to <code>true</code>. | [
"If",
"incoming",
"remote",
"address",
"matches",
"one",
"of",
"the",
"declared",
"IP",
"pattern",
"wraps",
"the",
"incoming",
"{"
] | train | https://github.com/xebia-france/xebia-servlet-extras/blob/b263636fc78f8794dde57d92b835edb5e95ce379/src/main/java/fr/xebia/servlet/filter/SecuredRemoteAddressFilter.java#L177-L200 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java | HtmlDocletWriter.addAnnotationInfo | public void addAnnotationInfo(ProgramElementDoc doc, Content htmltree) {
"""
Adds the annotatation types for the given doc.
@param doc the package to write annotations for
@param htmltree the content tree to which the annotation types will be added
"""
addAnnotationInfo(doc, doc.annotations(), html... | java | public void addAnnotationInfo(ProgramElementDoc doc, Content htmltree) {
addAnnotationInfo(doc, doc.annotations(), htmltree);
} | [
"public",
"void",
"addAnnotationInfo",
"(",
"ProgramElementDoc",
"doc",
",",
"Content",
"htmltree",
")",
"{",
"addAnnotationInfo",
"(",
"doc",
",",
"doc",
".",
"annotations",
"(",
")",
",",
"htmltree",
")",
";",
"}"
] | Adds the annotatation types for the given doc.
@param doc the package to write annotations for
@param htmltree the content tree to which the annotation types will be added | [
"Adds",
"the",
"annotatation",
"types",
"for",
"the",
"given",
"doc",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java#L1861-L1863 |
alkacon/opencms-core | src/org/opencms/jsp/CmsJspActionElement.java | CmsJspActionElement.getMessages | public CmsMessages getMessages(String bundleName, String language) {
"""
Generates an initialized instance of {@link CmsMessages} for
convenient access to localized resource bundles.<p>
@param bundleName the name of the ResourceBundle to use
@param language language identifier for the locale of the bundle
@r... | java | public CmsMessages getMessages(String bundleName, String language) {
return getMessages(bundleName, language, "", "", null);
} | [
"public",
"CmsMessages",
"getMessages",
"(",
"String",
"bundleName",
",",
"String",
"language",
")",
"{",
"return",
"getMessages",
"(",
"bundleName",
",",
"language",
",",
"\"\"",
",",
"\"\"",
",",
"null",
")",
";",
"}"
] | Generates an initialized instance of {@link CmsMessages} for
convenient access to localized resource bundles.<p>
@param bundleName the name of the ResourceBundle to use
@param language language identifier for the locale of the bundle
@return CmsMessages a message bundle initialized with the provided values | [
"Generates",
"an",
"initialized",
"instance",
"of",
"{",
"@link",
"CmsMessages",
"}",
"for",
"convenient",
"access",
"to",
"localized",
"resource",
"bundles",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspActionElement.java#L286-L289 |
jcuda/jcusparse | JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java | JCusparse.cusparseScsr2hyb | public static int cusparseScsr2hyb(
cusparseHandle handle,
int m,
int n,
cusparseMatDescr descrA,
Pointer csrSortedValA,
Pointer csrSortedRowPtrA,
Pointer csrSortedColIndA,
cusparseHybMat hybA,
int userEllWidth,
int parti... | java | public static int cusparseScsr2hyb(
cusparseHandle handle,
int m,
int n,
cusparseMatDescr descrA,
Pointer csrSortedValA,
Pointer csrSortedRowPtrA,
Pointer csrSortedColIndA,
cusparseHybMat hybA,
int userEllWidth,
int parti... | [
"public",
"static",
"int",
"cusparseScsr2hyb",
"(",
"cusparseHandle",
"handle",
",",
"int",
"m",
",",
"int",
"n",
",",
"cusparseMatDescr",
"descrA",
",",
"Pointer",
"csrSortedValA",
",",
"Pointer",
"csrSortedRowPtrA",
",",
"Pointer",
"csrSortedColIndA",
",",
"cusp... | Description: This routine converts a sparse matrix in CSR storage format
to a sparse matrix in HYB storage format. | [
"Description",
":",
"This",
"routine",
"converts",
"a",
"sparse",
"matrix",
"in",
"CSR",
"storage",
"format",
"to",
"a",
"sparse",
"matrix",
"in",
"HYB",
"storage",
"format",
"."
] | train | https://github.com/jcuda/jcusparse/blob/7687a62a4ef6b76cb91cf7da93d4cf5ade96a791/JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java#L11987-L12000 |
jglobus/JGlobus | ssl-proxies/src/main/java/org/globus/gsi/bc/BouncyCastleUtil.java | BouncyCastleUtil.getCertificateType | public static GSIConstants.CertificateType getCertificateType(X509Certificate cert)
throws CertificateException {
"""
Returns certificate type of the given certificate.
Please see {@link #getCertificateType(TBSCertificateStructure)
getCertificateType} for details for determining the certificate type.
@par... | java | public static GSIConstants.CertificateType getCertificateType(X509Certificate cert)
throws CertificateException {
try {
TBSCertificateStructure crt = getTBSCertificateStructure(cert);
return getCertificateType(crt);
} catch (IOException e) {
// but this should not happen
thro... | [
"public",
"static",
"GSIConstants",
".",
"CertificateType",
"getCertificateType",
"(",
"X509Certificate",
"cert",
")",
"throws",
"CertificateException",
"{",
"try",
"{",
"TBSCertificateStructure",
"crt",
"=",
"getTBSCertificateStructure",
"(",
"cert",
")",
";",
"return"... | Returns certificate type of the given certificate.
Please see {@link #getCertificateType(TBSCertificateStructure)
getCertificateType} for details for determining the certificate type.
@param cert the certificate to get the type of.
@return the certificate type as determined by
{@link #getCertificateType(TBSCertificate... | [
"Returns",
"certificate",
"type",
"of",
"the",
"given",
"certificate",
".",
"Please",
"see",
"{",
"@link",
"#getCertificateType",
"(",
"TBSCertificateStructure",
")",
"getCertificateType",
"}",
"for",
"details",
"for",
"determining",
"the",
"certificate",
"type",
".... | train | https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/ssl-proxies/src/main/java/org/globus/gsi/bc/BouncyCastleUtil.java#L215-L224 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/StringUtils.java | StringUtils.containsAny | public static boolean containsAny(final CharSequence cs, final CharSequence... searchCharSequences) {
"""
<p>Checks if the CharSequence contains any of the CharSequences in the given array.</p>
<p>
A {@code null} {@code cs} CharSequence will return {@code false}. A {@code null} or zero
length search array wil... | java | public static boolean containsAny(final CharSequence cs, final CharSequence... searchCharSequences) {
if (isEmpty(cs) || ArrayUtils.isEmpty(searchCharSequences)) {
return false;
}
for (final CharSequence searchCharSequence : searchCharSequences) {
if (contains(cs, searchC... | [
"public",
"static",
"boolean",
"containsAny",
"(",
"final",
"CharSequence",
"cs",
",",
"final",
"CharSequence",
"...",
"searchCharSequences",
")",
"{",
"if",
"(",
"isEmpty",
"(",
"cs",
")",
"||",
"ArrayUtils",
".",
"isEmpty",
"(",
"searchCharSequences",
")",
"... | <p>Checks if the CharSequence contains any of the CharSequences in the given array.</p>
<p>
A {@code null} {@code cs} CharSequence will return {@code false}. A {@code null} or zero
length search array will return {@code false}.
</p>
<pre>
StringUtils.containsAny(null, *) = false
StringUtils.containsAny("",... | [
"<p",
">",
"Checks",
"if",
"the",
"CharSequence",
"contains",
"any",
"of",
"the",
"CharSequences",
"in",
"the",
"given",
"array",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/StringUtils.java#L2249-L2259 |
casbin/jcasbin | src/main/java/org/casbin/jcasbin/main/Enforcer.java | Enforcer.deletePermissionForUser | public boolean deletePermissionForUser(String user, List<String> permission) {
"""
deletePermissionForUser deletes a permission for a user or role.
Returns false if the user or role does not have the permission (aka not affected).
@param user the user.
@param permission the permission, usually be (obj, act). ... | java | public boolean deletePermissionForUser(String user, List<String> permission) {
return deletePermissionForUser(user, permission.toArray(new String[0]));
} | [
"public",
"boolean",
"deletePermissionForUser",
"(",
"String",
"user",
",",
"List",
"<",
"String",
">",
"permission",
")",
"{",
"return",
"deletePermissionForUser",
"(",
"user",
",",
"permission",
".",
"toArray",
"(",
"new",
"String",
"[",
"0",
"]",
")",
")"... | deletePermissionForUser deletes a permission for a user or role.
Returns false if the user or role does not have the permission (aka not affected).
@param user the user.
@param permission the permission, usually be (obj, act). It is actually the rule without the subject.
@return succeeds or not. | [
"deletePermissionForUser",
"deletes",
"a",
"permission",
"for",
"a",
"user",
"or",
"role",
".",
"Returns",
"false",
"if",
"the",
"user",
"or",
"role",
"does",
"not",
"have",
"the",
"permission",
"(",
"aka",
"not",
"affected",
")",
"."
] | train | https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/main/Enforcer.java#L297-L299 |
wdtinc/mapbox-vector-tile-java | src/main/java/com/wdtinc/mapbox_vector_tile/adapt/jts/JtsAdapter.java | JtsAdapter.createTileGeom | public static TileGeomResult createTileGeom(List<Geometry> g,
Envelope tileEnvelope,
GeometryFactory geomFactory,
MvtLayerParams mvtLayerParams,
... | java | public static TileGeomResult createTileGeom(List<Geometry> g,
Envelope tileEnvelope,
GeometryFactory geomFactory,
MvtLayerParams mvtLayerParams,
... | [
"public",
"static",
"TileGeomResult",
"createTileGeom",
"(",
"List",
"<",
"Geometry",
">",
"g",
",",
"Envelope",
"tileEnvelope",
",",
"GeometryFactory",
"geomFactory",
",",
"MvtLayerParams",
"mvtLayerParams",
",",
"IGeometryFilter",
"filter",
")",
"{",
"return",
"cr... | <p>Create geometry clipped and then converted to MVT 'extent' coordinates. Result
contains both clipped geometry (intersection) and transformed geometry for encoding to MVT.</p>
<p>Uses the same tile and clipping coordinates. May cause rendering issues on boundaries for polygons
or line geometry depending on styling.<... | [
"<p",
">",
"Create",
"geometry",
"clipped",
"and",
"then",
"converted",
"to",
"MVT",
"extent",
"coordinates",
".",
"Result",
"contains",
"both",
"clipped",
"geometry",
"(",
"intersection",
")",
"and",
"transformed",
"geometry",
"for",
"encoding",
"to",
"MVT",
... | train | https://github.com/wdtinc/mapbox-vector-tile-java/blob/e5e3df3fc2260709e289f972a1348c0a1ea30339/src/main/java/com/wdtinc/mapbox_vector_tile/adapt/jts/JtsAdapter.java#L63-L69 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/EmulatedFields.java | EmulatedFields.put | public void put(String name, byte value) throws IllegalArgumentException {
"""
Find and set the byte value of a given field named {@code name} in the
receiver.
@param name
the name of the field to set.
@param value
new value for the field.
@throws IllegalArgumentException
if the corresponding field can ... | java | public void put(String name, byte value) throws IllegalArgumentException {
ObjectSlot slot = findMandatorySlot(name, byte.class);
slot.fieldValue = Byte.valueOf(value);
slot.defaulted = false; // No longer default value
} | [
"public",
"void",
"put",
"(",
"String",
"name",
",",
"byte",
"value",
")",
"throws",
"IllegalArgumentException",
"{",
"ObjectSlot",
"slot",
"=",
"findMandatorySlot",
"(",
"name",
",",
"byte",
".",
"class",
")",
";",
"slot",
".",
"fieldValue",
"=",
"Byte",
... | Find and set the byte value of a given field named {@code name} in the
receiver.
@param name
the name of the field to set.
@param value
new value for the field.
@throws IllegalArgumentException
if the corresponding field can not be found. | [
"Find",
"and",
"set",
"the",
"byte",
"value",
"of",
"a",
"given",
"field",
"named",
"{",
"@code",
"name",
"}",
"in",
"the",
"receiver",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/EmulatedFields.java#L385-L389 |
azkaban/azkaban | azkaban-common/src/main/java/azkaban/server/HttpRequestUtils.java | HttpRequestUtils.getIntParam | public static int getIntParam(final HttpServletRequest request, final String name)
throws ServletException {
"""
Returns the param and parses it into an int. Will throw an exception if not found, or a parse
error if the type is incorrect.
"""
final String p = getParam(request, name);
return Inte... | java | public static int getIntParam(final HttpServletRequest request, final String name)
throws ServletException {
final String p = getParam(request, name);
return Integer.parseInt(p);
} | [
"public",
"static",
"int",
"getIntParam",
"(",
"final",
"HttpServletRequest",
"request",
",",
"final",
"String",
"name",
")",
"throws",
"ServletException",
"{",
"final",
"String",
"p",
"=",
"getParam",
"(",
"request",
",",
"name",
")",
";",
"return",
"Integer"... | Returns the param and parses it into an int. Will throw an exception if not found, or a parse
error if the type is incorrect. | [
"Returns",
"the",
"param",
"and",
"parses",
"it",
"into",
"an",
"int",
".",
"Will",
"throw",
"an",
"exception",
"if",
"not",
"found",
"or",
"a",
"parse",
"error",
"if",
"the",
"type",
"is",
"incorrect",
"."
] | train | https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-common/src/main/java/azkaban/server/HttpRequestUtils.java#L213-L217 |
raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/utility/JavaConstant.java | Dynamic.ofInvocation | public static Dynamic ofInvocation(Constructor<?> constructor, List<?> rawArguments) {
"""
Represents a constant that is resolved by invoking a constructor.
@param constructor The constructor to invoke to create the represented constant value.
@param rawArguments The constructor's constant arguments.
@return... | java | public static Dynamic ofInvocation(Constructor<?> constructor, List<?> rawArguments) {
return ofInvocation(new MethodDescription.ForLoadedConstructor(constructor), rawArguments);
} | [
"public",
"static",
"Dynamic",
"ofInvocation",
"(",
"Constructor",
"<",
"?",
">",
"constructor",
",",
"List",
"<",
"?",
">",
"rawArguments",
")",
"{",
"return",
"ofInvocation",
"(",
"new",
"MethodDescription",
".",
"ForLoadedConstructor",
"(",
"constructor",
")"... | Represents a constant that is resolved by invoking a constructor.
@param constructor The constructor to invoke to create the represented constant value.
@param rawArguments The constructor's constant arguments.
@return A dynamic constant that is resolved by the supplied constuctor. | [
"Represents",
"a",
"constant",
"that",
"is",
"resolved",
"by",
"invoking",
"a",
"constructor",
"."
] | train | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/utility/JavaConstant.java#L1553-L1555 |
luontola/jumi | jumi-core/src/main/java/fi/jumi/core/network/NettyNetworkEndpointAdapter.java | NettyNetworkEndpointAdapter.channelClosed | @Override
public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
"""
of those events comes, even though the channelConnected came. Using just channelClosed appears to be reliable.
"""
endpoint.onDisconnected();
super.channelClosed(ctx, e);
} | java | @Override
public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
endpoint.onDisconnected();
super.channelClosed(ctx, e);
} | [
"@",
"Override",
"public",
"void",
"channelClosed",
"(",
"ChannelHandlerContext",
"ctx",
",",
"ChannelStateEvent",
"e",
")",
"throws",
"Exception",
"{",
"endpoint",
".",
"onDisconnected",
"(",
")",
";",
"super",
".",
"channelClosed",
"(",
"ctx",
",",
"e",
")",... | of those events comes, even though the channelConnected came. Using just channelClosed appears to be reliable. | [
"of",
"those",
"events",
"comes",
"even",
"though",
"the",
"channelConnected",
"came",
".",
"Using",
"just",
"channelClosed",
"appears",
"to",
"be",
"reliable",
"."
] | train | https://github.com/luontola/jumi/blob/18815c499b770f51cdb58cc6720dca4f254b2019/jumi-core/src/main/java/fi/jumi/core/network/NettyNetworkEndpointAdapter.java#L37-L41 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/wallet/KeyChainGroup.java | KeyChainGroup.mergeActiveKeyChains | public final void mergeActiveKeyChains(KeyChainGroup from, long keyRotationTimeSecs) {
"""
Merge all active chains from the given keychain group into this keychain group.
"""
checkArgument(isEncrypted() == from.isEncrypted(), "encrypted and non-encrypted keychains cannot be mixed");
for (Determ... | java | public final void mergeActiveKeyChains(KeyChainGroup from, long keyRotationTimeSecs) {
checkArgument(isEncrypted() == from.isEncrypted(), "encrypted and non-encrypted keychains cannot be mixed");
for (DeterministicKeyChain chain : from.getActiveKeyChains(keyRotationTimeSecs))
addAndActivateH... | [
"public",
"final",
"void",
"mergeActiveKeyChains",
"(",
"KeyChainGroup",
"from",
",",
"long",
"keyRotationTimeSecs",
")",
"{",
"checkArgument",
"(",
"isEncrypted",
"(",
")",
"==",
"from",
".",
"isEncrypted",
"(",
")",
",",
"\"encrypted and non-encrypted keychains cann... | Merge all active chains from the given keychain group into this keychain group. | [
"Merge",
"all",
"active",
"chains",
"from",
"the",
"given",
"keychain",
"group",
"into",
"this",
"keychain",
"group",
"."
] | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/wallet/KeyChainGroup.java#L435-L439 |
akarnokd/ixjava | src/main/java/ix/Ix.java | Ix.fromArrayRange | public static <T> Ix<T> fromArrayRange(int start, int end, T... values) {
"""
Emits a range of elements from the given array.
<p>
The result's iterator() doesn't support remove().
@param <T> the value type
@param start the staring index, inclusive, non-negative
@param end the end index, exclusive, non-negativ... | java | public static <T> Ix<T> fromArrayRange(int start, int end, T... values) {
if (start < 0 || end < 0 || start > values.length || end > values.length) {
throw new IndexOutOfBoundsException("start=" + start + ", end=" + end + ", length=" + values.length);
}
return new IxFromArray<T>(star... | [
"public",
"static",
"<",
"T",
">",
"Ix",
"<",
"T",
">",
"fromArrayRange",
"(",
"int",
"start",
",",
"int",
"end",
",",
"T",
"...",
"values",
")",
"{",
"if",
"(",
"start",
"<",
"0",
"||",
"end",
"<",
"0",
"||",
"start",
">",
"values",
".",
"leng... | Emits a range of elements from the given array.
<p>
The result's iterator() doesn't support remove().
@param <T> the value type
@param start the staring index, inclusive, non-negative
@param end the end index, exclusive, non-negative
@param values the array of values
@return the new Ix instance
@throws NullPointerExcep... | [
"Emits",
"a",
"range",
"of",
"elements",
"from",
"the",
"given",
"array",
".",
"<p",
">",
"The",
"result",
"s",
"iterator",
"()",
"doesn",
"t",
"support",
"remove",
"()",
"."
] | train | https://github.com/akarnokd/ixjava/blob/add721bba550c36541faa450e40a975bb65e78d7/src/main/java/ix/Ix.java#L253-L258 |
bbottema/simple-java-mail | modules/simple-java-mail/src/main/java/org/simplejavamail/mailer/internal/mailsender/MailSenderImpl.java | MailSenderImpl.logSession | private static void logSession(final Session session, boolean async, final String activity) {
"""
Simply logs host details, credentials used and whether authentication will take place and finally the transport protocol used.
"""
final TransportStrategy transportStrategy = TransportStrategy.findStrategyForSes... | java | private static void logSession(final Session session, boolean async, final String activity) {
final TransportStrategy transportStrategy = TransportStrategy.findStrategyForSession(session);
final Properties properties = session.getProperties();
final String sessionDetails = (transportStrategy != null) ? transportS... | [
"private",
"static",
"void",
"logSession",
"(",
"final",
"Session",
"session",
",",
"boolean",
"async",
",",
"final",
"String",
"activity",
")",
"{",
"final",
"TransportStrategy",
"transportStrategy",
"=",
"TransportStrategy",
".",
"findStrategyForSession",
"(",
"se... | Simply logs host details, credentials used and whether authentication will take place and finally the transport protocol used. | [
"Simply",
"logs",
"host",
"details",
"credentials",
"used",
"and",
"whether",
"authentication",
"will",
"take",
"place",
"and",
"finally",
"the",
"transport",
"protocol",
"used",
"."
] | train | https://github.com/bbottema/simple-java-mail/blob/b03635328aeecd525e35eddfef8f5b9a184559d8/modules/simple-java-mail/src/main/java/org/simplejavamail/mailer/internal/mailsender/MailSenderImpl.java#L328-L333 |
wuman/android-oauth-client | library/src/main/java/com/wuman/android/auth/oauth2/explicit/LenientTokenResponseException.java | LenientTokenResponseException.from | public static LenientTokenResponseException from(JsonFactory jsonFactory,
HttpResponse readResponse, String responseContent) {
"""
Returns a new instance of {@link LenientTokenResponseException}.
<p>
If there is a JSON error response, it is parsed using
{@link TokenErrorResponse}, which can be inspe... | java | public static LenientTokenResponseException from(JsonFactory jsonFactory,
HttpResponse readResponse, String responseContent) {
HttpResponseException.Builder builder = new HttpResponseException.Builder(
readResponse.getStatusCode(), readResponse.getStatusMessage(),
rea... | [
"public",
"static",
"LenientTokenResponseException",
"from",
"(",
"JsonFactory",
"jsonFactory",
",",
"HttpResponse",
"readResponse",
",",
"String",
"responseContent",
")",
"{",
"HttpResponseException",
".",
"Builder",
"builder",
"=",
"new",
"HttpResponseException",
".",
... | Returns a new instance of {@link LenientTokenResponseException}.
<p>
If there is a JSON error response, it is parsed using
{@link TokenErrorResponse}, which can be inspected using
{@link #getDetails()}. Otherwise, the full response content is read and
included in the exception message.
</p>
@param jsonFactory JSON fac... | [
"Returns",
"a",
"new",
"instance",
"of",
"{",
"@link",
"LenientTokenResponseException",
"}",
".",
"<p",
">",
"If",
"there",
"is",
"a",
"JSON",
"error",
"response",
"it",
"is",
"parsed",
"using",
"{",
"@link",
"TokenErrorResponse",
"}",
"which",
"can",
"be",
... | train | https://github.com/wuman/android-oauth-client/blob/6e01b81b7319a6954a1156e8b93c0b5cbeb61446/library/src/main/java/com/wuman/android/auth/oauth2/explicit/LenientTokenResponseException.java#L83-L117 |
ag-gipp/MathMLTools | mathml-converters/src/main/java/com/formulasearchengine/mathmltools/converters/LaTeXMLConverter.java | LaTeXMLConverter.convertToString | public String convertToString(List<String> arguments, String latex) {
"""
Parses latex to MathML string via LaTeXML (locally)
@param arguments
@param latex
@return
"""
NativeResponse response = parseToNativeResponse(arguments, latex);
if (handleResponseCode(response, NAME, LOG) != 0) {
... | java | public String convertToString(List<String> arguments, String latex) {
NativeResponse response = parseToNativeResponse(arguments, latex);
if (handleResponseCode(response, NAME, LOG) != 0) {
return null;
}
LOG.info(NAME + " conversion successful.");
return response.getR... | [
"public",
"String",
"convertToString",
"(",
"List",
"<",
"String",
">",
"arguments",
",",
"String",
"latex",
")",
"{",
"NativeResponse",
"response",
"=",
"parseToNativeResponse",
"(",
"arguments",
",",
"latex",
")",
";",
"if",
"(",
"handleResponseCode",
"(",
"... | Parses latex to MathML string via LaTeXML (locally)
@param arguments
@param latex
@return | [
"Parses",
"latex",
"to",
"MathML",
"string",
"via",
"LaTeXML",
"(",
"locally",
")"
] | train | https://github.com/ag-gipp/MathMLTools/blob/77c69b6366a5b8720796d1cd9d155ba26c2f1b20/mathml-converters/src/main/java/com/formulasearchengine/mathmltools/converters/LaTeXMLConverter.java#L161-L168 |
alkacon/opencms-core | src/org/opencms/xml/A_CmsXmlDocument.java | A_CmsXmlDocument.createDeepElementCopy | protected Element createDeepElementCopy(Element element, Set<String> copyElements) {
"""
Creates a partial deep element copy according to the set of element paths.<p>
Only elements contained in that set will be copied.
@param element the element to copy
@param copyElements the set of paths for elements to cop... | java | protected Element createDeepElementCopy(Element element, Set<String> copyElements) {
return createDeepElementCopyInternal(null, null, element, copyElements);
} | [
"protected",
"Element",
"createDeepElementCopy",
"(",
"Element",
"element",
",",
"Set",
"<",
"String",
">",
"copyElements",
")",
"{",
"return",
"createDeepElementCopyInternal",
"(",
"null",
",",
"null",
",",
"element",
",",
"copyElements",
")",
";",
"}"
] | Creates a partial deep element copy according to the set of element paths.<p>
Only elements contained in that set will be copied.
@param element the element to copy
@param copyElements the set of paths for elements to copy
@return a partial deep copy of <code>element</code> | [
"Creates",
"a",
"partial",
"deep",
"element",
"copy",
"according",
"to",
"the",
"set",
"of",
"element",
"paths",
".",
"<p",
">",
"Only",
"elements",
"contained",
"in",
"that",
"set",
"will",
"be",
"copied",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/A_CmsXmlDocument.java#L778-L781 |
google/error-prone | check_api/src/main/java/com/google/errorprone/util/Signatures.java | Signatures.prettyMethodSignature | public static String prettyMethodSignature(ClassSymbol origin, MethodSymbol m) {
"""
Pretty-prints a method signature for use in diagnostics.
<p>Uses simple names for declared types, and omitting formal type parameters and the return
type since they do not affect overload resolution.
"""
StringBuilder ... | java | public static String prettyMethodSignature(ClassSymbol origin, MethodSymbol m) {
StringBuilder sb = new StringBuilder();
if (m.isConstructor()) {
Name name = m.owner.enclClass().getSimpleName();
if (name.isEmpty()) {
// use the superclass name of anonymous classes
name = m.owner.encl... | [
"public",
"static",
"String",
"prettyMethodSignature",
"(",
"ClassSymbol",
"origin",
",",
"MethodSymbol",
"m",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"m",
".",
"isConstructor",
"(",
")",
")",
"{",
"Name",
"n... | Pretty-prints a method signature for use in diagnostics.
<p>Uses simple names for declared types, and omitting formal type parameters and the return
type since they do not affect overload resolution. | [
"Pretty",
"-",
"prints",
"a",
"method",
"signature",
"for",
"use",
"in",
"diagnostics",
"."
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/util/Signatures.java#L88-L108 |
EdwardRaff/JSAT | JSAT/src/jsat/linear/Matrix.java | Matrix.transposeMultiply | public Vec transposeMultiply(double c, Vec b) {
"""
Creates a new vector equal to <i><b>x</b> = A'*<b>b</b>*c</i>
@param c the scalar constant to multiply by
@param b the vector to multiply by
@return the new vector equal to <i>A'*b*c</i>
"""
DenseVector toReturns = new DenseVector(this.cols());
... | java | public Vec transposeMultiply(double c, Vec b)
{
DenseVector toReturns = new DenseVector(this.cols());
this.transposeMultiply(c, b, toReturns);
return toReturns;
} | [
"public",
"Vec",
"transposeMultiply",
"(",
"double",
"c",
",",
"Vec",
"b",
")",
"{",
"DenseVector",
"toReturns",
"=",
"new",
"DenseVector",
"(",
"this",
".",
"cols",
"(",
")",
")",
";",
"this",
".",
"transposeMultiply",
"(",
"c",
",",
"b",
",",
"toRetu... | Creates a new vector equal to <i><b>x</b> = A'*<b>b</b>*c</i>
@param c the scalar constant to multiply by
@param b the vector to multiply by
@return the new vector equal to <i>A'*b*c</i> | [
"Creates",
"a",
"new",
"vector",
"equal",
"to",
"<i",
">",
"<b",
">",
"x<",
"/",
"b",
">",
"=",
"A",
"*",
"<b",
">",
"b<",
"/",
"b",
">",
"*",
"c<",
"/",
"i",
">"
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/Matrix.java#L519-L524 |
allure-framework/allure1 | allure-java-adaptor-api/src/main/java/ru/yandex/qatools/allure/utils/AllureResultsUtils.java | AllureResultsUtils.writeAttachment | public static Attachment writeAttachment(byte[] attachment, String title, String type) throws IOException {
"""
Write attachment with specified type. Generate attachment name uses
{@link #generateAttachmentName()}, attachment extension uses
{@link #getExtensionByMimeType(String)}
@param attachment byte array ... | java | public static Attachment writeAttachment(byte[] attachment, String title, String type) throws IOException {
String name = generateAttachmentName();
String extension = getExtensionByMimeType(type);
String source = name + extension;
File file = new File(getResultsDirectory(), source);
... | [
"public",
"static",
"Attachment",
"writeAttachment",
"(",
"byte",
"[",
"]",
"attachment",
",",
"String",
"title",
",",
"String",
"type",
")",
"throws",
"IOException",
"{",
"String",
"name",
"=",
"generateAttachmentName",
"(",
")",
";",
"String",
"extension",
"... | Write attachment with specified type. Generate attachment name uses
{@link #generateAttachmentName()}, attachment extension uses
{@link #getExtensionByMimeType(String)}
@param attachment byte array with attachment
@param title attachment title
@param type valid mime-type of attachment
@return Created {@link... | [
"Write",
"attachment",
"with",
"specified",
"type",
".",
"Generate",
"attachment",
"name",
"uses",
"{",
"@link",
"#generateAttachmentName",
"()",
"}",
"attachment",
"extension",
"uses",
"{",
"@link",
"#getExtensionByMimeType",
"(",
"String",
")",
"}"
] | train | https://github.com/allure-framework/allure1/blob/9a816fa05d8b894a917b7ebb7fd1a4056dee4693/allure-java-adaptor-api/src/main/java/ru/yandex/qatools/allure/utils/AllureResultsUtils.java#L265-L279 |
junit-team/junit4 | src/main/java/org/junit/runner/FilterFactories.java | FilterFactories.createFilter | public static Filter createFilter(Class<? extends FilterFactory> filterFactoryClass, FilterFactoryParams params)
throws FilterFactory.FilterNotCreatedException {
"""
Creates a {@link Filter}.
@param filterFactoryClass The class of the {@link FilterFactory}
@param params The arguments t... | java | public static Filter createFilter(Class<? extends FilterFactory> filterFactoryClass, FilterFactoryParams params)
throws FilterFactory.FilterNotCreatedException {
FilterFactory filterFactory = createFilterFactory(filterFactoryClass);
return filterFactory.createFilter(params);
} | [
"public",
"static",
"Filter",
"createFilter",
"(",
"Class",
"<",
"?",
"extends",
"FilterFactory",
">",
"filterFactoryClass",
",",
"FilterFactoryParams",
"params",
")",
"throws",
"FilterFactory",
".",
"FilterNotCreatedException",
"{",
"FilterFactory",
"filterFactory",
"=... | Creates a {@link Filter}.
@param filterFactoryClass The class of the {@link FilterFactory}
@param params The arguments to the {@link FilterFactory} | [
"Creates",
"a",
"{",
"@link",
"Filter",
"}",
"."
] | train | https://github.com/junit-team/junit4/blob/d9861ecdb6e487f6c352437ee823879aca3b81d4/src/main/java/org/junit/runner/FilterFactories.java#L55-L60 |
ggrandes/packer | src/main/java/org/javastack/packer/Packer.java | Packer.getString | public String getString() {
"""
Get String stored in UTF-8 format (encoded as: VInt-Length + bytes)
@return
@see #putString(String)
"""
final int len = getVInt();
final byte[] utf = new byte[len];
System.arraycopy(buf, bufPosition, utf, 0, utf.length);
bufPosition += utf.length;
return new String... | java | public String getString() {
final int len = getVInt();
final byte[] utf = new byte[len];
System.arraycopy(buf, bufPosition, utf, 0, utf.length);
bufPosition += utf.length;
return new String(utf, 0, len, charsetUTF8);
} | [
"public",
"String",
"getString",
"(",
")",
"{",
"final",
"int",
"len",
"=",
"getVInt",
"(",
")",
";",
"final",
"byte",
"[",
"]",
"utf",
"=",
"new",
"byte",
"[",
"len",
"]",
";",
"System",
".",
"arraycopy",
"(",
"buf",
",",
"bufPosition",
",",
"utf"... | Get String stored in UTF-8 format (encoded as: VInt-Length + bytes)
@return
@see #putString(String) | [
"Get",
"String",
"stored",
"in",
"UTF",
"-",
"8",
"format",
"(",
"encoded",
"as",
":",
"VInt",
"-",
"Length",
"+",
"bytes",
")"
] | train | https://github.com/ggrandes/packer/blob/0b37b286a3d0555050eb2e65419dd74f8d8d3e78/src/main/java/org/javastack/packer/Packer.java#L1093-L1099 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/cluster/Cluster.java | Cluster.addPoint | public void addPoint(Point point, boolean moveClusterCenter) {
"""
Add a point to the cluster
@param point the point to add
@param moveClusterCenter whether to update
the cluster centroid or not
"""
if (moveClusterCenter) {
if (isInverse()) {
center.getArray().muli(points... | java | public void addPoint(Point point, boolean moveClusterCenter) {
if (moveClusterCenter) {
if (isInverse()) {
center.getArray().muli(points.size()).subi(point.getArray()).divi(points.size() + 1);
} else {
center.getArray().muli(points.size()).addi(point.getAr... | [
"public",
"void",
"addPoint",
"(",
"Point",
"point",
",",
"boolean",
"moveClusterCenter",
")",
"{",
"if",
"(",
"moveClusterCenter",
")",
"{",
"if",
"(",
"isInverse",
"(",
")",
")",
"{",
"center",
".",
"getArray",
"(",
")",
".",
"muli",
"(",
"points",
"... | Add a point to the cluster
@param point the point to add
@param moveClusterCenter whether to update
the cluster centroid or not | [
"Add",
"a",
"point",
"to",
"the",
"cluster"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/cluster/Cluster.java#L95-L105 |
i-net-software/jlessc | src/com/inet/lib/less/Operation.java | Operation.doubleValue2Colors | private double doubleValue2Colors( double left, double right ) {
"""
Calculate two colors. The calculation occur for every color channel.
@param left the left color
@param right the right color
@return color value as long
"""
return rgba( doubleValue( red( left ), red( right ) ), //
... | java | private double doubleValue2Colors( double left, double right ) {
return rgba( doubleValue( red( left ), red( right ) ), //
doubleValue( green( left ), green( right ) ), //
doubleValue( blue( left ), blue( right ) ), 1 );
} | [
"private",
"double",
"doubleValue2Colors",
"(",
"double",
"left",
",",
"double",
"right",
")",
"{",
"return",
"rgba",
"(",
"doubleValue",
"(",
"red",
"(",
"left",
")",
",",
"red",
"(",
"right",
")",
")",
",",
"//",
"doubleValue",
"(",
"green",
"(",
"le... | Calculate two colors. The calculation occur for every color channel.
@param left the left color
@param right the right color
@return color value as long | [
"Calculate",
"two",
"colors",
".",
"The",
"calculation",
"occur",
"for",
"every",
"color",
"channel",
"."
] | train | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/Operation.java#L406-L410 |
Azure/azure-sdk-for-java | compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineExtensionImagesInner.java | VirtualMachineExtensionImagesInner.listVersions | public List<VirtualMachineExtensionImageInner> listVersions(String location, String publisherName, String type) {
"""
Gets a list of virtual machine extension image versions.
@param location The name of a supported Azure region.
@param publisherName the String value
@param type the String value
@throws Illeg... | java | public List<VirtualMachineExtensionImageInner> listVersions(String location, String publisherName, String type) {
return listVersionsWithServiceResponseAsync(location, publisherName, type).toBlocking().single().body();
} | [
"public",
"List",
"<",
"VirtualMachineExtensionImageInner",
">",
"listVersions",
"(",
"String",
"location",
",",
"String",
"publisherName",
",",
"String",
"type",
")",
"{",
"return",
"listVersionsWithServiceResponseAsync",
"(",
"location",
",",
"publisherName",
",",
"... | Gets a list of virtual machine extension image versions.
@param location The name of a supported Azure region.
@param publisherName the String value
@param type the String value
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
... | [
"Gets",
"a",
"list",
"of",
"virtual",
"machine",
"extension",
"image",
"versions",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineExtensionImagesInner.java#L266-L268 |
facebook/fresco | imagepipeline-base/src/main/java/com/facebook/imagepipeline/cache/CountingMemoryCache.java | CountingMemoryCache.maybeClose | private void maybeClose(@Nullable ArrayList<Entry<K, V>> oldEntries) {
"""
Notifies the client that the cache no longer tracks the given items.
<p> This method invokes the external {@link CloseableReference#close} method,
so it must not be called while holding the <code>this</code> lock.
"""
if (oldEnt... | java | private void maybeClose(@Nullable ArrayList<Entry<K, V>> oldEntries) {
if (oldEntries != null) {
for (Entry<K, V> oldEntry : oldEntries) {
CloseableReference.closeSafely(referenceToClose(oldEntry));
}
}
} | [
"private",
"void",
"maybeClose",
"(",
"@",
"Nullable",
"ArrayList",
"<",
"Entry",
"<",
"K",
",",
"V",
">",
">",
"oldEntries",
")",
"{",
"if",
"(",
"oldEntries",
"!=",
"null",
")",
"{",
"for",
"(",
"Entry",
"<",
"K",
",",
"V",
">",
"oldEntry",
":",
... | Notifies the client that the cache no longer tracks the given items.
<p> This method invokes the external {@link CloseableReference#close} method,
so it must not be called while holding the <code>this</code> lock. | [
"Notifies",
"the",
"client",
"that",
"the",
"cache",
"no",
"longer",
"tracks",
"the",
"given",
"items",
"."
] | train | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline-base/src/main/java/com/facebook/imagepipeline/cache/CountingMemoryCache.java#L431-L437 |
alkacon/opencms-core | src/org/opencms/ade/containerpage/inherited/CmsInheritanceReferenceParser.java | CmsInheritanceReferenceParser.parseReference | protected CmsInheritanceReference parseReference(I_CmsXmlContentLocation location, Locale locale) {
"""
Extracts a single inheritance reference from a location in the XML content.<p>
This method may return null if the given location doesn't contain a valid inheritance container reference.<p>
@param location ... | java | protected CmsInheritanceReference parseReference(I_CmsXmlContentLocation location, Locale locale) {
I_CmsXmlContentValueLocation nameLocation = location.getSubValue("ConfigName");
if (nameLocation == null) {
return null;
}
String configName = nameLocation.asString(m_cm... | [
"protected",
"CmsInheritanceReference",
"parseReference",
"(",
"I_CmsXmlContentLocation",
"location",
",",
"Locale",
"locale",
")",
"{",
"I_CmsXmlContentValueLocation",
"nameLocation",
"=",
"location",
".",
"getSubValue",
"(",
"\"ConfigName\"",
")",
";",
"if",
"(",
"nam... | Extracts a single inheritance reference from a location in the XML content.<p>
This method may return null if the given location doesn't contain a valid inheritance container reference.<p>
@param location the location from which to parse the inheritance reference
@param locale the locale from which to parse the inhe... | [
"Extracts",
"a",
"single",
"inheritance",
"reference",
"from",
"a",
"location",
"in",
"the",
"XML",
"content",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/containerpage/inherited/CmsInheritanceReferenceParser.java#L133-L155 |
chhh/MSFTBX | MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java | JaxbUtils.createXmlStreamReader | public static XMLStreamReader createXmlStreamReader(Reader reader, boolean namespaceAware)
throws JAXBException {
"""
Creates an XMLStreamReader based on a Reader.
@param reader Note that XMLStreamReader, despite the name, does not implement the Reader
interface!
@param namespaceAware if {@code false} ... | java | public static XMLStreamReader createXmlStreamReader(Reader reader, boolean namespaceAware)
throws JAXBException {
XMLInputFactory xif = getXmlInputFactory(namespaceAware);
XMLStreamReader xsr = null;
try {
xsr = xif.createXMLStreamReader(reader);
} catch (XMLStreamException e) {
... | [
"public",
"static",
"XMLStreamReader",
"createXmlStreamReader",
"(",
"Reader",
"reader",
",",
"boolean",
"namespaceAware",
")",
"throws",
"JAXBException",
"{",
"XMLInputFactory",
"xif",
"=",
"getXmlInputFactory",
"(",
"namespaceAware",
")",
";",
"XMLStreamReader",
"xsr"... | Creates an XMLStreamReader based on a Reader.
@param reader Note that XMLStreamReader, despite the name, does not implement the Reader
interface!
@param namespaceAware if {@code false} the XMLStreamReader will remove all namespaces from all
XML elements
@return platform-specific XMLStreamReader implementation
@throws ... | [
"Creates",
"an",
"XMLStreamReader",
"based",
"on",
"a",
"Reader",
"."
] | train | https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java#L174-L184 |
rolfl/MicroBench | src/main/java/net/tuis/ubench/UBench.java | UBench.addTask | public <T> UBench addTask(String name, Supplier<T> task, Predicate<T> check) {
"""
Include a named task (and validator) in to the benchmark.
@param <T>
The type of the task return value (which is the input to be
tested in the validator)
@param name
The name of the task. Only one task with any one name is
a... | java | public <T> UBench addTask(String name, Supplier<T> task, Predicate<T> check) {
return putTask(name, () -> {
long start = System.nanoTime();
T result = task.get();
long time = System.nanoTime() - start;
if (check != null && !check.test(result)) {
th... | [
"public",
"<",
"T",
">",
"UBench",
"addTask",
"(",
"String",
"name",
",",
"Supplier",
"<",
"T",
">",
"task",
",",
"Predicate",
"<",
"T",
">",
"check",
")",
"{",
"return",
"putTask",
"(",
"name",
",",
"(",
")",
"->",
"{",
"long",
"start",
"=",
"Sy... | Include a named task (and validator) in to the benchmark.
@param <T>
The type of the task return value (which is the input to be
tested in the validator)
@param name
The name of the task. Only one task with any one name is
allowed.
@param task
The task to perform
@param check
The check of the results from the task.
@r... | [
"Include",
"a",
"named",
"task",
"(",
"and",
"validator",
")",
"in",
"to",
"the",
"benchmark",
"."
] | train | https://github.com/rolfl/MicroBench/blob/f2bfa92dacd7ea0d6b8eae4d4fe2975139d317ce/src/main/java/net/tuis/ubench/UBench.java#L128-L138 |
raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/utility/JavaConstant.java | Dynamic.ofInvocation | public static Dynamic ofInvocation(Constructor<?> constructor, Object... rawArgument) {
"""
Represents a constant that is resolved by invoking a constructor.
@param constructor The constructor to invoke to create the represented constant value.
@param rawArgument The constructor's constant arguments.
@return ... | java | public static Dynamic ofInvocation(Constructor<?> constructor, Object... rawArgument) {
return ofInvocation(constructor, Arrays.asList(rawArgument));
} | [
"public",
"static",
"Dynamic",
"ofInvocation",
"(",
"Constructor",
"<",
"?",
">",
"constructor",
",",
"Object",
"...",
"rawArgument",
")",
"{",
"return",
"ofInvocation",
"(",
"constructor",
",",
"Arrays",
".",
"asList",
"(",
"rawArgument",
")",
")",
";",
"}"... | Represents a constant that is resolved by invoking a constructor.
@param constructor The constructor to invoke to create the represented constant value.
@param rawArgument The constructor's constant arguments.
@return A dynamic constant that is resolved by the supplied constuctor. | [
"Represents",
"a",
"constant",
"that",
"is",
"resolved",
"by",
"invoking",
"a",
"constructor",
"."
] | train | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/utility/JavaConstant.java#L1542-L1544 |
querydsl/querydsl | querydsl-sql/src/main/java/com/querydsl/sql/mysql/AbstractMySQLQuery.java | AbstractMySQLQuery.withRollup | @WithBridgeMethods(value = MySQLQuery.class, castRequired = true)
public C withRollup() {
"""
The GROUP BY clause permits a WITH ROLLUP modifier that causes extra rows to be added to the
summary output. These rows represent higher-level (or super-aggregate) summary operations.
ROLLUP thus enables you to answ... | java | @WithBridgeMethods(value = MySQLQuery.class, castRequired = true)
public C withRollup() {
return addFlag(Position.AFTER_GROUP_BY, WITH_ROLLUP);
} | [
"@",
"WithBridgeMethods",
"(",
"value",
"=",
"MySQLQuery",
".",
"class",
",",
"castRequired",
"=",
"true",
")",
"public",
"C",
"withRollup",
"(",
")",
"{",
"return",
"addFlag",
"(",
"Position",
".",
"AFTER_GROUP_BY",
",",
"WITH_ROLLUP",
")",
";",
"}"
] | The GROUP BY clause permits a WITH ROLLUP modifier that causes extra rows to be added to the
summary output. These rows represent higher-level (or super-aggregate) summary operations.
ROLLUP thus enables you to answer questions at multiple levels of analysis with a single query.
It can be used, for example, to provide ... | [
"The",
"GROUP",
"BY",
"clause",
"permits",
"a",
"WITH",
"ROLLUP",
"modifier",
"that",
"causes",
"extra",
"rows",
"to",
"be",
"added",
"to",
"the",
"summary",
"output",
".",
"These",
"rows",
"represent",
"higher",
"-",
"level",
"(",
"or",
"super",
"-",
"a... | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/mysql/AbstractMySQLQuery.java#L251-L254 |
nleva/CDIEndpoint | CDIEndpoint/src/main/java/ru/sendto/websocket/WebsocketEventService.java | WebsocketEventService.onMessage | @OnMessage
public void onMessage(Dto msg, Session session) {
"""
Событие прихода нового сообщения. Десериализует данные, получает текущие
атрибуты сессии и проксирует запрос в сервисы.
@param msg
- сообщение.
@param session
- сессия вебсокета.
"""
try {
messageBus.fire(session);
messagePayloadB... | java | @OnMessage
public void onMessage(Dto msg, Session session) {
try {
messageBus.fire(session);
messagePayloadBus.fire(msg);
} catch (Exception e) {
log.log(Level.SEVERE, e.getMessage(), e);
}
} | [
"@",
"OnMessage",
"public",
"void",
"onMessage",
"(",
"Dto",
"msg",
",",
"Session",
"session",
")",
"{",
"try",
"{",
"messageBus",
".",
"fire",
"(",
"session",
")",
";",
"messagePayloadBus",
".",
"fire",
"(",
"msg",
")",
";",
"}",
"catch",
"(",
"Except... | Событие прихода нового сообщения. Десериализует данные, получает текущие
атрибуты сессии и проксирует запрос в сервисы.
@param msg
- сообщение.
@param session
- сессия вебсокета. | [
"Событие",
"прихода",
"нового",
"сообщения",
".",
"Десериализует",
"данные",
"получает",
"текущие",
"атрибуты",
"сессии",
"и",
"проксирует",
"запрос",
"в",
"сервисы",
"."
] | train | https://github.com/nleva/CDIEndpoint/blob/765f6d9fd94820f84e8be80b7234bd8c9657744e/CDIEndpoint/src/main/java/ru/sendto/websocket/WebsocketEventService.java#L119-L129 |
UrielCh/ovh-java-sdk | ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java | ApiOvhCloud.serviceName_pca_pcaServiceName_usage_GET | public Long serviceName_pca_pcaServiceName_usage_GET(String serviceName, String pcaServiceName) throws IOException {
"""
View account current total sessions usage (bytes)
REST: GET /cloud/{serviceName}/pca/{pcaServiceName}/usage
@param serviceName [required] The internal name of your public cloud passport
@pa... | java | public Long serviceName_pca_pcaServiceName_usage_GET(String serviceName, String pcaServiceName) throws IOException {
String qPath = "/cloud/{serviceName}/pca/{pcaServiceName}/usage";
StringBuilder sb = path(qPath, serviceName, pcaServiceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return conver... | [
"public",
"Long",
"serviceName_pca_pcaServiceName_usage_GET",
"(",
"String",
"serviceName",
",",
"String",
"pcaServiceName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/cloud/{serviceName}/pca/{pcaServiceName}/usage\"",
";",
"StringBuilder",
"sb",
"=",
"p... | View account current total sessions usage (bytes)
REST: GET /cloud/{serviceName}/pca/{pcaServiceName}/usage
@param serviceName [required] The internal name of your public cloud passport
@param pcaServiceName [required] The internal name of your PCA offer
@deprecated | [
"View",
"account",
"current",
"total",
"sessions",
"usage",
"(",
"bytes",
")"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L2565-L2570 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/config/SSLConfigManager.java | SSLConfigManager.parseSSLConfig | private SSLConfig parseSSLConfig(Map<String, Object> properties, boolean reinitialize) throws Exception {
"""
Helper method to build the SSLConfig properties from the SSLConfig model
object.
"""
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "parseSSLConfig: ... | java | private SSLConfig parseSSLConfig(Map<String, Object> properties, boolean reinitialize) throws Exception {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "parseSSLConfig: " + properties.get(LibertyConstants.KEY_ID), properties);
SSLConfig rc = parseSecureSocket... | [
"private",
"SSLConfig",
"parseSSLConfig",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
",",
"boolean",
"reinitialize",
")",
"throws",
"Exception",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntry... | Helper method to build the SSLConfig properties from the SSLConfig model
object. | [
"Helper",
"method",
"to",
"build",
"the",
"SSLConfig",
"properties",
"from",
"the",
"SSLConfig",
"model",
"object",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/config/SSLConfigManager.java#L314-L323 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/asn1/util/ASN1Dump.java | ASN1Dump.dumpAsString | public static String dumpAsString(
Object obj) {
"""
dump out a DER object as a formatted string
@param obj the DERObject to be dumped out.
"""
if (obj instanceof DERObject)
{
return _dumpAsString("", (DERObject) obj);
}
else ... | java | public static String dumpAsString(
Object obj)
{
if (obj instanceof DERObject)
{
return _dumpAsString("", (DERObject) obj);
}
else if (obj instanceof DEREncodable)
{
return _dumpAsString("", ((DEREncodable) obj).ge... | [
"public",
"static",
"String",
"dumpAsString",
"(",
"Object",
"obj",
")",
"{",
"if",
"(",
"obj",
"instanceof",
"DERObject",
")",
"{",
"return",
"_dumpAsString",
"(",
"\"\"",
",",
"(",
"DERObject",
")",
"obj",
")",
";",
"}",
"else",
"if",
"(",
"obj",
"in... | dump out a DER object as a formatted string
@param obj the DERObject to be dumped out. | [
"dump",
"out",
"a",
"DER",
"object",
"as",
"a",
"formatted",
"string"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/asn1/util/ASN1Dump.java#L322-L335 |
algorithmiaio/algorithmia-java | src/main/java/com/algorithmia/data/DataFile.java | DataFile.put | public void put(byte[] data) throws APIException {
"""
Upload raw data to this file as binary
@param data the data to upload
@throws APIException if there were any problems communicating with the Algorithmia API
"""
HttpResponse response = client.put(getUrl(), new ByteArrayEntity(data, ContentType.AP... | java | public void put(byte[] data) throws APIException {
HttpResponse response = client.put(getUrl(), new ByteArrayEntity(data, ContentType.APPLICATION_OCTET_STREAM));
HttpClientHelpers.throwIfNotOk(response);
} | [
"public",
"void",
"put",
"(",
"byte",
"[",
"]",
"data",
")",
"throws",
"APIException",
"{",
"HttpResponse",
"response",
"=",
"client",
".",
"put",
"(",
"getUrl",
"(",
")",
",",
"new",
"ByteArrayEntity",
"(",
"data",
",",
"ContentType",
".",
"APPLICATION_OC... | Upload raw data to this file as binary
@param data the data to upload
@throws APIException if there were any problems communicating with the Algorithmia API | [
"Upload",
"raw",
"data",
"to",
"this",
"file",
"as",
"binary"
] | train | https://github.com/algorithmiaio/algorithmia-java/blob/64bfdbd426e2d7f659be06d230523253e642a730/src/main/java/com/algorithmia/data/DataFile.java#L143-L146 |
box/box-java-sdk | src/main/java/com/box/sdk/BoxFile.java | BoxFile.addTask | public BoxTask.Info addTask(BoxTask.Action action, String message, Date dueAt) {
"""
Adds a new task to this file. The task can have an optional message to include, and a due date.
@param action the action the task assignee will be prompted to do.
@param message an optional message to include with the task.
... | java | public BoxTask.Info addTask(BoxTask.Action action, String message, Date dueAt) {
JsonObject itemJSON = new JsonObject();
itemJSON.add("type", "file");
itemJSON.add("id", this.getID());
JsonObject requestJSON = new JsonObject();
requestJSON.add("item", itemJSON);
requestJ... | [
"public",
"BoxTask",
".",
"Info",
"addTask",
"(",
"BoxTask",
".",
"Action",
"action",
",",
"String",
"message",
",",
"Date",
"dueAt",
")",
"{",
"JsonObject",
"itemJSON",
"=",
"new",
"JsonObject",
"(",
")",
";",
"itemJSON",
".",
"add",
"(",
"\"type\"",
",... | Adds a new task to this file. The task can have an optional message to include, and a due date.
@param action the action the task assignee will be prompted to do.
@param message an optional message to include with the task.
@param dueAt the day at which this task is due.
@return information about the newly added ta... | [
"Adds",
"a",
"new",
"task",
"to",
"this",
"file",
".",
"The",
"task",
"can",
"have",
"an",
"optional",
"message",
"to",
"include",
"and",
"a",
"due",
"date",
"."
] | train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxFile.java#L233-L258 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/http/HttpHeaderMap.java | HttpHeaderMap.addLongHeader | public void addLongHeader (@Nonnull @Nonempty final String sName, final long nValue) {
"""
Add the passed header as a number.
@param sName
Header name. May neither be <code>null</code> nor empty.
@param nValue
The value to be set. May not be <code>null</code>.
"""
_addHeader (sName, Long.toString (nV... | java | public void addLongHeader (@Nonnull @Nonempty final String sName, final long nValue)
{
_addHeader (sName, Long.toString (nValue));
} | [
"public",
"void",
"addLongHeader",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sName",
",",
"final",
"long",
"nValue",
")",
"{",
"_addHeader",
"(",
"sName",
",",
"Long",
".",
"toString",
"(",
"nValue",
")",
")",
";",
"}"
] | Add the passed header as a number.
@param sName
Header name. May neither be <code>null</code> nor empty.
@param nValue
The value to be set. May not be <code>null</code>. | [
"Add",
"the",
"passed",
"header",
"as",
"a",
"number",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/http/HttpHeaderMap.java#L382-L385 |
jboss/jboss-jsf-api_spec | src/main/java/javax/faces/TypedCollections.java | TypedCollections.dynamicallyCastCollection | @SuppressWarnings("unchecked")
static <E,TypedC extends Collection<E>> TypedC dynamicallyCastCollection(Collection<?> c,
Class<E> type,
... | java | @SuppressWarnings("unchecked")
static <E,TypedC extends Collection<E>> TypedC dynamicallyCastCollection(Collection<?> c,
Class<E> type,
... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"static",
"<",
"E",
",",
"TypedC",
"extends",
"Collection",
"<",
"E",
">",
">",
"TypedC",
"dynamicallyCastCollection",
"(",
"Collection",
"<",
"?",
">",
"c",
",",
"Class",
"<",
"E",
">",
"type",
",",
"C... | Dynamically check that the members of the collection are all
instances of the given type (or null), and that the collection
itself is of the given collection type.
@param <E>
the collection's element type
@param c
the collection to cast
@param type
the class of the collection's element type.
@return the dynamically-ty... | [
"Dynamically",
"check",
"that",
"the",
"members",
"of",
"the",
"collection",
"are",
"all",
"instances",
"of",
"the",
"given",
"type",
"(",
"or",
"null",
")",
"and",
"that",
"the",
"collection",
"itself",
"is",
"of",
"the",
"given",
"collection",
"type",
".... | train | https://github.com/jboss/jboss-jsf-api_spec/blob/cb33d215acbab847f2db5cdf2c6fe4d99c0a01c3/src/main/java/javax/faces/TypedCollections.java#L77-L89 |
javalite/activejdbc | activejdbc/src/main/java/org/javalite/activejdbc/Base.java | Base.firstCell | public static Object firstCell(String query, Object... params) {
"""
Returns a value of the first column of the first row.
This query expects only one column selected in the select statement.
If more than one column returned, it will throw {@link IllegalArgumentException}.
@param query query
@param params pa... | java | public static Object firstCell(String query, Object... params) {
return new DB(DB.DEFAULT_NAME).firstCell(query, params);
} | [
"public",
"static",
"Object",
"firstCell",
"(",
"String",
"query",
",",
"Object",
"...",
"params",
")",
"{",
"return",
"new",
"DB",
"(",
"DB",
".",
"DEFAULT_NAME",
")",
".",
"firstCell",
"(",
"query",
",",
"params",
")",
";",
"}"
] | Returns a value of the first column of the first row.
This query expects only one column selected in the select statement.
If more than one column returned, it will throw {@link IllegalArgumentException}.
@param query query
@param params parameters
@return fetched value, or null if query did not fetch anything. | [
"Returns",
"a",
"value",
"of",
"the",
"first",
"column",
"of",
"the",
"first",
"row",
".",
"This",
"query",
"expects",
"only",
"one",
"column",
"selected",
"in",
"the",
"select",
"statement",
".",
"If",
"more",
"than",
"one",
"column",
"returned",
"it",
... | train | https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/Base.java#L178-L180 |
alkacon/opencms-core | src/org/opencms/workflow/A_CmsWorkflowManager.java | A_CmsWorkflowManager.setParameters | public void setParameters(Map<String, String> parameters) {
"""
Sets the configuration parameters of the workflow manager.<p>
@param parameters the map of configuration parameters
"""
if (m_parameters != null) {
throw new IllegalStateException();
}
m_parameters = pa... | java | public void setParameters(Map<String, String> parameters) {
if (m_parameters != null) {
throw new IllegalStateException();
}
m_parameters = parameters;
} | [
"public",
"void",
"setParameters",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
")",
"{",
"if",
"(",
"m_parameters",
"!=",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
")",
";",
"}",
"m_parameters",
"=",
"parameters",
";"... | Sets the configuration parameters of the workflow manager.<p>
@param parameters the map of configuration parameters | [
"Sets",
"the",
"configuration",
"parameters",
"of",
"the",
"workflow",
"manager",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workflow/A_CmsWorkflowManager.java#L73-L79 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java | IoUtil.copy | public static long copy(ReadableByteChannel in, WritableByteChannel out, int bufferSize, StreamProgress streamProgress) throws IORuntimeException {
"""
拷贝流,使用NIO,不会关闭流
@param in {@link ReadableByteChannel}
@param out {@link WritableByteChannel}
@param bufferSize 缓冲大小,如果小于等于0,使用默认
@param streamProgress {@link... | java | public static long copy(ReadableByteChannel in, WritableByteChannel out, int bufferSize, StreamProgress streamProgress) throws IORuntimeException {
Assert.notNull(in, "InputStream is null !");
Assert.notNull(out, "OutputStream is null !");
ByteBuffer byteBuffer = ByteBuffer.allocate(bufferSize <= 0 ? DEFAULT... | [
"public",
"static",
"long",
"copy",
"(",
"ReadableByteChannel",
"in",
",",
"WritableByteChannel",
"out",
",",
"int",
"bufferSize",
",",
"StreamProgress",
"streamProgress",
")",
"throws",
"IORuntimeException",
"{",
"Assert",
".",
"notNull",
"(",
"in",
",",
"\"Input... | 拷贝流,使用NIO,不会关闭流
@param in {@link ReadableByteChannel}
@param out {@link WritableByteChannel}
@param bufferSize 缓冲大小,如果小于等于0,使用默认
@param streamProgress {@link StreamProgress}进度处理器
@return 拷贝的字节数
@throws IORuntimeException IO异常 | [
"拷贝流,使用NIO,不会关闭流"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L264-L290 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/LoadBalancersInner.java | LoadBalancersInner.getByResourceGroup | public LoadBalancerInner getByResourceGroup(String resourceGroupName, String loadBalancerName) {
"""
Gets the specified load balancer.
@param resourceGroupName The name of the resource group.
@param loadBalancerName The name of the load balancer.
@throws IllegalArgumentException thrown if parameters fail the ... | java | public LoadBalancerInner getByResourceGroup(String resourceGroupName, String loadBalancerName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, loadBalancerName).toBlocking().single().body();
} | [
"public",
"LoadBalancerInner",
"getByResourceGroup",
"(",
"String",
"resourceGroupName",
",",
"String",
"loadBalancerName",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"loadBalancerName",
")",
".",
"toBlocking",
"(",
")",... | Gets the specified load balancer.
@param resourceGroupName The name of the resource group.
@param loadBalancerName The name of the load balancer.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all oth... | [
"Gets",
"the",
"specified",
"load",
"balancer",
"."
] | 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/LoadBalancersInner.java#L277-L279 |
samskivert/samskivert | src/main/java/com/samskivert/velocity/DispatcherServlet.java | DispatcherServlet.mergeTemplate | protected void mergeTemplate (Template template, InvocationContext context)
throws ResourceNotFoundException, ParseErrorException, MethodInvocationException,
UnsupportedEncodingException, IOException, Exception {
"""
Merges the template with the context.
@param template template object re... | java | protected void mergeTemplate (Template template, InvocationContext context)
throws ResourceNotFoundException, ParseErrorException, MethodInvocationException,
UnsupportedEncodingException, IOException, Exception
{
HttpServletResponse response = context.getResponse();
ServletOut... | [
"protected",
"void",
"mergeTemplate",
"(",
"Template",
"template",
",",
"InvocationContext",
"context",
")",
"throws",
"ResourceNotFoundException",
",",
"ParseErrorException",
",",
"MethodInvocationException",
",",
"UnsupportedEncodingException",
",",
"IOException",
",",
"E... | Merges the template with the context.
@param template template object returned by the {@link #handleRequest} method.
@param context the context for this request. | [
"Merges",
"the",
"template",
"with",
"the",
"context",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/velocity/DispatcherServlet.java#L523-L563 |
lightblueseas/vintage-time | src/main/java/de/alpharogroup/date/DateExtensions.java | DateExtensions.setDate | public static Date setDate(final @NonNull Date dateToSet, final int hour, final int minute,
final int second, final int milliSecond, final TimeZone zone, final Locale locale) {
"""
Returns a new {@link Date} object from the given Date object and sets the given parameters.
@param dateToSet
the date to set
@p... | java | public static Date setDate(final @NonNull Date dateToSet, final int hour, final int minute,
final int second, final int milliSecond, final TimeZone zone, final Locale locale)
{
return setDate(dateToSet, getYear(dateToSet), getMonth(dateToSet), getDay(dateToSet), hour,
minute, second, milliSecond, zone, locale);... | [
"public",
"static",
"Date",
"setDate",
"(",
"final",
"@",
"NonNull",
"Date",
"dateToSet",
",",
"final",
"int",
"hour",
",",
"final",
"int",
"minute",
",",
"final",
"int",
"second",
",",
"final",
"int",
"milliSecond",
",",
"final",
"TimeZone",
"zone",
",",
... | Returns a new {@link Date} object from the given Date object and sets the given parameters.
@param dateToSet
the date to set
@param hour
the hour
@param minute
the minute
@param second
the second
@param milliSecond
the mili second
@param zone
the zone
@param locale
the a locale
@return the date | [
"Returns",
"a",
"new",
"{",
"@link",
"Date",
"}",
"object",
"from",
"the",
"given",
"Date",
"object",
"and",
"sets",
"the",
"given",
"parameters",
"."
] | train | https://github.com/lightblueseas/vintage-time/blob/fbf201e679d9f9b92e7b5771f3eea1413cc2e113/src/main/java/de/alpharogroup/date/DateExtensions.java#L205-L210 |
cqframework/clinical_quality_language | Src/java/elm/src/main/java/org/cqframework/cql/elm/visiting/ElmBaseVisitor.java | ElmBaseVisitor.visitList | public T visitList(List elm, C context) {
"""
Visit a List. This method will be called for
every node in the tree that is a List.
@param elm the ELM tree
@param context the context passed to the visitor
@return the visitor result
"""
if (elm.getTypeSpecifier() != null) {
visitElem... | java | public T visitList(List elm, C context) {
if (elm.getTypeSpecifier() != null) {
visitElement(elm.getTypeSpecifier(), context);
}
for (Expression element : elm.getElement()) {
visitElement(element, context);
}
return null;
} | [
"public",
"T",
"visitList",
"(",
"List",
"elm",
",",
"C",
"context",
")",
"{",
"if",
"(",
"elm",
".",
"getTypeSpecifier",
"(",
")",
"!=",
"null",
")",
"{",
"visitElement",
"(",
"elm",
".",
"getTypeSpecifier",
"(",
")",
",",
"context",
")",
";",
"}",
... | Visit a List. This method will be called for
every node in the tree that is a List.
@param elm the ELM tree
@param context the context passed to the visitor
@return the visitor result | [
"Visit",
"a",
"List",
".",
"This",
"method",
"will",
"be",
"called",
"for",
"every",
"node",
"in",
"the",
"tree",
"that",
"is",
"a",
"List",
"."
] | train | https://github.com/cqframework/clinical_quality_language/blob/67459d1ef453e49db8d7c5c86e87278377ed0a0b/Src/java/elm/src/main/java/org/cqframework/cql/elm/visiting/ElmBaseVisitor.java#L535-L543 |
apache/groovy | src/main/groovy/groovy/lang/ExpandoMetaClass.java | ExpandoMetaClass.getProperty | public Object getProperty(Object object, String name) {
"""
Overrides default implementation just in case getProperty method has been overridden by ExpandoMetaClass
@see MetaClassImpl#getProperty(Object, String)
"""
if (hasOverrideGetProperty(name) && getJavaClass().isInstance(object)) {
... | java | public Object getProperty(Object object, String name) {
if (hasOverrideGetProperty(name) && getJavaClass().isInstance(object)) {
return getPropertyMethod.invoke(object, new Object[]{name});
}
return super.getProperty(object, name);
} | [
"public",
"Object",
"getProperty",
"(",
"Object",
"object",
",",
"String",
"name",
")",
"{",
"if",
"(",
"hasOverrideGetProperty",
"(",
"name",
")",
"&&",
"getJavaClass",
"(",
")",
".",
"isInstance",
"(",
"object",
")",
")",
"{",
"return",
"getPropertyMethod"... | Overrides default implementation just in case getProperty method has been overridden by ExpandoMetaClass
@see MetaClassImpl#getProperty(Object, String) | [
"Overrides",
"default",
"implementation",
"just",
"in",
"case",
"getProperty",
"method",
"has",
"been",
"overridden",
"by",
"ExpandoMetaClass"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/ExpandoMetaClass.java#L1163-L1168 |
osmdroid/osmdroid | osmdroid-android/src/main/java/org/osmdroid/util/PointReducer.java | PointReducer.orthogonalDistance | public static double orthogonalDistance(GeoPoint point, GeoPoint lineStart, GeoPoint lineEnd) {
"""
Calculate the orthogonal distance from the line joining the
lineStart and lineEnd points to point
@param point The point the distance is being calculated for
@param lineStart The point that starts the... | java | public static double orthogonalDistance(GeoPoint point, GeoPoint lineStart, GeoPoint lineEnd)
{
double area = Math.abs(
(
lineStart.getLatitude() * lineEnd.getLongitude()
+ lineEnd.getLatitude() * point.getLongitude()
+ point.getLatitude() ... | [
"public",
"static",
"double",
"orthogonalDistance",
"(",
"GeoPoint",
"point",
",",
"GeoPoint",
"lineStart",
",",
"GeoPoint",
"lineEnd",
")",
"{",
"double",
"area",
"=",
"Math",
".",
"abs",
"(",
"(",
"lineStart",
".",
"getLatitude",
"(",
")",
"*",
"lineEnd",
... | Calculate the orthogonal distance from the line joining the
lineStart and lineEnd points to point
@param point The point the distance is being calculated for
@param lineStart The point that starts the line
@param lineEnd The point that ends the line
@return The distance in points coordinate system | [
"Calculate",
"the",
"orthogonal",
"distance",
"from",
"the",
"line",
"joining",
"the",
"lineStart",
"and",
"lineEnd",
"points",
"to",
"point"
] | train | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/util/PointReducer.java#L134-L153 |
killbilling/recurly-java-library | src/main/java/com/ning/billing/recurly/RecurlyClient.java | RecurlyClient.postSubscriptionUsage | public Usage postSubscriptionUsage(final String subscriptionCode, final String addOnCode, final Usage usage) {
"""
Post usage to subscription
<p>
@param subscriptionCode The recurly id of the {@link Subscription }
@param addOnCode recurly id of {@link AddOn}
@param usage the usage to post on recurly
@return... | java | public Usage postSubscriptionUsage(final String subscriptionCode, final String addOnCode, final Usage usage) {
return doPOST(Subscription.SUBSCRIPTION_RESOURCE +
"/" +
subscriptionCode +
AddOn.ADDONS_RESOURCE +
"/" +... | [
"public",
"Usage",
"postSubscriptionUsage",
"(",
"final",
"String",
"subscriptionCode",
",",
"final",
"String",
"addOnCode",
",",
"final",
"Usage",
"usage",
")",
"{",
"return",
"doPOST",
"(",
"Subscription",
".",
"SUBSCRIPTION_RESOURCE",
"+",
"\"/\"",
"+",
"subscr... | Post usage to subscription
<p>
@param subscriptionCode The recurly id of the {@link Subscription }
@param addOnCode recurly id of {@link AddOn}
@param usage the usage to post on recurly
@return the {@link Usage} object as identified by the passed in object | [
"Post",
"usage",
"to",
"subscription",
"<p",
">"
] | train | https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L709-L718 |
facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/lib/MultipleOutputs.java | MultipleOutputs.isMultiNamedOutput | public static boolean isMultiNamedOutput(JobConf conf, String namedOutput) {
"""
Returns if a named output is multiple.
@param conf job conf
@param namedOutput named output
@return <code>true</code> if the name output is multi, <code>false</code>
if it is single. If the name output is not defined it r... | java | public static boolean isMultiNamedOutput(JobConf conf, String namedOutput) {
checkNamedOutput(conf, namedOutput, false);
return conf.getBoolean(MO_PREFIX + namedOutput + MULTI, false);
} | [
"public",
"static",
"boolean",
"isMultiNamedOutput",
"(",
"JobConf",
"conf",
",",
"String",
"namedOutput",
")",
"{",
"checkNamedOutput",
"(",
"conf",
",",
"namedOutput",
",",
"false",
")",
";",
"return",
"conf",
".",
"getBoolean",
"(",
"MO_PREFIX",
"+",
"named... | Returns if a named output is multiple.
@param conf job conf
@param namedOutput named output
@return <code>true</code> if the name output is multi, <code>false</code>
if it is single. If the name output is not defined it returns
<code>false</code> | [
"Returns",
"if",
"a",
"named",
"output",
"is",
"multiple",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/lib/MultipleOutputs.java#L223-L226 |
strator-dev/greenpepper | greenpepper/core/src/main/java/com/greenpepper/util/BOMUtil.java | BOMUtil.newReader | public static Reader newReader(File file, String encoding)
throws IOException {
"""
<p>newReader.</p>
@param file a {@link java.io.File} object.
@param encoding a {@link java.lang.String} object.
@return a {@link java.io.Reader} object.
@throws java.io.IOException if any.
"""
int bomT... | java | public static Reader newReader(File file, String encoding)
throws IOException
{
int bomType = getBOMType( file );
int skipBytes = getSkipBytes( bomType );
FileInputStream fIn = new FileInputStream( file );
long skippedBytes = fIn.skip( skipBytes );
return new Inpu... | [
"public",
"static",
"Reader",
"newReader",
"(",
"File",
"file",
",",
"String",
"encoding",
")",
"throws",
"IOException",
"{",
"int",
"bomType",
"=",
"getBOMType",
"(",
"file",
")",
";",
"int",
"skipBytes",
"=",
"getSkipBytes",
"(",
"bomType",
")",
";",
"Fi... | <p>newReader.</p>
@param file a {@link java.io.File} object.
@param encoding a {@link java.lang.String} object.
@return a {@link java.io.Reader} object.
@throws java.io.IOException if any. | [
"<p",
">",
"newReader",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/core/src/main/java/com/greenpepper/util/BOMUtil.java#L160-L168 |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/date/GosuDateUtil.java | GosuDateUtil.addSeconds | public static Date addSeconds(Date date, int iSeconds) {
"""
Adds the specified (signed) amount of seconds to the given date. For
example, to subtract 5 seconds from the current time of the date, you can
achieve it by calling: <code>addSeconds(Date, -5)</code>.
@param date The time.
@param iSeconds The a... | java | public static Date addSeconds(Date date, int iSeconds) {
Calendar dateTime = dateToCalendar(date);
dateTime.add(Calendar.SECOND, iSeconds);
return dateTime.getTime();
} | [
"public",
"static",
"Date",
"addSeconds",
"(",
"Date",
"date",
",",
"int",
"iSeconds",
")",
"{",
"Calendar",
"dateTime",
"=",
"dateToCalendar",
"(",
"date",
")",
";",
"dateTime",
".",
"add",
"(",
"Calendar",
".",
"SECOND",
",",
"iSeconds",
")",
";",
"ret... | Adds the specified (signed) amount of seconds to the given date. For
example, to subtract 5 seconds from the current time of the date, you can
achieve it by calling: <code>addSeconds(Date, -5)</code>.
@param date The time.
@param iSeconds The amount of seconds to add.
@return A new date with the seconds added. | [
"Adds",
"the",
"specified",
"(",
"signed",
")",
"amount",
"of",
"seconds",
"to",
"the",
"given",
"date",
".",
"For",
"example",
"to",
"subtract",
"5",
"seconds",
"from",
"the",
"current",
"time",
"of",
"the",
"date",
"you",
"can",
"achieve",
"it",
"by",
... | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/date/GosuDateUtil.java#L28-L32 |
tvesalainen/util | security/src/main/java/org/vesalainen/security/cert/X509Generator.java | X509Generator.generateCertificate | public X509Certificate generateCertificate(String subjectDN, String issuerDN, KeyPair pair, PrivateKey privkey, int days, String signingAlgorithm) throws CertificateException {
"""
Create a signed X.509 Certificate
@param subjectDN the X.509 Distinguished Name, eg "CN=Test, L=London, C=GB"
@param issuerDN Signer... | java | public X509Certificate generateCertificate(String subjectDN, String issuerDN, KeyPair pair, PrivateKey privkey, int days, String signingAlgorithm) throws CertificateException
{
if (privkey == null)
{
privkey = pair.getPrivate();
}
X500Name issuer;
if (issue... | [
"public",
"X509Certificate",
"generateCertificate",
"(",
"String",
"subjectDN",
",",
"String",
"issuerDN",
",",
"KeyPair",
"pair",
",",
"PrivateKey",
"privkey",
",",
"int",
"days",
",",
"String",
"signingAlgorithm",
")",
"throws",
"CertificateException",
"{",
"if",
... | Create a signed X.509 Certificate
@param subjectDN the X.509 Distinguished Name, eg "CN=Test, L=London, C=GB"
@param issuerDN Signers X.509 Distinguished Name, eg "CN=Test, L=London, C=GB"
@param pair the KeyPair
@param privkey Signers private key
@param days how many days from now the Certificate is valid for
@param s... | [
"Create",
"a",
"signed",
"X",
".",
"509",
"Certificate"
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/security/src/main/java/org/vesalainen/security/cert/X509Generator.java#L73-L104 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UCharacterName.java | UCharacterName.setGroupCountSize | boolean setGroupCountSize(int count, int size) {
"""
Sets the number of group and size of each group in number of char
@param count number of groups
@param size size of group in char
@return true if group size is set correctly
"""
if (count <= 0 || size <= 0) {
return false;
}
... | java | boolean setGroupCountSize(int count, int size)
{
if (count <= 0 || size <= 0) {
return false;
}
m_groupcount_ = count;
m_groupsize_ = size;
return true;
} | [
"boolean",
"setGroupCountSize",
"(",
"int",
"count",
",",
"int",
"size",
")",
"{",
"if",
"(",
"count",
"<=",
"0",
"||",
"size",
"<=",
"0",
")",
"{",
"return",
"false",
";",
"}",
"m_groupcount_",
"=",
"count",
";",
"m_groupsize_",
"=",
"size",
";",
"r... | Sets the number of group and size of each group in number of char
@param count number of groups
@param size size of group in char
@return true if group size is set correctly | [
"Sets",
"the",
"number",
"of",
"group",
"and",
"size",
"of",
"each",
"group",
"in",
"number",
"of",
"char"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UCharacterName.java#L996-L1004 |
cdk/cdk | legacy/src/main/java/org/openscience/cdk/geometry/GeometryTools.java | GeometryTools.getClosestAtom | public static IAtom getClosestAtom(int xPosition, int yPosition, IAtomContainer atomCon) {
"""
Returns the atom of the given molecule that is closest to the given
coordinates.
See comment for center(IAtomContainer atomCon, Dimension areaDim, HashMap renderingCoordinates) for details on coordinate sets
@param ... | java | public static IAtom getClosestAtom(int xPosition, int yPosition, IAtomContainer atomCon) {
IAtom closestAtom = null;
IAtom currentAtom;
double smallestMouseDistance = -1;
double mouseDistance;
double atomX;
double atomY;
for (int i = 0; i < atomCon.getAtomCount();... | [
"public",
"static",
"IAtom",
"getClosestAtom",
"(",
"int",
"xPosition",
",",
"int",
"yPosition",
",",
"IAtomContainer",
"atomCon",
")",
"{",
"IAtom",
"closestAtom",
"=",
"null",
";",
"IAtom",
"currentAtom",
";",
"double",
"smallestMouseDistance",
"=",
"-",
"1",
... | Returns the atom of the given molecule that is closest to the given
coordinates.
See comment for center(IAtomContainer atomCon, Dimension areaDim, HashMap renderingCoordinates) for details on coordinate sets
@param xPosition The x coordinate
@param yPosition The y coordinate
@param atomCon The molecule that is... | [
"Returns",
"the",
"atom",
"of",
"the",
"given",
"molecule",
"that",
"is",
"closest",
"to",
"the",
"given",
"coordinates",
".",
"See",
"comment",
"for",
"center",
"(",
"IAtomContainer",
"atomCon",
"Dimension",
"areaDim",
"HashMap",
"renderingCoordinates",
")",
"f... | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/geometry/GeometryTools.java#L679-L697 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/orders/DigitalPackageUrl.java | DigitalPackageUrl.getAvailableDigitalPackageFulfillmentActionsUrl | public static MozuUrl getAvailableDigitalPackageFulfillmentActionsUrl(String digitalPackageId, String orderId) {
"""
Get Resource Url for GetAvailableDigitalPackageFulfillmentActions
@param digitalPackageId This parameter supplies package ID to get fulfillment actions for the digital package.
@param orderId Uniq... | java | public static MozuUrl getAvailableDigitalPackageFulfillmentActionsUrl(String digitalPackageId, String orderId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/orders/{orderId}/digitalpackages/{digitalPackageId}/actions");
formatter.formatUrl("digitalPackageId", digitalPackageId);
formatter.formatU... | [
"public",
"static",
"MozuUrl",
"getAvailableDigitalPackageFulfillmentActionsUrl",
"(",
"String",
"digitalPackageId",
",",
"String",
"orderId",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/orders/{orderId}/digitalpackages/{digitalPackage... | Get Resource Url for GetAvailableDigitalPackageFulfillmentActions
@param digitalPackageId This parameter supplies package ID to get fulfillment actions for the digital package.
@param orderId Unique identifier of the order.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"GetAvailableDigitalPackageFulfillmentActions"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/orders/DigitalPackageUrl.java#L22-L28 |
voldemort/voldemort | src/java/voldemort/client/ClientConfig.java | ClientConfig.setIdleConnectionTimeout | public ClientConfig setIdleConnectionTimeout(long idleConnectionTimeout, TimeUnit unit) {
"""
Set the timeout for idle connections. Voldemort client caches all
connections to the Voldemort server. This setting allows the a connection
to be dropped, if it is idle for more than this time.
This could be useful i... | java | public ClientConfig setIdleConnectionTimeout(long idleConnectionTimeout, TimeUnit unit) {
if (idleConnectionTimeout <= 0) {
this.idleConnectionTimeoutMs = -1;
} else {
if(unit.toMinutes(idleConnectionTimeout) < 10) {
throw new IllegalArgumentException("idleConnect... | [
"public",
"ClientConfig",
"setIdleConnectionTimeout",
"(",
"long",
"idleConnectionTimeout",
",",
"TimeUnit",
"unit",
")",
"{",
"if",
"(",
"idleConnectionTimeout",
"<=",
"0",
")",
"{",
"this",
".",
"idleConnectionTimeoutMs",
"=",
"-",
"1",
";",
"}",
"else",
"{",
... | Set the timeout for idle connections. Voldemort client caches all
connections to the Voldemort server. This setting allows the a connection
to be dropped, if it is idle for more than this time.
This could be useful in the following cases 1) Voldemort client is not
directly connected to the server and is connected via ... | [
"Set",
"the",
"timeout",
"for",
"idle",
"connections",
".",
"Voldemort",
"client",
"caches",
"all",
"connections",
"to",
"the",
"Voldemort",
"server",
".",
"This",
"setting",
"allows",
"the",
"a",
"connection",
"to",
"be",
"dropped",
"if",
"it",
"is",
"idle"... | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/client/ClientConfig.java#L617-L627 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUResourceBundle.java | ICUResourceBundle.getWithFallback | public ICUResourceBundle getWithFallback(String path) throws MissingResourceException {
"""
This method performs multilevel fallback for fetching items from the
bundle e.g: If resource is in the form de__PHONEBOOK{ collations{
default{ "phonebook"} } } If the value of "default" key needs to be
accessed, then do... | java | public ICUResourceBundle getWithFallback(String path) throws MissingResourceException {
ICUResourceBundle actualBundle = this;
// now recurse to pick up sub levels of the items
ICUResourceBundle result = findResourceWithFallback(path, actualBundle, null);
if (result == null) {
... | [
"public",
"ICUResourceBundle",
"getWithFallback",
"(",
"String",
"path",
")",
"throws",
"MissingResourceException",
"{",
"ICUResourceBundle",
"actualBundle",
"=",
"this",
";",
"// now recurse to pick up sub levels of the items",
"ICUResourceBundle",
"result",
"=",
"findResource... | This method performs multilevel fallback for fetching items from the
bundle e.g: If resource is in the form de__PHONEBOOK{ collations{
default{ "phonebook"} } } If the value of "default" key needs to be
accessed, then do: <code>
UResourceBundle bundle = UResourceBundle.getBundleInstance("de__PHONEBOOK");
ICUResourceBun... | [
"This",
"method",
"performs",
"multilevel",
"fallback",
"for",
"fetching",
"items",
"from",
"the",
"bundle",
"e",
".",
"g",
":",
"If",
"resource",
"is",
"in",
"the",
"form",
"de__PHONEBOOK",
"{",
"collations",
"{",
"default",
"{",
"phonebook",
"}",
"}",
"}... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUResourceBundle.java#L297-L315 |
greatman/craftconomy3 | src/main/java/com/greatmancode/craftconomy3/account/AccountManager.java | AccountManager.getAccount | public Account getAccount(String name, boolean bankAccount) {
"""
Retrieve a account. Accounts prefixed with bank: are bank accounts.
@param name The name of the account to retrieve
@param bankAccount If the account is a bank account
@return A economy account
"""
String newName = name;
if ... | java | public Account getAccount(String name, boolean bankAccount) {
String newName = name;
if (!Common.getInstance().getMainConfig().getBoolean("System.Case-sentitive")) {
newName = name.toLowerCase();
}
Account account;
if (bankAccount && bankList.containsKey(newName)) {
... | [
"public",
"Account",
"getAccount",
"(",
"String",
"name",
",",
"boolean",
"bankAccount",
")",
"{",
"String",
"newName",
"=",
"name",
";",
"if",
"(",
"!",
"Common",
".",
"getInstance",
"(",
")",
".",
"getMainConfig",
"(",
")",
".",
"getBoolean",
"(",
"\"S... | Retrieve a account. Accounts prefixed with bank: are bank accounts.
@param name The name of the account to retrieve
@param bankAccount If the account is a bank account
@return A economy account | [
"Retrieve",
"a",
"account",
".",
"Accounts",
"prefixed",
"with",
"bank",
":",
"are",
"bank",
"accounts",
"."
] | train | https://github.com/greatman/craftconomy3/blob/51b1b3de7d039e20c7418d1e70b8c4b02b8cf840/src/main/java/com/greatmancode/craftconomy3/account/AccountManager.java#L43-L62 |
dmerkushov/os-helper | src/main/java/ru/dmerkushov/oshelper/OSHelper.java | OSHelper.sendEmail_Unix | public static ProcessReturn sendEmail_Unix (String target, String topic, String text) throws OSHelperException {
"""
Send a simple email
@param target
@param topic
@param text
@return The ProcessReturn structure of the mailing process. Normal are
empty <code>stdout</code> and <code>stderr</code>, 0 * for ... | java | public static ProcessReturn sendEmail_Unix (String target, String topic, String text) throws OSHelperException {
topic = topic.replaceAll ("\"", "\\\"");
String emailCommandAsString = "mail -s \"" + topic + "\" -S sendcharsets=utf-8 " + target;
List<String> emailCommandAsList = OSHelper.constructCommandAsList_Uni... | [
"public",
"static",
"ProcessReturn",
"sendEmail_Unix",
"(",
"String",
"target",
",",
"String",
"topic",
",",
"String",
"text",
")",
"throws",
"OSHelperException",
"{",
"topic",
"=",
"topic",
".",
"replaceAll",
"(",
"\"\\\"\"",
",",
"\"\\\\\\\"\"",
")",
";",
"S... | Send a simple email
@param target
@param topic
@param text
@return The ProcessReturn structure of the mailing process. Normal are
empty <code>stdout</code> and <code>stderr</code>, 0 * for <code>exitCode</code>
and <code>osh_PROCESS_EXITED_BY_ITSELF</code> for <code>exitStatus</code>
@see ProcessReturn | [
"Send",
"a",
"simple",
"email"
] | train | https://github.com/dmerkushov/os-helper/blob/a7c2b72d289d9bc23ae106d1c5e11769cf3463d6/src/main/java/ru/dmerkushov/oshelper/OSHelper.java#L362-L380 |
nguyenq/tess4j | src/main/java/net/sourceforge/tess4j/Tesseract1.java | Tesseract1.createDocuments | private int createDocuments(String filename, TessResultRenderer renderer) throws TesseractException {
"""
Creates documents.
@param filename input file
@param renderer renderer
@throws TesseractException
@return the average text confidence for Tesseract page result
"""
TessBaseAPISetInputName(han... | java | private int createDocuments(String filename, TessResultRenderer renderer) throws TesseractException {
TessBaseAPISetInputName(handle, filename); //for reading a UNLV zone file
int result = TessBaseAPIProcessPages(handle, filename, null, 0, renderer);
// if (result == ITessAPI.FALSE) {
// ... | [
"private",
"int",
"createDocuments",
"(",
"String",
"filename",
",",
"TessResultRenderer",
"renderer",
")",
"throws",
"TesseractException",
"{",
"TessBaseAPISetInputName",
"(",
"handle",
",",
"filename",
")",
";",
"//for reading a UNLV zone file",
"int",
"result",
"=",
... | Creates documents.
@param filename input file
@param renderer renderer
@throws TesseractException
@return the average text confidence for Tesseract page result | [
"Creates",
"documents",
"."
] | train | https://github.com/nguyenq/tess4j/blob/cfcd4a8a44042f150b4aaf7bdf5ffc485a2236e1/src/main/java/net/sourceforge/tess4j/Tesseract1.java#L636-L644 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/convolution/ConvolutionLayer.java | ConvolutionLayer.preOutput4d | protected Pair<INDArray, INDArray> preOutput4d(boolean training, boolean forBackprop, LayerWorkspaceMgr workspaceMgr) {
"""
preOutput4d: Used so that ConvolutionLayer subclasses (such as Convolution1DLayer) can maintain their standard
non-4d preOutput method, while overriding this to return 4d activations (for us... | java | protected Pair<INDArray, INDArray> preOutput4d(boolean training, boolean forBackprop, LayerWorkspaceMgr workspaceMgr) {
return preOutput(training, forBackprop, workspaceMgr);
} | [
"protected",
"Pair",
"<",
"INDArray",
",",
"INDArray",
">",
"preOutput4d",
"(",
"boolean",
"training",
",",
"boolean",
"forBackprop",
",",
"LayerWorkspaceMgr",
"workspaceMgr",
")",
"{",
"return",
"preOutput",
"(",
"training",
",",
"forBackprop",
",",
"workspaceMgr... | preOutput4d: Used so that ConvolutionLayer subclasses (such as Convolution1DLayer) can maintain their standard
non-4d preOutput method, while overriding this to return 4d activations (for use in backprop) without modifying
the public API | [
"preOutput4d",
":",
"Used",
"so",
"that",
"ConvolutionLayer",
"subclasses",
"(",
"such",
"as",
"Convolution1DLayer",
")",
"can",
"maintain",
"their",
"standard",
"non",
"-",
"4d",
"preOutput",
"method",
"while",
"overriding",
"this",
"to",
"return",
"4d",
"activ... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/convolution/ConvolutionLayer.java#L259-L261 |
sdl/odata | odata_renderer/src/main/java/com/sdl/odata/unmarshaller/json/core/JsonNullableValidator.java | JsonNullableValidator.ensureNavigationProperties | public void ensureNavigationProperties(StructuredType entityType) throws ODataException {
"""
Ensure that non nullable navigation properties are present.
@param entityType entityType
@throws ODataException If unable to ensure navigation properties are present
"""
List<String> missingNavigationPrope... | java | public void ensureNavigationProperties(StructuredType entityType) throws ODataException {
List<String> missingNavigationPropertyNames = new ArrayList<>();
entityType.getStructuralProperties().stream().filter(property -> (property instanceof NavigationProperty)
&& !property.isNullable())... | [
"public",
"void",
"ensureNavigationProperties",
"(",
"StructuredType",
"entityType",
")",
"throws",
"ODataException",
"{",
"List",
"<",
"String",
">",
"missingNavigationPropertyNames",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"entityType",
".",
"getStructuralProp... | Ensure that non nullable navigation properties are present.
@param entityType entityType
@throws ODataException If unable to ensure navigation properties are present | [
"Ensure",
"that",
"non",
"nullable",
"navigation",
"properties",
"are",
"present",
"."
] | train | https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_renderer/src/main/java/com/sdl/odata/unmarshaller/json/core/JsonNullableValidator.java#L78-L94 |
nguyenq/tess4j | src/main/java/net/sourceforge/tess4j/util/ImageIOHelper.java | ImageIOHelper.mergeTiff | public static void mergeTiff(BufferedImage[] inputImages, File outputTiff, String compressionType) throws IOException {
"""
Merges multiple images into one multi-page TIFF image.
@param inputImages an array of <code>BufferedImage</code>
@param outputTiff the output TIFF file
@param compressionType valid value... | java | public static void mergeTiff(BufferedImage[] inputImages, File outputTiff, String compressionType) throws IOException {
List<IIOImage> imageList = new ArrayList<IIOImage>();
for (BufferedImage inputImage : inputImages) {
imageList.add(new IIOImage(inputImage, null, null));
}
... | [
"public",
"static",
"void",
"mergeTiff",
"(",
"BufferedImage",
"[",
"]",
"inputImages",
",",
"File",
"outputTiff",
",",
"String",
"compressionType",
")",
"throws",
"IOException",
"{",
"List",
"<",
"IIOImage",
">",
"imageList",
"=",
"new",
"ArrayList",
"<",
"II... | Merges multiple images into one multi-page TIFF image.
@param inputImages an array of <code>BufferedImage</code>
@param outputTiff the output TIFF file
@param compressionType valid values: LZW, CCITT T.6, PackBits
@throws IOException | [
"Merges",
"multiple",
"images",
"into",
"one",
"multi",
"-",
"page",
"TIFF",
"image",
"."
] | train | https://github.com/nguyenq/tess4j/blob/cfcd4a8a44042f150b4aaf7bdf5ffc485a2236e1/src/main/java/net/sourceforge/tess4j/util/ImageIOHelper.java#L517-L525 |
google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/ext/Attributes2Impl.java | Attributes2Impl.setDeclared | public void setDeclared (int index, boolean value) {
"""
Assign a value to the "declared" flag of a specific attribute.
This is normally needed only for attributes of type CDATA,
including attributes whose type is changed to or from CDATA.
@param index The index of the attribute (zero-based).
@param value Th... | java | public void setDeclared (int index, boolean value)
{
if (index < 0 || index >= getLength ())
throw new ArrayIndexOutOfBoundsException (
"No attribute at index: " + index);
declared [index] = value;
} | [
"public",
"void",
"setDeclared",
"(",
"int",
"index",
",",
"boolean",
"value",
")",
"{",
"if",
"(",
"index",
"<",
"0",
"||",
"index",
">=",
"getLength",
"(",
")",
")",
"throw",
"new",
"ArrayIndexOutOfBoundsException",
"(",
"\"No attribute at index: \"",
"+",
... | Assign a value to the "declared" flag of a specific attribute.
This is normally needed only for attributes of type CDATA,
including attributes whose type is changed to or from CDATA.
@param index The index of the attribute (zero-based).
@param value The desired flag value.
@exception java.lang.ArrayIndexOutOfBoundsExc... | [
"Assign",
"a",
"value",
"to",
"the",
"declared",
"flag",
"of",
"a",
"specific",
"attribute",
".",
"This",
"is",
"normally",
"needed",
"only",
"for",
"attributes",
"of",
"type",
"CDATA",
"including",
"attributes",
"whose",
"type",
"is",
"changed",
"to",
"or",... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/ext/Attributes2Impl.java#L288-L294 |
molgenis/molgenis | molgenis-data-import/src/main/java/org/molgenis/data/importer/MyEntitiesValidationReport.java | MyEntitiesValidationReport.addEntity | public MyEntitiesValidationReport addEntity(String entityTypeId, boolean importable) {
"""
Creates a new report, with an entity added to it.
@param entityTypeId name of the entity
@param importable true if the entity is importable
@return this report
"""
sheetsImportable.put(entityTypeId, importable);... | java | public MyEntitiesValidationReport addEntity(String entityTypeId, boolean importable) {
sheetsImportable.put(entityTypeId, importable);
valid = valid && importable;
if (importable) {
fieldsImportable.put(entityTypeId, new ArrayList<>());
fieldsUnknown.put(entityTypeId, new ArrayList<>());
f... | [
"public",
"MyEntitiesValidationReport",
"addEntity",
"(",
"String",
"entityTypeId",
",",
"boolean",
"importable",
")",
"{",
"sheetsImportable",
".",
"put",
"(",
"entityTypeId",
",",
"importable",
")",
";",
"valid",
"=",
"valid",
"&&",
"importable",
";",
"if",
"(... | Creates a new report, with an entity added to it.
@param entityTypeId name of the entity
@param importable true if the entity is importable
@return this report | [
"Creates",
"a",
"new",
"report",
"with",
"an",
"entity",
"added",
"to",
"it",
"."
] | train | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-import/src/main/java/org/molgenis/data/importer/MyEntitiesValidationReport.java#L54-L65 |
overturetool/overture | ide/debug/src/main/java/org/overture/ide/debug/utils/CharOperation.java | CharOperation.occurencesOf | public static final int occurencesOf(char toBeFound, char[] array) {
"""
Answers the number of occurrences of the given character in the given array, 0 if any. <br>
<br>
For example:
<ol>
<li>
<pre>
toBeFound = 'b'
array = { 'a' , 'b', 'b', 'a', 'b', 'a' }
result => 3
</pre>
</li>
<li>
<pre>
... | java | public static final int occurencesOf(char toBeFound, char[] array)
{
int count = 0;
for (int i = 0; i < array.length; i++)
{
if (toBeFound == array[i])
{
count++;
}
}
return count;
} | [
"public",
"static",
"final",
"int",
"occurencesOf",
"(",
"char",
"toBeFound",
",",
"char",
"[",
"]",
"array",
")",
"{",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"array",
".",
"length",
";",
"i",
"++",
")",
... | Answers the number of occurrences of the given character in the given array, 0 if any. <br>
<br>
For example:
<ol>
<li>
<pre>
toBeFound = 'b'
array = { 'a' , 'b', 'b', 'a', 'b', 'a' }
result => 3
</pre>
</li>
<li>
<pre>
toBeFound = 'c'
array = { 'a' , 'b', 'b', 'a', 'b', 'a' }
result => 0
</pre>
</li>
</ol>
... | [
"Answers",
"the",
"number",
"of",
"occurrences",
"of",
"the",
"given",
"character",
"in",
"the",
"given",
"array",
"0",
"if",
"any",
".",
"<br",
">",
"<br",
">",
"For",
"example",
":",
"<ol",
">",
"<li",
">"
] | train | https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/ide/debug/src/main/java/org/overture/ide/debug/utils/CharOperation.java#L3052-L3063 |
intendia-oss/rxjava-gwt | src/main/modified/io/reactivex/super/io/reactivex/Completable.java | Completable.doFinally | @CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public final Completable doFinally(Action onFinally) {
"""
Calls the specified action after this Completable signals onError or onComplete or gets disposed by
the downstream.
<p>
<img width="640" height="331" src="https://raw.github.com/wiki/Rea... | java | @CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public final Completable doFinally(Action onFinally) {
ObjectHelper.requireNonNull(onFinally, "onFinally is null");
return RxJavaPlugins.onAssembly(new CompletableDoFinally(this, onFinally));
} | [
"@",
"CheckReturnValue",
"@",
"SchedulerSupport",
"(",
"SchedulerSupport",
".",
"NONE",
")",
"public",
"final",
"Completable",
"doFinally",
"(",
"Action",
"onFinally",
")",
"{",
"ObjectHelper",
".",
"requireNonNull",
"(",
"onFinally",
",",
"\"onFinally is null\"",
"... | Calls the specified action after this Completable signals onError or onComplete or gets disposed by
the downstream.
<p>
<img width="640" height="331" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Completable.doFinally.png" alt="">
<p>
In case of a race between a terminal event and a dispose call... | [
"Calls",
"the",
"specified",
"action",
"after",
"this",
"Completable",
"signals",
"onError",
"or",
"onComplete",
"or",
"gets",
"disposed",
"by",
"the",
"downstream",
".",
"<p",
">",
"<img",
"width",
"=",
"640",
"height",
"=",
"331",
"src",
"=",
"https",
":... | train | https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Completable.java#L1592-L1597 |
negusoft/holoaccent | HoloAccent/src/com/negusoft/holoaccent/widget/AccentSwitch.java | AccentSwitch.setSwitchTextAppearance | public void setSwitchTextAppearance(Context context, int resid) {
"""
Sets the switch text color, size, style, hint color, and highlight color
from the specified TextAppearance resource.
@attr ref android.R.styleable#Switch_switchTextAppearance
"""
TypedArray appearance = context.obtainStyledAttributes(r... | java | public void setSwitchTextAppearance(Context context, int resid) {
TypedArray appearance = context.obtainStyledAttributes(resid,
R.styleable.TextAppearanceAccentSwitch);
ColorStateList colors;
int ts;
colors = appearance
.getColorStateList(R.styleable.TextAppearanceAccentSwitch_android_textColor);
if... | [
"public",
"void",
"setSwitchTextAppearance",
"(",
"Context",
"context",
",",
"int",
"resid",
")",
"{",
"TypedArray",
"appearance",
"=",
"context",
".",
"obtainStyledAttributes",
"(",
"resid",
",",
"R",
".",
"styleable",
".",
"TextAppearanceAccentSwitch",
")",
";",... | Sets the switch text color, size, style, hint color, and highlight color
from the specified TextAppearance resource.
@attr ref android.R.styleable#Switch_switchTextAppearance | [
"Sets",
"the",
"switch",
"text",
"color",
"size",
"style",
"hint",
"color",
"and",
"highlight",
"color",
"from",
"the",
"specified",
"TextAppearance",
"resource",
"."
] | train | https://github.com/negusoft/holoaccent/blob/7121a02dde94834e770cb81174d0bdc596323324/HoloAccent/src/com/negusoft/holoaccent/widget/AccentSwitch.java#L255-L301 |
ZieIony/Carbon | carbon/src/main/java/carbon/shadow/ShadowRenderer.java | ShadowRenderer.drawEdgeShadow | public void drawEdgeShadow(Canvas canvas, Matrix transform, RectF bounds, int elevation) {
"""
Draws an edge shadow on the canvas in the current bounds with the matrix transform applied.
"""
bounds.bottom += elevation;
bounds.offset(0, -elevation);
edgeColors[0] = shadowEndColor;
... | java | public void drawEdgeShadow(Canvas canvas, Matrix transform, RectF bounds, int elevation) {
bounds.bottom += elevation;
bounds.offset(0, -elevation);
edgeColors[0] = shadowEndColor;
edgeColors[1] = shadowMiddleColor;
edgeColors[2] = shadowStartColor;
edgeShadowPaint.setS... | [
"public",
"void",
"drawEdgeShadow",
"(",
"Canvas",
"canvas",
",",
"Matrix",
"transform",
",",
"RectF",
"bounds",
",",
"int",
"elevation",
")",
"{",
"bounds",
".",
"bottom",
"+=",
"elevation",
";",
"bounds",
".",
"offset",
"(",
"0",
",",
"-",
"elevation",
... | Draws an edge shadow on the canvas in the current bounds with the matrix transform applied. | [
"Draws",
"an",
"edge",
"shadow",
"on",
"the",
"canvas",
"in",
"the",
"current",
"bounds",
"with",
"the",
"matrix",
"transform",
"applied",
"."
] | train | https://github.com/ZieIony/Carbon/blob/78b0a432bd49edc7a6a13ce111cab274085d1693/carbon/src/main/java/carbon/shadow/ShadowRenderer.java#L100-L122 |
googleapis/cloud-bigtable-client | bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/io/OAuthCredentialsCache.java | OAuthCredentialsCache.getHeaderUnsafe | @VisibleForTesting
HeaderCacheElement getHeaderUnsafe(long timeout, TimeUnit timeUnit) {
"""
Get the http credential header we need from a new oauth2 AccessToken.
"""
// Optimize for the common case: do a volatile read to peek for a Good cache value
HeaderCacheElement headerCacheUnsync = this.headerC... | java | @VisibleForTesting
HeaderCacheElement getHeaderUnsafe(long timeout, TimeUnit timeUnit) {
// Optimize for the common case: do a volatile read to peek for a Good cache value
HeaderCacheElement headerCacheUnsync = this.headerCache;
// TODO(igorbernstein2): figure out how to make this work with appengine req... | [
"@",
"VisibleForTesting",
"HeaderCacheElement",
"getHeaderUnsafe",
"(",
"long",
"timeout",
",",
"TimeUnit",
"timeUnit",
")",
"{",
"// Optimize for the common case: do a volatile read to peek for a Good cache value",
"HeaderCacheElement",
"headerCacheUnsync",
"=",
"this",
".",
"he... | Get the http credential header we need from a new oauth2 AccessToken. | [
"Get",
"the",
"http",
"credential",
"header",
"we",
"need",
"from",
"a",
"new",
"oauth2",
"AccessToken",
"."
] | train | https://github.com/googleapis/cloud-bigtable-client/blob/53543f36e4d6f9ed1963640d91a35be2a2047656/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/io/OAuthCredentialsCache.java#L203-L226 |
deeplearning4j/deeplearning4j | datavec/datavec-spark/src/main/java/org/datavec/spark/transform/utils/SparkUtils.java | SparkUtils.readObjectFromFile | public static <T> T readObjectFromFile(String path, Class<T> type, SparkContext sc) throws IOException {
"""
Read an object from HDFS (or local) using default Java object serialization
@param path File to read
@param type Class of the object to read
@param sc Spark context
@param <T> Type of t... | java | public static <T> T readObjectFromFile(String path, Class<T> type, SparkContext sc) throws IOException {
return readObjectFromFile(path, type, sc.hadoopConfiguration());
} | [
"public",
"static",
"<",
"T",
">",
"T",
"readObjectFromFile",
"(",
"String",
"path",
",",
"Class",
"<",
"T",
">",
"type",
",",
"SparkContext",
"sc",
")",
"throws",
"IOException",
"{",
"return",
"readObjectFromFile",
"(",
"path",
",",
"type",
",",
"sc",
"... | Read an object from HDFS (or local) using default Java object serialization
@param path File to read
@param type Class of the object to read
@param sc Spark context
@param <T> Type of the object to read | [
"Read",
"an",
"object",
"from",
"HDFS",
"(",
"or",
"local",
")",
"using",
"default",
"Java",
"object",
"serialization"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark/src/main/java/org/datavec/spark/transform/utils/SparkUtils.java#L194-L196 |
Impetus/Kundera | src/jpa-engine/fallback-impl/src/main/java/com/impetus/kundera/index/DocumentIndexer.java | DocumentIndexer.prepareDocumentForSuperColumn | protected Document prepareDocumentForSuperColumn(EntityMetadata metadata, Object object, String embeddedColumnName,
String parentId, Class<?> clazz) {
"""
Prepare document.
@param metadata
the metadata
@param object
the object
@param embeddedColumnName
the super column name
@param parentId
the pa... | java | protected Document prepareDocumentForSuperColumn(EntityMetadata metadata, Object object, String embeddedColumnName,
String parentId, Class<?> clazz) {
Document currentDoc;
currentDoc = new Document();
// Add entity class and row key info to document
addEntityClassToDocument(meta... | [
"protected",
"Document",
"prepareDocumentForSuperColumn",
"(",
"EntityMetadata",
"metadata",
",",
"Object",
"object",
",",
"String",
"embeddedColumnName",
",",
"String",
"parentId",
",",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"Document",
"currentDoc",
";",
"cu... | Prepare document.
@param metadata
the metadata
@param object
the object
@param embeddedColumnName
the super column name
@param parentId
the parent id
@param clazz
the clazz
@return the document | [
"Prepare",
"document",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/fallback-impl/src/main/java/com/impetus/kundera/index/DocumentIndexer.java#L115-L128 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/Row.java | Row.getCells | public List<RowCell> getCells(@Nonnull String family, @Nonnull String qualifier) {
"""
Returns a sublist of the cells that belong to the specified family and qualifier.
@see RowCell#compareByNative() For details about the ordering.
"""
Preconditions.checkNotNull(family, "family");
Preconditions.chec... | java | public List<RowCell> getCells(@Nonnull String family, @Nonnull String qualifier) {
Preconditions.checkNotNull(family, "family");
Preconditions.checkNotNull(qualifier, "qualifier");
return getCells(family, ByteString.copyFromUtf8(qualifier));
} | [
"public",
"List",
"<",
"RowCell",
">",
"getCells",
"(",
"@",
"Nonnull",
"String",
"family",
",",
"@",
"Nonnull",
"String",
"qualifier",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"family",
",",
"\"family\"",
")",
";",
"Preconditions",
".",
"checkNo... | Returns a sublist of the cells that belong to the specified family and qualifier.
@see RowCell#compareByNative() For details about the ordering. | [
"Returns",
"a",
"sublist",
"of",
"the",
"cells",
"that",
"belong",
"to",
"the",
"specified",
"family",
"and",
"qualifier",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/Row.java#L93-L98 |
seam/faces | impl/src/main/java/org/jboss/seam/faces/security/SecurityPhaseListener.java | SecurityPhaseListener.observePreNavigateEvent | public void observePreNavigateEvent(@Observes PreNavigateEvent event) {
"""
Monitor PreNavigationEvents, looking for a successful navigation from the Seam Security login button. When such a
navigation is encountered, redirect to the the viewId captured before the login redirect was triggered.
@param event
... | java | public void observePreNavigateEvent(@Observes PreNavigateEvent event) {
log.debugf("PreNavigateEvent observed %s, %s", event.getOutcome(), event.getFromAction());
if (Identity.RESPONSE_LOGIN_SUCCESS.equals(event.getOutcome())
&& "#{identity.login}".equals(event.getFromAction())) {
... | [
"public",
"void",
"observePreNavigateEvent",
"(",
"@",
"Observes",
"PreNavigateEvent",
"event",
")",
"{",
"log",
".",
"debugf",
"(",
"\"PreNavigateEvent observed %s, %s\"",
",",
"event",
".",
"getOutcome",
"(",
")",
",",
"event",
".",
"getFromAction",
"(",
")",
... | Monitor PreNavigationEvents, looking for a successful navigation from the Seam Security login button. When such a
navigation is encountered, redirect to the the viewId captured before the login redirect was triggered.
@param event | [
"Monitor",
"PreNavigationEvents",
"looking",
"for",
"a",
"successful",
"navigation",
"from",
"the",
"Seam",
"Security",
"login",
"button",
".",
"When",
"such",
"a",
"navigation",
"is",
"encountered",
"redirect",
"to",
"the",
"the",
"viewId",
"captured",
"before",
... | train | https://github.com/seam/faces/blob/2fdedbc7070318c2c58bfffb8a26f1ea1d0ee1e3/impl/src/main/java/org/jboss/seam/faces/security/SecurityPhaseListener.java#L355-L363 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.