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
sequencelengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
sequencelengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
foundation-runtime/service-directory | 2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/connect/DirectoryConnection.java | DirectoryConnection.submitAsyncRequest | public ServiceDirectoryFuture submitAsyncRequest(ProtocolHeader h, Protocol request, WatcherRegistration wr) {
"""
Submit a Request in asynchronizing, it return a Future for the
Request Response.
@param h
the ProtocolHeader.
@param request
the Protocol.
@param wr
the WatcherRegistration of the Service.
@return
the Future.
"""
ServiceDirectoryFuture future = new ServiceDirectoryFuture();
queuePacket(h, request, null, null, future, wr);
return future;
} | java | public ServiceDirectoryFuture submitAsyncRequest(ProtocolHeader h, Protocol request, WatcherRegistration wr){
ServiceDirectoryFuture future = new ServiceDirectoryFuture();
queuePacket(h, request, null, null, future, wr);
return future;
} | [
"public",
"ServiceDirectoryFuture",
"submitAsyncRequest",
"(",
"ProtocolHeader",
"h",
",",
"Protocol",
"request",
",",
"WatcherRegistration",
"wr",
")",
"{",
"ServiceDirectoryFuture",
"future",
"=",
"new",
"ServiceDirectoryFuture",
"(",
")",
";",
"queuePacket",
"(",
"h",
",",
"request",
",",
"null",
",",
"null",
",",
"future",
",",
"wr",
")",
";",
"return",
"future",
";",
"}"
] | Submit a Request in asynchronizing, it return a Future for the
Request Response.
@param h
the ProtocolHeader.
@param request
the Protocol.
@param wr
the WatcherRegistration of the Service.
@return
the Future. | [
"Submit",
"a",
"Request",
"in",
"asynchronizing",
"it",
"return",
"a",
"Future",
"for",
"the",
"Request",
"Response",
"."
] | train | https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/connect/DirectoryConnection.java#L401-L405 |
VoltDB/voltdb | src/frontend/org/voltdb/expressions/ExpressionUtil.java | ExpressionUtil.collectTerminals | private static void collectTerminals(AbstractExpression expr, Set<AbstractExpression> accum) {
"""
A terminal node of an expression is the one that does not have left/right child, nor any parameters;
"""
if (expr != null) {
collectTerminals(expr.getLeft(), accum);
collectTerminals(expr.getRight(), accum);
if (expr.getArgs() != null) {
expr.getArgs().forEach(e -> collectTerminals(e, accum));
} else if (expr.getLeft() == null && expr.getRight() == null) {
accum.add(expr);
}
}
} | java | private static void collectTerminals(AbstractExpression expr, Set<AbstractExpression> accum) {
if (expr != null) {
collectTerminals(expr.getLeft(), accum);
collectTerminals(expr.getRight(), accum);
if (expr.getArgs() != null) {
expr.getArgs().forEach(e -> collectTerminals(e, accum));
} else if (expr.getLeft() == null && expr.getRight() == null) {
accum.add(expr);
}
}
} | [
"private",
"static",
"void",
"collectTerminals",
"(",
"AbstractExpression",
"expr",
",",
"Set",
"<",
"AbstractExpression",
">",
"accum",
")",
"{",
"if",
"(",
"expr",
"!=",
"null",
")",
"{",
"collectTerminals",
"(",
"expr",
".",
"getLeft",
"(",
")",
",",
"accum",
")",
";",
"collectTerminals",
"(",
"expr",
".",
"getRight",
"(",
")",
",",
"accum",
")",
";",
"if",
"(",
"expr",
".",
"getArgs",
"(",
")",
"!=",
"null",
")",
"{",
"expr",
".",
"getArgs",
"(",
")",
".",
"forEach",
"(",
"e",
"->",
"collectTerminals",
"(",
"e",
",",
"accum",
")",
")",
";",
"}",
"else",
"if",
"(",
"expr",
".",
"getLeft",
"(",
")",
"==",
"null",
"&&",
"expr",
".",
"getRight",
"(",
")",
"==",
"null",
")",
"{",
"accum",
".",
"add",
"(",
"expr",
")",
";",
"}",
"}",
"}"
] | A terminal node of an expression is the one that does not have left/right child, nor any parameters; | [
"A",
"terminal",
"node",
"of",
"an",
"expression",
"is",
"the",
"one",
"that",
"does",
"not",
"have",
"left",
"/",
"right",
"child",
"nor",
"any",
"parameters",
";"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/expressions/ExpressionUtil.java#L281-L291 |
MenoData/Time4J | base/src/main/java/net/time4j/calendar/astro/JulianDay.java | JulianDay.ofMeanSolarTime | public static JulianDay ofMeanSolarTime(Moment moment) {
"""
/*[deutsch]
<p>Erzeugt einen julianischen Tag auf der Zeitskala {@link TimeScale#UT},
also bezogen auf die mittlere Sonnenzeit. </p>
<p>Die Umrechnung in die <em>ephemeris time</em> erfordert eine delta-T-Korrektur. </p>
@param moment corresponding moment
@return JulianDay
@throws IllegalArgumentException if the Julian day of moment is not in supported range
"""
return new JulianDay(getValue(moment, TimeScale.UT), TimeScale.UT);
} | java | public static JulianDay ofMeanSolarTime(Moment moment) {
return new JulianDay(getValue(moment, TimeScale.UT), TimeScale.UT);
} | [
"public",
"static",
"JulianDay",
"ofMeanSolarTime",
"(",
"Moment",
"moment",
")",
"{",
"return",
"new",
"JulianDay",
"(",
"getValue",
"(",
"moment",
",",
"TimeScale",
".",
"UT",
")",
",",
"TimeScale",
".",
"UT",
")",
";",
"}"
] | /*[deutsch]
<p>Erzeugt einen julianischen Tag auf der Zeitskala {@link TimeScale#UT},
also bezogen auf die mittlere Sonnenzeit. </p>
<p>Die Umrechnung in die <em>ephemeris time</em> erfordert eine delta-T-Korrektur. </p>
@param moment corresponding moment
@return JulianDay
@throws IllegalArgumentException if the Julian day of moment is not in supported range | [
"/",
"*",
"[",
"deutsch",
"]",
"<p",
">",
"Erzeugt",
"einen",
"julianischen",
"Tag",
"auf",
"der",
"Zeitskala",
"{",
"@link",
"TimeScale#UT",
"}",
"also",
"bezogen",
"auf",
"die",
"mittlere",
"Sonnenzeit",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/calendar/astro/JulianDay.java#L278-L282 |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/MetatypeUtils.java | MetatypeUtils.parseDuration | public static long parseDuration(Object configAlias, String propertyKey, Object obj, long defaultValue) {
"""
Parse a duration from the provided config value: checks for whether or not
the object read from the Service/Component configuration is a String
or a Metatype converted long duration value
<p>
If an exception occurs converting the object parameter:
A translated warning message will be issued using the provided propertyKey and object
as parameters. FFDC for the exception is suppressed: Callers should handle the thrown
IllegalArgumentException as appropriate.
@param configAlias
Name of config (pid or alias) associated with a registered service
or DS component.
@param propertyKey
The key used to retrieve the property value from the map.
Used in the warning message if the value is badly formed.
@param obj
The object retrieved from the configuration property map/dictionary.
@param defaultValue
The default value that should be applied if the object is null.
@return Long parsed/retrieved from obj, or default value if obj is null
@throws IllegalArgumentException If value is not a Long, or if an error
occurs while converting/casting the object to the return parameter type.
"""
return parseDuration(configAlias, propertyKey, obj, defaultValue, TimeUnit.MILLISECONDS);
} | java | public static long parseDuration(Object configAlias, String propertyKey, Object obj, long defaultValue) {
return parseDuration(configAlias, propertyKey, obj, defaultValue, TimeUnit.MILLISECONDS);
} | [
"public",
"static",
"long",
"parseDuration",
"(",
"Object",
"configAlias",
",",
"String",
"propertyKey",
",",
"Object",
"obj",
",",
"long",
"defaultValue",
")",
"{",
"return",
"parseDuration",
"(",
"configAlias",
",",
"propertyKey",
",",
"obj",
",",
"defaultValue",
",",
"TimeUnit",
".",
"MILLISECONDS",
")",
";",
"}"
] | Parse a duration from the provided config value: checks for whether or not
the object read from the Service/Component configuration is a String
or a Metatype converted long duration value
<p>
If an exception occurs converting the object parameter:
A translated warning message will be issued using the provided propertyKey and object
as parameters. FFDC for the exception is suppressed: Callers should handle the thrown
IllegalArgumentException as appropriate.
@param configAlias
Name of config (pid or alias) associated with a registered service
or DS component.
@param propertyKey
The key used to retrieve the property value from the map.
Used in the warning message if the value is badly formed.
@param obj
The object retrieved from the configuration property map/dictionary.
@param defaultValue
The default value that should be applied if the object is null.
@return Long parsed/retrieved from obj, or default value if obj is null
@throws IllegalArgumentException If value is not a Long, or if an error
occurs while converting/casting the object to the return parameter type. | [
"Parse",
"a",
"duration",
"from",
"the",
"provided",
"config",
"value",
":",
"checks",
"for",
"whether",
"or",
"not",
"the",
"object",
"read",
"from",
"the",
"Service",
"/",
"Component",
"configuration",
"is",
"a",
"String",
"or",
"a",
"Metatype",
"converted",
"long",
"duration",
"value",
"<p",
">",
"If",
"an",
"exception",
"occurs",
"converting",
"the",
"object",
"parameter",
":",
"A",
"translated",
"warning",
"message",
"will",
"be",
"issued",
"using",
"the",
"provided",
"propertyKey",
"and",
"object",
"as",
"parameters",
".",
"FFDC",
"for",
"the",
"exception",
"is",
"suppressed",
":",
"Callers",
"should",
"handle",
"the",
"thrown",
"IllegalArgumentException",
"as",
"appropriate",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/MetatypeUtils.java#L433-L435 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/cloud/PointCloudUtils.java | PointCloudUtils.autoScale | public static double autoScale( List<Point3D_F64> cloud , double target ) {
"""
Automatically rescales the point cloud based so that it has a standard deviation of 'target'
@param cloud The point cloud
@param target The desired standard deviation of the cloud. Try 100
@return The selected scale factor
"""
Point3D_F64 mean = new Point3D_F64();
Point3D_F64 stdev = new Point3D_F64();
statistics(cloud, mean, stdev);
double scale = target/(Math.max(Math.max(stdev.x,stdev.y),stdev.z));
int N = cloud.size();
for (int i = 0; i < N ; i++) {
cloud.get(i).scale(scale);
}
return scale;
} | java | public static double autoScale( List<Point3D_F64> cloud , double target ) {
Point3D_F64 mean = new Point3D_F64();
Point3D_F64 stdev = new Point3D_F64();
statistics(cloud, mean, stdev);
double scale = target/(Math.max(Math.max(stdev.x,stdev.y),stdev.z));
int N = cloud.size();
for (int i = 0; i < N ; i++) {
cloud.get(i).scale(scale);
}
return scale;
} | [
"public",
"static",
"double",
"autoScale",
"(",
"List",
"<",
"Point3D_F64",
">",
"cloud",
",",
"double",
"target",
")",
"{",
"Point3D_F64",
"mean",
"=",
"new",
"Point3D_F64",
"(",
")",
";",
"Point3D_F64",
"stdev",
"=",
"new",
"Point3D_F64",
"(",
")",
";",
"statistics",
"(",
"cloud",
",",
"mean",
",",
"stdev",
")",
";",
"double",
"scale",
"=",
"target",
"/",
"(",
"Math",
".",
"max",
"(",
"Math",
".",
"max",
"(",
"stdev",
".",
"x",
",",
"stdev",
".",
"y",
")",
",",
"stdev",
".",
"z",
")",
")",
";",
"int",
"N",
"=",
"cloud",
".",
"size",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"N",
";",
"i",
"++",
")",
"{",
"cloud",
".",
"get",
"(",
"i",
")",
".",
"scale",
"(",
"scale",
")",
";",
"}",
"return",
"scale",
";",
"}"
] | Automatically rescales the point cloud based so that it has a standard deviation of 'target'
@param cloud The point cloud
@param target The desired standard deviation of the cloud. Try 100
@return The selected scale factor | [
"Automatically",
"rescales",
"the",
"point",
"cloud",
"based",
"so",
"that",
"it",
"has",
"a",
"standard",
"deviation",
"of",
"target"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/cloud/PointCloudUtils.java#L42-L57 |
ibm-bluemix-mobile-services/bms-clientsdk-android-core | lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/internal/AuthorizationProcessManager.java | AuthorizationProcessManager.saveCertificateFromResponse | private void saveCertificateFromResponse(Response response) {
"""
Extract the certificate data from response and save it on local storage
@param response contains the certificate data
"""
try {
String responseBody = response.getResponseText();
JSONObject jsonResponse = new JSONObject(responseBody);
//handle certificate
String certificateString = jsonResponse.getString("certificate");
X509Certificate certificate = CertificatesUtility.base64StringToCertificate(certificateString);
CertificatesUtility.checkValidityWithPublicKey(certificate, registrationKeyPair.getPublic());
certificateStore.saveCertificate(registrationKeyPair, certificate);
//save the clientId separately
preferences.clientId.set(jsonResponse.getString("clientId"));
} catch (Exception e) {
throw new RuntimeException("Failed to save certificate from response", e);
}
logger.debug("certificate successfully saved");
} | java | private void saveCertificateFromResponse(Response response) {
try {
String responseBody = response.getResponseText();
JSONObject jsonResponse = new JSONObject(responseBody);
//handle certificate
String certificateString = jsonResponse.getString("certificate");
X509Certificate certificate = CertificatesUtility.base64StringToCertificate(certificateString);
CertificatesUtility.checkValidityWithPublicKey(certificate, registrationKeyPair.getPublic());
certificateStore.saveCertificate(registrationKeyPair, certificate);
//save the clientId separately
preferences.clientId.set(jsonResponse.getString("clientId"));
} catch (Exception e) {
throw new RuntimeException("Failed to save certificate from response", e);
}
logger.debug("certificate successfully saved");
} | [
"private",
"void",
"saveCertificateFromResponse",
"(",
"Response",
"response",
")",
"{",
"try",
"{",
"String",
"responseBody",
"=",
"response",
".",
"getResponseText",
"(",
")",
";",
"JSONObject",
"jsonResponse",
"=",
"new",
"JSONObject",
"(",
"responseBody",
")",
";",
"//handle certificate",
"String",
"certificateString",
"=",
"jsonResponse",
".",
"getString",
"(",
"\"certificate\"",
")",
";",
"X509Certificate",
"certificate",
"=",
"CertificatesUtility",
".",
"base64StringToCertificate",
"(",
"certificateString",
")",
";",
"CertificatesUtility",
".",
"checkValidityWithPublicKey",
"(",
"certificate",
",",
"registrationKeyPair",
".",
"getPublic",
"(",
")",
")",
";",
"certificateStore",
".",
"saveCertificate",
"(",
"registrationKeyPair",
",",
"certificate",
")",
";",
"//save the clientId separately",
"preferences",
".",
"clientId",
".",
"set",
"(",
"jsonResponse",
".",
"getString",
"(",
"\"clientId\"",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Failed to save certificate from response\"",
",",
"e",
")",
";",
"}",
"logger",
".",
"debug",
"(",
"\"certificate successfully saved\"",
")",
";",
"}"
] | Extract the certificate data from response and save it on local storage
@param response contains the certificate data | [
"Extract",
"the",
"certificate",
"data",
"from",
"response",
"and",
"save",
"it",
"on",
"local",
"storage"
] | train | https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-core/blob/8db4f00d0d564792397bfc0e5bd57d52a238b858/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/internal/AuthorizationProcessManager.java#L223-L244 |
apache/incubator-atlas | notification/src/main/java/org/apache/atlas/hook/AtlasHook.java | AtlasHook.notifyEntities | public static void notifyEntities(List<HookNotification.HookNotificationMessage> messages, int maxRetries) {
"""
Notify atlas of the entity through message. The entity can be a
complex entity with reference to other entities.
De-duping of entities is done on server side depending on the
unique attribute on the entities.
@param messages hook notification messages
@param maxRetries maximum number of retries while sending message to messaging system
"""
notifyEntitiesInternal(messages, maxRetries, notificationInterface, logFailedMessages, failedMessagesLogger);
} | java | public static void notifyEntities(List<HookNotification.HookNotificationMessage> messages, int maxRetries) {
notifyEntitiesInternal(messages, maxRetries, notificationInterface, logFailedMessages, failedMessagesLogger);
} | [
"public",
"static",
"void",
"notifyEntities",
"(",
"List",
"<",
"HookNotification",
".",
"HookNotificationMessage",
">",
"messages",
",",
"int",
"maxRetries",
")",
"{",
"notifyEntitiesInternal",
"(",
"messages",
",",
"maxRetries",
",",
"notificationInterface",
",",
"logFailedMessages",
",",
"failedMessagesLogger",
")",
";",
"}"
] | Notify atlas of the entity through message. The entity can be a
complex entity with reference to other entities.
De-duping of entities is done on server side depending on the
unique attribute on the entities.
@param messages hook notification messages
@param maxRetries maximum number of retries while sending message to messaging system | [
"Notify",
"atlas",
"of",
"the",
"entity",
"through",
"message",
".",
"The",
"entity",
"can",
"be",
"a",
"complex",
"entity",
"with",
"reference",
"to",
"other",
"entities",
".",
"De",
"-",
"duping",
"of",
"entities",
"is",
"done",
"on",
"server",
"side",
"depending",
"on",
"the",
"unique",
"attribute",
"on",
"the",
"entities",
"."
] | train | https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/notification/src/main/java/org/apache/atlas/hook/AtlasHook.java#L117-L119 |
lucee/Lucee | core/src/main/java/lucee/transformer/bytecode/util/ASMUtil.java | ASMUtil.getAttributeString | public static String getAttributeString(Tag tag, String attrName) throws EvaluatorException {
"""
extract the content of a attribut
@param cfxdTag
@param attrName
@return attribute value
@throws EvaluatorException
"""
return getAttributeLiteral(tag, attrName).getString();
} | java | public static String getAttributeString(Tag tag, String attrName) throws EvaluatorException {
return getAttributeLiteral(tag, attrName).getString();
} | [
"public",
"static",
"String",
"getAttributeString",
"(",
"Tag",
"tag",
",",
"String",
"attrName",
")",
"throws",
"EvaluatorException",
"{",
"return",
"getAttributeLiteral",
"(",
"tag",
",",
"attrName",
")",
".",
"getString",
"(",
")",
";",
"}"
] | extract the content of a attribut
@param cfxdTag
@param attrName
@return attribute value
@throws EvaluatorException | [
"extract",
"the",
"content",
"of",
"a",
"attribut"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/bytecode/util/ASMUtil.java#L345-L347 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.refund_refundId_GET | public OvhRefund refund_refundId_GET(String refundId) throws IOException {
"""
Get this object properties
REST: GET /me/refund/{refundId}
@param refundId [required]
"""
String qPath = "/me/refund/{refundId}";
StringBuilder sb = path(qPath, refundId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhRefund.class);
} | java | public OvhRefund refund_refundId_GET(String refundId) throws IOException {
String qPath = "/me/refund/{refundId}";
StringBuilder sb = path(qPath, refundId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhRefund.class);
} | [
"public",
"OvhRefund",
"refund_refundId_GET",
"(",
"String",
"refundId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/refund/{refundId}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"refundId",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhRefund",
".",
"class",
")",
";",
"}"
] | Get this object properties
REST: GET /me/refund/{refundId}
@param refundId [required] | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L1423-L1428 |
devnied/Bit-lib4j | src/main/java/fr/devnied/bitlib/BitUtils.java | BitUtils.getMask | public byte getMask(final int pIndex, final int pLength) {
"""
This method is used to get a mask dynamically
@param pIndex
start index of the mask
@param pLength
size of mask
@return the mask in byte
"""
byte ret = (byte) DEFAULT_VALUE;
// Add X 0 to the left
ret = (byte) (ret << pIndex);
ret = (byte) ((ret & DEFAULT_VALUE) >> pIndex);
// Add X 0 to the right
int dec = BYTE_SIZE - (pLength + pIndex);
if (dec > 0) {
ret = (byte) (ret >> dec);
ret = (byte) (ret << dec);
}
return ret;
} | java | public byte getMask(final int pIndex, final int pLength) {
byte ret = (byte) DEFAULT_VALUE;
// Add X 0 to the left
ret = (byte) (ret << pIndex);
ret = (byte) ((ret & DEFAULT_VALUE) >> pIndex);
// Add X 0 to the right
int dec = BYTE_SIZE - (pLength + pIndex);
if (dec > 0) {
ret = (byte) (ret >> dec);
ret = (byte) (ret << dec);
}
return ret;
} | [
"public",
"byte",
"getMask",
"(",
"final",
"int",
"pIndex",
",",
"final",
"int",
"pLength",
")",
"{",
"byte",
"ret",
"=",
"(",
"byte",
")",
"DEFAULT_VALUE",
";",
"// Add X 0 to the left\r",
"ret",
"=",
"(",
"byte",
")",
"(",
"ret",
"<<",
"pIndex",
")",
";",
"ret",
"=",
"(",
"byte",
")",
"(",
"(",
"ret",
"&",
"DEFAULT_VALUE",
")",
">>",
"pIndex",
")",
";",
"// Add X 0 to the right\r",
"int",
"dec",
"=",
"BYTE_SIZE",
"-",
"(",
"pLength",
"+",
"pIndex",
")",
";",
"if",
"(",
"dec",
">",
"0",
")",
"{",
"ret",
"=",
"(",
"byte",
")",
"(",
"ret",
">>",
"dec",
")",
";",
"ret",
"=",
"(",
"byte",
")",
"(",
"ret",
"<<",
"dec",
")",
";",
"}",
"return",
"ret",
";",
"}"
] | This method is used to get a mask dynamically
@param pIndex
start index of the mask
@param pLength
size of mask
@return the mask in byte | [
"This",
"method",
"is",
"used",
"to",
"get",
"a",
"mask",
"dynamically"
] | train | https://github.com/devnied/Bit-lib4j/blob/bdfa79fd12e7e3d5cf1196291825ef1bb12a1ee0/src/main/java/fr/devnied/bitlib/BitUtils.java#L126-L138 |
VoltDB/voltdb | src/frontend/org/voltdb/parser/JDBCParser.java | JDBCParser.parseJDBCCall | public static ParsedCall parseJDBCCall(String jdbcCall) throws SQLParser.Exception {
"""
Parse call statements for JDBC.
@param jdbcCall statement to parse
@return object with parsed data or null if it didn't parse
@throws SQLParser.Exception
"""
Matcher m = PAT_CALL_WITH_PARAMETERS.matcher(jdbcCall);
if (m.matches()) {
String sql = m.group(1);
int parameterCount = PAT_CLEAN_CALL_PARAMETERS.matcher(m.group(2)).replaceAll("").length();
return new ParsedCall(sql, parameterCount);
}
m = PAT_CALL_WITHOUT_PARAMETERS.matcher(jdbcCall);
if (m.matches()) {
return new ParsedCall(m.group(1), 0);
}
return null;
} | java | public static ParsedCall parseJDBCCall(String jdbcCall) throws SQLParser.Exception
{
Matcher m = PAT_CALL_WITH_PARAMETERS.matcher(jdbcCall);
if (m.matches()) {
String sql = m.group(1);
int parameterCount = PAT_CLEAN_CALL_PARAMETERS.matcher(m.group(2)).replaceAll("").length();
return new ParsedCall(sql, parameterCount);
}
m = PAT_CALL_WITHOUT_PARAMETERS.matcher(jdbcCall);
if (m.matches()) {
return new ParsedCall(m.group(1), 0);
}
return null;
} | [
"public",
"static",
"ParsedCall",
"parseJDBCCall",
"(",
"String",
"jdbcCall",
")",
"throws",
"SQLParser",
".",
"Exception",
"{",
"Matcher",
"m",
"=",
"PAT_CALL_WITH_PARAMETERS",
".",
"matcher",
"(",
"jdbcCall",
")",
";",
"if",
"(",
"m",
".",
"matches",
"(",
")",
")",
"{",
"String",
"sql",
"=",
"m",
".",
"group",
"(",
"1",
")",
";",
"int",
"parameterCount",
"=",
"PAT_CLEAN_CALL_PARAMETERS",
".",
"matcher",
"(",
"m",
".",
"group",
"(",
"2",
")",
")",
".",
"replaceAll",
"(",
"\"\"",
")",
".",
"length",
"(",
")",
";",
"return",
"new",
"ParsedCall",
"(",
"sql",
",",
"parameterCount",
")",
";",
"}",
"m",
"=",
"PAT_CALL_WITHOUT_PARAMETERS",
".",
"matcher",
"(",
"jdbcCall",
")",
";",
"if",
"(",
"m",
".",
"matches",
"(",
")",
")",
"{",
"return",
"new",
"ParsedCall",
"(",
"m",
".",
"group",
"(",
"1",
")",
",",
"0",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Parse call statements for JDBC.
@param jdbcCall statement to parse
@return object with parsed data or null if it didn't parse
@throws SQLParser.Exception | [
"Parse",
"call",
"statements",
"for",
"JDBC",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/parser/JDBCParser.java#L67-L80 |
OpenTSDB/opentsdb | src/utils/JSON.java | JSON.serializeToJSONPBytes | public static final byte[] serializeToJSONPBytes(final String callback,
final Object object) {
"""
Serializes the given object and wraps it in a callback function
i.e. <callback>(<json>)
Note: This will not append a trailing semicolon
@param callback The name of the Javascript callback to prepend
@param object The object to serialize
@return A JSONP formatted byte array
@throws IllegalArgumentException if the callback method name was missing
or object was null
@throws JSONException if the object could not be serialized
"""
if (callback == null || callback.isEmpty())
throw new IllegalArgumentException("Missing callback name");
if (object == null)
throw new IllegalArgumentException("Object was null");
try {
return jsonMapper.writeValueAsBytes(new JSONPObject(callback, object));
} catch (JsonProcessingException e) {
throw new JSONException(e);
}
} | java | public static final byte[] serializeToJSONPBytes(final String callback,
final Object object) {
if (callback == null || callback.isEmpty())
throw new IllegalArgumentException("Missing callback name");
if (object == null)
throw new IllegalArgumentException("Object was null");
try {
return jsonMapper.writeValueAsBytes(new JSONPObject(callback, object));
} catch (JsonProcessingException e) {
throw new JSONException(e);
}
} | [
"public",
"static",
"final",
"byte",
"[",
"]",
"serializeToJSONPBytes",
"(",
"final",
"String",
"callback",
",",
"final",
"Object",
"object",
")",
"{",
"if",
"(",
"callback",
"==",
"null",
"||",
"callback",
".",
"isEmpty",
"(",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Missing callback name\"",
")",
";",
"if",
"(",
"object",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Object was null\"",
")",
";",
"try",
"{",
"return",
"jsonMapper",
".",
"writeValueAsBytes",
"(",
"new",
"JSONPObject",
"(",
"callback",
",",
"object",
")",
")",
";",
"}",
"catch",
"(",
"JsonProcessingException",
"e",
")",
"{",
"throw",
"new",
"JSONException",
"(",
"e",
")",
";",
"}",
"}"
] | Serializes the given object and wraps it in a callback function
i.e. <callback>(<json>)
Note: This will not append a trailing semicolon
@param callback The name of the Javascript callback to prepend
@param object The object to serialize
@return A JSONP formatted byte array
@throws IllegalArgumentException if the callback method name was missing
or object was null
@throws JSONException if the object could not be serialized | [
"Serializes",
"the",
"given",
"object",
"and",
"wraps",
"it",
"in",
"a",
"callback",
"function",
"i",
".",
"e",
".",
"<",
";",
"callback>",
";",
"(",
"<",
";",
"json>",
";",
")",
"Note",
":",
"This",
"will",
"not",
"append",
"a",
"trailing",
"semicolon"
] | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/utils/JSON.java#L335-L346 |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/SocketBindingJBossASClient.java | SocketBindingJBossASClient.setStandardSocketBindingInterface | public void setStandardSocketBindingInterface(String socketBindingName, String interfaceName) throws Exception {
"""
Sets the interface name for the named standard socket binding.
@param socketBindingName the name of the standard socket binding whose interface is to be set
@param interfaceName the new interface name
@throws Exception any error
"""
setStandardSocketBindingInterfaceExpression(socketBindingName, null, interfaceName);
} | java | public void setStandardSocketBindingInterface(String socketBindingName, String interfaceName) throws Exception {
setStandardSocketBindingInterfaceExpression(socketBindingName, null, interfaceName);
} | [
"public",
"void",
"setStandardSocketBindingInterface",
"(",
"String",
"socketBindingName",
",",
"String",
"interfaceName",
")",
"throws",
"Exception",
"{",
"setStandardSocketBindingInterfaceExpression",
"(",
"socketBindingName",
",",
"null",
",",
"interfaceName",
")",
";",
"}"
] | Sets the interface name for the named standard socket binding.
@param socketBindingName the name of the standard socket binding whose interface is to be set
@param interfaceName the new interface name
@throws Exception any error | [
"Sets",
"the",
"interface",
"name",
"for",
"the",
"named",
"standard",
"socket",
"binding",
"."
] | train | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/SocketBindingJBossASClient.java#L279-L281 |
phax/ph-schedule | ph-schedule/src/main/java/com/helger/schedule/quartz/QuartzSchedulerHelper.java | QuartzSchedulerHelper.getSchedulerMetaData | @Nonnull
public static SchedulerMetaData getSchedulerMetaData () {
"""
Get the metadata of the scheduler. The state of the scheduler is not
changed within this method.
@return The metadata of the underlying scheduler.
"""
try
{
// Get the scheduler without starting it
return s_aSchedulerFactory.getScheduler ().getMetaData ();
}
catch (final SchedulerException ex)
{
throw new IllegalStateException ("Failed to get scheduler metadata", ex);
}
} | java | @Nonnull
public static SchedulerMetaData getSchedulerMetaData ()
{
try
{
// Get the scheduler without starting it
return s_aSchedulerFactory.getScheduler ().getMetaData ();
}
catch (final SchedulerException ex)
{
throw new IllegalStateException ("Failed to get scheduler metadata", ex);
}
} | [
"@",
"Nonnull",
"public",
"static",
"SchedulerMetaData",
"getSchedulerMetaData",
"(",
")",
"{",
"try",
"{",
"// Get the scheduler without starting it",
"return",
"s_aSchedulerFactory",
".",
"getScheduler",
"(",
")",
".",
"getMetaData",
"(",
")",
";",
"}",
"catch",
"(",
"final",
"SchedulerException",
"ex",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Failed to get scheduler metadata\"",
",",
"ex",
")",
";",
"}",
"}"
] | Get the metadata of the scheduler. The state of the scheduler is not
changed within this method.
@return The metadata of the underlying scheduler. | [
"Get",
"the",
"metadata",
"of",
"the",
"scheduler",
".",
"The",
"state",
"of",
"the",
"scheduler",
"is",
"not",
"changed",
"within",
"this",
"method",
"."
] | train | https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-schedule/src/main/java/com/helger/schedule/quartz/QuartzSchedulerHelper.java#L97-L109 |
gaixie/jibu-core | src/main/java/org/gaixie/jibu/utils/SQLBuilder.java | SQLBuilder.beanToSQLClause | public static String beanToSQLClause(Object bean, String split)
throws JibuException {
"""
通过 Bean 实例转化为 SQL 语句段,只转化非空属性。
<p>
支持的属性类型有 int, Integer, float, Float, boolean, Boolean ,Date</p>
@param bean Bean 实例
@param split sql 语句的分隔符,如 " AND " 或 " , "
@return SQl 语句段,如果所有属性值都为空,返回 ""。
@exception JibuException 转化失败时抛出
"""
StringBuilder sb = new StringBuilder();
try{
if(null != bean ) {
BeanInfo beanInfo = Introspector.getBeanInfo(bean.getClass());
PropertyDescriptor[] pds = beanInfo.getPropertyDescriptors();
for( PropertyDescriptor pd : pds ){
String clause = columnClause(" "+pd.getName(),
pd.getPropertyType(),
pd.getReadMethod().invoke(bean));
if (null != clause) {
sb.append(clause + split+" \n");
}
}
}
} catch( Exception e){
throw new JibuException(e.getMessage());
}
return sb.toString();
} | java | public static String beanToSQLClause(Object bean, String split)
throws JibuException {
StringBuilder sb = new StringBuilder();
try{
if(null != bean ) {
BeanInfo beanInfo = Introspector.getBeanInfo(bean.getClass());
PropertyDescriptor[] pds = beanInfo.getPropertyDescriptors();
for( PropertyDescriptor pd : pds ){
String clause = columnClause(" "+pd.getName(),
pd.getPropertyType(),
pd.getReadMethod().invoke(bean));
if (null != clause) {
sb.append(clause + split+" \n");
}
}
}
} catch( Exception e){
throw new JibuException(e.getMessage());
}
return sb.toString();
} | [
"public",
"static",
"String",
"beanToSQLClause",
"(",
"Object",
"bean",
",",
"String",
"split",
")",
"throws",
"JibuException",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"try",
"{",
"if",
"(",
"null",
"!=",
"bean",
")",
"{",
"BeanInfo",
"beanInfo",
"=",
"Introspector",
".",
"getBeanInfo",
"(",
"bean",
".",
"getClass",
"(",
")",
")",
";",
"PropertyDescriptor",
"[",
"]",
"pds",
"=",
"beanInfo",
".",
"getPropertyDescriptors",
"(",
")",
";",
"for",
"(",
"PropertyDescriptor",
"pd",
":",
"pds",
")",
"{",
"String",
"clause",
"=",
"columnClause",
"(",
"\" \"",
"+",
"pd",
".",
"getName",
"(",
")",
",",
"pd",
".",
"getPropertyType",
"(",
")",
",",
"pd",
".",
"getReadMethod",
"(",
")",
".",
"invoke",
"(",
"bean",
")",
")",
";",
"if",
"(",
"null",
"!=",
"clause",
")",
"{",
"sb",
".",
"append",
"(",
"clause",
"+",
"split",
"+",
"\" \\n\"",
")",
";",
"}",
"}",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"JibuException",
"(",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] | 通过 Bean 实例转化为 SQL 语句段,只转化非空属性。
<p>
支持的属性类型有 int, Integer, float, Float, boolean, Boolean ,Date</p>
@param bean Bean 实例
@param split sql 语句的分隔符,如 " AND " 或 " , "
@return SQl 语句段,如果所有属性值都为空,返回 ""。
@exception JibuException 转化失败时抛出 | [
"通过",
"Bean",
"实例转化为",
"SQL",
"语句段,只转化非空属性。",
"<p",
">",
"支持的属性类型有",
"int",
"Integer",
"float",
"Float",
"boolean",
"Boolean",
"Date<",
"/",
"p",
">"
] | train | https://github.com/gaixie/jibu-core/blob/d5462f2883321c82d898c8752b7e5eba4b7dc184/src/main/java/org/gaixie/jibu/utils/SQLBuilder.java#L49-L71 |
rundeck/rundeck | core/src/main/java/com/dtolabs/rundeck/core/utils/ZipUtil.java | ZipUtil.extractZipFile | public static void extractZipFile(final String path, final File dest, final String fileName) throws IOException {
"""
Extracts a single entry from the zip
@param path zip file path
@param dest destination directory
@param fileName specific filepath to extract
@throws IOException on io error
"""
FilenameFilter filter = null;
if (null != fileName) {
filter = new FilenameFilter() {
public boolean accept(final File file, final String name) {
return fileName.equals(name) || fileName.startsWith(name);
}
};
}
extractZip(path, dest, filter, null, null);
} | java | public static void extractZipFile(final String path, final File dest, final String fileName) throws IOException {
FilenameFilter filter = null;
if (null != fileName) {
filter = new FilenameFilter() {
public boolean accept(final File file, final String name) {
return fileName.equals(name) || fileName.startsWith(name);
}
};
}
extractZip(path, dest, filter, null, null);
} | [
"public",
"static",
"void",
"extractZipFile",
"(",
"final",
"String",
"path",
",",
"final",
"File",
"dest",
",",
"final",
"String",
"fileName",
")",
"throws",
"IOException",
"{",
"FilenameFilter",
"filter",
"=",
"null",
";",
"if",
"(",
"null",
"!=",
"fileName",
")",
"{",
"filter",
"=",
"new",
"FilenameFilter",
"(",
")",
"{",
"public",
"boolean",
"accept",
"(",
"final",
"File",
"file",
",",
"final",
"String",
"name",
")",
"{",
"return",
"fileName",
".",
"equals",
"(",
"name",
")",
"||",
"fileName",
".",
"startsWith",
"(",
"name",
")",
";",
"}",
"}",
";",
"}",
"extractZip",
"(",
"path",
",",
"dest",
",",
"filter",
",",
"null",
",",
"null",
")",
";",
"}"
] | Extracts a single entry from the zip
@param path zip file path
@param dest destination directory
@param fileName specific filepath to extract
@throws IOException on io error | [
"Extracts",
"a",
"single",
"entry",
"from",
"the",
"zip"
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/utils/ZipUtil.java#L70-L80 |
b3dgs/lionengine | lionengine-core/src/main/java/com/b3dgs/lionengine/UtilFile.java | UtilFile.getFilesByExtensionRecursive | private static void getFilesByExtensionRecursive(Collection<File> filesList, File path, String extension) {
"""
Get all files existing in the path considering the extension.
@param filesList The files list.
@param path The path to check.
@param extension The extension (without dot; eg: png).
"""
Optional.ofNullable(path.listFiles()).ifPresent(files -> Arrays.asList(files).forEach(content ->
{
if (content.isDirectory())
{
getFilesByExtensionRecursive(filesList, content, extension);
}
if (content.isFile() && extension.equals(getExtension(content)))
{
filesList.add(content);
}
}));
} | java | private static void getFilesByExtensionRecursive(Collection<File> filesList, File path, String extension)
{
Optional.ofNullable(path.listFiles()).ifPresent(files -> Arrays.asList(files).forEach(content ->
{
if (content.isDirectory())
{
getFilesByExtensionRecursive(filesList, content, extension);
}
if (content.isFile() && extension.equals(getExtension(content)))
{
filesList.add(content);
}
}));
} | [
"private",
"static",
"void",
"getFilesByExtensionRecursive",
"(",
"Collection",
"<",
"File",
">",
"filesList",
",",
"File",
"path",
",",
"String",
"extension",
")",
"{",
"Optional",
".",
"ofNullable",
"(",
"path",
".",
"listFiles",
"(",
")",
")",
".",
"ifPresent",
"(",
"files",
"->",
"Arrays",
".",
"asList",
"(",
"files",
")",
".",
"forEach",
"(",
"content",
"->",
"{",
"if",
"(",
"content",
".",
"isDirectory",
"(",
")",
")",
"{",
"getFilesByExtensionRecursive",
"(",
"filesList",
",",
"content",
",",
"extension",
")",
";",
"}",
"if",
"(",
"content",
".",
"isFile",
"(",
")",
"&&",
"extension",
".",
"equals",
"(",
"getExtension",
"(",
"content",
")",
")",
")",
"{",
"filesList",
".",
"add",
"(",
"content",
")",
";",
"}",
"}",
")",
")",
";",
"}"
] | Get all files existing in the path considering the extension.
@param filesList The files list.
@param path The path to check.
@param extension The extension (without dot; eg: png). | [
"Get",
"all",
"files",
"existing",
"in",
"the",
"path",
"considering",
"the",
"extension",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/UtilFile.java#L252-L265 |
ppiastucki/recast4j | detourcrowd/src/main/java/org/recast4j/detour/crowd/PathCorridor.java | PathCorridor.setCorridor | public void setCorridor(float[] target, List<Long> path) {
"""
Loads a new path and target into the corridor. The current corridor position is expected to be within the first
polygon in the path. The target is expected to be in the last polygon.
@warning The size of the path must not exceed the size of corridor's path buffer set during #init().
@param target
The target location within the last polygon of the path. [(x, y, z)]
@param path
The path corridor.
"""
vCopy(m_target, target);
m_path = new ArrayList<>(path);
} | java | public void setCorridor(float[] target, List<Long> path) {
vCopy(m_target, target);
m_path = new ArrayList<>(path);
} | [
"public",
"void",
"setCorridor",
"(",
"float",
"[",
"]",
"target",
",",
"List",
"<",
"Long",
">",
"path",
")",
"{",
"vCopy",
"(",
"m_target",
",",
"target",
")",
";",
"m_path",
"=",
"new",
"ArrayList",
"<>",
"(",
"path",
")",
";",
"}"
] | Loads a new path and target into the corridor. The current corridor position is expected to be within the first
polygon in the path. The target is expected to be in the last polygon.
@warning The size of the path must not exceed the size of corridor's path buffer set during #init().
@param target
The target location within the last polygon of the path. [(x, y, z)]
@param path
The path corridor. | [
"Loads",
"a",
"new",
"path",
"and",
"target",
"into",
"the",
"corridor",
".",
"The",
"current",
"corridor",
"position",
"is",
"expected",
"to",
"be",
"within",
"the",
"first",
"polygon",
"in",
"the",
"path",
".",
"The",
"target",
"is",
"expected",
"to",
"be",
"in",
"the",
"last",
"polygon",
"."
] | train | https://github.com/ppiastucki/recast4j/blob/a414dc34f16b87c95fb4e0f46c28a7830d421788/detourcrowd/src/main/java/org/recast4j/detour/crowd/PathCorridor.java#L446-L449 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/StylesheetRoot.java | StylesheetRoot.addImports | protected void addImports(Stylesheet stylesheet, boolean addToList, Vector importList) {
"""
Add the imports in the given sheet to the working importList vector.
The will be added from highest import precedence to
least import precedence. This is a post-order traversal of the
import tree as described in <a href="http://www.w3.org/TR/xslt.html#import">the
XSLT Recommendation</a>.
<p>For example, suppose</p>
<p>stylesheet A imports stylesheets B and C in that order;</p>
<p>stylesheet B imports stylesheet D;</p>
<p>stylesheet C imports stylesheet E.</p>
<p>Then the order of import precedence (highest first) is
A, C, E, B, D.</p>
@param stylesheet Stylesheet to examine for imports.
@param addToList <code>true</code> if this template should be added to the import list
@param importList The working import list. Templates are added here in the reverse
order of priority. When we're all done, we'll reverse this to the correct
priority in an array.
"""
// Get the direct imports of this sheet.
int n = stylesheet.getImportCount();
if (n > 0)
{
for (int i = 0; i < n; i++)
{
Stylesheet imported = stylesheet.getImport(i);
addImports(imported, true, importList);
}
}
n = stylesheet.getIncludeCount();
if (n > 0)
{
for (int i = 0; i < n; i++)
{
Stylesheet included = stylesheet.getInclude(i);
addImports(included, false, importList);
}
}
if (addToList)
importList.addElement(stylesheet);
} | java | protected void addImports(Stylesheet stylesheet, boolean addToList, Vector importList)
{
// Get the direct imports of this sheet.
int n = stylesheet.getImportCount();
if (n > 0)
{
for (int i = 0; i < n; i++)
{
Stylesheet imported = stylesheet.getImport(i);
addImports(imported, true, importList);
}
}
n = stylesheet.getIncludeCount();
if (n > 0)
{
for (int i = 0; i < n; i++)
{
Stylesheet included = stylesheet.getInclude(i);
addImports(included, false, importList);
}
}
if (addToList)
importList.addElement(stylesheet);
} | [
"protected",
"void",
"addImports",
"(",
"Stylesheet",
"stylesheet",
",",
"boolean",
"addToList",
",",
"Vector",
"importList",
")",
"{",
"// Get the direct imports of this sheet.",
"int",
"n",
"=",
"stylesheet",
".",
"getImportCount",
"(",
")",
";",
"if",
"(",
"n",
">",
"0",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"Stylesheet",
"imported",
"=",
"stylesheet",
".",
"getImport",
"(",
"i",
")",
";",
"addImports",
"(",
"imported",
",",
"true",
",",
"importList",
")",
";",
"}",
"}",
"n",
"=",
"stylesheet",
".",
"getIncludeCount",
"(",
")",
";",
"if",
"(",
"n",
">",
"0",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"Stylesheet",
"included",
"=",
"stylesheet",
".",
"getInclude",
"(",
"i",
")",
";",
"addImports",
"(",
"included",
",",
"false",
",",
"importList",
")",
";",
"}",
"}",
"if",
"(",
"addToList",
")",
"importList",
".",
"addElement",
"(",
"stylesheet",
")",
";",
"}"
] | Add the imports in the given sheet to the working importList vector.
The will be added from highest import precedence to
least import precedence. This is a post-order traversal of the
import tree as described in <a href="http://www.w3.org/TR/xslt.html#import">the
XSLT Recommendation</a>.
<p>For example, suppose</p>
<p>stylesheet A imports stylesheets B and C in that order;</p>
<p>stylesheet B imports stylesheet D;</p>
<p>stylesheet C imports stylesheet E.</p>
<p>Then the order of import precedence (highest first) is
A, C, E, B, D.</p>
@param stylesheet Stylesheet to examine for imports.
@param addToList <code>true</code> if this template should be added to the import list
@param importList The working import list. Templates are added here in the reverse
order of priority. When we're all done, we'll reverse this to the correct
priority in an array. | [
"Add",
"the",
"imports",
"in",
"the",
"given",
"sheet",
"to",
"the",
"working",
"importList",
"vector",
".",
"The",
"will",
"be",
"added",
"from",
"highest",
"import",
"precedence",
"to",
"least",
"import",
"precedence",
".",
"This",
"is",
"a",
"post",
"-",
"order",
"traversal",
"of",
"the",
"import",
"tree",
"as",
"described",
"in",
"<a",
"href",
"=",
"http",
":",
"//",
"www",
".",
"w3",
".",
"org",
"/",
"TR",
"/",
"xslt",
".",
"html#import",
">",
"the",
"XSLT",
"Recommendation<",
"/",
"a",
">",
".",
"<p",
">",
"For",
"example",
"suppose<",
"/",
"p",
">",
"<p",
">",
"stylesheet",
"A",
"imports",
"stylesheets",
"B",
"and",
"C",
"in",
"that",
"order",
";",
"<",
"/",
"p",
">",
"<p",
">",
"stylesheet",
"B",
"imports",
"stylesheet",
"D",
";",
"<",
"/",
"p",
">",
"<p",
">",
"stylesheet",
"C",
"imports",
"stylesheet",
"E",
".",
"<",
"/",
"p",
">",
"<p",
">",
"Then",
"the",
"order",
"of",
"import",
"precedence",
"(",
"highest",
"first",
")",
"is",
"A",
"C",
"E",
"B",
"D",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/StylesheetRoot.java#L399-L431 |
jferard/fastods | fastods/src/main/java/com/github/jferard/fastods/TableBuilder.java | TableBuilder.nextRow | public TableRow nextRow(final Table table, final TableAppender appender) throws IOException {
"""
Get the next row
@param table the table
@param appender the appender
@return the row
@throws IOException if an I/O error occurs
"""
return this.getRowSecure(table, appender, this.curRowIndex + 1, true);
} | java | public TableRow nextRow(final Table table, final TableAppender appender) throws IOException {
return this.getRowSecure(table, appender, this.curRowIndex + 1, true);
} | [
"public",
"TableRow",
"nextRow",
"(",
"final",
"Table",
"table",
",",
"final",
"TableAppender",
"appender",
")",
"throws",
"IOException",
"{",
"return",
"this",
".",
"getRowSecure",
"(",
"table",
",",
"appender",
",",
"this",
".",
"curRowIndex",
"+",
"1",
",",
"true",
")",
";",
"}"
] | Get the next row
@param table the table
@param appender the appender
@return the row
@throws IOException if an I/O error occurs | [
"Get",
"the",
"next",
"row"
] | train | https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/TableBuilder.java#L309-L311 |
bazaarvoice/emodb | table/src/main/java/com/bazaarvoice/emodb/table/db/astyanax/RowKeyUtils.java | RowKeyUtils.getRowKeyRaw | static ByteBuffer getRowKeyRaw(int shardId, long tableUuid, byte[] contentKeyBytes) {
"""
Constructs a row key when the row's shard ID is already known, which is rare. Generally this is used for
range queries to construct the lower or upper bound for a query, so it doesn't necessarily need to produce
a valid row key.
"""
checkArgument(shardId >= 0 && shardId < 256);
// Assemble a single array which is "1 byte shard id + 8 byte table uuid + n-byte content key".
ByteBuffer rowKey = ByteBuffer.allocate(9 + contentKeyBytes.length);
rowKey.put((byte) shardId);
rowKey.putLong(tableUuid);
rowKey.put(contentKeyBytes);
rowKey.flip();
return rowKey;
} | java | static ByteBuffer getRowKeyRaw(int shardId, long tableUuid, byte[] contentKeyBytes) {
checkArgument(shardId >= 0 && shardId < 256);
// Assemble a single array which is "1 byte shard id + 8 byte table uuid + n-byte content key".
ByteBuffer rowKey = ByteBuffer.allocate(9 + contentKeyBytes.length);
rowKey.put((byte) shardId);
rowKey.putLong(tableUuid);
rowKey.put(contentKeyBytes);
rowKey.flip();
return rowKey;
} | [
"static",
"ByteBuffer",
"getRowKeyRaw",
"(",
"int",
"shardId",
",",
"long",
"tableUuid",
",",
"byte",
"[",
"]",
"contentKeyBytes",
")",
"{",
"checkArgument",
"(",
"shardId",
">=",
"0",
"&&",
"shardId",
"<",
"256",
")",
";",
"// Assemble a single array which is \"1 byte shard id + 8 byte table uuid + n-byte content key\".",
"ByteBuffer",
"rowKey",
"=",
"ByteBuffer",
".",
"allocate",
"(",
"9",
"+",
"contentKeyBytes",
".",
"length",
")",
";",
"rowKey",
".",
"put",
"(",
"(",
"byte",
")",
"shardId",
")",
";",
"rowKey",
".",
"putLong",
"(",
"tableUuid",
")",
";",
"rowKey",
".",
"put",
"(",
"contentKeyBytes",
")",
";",
"rowKey",
".",
"flip",
"(",
")",
";",
"return",
"rowKey",
";",
"}"
] | Constructs a row key when the row's shard ID is already known, which is rare. Generally this is used for
range queries to construct the lower or upper bound for a query, so it doesn't necessarily need to produce
a valid row key. | [
"Constructs",
"a",
"row",
"key",
"when",
"the",
"row",
"s",
"shard",
"ID",
"is",
"already",
"known",
"which",
"is",
"rare",
".",
"Generally",
"this",
"is",
"used",
"for",
"range",
"queries",
"to",
"construct",
"the",
"lower",
"or",
"upper",
"bound",
"for",
"a",
"query",
"so",
"it",
"doesn",
"t",
"necessarily",
"need",
"to",
"produce",
"a",
"valid",
"row",
"key",
"."
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/table/src/main/java/com/bazaarvoice/emodb/table/db/astyanax/RowKeyUtils.java#L82-L93 |
tvesalainen/util | util/src/main/java/d3/env/TSAGeoMag.java | TSAGeoMag.getVerticalIntensity | public double getVerticalIntensity( double dlat, double dlong, double year, double altitude ) {
"""
Returns the vertical magnetic field intensity from the
Department of Defense geomagnetic model and data
in nano Tesla.
@param dlat Latitude in decimal degrees.
@param dlong Longitude in decimal degrees.
@param year Date of the calculation in decimal years.
@param altitude Altitude of the calculation in kilometers.
@return The vertical magnetic field strength in nano Tesla.
"""
calcGeoMag( dlat, dlong, year, altitude );
return bz;
} | java | public double getVerticalIntensity( double dlat, double dlong, double year, double altitude )
{
calcGeoMag( dlat, dlong, year, altitude );
return bz;
} | [
"public",
"double",
"getVerticalIntensity",
"(",
"double",
"dlat",
",",
"double",
"dlong",
",",
"double",
"year",
",",
"double",
"altitude",
")",
"{",
"calcGeoMag",
"(",
"dlat",
",",
"dlong",
",",
"year",
",",
"altitude",
")",
";",
"return",
"bz",
";",
"}"
] | Returns the vertical magnetic field intensity from the
Department of Defense geomagnetic model and data
in nano Tesla.
@param dlat Latitude in decimal degrees.
@param dlong Longitude in decimal degrees.
@param year Date of the calculation in decimal years.
@param altitude Altitude of the calculation in kilometers.
@return The vertical magnetic field strength in nano Tesla. | [
"Returns",
"the",
"vertical",
"magnetic",
"field",
"intensity",
"from",
"the",
"Department",
"of",
"Defense",
"geomagnetic",
"model",
"and",
"data",
"in",
"nano",
"Tesla",
"."
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/d3/env/TSAGeoMag.java#L1038-L1042 |
centic9/commons-dost | src/main/java/org/dstadler/commons/net/UrlUtils.java | UrlUtils.retrieveDataPost | public static String retrieveDataPost(String sUrl, String encoding, String postRequestBody, String contentType, int timeout, SSLSocketFactory sslFactory) throws IOException {
"""
Download data from an URL with a POST request, if necessary converting from a character encoding.
@param sUrl The full URL used to download the content.
@param encoding An encoding, e.g. UTF-8, ISO-8859-15. Can be null.
@param postRequestBody the body of the POST request, e.g. request parameters; must not be null
@param contentType the content-type of the POST request; may be null
@param timeout The timeout in milliseconds that is used for both connection timeout and read timeout.
@param sslFactory The SSLFactory to use for the connection, this allows to support custom SSL certificates
@return The response from the HTTP POST call.
@throws IOException If accessing the resource fails.
"""
return retrieveStringInternalPost(sUrl, encoding, postRequestBody, contentType, timeout, sslFactory);
} | java | public static String retrieveDataPost(String sUrl, String encoding, String postRequestBody, String contentType, int timeout, SSLSocketFactory sslFactory) throws IOException {
return retrieveStringInternalPost(sUrl, encoding, postRequestBody, contentType, timeout, sslFactory);
} | [
"public",
"static",
"String",
"retrieveDataPost",
"(",
"String",
"sUrl",
",",
"String",
"encoding",
",",
"String",
"postRequestBody",
",",
"String",
"contentType",
",",
"int",
"timeout",
",",
"SSLSocketFactory",
"sslFactory",
")",
"throws",
"IOException",
"{",
"return",
"retrieveStringInternalPost",
"(",
"sUrl",
",",
"encoding",
",",
"postRequestBody",
",",
"contentType",
",",
"timeout",
",",
"sslFactory",
")",
";",
"}"
] | Download data from an URL with a POST request, if necessary converting from a character encoding.
@param sUrl The full URL used to download the content.
@param encoding An encoding, e.g. UTF-8, ISO-8859-15. Can be null.
@param postRequestBody the body of the POST request, e.g. request parameters; must not be null
@param contentType the content-type of the POST request; may be null
@param timeout The timeout in milliseconds that is used for both connection timeout and read timeout.
@param sslFactory The SSLFactory to use for the connection, this allows to support custom SSL certificates
@return The response from the HTTP POST call.
@throws IOException If accessing the resource fails. | [
"Download",
"data",
"from",
"an",
"URL",
"with",
"a",
"POST",
"request",
"if",
"necessary",
"converting",
"from",
"a",
"character",
"encoding",
"."
] | train | https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/net/UrlUtils.java#L204-L206 |
stapler/stapler | groovy/src/main/java/org/kohsuke/stapler/jelly/groovy/StaplerClosureScript.java | StaplerClosureScript._ | public String _(String key, Object... args) {
"""
Looks up the resource bundle with the given key, formats with arguments,
then return that formatted string.
"""
// JellyBuilder b = (JellyBuilder)getDelegate();
ResourceBundle resourceBundle = getResourceBundle();
// notify the listener if set
// InternationalizedStringExpressionListener listener = (InternationalizedStringExpressionListener) Stapler.getCurrentRequest().getAttribute(LISTENER_NAME);
// if(listener!=null)
// listener.onUsed(this, args);
args = Stapler.htmlSafeArguments(args);
return resourceBundle.format(LocaleProvider.getLocale(), key, args);
} | java | public String _(String key, Object... args) {
// JellyBuilder b = (JellyBuilder)getDelegate();
ResourceBundle resourceBundle = getResourceBundle();
// notify the listener if set
// InternationalizedStringExpressionListener listener = (InternationalizedStringExpressionListener) Stapler.getCurrentRequest().getAttribute(LISTENER_NAME);
// if(listener!=null)
// listener.onUsed(this, args);
args = Stapler.htmlSafeArguments(args);
return resourceBundle.format(LocaleProvider.getLocale(), key, args);
} | [
"public",
"String",
"_",
"(",
"String",
"key",
",",
"Object",
"...",
"args",
")",
"{",
"// JellyBuilder b = (JellyBuilder)getDelegate();",
"ResourceBundle",
"resourceBundle",
"=",
"getResourceBundle",
"(",
")",
";",
"// notify the listener if set",
"// InternationalizedStringExpressionListener listener = (InternationalizedStringExpressionListener) Stapler.getCurrentRequest().getAttribute(LISTENER_NAME);",
"// if(listener!=null)",
"// listener.onUsed(this, args);",
"args",
"=",
"Stapler",
".",
"htmlSafeArguments",
"(",
"args",
")",
";",
"return",
"resourceBundle",
".",
"format",
"(",
"LocaleProvider",
".",
"getLocale",
"(",
")",
",",
"key",
",",
"args",
")",
";",
"}"
] | Looks up the resource bundle with the given key, formats with arguments,
then return that formatted string. | [
"Looks",
"up",
"the",
"resource",
"bundle",
"with",
"the",
"given",
"key",
"formats",
"with",
"arguments",
"then",
"return",
"that",
"formatted",
"string",
"."
] | train | https://github.com/stapler/stapler/blob/11ad5af185e062fb46e01bf9fbed66f3ebf2a8f7/groovy/src/main/java/org/kohsuke/stapler/jelly/groovy/StaplerClosureScript.java#L36-L49 |
statefulj/statefulj | statefulj-common/src/main/java/org/statefulj/common/utils/ReflectionUtils.java | ReflectionUtils.getField | public static Field getField(final Class<?> clazz, final String fieldName) {
"""
Climb the class hierarchy starting with the clazz provided, looking for the field with fieldName
@param clazz starting class to search at
@param fieldName name of the field we are looking for
@return Field which was found, or null if nothing was found
"""
//Define return type
//
Field
field = null;
//For each class in the hierarchy starting with the current class, try to find the declared field
//
for (Class<?> current = clazz; current != null && field == null; current = current.getSuperclass()) {
try {
//Attempt to get the field, if exception is thrown continue to the next class
//
field =
current
.getDeclaredField(
fieldName
);
}
catch (final NoSuchFieldException e) {
//ignore and continue searching
//
}
}
//Return the field we found
//
return
field;
} | java | public static Field getField(final Class<?> clazz, final String fieldName) {
//Define return type
//
Field
field = null;
//For each class in the hierarchy starting with the current class, try to find the declared field
//
for (Class<?> current = clazz; current != null && field == null; current = current.getSuperclass()) {
try {
//Attempt to get the field, if exception is thrown continue to the next class
//
field =
current
.getDeclaredField(
fieldName
);
}
catch (final NoSuchFieldException e) {
//ignore and continue searching
//
}
}
//Return the field we found
//
return
field;
} | [
"public",
"static",
"Field",
"getField",
"(",
"final",
"Class",
"<",
"?",
">",
"clazz",
",",
"final",
"String",
"fieldName",
")",
"{",
"//Define return type",
"//",
"Field",
"field",
"=",
"null",
";",
"//For each class in the hierarchy starting with the current class, try to find the declared field",
"//",
"for",
"(",
"Class",
"<",
"?",
">",
"current",
"=",
"clazz",
";",
"current",
"!=",
"null",
"&&",
"field",
"==",
"null",
";",
"current",
"=",
"current",
".",
"getSuperclass",
"(",
")",
")",
"{",
"try",
"{",
"//Attempt to get the field, if exception is thrown continue to the next class",
"//",
"field",
"=",
"current",
".",
"getDeclaredField",
"(",
"fieldName",
")",
";",
"}",
"catch",
"(",
"final",
"NoSuchFieldException",
"e",
")",
"{",
"//ignore and continue searching",
"//",
"}",
"}",
"//Return the field we found",
"//",
"return",
"field",
";",
"}"
] | Climb the class hierarchy starting with the clazz provided, looking for the field with fieldName
@param clazz starting class to search at
@param fieldName name of the field we are looking for
@return Field which was found, or null if nothing was found | [
"Climb",
"the",
"class",
"hierarchy",
"starting",
"with",
"the",
"clazz",
"provided",
"looking",
"for",
"the",
"field",
"with",
"fieldName"
] | train | https://github.com/statefulj/statefulj/blob/d3459b3cb12bd508643027743401484a231e5fa1/statefulj-common/src/main/java/org/statefulj/common/utils/ReflectionUtils.java#L187-L215 |
apereo/cas | support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/AbstractSamlProfileHandlerController.java | AbstractSamlProfileHandlerController.buildCasAssertion | protected Assertion buildCasAssertion(final String principal,
final RegisteredService registeredService,
final Map<String, Object> attributes) {
"""
Build cas assertion.
@param principal the principal
@param registeredService the registered service
@param attributes the attributes
@return the assertion
"""
val p = new AttributePrincipalImpl(principal, attributes);
return new AssertionImpl(p, DateTimeUtils.dateOf(ZonedDateTime.now(ZoneOffset.UTC)),
null, DateTimeUtils.dateOf(ZonedDateTime.now(ZoneOffset.UTC)), attributes);
} | java | protected Assertion buildCasAssertion(final String principal,
final RegisteredService registeredService,
final Map<String, Object> attributes) {
val p = new AttributePrincipalImpl(principal, attributes);
return new AssertionImpl(p, DateTimeUtils.dateOf(ZonedDateTime.now(ZoneOffset.UTC)),
null, DateTimeUtils.dateOf(ZonedDateTime.now(ZoneOffset.UTC)), attributes);
} | [
"protected",
"Assertion",
"buildCasAssertion",
"(",
"final",
"String",
"principal",
",",
"final",
"RegisteredService",
"registeredService",
",",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"attributes",
")",
"{",
"val",
"p",
"=",
"new",
"AttributePrincipalImpl",
"(",
"principal",
",",
"attributes",
")",
";",
"return",
"new",
"AssertionImpl",
"(",
"p",
",",
"DateTimeUtils",
".",
"dateOf",
"(",
"ZonedDateTime",
".",
"now",
"(",
"ZoneOffset",
".",
"UTC",
")",
")",
",",
"null",
",",
"DateTimeUtils",
".",
"dateOf",
"(",
"ZonedDateTime",
".",
"now",
"(",
"ZoneOffset",
".",
"UTC",
")",
")",
",",
"attributes",
")",
";",
"}"
] | Build cas assertion.
@param principal the principal
@param registeredService the registered service
@param attributes the attributes
@return the assertion | [
"Build",
"cas",
"assertion",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/AbstractSamlProfileHandlerController.java#L181-L187 |
j-a-w-r/jawr | jawr-core/src/main/java/net/jawr/web/util/ReflectionUtils.java | ReflectionUtils.methodEquals | public static boolean methodEquals( Method method, Method other) {
"""
Checks if the 2 methods are equals.
@param method the first method
@param other the second method
@return true if the 2 methods are equals
"""
if ((method.getDeclaringClass().equals( other.getDeclaringClass()))
&& (method.getName().equals( other.getName()))) {
if (!method.getReturnType().equals(other.getReturnType()))
return false;
Class<?>[] params1 = method.getParameterTypes();
Class<?>[] params2 = other.getParameterTypes();
if (params1.length == params2.length) {
for (int i = 0; i < params1.length; i++) {
if (params1[i] != params2[i])
return false;
}
return true;
}
}
return false;
} | java | public static boolean methodEquals( Method method, Method other){
if ((method.getDeclaringClass().equals( other.getDeclaringClass()))
&& (method.getName().equals( other.getName()))) {
if (!method.getReturnType().equals(other.getReturnType()))
return false;
Class<?>[] params1 = method.getParameterTypes();
Class<?>[] params2 = other.getParameterTypes();
if (params1.length == params2.length) {
for (int i = 0; i < params1.length; i++) {
if (params1[i] != params2[i])
return false;
}
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"methodEquals",
"(",
"Method",
"method",
",",
"Method",
"other",
")",
"{",
"if",
"(",
"(",
"method",
".",
"getDeclaringClass",
"(",
")",
".",
"equals",
"(",
"other",
".",
"getDeclaringClass",
"(",
")",
")",
")",
"&&",
"(",
"method",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"other",
".",
"getName",
"(",
")",
")",
")",
")",
"{",
"if",
"(",
"!",
"method",
".",
"getReturnType",
"(",
")",
".",
"equals",
"(",
"other",
".",
"getReturnType",
"(",
")",
")",
")",
"return",
"false",
";",
"Class",
"<",
"?",
">",
"[",
"]",
"params1",
"=",
"method",
".",
"getParameterTypes",
"(",
")",
";",
"Class",
"<",
"?",
">",
"[",
"]",
"params2",
"=",
"other",
".",
"getParameterTypes",
"(",
")",
";",
"if",
"(",
"params1",
".",
"length",
"==",
"params2",
".",
"length",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"params1",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"params1",
"[",
"i",
"]",
"!=",
"params2",
"[",
"i",
"]",
")",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] | Checks if the 2 methods are equals.
@param method the first method
@param other the second method
@return true if the 2 methods are equals | [
"Checks",
"if",
"the",
"2",
"methods",
"are",
"equals",
"."
] | train | https://github.com/j-a-w-r/jawr/blob/1fa7cd46ebcd36908bd90b298ca316fa5b0c1b0d/jawr-core/src/main/java/net/jawr/web/util/ReflectionUtils.java#L50-L68 |
thrau/jarchivelib | src/main/java/org/rauschig/jarchivelib/CommonsStreamFactory.java | CommonsStreamFactory.createArchiveOutputStream | static ArchiveOutputStream createArchiveOutputStream(CommonsArchiver archiver, File archive) throws IOException,
ArchiveException {
"""
Uses the {@link ArchiveStreamFactory} and the name of the given archiver to create a new
{@link ArchiveOutputStream} for the given archive {@link File}.
@param archiver the invoking archiver
@param archive the archive file to create the {@link ArchiveOutputStream} for
@return a new {@link ArchiveOutputStream}
@throws IOException propagated IOExceptions when creating the FileOutputStream.
@throws ArchiveException if the archiver name is not known
"""
return createArchiveOutputStream(archiver.getArchiveFormat(), archive);
} | java | static ArchiveOutputStream createArchiveOutputStream(CommonsArchiver archiver, File archive) throws IOException,
ArchiveException {
return createArchiveOutputStream(archiver.getArchiveFormat(), archive);
} | [
"static",
"ArchiveOutputStream",
"createArchiveOutputStream",
"(",
"CommonsArchiver",
"archiver",
",",
"File",
"archive",
")",
"throws",
"IOException",
",",
"ArchiveException",
"{",
"return",
"createArchiveOutputStream",
"(",
"archiver",
".",
"getArchiveFormat",
"(",
")",
",",
"archive",
")",
";",
"}"
] | Uses the {@link ArchiveStreamFactory} and the name of the given archiver to create a new
{@link ArchiveOutputStream} for the given archive {@link File}.
@param archiver the invoking archiver
@param archive the archive file to create the {@link ArchiveOutputStream} for
@return a new {@link ArchiveOutputStream}
@throws IOException propagated IOExceptions when creating the FileOutputStream.
@throws ArchiveException if the archiver name is not known | [
"Uses",
"the",
"{",
"@link",
"ArchiveStreamFactory",
"}",
"and",
"the",
"name",
"of",
"the",
"given",
"archiver",
"to",
"create",
"a",
"new",
"{",
"@link",
"ArchiveOutputStream",
"}",
"for",
"the",
"given",
"archive",
"{",
"@link",
"File",
"}",
"."
] | train | https://github.com/thrau/jarchivelib/blob/8afee5124c588f589306796985b722d63572bbfa/src/main/java/org/rauschig/jarchivelib/CommonsStreamFactory.java#L118-L121 |
xetorthio/jedis | src/main/java/redis/clients/jedis/BinaryJedis.java | BinaryJedis.srem | @Override
public Long srem(final byte[] key, final byte[]... member) {
"""
Remove the specified member from the set value stored at key. If member was not a member of the
set no operation is performed. If key does not hold a set value an error is returned.
<p>
Time complexity O(1)
@param key the key of the set
@param member the set member to remove
@return Integer reply, specifically: 1 if the new element was removed 0 if the new element was
not a member of the set
"""
checkIsInMultiOrPipeline();
client.srem(key, member);
return client.getIntegerReply();
} | java | @Override
public Long srem(final byte[] key, final byte[]... member) {
checkIsInMultiOrPipeline();
client.srem(key, member);
return client.getIntegerReply();
} | [
"@",
"Override",
"public",
"Long",
"srem",
"(",
"final",
"byte",
"[",
"]",
"key",
",",
"final",
"byte",
"[",
"]",
"...",
"member",
")",
"{",
"checkIsInMultiOrPipeline",
"(",
")",
";",
"client",
".",
"srem",
"(",
"key",
",",
"member",
")",
";",
"return",
"client",
".",
"getIntegerReply",
"(",
")",
";",
"}"
] | Remove the specified member from the set value stored at key. If member was not a member of the
set no operation is performed. If key does not hold a set value an error is returned.
<p>
Time complexity O(1)
@param key the key of the set
@param member the set member to remove
@return Integer reply, specifically: 1 if the new element was removed 0 if the new element was
not a member of the set | [
"Remove",
"the",
"specified",
"member",
"from",
"the",
"set",
"value",
"stored",
"at",
"key",
".",
"If",
"member",
"was",
"not",
"a",
"member",
"of",
"the",
"set",
"no",
"operation",
"is",
"performed",
".",
"If",
"key",
"does",
"not",
"hold",
"a",
"set",
"value",
"an",
"error",
"is",
"returned",
".",
"<p",
">",
"Time",
"complexity",
"O",
"(",
"1",
")"
] | train | https://github.com/xetorthio/jedis/blob/ef4ab403f9d8fd88bd05092fea96de2e9db0bede/src/main/java/redis/clients/jedis/BinaryJedis.java#L1415-L1420 |
alkacon/opencms-core | src/org/opencms/jlan/CmsJlanDiskInterface.java | CmsJlanDiskInterface.getFileForPath | protected CmsJlanNetworkFile getFileForPath(SrvSession session, TreeConnection connection, String path)
throws CmsException {
"""
Helper method to get a network file object given a path.<p>
@param session the current session
@param connection the current connection
@param path the file path
@return the network file object for the given path
@throws CmsException if something goes wrong
"""
CmsObjectWrapper cms = getCms(session, connection);
return getFileForPath(cms, session, connection, path);
} | java | protected CmsJlanNetworkFile getFileForPath(SrvSession session, TreeConnection connection, String path)
throws CmsException {
CmsObjectWrapper cms = getCms(session, connection);
return getFileForPath(cms, session, connection, path);
} | [
"protected",
"CmsJlanNetworkFile",
"getFileForPath",
"(",
"SrvSession",
"session",
",",
"TreeConnection",
"connection",
",",
"String",
"path",
")",
"throws",
"CmsException",
"{",
"CmsObjectWrapper",
"cms",
"=",
"getCms",
"(",
"session",
",",
"connection",
")",
";",
"return",
"getFileForPath",
"(",
"cms",
",",
"session",
",",
"connection",
",",
"path",
")",
";",
"}"
] | Helper method to get a network file object given a path.<p>
@param session the current session
@param connection the current connection
@param path the file path
@return the network file object for the given path
@throws CmsException if something goes wrong | [
"Helper",
"method",
"to",
"get",
"a",
"network",
"file",
"object",
"given",
"a",
"path",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jlan/CmsJlanDiskInterface.java#L474-L479 |
google/closure-compiler | src/com/google/javascript/jscomp/CheckJSDoc.java | CheckJSDoc.isJSDocOnFunctionNode | private boolean isJSDocOnFunctionNode(Node n, JSDocInfo info) {
"""
Whether this node's JSDoc may apply to a function
<p>This has some false positive cases, to allow for patterns like goog.abstractMethod.
"""
switch (n.getToken()) {
case FUNCTION:
case GETTER_DEF:
case SETTER_DEF:
case MEMBER_FUNCTION_DEF:
case STRING_KEY:
case COMPUTED_PROP:
case EXPORT:
return true;
case GETELEM:
case GETPROP:
if (n.getFirstChild().isQualifiedName()) {
// assume qualified names may be function declarations
return true;
}
return false;
case VAR:
case LET:
case CONST:
case ASSIGN:
{
Node lhs = n.getFirstChild();
Node rhs = NodeUtil.getRValueOfLValue(lhs);
if (rhs != null && isClass(rhs) && !info.isConstructor()) {
return false;
}
// TODO(b/124081098): Check that the RHS of the assignment is a
// function. Note that it can be a FUNCTION node, but it can also be
// a call to goog.abstractMethod, goog.functions.constant, etc.
return true;
}
default:
return false;
}
} | java | private boolean isJSDocOnFunctionNode(Node n, JSDocInfo info) {
switch (n.getToken()) {
case FUNCTION:
case GETTER_DEF:
case SETTER_DEF:
case MEMBER_FUNCTION_DEF:
case STRING_KEY:
case COMPUTED_PROP:
case EXPORT:
return true;
case GETELEM:
case GETPROP:
if (n.getFirstChild().isQualifiedName()) {
// assume qualified names may be function declarations
return true;
}
return false;
case VAR:
case LET:
case CONST:
case ASSIGN:
{
Node lhs = n.getFirstChild();
Node rhs = NodeUtil.getRValueOfLValue(lhs);
if (rhs != null && isClass(rhs) && !info.isConstructor()) {
return false;
}
// TODO(b/124081098): Check that the RHS of the assignment is a
// function. Note that it can be a FUNCTION node, but it can also be
// a call to goog.abstractMethod, goog.functions.constant, etc.
return true;
}
default:
return false;
}
} | [
"private",
"boolean",
"isJSDocOnFunctionNode",
"(",
"Node",
"n",
",",
"JSDocInfo",
"info",
")",
"{",
"switch",
"(",
"n",
".",
"getToken",
"(",
")",
")",
"{",
"case",
"FUNCTION",
":",
"case",
"GETTER_DEF",
":",
"case",
"SETTER_DEF",
":",
"case",
"MEMBER_FUNCTION_DEF",
":",
"case",
"STRING_KEY",
":",
"case",
"COMPUTED_PROP",
":",
"case",
"EXPORT",
":",
"return",
"true",
";",
"case",
"GETELEM",
":",
"case",
"GETPROP",
":",
"if",
"(",
"n",
".",
"getFirstChild",
"(",
")",
".",
"isQualifiedName",
"(",
")",
")",
"{",
"// assume qualified names may be function declarations",
"return",
"true",
";",
"}",
"return",
"false",
";",
"case",
"VAR",
":",
"case",
"LET",
":",
"case",
"CONST",
":",
"case",
"ASSIGN",
":",
"{",
"Node",
"lhs",
"=",
"n",
".",
"getFirstChild",
"(",
")",
";",
"Node",
"rhs",
"=",
"NodeUtil",
".",
"getRValueOfLValue",
"(",
"lhs",
")",
";",
"if",
"(",
"rhs",
"!=",
"null",
"&&",
"isClass",
"(",
"rhs",
")",
"&&",
"!",
"info",
".",
"isConstructor",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"// TODO(b/124081098): Check that the RHS of the assignment is a",
"// function. Note that it can be a FUNCTION node, but it can also be",
"// a call to goog.abstractMethod, goog.functions.constant, etc.",
"return",
"true",
";",
"}",
"default",
":",
"return",
"false",
";",
"}",
"}"
] | Whether this node's JSDoc may apply to a function
<p>This has some false positive cases, to allow for patterns like goog.abstractMethod. | [
"Whether",
"this",
"node",
"s",
"JSDoc",
"may",
"apply",
"to",
"a",
"function"
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CheckJSDoc.java#L440-L476 |
mlhartme/sushi | src/main/java/net/oneandone/sushi/util/IntBitRelation.java | IntBitRelation.contains | public boolean contains(int left, int right) {
"""
Element test.
@param left left value of the pair to test.
@param right right value of the pair to test.
@return true, if (left, right) is element of the relation.
"""
if (line[left] == null) {
return false;
}
return line[left].contains(right);
} | java | public boolean contains(int left, int right) {
if (line[left] == null) {
return false;
}
return line[left].contains(right);
} | [
"public",
"boolean",
"contains",
"(",
"int",
"left",
",",
"int",
"right",
")",
"{",
"if",
"(",
"line",
"[",
"left",
"]",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"return",
"line",
"[",
"left",
"]",
".",
"contains",
"(",
"right",
")",
";",
"}"
] | Element test.
@param left left value of the pair to test.
@param right right value of the pair to test.
@return true, if (left, right) is element of the relation. | [
"Element",
"test",
"."
] | train | https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/util/IntBitRelation.java#L99-L104 |
Esri/geometry-api-java | src/main/java/com/esri/core/geometry/Transformation2D.java | Transformation2D.initializeFromRectIsotropic | void initializeFromRectIsotropic(Envelope2D src, Envelope2D dest) {
"""
Initializes an orhtonormal transformation from the Src and Dest
rectangles.
The result transformation proportionally fits the Src into the Dest. The
center of the Src will be in the center of the Dest.
"""
if (src.isEmpty() || dest.isEmpty() || 0 == src.getWidth()
|| 0 == src.getHeight())
setZero();
else {
yx = 0;
xy = 0;
xx = dest.getWidth() / src.getWidth();
yy = dest.getHeight() / src.getHeight();
if (xx > yy)
xx = yy;
else
yy = xx;
Point2D destCenter = dest.getCenter();
Point2D srcCenter = src.getCenter();
xd = destCenter.x - srcCenter.x * xx;
yd = destCenter.y - srcCenter.y * yy;
}
} | java | void initializeFromRectIsotropic(Envelope2D src, Envelope2D dest) {
if (src.isEmpty() || dest.isEmpty() || 0 == src.getWidth()
|| 0 == src.getHeight())
setZero();
else {
yx = 0;
xy = 0;
xx = dest.getWidth() / src.getWidth();
yy = dest.getHeight() / src.getHeight();
if (xx > yy)
xx = yy;
else
yy = xx;
Point2D destCenter = dest.getCenter();
Point2D srcCenter = src.getCenter();
xd = destCenter.x - srcCenter.x * xx;
yd = destCenter.y - srcCenter.y * yy;
}
} | [
"void",
"initializeFromRectIsotropic",
"(",
"Envelope2D",
"src",
",",
"Envelope2D",
"dest",
")",
"{",
"if",
"(",
"src",
".",
"isEmpty",
"(",
")",
"||",
"dest",
".",
"isEmpty",
"(",
")",
"||",
"0",
"==",
"src",
".",
"getWidth",
"(",
")",
"||",
"0",
"==",
"src",
".",
"getHeight",
"(",
")",
")",
"setZero",
"(",
")",
";",
"else",
"{",
"yx",
"=",
"0",
";",
"xy",
"=",
"0",
";",
"xx",
"=",
"dest",
".",
"getWidth",
"(",
")",
"/",
"src",
".",
"getWidth",
"(",
")",
";",
"yy",
"=",
"dest",
".",
"getHeight",
"(",
")",
"/",
"src",
".",
"getHeight",
"(",
")",
";",
"if",
"(",
"xx",
">",
"yy",
")",
"xx",
"=",
"yy",
";",
"else",
"yy",
"=",
"xx",
";",
"Point2D",
"destCenter",
"=",
"dest",
".",
"getCenter",
"(",
")",
";",
"Point2D",
"srcCenter",
"=",
"src",
".",
"getCenter",
"(",
")",
";",
"xd",
"=",
"destCenter",
".",
"x",
"-",
"srcCenter",
".",
"x",
"*",
"xx",
";",
"yd",
"=",
"destCenter",
".",
"y",
"-",
"srcCenter",
".",
"y",
"*",
"yy",
";",
"}",
"}"
] | Initializes an orhtonormal transformation from the Src and Dest
rectangles.
The result transformation proportionally fits the Src into the Dest. The
center of the Src will be in the center of the Dest. | [
"Initializes",
"an",
"orhtonormal",
"transformation",
"from",
"the",
"Src",
"and",
"Dest",
"rectangles",
"."
] | train | https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/Transformation2D.java#L341-L361 |
grails/grails-core | grails-web-common/src/main/groovy/org/grails/web/pages/GroovyPagesUriSupport.java | GroovyPagesUriSupport.getAbsoluteTemplateURI | public String getAbsoluteTemplateURI(String templateName, boolean includeExtension) {
"""
Used to resolve template names that are not relative to a controller.
@param templateName The template name normally beginning with /
@param includeExtension The flag to include the template extension
@return The template URI
"""
FastStringWriter buf = new FastStringWriter();
String tmp = templateName.substring(1,templateName.length());
if (tmp.indexOf(SLASH) > -1) {
buf.append(SLASH);
int i = tmp.lastIndexOf(SLASH);
buf.append(tmp.substring(0, i));
buf.append(SLASH_UNDR);
buf.append(tmp.substring(i + 1,tmp.length()));
}
else {
buf.append(SLASH_UNDR);
buf.append(templateName.substring(1,templateName.length()));
}
if (includeExtension) {
buf.append(EXTENSION);
}
String uri = buf.toString();
buf.close();
return uri;
} | java | public String getAbsoluteTemplateURI(String templateName, boolean includeExtension) {
FastStringWriter buf = new FastStringWriter();
String tmp = templateName.substring(1,templateName.length());
if (tmp.indexOf(SLASH) > -1) {
buf.append(SLASH);
int i = tmp.lastIndexOf(SLASH);
buf.append(tmp.substring(0, i));
buf.append(SLASH_UNDR);
buf.append(tmp.substring(i + 1,tmp.length()));
}
else {
buf.append(SLASH_UNDR);
buf.append(templateName.substring(1,templateName.length()));
}
if (includeExtension) {
buf.append(EXTENSION);
}
String uri = buf.toString();
buf.close();
return uri;
} | [
"public",
"String",
"getAbsoluteTemplateURI",
"(",
"String",
"templateName",
",",
"boolean",
"includeExtension",
")",
"{",
"FastStringWriter",
"buf",
"=",
"new",
"FastStringWriter",
"(",
")",
";",
"String",
"tmp",
"=",
"templateName",
".",
"substring",
"(",
"1",
",",
"templateName",
".",
"length",
"(",
")",
")",
";",
"if",
"(",
"tmp",
".",
"indexOf",
"(",
"SLASH",
")",
">",
"-",
"1",
")",
"{",
"buf",
".",
"append",
"(",
"SLASH",
")",
";",
"int",
"i",
"=",
"tmp",
".",
"lastIndexOf",
"(",
"SLASH",
")",
";",
"buf",
".",
"append",
"(",
"tmp",
".",
"substring",
"(",
"0",
",",
"i",
")",
")",
";",
"buf",
".",
"append",
"(",
"SLASH_UNDR",
")",
";",
"buf",
".",
"append",
"(",
"tmp",
".",
"substring",
"(",
"i",
"+",
"1",
",",
"tmp",
".",
"length",
"(",
")",
")",
")",
";",
"}",
"else",
"{",
"buf",
".",
"append",
"(",
"SLASH_UNDR",
")",
";",
"buf",
".",
"append",
"(",
"templateName",
".",
"substring",
"(",
"1",
",",
"templateName",
".",
"length",
"(",
")",
")",
")",
";",
"}",
"if",
"(",
"includeExtension",
")",
"{",
"buf",
".",
"append",
"(",
"EXTENSION",
")",
";",
"}",
"String",
"uri",
"=",
"buf",
".",
"toString",
"(",
")",
";",
"buf",
".",
"close",
"(",
")",
";",
"return",
"uri",
";",
"}"
] | Used to resolve template names that are not relative to a controller.
@param templateName The template name normally beginning with /
@param includeExtension The flag to include the template extension
@return The template URI | [
"Used",
"to",
"resolve",
"template",
"names",
"that",
"are",
"not",
"relative",
"to",
"a",
"controller",
"."
] | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-web-common/src/main/groovy/org/grails/web/pages/GroovyPagesUriSupport.java#L157-L177 |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/util/logging/LoggingScopeFactory.java | LoggingScopeFactory.getNewLoggingScope | public LoggingScope getNewLoggingScope(final String msg, final Object[] params) {
"""
Get a new instance of LoggingScope with msg and params through new.
@param msg
@param params
@return
"""
return new LoggingScopeImpl(LOG, logLevel, msg, params);
} | java | public LoggingScope getNewLoggingScope(final String msg, final Object[] params) {
return new LoggingScopeImpl(LOG, logLevel, msg, params);
} | [
"public",
"LoggingScope",
"getNewLoggingScope",
"(",
"final",
"String",
"msg",
",",
"final",
"Object",
"[",
"]",
"params",
")",
"{",
"return",
"new",
"LoggingScopeImpl",
"(",
"LOG",
",",
"logLevel",
",",
"msg",
",",
"params",
")",
";",
"}"
] | Get a new instance of LoggingScope with msg and params through new.
@param msg
@param params
@return | [
"Get",
"a",
"new",
"instance",
"of",
"LoggingScope",
"with",
"msg",
"and",
"params",
"through",
"new",
"."
] | train | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/util/logging/LoggingScopeFactory.java#L101-L103 |
oboehm/jfachwert | src/main/java/de/jfachwert/net/Telefonnummer.java | Telefonnummer.getRufnummer | public Telefonnummer getRufnummer() {
"""
Liefert die Nummer der Ortsvermittlungsstelle, d.h. die Telefonnummer
ohne Vorwahl und Laenderkennzahl.
@return z.B. "32168"
"""
String inlandsnummer = RegExUtils.replaceAll(this.getInlandsnummer().toString(), "[ /]+", " ");
return new Telefonnummer(StringUtils.substringAfter(inlandsnummer, " ").replaceAll(" ", ""));
} | java | public Telefonnummer getRufnummer() {
String inlandsnummer = RegExUtils.replaceAll(this.getInlandsnummer().toString(), "[ /]+", " ");
return new Telefonnummer(StringUtils.substringAfter(inlandsnummer, " ").replaceAll(" ", ""));
} | [
"public",
"Telefonnummer",
"getRufnummer",
"(",
")",
"{",
"String",
"inlandsnummer",
"=",
"RegExUtils",
".",
"replaceAll",
"(",
"this",
".",
"getInlandsnummer",
"(",
")",
".",
"toString",
"(",
")",
",",
"\"[ /]+\"",
",",
"\" \"",
")",
";",
"return",
"new",
"Telefonnummer",
"(",
"StringUtils",
".",
"substringAfter",
"(",
"inlandsnummer",
",",
"\" \"",
")",
".",
"replaceAll",
"(",
"\" \"",
",",
"\"\"",
")",
")",
";",
"}"
] | Liefert die Nummer der Ortsvermittlungsstelle, d.h. die Telefonnummer
ohne Vorwahl und Laenderkennzahl.
@return z.B. "32168" | [
"Liefert",
"die",
"Nummer",
"der",
"Ortsvermittlungsstelle",
"d",
".",
"h",
".",
"die",
"Telefonnummer",
"ohne",
"Vorwahl",
"und",
"Laenderkennzahl",
"."
] | train | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/net/Telefonnummer.java#L172-L175 |
wigforss/Ka-Commons-Reflection | src/main/java/org/kasource/commons/reflection/util/MethodUtils.java | MethodUtils.getMethod | public static Method getMethod(Class<?> target, MethodFilter methodFilter) {
"""
Returns the method declared by the target class and any of its super classes, which matches the supplied
methodFilter, if method is found null is returned. If more than one method is found the
first in the resulting set iterator is returned.
@param methodFilter
The method filter to apply.
@return method that match the methodFilter or null if no such method was found.
"""
Set<Method> methods = getMethods(target, methodFilter);
if (!methods.isEmpty()) {
return methods.iterator().next();
}
return null;
} | java | public static Method getMethod(Class<?> target, MethodFilter methodFilter) {
Set<Method> methods = getMethods(target, methodFilter);
if (!methods.isEmpty()) {
return methods.iterator().next();
}
return null;
} | [
"public",
"static",
"Method",
"getMethod",
"(",
"Class",
"<",
"?",
">",
"target",
",",
"MethodFilter",
"methodFilter",
")",
"{",
"Set",
"<",
"Method",
">",
"methods",
"=",
"getMethods",
"(",
"target",
",",
"methodFilter",
")",
";",
"if",
"(",
"!",
"methods",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"methods",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Returns the method declared by the target class and any of its super classes, which matches the supplied
methodFilter, if method is found null is returned. If more than one method is found the
first in the resulting set iterator is returned.
@param methodFilter
The method filter to apply.
@return method that match the methodFilter or null if no such method was found. | [
"Returns",
"the",
"method",
"declared",
"by",
"the",
"target",
"class",
"and",
"any",
"of",
"its",
"super",
"classes",
"which",
"matches",
"the",
"supplied",
"methodFilter",
"if",
"method",
"is",
"found",
"null",
"is",
"returned",
".",
"If",
"more",
"than",
"one",
"method",
"is",
"found",
"the",
"first",
"in",
"the",
"resulting",
"set",
"iterator",
"is",
"returned",
"."
] | train | https://github.com/wigforss/Ka-Commons-Reflection/blob/a80f7a164cd800089e4f4dd948ca6f0e7badcf33/src/main/java/org/kasource/commons/reflection/util/MethodUtils.java#L130-L136 |
gosu-lang/gosu-lang | gosu-core/src/main/java/gw/internal/gosu/ir/transform/StatementTransformer.java | StatementTransformer.compileInitializerAssignment | public static IRStatement compileInitializerAssignment( TopLevelTransformationContext context, InitializerAssignment stmt, IRExpression root ) {
"""
This is in its own method because it requires additional context
"""
return InitializerAssignmentTransformer.compile( context, stmt, root );
} | java | public static IRStatement compileInitializerAssignment( TopLevelTransformationContext context, InitializerAssignment stmt, IRExpression root )
{
return InitializerAssignmentTransformer.compile( context, stmt, root );
} | [
"public",
"static",
"IRStatement",
"compileInitializerAssignment",
"(",
"TopLevelTransformationContext",
"context",
",",
"InitializerAssignment",
"stmt",
",",
"IRExpression",
"root",
")",
"{",
"return",
"InitializerAssignmentTransformer",
".",
"compile",
"(",
"context",
",",
"stmt",
",",
"root",
")",
";",
"}"
] | This is in its own method because it requires additional context | [
"This",
"is",
"in",
"its",
"own",
"method",
"because",
"it",
"requires",
"additional",
"context"
] | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/ir/transform/StatementTransformer.java#L154-L157 |
landawn/AbacusUtil | src/com/landawn/abacus/util/N.java | N.distinctBy | public static <T, E extends Exception> List<T> distinctBy(final Collection<? extends T> c, final Try.Function<? super T, ?, E> keyMapper) throws E {
"""
Distinct by the value mapped from <code>keyMapper</code>.
Mostly it's designed for one-step operation to complete the operation in one step.
<code>java.util.stream.Stream</code> is preferred for multiple phases operation.
@param c
@param keyMapper don't change value of the input parameter.
@return
"""
if (N.isNullOrEmpty(c)) {
return new ArrayList<>();
}
return distinctBy(c, 0, c.size(), keyMapper);
} | java | public static <T, E extends Exception> List<T> distinctBy(final Collection<? extends T> c, final Try.Function<? super T, ?, E> keyMapper) throws E {
if (N.isNullOrEmpty(c)) {
return new ArrayList<>();
}
return distinctBy(c, 0, c.size(), keyMapper);
} | [
"public",
"static",
"<",
"T",
",",
"E",
"extends",
"Exception",
">",
"List",
"<",
"T",
">",
"distinctBy",
"(",
"final",
"Collection",
"<",
"?",
"extends",
"T",
">",
"c",
",",
"final",
"Try",
".",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
",",
"E",
">",
"keyMapper",
")",
"throws",
"E",
"{",
"if",
"(",
"N",
".",
"isNullOrEmpty",
"(",
"c",
")",
")",
"{",
"return",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"}",
"return",
"distinctBy",
"(",
"c",
",",
"0",
",",
"c",
".",
"size",
"(",
")",
",",
"keyMapper",
")",
";",
"}"
] | Distinct by the value mapped from <code>keyMapper</code>.
Mostly it's designed for one-step operation to complete the operation in one step.
<code>java.util.stream.Stream</code> is preferred for multiple phases operation.
@param c
@param keyMapper don't change value of the input parameter.
@return | [
"Distinct",
"by",
"the",
"value",
"mapped",
"from",
"<code",
">",
"keyMapper<",
"/",
"code",
">",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L18070-L18076 |
vkostyukov/la4j | src/main/java/org/la4j/Matrix.java | Matrix.eachInRow | public void eachInRow(int i, VectorProcedure procedure) {
"""
Applies given {@code procedure} to each element of specified row of this matrix.
@param i the row index
@param procedure the vector procedure
"""
VectorIterator it = iteratorOfRow(i);
while (it.hasNext()) {
double x = it.next();
int j = it.index();
procedure.apply(j, x);
}
} | java | public void eachInRow(int i, VectorProcedure procedure) {
VectorIterator it = iteratorOfRow(i);
while (it.hasNext()) {
double x = it.next();
int j = it.index();
procedure.apply(j, x);
}
} | [
"public",
"void",
"eachInRow",
"(",
"int",
"i",
",",
"VectorProcedure",
"procedure",
")",
"{",
"VectorIterator",
"it",
"=",
"iteratorOfRow",
"(",
"i",
")",
";",
"while",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"double",
"x",
"=",
"it",
".",
"next",
"(",
")",
";",
"int",
"j",
"=",
"it",
".",
"index",
"(",
")",
";",
"procedure",
".",
"apply",
"(",
"j",
",",
"x",
")",
";",
"}",
"}"
] | Applies given {@code procedure} to each element of specified row of this matrix.
@param i the row index
@param procedure the vector procedure | [
"Applies",
"given",
"{",
"@code",
"procedure",
"}",
"to",
"each",
"element",
"of",
"specified",
"row",
"of",
"this",
"matrix",
"."
] | train | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Matrix.java#L1384-L1392 |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChannelFrameworkImpl.java | ChannelFrameworkImpl.getRunningChannel | public synchronized Channel getRunningChannel(String inputChannelName, Chain chain) {
"""
Fetch the input channel from the runtime.
@param inputChannelName
of the (parent) channel requested.
@param chain
in which channel is running.
@return Channel requested, or null if not found.
"""
if (inputChannelName == null || chain == null) {
return null;
}
Channel channel = null;
// Ensure the chain is running.
if (null != this.chainRunningMap.get(chain.getName())) {
ChannelData[] channels = chain.getChannelsData();
for (int index = 0; index < channels.length; index++) {
if (channels[index].getExternalName().equals(inputChannelName)) {
channel = chain.getChannels()[index];
break;
}
}
}
return channel;
} | java | public synchronized Channel getRunningChannel(String inputChannelName, Chain chain) {
if (inputChannelName == null || chain == null) {
return null;
}
Channel channel = null;
// Ensure the chain is running.
if (null != this.chainRunningMap.get(chain.getName())) {
ChannelData[] channels = chain.getChannelsData();
for (int index = 0; index < channels.length; index++) {
if (channels[index].getExternalName().equals(inputChannelName)) {
channel = chain.getChannels()[index];
break;
}
}
}
return channel;
} | [
"public",
"synchronized",
"Channel",
"getRunningChannel",
"(",
"String",
"inputChannelName",
",",
"Chain",
"chain",
")",
"{",
"if",
"(",
"inputChannelName",
"==",
"null",
"||",
"chain",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Channel",
"channel",
"=",
"null",
";",
"// Ensure the chain is running.",
"if",
"(",
"null",
"!=",
"this",
".",
"chainRunningMap",
".",
"get",
"(",
"chain",
".",
"getName",
"(",
")",
")",
")",
"{",
"ChannelData",
"[",
"]",
"channels",
"=",
"chain",
".",
"getChannelsData",
"(",
")",
";",
"for",
"(",
"int",
"index",
"=",
"0",
";",
"index",
"<",
"channels",
".",
"length",
";",
"index",
"++",
")",
"{",
"if",
"(",
"channels",
"[",
"index",
"]",
".",
"getExternalName",
"(",
")",
".",
"equals",
"(",
"inputChannelName",
")",
")",
"{",
"channel",
"=",
"chain",
".",
"getChannels",
"(",
")",
"[",
"index",
"]",
";",
"break",
";",
"}",
"}",
"}",
"return",
"channel",
";",
"}"
] | Fetch the input channel from the runtime.
@param inputChannelName
of the (parent) channel requested.
@param chain
in which channel is running.
@return Channel requested, or null if not found. | [
"Fetch",
"the",
"input",
"channel",
"from",
"the",
"runtime",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChannelFrameworkImpl.java#L4048-L4065 |
GeoLatte/geolatte-common | src/main/java/org/geolatte/common/dataformats/json/jackson/GeometryDeserializer.java | GeometryDeserializer.setCrsIds | private String setCrsIds(String json, CrsId crsId) throws IOException, JsonException {
"""
Adds the given crs to all json objects. Used in {@link #asGeomCollection(org.geolatte.geom.crs.CrsId)}.
@param json the json string representing an array of geometry objects without crs property.
@param crsId the crsId
@return the same json string with the crs property filled in for each of the geometries.
"""
/* Prepare a geojson crs structure
"crs": {
"type": "name",
"properties": {
"name": "EPSG:xxxx"
}
}
*/
HashMap<String, Object> properties = new HashMap<String, Object>();
properties.put("name", crsId.getAuthority() + ":" + crsId.getCode());
HashMap<String, Object> type = new HashMap<String, Object>();
type.put("type", "name");
type.put("properties", properties);
List<HashMap> result = parent.collectionFromJson(json, HashMap.class);
for (HashMap geometryJson : result) {
geometryJson.put("crs", type);
}
return parent.toJson(result);
} | java | private String setCrsIds(String json, CrsId crsId) throws IOException, JsonException {
/* Prepare a geojson crs structure
"crs": {
"type": "name",
"properties": {
"name": "EPSG:xxxx"
}
}
*/
HashMap<String, Object> properties = new HashMap<String, Object>();
properties.put("name", crsId.getAuthority() + ":" + crsId.getCode());
HashMap<String, Object> type = new HashMap<String, Object>();
type.put("type", "name");
type.put("properties", properties);
List<HashMap> result = parent.collectionFromJson(json, HashMap.class);
for (HashMap geometryJson : result) {
geometryJson.put("crs", type);
}
return parent.toJson(result);
} | [
"private",
"String",
"setCrsIds",
"(",
"String",
"json",
",",
"CrsId",
"crsId",
")",
"throws",
"IOException",
",",
"JsonException",
"{",
"/* Prepare a geojson crs structure\n \"crs\": {\n \"type\": \"name\",\n \"properties\": {\n \"name\": \"EPSG:xxxx\"\n }\n }\n */",
"HashMap",
"<",
"String",
",",
"Object",
">",
"properties",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"properties",
".",
"put",
"(",
"\"name\"",
",",
"crsId",
".",
"getAuthority",
"(",
")",
"+",
"\":\"",
"+",
"crsId",
".",
"getCode",
"(",
")",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"type",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"type",
".",
"put",
"(",
"\"type\"",
",",
"\"name\"",
")",
";",
"type",
".",
"put",
"(",
"\"properties\"",
",",
"properties",
")",
";",
"List",
"<",
"HashMap",
">",
"result",
"=",
"parent",
".",
"collectionFromJson",
"(",
"json",
",",
"HashMap",
".",
"class",
")",
";",
"for",
"(",
"HashMap",
"geometryJson",
":",
"result",
")",
"{",
"geometryJson",
".",
"put",
"(",
"\"crs\"",
",",
"type",
")",
";",
"}",
"return",
"parent",
".",
"toJson",
"(",
"result",
")",
";",
"}"
] | Adds the given crs to all json objects. Used in {@link #asGeomCollection(org.geolatte.geom.crs.CrsId)}.
@param json the json string representing an array of geometry objects without crs property.
@param crsId the crsId
@return the same json string with the crs property filled in for each of the geometries. | [
"Adds",
"the",
"given",
"crs",
"to",
"all",
"json",
"objects",
".",
"Used",
"in",
"{",
"@link",
"#asGeomCollection",
"(",
"org",
".",
"geolatte",
".",
"geom",
".",
"crs",
".",
"CrsId",
")",
"}",
"."
] | train | https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/dataformats/json/jackson/GeometryDeserializer.java#L181-L204 |
UrielCh/ovh-java-sdk | ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java | ApiOvhSms.serviceName_phonebooks_bookKey_phonebookContact_POST | public Long serviceName_phonebooks_bookKey_phonebookContact_POST(String serviceName, String bookKey, String group, String homeMobile, String homePhone, String name, String surname, String workMobile, String workPhone) throws IOException {
"""
Create a phonebook contact. Return identifier of the phonebook contact.
REST: POST /sms/{serviceName}/phonebooks/{bookKey}/phonebookContact
@param homeMobile [required] Home mobile phone number of the contact
@param surname [required] Contact surname
@param homePhone [required] Home landline phone number of the contact
@param name [required] Name of the contact
@param group [required] Group name of the phonebook
@param workMobile [required] Mobile phone office number of the contact
@param workPhone [required] Landline phone office number of the contact
@param serviceName [required] The internal name of your SMS offer
@param bookKey [required] Identifier of the phonebook
"""
String qPath = "/sms/{serviceName}/phonebooks/{bookKey}/phonebookContact";
StringBuilder sb = path(qPath, serviceName, bookKey);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "group", group);
addBody(o, "homeMobile", homeMobile);
addBody(o, "homePhone", homePhone);
addBody(o, "name", name);
addBody(o, "surname", surname);
addBody(o, "workMobile", workMobile);
addBody(o, "workPhone", workPhone);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, Long.class);
} | java | public Long serviceName_phonebooks_bookKey_phonebookContact_POST(String serviceName, String bookKey, String group, String homeMobile, String homePhone, String name, String surname, String workMobile, String workPhone) throws IOException {
String qPath = "/sms/{serviceName}/phonebooks/{bookKey}/phonebookContact";
StringBuilder sb = path(qPath, serviceName, bookKey);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "group", group);
addBody(o, "homeMobile", homeMobile);
addBody(o, "homePhone", homePhone);
addBody(o, "name", name);
addBody(o, "surname", surname);
addBody(o, "workMobile", workMobile);
addBody(o, "workPhone", workPhone);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, Long.class);
} | [
"public",
"Long",
"serviceName_phonebooks_bookKey_phonebookContact_POST",
"(",
"String",
"serviceName",
",",
"String",
"bookKey",
",",
"String",
"group",
",",
"String",
"homeMobile",
",",
"String",
"homePhone",
",",
"String",
"name",
",",
"String",
"surname",
",",
"String",
"workMobile",
",",
"String",
"workPhone",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/sms/{serviceName}/phonebooks/{bookKey}/phonebookContact\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
",",
"bookKey",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"group\"",
",",
"group",
")",
";",
"addBody",
"(",
"o",
",",
"\"homeMobile\"",
",",
"homeMobile",
")",
";",
"addBody",
"(",
"o",
",",
"\"homePhone\"",
",",
"homePhone",
")",
";",
"addBody",
"(",
"o",
",",
"\"name\"",
",",
"name",
")",
";",
"addBody",
"(",
"o",
",",
"\"surname\"",
",",
"surname",
")",
";",
"addBody",
"(",
"o",
",",
"\"workMobile\"",
",",
"workMobile",
")",
";",
"addBody",
"(",
"o",
",",
"\"workPhone\"",
",",
"workPhone",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"Long",
".",
"class",
")",
";",
"}"
] | Create a phonebook contact. Return identifier of the phonebook contact.
REST: POST /sms/{serviceName}/phonebooks/{bookKey}/phonebookContact
@param homeMobile [required] Home mobile phone number of the contact
@param surname [required] Contact surname
@param homePhone [required] Home landline phone number of the contact
@param name [required] Name of the contact
@param group [required] Group name of the phonebook
@param workMobile [required] Mobile phone office number of the contact
@param workPhone [required] Landline phone office number of the contact
@param serviceName [required] The internal name of your SMS offer
@param bookKey [required] Identifier of the phonebook | [
"Create",
"a",
"phonebook",
"contact",
".",
"Return",
"identifier",
"of",
"the",
"phonebook",
"contact",
"."
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java#L1192-L1205 |
JOML-CI/JOML | src/org/joml/Matrix3x2d.java | Matrix3x2d.scale | public Matrix3x2d scale(Vector2dc xy, Matrix3x2d dest) {
"""
Apply scaling to this matrix by scaling the base axes by the given <code>xy</code> factors
and store the result in <code>dest</code>.
<p>
If <code>M</code> is <code>this</code> matrix and <code>S</code> the scaling matrix,
then the new matrix will be <code>M * S</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * S * v</code>, the scaling will be applied first!
@param xy
the factors of the x and y component, respectively
@param dest
will hold the result
@return dest
"""
return scale(xy.x(), xy.y(), dest);
} | java | public Matrix3x2d scale(Vector2dc xy, Matrix3x2d dest) {
return scale(xy.x(), xy.y(), dest);
} | [
"public",
"Matrix3x2d",
"scale",
"(",
"Vector2dc",
"xy",
",",
"Matrix3x2d",
"dest",
")",
"{",
"return",
"scale",
"(",
"xy",
".",
"x",
"(",
")",
",",
"xy",
".",
"y",
"(",
")",
",",
"dest",
")",
";",
"}"
] | Apply scaling to this matrix by scaling the base axes by the given <code>xy</code> factors
and store the result in <code>dest</code>.
<p>
If <code>M</code> is <code>this</code> matrix and <code>S</code> the scaling matrix,
then the new matrix will be <code>M * S</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * S * v</code>, the scaling will be applied first!
@param xy
the factors of the x and y component, respectively
@param dest
will hold the result
@return dest | [
"Apply",
"scaling",
"to",
"this",
"matrix",
"by",
"scaling",
"the",
"base",
"axes",
"by",
"the",
"given",
"<code",
">",
"xy<",
"/",
"code",
">",
"factors",
"and",
"store",
"the",
"result",
"in",
"<code",
">",
"dest<",
"/",
"code",
">",
".",
"<p",
">",
"If",
"<code",
">",
"M<",
"/",
"code",
">",
"is",
"<code",
">",
"this<",
"/",
"code",
">",
"matrix",
"and",
"<code",
">",
"S<",
"/",
"code",
">",
"the",
"scaling",
"matrix",
"then",
"the",
"new",
"matrix",
"will",
"be",
"<code",
">",
"M",
"*",
"S<",
"/",
"code",
">",
".",
"So",
"when",
"transforming",
"a",
"vector",
"<code",
">",
"v<",
"/",
"code",
">",
"with",
"the",
"new",
"matrix",
"by",
"using",
"<code",
">",
"M",
"*",
"S",
"*",
"v<",
"/",
"code",
">",
"the",
"scaling",
"will",
"be",
"applied",
"first!"
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3x2d.java#L1280-L1282 |
micrometer-metrics/micrometer | micrometer-core/src/main/java/io/micrometer/core/instrument/binder/db/DatabaseTableMetrics.java | DatabaseTableMetrics.monitor | public static void monitor(MeterRegistry registry, DataSource dataSource, String dataSourceName, String tableName, Iterable<Tag> tags) {
"""
Record the row count for an individual database table.
@param registry The registry to bind metrics to.
@param dataSource The data source to use to run the row count query.
@param dataSourceName The name prefix of the metrics.
@param tableName The name of the table to report table size for.
@param tags Tags to apply to all recorded metrics.
"""
new DatabaseTableMetrics(dataSource, dataSourceName, tableName, tags).bindTo(registry);
} | java | public static void monitor(MeterRegistry registry, DataSource dataSource, String dataSourceName, String tableName, Iterable<Tag> tags) {
new DatabaseTableMetrics(dataSource, dataSourceName, tableName, tags).bindTo(registry);
} | [
"public",
"static",
"void",
"monitor",
"(",
"MeterRegistry",
"registry",
",",
"DataSource",
"dataSource",
",",
"String",
"dataSourceName",
",",
"String",
"tableName",
",",
"Iterable",
"<",
"Tag",
">",
"tags",
")",
"{",
"new",
"DatabaseTableMetrics",
"(",
"dataSource",
",",
"dataSourceName",
",",
"tableName",
",",
"tags",
")",
".",
"bindTo",
"(",
"registry",
")",
";",
"}"
] | Record the row count for an individual database table.
@param registry The registry to bind metrics to.
@param dataSource The data source to use to run the row count query.
@param dataSourceName The name prefix of the metrics.
@param tableName The name of the table to report table size for.
@param tags Tags to apply to all recorded metrics. | [
"Record",
"the",
"row",
"count",
"for",
"an",
"individual",
"database",
"table",
"."
] | train | https://github.com/micrometer-metrics/micrometer/blob/127fa3265325cc894f368312ed8890b76a055d88/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/db/DatabaseTableMetrics.java#L97-L99 |
xvik/guice-persist-orient | src/main/java/ru/vyarus/guice/persist/orient/repository/core/ext/util/ExtUtils.java | ExtUtils.findAmendAnnotations | public static List<Annotation> findAmendAnnotations(
final Method method, final Class<?> root,
final Class<? extends RepositoryMethodDescriptor> descriptorType) {
"""
Searches for amend annotations (annotations annotated with
{@link ru.vyarus.guice.persist.orient.repository.core.spi.amend.AmendMethod}).
<p>
Amend annotation may be defined on method, type and probably globally on root repository type.
If annotation is defined in two places then only more prioritized will be used.
Priorities: method, direct method type, repository type (in simple cases the last two will be the same type).
<p>
Extensions compatibility is checked against descriptor object. If extension declared directly on method
error will be throw (bad usage). For type and root type declared extensions, incompatible extensions simply
skipped (case when extension should apply to all methods except few).
@param method repository method
@param root root repository type
@param descriptorType type of descriptor object (used to filter extensions)
@return list of found extension annotations
"""
final List<Annotation> res = filterAnnotations(AmendMethod.class, method.getAnnotations());
// strict check: if bad annotation defined - definitely error
ExtCompatibilityUtils.checkAmendExtensionsCompatibility(descriptorType, res);
// some annotations may be defined on type; these annotations are filtered according to descriptor
merge(res, filterAnnotations(AmendMethod.class, method.getDeclaringClass().getAnnotations()), descriptorType);
if (root != method.getDeclaringClass()) {
// global extensions may be applied on repository level
merge(res, filterAnnotations(AmendMethod.class, root.getAnnotations()), descriptorType);
}
return res;
} | java | public static List<Annotation> findAmendAnnotations(
final Method method, final Class<?> root,
final Class<? extends RepositoryMethodDescriptor> descriptorType) {
final List<Annotation> res = filterAnnotations(AmendMethod.class, method.getAnnotations());
// strict check: if bad annotation defined - definitely error
ExtCompatibilityUtils.checkAmendExtensionsCompatibility(descriptorType, res);
// some annotations may be defined on type; these annotations are filtered according to descriptor
merge(res, filterAnnotations(AmendMethod.class, method.getDeclaringClass().getAnnotations()), descriptorType);
if (root != method.getDeclaringClass()) {
// global extensions may be applied on repository level
merge(res, filterAnnotations(AmendMethod.class, root.getAnnotations()), descriptorType);
}
return res;
} | [
"public",
"static",
"List",
"<",
"Annotation",
">",
"findAmendAnnotations",
"(",
"final",
"Method",
"method",
",",
"final",
"Class",
"<",
"?",
">",
"root",
",",
"final",
"Class",
"<",
"?",
"extends",
"RepositoryMethodDescriptor",
">",
"descriptorType",
")",
"{",
"final",
"List",
"<",
"Annotation",
">",
"res",
"=",
"filterAnnotations",
"(",
"AmendMethod",
".",
"class",
",",
"method",
".",
"getAnnotations",
"(",
")",
")",
";",
"// strict check: if bad annotation defined - definitely error",
"ExtCompatibilityUtils",
".",
"checkAmendExtensionsCompatibility",
"(",
"descriptorType",
",",
"res",
")",
";",
"// some annotations may be defined on type; these annotations are filtered according to descriptor",
"merge",
"(",
"res",
",",
"filterAnnotations",
"(",
"AmendMethod",
".",
"class",
",",
"method",
".",
"getDeclaringClass",
"(",
")",
".",
"getAnnotations",
"(",
")",
")",
",",
"descriptorType",
")",
";",
"if",
"(",
"root",
"!=",
"method",
".",
"getDeclaringClass",
"(",
")",
")",
"{",
"// global extensions may be applied on repository level",
"merge",
"(",
"res",
",",
"filterAnnotations",
"(",
"AmendMethod",
".",
"class",
",",
"root",
".",
"getAnnotations",
"(",
")",
")",
",",
"descriptorType",
")",
";",
"}",
"return",
"res",
";",
"}"
] | Searches for amend annotations (annotations annotated with
{@link ru.vyarus.guice.persist.orient.repository.core.spi.amend.AmendMethod}).
<p>
Amend annotation may be defined on method, type and probably globally on root repository type.
If annotation is defined in two places then only more prioritized will be used.
Priorities: method, direct method type, repository type (in simple cases the last two will be the same type).
<p>
Extensions compatibility is checked against descriptor object. If extension declared directly on method
error will be throw (bad usage). For type and root type declared extensions, incompatible extensions simply
skipped (case when extension should apply to all methods except few).
@param method repository method
@param root root repository type
@param descriptorType type of descriptor object (used to filter extensions)
@return list of found extension annotations | [
"Searches",
"for",
"amend",
"annotations",
"(",
"annotations",
"annotated",
"with",
"{",
"@link",
"ru",
".",
"vyarus",
".",
"guice",
".",
"persist",
".",
"orient",
".",
"repository",
".",
"core",
".",
"spi",
".",
"amend",
".",
"AmendMethod",
"}",
")",
".",
"<p",
">",
"Amend",
"annotation",
"may",
"be",
"defined",
"on",
"method",
"type",
"and",
"probably",
"globally",
"on",
"root",
"repository",
"type",
".",
"If",
"annotation",
"is",
"defined",
"in",
"two",
"places",
"then",
"only",
"more",
"prioritized",
"will",
"be",
"used",
".",
"Priorities",
":",
"method",
"direct",
"method",
"type",
"repository",
"type",
"(",
"in",
"simple",
"cases",
"the",
"last",
"two",
"will",
"be",
"the",
"same",
"type",
")",
".",
"<p",
">",
"Extensions",
"compatibility",
"is",
"checked",
"against",
"descriptor",
"object",
".",
"If",
"extension",
"declared",
"directly",
"on",
"method",
"error",
"will",
"be",
"throw",
"(",
"bad",
"usage",
")",
".",
"For",
"type",
"and",
"root",
"type",
"declared",
"extensions",
"incompatible",
"extensions",
"simply",
"skipped",
"(",
"case",
"when",
"extension",
"should",
"apply",
"to",
"all",
"methods",
"except",
"few",
")",
"."
] | train | https://github.com/xvik/guice-persist-orient/blob/5ef06fb4f734360512e9824a3b875c4906c56b5b/src/main/java/ru/vyarus/guice/persist/orient/repository/core/ext/util/ExtUtils.java#L99-L112 |
gpein/jcache-jee7 | src/main/java/io/github/gpein/jcache/configuration/CacheConfiguration.java | CacheConfiguration.newMutable | public static <K, V> Configuration newMutable(TimeUnit expiryTimeUnit, long expiryDurationAmount) {
"""
Build a new mutable javax.cache.configuration.Configuration with an expiry policy
@param expiryTimeUnit time unit
@param expiryDurationAmount amount of time to wait before global cache expiration
@param <K> Key type
@param <V> Value type
@return a new cache configuration instance
"""
return new MutableConfiguration<K, V>().setExpiryPolicyFactory(factoryOf(new Duration(expiryTimeUnit, expiryDurationAmount)));
} | java | public static <K, V> Configuration newMutable(TimeUnit expiryTimeUnit, long expiryDurationAmount) {
return new MutableConfiguration<K, V>().setExpiryPolicyFactory(factoryOf(new Duration(expiryTimeUnit, expiryDurationAmount)));
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"Configuration",
"newMutable",
"(",
"TimeUnit",
"expiryTimeUnit",
",",
"long",
"expiryDurationAmount",
")",
"{",
"return",
"new",
"MutableConfiguration",
"<",
"K",
",",
"V",
">",
"(",
")",
".",
"setExpiryPolicyFactory",
"(",
"factoryOf",
"(",
"new",
"Duration",
"(",
"expiryTimeUnit",
",",
"expiryDurationAmount",
")",
")",
")",
";",
"}"
] | Build a new mutable javax.cache.configuration.Configuration with an expiry policy
@param expiryTimeUnit time unit
@param expiryDurationAmount amount of time to wait before global cache expiration
@param <K> Key type
@param <V> Value type
@return a new cache configuration instance | [
"Build",
"a",
"new",
"mutable",
"javax",
".",
"cache",
".",
"configuration",
".",
"Configuration",
"with",
"an",
"expiry",
"policy"
] | train | https://github.com/gpein/jcache-jee7/blob/492dd3bb6423cdfb064e7005952a7b79fe4cd7aa/src/main/java/io/github/gpein/jcache/configuration/CacheConfiguration.java#L38-L40 |
aws/aws-sdk-java | aws-java-sdk-fms/src/main/java/com/amazonaws/services/fms/model/Policy.java | Policy.setExcludeMap | public void setExcludeMap(java.util.Map<String, java.util.List<String>> excludeMap) {
"""
<p>
Specifies the AWS account IDs to exclude from the policy. The <code>IncludeMap</code> values are evaluated first,
with all the appropriate account IDs added to the policy. Then the accounts listed in <code>ExcludeMap</code> are
removed, resulting in the final list of accounts to add to the policy.
</p>
<p>
The key to the map is <code>ACCOUNT</code>. For example, a valid <code>ExcludeMap</code> would be
<code>{“ACCOUNT” : [“accountID1”, “accountID2”]}</code>.
</p>
@param excludeMap
Specifies the AWS account IDs to exclude from the policy. The <code>IncludeMap</code> values are evaluated
first, with all the appropriate account IDs added to the policy. Then the accounts listed in
<code>ExcludeMap</code> are removed, resulting in the final list of accounts to add to the policy.</p>
<p>
The key to the map is <code>ACCOUNT</code>. For example, a valid <code>ExcludeMap</code> would be
<code>{“ACCOUNT” : [“accountID1”, “accountID2”]}</code>.
"""
this.excludeMap = excludeMap;
} | java | public void setExcludeMap(java.util.Map<String, java.util.List<String>> excludeMap) {
this.excludeMap = excludeMap;
} | [
"public",
"void",
"setExcludeMap",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"java",
".",
"util",
".",
"List",
"<",
"String",
">",
">",
"excludeMap",
")",
"{",
"this",
".",
"excludeMap",
"=",
"excludeMap",
";",
"}"
] | <p>
Specifies the AWS account IDs to exclude from the policy. The <code>IncludeMap</code> values are evaluated first,
with all the appropriate account IDs added to the policy. Then the accounts listed in <code>ExcludeMap</code> are
removed, resulting in the final list of accounts to add to the policy.
</p>
<p>
The key to the map is <code>ACCOUNT</code>. For example, a valid <code>ExcludeMap</code> would be
<code>{“ACCOUNT” : [“accountID1”, “accountID2”]}</code>.
</p>
@param excludeMap
Specifies the AWS account IDs to exclude from the policy. The <code>IncludeMap</code> values are evaluated
first, with all the appropriate account IDs added to the policy. Then the accounts listed in
<code>ExcludeMap</code> are removed, resulting in the final list of accounts to add to the policy.</p>
<p>
The key to the map is <code>ACCOUNT</code>. For example, a valid <code>ExcludeMap</code> would be
<code>{“ACCOUNT” : [“accountID1”, “accountID2”]}</code>. | [
"<p",
">",
"Specifies",
"the",
"AWS",
"account",
"IDs",
"to",
"exclude",
"from",
"the",
"policy",
".",
"The",
"<code",
">",
"IncludeMap<",
"/",
"code",
">",
"values",
"are",
"evaluated",
"first",
"with",
"all",
"the",
"appropriate",
"account",
"IDs",
"added",
"to",
"the",
"policy",
".",
"Then",
"the",
"accounts",
"listed",
"in",
"<code",
">",
"ExcludeMap<",
"/",
"code",
">",
"are",
"removed",
"resulting",
"in",
"the",
"final",
"list",
"of",
"accounts",
"to",
"add",
"to",
"the",
"policy",
".",
"<",
"/",
"p",
">",
"<p",
">",
"The",
"key",
"to",
"the",
"map",
"is",
"<code",
">",
"ACCOUNT<",
"/",
"code",
">",
".",
"For",
"example",
"a",
"valid",
"<code",
">",
"ExcludeMap<",
"/",
"code",
">",
"would",
"be",
"<code",
">",
"{",
"“ACCOUNT”",
":",
"[",
"“accountID1”",
"“accountID2”",
"]",
"}",
"<",
"/",
"code",
">",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-fms/src/main/java/com/amazonaws/services/fms/model/Policy.java#L750-L752 |
awslabs/jsii | packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java | JsiiObject.jsiiStaticGet | @Nullable
protected static <T> T jsiiStaticGet(final Class<?> nativeClass, final String property, final Class<T> type) {
"""
Returns the value of a static property.
@param nativeClass The java class.
@param property The name of the property.
@param type The expected java return type.
@param <T> Return type
@return Return value
"""
String fqn = engine.loadModuleForClass(nativeClass);
return JsiiObjectMapper.treeToValue(engine.getClient().getStaticPropertyValue(fqn, property), type);
} | java | @Nullable
protected static <T> T jsiiStaticGet(final Class<?> nativeClass, final String property, final Class<T> type) {
String fqn = engine.loadModuleForClass(nativeClass);
return JsiiObjectMapper.treeToValue(engine.getClient().getStaticPropertyValue(fqn, property), type);
} | [
"@",
"Nullable",
"protected",
"static",
"<",
"T",
">",
"T",
"jsiiStaticGet",
"(",
"final",
"Class",
"<",
"?",
">",
"nativeClass",
",",
"final",
"String",
"property",
",",
"final",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"String",
"fqn",
"=",
"engine",
".",
"loadModuleForClass",
"(",
"nativeClass",
")",
";",
"return",
"JsiiObjectMapper",
".",
"treeToValue",
"(",
"engine",
".",
"getClient",
"(",
")",
".",
"getStaticPropertyValue",
"(",
"fqn",
",",
"property",
")",
",",
"type",
")",
";",
"}"
] | Returns the value of a static property.
@param nativeClass The java class.
@param property The name of the property.
@param type The expected java return type.
@param <T> Return type
@return Return value | [
"Returns",
"the",
"value",
"of",
"a",
"static",
"property",
"."
] | train | https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java#L118-L122 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/query/PagingPredicate.java | PagingPredicate.setInnerPredicate | private void setInnerPredicate(Predicate<K, V> predicate) {
"""
Sets an inner predicate.
throws {@link IllegalArgumentException} if inner predicate is also {@link PagingPredicate}
@param predicate the inner predicate through which results will be filtered
"""
if (predicate instanceof PagingPredicate) {
throw new IllegalArgumentException("Nested PagingPredicate is not supported!");
}
this.predicate = predicate;
} | java | private void setInnerPredicate(Predicate<K, V> predicate) {
if (predicate instanceof PagingPredicate) {
throw new IllegalArgumentException("Nested PagingPredicate is not supported!");
}
this.predicate = predicate;
} | [
"private",
"void",
"setInnerPredicate",
"(",
"Predicate",
"<",
"K",
",",
"V",
">",
"predicate",
")",
"{",
"if",
"(",
"predicate",
"instanceof",
"PagingPredicate",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Nested PagingPredicate is not supported!\"",
")",
";",
"}",
"this",
".",
"predicate",
"=",
"predicate",
";",
"}"
] | Sets an inner predicate.
throws {@link IllegalArgumentException} if inner predicate is also {@link PagingPredicate}
@param predicate the inner predicate through which results will be filtered | [
"Sets",
"an",
"inner",
"predicate",
".",
"throws",
"{",
"@link",
"IllegalArgumentException",
"}",
"if",
"inner",
"predicate",
"is",
"also",
"{",
"@link",
"PagingPredicate",
"}"
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/query/PagingPredicate.java#L164-L169 |
ThreeTen/threetenbp | src/main/java/org/threeten/bp/chrono/Chronology.java | Chronology.zonedDateTime | @SuppressWarnings( {
"""
Obtains a zoned date-time in this chronology from another temporal object.
<p>
This creates a date-time in this chronology based on the specified {@code TemporalAccessor}.
<p>
This should obtain a {@code ZoneId} using {@link ZoneId#from(TemporalAccessor)}.
The date-time should be obtained by obtaining an {@code Instant}.
If that fails, the local date-time should be used.
@param temporal the temporal object to convert, not null
@return the zoned date-time in this chronology, not null
@throws DateTimeException if unable to create the date-time
""" "rawtypes", "unchecked" })
public ChronoZonedDateTime<?> zonedDateTime(TemporalAccessor temporal) {
try {
ZoneId zone = ZoneId.from(temporal);
try {
Instant instant = Instant.from(temporal);
return zonedDateTime(instant, zone);
} catch (DateTimeException ex1) {
ChronoLocalDateTime cldt = localDateTime(temporal);
ChronoLocalDateTimeImpl cldtImpl = ensureChronoLocalDateTime(cldt);
return ChronoZonedDateTimeImpl.ofBest(cldtImpl, zone, null);
}
} catch (DateTimeException ex) {
throw new DateTimeException("Unable to obtain ChronoZonedDateTime from TemporalAccessor: " + temporal.getClass(), ex);
}
} | java | @SuppressWarnings({ "rawtypes", "unchecked" })
public ChronoZonedDateTime<?> zonedDateTime(TemporalAccessor temporal) {
try {
ZoneId zone = ZoneId.from(temporal);
try {
Instant instant = Instant.from(temporal);
return zonedDateTime(instant, zone);
} catch (DateTimeException ex1) {
ChronoLocalDateTime cldt = localDateTime(temporal);
ChronoLocalDateTimeImpl cldtImpl = ensureChronoLocalDateTime(cldt);
return ChronoZonedDateTimeImpl.ofBest(cldtImpl, zone, null);
}
} catch (DateTimeException ex) {
throw new DateTimeException("Unable to obtain ChronoZonedDateTime from TemporalAccessor: " + temporal.getClass(), ex);
}
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"rawtypes\"",
",",
"\"unchecked\"",
"}",
")",
"public",
"ChronoZonedDateTime",
"<",
"?",
">",
"zonedDateTime",
"(",
"TemporalAccessor",
"temporal",
")",
"{",
"try",
"{",
"ZoneId",
"zone",
"=",
"ZoneId",
".",
"from",
"(",
"temporal",
")",
";",
"try",
"{",
"Instant",
"instant",
"=",
"Instant",
".",
"from",
"(",
"temporal",
")",
";",
"return",
"zonedDateTime",
"(",
"instant",
",",
"zone",
")",
";",
"}",
"catch",
"(",
"DateTimeException",
"ex1",
")",
"{",
"ChronoLocalDateTime",
"cldt",
"=",
"localDateTime",
"(",
"temporal",
")",
";",
"ChronoLocalDateTimeImpl",
"cldtImpl",
"=",
"ensureChronoLocalDateTime",
"(",
"cldt",
")",
";",
"return",
"ChronoZonedDateTimeImpl",
".",
"ofBest",
"(",
"cldtImpl",
",",
"zone",
",",
"null",
")",
";",
"}",
"}",
"catch",
"(",
"DateTimeException",
"ex",
")",
"{",
"throw",
"new",
"DateTimeException",
"(",
"\"Unable to obtain ChronoZonedDateTime from TemporalAccessor: \"",
"+",
"temporal",
".",
"getClass",
"(",
")",
",",
"ex",
")",
";",
"}",
"}"
] | Obtains a zoned date-time in this chronology from another temporal object.
<p>
This creates a date-time in this chronology based on the specified {@code TemporalAccessor}.
<p>
This should obtain a {@code ZoneId} using {@link ZoneId#from(TemporalAccessor)}.
The date-time should be obtained by obtaining an {@code Instant}.
If that fails, the local date-time should be used.
@param temporal the temporal object to convert, not null
@return the zoned date-time in this chronology, not null
@throws DateTimeException if unable to create the date-time | [
"Obtains",
"a",
"zoned",
"date",
"-",
"time",
"in",
"this",
"chronology",
"from",
"another",
"temporal",
"object",
".",
"<p",
">",
"This",
"creates",
"a",
"date",
"-",
"time",
"in",
"this",
"chronology",
"based",
"on",
"the",
"specified",
"{",
"@code",
"TemporalAccessor",
"}",
".",
"<p",
">",
"This",
"should",
"obtain",
"a",
"{",
"@code",
"ZoneId",
"}",
"using",
"{",
"@link",
"ZoneId#from",
"(",
"TemporalAccessor",
")",
"}",
".",
"The",
"date",
"-",
"time",
"should",
"be",
"obtained",
"by",
"obtaining",
"an",
"{",
"@code",
"Instant",
"}",
".",
"If",
"that",
"fails",
"the",
"local",
"date",
"-",
"time",
"should",
"be",
"used",
"."
] | train | https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/chrono/Chronology.java#L598-L614 |
fcrepo4/fcrepo4 | fcrepo-http-api/src/main/java/org/fcrepo/http/api/FedoraBaseResource.java | FedoraBaseResource.setUpJMSInfo | protected void setUpJMSInfo(final UriInfo uriInfo, final HttpHeaders headers) {
"""
Set the baseURL for JMS events.
@param uriInfo the uri info
@param headers HTTP headers
"""
try {
String baseURL = getBaseUrlProperty(uriInfo);
if (baseURL.length() == 0) {
baseURL = uriInfo.getBaseUri().toString();
}
LOGGER.debug("setting baseURL = " + baseURL);
session.getFedoraSession().addSessionData(BASE_URL, baseURL);
if (!StringUtils.isBlank(headers.getHeaderString("user-agent"))) {
session.getFedoraSession().addSessionData(USER_AGENT, headers.getHeaderString("user-agent"));
}
} catch (final Exception ex) {
LOGGER.warn("Error setting baseURL", ex.getMessage());
}
} | java | protected void setUpJMSInfo(final UriInfo uriInfo, final HttpHeaders headers) {
try {
String baseURL = getBaseUrlProperty(uriInfo);
if (baseURL.length() == 0) {
baseURL = uriInfo.getBaseUri().toString();
}
LOGGER.debug("setting baseURL = " + baseURL);
session.getFedoraSession().addSessionData(BASE_URL, baseURL);
if (!StringUtils.isBlank(headers.getHeaderString("user-agent"))) {
session.getFedoraSession().addSessionData(USER_AGENT, headers.getHeaderString("user-agent"));
}
} catch (final Exception ex) {
LOGGER.warn("Error setting baseURL", ex.getMessage());
}
} | [
"protected",
"void",
"setUpJMSInfo",
"(",
"final",
"UriInfo",
"uriInfo",
",",
"final",
"HttpHeaders",
"headers",
")",
"{",
"try",
"{",
"String",
"baseURL",
"=",
"getBaseUrlProperty",
"(",
"uriInfo",
")",
";",
"if",
"(",
"baseURL",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"baseURL",
"=",
"uriInfo",
".",
"getBaseUri",
"(",
")",
".",
"toString",
"(",
")",
";",
"}",
"LOGGER",
".",
"debug",
"(",
"\"setting baseURL = \"",
"+",
"baseURL",
")",
";",
"session",
".",
"getFedoraSession",
"(",
")",
".",
"addSessionData",
"(",
"BASE_URL",
",",
"baseURL",
")",
";",
"if",
"(",
"!",
"StringUtils",
".",
"isBlank",
"(",
"headers",
".",
"getHeaderString",
"(",
"\"user-agent\"",
")",
")",
")",
"{",
"session",
".",
"getFedoraSession",
"(",
")",
".",
"addSessionData",
"(",
"USER_AGENT",
",",
"headers",
".",
"getHeaderString",
"(",
"\"user-agent\"",
")",
")",
";",
"}",
"}",
"catch",
"(",
"final",
"Exception",
"ex",
")",
"{",
"LOGGER",
".",
"warn",
"(",
"\"Error setting baseURL\"",
",",
"ex",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}"
] | Set the baseURL for JMS events.
@param uriInfo the uri info
@param headers HTTP headers | [
"Set",
"the",
"baseURL",
"for",
"JMS",
"events",
"."
] | train | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-api/src/main/java/org/fcrepo/http/api/FedoraBaseResource.java#L109-L123 |
pac4j/pac4j | pac4j-oauth/src/main/java/org/pac4j/oauth/profile/definition/OAuthProfileDefinition.java | OAuthProfileDefinition.raiseProfileExtractionJsonError | protected void raiseProfileExtractionJsonError(String body, String missingNode) {
"""
Throws a {@link TechnicalException} to indicate that user profile extraction has failed.
@param body the request body that the user profile should be have been extracted from
@param missingNode the name of a JSON node that was found missing. may be omitted
"""
logger.error("Unable to extract user profile as no JSON node '{}' was found in body: {}", missingNode, body);
throw new TechnicalException("No JSON node '" + missingNode + "' to extract user profile from");
} | java | protected void raiseProfileExtractionJsonError(String body, String missingNode) {
logger.error("Unable to extract user profile as no JSON node '{}' was found in body: {}", missingNode, body);
throw new TechnicalException("No JSON node '" + missingNode + "' to extract user profile from");
} | [
"protected",
"void",
"raiseProfileExtractionJsonError",
"(",
"String",
"body",
",",
"String",
"missingNode",
")",
"{",
"logger",
".",
"error",
"(",
"\"Unable to extract user profile as no JSON node '{}' was found in body: {}\"",
",",
"missingNode",
",",
"body",
")",
";",
"throw",
"new",
"TechnicalException",
"(",
"\"No JSON node '\"",
"+",
"missingNode",
"+",
"\"' to extract user profile from\"",
")",
";",
"}"
] | Throws a {@link TechnicalException} to indicate that user profile extraction has failed.
@param body the request body that the user profile should be have been extracted from
@param missingNode the name of a JSON node that was found missing. may be omitted | [
"Throws",
"a",
"{",
"@link",
"TechnicalException",
"}",
"to",
"indicate",
"that",
"user",
"profile",
"extraction",
"has",
"failed",
"."
] | train | https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-oauth/src/main/java/org/pac4j/oauth/profile/definition/OAuthProfileDefinition.java#L61-L64 |
ReactiveX/RxNetty | rxnetty-http/src/main/java/io/reactivex/netty/protocol/http/sse/ServerSentEvent.java | ServerSentEvent.withEventId | public static ServerSentEvent withEventId(ByteBuf eventId, ByteBuf data) {
"""
Creates a {@link ServerSentEvent} instance with an event id.
@param eventId Id for the event.
@param data Data for the event.
@return The {@link ServerSentEvent} instance.
"""
return new ServerSentEvent(eventId, null, data);
} | java | public static ServerSentEvent withEventId(ByteBuf eventId, ByteBuf data) {
return new ServerSentEvent(eventId, null, data);
} | [
"public",
"static",
"ServerSentEvent",
"withEventId",
"(",
"ByteBuf",
"eventId",
",",
"ByteBuf",
"data",
")",
"{",
"return",
"new",
"ServerSentEvent",
"(",
"eventId",
",",
"null",
",",
"data",
")",
";",
"}"
] | Creates a {@link ServerSentEvent} instance with an event id.
@param eventId Id for the event.
@param data Data for the event.
@return The {@link ServerSentEvent} instance. | [
"Creates",
"a",
"{",
"@link",
"ServerSentEvent",
"}",
"instance",
"with",
"an",
"event",
"id",
"."
] | train | https://github.com/ReactiveX/RxNetty/blob/a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6/rxnetty-http/src/main/java/io/reactivex/netty/protocol/http/sse/ServerSentEvent.java#L252-L254 |
roboconf/roboconf-platform | miscellaneous/roboconf-doc-generator/src/main/java/net/roboconf/doc/generator/RenderingManager.java | RenderingManager.buildRenderer | private IRenderer buildRenderer(
File outputDirectory,
ApplicationTemplate applicationTemplate,
File applicationDirectory,
Renderer renderer,
Map<String,String> typeAnnotations ) {
"""
Builds the right renderer.
@param outputDirectory
@param applicationTemplate
@param applicationDirectory
@param renderer
@param typeAnnotations
@return a renderer
"""
IRenderer result = null;
switch( renderer ) {
case HTML:
result = new HtmlRenderer( outputDirectory, applicationTemplate, applicationDirectory, typeAnnotations );
break;
case MARKDOWN:
result = new MarkdownRenderer( outputDirectory, applicationTemplate, applicationDirectory, typeAnnotations );
break;
case FOP:
result = new FopRenderer( outputDirectory, applicationTemplate, applicationDirectory, typeAnnotations );
break;
case PDF:
result = new PdfRenderer( outputDirectory, applicationTemplate, applicationDirectory, typeAnnotations );
break;
default:
break;
}
return result;
} | java | private IRenderer buildRenderer(
File outputDirectory,
ApplicationTemplate applicationTemplate,
File applicationDirectory,
Renderer renderer,
Map<String,String> typeAnnotations ) {
IRenderer result = null;
switch( renderer ) {
case HTML:
result = new HtmlRenderer( outputDirectory, applicationTemplate, applicationDirectory, typeAnnotations );
break;
case MARKDOWN:
result = new MarkdownRenderer( outputDirectory, applicationTemplate, applicationDirectory, typeAnnotations );
break;
case FOP:
result = new FopRenderer( outputDirectory, applicationTemplate, applicationDirectory, typeAnnotations );
break;
case PDF:
result = new PdfRenderer( outputDirectory, applicationTemplate, applicationDirectory, typeAnnotations );
break;
default:
break;
}
return result;
} | [
"private",
"IRenderer",
"buildRenderer",
"(",
"File",
"outputDirectory",
",",
"ApplicationTemplate",
"applicationTemplate",
",",
"File",
"applicationDirectory",
",",
"Renderer",
"renderer",
",",
"Map",
"<",
"String",
",",
"String",
">",
"typeAnnotations",
")",
"{",
"IRenderer",
"result",
"=",
"null",
";",
"switch",
"(",
"renderer",
")",
"{",
"case",
"HTML",
":",
"result",
"=",
"new",
"HtmlRenderer",
"(",
"outputDirectory",
",",
"applicationTemplate",
",",
"applicationDirectory",
",",
"typeAnnotations",
")",
";",
"break",
";",
"case",
"MARKDOWN",
":",
"result",
"=",
"new",
"MarkdownRenderer",
"(",
"outputDirectory",
",",
"applicationTemplate",
",",
"applicationDirectory",
",",
"typeAnnotations",
")",
";",
"break",
";",
"case",
"FOP",
":",
"result",
"=",
"new",
"FopRenderer",
"(",
"outputDirectory",
",",
"applicationTemplate",
",",
"applicationDirectory",
",",
"typeAnnotations",
")",
";",
"break",
";",
"case",
"PDF",
":",
"result",
"=",
"new",
"PdfRenderer",
"(",
"outputDirectory",
",",
"applicationTemplate",
",",
"applicationDirectory",
",",
"typeAnnotations",
")",
";",
"break",
";",
"default",
":",
"break",
";",
"}",
"return",
"result",
";",
"}"
] | Builds the right renderer.
@param outputDirectory
@param applicationTemplate
@param applicationDirectory
@param renderer
@param typeAnnotations
@return a renderer | [
"Builds",
"the",
"right",
"renderer",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-doc-generator/src/main/java/net/roboconf/doc/generator/RenderingManager.java#L178-L208 |
google/closure-compiler | src/com/google/javascript/jscomp/TypeValidator.java | TypeValidator.expectCanAssignToPrototype | void expectCanAssignToPrototype(JSType ownerType, Node node, JSType rightType) {
"""
Expect that it's valid to assign something to a given type's prototype.
<p>Most of these checks occur during TypedScopeCreator, so we just handle very basic cases here
<p>For example, assuming `Foo` is a constructor, `Foo.prototype = 3;` will warn because `3` is
not an object.
@param ownerType The type of the object whose prototype is being changed. (e.g. `Foo` above)
@param node Node to issue warnings on (e.g. `3` above)
@param rightType the rvalue type being assigned to the prototype (e.g. `number` above)
"""
if (ownerType.isFunctionType()) {
FunctionType functionType = ownerType.toMaybeFunctionType();
if (functionType.isConstructor()) {
expectObject(node, rightType, "cannot override prototype with non-object");
}
}
} | java | void expectCanAssignToPrototype(JSType ownerType, Node node, JSType rightType) {
if (ownerType.isFunctionType()) {
FunctionType functionType = ownerType.toMaybeFunctionType();
if (functionType.isConstructor()) {
expectObject(node, rightType, "cannot override prototype with non-object");
}
}
} | [
"void",
"expectCanAssignToPrototype",
"(",
"JSType",
"ownerType",
",",
"Node",
"node",
",",
"JSType",
"rightType",
")",
"{",
"if",
"(",
"ownerType",
".",
"isFunctionType",
"(",
")",
")",
"{",
"FunctionType",
"functionType",
"=",
"ownerType",
".",
"toMaybeFunctionType",
"(",
")",
";",
"if",
"(",
"functionType",
".",
"isConstructor",
"(",
")",
")",
"{",
"expectObject",
"(",
"node",
",",
"rightType",
",",
"\"cannot override prototype with non-object\"",
")",
";",
"}",
"}",
"}"
] | Expect that it's valid to assign something to a given type's prototype.
<p>Most of these checks occur during TypedScopeCreator, so we just handle very basic cases here
<p>For example, assuming `Foo` is a constructor, `Foo.prototype = 3;` will warn because `3` is
not an object.
@param ownerType The type of the object whose prototype is being changed. (e.g. `Foo` above)
@param node Node to issue warnings on (e.g. `3` above)
@param rightType the rvalue type being assigned to the prototype (e.g. `number` above) | [
"Expect",
"that",
"it",
"s",
"valid",
"to",
"assign",
"something",
"to",
"a",
"given",
"type",
"s",
"prototype",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeValidator.java#L760-L767 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java | ApiOvhDedicatedCloud.serviceName_datacenter_datacenterId_disasterRecovery_zertoSingle_configureVpn_POST | public OvhTask serviceName_datacenter_datacenterId_disasterRecovery_zertoSingle_configureVpn_POST(String serviceName, Long datacenterId, String preSharedKey, String remoteEndpointInternalIp, String remoteEndpointPublicIp, String remoteVraNetwork, String remoteZvmInternalIp) throws IOException {
"""
Configure vpn between your OVH Private Cloud and your onsite infrastructure
REST: POST /dedicatedCloud/{serviceName}/datacenter/{datacenterId}/disasterRecovery/zertoSingle/configureVpn
@param remoteEndpointPublicIp [required] Your onsite endpoint public IP for the secured replication data tunnel
@param remoteVraNetwork [required] Internal zerto subnet of your onsite infrastructure (ip/cidr)
@param remoteZvmInternalIp [required] Internal ZVM ip of your onsite infrastructure
@param remoteEndpointInternalIp [required] Your onsite endpoint internal IP for the secured replication data tunnel
@param preSharedKey [required] Pre-Shared Key to secure data transfer between both sites
@param serviceName [required] Domain of the service
@param datacenterId [required]
API beta
"""
String qPath = "/dedicatedCloud/{serviceName}/datacenter/{datacenterId}/disasterRecovery/zertoSingle/configureVpn";
StringBuilder sb = path(qPath, serviceName, datacenterId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "preSharedKey", preSharedKey);
addBody(o, "remoteEndpointInternalIp", remoteEndpointInternalIp);
addBody(o, "remoteEndpointPublicIp", remoteEndpointPublicIp);
addBody(o, "remoteVraNetwork", remoteVraNetwork);
addBody(o, "remoteZvmInternalIp", remoteZvmInternalIp);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | java | public OvhTask serviceName_datacenter_datacenterId_disasterRecovery_zertoSingle_configureVpn_POST(String serviceName, Long datacenterId, String preSharedKey, String remoteEndpointInternalIp, String remoteEndpointPublicIp, String remoteVraNetwork, String remoteZvmInternalIp) throws IOException {
String qPath = "/dedicatedCloud/{serviceName}/datacenter/{datacenterId}/disasterRecovery/zertoSingle/configureVpn";
StringBuilder sb = path(qPath, serviceName, datacenterId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "preSharedKey", preSharedKey);
addBody(o, "remoteEndpointInternalIp", remoteEndpointInternalIp);
addBody(o, "remoteEndpointPublicIp", remoteEndpointPublicIp);
addBody(o, "remoteVraNetwork", remoteVraNetwork);
addBody(o, "remoteZvmInternalIp", remoteZvmInternalIp);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | [
"public",
"OvhTask",
"serviceName_datacenter_datacenterId_disasterRecovery_zertoSingle_configureVpn_POST",
"(",
"String",
"serviceName",
",",
"Long",
"datacenterId",
",",
"String",
"preSharedKey",
",",
"String",
"remoteEndpointInternalIp",
",",
"String",
"remoteEndpointPublicIp",
",",
"String",
"remoteVraNetwork",
",",
"String",
"remoteZvmInternalIp",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dedicatedCloud/{serviceName}/datacenter/{datacenterId}/disasterRecovery/zertoSingle/configureVpn\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
",",
"datacenterId",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"preSharedKey\"",
",",
"preSharedKey",
")",
";",
"addBody",
"(",
"o",
",",
"\"remoteEndpointInternalIp\"",
",",
"remoteEndpointInternalIp",
")",
";",
"addBody",
"(",
"o",
",",
"\"remoteEndpointPublicIp\"",
",",
"remoteEndpointPublicIp",
")",
";",
"addBody",
"(",
"o",
",",
"\"remoteVraNetwork\"",
",",
"remoteVraNetwork",
")",
";",
"addBody",
"(",
"o",
",",
"\"remoteZvmInternalIp\"",
",",
"remoteZvmInternalIp",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhTask",
".",
"class",
")",
";",
"}"
] | Configure vpn between your OVH Private Cloud and your onsite infrastructure
REST: POST /dedicatedCloud/{serviceName}/datacenter/{datacenterId}/disasterRecovery/zertoSingle/configureVpn
@param remoteEndpointPublicIp [required] Your onsite endpoint public IP for the secured replication data tunnel
@param remoteVraNetwork [required] Internal zerto subnet of your onsite infrastructure (ip/cidr)
@param remoteZvmInternalIp [required] Internal ZVM ip of your onsite infrastructure
@param remoteEndpointInternalIp [required] Your onsite endpoint internal IP for the secured replication data tunnel
@param preSharedKey [required] Pre-Shared Key to secure data transfer between both sites
@param serviceName [required] Domain of the service
@param datacenterId [required]
API beta | [
"Configure",
"vpn",
"between",
"your",
"OVH",
"Private",
"Cloud",
"and",
"your",
"onsite",
"infrastructure"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java#L1856-L1867 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java | AppServiceEnvironmentsInner.getMultiRolePoolAsync | public Observable<WorkerPoolResourceInner> getMultiRolePoolAsync(String resourceGroupName, String name) {
"""
Get properties of a multi-role pool.
Get properties of a multi-role pool.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service Environment.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the WorkerPoolResourceInner object
"""
return getMultiRolePoolWithServiceResponseAsync(resourceGroupName, name).map(new Func1<ServiceResponse<WorkerPoolResourceInner>, WorkerPoolResourceInner>() {
@Override
public WorkerPoolResourceInner call(ServiceResponse<WorkerPoolResourceInner> response) {
return response.body();
}
});
} | java | public Observable<WorkerPoolResourceInner> getMultiRolePoolAsync(String resourceGroupName, String name) {
return getMultiRolePoolWithServiceResponseAsync(resourceGroupName, name).map(new Func1<ServiceResponse<WorkerPoolResourceInner>, WorkerPoolResourceInner>() {
@Override
public WorkerPoolResourceInner call(ServiceResponse<WorkerPoolResourceInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"WorkerPoolResourceInner",
">",
"getMultiRolePoolAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
")",
"{",
"return",
"getMultiRolePoolWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"WorkerPoolResourceInner",
">",
",",
"WorkerPoolResourceInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"WorkerPoolResourceInner",
"call",
"(",
"ServiceResponse",
"<",
"WorkerPoolResourceInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Get properties of a multi-role pool.
Get properties of a multi-role pool.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service Environment.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the WorkerPoolResourceInner object | [
"Get",
"properties",
"of",
"a",
"multi",
"-",
"role",
"pool",
".",
"Get",
"properties",
"of",
"a",
"multi",
"-",
"role",
"pool",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L2209-L2216 |
apache/flink | flink-libraries/flink-streaming-python/src/main/java/org/apache/flink/streaming/python/api/datastream/PythonDataStream.java | PythonDataStream.write_to_socket | @PublicEvolving
public void write_to_socket(String host, Integer port, SerializationSchema<PyObject> schema) throws IOException {
"""
A thin wrapper layer over {@link DataStream#writeToSocket(String, int, org.apache.flink.api.common.serialization.SerializationSchema)}.
@param host host of the socket
@param port port of the socket
@param schema schema for serialization
"""
stream.writeToSocket(host, port, new PythonSerializationSchema(schema));
} | java | @PublicEvolving
public void write_to_socket(String host, Integer port, SerializationSchema<PyObject> schema) throws IOException {
stream.writeToSocket(host, port, new PythonSerializationSchema(schema));
} | [
"@",
"PublicEvolving",
"public",
"void",
"write_to_socket",
"(",
"String",
"host",
",",
"Integer",
"port",
",",
"SerializationSchema",
"<",
"PyObject",
">",
"schema",
")",
"throws",
"IOException",
"{",
"stream",
".",
"writeToSocket",
"(",
"host",
",",
"port",
",",
"new",
"PythonSerializationSchema",
"(",
"schema",
")",
")",
";",
"}"
] | A thin wrapper layer over {@link DataStream#writeToSocket(String, int, org.apache.flink.api.common.serialization.SerializationSchema)}.
@param host host of the socket
@param port port of the socket
@param schema schema for serialization | [
"A",
"thin",
"wrapper",
"layer",
"over",
"{",
"@link",
"DataStream#writeToSocket",
"(",
"String",
"int",
"org",
".",
"apache",
".",
"flink",
".",
"api",
".",
"common",
".",
"serialization",
".",
"SerializationSchema",
")",
"}",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-streaming-python/src/main/java/org/apache/flink/streaming/python/api/datastream/PythonDataStream.java#L176-L179 |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/SARLEclipsePlugin.java | SARLEclipsePlugin.logErrorMessage | public void logErrorMessage(String message) {
"""
Logs an internal error with the specified message.
@param message the error message to log
"""
getILog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, null));
} | java | public void logErrorMessage(String message) {
getILog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, null));
} | [
"public",
"void",
"logErrorMessage",
"(",
"String",
"message",
")",
"{",
"getILog",
"(",
")",
".",
"log",
"(",
"new",
"Status",
"(",
"IStatus",
".",
"ERROR",
",",
"PLUGIN_ID",
",",
"message",
",",
"null",
")",
")",
";",
"}"
] | Logs an internal error with the specified message.
@param message the error message to log | [
"Logs",
"an",
"internal",
"error",
"with",
"the",
"specified",
"message",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/SARLEclipsePlugin.java#L286-L288 |
eserating/siren4j | src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java | ReflectingConverter.handleSubEntity | private void handleSubEntity(EntityBuilder builder, Object obj, Field currentField, List<ReflectedInfo> fieldInfo)
throws Siren4JException {
"""
Handles sub entities.
@param builder assumed not <code>null</code>.
@param obj assumed not <code>null</code>.
@param currentField assumed not <code>null</code>.
@throws Siren4JException
"""
Siren4JSubEntity subAnno = getSubEntityAnnotation(currentField, fieldInfo);
if (subAnno != null) {
if (isCollection(obj, currentField)) {
Collection<?> coll = (Collection<?>) ReflectionUtils.getFieldValue(currentField, obj);
if (coll != null) {
for (Object o : coll) {
builder.addSubEntity(toEntity(o, currentField, obj, fieldInfo));
}
}
} else {
Object subObj = ReflectionUtils.getFieldValue(currentField, obj);
if (subObj != null) {
builder.addSubEntity(toEntity(subObj, currentField, obj, fieldInfo));
}
}
}
} | java | private void handleSubEntity(EntityBuilder builder, Object obj, Field currentField, List<ReflectedInfo> fieldInfo)
throws Siren4JException {
Siren4JSubEntity subAnno = getSubEntityAnnotation(currentField, fieldInfo);
if (subAnno != null) {
if (isCollection(obj, currentField)) {
Collection<?> coll = (Collection<?>) ReflectionUtils.getFieldValue(currentField, obj);
if (coll != null) {
for (Object o : coll) {
builder.addSubEntity(toEntity(o, currentField, obj, fieldInfo));
}
}
} else {
Object subObj = ReflectionUtils.getFieldValue(currentField, obj);
if (subObj != null) {
builder.addSubEntity(toEntity(subObj, currentField, obj, fieldInfo));
}
}
}
} | [
"private",
"void",
"handleSubEntity",
"(",
"EntityBuilder",
"builder",
",",
"Object",
"obj",
",",
"Field",
"currentField",
",",
"List",
"<",
"ReflectedInfo",
">",
"fieldInfo",
")",
"throws",
"Siren4JException",
"{",
"Siren4JSubEntity",
"subAnno",
"=",
"getSubEntityAnnotation",
"(",
"currentField",
",",
"fieldInfo",
")",
";",
"if",
"(",
"subAnno",
"!=",
"null",
")",
"{",
"if",
"(",
"isCollection",
"(",
"obj",
",",
"currentField",
")",
")",
"{",
"Collection",
"<",
"?",
">",
"coll",
"=",
"(",
"Collection",
"<",
"?",
">",
")",
"ReflectionUtils",
".",
"getFieldValue",
"(",
"currentField",
",",
"obj",
")",
";",
"if",
"(",
"coll",
"!=",
"null",
")",
"{",
"for",
"(",
"Object",
"o",
":",
"coll",
")",
"{",
"builder",
".",
"addSubEntity",
"(",
"toEntity",
"(",
"o",
",",
"currentField",
",",
"obj",
",",
"fieldInfo",
")",
")",
";",
"}",
"}",
"}",
"else",
"{",
"Object",
"subObj",
"=",
"ReflectionUtils",
".",
"getFieldValue",
"(",
"currentField",
",",
"obj",
")",
";",
"if",
"(",
"subObj",
"!=",
"null",
")",
"{",
"builder",
".",
"addSubEntity",
"(",
"toEntity",
"(",
"subObj",
",",
"currentField",
",",
"obj",
",",
"fieldInfo",
")",
")",
";",
"}",
"}",
"}",
"}"
] | Handles sub entities.
@param builder assumed not <code>null</code>.
@param obj assumed not <code>null</code>.
@param currentField assumed not <code>null</code>.
@throws Siren4JException | [
"Handles",
"sub",
"entities",
"."
] | train | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java#L474-L494 |
Talend/tesb-rt-se | locator/src/main/java/org/talend/esb/servicelocator/cxf/internal/CXFEndpointProvider.java | CXFEndpointProvider.addProperties | private static void addProperties(EndpointReferenceType epr, SLProperties props) {
"""
Adds service locator properties to an endpoint reference.
@param epr
@param props
"""
MetadataType metadata = WSAEndpointReferenceUtils.getSetMetadata(epr);
ServiceLocatorPropertiesType jaxbProps = SLPropertiesConverter.toServiceLocatorPropertiesType(props);
JAXBElement<ServiceLocatorPropertiesType>
slp = SL_OBJECT_FACTORY.createServiceLocatorProperties(jaxbProps);
metadata.getAny().add(slp);
} | java | private static void addProperties(EndpointReferenceType epr, SLProperties props) {
MetadataType metadata = WSAEndpointReferenceUtils.getSetMetadata(epr);
ServiceLocatorPropertiesType jaxbProps = SLPropertiesConverter.toServiceLocatorPropertiesType(props);
JAXBElement<ServiceLocatorPropertiesType>
slp = SL_OBJECT_FACTORY.createServiceLocatorProperties(jaxbProps);
metadata.getAny().add(slp);
} | [
"private",
"static",
"void",
"addProperties",
"(",
"EndpointReferenceType",
"epr",
",",
"SLProperties",
"props",
")",
"{",
"MetadataType",
"metadata",
"=",
"WSAEndpointReferenceUtils",
".",
"getSetMetadata",
"(",
"epr",
")",
";",
"ServiceLocatorPropertiesType",
"jaxbProps",
"=",
"SLPropertiesConverter",
".",
"toServiceLocatorPropertiesType",
"(",
"props",
")",
";",
"JAXBElement",
"<",
"ServiceLocatorPropertiesType",
">",
"slp",
"=",
"SL_OBJECT_FACTORY",
".",
"createServiceLocatorProperties",
"(",
"jaxbProps",
")",
";",
"metadata",
".",
"getAny",
"(",
")",
".",
"add",
"(",
"slp",
")",
";",
"}"
] | Adds service locator properties to an endpoint reference.
@param epr
@param props | [
"Adds",
"service",
"locator",
"properties",
"to",
"an",
"endpoint",
"reference",
"."
] | train | https://github.com/Talend/tesb-rt-se/blob/0a151a6d91ffff65ac4b5ee0c5b2c882ac28d886/locator/src/main/java/org/talend/esb/servicelocator/cxf/internal/CXFEndpointProvider.java#L310-L317 |
percolate/caffeine | caffeine/src/main/java/com/percolate/caffeine/ViewUtils.java | ViewUtils.hideView | public static void hideView(View parentView, int id) {
"""
Sets visibility of the given view to <code>View.GONE</code>.
@param parentView The View used to call findViewId() on.
@param id R.id.xxxx value for the view to hide "expected textView to throw a ClassCastException" + textView.
"""
if (parentView != null) {
View view = parentView.findViewById(id);
if (view != null) {
view.setVisibility(View.GONE);
} else {
Log.e("Caffeine", "View does not exist. Could not hide it.");
}
}
} | java | public static void hideView(View parentView, int id) {
if (parentView != null) {
View view = parentView.findViewById(id);
if (view != null) {
view.setVisibility(View.GONE);
} else {
Log.e("Caffeine", "View does not exist. Could not hide it.");
}
}
} | [
"public",
"static",
"void",
"hideView",
"(",
"View",
"parentView",
",",
"int",
"id",
")",
"{",
"if",
"(",
"parentView",
"!=",
"null",
")",
"{",
"View",
"view",
"=",
"parentView",
".",
"findViewById",
"(",
"id",
")",
";",
"if",
"(",
"view",
"!=",
"null",
")",
"{",
"view",
".",
"setVisibility",
"(",
"View",
".",
"GONE",
")",
";",
"}",
"else",
"{",
"Log",
".",
"e",
"(",
"\"Caffeine\"",
",",
"\"View does not exist. Could not hide it.\"",
")",
";",
"}",
"}",
"}"
] | Sets visibility of the given view to <code>View.GONE</code>.
@param parentView The View used to call findViewId() on.
@param id R.id.xxxx value for the view to hide "expected textView to throw a ClassCastException" + textView. | [
"Sets",
"visibility",
"of",
"the",
"given",
"view",
"to",
"<code",
">",
"View",
".",
"GONE<",
"/",
"code",
">",
"."
] | train | https://github.com/percolate/caffeine/blob/e2265cab474a6397f4d75b1ed928c356a7b9672e/caffeine/src/main/java/com/percolate/caffeine/ViewUtils.java#L249-L258 |
google/closure-compiler | src/com/google/javascript/jscomp/CollapseProperties.java | CollapseProperties.updateTwinnedDeclaration | private void updateTwinnedDeclaration(String alias, Name refName, Ref ref) {
"""
Updates the initial assignment to a collapsible property at global scope
by adding a VAR stub and collapsing the property. e.g. c = a.b = 1; => var a$b; c = a$b = 1;
This specifically handles "twinned" assignments, which are those where the assignment is also
used as a reference and which need special handling.
@param alias The flattened property name (e.g. "a$b")
@param refName The name for the reference being updated.
@param ref An object containing information about the assignment getting updated
"""
checkNotNull(ref.getTwin());
// Don't handle declarations of an already flat name, just qualified names.
if (!ref.getNode().isGetProp()) {
return;
}
Node rvalue = ref.getNode().getNext();
Node parent = ref.getNode().getParent();
Node grandparent = parent.getParent();
if (rvalue != null && rvalue.isFunction()) {
checkForHosedThisReferences(rvalue, refName.getJSDocInfo(), refName);
}
// Create the new alias node.
Node nameNode =
NodeUtil.newName(compiler, alias, grandparent.getFirstChild(), refName.getFullName());
NodeUtil.copyNameAnnotations(ref.getNode().getLastChild(), nameNode);
// BEFORE:
// ... (x.y = 3);
//
// AFTER:
// var x$y;
// ... (x$y = 3);
Node current = grandparent;
Node currentParent = grandparent.getParent();
for (;
!currentParent.isScript() && !currentParent.isBlock();
current = currentParent, currentParent = currentParent.getParent()) {}
// Create a stub variable declaration right
// before the current statement.
Node stubVar = IR.var(nameNode.cloneTree()).useSourceInfoIfMissingFrom(nameNode);
currentParent.addChildBefore(stubVar, current);
parent.replaceChild(ref.getNode(), nameNode);
compiler.reportChangeToEnclosingScope(nameNode);
} | java | private void updateTwinnedDeclaration(String alias, Name refName, Ref ref) {
checkNotNull(ref.getTwin());
// Don't handle declarations of an already flat name, just qualified names.
if (!ref.getNode().isGetProp()) {
return;
}
Node rvalue = ref.getNode().getNext();
Node parent = ref.getNode().getParent();
Node grandparent = parent.getParent();
if (rvalue != null && rvalue.isFunction()) {
checkForHosedThisReferences(rvalue, refName.getJSDocInfo(), refName);
}
// Create the new alias node.
Node nameNode =
NodeUtil.newName(compiler, alias, grandparent.getFirstChild(), refName.getFullName());
NodeUtil.copyNameAnnotations(ref.getNode().getLastChild(), nameNode);
// BEFORE:
// ... (x.y = 3);
//
// AFTER:
// var x$y;
// ... (x$y = 3);
Node current = grandparent;
Node currentParent = grandparent.getParent();
for (;
!currentParent.isScript() && !currentParent.isBlock();
current = currentParent, currentParent = currentParent.getParent()) {}
// Create a stub variable declaration right
// before the current statement.
Node stubVar = IR.var(nameNode.cloneTree()).useSourceInfoIfMissingFrom(nameNode);
currentParent.addChildBefore(stubVar, current);
parent.replaceChild(ref.getNode(), nameNode);
compiler.reportChangeToEnclosingScope(nameNode);
} | [
"private",
"void",
"updateTwinnedDeclaration",
"(",
"String",
"alias",
",",
"Name",
"refName",
",",
"Ref",
"ref",
")",
"{",
"checkNotNull",
"(",
"ref",
".",
"getTwin",
"(",
")",
")",
";",
"// Don't handle declarations of an already flat name, just qualified names.",
"if",
"(",
"!",
"ref",
".",
"getNode",
"(",
")",
".",
"isGetProp",
"(",
")",
")",
"{",
"return",
";",
"}",
"Node",
"rvalue",
"=",
"ref",
".",
"getNode",
"(",
")",
".",
"getNext",
"(",
")",
";",
"Node",
"parent",
"=",
"ref",
".",
"getNode",
"(",
")",
".",
"getParent",
"(",
")",
";",
"Node",
"grandparent",
"=",
"parent",
".",
"getParent",
"(",
")",
";",
"if",
"(",
"rvalue",
"!=",
"null",
"&&",
"rvalue",
".",
"isFunction",
"(",
")",
")",
"{",
"checkForHosedThisReferences",
"(",
"rvalue",
",",
"refName",
".",
"getJSDocInfo",
"(",
")",
",",
"refName",
")",
";",
"}",
"// Create the new alias node.",
"Node",
"nameNode",
"=",
"NodeUtil",
".",
"newName",
"(",
"compiler",
",",
"alias",
",",
"grandparent",
".",
"getFirstChild",
"(",
")",
",",
"refName",
".",
"getFullName",
"(",
")",
")",
";",
"NodeUtil",
".",
"copyNameAnnotations",
"(",
"ref",
".",
"getNode",
"(",
")",
".",
"getLastChild",
"(",
")",
",",
"nameNode",
")",
";",
"// BEFORE:",
"// ... (x.y = 3);",
"//",
"// AFTER:",
"// var x$y;",
"// ... (x$y = 3);",
"Node",
"current",
"=",
"grandparent",
";",
"Node",
"currentParent",
"=",
"grandparent",
".",
"getParent",
"(",
")",
";",
"for",
"(",
";",
"!",
"currentParent",
".",
"isScript",
"(",
")",
"&&",
"!",
"currentParent",
".",
"isBlock",
"(",
")",
";",
"current",
"=",
"currentParent",
",",
"currentParent",
"=",
"currentParent",
".",
"getParent",
"(",
")",
")",
"{",
"}",
"// Create a stub variable declaration right",
"// before the current statement.",
"Node",
"stubVar",
"=",
"IR",
".",
"var",
"(",
"nameNode",
".",
"cloneTree",
"(",
")",
")",
".",
"useSourceInfoIfMissingFrom",
"(",
"nameNode",
")",
";",
"currentParent",
".",
"addChildBefore",
"(",
"stubVar",
",",
"current",
")",
";",
"parent",
".",
"replaceChild",
"(",
"ref",
".",
"getNode",
"(",
")",
",",
"nameNode",
")",
";",
"compiler",
".",
"reportChangeToEnclosingScope",
"(",
"nameNode",
")",
";",
"}"
] | Updates the initial assignment to a collapsible property at global scope
by adding a VAR stub and collapsing the property. e.g. c = a.b = 1; => var a$b; c = a$b = 1;
This specifically handles "twinned" assignments, which are those where the assignment is also
used as a reference and which need special handling.
@param alias The flattened property name (e.g. "a$b")
@param refName The name for the reference being updated.
@param ref An object containing information about the assignment getting updated | [
"Updates",
"the",
"initial",
"assignment",
"to",
"a",
"collapsible",
"property",
"at",
"global",
"scope",
"by",
"adding",
"a",
"VAR",
"stub",
"and",
"collapsing",
"the",
"property",
".",
"e",
".",
"g",
".",
"c",
"=",
"a",
".",
"b",
"=",
"1",
";",
"=",
">",
"var",
"a$b",
";",
"c",
"=",
"a$b",
"=",
"1",
";",
"This",
"specifically",
"handles",
"twinned",
"assignments",
"which",
"are",
"those",
"where",
"the",
"assignment",
"is",
"also",
"used",
"as",
"a",
"reference",
"and",
"which",
"need",
"special",
"handling",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CollapseProperties.java#L464-L503 |
hibernate/hibernate-ogm | neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/query/parsing/impl/Neo4jPropertyHelper.java | Neo4jPropertyHelper.isIdProperty | public boolean isIdProperty(OgmEntityPersister persister, List<String> namesWithoutAlias) {
"""
Check if the property is part of the identifier of the entity.
@param persister the {@link OgmEntityPersister} of the entity with the property
@param namesWithoutAlias the path to the property with all the aliases resolved
@return {@code true} if the property is part of the id, {@code false} otherwise.
"""
String join = StringHelper.join( namesWithoutAlias, "." );
Type propertyType = persister.getPropertyType( namesWithoutAlias.get( 0 ) );
String[] identifierColumnNames = persister.getIdentifierColumnNames();
if ( propertyType.isComponentType() ) {
String[] embeddedColumnNames = persister.getPropertyColumnNames( join );
for ( String embeddedColumn : embeddedColumnNames ) {
if ( !ArrayHelper.contains( identifierColumnNames, embeddedColumn ) ) {
return false;
}
}
return true;
}
return ArrayHelper.contains( identifierColumnNames, join );
} | java | public boolean isIdProperty(OgmEntityPersister persister, List<String> namesWithoutAlias) {
String join = StringHelper.join( namesWithoutAlias, "." );
Type propertyType = persister.getPropertyType( namesWithoutAlias.get( 0 ) );
String[] identifierColumnNames = persister.getIdentifierColumnNames();
if ( propertyType.isComponentType() ) {
String[] embeddedColumnNames = persister.getPropertyColumnNames( join );
for ( String embeddedColumn : embeddedColumnNames ) {
if ( !ArrayHelper.contains( identifierColumnNames, embeddedColumn ) ) {
return false;
}
}
return true;
}
return ArrayHelper.contains( identifierColumnNames, join );
} | [
"public",
"boolean",
"isIdProperty",
"(",
"OgmEntityPersister",
"persister",
",",
"List",
"<",
"String",
">",
"namesWithoutAlias",
")",
"{",
"String",
"join",
"=",
"StringHelper",
".",
"join",
"(",
"namesWithoutAlias",
",",
"\".\"",
")",
";",
"Type",
"propertyType",
"=",
"persister",
".",
"getPropertyType",
"(",
"namesWithoutAlias",
".",
"get",
"(",
"0",
")",
")",
";",
"String",
"[",
"]",
"identifierColumnNames",
"=",
"persister",
".",
"getIdentifierColumnNames",
"(",
")",
";",
"if",
"(",
"propertyType",
".",
"isComponentType",
"(",
")",
")",
"{",
"String",
"[",
"]",
"embeddedColumnNames",
"=",
"persister",
".",
"getPropertyColumnNames",
"(",
"join",
")",
";",
"for",
"(",
"String",
"embeddedColumn",
":",
"embeddedColumnNames",
")",
"{",
"if",
"(",
"!",
"ArrayHelper",
".",
"contains",
"(",
"identifierColumnNames",
",",
"embeddedColumn",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}",
"return",
"ArrayHelper",
".",
"contains",
"(",
"identifierColumnNames",
",",
"join",
")",
";",
"}"
] | Check if the property is part of the identifier of the entity.
@param persister the {@link OgmEntityPersister} of the entity with the property
@param namesWithoutAlias the path to the property with all the aliases resolved
@return {@code true} if the property is part of the id, {@code false} otherwise. | [
"Check",
"if",
"the",
"property",
"is",
"part",
"of",
"the",
"identifier",
"of",
"the",
"entity",
"."
] | train | https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/query/parsing/impl/Neo4jPropertyHelper.java#L164-L178 |
btrplace/scheduler | choco/src/main/java/org/btrplace/scheduler/choco/extensions/pack/KnapsackDecorator.java | KnapsackDecorator.postRemoveItem | @SuppressWarnings("squid:S3346")
public void postRemoveItem(int item, int bin) {
"""
update the candidate list of a bin when an item is removed
@param item the removed item
@param bin the bin
"""
assert candidate.get(bin).get(item);
candidate.get(bin).clear(item);
} | java | @SuppressWarnings("squid:S3346")
public void postRemoveItem(int item, int bin) {
assert candidate.get(bin).get(item);
candidate.get(bin).clear(item);
} | [
"@",
"SuppressWarnings",
"(",
"\"squid:S3346\"",
")",
"public",
"void",
"postRemoveItem",
"(",
"int",
"item",
",",
"int",
"bin",
")",
"{",
"assert",
"candidate",
".",
"get",
"(",
"bin",
")",
".",
"get",
"(",
"item",
")",
";",
"candidate",
".",
"get",
"(",
"bin",
")",
".",
"clear",
"(",
"item",
")",
";",
"}"
] | update the candidate list of a bin when an item is removed
@param item the removed item
@param bin the bin | [
"update",
"the",
"candidate",
"list",
"of",
"a",
"bin",
"when",
"an",
"item",
"is",
"removed"
] | train | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/choco/src/main/java/org/btrplace/scheduler/choco/extensions/pack/KnapsackDecorator.java#L148-L152 |
acromusashi/acromusashi-stream-ml | src/main/java/acromusashi/stream/ml/anomaly/lof/LofCalculator.java | LofCalculator.calculateLof | protected static double calculateLof(LofPoint basePoint, LofDataSet dataSet) {
"""
basePointの局所外れ係数(Local outlier factor)を算出する。
@param basePoint 算出元対象点
@param dataSet 全体データ
@return 局所外れ係数
"""
int countedData = 0;
double totalAmount = 0.0d;
for (String targetDataId : basePoint.getkDistanceNeighbor())
{
LofPoint targetPoint = dataSet.getDataMap().get(targetDataId);
totalAmount = totalAmount + (targetPoint.getLrd() / basePoint.getLrd());
countedData++;
}
if (countedData == 0)
{
return totalAmount;
}
return totalAmount / (countedData);
} | java | protected static double calculateLof(LofPoint basePoint, LofDataSet dataSet)
{
int countedData = 0;
double totalAmount = 0.0d;
for (String targetDataId : basePoint.getkDistanceNeighbor())
{
LofPoint targetPoint = dataSet.getDataMap().get(targetDataId);
totalAmount = totalAmount + (targetPoint.getLrd() / basePoint.getLrd());
countedData++;
}
if (countedData == 0)
{
return totalAmount;
}
return totalAmount / (countedData);
} | [
"protected",
"static",
"double",
"calculateLof",
"(",
"LofPoint",
"basePoint",
",",
"LofDataSet",
"dataSet",
")",
"{",
"int",
"countedData",
"=",
"0",
";",
"double",
"totalAmount",
"=",
"0.0d",
";",
"for",
"(",
"String",
"targetDataId",
":",
"basePoint",
".",
"getkDistanceNeighbor",
"(",
")",
")",
"{",
"LofPoint",
"targetPoint",
"=",
"dataSet",
".",
"getDataMap",
"(",
")",
".",
"get",
"(",
"targetDataId",
")",
";",
"totalAmount",
"=",
"totalAmount",
"+",
"(",
"targetPoint",
".",
"getLrd",
"(",
")",
"/",
"basePoint",
".",
"getLrd",
"(",
")",
")",
";",
"countedData",
"++",
";",
"}",
"if",
"(",
"countedData",
"==",
"0",
")",
"{",
"return",
"totalAmount",
";",
"}",
"return",
"totalAmount",
"/",
"(",
"countedData",
")",
";",
"}"
] | basePointの局所外れ係数(Local outlier factor)を算出する。
@param basePoint 算出元対象点
@param dataSet 全体データ
@return 局所外れ係数 | [
"basePointの局所外れ係数",
"(",
"Local",
"outlier",
"factor",
")",
"を算出する。"
] | train | https://github.com/acromusashi/acromusashi-stream-ml/blob/26d6799a917cacda68e21d506c75cfeb17d832a6/src/main/java/acromusashi/stream/ml/anomaly/lof/LofCalculator.java#L415-L433 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/AvroUtils.java | AvroUtils.checkReaderWriterCompatibility | public static boolean checkReaderWriterCompatibility(Schema readerSchema, Schema writerSchema, boolean ignoreNamespace) {
"""
Validates that the provided reader schema can be used to decode avro data written with the
provided writer schema.
@param readerSchema schema to check.
@param writerSchema schema to check.
@param ignoreNamespace whether name and namespace should be ignored in validation
@return true if validation passes
"""
if (ignoreNamespace) {
List<Schema.Field> fields = deepCopySchemaFields(readerSchema);
readerSchema = Schema.createRecord(writerSchema.getName(), writerSchema.getDoc(), writerSchema.getNamespace(),
readerSchema.isError());
readerSchema.setFields(fields);
}
return SchemaCompatibility.checkReaderWriterCompatibility(readerSchema, writerSchema).getType().equals(SchemaCompatibility.SchemaCompatibilityType.COMPATIBLE);
} | java | public static boolean checkReaderWriterCompatibility(Schema readerSchema, Schema writerSchema, boolean ignoreNamespace) {
if (ignoreNamespace) {
List<Schema.Field> fields = deepCopySchemaFields(readerSchema);
readerSchema = Schema.createRecord(writerSchema.getName(), writerSchema.getDoc(), writerSchema.getNamespace(),
readerSchema.isError());
readerSchema.setFields(fields);
}
return SchemaCompatibility.checkReaderWriterCompatibility(readerSchema, writerSchema).getType().equals(SchemaCompatibility.SchemaCompatibilityType.COMPATIBLE);
} | [
"public",
"static",
"boolean",
"checkReaderWriterCompatibility",
"(",
"Schema",
"readerSchema",
",",
"Schema",
"writerSchema",
",",
"boolean",
"ignoreNamespace",
")",
"{",
"if",
"(",
"ignoreNamespace",
")",
"{",
"List",
"<",
"Schema",
".",
"Field",
">",
"fields",
"=",
"deepCopySchemaFields",
"(",
"readerSchema",
")",
";",
"readerSchema",
"=",
"Schema",
".",
"createRecord",
"(",
"writerSchema",
".",
"getName",
"(",
")",
",",
"writerSchema",
".",
"getDoc",
"(",
")",
",",
"writerSchema",
".",
"getNamespace",
"(",
")",
",",
"readerSchema",
".",
"isError",
"(",
")",
")",
";",
"readerSchema",
".",
"setFields",
"(",
"fields",
")",
";",
"}",
"return",
"SchemaCompatibility",
".",
"checkReaderWriterCompatibility",
"(",
"readerSchema",
",",
"writerSchema",
")",
".",
"getType",
"(",
")",
".",
"equals",
"(",
"SchemaCompatibility",
".",
"SchemaCompatibilityType",
".",
"COMPATIBLE",
")",
";",
"}"
] | Validates that the provided reader schema can be used to decode avro data written with the
provided writer schema.
@param readerSchema schema to check.
@param writerSchema schema to check.
@param ignoreNamespace whether name and namespace should be ignored in validation
@return true if validation passes | [
"Validates",
"that",
"the",
"provided",
"reader",
"schema",
"can",
"be",
"used",
"to",
"decode",
"avro",
"data",
"written",
"with",
"the",
"provided",
"writer",
"schema",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/AvroUtils.java#L101-L110 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/CalendarAstronomer.java | CalendarAstronomer.eclipticToEquatorial | public final Equatorial eclipticToEquatorial(double eclipLong, double eclipLat) {
"""
Convert from ecliptic to equatorial coordinates.
@param eclipLong The ecliptic longitude
@param eclipLat The ecliptic latitude
@return The corresponding point in equatorial coordinates.
@hide draft / provisional / internal are hidden on Android
"""
// See page 42 of "Practial Astronomy with your Calculator",
// by Peter Duffet-Smith, for details on the algorithm.
double obliq = eclipticObliquity();
double sinE = Math.sin(obliq);
double cosE = Math.cos(obliq);
double sinL = Math.sin(eclipLong);
double cosL = Math.cos(eclipLong);
double sinB = Math.sin(eclipLat);
double cosB = Math.cos(eclipLat);
double tanB = Math.tan(eclipLat);
return new Equatorial(Math.atan2(sinL*cosE - tanB*sinE, cosL),
Math.asin(sinB*cosE + cosB*sinE*sinL) );
} | java | public final Equatorial eclipticToEquatorial(double eclipLong, double eclipLat)
{
// See page 42 of "Practial Astronomy with your Calculator",
// by Peter Duffet-Smith, for details on the algorithm.
double obliq = eclipticObliquity();
double sinE = Math.sin(obliq);
double cosE = Math.cos(obliq);
double sinL = Math.sin(eclipLong);
double cosL = Math.cos(eclipLong);
double sinB = Math.sin(eclipLat);
double cosB = Math.cos(eclipLat);
double tanB = Math.tan(eclipLat);
return new Equatorial(Math.atan2(sinL*cosE - tanB*sinE, cosL),
Math.asin(sinB*cosE + cosB*sinE*sinL) );
} | [
"public",
"final",
"Equatorial",
"eclipticToEquatorial",
"(",
"double",
"eclipLong",
",",
"double",
"eclipLat",
")",
"{",
"// See page 42 of \"Practial Astronomy with your Calculator\",",
"// by Peter Duffet-Smith, for details on the algorithm.",
"double",
"obliq",
"=",
"eclipticObliquity",
"(",
")",
";",
"double",
"sinE",
"=",
"Math",
".",
"sin",
"(",
"obliq",
")",
";",
"double",
"cosE",
"=",
"Math",
".",
"cos",
"(",
"obliq",
")",
";",
"double",
"sinL",
"=",
"Math",
".",
"sin",
"(",
"eclipLong",
")",
";",
"double",
"cosL",
"=",
"Math",
".",
"cos",
"(",
"eclipLong",
")",
";",
"double",
"sinB",
"=",
"Math",
".",
"sin",
"(",
"eclipLat",
")",
";",
"double",
"cosB",
"=",
"Math",
".",
"cos",
"(",
"eclipLat",
")",
";",
"double",
"tanB",
"=",
"Math",
".",
"tan",
"(",
"eclipLat",
")",
";",
"return",
"new",
"Equatorial",
"(",
"Math",
".",
"atan2",
"(",
"sinL",
"*",
"cosE",
"-",
"tanB",
"*",
"sinE",
",",
"cosL",
")",
",",
"Math",
".",
"asin",
"(",
"sinB",
"*",
"cosE",
"+",
"cosB",
"*",
"sinE",
"*",
"sinL",
")",
")",
";",
"}"
] | Convert from ecliptic to equatorial coordinates.
@param eclipLong The ecliptic longitude
@param eclipLat The ecliptic latitude
@return The corresponding point in equatorial coordinates.
@hide draft / provisional / internal are hidden on Android | [
"Convert",
"from",
"ecliptic",
"to",
"equatorial",
"coordinates",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/CalendarAstronomer.java#L442-L460 |
elki-project/elki | elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/statistics/HopkinsStatisticClusteringTendency.java | HopkinsStatisticClusteringTendency.computeNNForRealData | protected double computeNNForRealData(final KNNQuery<NumberVector> knnQuery, Relation<NumberVector> relation, final int dim) {
"""
Search nearest neighbors for <em>real</em> data members.
@param knnQuery KNN query
@param relation Data relation
@return Aggregated 1NN distances
"""
double w = 0.;
ModifiableDBIDs dataSampleIds = DBIDUtil.randomSample(relation.getDBIDs(), sampleSize, random);
for(DBIDIter iter = dataSampleIds.iter(); iter.valid(); iter.advance()) {
final double kdist = knnQuery.getKNNForDBID(iter, k + 1).getKNNDistance();
w += MathUtil.powi(kdist, dim);
}
return w;
} | java | protected double computeNNForRealData(final KNNQuery<NumberVector> knnQuery, Relation<NumberVector> relation, final int dim) {
double w = 0.;
ModifiableDBIDs dataSampleIds = DBIDUtil.randomSample(relation.getDBIDs(), sampleSize, random);
for(DBIDIter iter = dataSampleIds.iter(); iter.valid(); iter.advance()) {
final double kdist = knnQuery.getKNNForDBID(iter, k + 1).getKNNDistance();
w += MathUtil.powi(kdist, dim);
}
return w;
} | [
"protected",
"double",
"computeNNForRealData",
"(",
"final",
"KNNQuery",
"<",
"NumberVector",
">",
"knnQuery",
",",
"Relation",
"<",
"NumberVector",
">",
"relation",
",",
"final",
"int",
"dim",
")",
"{",
"double",
"w",
"=",
"0.",
";",
"ModifiableDBIDs",
"dataSampleIds",
"=",
"DBIDUtil",
".",
"randomSample",
"(",
"relation",
".",
"getDBIDs",
"(",
")",
",",
"sampleSize",
",",
"random",
")",
";",
"for",
"(",
"DBIDIter",
"iter",
"=",
"dataSampleIds",
".",
"iter",
"(",
")",
";",
"iter",
".",
"valid",
"(",
")",
";",
"iter",
".",
"advance",
"(",
")",
")",
"{",
"final",
"double",
"kdist",
"=",
"knnQuery",
".",
"getKNNForDBID",
"(",
"iter",
",",
"k",
"+",
"1",
")",
".",
"getKNNDistance",
"(",
")",
";",
"w",
"+=",
"MathUtil",
".",
"powi",
"(",
"kdist",
",",
"dim",
")",
";",
"}",
"return",
"w",
";",
"}"
] | Search nearest neighbors for <em>real</em> data members.
@param knnQuery KNN query
@param relation Data relation
@return Aggregated 1NN distances | [
"Search",
"nearest",
"neighbors",
"for",
"<em",
">",
"real<",
"/",
"em",
">",
"data",
"members",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/statistics/HopkinsStatisticClusteringTendency.java#L204-L212 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/util/MLLibUtil.java | MLLibUtil.fromLabeledPoint | public static JavaRDD<DataSet> fromLabeledPoint(JavaRDD<LabeledPoint> data, final long numPossibleLabels,
boolean preCache) {
"""
Converts JavaRDD labeled points to JavaRDD DataSets.
@param data JavaRDD LabeledPoints
@param numPossibleLabels number of possible labels
@param preCache boolean pre-cache rdd before operation
@return
"""
if (preCache && !data.getStorageLevel().useMemory()) {
data.cache();
}
return data.map(new Function<LabeledPoint, DataSet>() {
@Override
public DataSet call(LabeledPoint lp) {
return fromLabeledPoint(lp, numPossibleLabels);
}
});
} | java | public static JavaRDD<DataSet> fromLabeledPoint(JavaRDD<LabeledPoint> data, final long numPossibleLabels,
boolean preCache) {
if (preCache && !data.getStorageLevel().useMemory()) {
data.cache();
}
return data.map(new Function<LabeledPoint, DataSet>() {
@Override
public DataSet call(LabeledPoint lp) {
return fromLabeledPoint(lp, numPossibleLabels);
}
});
} | [
"public",
"static",
"JavaRDD",
"<",
"DataSet",
">",
"fromLabeledPoint",
"(",
"JavaRDD",
"<",
"LabeledPoint",
">",
"data",
",",
"final",
"long",
"numPossibleLabels",
",",
"boolean",
"preCache",
")",
"{",
"if",
"(",
"preCache",
"&&",
"!",
"data",
".",
"getStorageLevel",
"(",
")",
".",
"useMemory",
"(",
")",
")",
"{",
"data",
".",
"cache",
"(",
")",
";",
"}",
"return",
"data",
".",
"map",
"(",
"new",
"Function",
"<",
"LabeledPoint",
",",
"DataSet",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"DataSet",
"call",
"(",
"LabeledPoint",
"lp",
")",
"{",
"return",
"fromLabeledPoint",
"(",
"lp",
",",
"numPossibleLabels",
")",
";",
"}",
"}",
")",
";",
"}"
] | Converts JavaRDD labeled points to JavaRDD DataSets.
@param data JavaRDD LabeledPoints
@param numPossibleLabels number of possible labels
@param preCache boolean pre-cache rdd before operation
@return | [
"Converts",
"JavaRDD",
"labeled",
"points",
"to",
"JavaRDD",
"DataSets",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/util/MLLibUtil.java#L358-L369 |
contentful/contentful.java | src/main/java/com/contentful/java/cda/image/ImageOption.java | ImageOption.jpegQualityOf | public static ImageOption jpegQualityOf(int quality) {
"""
Define the quality of the jpg image to be returned.
@param quality an positive integer between 1 and 100.
@return an image option for updating the url.
@throws IllegalArgumentException if quality is not between 1 and 100.
"""
if (quality < 1 || quality > 100) {
throw new IllegalArgumentException("Quality has to be in the range from 1 to 100.");
}
return new ImageOption("q", Integer.toString(quality));
} | java | public static ImageOption jpegQualityOf(int quality) {
if (quality < 1 || quality > 100) {
throw new IllegalArgumentException("Quality has to be in the range from 1 to 100.");
}
return new ImageOption("q", Integer.toString(quality));
} | [
"public",
"static",
"ImageOption",
"jpegQualityOf",
"(",
"int",
"quality",
")",
"{",
"if",
"(",
"quality",
"<",
"1",
"||",
"quality",
">",
"100",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Quality has to be in the range from 1 to 100.\"",
")",
";",
"}",
"return",
"new",
"ImageOption",
"(",
"\"q\"",
",",
"Integer",
".",
"toString",
"(",
"quality",
")",
")",
";",
"}"
] | Define the quality of the jpg image to be returned.
@param quality an positive integer between 1 and 100.
@return an image option for updating the url.
@throws IllegalArgumentException if quality is not between 1 and 100. | [
"Define",
"the",
"quality",
"of",
"the",
"jpg",
"image",
"to",
"be",
"returned",
"."
] | train | https://github.com/contentful/contentful.java/blob/6ecc2ace454c674b218b99489dc50697b1dbffcb/src/main/java/com/contentful/java/cda/image/ImageOption.java#L161-L167 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/crs/ST_SetSRID.java | ST_SetSRID.setSRID | public static Geometry setSRID(Geometry geometry, Integer srid) throws IllegalArgumentException {
"""
Set a new SRID to the geometry
@param geometry
@param srid
@return
@throws IllegalArgumentException
"""
if (geometry == null) {
return null;
}
if (srid == null) {
throw new IllegalArgumentException("The SRID code cannot be null.");
}
Geometry geom = geometry.copy();
geom.setSRID(srid);
return geom;
} | java | public static Geometry setSRID(Geometry geometry, Integer srid) throws IllegalArgumentException {
if (geometry == null) {
return null;
}
if (srid == null) {
throw new IllegalArgumentException("The SRID code cannot be null.");
}
Geometry geom = geometry.copy();
geom.setSRID(srid);
return geom;
} | [
"public",
"static",
"Geometry",
"setSRID",
"(",
"Geometry",
"geometry",
",",
"Integer",
"srid",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"geometry",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"srid",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The SRID code cannot be null.\"",
")",
";",
"}",
"Geometry",
"geom",
"=",
"geometry",
".",
"copy",
"(",
")",
";",
"geom",
".",
"setSRID",
"(",
"srid",
")",
";",
"return",
"geom",
";",
"}"
] | Set a new SRID to the geometry
@param geometry
@param srid
@return
@throws IllegalArgumentException | [
"Set",
"a",
"new",
"SRID",
"to",
"the",
"geometry"
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/crs/ST_SetSRID.java#L51-L61 |
b3log/latke | latke-core/src/main/java/org/json/JSONObject.java | JSONObject.optBigDecimal | public BigDecimal optBigDecimal(String key, BigDecimal defaultValue) {
"""
Get an optional BigDecimal associated with a key, or the defaultValue if
there is no such key or if its value is not a number. If the value is a
string, an attempt will be made to evaluate it as a number. If the value
is float or double, then the {@link BigDecimal#BigDecimal(double)}
constructor will be used. See notes on the constructor for conversion
issues that may arise.
@param key
A key string.
@param defaultValue
The default.
@return An object which is the value.
"""
Object val = this.opt(key);
return objectToBigDecimal(val, defaultValue);
} | java | public BigDecimal optBigDecimal(String key, BigDecimal defaultValue) {
Object val = this.opt(key);
return objectToBigDecimal(val, defaultValue);
} | [
"public",
"BigDecimal",
"optBigDecimal",
"(",
"String",
"key",
",",
"BigDecimal",
"defaultValue",
")",
"{",
"Object",
"val",
"=",
"this",
".",
"opt",
"(",
"key",
")",
";",
"return",
"objectToBigDecimal",
"(",
"val",
",",
"defaultValue",
")",
";",
"}"
] | Get an optional BigDecimal associated with a key, or the defaultValue if
there is no such key or if its value is not a number. If the value is a
string, an attempt will be made to evaluate it as a number. If the value
is float or double, then the {@link BigDecimal#BigDecimal(double)}
constructor will be used. See notes on the constructor for conversion
issues that may arise.
@param key
A key string.
@param defaultValue
The default.
@return An object which is the value. | [
"Get",
"an",
"optional",
"BigDecimal",
"associated",
"with",
"a",
"key",
"or",
"the",
"defaultValue",
"if",
"there",
"is",
"no",
"such",
"key",
"or",
"if",
"its",
"value",
"is",
"not",
"a",
"number",
".",
"If",
"the",
"value",
"is",
"a",
"string",
"an",
"attempt",
"will",
"be",
"made",
"to",
"evaluate",
"it",
"as",
"a",
"number",
".",
"If",
"the",
"value",
"is",
"float",
"or",
"double",
"then",
"the",
"{",
"@link",
"BigDecimal#BigDecimal",
"(",
"double",
")",
"}",
"constructor",
"will",
"be",
"used",
".",
"See",
"notes",
"on",
"the",
"constructor",
"for",
"conversion",
"issues",
"that",
"may",
"arise",
"."
] | train | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/JSONObject.java#L1109-L1112 |
santhosh-tekuri/jlibs | xml/src/main/java/jlibs/xml/xsl/TransformerUtil.java | TransformerUtil.setOutputProperties | public static Transformer setOutputProperties(Transformer transformer, boolean omitXMLDeclaration, int indentAmount, String encoding) {
"""
to set various output properties on given transformer.
@param transformer transformer on which properties are set
@param omitXMLDeclaration omit xml declaration or not
@param indentAmount the number fo spaces used for indentation.
use <=0, in case you dont want indentation
@param encoding required encoding. use null to don't set any encoding
@return the same transformer which is passed as argument
"""
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, omitXMLDeclaration ? "yes" : "no");
// indentation
if(indentAmount>0){
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty(OUTPUT_KEY_INDENT_AMOUT, String.valueOf(indentAmount));
}
if(!StringUtil.isWhitespace(encoding))
transformer.setOutputProperty(OutputKeys.ENCODING, encoding.trim());
return transformer;
} | java | public static Transformer setOutputProperties(Transformer transformer, boolean omitXMLDeclaration, int indentAmount, String encoding){
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, omitXMLDeclaration ? "yes" : "no");
// indentation
if(indentAmount>0){
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty(OUTPUT_KEY_INDENT_AMOUT, String.valueOf(indentAmount));
}
if(!StringUtil.isWhitespace(encoding))
transformer.setOutputProperty(OutputKeys.ENCODING, encoding.trim());
return transformer;
} | [
"public",
"static",
"Transformer",
"setOutputProperties",
"(",
"Transformer",
"transformer",
",",
"boolean",
"omitXMLDeclaration",
",",
"int",
"indentAmount",
",",
"String",
"encoding",
")",
"{",
"transformer",
".",
"setOutputProperty",
"(",
"OutputKeys",
".",
"OMIT_XML_DECLARATION",
",",
"omitXMLDeclaration",
"?",
"\"yes\"",
":",
"\"no\"",
")",
";",
"// indentation",
"if",
"(",
"indentAmount",
">",
"0",
")",
"{",
"transformer",
".",
"setOutputProperty",
"(",
"OutputKeys",
".",
"INDENT",
",",
"\"yes\"",
")",
";",
"transformer",
".",
"setOutputProperty",
"(",
"OUTPUT_KEY_INDENT_AMOUT",
",",
"String",
".",
"valueOf",
"(",
"indentAmount",
")",
")",
";",
"}",
"if",
"(",
"!",
"StringUtil",
".",
"isWhitespace",
"(",
"encoding",
")",
")",
"transformer",
".",
"setOutputProperty",
"(",
"OutputKeys",
".",
"ENCODING",
",",
"encoding",
".",
"trim",
"(",
")",
")",
";",
"return",
"transformer",
";",
"}"
] | to set various output properties on given transformer.
@param transformer transformer on which properties are set
@param omitXMLDeclaration omit xml declaration or not
@param indentAmount the number fo spaces used for indentation.
use <=0, in case you dont want indentation
@param encoding required encoding. use null to don't set any encoding
@return the same transformer which is passed as argument | [
"to",
"set",
"various",
"output",
"properties",
"on",
"given",
"transformer",
"."
] | train | https://github.com/santhosh-tekuri/jlibs/blob/59c28719f054123cf778278154e1b92e943ad232/xml/src/main/java/jlibs/xml/xsl/TransformerUtil.java#L44-L57 |
infinispan/infinispan | commons/src/main/java/org/infinispan/commons/marshall/MarshallUtil.java | MarshallUtil.marshallArray | public static <E> void marshallArray(E[] array, ObjectOutput out) throws IOException {
"""
Marshall arrays.
<p>
This method supports {@code null} {@code array}.
@param array Array to marshall.
@param out {@link ObjectOutput} to write.
@param <E> Array type.
@throws IOException If any of the usual Input/Output related exceptions occur.
"""
final int size = array == null ? NULL_VALUE : array.length;
marshallSize(out, size);
if (size <= 0) {
return;
}
for (int i = 0; i < size; ++i) {
out.writeObject(array[i]);
}
} | java | public static <E> void marshallArray(E[] array, ObjectOutput out) throws IOException {
final int size = array == null ? NULL_VALUE : array.length;
marshallSize(out, size);
if (size <= 0) {
return;
}
for (int i = 0; i < size; ++i) {
out.writeObject(array[i]);
}
} | [
"public",
"static",
"<",
"E",
">",
"void",
"marshallArray",
"(",
"E",
"[",
"]",
"array",
",",
"ObjectOutput",
"out",
")",
"throws",
"IOException",
"{",
"final",
"int",
"size",
"=",
"array",
"==",
"null",
"?",
"NULL_VALUE",
":",
"array",
".",
"length",
";",
"marshallSize",
"(",
"out",
",",
"size",
")",
";",
"if",
"(",
"size",
"<=",
"0",
")",
"{",
"return",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
"++",
"i",
")",
"{",
"out",
".",
"writeObject",
"(",
"array",
"[",
"i",
"]",
")",
";",
"}",
"}"
] | Marshall arrays.
<p>
This method supports {@code null} {@code array}.
@param array Array to marshall.
@param out {@link ObjectOutput} to write.
@param <E> Array type.
@throws IOException If any of the usual Input/Output related exceptions occur. | [
"Marshall",
"arrays",
".",
"<p",
">",
"This",
"method",
"supports",
"{",
"@code",
"null",
"}",
"{",
"@code",
"array",
"}",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/marshall/MarshallUtil.java#L184-L193 |
twitter/cloudhopper-commons | ch-commons-gsm/src/main/java/com/cloudhopper/commons/gsm/DataCoding.java | DataCoding.createCharacterEncodingGroup | static public DataCoding createCharacterEncodingGroup(byte characterEncoding) throws IllegalArgumentException {
"""
Creates a "Character Encoding" group data coding scheme where 16 different
languages are supported. This method validates the range and
sets the message class to 0 and compression flags to false.
@param characterEncoding The different possible character encodings
@return A new immutable DataCoding instance representing this data coding scheme
@throws IllegalArgumentException Thrown if the range is not supported.
"""
// bits 3 thru 0 of the encoding represent 16 languages
// make sure the top bits 7 thru 4 are not set
if ((characterEncoding & 0xF0) != 0) {
throw new IllegalArgumentException("Invalid characterEncoding [0x" + HexUtil.toHexString(characterEncoding) + "] value used: only 16 possible for char encoding group");
}
return new DataCoding(characterEncoding, Group.CHARACTER_ENCODING, characterEncoding, MESSAGE_CLASS_0, false);
} | java | static public DataCoding createCharacterEncodingGroup(byte characterEncoding) throws IllegalArgumentException {
// bits 3 thru 0 of the encoding represent 16 languages
// make sure the top bits 7 thru 4 are not set
if ((characterEncoding & 0xF0) != 0) {
throw new IllegalArgumentException("Invalid characterEncoding [0x" + HexUtil.toHexString(characterEncoding) + "] value used: only 16 possible for char encoding group");
}
return new DataCoding(characterEncoding, Group.CHARACTER_ENCODING, characterEncoding, MESSAGE_CLASS_0, false);
} | [
"static",
"public",
"DataCoding",
"createCharacterEncodingGroup",
"(",
"byte",
"characterEncoding",
")",
"throws",
"IllegalArgumentException",
"{",
"// bits 3 thru 0 of the encoding represent 16 languages",
"// make sure the top bits 7 thru 4 are not set",
"if",
"(",
"(",
"characterEncoding",
"&",
"0xF0",
")",
"!=",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid characterEncoding [0x\"",
"+",
"HexUtil",
".",
"toHexString",
"(",
"characterEncoding",
")",
"+",
"\"] value used: only 16 possible for char encoding group\"",
")",
";",
"}",
"return",
"new",
"DataCoding",
"(",
"characterEncoding",
",",
"Group",
".",
"CHARACTER_ENCODING",
",",
"characterEncoding",
",",
"MESSAGE_CLASS_0",
",",
"false",
")",
";",
"}"
] | Creates a "Character Encoding" group data coding scheme where 16 different
languages are supported. This method validates the range and
sets the message class to 0 and compression flags to false.
@param characterEncoding The different possible character encodings
@return A new immutable DataCoding instance representing this data coding scheme
@throws IllegalArgumentException Thrown if the range is not supported. | [
"Creates",
"a",
"Character",
"Encoding",
"group",
"data",
"coding",
"scheme",
"where",
"16",
"different",
"languages",
"are",
"supported",
".",
"This",
"method",
"validates",
"the",
"range",
"and",
"sets",
"the",
"message",
"class",
"to",
"0",
"and",
"compression",
"flags",
"to",
"false",
"."
] | train | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-gsm/src/main/java/com/cloudhopper/commons/gsm/DataCoding.java#L202-L209 |
cdapio/tigon | tigon-flow/src/main/java/co/cask/tigon/internal/app/runtime/distributed/AbstractDistributedProgramRunner.java | AbstractDistributedProgramRunner.copyProgramJar | private Program copyProgramJar(final Program program, File programDir) throws IOException {
"""
Copies the program jar to a local temp file and return a {@link Program} instance
with {@link Program#getJarLocation()} points to the local temp file.
"""
File tempJar = File.createTempFile(program.getName(), ".jar");
Files.copy(new InputSupplier<InputStream>() {
@Override
public InputStream getInput() throws IOException {
return program.getJarLocation().getInputStream();
}
}, tempJar);
final Location jarLocation = new LocalLocationFactory().create(tempJar.toURI());
return Programs.createWithUnpack(jarLocation, programDir);
} | java | private Program copyProgramJar(final Program program, File programDir) throws IOException {
File tempJar = File.createTempFile(program.getName(), ".jar");
Files.copy(new InputSupplier<InputStream>() {
@Override
public InputStream getInput() throws IOException {
return program.getJarLocation().getInputStream();
}
}, tempJar);
final Location jarLocation = new LocalLocationFactory().create(tempJar.toURI());
return Programs.createWithUnpack(jarLocation, programDir);
} | [
"private",
"Program",
"copyProgramJar",
"(",
"final",
"Program",
"program",
",",
"File",
"programDir",
")",
"throws",
"IOException",
"{",
"File",
"tempJar",
"=",
"File",
".",
"createTempFile",
"(",
"program",
".",
"getName",
"(",
")",
",",
"\".jar\"",
")",
";",
"Files",
".",
"copy",
"(",
"new",
"InputSupplier",
"<",
"InputStream",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"InputStream",
"getInput",
"(",
")",
"throws",
"IOException",
"{",
"return",
"program",
".",
"getJarLocation",
"(",
")",
".",
"getInputStream",
"(",
")",
";",
"}",
"}",
",",
"tempJar",
")",
";",
"final",
"Location",
"jarLocation",
"=",
"new",
"LocalLocationFactory",
"(",
")",
".",
"create",
"(",
"tempJar",
".",
"toURI",
"(",
")",
")",
";",
"return",
"Programs",
".",
"createWithUnpack",
"(",
"jarLocation",
",",
"programDir",
")",
";",
"}"
] | Copies the program jar to a local temp file and return a {@link Program} instance
with {@link Program#getJarLocation()} points to the local temp file. | [
"Copies",
"the",
"program",
"jar",
"to",
"a",
"local",
"temp",
"file",
"and",
"return",
"a",
"{"
] | train | https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-flow/src/main/java/co/cask/tigon/internal/app/runtime/distributed/AbstractDistributedProgramRunner.java#L164-L175 |
rey5137/material | material/src/main/java/com/rey/material/widget/Slider.java | Slider.setValueRange | public void setValueRange(int min, int max, boolean animation) {
"""
Set the randge of selectable value.
@param min The minimum selectable value.
@param max The maximum selectable value.
@param animation Indicate that should show animation when thumb's current position changed.
"""
if(max < min || (min == mMinValue && max == mMaxValue))
return;
float oldValue = getExactValue();
float oldPosition = getPosition();
mMinValue = min;
mMaxValue = max;
setValue(oldValue, animation);
if(mOnPositionChangeListener != null && oldPosition == getPosition() && oldValue != getExactValue())
mOnPositionChangeListener.onPositionChanged(this, false, oldPosition, oldPosition, Math.round(oldValue), getValue());
} | java | public void setValueRange(int min, int max, boolean animation){
if(max < min || (min == mMinValue && max == mMaxValue))
return;
float oldValue = getExactValue();
float oldPosition = getPosition();
mMinValue = min;
mMaxValue = max;
setValue(oldValue, animation);
if(mOnPositionChangeListener != null && oldPosition == getPosition() && oldValue != getExactValue())
mOnPositionChangeListener.onPositionChanged(this, false, oldPosition, oldPosition, Math.round(oldValue), getValue());
} | [
"public",
"void",
"setValueRange",
"(",
"int",
"min",
",",
"int",
"max",
",",
"boolean",
"animation",
")",
"{",
"if",
"(",
"max",
"<",
"min",
"||",
"(",
"min",
"==",
"mMinValue",
"&&",
"max",
"==",
"mMaxValue",
")",
")",
"return",
";",
"float",
"oldValue",
"=",
"getExactValue",
"(",
")",
";",
"float",
"oldPosition",
"=",
"getPosition",
"(",
")",
";",
"mMinValue",
"=",
"min",
";",
"mMaxValue",
"=",
"max",
";",
"setValue",
"(",
"oldValue",
",",
"animation",
")",
";",
"if",
"(",
"mOnPositionChangeListener",
"!=",
"null",
"&&",
"oldPosition",
"==",
"getPosition",
"(",
")",
"&&",
"oldValue",
"!=",
"getExactValue",
"(",
")",
")",
"mOnPositionChangeListener",
".",
"onPositionChanged",
"(",
"this",
",",
"false",
",",
"oldPosition",
",",
"oldPosition",
",",
"Math",
".",
"round",
"(",
"oldValue",
")",
",",
"getValue",
"(",
")",
")",
";",
"}"
] | Set the randge of selectable value.
@param min The minimum selectable value.
@param max The maximum selectable value.
@param animation Indicate that should show animation when thumb's current position changed. | [
"Set",
"the",
"randge",
"of",
"selectable",
"value",
"."
] | train | https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/widget/Slider.java#L374-L386 |
alibaba/jstorm | jstorm-core/src/main/java/backtype/storm/windowing/WatermarkTimeTriggerPolicy.java | WatermarkTimeTriggerPolicy.getNextAlignedWindowTs | private long getNextAlignedWindowTs(long startTs, long endTs) {
"""
Computes the next window by scanning the events in the window and
finds the next aligned window between the startTs and endTs. Return the end ts
of the next aligned window, i.e. the ts when the window should fire.
@param startTs the start timestamp (excluding)
@param endTs the end timestamp (including)
@return the aligned window end ts for the next window or Long.MAX_VALUE if there
are no more events to be processed.
"""
long nextTs = windowManager.getEarliestEventTs(startTs, endTs);
if (nextTs == Long.MAX_VALUE || (nextTs % slidingIntervalMs == 0)) {
return nextTs;
}
return nextTs + (slidingIntervalMs - (nextTs % slidingIntervalMs));
} | java | private long getNextAlignedWindowTs(long startTs, long endTs) {
long nextTs = windowManager.getEarliestEventTs(startTs, endTs);
if (nextTs == Long.MAX_VALUE || (nextTs % slidingIntervalMs == 0)) {
return nextTs;
}
return nextTs + (slidingIntervalMs - (nextTs % slidingIntervalMs));
} | [
"private",
"long",
"getNextAlignedWindowTs",
"(",
"long",
"startTs",
",",
"long",
"endTs",
")",
"{",
"long",
"nextTs",
"=",
"windowManager",
".",
"getEarliestEventTs",
"(",
"startTs",
",",
"endTs",
")",
";",
"if",
"(",
"nextTs",
"==",
"Long",
".",
"MAX_VALUE",
"||",
"(",
"nextTs",
"%",
"slidingIntervalMs",
"==",
"0",
")",
")",
"{",
"return",
"nextTs",
";",
"}",
"return",
"nextTs",
"+",
"(",
"slidingIntervalMs",
"-",
"(",
"nextTs",
"%",
"slidingIntervalMs",
")",
")",
";",
"}"
] | Computes the next window by scanning the events in the window and
finds the next aligned window between the startTs and endTs. Return the end ts
of the next aligned window, i.e. the ts when the window should fire.
@param startTs the start timestamp (excluding)
@param endTs the end timestamp (including)
@return the aligned window end ts for the next window or Long.MAX_VALUE if there
are no more events to be processed. | [
"Computes",
"the",
"next",
"window",
"by",
"scanning",
"the",
"events",
"in",
"the",
"window",
"and",
"finds",
"the",
"next",
"aligned",
"window",
"between",
"the",
"startTs",
"and",
"endTs",
".",
"Return",
"the",
"end",
"ts",
"of",
"the",
"next",
"aligned",
"window",
"i",
".",
"e",
".",
"the",
"ts",
"when",
"the",
"window",
"should",
"fire",
"."
] | train | https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/backtype/storm/windowing/WatermarkTimeTriggerPolicy.java#L109-L115 |
VoltDB/voltdb | src/frontend/org/voltcore/utils/ssl/SSLConfiguration.java | SSLConfiguration.createTrustManagers | private static TrustManagerFactory createTrustManagers(String filepath, String keystorePassword)
throws KeyStoreException, FileNotFoundException,
IOException, NoSuchAlgorithmException, CertificateException {
"""
Creates the trust managers required to initiate the {@link SSLContext}, using a JKS keystore as an input.
@param filepath - the path to the JKS keystore.
@param keystorePassword - the keystore's password.
@return {@link TrustManager} array, that will be used to initiate the {@link SSLContext}.
@throws Exception
"""
KeyStore trustStore = KeyStore.getInstance("JKS");
try (InputStream trustStoreIS = new FileInputStream(filepath)) {
trustStore.load(trustStoreIS, keystorePassword.toCharArray());
}
TrustManagerFactory trustFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
trustFactory.init(trustStore);
return trustFactory;
} | java | private static TrustManagerFactory createTrustManagers(String filepath, String keystorePassword)
throws KeyStoreException, FileNotFoundException,
IOException, NoSuchAlgorithmException, CertificateException {
KeyStore trustStore = KeyStore.getInstance("JKS");
try (InputStream trustStoreIS = new FileInputStream(filepath)) {
trustStore.load(trustStoreIS, keystorePassword.toCharArray());
}
TrustManagerFactory trustFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
trustFactory.init(trustStore);
return trustFactory;
} | [
"private",
"static",
"TrustManagerFactory",
"createTrustManagers",
"(",
"String",
"filepath",
",",
"String",
"keystorePassword",
")",
"throws",
"KeyStoreException",
",",
"FileNotFoundException",
",",
"IOException",
",",
"NoSuchAlgorithmException",
",",
"CertificateException",
"{",
"KeyStore",
"trustStore",
"=",
"KeyStore",
".",
"getInstance",
"(",
"\"JKS\"",
")",
";",
"try",
"(",
"InputStream",
"trustStoreIS",
"=",
"new",
"FileInputStream",
"(",
"filepath",
")",
")",
"{",
"trustStore",
".",
"load",
"(",
"trustStoreIS",
",",
"keystorePassword",
".",
"toCharArray",
"(",
")",
")",
";",
"}",
"TrustManagerFactory",
"trustFactory",
"=",
"TrustManagerFactory",
".",
"getInstance",
"(",
"TrustManagerFactory",
".",
"getDefaultAlgorithm",
"(",
")",
")",
";",
"trustFactory",
".",
"init",
"(",
"trustStore",
")",
";",
"return",
"trustFactory",
";",
"}"
] | Creates the trust managers required to initiate the {@link SSLContext}, using a JKS keystore as an input.
@param filepath - the path to the JKS keystore.
@param keystorePassword - the keystore's password.
@return {@link TrustManager} array, that will be used to initiate the {@link SSLContext}.
@throws Exception | [
"Creates",
"the",
"trust",
"managers",
"required",
"to",
"initiate",
"the",
"{",
"@link",
"SSLContext",
"}",
"using",
"a",
"JKS",
"keystore",
"as",
"an",
"input",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltcore/utils/ssl/SSLConfiguration.java#L151-L161 |
sd4324530/fastweixin | src/main/java/com/github/sd4324530/fastweixin/api/OauthAPI.java | OauthAPI.getOauthPageUrl | public String getOauthPageUrl(String redirectUrl, OauthScope scope, String state) {
"""
生成回调url,这个结果要求用户在微信中打开,即可获得token,并指向redirectUrl
@param redirectUrl 用户自己设置的回调地址
@param scope 授权作用域
@param state 用户自带参数
@return 回调url,用户在微信中打开即可开始授权
"""
BeanUtil.requireNonNull(redirectUrl, "redirectUrl is null");
BeanUtil.requireNonNull(scope, "scope is null");
String userState = StrUtil.isBlank(state) ? "STATE" : state;
String url = null;
try {
url = URLEncoder.encode(redirectUrl, "UTF-8");
} catch (UnsupportedEncodingException e) {
LOG.error("异常", e);
}
StringBuilder stringBuilder = new StringBuilder("https://open.weixin.qq.com/connect/oauth2/authorize?");
stringBuilder.append("appid=").append(this.config.getAppid())
.append("&redirect_uri=").append(url)
.append("&response_type=code&scope=").append(scope.toString())
.append("&state=")
.append(userState)
.append("#wechat_redirect");
return stringBuilder.toString();
} | java | public String getOauthPageUrl(String redirectUrl, OauthScope scope, String state) {
BeanUtil.requireNonNull(redirectUrl, "redirectUrl is null");
BeanUtil.requireNonNull(scope, "scope is null");
String userState = StrUtil.isBlank(state) ? "STATE" : state;
String url = null;
try {
url = URLEncoder.encode(redirectUrl, "UTF-8");
} catch (UnsupportedEncodingException e) {
LOG.error("异常", e);
}
StringBuilder stringBuilder = new StringBuilder("https://open.weixin.qq.com/connect/oauth2/authorize?");
stringBuilder.append("appid=").append(this.config.getAppid())
.append("&redirect_uri=").append(url)
.append("&response_type=code&scope=").append(scope.toString())
.append("&state=")
.append(userState)
.append("#wechat_redirect");
return stringBuilder.toString();
} | [
"public",
"String",
"getOauthPageUrl",
"(",
"String",
"redirectUrl",
",",
"OauthScope",
"scope",
",",
"String",
"state",
")",
"{",
"BeanUtil",
".",
"requireNonNull",
"(",
"redirectUrl",
",",
"\"redirectUrl is null\"",
")",
";",
"BeanUtil",
".",
"requireNonNull",
"(",
"scope",
",",
"\"scope is null\"",
")",
";",
"String",
"userState",
"=",
"StrUtil",
".",
"isBlank",
"(",
"state",
")",
"?",
"\"STATE\"",
":",
"state",
";",
"String",
"url",
"=",
"null",
";",
"try",
"{",
"url",
"=",
"URLEncoder",
".",
"encode",
"(",
"redirectUrl",
",",
"\"UTF-8\"",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"\"异常\", e)",
";",
"",
"",
"",
"}",
"StringBuilder",
"stringBuilder",
"=",
"new",
"StringBuilder",
"(",
"\"https://open.weixin.qq.com/connect/oauth2/authorize?\"",
")",
";",
"stringBuilder",
".",
"append",
"(",
"\"appid=\"",
")",
".",
"append",
"(",
"this",
".",
"config",
".",
"getAppid",
"(",
")",
")",
".",
"append",
"(",
"\"&redirect_uri=\"",
")",
".",
"append",
"(",
"url",
")",
".",
"append",
"(",
"\"&response_type=code&scope=\"",
")",
".",
"append",
"(",
"scope",
".",
"toString",
"(",
")",
")",
".",
"append",
"(",
"\"&state=\"",
")",
".",
"append",
"(",
"userState",
")",
".",
"append",
"(",
"\"#wechat_redirect\"",
")",
";",
"return",
"stringBuilder",
".",
"toString",
"(",
")",
";",
"}"
] | 生成回调url,这个结果要求用户在微信中打开,即可获得token,并指向redirectUrl
@param redirectUrl 用户自己设置的回调地址
@param scope 授权作用域
@param state 用户自带参数
@return 回调url,用户在微信中打开即可开始授权 | [
"生成回调url,这个结果要求用户在微信中打开,即可获得token,并指向redirectUrl"
] | train | https://github.com/sd4324530/fastweixin/blob/6bc0a7abfa23aad0dbad4c3123a47a7fb53f3447/src/main/java/com/github/sd4324530/fastweixin/api/OauthAPI.java#L38-L56 |
moparisthebest/beehive | beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/databinding/datagrid/AnchorCell.java | AnchorCell.renderDataCellContents | protected void renderDataCellContents(AbstractRenderAppender appender, String jspFragmentOutput) {
"""
Render the contents of the HTML anchor. This method calls to an
{@link org.apache.beehive.netui.databinding.datagrid.api.rendering.CellDecorator} associated with this tag.
The result of renderingi is appended to the <code>appender</code>
@param appender the {@link AbstractRenderAppender} to which output should be rendered
@param jspFragmentOutput the result of having evaluated this tag's {@link javax.servlet.jsp.tagext.JspFragment}
"""
/* render any JavaScript needed to support framework features */
if (_anchorState.id != null) {
HttpServletRequest request = JspUtil.getRequest(getJspContext());
String script = renderNameAndId(request, _anchorState, null);
_anchorCellModel.setJavascript(script);
}
DECORATOR.decorate(getJspContext(), appender, _anchorCellModel);
} | java | protected void renderDataCellContents(AbstractRenderAppender appender, String jspFragmentOutput) {
/* render any JavaScript needed to support framework features */
if (_anchorState.id != null) {
HttpServletRequest request = JspUtil.getRequest(getJspContext());
String script = renderNameAndId(request, _anchorState, null);
_anchorCellModel.setJavascript(script);
}
DECORATOR.decorate(getJspContext(), appender, _anchorCellModel);
} | [
"protected",
"void",
"renderDataCellContents",
"(",
"AbstractRenderAppender",
"appender",
",",
"String",
"jspFragmentOutput",
")",
"{",
"/* render any JavaScript needed to support framework features */",
"if",
"(",
"_anchorState",
".",
"id",
"!=",
"null",
")",
"{",
"HttpServletRequest",
"request",
"=",
"JspUtil",
".",
"getRequest",
"(",
"getJspContext",
"(",
")",
")",
";",
"String",
"script",
"=",
"renderNameAndId",
"(",
"request",
",",
"_anchorState",
",",
"null",
")",
";",
"_anchorCellModel",
".",
"setJavascript",
"(",
"script",
")",
";",
"}",
"DECORATOR",
".",
"decorate",
"(",
"getJspContext",
"(",
")",
",",
"appender",
",",
"_anchorCellModel",
")",
";",
"}"
] | Render the contents of the HTML anchor. This method calls to an
{@link org.apache.beehive.netui.databinding.datagrid.api.rendering.CellDecorator} associated with this tag.
The result of renderingi is appended to the <code>appender</code>
@param appender the {@link AbstractRenderAppender} to which output should be rendered
@param jspFragmentOutput the result of having evaluated this tag's {@link javax.servlet.jsp.tagext.JspFragment} | [
"Render",
"the",
"contents",
"of",
"the",
"HTML",
"anchor",
".",
"This",
"method",
"calls",
"to",
"an",
"{"
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/databinding/datagrid/AnchorCell.java#L612-L622 |
unbescape/unbescape | src/main/java/org/unbescape/html/HtmlEscape.java | HtmlEscape.unescapeHtml | public static void unescapeHtml(final char[] text, final int offset, final int len, final Writer writer)
throws IOException {
"""
<p>
Perform an HTML <strong>unescape</strong> operation on a <tt>char[]</tt> input.
</p>
<p>
No additional configuration arguments are required. Unescape operations
will always perform <em>complete</em> unescape of NCRs (whole HTML5 set supported), decimal
and hexadecimal references.
</p>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param text the <tt>char[]</tt> to be unescaped.
@param offset the position in <tt>text</tt> at which the unescape operation should start.
@param len the number of characters in <tt>text</tt> that should be unescaped.
@param writer the <tt>java.io.Writer</tt> to which the unescaped result will be written. Nothing will
be written at all to this writer if input is <tt>null</tt>.
@throws IOException if an input/output exception occurs
"""
if (writer == null) {
throw new IllegalArgumentException("Argument 'writer' cannot be null");
}
final int textLen = (text == null? 0 : text.length);
if (offset < 0 || offset > textLen) {
throw new IllegalArgumentException(
"Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen);
}
if (len < 0 || (offset + len) > textLen) {
throw new IllegalArgumentException(
"Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen);
}
HtmlEscapeUtil.unescape(text, offset, len, writer);
} | java | public static void unescapeHtml(final char[] text, final int offset, final int len, final Writer writer)
throws IOException{
if (writer == null) {
throw new IllegalArgumentException("Argument 'writer' cannot be null");
}
final int textLen = (text == null? 0 : text.length);
if (offset < 0 || offset > textLen) {
throw new IllegalArgumentException(
"Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen);
}
if (len < 0 || (offset + len) > textLen) {
throw new IllegalArgumentException(
"Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen);
}
HtmlEscapeUtil.unescape(text, offset, len, writer);
} | [
"public",
"static",
"void",
"unescapeHtml",
"(",
"final",
"char",
"[",
"]",
"text",
",",
"final",
"int",
"offset",
",",
"final",
"int",
"len",
",",
"final",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"if",
"(",
"writer",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Argument 'writer' cannot be null\"",
")",
";",
"}",
"final",
"int",
"textLen",
"=",
"(",
"text",
"==",
"null",
"?",
"0",
":",
"text",
".",
"length",
")",
";",
"if",
"(",
"offset",
"<",
"0",
"||",
"offset",
">",
"textLen",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid (offset, len). offset=\"",
"+",
"offset",
"+",
"\", len=\"",
"+",
"len",
"+",
"\", text.length=\"",
"+",
"textLen",
")",
";",
"}",
"if",
"(",
"len",
"<",
"0",
"||",
"(",
"offset",
"+",
"len",
")",
">",
"textLen",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid (offset, len). offset=\"",
"+",
"offset",
"+",
"\", len=\"",
"+",
"len",
"+",
"\", text.length=\"",
"+",
"textLen",
")",
";",
"}",
"HtmlEscapeUtil",
".",
"unescape",
"(",
"text",
",",
"offset",
",",
"len",
",",
"writer",
")",
";",
"}"
] | <p>
Perform an HTML <strong>unescape</strong> operation on a <tt>char[]</tt> input.
</p>
<p>
No additional configuration arguments are required. Unescape operations
will always perform <em>complete</em> unescape of NCRs (whole HTML5 set supported), decimal
and hexadecimal references.
</p>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param text the <tt>char[]</tt> to be unescaped.
@param offset the position in <tt>text</tt> at which the unescape operation should start.
@param len the number of characters in <tt>text</tt> that should be unescaped.
@param writer the <tt>java.io.Writer</tt> to which the unescaped result will be written. Nothing will
be written at all to this writer if input is <tt>null</tt>.
@throws IOException if an input/output exception occurs | [
"<p",
">",
"Perform",
"an",
"HTML",
"<strong",
">",
"unescape<",
"/",
"strong",
">",
"operation",
"on",
"a",
"<tt",
">",
"char",
"[]",
"<",
"/",
"tt",
">",
"input",
".",
"<",
"/",
"p",
">",
"<p",
">",
"No",
"additional",
"configuration",
"arguments",
"are",
"required",
".",
"Unescape",
"operations",
"will",
"always",
"perform",
"<em",
">",
"complete<",
"/",
"em",
">",
"unescape",
"of",
"NCRs",
"(",
"whole",
"HTML5",
"set",
"supported",
")",
"decimal",
"and",
"hexadecimal",
"references",
".",
"<",
"/",
"p",
">",
"<p",
">",
"This",
"method",
"is",
"<strong",
">",
"thread",
"-",
"safe<",
"/",
"strong",
">",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/html/HtmlEscape.java#L1198-L1219 |
micronaut-projects/micronaut-core | inject/src/main/java/io/micronaut/inject/writer/AbstractClassFileWriter.java | AbstractClassFileWriter.writeClassToDisk | protected void writeClassToDisk(File targetDir, ClassWriter classWriter, String className) throws IOException {
"""
Writes the class file to disk in the given directory.
@param targetDir The target directory
@param classWriter The current class writer
@param className The class name
@throws IOException if there is a problem writing the class to disk
"""
if (targetDir != null) {
String fileName = className.replace('.', '/') + ".class";
File targetFile = new File(targetDir, fileName);
targetFile.getParentFile().mkdirs();
try (OutputStream outputStream = Files.newOutputStream(targetFile.toPath())) {
writeClassToDisk(outputStream, classWriter);
}
}
} | java | protected void writeClassToDisk(File targetDir, ClassWriter classWriter, String className) throws IOException {
if (targetDir != null) {
String fileName = className.replace('.', '/') + ".class";
File targetFile = new File(targetDir, fileName);
targetFile.getParentFile().mkdirs();
try (OutputStream outputStream = Files.newOutputStream(targetFile.toPath())) {
writeClassToDisk(outputStream, classWriter);
}
}
} | [
"protected",
"void",
"writeClassToDisk",
"(",
"File",
"targetDir",
",",
"ClassWriter",
"classWriter",
",",
"String",
"className",
")",
"throws",
"IOException",
"{",
"if",
"(",
"targetDir",
"!=",
"null",
")",
"{",
"String",
"fileName",
"=",
"className",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
"+",
"\".class\"",
";",
"File",
"targetFile",
"=",
"new",
"File",
"(",
"targetDir",
",",
"fileName",
")",
";",
"targetFile",
".",
"getParentFile",
"(",
")",
".",
"mkdirs",
"(",
")",
";",
"try",
"(",
"OutputStream",
"outputStream",
"=",
"Files",
".",
"newOutputStream",
"(",
"targetFile",
".",
"toPath",
"(",
")",
")",
")",
"{",
"writeClassToDisk",
"(",
"outputStream",
",",
"classWriter",
")",
";",
"}",
"}",
"}"
] | Writes the class file to disk in the given directory.
@param targetDir The target directory
@param classWriter The current class writer
@param className The class name
@throws IOException if there is a problem writing the class to disk | [
"Writes",
"the",
"class",
"file",
"to",
"disk",
"in",
"the",
"given",
"directory",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/inject/writer/AbstractClassFileWriter.java#L834-L845 |
litsec/eidas-opensaml | opensaml3/src/main/java/se/litsec/eidas/opensaml/ext/RequestedAttributeTemplates.java | RequestedAttributeTemplates.CURRENT_GIVEN_NAME | public static RequestedAttribute CURRENT_GIVEN_NAME(Boolean isRequired, boolean includeFriendlyName) {
"""
Creates a {@code RequestedAttribute} object for the CurrentGivenName attribute.
@param isRequired
flag to tell whether the attribute is required
@param includeFriendlyName
flag that tells whether the friendly name should be included
@return a {@code RequestedAttribute} object representing the CurrentGivenName attribute
"""
return create(AttributeConstants.EIDAS_CURRENT_GIVEN_NAME_ATTRIBUTE_NAME,
includeFriendlyName ? AttributeConstants.EIDAS_CURRENT_GIVEN_NAME_ATTRIBUTE_FRIENDLY_NAME : null,
Attribute.URI_REFERENCE, isRequired);
} | java | public static RequestedAttribute CURRENT_GIVEN_NAME(Boolean isRequired, boolean includeFriendlyName) {
return create(AttributeConstants.EIDAS_CURRENT_GIVEN_NAME_ATTRIBUTE_NAME,
includeFriendlyName ? AttributeConstants.EIDAS_CURRENT_GIVEN_NAME_ATTRIBUTE_FRIENDLY_NAME : null,
Attribute.URI_REFERENCE, isRequired);
} | [
"public",
"static",
"RequestedAttribute",
"CURRENT_GIVEN_NAME",
"(",
"Boolean",
"isRequired",
",",
"boolean",
"includeFriendlyName",
")",
"{",
"return",
"create",
"(",
"AttributeConstants",
".",
"EIDAS_CURRENT_GIVEN_NAME_ATTRIBUTE_NAME",
",",
"includeFriendlyName",
"?",
"AttributeConstants",
".",
"EIDAS_CURRENT_GIVEN_NAME_ATTRIBUTE_FRIENDLY_NAME",
":",
"null",
",",
"Attribute",
".",
"URI_REFERENCE",
",",
"isRequired",
")",
";",
"}"
] | Creates a {@code RequestedAttribute} object for the CurrentGivenName attribute.
@param isRequired
flag to tell whether the attribute is required
@param includeFriendlyName
flag that tells whether the friendly name should be included
@return a {@code RequestedAttribute} object representing the CurrentGivenName attribute | [
"Creates",
"a",
"{",
"@code",
"RequestedAttribute",
"}",
"object",
"for",
"the",
"CurrentGivenName",
"attribute",
"."
] | train | https://github.com/litsec/eidas-opensaml/blob/522ba6dba433a9524cb8a02464cc3b087b47a2b7/opensaml3/src/main/java/se/litsec/eidas/opensaml/ext/RequestedAttributeTemplates.java#L71-L75 |
crowmagnumb/s6-util | src/main/java/net/crowmagnumb/util/net/AbstractMultipartUtility.java | AbstractMultipartUtility.addFilePart | public void addFilePart(final String fieldName, final URL urlToUploadFile)
throws IOException {
"""
Adds a upload file section to the request by url stream
@param fieldName name attribute in <input type="file" name="..." />
@param urlToUploadFile url to add as a stream
@throws IOException if problems
"""
//
// Maybe try and extract a filename from the last part of the url?
// Or have the user pass it in?
// Or just leave it blank as I have already done?
//
addFilePart(fieldName,
urlToUploadFile.openStream(),
null,
URLConnection.guessContentTypeFromName(urlToUploadFile.toString()));
} | java | public void addFilePart(final String fieldName, final URL urlToUploadFile)
throws IOException
{
//
// Maybe try and extract a filename from the last part of the url?
// Or have the user pass it in?
// Or just leave it blank as I have already done?
//
addFilePart(fieldName,
urlToUploadFile.openStream(),
null,
URLConnection.guessContentTypeFromName(urlToUploadFile.toString()));
} | [
"public",
"void",
"addFilePart",
"(",
"final",
"String",
"fieldName",
",",
"final",
"URL",
"urlToUploadFile",
")",
"throws",
"IOException",
"{",
"//",
"// Maybe try and extract a filename from the last part of the url?",
"// Or have the user pass it in?",
"// Or just leave it blank as I have already done?",
"//",
"addFilePart",
"(",
"fieldName",
",",
"urlToUploadFile",
".",
"openStream",
"(",
")",
",",
"null",
",",
"URLConnection",
".",
"guessContentTypeFromName",
"(",
"urlToUploadFile",
".",
"toString",
"(",
")",
")",
")",
";",
"}"
] | Adds a upload file section to the request by url stream
@param fieldName name attribute in <input type="file" name="..." />
@param urlToUploadFile url to add as a stream
@throws IOException if problems | [
"Adds",
"a",
"upload",
"file",
"section",
"to",
"the",
"request",
"by",
"url",
"stream"
] | train | https://github.com/crowmagnumb/s6-util/blob/0f9969bc0809e8a617501fa57c135e9b3984fae0/src/main/java/net/crowmagnumb/util/net/AbstractMultipartUtility.java#L83-L95 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/CipherSpi.java | CipherSpi.engineUpdate | protected int engineUpdate(ByteBuffer input, ByteBuffer output)
throws ShortBufferException {
"""
Continues a multiple-part encryption or decryption operation
(depending on how this cipher was initialized), processing another data
part.
<p>All <code>input.remaining()</code> bytes starting at
<code>input.position()</code> are processed. The result is stored
in the output buffer.
Upon return, the input buffer's position will be equal
to its limit; its limit will not have changed. The output buffer's
position will have advanced by n, where n is the value returned
by this method; the output buffer's limit will not have changed.
<p>If <code>output.remaining()</code> bytes are insufficient to
hold the result, a <code>ShortBufferException</code> is thrown.
<p>Subclasses should consider overriding this method if they can
process ByteBuffers more efficiently than byte arrays.
@param input the input ByteBuffer
@param output the output ByteByffer
@return the number of bytes stored in <code>output</code>
@exception ShortBufferException if there is insufficient space in the
output buffer
@throws NullPointerException if either parameter is <CODE>null</CODE>
@since 1.5
"""
try {
return bufferCrypt(input, output, true);
} catch (IllegalBlockSizeException e) {
// never thrown for engineUpdate()
throw new ProviderException("Internal error in update()");
} catch (BadPaddingException e) {
// never thrown for engineUpdate()
throw new ProviderException("Internal error in update()");
}
} | java | protected int engineUpdate(ByteBuffer input, ByteBuffer output)
throws ShortBufferException {
try {
return bufferCrypt(input, output, true);
} catch (IllegalBlockSizeException e) {
// never thrown for engineUpdate()
throw new ProviderException("Internal error in update()");
} catch (BadPaddingException e) {
// never thrown for engineUpdate()
throw new ProviderException("Internal error in update()");
}
} | [
"protected",
"int",
"engineUpdate",
"(",
"ByteBuffer",
"input",
",",
"ByteBuffer",
"output",
")",
"throws",
"ShortBufferException",
"{",
"try",
"{",
"return",
"bufferCrypt",
"(",
"input",
",",
"output",
",",
"true",
")",
";",
"}",
"catch",
"(",
"IllegalBlockSizeException",
"e",
")",
"{",
"// never thrown for engineUpdate()",
"throw",
"new",
"ProviderException",
"(",
"\"Internal error in update()\"",
")",
";",
"}",
"catch",
"(",
"BadPaddingException",
"e",
")",
"{",
"// never thrown for engineUpdate()",
"throw",
"new",
"ProviderException",
"(",
"\"Internal error in update()\"",
")",
";",
"}",
"}"
] | Continues a multiple-part encryption or decryption operation
(depending on how this cipher was initialized), processing another data
part.
<p>All <code>input.remaining()</code> bytes starting at
<code>input.position()</code> are processed. The result is stored
in the output buffer.
Upon return, the input buffer's position will be equal
to its limit; its limit will not have changed. The output buffer's
position will have advanced by n, where n is the value returned
by this method; the output buffer's limit will not have changed.
<p>If <code>output.remaining()</code> bytes are insufficient to
hold the result, a <code>ShortBufferException</code> is thrown.
<p>Subclasses should consider overriding this method if they can
process ByteBuffers more efficiently than byte arrays.
@param input the input ByteBuffer
@param output the output ByteByffer
@return the number of bytes stored in <code>output</code>
@exception ShortBufferException if there is insufficient space in the
output buffer
@throws NullPointerException if either parameter is <CODE>null</CODE>
@since 1.5 | [
"Continues",
"a",
"multiple",
"-",
"part",
"encryption",
"or",
"decryption",
"operation",
"(",
"depending",
"on",
"how",
"this",
"cipher",
"was",
"initialized",
")",
"processing",
"another",
"data",
"part",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/CipherSpi.java#L552-L563 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Value.java | Value.stringArray | public static Value stringArray(@Nullable Iterable<String> v) {
"""
Returns an {@code ARRAY<STRING>} value.
@param v the source of element values. This may be {@code null} to produce a value for which
{@code isNull()} is {@code true}. Individual elements may also be {@code null}.
"""
return new StringArrayImpl(v == null, v == null ? null : immutableCopyOf(v));
} | java | public static Value stringArray(@Nullable Iterable<String> v) {
return new StringArrayImpl(v == null, v == null ? null : immutableCopyOf(v));
} | [
"public",
"static",
"Value",
"stringArray",
"(",
"@",
"Nullable",
"Iterable",
"<",
"String",
">",
"v",
")",
"{",
"return",
"new",
"StringArrayImpl",
"(",
"v",
"==",
"null",
",",
"v",
"==",
"null",
"?",
"null",
":",
"immutableCopyOf",
"(",
"v",
")",
")",
";",
"}"
] | Returns an {@code ARRAY<STRING>} value.
@param v the source of element values. This may be {@code null} to produce a value for which
{@code isNull()} is {@code true}. Individual elements may also be {@code null}. | [
"Returns",
"an",
"{",
"@code",
"ARRAY<STRING",
">",
"}",
"value",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Value.java#L292-L294 |
VoltDB/voltdb | src/frontend/org/voltdb/compiler/VoltCompilerUtils.java | VoltCompilerUtils.readFileFromJarfile | static String readFileFromJarfile(String fulljarpath) throws IOException {
"""
Read a file from a jar in the form path/to/jar.jar!/path/to/file.ext
"""
assert (fulljarpath.contains(".jar!"));
String[] paths = fulljarpath.split("!");
if (paths[0].startsWith("file:"))
paths[0] = paths[0].substring("file:".length());
paths[1] = paths[1].substring(1);
return readFileFromJarfile(paths[0], paths[1]);
} | java | static String readFileFromJarfile(String fulljarpath) throws IOException {
assert (fulljarpath.contains(".jar!"));
String[] paths = fulljarpath.split("!");
if (paths[0].startsWith("file:"))
paths[0] = paths[0].substring("file:".length());
paths[1] = paths[1].substring(1);
return readFileFromJarfile(paths[0], paths[1]);
} | [
"static",
"String",
"readFileFromJarfile",
"(",
"String",
"fulljarpath",
")",
"throws",
"IOException",
"{",
"assert",
"(",
"fulljarpath",
".",
"contains",
"(",
"\".jar!\"",
")",
")",
";",
"String",
"[",
"]",
"paths",
"=",
"fulljarpath",
".",
"split",
"(",
"\"!\"",
")",
";",
"if",
"(",
"paths",
"[",
"0",
"]",
".",
"startsWith",
"(",
"\"file:\"",
")",
")",
"paths",
"[",
"0",
"]",
"=",
"paths",
"[",
"0",
"]",
".",
"substring",
"(",
"\"file:\"",
".",
"length",
"(",
")",
")",
";",
"paths",
"[",
"1",
"]",
"=",
"paths",
"[",
"1",
"]",
".",
"substring",
"(",
"1",
")",
";",
"return",
"readFileFromJarfile",
"(",
"paths",
"[",
"0",
"]",
",",
"paths",
"[",
"1",
"]",
")",
";",
"}"
] | Read a file from a jar in the form path/to/jar.jar!/path/to/file.ext | [
"Read",
"a",
"file",
"from",
"a",
"jar",
"in",
"the",
"form",
"path",
"/",
"to",
"/",
"jar",
".",
"jar!",
"/",
"path",
"/",
"to",
"/",
"file",
".",
"ext"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/compiler/VoltCompilerUtils.java#L38-L47 |
Azure/azure-sdk-for-java | policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java | PolicyStatesInner.summarizeForResourceGroupAsync | public Observable<SummarizeResultsInner> summarizeForResourceGroupAsync(String subscriptionId, String resourceGroupName) {
"""
Summarizes policy states for the resources under the resource group.
@param subscriptionId Microsoft Azure subscription ID.
@param resourceGroupName Resource group name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the SummarizeResultsInner object
"""
return summarizeForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName).map(new Func1<ServiceResponse<SummarizeResultsInner>, SummarizeResultsInner>() {
@Override
public SummarizeResultsInner call(ServiceResponse<SummarizeResultsInner> response) {
return response.body();
}
});
} | java | public Observable<SummarizeResultsInner> summarizeForResourceGroupAsync(String subscriptionId, String resourceGroupName) {
return summarizeForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName).map(new Func1<ServiceResponse<SummarizeResultsInner>, SummarizeResultsInner>() {
@Override
public SummarizeResultsInner call(ServiceResponse<SummarizeResultsInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"SummarizeResultsInner",
">",
"summarizeForResourceGroupAsync",
"(",
"String",
"subscriptionId",
",",
"String",
"resourceGroupName",
")",
"{",
"return",
"summarizeForResourceGroupWithServiceResponseAsync",
"(",
"subscriptionId",
",",
"resourceGroupName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"SummarizeResultsInner",
">",
",",
"SummarizeResultsInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"SummarizeResultsInner",
"call",
"(",
"ServiceResponse",
"<",
"SummarizeResultsInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Summarizes policy states for the resources under the resource group.
@param subscriptionId Microsoft Azure subscription ID.
@param resourceGroupName Resource group name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the SummarizeResultsInner object | [
"Summarizes",
"policy",
"states",
"for",
"the",
"resources",
"under",
"the",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java#L1128-L1135 |
elki-project/elki | elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/arrays/DoubleIntegerArrayQuickSort.java | DoubleIntegerArrayQuickSort.insertionSortReverse | private static void insertionSortReverse(double[] keys, int[] vals, final int start, final int end) {
"""
Sort via insertion sort.
@param keys Keys
@param vals Values
@param start Interval start
@param end Interval end
"""
// Classic insertion sort.
for(int i = start + 1; i < end; i++) {
for(int j = i; j > start; j--) {
if(keys[j] <= keys[j - 1]) {
break;
}
swap(keys, vals, j, j - 1);
}
}
} | java | private static void insertionSortReverse(double[] keys, int[] vals, final int start, final int end) {
// Classic insertion sort.
for(int i = start + 1; i < end; i++) {
for(int j = i; j > start; j--) {
if(keys[j] <= keys[j - 1]) {
break;
}
swap(keys, vals, j, j - 1);
}
}
} | [
"private",
"static",
"void",
"insertionSortReverse",
"(",
"double",
"[",
"]",
"keys",
",",
"int",
"[",
"]",
"vals",
",",
"final",
"int",
"start",
",",
"final",
"int",
"end",
")",
"{",
"// Classic insertion sort.",
"for",
"(",
"int",
"i",
"=",
"start",
"+",
"1",
";",
"i",
"<",
"end",
";",
"i",
"++",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"i",
";",
"j",
">",
"start",
";",
"j",
"--",
")",
"{",
"if",
"(",
"keys",
"[",
"j",
"]",
"<=",
"keys",
"[",
"j",
"-",
"1",
"]",
")",
"{",
"break",
";",
"}",
"swap",
"(",
"keys",
",",
"vals",
",",
"j",
",",
"j",
"-",
"1",
")",
";",
"}",
"}",
"}"
] | Sort via insertion sort.
@param keys Keys
@param vals Values
@param start Interval start
@param end Interval end | [
"Sort",
"via",
"insertion",
"sort",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/arrays/DoubleIntegerArrayQuickSort.java#L359-L369 |
alkacon/opencms-core | src/org/opencms/search/documents/CmsDocumentPdf.java | CmsDocumentPdf.extractContent | public I_CmsExtractionResult extractContent(CmsObject cms, CmsResource resource, I_CmsSearchIndex index)
throws CmsIndexException, CmsException {
"""
Returns the raw text content of a given vfs resource containing Adobe PDF data.<p>
@see org.opencms.search.documents.I_CmsSearchExtractor#extractContent(CmsObject, CmsResource, I_CmsSearchIndex)
"""
logContentExtraction(resource, index);
CmsFile file = readFile(cms, resource);
try {
return CmsExtractorPdf.getExtractor().extractText(file.getContents());
} catch (Exception e) {
if (e.getClass().getSimpleName().equals("EncryptedDocumentException")) {
throw new CmsIndexException(
Messages.get().container(Messages.ERR_DECRYPTING_RESOURCE_1, resource.getRootPath()),
e);
}
if (e instanceof InvalidPasswordException) {
// default password "" was wrong.
throw new CmsIndexException(
Messages.get().container(Messages.ERR_PWD_PROTECTED_1, resource.getRootPath()),
e);
}
throw new CmsIndexException(
Messages.get().container(Messages.ERR_TEXT_EXTRACTION_1, resource.getRootPath()),
e);
}
} | java | public I_CmsExtractionResult extractContent(CmsObject cms, CmsResource resource, I_CmsSearchIndex index)
throws CmsIndexException, CmsException {
logContentExtraction(resource, index);
CmsFile file = readFile(cms, resource);
try {
return CmsExtractorPdf.getExtractor().extractText(file.getContents());
} catch (Exception e) {
if (e.getClass().getSimpleName().equals("EncryptedDocumentException")) {
throw new CmsIndexException(
Messages.get().container(Messages.ERR_DECRYPTING_RESOURCE_1, resource.getRootPath()),
e);
}
if (e instanceof InvalidPasswordException) {
// default password "" was wrong.
throw new CmsIndexException(
Messages.get().container(Messages.ERR_PWD_PROTECTED_1, resource.getRootPath()),
e);
}
throw new CmsIndexException(
Messages.get().container(Messages.ERR_TEXT_EXTRACTION_1, resource.getRootPath()),
e);
}
} | [
"public",
"I_CmsExtractionResult",
"extractContent",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"resource",
",",
"I_CmsSearchIndex",
"index",
")",
"throws",
"CmsIndexException",
",",
"CmsException",
"{",
"logContentExtraction",
"(",
"resource",
",",
"index",
")",
";",
"CmsFile",
"file",
"=",
"readFile",
"(",
"cms",
",",
"resource",
")",
";",
"try",
"{",
"return",
"CmsExtractorPdf",
".",
"getExtractor",
"(",
")",
".",
"extractText",
"(",
"file",
".",
"getContents",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"if",
"(",
"e",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
".",
"equals",
"(",
"\"EncryptedDocumentException\"",
")",
")",
"{",
"throw",
"new",
"CmsIndexException",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"container",
"(",
"Messages",
".",
"ERR_DECRYPTING_RESOURCE_1",
",",
"resource",
".",
"getRootPath",
"(",
")",
")",
",",
"e",
")",
";",
"}",
"if",
"(",
"e",
"instanceof",
"InvalidPasswordException",
")",
"{",
"// default password \"\" was wrong.",
"throw",
"new",
"CmsIndexException",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"container",
"(",
"Messages",
".",
"ERR_PWD_PROTECTED_1",
",",
"resource",
".",
"getRootPath",
"(",
")",
")",
",",
"e",
")",
";",
"}",
"throw",
"new",
"CmsIndexException",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"container",
"(",
"Messages",
".",
"ERR_TEXT_EXTRACTION_1",
",",
"resource",
".",
"getRootPath",
"(",
")",
")",
",",
"e",
")",
";",
"}",
"}"
] | Returns the raw text content of a given vfs resource containing Adobe PDF data.<p>
@see org.opencms.search.documents.I_CmsSearchExtractor#extractContent(CmsObject, CmsResource, I_CmsSearchIndex) | [
"Returns",
"the",
"raw",
"text",
"content",
"of",
"a",
"given",
"vfs",
"resource",
"containing",
"Adobe",
"PDF",
"data",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/documents/CmsDocumentPdf.java#L64-L87 |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/contextspace/SpaceRepository.java | SpaceRepository.removeLocalSpaceDefinition | protected void removeLocalSpaceDefinition(SpaceID id, boolean isLocalDestruction) {
"""
Remove a remote space.
@param id identifier of the space
@param isLocalDestruction indicates if the destruction is initiated by the local kernel.
"""
final Space space;
synchronized (getSpaceRepositoryMutex()) {
space = this.spaces.remove(id);
if (space != null) {
this.spacesBySpec.remove(id.getSpaceSpecification(), id);
}
}
if (space != null) {
fireSpaceRemoved(space, isLocalDestruction);
}
} | java | protected void removeLocalSpaceDefinition(SpaceID id, boolean isLocalDestruction) {
final Space space;
synchronized (getSpaceRepositoryMutex()) {
space = this.spaces.remove(id);
if (space != null) {
this.spacesBySpec.remove(id.getSpaceSpecification(), id);
}
}
if (space != null) {
fireSpaceRemoved(space, isLocalDestruction);
}
} | [
"protected",
"void",
"removeLocalSpaceDefinition",
"(",
"SpaceID",
"id",
",",
"boolean",
"isLocalDestruction",
")",
"{",
"final",
"Space",
"space",
";",
"synchronized",
"(",
"getSpaceRepositoryMutex",
"(",
")",
")",
"{",
"space",
"=",
"this",
".",
"spaces",
".",
"remove",
"(",
"id",
")",
";",
"if",
"(",
"space",
"!=",
"null",
")",
"{",
"this",
".",
"spacesBySpec",
".",
"remove",
"(",
"id",
".",
"getSpaceSpecification",
"(",
")",
",",
"id",
")",
";",
"}",
"}",
"if",
"(",
"space",
"!=",
"null",
")",
"{",
"fireSpaceRemoved",
"(",
"space",
",",
"isLocalDestruction",
")",
";",
"}",
"}"
] | Remove a remote space.
@param id identifier of the space
@param isLocalDestruction indicates if the destruction is initiated by the local kernel. | [
"Remove",
"a",
"remote",
"space",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/contextspace/SpaceRepository.java#L224-L235 |
massfords/jaxb-visitor | src/main/java/com/massfords/jaxb/CreateTraversingVisitorClass.java | CreateTraversingVisitorClass.addGetterAndSetter | private void addGetterAndSetter(JDefinedClass traversingVisitor, JFieldVar field) {
"""
Convenience method to add a getter and setter method for the given field.
@param traversingVisitor
@param field
"""
String propName = Character.toUpperCase(field.name().charAt(0)) + field.name().substring(1);
traversingVisitor.method(JMod.PUBLIC, field.type(), "get" + propName).body()._return(field);
JMethod setVisitor = traversingVisitor.method(JMod.PUBLIC, void.class, "set" + propName);
JVar visParam = setVisitor.param(field.type(), "aVisitor");
setVisitor.body().assign(field, visParam);
} | java | private void addGetterAndSetter(JDefinedClass traversingVisitor, JFieldVar field) {
String propName = Character.toUpperCase(field.name().charAt(0)) + field.name().substring(1);
traversingVisitor.method(JMod.PUBLIC, field.type(), "get" + propName).body()._return(field);
JMethod setVisitor = traversingVisitor.method(JMod.PUBLIC, void.class, "set" + propName);
JVar visParam = setVisitor.param(field.type(), "aVisitor");
setVisitor.body().assign(field, visParam);
} | [
"private",
"void",
"addGetterAndSetter",
"(",
"JDefinedClass",
"traversingVisitor",
",",
"JFieldVar",
"field",
")",
"{",
"String",
"propName",
"=",
"Character",
".",
"toUpperCase",
"(",
"field",
".",
"name",
"(",
")",
".",
"charAt",
"(",
"0",
")",
")",
"+",
"field",
".",
"name",
"(",
")",
".",
"substring",
"(",
"1",
")",
";",
"traversingVisitor",
".",
"method",
"(",
"JMod",
".",
"PUBLIC",
",",
"field",
".",
"type",
"(",
")",
",",
"\"get\"",
"+",
"propName",
")",
".",
"body",
"(",
")",
".",
"_return",
"(",
"field",
")",
";",
"JMethod",
"setVisitor",
"=",
"traversingVisitor",
".",
"method",
"(",
"JMod",
".",
"PUBLIC",
",",
"void",
".",
"class",
",",
"\"set\"",
"+",
"propName",
")",
";",
"JVar",
"visParam",
"=",
"setVisitor",
".",
"param",
"(",
"field",
".",
"type",
"(",
")",
",",
"\"aVisitor\"",
")",
";",
"setVisitor",
".",
"body",
"(",
")",
".",
"assign",
"(",
"field",
",",
"visParam",
")",
";",
"}"
] | Convenience method to add a getter and setter method for the given field.
@param traversingVisitor
@param field | [
"Convenience",
"method",
"to",
"add",
"a",
"getter",
"and",
"setter",
"method",
"for",
"the",
"given",
"field",
"."
] | train | https://github.com/massfords/jaxb-visitor/blob/0d66cd4d8b6700b5eb67c028a87b53792be895b8/src/main/java/com/massfords/jaxb/CreateTraversingVisitorClass.java#L151-L157 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_easyPabx_serviceName_hunting_agent_agentNumber_DELETE | public void billingAccount_easyPabx_serviceName_hunting_agent_agentNumber_DELETE(String billingAccount, String serviceName, String agentNumber) throws IOException {
"""
Delete the agent
REST: DELETE /telephony/{billingAccount}/easyPabx/{serviceName}/hunting/agent/{agentNumber}
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param agentNumber [required] The phone number of the agent
"""
String qPath = "/telephony/{billingAccount}/easyPabx/{serviceName}/hunting/agent/{agentNumber}";
StringBuilder sb = path(qPath, billingAccount, serviceName, agentNumber);
exec(qPath, "DELETE", sb.toString(), null);
} | java | public void billingAccount_easyPabx_serviceName_hunting_agent_agentNumber_DELETE(String billingAccount, String serviceName, String agentNumber) throws IOException {
String qPath = "/telephony/{billingAccount}/easyPabx/{serviceName}/hunting/agent/{agentNumber}";
StringBuilder sb = path(qPath, billingAccount, serviceName, agentNumber);
exec(qPath, "DELETE", sb.toString(), null);
} | [
"public",
"void",
"billingAccount_easyPabx_serviceName_hunting_agent_agentNumber_DELETE",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"String",
"agentNumber",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/telephony/{billingAccount}/easyPabx/{serviceName}/hunting/agent/{agentNumber}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"billingAccount",
",",
"serviceName",
",",
"agentNumber",
")",
";",
"exec",
"(",
"qPath",
",",
"\"DELETE\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"}"
] | Delete the agent
REST: DELETE /telephony/{billingAccount}/easyPabx/{serviceName}/hunting/agent/{agentNumber}
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param agentNumber [required] The phone number of the agent | [
"Delete",
"the",
"agent"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L3572-L3576 |
elki-project/elki | elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/kmeans/quality/AbstractKMeansQualityMeasure.java | AbstractKMeansQualityMeasure.numberOfFreeParameters | public static int numberOfFreeParameters(Relation<? extends NumberVector> relation, Clustering<? extends MeanModel> clustering) {
"""
Compute the number of free parameters.
@param relation Data relation (for dimensionality)
@param clustering Set of clusters
@return Number of free parameters
"""
// number of clusters
int m = clustering.getAllClusters().size(); // num_ctrs
// dimensionality of data points
int dim = RelationUtil.dimensionality(relation); // num_dims
// number of free parameters
return (m - 1) + m * dim + m;
} | java | public static int numberOfFreeParameters(Relation<? extends NumberVector> relation, Clustering<? extends MeanModel> clustering) {
// number of clusters
int m = clustering.getAllClusters().size(); // num_ctrs
// dimensionality of data points
int dim = RelationUtil.dimensionality(relation); // num_dims
// number of free parameters
return (m - 1) + m * dim + m;
} | [
"public",
"static",
"int",
"numberOfFreeParameters",
"(",
"Relation",
"<",
"?",
"extends",
"NumberVector",
">",
"relation",
",",
"Clustering",
"<",
"?",
"extends",
"MeanModel",
">",
"clustering",
")",
"{",
"// number of clusters",
"int",
"m",
"=",
"clustering",
".",
"getAllClusters",
"(",
")",
".",
"size",
"(",
")",
";",
"// num_ctrs",
"// dimensionality of data points",
"int",
"dim",
"=",
"RelationUtil",
".",
"dimensionality",
"(",
"relation",
")",
";",
"// num_dims",
"// number of free parameters",
"return",
"(",
"m",
"-",
"1",
")",
"+",
"m",
"*",
"dim",
"+",
"m",
";",
"}"
] | Compute the number of free parameters.
@param relation Data relation (for dimensionality)
@param clustering Set of clusters
@return Number of free parameters | [
"Compute",
"the",
"number",
"of",
"free",
"parameters",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/kmeans/quality/AbstractKMeansQualityMeasure.java#L181-L190 |
hexagonframework/spring-data-ebean | src/main/java/org/springframework/data/ebean/util/ExampleExpressionBuilder.java | ExampleExpressionBuilder.exampleExpression | public static <T> ExampleExpression exampleExpression(EbeanServer ebeanServer, Example<T> example) {
"""
Return a ExampleExpression from Spring data Example
@param ebeanServer
@param example
@param <T>
@return
"""
LikeType likeType;
switch (example.getMatcher().getDefaultStringMatcher()) {
case EXACT:
likeType = LikeType.EQUAL_TO;
break;
case CONTAINING:
likeType = LikeType.CONTAINS;
break;
case STARTING:
likeType = LikeType.STARTS_WITH;
break;
case ENDING:
likeType = LikeType.ENDS_WITH;
break;
default:
likeType = LikeType.RAW;
break;
}
return ebeanServer.getExpressionFactory().exampleLike(example.getProbe(),
example.getMatcher().isIgnoreCaseEnabled(),
likeType);
} | java | public static <T> ExampleExpression exampleExpression(EbeanServer ebeanServer, Example<T> example) {
LikeType likeType;
switch (example.getMatcher().getDefaultStringMatcher()) {
case EXACT:
likeType = LikeType.EQUAL_TO;
break;
case CONTAINING:
likeType = LikeType.CONTAINS;
break;
case STARTING:
likeType = LikeType.STARTS_WITH;
break;
case ENDING:
likeType = LikeType.ENDS_WITH;
break;
default:
likeType = LikeType.RAW;
break;
}
return ebeanServer.getExpressionFactory().exampleLike(example.getProbe(),
example.getMatcher().isIgnoreCaseEnabled(),
likeType);
} | [
"public",
"static",
"<",
"T",
">",
"ExampleExpression",
"exampleExpression",
"(",
"EbeanServer",
"ebeanServer",
",",
"Example",
"<",
"T",
">",
"example",
")",
"{",
"LikeType",
"likeType",
";",
"switch",
"(",
"example",
".",
"getMatcher",
"(",
")",
".",
"getDefaultStringMatcher",
"(",
")",
")",
"{",
"case",
"EXACT",
":",
"likeType",
"=",
"LikeType",
".",
"EQUAL_TO",
";",
"break",
";",
"case",
"CONTAINING",
":",
"likeType",
"=",
"LikeType",
".",
"CONTAINS",
";",
"break",
";",
"case",
"STARTING",
":",
"likeType",
"=",
"LikeType",
".",
"STARTS_WITH",
";",
"break",
";",
"case",
"ENDING",
":",
"likeType",
"=",
"LikeType",
".",
"ENDS_WITH",
";",
"break",
";",
"default",
":",
"likeType",
"=",
"LikeType",
".",
"RAW",
";",
"break",
";",
"}",
"return",
"ebeanServer",
".",
"getExpressionFactory",
"(",
")",
".",
"exampleLike",
"(",
"example",
".",
"getProbe",
"(",
")",
",",
"example",
".",
"getMatcher",
"(",
")",
".",
"isIgnoreCaseEnabled",
"(",
")",
",",
"likeType",
")",
";",
"}"
] | Return a ExampleExpression from Spring data Example
@param ebeanServer
@param example
@param <T>
@return | [
"Return",
"a",
"ExampleExpression",
"from",
"Spring",
"data",
"Example"
] | train | https://github.com/hexagonframework/spring-data-ebean/blob/dd11b97654982403b50dd1d5369cadad71fce410/src/main/java/org/springframework/data/ebean/util/ExampleExpressionBuilder.java#L39-L61 |
paypal/SeLion | server/src/main/java/com/paypal/selion/grid/servlets/transfer/DownloadResponder.java | DownloadResponder.respond | public void respond() {
"""
Sends a response over the HTTP servlet for the current {@link TransferContext}.
"""
LOGGER.entering();
managedArtifact = downloadRequestProcessor.getArtifact(this.pathInfo);
contents = managedArtifact.getArtifactContents();
setResponseMetadata();
try {
IOUtils.copy(new ByteArrayInputStream(contents), httpServletResponse.getOutputStream());
} catch (IOException e) {
throw new ArtifactDownloadException("IOException in writing to servlet response", e);
}
LOGGER.exiting();
} | java | public void respond() {
LOGGER.entering();
managedArtifact = downloadRequestProcessor.getArtifact(this.pathInfo);
contents = managedArtifact.getArtifactContents();
setResponseMetadata();
try {
IOUtils.copy(new ByteArrayInputStream(contents), httpServletResponse.getOutputStream());
} catch (IOException e) {
throw new ArtifactDownloadException("IOException in writing to servlet response", e);
}
LOGGER.exiting();
} | [
"public",
"void",
"respond",
"(",
")",
"{",
"LOGGER",
".",
"entering",
"(",
")",
";",
"managedArtifact",
"=",
"downloadRequestProcessor",
".",
"getArtifact",
"(",
"this",
".",
"pathInfo",
")",
";",
"contents",
"=",
"managedArtifact",
".",
"getArtifactContents",
"(",
")",
";",
"setResponseMetadata",
"(",
")",
";",
"try",
"{",
"IOUtils",
".",
"copy",
"(",
"new",
"ByteArrayInputStream",
"(",
"contents",
")",
",",
"httpServletResponse",
".",
"getOutputStream",
"(",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"ArtifactDownloadException",
"(",
"\"IOException in writing to servlet response\"",
",",
"e",
")",
";",
"}",
"LOGGER",
".",
"exiting",
"(",
")",
";",
"}"
] | Sends a response over the HTTP servlet for the current {@link TransferContext}. | [
"Sends",
"a",
"response",
"over",
"the",
"HTTP",
"servlet",
"for",
"the",
"current",
"{"
] | train | https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/server/src/main/java/com/paypal/selion/grid/servlets/transfer/DownloadResponder.java#L64-L75 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java | InternalUtils.lookupMethod | public static Method lookupMethod( Class parentClass, String methodName, Class[] signature ) {
"""
Get a Method in a Class.
@param parentClass the Class in which to find the Method.
@param methodName the name of the Method.
@param signature the argument types for the Method.
@return the Method with the given name and signature, or <code>null</code> if the method does not exist.
"""
try
{
return parentClass.getDeclaredMethod( methodName, signature );
}
catch ( NoSuchMethodException e )
{
Class superClass = parentClass.getSuperclass();
return superClass != null ? lookupMethod( superClass, methodName, signature ) : null;
}
} | java | public static Method lookupMethod( Class parentClass, String methodName, Class[] signature )
{
try
{
return parentClass.getDeclaredMethod( methodName, signature );
}
catch ( NoSuchMethodException e )
{
Class superClass = parentClass.getSuperclass();
return superClass != null ? lookupMethod( superClass, methodName, signature ) : null;
}
} | [
"public",
"static",
"Method",
"lookupMethod",
"(",
"Class",
"parentClass",
",",
"String",
"methodName",
",",
"Class",
"[",
"]",
"signature",
")",
"{",
"try",
"{",
"return",
"parentClass",
".",
"getDeclaredMethod",
"(",
"methodName",
",",
"signature",
")",
";",
"}",
"catch",
"(",
"NoSuchMethodException",
"e",
")",
"{",
"Class",
"superClass",
"=",
"parentClass",
".",
"getSuperclass",
"(",
")",
";",
"return",
"superClass",
"!=",
"null",
"?",
"lookupMethod",
"(",
"superClass",
",",
"methodName",
",",
"signature",
")",
":",
"null",
";",
"}",
"}"
] | Get a Method in a Class.
@param parentClass the Class in which to find the Method.
@param methodName the name of the Method.
@param signature the argument types for the Method.
@return the Method with the given name and signature, or <code>null</code> if the method does not exist. | [
"Get",
"a",
"Method",
"in",
"a",
"Class",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java#L265-L276 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.