repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 192 | func_name stringlengths 5 108 | whole_func_string stringlengths 75 3.91k | language stringclasses 1
value | func_code_string stringlengths 75 3.91k | func_code_tokens listlengths 21 629 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 111 306 |
|---|---|---|---|---|---|---|---|---|---|---|
stripe/stripe-android | stripe/src/main/java/com/stripe/android/CardUtils.java | CardUtils.getPossibleCardType | @NonNull
@Card.CardBrand
public static String getPossibleCardType(@Nullable String cardNumber) {
return getPossibleCardType(cardNumber, true);
} | java | @NonNull
@Card.CardBrand
public static String getPossibleCardType(@Nullable String cardNumber) {
return getPossibleCardType(cardNumber, true);
} | [
"@",
"NonNull",
"@",
"Card",
".",
"CardBrand",
"public",
"static",
"String",
"getPossibleCardType",
"(",
"@",
"Nullable",
"String",
"cardNumber",
")",
"{",
"return",
"getPossibleCardType",
"(",
"cardNumber",
",",
"true",
")",
";",
"}"
] | Returns a {@link Card.CardBrand} corresponding to a partial card number,
or {@link Card#UNKNOWN} if the card brand can't be determined from the input value.
@param cardNumber a credit card number or partial card number
@return the {@link Card.CardBrand} corresponding to that number,
or {@link Card#UNKNOWN} if it can't be determined | [
"Returns",
"a",
"{",
"@link",
"Card",
".",
"CardBrand",
"}",
"corresponding",
"to",
"a",
"partial",
"card",
"number",
"or",
"{",
"@link",
"Card#UNKNOWN",
"}",
"if",
"the",
"card",
"brand",
"can",
"t",
"be",
"determined",
"from",
"the",
"input",
"value",
... | train | https://github.com/stripe/stripe-android/blob/0f199255f3769a3b84583fe3ace47bfae8c3b1c8/stripe/src/main/java/com/stripe/android/CardUtils.java#L27-L31 |
mapfish/mapfish-print | core/src/main/java/org/mapfish/print/map/image/wms/WmsUtilities.java | WmsUtilities.setDpiValue | private static void setDpiValue(final Multimap<String, String> extraParams, final int dpi) {
String searchKey = "FORMAT_OPTIONS";
for (String key: extraParams.keys()) {
if (key.equalsIgnoreCase(searchKey)) {
Collection<String> values = extraParams.removeAll(key);
List<String> newValues = new ArrayList<>();
for (String value: values) {
if (!StringUtils.isEmpty(value)) {
value += ";dpi:" + Integer.toString(dpi);
newValues.add(value);
}
}
extraParams.putAll(key, newValues);
return;
}
}
} | java | private static void setDpiValue(final Multimap<String, String> extraParams, final int dpi) {
String searchKey = "FORMAT_OPTIONS";
for (String key: extraParams.keys()) {
if (key.equalsIgnoreCase(searchKey)) {
Collection<String> values = extraParams.removeAll(key);
List<String> newValues = new ArrayList<>();
for (String value: values) {
if (!StringUtils.isEmpty(value)) {
value += ";dpi:" + Integer.toString(dpi);
newValues.add(value);
}
}
extraParams.putAll(key, newValues);
return;
}
}
} | [
"private",
"static",
"void",
"setDpiValue",
"(",
"final",
"Multimap",
"<",
"String",
",",
"String",
">",
"extraParams",
",",
"final",
"int",
"dpi",
")",
"{",
"String",
"searchKey",
"=",
"\"FORMAT_OPTIONS\"",
";",
"for",
"(",
"String",
"key",
":",
"extraParam... | Set the DPI value for GeoServer if there are already FORMAT_OPTIONS. | [
"Set",
"the",
"DPI",
"value",
"for",
"GeoServer",
"if",
"there",
"are",
"already",
"FORMAT_OPTIONS",
"."
] | train | https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/map/image/wms/WmsUtilities.java#L188-L204 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.putAt | public static void putAt(Object self, String property, Object newValue) {
InvokerHelper.setProperty(self, property, newValue);
} | java | public static void putAt(Object self, String property, Object newValue) {
InvokerHelper.setProperty(self, property, newValue);
} | [
"public",
"static",
"void",
"putAt",
"(",
"Object",
"self",
",",
"String",
"property",
",",
"Object",
"newValue",
")",
"{",
"InvokerHelper",
".",
"setProperty",
"(",
"self",
",",
"property",
",",
"newValue",
")",
";",
"}"
] | Allows the subscript operator to be used to set dynamically named property values.
<code>bean[somePropertyNameExpression] = foo</code>. The normal property notation
of groovy is neater and more concise but only works with property names which
are known at compile time.
@param self the object to act upon
@param property the name of the property to set
@param newValue the value to set
@since 1.0 | [
"Allows",
"the",
"subscript",
"operator",
"to",
"be",
"used",
"to",
"set",
"dynamically",
"named",
"property",
"values",
".",
"<code",
">",
"bean",
"[",
"somePropertyNameExpression",
"]",
"=",
"foo<",
"/",
"code",
">",
".",
"The",
"normal",
"property",
"nota... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L419-L421 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_line_serviceName_dissociateDevice_POST | public void billingAccount_line_serviceName_dissociateDevice_POST(String billingAccount, String serviceName, String ipAddress, String macAddress) throws IOException {
String qPath = "/telephony/{billingAccount}/line/{serviceName}/dissociateDevice";
StringBuilder sb = path(qPath, billingAccount, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "ipAddress", ipAddress);
addBody(o, "macAddress", macAddress);
exec(qPath, "POST", sb.toString(), o);
} | java | public void billingAccount_line_serviceName_dissociateDevice_POST(String billingAccount, String serviceName, String ipAddress, String macAddress) throws IOException {
String qPath = "/telephony/{billingAccount}/line/{serviceName}/dissociateDevice";
StringBuilder sb = path(qPath, billingAccount, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "ipAddress", ipAddress);
addBody(o, "macAddress", macAddress);
exec(qPath, "POST", sb.toString(), o);
} | [
"public",
"void",
"billingAccount_line_serviceName_dissociateDevice_POST",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"String",
"ipAddress",
",",
"String",
"macAddress",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/telephony/{bil... | Dissociate a device from the current line with the device mac address
REST: POST /telephony/{billingAccount}/line/{serviceName}/dissociateDevice
@param macAddress [required] The mac address of the device you want to dissociate from the line (format: AABBCCDDEEFF)
@param ipAddress [required] The public phone IP address allowed to get phone's configuration
@param billingAccount [required] The name of your billingAccount
@param serviceName [required] | [
"Dissociate",
"a",
"device",
"from",
"the",
"current",
"line",
"with",
"the",
"device",
"mac",
"address"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L2162-L2169 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/stat/cache/cachepolicy_stats.java | cachepolicy_stats.get | public static cachepolicy_stats get(nitro_service service, String policyname) throws Exception{
cachepolicy_stats obj = new cachepolicy_stats();
obj.set_policyname(policyname);
cachepolicy_stats response = (cachepolicy_stats) obj.stat_resource(service);
return response;
} | java | public static cachepolicy_stats get(nitro_service service, String policyname) throws Exception{
cachepolicy_stats obj = new cachepolicy_stats();
obj.set_policyname(policyname);
cachepolicy_stats response = (cachepolicy_stats) obj.stat_resource(service);
return response;
} | [
"public",
"static",
"cachepolicy_stats",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"policyname",
")",
"throws",
"Exception",
"{",
"cachepolicy_stats",
"obj",
"=",
"new",
"cachepolicy_stats",
"(",
")",
";",
"obj",
".",
"set_policyname",
"(",
"policynam... | Use this API to fetch statistics of cachepolicy_stats resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"statistics",
"of",
"cachepolicy_stats",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/cache/cachepolicy_stats.java#L169-L174 |
Waikato/moa | moa/src/main/java/moa/gui/visualization/AbstractGraphAxes.java | AbstractGraphAxes.yAxis | private void yAxis(Graphics g) {
// y-axis
g.setColor(Color.BLACK);
g.drawLine(X_OFFSET_LEFT, calcY(0), X_OFFSET_LEFT, Y_OFFSET_TOP);
// center horizontal line
g.setColor(new Color(220, 220, 220));
g.drawLine(X_OFFSET_LEFT, height / 2 + Y_OFFSET_TOP, getWidth(),
height / 2 + Y_OFFSET_TOP);
g.setColor(Color.BLACK);
// y-achsis markers + labels
DecimalFormat d = new DecimalFormat("0.00");
double numLabels = Math.min(Math.pow(2, y_resolution), 32);
/*
* technically, this is numLabels-1, but as we're iterating 0 <= i <=
* numLabels, we need the extra label. Also don't draw more than 32
* labels.
*/
for (int i = 0; i <= numLabels; i++) {
double fraction = i / numLabels;
double value = fraction * upper_y_value;
g.drawString(d.format(value), 1,
(int) ((1 - fraction) * height) + Y_OFFSET_TOP + 5);
g.drawLine(X_OFFSET_LEFT - 5,
(int) ((1 - fraction) * height) + Y_OFFSET_TOP,
X_OFFSET_LEFT,
(int) ((1 - fraction) * height) + Y_OFFSET_TOP);
}
} | java | private void yAxis(Graphics g) {
// y-axis
g.setColor(Color.BLACK);
g.drawLine(X_OFFSET_LEFT, calcY(0), X_OFFSET_LEFT, Y_OFFSET_TOP);
// center horizontal line
g.setColor(new Color(220, 220, 220));
g.drawLine(X_OFFSET_LEFT, height / 2 + Y_OFFSET_TOP, getWidth(),
height / 2 + Y_OFFSET_TOP);
g.setColor(Color.BLACK);
// y-achsis markers + labels
DecimalFormat d = new DecimalFormat("0.00");
double numLabels = Math.min(Math.pow(2, y_resolution), 32);
/*
* technically, this is numLabels-1, but as we're iterating 0 <= i <=
* numLabels, we need the extra label. Also don't draw more than 32
* labels.
*/
for (int i = 0; i <= numLabels; i++) {
double fraction = i / numLabels;
double value = fraction * upper_y_value;
g.drawString(d.format(value), 1,
(int) ((1 - fraction) * height) + Y_OFFSET_TOP + 5);
g.drawLine(X_OFFSET_LEFT - 5,
(int) ((1 - fraction) * height) + Y_OFFSET_TOP,
X_OFFSET_LEFT,
(int) ((1 - fraction) * height) + Y_OFFSET_TOP);
}
} | [
"private",
"void",
"yAxis",
"(",
"Graphics",
"g",
")",
"{",
"// y-axis",
"g",
".",
"setColor",
"(",
"Color",
".",
"BLACK",
")",
";",
"g",
".",
"drawLine",
"(",
"X_OFFSET_LEFT",
",",
"calcY",
"(",
"0",
")",
",",
"X_OFFSET_LEFT",
",",
"Y_OFFSET_TOP",
")"... | Draws the y axis, containing og the axis line, the horizontal helping
line and the labels.
@param g
the Graphics context in which to paint | [
"Draws",
"the",
"y",
"axis",
"containing",
"og",
"the",
"axis",
"line",
"the",
"horizontal",
"helping",
"line",
"and",
"the",
"labels",
"."
] | train | https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/gui/visualization/AbstractGraphAxes.java#L153-L186 |
haraldk/TwelveMonkeys | common/common-lang/src/main/java/com/twelvemonkeys/util/IgnoreCaseMap.java | IgnoreCaseMap.put | public V put(String pKey, V pValue) {
String key = (String) toUpper(pKey);
return unwrap(entries.put(key, new BasicEntry<String, V>(key, pValue)));
} | java | public V put(String pKey, V pValue) {
String key = (String) toUpper(pKey);
return unwrap(entries.put(key, new BasicEntry<String, V>(key, pValue)));
} | [
"public",
"V",
"put",
"(",
"String",
"pKey",
",",
"V",
"pValue",
")",
"{",
"String",
"key",
"=",
"(",
"String",
")",
"toUpper",
"(",
"pKey",
")",
";",
"return",
"unwrap",
"(",
"entries",
".",
"put",
"(",
"key",
",",
"new",
"BasicEntry",
"<",
"Strin... | Maps the specified key to the specified value in this map.
Note: If the key used is a string, the key will not be case-sensitive.
@param pKey the map key.
@param pValue the value.
@return the previous value of the specified key in this map,
or null if it did not have one. | [
"Maps",
"the",
"specified",
"key",
"to",
"the",
"specified",
"value",
"in",
"this",
"map",
".",
"Note",
":",
"If",
"the",
"key",
"used",
"is",
"a",
"string",
"the",
"key",
"will",
"not",
"be",
"case",
"-",
"sensitive",
"."
] | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-lang/src/main/java/com/twelvemonkeys/util/IgnoreCaseMap.java#L110-L113 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_aaasession.java | ns_aaasession.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
ns_aaasession_responses result = (ns_aaasession_responses) service.get_payload_formatter().string_to_resource(ns_aaasession_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.ns_aaasession_response_array);
}
ns_aaasession[] result_ns_aaasession = new ns_aaasession[result.ns_aaasession_response_array.length];
for(int i = 0; i < result.ns_aaasession_response_array.length; i++)
{
result_ns_aaasession[i] = result.ns_aaasession_response_array[i].ns_aaasession[0];
}
return result_ns_aaasession;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
ns_aaasession_responses result = (ns_aaasession_responses) service.get_payload_formatter().string_to_resource(ns_aaasession_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.ns_aaasession_response_array);
}
ns_aaasession[] result_ns_aaasession = new ns_aaasession[result.ns_aaasession_response_array.length];
for(int i = 0; i < result.ns_aaasession_response_array.length; i++)
{
result_ns_aaasession[i] = result.ns_aaasession_response_array[i].ns_aaasession[0];
}
return result_ns_aaasession;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"ns_aaasession_responses",
"result",
"=",
"(",
"ns_aaasession_responses",
")",
"service",
".",
"get_payload_fo... | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_aaasession.java#L236-L253 |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.photos_upload | public T photos_upload(File photo, String caption)
throws FacebookException, IOException {
return photos_upload(photo, caption, /*albumId*/null) ;
} | java | public T photos_upload(File photo, String caption)
throws FacebookException, IOException {
return photos_upload(photo, caption, /*albumId*/null) ;
} | [
"public",
"T",
"photos_upload",
"(",
"File",
"photo",
",",
"String",
"caption",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"return",
"photos_upload",
"(",
"photo",
",",
"caption",
",",
"/*albumId*/",
"null",
")",
";",
"}"
] | Uploads a photo to Facebook.
@param photo an image file
@param caption a description of the image contents
@return a T with the standard Facebook photo information
@see <a href="http://wiki.developers.facebook.com/index.php/Photos.upload">
Developers wiki: Photos.upload</a> | [
"Uploads",
"a",
"photo",
"to",
"Facebook",
"."
] | train | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L1295-L1298 |
hal/core | gui/src/main/java/org/jboss/as/console/client/core/CircuitPresenter.java | CircuitPresenter.onError | protected void onError(Action action, String reason) {
Console.error(Console.CONSTANTS.lastActionError(), reason);
} | java | protected void onError(Action action, String reason) {
Console.error(Console.CONSTANTS.lastActionError(), reason);
} | [
"protected",
"void",
"onError",
"(",
"Action",
"action",
",",
"String",
"reason",
")",
"{",
"Console",
".",
"error",
"(",
"Console",
".",
"CONSTANTS",
".",
"lastActionError",
"(",
")",
",",
"reason",
")",
";",
"}"
] | When this method is called it's guaranteed that the presenter is visible. | [
"When",
"this",
"method",
"is",
"called",
"it",
"s",
"guaranteed",
"that",
"the",
"presenter",
"is",
"visible",
"."
] | train | https://github.com/hal/core/blob/d6d03f0bb128dc0470f5dc75fdb1ea1014400602/gui/src/main/java/org/jboss/as/console/client/core/CircuitPresenter.java#L109-L111 |
igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/media/MediaNegotiator.java | MediaNegotiator.receiveContentAcceptAction | private IQ receiveContentAcceptAction(Jingle jingle, JingleDescription description) throws XMPPException, NotConnectedException, InterruptedException {
IQ response;
List<PayloadType> offeredPayloads = description.getAudioPayloadTypesList();
bestCommonAudioPt = calculateBestCommonAudioPt(offeredPayloads);
if (bestCommonAudioPt == null) {
setNegotiatorState(JingleNegotiatorState.FAILED);
response = session.createJingleError(jingle, JingleError.NEGOTIATION_ERROR);
} else {
setNegotiatorState(JingleNegotiatorState.SUCCEEDED);
triggerMediaEstablished(getBestCommonAudioPt());
LOGGER.severe("Media choice:" + getBestCommonAudioPt().getName());
response = session.createAck(jingle);
}
return response;
} | java | private IQ receiveContentAcceptAction(Jingle jingle, JingleDescription description) throws XMPPException, NotConnectedException, InterruptedException {
IQ response;
List<PayloadType> offeredPayloads = description.getAudioPayloadTypesList();
bestCommonAudioPt = calculateBestCommonAudioPt(offeredPayloads);
if (bestCommonAudioPt == null) {
setNegotiatorState(JingleNegotiatorState.FAILED);
response = session.createJingleError(jingle, JingleError.NEGOTIATION_ERROR);
} else {
setNegotiatorState(JingleNegotiatorState.SUCCEEDED);
triggerMediaEstablished(getBestCommonAudioPt());
LOGGER.severe("Media choice:" + getBestCommonAudioPt().getName());
response = session.createAck(jingle);
}
return response;
} | [
"private",
"IQ",
"receiveContentAcceptAction",
"(",
"Jingle",
"jingle",
",",
"JingleDescription",
"description",
")",
"throws",
"XMPPException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"IQ",
"response",
";",
"List",
"<",
"PayloadType",
">",
"of... | The other side has sent us a content-accept. The payload types in that message may not match with what
we sent, but XEP-167 says that the other side should retain the order of the payload types we first sent.
This means we can walk through our list, in order, until we find one from their list that matches. This
will be the best payload type to use.
@param jingle
@return the iq
@throws NotConnectedException
@throws InterruptedException | [
"The",
"other",
"side",
"has",
"sent",
"us",
"a",
"content",
"-",
"accept",
".",
"The",
"payload",
"types",
"in",
"that",
"message",
"may",
"not",
"match",
"with",
"what",
"we",
"sent",
"but",
"XEP",
"-",
"167",
"says",
"that",
"the",
"other",
"side",
... | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/media/MediaNegotiator.java#L210-L231 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/policy/policyexpression.java | policyexpression.get | public static policyexpression get(nitro_service service, String name) throws Exception{
policyexpression obj = new policyexpression();
obj.set_name(name);
policyexpression response = (policyexpression) obj.get_resource(service);
return response;
} | java | public static policyexpression get(nitro_service service, String name) throws Exception{
policyexpression obj = new policyexpression();
obj.set_name(name);
policyexpression response = (policyexpression) obj.get_resource(service);
return response;
} | [
"public",
"static",
"policyexpression",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"policyexpression",
"obj",
"=",
"new",
"policyexpression",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
")",
";",
"... | Use this API to fetch policyexpression resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"policyexpression",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/policy/policyexpression.java#L429-L434 |
jlinn/quartz-redis-jobstore | src/main/java/net/joelinn/quartz/jobstore/AbstractRedisStorage.java | AbstractRedisStorage.checkExists | public boolean checkExists(TriggerKey triggerKey, T jedis){
return jedis.exists(redisSchema.triggerHashKey(triggerKey));
} | java | public boolean checkExists(TriggerKey triggerKey, T jedis){
return jedis.exists(redisSchema.triggerHashKey(triggerKey));
} | [
"public",
"boolean",
"checkExists",
"(",
"TriggerKey",
"triggerKey",
",",
"T",
"jedis",
")",
"{",
"return",
"jedis",
".",
"exists",
"(",
"redisSchema",
".",
"triggerHashKey",
"(",
"triggerKey",
")",
")",
";",
"}"
] | Check if the trigger identified by the given key exists
@param triggerKey the key of the desired trigger
@param jedis a thread-safe Redis connection
@return true if the trigger exists; false otherwise | [
"Check",
"if",
"the",
"trigger",
"identified",
"by",
"the",
"given",
"key",
"exists"
] | train | https://github.com/jlinn/quartz-redis-jobstore/blob/be9a52ee776d8a09866fe99fd9718bc13a0cb992/src/main/java/net/joelinn/quartz/jobstore/AbstractRedisStorage.java#L363-L365 |
lucee/Lucee | core/src/main/java/lucee/commons/io/ini/IniFile.java | IniFile.getKeyValueEL | public String getKeyValueEL(String strSection, String key) {
Map map = getSectionEL(strSection);
if (map == null) return null;
Object o = map.get(key.toLowerCase());
if (o == null) return null;
return (String) o;
} | java | public String getKeyValueEL(String strSection, String key) {
Map map = getSectionEL(strSection);
if (map == null) return null;
Object o = map.get(key.toLowerCase());
if (o == null) return null;
return (String) o;
} | [
"public",
"String",
"getKeyValueEL",
"(",
"String",
"strSection",
",",
"String",
"key",
")",
"{",
"Map",
"map",
"=",
"getSectionEL",
"(",
"strSection",
")",
";",
"if",
"(",
"map",
"==",
"null",
")",
"return",
"null",
";",
"Object",
"o",
"=",
"map",
"."... | Gets the KeyValue attribute of the IniFile object, if not exist return null
@param strSection section to get
@param key key to get
@return matching alue | [
"Gets",
"the",
"KeyValue",
"attribute",
"of",
"the",
"IniFile",
"object",
"if",
"not",
"exist",
"return",
"null"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/ini/IniFile.java#L157-L164 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/script/ScriptBuilder.java | ScriptBuilder.createMultiSigOutputScript | public static Script createMultiSigOutputScript(int threshold, List<ECKey> pubkeys) {
checkArgument(threshold > 0);
checkArgument(threshold <= pubkeys.size());
checkArgument(pubkeys.size() <= 16); // That's the max we can represent with a single opcode.
ScriptBuilder builder = new ScriptBuilder();
builder.smallNum(threshold);
for (ECKey key : pubkeys) {
builder.data(key.getPubKey());
}
builder.smallNum(pubkeys.size());
builder.op(OP_CHECKMULTISIG);
return builder.build();
} | java | public static Script createMultiSigOutputScript(int threshold, List<ECKey> pubkeys) {
checkArgument(threshold > 0);
checkArgument(threshold <= pubkeys.size());
checkArgument(pubkeys.size() <= 16); // That's the max we can represent with a single opcode.
ScriptBuilder builder = new ScriptBuilder();
builder.smallNum(threshold);
for (ECKey key : pubkeys) {
builder.data(key.getPubKey());
}
builder.smallNum(pubkeys.size());
builder.op(OP_CHECKMULTISIG);
return builder.build();
} | [
"public",
"static",
"Script",
"createMultiSigOutputScript",
"(",
"int",
"threshold",
",",
"List",
"<",
"ECKey",
">",
"pubkeys",
")",
"{",
"checkArgument",
"(",
"threshold",
">",
"0",
")",
";",
"checkArgument",
"(",
"threshold",
"<=",
"pubkeys",
".",
"size",
... | Creates a program that requires at least N of the given keys to sign, using OP_CHECKMULTISIG. | [
"Creates",
"a",
"program",
"that",
"requires",
"at",
"least",
"N",
"of",
"the",
"given",
"keys",
"to",
"sign",
"using",
"OP_CHECKMULTISIG",
"."
] | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/script/ScriptBuilder.java#L304-L316 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/Period.java | Period.and | public Period and(float count, TimeUnit unit) {
checkCount(count);
return setTimeUnitValue(unit, count);
} | java | public Period and(float count, TimeUnit unit) {
checkCount(count);
return setTimeUnitValue(unit, count);
} | [
"public",
"Period",
"and",
"(",
"float",
"count",
",",
"TimeUnit",
"unit",
")",
"{",
"checkCount",
"(",
"count",
")",
";",
"return",
"setTimeUnitValue",
"(",
"unit",
",",
"count",
")",
";",
"}"
] | Set the given unit to have the given count. Marks the
unit as having been set. This can be used to set
multiple units, or to reset a unit to have a new count.
This does <b>not</b> add the count to an existing count
for this unit.
@param count the number of units. must be non-negative
@param unit the unit
@return the new Period | [
"Set",
"the",
"given",
"unit",
"to",
"have",
"the",
"given",
"count",
".",
"Marks",
"the",
"unit",
"as",
"having",
"been",
"set",
".",
"This",
"can",
"be",
"used",
"to",
"set",
"multiple",
"units",
"or",
"to",
"reset",
"a",
"unit",
"to",
"have",
"a",... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/Period.java#L83-L86 |
alkacon/opencms-core | src-gwt/org/opencms/ade/publish/client/CmsBrokenLinksPanel.java | CmsBrokenLinksPanel.prepareButton | private void prepareButton(CmsPushButton button, String text) {
button.setText(text);
button.setUseMinWidth(true);
} | java | private void prepareButton(CmsPushButton button, String text) {
button.setText(text);
button.setUseMinWidth(true);
} | [
"private",
"void",
"prepareButton",
"(",
"CmsPushButton",
"button",
",",
"String",
"text",
")",
"{",
"button",
".",
"setText",
"(",
"text",
")",
";",
"button",
".",
"setUseMinWidth",
"(",
"true",
")",
";",
"}"
] | Sets the text on a button and formats the button.<p>
@param button the button
@param text the text to put on the button | [
"Sets",
"the",
"text",
"on",
"a",
"button",
"and",
"formats",
"the",
"button",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/publish/client/CmsBrokenLinksPanel.java#L260-L264 |
dkpro/dkpro-jwpl | de.tudarmstadt.ukp.wikipedia.api/src/main/java/de/tudarmstadt/ukp/wikipedia/api/CategoryGraph.java | CategoryGraph.getIntrinsicInformationContent | public double getIntrinsicInformationContent(Category category) throws WikiApiException {
int node = category.getPageId();
int hyponymCount = getHyponymCountMap().get(node);
int numberOfNodes = this.getNumberOfNodes();
if (hyponymCount > numberOfNodes) {
throw new WikiApiException("Something is wrong with the hyponymCountMap. " + hyponymCount + " hyponyms, but only " + numberOfNodes + " nodes.");
}
logger.debug(category.getTitle().getPlainTitle() + " has # hyponyms: " + hyponymCount);
double intrinsicIC = -1;
if (hyponymCount >= 0) {
intrinsicIC = (1 - ( Math.log(hyponymCount + 1) / Math.log(numberOfNodes) ) );
}
return intrinsicIC;
} | java | public double getIntrinsicInformationContent(Category category) throws WikiApiException {
int node = category.getPageId();
int hyponymCount = getHyponymCountMap().get(node);
int numberOfNodes = this.getNumberOfNodes();
if (hyponymCount > numberOfNodes) {
throw new WikiApiException("Something is wrong with the hyponymCountMap. " + hyponymCount + " hyponyms, but only " + numberOfNodes + " nodes.");
}
logger.debug(category.getTitle().getPlainTitle() + " has # hyponyms: " + hyponymCount);
double intrinsicIC = -1;
if (hyponymCount >= 0) {
intrinsicIC = (1 - ( Math.log(hyponymCount + 1) / Math.log(numberOfNodes) ) );
}
return intrinsicIC;
} | [
"public",
"double",
"getIntrinsicInformationContent",
"(",
"Category",
"category",
")",
"throws",
"WikiApiException",
"{",
"int",
"node",
"=",
"category",
".",
"getPageId",
"(",
")",
";",
"int",
"hyponymCount",
"=",
"getHyponymCountMap",
"(",
")",
".",
"get",
"(... | Intrinsic information content (Seco Etal. 2004) allows to compute information content from the structure of the taxonomy (no corpus needed).
IC(n) = 1 - log( hypo(n) + 1) / log(#cat)
hypo(n) is the (recursive) number of hyponyms of a node n. Recursive means that the hyponyms of hyponyms are also taken into account
#cat is the number of categories in the graph
@param category The category node for which the intrinsic information content should be returned.
@return The intrinsic information content for this category node.
@throws WikiApiException Thrown if errors occurred. | [
"Intrinsic",
"information",
"content",
"(",
"Seco",
"Etal",
".",
"2004",
")",
"allows",
"to",
"compute",
"information",
"content",
"from",
"the",
"structure",
"of",
"the",
"taxonomy",
"(",
"no",
"corpus",
"needed",
")",
".",
"IC",
"(",
"n",
")",
"=",
"1"... | train | https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.api/src/main/java/de/tudarmstadt/ukp/wikipedia/api/CategoryGraph.java#L951-L968 |
alkacon/opencms-core | src/org/opencms/ui/apps/sessions/CmsSessionsTable.java | CmsSessionsTable.filterTable | public void filterTable(String search) {
m_container.removeAllContainerFilters();
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(search)) {
m_container.addContainerFilter(
new Or(
new SimpleStringFilter(TableProperty.UserName, search, true, false),
new SimpleStringFilter(TableProperty.Site, search, true, false),
new SimpleStringFilter(TableProperty.Project, search, true, false)));
}
if ((getValue() != null) & !((Set<String>)getValue()).isEmpty()) {
setCurrentPageFirstItemId(((Set<String>)getValue()).iterator().next());
}
} | java | public void filterTable(String search) {
m_container.removeAllContainerFilters();
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(search)) {
m_container.addContainerFilter(
new Or(
new SimpleStringFilter(TableProperty.UserName, search, true, false),
new SimpleStringFilter(TableProperty.Site, search, true, false),
new SimpleStringFilter(TableProperty.Project, search, true, false)));
}
if ((getValue() != null) & !((Set<String>)getValue()).isEmpty()) {
setCurrentPageFirstItemId(((Set<String>)getValue()).iterator().next());
}
} | [
"public",
"void",
"filterTable",
"(",
"String",
"search",
")",
"{",
"m_container",
".",
"removeAllContainerFilters",
"(",
")",
";",
"if",
"(",
"CmsStringUtil",
".",
"isNotEmptyOrWhitespaceOnly",
"(",
"search",
")",
")",
"{",
"m_container",
".",
"addContainerFilter... | Filters the table according to given search string.<p>
@param search string to be looked for. | [
"Filters",
"the",
"table",
"according",
"to",
"given",
"search",
"string",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/sessions/CmsSessionsTable.java#L495-L508 |
jbundle/jbundle | thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/opt/JAltGridScreen.java | JAltGridScreen.addGridDetailItem | public void addGridDetailItem(TableModel model, int iRowIndex, GridBagLayout gridbag, GridBagConstraints c)
{
JComponent rgcompoments[] = new JComponent[model.getColumnCount()];
for (int iColumnIndex = 0; iColumnIndex < rgcompoments.length; iColumnIndex++)
{
Object obj = model.getValueAt(iRowIndex, iColumnIndex);
if ((obj == null) || (model.getRowCount() <= iRowIndex))
return; // EOF
if (iColumnIndex == rgcompoments.length - 1)
{ // Last column - take remainder
c.weightx = 1.0;
c.gridwidth = GridBagConstraints.REMAINDER; //end row
c.anchor = GridBagConstraints.WEST; // Edit boxes left justified
c.insets.right = 5;
}
Component component = this.addDetailComponent(model, obj, iRowIndex, iColumnIndex, c);
if (component == null)
continue; // Skip this column
gridbag.setConstraints(component, c);
m_panelGrid.add(component);
rgcompoments[iColumnIndex] = (JComponent)component;
}
// Set up a table to lookup the item<->textfield link
m_vComponentCache.addElement(new ComponentCache(iRowIndex, rgcompoments));
} | java | public void addGridDetailItem(TableModel model, int iRowIndex, GridBagLayout gridbag, GridBagConstraints c)
{
JComponent rgcompoments[] = new JComponent[model.getColumnCount()];
for (int iColumnIndex = 0; iColumnIndex < rgcompoments.length; iColumnIndex++)
{
Object obj = model.getValueAt(iRowIndex, iColumnIndex);
if ((obj == null) || (model.getRowCount() <= iRowIndex))
return; // EOF
if (iColumnIndex == rgcompoments.length - 1)
{ // Last column - take remainder
c.weightx = 1.0;
c.gridwidth = GridBagConstraints.REMAINDER; //end row
c.anchor = GridBagConstraints.WEST; // Edit boxes left justified
c.insets.right = 5;
}
Component component = this.addDetailComponent(model, obj, iRowIndex, iColumnIndex, c);
if (component == null)
continue; // Skip this column
gridbag.setConstraints(component, c);
m_panelGrid.add(component);
rgcompoments[iColumnIndex] = (JComponent)component;
}
// Set up a table to lookup the item<->textfield link
m_vComponentCache.addElement(new ComponentCache(iRowIndex, rgcompoments));
} | [
"public",
"void",
"addGridDetailItem",
"(",
"TableModel",
"model",
",",
"int",
"iRowIndex",
",",
"GridBagLayout",
"gridbag",
",",
"GridBagConstraints",
"c",
")",
"{",
"JComponent",
"rgcompoments",
"[",
"]",
"=",
"new",
"JComponent",
"[",
"model",
".",
"getColumn... | Add this item to the grid detail at this row.
@param model The table model to read through.
@param iRowIndex The row to add this item.
@param gridbag The screen layout.
@param c The constraint to use. | [
"Add",
"this",
"item",
"to",
"the",
"grid",
"detail",
"at",
"this",
"row",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/opt/JAltGridScreen.java#L223-L247 |
comapi/comapi-sdk-android | COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java | InternalService.getProfile | public void getProfile(@NonNull final String profileId, @Nullable Callback<ComapiResult<Map<String, Object>>> callback) {
adapter.adapt(getProfile(profileId), callback);
} | java | public void getProfile(@NonNull final String profileId, @Nullable Callback<ComapiResult<Map<String, Object>>> callback) {
adapter.adapt(getProfile(profileId), callback);
} | [
"public",
"void",
"getProfile",
"(",
"@",
"NonNull",
"final",
"String",
"profileId",
",",
"@",
"Nullable",
"Callback",
"<",
"ComapiResult",
"<",
"Map",
"<",
"String",
",",
"Object",
">",
">",
">",
"callback",
")",
"{",
"adapter",
".",
"adapt",
"(",
"getP... | Get profile details from the service.
@param profileId Profile Id of the user.
@param callback Callback to deliver new session instance. | [
"Get",
"profile",
"details",
"from",
"the",
"service",
"."
] | train | https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java#L279-L281 |
op4j/op4j | src/main/java/org/op4j/Op.java | Op.onArrayFor | public static <T> Level0ArrayOperator<Character[],Character> onArrayFor(final Character... elements) {
return onArrayOf(Types.CHARACTER, VarArgsUtil.asRequiredObjectArray(elements));
} | java | public static <T> Level0ArrayOperator<Character[],Character> onArrayFor(final Character... elements) {
return onArrayOf(Types.CHARACTER, VarArgsUtil.asRequiredObjectArray(elements));
} | [
"public",
"static",
"<",
"T",
">",
"Level0ArrayOperator",
"<",
"Character",
"[",
"]",
",",
"Character",
">",
"onArrayFor",
"(",
"final",
"Character",
"...",
"elements",
")",
"{",
"return",
"onArrayOf",
"(",
"Types",
".",
"CHARACTER",
",",
"VarArgsUtil",
".",... | <p>
Creates an array with the specified elements and an <i>operation expression</i> on it.
</p>
@param elements the elements of the array being created
@return an operator, ready for chaining | [
"<p",
">",
"Creates",
"an",
"array",
"with",
"the",
"specified",
"elements",
"and",
"an",
"<i",
">",
"operation",
"expression<",
"/",
"i",
">",
"on",
"it",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/Op.java#L958-L960 |
rey5137/material | app/src/main/java/com/rey/material/app/Recurring.java | Recurring.setEnabledWeekday | public void setEnabledWeekday(int dayOfWeek, boolean enable){
if(mRepeatMode != REPEAT_WEEKLY)
return;
if(enable)
mRepeatSetting = mRepeatSetting | WEEKDAY_MASK[dayOfWeek - 1];
else
mRepeatSetting = mRepeatSetting & (~WEEKDAY_MASK[dayOfWeek - 1]);
} | java | public void setEnabledWeekday(int dayOfWeek, boolean enable){
if(mRepeatMode != REPEAT_WEEKLY)
return;
if(enable)
mRepeatSetting = mRepeatSetting | WEEKDAY_MASK[dayOfWeek - 1];
else
mRepeatSetting = mRepeatSetting & (~WEEKDAY_MASK[dayOfWeek - 1]);
} | [
"public",
"void",
"setEnabledWeekday",
"(",
"int",
"dayOfWeek",
",",
"boolean",
"enable",
")",
"{",
"if",
"(",
"mRepeatMode",
"!=",
"REPEAT_WEEKLY",
")",
"return",
";",
"if",
"(",
"enable",
")",
"mRepeatSetting",
"=",
"mRepeatSetting",
"|",
"WEEKDAY_MASK",
"["... | Enable repeat on a dayOfWeek. Only apply it repeat mode is REPEAT_WEEKLY.
@param dayOfWeek value of dayOfWeek, take from Calendar obj.
@param enable Enable this dayOfWeek or not. | [
"Enable",
"repeat",
"on",
"a",
"dayOfWeek",
".",
"Only",
"apply",
"it",
"repeat",
"mode",
"is",
"REPEAT_WEEKLY",
"."
] | train | https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/app/src/main/java/com/rey/material/app/Recurring.java#L157-L165 |
jenkinsci/jenkins | core/src/main/java/jenkins/model/Jenkins.java | Jenkins.isNameUnique | boolean isNameUnique(String name, String currentJobName) {
Item item = getItem(name);
if(null==item) {
// the candidate name didn't return any items so the name is unique
return true;
}
else if(item.getName().equals(currentJobName)) {
// the candidate name returned an item, but the item is the item
// that the user is configuring so this is ok
return true;
}
else {
// the candidate name returned an item, so it is not unique
return false;
}
} | java | boolean isNameUnique(String name, String currentJobName) {
Item item = getItem(name);
if(null==item) {
// the candidate name didn't return any items so the name is unique
return true;
}
else if(item.getName().equals(currentJobName)) {
// the candidate name returned an item, but the item is the item
// that the user is configuring so this is ok
return true;
}
else {
// the candidate name returned an item, so it is not unique
return false;
}
} | [
"boolean",
"isNameUnique",
"(",
"String",
"name",
",",
"String",
"currentJobName",
")",
"{",
"Item",
"item",
"=",
"getItem",
"(",
"name",
")",
";",
"if",
"(",
"null",
"==",
"item",
")",
"{",
"// the candidate name didn't return any items so the name is unique",
"r... | True if there is no item in Jenkins that has this name
@param name The name to test
@param currentJobName The name of the job that the user is configuring | [
"True",
"if",
"there",
"is",
"no",
"item",
"in",
"Jenkins",
"that",
"has",
"this",
"name"
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/model/Jenkins.java#L4801-L4817 |
apache/groovy | subprojects/groovy-datetime/src/main/java/org/apache/groovy/datetime/extensions/DateTimeExtensions.java | DateTimeExtensions.upto | public static void upto(Temporal from, Temporal to, TemporalUnit unit, Closure closure) {
if (isUptoEligible(from, to)) {
for (Temporal i = from; isUptoEligible(i, to); i = i.plus(1, unit)) {
closure.call(i);
}
} else {
throw new GroovyRuntimeException("The argument (" + to +
") to upto() cannot be earlier than the value (" + from + ") it's called on.");
}
} | java | public static void upto(Temporal from, Temporal to, TemporalUnit unit, Closure closure) {
if (isUptoEligible(from, to)) {
for (Temporal i = from; isUptoEligible(i, to); i = i.plus(1, unit)) {
closure.call(i);
}
} else {
throw new GroovyRuntimeException("The argument (" + to +
") to upto() cannot be earlier than the value (" + from + ") it's called on.");
}
} | [
"public",
"static",
"void",
"upto",
"(",
"Temporal",
"from",
",",
"Temporal",
"to",
",",
"TemporalUnit",
"unit",
",",
"Closure",
"closure",
")",
"{",
"if",
"(",
"isUptoEligible",
"(",
"from",
",",
"to",
")",
")",
"{",
"for",
"(",
"Temporal",
"i",
"=",
... | Iterates from this to the {@code to} {@link java.time.temporal.Temporal}, inclusive, incrementing by one
{@code unit} each iteration, calling the closure once per iteration. The closure may accept a single
{@link java.time.temporal.Temporal} argument.
<p>
If the unit is too large to iterate to the second Temporal exactly, such as iterating from two LocalDateTimes
that are seconds apart using {@link java.time.temporal.ChronoUnit#DAYS} as the unit, the iteration will cease
as soon as the current value of the iteration is later than the second Temporal argument. The closure will
not be called with any value later than the {@code to} value.
@param from the starting Temporal
@param to the ending Temporal
@param unit the TemporalUnit to increment by
@param closure the zero or one-argument closure to call
@throws GroovyRuntimeException if this value is later than {@code to}
@throws GroovyRuntimeException if {@code to} is a different type than this
@since 2.5.0 | [
"Iterates",
"from",
"this",
"to",
"the",
"{",
"@code",
"to",
"}",
"{",
"@link",
"java",
".",
"time",
".",
"temporal",
".",
"Temporal",
"}",
"inclusive",
"incrementing",
"by",
"one",
"{",
"@code",
"unit",
"}",
"each",
"iteration",
"calling",
"the",
"closu... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-datetime/src/main/java/org/apache/groovy/datetime/extensions/DateTimeExtensions.java#L155-L164 |
Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/CraftingHelper.java | CraftingHelper.playerHasIngredients | public static boolean playerHasIngredients(EntityPlayerMP player, List<ItemStack> ingredients)
{
NonNullList<ItemStack> main = player.inventory.mainInventory;
NonNullList<ItemStack> arm = player.inventory.armorInventory;
for (ItemStack isIngredient : ingredients)
{
int target = isIngredient.getCount();
for (int i = 0; i < main.size() + arm.size() && target > 0; i++)
{
ItemStack isPlayer = (i >= main.size()) ? arm.get(i - main.size()) : main.get(i);
if (isPlayer != null && isIngredient != null && itemStackIngredientsMatch(isPlayer, isIngredient))
target -= isPlayer.getCount();
}
if (target > 0)
return false; // Don't have enough of this.
}
return true;
} | java | public static boolean playerHasIngredients(EntityPlayerMP player, List<ItemStack> ingredients)
{
NonNullList<ItemStack> main = player.inventory.mainInventory;
NonNullList<ItemStack> arm = player.inventory.armorInventory;
for (ItemStack isIngredient : ingredients)
{
int target = isIngredient.getCount();
for (int i = 0; i < main.size() + arm.size() && target > 0; i++)
{
ItemStack isPlayer = (i >= main.size()) ? arm.get(i - main.size()) : main.get(i);
if (isPlayer != null && isIngredient != null && itemStackIngredientsMatch(isPlayer, isIngredient))
target -= isPlayer.getCount();
}
if (target > 0)
return false; // Don't have enough of this.
}
return true;
} | [
"public",
"static",
"boolean",
"playerHasIngredients",
"(",
"EntityPlayerMP",
"player",
",",
"List",
"<",
"ItemStack",
">",
"ingredients",
")",
"{",
"NonNullList",
"<",
"ItemStack",
">",
"main",
"=",
"player",
".",
"inventory",
".",
"mainInventory",
";",
"NonNul... | Inspect a player's inventory to see whether they have enough items to form the supplied list of ItemStacks.<br>
The ingredients list MUST be amalgamated such that no two ItemStacks contain the same type of item.
@param player
@param ingredients an amalgamated list of ingredients
@return true if the player's inventory contains sufficient quantities of all the required items. | [
"Inspect",
"a",
"player",
"s",
"inventory",
"to",
"see",
"whether",
"they",
"have",
"enough",
"items",
"to",
"form",
"the",
"supplied",
"list",
"of",
"ItemStacks",
".",
"<br",
">",
"The",
"ingredients",
"list",
"MUST",
"be",
"amalgamated",
"such",
"that",
... | train | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/CraftingHelper.java#L185-L203 |
contentful/contentful-management.java | src/main/java/com/contentful/java/cma/ModuleEntries.java | ModuleEntries.fetchAll | public CMAArray<CMAEntry> fetchAll(String spaceId, String environmentId) {
return fetchAll(spaceId, environmentId, new HashMap<>());
} | java | public CMAArray<CMAEntry> fetchAll(String spaceId, String environmentId) {
return fetchAll(spaceId, environmentId, new HashMap<>());
} | [
"public",
"CMAArray",
"<",
"CMAEntry",
">",
"fetchAll",
"(",
"String",
"spaceId",
",",
"String",
"environmentId",
")",
"{",
"return",
"fetchAll",
"(",
"spaceId",
",",
"environmentId",
",",
"new",
"HashMap",
"<>",
"(",
")",
")",
";",
"}"
] | Fetch all entries from the given space and environment.
<p>
This fetch uses the default parameter defined in {@link DefaultQueryParameter#FETCH}
<p>
This method will override the configuration specified through
{@link CMAClient.Builder#setSpaceId(String)} and
{@link CMAClient.Builder#setEnvironmentId(String)}.
@param spaceId Space ID
@param environmentId Environment ID
@return {@link CMAArray} result instance
@throws IllegalArgumentException if spaceId is null.
@throws IllegalArgumentException if environmentId is null. | [
"Fetch",
"all",
"entries",
"from",
"the",
"given",
"space",
"and",
"environment",
".",
"<p",
">",
"This",
"fetch",
"uses",
"the",
"default",
"parameter",
"defined",
"in",
"{",
"@link",
"DefaultQueryParameter#FETCH",
"}",
"<p",
">",
"This",
"method",
"will",
... | train | https://github.com/contentful/contentful-management.java/blob/ca310fb9ea9577fcff0ca57949ab7c2315fa2534/src/main/java/com/contentful/java/cma/ModuleEntries.java#L215-L217 |
intuit/QuickBooks-V3-Java-SDK | ipp-v3-java-devkit/src/main/java/com/intuit/ipp/services/DataService.java | DataService.executeBatchAsync | public void executeBatchAsync(BatchOperation batchOperation, CallbackHandler callbackHandler) throws FMSException {
IntuitMessage intuitMessage = prepareBatch(batchOperation);
//set callback handler
intuitMessage.getRequestElements().setCallbackHandler(callbackHandler);
//execute async interceptors
executeAsyncInterceptors(intuitMessage);
} | java | public void executeBatchAsync(BatchOperation batchOperation, CallbackHandler callbackHandler) throws FMSException {
IntuitMessage intuitMessage = prepareBatch(batchOperation);
//set callback handler
intuitMessage.getRequestElements().setCallbackHandler(callbackHandler);
//execute async interceptors
executeAsyncInterceptors(intuitMessage);
} | [
"public",
"void",
"executeBatchAsync",
"(",
"BatchOperation",
"batchOperation",
",",
"CallbackHandler",
"callbackHandler",
")",
"throws",
"FMSException",
"{",
"IntuitMessage",
"intuitMessage",
"=",
"prepareBatch",
"(",
"batchOperation",
")",
";",
"//set callback handler",
... | Method to cancel the operation for the corresponding entity in asynchronous fashion
@param batchOperation
the batch operation
@param callbackHandler
the callback handler
@throws FMSException | [
"Method",
"to",
"cancel",
"the",
"operation",
"for",
"the",
"corresponding",
"entity",
"in",
"asynchronous",
"fashion"
] | train | https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/services/DataService.java#L1016-L1025 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/trees/EnglishGrammaticalStructure.java | EnglishGrammaticalStructure.getSubject | public static TreeGraphNode getSubject(TreeGraphNode t) {
TreeGraphNode subj = getNodeInRelation(t, NOMINAL_SUBJECT);
if (subj != null) {
return subj;
}
subj = getNodeInRelation(t, CLAUSAL_SUBJECT);
if (subj != null) {
return subj;
} else {
return getNodeInRelation(t, NOMINAL_PASSIVE_SUBJECT);
}
} | java | public static TreeGraphNode getSubject(TreeGraphNode t) {
TreeGraphNode subj = getNodeInRelation(t, NOMINAL_SUBJECT);
if (subj != null) {
return subj;
}
subj = getNodeInRelation(t, CLAUSAL_SUBJECT);
if (subj != null) {
return subj;
} else {
return getNodeInRelation(t, NOMINAL_PASSIVE_SUBJECT);
}
} | [
"public",
"static",
"TreeGraphNode",
"getSubject",
"(",
"TreeGraphNode",
"t",
")",
"{",
"TreeGraphNode",
"subj",
"=",
"getNodeInRelation",
"(",
"t",
",",
"NOMINAL_SUBJECT",
")",
";",
"if",
"(",
"subj",
"!=",
"null",
")",
"{",
"return",
"subj",
";",
"}",
"s... | Tries to return a node representing the <code>SUBJECT</code> (whether
nominal or clausal) of the given node <code>t</code>. Probably, node
<code>t</code> should represent a clause or verb phrase.
@param t
a node in this <code>GrammaticalStructure</code>
@return a node which is the subject of node <code>t</code>, or else
<code>null</code> | [
"Tries",
"to",
"return",
"a",
"node",
"representing",
"the",
"<code",
">",
"SUBJECT<",
"/",
"code",
">",
"(",
"whether",
"nominal",
"or",
"clausal",
")",
"of",
"the",
"given",
"node",
"<code",
">",
"t<",
"/",
"code",
">",
".",
"Probably",
"node",
"<cod... | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/trees/EnglishGrammaticalStructure.java#L103-L114 |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java | GenericUtils.putInt | static public WsByteBuffer[] putInt(WsByteBuffer[] buffers, int value, BNFHeadersImpl bnfObj) {
// verify input buffer information
if (null == buffers) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Null buffers sent to putInt");
}
return null;
}
// Last buffer
WsByteBuffer buffer = buffers[buffers.length - 1];
byte[] data = asBytes(value);
try {
buffer.put(data);
} catch (BufferOverflowException boe) {
// no FFDC required
// use existing method to put what bytes we can, allocate a new
// buffer and put the rest
return putByteArrayKnownOverflow(buffers, data, bnfObj);
}
return buffers;
} | java | static public WsByteBuffer[] putInt(WsByteBuffer[] buffers, int value, BNFHeadersImpl bnfObj) {
// verify input buffer information
if (null == buffers) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Null buffers sent to putInt");
}
return null;
}
// Last buffer
WsByteBuffer buffer = buffers[buffers.length - 1];
byte[] data = asBytes(value);
try {
buffer.put(data);
} catch (BufferOverflowException boe) {
// no FFDC required
// use existing method to put what bytes we can, allocate a new
// buffer and put the rest
return putByteArrayKnownOverflow(buffers, data, bnfObj);
}
return buffers;
} | [
"static",
"public",
"WsByteBuffer",
"[",
"]",
"putInt",
"(",
"WsByteBuffer",
"[",
"]",
"buffers",
",",
"int",
"value",
",",
"BNFHeadersImpl",
"bnfObj",
")",
"{",
"// verify input buffer information",
"if",
"(",
"null",
"==",
"buffers",
")",
"{",
"if",
"(",
"... | Given a wsbb[], we're adding a int value to the <b>last</b> buffer. If
that buffer fills up, then we will allocate a new one, by expanding
the last WsByteBuffer in wsbb[].
<p>
Returns the new wsbb[] (expanded if needed).
@param buffers
@param value
@param bnfObj
@return WsByteBuffer[] | [
"Given",
"a",
"wsbb",
"[]",
"we",
"re",
"adding",
"a",
"int",
"value",
"to",
"the",
"<b",
">",
"last<",
"/",
"b",
">",
"buffer",
".",
"If",
"that",
"buffer",
"fills",
"up",
"then",
"we",
"will",
"allocate",
"a",
"new",
"one",
"by",
"expanding",
"th... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java#L112-L135 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Instance.java | Instance.setSchedulingOptions | public Operation setSchedulingOptions(SchedulingOptions scheduling, OperationOption... options) {
return compute.setSchedulingOptions(getInstanceId(), scheduling, options);
} | java | public Operation setSchedulingOptions(SchedulingOptions scheduling, OperationOption... options) {
return compute.setSchedulingOptions(getInstanceId(), scheduling, options);
} | [
"public",
"Operation",
"setSchedulingOptions",
"(",
"SchedulingOptions",
"scheduling",
",",
"OperationOption",
"...",
"options",
")",
"{",
"return",
"compute",
".",
"setSchedulingOptions",
"(",
"getInstanceId",
"(",
")",
",",
"scheduling",
",",
"options",
")",
";",
... | Sets the scheduling options for this instance.
@return a zone operation if the set request was issued correctly, {@code null} if the instance
was not found
@throws ComputeException upon failure | [
"Sets",
"the",
"scheduling",
"options",
"for",
"this",
"instance",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Instance.java#L382-L384 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/effect/SeaGlassInternalShadowEffect.java | SeaGlassInternalShadowEffect.getLeftShadowGradient | public Paint getLeftShadowGradient(Shape s) {
Rectangle2D bounds = s.getBounds2D();
float minX = (float) bounds.getMinX();
float maxX = (float) bounds.getMaxX();
float midY = (float) bounds.getCenterY();
return new LinearGradientPaint(minX, midY, maxX, midY, (new float[] { 0f, 1f }),
new Color[] { innerShadow.bottom, transparentColor });
} | java | public Paint getLeftShadowGradient(Shape s) {
Rectangle2D bounds = s.getBounds2D();
float minX = (float) bounds.getMinX();
float maxX = (float) bounds.getMaxX();
float midY = (float) bounds.getCenterY();
return new LinearGradientPaint(minX, midY, maxX, midY, (new float[] { 0f, 1f }),
new Color[] { innerShadow.bottom, transparentColor });
} | [
"public",
"Paint",
"getLeftShadowGradient",
"(",
"Shape",
"s",
")",
"{",
"Rectangle2D",
"bounds",
"=",
"s",
".",
"getBounds2D",
"(",
")",
";",
"float",
"minX",
"=",
"(",
"float",
")",
"bounds",
".",
"getMinX",
"(",
")",
";",
"float",
"maxX",
"=",
"(",
... | Create the gradient for the left of a rectangular shadow.
@param s the shape of the gradient. This is only used for its bounds.
@return the gradient. | [
"Create",
"the",
"gradient",
"for",
"the",
"left",
"of",
"a",
"rectangular",
"shadow",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/effect/SeaGlassInternalShadowEffect.java#L156-L164 |
eobermuhlner/big-math | ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigRational.java | BigRational.valueOf | public static BigRational valueOf(BigInteger numerator, BigInteger denominator) {
return of(new BigDecimal(numerator), new BigDecimal(denominator));
} | java | public static BigRational valueOf(BigInteger numerator, BigInteger denominator) {
return of(new BigDecimal(numerator), new BigDecimal(denominator));
} | [
"public",
"static",
"BigRational",
"valueOf",
"(",
"BigInteger",
"numerator",
",",
"BigInteger",
"denominator",
")",
"{",
"return",
"of",
"(",
"new",
"BigDecimal",
"(",
"numerator",
")",
",",
"new",
"BigDecimal",
"(",
"denominator",
")",
")",
";",
"}"
] | Creates a rational number of the specified numerator/denominator BigInteger values.
@param numerator the numerator {@link BigInteger} value
@param denominator the denominator {@link BigInteger} value (0 not allowed)
@return the rational number
@throws ArithmeticException if the denominator is 0 (division by zero) | [
"Creates",
"a",
"rational",
"number",
"of",
"the",
"specified",
"numerator",
"/",
"denominator",
"BigInteger",
"values",
"."
] | train | https://github.com/eobermuhlner/big-math/blob/52c4fc334d0d722b295de740c1018ee400e3e8f2/ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigRational.java#L862-L864 |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/gui/overview/LayerMap.java | LayerMap.getVisualization | public Visualization getVisualization(PlotItem item, VisualizationTask task) {
Pair<Element, Visualization> pair = map.get(key(item, task));
return pair == null ? null : pair.second;
} | java | public Visualization getVisualization(PlotItem item, VisualizationTask task) {
Pair<Element, Visualization> pair = map.get(key(item, task));
return pair == null ? null : pair.second;
} | [
"public",
"Visualization",
"getVisualization",
"(",
"PlotItem",
"item",
",",
"VisualizationTask",
"task",
")",
"{",
"Pair",
"<",
"Element",
",",
"Visualization",
">",
"pair",
"=",
"map",
".",
"get",
"(",
"key",
"(",
"item",
",",
"task",
")",
")",
";",
"r... | Get the visualization referenced by a item/key combination.
@param item Plot ttem
@param task Visualization task
@return Visualization | [
"Get",
"the",
"visualization",
"referenced",
"by",
"a",
"item",
"/",
"key",
"combination",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/gui/overview/LayerMap.java#L76-L79 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java | NumberUtil.fromUnsignedByteArray | public static BigInteger fromUnsignedByteArray(byte[] buf, int off, int length) {
byte[] mag = buf;
if (off != 0 || length != buf.length) {
mag = new byte[length];
System.arraycopy(buf, off, mag, 0, length);
}
return new BigInteger(1, mag);
} | java | public static BigInteger fromUnsignedByteArray(byte[] buf, int off, int length) {
byte[] mag = buf;
if (off != 0 || length != buf.length) {
mag = new byte[length];
System.arraycopy(buf, off, mag, 0, length);
}
return new BigInteger(1, mag);
} | [
"public",
"static",
"BigInteger",
"fromUnsignedByteArray",
"(",
"byte",
"[",
"]",
"buf",
",",
"int",
"off",
",",
"int",
"length",
")",
"{",
"byte",
"[",
"]",
"mag",
"=",
"buf",
";",
"if",
"(",
"off",
"!=",
"0",
"||",
"length",
"!=",
"buf",
".",
"le... | 无符号bytes转{@link BigInteger}
@param buf 无符号bytes
@param off 起始位置
@param length 长度
@return {@link BigInteger} | [
"无符号bytes转",
"{",
"@link",
"BigInteger",
"}"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L2293-L2300 |
hdbeukel/james-core | src/main/java/org/jamesframework/core/search/cache/SingleEvaluatedMoveCache.java | SingleEvaluatedMoveCache.cacheMoveValidation | @Override
public final void cacheMoveValidation(Move<?> move, Validation validation) {
validatedMove = move;
this.validation = validation;
} | java | @Override
public final void cacheMoveValidation(Move<?> move, Validation validation) {
validatedMove = move;
this.validation = validation;
} | [
"@",
"Override",
"public",
"final",
"void",
"cacheMoveValidation",
"(",
"Move",
"<",
"?",
">",
"move",
",",
"Validation",
"validation",
")",
"{",
"validatedMove",
"=",
"move",
";",
"this",
".",
"validation",
"=",
"validation",
";",
"}"
] | Cache validation of the given move, discarding any previously cached value.
@param move move applied to the current solution
@param validation validation of obtained neighbour | [
"Cache",
"validation",
"of",
"the",
"given",
"move",
"discarding",
"any",
"previously",
"cached",
"value",
"."
] | train | https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/search/cache/SingleEvaluatedMoveCache.java#L89-L93 |
netty/netty | resolver-dns/src/main/java/io/netty/resolver/dns/UnixResolverDnsServerAddressStreamProvider.java | UnixResolverDnsServerAddressStreamProvider.parseSilently | static DnsServerAddressStreamProvider parseSilently() {
try {
UnixResolverDnsServerAddressStreamProvider nameServerCache =
new UnixResolverDnsServerAddressStreamProvider(ETC_RESOLV_CONF_FILE, ETC_RESOLVER_DIR);
return nameServerCache.mayOverrideNameServers() ? nameServerCache
: DefaultDnsServerAddressStreamProvider.INSTANCE;
} catch (Exception e) {
logger.debug("failed to parse {} and/or {}", ETC_RESOLV_CONF_FILE, ETC_RESOLVER_DIR, e);
return DefaultDnsServerAddressStreamProvider.INSTANCE;
}
} | java | static DnsServerAddressStreamProvider parseSilently() {
try {
UnixResolverDnsServerAddressStreamProvider nameServerCache =
new UnixResolverDnsServerAddressStreamProvider(ETC_RESOLV_CONF_FILE, ETC_RESOLVER_DIR);
return nameServerCache.mayOverrideNameServers() ? nameServerCache
: DefaultDnsServerAddressStreamProvider.INSTANCE;
} catch (Exception e) {
logger.debug("failed to parse {} and/or {}", ETC_RESOLV_CONF_FILE, ETC_RESOLVER_DIR, e);
return DefaultDnsServerAddressStreamProvider.INSTANCE;
}
} | [
"static",
"DnsServerAddressStreamProvider",
"parseSilently",
"(",
")",
"{",
"try",
"{",
"UnixResolverDnsServerAddressStreamProvider",
"nameServerCache",
"=",
"new",
"UnixResolverDnsServerAddressStreamProvider",
"(",
"ETC_RESOLV_CONF_FILE",
",",
"ETC_RESOLVER_DIR",
")",
";",
"re... | Attempt to parse {@code /etc/resolv.conf} and files in the {@code /etc/resolver} directory by default.
A failure to parse will return {@link DefaultDnsServerAddressStreamProvider}. | [
"Attempt",
"to",
"parse",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/resolver-dns/src/main/java/io/netty/resolver/dns/UnixResolverDnsServerAddressStreamProvider.java#L68-L78 |
knowm/XChart | xchart/src/main/java/org/knowm/xchart/internal/chartpart/Legend_.java | Legend_.getSeriesTextBounds | Map<String, Rectangle2D> getSeriesTextBounds(S series) {
// FontMetrics fontMetrics = g.getFontMetrics(getChartPainter().getstyler().getLegendFont());
// float fontDescent = fontMetrics.getDescent();
String lines[] = series.getName().split("\\n");
Map<String, Rectangle2D> seriesTextBounds =
new LinkedHashMap<String, Rectangle2D>(lines.length);
for (String line : lines) {
TextLayout textLayout =
new TextLayout(
line, chart.getStyler().getLegendFont(), new FontRenderContext(null, true, false));
Shape shape = textLayout.getOutline(null);
Rectangle2D bounds = shape.getBounds2D();
// System.out.println(tl.getAscent());
// System.out.println(tl.getDescent());
// System.out.println(tl.getBounds());
// seriesTextBounds.put(line, new Rectangle2D.Double(bounds.getX(), bounds.getY(),
// bounds.getWidth(), bounds.getHeight() - tl.getDescent()));
// seriesTextBounds.put(line, new Rectangle2D.Double(bounds.getX(), bounds.getY(),
// bounds.getWidth(), tl.getAscent()));
seriesTextBounds.put(line, bounds);
}
return seriesTextBounds;
} | java | Map<String, Rectangle2D> getSeriesTextBounds(S series) {
// FontMetrics fontMetrics = g.getFontMetrics(getChartPainter().getstyler().getLegendFont());
// float fontDescent = fontMetrics.getDescent();
String lines[] = series.getName().split("\\n");
Map<String, Rectangle2D> seriesTextBounds =
new LinkedHashMap<String, Rectangle2D>(lines.length);
for (String line : lines) {
TextLayout textLayout =
new TextLayout(
line, chart.getStyler().getLegendFont(), new FontRenderContext(null, true, false));
Shape shape = textLayout.getOutline(null);
Rectangle2D bounds = shape.getBounds2D();
// System.out.println(tl.getAscent());
// System.out.println(tl.getDescent());
// System.out.println(tl.getBounds());
// seriesTextBounds.put(line, new Rectangle2D.Double(bounds.getX(), bounds.getY(),
// bounds.getWidth(), bounds.getHeight() - tl.getDescent()));
// seriesTextBounds.put(line, new Rectangle2D.Double(bounds.getX(), bounds.getY(),
// bounds.getWidth(), tl.getAscent()));
seriesTextBounds.put(line, bounds);
}
return seriesTextBounds;
} | [
"Map",
"<",
"String",
",",
"Rectangle2D",
">",
"getSeriesTextBounds",
"(",
"S",
"series",
")",
"{",
"// FontMetrics fontMetrics = g.getFontMetrics(getChartPainter().getstyler().getLegendFont());",
"// float fontDescent = fontMetrics.getDescent();",
"String",
"lines",
"[",
"]",
"=... | Normally each legend entry just has one line of text, but it can be made multi-line by adding
"\\n". This method returns a Map for each single legend entry, which is normally just a Map
with one single entry.
@param series
@return | [
"Normally",
"each",
"legend",
"entry",
"just",
"has",
"one",
"line",
"of",
"text",
"but",
"it",
"can",
"be",
"made",
"multi",
"-",
"line",
"by",
"adding",
"\\\\",
"n",
".",
"This",
"method",
"returns",
"a",
"Map",
"for",
"each",
"single",
"legend",
"en... | train | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/internal/chartpart/Legend_.java#L289-L313 |
google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/libcore/util/BasicLruCache.java | BasicLruCache.put | public synchronized final V put(K key, V value) {
if (key == null) {
throw new NullPointerException("key == null");
} else if (value == null) {
throw new NullPointerException("value == null");
}
V previous = map.put(key, value);
trimToSize(maxSize);
return previous;
} | java | public synchronized final V put(K key, V value) {
if (key == null) {
throw new NullPointerException("key == null");
} else if (value == null) {
throw new NullPointerException("value == null");
}
V previous = map.put(key, value);
trimToSize(maxSize);
return previous;
} | [
"public",
"synchronized",
"final",
"V",
"put",
"(",
"K",
"key",
",",
"V",
"value",
")",
"{",
"if",
"(",
"key",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"key == null\"",
")",
";",
"}",
"else",
"if",
"(",
"value",
"==",
"n... | Caches {@code value} for {@code key}. The value is moved to the head of
the queue.
@return the previous value mapped by {@code key}. Although that entry is
no longer cached, it has not been passed to {@link #entryEvicted}. | [
"Caches",
"{",
"@code",
"value",
"}",
"for",
"{",
"@code",
"key",
"}",
".",
"The",
"value",
"is",
"moved",
"to",
"the",
"head",
"of",
"the",
"queue",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/libcore/util/BasicLruCache.java#L71-L81 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/font/GlyphPage.java | GlyphPage.renderGlyph | private void renderGlyph(Glyph glyph, int width, int height) throws SlickException {
// Draw the glyph to the scratch image using Java2D.
scratchGraphics.setComposite(AlphaComposite.Clear);
scratchGraphics.fillRect(0, 0, MAX_GLYPH_SIZE, MAX_GLYPH_SIZE);
scratchGraphics.setComposite(AlphaComposite.SrcOver);
scratchGraphics.setColor(java.awt.Color.white);
for (Iterator iter = unicodeFont.getEffects().iterator(); iter.hasNext();)
((Effect)iter.next()).draw(scratchImage, scratchGraphics, unicodeFont, glyph);
glyph.setShape(null); // The shape will never be needed again.
WritableRaster raster = scratchImage.getRaster();
int[] row = new int[width];
for (int y = 0; y < height; y++) {
raster.getDataElements(0, y, width, 1, row);
scratchIntBuffer.put(row);
}
GL.glTexSubImage2D(SGL.GL_TEXTURE_2D, 0, pageX, pageY, width, height, SGL.GL_BGRA, SGL.GL_UNSIGNED_BYTE,
scratchByteBuffer);
scratchIntBuffer.clear();
glyph.setImage(pageImage.getSubImage(pageX, pageY, width, height));
} | java | private void renderGlyph(Glyph glyph, int width, int height) throws SlickException {
// Draw the glyph to the scratch image using Java2D.
scratchGraphics.setComposite(AlphaComposite.Clear);
scratchGraphics.fillRect(0, 0, MAX_GLYPH_SIZE, MAX_GLYPH_SIZE);
scratchGraphics.setComposite(AlphaComposite.SrcOver);
scratchGraphics.setColor(java.awt.Color.white);
for (Iterator iter = unicodeFont.getEffects().iterator(); iter.hasNext();)
((Effect)iter.next()).draw(scratchImage, scratchGraphics, unicodeFont, glyph);
glyph.setShape(null); // The shape will never be needed again.
WritableRaster raster = scratchImage.getRaster();
int[] row = new int[width];
for (int y = 0; y < height; y++) {
raster.getDataElements(0, y, width, 1, row);
scratchIntBuffer.put(row);
}
GL.glTexSubImage2D(SGL.GL_TEXTURE_2D, 0, pageX, pageY, width, height, SGL.GL_BGRA, SGL.GL_UNSIGNED_BYTE,
scratchByteBuffer);
scratchIntBuffer.clear();
glyph.setImage(pageImage.getSubImage(pageX, pageY, width, height));
} | [
"private",
"void",
"renderGlyph",
"(",
"Glyph",
"glyph",
",",
"int",
"width",
",",
"int",
"height",
")",
"throws",
"SlickException",
"{",
"// Draw the glyph to the scratch image using Java2D.\r",
"scratchGraphics",
".",
"setComposite",
"(",
"AlphaComposite",
".",
"Clear... | Loads a single glyph to the backing texture, if it fits.
@param glyph The glyph to be rendered
@param width The expected width of the glyph
@param height The expected height of the glyph
@throws SlickException if the glyph could not be rendered. | [
"Loads",
"a",
"single",
"glyph",
"to",
"the",
"backing",
"texture",
"if",
"it",
"fits",
"."
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/font/GlyphPage.java#L196-L217 |
zaproxy/zaproxy | src/org/zaproxy/zap/spider/URLCanonicalizer.java | URLCanonicalizer.buildCleanedParametersURIRepresentation | public static String buildCleanedParametersURIRepresentation(org.apache.commons.httpclient.URI uri,
SpiderParam.HandleParametersOption handleParameters, boolean handleODataParametersVisited) throws URIException {
// If the option is set to use all the information, just use the default string representation
if (handleParameters.equals(HandleParametersOption.USE_ALL)) {
return uri.toString();
}
// If the option is set to ignore parameters completely, ignore the query completely
if (handleParameters.equals(HandleParametersOption.IGNORE_COMPLETELY)) {
return createBaseUriWithCleanedPath(uri, handleParameters, handleODataParametersVisited);
}
// If the option is set to ignore the value, we get the parameters and we only add their name to the
// query
if (handleParameters.equals(HandleParametersOption.IGNORE_VALUE)) {
StringBuilder retVal = new StringBuilder(
createBaseUriWithCleanedPath(uri, handleParameters, handleODataParametersVisited));
String cleanedQuery = getCleanedQuery(uri.getEscapedQuery());
// Add the parameters' names to the uri representation.
if(cleanedQuery.length()>0) {
retVal.append('?').append(cleanedQuery);
}
return retVal.toString();
}
// Should not be reached
return uri.toString();
} | java | public static String buildCleanedParametersURIRepresentation(org.apache.commons.httpclient.URI uri,
SpiderParam.HandleParametersOption handleParameters, boolean handleODataParametersVisited) throws URIException {
// If the option is set to use all the information, just use the default string representation
if (handleParameters.equals(HandleParametersOption.USE_ALL)) {
return uri.toString();
}
// If the option is set to ignore parameters completely, ignore the query completely
if (handleParameters.equals(HandleParametersOption.IGNORE_COMPLETELY)) {
return createBaseUriWithCleanedPath(uri, handleParameters, handleODataParametersVisited);
}
// If the option is set to ignore the value, we get the parameters and we only add their name to the
// query
if (handleParameters.equals(HandleParametersOption.IGNORE_VALUE)) {
StringBuilder retVal = new StringBuilder(
createBaseUriWithCleanedPath(uri, handleParameters, handleODataParametersVisited));
String cleanedQuery = getCleanedQuery(uri.getEscapedQuery());
// Add the parameters' names to the uri representation.
if(cleanedQuery.length()>0) {
retVal.append('?').append(cleanedQuery);
}
return retVal.toString();
}
// Should not be reached
return uri.toString();
} | [
"public",
"static",
"String",
"buildCleanedParametersURIRepresentation",
"(",
"org",
".",
"apache",
".",
"commons",
".",
"httpclient",
".",
"URI",
"uri",
",",
"SpiderParam",
".",
"HandleParametersOption",
"handleParameters",
",",
"boolean",
"handleODataParametersVisited",... | Builds a String representation of the URI with cleaned parameters, that can be used when checking if an
URI was already visited. The URI provided as a parameter should be already cleaned and canonicalized,
so it should be build with a result from {@link #getCanonicalURL(String)}.
<p>
When building the URI representation, the same format should be used for all the cases, as it may
affect the number of times the pages are visited and reported if the option HandleParametersOption is
changed while the spider is running.
</p>
@param uri the uri
@param handleParameters the handle parameters option
@param handleODataParametersVisited Should we handle specific OData parameters
@return the string representation of the URI
@throws URIException the URI exception | [
"Builds",
"a",
"String",
"representation",
"of",
"the",
"URI",
"with",
"cleaned",
"parameters",
"that",
"can",
"be",
"used",
"when",
"checking",
"if",
"an",
"URI",
"was",
"already",
"visited",
".",
"The",
"URI",
"provided",
"as",
"a",
"parameter",
"should",
... | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/spider/URLCanonicalizer.java#L222-L252 |
realtime-framework/RealtimeMessaging-Java | library/src/main/java/ibt/ortc/api/Strings.java | Strings.randomString | public static String randomString(int length) {
// CAUSE: If-Else Statements Should Use Braces
if (length < 1) {
throw new IllegalArgumentException(String.format("length < 1: %s", length));
}
char[] buf = new char[length];
return nextString(buf);
} | java | public static String randomString(int length) {
// CAUSE: If-Else Statements Should Use Braces
if (length < 1) {
throw new IllegalArgumentException(String.format("length < 1: %s", length));
}
char[] buf = new char[length];
return nextString(buf);
} | [
"public",
"static",
"String",
"randomString",
"(",
"int",
"length",
")",
"{",
"// CAUSE: If-Else Statements Should Use Braces",
"if",
"(",
"length",
"<",
"1",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"length < 1: %s\... | Generates a random alphanumeric string
@param length Number of characters the random string contains
@return String with the specified length | [
"Generates",
"a",
"random",
"alphanumeric",
"string"
] | train | https://github.com/realtime-framework/RealtimeMessaging-Java/blob/cae0dfd01567a2d9e55a0849c0c9b09ad4b2cc08/library/src/main/java/ibt/ortc/api/Strings.java#L49-L58 |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.checkAssert | private Environment checkAssert(Stmt.Assert stmt, Environment environment, EnclosingScope scope) {
return checkCondition(stmt.getCondition(), true, environment);
} | java | private Environment checkAssert(Stmt.Assert stmt, Environment environment, EnclosingScope scope) {
return checkCondition(stmt.getCondition(), true, environment);
} | [
"private",
"Environment",
"checkAssert",
"(",
"Stmt",
".",
"Assert",
"stmt",
",",
"Environment",
"environment",
",",
"EnclosingScope",
"scope",
")",
"{",
"return",
"checkCondition",
"(",
"stmt",
".",
"getCondition",
"(",
")",
",",
"true",
",",
"environment",
"... | Type check an assertion statement. This requires checking that the expression
being asserted is well-formed and has boolean type. An assert statement can
affect the resulting environment in certain cases, such as when a type test
is assert. For example, after <code>assert x is int</code> the environment
will regard <code>x</code> as having type <code>int</code>.
@param stmt
Statement to type check
@param environment
Determines the type of all variables immediately going into this
block
@return | [
"Type",
"check",
"an",
"assertion",
"statement",
".",
"This",
"requires",
"checking",
"that",
"the",
"expression",
"being",
"asserted",
"is",
"well",
"-",
"formed",
"and",
"has",
"boolean",
"type",
".",
"An",
"assert",
"statement",
"can",
"affect",
"the",
"r... | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L353-L355 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/InboundNatRulesInner.java | InboundNatRulesInner.createOrUpdateAsync | public Observable<InboundNatRuleInner> createOrUpdateAsync(String resourceGroupName, String loadBalancerName, String inboundNatRuleName, InboundNatRuleInner inboundNatRuleParameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, loadBalancerName, inboundNatRuleName, inboundNatRuleParameters).map(new Func1<ServiceResponse<InboundNatRuleInner>, InboundNatRuleInner>() {
@Override
public InboundNatRuleInner call(ServiceResponse<InboundNatRuleInner> response) {
return response.body();
}
});
} | java | public Observable<InboundNatRuleInner> createOrUpdateAsync(String resourceGroupName, String loadBalancerName, String inboundNatRuleName, InboundNatRuleInner inboundNatRuleParameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, loadBalancerName, inboundNatRuleName, inboundNatRuleParameters).map(new Func1<ServiceResponse<InboundNatRuleInner>, InboundNatRuleInner>() {
@Override
public InboundNatRuleInner call(ServiceResponse<InboundNatRuleInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"InboundNatRuleInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"loadBalancerName",
",",
"String",
"inboundNatRuleName",
",",
"InboundNatRuleInner",
"inboundNatRuleParameters",
")",
"{",
"return",
"createOrU... | Creates or updates a load balancer inbound nat rule.
@param resourceGroupName The name of the resource group.
@param loadBalancerName The name of the load balancer.
@param inboundNatRuleName The name of the inbound nat rule.
@param inboundNatRuleParameters Parameters supplied to the create or update inbound nat rule operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Creates",
"or",
"updates",
"a",
"load",
"balancer",
"inbound",
"nat",
"rule",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/InboundNatRulesInner.java#L601-L608 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/CommonMpJwtFat.java | CommonMpJwtFat.setBadIssuerExpectations | public Expectations setBadIssuerExpectations(LibertyServer server) throws Exception {
Expectations expectations = new Expectations();
expectations.addExpectation(new ResponseStatusExpectation(HttpServletResponse.SC_UNAUTHORIZED));
expectations.addExpectation(new ServerMessageExpectation(server, MpJwtMessageConstants.CWWKS5523E_ERROR_CREATING_JWT_USING_TOKEN_IN_REQ, "Messagelog did not contain an error indicating a problem authenticating the request with the provided token."));
expectations.addExpectation(new ServerMessageExpectation(server, MpJwtMessageConstants.CWWKS6022E_ISSUER_NOT_TRUSTED, "Messagelog did not contain an exception indicating that the issuer is NOT valid."));
return expectations;
} | java | public Expectations setBadIssuerExpectations(LibertyServer server) throws Exception {
Expectations expectations = new Expectations();
expectations.addExpectation(new ResponseStatusExpectation(HttpServletResponse.SC_UNAUTHORIZED));
expectations.addExpectation(new ServerMessageExpectation(server, MpJwtMessageConstants.CWWKS5523E_ERROR_CREATING_JWT_USING_TOKEN_IN_REQ, "Messagelog did not contain an error indicating a problem authenticating the request with the provided token."));
expectations.addExpectation(new ServerMessageExpectation(server, MpJwtMessageConstants.CWWKS6022E_ISSUER_NOT_TRUSTED, "Messagelog did not contain an exception indicating that the issuer is NOT valid."));
return expectations;
} | [
"public",
"Expectations",
"setBadIssuerExpectations",
"(",
"LibertyServer",
"server",
")",
"throws",
"Exception",
"{",
"Expectations",
"expectations",
"=",
"new",
"Expectations",
"(",
")",
";",
"expectations",
".",
"addExpectation",
"(",
"new",
"ResponseStatusExpectatio... | Set expectations for tests that have bad issuers
@return Expectations
@throws Exception | [
"Set",
"expectations",
"for",
"tests",
"that",
"have",
"bad",
"issuers"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/CommonMpJwtFat.java#L300-L310 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/SnapshotInfo.java | SnapshotInfo.of | public static SnapshotInfo of(SnapshotId snapshotId, DiskId source) {
return newBuilder(snapshotId, source).build();
} | java | public static SnapshotInfo of(SnapshotId snapshotId, DiskId source) {
return newBuilder(snapshotId, source).build();
} | [
"public",
"static",
"SnapshotInfo",
"of",
"(",
"SnapshotId",
"snapshotId",
",",
"DiskId",
"source",
")",
"{",
"return",
"newBuilder",
"(",
"snapshotId",
",",
"source",
")",
".",
"build",
"(",
")",
";",
"}"
] | Returns a {@code SnapshotInfo} object given the snapshot identity and a source disk identity. | [
"Returns",
"a",
"{"
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/SnapshotInfo.java#L451-L453 |
alkacon/opencms-core | src/org/opencms/workplace/CmsWorkplaceUserInfoBlock.java | CmsWorkplaceUserInfoBlock.addEntry | public void addEntry(String key, String type, String widget, String params, String optional) {
m_entries.add(new CmsWorkplaceUserInfoEntry(key, type, widget, params, optional));
} | java | public void addEntry(String key, String type, String widget, String params, String optional) {
m_entries.add(new CmsWorkplaceUserInfoEntry(key, type, widget, params, optional));
} | [
"public",
"void",
"addEntry",
"(",
"String",
"key",
",",
"String",
"type",
",",
"String",
"widget",
",",
"String",
"params",
",",
"String",
"optional",
")",
"{",
"m_entries",
".",
"add",
"(",
"new",
"CmsWorkplaceUserInfoEntry",
"(",
"key",
",",
"type",
","... | Creates a new entry.<p>
@param key the additional information key
@param type the class name of the stored data type
@param widget the widget class name
@param params the widget parameters
@param optional if optional | [
"Creates",
"a",
"new",
"entry",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsWorkplaceUserInfoBlock.java#L63-L66 |
graknlabs/grakn | server/src/server/kb/concept/ElementFactory.java | ElementFactory.addVertexElement | public VertexElement addVertexElement(Schema.BaseType baseType) {
Vertex vertex = graph.addVertex(baseType.name());
return new VertexElement(tx, vertex);
} | java | public VertexElement addVertexElement(Schema.BaseType baseType) {
Vertex vertex = graph.addVertex(baseType.name());
return new VertexElement(tx, vertex);
} | [
"public",
"VertexElement",
"addVertexElement",
"(",
"Schema",
".",
"BaseType",
"baseType",
")",
"{",
"Vertex",
"vertex",
"=",
"graph",
".",
"addVertex",
"(",
"baseType",
".",
"name",
"(",
")",
")",
";",
"return",
"new",
"VertexElement",
"(",
"tx",
",",
"ve... | Creates a new Vertex in the graph and builds a VertexElement which wraps the newly created vertex
@param baseType The Schema.BaseType
@return a new VertexElement | [
"Creates",
"a",
"new",
"Vertex",
"in",
"the",
"graph",
"and",
"builds",
"a",
"VertexElement",
"which",
"wraps",
"the",
"newly",
"created",
"vertex"
] | train | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/kb/concept/ElementFactory.java#L308-L311 |
jenkinsci/jenkins | core/src/main/java/hudson/util/ByteBuffer.java | ByteBuffer.newInputStream | public InputStream newInputStream() {
return new InputStream() {
private int pos = 0;
public int read() throws IOException {
synchronized(ByteBuffer.this) {
if(pos>=size) return -1;
return buf[pos++];
}
}
public int read(byte[] b, int off, int len) throws IOException {
synchronized(ByteBuffer.this) {
if(size==pos)
return -1;
int sz = Math.min(len,size-pos);
System.arraycopy(buf,pos,b,off,sz);
pos+=sz;
return sz;
}
}
public int available() throws IOException {
synchronized(ByteBuffer.this) {
return size-pos;
}
}
public long skip(long n) throws IOException {
synchronized(ByteBuffer.this) {
int diff = (int) Math.min(n,size-pos);
pos+=diff;
return diff;
}
}
};
} | java | public InputStream newInputStream() {
return new InputStream() {
private int pos = 0;
public int read() throws IOException {
synchronized(ByteBuffer.this) {
if(pos>=size) return -1;
return buf[pos++];
}
}
public int read(byte[] b, int off, int len) throws IOException {
synchronized(ByteBuffer.this) {
if(size==pos)
return -1;
int sz = Math.min(len,size-pos);
System.arraycopy(buf,pos,b,off,sz);
pos+=sz;
return sz;
}
}
public int available() throws IOException {
synchronized(ByteBuffer.this) {
return size-pos;
}
}
public long skip(long n) throws IOException {
synchronized(ByteBuffer.this) {
int diff = (int) Math.min(n,size-pos);
pos+=diff;
return diff;
}
}
};
} | [
"public",
"InputStream",
"newInputStream",
"(",
")",
"{",
"return",
"new",
"InputStream",
"(",
")",
"{",
"private",
"int",
"pos",
"=",
"0",
";",
"public",
"int",
"read",
"(",
")",
"throws",
"IOException",
"{",
"synchronized",
"(",
"ByteBuffer",
".",
"this"... | Creates an {@link InputStream} that reads from the underlying buffer. | [
"Creates",
"an",
"{"
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/ByteBuffer.java#L87-L124 |
Azure/azure-sdk-for-java | sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/EncryptionProtectorsInner.java | EncryptionProtectorsInner.createOrUpdateAsync | public Observable<EncryptionProtectorInner> createOrUpdateAsync(String resourceGroupName, String serverName, EncryptionProtectorInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1<ServiceResponse<EncryptionProtectorInner>, EncryptionProtectorInner>() {
@Override
public EncryptionProtectorInner call(ServiceResponse<EncryptionProtectorInner> response) {
return response.body();
}
});
} | java | public Observable<EncryptionProtectorInner> createOrUpdateAsync(String resourceGroupName, String serverName, EncryptionProtectorInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1<ServiceResponse<EncryptionProtectorInner>, EncryptionProtectorInner>() {
@Override
public EncryptionProtectorInner call(ServiceResponse<EncryptionProtectorInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"EncryptionProtectorInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"EncryptionProtectorInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGro... | Updates an existing encryption protector.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param parameters The requested encryption protector resource state.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Updates",
"an",
"existing",
"encryption",
"protector",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/EncryptionProtectorsInner.java#L333-L340 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/util/CmsDomUtil.java | CmsDomUtil.generateHiddenForm | public static FormElement generateHiddenForm(
String action,
Method method,
Target target,
Map<String, String> values) {
return generateHiddenForm(action, method, target.getRepresentation(), values);
} | java | public static FormElement generateHiddenForm(
String action,
Method method,
Target target,
Map<String, String> values) {
return generateHiddenForm(action, method, target.getRepresentation(), values);
} | [
"public",
"static",
"FormElement",
"generateHiddenForm",
"(",
"String",
"action",
",",
"Method",
"method",
",",
"Target",
"target",
",",
"Map",
"<",
"String",
",",
"String",
">",
"values",
")",
"{",
"return",
"generateHiddenForm",
"(",
"action",
",",
"method",... | Generates a form element with hidden input fields.<p>
@param action the form action
@param method the form method
@param target the form target
@param values the input values
@return the generated form element | [
"Generates",
"a",
"form",
"element",
"with",
"hidden",
"input",
"fields",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/util/CmsDomUtil.java#L1095-L1102 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XStringForFSB.java | XStringForFSB.getChars | public void getChars(int srcBegin, int srcEnd, char dst[], int dstBegin)
{
// %OPT% Need to call this on FSB when it is implemented.
// %UNTESTED% (I don't think anyone calls this yet?)
int n = srcEnd - srcBegin;
if (n > m_length)
n = m_length;
if (n > (dst.length - dstBegin))
n = (dst.length - dstBegin);
int end = srcBegin + m_start + n;
int d = dstBegin;
FastStringBuffer fsb = fsb();
for (int i = srcBegin + m_start; i < end; i++)
{
dst[d++] = fsb.charAt(i);
}
} | java | public void getChars(int srcBegin, int srcEnd, char dst[], int dstBegin)
{
// %OPT% Need to call this on FSB when it is implemented.
// %UNTESTED% (I don't think anyone calls this yet?)
int n = srcEnd - srcBegin;
if (n > m_length)
n = m_length;
if (n > (dst.length - dstBegin))
n = (dst.length - dstBegin);
int end = srcBegin + m_start + n;
int d = dstBegin;
FastStringBuffer fsb = fsb();
for (int i = srcBegin + m_start; i < end; i++)
{
dst[d++] = fsb.charAt(i);
}
} | [
"public",
"void",
"getChars",
"(",
"int",
"srcBegin",
",",
"int",
"srcEnd",
",",
"char",
"dst",
"[",
"]",
",",
"int",
"dstBegin",
")",
"{",
"// %OPT% Need to call this on FSB when it is implemented.",
"// %UNTESTED% (I don't think anyone calls this yet?)",
"int",
"n",
"... | Copies characters from this string into the destination character
array.
@param srcBegin index of the first character in the string
to copy.
@param srcEnd index after the last character in the string
to copy.
@param dst the destination array.
@param dstBegin the start offset in the destination array.
@exception IndexOutOfBoundsException If any of the following
is true:
<ul><li><code>srcBegin</code> is negative.
<li><code>srcBegin</code> is greater than <code>srcEnd</code>
<li><code>srcEnd</code> is greater than the length of this
string
<li><code>dstBegin</code> is negative
<li><code>dstBegin+(srcEnd-srcBegin)</code> is larger than
<code>dst.length</code></ul>
@exception NullPointerException if <code>dst</code> is <code>null</code> | [
"Copies",
"characters",
"from",
"this",
"string",
"into",
"the",
"destination",
"character",
"array",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XStringForFSB.java#L252-L273 |
zaproxy/zaproxy | src/org/zaproxy/zap/extension/authorization/BasicAuthorizationDetectionMethod.java | BasicAuthorizationDetectionMethod.loadMethodFromSession | public static BasicAuthorizationDetectionMethod loadMethodFromSession(Session session, int contextId)
throws DatabaseException {
int statusCode = NO_STATUS_CODE;
try {
List<String> statusCodeL = session.getContextDataStrings(contextId,
RecordContext.TYPE_AUTHORIZATION_METHOD_FIELD_1);
statusCode = Integer.parseInt(statusCodeL.get(0));
} catch (NullPointerException | IndexOutOfBoundsException | NumberFormatException ex) {
// There was no valid data so use the defaults
}
String headerRegex = null;
try {
List<String> loadedData = session.getContextDataStrings(contextId,
RecordContext.TYPE_AUTHORIZATION_METHOD_FIELD_2);
headerRegex = loadedData.get(0);
} catch (NullPointerException | IndexOutOfBoundsException ex) {
// There was no valid data so use the defaults
}
String bodyRegex = null;
try {
List<String> loadedData = session.getContextDataStrings(contextId,
RecordContext.TYPE_AUTHORIZATION_METHOD_FIELD_3);
bodyRegex = loadedData.get(0);
} catch (NullPointerException | IndexOutOfBoundsException ex) {
// There was no valid data so use the defaults
}
LogicalOperator operator = LogicalOperator.OR;
try {
List<String> loadedData = session.getContextDataStrings(contextId,
RecordContext.TYPE_AUTHORIZATION_METHOD_FIELD_4);
operator = LogicalOperator.valueOf(loadedData.get(0));
} catch (NullPointerException | IndexOutOfBoundsException | IllegalArgumentException ex) {
// There was no valid data so use the defaults
}
return new BasicAuthorizationDetectionMethod(statusCode, headerRegex, bodyRegex, operator);
} | java | public static BasicAuthorizationDetectionMethod loadMethodFromSession(Session session, int contextId)
throws DatabaseException {
int statusCode = NO_STATUS_CODE;
try {
List<String> statusCodeL = session.getContextDataStrings(contextId,
RecordContext.TYPE_AUTHORIZATION_METHOD_FIELD_1);
statusCode = Integer.parseInt(statusCodeL.get(0));
} catch (NullPointerException | IndexOutOfBoundsException | NumberFormatException ex) {
// There was no valid data so use the defaults
}
String headerRegex = null;
try {
List<String> loadedData = session.getContextDataStrings(contextId,
RecordContext.TYPE_AUTHORIZATION_METHOD_FIELD_2);
headerRegex = loadedData.get(0);
} catch (NullPointerException | IndexOutOfBoundsException ex) {
// There was no valid data so use the defaults
}
String bodyRegex = null;
try {
List<String> loadedData = session.getContextDataStrings(contextId,
RecordContext.TYPE_AUTHORIZATION_METHOD_FIELD_3);
bodyRegex = loadedData.get(0);
} catch (NullPointerException | IndexOutOfBoundsException ex) {
// There was no valid data so use the defaults
}
LogicalOperator operator = LogicalOperator.OR;
try {
List<String> loadedData = session.getContextDataStrings(contextId,
RecordContext.TYPE_AUTHORIZATION_METHOD_FIELD_4);
operator = LogicalOperator.valueOf(loadedData.get(0));
} catch (NullPointerException | IndexOutOfBoundsException | IllegalArgumentException ex) {
// There was no valid data so use the defaults
}
return new BasicAuthorizationDetectionMethod(statusCode, headerRegex, bodyRegex, operator);
} | [
"public",
"static",
"BasicAuthorizationDetectionMethod",
"loadMethodFromSession",
"(",
"Session",
"session",
",",
"int",
"contextId",
")",
"throws",
"DatabaseException",
"{",
"int",
"statusCode",
"=",
"NO_STATUS_CODE",
";",
"try",
"{",
"List",
"<",
"String",
">",
"s... | Creates a {@link BasicAuthorizationDetectionMethod} object based on data loaded from the
session database for a given context. For proper results, data should have been saved to the
session using the {@link #persistMethodToSession(Session, int)} method.
@throws DatabaseException if an error occurred while reading from the database | [
"Creates",
"a",
"{",
"@link",
"BasicAuthorizationDetectionMethod",
"}",
"object",
"based",
"on",
"data",
"loaded",
"from",
"the",
"session",
"database",
"for",
"a",
"given",
"context",
".",
"For",
"proper",
"results",
"data",
"should",
"have",
"been",
"saved",
... | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/authorization/BasicAuthorizationDetectionMethod.java#L154-L194 |
voldemort/voldemort | src/java/voldemort/store/readonly/StoreVersionManager.java | StoreVersionManager.getDisabledMarkerFile | private File getDisabledMarkerFile(long version) throws PersistenceFailureException {
File[] versionDirArray = ReadOnlyUtils.getVersionDirs(rootDir, version, version);
if (versionDirArray.length == 0) {
throw new PersistenceFailureException("getDisabledMarkerFile did not find the requested version directory" +
" on disk. Version: " + version + ", rootDir: " + rootDir);
}
File disabledMarkerFile = new File(versionDirArray[0], DISABLED_MARKER_NAME);
return disabledMarkerFile;
} | java | private File getDisabledMarkerFile(long version) throws PersistenceFailureException {
File[] versionDirArray = ReadOnlyUtils.getVersionDirs(rootDir, version, version);
if (versionDirArray.length == 0) {
throw new PersistenceFailureException("getDisabledMarkerFile did not find the requested version directory" +
" on disk. Version: " + version + ", rootDir: " + rootDir);
}
File disabledMarkerFile = new File(versionDirArray[0], DISABLED_MARKER_NAME);
return disabledMarkerFile;
} | [
"private",
"File",
"getDisabledMarkerFile",
"(",
"long",
"version",
")",
"throws",
"PersistenceFailureException",
"{",
"File",
"[",
"]",
"versionDirArray",
"=",
"ReadOnlyUtils",
".",
"getVersionDirs",
"(",
"rootDir",
",",
"version",
",",
"version",
")",
";",
"if",... | Gets the '.disabled' file for a given version of this store. That file may or may not
exist.
@param version of the store for which to get the '.disabled' file.
@return an instance of {@link File} pointing to the '.disabled' file.
@throws PersistenceFailureException if the requested version cannot be found. | [
"Gets",
"the",
".",
"disabled",
"file",
"for",
"a",
"given",
"version",
"of",
"this",
"store",
".",
"That",
"file",
"may",
"or",
"may",
"not",
"exist",
"."
] | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/readonly/StoreVersionManager.java#L244-L252 |
aws/aws-sdk-java | aws-java-sdk-marketplacecommerceanalytics/src/main/java/com/amazonaws/services/marketplacecommerceanalytics/model/GenerateDataSetRequest.java | GenerateDataSetRequest.withCustomerDefinedValues | public GenerateDataSetRequest withCustomerDefinedValues(java.util.Map<String, String> customerDefinedValues) {
setCustomerDefinedValues(customerDefinedValues);
return this;
} | java | public GenerateDataSetRequest withCustomerDefinedValues(java.util.Map<String, String> customerDefinedValues) {
setCustomerDefinedValues(customerDefinedValues);
return this;
} | [
"public",
"GenerateDataSetRequest",
"withCustomerDefinedValues",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"customerDefinedValues",
")",
"{",
"setCustomerDefinedValues",
"(",
"customerDefinedValues",
")",
";",
"return",
"this",
";",
"}... | (Optional) Key-value pairs which will be returned, unmodified, in the Amazon SNS notification message and the
data set metadata file. These key-value pairs can be used to correlated responses with tracking information from
other systems.
@param customerDefinedValues
(Optional) Key-value pairs which will be returned, unmodified, in the Amazon SNS notification message and
the data set metadata file. These key-value pairs can be used to correlated responses with tracking
information from other systems.
@return Returns a reference to this object so that method calls can be chained together. | [
"(",
"Optional",
")",
"Key",
"-",
"value",
"pairs",
"which",
"will",
"be",
"returned",
"unmodified",
"in",
"the",
"Amazon",
"SNS",
"notification",
"message",
"and",
"the",
"data",
"set",
"metadata",
"file",
".",
"These",
"key",
"-",
"value",
"pairs",
"can"... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-marketplacecommerceanalytics/src/main/java/com/amazonaws/services/marketplacecommerceanalytics/model/GenerateDataSetRequest.java#L1931-L1934 |
RestComm/media-core | rtp/src/main/java/org/restcomm/media/core/rtp/channels/MediaChannel.java | MediaChannel.enableICE | public void enableICE(String externalAddress, boolean rtcpMux) {
if (!this.ice) {
this.ice = true;
this.rtcpMux = rtcpMux;
this.iceAuthenticator.generateIceCredentials();
// Enable ICE on RTP channels
this.rtpChannel.enableIce(this.iceAuthenticator);
if(!rtcpMux) {
this.rtcpChannel.enableIce(this.iceAuthenticator);
}
if (logger.isDebugEnabled()) {
logger.debug(this.mediaType + " channel " + this.ssrc + " enabled ICE");
}
}
} | java | public void enableICE(String externalAddress, boolean rtcpMux) {
if (!this.ice) {
this.ice = true;
this.rtcpMux = rtcpMux;
this.iceAuthenticator.generateIceCredentials();
// Enable ICE on RTP channels
this.rtpChannel.enableIce(this.iceAuthenticator);
if(!rtcpMux) {
this.rtcpChannel.enableIce(this.iceAuthenticator);
}
if (logger.isDebugEnabled()) {
logger.debug(this.mediaType + " channel " + this.ssrc + " enabled ICE");
}
}
} | [
"public",
"void",
"enableICE",
"(",
"String",
"externalAddress",
",",
"boolean",
"rtcpMux",
")",
"{",
"if",
"(",
"!",
"this",
".",
"ice",
")",
"{",
"this",
".",
"ice",
"=",
"true",
";",
"this",
".",
"rtcpMux",
"=",
"rtcpMux",
";",
"this",
".",
"iceAu... | Enables ICE on the channel.
<p>
An ICE-enabled channel will start an ICE Agent which gathers local
candidates and listens to incoming STUN requests as a mean to select the
proper address to be used during the call.
</p>
@param externalAddress
The public address of the Media Server. Used for SRFLX
candidates.
@param rtcpMux
Whether RTCP is multiplexed or not. Affects number of
candidates. | [
"Enables",
"ICE",
"on",
"the",
"channel",
"."
] | train | https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/rtp/src/main/java/org/restcomm/media/core/rtp/channels/MediaChannel.java#L720-L736 |
zaproxy/zaproxy | src/org/zaproxy/zap/extension/script/ExtensionScript.java | ExtensionScript.handleFailedScriptInterface | public void handleFailedScriptInterface(ScriptWrapper script, String errorMessage) {
handleUnspecifiedScriptError(script, getWriters(script), errorMessage);
} | java | public void handleFailedScriptInterface(ScriptWrapper script, String errorMessage) {
handleUnspecifiedScriptError(script, getWriters(script), errorMessage);
} | [
"public",
"void",
"handleFailedScriptInterface",
"(",
"ScriptWrapper",
"script",
",",
"String",
"errorMessage",
")",
"{",
"handleUnspecifiedScriptError",
"(",
"script",
",",
"getWriters",
"(",
"script",
")",
",",
"errorMessage",
")",
";",
"}"
] | Handles a failed attempt to convert a script into an interface.
<p>
The given {@code errorMessage} will be written to the writer(s) associated with the given {@code script}, moreover it
will be disabled and flagged that has an error.
@param script the script that resulted in an exception, must not be {@code null}
@param errorMessage the message that will be written to the writer(s)
@since 2.5.0
@see #setEnabled(ScriptWrapper, boolean)
@see #setError(ScriptWrapper, Exception)
@see #handleScriptException(ScriptWrapper, Exception) | [
"Handles",
"a",
"failed",
"attempt",
"to",
"convert",
"a",
"script",
"into",
"an",
"interface",
".",
"<p",
">",
"The",
"given",
"{",
"@code",
"errorMessage",
"}",
"will",
"be",
"written",
"to",
"the",
"writer",
"(",
"s",
")",
"associated",
"with",
"the",... | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/script/ExtensionScript.java#L1439-L1441 |
jeremylong/DependencyCheck | core/src/main/java/org/owasp/dependencycheck/data/cwe/App.java | App.serializeCweData | private static void serializeCweData(Map<String, String> cwe, File out) {
try (FileOutputStream fout = new FileOutputStream(out);
ObjectOutputStream objOut = new ObjectOutputStream(fout);) {
System.out.println("Writing " + cwe.size() + " cwe entries.");
objOut.writeObject(cwe);
System.out.println(String.format("Serialized CWE data written to %s", out.getCanonicalPath()));
System.out.println("To update the ODC CWE data copy the serialized file to 'src/main/resources/data/cwe.hashmap.serialized'");
} catch (IOException ex) {
System.err.println(String.format("Error generating serialized data: %s", ex.getMessage()));
}
} | java | private static void serializeCweData(Map<String, String> cwe, File out) {
try (FileOutputStream fout = new FileOutputStream(out);
ObjectOutputStream objOut = new ObjectOutputStream(fout);) {
System.out.println("Writing " + cwe.size() + " cwe entries.");
objOut.writeObject(cwe);
System.out.println(String.format("Serialized CWE data written to %s", out.getCanonicalPath()));
System.out.println("To update the ODC CWE data copy the serialized file to 'src/main/resources/data/cwe.hashmap.serialized'");
} catch (IOException ex) {
System.err.println(String.format("Error generating serialized data: %s", ex.getMessage()));
}
} | [
"private",
"static",
"void",
"serializeCweData",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"cwe",
",",
"File",
"out",
")",
"{",
"try",
"(",
"FileOutputStream",
"fout",
"=",
"new",
"FileOutputStream",
"(",
"out",
")",
";",
"ObjectOutputStream",
"objOut",... | Writes the map of CWE data to disk.
@param cwe the CWE data
@param out the file output location | [
"Writes",
"the",
"map",
"of",
"CWE",
"data",
"to",
"disk",
"."
] | train | https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/data/cwe/App.java#L101-L111 |
GenesysPureEngage/authentication-client-java | src/main/java/com/genesys/internal/authentication/api/AuthenticationApi.java | AuthenticationApi.authorizeWithHttpInfo | public ApiResponse<Void> authorizeWithHttpInfo(String clientId, String redirectUri, String responseType, String authorization, Boolean hideTenant, String scope) throws ApiException {
com.squareup.okhttp.Call call = authorizeValidateBeforeCall(clientId, redirectUri, responseType, authorization, hideTenant, scope, null, null);
return apiClient.execute(call);
} | java | public ApiResponse<Void> authorizeWithHttpInfo(String clientId, String redirectUri, String responseType, String authorization, Boolean hideTenant, String scope) throws ApiException {
com.squareup.okhttp.Call call = authorizeValidateBeforeCall(clientId, redirectUri, responseType, authorization, hideTenant, scope, null, null);
return apiClient.execute(call);
} | [
"public",
"ApiResponse",
"<",
"Void",
">",
"authorizeWithHttpInfo",
"(",
"String",
"clientId",
",",
"String",
"redirectUri",
",",
"String",
"responseType",
",",
"String",
"authorization",
",",
"Boolean",
"hideTenant",
",",
"String",
"scope",
")",
"throws",
"ApiExc... | Perform authorization
Perform authorization based on the code grant type &mdash; either Authorization Code Grant or Implicit Grant. For more information, see [Authorization Endpoint](https://tools.ietf.org/html/rfc6749#section-3.1). **Note:** For the optional **scope** parameter, the Authentication API supports only the `*` value.
@param clientId The ID of the application or service that is registered as the client. You'll need to get this value from your PureEngage Cloud representative. (required)
@param redirectUri The URI that you want users to be redirected to after entering valid credentials during an Implicit or Authorization Code grant. The Authentication API includes this as part of the URI it returns in the 'Location' header. (required)
@param responseType The response type to let the Authentication API know which grant flow you're using. Possible values are `code` for Authorization Code Grant or `token` for Implicit Grant. For more information about this parameter, see [Response Type](https://tools.ietf.org/html/rfc6749#section-3.1.1). (required)
@param authorization Basic authorization. For example: 'Authorization: Basic Y3...MQ==' (optional)
@param hideTenant Hide the **tenant** field in the UI for Authorization Code Grant. (optional, default to false)
@param scope The scope of the access request. The Authentication API supports only the `*` value. (optional)
@return ApiResponse<Void>
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Perform",
"authorization",
"Perform",
"authorization",
"based",
"on",
"the",
"code",
"grant",
"type",
"&",
";",
"mdash",
";",
"either",
"Authorization",
"Code",
"Grant",
"or",
"Implicit",
"Grant",
".",
"For",
"more",
"information",
"see",
"[",
"Authorization... | train | https://github.com/GenesysPureEngage/authentication-client-java/blob/eb0d58343ee42ebd3c037163c1137f611dfcbb3a/src/main/java/com/genesys/internal/authentication/api/AuthenticationApi.java#L180-L183 |
Jasig/uPortal | uPortal-spring/src/main/java/org/springframework/context/support/PortalPropertySourcesPlaceholderConfigurer.java | PortalPropertySourcesPlaceholderConfigurer.postProcessBeanFactory | @Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
throws BeansException {
if (propertyResolver == null) {
try {
MutablePropertySources sources = new MutablePropertySources();
PropertySource<?> localPropertySource =
new PropertiesPropertySource(EXTENDED_PROPERTIES_SOURCE, mergeProperties());
sources.addLast(localPropertySource);
propertyResolver = new PropertySourcesPropertyResolver(sources);
} catch (IOException e) {
throw new BeanInitializationException("Could not load properties", e);
}
}
super.postProcessBeanFactory(beanFactory);
} | java | @Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
throws BeansException {
if (propertyResolver == null) {
try {
MutablePropertySources sources = new MutablePropertySources();
PropertySource<?> localPropertySource =
new PropertiesPropertySource(EXTENDED_PROPERTIES_SOURCE, mergeProperties());
sources.addLast(localPropertySource);
propertyResolver = new PropertySourcesPropertyResolver(sources);
} catch (IOException e) {
throw new BeanInitializationException("Could not load properties", e);
}
}
super.postProcessBeanFactory(beanFactory);
} | [
"@",
"Override",
"public",
"void",
"postProcessBeanFactory",
"(",
"ConfigurableListableBeanFactory",
"beanFactory",
")",
"throws",
"BeansException",
"{",
"if",
"(",
"propertyResolver",
"==",
"null",
")",
"{",
"try",
"{",
"MutablePropertySources",
"sources",
"=",
"new"... | Override the postProcessing. The default PropertySourcesPlaceholderConfigurer does not inject
local properties into the Environment object. It builds a local list of properties files and
then uses a transient Resolver to resolve the @Value annotations. That means that you are
unable to get to "local" properties (eg. portal.properties) after bean post-processing has
completed unless you are going to re-parse those file. This is similar to what
PropertiesManager does, but it uses all the property files configured, not just
portal.properties.
<p>If we upgrade to spring 4, there are better/more efficient solutions available. I'm not
aware of better solutions for spring 3.x.
@param beanFactory the bean factory
@throws BeansException if an error occurs while loading properties or wiring up beans | [
"Override",
"the",
"postProcessing",
".",
"The",
"default",
"PropertySourcesPlaceholderConfigurer",
"does",
"not",
"inject",
"local",
"properties",
"into",
"the",
"Environment",
"object",
".",
"It",
"builds",
"a",
"local",
"list",
"of",
"properties",
"files",
"and",... | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-spring/src/main/java/org/springframework/context/support/PortalPropertySourcesPlaceholderConfigurer.java#L113-L131 |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/wsspi/http/channel/compression/GzipInputHandler.java | GzipInputHandler.skipPast | private int skipPast(byte[] data, int pos, byte target) {
int index = pos;
while (index < data.length) {
if (target == data[index++]) {
return index;
}
}
return index;
} | java | private int skipPast(byte[] data, int pos, byte target) {
int index = pos;
while (index < data.length) {
if (target == data[index++]) {
return index;
}
}
return index;
} | [
"private",
"int",
"skipPast",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"pos",
",",
"byte",
"target",
")",
"{",
"int",
"index",
"=",
"pos",
";",
"while",
"(",
"index",
"<",
"data",
".",
"length",
")",
"{",
"if",
"(",
"target",
"==",
"data",
"[",... | Skip until it runs out of input data or finds the target byte.
@param data
@param pos
@param target
@return pos | [
"Skip",
"until",
"it",
"runs",
"out",
"of",
"input",
"data",
"or",
"finds",
"the",
"target",
"byte",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/wsspi/http/channel/compression/GzipInputHandler.java#L166-L174 |
opsmatters/opsmatters-core | src/main/java/com/opsmatters/core/util/StringUtilities.java | StringUtilities.getOccurenceCount | public static int getOccurenceCount(char c, String s)
{
int ret = 0;
for(int i = 0; i < s.length(); i++)
{
if(s.charAt(i) == c)
++ret;
}
return ret;
} | java | public static int getOccurenceCount(char c, String s)
{
int ret = 0;
for(int i = 0; i < s.length(); i++)
{
if(s.charAt(i) == c)
++ret;
}
return ret;
} | [
"public",
"static",
"int",
"getOccurenceCount",
"(",
"char",
"c",
",",
"String",
"s",
")",
"{",
"int",
"ret",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"s",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
... | Returns the number of occurences of the given character in the given string.
@param c The character to look for occurrences of
@param s The string to search
@return The number of occurences | [
"Returns",
"the",
"number",
"of",
"occurences",
"of",
"the",
"given",
"character",
"in",
"the",
"given",
"string",
"."
] | train | https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/util/StringUtilities.java#L282-L293 |
logic-ng/LogicNG | src/main/java/org/logicng/formulas/FormulaFactory.java | FormulaFactory.addFormulaAnd | private void addFormulaAnd(final LinkedHashSet<Formula> ops, final Formula f) {
if (f.type() == TRUE) {
this.formulaAdditionResult[0] = true;
this.formulaAdditionResult[1] = true;
} else if (f.type == FALSE || containsComplement(ops, f)) {
this.formulaAdditionResult[0] = false;
this.formulaAdditionResult[1] = false;
} else {
ops.add(f);
this.formulaAdditionResult[0] = true;
this.formulaAdditionResult[1] = f.type == LITERAL || f.type == OR && ((Or) f).isCNFClause();
}
} | java | private void addFormulaAnd(final LinkedHashSet<Formula> ops, final Formula f) {
if (f.type() == TRUE) {
this.formulaAdditionResult[0] = true;
this.formulaAdditionResult[1] = true;
} else if (f.type == FALSE || containsComplement(ops, f)) {
this.formulaAdditionResult[0] = false;
this.formulaAdditionResult[1] = false;
} else {
ops.add(f);
this.formulaAdditionResult[0] = true;
this.formulaAdditionResult[1] = f.type == LITERAL || f.type == OR && ((Or) f).isCNFClause();
}
} | [
"private",
"void",
"addFormulaAnd",
"(",
"final",
"LinkedHashSet",
"<",
"Formula",
">",
"ops",
",",
"final",
"Formula",
"f",
")",
"{",
"if",
"(",
"f",
".",
"type",
"(",
")",
"==",
"TRUE",
")",
"{",
"this",
".",
"formulaAdditionResult",
"[",
"0",
"]",
... | Adds a given formula to a list of operands. If the formula is the neutral element for the respective n-ary
operation it will be skipped. If a complementary formula is already present in the list of operands or the
formula is the dual element, {@code false} is stored as first element of the result array,
otherwise {@code true} is the first element of the result array. If the added formula was a clause, the second
element in the result array is {@code true}, {@code false} otherwise.
@param ops the list of operands
@param f the formula | [
"Adds",
"a",
"given",
"formula",
"to",
"a",
"list",
"of",
"operands",
".",
"If",
"the",
"formula",
"is",
"the",
"neutral",
"element",
"for",
"the",
"respective",
"n",
"-",
"ary",
"operation",
"it",
"will",
"be",
"skipped",
".",
"If",
"a",
"complementary"... | train | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/formulas/FormulaFactory.java#L977-L989 |
apache/flink | flink-core/src/main/java/org/apache/flink/core/fs/FileSystem.java | FileSystem.create | @Deprecated
public FSDataOutputStream create(
Path f,
boolean overwrite,
int bufferSize,
short replication,
long blockSize) throws IOException {
return create(f, overwrite ? WriteMode.OVERWRITE : WriteMode.NO_OVERWRITE);
} | java | @Deprecated
public FSDataOutputStream create(
Path f,
boolean overwrite,
int bufferSize,
short replication,
long blockSize) throws IOException {
return create(f, overwrite ? WriteMode.OVERWRITE : WriteMode.NO_OVERWRITE);
} | [
"@",
"Deprecated",
"public",
"FSDataOutputStream",
"create",
"(",
"Path",
"f",
",",
"boolean",
"overwrite",
",",
"int",
"bufferSize",
",",
"short",
"replication",
",",
"long",
"blockSize",
")",
"throws",
"IOException",
"{",
"return",
"create",
"(",
"f",
",",
... | Opens an FSDataOutputStream at the indicated Path.
<p>This method is deprecated, because most of its parameters are ignored by most file systems.
To control for example the replication factor and block size in the Hadoop Distributed File system,
make sure that the respective Hadoop configuration file is either linked from the Flink configuration,
or in the classpath of either Flink or the user code.
@param f
the file name to open
@param overwrite
if a file with this name already exists, then if true,
the file will be overwritten, and if false an error will be thrown.
@param bufferSize
the size of the buffer to be used.
@param replication
required block replication for the file.
@param blockSize
the size of the file blocks
@throws IOException Thrown, if the stream could not be opened because of an I/O, or because
a file already exists at that path and the write mode indicates to not
overwrite the file.
@deprecated Deprecated because not well supported across types of file systems.
Control the behavior of specific file systems via configurations instead. | [
"Opens",
"an",
"FSDataOutputStream",
"at",
"the",
"indicated",
"Path",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/fs/FileSystem.java#L643-L652 |
recommenders/rival | rival-recommend/src/main/java/net/recommenders/rival/recommend/frameworks/MultipleRecommendationRunner.java | MultipleRecommendationRunner.listAllFiles | public static void listAllFiles(final Set<String> setOfPaths, final String inputPath) {
if (inputPath == null) {
return;
}
File[] files = new File(inputPath).listFiles();
if (files == null) {
return;
}
for (File file : files) {
if (file.isDirectory()) {
listAllFiles(setOfPaths, file.getAbsolutePath());
} else if (file.getName().contains("_train.dat")) {
setOfPaths.add(file.getAbsolutePath().replaceAll("_train.dat", ""));
}
}
} | java | public static void listAllFiles(final Set<String> setOfPaths, final String inputPath) {
if (inputPath == null) {
return;
}
File[] files = new File(inputPath).listFiles();
if (files == null) {
return;
}
for (File file : files) {
if (file.isDirectory()) {
listAllFiles(setOfPaths, file.getAbsolutePath());
} else if (file.getName().contains("_train.dat")) {
setOfPaths.add(file.getAbsolutePath().replaceAll("_train.dat", ""));
}
}
} | [
"public",
"static",
"void",
"listAllFiles",
"(",
"final",
"Set",
"<",
"String",
">",
"setOfPaths",
",",
"final",
"String",
"inputPath",
")",
"{",
"if",
"(",
"inputPath",
"==",
"null",
")",
"{",
"return",
";",
"}",
"File",
"[",
"]",
"files",
"=",
"new",... | List all files at a certain path.
@param setOfPaths the set of files at a certain path
@param inputPath the path to check | [
"List",
"all",
"files",
"at",
"a",
"certain",
"path",
"."
] | train | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-recommend/src/main/java/net/recommenders/rival/recommend/frameworks/MultipleRecommendationRunner.java#L411-L426 |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/ssh/SshKeyFingerprint.java | SshKeyFingerprint.getFingerprint | public static String getFingerprint(byte[] encoded, String algorithm)
throws SshException {
Digest md5 = (Digest) ComponentManager.getInstance().supportedDigests()
.getInstance(algorithm);
md5.putBytes(encoded);
byte[] digest = md5.doFinal();
StringBuffer buf = new StringBuffer();
int ch;
for (int i = 0; i < digest.length; i++) {
ch = digest[i] & 0xFF;
if (i > 0) {
buf.append(':');
}
buf.append(HEX[(ch >>> 4) & 0x0F]);
buf.append(HEX[ch & 0x0F]);
}
return buf.toString();
} | java | public static String getFingerprint(byte[] encoded, String algorithm)
throws SshException {
Digest md5 = (Digest) ComponentManager.getInstance().supportedDigests()
.getInstance(algorithm);
md5.putBytes(encoded);
byte[] digest = md5.doFinal();
StringBuffer buf = new StringBuffer();
int ch;
for (int i = 0; i < digest.length; i++) {
ch = digest[i] & 0xFF;
if (i > 0) {
buf.append(':');
}
buf.append(HEX[(ch >>> 4) & 0x0F]);
buf.append(HEX[ch & 0x0F]);
}
return buf.toString();
} | [
"public",
"static",
"String",
"getFingerprint",
"(",
"byte",
"[",
"]",
"encoded",
",",
"String",
"algorithm",
")",
"throws",
"SshException",
"{",
"Digest",
"md5",
"=",
"(",
"Digest",
")",
"ComponentManager",
".",
"getInstance",
"(",
")",
".",
"supportedDigests... | Generate an SSH key fingerprint with a specific algorithm.
@param encoded
@param algorithm
@return the key fingerprint, for example
"c1:b1:30:29:d7:b8:de:6c:97:77:10:d7:46:41:63:87" | [
"Generate",
"an",
"SSH",
"key",
"fingerprint",
"with",
"a",
"specific",
"algorithm",
"."
] | train | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/ssh/SshKeyFingerprint.java#L66-L88 |
wisdom-framework/wisdom | framework/resource-controller/src/main/java/org/wisdom/resources/WebJarController.java | WebJarController.addingBundle | @Override
public synchronized List<BundleWebJarLib> addingBundle(Bundle bundle, BundleEvent bundleEvent) {
Enumeration<URL> e = bundle.findEntries(WEBJAR_LOCATION, "*", true);
if (e == null) {
// No match
return Collections.emptyList();
}
List<BundleWebJarLib> list = new ArrayList<>();
while (e.hasMoreElements()) {
String path = e.nextElement().getPath();
if (path.endsWith("/")) {
Matcher matcher = WEBJAR_ROOT_REGEX.matcher(path);
if (matcher.matches()) {
String name = matcher.group(1);
String version = matcher.group(2);
final BundleWebJarLib lib = new BundleWebJarLib(name, version, bundle);
logger().info("Web Jar library ({}) found in {} [{}]", lib,
bundle.getSymbolicName(),
bundle.getBundleId());
list.add(lib);
}
}
}
addWebJarLibs(list);
return list;
} | java | @Override
public synchronized List<BundleWebJarLib> addingBundle(Bundle bundle, BundleEvent bundleEvent) {
Enumeration<URL> e = bundle.findEntries(WEBJAR_LOCATION, "*", true);
if (e == null) {
// No match
return Collections.emptyList();
}
List<BundleWebJarLib> list = new ArrayList<>();
while (e.hasMoreElements()) {
String path = e.nextElement().getPath();
if (path.endsWith("/")) {
Matcher matcher = WEBJAR_ROOT_REGEX.matcher(path);
if (matcher.matches()) {
String name = matcher.group(1);
String version = matcher.group(2);
final BundleWebJarLib lib = new BundleWebJarLib(name, version, bundle);
logger().info("Web Jar library ({}) found in {} [{}]", lib,
bundle.getSymbolicName(),
bundle.getBundleId());
list.add(lib);
}
}
}
addWebJarLibs(list);
return list;
} | [
"@",
"Override",
"public",
"synchronized",
"List",
"<",
"BundleWebJarLib",
">",
"addingBundle",
"(",
"Bundle",
"bundle",
",",
"BundleEvent",
"bundleEvent",
")",
"{",
"Enumeration",
"<",
"URL",
">",
"e",
"=",
"bundle",
".",
"findEntries",
"(",
"WEBJAR_LOCATION",
... | A bundle just arrived (and / or just becomes ACTIVE). We need to check if it contains 'webjar libraries'.
@param bundle the bundle
@param bundleEvent the event
@return the list of webjar found in the bundle, empty if none. | [
"A",
"bundle",
"just",
"arrived",
"(",
"and",
"/",
"or",
"just",
"becomes",
"ACTIVE",
")",
".",
"We",
"need",
"to",
"check",
"if",
"it",
"contains",
"webjar",
"libraries",
"."
] | train | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/resource-controller/src/main/java/org/wisdom/resources/WebJarController.java#L294-L321 |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/tracker/meanshift/LocalWeightedHistogramRotRect.java | LocalWeightedHistogramRotRect.createSamplePoints | protected void createSamplePoints(int numSamples) {
for( int y = 0; y < numSamples; y++ ) {
float regionY = (y/(numSamples-1.0f) - 0.5f);
for( int x = 0; x < numSamples; x++ ) {
float regionX = (x/(numSamples-1.0f) - 0.5f);
samplePts.add( new Point2D_F32(regionX,regionY));
}
}
} | java | protected void createSamplePoints(int numSamples) {
for( int y = 0; y < numSamples; y++ ) {
float regionY = (y/(numSamples-1.0f) - 0.5f);
for( int x = 0; x < numSamples; x++ ) {
float regionX = (x/(numSamples-1.0f) - 0.5f);
samplePts.add( new Point2D_F32(regionX,regionY));
}
}
} | [
"protected",
"void",
"createSamplePoints",
"(",
"int",
"numSamples",
")",
"{",
"for",
"(",
"int",
"y",
"=",
"0",
";",
"y",
"<",
"numSamples",
";",
"y",
"++",
")",
"{",
"float",
"regionY",
"=",
"(",
"y",
"/",
"(",
"numSamples",
"-",
"1.0f",
")",
"-"... | create the list of points in square coordinates that it will sample. values will range
from -0.5 to 0.5 along each axis. | [
"create",
"the",
"list",
"of",
"points",
"in",
"square",
"coordinates",
"that",
"it",
"will",
"sample",
".",
"values",
"will",
"range",
"from",
"-",
"0",
".",
"5",
"to",
"0",
".",
"5",
"along",
"each",
"axis",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/tracker/meanshift/LocalWeightedHistogramRotRect.java#L117-L126 |
camunda/camunda-xml-model | src/main/java/org/camunda/bpm/model/xml/impl/ModelImpl.java | ModelImpl.registerType | public void registerType(ModelElementType modelElementType, Class<? extends ModelElementInstance> instanceType) {
QName qName = ModelUtil.getQName(modelElementType.getTypeNamespace(), modelElementType.getTypeName());
typesByName.put(qName, modelElementType);
typesByClass.put(instanceType, modelElementType);
} | java | public void registerType(ModelElementType modelElementType, Class<? extends ModelElementInstance> instanceType) {
QName qName = ModelUtil.getQName(modelElementType.getTypeNamespace(), modelElementType.getTypeName());
typesByName.put(qName, modelElementType);
typesByClass.put(instanceType, modelElementType);
} | [
"public",
"void",
"registerType",
"(",
"ModelElementType",
"modelElementType",
",",
"Class",
"<",
"?",
"extends",
"ModelElementInstance",
">",
"instanceType",
")",
"{",
"QName",
"qName",
"=",
"ModelUtil",
".",
"getQName",
"(",
"modelElementType",
".",
"getTypeNamesp... | Registers a {@link ModelElementType} in this {@link Model}.
@param modelElementType the element type to register
@param instanceType the instance class of the type to register | [
"Registers",
"a",
"{",
"@link",
"ModelElementType",
"}",
"in",
"this",
"{",
"@link",
"Model",
"}",
"."
] | train | https://github.com/camunda/camunda-xml-model/blob/85b3f879e26d063f71c94cfd21ac17d9ff6baf4d/src/main/java/org/camunda/bpm/model/xml/impl/ModelImpl.java#L106-L110 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/mesh/ST_Delaunay.java | ST_Delaunay.createDT | public static GeometryCollection createDT(Geometry geometry, int flag) throws SQLException {
if (geometry != null) {
DelaunayTriangulationBuilder triangulationBuilder = new DelaunayTriangulationBuilder();
triangulationBuilder.setSites(geometry);
if(flag == 0) {
return getTriangles(geometry.getFactory(), triangulationBuilder);
} else {
return (GeometryCollection)triangulationBuilder.getEdges(geometry.getFactory());
}
}
return null;
} | java | public static GeometryCollection createDT(Geometry geometry, int flag) throws SQLException {
if (geometry != null) {
DelaunayTriangulationBuilder triangulationBuilder = new DelaunayTriangulationBuilder();
triangulationBuilder.setSites(geometry);
if(flag == 0) {
return getTriangles(geometry.getFactory(), triangulationBuilder);
} else {
return (GeometryCollection)triangulationBuilder.getEdges(geometry.getFactory());
}
}
return null;
} | [
"public",
"static",
"GeometryCollection",
"createDT",
"(",
"Geometry",
"geometry",
",",
"int",
"flag",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"geometry",
"!=",
"null",
")",
"{",
"DelaunayTriangulationBuilder",
"triangulationBuilder",
"=",
"new",
"DelaunayTri... | Build a delaunay triangulation based on all coordinates of the geometry
@param geometry
@param flag for flag=0 (default flag) or a MULTILINESTRING for flag=1
@return a set of polygons (triangles)
@throws SQLException | [
"Build",
"a",
"delaunay",
"triangulation",
"based",
"on",
"all",
"coordinates",
"of",
"the",
"geometry"
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/mesh/ST_Delaunay.java#L71-L82 |
netty/netty | buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java | CompositeByteBuf.addComponents | public CompositeByteBuf addComponents(boolean increaseWriterIndex, ByteBuf... buffers) {
checkNotNull(buffers, "buffers");
addComponents0(increaseWriterIndex, componentCount, buffers, 0);
consolidateIfNeeded();
return this;
} | java | public CompositeByteBuf addComponents(boolean increaseWriterIndex, ByteBuf... buffers) {
checkNotNull(buffers, "buffers");
addComponents0(increaseWriterIndex, componentCount, buffers, 0);
consolidateIfNeeded();
return this;
} | [
"public",
"CompositeByteBuf",
"addComponents",
"(",
"boolean",
"increaseWriterIndex",
",",
"ByteBuf",
"...",
"buffers",
")",
"{",
"checkNotNull",
"(",
"buffers",
",",
"\"buffers\"",
")",
";",
"addComponents0",
"(",
"increaseWriterIndex",
",",
"componentCount",
",",
... | Add the given {@link ByteBuf}s and increase the {@code writerIndex} if {@code increaseWriterIndex} is
{@code true}.
{@link ByteBuf#release()} ownership of all {@link ByteBuf} objects in {@code buffers} is transferred to this
{@link CompositeByteBuf}.
@param buffers the {@link ByteBuf}s to add. {@link ByteBuf#release()} ownership of all {@link ByteBuf#release()}
ownership of all {@link ByteBuf} objects is transferred to this {@link CompositeByteBuf}. | [
"Add",
"the",
"given",
"{",
"@link",
"ByteBuf",
"}",
"s",
"and",
"increase",
"the",
"{",
"@code",
"writerIndex",
"}",
"if",
"{",
"@code",
"increaseWriterIndex",
"}",
"is",
"{",
"@code",
"true",
"}",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java#L234-L239 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/responder/responderhtmlpage.java | responderhtmlpage.get | public static responderhtmlpage get(nitro_service service, String name) throws Exception{
responderhtmlpage obj = new responderhtmlpage();
obj.set_name(name);
responderhtmlpage response = (responderhtmlpage) obj.get_resource(service);
return response;
} | java | public static responderhtmlpage get(nitro_service service, String name) throws Exception{
responderhtmlpage obj = new responderhtmlpage();
obj.set_name(name);
responderhtmlpage response = (responderhtmlpage) obj.get_resource(service);
return response;
} | [
"public",
"static",
"responderhtmlpage",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"responderhtmlpage",
"obj",
"=",
"new",
"responderhtmlpage",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
")",
";",
... | Use this API to fetch responderhtmlpage resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"responderhtmlpage",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/responder/responderhtmlpage.java#L232-L237 |
HanSolo/SteelSeries-Swing | src/main/java/eu/hansolo/steelseries/extras/Poi.java | Poi.setLocation | public final void setLocation(final double LAT, final double LON) {
this.lon = LON; // X
this.lat = LAT; // Y
this.LOCATION.setLocation(LON, LAT);
this.LOCATION_XY.setLocation(toXY(LAT, LON));
adjustDirection();
} | java | public final void setLocation(final double LAT, final double LON) {
this.lon = LON; // X
this.lat = LAT; // Y
this.LOCATION.setLocation(LON, LAT);
this.LOCATION_XY.setLocation(toXY(LAT, LON));
adjustDirection();
} | [
"public",
"final",
"void",
"setLocation",
"(",
"final",
"double",
"LAT",
",",
"final",
"double",
"LON",
")",
"{",
"this",
".",
"lon",
"=",
"LON",
";",
"// X",
"this",
".",
"lat",
"=",
"LAT",
";",
"// Y",
"this",
".",
"LOCATION",
".",
"setLocation",
"... | Sets the location of the poi by the given latitude
and longitude values
@param LAT
@param LON | [
"Sets",
"the",
"location",
"of",
"the",
"poi",
"by",
"the",
"given",
"latitude",
"and",
"longitude",
"values"
] | train | https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/extras/Poi.java#L335-L341 |
jOOQ/jOOL | jOOL-java-8/src/main/java/org/jooq/lambda/Agg.java | Agg.maxAll | public static <T> Collector<T, ?, Seq<T>> maxAll(Comparator<? super T> comparator) {
return maxAllBy(t -> t, comparator);
} | java | public static <T> Collector<T, ?, Seq<T>> maxAll(Comparator<? super T> comparator) {
return maxAllBy(t -> t, comparator);
} | [
"public",
"static",
"<",
"T",
">",
"Collector",
"<",
"T",
",",
"?",
",",
"Seq",
"<",
"T",
">",
">",
"maxAll",
"(",
"Comparator",
"<",
"?",
"super",
"T",
">",
"comparator",
")",
"{",
"return",
"maxAllBy",
"(",
"t",
"->",
"t",
",",
"comparator",
")... | Get a {@link Collector} that calculates the <code>MAX()</code> function, producing multiple results. | [
"Get",
"a",
"{"
] | train | https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Agg.java#L336-L338 |
fozziethebeat/S-Space | src/main/java/edu/ucla/sspace/mains/FixedDurationTemporalRandomIndexingMain.java | FixedDurationTemporalRandomIndexingMain.printWordNeighbors | private void printWordNeighbors(String dateString,
SemanticSpace semanticPartition)
throws IOException {
LOGGER.info("printing the most similar words for the semantic partition" +
" starting at: " + dateString);
NearestNeighborFinder nnf =
new SimpleNearestNeighborFinder(semanticPartition);
// generate the similarity lists
for (String toExamine : interestingWords) {
SortedMultiMap<Double,String> mostSimilar =
nnf.getMostSimilar(toExamine, interestingWordNeighbors);
if (mostSimilar != null) {
File neighborFile =
new File(outputDir, toExamine + "-" + dateString + ".txt");
neighborFile.createNewFile(); // iff it doesn't already exist
File neighborComparisonFile = new File(outputDir,
toExamine + "_neighbor-comparisons_" + dateString + ".txt");
neighborComparisonFile.createNewFile(); // see above comment
PrintWriter pw = new PrintWriter(neighborFile);
for (String similar : mostSimilar.values()) {
pw.println(similar);
}
pw.close();
if (compareNeighbors) {
// Print an N x N comparison between all of the most similar
// words. This gives an indication of whether any of the
// words might be outliers.
writeNeighborComparison(neighborComparisonFile,
mostSimilar, semanticPartition);
}
}
}
} | java | private void printWordNeighbors(String dateString,
SemanticSpace semanticPartition)
throws IOException {
LOGGER.info("printing the most similar words for the semantic partition" +
" starting at: " + dateString);
NearestNeighborFinder nnf =
new SimpleNearestNeighborFinder(semanticPartition);
// generate the similarity lists
for (String toExamine : interestingWords) {
SortedMultiMap<Double,String> mostSimilar =
nnf.getMostSimilar(toExamine, interestingWordNeighbors);
if (mostSimilar != null) {
File neighborFile =
new File(outputDir, toExamine + "-" + dateString + ".txt");
neighborFile.createNewFile(); // iff it doesn't already exist
File neighborComparisonFile = new File(outputDir,
toExamine + "_neighbor-comparisons_" + dateString + ".txt");
neighborComparisonFile.createNewFile(); // see above comment
PrintWriter pw = new PrintWriter(neighborFile);
for (String similar : mostSimilar.values()) {
pw.println(similar);
}
pw.close();
if (compareNeighbors) {
// Print an N x N comparison between all of the most similar
// words. This gives an indication of whether any of the
// words might be outliers.
writeNeighborComparison(neighborComparisonFile,
mostSimilar, semanticPartition);
}
}
}
} | [
"private",
"void",
"printWordNeighbors",
"(",
"String",
"dateString",
",",
"SemanticSpace",
"semanticPartition",
")",
"throws",
"IOException",
"{",
"LOGGER",
".",
"info",
"(",
"\"printing the most similar words for the semantic partition\"",
"+",
"\" starting at: \"",
"+",
... | Using the {@link wordToTemporalSemantics} set and input parameters,
calculates the shift in each word's semantic vector per recorded time
period and also prints out the nearest neighbors to each word for each
time period.
@param dateString the string that encodes the date of the semantic partition.
This will be used as a part of the file name to indicate when the
shifts occurred.
@param semanticPartition the current semantic that will be used to identify
the neighbors of each interesting word | [
"Using",
"the",
"{",
"@link",
"wordToTemporalSemantics",
"}",
"set",
"and",
"input",
"parameters",
"calculates",
"the",
"shift",
"in",
"each",
"word",
"s",
"semantic",
"vector",
"per",
"recorded",
"time",
"period",
"and",
"also",
"prints",
"out",
"the",
"neare... | train | https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/mains/FixedDurationTemporalRandomIndexingMain.java#L668-L708 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.dedicated_server_serviceName_bandwidth_duration_POST | public OvhOrder dedicated_server_serviceName_bandwidth_duration_POST(String serviceName, String duration, OvhBandwidthOrderEnum bandwidth, OvhBandwidthOrderTypeEnum type) throws IOException {
String qPath = "/order/dedicated/server/{serviceName}/bandwidth/{duration}";
StringBuilder sb = path(qPath, serviceName, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "bandwidth", bandwidth);
addBody(o, "type", type);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | java | public OvhOrder dedicated_server_serviceName_bandwidth_duration_POST(String serviceName, String duration, OvhBandwidthOrderEnum bandwidth, OvhBandwidthOrderTypeEnum type) throws IOException {
String qPath = "/order/dedicated/server/{serviceName}/bandwidth/{duration}";
StringBuilder sb = path(qPath, serviceName, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "bandwidth", bandwidth);
addBody(o, "type", type);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | [
"public",
"OvhOrder",
"dedicated_server_serviceName_bandwidth_duration_POST",
"(",
"String",
"serviceName",
",",
"String",
"duration",
",",
"OvhBandwidthOrderEnum",
"bandwidth",
",",
"OvhBandwidthOrderTypeEnum",
"type",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
... | Create order
REST: POST /order/dedicated/server/{serviceName}/bandwidth/{duration}
@param bandwidth [required] Bandwidth to allocate
@param type [required] bandwidth type
@param serviceName [required] The internal name of your dedicated server
@param duration [required] Duration | [
"Create",
"order"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L2519-L2527 |
apache/spark | sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeArrayData.java | UnsafeArrayData.pointTo | public void pointTo(Object baseObject, long baseOffset, int sizeInBytes) {
// Read the number of elements from the first 8 bytes.
final long numElements = Platform.getLong(baseObject, baseOffset);
assert numElements >= 0 : "numElements (" + numElements + ") should >= 0";
assert numElements <= Integer.MAX_VALUE :
"numElements (" + numElements + ") should <= Integer.MAX_VALUE";
this.numElements = (int)numElements;
this.baseObject = baseObject;
this.baseOffset = baseOffset;
this.sizeInBytes = sizeInBytes;
this.elementOffset = baseOffset + calculateHeaderPortionInBytes(this.numElements);
} | java | public void pointTo(Object baseObject, long baseOffset, int sizeInBytes) {
// Read the number of elements from the first 8 bytes.
final long numElements = Platform.getLong(baseObject, baseOffset);
assert numElements >= 0 : "numElements (" + numElements + ") should >= 0";
assert numElements <= Integer.MAX_VALUE :
"numElements (" + numElements + ") should <= Integer.MAX_VALUE";
this.numElements = (int)numElements;
this.baseObject = baseObject;
this.baseOffset = baseOffset;
this.sizeInBytes = sizeInBytes;
this.elementOffset = baseOffset + calculateHeaderPortionInBytes(this.numElements);
} | [
"public",
"void",
"pointTo",
"(",
"Object",
"baseObject",
",",
"long",
"baseOffset",
",",
"int",
"sizeInBytes",
")",
"{",
"// Read the number of elements from the first 8 bytes.",
"final",
"long",
"numElements",
"=",
"Platform",
".",
"getLong",
"(",
"baseObject",
",",... | Update this UnsafeArrayData to point to different backing data.
@param baseObject the base object
@param baseOffset the offset within the base object
@param sizeInBytes the size of this array's backing data, in bytes | [
"Update",
"this",
"UnsafeArrayData",
"to",
"point",
"to",
"different",
"backing",
"data",
"."
] | train | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeArrayData.java#L128-L140 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/IOUtils.java | IOUtils.copy | public static void copy(InputStream input, OutputStream output, boolean closeStreams) throws IOException {
try {
copy(input, output);
} finally {
if (closeStreams) {
close(input);
close(output);
}
}
} | java | public static void copy(InputStream input, OutputStream output, boolean closeStreams) throws IOException {
try {
copy(input, output);
} finally {
if (closeStreams) {
close(input);
close(output);
}
}
} | [
"public",
"static",
"void",
"copy",
"(",
"InputStream",
"input",
",",
"OutputStream",
"output",
",",
"boolean",
"closeStreams",
")",
"throws",
"IOException",
"{",
"try",
"{",
"copy",
"(",
"input",
",",
"output",
")",
";",
"}",
"finally",
"{",
"if",
"(",
... | Writes all the contents of an InputStream to an OutputStream.
@param input
the input stream to read from
@param output
the output stream to write to
@param closeStreams
the flag indicating if the stream must be close at the end,
even if an exception occurs
@throws java.io.IOException
if an IOExcption occurs | [
"Writes",
"all",
"the",
"contents",
"of",
"an",
"InputStream",
"to",
"an",
"OutputStream",
"."
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/IOUtils.java#L121-L130 |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.openapi_fat/fat/src/com/ibm/ws/microprofile/openapi/fat/utils/OpenAPIConnection.java | OpenAPIConnection.openAPIDocsConnection | public static OpenAPIConnection openAPIDocsConnection(LibertyServer server, boolean secure) {
return new OpenAPIConnection(server, OPEN_API_DOCS).secure(secure);
} | java | public static OpenAPIConnection openAPIDocsConnection(LibertyServer server, boolean secure) {
return new OpenAPIConnection(server, OPEN_API_DOCS).secure(secure);
} | [
"public",
"static",
"OpenAPIConnection",
"openAPIDocsConnection",
"(",
"LibertyServer",
"server",
",",
"boolean",
"secure",
")",
"{",
"return",
"new",
"OpenAPIConnection",
"(",
"server",
",",
"OPEN_API_DOCS",
")",
".",
"secure",
"(",
"secure",
")",
";",
"}"
] | creates default connection for OpenAPI docs endpoint
@param server - server to connect to
@param secure - if true connection uses HTTPS
@return | [
"creates",
"default",
"connection",
"for",
"OpenAPI",
"docs",
"endpoint"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.openapi_fat/fat/src/com/ibm/ws/microprofile/openapi/fat/utils/OpenAPIConnection.java#L270-L272 |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/locale/Locale.java | Locale.getString | public static String getString(String key, Object... params) {
final Class<?> resource = detectResourceClass(null);
return getString(ClassLoaderFinder.findClassLoader(), resource, key, params);
} | java | public static String getString(String key, Object... params) {
final Class<?> resource = detectResourceClass(null);
return getString(ClassLoaderFinder.findClassLoader(), resource, key, params);
} | [
"public",
"static",
"String",
"getString",
"(",
"String",
"key",
",",
"Object",
"...",
"params",
")",
"{",
"final",
"Class",
"<",
"?",
">",
"resource",
"=",
"detectResourceClass",
"(",
"null",
")",
";",
"return",
"getString",
"(",
"ClassLoaderFinder",
".",
... | Replies the text that corresponds to the specified resource.
<p>This function assumes the classname of the caller as the
resource provider.
@param key is the name of the resource into the specified file
@param params is the the list of parameters which will
replaces the <code>#1</code>, <code>#2</code>... into the string.
@return the text that corresponds to the specified resource | [
"Replies",
"the",
"text",
"that",
"corresponds",
"to",
"the",
"specified",
"resource",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/locale/Locale.java#L309-L312 |
aws/aws-sdk-java | aws-java-sdk-ecs/src/main/java/com/amazonaws/services/ecs/model/ContainerDefinition.java | ContainerDefinition.withDockerLabels | public ContainerDefinition withDockerLabels(java.util.Map<String, String> dockerLabels) {
setDockerLabels(dockerLabels);
return this;
} | java | public ContainerDefinition withDockerLabels(java.util.Map<String, String> dockerLabels) {
setDockerLabels(dockerLabels);
return this;
} | [
"public",
"ContainerDefinition",
"withDockerLabels",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"dockerLabels",
")",
"{",
"setDockerLabels",
"(",
"dockerLabels",
")",
";",
"return",
"this",
";",
"}"
] | <p>
A key/value map of labels to add to the container. This parameter maps to <code>Labels</code> in the <a
href="https://docs.docker.com/engine/api/v1.35/#operation/ContainerCreate">Create a container</a> section of the
<a href="https://docs.docker.com/engine/api/v1.35/">Docker Remote API</a> and the <code>--label</code> option to
<a href="https://docs.docker.com/engine/reference/run/">docker run</a>. This parameter requires version 1.18 of
the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your
container instance, log in to your container instance and run the following command:
<code>sudo docker version --format '{{.Server.APIVersion}}'</code>
</p>
@param dockerLabels
A key/value map of labels to add to the container. This parameter maps to <code>Labels</code> in the <a
href="https://docs.docker.com/engine/api/v1.35/#operation/ContainerCreate">Create a container</a> section
of the <a href="https://docs.docker.com/engine/api/v1.35/">Docker Remote API</a> and the
<code>--label</code> option to <a href="https://docs.docker.com/engine/reference/run/">docker run</a>.
This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To
check the Docker Remote API version on your container instance, log in to your container instance and run
the following command: <code>sudo docker version --format '{{.Server.APIVersion}}'</code>
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"A",
"key",
"/",
"value",
"map",
"of",
"labels",
"to",
"add",
"to",
"the",
"container",
".",
"This",
"parameter",
"maps",
"to",
"<code",
">",
"Labels<",
"/",
"code",
">",
"in",
"the",
"<a",
"href",
"=",
"https",
":",
"//",
"docs",
".",
... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ecs/src/main/java/com/amazonaws/services/ecs/model/ContainerDefinition.java#L5546-L5549 |
bmwcarit/joynr | java/messaging/channel-service/src/main/java/io/joynr/messaging/service/ChannelServiceRestAdapter.java | ChannelServiceRestAdapter.createChannel | @POST
@Produces({ MediaType.TEXT_PLAIN })
public Response createChannel(@QueryParam("ccid") String ccid,
@HeaderParam(ChannelServiceConstants.X_ATMOSPHERE_TRACKING_ID) String atmosphereTrackingId) {
try {
log.info("CREATE channel for channel ID: {}", ccid);
if (ccid == null || ccid.isEmpty())
throw new JoynrHttpException(Status.BAD_REQUEST, JOYNRMESSAGINGERROR_CHANNELNOTSET);
Channel channel = channelService.getChannel(ccid);
if (channel != null) {
String encodedChannelLocation = response.encodeURL(channel.getLocation().toString());
return Response.ok()
.entity(encodedChannelLocation)
.header("Location", encodedChannelLocation)
.header("bp", channel.getBounceProxy().getId())
.build();
}
// look for an existing bounce proxy handling the channel
channel = channelService.createChannel(ccid, atmosphereTrackingId);
String encodedChannelLocation = response.encodeURL(channel.getLocation().toString());
log.debug("encoded channel URL " + channel.getLocation() + " to " + encodedChannelLocation);
return Response.created(URI.create(encodedChannelLocation))
.entity(encodedChannelLocation)
.header("bp", channel.getBounceProxy().getId())
.build();
} catch (WebApplicationException ex) {
throw ex;
} catch (Exception e) {
throw new WebApplicationException(e);
}
} | java | @POST
@Produces({ MediaType.TEXT_PLAIN })
public Response createChannel(@QueryParam("ccid") String ccid,
@HeaderParam(ChannelServiceConstants.X_ATMOSPHERE_TRACKING_ID) String atmosphereTrackingId) {
try {
log.info("CREATE channel for channel ID: {}", ccid);
if (ccid == null || ccid.isEmpty())
throw new JoynrHttpException(Status.BAD_REQUEST, JOYNRMESSAGINGERROR_CHANNELNOTSET);
Channel channel = channelService.getChannel(ccid);
if (channel != null) {
String encodedChannelLocation = response.encodeURL(channel.getLocation().toString());
return Response.ok()
.entity(encodedChannelLocation)
.header("Location", encodedChannelLocation)
.header("bp", channel.getBounceProxy().getId())
.build();
}
// look for an existing bounce proxy handling the channel
channel = channelService.createChannel(ccid, atmosphereTrackingId);
String encodedChannelLocation = response.encodeURL(channel.getLocation().toString());
log.debug("encoded channel URL " + channel.getLocation() + " to " + encodedChannelLocation);
return Response.created(URI.create(encodedChannelLocation))
.entity(encodedChannelLocation)
.header("bp", channel.getBounceProxy().getId())
.build();
} catch (WebApplicationException ex) {
throw ex;
} catch (Exception e) {
throw new WebApplicationException(e);
}
} | [
"@",
"POST",
"@",
"Produces",
"(",
"{",
"MediaType",
".",
"TEXT_PLAIN",
"}",
")",
"public",
"Response",
"createChannel",
"(",
"@",
"QueryParam",
"(",
"\"ccid\"",
")",
"String",
"ccid",
",",
"@",
"HeaderParam",
"(",
"ChannelServiceConstants",
".",
"X_ATMOSPHERE... | HTTP POST to create a channel, returns location to new resource which can
then be long polled. Since the channel id may later change to be a UUID,
not using a PUT but rather POST with used id being returned
@param ccid cluster controller id
@param atmosphereTrackingId tracking id for atmosphere
@return location to new resource | [
"HTTP",
"POST",
"to",
"create",
"a",
"channel",
"returns",
"location",
"to",
"new",
"resource",
"which",
"can",
"then",
"be",
"long",
"polled",
".",
"Since",
"the",
"channel",
"id",
"may",
"later",
"change",
"to",
"be",
"a",
"UUID",
"not",
"using",
"a",
... | train | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/channel-service/src/main/java/io/joynr/messaging/service/ChannelServiceRestAdapter.java#L130-L168 |
Azure/azure-sdk-for-java | datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/AccountsInner.java | AccountsInner.beginCreate | public DataLakeAnalyticsAccountInner beginCreate(String resourceGroupName, String accountName, CreateDataLakeAnalyticsAccountParameters parameters) {
return beginCreateWithServiceResponseAsync(resourceGroupName, accountName, parameters).toBlocking().single().body();
} | java | public DataLakeAnalyticsAccountInner beginCreate(String resourceGroupName, String accountName, CreateDataLakeAnalyticsAccountParameters parameters) {
return beginCreateWithServiceResponseAsync(resourceGroupName, accountName, parameters).toBlocking().single().body();
} | [
"public",
"DataLakeAnalyticsAccountInner",
"beginCreate",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"CreateDataLakeAnalyticsAccountParameters",
"parameters",
")",
"{",
"return",
"beginCreateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"... | Creates the specified Data Lake Analytics account. This supplies the user with computation services for Data Lake Analytics workloads.
@param resourceGroupName The name of the Azure resource group.
@param accountName The name of the Data Lake Analytics account.
@param parameters Parameters supplied to create a new Data Lake Analytics account.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the DataLakeAnalyticsAccountInner object if successful. | [
"Creates",
"the",
"specified",
"Data",
"Lake",
"Analytics",
"account",
".",
"This",
"supplies",
"the",
"user",
"with",
"computation",
"services",
"for",
"Data",
"Lake",
"Analytics",
"workloads",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/AccountsInner.java#L712-L714 |
jronrun/benayn | benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/UriEscaper.java | UriEscaper.escapePath | public static String escapePath(final String path, final boolean strict) {
return (strict ? STRICT_ESCAPER : ESCAPER).escapePath(path);
} | java | public static String escapePath(final String path, final boolean strict) {
return (strict ? STRICT_ESCAPER : ESCAPER).escapePath(path);
} | [
"public",
"static",
"String",
"escapePath",
"(",
"final",
"String",
"path",
",",
"final",
"boolean",
"strict",
")",
"{",
"return",
"(",
"strict",
"?",
"STRICT_ESCAPER",
":",
"ESCAPER",
")",
".",
"escapePath",
"(",
"path",
")",
";",
"}"
] | Escapes a string as a URI path
@param path the path to escape
@param strict whether or not to do strict escaping
@return the escaped string | [
"Escapes",
"a",
"string",
"as",
"a",
"URI",
"path"
] | train | https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/UriEscaper.java#L239-L241 |
Harium/keel | src/main/java/com/harium/keel/catalano/math/function/PerlinNoise.java | PerlinNoise.SmoothedNoise | private double SmoothedNoise(double x, double y) {
int xInt = (int) x;
int yInt = (int) y;
double xFrac = x - xInt;
double yFrac = y - yInt;
// get four noise values
double x0y0 = Noise(xInt, yInt);
double x1y0 = Noise(xInt + 1, yInt);
double x0y1 = Noise(xInt, yInt + 1);
double x1y1 = Noise(xInt + 1, yInt + 1);
// x interpolation
double v1 = CosineInterpolate(x0y0, x1y0, xFrac);
double v2 = CosineInterpolate(x0y1, x1y1, xFrac);
// y interpolation
return CosineInterpolate(v1, v2, yFrac);
} | java | private double SmoothedNoise(double x, double y) {
int xInt = (int) x;
int yInt = (int) y;
double xFrac = x - xInt;
double yFrac = y - yInt;
// get four noise values
double x0y0 = Noise(xInt, yInt);
double x1y0 = Noise(xInt + 1, yInt);
double x0y1 = Noise(xInt, yInt + 1);
double x1y1 = Noise(xInt + 1, yInt + 1);
// x interpolation
double v1 = CosineInterpolate(x0y0, x1y0, xFrac);
double v2 = CosineInterpolate(x0y1, x1y1, xFrac);
// y interpolation
return CosineInterpolate(v1, v2, yFrac);
} | [
"private",
"double",
"SmoothedNoise",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"int",
"xInt",
"=",
"(",
"int",
")",
"x",
";",
"int",
"yInt",
"=",
"(",
"int",
")",
"y",
";",
"double",
"xFrac",
"=",
"x",
"-",
"xInt",
";",
"double",
"yFrac"... | Smoothed noise.
@param x X Value.
@param y Y Value.
@return Value. | [
"Smoothed",
"noise",
"."
] | train | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/function/PerlinNoise.java#L231-L248 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/hadoop/ConfigHelper.java | ConfigHelper.setInputRange | public static void setInputRange(Configuration conf, List<IndexExpression> filter)
{
KeyRange range = new KeyRange().setRow_filter(filter);
conf.set(INPUT_KEYRANGE_CONFIG, thriftToString(range));
} | java | public static void setInputRange(Configuration conf, List<IndexExpression> filter)
{
KeyRange range = new KeyRange().setRow_filter(filter);
conf.set(INPUT_KEYRANGE_CONFIG, thriftToString(range));
} | [
"public",
"static",
"void",
"setInputRange",
"(",
"Configuration",
"conf",
",",
"List",
"<",
"IndexExpression",
">",
"filter",
")",
"{",
"KeyRange",
"range",
"=",
"new",
"KeyRange",
"(",
")",
".",
"setRow_filter",
"(",
"filter",
")",
";",
"conf",
".",
"set... | Set the KeyRange to limit the rows.
@param conf Job configuration you are about to run | [
"Set",
"the",
"KeyRange",
"to",
"limit",
"the",
"rows",
"."
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/hadoop/ConfigHelper.java#L264-L268 |
camunda/camunda-bpm-platform | engine-rest/engine-rest/src/main/java/org/camunda/bpm/engine/rest/util/EngineUtil.java | EngineUtil.lookupProcessEngine | public static ProcessEngine lookupProcessEngine(String engineName) {
ServiceLoader<ProcessEngineProvider> serviceLoader = ServiceLoader.load(ProcessEngineProvider.class);
Iterator<ProcessEngineProvider> iterator = serviceLoader.iterator();
if(iterator.hasNext()) {
ProcessEngineProvider provider = iterator.next();
if (engineName == null) {
return provider.getDefaultProcessEngine();
} else {
return provider.getProcessEngine(engineName);
}
} else {
throw new RestException(Status.INTERNAL_SERVER_ERROR, "Could not find an implementation of the "+ProcessEngineProvider.class+"- SPI");
}
} | java | public static ProcessEngine lookupProcessEngine(String engineName) {
ServiceLoader<ProcessEngineProvider> serviceLoader = ServiceLoader.load(ProcessEngineProvider.class);
Iterator<ProcessEngineProvider> iterator = serviceLoader.iterator();
if(iterator.hasNext()) {
ProcessEngineProvider provider = iterator.next();
if (engineName == null) {
return provider.getDefaultProcessEngine();
} else {
return provider.getProcessEngine(engineName);
}
} else {
throw new RestException(Status.INTERNAL_SERVER_ERROR, "Could not find an implementation of the "+ProcessEngineProvider.class+"- SPI");
}
} | [
"public",
"static",
"ProcessEngine",
"lookupProcessEngine",
"(",
"String",
"engineName",
")",
"{",
"ServiceLoader",
"<",
"ProcessEngineProvider",
">",
"serviceLoader",
"=",
"ServiceLoader",
".",
"load",
"(",
"ProcessEngineProvider",
".",
"class",
")",
";",
"Iterator",... | Look up the process engine from the {@link ProcessEngineProvider}. If engineName is null, the default engine is returned.
@param engineName
@return | [
"Look",
"up",
"the",
"process",
"engine",
"from",
"the",
"{"
] | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine-rest/engine-rest/src/main/java/org/camunda/bpm/engine/rest/util/EngineUtil.java#L34-L49 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/crdt/pncounter/PNCounterProxy.java | PNCounterProxy.invokeInternal | private long invokeInternal(Operation operation, List<Address> excludedAddresses,
HazelcastException lastException) {
final Address target = getCRDTOperationTarget(excludedAddresses);
if (target == null) {
throw lastException != null
? lastException
: new NoDataMemberInClusterException(
"Cannot invoke operations on a CRDT because the cluster does not contain any data members");
}
try {
final InvocationBuilder builder = getNodeEngine().getOperationService()
.createInvocationBuilder(SERVICE_NAME, operation, target);
if (operationTryCount > 0) {
builder.setTryCount(operationTryCount);
}
final InternalCompletableFuture<CRDTTimestampedLong> future = builder.invoke();
final CRDTTimestampedLong result = future.join();
updateObservedReplicaTimestamps(result.getVectorClock());
return result.getValue();
} catch (HazelcastException e) {
logger.fine("Exception occurred while invoking operation on target " + target + ", choosing different target", e);
if (excludedAddresses == EMPTY_ADDRESS_LIST) {
excludedAddresses = new ArrayList<Address>();
}
excludedAddresses.add(target);
return invokeInternal(operation, excludedAddresses, e);
}
} | java | private long invokeInternal(Operation operation, List<Address> excludedAddresses,
HazelcastException lastException) {
final Address target = getCRDTOperationTarget(excludedAddresses);
if (target == null) {
throw lastException != null
? lastException
: new NoDataMemberInClusterException(
"Cannot invoke operations on a CRDT because the cluster does not contain any data members");
}
try {
final InvocationBuilder builder = getNodeEngine().getOperationService()
.createInvocationBuilder(SERVICE_NAME, operation, target);
if (operationTryCount > 0) {
builder.setTryCount(operationTryCount);
}
final InternalCompletableFuture<CRDTTimestampedLong> future = builder.invoke();
final CRDTTimestampedLong result = future.join();
updateObservedReplicaTimestamps(result.getVectorClock());
return result.getValue();
} catch (HazelcastException e) {
logger.fine("Exception occurred while invoking operation on target " + target + ", choosing different target", e);
if (excludedAddresses == EMPTY_ADDRESS_LIST) {
excludedAddresses = new ArrayList<Address>();
}
excludedAddresses.add(target);
return invokeInternal(operation, excludedAddresses, e);
}
} | [
"private",
"long",
"invokeInternal",
"(",
"Operation",
"operation",
",",
"List",
"<",
"Address",
">",
"excludedAddresses",
",",
"HazelcastException",
"lastException",
")",
"{",
"final",
"Address",
"target",
"=",
"getCRDTOperationTarget",
"(",
"excludedAddresses",
")",... | Invokes the {@code operation} recursively on viable replica addresses
until successful or the list of viable replicas is exhausted.
Replicas with addresses contained in the {@code excludedAddresses} are
skipped. If there are no viable replicas, this method will throw the
{@code lastException} if not {@code null} or a
{@link NoDataMemberInClusterException} if the {@code lastException} is
{@code null}.
@param operation the operation to invoke on a CRDT replica
@param excludedAddresses the addresses to exclude when choosing a replica
address, must not be {@code null}
@param lastException the exception thrown from the last invocation of
the {@code operation} on a replica, may be {@code null}
@return the result of the operation invocation on a replica
@throws NoDataMemberInClusterException if there are no replicas and the
{@code lastException} is {@code null} | [
"Invokes",
"the",
"{",
"@code",
"operation",
"}",
"recursively",
"on",
"viable",
"replica",
"addresses",
"until",
"successful",
"or",
"the",
"list",
"of",
"viable",
"replicas",
"is",
"exhausted",
".",
"Replicas",
"with",
"addresses",
"contained",
"in",
"the",
... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/crdt/pncounter/PNCounterProxy.java#L184-L211 |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/maplayer/MultiMapLayer.java | MultiMapLayer.fireLayerMovedDownEvent | protected void fireLayerMovedDownEvent(MapLayer layer, int newIndex) {
fireLayerHierarchyChangedEvent(new MapLayerHierarchyEvent(this, layer,
Type.MOVE_CHILD_DOWN, newIndex, layer.isTemporaryLayer()));
} | java | protected void fireLayerMovedDownEvent(MapLayer layer, int newIndex) {
fireLayerHierarchyChangedEvent(new MapLayerHierarchyEvent(this, layer,
Type.MOVE_CHILD_DOWN, newIndex, layer.isTemporaryLayer()));
} | [
"protected",
"void",
"fireLayerMovedDownEvent",
"(",
"MapLayer",
"layer",
",",
"int",
"newIndex",
")",
"{",
"fireLayerHierarchyChangedEvent",
"(",
"new",
"MapLayerHierarchyEvent",
"(",
"this",
",",
"layer",
",",
"Type",
".",
"MOVE_CHILD_DOWN",
",",
"newIndex",
",",
... | Fire the event that indicates a layer was moved down.
@param layer is the moved layer.
@param newIndex is the new index of the layer. | [
"Fire",
"the",
"event",
"that",
"indicates",
"a",
"layer",
"was",
"moved",
"down",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/maplayer/MultiMapLayer.java#L472-L475 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfContentByte.java | PdfContentByte.concatCTM | public void concatCTM(float a, float b, float c, float d, float e, float f) {
content.append(a).append(' ').append(b).append(' ').append(c).append(' ');
content.append(d).append(' ').append(e).append(' ').append(f).append(" cm").append_i(separator);
} | java | public void concatCTM(float a, float b, float c, float d, float e, float f) {
content.append(a).append(' ').append(b).append(' ').append(c).append(' ');
content.append(d).append(' ').append(e).append(' ').append(f).append(" cm").append_i(separator);
} | [
"public",
"void",
"concatCTM",
"(",
"float",
"a",
",",
"float",
"b",
",",
"float",
"c",
",",
"float",
"d",
",",
"float",
"e",
",",
"float",
"f",
")",
"{",
"content",
".",
"append",
"(",
"a",
")",
".",
"append",
"(",
"'",
"'",
")",
".",
"append"... | Concatenate a matrix to the current transformation matrix.
@param a an element of the transformation matrix
@param b an element of the transformation matrix
@param c an element of the transformation matrix
@param d an element of the transformation matrix
@param e an element of the transformation matrix
@param f an element of the transformation matrix | [
"Concatenate",
"a",
"matrix",
"to",
"the",
"current",
"transformation",
"matrix",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfContentByte.java#L1781-L1784 |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/impl/core/jackson/JAXBAnnotationsHelper.java | JAXBAnnotationsHelper.applyElement | private static void applyElement(Annotated member, Schema property) {
final XmlElementWrapper wrapper = member.getAnnotation(XmlElementWrapper.class);
if (wrapper != null) {
final XML xml = getXml(property);
xml.setWrapped(true);
// No need to set the xml name if the name provided by xmlelementwrapper annotation is ##default or equal to the property name | https://github.com/swagger-api/swagger-core/pull/2050
if (!"##default".equals(wrapper.name()) && !wrapper.name().isEmpty() && !wrapper.name().equals(((SchemaImpl) property).getName())) {
xml.setName(wrapper.name());
}
} else {
final XmlElement element = member.getAnnotation(XmlElement.class);
if (element != null) {
setName(element.namespace(), element.name(), property);
}
}
} | java | private static void applyElement(Annotated member, Schema property) {
final XmlElementWrapper wrapper = member.getAnnotation(XmlElementWrapper.class);
if (wrapper != null) {
final XML xml = getXml(property);
xml.setWrapped(true);
// No need to set the xml name if the name provided by xmlelementwrapper annotation is ##default or equal to the property name | https://github.com/swagger-api/swagger-core/pull/2050
if (!"##default".equals(wrapper.name()) && !wrapper.name().isEmpty() && !wrapper.name().equals(((SchemaImpl) property).getName())) {
xml.setName(wrapper.name());
}
} else {
final XmlElement element = member.getAnnotation(XmlElement.class);
if (element != null) {
setName(element.namespace(), element.name(), property);
}
}
} | [
"private",
"static",
"void",
"applyElement",
"(",
"Annotated",
"member",
",",
"Schema",
"property",
")",
"{",
"final",
"XmlElementWrapper",
"wrapper",
"=",
"member",
".",
"getAnnotation",
"(",
"XmlElementWrapper",
".",
"class",
")",
";",
"if",
"(",
"wrapper",
... | Puts definitions for XML element.
@param member annotations provider
@param property property instance to be updated | [
"Puts",
"definitions",
"for",
"XML",
"element",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/impl/core/jackson/JAXBAnnotationsHelper.java#L55-L70 |
BotMill/fb-botmill | src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/BoardingPassBuilder.java | BoardingPassBuilder.addSecondaryField | public BoardingPassBuilder addSecondaryField(String label, String value) {
Field field = new Field(label, value);
this.boardingPass.addSecondaryField(field);
return this;
} | java | public BoardingPassBuilder addSecondaryField(String label, String value) {
Field field = new Field(label, value);
this.boardingPass.addSecondaryField(field);
return this;
} | [
"public",
"BoardingPassBuilder",
"addSecondaryField",
"(",
"String",
"label",
",",
"String",
"value",
")",
"{",
"Field",
"field",
"=",
"new",
"Field",
"(",
"label",
",",
"value",
")",
";",
"this",
".",
"boardingPass",
".",
"addSecondaryField",
"(",
"field",
... | Adds a secondary field for the current {@link BoardingPass} object. This
field is optional. There can be at most 5 secondary fields per boarding
pass.
@param label
the label for the additional field. It can't be empty.
@param value
the value for the additional field. It can't be empty.
@return this builder. | [
"Adds",
"a",
"secondary",
"field",
"for",
"the",
"current",
"{",
"@link",
"BoardingPass",
"}",
"object",
".",
"This",
"field",
"is",
"optional",
".",
"There",
"can",
"be",
"at",
"most",
"5",
"secondary",
"fields",
"per",
"boarding",
"pass",
"."
] | train | https://github.com/BotMill/fb-botmill/blob/d94da3615a7339822c137ef75c92a03d791ee969/src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/BoardingPassBuilder.java#L146-L150 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java | DiagnosticsInner.getSiteDiagnosticCategory | public DiagnosticCategoryInner getSiteDiagnosticCategory(String resourceGroupName, String siteName, String diagnosticCategory) {
return getSiteDiagnosticCategoryWithServiceResponseAsync(resourceGroupName, siteName, diagnosticCategory).toBlocking().single().body();
} | java | public DiagnosticCategoryInner getSiteDiagnosticCategory(String resourceGroupName, String siteName, String diagnosticCategory) {
return getSiteDiagnosticCategoryWithServiceResponseAsync(resourceGroupName, siteName, diagnosticCategory).toBlocking().single().body();
} | [
"public",
"DiagnosticCategoryInner",
"getSiteDiagnosticCategory",
"(",
"String",
"resourceGroupName",
",",
"String",
"siteName",
",",
"String",
"diagnosticCategory",
")",
"{",
"return",
"getSiteDiagnosticCategoryWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"siteNam... | Get Diagnostics Category.
Get Diagnostics Category.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param siteName Site Name
@param diagnosticCategory Diagnostic Category
@throws IllegalArgumentException thrown if parameters fail the validation
@throws DefaultErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the DiagnosticCategoryInner object if successful. | [
"Get",
"Diagnostics",
"Category",
".",
"Get",
"Diagnostics",
"Category",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java#L300-L302 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapAdapter.java | LdapAdapter.getContextProperty | public static String getContextProperty(Root root, String propertyName) {
String result = "";
List<Context> contexts = root.getContexts();
for (Context context : contexts) {
String key = context.getKey();
if (key != null && key.equals(propertyName)) {
result = (String) context.getValue();
break;
}
}
return result;
} | java | public static String getContextProperty(Root root, String propertyName) {
String result = "";
List<Context> contexts = root.getContexts();
for (Context context : contexts) {
String key = context.getKey();
if (key != null && key.equals(propertyName)) {
result = (String) context.getValue();
break;
}
}
return result;
} | [
"public",
"static",
"String",
"getContextProperty",
"(",
"Root",
"root",
",",
"String",
"propertyName",
")",
"{",
"String",
"result",
"=",
"\"\"",
";",
"List",
"<",
"Context",
">",
"contexts",
"=",
"root",
".",
"getContexts",
"(",
")",
";",
"for",
"(",
"... | return the customProperty from the root object of the input data graph
@param root
@param propertyName
@return | [
"return",
"the",
"customProperty",
"from",
"the",
"root",
"object",
"of",
"the",
"input",
"data",
"graph"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapAdapter.java#L2678-L2689 |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/GaliosFieldTableOps.java | GaliosFieldTableOps.polyAddScaleB | public void polyAddScaleB(GrowQueue_I8 polyA , GrowQueue_I8 polyB , int scaleB , GrowQueue_I8 output ) {
output.resize(Math.max(polyA.size,polyB.size));
// compute offset that would align the smaller polynomial with the larger polynomial
int offsetA = Math.max(0,polyB.size-polyA.size);
int offsetB = Math.max(0,polyA.size-polyB.size);
int N = output.size;
for (int i = 0; i < offsetB; i++) {
output.data[i] = polyA.data[i];
}
for (int i = 0; i < offsetA; i++) {
output.data[i] = (byte)multiply(polyB.data[i]&0xFF,scaleB);
}
for (int i = Math.max(offsetA,offsetB); i < N; i++) {
output.data[i] = (byte)((polyA.data[i-offsetA]&0xFF) ^ multiply(polyB.data[i-offsetB]&0xFF,scaleB));
}
} | java | public void polyAddScaleB(GrowQueue_I8 polyA , GrowQueue_I8 polyB , int scaleB , GrowQueue_I8 output ) {
output.resize(Math.max(polyA.size,polyB.size));
// compute offset that would align the smaller polynomial with the larger polynomial
int offsetA = Math.max(0,polyB.size-polyA.size);
int offsetB = Math.max(0,polyA.size-polyB.size);
int N = output.size;
for (int i = 0; i < offsetB; i++) {
output.data[i] = polyA.data[i];
}
for (int i = 0; i < offsetA; i++) {
output.data[i] = (byte)multiply(polyB.data[i]&0xFF,scaleB);
}
for (int i = Math.max(offsetA,offsetB); i < N; i++) {
output.data[i] = (byte)((polyA.data[i-offsetA]&0xFF) ^ multiply(polyB.data[i-offsetB]&0xFF,scaleB));
}
} | [
"public",
"void",
"polyAddScaleB",
"(",
"GrowQueue_I8",
"polyA",
",",
"GrowQueue_I8",
"polyB",
",",
"int",
"scaleB",
",",
"GrowQueue_I8",
"output",
")",
"{",
"output",
".",
"resize",
"(",
"Math",
".",
"max",
"(",
"polyA",
".",
"size",
",",
"polyB",
".",
... | Adds two polynomials together while scaling the second.
<p>Coefficients for largest powers are first, e.g. 2*x**3 + 8*x**2+1 = [2,8,0,1]</p>
@param polyA (Input) First polynomial
@param polyB (Input) Second polynomial
@param scaleB (Input) Scale factor applied to polyB
@param output (Output) Results of addition | [
"Adds",
"two",
"polynomials",
"together",
"while",
"scaling",
"the",
"second",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/GaliosFieldTableOps.java#L201-L218 |
strator-dev/greenpepper | greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/velocity/ConfluenceGreenPepper.java | ConfluenceGreenPepper.savePreviousImplementedVersion | public void savePreviousImplementedVersion(Page page, Integer version) {
String value = version != null ? String.valueOf(version) : null;
ContentEntityObject entityObject = getContentEntityManager().getById(page.getId());
getContentPropertyManager().setStringProperty(entityObject, PREVIOUS_IMPLEMENTED_VERSION, value);
} | java | public void savePreviousImplementedVersion(Page page, Integer version) {
String value = version != null ? String.valueOf(version) : null;
ContentEntityObject entityObject = getContentEntityManager().getById(page.getId());
getContentPropertyManager().setStringProperty(entityObject, PREVIOUS_IMPLEMENTED_VERSION, value);
} | [
"public",
"void",
"savePreviousImplementedVersion",
"(",
"Page",
"page",
",",
"Integer",
"version",
")",
"{",
"String",
"value",
"=",
"version",
"!=",
"null",
"?",
"String",
".",
"valueOf",
"(",
"version",
")",
":",
"null",
";",
"ContentEntityObject",
"entityO... | Saves the sprecified version as the Previous implemented version
@param page a {@link com.atlassian.confluence.pages.Page} object.
@param version a {@link java.lang.Integer} object. | [
"Saves",
"the",
"sprecified",
"version",
"as",
"the",
"Previous",
"implemented",
"version"
] | train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/velocity/ConfluenceGreenPepper.java#L576-L580 |
asterisk-java/asterisk-java | src/main/java/org/asteriskjava/util/DateUtil.java | DateUtil.parseDateTime | public static Date parseDateTime(String s, TimeZone tz)
{
DateFormat df;
if (s == null)
{
return null;
}
df = new SimpleDateFormat(DATE_TIME_PATTERN);
if (tz != null)
{
df.setTimeZone(tz);
}
try
{
return df.parse(s);
}
catch (ParseException e)
{
return null;
}
} | java | public static Date parseDateTime(String s, TimeZone tz)
{
DateFormat df;
if (s == null)
{
return null;
}
df = new SimpleDateFormat(DATE_TIME_PATTERN);
if (tz != null)
{
df.setTimeZone(tz);
}
try
{
return df.parse(s);
}
catch (ParseException e)
{
return null;
}
} | [
"public",
"static",
"Date",
"parseDateTime",
"(",
"String",
"s",
",",
"TimeZone",
"tz",
")",
"{",
"DateFormat",
"df",
";",
"if",
"(",
"s",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"df",
"=",
"new",
"SimpleDateFormat",
"(",
"DATE_TIME_PATTERN",... | Converts a date in the form of "yy-MM-dd HH:mm:ss" to a Date object using
the given time zone.
@param s date string in the form of "yy-MM-dd HH:mm:ss"
@param tz the timezone to use or <code>null</code> for the default time
zone.
@return the corresponding Java date object or <code>null</code> if it is
not parsable. | [
"Converts",
"a",
"date",
"in",
"the",
"form",
"of",
"yy",
"-",
"MM",
"-",
"dd",
"HH",
":",
"mm",
":",
"ss",
"to",
"a",
"Date",
"object",
"using",
"the",
"given",
"time",
"zone",
"."
] | train | https://github.com/asterisk-java/asterisk-java/blob/cdc9849270d97ef75afa447a02c5194ed29121eb/src/main/java/org/asteriskjava/util/DateUtil.java#L95-L117 |
steveash/jopenfst | src/main/java/com/github/steveash/jopenfst/operations/Compose.java | Compose.composeWithPrecomputed | public static MutableFst composeWithPrecomputed(MutableFst fst1, PrecomputedComposeFst fst2, boolean useSorted, boolean trimOutput) {
fst1.throwIfInvalid();
if (useSorted) {
if (fst1.getOutputSymbols() != fst2.getFstInputSymbolsAsFrozen() &&
fst1.getOutputSymbols() != fst2.getFst().getInputSymbols()) {
throw new IllegalArgumentException("When using the precomputed and useSorted optimization, you must have " +
"the outer's output symbol be the same symbol table as the inner's input");
}
}
Semiring semiring = fst2.getSemiring();
augment(AugmentLabels.OUTPUT, fst1, semiring, fst2.getEps1(), fst2.getEps2());
if (useSorted) {
ArcSort.sortByOutput(fst1);
}
ImmutableFst filter = fst2.getFilterFst();
MutableFst tmp = Compose.doCompose(fst1, filter, semiring, useSorted);
if (useSorted) {
ArcSort.sortByOutput(tmp);
}
MutableFst res = Compose.doCompose(tmp, fst2.getFst(), semiring, useSorted);
// definitionally the output of compose should be trimmed, but if you don't care, you can save some cpu
if (trimOutput) {
Connect.apply(res);
}
return res;
} | java | public static MutableFst composeWithPrecomputed(MutableFst fst1, PrecomputedComposeFst fst2, boolean useSorted, boolean trimOutput) {
fst1.throwIfInvalid();
if (useSorted) {
if (fst1.getOutputSymbols() != fst2.getFstInputSymbolsAsFrozen() &&
fst1.getOutputSymbols() != fst2.getFst().getInputSymbols()) {
throw new IllegalArgumentException("When using the precomputed and useSorted optimization, you must have " +
"the outer's output symbol be the same symbol table as the inner's input");
}
}
Semiring semiring = fst2.getSemiring();
augment(AugmentLabels.OUTPUT, fst1, semiring, fst2.getEps1(), fst2.getEps2());
if (useSorted) {
ArcSort.sortByOutput(fst1);
}
ImmutableFst filter = fst2.getFilterFst();
MutableFst tmp = Compose.doCompose(fst1, filter, semiring, useSorted);
if (useSorted) {
ArcSort.sortByOutput(tmp);
}
MutableFst res = Compose.doCompose(tmp, fst2.getFst(), semiring, useSorted);
// definitionally the output of compose should be trimmed, but if you don't care, you can save some cpu
if (trimOutput) {
Connect.apply(res);
}
return res;
} | [
"public",
"static",
"MutableFst",
"composeWithPrecomputed",
"(",
"MutableFst",
"fst1",
",",
"PrecomputedComposeFst",
"fst2",
",",
"boolean",
"useSorted",
",",
"boolean",
"trimOutput",
")",
"{",
"fst1",
".",
"throwIfInvalid",
"(",
")",
";",
"if",
"(",
"useSorted",
... | Executes a compose of fst1 o fst2, with fst2 being a precomputed/preprocessed fst (for performance reasons)
@param fst1 outer fst
@param fst2 inner fst
@param useSorted if true, then performance will be faster; NOTE fst1 must be sorted by OUTPUT labels
@param trimOutput if true, then output will be trimmed before returning
@return | [
"Executes",
"a",
"compose",
"of",
"fst1",
"o",
"fst2",
"with",
"fst2",
"being",
"a",
"precomputed",
"/",
"preprocessed",
"fst",
"(",
"for",
"performance",
"reasons",
")"
] | train | https://github.com/steveash/jopenfst/blob/4c675203015c1cfad2072556cb532b6edc73261d/src/main/java/com/github/steveash/jopenfst/operations/Compose.java#L95-L121 |
ThreeTen/threeten-extra | src/main/java/org/threeten/extra/YearQuarter.java | YearQuarter.withQuarter | public YearQuarter withQuarter(int quarter) {
QUARTER_OF_YEAR.range().checkValidValue(quarter, QUARTER_OF_YEAR);
return with(year, Quarter.of(quarter));
} | java | public YearQuarter withQuarter(int quarter) {
QUARTER_OF_YEAR.range().checkValidValue(quarter, QUARTER_OF_YEAR);
return with(year, Quarter.of(quarter));
} | [
"public",
"YearQuarter",
"withQuarter",
"(",
"int",
"quarter",
")",
"{",
"QUARTER_OF_YEAR",
".",
"range",
"(",
")",
".",
"checkValidValue",
"(",
"quarter",
",",
"QUARTER_OF_YEAR",
")",
";",
"return",
"with",
"(",
"year",
",",
"Quarter",
".",
"of",
"(",
"qu... | Returns a copy of this {@code YearQuarter} with the quarter-of-year altered.
<p>
This instance is immutable and unaffected by this method call.
@param quarter the quarter-of-year to set in the returned year-quarter, from 1 to 4
@return a {@code YearQuarter} based on this year-quarter with the requested quarter, not null
@throws DateTimeException if the quarter-of-year value is invalid | [
"Returns",
"a",
"copy",
"of",
"this",
"{",
"@code",
"YearQuarter",
"}",
"with",
"the",
"quarter",
"-",
"of",
"-",
"year",
"altered",
".",
"<p",
">",
"This",
"instance",
"is",
"immutable",
"and",
"unaffected",
"by",
"this",
"method",
"call",
"."
] | train | https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/YearQuarter.java#L734-L737 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/QuatSymmetryDetector.java | QuatSymmetryDetector.calcLocalSymmetries | public static List<QuatSymmetryResults> calcLocalSymmetries(
Structure structure, QuatSymmetryParameters symmParams,
SubunitClustererParameters clusterParams) {
Stoichiometry composition = SubunitClusterer.cluster(structure, clusterParams);
return calcLocalSymmetries(composition, symmParams);
} | java | public static List<QuatSymmetryResults> calcLocalSymmetries(
Structure structure, QuatSymmetryParameters symmParams,
SubunitClustererParameters clusterParams) {
Stoichiometry composition = SubunitClusterer.cluster(structure, clusterParams);
return calcLocalSymmetries(composition, symmParams);
} | [
"public",
"static",
"List",
"<",
"QuatSymmetryResults",
">",
"calcLocalSymmetries",
"(",
"Structure",
"structure",
",",
"QuatSymmetryParameters",
"symmParams",
",",
"SubunitClustererParameters",
"clusterParams",
")",
"{",
"Stoichiometry",
"composition",
"=",
"SubunitCluster... | Returns a List of LOCAL symmetry results. This means that a subset of the
{@link SubunitCluster} is left out of the symmetry calculation. Each
element of the List is one possible LOCAL symmetry result.
<p>
Determine local symmetry if global structure is: (1) asymmetric, C1; (2)
heteromeric (belongs to more than 1 subunit cluster); (3) more than 2
subunits (heteromers with just 2 chains cannot have local symmetry)
@param structure
protein chains will be extracted as {@link Subunit}
@param symmParams
quaternary symmetry parameters
@param clusterParams
subunit clustering parameters
@return List of LOCAL quaternary structure symmetry results. Empty if
none. | [
"Returns",
"a",
"List",
"of",
"LOCAL",
"symmetry",
"results",
".",
"This",
"means",
"that",
"a",
"subset",
"of",
"the",
"{",
"@link",
"SubunitCluster",
"}",
"is",
"left",
"out",
"of",
"the",
"symmetry",
"calculation",
".",
"Each",
"element",
"of",
"the",
... | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/QuatSymmetryDetector.java#L149-L155 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.