repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 218 | func_name stringlengths 4 140 | whole_func_string stringlengths 153 5.32k | language stringclasses 1
value | func_code_string stringlengths 72 4k | func_code_tokens listlengths 20 832 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 102 339 |
|---|---|---|---|---|---|---|---|---|---|---|
davidmoten/rxjava-jdbc | src/main/java/com/github/davidmoten/rx/jdbc/Database.java | Database.from | public static Database from(String url, String username, String password) {
"""
Returns a {@link Database} based on a jdbc connection string.
@param url
jdbc url
@param username
username for connection
@param password
password for connection
@return the database object
"""
return new Database(... | java | public static Database from(String url, String username, String password) {
return new Database(url, username, password);
} | [
"public",
"static",
"Database",
"from",
"(",
"String",
"url",
",",
"String",
"username",
",",
"String",
"password",
")",
"{",
"return",
"new",
"Database",
"(",
"url",
",",
"username",
",",
"password",
")",
";",
"}"
] | Returns a {@link Database} based on a jdbc connection string.
@param url
jdbc url
@param username
username for connection
@param password
password for connection
@return the database object | [
"Returns",
"a",
"{",
"@link",
"Database",
"}",
"based",
"on",
"a",
"jdbc",
"connection",
"string",
"."
] | train | https://github.com/davidmoten/rxjava-jdbc/blob/81e157d7071a825086bde81107b8694684cdff14/src/main/java/com/github/davidmoten/rx/jdbc/Database.java#L225-L227 |
drinkjava2/jBeanBox | jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/util/CheckClassAdapter.java | CheckClassAdapter.checkFormalTypeParameters | private static int checkFormalTypeParameters(final String signature, int pos) {
"""
Checks the formal type parameters of a class or method signature.
@param signature
a string containing the signature that must be checked.
@param pos
index of first character to be checked.
@return the index of the first cha... | java | private static int checkFormalTypeParameters(final String signature, int pos) {
// FormalTypeParameters:
// < FormalTypeParameter+ >
pos = checkChar('<', signature, pos);
pos = checkFormalTypeParameter(signature, pos);
while (getChar(signature, pos) != '>') {
pos = c... | [
"private",
"static",
"int",
"checkFormalTypeParameters",
"(",
"final",
"String",
"signature",
",",
"int",
"pos",
")",
"{",
"// FormalTypeParameters:",
"// < FormalTypeParameter+ >",
"pos",
"=",
"checkChar",
"(",
"'",
"'",
",",
"signature",
",",
"pos",
")",
";",
... | Checks the formal type parameters of a class or method signature.
@param signature
a string containing the signature that must be checked.
@param pos
index of first character to be checked.
@return the index of the first character after the checked part. | [
"Checks",
"the",
"formal",
"type",
"parameters",
"of",
"a",
"class",
"or",
"method",
"signature",
"."
] | train | https://github.com/drinkjava2/jBeanBox/blob/01c216599ffa2e5f2d9c01df2adaad0f45567c04/jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/util/CheckClassAdapter.java#L775-L785 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/sampling/ReservoirLongsSketch.java | ReservoirLongsSketch.getInstance | static ReservoirLongsSketch getInstance(final long[] data, final long itemsSeen,
final ResizeFactor rf, final int k) {
"""
Thin wrapper around private constructor
@param data Reservoir items as long[]
@param itemsSeen Number of items presented to the sketch so far
@pa... | java | static ReservoirLongsSketch getInstance(final long[] data, final long itemsSeen,
final ResizeFactor rf, final int k) {
return new ReservoirLongsSketch(data, itemsSeen, rf, k);
} | [
"static",
"ReservoirLongsSketch",
"getInstance",
"(",
"final",
"long",
"[",
"]",
"data",
",",
"final",
"long",
"itemsSeen",
",",
"final",
"ResizeFactor",
"rf",
",",
"final",
"int",
"k",
")",
"{",
"return",
"new",
"ReservoirLongsSketch",
"(",
"data",
",",
"it... | Thin wrapper around private constructor
@param data Reservoir items as long[]
@param itemsSeen Number of items presented to the sketch so far
@param rf <a href="{@docRoot}/resources/dictionary.html#resizeFactor">See Resize Factor</a>
@param k Maximum reservoir size
@return New sketch built with the provided inputs | [
"Thin",
"wrapper",
"around",
"private",
"constructor"
] | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/sampling/ReservoirLongsSketch.java#L241-L244 |
javalite/activejdbc | activejdbc/src/main/java/org/javalite/activejdbc/Errors.java | Errors.get | public String get(String attributeName, Object... params) {
"""
Provides a message from the resource bundle <code>activejdbc_messages</code> which is merged
with parameters. This methods expects the message in the resource bundle to be parametrized.
This message is configured for a validator using a Fluent Inter... | java | public String get(String attributeName, Object... params) {
if (attributeName == null) throw new NullPointerException("attributeName cannot be null");
return validators.get(attributeName).formatMessage(locale, params);
} | [
"public",
"String",
"get",
"(",
"String",
"attributeName",
",",
"Object",
"...",
"params",
")",
"{",
"if",
"(",
"attributeName",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"attributeName cannot be null\"",
")",
";",
"return",
"validators",
... | Provides a message from the resource bundle <code>activejdbc_messages</code> which is merged
with parameters. This methods expects the message in the resource bundle to be parametrized.
This message is configured for a validator using a Fluent Interface when declaring a validator:
<pre>
public class Temperature extends... | [
"Provides",
"a",
"message",
"from",
"the",
"resource",
"bundle",
"<code",
">",
"activejdbc_messages<",
"/",
"code",
">",
"which",
"is",
"merged",
"with",
"parameters",
".",
"This",
"methods",
"expects",
"the",
"message",
"in",
"the",
"resource",
"bundle",
"to"... | train | https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/Errors.java#L91-L95 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/slim/XmlFixture.java | XmlFixture.registerPrefixForNamespace | public void registerPrefixForNamespace(String prefix, String namespace) {
"""
Register a prefix to use in XPath expressions.
@param prefix prefix to be used in xPath expressions.
@param namespace XML namespace the prefix should point to.
"""
getEnvironment().registerNamespace(prefix, getUrl(namesp... | java | public void registerPrefixForNamespace(String prefix, String namespace) {
getEnvironment().registerNamespace(prefix, getUrl(namespace));
} | [
"public",
"void",
"registerPrefixForNamespace",
"(",
"String",
"prefix",
",",
"String",
"namespace",
")",
"{",
"getEnvironment",
"(",
")",
".",
"registerNamespace",
"(",
"prefix",
",",
"getUrl",
"(",
"namespace",
")",
")",
";",
"}"
] | Register a prefix to use in XPath expressions.
@param prefix prefix to be used in xPath expressions.
@param namespace XML namespace the prefix should point to. | [
"Register",
"a",
"prefix",
"to",
"use",
"in",
"XPath",
"expressions",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/XmlFixture.java#L52-L54 |
Azure/azure-sdk-for-java | compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java | VirtualMachineScaleSetsInner.beginDeleteInstancesAsync | public Observable<OperationStatusResponseInner> beginDeleteInstancesAsync(String resourceGroupName, String vmScaleSetName, List<String> instanceIds) {
"""
Deletes virtual machines in a VM scale set.
@param resourceGroupName The name of the resource group.
@param vmScaleSetName The name of the VM scale set.
@p... | java | public Observable<OperationStatusResponseInner> beginDeleteInstancesAsync(String resourceGroupName, String vmScaleSetName, List<String> instanceIds) {
return beginDeleteInstancesWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds).map(new Func1<ServiceResponse<OperationStatusResponseInner>, ... | [
"public",
"Observable",
"<",
"OperationStatusResponseInner",
">",
"beginDeleteInstancesAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"vmScaleSetName",
",",
"List",
"<",
"String",
">",
"instanceIds",
")",
"{",
"return",
"beginDeleteInstancesWithServiceResponseAs... | Deletes virtual machines in a VM scale set.
@param resourceGroupName The name of the resource group.
@param vmScaleSetName The name of the VM scale set.
@param instanceIds The virtual machine scale set instance ids.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the... | [
"Deletes",
"virtual",
"machines",
"in",
"a",
"VM",
"scale",
"set",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java#L1226-L1233 |
TheHortonMachine/hortonmachine | gears/src/main/java/oms3/compiler/MemorySourceJavaFileObject.java | MemorySourceJavaFileObject.createUriFromName | private static URI createUriFromName(String name) {
"""
Creates a URI from a source file name.
@param name the source file name.
@return the URI.
@throws NullPointerException if <code>name</code>
is null.
@throws IllegalArgumentException if <code>name</code>
is invalid.
"""
if (name == null) {
... | java | private static URI createUriFromName(String name) {
if (name == null) {
throw new NullPointerException("name");
}
try {
return new URI(name);
} catch (final URISyntaxException e) {
throw new IllegalArgumentException("Invalid name: " + name, e);
... | [
"private",
"static",
"URI",
"createUriFromName",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"name\"",
")",
";",
"}",
"try",
"{",
"return",
"new",
"URI",
"(",
"name",
")",
"... | Creates a URI from a source file name.
@param name the source file name.
@return the URI.
@throws NullPointerException if <code>name</code>
is null.
@throws IllegalArgumentException if <code>name</code>
is invalid. | [
"Creates",
"a",
"URI",
"from",
"a",
"source",
"file",
"name",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/compiler/MemorySourceJavaFileObject.java#L44-L53 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.deposit_depositId_paidBills_billId_details_billDetailId_GET | public OvhBillDetail deposit_depositId_paidBills_billId_details_billDetailId_GET(String depositId, String billId, String billDetailId) throws IOException {
"""
Get this object properties
REST: GET /me/deposit/{depositId}/paidBills/{billId}/details/{billDetailId}
@param depositId [required]
@param billId [requ... | java | public OvhBillDetail deposit_depositId_paidBills_billId_details_billDetailId_GET(String depositId, String billId, String billDetailId) throws IOException {
String qPath = "/me/deposit/{depositId}/paidBills/{billId}/details/{billDetailId}";
StringBuilder sb = path(qPath, depositId, billId, billDetailId);
String re... | [
"public",
"OvhBillDetail",
"deposit_depositId_paidBills_billId_details_billDetailId_GET",
"(",
"String",
"depositId",
",",
"String",
"billId",
",",
"String",
"billDetailId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/deposit/{depositId}/paidBills/{billId}... | Get this object properties
REST: GET /me/deposit/{depositId}/paidBills/{billId}/details/{billDetailId}
@param depositId [required]
@param billId [required]
@param billDetailId [required] | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L3224-L3229 |
alexvasilkov/GestureViews | library/src/main/java/com/alexvasilkov/gestures/utils/FloatScroller.java | FloatScroller.startScroll | public void startScroll(float startValue, float finalValue) {
"""
Starts an animation from startValue to finalValue.
@param startValue Start value
@param finalValue Final value
@see android.widget.Scroller#startScroll(int, int, int, int)
"""
finished = false;
startRtc = SystemClock.elapsed... | java | public void startScroll(float startValue, float finalValue) {
finished = false;
startRtc = SystemClock.elapsedRealtime();
this.startValue = startValue;
this.finalValue = finalValue;
currValue = startValue;
} | [
"public",
"void",
"startScroll",
"(",
"float",
"startValue",
",",
"float",
"finalValue",
")",
"{",
"finished",
"=",
"false",
";",
"startRtc",
"=",
"SystemClock",
".",
"elapsedRealtime",
"(",
")",
";",
"this",
".",
"startValue",
"=",
"startValue",
";",
"this"... | Starts an animation from startValue to finalValue.
@param startValue Start value
@param finalValue Final value
@see android.widget.Scroller#startScroll(int, int, int, int) | [
"Starts",
"an",
"animation",
"from",
"startValue",
"to",
"finalValue",
"."
] | train | https://github.com/alexvasilkov/GestureViews/blob/f0a4c266e31dcad23bd0d9013531bc1c501b9c9f/library/src/main/java/com/alexvasilkov/gestures/utils/FloatScroller.java#L75-L82 |
korpling/ANNIS | annis-gui/src/main/java/annis/gui/QueryController.java | QueryController.setIfNew | private static <T> void setIfNew(Property<T> prop, T newValue) {
"""
Only changes the value of the property if it is not equals to the old one.
@param <T>
@param prop
@param newValue
"""
if(!Objects.equals(prop.getValue(), newValue))
{
prop.setValue(newValue);
}
} | java | private static <T> void setIfNew(Property<T> prop, T newValue)
{
if(!Objects.equals(prop.getValue(), newValue))
{
prop.setValue(newValue);
}
} | [
"private",
"static",
"<",
"T",
">",
"void",
"setIfNew",
"(",
"Property",
"<",
"T",
">",
"prop",
",",
"T",
"newValue",
")",
"{",
"if",
"(",
"!",
"Objects",
".",
"equals",
"(",
"prop",
".",
"getValue",
"(",
")",
",",
"newValue",
")",
")",
"{",
"pro... | Only changes the value of the property if it is not equals to the old one.
@param <T>
@param prop
@param newValue | [
"Only",
"changes",
"the",
"value",
"of",
"the",
"property",
"if",
"it",
"is",
"not",
"equals",
"to",
"the",
"old",
"one",
"."
] | train | https://github.com/korpling/ANNIS/blob/152a2e34832e015f73ac8ce8a7d4c32641641324/annis-gui/src/main/java/annis/gui/QueryController.java#L287-L293 |
elki-project/elki | elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/lof/LoOP.java | LoOP.run | public OutlierResult run(Database database, Relation<O> relation) {
"""
Performs the LoOP algorithm on the given database.
@param database Database to process
@param relation Relation to process
@return Outlier result
"""
StepProgress stepprog = LOG.isVerbose() ? new StepProgress(5) : null;
Pair<... | java | public OutlierResult run(Database database, Relation<O> relation) {
StepProgress stepprog = LOG.isVerbose() ? new StepProgress(5) : null;
Pair<KNNQuery<O>, KNNQuery<O>> pair = getKNNQueries(database, relation, stepprog);
KNNQuery<O> knnComp = pair.getFirst();
KNNQuery<O> knnReach = pair.getSecond();
... | [
"public",
"OutlierResult",
"run",
"(",
"Database",
"database",
",",
"Relation",
"<",
"O",
">",
"relation",
")",
"{",
"StepProgress",
"stepprog",
"=",
"LOG",
".",
"isVerbose",
"(",
")",
"?",
"new",
"StepProgress",
"(",
"5",
")",
":",
"null",
";",
"Pair",
... | Performs the LoOP algorithm on the given database.
@param database Database to process
@param relation Relation to process
@return Outlier result | [
"Performs",
"the",
"LoOP",
"algorithm",
"on",
"the",
"given",
"database",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/lof/LoOP.java#L184-L232 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.order_orderId_payWithRegisteredPaymentMean_POST | public void order_orderId_payWithRegisteredPaymentMean_POST(Long orderId, OvhReusablePaymentMeanEnum paymentMean, Long paymentMeanId) throws IOException {
"""
Pay with an already registered payment mean
REST: POST /me/order/{orderId}/payWithRegisteredPaymentMean
@param paymentMean [required] The registered pay... | java | public void order_orderId_payWithRegisteredPaymentMean_POST(Long orderId, OvhReusablePaymentMeanEnum paymentMean, Long paymentMeanId) throws IOException {
String qPath = "/me/order/{orderId}/payWithRegisteredPaymentMean";
StringBuilder sb = path(qPath, orderId);
HashMap<String, Object>o = new HashMap<String, Obje... | [
"public",
"void",
"order_orderId_payWithRegisteredPaymentMean_POST",
"(",
"Long",
"orderId",
",",
"OvhReusablePaymentMeanEnum",
"paymentMean",
",",
"Long",
"paymentMeanId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/order/{orderId}/payWithRegisteredPaymen... | Pay with an already registered payment mean
REST: POST /me/order/{orderId}/payWithRegisteredPaymentMean
@param paymentMean [required] The registered payment mean you want to use
@param paymentMeanId [required] Id of registered payment mean, mandatory for bankAccount, creditCard and paypal
@param orderId [required] | [
"Pay",
"with",
"an",
"already",
"registered",
"payment",
"mean"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L1912-L1919 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/XFactory.java | XFactory.getExactXField | public static XField getExactXField(@SlashedClassName String className, String name, String signature, boolean isStatic) {
"""
Get an XField object exactly matching given class, name, and signature.
May return an unresolved object (if the class can't be found, or does not
directly declare named field).
@param... | java | public static XField getExactXField(@SlashedClassName String className, String name, String signature, boolean isStatic) {
FieldDescriptor fieldDesc = DescriptorFactory.instance().getFieldDescriptor(ClassName.toSlashedClassName(className),
name, signature, isStatic);
return getExactXFiel... | [
"public",
"static",
"XField",
"getExactXField",
"(",
"@",
"SlashedClassName",
"String",
"className",
",",
"String",
"name",
",",
"String",
"signature",
",",
"boolean",
"isStatic",
")",
"{",
"FieldDescriptor",
"fieldDesc",
"=",
"DescriptorFactory",
".",
"instance",
... | Get an XField object exactly matching given class, name, and signature.
May return an unresolved object (if the class can't be found, or does not
directly declare named field).
@param className
name of class containing the field
@param name
name of field
@param signature
field signature
@param isStatic
field access fl... | [
"Get",
"an",
"XField",
"object",
"exactly",
"matching",
"given",
"class",
"name",
"and",
"signature",
".",
"May",
"return",
"an",
"unresolved",
"object",
"(",
"if",
"the",
"class",
"can",
"t",
"be",
"found",
"or",
"does",
"not",
"directly",
"declare",
"nam... | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/XFactory.java#L534-L538 |
chanjarster/weixin-java-tools | weixin-java-common/src/main/java/me/chanjar/weixin/common/util/res/StringManager.java | StringManager.getString | public String getString(final String key, final Object... args) {
"""
Get a string from the underlying resource bundle and format
it with the given set of arguments.
@param key
@param args
"""
String value = getString(key);
if (value == null) {
value = key;
}
M... | java | public String getString(final String key, final Object... args) {
String value = getString(key);
if (value == null) {
value = key;
}
MessageFormat mf = new MessageFormat(value);
mf.setLocale(locale);
return mf.format(args, new StringBuffer(), null).toString()... | [
"public",
"String",
"getString",
"(",
"final",
"String",
"key",
",",
"final",
"Object",
"...",
"args",
")",
"{",
"String",
"value",
"=",
"getString",
"(",
"key",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"value",
"=",
"key",
";",
"}",
"... | Get a string from the underlying resource bundle and format
it with the given set of arguments.
@param key
@param args | [
"Get",
"a",
"string",
"from",
"the",
"underlying",
"resource",
"bundle",
"and",
"format",
"it",
"with",
"the",
"given",
"set",
"of",
"arguments",
"."
] | train | https://github.com/chanjarster/weixin-java-tools/blob/2a0b1c30c0f60c2de466cb8933c945bc0d391edf/weixin-java-common/src/main/java/me/chanjar/weixin/common/util/res/StringManager.java#L151-L160 |
cdk/cdk | descriptor/signature/src/main/java/org/openscience/cdk/signature/MoleculeSignature.java | MoleculeSignature.fromSignatureString | public static IAtomContainer fromSignatureString(String signatureString, IChemObjectBuilder coBuilder) {
"""
Builder for molecules (rather, for atom containers) from signature
strings.
@param signatureString the signature string to use
@param coBuilder {@link IChemObjectBuilder} to build the returned atom con... | java | public static IAtomContainer fromSignatureString(String signatureString, IChemObjectBuilder coBuilder) {
ColoredTree tree = AtomSignature.parse(signatureString);
MoleculeFromSignatureBuilder builder = new MoleculeFromSignatureBuilder(coBuilder);
builder.makeFromColoredTree(tree);
return ... | [
"public",
"static",
"IAtomContainer",
"fromSignatureString",
"(",
"String",
"signatureString",
",",
"IChemObjectBuilder",
"coBuilder",
")",
"{",
"ColoredTree",
"tree",
"=",
"AtomSignature",
".",
"parse",
"(",
"signatureString",
")",
";",
"MoleculeFromSignatureBuilder",
... | Builder for molecules (rather, for atom containers) from signature
strings.
@param signatureString the signature string to use
@param coBuilder {@link IChemObjectBuilder} to build the returned atom container from
@return an atom container | [
"Builder",
"for",
"molecules",
"(",
"rather",
"for",
"atom",
"containers",
")",
"from",
"signature",
"strings",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/descriptor/signature/src/main/java/org/openscience/cdk/signature/MoleculeSignature.java#L179-L184 |
elastic/elasticsearch-hadoop | mr/src/main/java/org/elasticsearch/hadoop/rest/NetworkUtils.java | NetworkUtils.addAllInterfaces | private static void addAllInterfaces(List<NetworkInterface> target, List<NetworkInterface> level) {
"""
Helper for getInterfaces, recursively adds subinterfaces to {@code target}
"""
if (!level.isEmpty()) {
target.addAll(level);
for (NetworkInterface intf : level) {
... | java | private static void addAllInterfaces(List<NetworkInterface> target, List<NetworkInterface> level) {
if (!level.isEmpty()) {
target.addAll(level);
for (NetworkInterface intf : level) {
addAllInterfaces(target, Collections.list(intf.getSubInterfaces()));
}
... | [
"private",
"static",
"void",
"addAllInterfaces",
"(",
"List",
"<",
"NetworkInterface",
">",
"target",
",",
"List",
"<",
"NetworkInterface",
">",
"level",
")",
"{",
"if",
"(",
"!",
"level",
".",
"isEmpty",
"(",
")",
")",
"{",
"target",
".",
"addAll",
"(",... | Helper for getInterfaces, recursively adds subinterfaces to {@code target} | [
"Helper",
"for",
"getInterfaces",
"recursively",
"adds",
"subinterfaces",
"to",
"{"
] | train | https://github.com/elastic/elasticsearch-hadoop/blob/f3acaba268ff96efae8eb946088c748c777c22cc/mr/src/main/java/org/elasticsearch/hadoop/rest/NetworkUtils.java#L33-L40 |
uber/NullAway | nullaway/src/main/java/com/uber/nullaway/dataflow/AccessPath.java | AccessPath.getAccessPathForNodeWithMapGet | @Nullable
public static AccessPath getAccessPathForNodeWithMapGet(Node node, @Nullable Types types) {
"""
Gets corresponding AccessPath for node, if it exists. Handles calls to <code>Map.get()
</code>
@param node AST node
@param types javac {@link Types}
@return corresponding AccessPath if it exists; <code... | java | @Nullable
public static AccessPath getAccessPathForNodeWithMapGet(Node node, @Nullable Types types) {
if (node instanceof LocalVariableNode) {
return fromLocal((LocalVariableNode) node);
} else if (node instanceof FieldAccessNode) {
return fromFieldAccess((FieldAccessNode) node);
} else if (no... | [
"@",
"Nullable",
"public",
"static",
"AccessPath",
"getAccessPathForNodeWithMapGet",
"(",
"Node",
"node",
",",
"@",
"Nullable",
"Types",
"types",
")",
"{",
"if",
"(",
"node",
"instanceof",
"LocalVariableNode",
")",
"{",
"return",
"fromLocal",
"(",
"(",
"LocalVar... | Gets corresponding AccessPath for node, if it exists. Handles calls to <code>Map.get()
</code>
@param node AST node
@param types javac {@link Types}
@return corresponding AccessPath if it exists; <code>null</code> otherwise | [
"Gets",
"corresponding",
"AccessPath",
"for",
"node",
"if",
"it",
"exists",
".",
"Handles",
"calls",
"to",
"<code",
">",
"Map",
".",
"get",
"()",
"<",
"/",
"code",
">"
] | train | https://github.com/uber/NullAway/blob/c3979b4241f80411dbba6aac3ff653acbb88d00b/nullaway/src/main/java/com/uber/nullaway/dataflow/AccessPath.java#L196-L207 |
aws/aws-sdk-java | aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/GetMethodResult.java | GetMethodResult.withRequestParameters | public GetMethodResult withRequestParameters(java.util.Map<String, Boolean> requestParameters) {
"""
<p>
A key-value map defining required or optional method request parameters that can be accepted by API Gateway. A
key is a method request parameter name matching the pattern of <code>method.request.{location}.{n... | java | public GetMethodResult withRequestParameters(java.util.Map<String, Boolean> requestParameters) {
setRequestParameters(requestParameters);
return this;
} | [
"public",
"GetMethodResult",
"withRequestParameters",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"Boolean",
">",
"requestParameters",
")",
"{",
"setRequestParameters",
"(",
"requestParameters",
")",
";",
"return",
"this",
";",
"}"
] | <p>
A key-value map defining required or optional method request parameters that can be accepted by API Gateway. A
key is a method request parameter name matching the pattern of <code>method.request.{location}.{name}</code>,
where <code>location</code> is <code>querystring</code>, <code>path</code>, or <code>header</co... | [
"<p",
">",
"A",
"key",
"-",
"value",
"map",
"defining",
"required",
"or",
"optional",
"method",
"request",
"parameters",
"that",
"can",
"be",
"accepted",
"by",
"API",
"Gateway",
".",
"A",
"key",
"is",
"a",
"method",
"request",
"parameter",
"name",
"matchin... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/GetMethodResult.java#L547-L550 |
NoraUi/NoraUi | src/main/java/com/github/noraui/application/steps/CommonSteps.java | CommonSteps.updateRadioList | @Conditioned
@Et("Je mets à jour la liste radio '(.*)-(.*)' avec '(.*)'[\\.|\\?]")
@And("I update radio list '(.*)-(.*)' with '(.*)'[\\.|\\?]")
public void updateRadioList(String page, String elementName, String valueOrKey, List<GherkinStepCondition> conditions) throws TechnicalException, FailureExceptio... | java | @Conditioned
@Et("Je mets à jour la liste radio '(.*)-(.*)' avec '(.*)'[\\.|\\?]")
@And("I update radio list '(.*)-(.*)' with '(.*)'[\\.|\\?]")
public void updateRadioList(String page, String elementName, String valueOrKey, List<GherkinStepCondition> conditions) throws TechnicalException, FailureExceptio... | [
"@",
"Conditioned",
"@",
"Et",
"(",
"\"Je mets à jour la liste radio '(.*)-(.*)' avec '(.*)'[\\\\.|\\\\?]\")",
"\r",
"@",
"And",
"(",
"\"I update radio list '(.*)-(.*)' with '(.*)'[\\\\.|\\\\?]\"",
")",
"public",
"void",
"updateRadioList",
"(",
"String",
"page",
",",
"String",
... | Updates the value of a html radio element with conditions.
@param page
The concerned page of elementName
@param elementName
is target element
@param valueOrKey
Is the value (value or value in context (after a save)) use for selection
@param conditions
list of 'expected' values condition and 'actual' values ({@link com... | [
"Updates",
"the",
"value",
"of",
"a",
"html",
"radio",
"element",
"with",
"conditions",
"."
] | train | https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/application/steps/CommonSteps.java#L843-L848 |
hypercube1024/firefly | firefly-common/src/main/java/com/firefly/utils/function/Actions.java | Actions.toFunc | public static <T1, T2, T3, T4, T5, T6, T7, T8, R> Func8<T1, T2, T3, T4, T5, T6, T7, T8, R> toFunc(
final Action8<T1, T2, T3, T4, T5, T6, T7, T8> action, final R result) {
"""
Converts an {@link Action8} to a function that calls the action and returns a specified value.
@param action the {@link Actio... | java | public static <T1, T2, T3, T4, T5, T6, T7, T8, R> Func8<T1, T2, T3, T4, T5, T6, T7, T8, R> toFunc(
final Action8<T1, T2, T3, T4, T5, T6, T7, T8> action, final R result) {
return new Func8<T1, T2, T3, T4, T5, T6, T7, T8, R>() {
@Override
public R call(T1 t1, T2 t2, T3 t3, T4 t... | [
"public",
"static",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
",",
"T5",
",",
"T6",
",",
"T7",
",",
"T8",
",",
"R",
">",
"Func8",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
",",
"T5",
",",
"T6",
",",
"T7",
",",
"T8",
",",
"R",
">",
... | Converts an {@link Action8} to a function that calls the action and returns a specified value.
@param action the {@link Action8} to convert
@param result the value to return from the function call
@return a {@link Func8} that calls {@code action} and returns {@code result} | [
"Converts",
"an",
"{",
"@link",
"Action8",
"}",
"to",
"a",
"function",
"that",
"calls",
"the",
"action",
"and",
"returns",
"a",
"specified",
"value",
"."
] | train | https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/function/Actions.java#L341-L350 |
CloudSlang/cs-actions | cs-amazon/src/main/java/io/cloudslang/content/amazon/services/helpers/AwsSignatureV4.java | AwsSignatureV4.calculateHmacSHA256 | private byte[] calculateHmacSHA256(String data, byte[] key)
throws NoSuchAlgorithmException, InvalidKeyException, UnsupportedEncodingException {
"""
Calculates the keyed-hash message authentication code for the data string.
@param data String for which the HMAC will be calculated.
@param key Key u... | java | private byte[] calculateHmacSHA256(String data, byte[] key)
throws NoSuchAlgorithmException, InvalidKeyException, UnsupportedEncodingException {
Mac mac = Mac.getInstance(HMAC_ALGORITHM);
mac.init(new SecretKeySpec(key, HMAC_ALGORITHM));
return mac.doFinal(data.getBytes(ENCODING));
... | [
"private",
"byte",
"[",
"]",
"calculateHmacSHA256",
"(",
"String",
"data",
",",
"byte",
"[",
"]",
"key",
")",
"throws",
"NoSuchAlgorithmException",
",",
"InvalidKeyException",
",",
"UnsupportedEncodingException",
"{",
"Mac",
"mac",
"=",
"Mac",
".",
"getInstance",
... | Calculates the keyed-hash message authentication code for the data string.
@param data String for which the HMAC will be calculated.
@param key Key used for HMAC calculation.
@return HMAC's bytes. This result is not encoded. | [
"Calculates",
"the",
"keyed",
"-",
"hash",
"message",
"authentication",
"code",
"for",
"the",
"data",
"string",
"."
] | train | https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-amazon/src/main/java/io/cloudslang/content/amazon/services/helpers/AwsSignatureV4.java#L147-L152 |
aws/aws-sdk-java | aws-java-sdk-core/src/main/java/com/amazonaws/auth/policy/internal/JsonPolicyWriter.java | JsonPolicyWriter.writeJsonArray | private void writeJsonArray(String arrayName, List<String> values)
throws JsonGenerationException, IOException {
"""
Writes an array along with its values to the JSONGenerator.
@param arrayName
name of the JSON array.
@param values
values of the JSON array.
"""
writeJsonArrayStart(arr... | java | private void writeJsonArray(String arrayName, List<String> values)
throws JsonGenerationException, IOException {
writeJsonArrayStart(arrayName);
for (String value : values)
generator.writeString(value);
writeJsonArrayEnd();
} | [
"private",
"void",
"writeJsonArray",
"(",
"String",
"arrayName",
",",
"List",
"<",
"String",
">",
"values",
")",
"throws",
"JsonGenerationException",
",",
"IOException",
"{",
"writeJsonArrayStart",
"(",
"arrayName",
")",
";",
"for",
"(",
"String",
"value",
":",
... | Writes an array along with its values to the JSONGenerator.
@param arrayName
name of the JSON array.
@param values
values of the JSON array. | [
"Writes",
"an",
"array",
"along",
"with",
"its",
"values",
"to",
"the",
"JSONGenerator",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/auth/policy/internal/JsonPolicyWriter.java#L353-L359 |
wg/lettuce | src/main/java/com/lambdaworks/redis/RedisConnection.java | RedisConnection.evalsha | @SuppressWarnings("unchecked")
public <T> T evalsha(String digest, ScriptOutputType type, K... keys) {
"""
Eval a pre-loaded script identified by its SHA-1 digest, which must result
in the requested {@link ScriptOutputType type}.
@param digest Lowercase hex string of script's SHA-1 digest.
@param type ... | java | @SuppressWarnings("unchecked")
public <T> T evalsha(String digest, ScriptOutputType type, K... keys) {
return (T) await(c.evalsha(digest, type, keys, (V[]) new Object[0]));
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"T",
"evalsha",
"(",
"String",
"digest",
",",
"ScriptOutputType",
"type",
",",
"K",
"...",
"keys",
")",
"{",
"return",
"(",
"T",
")",
"await",
"(",
"c",
".",
"evalsha",
"(",
... | Eval a pre-loaded script identified by its SHA-1 digest, which must result
in the requested {@link ScriptOutputType type}.
@param digest Lowercase hex string of script's SHA-1 digest.
@param type Script output type.
@param keys Redis keys to pass to script.
@param <T> Expected return type.
@return... | [
"Eval",
"a",
"pre",
"-",
"loaded",
"script",
"identified",
"by",
"its",
"SHA",
"-",
"1",
"digest",
"which",
"must",
"result",
"in",
"the",
"requested",
"{",
"@link",
"ScriptOutputType",
"type",
"}",
"."
] | train | https://github.com/wg/lettuce/blob/5141640dc8289ff3af07b44a87020cef719c5f4a/src/main/java/com/lambdaworks/redis/RedisConnection.java#L203-L206 |
mgm-tp/jfunk | jfunk-web/src/main/java/com/mgmtp/jfunk/web/util/WebDriverTool.java | WebDriverTool.openNewWindow | public String openNewWindow(final Runnable openCommand, final long timeoutSeconds) {
"""
Opens a new window and switches to it. The window to switch to is determined by diffing
the given {@code existingWindowHandles} with the current ones. The difference must be
exactly one window handle which is then used to sw... | java | public String openNewWindow(final Runnable openCommand, final long timeoutSeconds) {
String oldHandle = webDriver.getWindowHandle();
final Set<String> existingWindowHandles = webDriver.getWindowHandles();
openCommand.run();
Function<WebDriver, String> function = new Function<WebDriver, String>() {
@Overrid... | [
"public",
"String",
"openNewWindow",
"(",
"final",
"Runnable",
"openCommand",
",",
"final",
"long",
"timeoutSeconds",
")",
"{",
"String",
"oldHandle",
"=",
"webDriver",
".",
"getWindowHandle",
"(",
")",
";",
"final",
"Set",
"<",
"String",
">",
"existingWindowHan... | Opens a new window and switches to it. The window to switch to is determined by diffing
the given {@code existingWindowHandles} with the current ones. The difference must be
exactly one window handle which is then used to switch to.
@param openCommand
logic for opening the new window
@param timeoutSeconds
the timeout ... | [
"Opens",
"a",
"new",
"window",
"and",
"switches",
"to",
"it",
".",
"The",
"window",
"to",
"switch",
"to",
"is",
"determined",
"by",
"diffing",
"the",
"given",
"{",
"@code",
"existingWindowHandles",
"}",
"with",
"the",
"current",
"ones",
".",
"The",
"differ... | train | https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-web/src/main/java/com/mgmtp/jfunk/web/util/WebDriverTool.java#L808-L834 |
houbb/log-integration | src/main/java/com/github/houbb/log/integration/adaptors/jdbc/ConnectionLogger.java | ConnectionLogger.newInstance | public static Connection newInstance(Connection conn, Log statementLog, int queryStack) {
"""
/*
Creates a logging version of a connection
@param conn - the original connection
@return - the connection with logging
"""
InvocationHandler handler = new ConnectionLogger(conn, statementLog, queryStack... | java | public static Connection newInstance(Connection conn, Log statementLog, int queryStack) {
InvocationHandler handler = new ConnectionLogger(conn, statementLog, queryStack);
ClassLoader cl = Connection.class.getClassLoader();
return (Connection) Proxy.newProxyInstance(cl, new Class[]{Connection.cl... | [
"public",
"static",
"Connection",
"newInstance",
"(",
"Connection",
"conn",
",",
"Log",
"statementLog",
",",
"int",
"queryStack",
")",
"{",
"InvocationHandler",
"handler",
"=",
"new",
"ConnectionLogger",
"(",
"conn",
",",
"statementLog",
",",
"queryStack",
")",
... | /*
Creates a logging version of a connection
@param conn - the original connection
@return - the connection with logging | [
"/",
"*",
"Creates",
"a",
"logging",
"version",
"of",
"a",
"connection"
] | train | https://github.com/houbb/log-integration/blob/c5e979719aec12a02f7d22b24b04b6fbb1789ca5/src/main/java/com/github/houbb/log/integration/adaptors/jdbc/ConnectionLogger.java#L81-L85 |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/VMCommandLine.java | VMCommandLine.launchVMWithClassPath | public static Process launchVMWithClassPath(String classToLaunch, File[] classpath,
String... additionalParams) throws IOException {
"""
Run a new VM with the given class path.
@param classToLaunch is the class to launch.
@param classpath is the class path to use.
@param additionalParams is the list of add... | java | public static Process launchVMWithClassPath(String classToLaunch, File[] classpath,
String... additionalParams) throws IOException {
final StringBuilder b = new StringBuilder();
for (final File f : classpath) {
if (b.length() > 0) {
b.append(File.pathSeparator);
}
b.append(f.getAbsolutePath());
}
... | [
"public",
"static",
"Process",
"launchVMWithClassPath",
"(",
"String",
"classToLaunch",
",",
"File",
"[",
"]",
"classpath",
",",
"String",
"...",
"additionalParams",
")",
"throws",
"IOException",
"{",
"final",
"StringBuilder",
"b",
"=",
"new",
"StringBuilder",
"("... | Run a new VM with the given class path.
@param classToLaunch is the class to launch.
@param classpath is the class path to use.
@param additionalParams is the list of additional parameters
@return the process that is running the new virtual machine, neither <code>null</code>
@throws IOException when a IO error occurs.... | [
"Run",
"a",
"new",
"VM",
"with",
"the",
"given",
"class",
"path",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/VMCommandLine.java#L235-L245 |
liferay/com-liferay-commerce | commerce-payment-service/src/main/java/com/liferay/commerce/payment/service/persistence/impl/CommercePaymentMethodGroupRelPersistenceImpl.java | CommercePaymentMethodGroupRelPersistenceImpl.findByGroupId | @Override
public List<CommercePaymentMethodGroupRel> findByGroupId(long groupId,
int start, int end) {
"""
Returns a range of all the commerce payment method group rels where groupId = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and ... | java | @Override
public List<CommercePaymentMethodGroupRel> findByGroupId(long groupId,
int start, int end) {
return findByGroupId(groupId, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommercePaymentMethodGroupRel",
">",
"findByGroupId",
"(",
"long",
"groupId",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByGroupId",
"(",
"groupId",
",",
"start",
",",
"end",
",",
"null",
")",
... | Returns a range of all the commerce payment method group rels where groupId = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first re... | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"payment",
"method",
"group",
"rels",
"where",
"groupId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-payment-service/src/main/java/com/liferay/commerce/payment/service/persistence/impl/CommercePaymentMethodGroupRelPersistenceImpl.java#L144-L148 |
kenyee/android-ddp-client | src/com/keysolutions/ddpclient/android/DDPStateSingleton.java | DDPStateSingleton.initInstance | public static void initInstance(Context context, String meteorServerHostname,
Integer meteorPort, TrustManager[] trustManagers) {
"""
Initializes instance to connect to given Meteor server
@param context Android context
@param meteorServerHostname Meteor hostname/IP
@param tr... | java | public static void initInstance(Context context, String meteorServerHostname,
Integer meteorPort, TrustManager[] trustManagers) {
if (mInstance == null) {
mInstance = new DDPStateSingleton(context, meteorServerHostname, meteorPort, trustManagers);
}
} | [
"public",
"static",
"void",
"initInstance",
"(",
"Context",
"context",
",",
"String",
"meteorServerHostname",
",",
"Integer",
"meteorPort",
",",
"TrustManager",
"[",
"]",
"trustManagers",
")",
"{",
"if",
"(",
"mInstance",
"==",
"null",
")",
"{",
"mInstance",
"... | Initializes instance to connect to given Meteor server
@param context Android context
@param meteorServerHostname Meteor hostname/IP
@param trustManagers trustmanagers to use for SSL | [
"Initializes",
"instance",
"to",
"connect",
"to",
"given",
"Meteor",
"server"
] | train | https://github.com/kenyee/android-ddp-client/blob/6ab416e415570a03f96c383497144dd742de3f08/src/com/keysolutions/ddpclient/android/DDPStateSingleton.java#L181-L186 |
JoeKerouac/utils | src/main/java/com/joe/utils/reflect/ReflectUtil.java | ReflectUtil.getFieldValue | @SuppressWarnings("unchecked")
public static <T extends Object> T getFieldValue(Object obj, Field field) {
"""
获取指定对象中指定字段对应的字段的值
@param obj 对象,不能为空
@param field 字段
@param <T> 字段类型
@return 字段值
"""
Assert.notNull(obj, "obj不能为空");
Assert.notNull(field, "field不能为空");
try {
... | java | @SuppressWarnings("unchecked")
public static <T extends Object> T getFieldValue(Object obj, Field field) {
Assert.notNull(obj, "obj不能为空");
Assert.notNull(field, "field不能为空");
try {
return (T) field.get(obj);
} catch (IllegalArgumentException e) {
throw new Re... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
"extends",
"Object",
">",
"T",
"getFieldValue",
"(",
"Object",
"obj",
",",
"Field",
"field",
")",
"{",
"Assert",
".",
"notNull",
"(",
"obj",
",",
"\"obj不能为空\");",
"",
"",
"... | 获取指定对象中指定字段对应的字段的值
@param obj 对象,不能为空
@param field 字段
@param <T> 字段类型
@return 字段值 | [
"获取指定对象中指定字段对应的字段的值"
] | train | https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/reflect/ReflectUtil.java#L323-L338 |
VoltDB/voltdb | src/frontend/org/voltdb/SnapshotDaemon.java | SnapshotDaemon.requestUserSnapshot | public void requestUserSnapshot(final StoredProcedureInvocation invocation, final Connection c) {
"""
/*
If we are the leader, go ahead an create the procedure invocation to do the work.
We aren't going to journal this in ZK. if the leader dies there will be no
one to try and complete the work. C'est la vie.
... | java | public void requestUserSnapshot(final StoredProcedureInvocation invocation, final Connection c) {
m_es.submit(new Runnable() {
@Override
public void run() {
try {
submitUserSnapshotRequest(invocation, c);
} catch (Exception e) {
... | [
"public",
"void",
"requestUserSnapshot",
"(",
"final",
"StoredProcedureInvocation",
"invocation",
",",
"final",
"Connection",
"c",
")",
"{",
"m_es",
".",
"submit",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{"... | /*
If we are the leader, go ahead an create the procedure invocation to do the work.
We aren't going to journal this in ZK. if the leader dies there will be no
one to try and complete the work. C'est la vie. | [
"/",
"*",
"If",
"we",
"are",
"the",
"leader",
"go",
"ahead",
"an",
"create",
"the",
"procedure",
"invocation",
"to",
"do",
"the",
"work",
".",
"We",
"aren",
"t",
"going",
"to",
"journal",
"this",
"in",
"ZK",
".",
"if",
"the",
"leader",
"dies",
"there... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/SnapshotDaemon.java#L1644-L1655 |
soklet/soklet | src/main/java/com/soklet/util/PathUtils.java | PathUtils.copyDirectory | public static void copyDirectory(Path sourceDirectory, Path targetDirectory) throws IOException {
"""
Copies a directory.
<p>
NOTE: This method is not thread-safe.
<p>
Most of the implementation is thanks to
http://stackoverflow.com/questions/17641706/how-to-copy-a-directory-with-its-attributes-permissions-fr... | java | public static void copyDirectory(Path sourceDirectory, Path targetDirectory) throws IOException {
copyDirectory(sourceDirectory, targetDirectory, emptySet());
} | [
"public",
"static",
"void",
"copyDirectory",
"(",
"Path",
"sourceDirectory",
",",
"Path",
"targetDirectory",
")",
"throws",
"IOException",
"{",
"copyDirectory",
"(",
"sourceDirectory",
",",
"targetDirectory",
",",
"emptySet",
"(",
")",
")",
";",
"}"
] | Copies a directory.
<p>
NOTE: This method is not thread-safe.
<p>
Most of the implementation is thanks to
http://stackoverflow.com/questions/17641706/how-to-copy-a-directory-with-its-attributes-permissions-from-one
-location-to-ano/18691793#18691793
@param sourceDirectory
the directory to copy from
@param targetDirect... | [
"Copies",
"a",
"directory",
".",
"<p",
">",
"NOTE",
":",
"This",
"method",
"is",
"not",
"thread",
"-",
"safe",
".",
"<p",
">",
"Most",
"of",
"the",
"implementation",
"is",
"thanks",
"to",
"http",
":",
"//",
"stackoverflow",
".",
"com",
"/",
"questions"... | train | https://github.com/soklet/soklet/blob/4f12de07d9c132e0126d50ad11cc1d8576594700/src/main/java/com/soklet/util/PathUtils.java#L123-L125 |
google/closure-templates | java/src/com/google/template/soy/jbcsrc/ProtoUtils.java | ProtoUtils.createProto | static SoyExpression createProto(
ProtoInitNode node,
Function<ExprNode, SoyExpression> compilerFunction,
Supplier<? extends ExpressionDetacher> detacher,
TemplateVariableManager varManager) {
"""
Returns a {@link SoyExpression} for initializing a new proto.
@param node The proto initial... | java | static SoyExpression createProto(
ProtoInitNode node,
Function<ExprNode, SoyExpression> compilerFunction,
Supplier<? extends ExpressionDetacher> detacher,
TemplateVariableManager varManager) {
return new ProtoInitGenerator(node, compilerFunction, detacher, varManager).generate();
} | [
"static",
"SoyExpression",
"createProto",
"(",
"ProtoInitNode",
"node",
",",
"Function",
"<",
"ExprNode",
",",
"SoyExpression",
">",
"compilerFunction",
",",
"Supplier",
"<",
"?",
"extends",
"ExpressionDetacher",
">",
"detacher",
",",
"TemplateVariableManager",
"varMa... | Returns a {@link SoyExpression} for initializing a new proto.
@param node The proto initialization node
@param args Args for the proto initialization call
@param varManager Local variables manager | [
"Returns",
"a",
"{",
"@link",
"SoyExpression",
"}",
"for",
"initializing",
"a",
"new",
"proto",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/ProtoUtils.java#L553-L559 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/AppsImpl.java | AppsImpl.importMethodAsync | public Observable<UUID> importMethodAsync(LuisApp luisApp, ImportMethodAppsOptionalParameter importMethodOptionalParameter) {
"""
Imports an application to LUIS, the application's structure should be included in in the request body.
@param luisApp A LUIS application structure.
@param importMethodOptionalParame... | java | public Observable<UUID> importMethodAsync(LuisApp luisApp, ImportMethodAppsOptionalParameter importMethodOptionalParameter) {
return importMethodWithServiceResponseAsync(luisApp, importMethodOptionalParameter).map(new Func1<ServiceResponse<UUID>, UUID>() {
@Override
public UUID call(Serv... | [
"public",
"Observable",
"<",
"UUID",
">",
"importMethodAsync",
"(",
"LuisApp",
"luisApp",
",",
"ImportMethodAppsOptionalParameter",
"importMethodOptionalParameter",
")",
"{",
"return",
"importMethodWithServiceResponseAsync",
"(",
"luisApp",
",",
"importMethodOptionalParameter",... | Imports an application to LUIS, the application's structure should be included in in the request body.
@param luisApp A LUIS application structure.
@param importMethodOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameter... | [
"Imports",
"an",
"application",
"to",
"LUIS",
"the",
"application",
"s",
"structure",
"should",
"be",
"included",
"in",
"in",
"the",
"request",
"body",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/AppsImpl.java#L424-L431 |
ben-manes/caffeine | jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java | CacheProxy.replaceNoCopyOrAwait | private V replaceNoCopyOrAwait(K key, V value) {
"""
Replaces the entry for the specified key only if it is currently mapped to some value. The
entry is not store-by-value copied nor does the method wait for synchronous listeners to
complete.
@param key key with which the specified value is associated
@param... | java | private V replaceNoCopyOrAwait(K key, V value) {
requireNonNull(value);
V copy = copyOf(value);
@SuppressWarnings("unchecked")
V[] replaced = (V[]) new Object[1];
cache.asMap().computeIfPresent(key, (k, expirable) -> {
if (!expirable.isEternal() && expirable.hasExpired(currentTimeMillis())) {
... | [
"private",
"V",
"replaceNoCopyOrAwait",
"(",
"K",
"key",
",",
"V",
"value",
")",
"{",
"requireNonNull",
"(",
"value",
")",
";",
"V",
"copy",
"=",
"copyOf",
"(",
"value",
")",
";",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"V",
"[",
"]",
"repl... | Replaces the entry for the specified key only if it is currently mapped to some value. The
entry is not store-by-value copied nor does the method wait for synchronous listeners to
complete.
@param key key with which the specified value is associated
@param value value to be associated with the specified key
@return th... | [
"Replaces",
"the",
"entry",
"for",
"the",
"specified",
"key",
"only",
"if",
"it",
"is",
"currently",
"mapped",
"to",
"some",
"value",
".",
"The",
"entry",
"is",
"not",
"store",
"-",
"by",
"-",
"value",
"copied",
"nor",
"does",
"the",
"method",
"wait",
... | train | https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java#L681-L703 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/DateTime.java | DateTime.isIn | public boolean isIn(Date beginDate, Date endDate) {
"""
当前日期是否在日期指定范围内<br>
起始日期和结束日期可以互换
@param beginDate 起始日期
@param endDate 结束日期
@return 是否在范围内
@since 3.0.8
"""
long beginMills = beginDate.getTime();
long endMills = endDate.getTime();
long thisMills = this.getTime();
return thisMills >= ... | java | public boolean isIn(Date beginDate, Date endDate) {
long beginMills = beginDate.getTime();
long endMills = endDate.getTime();
long thisMills = this.getTime();
return thisMills >= Math.min(beginMills, endMills) && thisMills <= Math.max(beginMills, endMills);
} | [
"public",
"boolean",
"isIn",
"(",
"Date",
"beginDate",
",",
"Date",
"endDate",
")",
"{",
"long",
"beginMills",
"=",
"beginDate",
".",
"getTime",
"(",
")",
";",
"long",
"endMills",
"=",
"endDate",
".",
"getTime",
"(",
")",
";",
"long",
"thisMills",
"=",
... | 当前日期是否在日期指定范围内<br>
起始日期和结束日期可以互换
@param beginDate 起始日期
@param endDate 结束日期
@return 是否在范围内
@since 3.0.8 | [
"当前日期是否在日期指定范围内<br",
">",
"起始日期和结束日期可以互换"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateTime.java#L622-L628 |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/square/DetectFiducialSquareBinary.java | DetectFiducialSquareBinary.findBitCounts | protected void findBitCounts(GrayF32 gray , double threshold ) {
"""
Converts the gray scale image into a binary number. Skip the outer 1 pixel of each inner square. These
tend to be incorrectly classified due to distortion.
"""
// compute binary image using an adaptive algorithm to handle shadows
Thres... | java | protected void findBitCounts(GrayF32 gray , double threshold ) {
// compute binary image using an adaptive algorithm to handle shadows
ThresholdImageOps.threshold(gray,binaryInner,(float)threshold,true);
Arrays.fill(counts, 0);
for (int row = 0; row < gridWidth; row++) {
int y0 = row * binaryInner.width / g... | [
"protected",
"void",
"findBitCounts",
"(",
"GrayF32",
"gray",
",",
"double",
"threshold",
")",
"{",
"// compute binary image using an adaptive algorithm to handle shadows",
"ThresholdImageOps",
".",
"threshold",
"(",
"gray",
",",
"binaryInner",
",",
"(",
"float",
")",
"... | Converts the gray scale image into a binary number. Skip the outer 1 pixel of each inner square. These
tend to be incorrectly classified due to distortion. | [
"Converts",
"the",
"gray",
"scale",
"image",
"into",
"a",
"binary",
"number",
".",
"Skip",
"the",
"outer",
"1",
"pixel",
"of",
"each",
"inner",
"square",
".",
"These",
"tend",
"to",
"be",
"incorrectly",
"classified",
"due",
"to",
"distortion",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/square/DetectFiducialSquareBinary.java#L252-L275 |
google/closure-templates | java/src/com/google/template/soy/soyparse/SoyParseUtils.java | SoyParseUtils.unescapeCommandAttributeValue | static String unescapeCommandAttributeValue(String s, QuoteStyle quoteStyle) {
"""
Unescapes backslash quote sequences in an attribute value to just the quote.
"""
// NOTE: we don't just use String.replace since it internally allocates/compiles a regular
// expression. Instead we have a handrolled loo... | java | static String unescapeCommandAttributeValue(String s, QuoteStyle quoteStyle) {
// NOTE: we don't just use String.replace since it internally allocates/compiles a regular
// expression. Instead we have a handrolled loop.
int index = s.indexOf(quoteStyle == QuoteStyle.DOUBLE ? "\\\"" : "\\\'");
if (index... | [
"static",
"String",
"unescapeCommandAttributeValue",
"(",
"String",
"s",
",",
"QuoteStyle",
"quoteStyle",
")",
"{",
"// NOTE: we don't just use String.replace since it internally allocates/compiles a regular",
"// expression. Instead we have a handrolled loop.",
"int",
"index",
"=",
... | Unescapes backslash quote sequences in an attribute value to just the quote. | [
"Unescapes",
"backslash",
"quote",
"sequences",
"in",
"an",
"attribute",
"value",
"to",
"just",
"the",
"quote",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soyparse/SoyParseUtils.java#L170-L188 |
inkstand-io/scribble | scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/RemoteContentRepository.java | RemoteContentRepository.getActiveArquillianHost | private String getActiveArquillianHost(final URL arquillianXml, final String arquillianLaunch) {
"""
Reads the active remote host from the <code>arquillian.xml</code>. The host is activated by the defining
container which is activated by its qualified using the <code>arquillian.launch</code> system property. If t... | java | private String getActiveArquillianHost(final URL arquillianXml, final String arquillianLaunch) {
final XPath xPath = XPathFactory.newInstance().newXPath();
final String xpExpr = "//container[@qualifier=$containerQualifier]/protocol/property[@name='host']";
try {
final Document docum... | [
"private",
"String",
"getActiveArquillianHost",
"(",
"final",
"URL",
"arquillianXml",
",",
"final",
"String",
"arquillianLaunch",
")",
"{",
"final",
"XPath",
"xPath",
"=",
"XPathFactory",
".",
"newInstance",
"(",
")",
".",
"newXPath",
"(",
")",
";",
"final",
"... | Reads the active remote host from the <code>arquillian.xml</code>. The host is activated by the defining
container which is activated by its qualified using the <code>arquillian.launch</code> system property. If there
is no host defined, <code>null</code> is returned indicating to use the default configuration.
@param... | [
"Reads",
"the",
"active",
"remote",
"host",
"from",
"the",
"<code",
">",
"arquillian",
".",
"xml<",
"/",
"code",
">",
".",
"The",
"host",
"is",
"activated",
"by",
"the",
"defining",
"container",
"which",
"is",
"activated",
"by",
"its",
"qualified",
"using"... | train | https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/RemoteContentRepository.java#L194-L214 |
operasoftware/operaprestodriver | src/com/opera/core/systems/OperaExtensions.java | OperaExtensions.writeOEXtoWidgetsDat | private void writeOEXtoWidgetsDat(String wuid, File oexpath) throws IOException {
"""
Install the extension by writing to widgets.dat
@param wuid Unique identifier of the widget.
@param oexpath Location of .oex file within profile
"""
// Define a path relative to the profile directory. Don't use an ... | java | private void writeOEXtoWidgetsDat(String wuid, File oexpath) throws IOException {
// Define a path relative to the profile directory. Don't use an absolute path,
// because that will break when used with the Remote web driver.
String oexpathRelative = "{LargePreferences}widgets/" + oexpath.getName();
S... | [
"private",
"void",
"writeOEXtoWidgetsDat",
"(",
"String",
"wuid",
",",
"File",
"oexpath",
")",
"throws",
"IOException",
"{",
"// Define a path relative to the profile directory. Don't use an absolute path,",
"// because that will break when used with the Remote web driver.",
"String",
... | Install the extension by writing to widgets.dat
@param wuid Unique identifier of the widget.
@param oexpath Location of .oex file within profile | [
"Install",
"the",
"extension",
"by",
"writing",
"to",
"widgets",
".",
"dat"
] | train | https://github.com/operasoftware/operaprestodriver/blob/1ccceda80f1c1a0489171d17dcaa6e7b18fb4c01/src/com/opera/core/systems/OperaExtensions.java#L163-L179 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/TableWorks.java | TableWorks.setColNullability | void setColNullability(ColumnSchema column, boolean nullable) {
"""
performs the work for changing the nullability of a column
@param column Column
@param nullable boolean
"""
Constraint c = null;
int colIndex = table.getColumnIndex(column.getName().name);
if (column... | java | void setColNullability(ColumnSchema column, boolean nullable) {
Constraint c = null;
int colIndex = table.getColumnIndex(column.getName().name);
if (column.isNullable() == nullable) {
return;
}
if (nullable) {
if (column.isPrimaryKey()) {
... | [
"void",
"setColNullability",
"(",
"ColumnSchema",
"column",
",",
"boolean",
"nullable",
")",
"{",
"Constraint",
"c",
"=",
"null",
";",
"int",
"colIndex",
"=",
"table",
".",
"getColumnIndex",
"(",
"column",
".",
"getName",
"(",
")",
".",
"name",
")",
";",
... | performs the work for changing the nullability of a column
@param column Column
@param nullable boolean | [
"performs",
"the",
"work",
"for",
"changing",
"the",
"nullability",
"of",
"a",
"column"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/TableWorks.java#L1028-L1058 |
app55/app55-java | src/support/java/com/googlecode/openbeans/Introspector.java | Introspector.getBeanInfo | public static BeanInfo getBeanInfo(Class<?> beanClass, int flags) throws IntrospectionException {
"""
Gets the <code>BeanInfo</code> object which contains the information of the properties, events and methods of the specified bean class.
<ol>
<li>If <code>flag==IGNORE_ALL_BEANINFO</code>, the <code>Introspector<... | java | public static BeanInfo getBeanInfo(Class<?> beanClass, int flags) throws IntrospectionException
{
if (flags == USE_ALL_BEANINFO)
{
// try to use cache
return getBeanInfo(beanClass);
}
return getBeanInfoImplAndInit(beanClass, null, flags);
} | [
"public",
"static",
"BeanInfo",
"getBeanInfo",
"(",
"Class",
"<",
"?",
">",
"beanClass",
",",
"int",
"flags",
")",
"throws",
"IntrospectionException",
"{",
"if",
"(",
"flags",
"==",
"USE_ALL_BEANINFO",
")",
"{",
"// try to use cache",
"return",
"getBeanInfo",
"(... | Gets the <code>BeanInfo</code> object which contains the information of the properties, events and methods of the specified bean class.
<ol>
<li>If <code>flag==IGNORE_ALL_BEANINFO</code>, the <code>Introspector</code> will ignore all <code>BeanInfo</code> class.</li>
<li>If <code>flag==IGNORE_IMMEDIATE_BEANINFO</code>,... | [
"Gets",
"the",
"<code",
">",
"BeanInfo<",
"/",
"code",
">",
"object",
"which",
"contains",
"the",
"information",
"of",
"the",
"properties",
"events",
"and",
"methods",
"of",
"the",
"specified",
"bean",
"class",
".",
"<ol",
">",
"<li",
">",
"If",
"<code",
... | train | https://github.com/app55/app55-java/blob/73e51d0f3141a859dfbd37ca9becef98477e553e/src/support/java/com/googlecode/openbeans/Introspector.java#L205-L213 |
avianey/facebook-api-android-maven | facebook/src/main/java/com/facebook/TokenCachingStrategy.java | TokenCachingStrategy.putExpirationDate | public static void putExpirationDate(Bundle bundle, Date value) {
"""
Puts the expiration date into a Bundle.
@param bundle
A Bundle in which the expiration date should be stored.
@param value
The Date representing the expiration date.
@throws NullPointerException if the passed in Bundle or date value are... | java | public static void putExpirationDate(Bundle bundle, Date value) {
Validate.notNull(bundle, "bundle");
Validate.notNull(value, "value");
putDate(bundle, EXPIRATION_DATE_KEY, value);
} | [
"public",
"static",
"void",
"putExpirationDate",
"(",
"Bundle",
"bundle",
",",
"Date",
"value",
")",
"{",
"Validate",
".",
"notNull",
"(",
"bundle",
",",
"\"bundle\"",
")",
";",
"Validate",
".",
"notNull",
"(",
"value",
",",
"\"value\"",
")",
";",
"putDate... | Puts the expiration date into a Bundle.
@param bundle
A Bundle in which the expiration date should be stored.
@param value
The Date representing the expiration date.
@throws NullPointerException if the passed in Bundle or date value are null | [
"Puts",
"the",
"expiration",
"date",
"into",
"a",
"Bundle",
"."
] | train | https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/TokenCachingStrategy.java#L200-L204 |
knowm/XChange | xchange-coinbase/src/main/java/org/knowm/xchange/coinbase/v2/service/CoinbaseMarketDataServiceRaw.java | CoinbaseMarketDataServiceRaw.getCoinbaseBuyPrice | public CoinbasePrice getCoinbaseBuyPrice(Currency base, Currency counter) throws IOException {
"""
Unauthenticated resource that tells you the price to buy one unit.
@param pair The currency pair.
@return The price in the desired {@code currency} to buy one unit.
@throws IOException
@see <a
href="https://de... | java | public CoinbasePrice getCoinbaseBuyPrice(Currency base, Currency counter) throws IOException {
return coinbase.getBuyPrice(Coinbase.CB_VERSION_VALUE, base + "-" + counter).getData();
} | [
"public",
"CoinbasePrice",
"getCoinbaseBuyPrice",
"(",
"Currency",
"base",
",",
"Currency",
"counter",
")",
"throws",
"IOException",
"{",
"return",
"coinbase",
".",
"getBuyPrice",
"(",
"Coinbase",
".",
"CB_VERSION_VALUE",
",",
"base",
"+",
"\"-\"",
"+",
"counter",... | Unauthenticated resource that tells you the price to buy one unit.
@param pair The currency pair.
@return The price in the desired {@code currency} to buy one unit.
@throws IOException
@see <a
href="https://developers.coinbase.com/api/v2#get-buy-price">developers.coinbase.com/api/v2#get-buy-price</a> | [
"Unauthenticated",
"resource",
"that",
"tells",
"you",
"the",
"price",
"to",
"buy",
"one",
"unit",
"."
] | train | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-coinbase/src/main/java/org/knowm/xchange/coinbase/v2/service/CoinbaseMarketDataServiceRaw.java#L44-L47 |
infinispan/infinispan | commons/src/main/java/org/infinispan/commons/dataconversion/EncodingUtils.java | EncodingUtils.toStorage | public static Object toStorage(Object toStore, Encoder encoder, Wrapper wrapper) {
"""
Encode object to storage format.
@param toStore Object to be encoded.
@param encoder the {@link Encoder} used for data conversion.
@param wrapper the {@link Wrapper} used to decorate the converted data.
@return Object dec... | java | public static Object toStorage(Object toStore, Encoder encoder, Wrapper wrapper) {
if (encoder == null || wrapper == null) {
throw new IllegalArgumentException("Both Encoder and Wrapper must be provided!");
}
if (toStore == null) return null;
return wrapper.wrap(encoder.toStorage(toStor... | [
"public",
"static",
"Object",
"toStorage",
"(",
"Object",
"toStore",
",",
"Encoder",
"encoder",
",",
"Wrapper",
"wrapper",
")",
"{",
"if",
"(",
"encoder",
"==",
"null",
"||",
"wrapper",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",... | Encode object to storage format.
@param toStore Object to be encoded.
@param encoder the {@link Encoder} used for data conversion.
@param wrapper the {@link Wrapper} used to decorate the converted data.
@return Object decoded and unwrapped. | [
"Encode",
"object",
"to",
"storage",
"format",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/dataconversion/EncodingUtils.java#L38-L44 |
voldemort/voldemort | src/java/voldemort/client/rebalance/task/RebalanceTask.java | RebalanceTask.logPermitStatus | protected void logPermitStatus(int nodeId, String prefix) {
"""
Helper method to pretty print progress and timing info.
@param nodeId node ID for which donor permit is required
"""
String durationString = "";
if(permitAcquisitionTimeMs >= 0) {
long durationMs = System.currentTime... | java | protected void logPermitStatus(int nodeId, String prefix) {
String durationString = "";
if(permitAcquisitionTimeMs >= 0) {
long durationMs = System.currentTimeMillis() - permitAcquisitionTimeMs;
permitAcquisitionTimeMs = -1;
durationString = " in " + TimeUnit.MILLISEC... | [
"protected",
"void",
"logPermitStatus",
"(",
"int",
"nodeId",
",",
"String",
"prefix",
")",
"{",
"String",
"durationString",
"=",
"\"\"",
";",
"if",
"(",
"permitAcquisitionTimeMs",
">=",
"0",
")",
"{",
"long",
"durationMs",
"=",
"System",
".",
"currentTimeMill... | Helper method to pretty print progress and timing info.
@param nodeId node ID for which donor permit is required | [
"Helper",
"method",
"to",
"pretty",
"print",
"progress",
"and",
"timing",
"info",
"."
] | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/client/rebalance/task/RebalanceTask.java#L131-L139 |
apache/flink | flink-table/flink-table-planner/src/main/java/org/apache/flink/table/operations/SortOperationFactory.java | SortOperationFactory.createLimitWithFetch | public TableOperation createLimitWithFetch(int fetch, TableOperation child) {
"""
Adds fetch to the underlying {@link SortTableOperation} if it is a valid one.
@param fetch fetch number to add
@param child should be {@link SortTableOperation}
@return valid sort operation with applied fetch
"""
SortTable... | java | public TableOperation createLimitWithFetch(int fetch, TableOperation child) {
SortTableOperation previousSort = validateAndGetChildSort(child);
if (fetch < 0) {
throw new ValidationException("Fetch should be greater or equal 0");
}
int offset = Math.max(previousSort.getOffset(), 0);
return new SortTable... | [
"public",
"TableOperation",
"createLimitWithFetch",
"(",
"int",
"fetch",
",",
"TableOperation",
"child",
")",
"{",
"SortTableOperation",
"previousSort",
"=",
"validateAndGetChildSort",
"(",
"child",
")",
";",
"if",
"(",
"fetch",
"<",
"0",
")",
"{",
"throw",
"new... | Adds fetch to the underlying {@link SortTableOperation} if it is a valid one.
@param fetch fetch number to add
@param child should be {@link SortTableOperation}
@return valid sort operation with applied fetch | [
"Adds",
"fetch",
"to",
"the",
"underlying",
"{",
"@link",
"SortTableOperation",
"}",
"if",
"it",
"is",
"a",
"valid",
"one",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/operations/SortOperationFactory.java#L94-L104 |
h2oai/h2o-3 | h2o-extensions/xgboost/src/main/java/ml/dmlc/xgboost4j/java/XGBoostRegTree.java | XGBoostRegTree.getLeafValue | @Override
public final float getLeafValue(FVec feat, int root_id) {
"""
Retrieves nodes from root to leaf and returns leaf value.
@param feat feature vector
@param root_id starting root index
@return leaf value
"""
int pid = root_id;
int pos = pid * NODE_SIZE + 4;
int cleft_ = UnsafeUtil... | java | @Override
public final float getLeafValue(FVec feat, int root_id) {
int pid = root_id;
int pos = pid * NODE_SIZE + 4;
int cleft_ = UnsafeUtils.get4(_nodes, pos);
while (cleft_ != -1) {
final int sindex_ = UnsafeUtils.get4(_nodes, pos + 8);
final float fvalue = feat.fvalue((int) (sindex_ ... | [
"@",
"Override",
"public",
"final",
"float",
"getLeafValue",
"(",
"FVec",
"feat",
",",
"int",
"root_id",
")",
"{",
"int",
"pid",
"=",
"root_id",
";",
"int",
"pos",
"=",
"pid",
"*",
"NODE_SIZE",
"+",
"4",
";",
"int",
"cleft_",
"=",
"UnsafeUtils",
".",
... | Retrieves nodes from root to leaf and returns leaf value.
@param feat feature vector
@param root_id starting root index
@return leaf value | [
"Retrieves",
"nodes",
"from",
"root",
"to",
"leaf",
"and",
"returns",
"leaf",
"value",
"."
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-extensions/xgboost/src/main/java/ml/dmlc/xgboost4j/java/XGBoostRegTree.java#L53-L74 |
nguillaumin/slick2d-maven | slick2d-examples/src/main/java/org/newdawn/slick/examples/scroller/Scroller.java | Scroller.drawTank | public void drawTank(Graphics g, float xpos, float ypos, float rot) {
"""
Draw a single tank to the game
@param g The graphics context on which we're drawing
@param xpos The x coordinate in tiles the tank is at
@param ypos The y coordinate in tiles the tank is at
@param rot The rotation of the tank
"""
... | java | public void drawTank(Graphics g, float xpos, float ypos, float rot) {
// work out the centre of the tank in rendering coordinates and then
// spit onto the screen
int cx = (int) (xpos * 32);
int cy = (int) (ypos * 32);
g.rotate(cx,cy,rot);
player.draw(cx-16,cy-16);
g.rotate(cx,cy,-rot);
} | [
"public",
"void",
"drawTank",
"(",
"Graphics",
"g",
",",
"float",
"xpos",
",",
"float",
"ypos",
",",
"float",
"rot",
")",
"{",
"// work out the centre of the tank in rendering coordinates and then\r",
"// spit onto the screen\r",
"int",
"cx",
"=",
"(",
"int",
")",
"... | Draw a single tank to the game
@param g The graphics context on which we're drawing
@param xpos The x coordinate in tiles the tank is at
@param ypos The y coordinate in tiles the tank is at
@param rot The rotation of the tank | [
"Draw",
"a",
"single",
"tank",
"to",
"the",
"game"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-examples/src/main/java/org/newdawn/slick/examples/scroller/Scroller.java#L236-L244 |
Alluxio/alluxio | core/common/src/main/java/alluxio/grpc/GrpcChannelBuilder.java | GrpcChannelBuilder.build | public GrpcChannel build() throws AlluxioStatusException {
"""
Creates an authenticated channel of type {@link GrpcChannel}.
@return the built {@link GrpcChannel}
"""
ManagedChannel underlyingChannel =
GrpcManagedChannelPool.INSTANCE().acquireManagedChannel(mChannelKey,
mConfiguratio... | java | public GrpcChannel build() throws AlluxioStatusException {
ManagedChannel underlyingChannel =
GrpcManagedChannelPool.INSTANCE().acquireManagedChannel(mChannelKey,
mConfiguration.getMs(PropertyKey.NETWORK_CONNECTION_HEALTH_CHECK_TIMEOUT_MS),
mConfiguration.getMs(PropertyKey.MASTER_GRP... | [
"public",
"GrpcChannel",
"build",
"(",
")",
"throws",
"AlluxioStatusException",
"{",
"ManagedChannel",
"underlyingChannel",
"=",
"GrpcManagedChannelPool",
".",
"INSTANCE",
"(",
")",
".",
"acquireManagedChannel",
"(",
"mChannelKey",
",",
"mConfiguration",
".",
"getMs",
... | Creates an authenticated channel of type {@link GrpcChannel}.
@return the built {@link GrpcChannel} | [
"Creates",
"an",
"authenticated",
"channel",
"of",
"type",
"{",
"@link",
"GrpcChannel",
"}",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/grpc/GrpcChannelBuilder.java#L200-L231 |
JOML-CI/JOML | src/org/joml/Matrix4f.java | Matrix4f.translationRotate | public Matrix4f translationRotate(float tx, float ty, float tz, float qx, float qy, float qz, float qw) {
"""
Set <code>this</code> matrix to <code>T * R</code>, where <code>T</code> is a translation by the given <code>(tx, ty, tz)</code> and
<code>R</code> is a rotation - and possibly scaling - transformation sp... | java | public Matrix4f translationRotate(float tx, float ty, float tz, float qx, float qy, float qz, float qw) {
float w2 = qw * qw;
float x2 = qx * qx;
float y2 = qy * qy;
float z2 = qz * qz;
float zw = qz * qw;
float xy = qx * qy;
float xz = qx * qz;
float yw =... | [
"public",
"Matrix4f",
"translationRotate",
"(",
"float",
"tx",
",",
"float",
"ty",
",",
"float",
"tz",
",",
"float",
"qx",
",",
"float",
"qy",
",",
"float",
"qz",
",",
"float",
"qw",
")",
"{",
"float",
"w2",
"=",
"qw",
"*",
"qw",
";",
"float",
"x2"... | Set <code>this</code> matrix to <code>T * R</code>, where <code>T</code> is a translation by the given <code>(tx, ty, tz)</code> and
<code>R</code> is a rotation - and possibly scaling - transformation specified by the quaternion <code>(qx, qy, qz, qw)</code>.
<p>
When transforming a vector by the resulting matrix the ... | [
"Set",
"<code",
">",
"this<",
"/",
"code",
">",
"matrix",
"to",
"<code",
">",
"T",
"*",
"R<",
"/",
"code",
">",
"where",
"<code",
">",
"T<",
"/",
"code",
">",
"is",
"a",
"translation",
"by",
"the",
"given",
"<code",
">",
"(",
"tx",
"ty",
"tz",
... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L4426-L4452 |
derari/cthul | strings/src/main/java/org/cthul/strings/format/FormatImplBase.java | FormatImplBase.containsFlag | protected boolean containsFlag(final char flag, final String flags) {
"""
Returns whether {@code flags} contains {@code flag}.
@param flag
@param flags
@return whether {@code flags} contains {@code flag}.
"""
if (flags == null) return false;
return flags.indexOf(flag) >= 0;
} | java | protected boolean containsFlag(final char flag, final String flags) {
if (flags == null) return false;
return flags.indexOf(flag) >= 0;
} | [
"protected",
"boolean",
"containsFlag",
"(",
"final",
"char",
"flag",
",",
"final",
"String",
"flags",
")",
"{",
"if",
"(",
"flags",
"==",
"null",
")",
"return",
"false",
";",
"return",
"flags",
".",
"indexOf",
"(",
"flag",
")",
">=",
"0",
";",
"}"
] | Returns whether {@code flags} contains {@code flag}.
@param flag
@param flags
@return whether {@code flags} contains {@code flag}. | [
"Returns",
"whether",
"{"
] | train | https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/strings/src/main/java/org/cthul/strings/format/FormatImplBase.java#L194-L197 |
cchantep/acolyte | jdbc-driver/src/main/java/acolyte/jdbc/PreparedStatement.java | PreparedStatement.setObject | public void setObject(final int parameterIndex,
final Object x) throws SQLException {
"""
{@inheritDoc}
Cannot be used with null parameter |x|.
@see #setObject(int,Object,int)
"""
if (x == null) {
if ("true".equals(connection.getProperties().
... | java | public void setObject(final int parameterIndex,
final Object x) throws SQLException {
if (x == null) {
if ("true".equals(connection.getProperties().
get("acolyte.parameter.untypedNull"))) {
// Fallback to String-VARCHAR
... | [
"public",
"void",
"setObject",
"(",
"final",
"int",
"parameterIndex",
",",
"final",
"Object",
"x",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"x",
"==",
"null",
")",
"{",
"if",
"(",
"\"true\"",
".",
"equals",
"(",
"connection",
".",
"getProperties",
... | {@inheritDoc}
Cannot be used with null parameter |x|.
@see #setObject(int,Object,int) | [
"{"
] | train | https://github.com/cchantep/acolyte/blob/a383dff20fadc08ec9306f2f1f24b2a7e0047449/jdbc-driver/src/main/java/acolyte/jdbc/PreparedStatement.java#L501-L530 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_health_resource.java | xen_health_resource.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception {
"""
<pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre>
"""
xen_health_resource_responses result = (xen_health_resource_responses) ... | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
xen_health_resource_responses result = (xen_health_resource_responses) service.get_payload_formatter().string_to_resource(xen_health_resource_responses.class, response);
if(result.errorcode != 0)
{
... | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"xen_health_resource_responses",
"result",
"=",
"(",
"xen_health_resource_responses",
")",
"service",
".",
"ge... | <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/xen/xen_health_resource.java#L313-L330 |
Azure/azure-sdk-for-java | automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/DscConfigurationsInner.java | DscConfigurationsInner.get | public DscConfigurationInner get(String resourceGroupName, String automationAccountName, String configurationName) {
"""
Retrieve the configuration identified by configuration name.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@para... | java | public DscConfigurationInner get(String resourceGroupName, String automationAccountName, String configurationName) {
return getWithServiceResponseAsync(resourceGroupName, automationAccountName, configurationName).toBlocking().single().body();
} | [
"public",
"DscConfigurationInner",
"get",
"(",
"String",
"resourceGroupName",
",",
"String",
"automationAccountName",
",",
"String",
"configurationName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"automationAccountName",
",",
"configu... | Retrieve the configuration identified by configuration name.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param configurationName The configuration name.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws Erro... | [
"Retrieve",
"the",
"configuration",
"identified",
"by",
"configuration",
"name",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/DscConfigurationsInner.java#L199-L201 |
sababado/CircularView | library/src/main/java/com/sababado/circularview/CircularViewObject.java | CircularViewObject.distanceFromCenter | public double distanceFromCenter(final float x, final float y) {
"""
Get the distance from the given point to the center of this object.
@param x X coordinate.
@param y Y coordinate.
@return Distance from the given point to the center of this object.
"""
return Math.sqrt(Math.pow(x - this.x, 2) + ... | java | public double distanceFromCenter(final float x, final float y) {
return Math.sqrt(Math.pow(x - this.x, 2) + Math.pow(y - this.y, 2));
} | [
"public",
"double",
"distanceFromCenter",
"(",
"final",
"float",
"x",
",",
"final",
"float",
"y",
")",
"{",
"return",
"Math",
".",
"sqrt",
"(",
"Math",
".",
"pow",
"(",
"x",
"-",
"this",
".",
"x",
",",
"2",
")",
"+",
"Math",
".",
"pow",
"(",
"y",... | Get the distance from the given point to the center of this object.
@param x X coordinate.
@param y Y coordinate.
@return Distance from the given point to the center of this object. | [
"Get",
"the",
"distance",
"from",
"the",
"given",
"point",
"to",
"the",
"center",
"of",
"this",
"object",
"."
] | train | https://github.com/sababado/CircularView/blob/c9ab818d063bcc0796183616f8a82166a9b80aac/library/src/main/java/com/sababado/circularview/CircularViewObject.java#L153-L155 |
kiswanij/jk-util | src/main/java/com/jk/util/model/table/JKDefaultTableModel.java | JKDefaultTableModel.setDataVector | public void setDataVector(final Vector dataVector, final Vector columnIdentifiers) {
"""
Replaces the current <code>dataVector</code> instance variable with the new
<code>Vector</code> of rows, <code>dataVector</code>. Each row is represented
in <code>dataVector</code> as a <code>Vector</code> of <code>Object</c... | java | public void setDataVector(final Vector dataVector, final Vector columnIdentifiers) {
this.dataVector = nonNullVector(dataVector);
this.columnIdentifiers = nonNullVector(columnIdentifiers);
justifyRows(0, getRowCount());
fireTableStructureChanged();
} | [
"public",
"void",
"setDataVector",
"(",
"final",
"Vector",
"dataVector",
",",
"final",
"Vector",
"columnIdentifiers",
")",
"{",
"this",
".",
"dataVector",
"=",
"nonNullVector",
"(",
"dataVector",
")",
";",
"this",
".",
"columnIdentifiers",
"=",
"nonNullVector",
... | Replaces the current <code>dataVector</code> instance variable with the new
<code>Vector</code> of rows, <code>dataVector</code>. Each row is represented
in <code>dataVector</code> as a <code>Vector</code> of <code>Object</code>
values. <code>columnIdentifiers</code> are the names of the new columns. The
first name in ... | [
"Replaces",
"the",
"current",
"<code",
">",
"dataVector<",
"/",
"code",
">",
"instance",
"variable",
"with",
"the",
"new",
"<code",
">",
"Vector<",
"/",
"code",
">",
"of",
"rows",
"<code",
">",
"dataVector<",
"/",
"code",
">",
".",
"Each",
"row",
"is",
... | train | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/model/table/JKDefaultTableModel.java#L659-L664 |
apptik/jus | jus-java/src/main/java/io/apptik/comm/jus/http/HttpUrl.java | HttpUrl.queryParameterNames | public Set<String> queryParameterNames() {
"""
Returns the distinct query parameter names in this URL, like {@code ["a", "b"]} for {@code
http://host/?a=apple&b=banana}. If this URL has no query this returns the empty set.
<p><table summary="">
<tr><th>URL</th><th>{@code queryParameterNames()}</th></tr>
<tr>... | java | public Set<String> queryParameterNames() {
if (queryNamesAndValues == null) return Collections.emptySet();
Set<String> result = new LinkedHashSet<>();
for (int i = 0, size = queryNamesAndValues.size(); i < size; i += 2) {
result.add(queryNamesAndValues.get(i));
}
retu... | [
"public",
"Set",
"<",
"String",
">",
"queryParameterNames",
"(",
")",
"{",
"if",
"(",
"queryNamesAndValues",
"==",
"null",
")",
"return",
"Collections",
".",
"emptySet",
"(",
")",
";",
"Set",
"<",
"String",
">",
"result",
"=",
"new",
"LinkedHashSet",
"<>",... | Returns the distinct query parameter names in this URL, like {@code ["a", "b"]} for {@code
http://host/?a=apple&b=banana}. If this URL has no query this returns the empty set.
<p><table summary="">
<tr><th>URL</th><th>{@code queryParameterNames()}</th></tr>
<tr><td>{@code http://host/}</td><td>{@code []}</td></tr>
<tr... | [
"Returns",
"the",
"distinct",
"query",
"parameter",
"names",
"in",
"this",
"URL",
"like",
"{",
"@code",
"[",
"a",
"b",
"]",
"}",
"for",
"{",
"@code",
"http",
":",
"//",
"host",
"/",
"?a",
"=",
"apple&b",
"=",
"banana",
"}",
".",
"If",
"this",
"URL"... | train | https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/jus-java/src/main/java/io/apptik/comm/jus/http/HttpUrl.java#L730-L737 |
code4everything/util | src/main/java/com/zhazhapan/util/DateUtils.java | DateUtils.convertDateToTimestamp | public static Timestamp convertDateToTimestamp(Date date, Timestamp elseValue) {
"""
将日期转换成时间戳
@param date {@link Date}
@param elseValue 日期为空返回默认时间戳
@return {@link Timestamp}
@since 1.1.1
"""
return Checker.isNull(date) ? elseValue : new Timestamp(date.getTime());
} | java | public static Timestamp convertDateToTimestamp(Date date, Timestamp elseValue) {
return Checker.isNull(date) ? elseValue : new Timestamp(date.getTime());
} | [
"public",
"static",
"Timestamp",
"convertDateToTimestamp",
"(",
"Date",
"date",
",",
"Timestamp",
"elseValue",
")",
"{",
"return",
"Checker",
".",
"isNull",
"(",
"date",
")",
"?",
"elseValue",
":",
"new",
"Timestamp",
"(",
"date",
".",
"getTime",
"(",
")",
... | 将日期转换成时间戳
@param date {@link Date}
@param elseValue 日期为空返回默认时间戳
@return {@link Timestamp}
@since 1.1.1 | [
"将日期转换成时间戳"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/DateUtils.java#L77-L79 |
betamaxteam/betamax | betamax-core/src/main/java/software/betamax/util/ProxyOverrider.java | ProxyOverrider.lookupChainedProxies | @Override
public void lookupChainedProxies(HttpRequest request, Queue<ChainedProxy> chainedProxies) {
"""
Used by LittleProxy to connect to a downstream proxy if there is one.
"""
final InetSocketAddress originalProxy = originalProxies.get(URI.create(request.getUri()).getScheme());
if (orig... | java | @Override
public void lookupChainedProxies(HttpRequest request, Queue<ChainedProxy> chainedProxies) {
final InetSocketAddress originalProxy = originalProxies.get(URI.create(request.getUri()).getScheme());
if (originalProxy != null) {
ChainedProxy chainProxy = new ChainedProxyAdapter() {
... | [
"@",
"Override",
"public",
"void",
"lookupChainedProxies",
"(",
"HttpRequest",
"request",
",",
"Queue",
"<",
"ChainedProxy",
">",
"chainedProxies",
")",
"{",
"final",
"InetSocketAddress",
"originalProxy",
"=",
"originalProxies",
".",
"get",
"(",
"URI",
".",
"creat... | Used by LittleProxy to connect to a downstream proxy if there is one. | [
"Used",
"by",
"LittleProxy",
"to",
"connect",
"to",
"a",
"downstream",
"proxy",
"if",
"there",
"is",
"one",
"."
] | train | https://github.com/betamaxteam/betamax/blob/30f29db9a2e2975f9d8ccd28ee3f4cea2bdf16e0/betamax-core/src/main/java/software/betamax/util/ProxyOverrider.java#L116-L130 |
wcm-io/wcm-io-sling | commons/src/main/java/io/wcm/sling/commons/request/RequestParam.java | RequestParam.getBoolean | public static boolean getBoolean(@NotNull ServletRequest request, @NotNull String param, boolean defaultValue) {
"""
Returns a request parameter as boolean.
@param request Request.
@param param Parameter name.
@param defaultValue Default value.
@return Parameter value or default value if it does not exist or <... | java | public static boolean getBoolean(@NotNull ServletRequest request, @NotNull String param, boolean defaultValue) {
String value = request.getParameter(param);
return BooleanUtils.toBoolean(value);
} | [
"public",
"static",
"boolean",
"getBoolean",
"(",
"@",
"NotNull",
"ServletRequest",
"request",
",",
"@",
"NotNull",
"String",
"param",
",",
"boolean",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"request",
".",
"getParameter",
"(",
"param",
")",
";",
"... | Returns a request parameter as boolean.
@param request Request.
@param param Parameter name.
@param defaultValue Default value.
@return Parameter value or default value if it does not exist or <code>false</code> if it cannot be interpreted as
boolean. | [
"Returns",
"a",
"request",
"parameter",
"as",
"boolean",
"."
] | train | https://github.com/wcm-io/wcm-io-sling/blob/90adbe432469378794b5695c72e9cdfa2b7d36f1/commons/src/main/java/io/wcm/sling/commons/request/RequestParam.java#L245-L248 |
netty/netty | codec/src/main/java/io/netty/handler/codec/DateFormatter.java | DateFormatter.parseHttpDate | public static Date parseHttpDate(CharSequence txt, int start, int end) {
"""
Parse some text into a {@link Date}, according to RFC6265
@param txt text to parse
@param start the start index inside {@code txt}
@param end the end index inside {@code txt}
@return a {@link Date}, or null if text couldn't be parsed
... | java | public static Date parseHttpDate(CharSequence txt, int start, int end) {
int length = end - start;
if (length == 0) {
return null;
} else if (length < 0) {
throw new IllegalArgumentException("Can't have end < start");
} else if (length > 64) {
throw ne... | [
"public",
"static",
"Date",
"parseHttpDate",
"(",
"CharSequence",
"txt",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"int",
"length",
"=",
"end",
"-",
"start",
";",
"if",
"(",
"length",
"==",
"0",
")",
"{",
"return",
"null",
";",
"}",
"else",
... | Parse some text into a {@link Date}, according to RFC6265
@param txt text to parse
@param start the start index inside {@code txt}
@param end the end index inside {@code txt}
@return a {@link Date}, or null if text couldn't be parsed | [
"Parse",
"some",
"text",
"into",
"a",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/DateFormatter.java#L95-L106 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WebUtilities.java | WebUtilities.isAncestor | public static boolean isAncestor(final WComponent component1, final WComponent component2) {
"""
Indicates whether a component is an ancestor of another.
@param component1 a possible ancestor.
@param component2 the component to check.
@return true if <code>component1</code> is an ancestor of <code>component2<... | java | public static boolean isAncestor(final WComponent component1, final WComponent component2) {
for (WComponent parent = component2.getParent(); parent != null; parent = parent.getParent()) {
if (parent == component1) {
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"isAncestor",
"(",
"final",
"WComponent",
"component1",
",",
"final",
"WComponent",
"component2",
")",
"{",
"for",
"(",
"WComponent",
"parent",
"=",
"component2",
".",
"getParent",
"(",
")",
";",
"parent",
"!=",
"null",
";",
"p... | Indicates whether a component is an ancestor of another.
@param component1 a possible ancestor.
@param component2 the component to check.
@return true if <code>component1</code> is an ancestor of <code>component2</code>, false otherwise. | [
"Indicates",
"whether",
"a",
"component",
"is",
"an",
"ancestor",
"of",
"another",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WebUtilities.java#L574-L582 |
apache/flink | flink-core/src/main/java/org/apache/flink/types/parser/BooleanParser.java | BooleanParser.byteArrayEquals | private static boolean byteArrayEquals(byte[] source, int start, int length, byte[] other) {
"""
Checks if a part of a byte array matches another byte array with chars (case-insensitive).
@param source The source byte array.
@param start The offset into the source byte array.
@param length The length of the mat... | java | private static boolean byteArrayEquals(byte[] source, int start, int length, byte[] other) {
if (length != other.length) {
return false;
}
for (int i = 0; i < other.length; i++) {
if (Character.toLowerCase(source[i + start]) != other[i]) {
return false;
}
}
return true;
} | [
"private",
"static",
"boolean",
"byteArrayEquals",
"(",
"byte",
"[",
"]",
"source",
",",
"int",
"start",
",",
"int",
"length",
",",
"byte",
"[",
"]",
"other",
")",
"{",
"if",
"(",
"length",
"!=",
"other",
".",
"length",
")",
"{",
"return",
"false",
"... | Checks if a part of a byte array matches another byte array with chars (case-insensitive).
@param source The source byte array.
@param start The offset into the source byte array.
@param length The length of the match.
@param other The byte array which is fully compared to the part of the source array.
@return true if ... | [
"Checks",
"if",
"a",
"part",
"of",
"a",
"byte",
"array",
"matches",
"another",
"byte",
"array",
"with",
"chars",
"(",
"case",
"-",
"insensitive",
")",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/types/parser/BooleanParser.java#L84-L94 |
jhalterman/lyra | src/main/java/net/jodah/lyra/config/RecoveryPolicy.java | RecoveryPolicy.withBackoff | @Override
public RecoveryPolicy withBackoff(Duration interval, Duration maxInterval, int intervalMultiplier) {
"""
Sets the {@code interval} to pause for between attempts, exponentially backing of to the
{@code maxInterval} multiplying successive intervals by the {@code intervalMultiplier}.
@throws NullPoint... | java | @Override
public RecoveryPolicy withBackoff(Duration interval, Duration maxInterval, int intervalMultiplier) {
return super.withBackoff(interval, maxInterval, intervalMultiplier);
} | [
"@",
"Override",
"public",
"RecoveryPolicy",
"withBackoff",
"(",
"Duration",
"interval",
",",
"Duration",
"maxInterval",
",",
"int",
"intervalMultiplier",
")",
"{",
"return",
"super",
".",
"withBackoff",
"(",
"interval",
",",
"maxInterval",
",",
"intervalMultiplier"... | Sets the {@code interval} to pause for between attempts, exponentially backing of to the
{@code maxInterval} multiplying successive intervals by the {@code intervalMultiplier}.
@throws NullPointerException if {@code interval} or {@code maxInterval} are null
@throws IllegalArgumentException if {@code interval} is <= 0,... | [
"Sets",
"the",
"{",
"@code",
"interval",
"}",
"to",
"pause",
"for",
"between",
"attempts",
"exponentially",
"backing",
"of",
"to",
"the",
"{",
"@code",
"maxInterval",
"}",
"multiplying",
"successive",
"intervals",
"by",
"the",
"{",
"@code",
"intervalMultiplier",... | train | https://github.com/jhalterman/lyra/blob/ce347a69357fef1b34e92d92a4f9e68792d81255/src/main/java/net/jodah/lyra/config/RecoveryPolicy.java#L101-L104 |
jbundle/jbundle | main/db/src/main/java/org/jbundle/main/user/db/UserInfo.java | UserInfo.addPropertyListeners | public void addPropertyListeners() {
"""
Add The listeners to sync the property field with the virtual fields.
"""
BaseField fldProperties = this.getField(PropertiesRecord.PROPERTIES);
if (fldProperties.getListener(CopyConvertersHandler.class) != null)
return;
this.... | java | public void addPropertyListeners()
{
BaseField fldProperties = this.getField(PropertiesRecord.PROPERTIES);
if (fldProperties.getListener(CopyConvertersHandler.class) != null)
return;
this.addPropertiesFieldBehavior(this.getField(UserInfo.FRAMES), DBParams.FRAMES);
... | [
"public",
"void",
"addPropertyListeners",
"(",
")",
"{",
"BaseField",
"fldProperties",
"=",
"this",
".",
"getField",
"(",
"PropertiesRecord",
".",
"PROPERTIES",
")",
";",
"if",
"(",
"fldProperties",
".",
"getListener",
"(",
"CopyConvertersHandler",
".",
"class",
... | Add The listeners to sync the property field with the virtual fields. | [
"Add",
"The",
"listeners",
"to",
"sync",
"the",
"property",
"field",
"with",
"the",
"virtual",
"fields",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/db/src/main/java/org/jbundle/main/user/db/UserInfo.java#L309-L338 |
mapbox/mapbox-navigation-android | libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/OfflineNavigator.java | OfflineNavigator.removeTiles | void removeTiles(String tilePath, Point southwest, Point northeast, OnOfflineTilesRemovedCallback callback) {
"""
Removes tiles within / intersected by a bounding box
@param tilePath directory path where the tiles are located
@param southwest lower left {@link Point} of the bounding box
@param northeast uppe... | java | void removeTiles(String tilePath, Point southwest, Point northeast, OnOfflineTilesRemovedCallback callback) {
new RemoveTilesTask(navigator, tilePath, southwest, northeast, callback).execute();
} | [
"void",
"removeTiles",
"(",
"String",
"tilePath",
",",
"Point",
"southwest",
",",
"Point",
"northeast",
",",
"OnOfflineTilesRemovedCallback",
"callback",
")",
"{",
"new",
"RemoveTilesTask",
"(",
"navigator",
",",
"tilePath",
",",
"southwest",
",",
"northeast",
","... | Removes tiles within / intersected by a bounding box
@param tilePath directory path where the tiles are located
@param southwest lower left {@link Point} of the bounding box
@param northeast upper right {@link Point} of the bounding box
@param callback a callback that will be fired when the routing tiles have been r... | [
"Removes",
"tiles",
"within",
"/",
"intersected",
"by",
"a",
"bounding",
"box"
] | train | https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/OfflineNavigator.java#L54-L56 |
briandilley/jsonrpc4j | src/main/java/com/googlecode/jsonrpc4j/JsonRpcClient.java | JsonRpcClient.invokeAndReadResponse | private Object invokeAndReadResponse(String methodName, Object argument, Type returnType, OutputStream output, InputStream input, String id) throws Throwable {
"""
Invokes the given method on the remote service
passing the given arguments and reads a response.
@param methodName the method to invoke
@param arg... | java | private Object invokeAndReadResponse(String methodName, Object argument, Type returnType, OutputStream output, InputStream input, String id) throws Throwable {
invoke(methodName, argument, output, id);
return readResponse(returnType, input, id);
} | [
"private",
"Object",
"invokeAndReadResponse",
"(",
"String",
"methodName",
",",
"Object",
"argument",
",",
"Type",
"returnType",
",",
"OutputStream",
"output",
",",
"InputStream",
"input",
",",
"String",
"id",
")",
"throws",
"Throwable",
"{",
"invoke",
"(",
"met... | Invokes the given method on the remote service
passing the given arguments and reads a response.
@param methodName the method to invoke
@param argument the argument to pass to the method
@param returnType the expected return type
@param output the {@link OutputStream} to write to
@param input the {@link Inp... | [
"Invokes",
"the",
"given",
"method",
"on",
"the",
"remote",
"service",
"passing",
"the",
"given",
"arguments",
"and",
"reads",
"a",
"response",
"."
] | train | https://github.com/briandilley/jsonrpc4j/blob/d749762c9295b92d893677a8c7be2a14dd43b3bb/src/main/java/com/googlecode/jsonrpc4j/JsonRpcClient.java#L157-L160 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UCharacter.java | UCharacter.toLowerCase | public static String toLowerCase(ULocale locale, String str) {
"""
Returns the lowercase version of the argument string.
Casing is dependent on the argument locale and context-sensitive
@param locale which string is to be converted in
@param str source string to be performed on
@return lowercase version of the... | java | public static String toLowerCase(ULocale locale, String str) {
return toLowerCase(getCaseLocale(locale), str);
} | [
"public",
"static",
"String",
"toLowerCase",
"(",
"ULocale",
"locale",
",",
"String",
"str",
")",
"{",
"return",
"toLowerCase",
"(",
"getCaseLocale",
"(",
"locale",
")",
",",
"str",
")",
";",
"}"
] | Returns the lowercase version of the argument string.
Casing is dependent on the argument locale and context-sensitive
@param locale which string is to be converted in
@param str source string to be performed on
@return lowercase version of the argument string | [
"Returns",
"the",
"lowercase",
"version",
"of",
"the",
"argument",
"string",
".",
"Casing",
"is",
"dependent",
"on",
"the",
"argument",
"locale",
"and",
"context",
"-",
"sensitive"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UCharacter.java#L4444-L4446 |
grails/grails-core | grails-core/src/main/groovy/org/grails/compiler/injection/GrailsASTUtils.java | GrailsASTUtils.applyDefaultMethodTarget | public static MethodCallExpression applyDefaultMethodTarget(final MethodCallExpression methodCallExpression, final ClassNode targetClassNode) {
"""
Set the method target of a MethodCallExpression to the first matching method with same number of arguments.
This doesn't check argument types.
@param methodCallExp... | java | public static MethodCallExpression applyDefaultMethodTarget(final MethodCallExpression methodCallExpression, final ClassNode targetClassNode) {
return applyMethodTarget(methodCallExpression, targetClassNode, (ClassNode[])null);
} | [
"public",
"static",
"MethodCallExpression",
"applyDefaultMethodTarget",
"(",
"final",
"MethodCallExpression",
"methodCallExpression",
",",
"final",
"ClassNode",
"targetClassNode",
")",
"{",
"return",
"applyMethodTarget",
"(",
"methodCallExpression",
",",
"targetClassNode",
",... | Set the method target of a MethodCallExpression to the first matching method with same number of arguments.
This doesn't check argument types.
@param methodCallExpression
@param targetClassNode | [
"Set",
"the",
"method",
"target",
"of",
"a",
"MethodCallExpression",
"to",
"the",
"first",
"matching",
"method",
"with",
"same",
"number",
"of",
"arguments",
".",
"This",
"doesn",
"t",
"check",
"argument",
"types",
"."
] | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/org/grails/compiler/injection/GrailsASTUtils.java#L1199-L1201 |
google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/CDATASectionImpl.java | CDATASectionImpl.replaceWithText | public TextImpl replaceWithText() {
"""
Replaces this node with a semantically equivalent text node. This node
will be removed from the DOM tree and the new node inserted in its place.
@return the replacement node.
"""
TextImpl replacement = new TextImpl(document, getData());
parent.insertB... | java | public TextImpl replaceWithText() {
TextImpl replacement = new TextImpl(document, getData());
parent.insertBefore(replacement, this);
parent.removeChild(this);
return replacement;
} | [
"public",
"TextImpl",
"replaceWithText",
"(",
")",
"{",
"TextImpl",
"replacement",
"=",
"new",
"TextImpl",
"(",
"document",
",",
"getData",
"(",
")",
")",
";",
"parent",
".",
"insertBefore",
"(",
"replacement",
",",
"this",
")",
";",
"parent",
".",
"remove... | Replaces this node with a semantically equivalent text node. This node
will be removed from the DOM tree and the new node inserted in its place.
@return the replacement node. | [
"Replaces",
"this",
"node",
"with",
"a",
"semantically",
"equivalent",
"text",
"node",
".",
"This",
"node",
"will",
"be",
"removed",
"from",
"the",
"DOM",
"tree",
"and",
"the",
"new",
"node",
"inserted",
"in",
"its",
"place",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/CDATASectionImpl.java#L81-L86 |
alkacon/opencms-core | src/org/opencms/workplace/CmsWorkplaceMessages.java | CmsWorkplaceMessages.getResourceTypeName | public static String getResourceTypeName(CmsWorkplace wp, String name) {
"""
Returns the localized name of the given resource type name.<p>
If this key is not found, the value of the name input will be returned.<p>
@param wp an instance of a {@link CmsWorkplace} to resolve the key name with
@param name the ... | java | public static String getResourceTypeName(CmsWorkplace wp, String name) {
// try to find the localized key
CmsExplorerTypeSettings typeSettings = OpenCms.getWorkplaceManager().getExplorerTypeSetting(name);
if (typeSettings == null) {
return name;
}
String key = typeSe... | [
"public",
"static",
"String",
"getResourceTypeName",
"(",
"CmsWorkplace",
"wp",
",",
"String",
"name",
")",
"{",
"// try to find the localized key",
"CmsExplorerTypeSettings",
"typeSettings",
"=",
"OpenCms",
".",
"getWorkplaceManager",
"(",
")",
".",
"getExplorerTypeSetti... | Returns the localized name of the given resource type name.<p>
If this key is not found, the value of the name input will be returned.<p>
@param wp an instance of a {@link CmsWorkplace} to resolve the key name with
@param name the resource type name to generate the nice name for
@return the localized name of the giv... | [
"Returns",
"the",
"localized",
"name",
"of",
"the",
"given",
"resource",
"type",
"name",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsWorkplaceMessages.java#L172-L181 |
threerings/nenya | core/src/main/java/com/threerings/media/image/ImageManager.java | ImageManager.getPreparedImage | public BufferedImage getPreparedImage (String rset, String path) {
"""
Loads (and caches) the specified image from the resource manager, obtaining the image from
the supplied resource set.
<p> Additionally the image is optimized for display in the current graphics
configuration. Consider using {@link #getMira... | java | public BufferedImage getPreparedImage (String rset, String path)
{
return getPreparedImage(rset, path, null);
} | [
"public",
"BufferedImage",
"getPreparedImage",
"(",
"String",
"rset",
",",
"String",
"path",
")",
"{",
"return",
"getPreparedImage",
"(",
"rset",
",",
"path",
",",
"null",
")",
";",
"}"
] | Loads (and caches) the specified image from the resource manager, obtaining the image from
the supplied resource set.
<p> Additionally the image is optimized for display in the current graphics
configuration. Consider using {@link #getMirage(ImageKey)} instead of prepared images as
they (some day) will automatically u... | [
"Loads",
"(",
"and",
"caches",
")",
"the",
"specified",
"image",
"from",
"the",
"resource",
"manager",
"obtaining",
"the",
"image",
"from",
"the",
"supplied",
"resource",
"set",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/ImageManager.java#L230-L233 |
wanglinsong/testharness | src/main/java/com/tascape/qa/th/Utils.java | Utils.cmd | public static List<String> cmd(String[] command) throws IOException, InterruptedException {
"""
Executes command, and waits for the expected phrase in console printout.
@param command command line
@return console output as a list of strings
@throws IOException for command error
@throws Interrupt... | java | public static List<String> cmd(String[] command) throws IOException, InterruptedException {
return cmd(command, null, null, 300000L, null);
} | [
"public",
"static",
"List",
"<",
"String",
">",
"cmd",
"(",
"String",
"[",
"]",
"command",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"return",
"cmd",
"(",
"command",
",",
"null",
",",
"null",
",",
"300000L",
",",
"null",
")",
";",
... | Executes command, and waits for the expected phrase in console printout.
@param command command line
@return console output as a list of strings
@throws IOException for command error
@throws InterruptedException when interrupted | [
"Executes",
"command",
"and",
"waits",
"for",
"the",
"expected",
"phrase",
"in",
"console",
"printout",
"."
] | train | https://github.com/wanglinsong/testharness/blob/76f3e4546648e0720f6f87a58cb91a09cd36dfca/src/main/java/com/tascape/qa/th/Utils.java#L126-L128 |
JM-Lab/utils-java8 | src/main/java/kr/jm/utils/stats/JMStats.java | JMStats.calPercentPrecisely | public static double calPercentPrecisely(Number target, Number total) {
"""
Cal percent precisely double.
@param target the target
@param total the total
@return the double
"""
double targetD = target.doubleValue();
double totalD = total.doubleValue();
return targetD == totalD ? 1... | java | public static double calPercentPrecisely(Number target, Number total) {
double targetD = target.doubleValue();
double totalD = total.doubleValue();
return targetD == totalD ? 100d : targetD / totalD * 100;
} | [
"public",
"static",
"double",
"calPercentPrecisely",
"(",
"Number",
"target",
",",
"Number",
"total",
")",
"{",
"double",
"targetD",
"=",
"target",
".",
"doubleValue",
"(",
")",
";",
"double",
"totalD",
"=",
"total",
".",
"doubleValue",
"(",
")",
";",
"ret... | Cal percent precisely double.
@param target the target
@param total the total
@return the double | [
"Cal",
"percent",
"precisely",
"double",
"."
] | train | https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/stats/JMStats.java#L230-L234 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/NodeVector.java | NodeVector.pushPair | public final void pushPair(int v1, int v2) {
"""
Push a pair of nodes into the stack.
Special purpose method for TransformerImpl, pushElemTemplateElement.
Performance critical.
@param v1 First node to add to vector
@param v2 Second node to add to vector
"""
if (null == m_map)
{
m_map = new... | java | public final void pushPair(int v1, int v2)
{
if (null == m_map)
{
m_map = new int[m_blocksize];
m_mapSize = m_blocksize;
}
else
{
if ((m_firstFree + 2) >= m_mapSize)
{
m_mapSize += m_blocksize;
int newMap[] = new int[m_mapSize];
System.arraycopy(m... | [
"public",
"final",
"void",
"pushPair",
"(",
"int",
"v1",
",",
"int",
"v2",
")",
"{",
"if",
"(",
"null",
"==",
"m_map",
")",
"{",
"m_map",
"=",
"new",
"int",
"[",
"m_blocksize",
"]",
";",
"m_mapSize",
"=",
"m_blocksize",
";",
"}",
"else",
"{",
"if",... | Push a pair of nodes into the stack.
Special purpose method for TransformerImpl, pushElemTemplateElement.
Performance critical.
@param v1 First node to add to vector
@param v2 Second node to add to vector | [
"Push",
"a",
"pair",
"of",
"nodes",
"into",
"the",
"stack",
".",
"Special",
"purpose",
"method",
"for",
"TransformerImpl",
"pushElemTemplateElement",
".",
"Performance",
"critical",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/NodeVector.java#L244-L269 |
anotheria/moskito | moskito-extensions/moskito-monitoring-plugin/src/main/java/net/anotheria/moskito/extensions/monitoring/parser/ApacheStatusParser.java | ApacheStatusParser.parseScoreboard | private static void parseScoreboard(final StatusData<ApacheMetrics> statusData, final String scoreboard) {
"""
Parse scoreboard line.
Scoreboard Key:
"_" Waiting for Connection, "S" Starting up, "R" Reading Request,
"W" Sending Reply, "K" Keepalive (read), "D" DNS Lookup,
"C" Closing connection, "L" Logging, "... | java | private static void parseScoreboard(final StatusData<ApacheMetrics> statusData, final String scoreboard) {
statusData.put(ApacheMetrics.SCOREBOARD_WAITINGFORCONNECTION, charCount(scoreboard, '_'));
statusData.put(ApacheMetrics.SCOREBOARD_STARTINGUP, charCount(scoreboard, 'S'));
statusData.put(Ap... | [
"private",
"static",
"void",
"parseScoreboard",
"(",
"final",
"StatusData",
"<",
"ApacheMetrics",
">",
"statusData",
",",
"final",
"String",
"scoreboard",
")",
"{",
"statusData",
".",
"put",
"(",
"ApacheMetrics",
".",
"SCOREBOARD_WAITINGFORCONNECTION",
",",
"charCou... | Parse scoreboard line.
Scoreboard Key:
"_" Waiting for Connection, "S" Starting up, "R" Reading Request,
"W" Sending Reply, "K" Keepalive (read), "D" DNS Lookup,
"C" Closing connection, "L" Logging, "G" Gracefully finishing,
"I" Idle cleanup of worker, "." Open slot with no current process | [
"Parse",
"scoreboard",
"line",
".",
"Scoreboard",
"Key",
":",
"_",
"Waiting",
"for",
"Connection",
"S",
"Starting",
"up",
"R",
"Reading",
"Request",
"W",
"Sending",
"Reply",
"K",
"Keepalive",
"(",
"read",
")",
"D",
"DNS",
"Lookup",
"C",
"Closing",
"connect... | train | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-extensions/moskito-monitoring-plugin/src/main/java/net/anotheria/moskito/extensions/monitoring/parser/ApacheStatusParser.java#L102-L115 |
probedock/probedock-java | src/main/java/io/probedock/client/core/filters/FilterUtils.java | FilterUtils.isRunnable | @SuppressWarnings("unchecked")
public static boolean isRunnable(Class cl, Method method, List<FilterDefinition> filters) {
"""
Define if a test is runnable or not based on a method and class
@param cl Class
@param method The method
@param filters The filters to apply
@return True if the test can be run
... | java | @SuppressWarnings("unchecked")
public static boolean isRunnable(Class cl, Method method, List<FilterDefinition> filters) {
// Get the ROX annotations
ProbeTest mAnnotation = method.getAnnotation(ProbeTest.class);
ProbeTestClass cAnnotation = method.getDeclaringClass().getAnnotation(ProbeTest... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"boolean",
"isRunnable",
"(",
"Class",
"cl",
",",
"Method",
"method",
",",
"List",
"<",
"FilterDefinition",
">",
"filters",
")",
"{",
"// Get the ROX annotations",
"ProbeTest",
"mAnnotation",
... | Define if a test is runnable or not based on a method and class
@param cl Class
@param method The method
@param filters The filters to apply
@return True if the test can be run | [
"Define",
"if",
"a",
"test",
"is",
"runnable",
"or",
"not",
"based",
"on",
"a",
"method",
"and",
"class"
] | train | https://github.com/probedock/probedock-java/blob/92ee6634ba4fe3fdffeb4e202f5372ef947a67c3/src/main/java/io/probedock/client/core/filters/FilterUtils.java#L44-L57 |
wcm-io/wcm-io-handler | link/src/main/java/io/wcm/handler/link/type/helpers/InternalLinkResolver.java | InternalLinkResolver.acceptPage | @SuppressWarnings("deprecation")
public boolean acceptPage(@Nullable Page page, @NotNull InternalLinkResolverOptions options) {
"""
Check if a given page is valid and acceptable to link upon.
@param page Page
@param options Options
@return true if link is acceptable
"""
if (page == null) {
retur... | java | @SuppressWarnings("deprecation")
public boolean acceptPage(@Nullable Page page, @NotNull InternalLinkResolverOptions options) {
if (page == null) {
return false;
}
// check for jcr:content node
if (!page.hasContent()) {
return false;
}
// check if page is valid concerning on/off-... | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"public",
"boolean",
"acceptPage",
"(",
"@",
"Nullable",
"Page",
"page",
",",
"@",
"NotNull",
"InternalLinkResolverOptions",
"options",
")",
"{",
"if",
"(",
"page",
"==",
"null",
")",
"{",
"return",
"false"... | Check if a given page is valid and acceptable to link upon.
@param page Page
@param options Options
@return true if link is acceptable | [
"Check",
"if",
"a",
"given",
"page",
"is",
"valid",
"and",
"acceptable",
"to",
"link",
"upon",
"."
] | train | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/link/src/main/java/io/wcm/handler/link/type/helpers/InternalLinkResolver.java#L94-L116 |
elki-project/elki | elki-core/src/main/java/de/lmu/ifi/dbs/elki/result/textwriter/TextWriterStream.java | TextWriterStream.quotePrintln | private void quotePrintln(PrintStream outStream, String data) {
"""
Quoted println. All lines written will be prefixed with {@link #QUOTE}
@param outStream output stream to write to
@param data data to print
"""
String[] lines = data.split("\n");
for(String line : lines) {
if(!line.equals(COM... | java | private void quotePrintln(PrintStream outStream, String data) {
String[] lines = data.split("\n");
for(String line : lines) {
if(!line.equals(COMMENTSEP)) {
outStream.append(QUOTE);
}
outStream.append(line).append(NEWLINE);
}
} | [
"private",
"void",
"quotePrintln",
"(",
"PrintStream",
"outStream",
",",
"String",
"data",
")",
"{",
"String",
"[",
"]",
"lines",
"=",
"data",
".",
"split",
"(",
"\"\\n\"",
")",
";",
"for",
"(",
"String",
"line",
":",
"lines",
")",
"{",
"if",
"(",
"!... | Quoted println. All lines written will be prefixed with {@link #QUOTE}
@param outStream output stream to write to
@param data data to print | [
"Quoted",
"println",
".",
"All",
"lines",
"written",
"will",
"be",
"prefixed",
"with",
"{",
"@link",
"#QUOTE",
"}"
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core/src/main/java/de/lmu/ifi/dbs/elki/result/textwriter/TextWriterStream.java#L213-L221 |
wcm-io/wcm-io-sling | commons/src/main/java/io/wcm/sling/commons/request/RequestParam.java | RequestParam.getEnum | public static <T extends Enum> @Nullable T getEnum(@NotNull ServletRequest request, @NotNull String param, @NotNull Class<T> enumClass) {
"""
Returns a request parameter as enum value.
@param <T> Enum type
@param request Request.
@param param Parameter name.
@param enumClass Enum class
@return Parameter value... | java | public static <T extends Enum> @Nullable T getEnum(@NotNull ServletRequest request, @NotNull String param, @NotNull Class<T> enumClass) {
return getEnum(request, param, enumClass, null);
} | [
"public",
"static",
"<",
"T",
"extends",
"Enum",
">",
"@",
"Nullable",
"T",
"getEnum",
"(",
"@",
"NotNull",
"ServletRequest",
"request",
",",
"@",
"NotNull",
"String",
"param",
",",
"@",
"NotNull",
"Class",
"<",
"T",
">",
"enumClass",
")",
"{",
"return",... | Returns a request parameter as enum value.
@param <T> Enum type
@param request Request.
@param param Parameter name.
@param enumClass Enum class
@return Parameter value or null if it is not set or an invalid enum value. | [
"Returns",
"a",
"request",
"parameter",
"as",
"enum",
"value",
"."
] | train | https://github.com/wcm-io/wcm-io-sling/blob/90adbe432469378794b5695c72e9cdfa2b7d36f1/commons/src/main/java/io/wcm/sling/commons/request/RequestParam.java#L258-L260 |
Tristan971/EasyFXML | easyfxml/src/main/java/moe/tristan/easyfxml/model/exception/ExceptionHandler.java | ExceptionHandler.asPane | public Pane asPane(final String userReadableError) {
"""
Same as {@link #asPane()} but with a custom error label on top of the stack trace.
@param userReadableError The custom error message.
@return The exception in a pane with the custom error message as a label over the stacktrace.
"""
LOG.debu... | java | public Pane asPane(final String userReadableError) {
LOG.debug("Generating node corresponding to ExceptionPane...");
final Label messageLabel = new Label(userReadableError);
final TextArea throwableDataLabel = new TextArea(formatErrorMessage(this.exception));
AnchorPane.setLeftAnchor(me... | [
"public",
"Pane",
"asPane",
"(",
"final",
"String",
"userReadableError",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"Generating node corresponding to ExceptionPane...\"",
")",
";",
"final",
"Label",
"messageLabel",
"=",
"new",
"Label",
"(",
"userReadableError",
")",
";",... | Same as {@link #asPane()} but with a custom error label on top of the stack trace.
@param userReadableError The custom error message.
@return The exception in a pane with the custom error message as a label over the stacktrace. | [
"Same",
"as",
"{",
"@link",
"#asPane",
"()",
"}",
"but",
"with",
"a",
"custom",
"error",
"label",
"on",
"top",
"of",
"the",
"stack",
"trace",
"."
] | train | https://github.com/Tristan971/EasyFXML/blob/f82cad1d54e62903ca5e4a250279ad315b028aef/easyfxml/src/main/java/moe/tristan/easyfxml/model/exception/ExceptionHandler.java#L53-L61 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/search/result/impl/DefaultAsyncSearchQueryResult.java | DefaultAsyncSearchQueryResult.fromHttp412 | @Deprecated
public static AsyncSearchQueryResult fromHttp412() {
"""
A utility method to convert an HTTP 412 response from the search service into a proper
{@link AsyncSearchQueryResult}. HTTP 412 indicates the request couldn't be satisfied with given
consistency before the timeout expired. This is translate... | java | @Deprecated
public static AsyncSearchQueryResult fromHttp412() {
//dummy default values
SearchStatus status = new DefaultSearchStatus(1L, 1L, 0L);
SearchMetrics metrics = new DefaultSearchMetrics(0L, 0L, 0d);
return new DefaultAsyncSearchQueryResult(
status,
... | [
"@",
"Deprecated",
"public",
"static",
"AsyncSearchQueryResult",
"fromHttp412",
"(",
")",
"{",
"//dummy default values",
"SearchStatus",
"status",
"=",
"new",
"DefaultSearchStatus",
"(",
"1L",
",",
"1L",
",",
"0L",
")",
";",
"SearchMetrics",
"metrics",
"=",
"new",... | A utility method to convert an HTTP 412 response from the search service into a proper
{@link AsyncSearchQueryResult}. HTTP 412 indicates the request couldn't be satisfied with given
consistency before the timeout expired. This is translated to a {@link FtsConsistencyTimeoutException}.
@return an {@link AsyncSearchQue... | [
"A",
"utility",
"method",
"to",
"convert",
"an",
"HTTP",
"412",
"response",
"from",
"the",
"search",
"service",
"into",
"a",
"proper",
"{",
"@link",
"AsyncSearchQueryResult",
"}",
".",
"HTTP",
"412",
"indicates",
"the",
"request",
"couldn",
"t",
"be",
"satis... | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/search/result/impl/DefaultAsyncSearchQueryResult.java#L287-L300 |
eclipse/xtext-lib | org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/IntegerExtensions.java | IntegerExtensions.operator_upTo | @Pure
@Inline(value="new $3($1, $2)", imported=IntegerRange.class, statementExpression=false)
public static IntegerRange operator_upTo(final int a, final int b) {
"""
The <code>..</code> operator yields an {@link IntegerRange}.
@param a the start of the range.
@param b the end of the range.
@return an {@lin... | java | @Pure
@Inline(value="new $3($1, $2)", imported=IntegerRange.class, statementExpression=false)
public static IntegerRange operator_upTo(final int a, final int b) {
return new IntegerRange(a, b);
} | [
"@",
"Pure",
"@",
"Inline",
"(",
"value",
"=",
"\"new $3($1, $2)\"",
",",
"imported",
"=",
"IntegerRange",
".",
"class",
",",
"statementExpression",
"=",
"false",
")",
"public",
"static",
"IntegerRange",
"operator_upTo",
"(",
"final",
"int",
"a",
",",
"final",... | The <code>..</code> operator yields an {@link IntegerRange}.
@param a the start of the range.
@param b the end of the range.
@return an {@link IntegerRange}. Never <code>null</code>.
@since 2.3 | [
"The",
"<code",
">",
"..",
"<",
"/",
"code",
">",
"operator",
"yields",
"an",
"{",
"@link",
"IntegerRange",
"}",
"."
] | train | https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/IntegerExtensions.java#L31-L35 |
marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java | MarkLogicRepositoryConnection.configureWriteCache | @Override
public void configureWriteCache(long initDelay, long delayCache, long cacheSize) {
"""
customise write cache interval and cache size.
@param initDelay - initial interval before write cache is checked
@param delayCache - interval (ms) to check write cache
@param cacheSize - size (# triples) of wr... | java | @Override
public void configureWriteCache(long initDelay, long delayCache, long cacheSize){
client.initTimer(initDelay, delayCache,cacheSize);
} | [
"@",
"Override",
"public",
"void",
"configureWriteCache",
"(",
"long",
"initDelay",
",",
"long",
"delayCache",
",",
"long",
"cacheSize",
")",
"{",
"client",
".",
"initTimer",
"(",
"initDelay",
",",
"delayCache",
",",
"cacheSize",
")",
";",
"}"
] | customise write cache interval and cache size.
@param initDelay - initial interval before write cache is checked
@param delayCache - interval (ms) to check write cache
@param cacheSize - size (# triples) of write cache | [
"customise",
"write",
"cache",
"interval",
"and",
"cache",
"size",
"."
] | train | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java#L1374-L1377 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/internal/cluster/impl/ClusterHeartbeatManager.java | ClusterHeartbeatManager.logIfConnectionToEndpointIsMissing | private void logIfConnectionToEndpointIsMissing(long now, Member member) {
"""
Logs a warning if the {@code member} hasn't sent a heartbeat in {@link #HEART_BEAT_INTERVAL_FACTOR} heartbeat
intervals and there is no live connection to the member
"""
long heartbeatTime = heartbeatFailureDetector.lastHea... | java | private void logIfConnectionToEndpointIsMissing(long now, Member member) {
long heartbeatTime = heartbeatFailureDetector.lastHeartbeat(member);
if ((now - heartbeatTime) >= heartbeatIntervalMillis * HEART_BEAT_INTERVAL_FACTOR) {
Connection conn = node.getEndpointManager(MEMBER).getOrConnect(... | [
"private",
"void",
"logIfConnectionToEndpointIsMissing",
"(",
"long",
"now",
",",
"Member",
"member",
")",
"{",
"long",
"heartbeatTime",
"=",
"heartbeatFailureDetector",
".",
"lastHeartbeat",
"(",
"member",
")",
";",
"if",
"(",
"(",
"now",
"-",
"heartbeatTime",
... | Logs a warning if the {@code member} hasn't sent a heartbeat in {@link #HEART_BEAT_INTERVAL_FACTOR} heartbeat
intervals and there is no live connection to the member | [
"Logs",
"a",
"warning",
"if",
"the",
"{"
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/cluster/impl/ClusterHeartbeatManager.java#L634-L642 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfDocument.java | PdfDocument.localGoto | void localGoto(String name, float llx, float lly, float urx, float ury) {
"""
Implements a link to other part of the document. The jump will
be made to a local destination with the same name, that must exist.
@param name the name for this link
@param llx the lower left x corner of the activation area
@param ll... | java | void localGoto(String name, float llx, float lly, float urx, float ury) {
PdfAction action = getLocalGotoAction(name);
annotationsImp.addPlainAnnotation(new PdfAnnotation(writer, llx, lly, urx, ury, action));
} | [
"void",
"localGoto",
"(",
"String",
"name",
",",
"float",
"llx",
",",
"float",
"lly",
",",
"float",
"urx",
",",
"float",
"ury",
")",
"{",
"PdfAction",
"action",
"=",
"getLocalGotoAction",
"(",
"name",
")",
";",
"annotationsImp",
".",
"addPlainAnnotation",
... | Implements a link to other part of the document. The jump will
be made to a local destination with the same name, that must exist.
@param name the name for this link
@param llx the lower left x corner of the activation area
@param lly the lower left y corner of the activation area
@param urx the upper right x corner of... | [
"Implements",
"a",
"link",
"to",
"other",
"part",
"of",
"the",
"document",
".",
"The",
"jump",
"will",
"be",
"made",
"to",
"a",
"local",
"destination",
"with",
"the",
"same",
"name",
"that",
"must",
"exist",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfDocument.java#L2013-L2016 |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/constraints/CollectionDescriptorConstraints.java | CollectionDescriptorConstraints.checkInheritedForeignkey | private void checkInheritedForeignkey(CollectionDescriptorDef collDef, String checkLevel) throws ConstraintException {
"""
Checks that the foreignkey is not modified in an inherited/nested m:n collection descriptor.
@param collDef The collection descriptor
@param checkLevel The current check level (this con... | java | private void checkInheritedForeignkey(CollectionDescriptorDef collDef, String checkLevel) throws ConstraintException
{
if (CHECKLEVEL_NONE.equals(checkLevel))
{
return;
}
if (!collDef.isInherited() && !collDef.isNested())
{
return;
}
... | [
"private",
"void",
"checkInheritedForeignkey",
"(",
"CollectionDescriptorDef",
"collDef",
",",
"String",
"checkLevel",
")",
"throws",
"ConstraintException",
"{",
"if",
"(",
"CHECKLEVEL_NONE",
".",
"equals",
"(",
"checkLevel",
")",
")",
"{",
"return",
";",
"}",
"if... | Checks that the foreignkey is not modified in an inherited/nested m:n collection descriptor.
@param collDef The collection descriptor
@param checkLevel The current check level (this constraint is checked in basic and strict) | [
"Checks",
"that",
"the",
"foreignkey",
"is",
"not",
"modified",
"in",
"an",
"inherited",
"/",
"nested",
"m",
":",
"n",
"collection",
"descriptor",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/CollectionDescriptorConstraints.java#L126-L148 |
exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/artifact/ArtifactManagingServiceImpl.java | ArtifactManagingServiceImpl.importResource | private void importResource(Node parentNode, InputStream file_in, String resourceType, ArtifactDescriptor artifact)
throws RepositoryException {
"""
this method used for writing to repo jars, poms and their checksums
"""
// Note that artifactBean been initialized within constructor
// r... | java | private void importResource(Node parentNode, InputStream file_in, String resourceType, ArtifactDescriptor artifact)
throws RepositoryException
{
// Note that artifactBean been initialized within constructor
// resourceType can be jar, pom, metadata
String filename;
if (resourceTy... | [
"private",
"void",
"importResource",
"(",
"Node",
"parentNode",
",",
"InputStream",
"file_in",
",",
"String",
"resourceType",
",",
"ArtifactDescriptor",
"artifact",
")",
"throws",
"RepositoryException",
"{",
"// Note that artifactBean been initialized within constructor",
"//... | this method used for writing to repo jars, poms and their checksums | [
"this",
"method",
"used",
"for",
"writing",
"to",
"repo",
"jars",
"poms",
"and",
"their",
"checksums"
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/artifact/ArtifactManagingServiceImpl.java#L858-L911 |
ZenHarbinger/l2fprod-properties-editor | src/main/java/com/l2fprod/common/propertysheet/PropertySheetTableModel.java | PropertySheetTableModel.getValueAt | @Override
public Object getValueAt(int rowIndex, int columnIndex) {
"""
Retrieve the value at the specified row and column location. When the row
contains a category or the column is {@link #NAME_COLUMN}, an
{@link Item} object will be returned. If the row is a property and the
column is {@link #VALUE_COLUM... | java | @Override
public Object getValueAt(int rowIndex, int columnIndex) {
Object result = null;
Item item = getPropertySheetElement(rowIndex);
if (item.isProperty()) {
switch (columnIndex) {
case NAME_COLUMN:
result = item;
break... | [
"@",
"Override",
"public",
"Object",
"getValueAt",
"(",
"int",
"rowIndex",
",",
"int",
"columnIndex",
")",
"{",
"Object",
"result",
"=",
"null",
";",
"Item",
"item",
"=",
"getPropertySheetElement",
"(",
"rowIndex",
")",
";",
"if",
"(",
"item",
".",
"isProp... | Retrieve the value at the specified row and column location. When the row
contains a category or the column is {@link #NAME_COLUMN}, an
{@link Item} object will be returned. If the row is a property and the
column is {@link #VALUE_COLUMN}, the value of the property will be
returned.
@param rowIndex
@param columnIndex
... | [
"Retrieve",
"the",
"value",
"at",
"the",
"specified",
"row",
"and",
"column",
"location",
".",
"When",
"the",
"row",
"contains",
"a",
"category",
"or",
"the",
"column",
"is",
"{",
"@link",
"#NAME_COLUMN",
"}",
"an",
"{",
"@link",
"Item",
"}",
"object",
"... | train | https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/propertysheet/PropertySheetTableModel.java#L345-L371 |
google/closure-compiler | src/com/google/javascript/jscomp/NodeUtil.java | NodeUtil.deleteChildren | public static void deleteChildren(Node n, AbstractCompiler compiler) {
"""
Permanently delete all the children of the given node, including reporting changes.
"""
while (n.hasChildren()) {
deleteNode(n.getFirstChild(), compiler);
}
} | java | public static void deleteChildren(Node n, AbstractCompiler compiler) {
while (n.hasChildren()) {
deleteNode(n.getFirstChild(), compiler);
}
} | [
"public",
"static",
"void",
"deleteChildren",
"(",
"Node",
"n",
",",
"AbstractCompiler",
"compiler",
")",
"{",
"while",
"(",
"n",
".",
"hasChildren",
"(",
")",
")",
"{",
"deleteNode",
"(",
"n",
".",
"getFirstChild",
"(",
")",
",",
"compiler",
")",
";",
... | Permanently delete all the children of the given node, including reporting changes. | [
"Permanently",
"delete",
"all",
"the",
"children",
"of",
"the",
"given",
"node",
"including",
"reporting",
"changes",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeUtil.java#L2779-L2783 |
elki-project/elki | elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/ids/DBIDUtil.java | DBIDUtil.randomSplit | public static ArrayDBIDs[] randomSplit(DBIDs ids, int p, RandomFactory rnd) {
"""
Randomly split IDs into {@code p} partitions of almost-equal size.
@param ids Original DBIDs
@param p Desired number of partitions.
@param rnd Random generator
"""
return randomSplit(ids, p, rnd.getSingleThreadedRandom()... | java | public static ArrayDBIDs[] randomSplit(DBIDs ids, int p, RandomFactory rnd) {
return randomSplit(ids, p, rnd.getSingleThreadedRandom());
} | [
"public",
"static",
"ArrayDBIDs",
"[",
"]",
"randomSplit",
"(",
"DBIDs",
"ids",
",",
"int",
"p",
",",
"RandomFactory",
"rnd",
")",
"{",
"return",
"randomSplit",
"(",
"ids",
",",
"p",
",",
"rnd",
".",
"getSingleThreadedRandom",
"(",
")",
")",
";",
"}"
] | Randomly split IDs into {@code p} partitions of almost-equal size.
@param ids Original DBIDs
@param p Desired number of partitions.
@param rnd Random generator | [
"Randomly",
"split",
"IDs",
"into",
"{",
"@code",
"p",
"}",
"partitions",
"of",
"almost",
"-",
"equal",
"size",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/ids/DBIDUtil.java#L736-L738 |
krummas/DrizzleJDBC | src/main/java/org/drizzle/jdbc/DrizzlePreparedStatement.java | DrizzlePreparedStatement.setBlob | public void setBlob(final int parameterIndex, final InputStream inputStream) throws SQLException {
"""
Sets the designated parameter to a <code>InputStream</code> object. This method differs from the
<code>setBinaryStream (int, InputStream)</code> method because it informs the driver that the parameter value
sho... | java | public void setBlob(final int parameterIndex, final InputStream inputStream) throws SQLException {
if(inputStream == null) {
setNull(parameterIndex, Types.BLOB);
return;
}
try {
if(getProtocol().supportsPBMS()) {
setParameter(parameterIndex,
... | [
"public",
"void",
"setBlob",
"(",
"final",
"int",
"parameterIndex",
",",
"final",
"InputStream",
"inputStream",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"inputStream",
"==",
"null",
")",
"{",
"setNull",
"(",
"parameterIndex",
",",
"Types",
".",
"BLOB",
... | Sets the designated parameter to a <code>InputStream</code> object. This method differs from the
<code>setBinaryStream (int, InputStream)</code> method because it informs the driver that the parameter value
should be sent to the server as a <code>BLOB</code>. When the <code>setBinaryStream</code> method is used, the
d... | [
"Sets",
"the",
"designated",
"parameter",
"to",
"a",
"<code",
">",
"InputStream<",
"/",
"code",
">",
"object",
".",
"This",
"method",
"differs",
"from",
"the",
"<code",
">",
"setBinaryStream",
"(",
"int",
"InputStream",
")",
"<",
"/",
"code",
">",
"method"... | train | https://github.com/krummas/DrizzleJDBC/blob/716f31fd71f3cc289edf69844d8117deb86d98d6/src/main/java/org/drizzle/jdbc/DrizzlePreparedStatement.java#L1007-L1026 |
h2oai/h2o-3 | h2o-core/src/main/java/water/util/VecUtils.java | VecUtils.stringToNumeric | public static Vec stringToNumeric(Vec src) {
"""
Create a new {@link Vec} of numeric values from a string {@link Vec}. Any rows that cannot be
converted to a number are set to NA.
Currently only does basic numeric formats. No exponents, or hex values. Doesn't
even like commas or spaces. :( Needs love. Handli... | java | public static Vec stringToNumeric(Vec src) {
if(!src.isString()) throw new H2OIllegalArgumentException("stringToNumeric conversion only works on string columns");
Vec res = new MRTask() {
@Override public void map(Chunk chk, NewChunk newChk){
if (chk instanceof C0DChunk) { // all NAs
for... | [
"public",
"static",
"Vec",
"stringToNumeric",
"(",
"Vec",
"src",
")",
"{",
"if",
"(",
"!",
"src",
".",
"isString",
"(",
")",
")",
"throw",
"new",
"H2OIllegalArgumentException",
"(",
"\"stringToNumeric conversion only works on string columns\"",
")",
";",
"Vec",
"r... | Create a new {@link Vec} of numeric values from a string {@link Vec}. Any rows that cannot be
converted to a number are set to NA.
Currently only does basic numeric formats. No exponents, or hex values. Doesn't
even like commas or spaces. :( Needs love. Handling more numeric
representations is PUBDEV-2209
@param src... | [
"Create",
"a",
"new",
"{",
"@link",
"Vec",
"}",
"of",
"numeric",
"values",
"from",
"a",
"string",
"{",
"@link",
"Vec",
"}",
".",
"Any",
"rows",
"that",
"cannot",
"be",
"converted",
"to",
"a",
"number",
"are",
"set",
"to",
"NA",
"."
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/util/VecUtils.java#L193-L222 |
opendatatrentino/s-match | src/main/java/it/unitn/disi/smatch/oracles/wordnet/WordNet.java | WordNet.traverseTree | private static boolean traverseTree(PointerTargetTree syn, PointerTargetNodeList ptnl, Synset source) {
"""
traverses PointerTargetTree.
@param syn synonyms
@param ptnl target node list
@param source source synset
@return if source was found
"""
java.util.List MGListsList = syn.toList();
... | java | private static boolean traverseTree(PointerTargetTree syn, PointerTargetNodeList ptnl, Synset source) {
java.util.List MGListsList = syn.toList();
for (Object aMGListsList : MGListsList) {
PointerTargetNodeList MGList = (PointerTargetNodeList) aMGListsList;
for (Object aMGLis... | [
"private",
"static",
"boolean",
"traverseTree",
"(",
"PointerTargetTree",
"syn",
",",
"PointerTargetNodeList",
"ptnl",
",",
"Synset",
"source",
")",
"{",
"java",
".",
"util",
".",
"List",
"MGListsList",
"=",
"syn",
".",
"toList",
"(",
")",
";",
"for",
"(",
... | traverses PointerTargetTree.
@param syn synonyms
@param ptnl target node list
@param source source synset
@return if source was found | [
"traverses",
"PointerTargetTree",
"."
] | train | https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/oracles/wordnet/WordNet.java#L436-L454 |
opsmatters/opsmatters-core | src/main/java/com/opsmatters/core/util/StringUtilities.java | StringUtilities.getWildcardMatcher | public static Matcher getWildcardMatcher(String str, String expr, boolean whole) {
"""
Returns <CODE>true</CODE> if the given string matches the given regular expression.
@param str The string against which the expression is to be matched
@param expr The regular expression to match with the input string
@param ... | java | public static Matcher getWildcardMatcher(String str, String expr, boolean whole)
{
expr = expr.replaceAll("\\?",".?");
expr = expr.replaceAll("\\*",".*?");
if(whole)
expr = "^"+expr+"$";
Pattern pattern = Pattern.compile(expr/*, Pattern.DOTALL*/);
return pattern.m... | [
"public",
"static",
"Matcher",
"getWildcardMatcher",
"(",
"String",
"str",
",",
"String",
"expr",
",",
"boolean",
"whole",
")",
"{",
"expr",
"=",
"expr",
".",
"replaceAll",
"(",
"\"\\\\?\"",
",",
"\".?\"",
")",
";",
"expr",
"=",
"expr",
".",
"replaceAll",
... | Returns <CODE>true</CODE> if the given string matches the given regular expression.
@param str The string against which the expression is to be matched
@param expr The regular expression to match with the input string
@param whole Indicates that a whole word match is required
@return An object giving the results of the... | [
"Returns",
"<CODE",
">",
"true<",
"/",
"CODE",
">",
"if",
"the",
"given",
"string",
"matches",
"the",
"given",
"regular",
"expression",
"."
] | train | https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/util/StringUtilities.java#L318-L326 |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/custom/ControlBar.java | ControlBar.addControlListener | public boolean addControlListener(String name, Widget.OnTouchListener listener) {
"""
Add a touch listener for the button specified by {@code name}. The listener is only
registered if the button is actually present.
@param name The {@linkplain Widget#getName() name} of the button to listen to
@param listener... | java | public boolean addControlListener(String name, Widget.OnTouchListener listener) {
Widget control = findChildByName(name);
if (control != null) {
return control.addTouchListener(listener);
}
return false;
} | [
"public",
"boolean",
"addControlListener",
"(",
"String",
"name",
",",
"Widget",
".",
"OnTouchListener",
"listener",
")",
"{",
"Widget",
"control",
"=",
"findChildByName",
"(",
"name",
")",
";",
"if",
"(",
"control",
"!=",
"null",
")",
"{",
"return",
"contro... | Add a touch listener for the button specified by {@code name}. The listener is only
registered if the button is actually present.
@param name The {@linkplain Widget#getName() name} of the button to listen to
@param listener A valid listener or null to clear
@return {@code True} if a valid listener was passed and the ... | [
"Add",
"a",
"touch",
"listener",
"for",
"the",
"button",
"specified",
"by",
"{",
"@code",
"name",
"}",
".",
"The",
"listener",
"is",
"only",
"registered",
"if",
"the",
"button",
"is",
"actually",
"present",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/custom/ControlBar.java#L231-L238 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/util/SparkUtils.java | SparkUtils.listPaths | public static JavaRDD<String> listPaths(JavaSparkContext sc, String path, boolean recursive, String[] allowedExtensions) throws IOException {
"""
List of the files in the given directory (path), as a {@code JavaRDD<String>}
@param sc Spark context
@param path Path to list files in
... | java | public static JavaRDD<String> listPaths(JavaSparkContext sc, String path, boolean recursive, String[] allowedExtensions) throws IOException {
return listPaths(sc, path, recursive, (allowedExtensions == null ? null : new HashSet<>(Arrays.asList(allowedExtensions))));
} | [
"public",
"static",
"JavaRDD",
"<",
"String",
">",
"listPaths",
"(",
"JavaSparkContext",
"sc",
",",
"String",
"path",
",",
"boolean",
"recursive",
",",
"String",
"[",
"]",
"allowedExtensions",
")",
"throws",
"IOException",
"{",
"return",
"listPaths",
"(",
"sc"... | List of the files in the given directory (path), as a {@code JavaRDD<String>}
@param sc Spark context
@param path Path to list files in
@param recursive Whether to walk the directory tree recursively (i.e., include subdirectories)
@param allowedExtensions If null: all files will be ... | [
"List",
"of",
"the",
"files",
"in",
"the",
"given",
"directory",
"(",
"path",
")",
"as",
"a",
"{",
"@code",
"JavaRDD<String",
">",
"}"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/util/SparkUtils.java#L556-L558 |
google/error-prone-javac | src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor6.java | ElementKindVisitor6.visitPackage | @Override
public R visitPackage(PackageElement e, P p) {
"""
{@inheritDoc}
The element argument has kind {@code PACKAGE}.
@param e {@inheritDoc}
@param p {@inheritDoc}
@return {@inheritDoc}
"""
assert e.getKind() == PACKAGE: "Bad kind on PackageElement";
return defaultAction(e, p);... | java | @Override
public R visitPackage(PackageElement e, P p) {
assert e.getKind() == PACKAGE: "Bad kind on PackageElement";
return defaultAction(e, p);
} | [
"@",
"Override",
"public",
"R",
"visitPackage",
"(",
"PackageElement",
"e",
",",
"P",
"p",
")",
"{",
"assert",
"e",
".",
"getKind",
"(",
")",
"==",
"PACKAGE",
":",
"\"Bad kind on PackageElement\"",
";",
"return",
"defaultAction",
"(",
"e",
",",
"p",
")",
... | {@inheritDoc}
The element argument has kind {@code PACKAGE}.
@param e {@inheritDoc}
@param p {@inheritDoc}
@return {@inheritDoc} | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor6.java#L121-L125 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/gen/CodeBuilderUtil.java | CodeBuilderUtil.assertParameterNotNull | public static void assertParameterNotNull(CodeBuilder b, int paramIndex) {
"""
Generate code to throw an exception if a parameter is null
@param b CodeBuilder into which to append the code
@param paramIndex index of the parameter to check
"""
b.loadLocal(b.getParameter(paramIndex));
Label n... | java | public static void assertParameterNotNull(CodeBuilder b, int paramIndex) {
b.loadLocal(b.getParameter(paramIndex));
Label notNull = b.createLabel();
b.ifNullBranch(notNull, false);
throwException(b, IllegalArgumentException.class, null);
notNull.setLocation();
} | [
"public",
"static",
"void",
"assertParameterNotNull",
"(",
"CodeBuilder",
"b",
",",
"int",
"paramIndex",
")",
"{",
"b",
".",
"loadLocal",
"(",
"b",
".",
"getParameter",
"(",
"paramIndex",
")",
")",
";",
"Label",
"notNull",
"=",
"b",
".",
"createLabel",
"("... | Generate code to throw an exception if a parameter is null
@param b CodeBuilder into which to append the code
@param paramIndex index of the parameter to check | [
"Generate",
"code",
"to",
"throw",
"an",
"exception",
"if",
"a",
"parameter",
"is",
"null"
] | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/gen/CodeBuilderUtil.java#L55-L61 |
UrielCh/ovh-java-sdk | ovh-java-sdk-vrack/src/main/java/net/minidev/ovh/api/ApiOvhVrack.java | ApiOvhVrack.serviceName_legacyVrack_legacyVrack_GET | public OvhLegacyVrack serviceName_legacyVrack_legacyVrack_GET(String serviceName, String legacyVrack) throws IOException {
"""
Get this object properties
REST: GET /vrack/{serviceName}/legacyVrack/{legacyVrack}
@param serviceName [required] The internal name of your vrack
@param legacyVrack [required] your le... | java | public OvhLegacyVrack serviceName_legacyVrack_legacyVrack_GET(String serviceName, String legacyVrack) throws IOException {
String qPath = "/vrack/{serviceName}/legacyVrack/{legacyVrack}";
StringBuilder sb = path(qPath, serviceName, legacyVrack);
String resp = exec(qPath, "GET", sb.toString(), null);
return conv... | [
"public",
"OvhLegacyVrack",
"serviceName_legacyVrack_legacyVrack_GET",
"(",
"String",
"serviceName",
",",
"String",
"legacyVrack",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/vrack/{serviceName}/legacyVrack/{legacyVrack}\"",
";",
"StringBuilder",
"sb",
"=",... | Get this object properties
REST: GET /vrack/{serviceName}/legacyVrack/{legacyVrack}
@param serviceName [required] The internal name of your vrack
@param legacyVrack [required] your legacy vrack service | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-vrack/src/main/java/net/minidev/ovh/api/ApiOvhVrack.java#L264-L269 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.