repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
192
func_name
stringlengths
5
108
whole_func_string
stringlengths
75
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.91k
func_code_tokens
listlengths
21
629
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
111
306
tobykurien/Xtendroid
Xtendroid/src/asia/sonix/android/orm/AbatisService.java
AbatisService.getInstance
protected static AbatisService getInstance(Context context, int version) { if (instance == null) { instance = new AbatisService(context, version); } return instance; }
java
protected static AbatisService getInstance(Context context, int version) { if (instance == null) { instance = new AbatisService(context, version); } return instance; }
[ "protected", "static", "AbatisService", "getInstance", "(", "Context", "context", ",", "int", "version", ")", "{", "if", "(", "instance", "==", "null", ")", "{", "instance", "=", "new", "AbatisService", "(", "context", ",", "version", ")", ";", "}", "retur...
Default DB file nameを利用する外部Constructor @param context 呼び出し元Contextオブジェクト @param dbName 生成するDB file name
[ "Default", "DB", "file", "nameを利用する外部Constructor" ]
train
https://github.com/tobykurien/Xtendroid/blob/758bf1d06f4cf3b64f9c10632fe9c6fb30bcebd4/Xtendroid/src/asia/sonix/android/orm/AbatisService.java#L121-L126
VoltDB/voltdb
src/frontend/org/voltdb/PostgreSQLBackend.java
PostgreSQLBackend.indexOfNthOccurrenceOfCharIn
static private int indexOfNthOccurrenceOfCharIn(String str, char ch, int n) { boolean inMiddleOfQuote = false; int index = -1, previousIndex = 0; for (int i=0; i < n; i++) { do { index = str.indexOf(ch, index+1); if (index < 0) { return -1; } if (hasOddNumberOfSingleQuotes(str.substring(previousIndex, index))) { inMiddleOfQuote = !inMiddleOfQuote; } previousIndex = index; } while (inMiddleOfQuote); } return index; }
java
static private int indexOfNthOccurrenceOfCharIn(String str, char ch, int n) { boolean inMiddleOfQuote = false; int index = -1, previousIndex = 0; for (int i=0; i < n; i++) { do { index = str.indexOf(ch, index+1); if (index < 0) { return -1; } if (hasOddNumberOfSingleQuotes(str.substring(previousIndex, index))) { inMiddleOfQuote = !inMiddleOfQuote; } previousIndex = index; } while (inMiddleOfQuote); } return index; }
[ "static", "private", "int", "indexOfNthOccurrenceOfCharIn", "(", "String", "str", ",", "char", "ch", ",", "int", "n", ")", "{", "boolean", "inMiddleOfQuote", "=", "false", ";", "int", "index", "=", "-", "1", ",", "previousIndex", "=", "0", ";", "for", "(...
Returns the Nth occurrence of the specified character in the specified String, but ignoring those contained in single quotes.
[ "Returns", "the", "Nth", "occurrence", "of", "the", "specified", "character", "in", "the", "specified", "String", "but", "ignoring", "those", "contained", "in", "single", "quotes", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/PostgreSQLBackend.java#L666-L682
elki-project/elki
elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/datastore/DataStoreUtil.java
DataStoreUtil.makeIntegerStorage
public static WritableIntegerDataStore makeIntegerStorage(DBIDs ids, int hints) { return DataStoreFactory.FACTORY.makeIntegerStorage(ids, hints); }
java
public static WritableIntegerDataStore makeIntegerStorage(DBIDs ids, int hints) { return DataStoreFactory.FACTORY.makeIntegerStorage(ids, hints); }
[ "public", "static", "WritableIntegerDataStore", "makeIntegerStorage", "(", "DBIDs", "ids", ",", "int", "hints", ")", "{", "return", "DataStoreFactory", ".", "FACTORY", ".", "makeIntegerStorage", "(", "ids", ",", "hints", ")", ";", "}" ]
Make a new storage, to associate the given ids with an object of class dataclass. @param ids DBIDs to store data for @param hints Hints for the storage manager @return new data store
[ "Make", "a", "new", "storage", "to", "associate", "the", "given", "ids", "with", "an", "object", "of", "class", "dataclass", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/datastore/DataStoreUtil.java#L112-L114
UrielCh/ovh-java-sdk
ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java
ApiOvhXdsl.serviceName_lines_number_diagnostic_cancel_POST
public void serviceName_lines_number_diagnostic_cancel_POST(String serviceName, String number) throws IOException { String qPath = "/xdsl/{serviceName}/lines/{number}/diagnostic/cancel"; StringBuilder sb = path(qPath, serviceName, number); exec(qPath, "POST", sb.toString(), null); }
java
public void serviceName_lines_number_diagnostic_cancel_POST(String serviceName, String number) throws IOException { String qPath = "/xdsl/{serviceName}/lines/{number}/diagnostic/cancel"; StringBuilder sb = path(qPath, serviceName, number); exec(qPath, "POST", sb.toString(), null); }
[ "public", "void", "serviceName_lines_number_diagnostic_cancel_POST", "(", "String", "serviceName", ",", "String", "number", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/xdsl/{serviceName}/lines/{number}/diagnostic/cancel\"", ";", "StringBuilder", "sb", "=", ...
Cancel line diagnostic if possible REST: POST /xdsl/{serviceName}/lines/{number}/diagnostic/cancel @param serviceName [required] The internal name of your XDSL offer @param number [required] The number of the line
[ "Cancel", "line", "diagnostic", "if", "possible" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java#L430-L434
apache/incubator-gobblin
gobblin-compaction/src/main/java/org/apache/gobblin/compaction/mapreduce/avro/MRCompactorAvroKeyDedupJobRunner.java
MRCompactorAvroKeyDedupJobRunner.isKeySchemaValid
public static boolean isKeySchemaValid(Schema keySchema, Schema topicSchema) { return SchemaCompatibility.checkReaderWriterCompatibility(keySchema, topicSchema).getType() .equals(SchemaCompatibilityType.COMPATIBLE); }
java
public static boolean isKeySchemaValid(Schema keySchema, Schema topicSchema) { return SchemaCompatibility.checkReaderWriterCompatibility(keySchema, topicSchema).getType() .equals(SchemaCompatibilityType.COMPATIBLE); }
[ "public", "static", "boolean", "isKeySchemaValid", "(", "Schema", "keySchema", ",", "Schema", "topicSchema", ")", "{", "return", "SchemaCompatibility", ".", "checkReaderWriterCompatibility", "(", "keySchema", ",", "topicSchema", ")", ".", "getType", "(", ")", ".", ...
keySchema is valid if a record with newestSchema can be converted to a record with keySchema.
[ "keySchema", "is", "valid", "if", "a", "record", "with", "newestSchema", "can", "be", "converted", "to", "a", "record", "with", "keySchema", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-compaction/src/main/java/org/apache/gobblin/compaction/mapreduce/avro/MRCompactorAvroKeyDedupJobRunner.java#L215-L218
jcuda/jcusparse
JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java
JCusparse.cusparseSbsrmm
public static int cusparseSbsrmm( cusparseHandle handle, int dirA, int transA, int transB, int mb, int n, int kb, int nnzb, Pointer alpha, cusparseMatDescr descrA, Pointer bsrSortedValA, Pointer bsrSortedRowPtrA, Pointer bsrSortedColIndA, int blockSize, Pointer B, int ldb, Pointer beta, Pointer C, int ldc) { return checkResult(cusparseSbsrmmNative(handle, dirA, transA, transB, mb, n, kb, nnzb, alpha, descrA, bsrSortedValA, bsrSortedRowPtrA, bsrSortedColIndA, blockSize, B, ldb, beta, C, ldc)); }
java
public static int cusparseSbsrmm( cusparseHandle handle, int dirA, int transA, int transB, int mb, int n, int kb, int nnzb, Pointer alpha, cusparseMatDescr descrA, Pointer bsrSortedValA, Pointer bsrSortedRowPtrA, Pointer bsrSortedColIndA, int blockSize, Pointer B, int ldb, Pointer beta, Pointer C, int ldc) { return checkResult(cusparseSbsrmmNative(handle, dirA, transA, transB, mb, n, kb, nnzb, alpha, descrA, bsrSortedValA, bsrSortedRowPtrA, bsrSortedColIndA, blockSize, B, ldb, beta, C, ldc)); }
[ "public", "static", "int", "cusparseSbsrmm", "(", "cusparseHandle", "handle", ",", "int", "dirA", ",", "int", "transA", ",", "int", "transB", ",", "int", "mb", ",", "int", "n", ",", "int", "kb", ",", "int", "nnzb", ",", "Pointer", "alpha", ",", "cuspar...
Description: sparse - dense matrix multiplication C = alpha * op(A) * B + beta * C, where A is a sparse matrix in block-CSR format, B and C are dense tall matrices. This routine allows transposition of matrix B, which may improve performance.
[ "Description", ":", "sparse", "-", "dense", "matrix", "multiplication", "C", "=", "alpha", "*", "op", "(", "A", ")", "*", "B", "+", "beta", "*", "C", "where", "A", "is", "a", "sparse", "matrix", "in", "block", "-", "CSR", "format", "B", "and", "C",...
train
https://github.com/jcuda/jcusparse/blob/7687a62a4ef6b76cb91cf7da93d4cf5ade96a791/JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java#L3969-L3991
jcuda/jcufft
JCufftJava/src/main/java/jcuda/jcufft/JCufft.java
JCufft.cufftExecZ2Z
public static int cufftExecZ2Z(cufftHandle plan, Pointer cIdata, Pointer cOdata, int direction) { return checkResult(cufftExecZ2ZNative(plan, cIdata, cOdata, direction)); }
java
public static int cufftExecZ2Z(cufftHandle plan, Pointer cIdata, Pointer cOdata, int direction) { return checkResult(cufftExecZ2ZNative(plan, cIdata, cOdata, direction)); }
[ "public", "static", "int", "cufftExecZ2Z", "(", "cufftHandle", "plan", ",", "Pointer", "cIdata", ",", "Pointer", "cOdata", ",", "int", "direction", ")", "{", "return", "checkResult", "(", "cufftExecZ2ZNative", "(", "plan", ",", "cIdata", ",", "cOdata", ",", ...
<pre> Executes a CUFFT complex-to-complex transform plan for double precision values. cufftResult cufftExecZ2Z( cufftHandle plan, cufftDoubleComplex *idata, cufftDoubleComplex *odata, int direction ); CUFFT uses as input data the GPU memory pointed to by the idata parameter. This function stores the Fourier coefficients in the odata array. If idata and odata are the same, this method does an in-place transform. Input ---- plan The cufftHandle object for the plan to update idata Pointer to the input data (in GPU memory) to transform odata Pointer to the output data (in GPU memory) direction The transform direction: CUFFT_FORWARD or CUFFT_INVERSE Output ---- odata Contains the complex Fourier coefficients Return Values ---- CUFFT_SETUP_FAILED CUFFT library failed to initialize. CUFFT_INVALID_PLAN The plan parameter is not a valid handle. CUFFT_INVALID_VALUE The idata, odata, and/or direction parameter is not valid. CUFFT_EXEC_FAILED CUFFT failed to execute the transform on GPU. CUFFT_SUCCESS CUFFT successfully executed the FFT plan JCUFFT_INTERNAL_ERROR If an internal JCufft error occurred <pre>
[ "<pre", ">", "Executes", "a", "CUFFT", "complex", "-", "to", "-", "complex", "transform", "plan", "for", "double", "precision", "values", "." ]
train
https://github.com/jcuda/jcufft/blob/833c87ffb0864f7ee7270fddef8af57f48939b3a/JCufftJava/src/main/java/jcuda/jcufft/JCufft.java#L1309-L1312
Azure/azure-sdk-for-java
appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DomainsInner.java
DomainsInner.deleteOwnershipIdentifier
public void deleteOwnershipIdentifier(String resourceGroupName, String domainName, String name) { deleteOwnershipIdentifierWithServiceResponseAsync(resourceGroupName, domainName, name).toBlocking().single().body(); }
java
public void deleteOwnershipIdentifier(String resourceGroupName, String domainName, String name) { deleteOwnershipIdentifierWithServiceResponseAsync(resourceGroupName, domainName, name).toBlocking().single().body(); }
[ "public", "void", "deleteOwnershipIdentifier", "(", "String", "resourceGroupName", ",", "String", "domainName", ",", "String", "name", ")", "{", "deleteOwnershipIdentifierWithServiceResponseAsync", "(", "resourceGroupName", ",", "domainName", ",", "name", ")", ".", "toB...
Delete ownership identifier for domain. Delete ownership identifier for domain. @param resourceGroupName Name of the resource group to which the resource belongs. @param domainName Name of domain. @param name Name of identifier. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Delete", "ownership", "identifier", "for", "domain", ".", "Delete", "ownership", "identifier", "for", "domain", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DomainsInner.java#L1624-L1626
vdmeer/asciitable
src/main/java/de/vandermeer/asciitable/AT_CellContext.java
AT_CellContext.setPaddingTopBottom
public AT_CellContext setPaddingTopBottom(int paddingTop, int paddingBottom){ if(paddingTop>-1 && paddingBottom>-1){ this.paddingTop = paddingTop; this.paddingBottom = paddingBottom; } return this; }
java
public AT_CellContext setPaddingTopBottom(int paddingTop, int paddingBottom){ if(paddingTop>-1 && paddingBottom>-1){ this.paddingTop = paddingTop; this.paddingBottom = paddingBottom; } return this; }
[ "public", "AT_CellContext", "setPaddingTopBottom", "(", "int", "paddingTop", ",", "int", "paddingBottom", ")", "{", "if", "(", "paddingTop", ">", "-", "1", "&&", "paddingBottom", ">", "-", "1", ")", "{", "this", ".", "paddingTop", "=", "paddingTop", ";", "...
Sets top and bottom padding (only if both values are not smaller than 0). @param paddingTop new top padding, ignored if smaller than 0 @param paddingBottom new bottom padding, ignored if smaller than 0 @return this to allow chaining
[ "Sets", "top", "and", "bottom", "padding", "(", "only", "if", "both", "values", "are", "not", "smaller", "than", "0", ")", "." ]
train
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AT_CellContext.java#L340-L346
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessageFormat.java
MessageFormat.readObject
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); // ICU 4.8 custom deserialization. String languageTag = (String)in.readObject(); ulocale = ULocale.forLanguageTag(languageTag); MessagePattern.ApostropheMode aposMode = (MessagePattern.ApostropheMode)in.readObject(); if (msgPattern == null || aposMode != msgPattern.getApostropheMode()) { msgPattern = new MessagePattern(aposMode); } String msg = (String)in.readObject(); if (msg != null) { applyPattern(msg); } // custom formatters for (int numFormatters = in.readInt(); numFormatters > 0; --numFormatters) { int formatIndex = in.readInt(); Format formatter = (Format)in.readObject(); setFormat(formatIndex, formatter); } // skip future (int, Object) pairs for (int numPairs = in.readInt(); numPairs > 0; --numPairs) { in.readInt(); in.readObject(); } }
java
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); // ICU 4.8 custom deserialization. String languageTag = (String)in.readObject(); ulocale = ULocale.forLanguageTag(languageTag); MessagePattern.ApostropheMode aposMode = (MessagePattern.ApostropheMode)in.readObject(); if (msgPattern == null || aposMode != msgPattern.getApostropheMode()) { msgPattern = new MessagePattern(aposMode); } String msg = (String)in.readObject(); if (msg != null) { applyPattern(msg); } // custom formatters for (int numFormatters = in.readInt(); numFormatters > 0; --numFormatters) { int formatIndex = in.readInt(); Format formatter = (Format)in.readObject(); setFormat(formatIndex, formatter); } // skip future (int, Object) pairs for (int numPairs = in.readInt(); numPairs > 0; --numPairs) { in.readInt(); in.readObject(); } }
[ "private", "void", "readObject", "(", "ObjectInputStream", "in", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "in", ".", "defaultReadObject", "(", ")", ";", "// ICU 4.8 custom deserialization.", "String", "languageTag", "=", "(", "String", ")", ...
Custom deserialization, new in ICU 4.8. See comments on writeObject(). @throws InvalidObjectException if the objects read from the stream is invalid.
[ "Custom", "deserialization", "new", "in", "ICU", "4", ".", "8", ".", "See", "comments", "on", "writeObject", "()", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessageFormat.java#L2328-L2352
xiancloud/xian
xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/intern/ConfigurationSupport.java
ConfigurationSupport.setDynamicMdcFields
public static void setDynamicMdcFields(String spec, GelfMessageAssembler gelfMessageAssembler) { if (null != spec) { String[] fields = spec.split(MULTI_VALUE_DELIMITTER); for (String field : fields) { gelfMessageAssembler.addField(new DynamicMdcMessageField(field.trim())); } } }
java
public static void setDynamicMdcFields(String spec, GelfMessageAssembler gelfMessageAssembler) { if (null != spec) { String[] fields = spec.split(MULTI_VALUE_DELIMITTER); for (String field : fields) { gelfMessageAssembler.addField(new DynamicMdcMessageField(field.trim())); } } }
[ "public", "static", "void", "setDynamicMdcFields", "(", "String", "spec", ",", "GelfMessageAssembler", "gelfMessageAssembler", ")", "{", "if", "(", "null", "!=", "spec", ")", "{", "String", "[", "]", "fields", "=", "spec", ".", "split", "(", "MULTI_VALUE_DELIM...
Set the dynamic MDC fields. @param spec field, .*FieldSuffix, fieldPrefix.* @param gelfMessageAssembler the {@link GelfMessageAssembler}.
[ "Set", "the", "dynamic", "MDC", "fields", "." ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/intern/ConfigurationSupport.java#L61-L69
weld/core
impl/src/main/java/org/jboss/weld/util/bytecode/BytecodeUtils.java
BytecodeUtils.pushClassType
public static void pushClassType(CodeAttribute b, String classType) { if (classType.length() != 1) { if (classType.startsWith("L") && classType.endsWith(";")) { classType = classType.substring(1, classType.length() - 1); } b.loadClass(classType); } else { char type = classType.charAt(0); switch (type) { case 'I': b.getstatic(Integer.class.getName(), TYPE, LJAVA_LANG_CLASS); break; case 'J': b.getstatic(Long.class.getName(), TYPE, LJAVA_LANG_CLASS); break; case 'S': b.getstatic(Short.class.getName(), TYPE, LJAVA_LANG_CLASS); break; case 'F': b.getstatic(Float.class.getName(), TYPE, LJAVA_LANG_CLASS); break; case 'D': b.getstatic(Double.class.getName(), TYPE, LJAVA_LANG_CLASS); break; case 'B': b.getstatic(Byte.class.getName(), TYPE, LJAVA_LANG_CLASS); break; case 'C': b.getstatic(Character.class.getName(), TYPE, LJAVA_LANG_CLASS); break; case 'Z': b.getstatic(Boolean.class.getName(), TYPE, LJAVA_LANG_CLASS); break; default: throw new RuntimeException("Cannot handle primitive type: " + type); } } }
java
public static void pushClassType(CodeAttribute b, String classType) { if (classType.length() != 1) { if (classType.startsWith("L") && classType.endsWith(";")) { classType = classType.substring(1, classType.length() - 1); } b.loadClass(classType); } else { char type = classType.charAt(0); switch (type) { case 'I': b.getstatic(Integer.class.getName(), TYPE, LJAVA_LANG_CLASS); break; case 'J': b.getstatic(Long.class.getName(), TYPE, LJAVA_LANG_CLASS); break; case 'S': b.getstatic(Short.class.getName(), TYPE, LJAVA_LANG_CLASS); break; case 'F': b.getstatic(Float.class.getName(), TYPE, LJAVA_LANG_CLASS); break; case 'D': b.getstatic(Double.class.getName(), TYPE, LJAVA_LANG_CLASS); break; case 'B': b.getstatic(Byte.class.getName(), TYPE, LJAVA_LANG_CLASS); break; case 'C': b.getstatic(Character.class.getName(), TYPE, LJAVA_LANG_CLASS); break; case 'Z': b.getstatic(Boolean.class.getName(), TYPE, LJAVA_LANG_CLASS); break; default: throw new RuntimeException("Cannot handle primitive type: " + type); } } }
[ "public", "static", "void", "pushClassType", "(", "CodeAttribute", "b", ",", "String", "classType", ")", "{", "if", "(", "classType", ".", "length", "(", ")", "!=", "1", ")", "{", "if", "(", "classType", ".", "startsWith", "(", "\"L\"", ")", "&&", "cla...
Pushes a class type onto the stack from the string representation This can also handle primitives @param b the bytecode @param classType the type descriptor for the class or primitive to push. This will accept both the java.lang.Object form and the Ljava/lang/Object; form
[ "Pushes", "a", "class", "type", "onto", "the", "stack", "from", "the", "string", "representation", "This", "can", "also", "handle", "primitives" ]
train
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/bytecode/BytecodeUtils.java#L85-L122
intel/jndn-utils
src/main/java/com/intel/jndn/utils/impl/KeyChainFactory.java
KeyChainFactory.configureKeyChain
public static KeyChain configureKeyChain(Name deviceName) throws net.named_data.jndn.security.SecurityException { // access key chain in ~/.ndn; creates if necessary PrivateKeyStorage keyStorage = new FilePrivateKeyStorage(); IdentityStorage identityStorage = new BasicIdentityStorage(); KeyChain keyChain = new KeyChain(new IdentityManager(identityStorage, keyStorage), new SelfVerifyPolicyManager(identityStorage)); // create keys, certs if necessary if (!identityStorage.doesIdentityExist(deviceName)) { Name certificateName = keyChain.createIdentityAndCertificate(deviceName); Name keyName = IdentityCertificate.certificateNameToPublicKeyName(certificateName); keyChain.setDefaultKeyForIdentity(keyName); } // set default identity keyChain.getIdentityManager().setDefaultIdentity(deviceName); return keyChain; }
java
public static KeyChain configureKeyChain(Name deviceName) throws net.named_data.jndn.security.SecurityException { // access key chain in ~/.ndn; creates if necessary PrivateKeyStorage keyStorage = new FilePrivateKeyStorage(); IdentityStorage identityStorage = new BasicIdentityStorage(); KeyChain keyChain = new KeyChain(new IdentityManager(identityStorage, keyStorage), new SelfVerifyPolicyManager(identityStorage)); // create keys, certs if necessary if (!identityStorage.doesIdentityExist(deviceName)) { Name certificateName = keyChain.createIdentityAndCertificate(deviceName); Name keyName = IdentityCertificate.certificateNameToPublicKeyName(certificateName); keyChain.setDefaultKeyForIdentity(keyName); } // set default identity keyChain.getIdentityManager().setDefaultIdentity(deviceName); return keyChain; }
[ "public", "static", "KeyChain", "configureKeyChain", "(", "Name", "deviceName", ")", "throws", "net", ".", "named_data", ".", "jndn", ".", "security", ".", "SecurityException", "{", "// access key chain in ~/.ndn; creates if necessary\r", "PrivateKeyStorage", "keyStorage", ...
Build and configure an NDN {@link KeyChain} from the file system; looks in the ~/.ndn folder for keys and identity SQLite DB. @param deviceName the identity of the device; this identity will be created if it does not exist @return a configured {@link KeyChain} @throws net.named_data.jndn.security.SecurityException if key chain creation fails
[ "Build", "and", "configure", "an", "NDN", "{", "@link", "KeyChain", "}", "from", "the", "file", "system", ";", "looks", "in", "the", "~", "/", ".", "ndn", "folder", "for", "keys", "and", "identity", "SQLite", "DB", "." ]
train
https://github.com/intel/jndn-utils/blob/7f670b259484c35d51a6c5acce5715b0573faedd/src/main/java/com/intel/jndn/utils/impl/KeyChainFactory.java#L49-L67
h2oai/h2o-2
src/main/java/water/parser/SVMLightParser.java
SVMLightParser.guessSetup
public static PSetupGuess guessSetup(byte [] bytes){ // find the last eof int i = bytes.length-1; while(i > 0 && bytes[i] != '\n')--i; assert i >= 0; InputStream is = new ByteArrayInputStream(Arrays.copyOf(bytes,i)); SVMLightParser p = new SVMLightParser(new ParserSetup(ParserType.SVMLight, CsvParser.AUTO_SEP, false)); InspectDataOut dout = new InspectDataOut(); try{p.streamParse(is, dout);}catch(Exception e){throw new RuntimeException(e);} return new PSetupGuess(new ParserSetup(ParserType.SVMLight, CsvParser.AUTO_SEP, dout._ncols,false,null,false),dout._nlines,dout._invalidLines,dout.data(),dout._ncols > 0 && dout._nlines > 0 && dout._nlines > dout._invalidLines,dout.errors()); }
java
public static PSetupGuess guessSetup(byte [] bytes){ // find the last eof int i = bytes.length-1; while(i > 0 && bytes[i] != '\n')--i; assert i >= 0; InputStream is = new ByteArrayInputStream(Arrays.copyOf(bytes,i)); SVMLightParser p = new SVMLightParser(new ParserSetup(ParserType.SVMLight, CsvParser.AUTO_SEP, false)); InspectDataOut dout = new InspectDataOut(); try{p.streamParse(is, dout);}catch(Exception e){throw new RuntimeException(e);} return new PSetupGuess(new ParserSetup(ParserType.SVMLight, CsvParser.AUTO_SEP, dout._ncols,false,null,false),dout._nlines,dout._invalidLines,dout.data(),dout._ncols > 0 && dout._nlines > 0 && dout._nlines > dout._invalidLines,dout.errors()); }
[ "public", "static", "PSetupGuess", "guessSetup", "(", "byte", "[", "]", "bytes", ")", "{", "// find the last eof", "int", "i", "=", "bytes", ".", "length", "-", "1", ";", "while", "(", "i", ">", "0", "&&", "bytes", "[", "i", "]", "!=", "'", "'", ")...
Try to parse the bytes as svm light format, return SVMParser instance if the input is in svm light format, null otherwise. @param bytes @return SVMLightPArser instance or null
[ "Try", "to", "parse", "the", "bytes", "as", "svm", "light", "format", "return", "SVMParser", "instance", "if", "the", "input", "is", "in", "svm", "light", "format", "null", "otherwise", "." ]
train
https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/parser/SVMLightParser.java#L52-L62
phax/peppol-directory
peppol-directory-indexer/src/main/java/com/helger/pd/indexer/storage/PDStorageManager.java
PDStorageManager.searchAtomic
public void searchAtomic (@Nonnull final Query aQuery, @Nonnull final Collector aCollector) throws IOException { ValueEnforcer.notNull (aQuery, "Query"); ValueEnforcer.notNull (aCollector, "Collector"); m_aLucene.readLockedAtomic ( () -> { final IndexSearcher aSearcher = m_aLucene.getSearcher (); if (aSearcher != null) { if (LOGGER.isDebugEnabled ()) LOGGER.debug ("Searching Lucene: " + aQuery); // Search all documents, collect them _timedSearch ( () -> aSearcher.search (aQuery, aCollector), aQuery); } else LOGGER.error ("Failed to obtain IndexSearcher for " + aQuery); // Return values does not matter return null; }); }
java
public void searchAtomic (@Nonnull final Query aQuery, @Nonnull final Collector aCollector) throws IOException { ValueEnforcer.notNull (aQuery, "Query"); ValueEnforcer.notNull (aCollector, "Collector"); m_aLucene.readLockedAtomic ( () -> { final IndexSearcher aSearcher = m_aLucene.getSearcher (); if (aSearcher != null) { if (LOGGER.isDebugEnabled ()) LOGGER.debug ("Searching Lucene: " + aQuery); // Search all documents, collect them _timedSearch ( () -> aSearcher.search (aQuery, aCollector), aQuery); } else LOGGER.error ("Failed to obtain IndexSearcher for " + aQuery); // Return values does not matter return null; }); }
[ "public", "void", "searchAtomic", "(", "@", "Nonnull", "final", "Query", "aQuery", ",", "@", "Nonnull", "final", "Collector", "aCollector", ")", "throws", "IOException", "{", "ValueEnforcer", ".", "notNull", "(", "aQuery", ",", "\"Query\"", ")", ";", "ValueEnf...
Search all documents matching the passed query and pass the result on to the provided {@link Consumer}. @param aQuery Query to execute. May not be <code>null</code>- @param aCollector The Lucene collector to be used. May not be <code>null</code>. @throws IOException On Lucene error @see #getAllDocuments(Query,int)
[ "Search", "all", "documents", "matching", "the", "passed", "query", "and", "pass", "the", "result", "on", "to", "the", "provided", "{", "@link", "Consumer", "}", "." ]
train
https://github.com/phax/peppol-directory/blob/98da26da29fb7178371d6b029516cbf01be223fb/peppol-directory-indexer/src/main/java/com/helger/pd/indexer/storage/PDStorageManager.java#L402-L423
VoltDB/voltdb
src/frontend/org/voltdb/jni/ExecutionEngineJNI.java
ExecutionEngineJNI.coreUpdateCatalog
@Override public void coreUpdateCatalog(long timestamp, boolean isStreamUpdate, final String catalogDiffs) throws EEException { LOG.trace("Loading Application Catalog..."); int errorCode = 0; errorCode = nativeUpdateCatalog(pointer, timestamp, isStreamUpdate, getStringBytes(catalogDiffs)); checkErrorCode(errorCode); }
java
@Override public void coreUpdateCatalog(long timestamp, boolean isStreamUpdate, final String catalogDiffs) throws EEException { LOG.trace("Loading Application Catalog..."); int errorCode = 0; errorCode = nativeUpdateCatalog(pointer, timestamp, isStreamUpdate, getStringBytes(catalogDiffs)); checkErrorCode(errorCode); }
[ "@", "Override", "public", "void", "coreUpdateCatalog", "(", "long", "timestamp", ",", "boolean", "isStreamUpdate", ",", "final", "String", "catalogDiffs", ")", "throws", "EEException", "{", "LOG", ".", "trace", "(", "\"Loading Application Catalog...\"", ")", ";", ...
Provide a catalog diff and a new catalog version and update the engine's catalog.
[ "Provide", "a", "catalog", "diff", "and", "a", "new", "catalog", "version", "and", "update", "the", "engine", "s", "catalog", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jni/ExecutionEngineJNI.java#L348-L354
fracpete/multisearch-weka-package
src/main/java/weka/core/setupgenerator/FunctionSpaceDimension.java
FunctionSpaceDimension.subdimension
public FunctionSpaceDimension subdimension(int left, int right) { return new FunctionSpaceDimension((Double) getValue(left), (Double) getValue(right), getStep(), getLabel()); }
java
public FunctionSpaceDimension subdimension(int left, int right) { return new FunctionSpaceDimension((Double) getValue(left), (Double) getValue(right), getStep(), getLabel()); }
[ "public", "FunctionSpaceDimension", "subdimension", "(", "int", "left", ",", "int", "right", ")", "{", "return", "new", "FunctionSpaceDimension", "(", "(", "Double", ")", "getValue", "(", "left", ")", ",", "(", "Double", ")", "getValue", "(", "right", ")", ...
returns a sub-dimension with the same type/step/list, but different borders. @param left the left index @param right the right index @return the sub-dimension
[ "returns", "a", "sub", "-", "dimension", "with", "the", "same", "type", "/", "step", "/", "list", "but", "different", "borders", "." ]
train
https://github.com/fracpete/multisearch-weka-package/blob/756fcf343e7cc9fd3844c99a0e1e828368f393d0/src/main/java/weka/core/setupgenerator/FunctionSpaceDimension.java#L147-L149
JOML-CI/JOML
src/org/joml/Intersectiond.java
Intersectiond.intersectSphereSphere
public static boolean intersectSphereSphere(Vector3dc centerA, double radiusSquaredA, Vector3dc centerB, double radiusSquaredB, Vector4d centerAndRadiusOfIntersectionCircle) { return intersectSphereSphere(centerA.x(), centerA.y(), centerA.z(), radiusSquaredA, centerB.x(), centerB.y(), centerB.z(), radiusSquaredB, centerAndRadiusOfIntersectionCircle); }
java
public static boolean intersectSphereSphere(Vector3dc centerA, double radiusSquaredA, Vector3dc centerB, double radiusSquaredB, Vector4d centerAndRadiusOfIntersectionCircle) { return intersectSphereSphere(centerA.x(), centerA.y(), centerA.z(), radiusSquaredA, centerB.x(), centerB.y(), centerB.z(), radiusSquaredB, centerAndRadiusOfIntersectionCircle); }
[ "public", "static", "boolean", "intersectSphereSphere", "(", "Vector3dc", "centerA", ",", "double", "radiusSquaredA", ",", "Vector3dc", "centerB", ",", "double", "radiusSquaredB", ",", "Vector4d", "centerAndRadiusOfIntersectionCircle", ")", "{", "return", "intersectSphere...
Test whether the one sphere with center <code>centerA</code> and square radius <code>radiusSquaredA</code> intersects the other sphere with center <code>centerB</code> and square radius <code>radiusSquaredB</code>, and store the center of the circle of intersection in the <code>(x, y, z)</code> components of the supplied vector and the radius of that circle in the w component. <p> The normal vector of the circle of intersection can simply be obtained by subtracting the center of either sphere from the other. <p> Reference: <a href="http://gamedev.stackexchange.com/questions/75756/sphere-sphere-intersection-and-circle-sphere-intersection">http://gamedev.stackexchange.com</a> @param centerA the first sphere's center @param radiusSquaredA the square of the first sphere's radius @param centerB the second sphere's center @param radiusSquaredB the square of the second sphere's radius @param centerAndRadiusOfIntersectionCircle will hold the center of the circle of intersection in the <code>(x, y, z)</code> components and the radius in the w component @return <code>true</code> iff both spheres intersect; <code>false</code> otherwise
[ "Test", "whether", "the", "one", "sphere", "with", "center", "<code", ">", "centerA<", "/", "code", ">", "and", "square", "radius", "<code", ">", "radiusSquaredA<", "/", "code", ">", "intersects", "the", "other", "sphere", "with", "center", "<code", ">", "...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Intersectiond.java#L805-L807
beanshell/beanshell
src/main/java/bsh/engine/BshScriptEngine.java
BshScriptEngine.invokeMethod
@Override public Object invokeMethod(Object thiz, String name, Object... args) throws ScriptException, NoSuchMethodException { if (!(thiz instanceof bsh.This)) { throw new ScriptException("Illegal object type: " + (null == thiz ? "null" : thiz.getClass())); } bsh.This bshObject = (bsh.This) thiz; try { return bshObject.invokeMethod(name, args); } catch (TargetError e) { // The script threw an application level exception // set it as the cause ? ScriptException se = new ScriptException(e.toString(), e.getErrorSourceFile(), e.getErrorLineNumber()); se.initCause(e.getTarget()); throw se; } catch (EvalError e) { // The script couldn't be evaluated properly throw new ScriptException(e.toString(), e.getErrorSourceFile(), e.getErrorLineNumber()); } }
java
@Override public Object invokeMethod(Object thiz, String name, Object... args) throws ScriptException, NoSuchMethodException { if (!(thiz instanceof bsh.This)) { throw new ScriptException("Illegal object type: " + (null == thiz ? "null" : thiz.getClass())); } bsh.This bshObject = (bsh.This) thiz; try { return bshObject.invokeMethod(name, args); } catch (TargetError e) { // The script threw an application level exception // set it as the cause ? ScriptException se = new ScriptException(e.toString(), e.getErrorSourceFile(), e.getErrorLineNumber()); se.initCause(e.getTarget()); throw se; } catch (EvalError e) { // The script couldn't be evaluated properly throw new ScriptException(e.toString(), e.getErrorSourceFile(), e.getErrorLineNumber()); } }
[ "@", "Override", "public", "Object", "invokeMethod", "(", "Object", "thiz", ",", "String", "name", ",", "Object", "...", "args", ")", "throws", "ScriptException", ",", "NoSuchMethodException", "{", "if", "(", "!", "(", "thiz", "instanceof", "bsh", ".", "This...
Calls a procedure compiled during a previous script execution, which is retained in the state of the {@code ScriptEngine{@code . @param name The name of the procedure to be called. @param thiz If the procedure is a member of a class defined in the script and thiz is an instance of that class returned by a previous execution or invocation, the named method is called through that instance. If classes are not supported in the scripting language or if the procedure is not a member function of any class, the argument must be {@code null}. @param args Arguments to pass to the procedure. The rules for converting the arguments to scripting variables are implementation-specific. @return The value returned by the procedure. The rules for converting the scripting variable returned by the procedure to a Java Object are implementation-specific. @throws javax.script.ScriptException if an error occurrs during invocation of the method. @throws NoSuchMethodException if method with given name or matching argument types cannot be found. @throws NullPointerException if method name is null.
[ "Calls", "a", "procedure", "compiled", "during", "a", "previous", "script", "execution", "which", "is", "retained", "in", "the", "state", "of", "the", "{", "@code", "ScriptEngine", "{", "@code", "." ]
train
https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/engine/BshScriptEngine.java#L267-L287
ef-labs/vertx-jersey
vertx-jersey/src/main/java/com/englishtown/vertx/guice/GuiceJerseyServer.java
GuiceJerseyServer.initBridge
protected void initBridge(ServiceLocator locator, Injector injector) { // Set up bridge GuiceBridge.getGuiceBridge().initializeGuiceBridge(locator); GuiceIntoHK2Bridge guiceBridge = locator.getService(GuiceIntoHK2Bridge.class); guiceBridge.bridgeGuiceInjector(injector); injectMultibindings(locator, injector); // Bind guice scope context ServiceLocatorUtilities.bind(locator, new AbstractBinder() { @Override protected void configure() { bind(GuiceScopeContext.class).to(new TypeLiteral<Context<GuiceScope>>() { }).in(Singleton.class); } }); }
java
protected void initBridge(ServiceLocator locator, Injector injector) { // Set up bridge GuiceBridge.getGuiceBridge().initializeGuiceBridge(locator); GuiceIntoHK2Bridge guiceBridge = locator.getService(GuiceIntoHK2Bridge.class); guiceBridge.bridgeGuiceInjector(injector); injectMultibindings(locator, injector); // Bind guice scope context ServiceLocatorUtilities.bind(locator, new AbstractBinder() { @Override protected void configure() { bind(GuiceScopeContext.class).to(new TypeLiteral<Context<GuiceScope>>() { }).in(Singleton.class); } }); }
[ "protected", "void", "initBridge", "(", "ServiceLocator", "locator", ",", "Injector", "injector", ")", "{", "// Set up bridge", "GuiceBridge", ".", "getGuiceBridge", "(", ")", ".", "initializeGuiceBridge", "(", "locator", ")", ";", "GuiceIntoHK2Bridge", "guiceBridge",...
Initialize the hk2 bridge @param locator the HK2 locator @param injector the Guice injector
[ "Initialize", "the", "hk2", "bridge" ]
train
https://github.com/ef-labs/vertx-jersey/blob/733482a8a5afb1fb257c682b3767655e56f7a0fe/vertx-jersey/src/main/java/com/englishtown/vertx/guice/GuiceJerseyServer.java#L50-L66
facebookarchive/hadoop-20
src/core/org/apache/hadoop/fs/FileSystem.java
FileSystem.copyFromLocalFile
@Deprecated public void copyFromLocalFile(boolean delSrc, Path src, Path dst) throws IOException { copyFromLocalFile(delSrc, true, src, dst); }
java
@Deprecated public void copyFromLocalFile(boolean delSrc, Path src, Path dst) throws IOException { copyFromLocalFile(delSrc, true, src, dst); }
[ "@", "Deprecated", "public", "void", "copyFromLocalFile", "(", "boolean", "delSrc", ",", "Path", "src", ",", "Path", "dst", ")", "throws", "IOException", "{", "copyFromLocalFile", "(", "delSrc", ",", "true", ",", "src", ",", "dst", ")", ";", "}" ]
The src file is on the local disk. Add it to FS at the given dst name. delSrc indicates if the source should be removed
[ "The", "src", "file", "is", "on", "the", "local", "disk", ".", "Add", "it", "to", "FS", "at", "the", "given", "dst", "name", ".", "delSrc", "indicates", "if", "the", "source", "should", "be", "removed" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L1651-L1655
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/richclient/framework/impl/RichClientFramework.java
RichClientFramework.areEndPointsEqual
@Override public boolean areEndPointsEqual(Object ep1, Object ep2) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "areEndPointsEqual", new Object[] { ep1, ep2 }); boolean isEqual = false; if (ep1 instanceof CFEndPoint && ep2 instanceof CFEndPoint) { CFEndPoint cfEp1 = (CFEndPoint) ep1; CFEndPoint cfEp2 = (CFEndPoint) ep2; // The CFW does not provide an equals method for its endpoints. // We need to manually equals the important bits up isEqual = isEqual(cfEp1.getAddress(), cfEp2.getAddress()) && isEqual(cfEp1.getName(), cfEp2.getName()) && cfEp1.getPort() == cfEp2.getPort() && cfEp1.isLocal() == cfEp2.isLocal() && cfEp1.isSSLEnabled() == cfEp2.isSSLEnabled(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "areEndPointsEqual", Boolean.valueOf(isEqual)); return isEqual; }
java
@Override public boolean areEndPointsEqual(Object ep1, Object ep2) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "areEndPointsEqual", new Object[] { ep1, ep2 }); boolean isEqual = false; if (ep1 instanceof CFEndPoint && ep2 instanceof CFEndPoint) { CFEndPoint cfEp1 = (CFEndPoint) ep1; CFEndPoint cfEp2 = (CFEndPoint) ep2; // The CFW does not provide an equals method for its endpoints. // We need to manually equals the important bits up isEqual = isEqual(cfEp1.getAddress(), cfEp2.getAddress()) && isEqual(cfEp1.getName(), cfEp2.getName()) && cfEp1.getPort() == cfEp2.getPort() && cfEp1.isLocal() == cfEp2.isLocal() && cfEp1.isSSLEnabled() == cfEp2.isSSLEnabled(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "areEndPointsEqual", Boolean.valueOf(isEqual)); return isEqual; }
[ "@", "Override", "public", "boolean", "areEndPointsEqual", "(", "Object", "ep1", ",", "Object", "ep2", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "("...
The channel framework EP's don't have their own equals method - so one is implemented here by comparing the various parts of the EP. @see com.ibm.ws.sib.jfapchannel.framework.Framework#areEndPointsEqual(java.lang.Object, java.lang.Object)
[ "The", "channel", "framework", "EP", "s", "don", "t", "have", "their", "own", "equals", "method", "-", "so", "one", "is", "implemented", "here", "by", "comparing", "the", "various", "parts", "of", "the", "EP", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/richclient/framework/impl/RichClientFramework.java#L572-L597
apereo/cas
core/cas-server-core-authentication-mfa-api/src/main/java/org/apereo/cas/authentication/trigger/PrincipalAttributeMultifactorAuthenticationTrigger.java
PrincipalAttributeMultifactorAuthenticationTrigger.resolveMultifactorAuthenticationProvider
protected Set<Event> resolveMultifactorAuthenticationProvider(final Optional<RequestContext> context, final RegisteredService service, final Principal principal) { val globalPrincipalAttributeValueRegex = casProperties.getAuthn().getMfa().getGlobalPrincipalAttributeValueRegex(); val providerMap = MultifactorAuthenticationUtils.getAvailableMultifactorAuthenticationProviders(ApplicationContextProvider.getApplicationContext()); val providers = providerMap.values(); if (providers.size() == 1 && StringUtils.isNotBlank(globalPrincipalAttributeValueRegex)) { return resolveSingleMultifactorProvider(context, service, principal, providers); } return resolveMultifactorProviderViaPredicate(context, service, principal, providers); }
java
protected Set<Event> resolveMultifactorAuthenticationProvider(final Optional<RequestContext> context, final RegisteredService service, final Principal principal) { val globalPrincipalAttributeValueRegex = casProperties.getAuthn().getMfa().getGlobalPrincipalAttributeValueRegex(); val providerMap = MultifactorAuthenticationUtils.getAvailableMultifactorAuthenticationProviders(ApplicationContextProvider.getApplicationContext()); val providers = providerMap.values(); if (providers.size() == 1 && StringUtils.isNotBlank(globalPrincipalAttributeValueRegex)) { return resolveSingleMultifactorProvider(context, service, principal, providers); } return resolveMultifactorProviderViaPredicate(context, service, principal, providers); }
[ "protected", "Set", "<", "Event", ">", "resolveMultifactorAuthenticationProvider", "(", "final", "Optional", "<", "RequestContext", ">", "context", ",", "final", "RegisteredService", "service", ",", "final", "Principal", "principal", ")", "{", "val", "globalPrincipalA...
Resolve multifactor authentication provider set. @param context the context @param service the service @param principal the principal @return the set
[ "Resolve", "multifactor", "authentication", "provider", "set", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-authentication-mfa-api/src/main/java/org/apereo/cas/authentication/trigger/PrincipalAttributeMultifactorAuthenticationTrigger.java#L85-L96
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java
VirtualMachinesInner.performMaintenance
public OperationStatusResponseInner performMaintenance(String resourceGroupName, String vmName) { return performMaintenanceWithServiceResponseAsync(resourceGroupName, vmName).toBlocking().last().body(); }
java
public OperationStatusResponseInner performMaintenance(String resourceGroupName, String vmName) { return performMaintenanceWithServiceResponseAsync(resourceGroupName, vmName).toBlocking().last().body(); }
[ "public", "OperationStatusResponseInner", "performMaintenance", "(", "String", "resourceGroupName", ",", "String", "vmName", ")", "{", "return", "performMaintenanceWithServiceResponseAsync", "(", "resourceGroupName", ",", "vmName", ")", ".", "toBlocking", "(", ")", ".", ...
The operation to perform maintenance on a virtual machine. @param resourceGroupName The name of the resource group. @param vmName The name of the virtual machine. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the OperationStatusResponseInner object if successful.
[ "The", "operation", "to", "perform", "maintenance", "on", "a", "virtual", "machine", "." ]
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/VirtualMachinesInner.java#L2469-L2471
ops4j/org.ops4j.pax.exam1
ops4j-quickbuild-core/src/main/java/org/ops4j/pax/exam/quickbuild/internal/DefaultSnapshotBuilder.java
DefaultSnapshotBuilder.newSnapshotElement
private SnapshotElement newSnapshotElement( String name, Handle handle, QType type ) throws IOException { return new DefaultSnapshotElement( name, m_store.getLocation( handle ), type, handle.getIdentification() ); }
java
private SnapshotElement newSnapshotElement( String name, Handle handle, QType type ) throws IOException { return new DefaultSnapshotElement( name, m_store.getLocation( handle ), type, handle.getIdentification() ); }
[ "private", "SnapshotElement", "newSnapshotElement", "(", "String", "name", ",", "Handle", "handle", ",", "QType", "type", ")", "throws", "IOException", "{", "return", "new", "DefaultSnapshotElement", "(", "name", ",", "m_store", ".", "getLocation", "(", "handle", ...
Create a new SnapshotElement instance of name, handle and type. Helper method. @param name name identifier of a snapshot entry @param handle store handle @param type the type @return new instance of type {@link SnapshotElement} @throws IOException in case something goes wrong when dealing with you supplied handle
[ "Create", "a", "new", "SnapshotElement", "instance", "of", "name", "handle", "and", "type", ".", "Helper", "method", "." ]
train
https://github.com/ops4j/org.ops4j.pax.exam1/blob/7c8742208117ff91bd24bcd3a185d2d019f7000f/ops4j-quickbuild-core/src/main/java/org/ops4j/pax/exam/quickbuild/internal/DefaultSnapshotBuilder.java#L97-L101
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/CommandGroupJComponentBuilder.java
CommandGroupJComponentBuilder.buildGroupModel
protected final Object buildGroupModel(Object parentModel, CommandGroup commandGroup, int level) { return buildGroupComponent((JComponent) parentModel, commandGroup, level); }
java
protected final Object buildGroupModel(Object parentModel, CommandGroup commandGroup, int level) { return buildGroupComponent((JComponent) parentModel, commandGroup, level); }
[ "protected", "final", "Object", "buildGroupModel", "(", "Object", "parentModel", ",", "CommandGroup", "commandGroup", ",", "int", "level", ")", "{", "return", "buildGroupComponent", "(", "(", "JComponent", ")", "parentModel", ",", "commandGroup", ",", "level", ")"...
Implementation wrapping around the {@link #buildGroupComponent(JComponent, CommandGroup, int)}
[ "Implementation", "wrapping", "around", "the", "{" ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/CommandGroupJComponentBuilder.java#L78-L81
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/SQLExceptionHandler.java
SQLExceptionHandler.handleDeleteException
public String handleDeleteException(SQLException e, ItemData item) throws RepositoryException, InvalidItemStateException { StringBuilder message = new StringBuilder("["); message.append(containerName).append("] DELETE ").append(item.isNode() ? "NODE. " : "PROPERTY. "); String errMessage = e.getMessage(); String itemInfo = item.getQPath().getAsString() + " " + item.getIdentifier() + (errMessage != null ? ". Cause >>>> " + errMessage : ""); if (errMessage != null) { // try detect error by foreign key names String umsg = errMessage.toLowerCase().toUpperCase(); if (umsg.indexOf(conn.JCR_FK_ITEM_PARENT) >= 0) { message.append("Can not delete parent till childs exists. Item ").append(itemInfo); throw new JCRInvalidItemStateException(message.toString(), item.getIdentifier(), ItemState.DELETED, e); } else if (umsg.indexOf(conn.JCR_FK_VALUE_PROPERTY) >= 0) { message.append("[FATAL] Can not delete property item till it contains values. Condition: property ID. ") .append(itemInfo); throw new RepositoryException(message.toString(), e); } } message.append("Error of item delete ").append(itemInfo); throw new RepositoryException(message.toString(), e); }
java
public String handleDeleteException(SQLException e, ItemData item) throws RepositoryException, InvalidItemStateException { StringBuilder message = new StringBuilder("["); message.append(containerName).append("] DELETE ").append(item.isNode() ? "NODE. " : "PROPERTY. "); String errMessage = e.getMessage(); String itemInfo = item.getQPath().getAsString() + " " + item.getIdentifier() + (errMessage != null ? ". Cause >>>> " + errMessage : ""); if (errMessage != null) { // try detect error by foreign key names String umsg = errMessage.toLowerCase().toUpperCase(); if (umsg.indexOf(conn.JCR_FK_ITEM_PARENT) >= 0) { message.append("Can not delete parent till childs exists. Item ").append(itemInfo); throw new JCRInvalidItemStateException(message.toString(), item.getIdentifier(), ItemState.DELETED, e); } else if (umsg.indexOf(conn.JCR_FK_VALUE_PROPERTY) >= 0) { message.append("[FATAL] Can not delete property item till it contains values. Condition: property ID. ") .append(itemInfo); throw new RepositoryException(message.toString(), e); } } message.append("Error of item delete ").append(itemInfo); throw new RepositoryException(message.toString(), e); }
[ "public", "String", "handleDeleteException", "(", "SQLException", "e", ",", "ItemData", "item", ")", "throws", "RepositoryException", ",", "InvalidItemStateException", "{", "StringBuilder", "message", "=", "new", "StringBuilder", "(", "\"[\"", ")", ";", "message", "...
Handle delete Exceptions. @param e - an SQLException @param item - context ItemData @return String with error message @throws RepositoryException if <code>RepositoryException</code> should be thrown @throws InvalidItemStateException if <code>InvalidItemStateException</code> should be thrown
[ "Handle", "delete", "Exceptions", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/SQLExceptionHandler.java#L364-L394
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceWarehousePersistenceImpl.java
CommerceWarehousePersistenceImpl.removeByG_A_P
@Override public void removeByG_A_P(long groupId, boolean active, boolean primary) { for (CommerceWarehouse commerceWarehouse : findByG_A_P(groupId, active, primary, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceWarehouse); } }
java
@Override public void removeByG_A_P(long groupId, boolean active, boolean primary) { for (CommerceWarehouse commerceWarehouse : findByG_A_P(groupId, active, primary, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceWarehouse); } }
[ "@", "Override", "public", "void", "removeByG_A_P", "(", "long", "groupId", ",", "boolean", "active", ",", "boolean", "primary", ")", "{", "for", "(", "CommerceWarehouse", "commerceWarehouse", ":", "findByG_A_P", "(", "groupId", ",", "active", ",", "primary", ...
Removes all the commerce warehouses where groupId = &#63; and active = &#63; and primary = &#63; from the database. @param groupId the group ID @param active the active @param primary the primary
[ "Removes", "all", "the", "commerce", "warehouses", "where", "groupId", "=", "&#63", ";", "and", "active", "=", "&#63", ";", "and", "primary", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceWarehousePersistenceImpl.java#L3358-L3364
hazelcast/hazelcast
hazelcast-client/src/main/java/com/hazelcast/client/config/ClientConfig.java
ClientConfig.addNearCacheConfig
@Deprecated public ClientConfig addNearCacheConfig(String name, NearCacheConfig nearCacheConfig) { nearCacheConfig.setName(name); return addNearCacheConfig(nearCacheConfig); }
java
@Deprecated public ClientConfig addNearCacheConfig(String name, NearCacheConfig nearCacheConfig) { nearCacheConfig.setName(name); return addNearCacheConfig(nearCacheConfig); }
[ "@", "Deprecated", "public", "ClientConfig", "addNearCacheConfig", "(", "String", "name", ",", "NearCacheConfig", "nearCacheConfig", ")", "{", "nearCacheConfig", ".", "setName", "(", "name", ")", ";", "return", "addNearCacheConfig", "(", "nearCacheConfig", ")", ";",...
please use {@link ClientConfig#addNearCacheConfig(NearCacheConfig)} @param name name of the IMap / ICache that Near Cache config will be applied to @param nearCacheConfig nearCacheConfig @return configured {@link com.hazelcast.client.config.ClientConfig} for chaining
[ "please", "use", "{", "@link", "ClientConfig#addNearCacheConfig", "(", "NearCacheConfig", ")", "}" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast-client/src/main/java/com/hazelcast/client/config/ClientConfig.java#L324-L328
meltmedia/cadmium
servlets/src/main/java/com/meltmedia/cadmium/servlets/BasicFileServlet.java
BasicFileServlet.locateFileToServe
public boolean locateFileToServe( FileRequestContext context ) throws IOException { context.file = new File( contentDir, context.path); // if the path is not on the file system, send a 404. if( !context.file.exists() ) { context.response.sendError(HttpServletResponse.SC_NOT_FOUND); return true; } // redirect welcome files if needed. if( handleWelcomeRedirect(context) ) return true; // if the requested file is a directory, try to find the welcome file. if( context.file.isDirectory() ) { context.file = new File(context.file, "index.html"); } // if the file does not exist, then terminate with a 404. if( !context.file.exists() ) { context.response.sendError(HttpServletResponse.SC_NOT_FOUND); return true; } return false; }
java
public boolean locateFileToServe( FileRequestContext context ) throws IOException { context.file = new File( contentDir, context.path); // if the path is not on the file system, send a 404. if( !context.file.exists() ) { context.response.sendError(HttpServletResponse.SC_NOT_FOUND); return true; } // redirect welcome files if needed. if( handleWelcomeRedirect(context) ) return true; // if the requested file is a directory, try to find the welcome file. if( context.file.isDirectory() ) { context.file = new File(context.file, "index.html"); } // if the file does not exist, then terminate with a 404. if( !context.file.exists() ) { context.response.sendError(HttpServletResponse.SC_NOT_FOUND); return true; } return false; }
[ "public", "boolean", "locateFileToServe", "(", "FileRequestContext", "context", ")", "throws", "IOException", "{", "context", ".", "file", "=", "new", "File", "(", "contentDir", ",", "context", ".", "path", ")", ";", "// if the path is not on the file system, send a 4...
Locates the file to serve. Returns true if locating the file caused the request to be handled. @param context @return @throws IOException
[ "Locates", "the", "file", "to", "serve", ".", "Returns", "true", "if", "locating", "the", "file", "caused", "the", "request", "to", "be", "handled", "." ]
train
https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/servlets/src/main/java/com/meltmedia/cadmium/servlets/BasicFileServlet.java#L287-L311
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/commerce/checkouts/AppliedDiscountUrl.java
AppliedDiscountUrl.applyCouponUrl
public static MozuUrl applyCouponUrl(String checkoutId, String couponCode, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/commerce/checkouts/{checkoutId}/coupons/{couponCode}?responseFields={responseFields}"); formatter.formatUrl("checkoutId", checkoutId); formatter.formatUrl("couponCode", couponCode); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl applyCouponUrl(String checkoutId, String couponCode, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/commerce/checkouts/{checkoutId}/coupons/{couponCode}?responseFields={responseFields}"); formatter.formatUrl("checkoutId", checkoutId); formatter.formatUrl("couponCode", couponCode); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "applyCouponUrl", "(", "String", "checkoutId", ",", "String", "couponCode", ",", "String", "responseFields", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/checkouts/{checkoutId}/coupons/{couponCode}?r...
Get Resource Url for ApplyCoupon @param checkoutId The unique identifier of the checkout. @param couponCode Code associated with the coupon to remove from the cart. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url
[ "Get", "Resource", "Url", "for", "ApplyCoupon" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/checkouts/AppliedDiscountUrl.java#L23-L30
yanzhenjie/AndServer
api/src/main/java/com/yanzhenjie/andserver/util/StringUtils.java
StringUtils.deleteAny
public static String deleteAny(String inString, String charsToDelete) { if (!hasLength(inString) || !hasLength(charsToDelete)) { return inString; } StringBuilder sb = new StringBuilder(inString.length()); for (int i = 0; i < inString.length(); i++) { char c = inString.charAt(i); if (charsToDelete.indexOf(c) == -1) { sb.append(c); } } return sb.toString(); }
java
public static String deleteAny(String inString, String charsToDelete) { if (!hasLength(inString) || !hasLength(charsToDelete)) { return inString; } StringBuilder sb = new StringBuilder(inString.length()); for (int i = 0; i < inString.length(); i++) { char c = inString.charAt(i); if (charsToDelete.indexOf(c) == -1) { sb.append(c); } } return sb.toString(); }
[ "public", "static", "String", "deleteAny", "(", "String", "inString", ",", "String", "charsToDelete", ")", "{", "if", "(", "!", "hasLength", "(", "inString", ")", "||", "!", "hasLength", "(", "charsToDelete", ")", ")", "{", "return", "inString", ";", "}", ...
Delete any character in a given {@code String}. @param inString the original {@code String}. @param charsToDelete a set of characters to delete. E.g. "az\n" will delete 'a's, 'z's and new lines. @return the resulting {@code String}.
[ "Delete", "any", "character", "in", "a", "given", "{", "@code", "String", "}", "." ]
train
https://github.com/yanzhenjie/AndServer/blob/f95f316cdfa5755d6a3fec3c6a1b5df783b81517/api/src/main/java/com/yanzhenjie/andserver/util/StringUtils.java#L411-L424
JodaOrg/joda-time
src/main/java/org/joda/time/MutableInterval.java
MutableInterval.setInterval
public void setInterval(ReadableInstant start, ReadableInstant end) { if (start == null && end == null) { long now = DateTimeUtils.currentTimeMillis(); setInterval(now, now); } else { long startMillis = DateTimeUtils.getInstantMillis(start); long endMillis = DateTimeUtils.getInstantMillis(end); Chronology chrono = DateTimeUtils.getInstantChronology(start); super.setInterval(startMillis, endMillis, chrono); } }
java
public void setInterval(ReadableInstant start, ReadableInstant end) { if (start == null && end == null) { long now = DateTimeUtils.currentTimeMillis(); setInterval(now, now); } else { long startMillis = DateTimeUtils.getInstantMillis(start); long endMillis = DateTimeUtils.getInstantMillis(end); Chronology chrono = DateTimeUtils.getInstantChronology(start); super.setInterval(startMillis, endMillis, chrono); } }
[ "public", "void", "setInterval", "(", "ReadableInstant", "start", ",", "ReadableInstant", "end", ")", "{", "if", "(", "start", "==", "null", "&&", "end", "==", "null", ")", "{", "long", "now", "=", "DateTimeUtils", ".", "currentTimeMillis", "(", ")", ";", ...
Sets this interval from two instants, replacing the chronology with that from the start instant. @param start the start of the time interval @param end the start of the time interval @throws IllegalArgumentException if the end is before the start
[ "Sets", "this", "interval", "from", "two", "instants", "replacing", "the", "chronology", "with", "that", "from", "the", "start", "instant", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/MutableInterval.java#L244-L254
overturetool/overture
core/interpreter/src/main/java/org/overture/interpreter/runtime/ModuleInterpreter.java
ModuleInterpreter.execute
@Override public Value execute(String line, DBGPReader dbgp) throws Exception { PExp expr = parseExpression(line, getDefaultName()); Environment env = getGlobalEnvironment(); typeCheck(expr, env); Context mainContext = new StateContext(assistantFactory, defaultModule.getName().getLocation(), "module scope", null, assistantFactory.createAModuleModulesAssistant().getStateContext(defaultModule)); mainContext.putAll(initialContext); mainContext.setThreadState(dbgp, null); clearBreakpointHits(); // scheduler.reset(); InitThread iniThread = new InitThread(Thread.currentThread()); BasicSchedulableThread.setInitialThread(iniThread); MainThread main = new MainThread(expr, mainContext); main.start(); scheduler.start(main); return main.getResult(); // Can throw ContextException }
java
@Override public Value execute(String line, DBGPReader dbgp) throws Exception { PExp expr = parseExpression(line, getDefaultName()); Environment env = getGlobalEnvironment(); typeCheck(expr, env); Context mainContext = new StateContext(assistantFactory, defaultModule.getName().getLocation(), "module scope", null, assistantFactory.createAModuleModulesAssistant().getStateContext(defaultModule)); mainContext.putAll(initialContext); mainContext.setThreadState(dbgp, null); clearBreakpointHits(); // scheduler.reset(); InitThread iniThread = new InitThread(Thread.currentThread()); BasicSchedulableThread.setInitialThread(iniThread); MainThread main = new MainThread(expr, mainContext); main.start(); scheduler.start(main); return main.getResult(); // Can throw ContextException }
[ "@", "Override", "public", "Value", "execute", "(", "String", "line", ",", "DBGPReader", "dbgp", ")", "throws", "Exception", "{", "PExp", "expr", "=", "parseExpression", "(", "line", ",", "getDefaultName", "(", ")", ")", ";", "Environment", "env", "=", "ge...
Parse the line passed, type check it and evaluate it as an expression in the initial module context (with default module's state). @param line A VDM expression. @return The value of the expression. @throws Exception Parser, type checking or runtime errors.
[ "Parse", "the", "line", "passed", "type", "check", "it", "and", "evaluate", "it", "as", "an", "expression", "in", "the", "initial", "module", "context", "(", "with", "default", "module", "s", "state", ")", "." ]
train
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/interpreter/src/main/java/org/overture/interpreter/runtime/ModuleInterpreter.java#L257-L280
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/Parameterized.java
Parameterized.getParameter
public String getParameter(String name, boolean asAbsolutePath) { if (!m_parameters.containsKey(name)) return null; String paramValue = m_parameters.get(name).getValue(); if (asAbsolutePath && paramValue != null) { File f = new File(paramValue); if (!f.isAbsolute()) { paramValue = FEDORA_HOME + File.separator + paramValue; } } return paramValue; }
java
public String getParameter(String name, boolean asAbsolutePath) { if (!m_parameters.containsKey(name)) return null; String paramValue = m_parameters.get(name).getValue(); if (asAbsolutePath && paramValue != null) { File f = new File(paramValue); if (!f.isAbsolute()) { paramValue = FEDORA_HOME + File.separator + paramValue; } } return paramValue; }
[ "public", "String", "getParameter", "(", "String", "name", ",", "boolean", "asAbsolutePath", ")", "{", "if", "(", "!", "m_parameters", ".", "containsKey", "(", "name", ")", ")", "return", "null", ";", "String", "paramValue", "=", "m_parameters", ".", "get", ...
Gets the value of a named configuration parameter. Same as getParameter(String name) but prepends the location of FEDORA_HOME if asAbsolutePath is true and the parameter location does not already specify an absolute pathname. @param name The parameter name. @param asAbsolutePath Whether to return the parameter value as an absolute path relative to FEDORA_HOME. @return The value, null if undefined.
[ "Gets", "the", "value", "of", "a", "named", "configuration", "parameter", ".", "Same", "as", "getParameter", "(", "String", "name", ")", "but", "prepends", "the", "location", "of", "FEDORA_HOME", "if", "asAbsolutePath", "is", "true", "and", "the", "parameter",...
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/Parameterized.java#L102-L113
aol/cyclops
cyclops/src/main/java/cyclops/companion/Streams.java
Streams.splitBy
public final static <T> Tuple2<Stream<T>, Stream<T>> splitBy(final Stream<T> stream, final Predicate<T> splitter) { final Tuple2<Stream<T>, Stream<T>> Tuple2 = duplicate(stream); return Tuple.tuple( takeWhile(Tuple2._1(), splitter), dropWhile(Tuple2._2(), splitter)); }
java
public final static <T> Tuple2<Stream<T>, Stream<T>> splitBy(final Stream<T> stream, final Predicate<T> splitter) { final Tuple2<Stream<T>, Stream<T>> Tuple2 = duplicate(stream); return Tuple.tuple( takeWhile(Tuple2._1(), splitter), dropWhile(Tuple2._2(), splitter)); }
[ "public", "final", "static", "<", "T", ">", "Tuple2", "<", "Stream", "<", "T", ">", ",", "Stream", "<", "T", ">", ">", "splitBy", "(", "final", "Stream", "<", "T", ">", "stream", ",", "final", "Predicate", "<", "T", ">", "splitter", ")", "{", "fi...
Split stream at point where predicate no longer holds <pre> {@code ReactiveSeq.of(1, 2, 3, 4, 5, 6).splitBy(i->i<4) //Stream[1,2,3] Stream[4,5,6] } </pre>
[ "Split", "stream", "at", "point", "where", "predicate", "no", "longer", "holds", "<pre", ">", "{", "@code", "ReactiveSeq", ".", "of", "(", "1", "2", "3", "4", "5", "6", ")", ".", "splitBy", "(", "i", "-", ">", "i<4", ")" ]
train
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Streams.java#L843-L847
btrplace/scheduler
choco/src/main/java/org/btrplace/scheduler/choco/extensions/pack/VectorPackingPropagator.java
VectorPackingPropagator.assignItem
protected void assignItem(int item, int bin) throws ContradictionException { for (int d = 0; d < nbDims; d++) { filterLoadInf(d, bin, assignedLoad[d][bin].add(iSizes[d][item])); } if (decoKPSimple != null) { decoKPSimple.postAssignItem(item, bin); } }
java
protected void assignItem(int item, int bin) throws ContradictionException { for (int d = 0; d < nbDims; d++) { filterLoadInf(d, bin, assignedLoad[d][bin].add(iSizes[d][item])); } if (decoKPSimple != null) { decoKPSimple.postAssignItem(item, bin); } }
[ "protected", "void", "assignItem", "(", "int", "item", ",", "int", "bin", ")", "throws", "ContradictionException", "{", "for", "(", "int", "d", "=", "0", ";", "d", "<", "nbDims", ";", "d", "++", ")", "{", "filterLoadInf", "(", "d", ",", "bin", ",", ...
apply rule 2 (binLoad >= binAssignedLoad) when an item has been assign to the bin @throws ContradictionException if a contradiction (rule 2) is raised
[ "apply", "rule", "2", "(", "binLoad", ">", "=", "binAssignedLoad", ")", "when", "an", "item", "has", "been", "assign", "to", "the", "bin" ]
train
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/choco/src/main/java/org/btrplace/scheduler/choco/extensions/pack/VectorPackingPropagator.java#L326-L333
sagiegurari/fax4j
src/main/java/org/fax4j/common/ApacheCommonsLogger.java
ApacheCommonsLogger.logImpl
@Override protected void logImpl(LogLevel level,Object[] message,Throwable throwable) { //format log message (without exception) String text=this.formatLogMessage(level,message,null); //get log level int levelValue=level.getValue(); switch(levelValue) { case LogLevel.DEBUG_LOG_LEVEL_VALUE: this.APACHE_LOGGER.debug(text); break; case LogLevel.ERROR_LOG_LEVEL_VALUE: this.APACHE_LOGGER.error(text,throwable); break; case LogLevel.INFO_LOG_LEVEL_VALUE: default: this.APACHE_LOGGER.info(text); break; } }
java
@Override protected void logImpl(LogLevel level,Object[] message,Throwable throwable) { //format log message (without exception) String text=this.formatLogMessage(level,message,null); //get log level int levelValue=level.getValue(); switch(levelValue) { case LogLevel.DEBUG_LOG_LEVEL_VALUE: this.APACHE_LOGGER.debug(text); break; case LogLevel.ERROR_LOG_LEVEL_VALUE: this.APACHE_LOGGER.error(text,throwable); break; case LogLevel.INFO_LOG_LEVEL_VALUE: default: this.APACHE_LOGGER.info(text); break; } }
[ "@", "Override", "protected", "void", "logImpl", "(", "LogLevel", "level", ",", "Object", "[", "]", "message", ",", "Throwable", "throwable", ")", "{", "//format log message (without exception)", "String", "text", "=", "this", ".", "formatLogMessage", "(", "level"...
Logs the provided data. @param level The log level @param message The message parts (may be null) @param throwable The error (may be null)
[ "Logs", "the", "provided", "data", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/common/ApacheCommonsLogger.java#L54-L75
looly/hutool
hutool-db/src/main/java/cn/hutool/db/StatementUtil.java
StatementUtil.prepareStatement
public static PreparedStatement prepareStatement(Connection conn, SqlBuilder sqlBuilder) throws SQLException { return prepareStatement(conn, sqlBuilder.build(), sqlBuilder.getParamValueArray()); }
java
public static PreparedStatement prepareStatement(Connection conn, SqlBuilder sqlBuilder) throws SQLException { return prepareStatement(conn, sqlBuilder.build(), sqlBuilder.getParamValueArray()); }
[ "public", "static", "PreparedStatement", "prepareStatement", "(", "Connection", "conn", ",", "SqlBuilder", "sqlBuilder", ")", "throws", "SQLException", "{", "return", "prepareStatement", "(", "conn", ",", "sqlBuilder", ".", "build", "(", ")", ",", "sqlBuilder", "....
创建{@link PreparedStatement} @param conn 数据库连接 @param sqlBuilder {@link SqlBuilder}包括SQL语句和参数 @return {@link PreparedStatement} @throws SQLException SQL异常 @since 4.1.3
[ "创建", "{", "@link", "PreparedStatement", "}" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/StatementUtil.java#L110-L112
ReactiveX/RxJavaAsyncUtil
src/main/java/rx/util/async/Async.java
Async.toAsyncThrowing
public static <T1, R> Func1<T1, Observable<R>> toAsyncThrowing(ThrowingFunc1<? super T1, ? extends R> func) { return toAsyncThrowing(func, Schedulers.computation()); }
java
public static <T1, R> Func1<T1, Observable<R>> toAsyncThrowing(ThrowingFunc1<? super T1, ? extends R> func) { return toAsyncThrowing(func, Schedulers.computation()); }
[ "public", "static", "<", "T1", ",", "R", ">", "Func1", "<", "T1", ",", "Observable", "<", "R", ">", ">", "toAsyncThrowing", "(", "ThrowingFunc1", "<", "?", "super", "T1", ",", "?", "extends", "R", ">", "func", ")", "{", "return", "toAsyncThrowing", "...
Convert a synchronous function call into an asynchronous function call through an Observable. <p> <img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/toAsync.png" alt=""> @param <T1> first parameter type of the action @param <R> the result type @param func the function to convert @return a function that returns an Observable that executes the {@code func} and emits its returned value @see <a href="https://github.com/ReactiveX/RxJava/wiki/Async-Operators#wiki-toasync-or-asyncaction-or-asyncfunc">RxJava Wiki: toAsync()</a> @see <a href="http://msdn.microsoft.com/en-us/library/hh229755.aspx">MSDN: Observable.ToAsync</a>
[ "Convert", "a", "synchronous", "function", "call", "into", "an", "asynchronous", "function", "call", "through", "an", "Observable", ".", "<p", ">", "<img", "width", "=", "640", "src", "=", "https", ":", "//", "raw", ".", "github", ".", "com", "/", "wiki"...
train
https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/Async.java#L223-L225
JOML-CI/JOML
src/org/joml/Matrix4f.java
Matrix4f.frustumLH
public Matrix4f frustumLH(float left, float right, float bottom, float top, float zNear, float zFar, boolean zZeroToOne, Matrix4f dest) { if ((properties & PROPERTY_IDENTITY) != 0) return dest.setFrustumLH(left, right, bottom, top, zNear, zFar, zZeroToOne); return frustumLHGeneric(left, right, bottom, top, zNear, zFar, zZeroToOne, dest); }
java
public Matrix4f frustumLH(float left, float right, float bottom, float top, float zNear, float zFar, boolean zZeroToOne, Matrix4f dest) { if ((properties & PROPERTY_IDENTITY) != 0) return dest.setFrustumLH(left, right, bottom, top, zNear, zFar, zZeroToOne); return frustumLHGeneric(left, right, bottom, top, zNear, zFar, zZeroToOne, dest); }
[ "public", "Matrix4f", "frustumLH", "(", "float", "left", ",", "float", "right", ",", "float", "bottom", ",", "float", "top", ",", "float", "zNear", ",", "float", "zFar", ",", "boolean", "zZeroToOne", ",", "Matrix4f", "dest", ")", "{", "if", "(", "(", "...
Apply an arbitrary perspective projection frustum transformation for a left-handed coordinate system using the given NDC z range to this matrix and store the result in <code>dest</code>. <p> If <code>M</code> is <code>this</code> matrix and <code>F</code> the frustum matrix, then the new matrix will be <code>M * F</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * F * v</code>, the frustum transformation will be applied first! <p> In order to set the matrix to a perspective frustum transformation without post-multiplying, use {@link #setFrustumLH(float, float, float, float, float, float, boolean) setFrustumLH()}. <p> Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#perspective">http://www.songho.ca</a> @see #setFrustumLH(float, float, float, float, float, float, boolean) @param left the distance along the x-axis to the left frustum edge @param right the distance along the x-axis to the right frustum edge @param bottom the distance along the y-axis to the bottom frustum edge @param top the distance along the y-axis to the top frustum edge @param zNear near clipping plane distance. If the special value {@link Float#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity. In that case, <code>zFar</code> may not also be {@link Float#POSITIVE_INFINITY}. @param zFar far clipping plane distance. If the special value {@link Float#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity. In that case, <code>zNear</code> may not also be {@link Float#POSITIVE_INFINITY}. @param zZeroToOne whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code> or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code> @param dest will hold the result @return dest
[ "Apply", "an", "arbitrary", "perspective", "projection", "frustum", "transformation", "for", "a", "left", "-", "handed", "coordinate", "system", "using", "the", "given", "NDC", "z", "range", "to", "this", "matrix", "and", "store", "the", "result", "in", "<code...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L10618-L10622
joniles/mpxj
src/main/java/net/sf/mpxj/RecurringData.java
RecurringData.getYearlyDates
private void getYearlyDates(Calendar calendar, List<Date> dates) { if (m_relative) { getYearlyRelativeDates(calendar, dates); } else { getYearlyAbsoluteDates(calendar, dates); } }
java
private void getYearlyDates(Calendar calendar, List<Date> dates) { if (m_relative) { getYearlyRelativeDates(calendar, dates); } else { getYearlyAbsoluteDates(calendar, dates); } }
[ "private", "void", "getYearlyDates", "(", "Calendar", "calendar", ",", "List", "<", "Date", ">", "dates", ")", "{", "if", "(", "m_relative", ")", "{", "getYearlyRelativeDates", "(", "calendar", ",", "dates", ")", ";", "}", "else", "{", "getYearlyAbsoluteDate...
Calculate start dates for a yearly recurrence. @param calendar current date @param dates array of start dates
[ "Calculate", "start", "dates", "for", "a", "yearly", "recurrence", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/RecurringData.java#L551-L561
VoltDB/voltdb
src/frontend/org/voltdb/client/ClientImpl.java
ClientImpl.callProcedure
@Override public final ClientResponse callProcedure(String procName, Object... parameters) throws IOException, NoConnectionsException, ProcCallException { return callProcedureWithClientTimeout(BatchTimeoutOverrideType.NO_TIMEOUT, false, procName, Distributer.USE_DEFAULT_CLIENT_TIMEOUT, TimeUnit.SECONDS, parameters); }
java
@Override public final ClientResponse callProcedure(String procName, Object... parameters) throws IOException, NoConnectionsException, ProcCallException { return callProcedureWithClientTimeout(BatchTimeoutOverrideType.NO_TIMEOUT, false, procName, Distributer.USE_DEFAULT_CLIENT_TIMEOUT, TimeUnit.SECONDS, parameters); }
[ "@", "Override", "public", "final", "ClientResponse", "callProcedure", "(", "String", "procName", ",", "Object", "...", "parameters", ")", "throws", "IOException", ",", "NoConnectionsException", ",", "ProcCallException", "{", "return", "callProcedureWithClientTimeout", ...
Synchronously invoke a procedure call blocking until a result is available. @param procName class name (not qualified by package) of the procedure to execute. @param parameters vararg list of procedure's parameter values. @return array of VoltTable results. @throws org.voltdb.client.ProcCallException @throws NoConnectionsException
[ "Synchronously", "invoke", "a", "procedure", "call", "blocking", "until", "a", "result", "is", "available", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/client/ClientImpl.java#L256-L262
demidenko05/beigesoft-bcommon
src/main/java/org/beigesoft/service/UtlReflection.java
UtlReflection.retrieveGetterForField
@Override public final Method retrieveGetterForField(final Class<?> pClazz, final String pFieldName) throws Exception { String getterName = "get" + pFieldName.substring(0, 1).toUpperCase() + pFieldName.substring(1); return retrieveMethod(pClazz, getterName); }
java
@Override public final Method retrieveGetterForField(final Class<?> pClazz, final String pFieldName) throws Exception { String getterName = "get" + pFieldName.substring(0, 1).toUpperCase() + pFieldName.substring(1); return retrieveMethod(pClazz, getterName); }
[ "@", "Override", "public", "final", "Method", "retrieveGetterForField", "(", "final", "Class", "<", "?", ">", "pClazz", ",", "final", "String", "pFieldName", ")", "throws", "Exception", "{", "String", "getterName", "=", "\"get\"", "+", "pFieldName", ".", "subs...
<p>Retrieve getter from given class by field name.</p> @param pClazz - class @param pFieldName - field name @return Method getter. @throws Exception if method not exist
[ "<p", ">", "Retrieve", "getter", "from", "given", "class", "by", "field", "name", ".", "<", "/", "p", ">" ]
train
https://github.com/demidenko05/beigesoft-bcommon/blob/bb446822b4fc9b5a6a8cd3cc98d0b3d83d718daf/src/main/java/org/beigesoft/service/UtlReflection.java#L140-L146
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/OffsetDateTime.java
OffsetDateTime.compareInstant
private static int compareInstant(OffsetDateTime datetime1, OffsetDateTime datetime2) { if (datetime1.getOffset().equals(datetime2.getOffset())) { return datetime1.toLocalDateTime().compareTo(datetime2.toLocalDateTime()); } int cmp = Long.compare(datetime1.toEpochSecond(), datetime2.toEpochSecond()); if (cmp == 0) { cmp = datetime1.toLocalTime().getNano() - datetime2.toLocalTime().getNano(); } return cmp; }
java
private static int compareInstant(OffsetDateTime datetime1, OffsetDateTime datetime2) { if (datetime1.getOffset().equals(datetime2.getOffset())) { return datetime1.toLocalDateTime().compareTo(datetime2.toLocalDateTime()); } int cmp = Long.compare(datetime1.toEpochSecond(), datetime2.toEpochSecond()); if (cmp == 0) { cmp = datetime1.toLocalTime().getNano() - datetime2.toLocalTime().getNano(); } return cmp; }
[ "private", "static", "int", "compareInstant", "(", "OffsetDateTime", "datetime1", ",", "OffsetDateTime", "datetime2", ")", "{", "if", "(", "datetime1", ".", "getOffset", "(", ")", ".", "equals", "(", "datetime2", ".", "getOffset", "(", ")", ")", ")", "{", ...
Compares this {@code OffsetDateTime} to another date-time. The comparison is based on the instant. @param datetime1 the first date-time to compare, not null @param datetime2 the other date-time to compare to, not null @return the comparator value, negative if less, positive if greater
[ "Compares", "this", "{", "@code", "OffsetDateTime", "}", "to", "another", "date", "-", "time", ".", "The", "comparison", "is", "based", "on", "the", "instant", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/OffsetDateTime.java#L167-L176
OpenLiberty/open-liberty
dev/com.ibm.websphere.security/src/com/ibm/wsspi/security/registry/RegistryHelper.java
RegistryHelper.getUserRegistry
public static UserRegistry getUserRegistry(String realmName) throws WSSecurityException { try { WSSecurityService ss = wsSecurityServiceRef.getService(); if (ss == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "No WSSecurityService, returning null"); } } else { return ss.getUserRegistry(realmName); } } catch (WSSecurityException e) { String msg = "getUserRegistry for realm " + realmName + " failed due to an internal error: " + e.getMessage(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, msg, e); } throw new WSSecurityException(msg, e); } return null; }
java
public static UserRegistry getUserRegistry(String realmName) throws WSSecurityException { try { WSSecurityService ss = wsSecurityServiceRef.getService(); if (ss == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "No WSSecurityService, returning null"); } } else { return ss.getUserRegistry(realmName); } } catch (WSSecurityException e) { String msg = "getUserRegistry for realm " + realmName + " failed due to an internal error: " + e.getMessage(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, msg, e); } throw new WSSecurityException(msg, e); } return null; }
[ "public", "static", "UserRegistry", "getUserRegistry", "(", "String", "realmName", ")", "throws", "WSSecurityException", "{", "try", "{", "WSSecurityService", "ss", "=", "wsSecurityServiceRef", ".", "getService", "(", ")", ";", "if", "(", "ss", "==", "null", ")"...
Gets the UserRegistry object for the given realm. If the realm name is null returns the active registry. If the realm is not valid, or security is not enabled, or no registry is configured, returns null. @param realmName @return UserRegistry object @throws WSSecurityException if there is an internal error
[ "Gets", "the", "UserRegistry", "object", "for", "the", "given", "realm", ".", "If", "the", "realm", "name", "is", "null", "returns", "the", "active", "registry", ".", "If", "the", "realm", "is", "not", "valid", "or", "security", "is", "not", "enabled", "...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.security/src/com/ibm/wsspi/security/registry/RegistryHelper.java#L63-L81
irmen/Pyrolite
java/src/main/java/net/razorvine/pickle/Pickler.java
Pickler.dump
public void dump(Object o, OutputStream stream) throws IOException, PickleException { out = stream; recurse = 0; if(useMemo) memo = new HashMap<Integer, Memo>(); out.write(Opcodes.PROTO); out.write(PROTOCOL); save(o); memo = null; // get rid of the memo table out.write(Opcodes.STOP); out.flush(); if(recurse!=0) // sanity check throw new PickleException("recursive structure error, please report this problem"); }
java
public void dump(Object o, OutputStream stream) throws IOException, PickleException { out = stream; recurse = 0; if(useMemo) memo = new HashMap<Integer, Memo>(); out.write(Opcodes.PROTO); out.write(PROTOCOL); save(o); memo = null; // get rid of the memo table out.write(Opcodes.STOP); out.flush(); if(recurse!=0) // sanity check throw new PickleException("recursive structure error, please report this problem"); }
[ "public", "void", "dump", "(", "Object", "o", ",", "OutputStream", "stream", ")", "throws", "IOException", ",", "PickleException", "{", "out", "=", "stream", ";", "recurse", "=", "0", ";", "if", "(", "useMemo", ")", "memo", "=", "new", "HashMap", "<", ...
Pickle a given object graph, writing the result to the output stream.
[ "Pickle", "a", "given", "object", "graph", "writing", "the", "result", "to", "the", "output", "stream", "." ]
train
https://github.com/irmen/Pyrolite/blob/060bc3c9069cd31560b6da4f67280736fb2cdf63/java/src/main/java/net/razorvine/pickle/Pickler.java#L156-L169
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java
SVGPath.relativeLineTo
public SVGPath relativeLineTo(double x, double y) { return append(PATH_LINE_TO_RELATIVE).append(x).append(y); }
java
public SVGPath relativeLineTo(double x, double y) { return append(PATH_LINE_TO_RELATIVE).append(x).append(y); }
[ "public", "SVGPath", "relativeLineTo", "(", "double", "x", ",", "double", "y", ")", "{", "return", "append", "(", "PATH_LINE_TO_RELATIVE", ")", ".", "append", "(", "x", ")", ".", "append", "(", "y", ")", ";", "}" ]
Draw a line to the given relative coordinates. @param x relative coordinates @param y relative coordinates @return path object, for compact syntax.
[ "Draw", "a", "line", "to", "the", "given", "relative", "coordinates", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java#L250-L252
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceWarehousePersistenceImpl.java
CommerceWarehousePersistenceImpl.findAll
@Override public List<CommerceWarehouse> findAll() { return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
java
@Override public List<CommerceWarehouse> findAll() { return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
[ "@", "Override", "public", "List", "<", "CommerceWarehouse", ">", "findAll", "(", ")", "{", "return", "findAll", "(", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ";", "}" ]
Returns all the commerce warehouses. @return the commerce warehouses
[ "Returns", "all", "the", "commerce", "warehouses", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceWarehousePersistenceImpl.java#L5397-L5400
JetBrains/xodus
vfs/src/main/java/jetbrains/exodus/vfs/VirtualFileSystem.java
VirtualFileSystem.writeFile
public OutputStream writeFile(@NotNull final Transaction txn, final long fileDescriptor) { return new VfsOutputStream(this, txn, fileDescriptor, null); }
java
public OutputStream writeFile(@NotNull final Transaction txn, final long fileDescriptor) { return new VfsOutputStream(this, txn, fileDescriptor, null); }
[ "public", "OutputStream", "writeFile", "(", "@", "NotNull", "final", "Transaction", "txn", ",", "final", "long", "fileDescriptor", ")", "{", "return", "new", "VfsOutputStream", "(", "this", ",", "txn", ",", "fileDescriptor", ",", "null", ")", ";", "}" ]
Returns {@linkplain OutputStream} to write the contents of the specified file from the beginning. Writing to the returned stream doesn't change the {@linkplain File}'s last modified time. @param txn {@linkplain Transaction} instance @param fileDescriptor file descriptor @return {@linkplain OutputStream} to write the contents of the specified file from the beginning @see #readFile(Transaction, File) @see #readFile(Transaction, long) @see #readFile(Transaction, File, long) @see #writeFile(Transaction, File) @see #writeFile(Transaction, File, long) @see #writeFile(Transaction, long, long) @see #appendFile(Transaction, File) @see #touchFile(Transaction, File) @see File#getDescriptor() @see File#getLastModified()
[ "Returns", "{", "@linkplain", "OutputStream", "}", "to", "write", "the", "contents", "of", "the", "specified", "file", "from", "the", "beginning", ".", "Writing", "to", "the", "returned", "stream", "doesn", "t", "change", "the", "{", "@linkplain", "File", "}...
train
https://github.com/JetBrains/xodus/blob/7b3476c4e81db66f9c7529148c761605cc8eea6d/vfs/src/main/java/jetbrains/exodus/vfs/VirtualFileSystem.java#L540-L542
aalmiray/Json-lib
src/main/java/net/sf/json/JsonConfig.java
JsonConfig.registerDefaultValueProcessor
public void registerDefaultValueProcessor( Class target, DefaultValueProcessor defaultValueProcessor ) { if( target != null && defaultValueProcessor != null ) { defaultValueMap.put( target, defaultValueProcessor ); } }
java
public void registerDefaultValueProcessor( Class target, DefaultValueProcessor defaultValueProcessor ) { if( target != null && defaultValueProcessor != null ) { defaultValueMap.put( target, defaultValueProcessor ); } }
[ "public", "void", "registerDefaultValueProcessor", "(", "Class", "target", ",", "DefaultValueProcessor", "defaultValueProcessor", ")", "{", "if", "(", "target", "!=", "null", "&&", "defaultValueProcessor", "!=", "null", ")", "{", "defaultValueMap", ".", "put", "(", ...
Registers a DefaultValueProcessor.<br> [Java -&gt; JSON] @param target the class to use as key @param defaultValueProcessor the processor to register
[ "Registers", "a", "DefaultValueProcessor", ".", "<br", ">", "[", "Java", "-", "&gt", ";", "JSON", "]" ]
train
https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/JsonConfig.java#L760-L764
chocotan/datepicker4j
src/main/java/io/loli/datepicker/DatePicker.java
DatePicker.dateTimePicker
public static void dateTimePicker(JTextField field, String format, DateFilter filter) { new DateTimePicker(field, format, filter); }
java
public static void dateTimePicker(JTextField field, String format, DateFilter filter) { new DateTimePicker(field, format, filter); }
[ "public", "static", "void", "dateTimePicker", "(", "JTextField", "field", ",", "String", "format", ",", "DateFilter", "filter", ")", "{", "new", "DateTimePicker", "(", "field", ",", "format", ",", "filter", ")", ";", "}" ]
Add a time picker to a text field with time format @param field the text field you want to add to @param format time format string @param filter to make some days unclickable
[ "Add", "a", "time", "picker", "to", "a", "text", "field", "with", "time", "format" ]
train
https://github.com/chocotan/datepicker4j/blob/d65d7a6b29f9efe77aeec2024dc31a38a7852676/src/main/java/io/loli/datepicker/DatePicker.java#L211-L214
alkacon/opencms-core
src/org/opencms/xml/CmsXmlContentTypeManager.java
CmsXmlContentTypeManager.getContentHandler
public I_CmsXmlContentHandler getContentHandler(String className, String schemaLocation) throws CmsXmlException { // create a unique key for the content deinition / class name combo StringBuffer buffer = new StringBuffer(128); buffer.append(schemaLocation); buffer.append('#'); buffer.append(className); String key = buffer.toString(); // look up the content handler from the cache I_CmsXmlContentHandler contentHandler = m_contentHandlers.get(key); if (contentHandler != null) { return contentHandler; } // generate an instance for the content handler try { contentHandler = (I_CmsXmlContentHandler)Class.forName(className).newInstance(); } catch (InstantiationException e) { throw new CmsXmlException(Messages.get().container(Messages.ERR_INVALID_CONTENT_HANDLER_1, key)); } catch (IllegalAccessException e) { throw new CmsXmlException(Messages.get().container(Messages.ERR_INVALID_CONTENT_HANDLER_1, key)); } catch (ClassCastException e) { throw new CmsXmlException(Messages.get().container(Messages.ERR_INVALID_CONTENT_HANDLER_1, key)); } catch (ClassNotFoundException e) { throw new CmsXmlException(Messages.get().container(Messages.ERR_INVALID_CONTENT_HANDLER_1, key)); } // cache and return the content handler instance m_contentHandlers.put(key, contentHandler); return contentHandler; }
java
public I_CmsXmlContentHandler getContentHandler(String className, String schemaLocation) throws CmsXmlException { // create a unique key for the content deinition / class name combo StringBuffer buffer = new StringBuffer(128); buffer.append(schemaLocation); buffer.append('#'); buffer.append(className); String key = buffer.toString(); // look up the content handler from the cache I_CmsXmlContentHandler contentHandler = m_contentHandlers.get(key); if (contentHandler != null) { return contentHandler; } // generate an instance for the content handler try { contentHandler = (I_CmsXmlContentHandler)Class.forName(className).newInstance(); } catch (InstantiationException e) { throw new CmsXmlException(Messages.get().container(Messages.ERR_INVALID_CONTENT_HANDLER_1, key)); } catch (IllegalAccessException e) { throw new CmsXmlException(Messages.get().container(Messages.ERR_INVALID_CONTENT_HANDLER_1, key)); } catch (ClassCastException e) { throw new CmsXmlException(Messages.get().container(Messages.ERR_INVALID_CONTENT_HANDLER_1, key)); } catch (ClassNotFoundException e) { throw new CmsXmlException(Messages.get().container(Messages.ERR_INVALID_CONTENT_HANDLER_1, key)); } // cache and return the content handler instance m_contentHandlers.put(key, contentHandler); return contentHandler; }
[ "public", "I_CmsXmlContentHandler", "getContentHandler", "(", "String", "className", ",", "String", "schemaLocation", ")", "throws", "CmsXmlException", "{", "// create a unique key for the content deinition / class name combo", "StringBuffer", "buffer", "=", "new", "StringBuffer"...
Returns the XML content handler instance class for the specified class name.<p> Only one instance of an XML content handler class per content definition name will be generated, and that instance will be cached and re-used for all operations.<p> @param className the name of the XML content handler to return @param schemaLocation the schema location of the XML content definition that handler belongs to @return the XML content handler class @throws CmsXmlException if something goes wrong
[ "Returns", "the", "XML", "content", "handler", "instance", "class", "for", "the", "specified", "class", "name", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/CmsXmlContentTypeManager.java#L283-L314
salesforce/Argus
ArgusSDK/src/main/java/com/salesforce/dva/argus/sdk/NamespaceService.java
NamespaceService.updateNamespaceMembers
public Namespace updateNamespaceMembers(BigInteger id, Set<String> users) throws IOException, TokenExpiredException { String requestUrl = RESOURCE + "/" + id.toString() + "/users"; ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.RequestType.PUT, requestUrl, users); assertValidResponse(response, requestUrl); return fromJson(response.getResult(), Namespace.class); }
java
public Namespace updateNamespaceMembers(BigInteger id, Set<String> users) throws IOException, TokenExpiredException { String requestUrl = RESOURCE + "/" + id.toString() + "/users"; ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.RequestType.PUT, requestUrl, users); assertValidResponse(response, requestUrl); return fromJson(response.getResult(), Namespace.class); }
[ "public", "Namespace", "updateNamespaceMembers", "(", "BigInteger", "id", ",", "Set", "<", "String", ">", "users", ")", "throws", "IOException", ",", "TokenExpiredException", "{", "String", "requestUrl", "=", "RESOURCE", "+", "\"/\"", "+", "id", ".", "toString",...
Updates a the members of a namespace. @param id The ID of the namespace to update. @param users The updated members of the namespace. @return The updated namespace. @throws IOException If the server cannot be reached. @throws TokenExpiredException If the token sent along with the request has expired
[ "Updates", "a", "the", "members", "of", "a", "namespace", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusSDK/src/main/java/com/salesforce/dva/argus/sdk/NamespaceService.java#L132-L138
apereo/cas
support/cas-server-support-gauth-couchdb/src/main/java/org/apereo/cas/couchdb/gauth/token/GoogleAuthenticatorTokenCouchDbRepository.java
GoogleAuthenticatorTokenCouchDbRepository.findByUserId
@View(name = "by_userId", map = "function(doc) { if(doc.token && doc.userId) { emit(doc.userId, doc) } }") public List<CouchDbGoogleAuthenticatorToken> findByUserId(final String userId) { return queryView("by_userId", userId); }
java
@View(name = "by_userId", map = "function(doc) { if(doc.token && doc.userId) { emit(doc.userId, doc) } }") public List<CouchDbGoogleAuthenticatorToken> findByUserId(final String userId) { return queryView("by_userId", userId); }
[ "@", "View", "(", "name", "=", "\"by_userId\"", ",", "map", "=", "\"function(doc) { if(doc.token && doc.userId) { emit(doc.userId, doc) } }\"", ")", "public", "List", "<", "CouchDbGoogleAuthenticatorToken", ">", "findByUserId", "(", "final", "String", "userId", ")", "{", ...
Find tokens by user id. @param userId user id to search for @return tokens belonging to use id
[ "Find", "tokens", "by", "user", "id", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-gauth-couchdb/src/main/java/org/apereo/cas/couchdb/gauth/token/GoogleAuthenticatorTokenCouchDbRepository.java#L57-L60
jcuda/jcuda
JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java
JCudaDriver.cuFuncSetBlockShape
@Deprecated public static int cuFuncSetBlockShape(CUfunction hfunc, int x, int y, int z) { return checkResult(cuFuncSetBlockShapeNative(hfunc, x, y, z)); }
java
@Deprecated public static int cuFuncSetBlockShape(CUfunction hfunc, int x, int y, int z) { return checkResult(cuFuncSetBlockShapeNative(hfunc, x, y, z)); }
[ "@", "Deprecated", "public", "static", "int", "cuFuncSetBlockShape", "(", "CUfunction", "hfunc", ",", "int", "x", ",", "int", "y", ",", "int", "z", ")", "{", "return", "checkResult", "(", "cuFuncSetBlockShapeNative", "(", "hfunc", ",", "x", ",", "y", ",", ...
Sets the block-dimensions for the function. <pre> CUresult cuFuncSetBlockShape ( CUfunction hfunc, int x, int y, int z ) </pre> <div> <p>Sets the block-dimensions for the function. Deprecated Specifies the <tt>x</tt>, <tt>y</tt>, and <tt>z</tt> dimensions of the thread blocks that are created when the kernel given by <tt>hfunc</tt> is launched. </p> <div> <span>Note:</span> <p>Note that this function may also return error codes from previous, asynchronous launches. </p> </div> </p> </div> @param hfunc Kernel to specify dimensions of @param x X dimension @param y Y dimension @param z Z dimension @return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_HANDLE, CUDA_ERROR_INVALID_VALUE @see JCudaDriver#cuFuncSetSharedSize @see JCudaDriver#cuFuncSetCacheConfig @see JCudaDriver#cuFuncGetAttribute @see JCudaDriver#cuParamSetSize @see JCudaDriver#cuParamSeti @see JCudaDriver#cuParamSetf @see JCudaDriver#cuParamSetv @see JCudaDriver#cuLaunch @see JCudaDriver#cuLaunchGrid @see JCudaDriver#cuLaunchGridAsync @see JCudaDriver#cuLaunchKernel @deprecated Deprecated in CUDA
[ "Sets", "the", "block", "-", "dimensions", "for", "the", "function", "." ]
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L8218-L8222
Alluxio/alluxio
underfs/kodo/src/main/java/alluxio/underfs/kodo/KodoClient.java
KodoClient.uploadFile
public void uploadFile(String Key, File File) throws QiniuException { com.qiniu.http.Response response = mUploadManager.put(File, Key, mAuth.uploadToken(mBucketName, Key)); response.close(); }
java
public void uploadFile(String Key, File File) throws QiniuException { com.qiniu.http.Response response = mUploadManager.put(File, Key, mAuth.uploadToken(mBucketName, Key)); response.close(); }
[ "public", "void", "uploadFile", "(", "String", "Key", ",", "File", "File", ")", "throws", "QiniuException", "{", "com", ".", "qiniu", ".", "http", ".", "Response", "response", "=", "mUploadManager", ".", "put", "(", "File", ",", "Key", ",", "mAuth", ".",...
Puts Object to Qiniu kodo. @param Key Object key for kodo @param File Alluxio File
[ "Puts", "Object", "to", "Qiniu", "kodo", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/underfs/kodo/src/main/java/alluxio/underfs/kodo/KodoClient.java#L133-L137
JoanZapata/android-pdfview
android-pdfview/src/main/java/com/joanzapata/pdfview/PDFView.java
PDFView.zoomCenteredTo
public void zoomCenteredTo(float zoom, PointF pivot) { float dzoom = zoom / this.zoom; zoomTo(zoom); float baseX = currentXOffset * dzoom; float baseY = currentYOffset * dzoom; baseX += (pivot.x - pivot.x * dzoom); baseY += (pivot.y - pivot.y * dzoom); moveTo(baseX, baseY); }
java
public void zoomCenteredTo(float zoom, PointF pivot) { float dzoom = zoom / this.zoom; zoomTo(zoom); float baseX = currentXOffset * dzoom; float baseY = currentYOffset * dzoom; baseX += (pivot.x - pivot.x * dzoom); baseY += (pivot.y - pivot.y * dzoom); moveTo(baseX, baseY); }
[ "public", "void", "zoomCenteredTo", "(", "float", "zoom", ",", "PointF", "pivot", ")", "{", "float", "dzoom", "=", "zoom", "/", "this", ".", "zoom", ";", "zoomTo", "(", "zoom", ")", ";", "float", "baseX", "=", "currentXOffset", "*", "dzoom", ";", "floa...
Change the zoom level, relatively to a pivot point. It will call moveTo() to make sure the given point stays in the middle of the screen. @param zoom The zoom level. @param pivot The point on the screen that should stays.
[ "Change", "the", "zoom", "level", "relatively", "to", "a", "pivot", "point", ".", "It", "will", "call", "moveTo", "()", "to", "make", "sure", "the", "given", "point", "stays", "in", "the", "middle", "of", "the", "screen", "." ]
train
https://github.com/JoanZapata/android-pdfview/blob/8f239bb91ab56ff3066739dc44bccf8b1753b0ba/android-pdfview/src/main/java/com/joanzapata/pdfview/PDFView.java#L897-L905
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WRadioButtonSelectRenderer.java
WRadioButtonSelectRenderer.paintAjax
private void paintAjax(final WRadioButtonSelect rbSelect, final XmlStringBuilder xml) { // Start tag xml.appendTagOpen("ui:ajaxtrigger"); xml.appendAttribute("triggerId", rbSelect.getId()); xml.appendClose(); // Target xml.appendTagOpen("ui:ajaxtargetid"); xml.appendAttribute("targetId", rbSelect.getAjaxTarget().getId()); xml.appendEnd(); // End tag xml.appendEndTag("ui:ajaxtrigger"); }
java
private void paintAjax(final WRadioButtonSelect rbSelect, final XmlStringBuilder xml) { // Start tag xml.appendTagOpen("ui:ajaxtrigger"); xml.appendAttribute("triggerId", rbSelect.getId()); xml.appendClose(); // Target xml.appendTagOpen("ui:ajaxtargetid"); xml.appendAttribute("targetId", rbSelect.getAjaxTarget().getId()); xml.appendEnd(); // End tag xml.appendEndTag("ui:ajaxtrigger"); }
[ "private", "void", "paintAjax", "(", "final", "WRadioButtonSelect", "rbSelect", ",", "final", "XmlStringBuilder", "xml", ")", "{", "// Start tag", "xml", ".", "appendTagOpen", "(", "\"ui:ajaxtrigger\"", ")", ";", "xml", ".", "appendAttribute", "(", "\"triggerId\"", ...
Paints the AJAX information for the given WRadioButtonSelect. @param rbSelect the WRadioButtonSelect to paint. @param xml the XmlStringBuilder to paint to.
[ "Paints", "the", "AJAX", "information", "for", "the", "given", "WRadioButtonSelect", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WRadioButtonSelectRenderer.java#L133-L146
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/spi/discovery/AbstractDiscoveryStrategy.java
AbstractDiscoveryStrategy.getOrDefault
protected <T extends Comparable> T getOrDefault(PropertyDefinition property, T defaultValue) { return getOrDefault(null, property, defaultValue); }
java
protected <T extends Comparable> T getOrDefault(PropertyDefinition property, T defaultValue) { return getOrDefault(null, property, defaultValue); }
[ "protected", "<", "T", "extends", "Comparable", ">", "T", "getOrDefault", "(", "PropertyDefinition", "property", ",", "T", "defaultValue", ")", "{", "return", "getOrDefault", "(", "null", ",", "property", ",", "defaultValue", ")", ";", "}" ]
Returns the value of the requested {@link PropertyDefinition} if available in the declarative or programmatic configuration (XML or Config API), otherwise it will return the given <tt>defaultValue</tt>. <p/> <b>This method overload won't do environment or JVM property lookup.</b> A call to this overload is equivalent to {@link #getOrDefault(String, PropertyDefinition, Comparable)} with <tt>null</tt> passed as the first parameter. @param property the PropertyDefinition to lookup @param <T> the type of the property, must be compatible with the conversion result of {@link PropertyDefinition#typeConverter()} @return the value of the given property if available in the configuration, otherwise the given default value
[ "Returns", "the", "value", "of", "the", "requested", "{", "@link", "PropertyDefinition", "}", "if", "available", "in", "the", "declarative", "or", "programmatic", "configuration", "(", "XML", "or", "Config", "API", ")", "otherwise", "it", "will", "return", "th...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/spi/discovery/AbstractDiscoveryStrategy.java#L143-L145
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/commitlog/CommitLogArchiver.java
CommitLogArchiver.maybeArchive
public void maybeArchive(final String path, final String name) { if (Strings.isNullOrEmpty(archiveCommand)) return; archivePending.put(name, executor.submit(new WrappedRunnable() { protected void runMayThrow() throws IOException { String command = archiveCommand.replace("%name", name); command = command.replace("%path", path); exec(command); } })); }
java
public void maybeArchive(final String path, final String name) { if (Strings.isNullOrEmpty(archiveCommand)) return; archivePending.put(name, executor.submit(new WrappedRunnable() { protected void runMayThrow() throws IOException { String command = archiveCommand.replace("%name", name); command = command.replace("%path", path); exec(command); } })); }
[ "public", "void", "maybeArchive", "(", "final", "String", "path", ",", "final", "String", "name", ")", "{", "if", "(", "Strings", ".", "isNullOrEmpty", "(", "archiveCommand", ")", ")", "return", ";", "archivePending", ".", "put", "(", "name", ",", "executo...
Differs from the above because it can be used on any file, rather than only managed commit log segments (and thus cannot call waitForFinalSync). Used to archive files present in the commit log directory at startup (CASSANDRA-6904)
[ "Differs", "from", "the", "above", "because", "it", "can", "be", "used", "on", "any", "file", "rather", "than", "only", "managed", "commit", "log", "segments", "(", "and", "thus", "cannot", "call", "waitForFinalSync", ")", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/commitlog/CommitLogArchiver.java#L144-L158
CodeNarc/CodeNarc
src/main/java/org/codenarc/util/AstUtil.java
AstUtil.isBinaryExpressionType
public static boolean isBinaryExpressionType(Expression expression, List<String> tokens) { if (expression instanceof BinaryExpression) { if (tokens.contains(((BinaryExpression) expression).getOperation().getText())) { return true; } } return false; }
java
public static boolean isBinaryExpressionType(Expression expression, List<String> tokens) { if (expression instanceof BinaryExpression) { if (tokens.contains(((BinaryExpression) expression).getOperation().getText())) { return true; } } return false; }
[ "public", "static", "boolean", "isBinaryExpressionType", "(", "Expression", "expression", ",", "List", "<", "String", ">", "tokens", ")", "{", "if", "(", "expression", "instanceof", "BinaryExpression", ")", "{", "if", "(", "tokens", ".", "contains", "(", "(", ...
Returns true if the expression is a binary expression with the specified token. @param expression - the expression node @param tokens - the List of allowable (operator) tokens @return as described
[ "Returns", "true", "if", "the", "expression", "is", "a", "binary", "expression", "with", "the", "specified", "token", "." ]
train
https://github.com/CodeNarc/CodeNarc/blob/9a7cec02cb8cbaf845030f2434309e8968f5d7a7/src/main/java/org/codenarc/util/AstUtil.java#L786-L793
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/GeoBackupPoliciesInner.java
GeoBackupPoliciesInner.createOrUpdate
public GeoBackupPolicyInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, GeoBackupPolicyState state) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, state).toBlocking().single().body(); }
java
public GeoBackupPolicyInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, GeoBackupPolicyState state) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, state).toBlocking().single().body(); }
[ "public", "GeoBackupPolicyInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ",", "GeoBackupPolicyState", "state", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ...
Updates a database geo backup policy. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database. @param state The state of the geo backup policy. Possible values include: 'Disabled', 'Enabled' @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the GeoBackupPolicyInner object if successful.
[ "Updates", "a", "database", "geo", "backup", "policy", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/GeoBackupPoliciesInner.java#L84-L86
OpenLiberty/open-liberty
dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLChannel.java
SSLChannel.createSSLHandshakeErrorTracker
private SSLHandshakeErrorTracker createSSLHandshakeErrorTracker(ChannelData inputData) { Map<Object, Object> bag = inputData.getPropertyBag(); // Even though they are of type Boolean and Long in the metatype, they are // going to be a String in the property bag (not sure why though). boolean suppressHandshakeError = SSLChannelConstants.DEFAULT_HANDSHAKE_FAILURE; Object value = bag.get(SSLChannelProvider.SSL_CFG_SUPPRESS_HANDSHAKE_ERRORS); if (value != null) { suppressHandshakeError = convertBooleanValue(value); } long maxLogEntries = SSLChannelConstants.DEFAULT_HANDSHAKE_FAILURE_STOP_LOGGING; value = bag.get(SSLChannelProvider.SSL_CFG_SUPPRESS_HANDSHAKE_ERRORS_COUNT); if (value != null) { maxLogEntries = convertLongValue(value); } return new SSLHandshakeErrorTracker(!suppressHandshakeError, maxLogEntries); }
java
private SSLHandshakeErrorTracker createSSLHandshakeErrorTracker(ChannelData inputData) { Map<Object, Object> bag = inputData.getPropertyBag(); // Even though they are of type Boolean and Long in the metatype, they are // going to be a String in the property bag (not sure why though). boolean suppressHandshakeError = SSLChannelConstants.DEFAULT_HANDSHAKE_FAILURE; Object value = bag.get(SSLChannelProvider.SSL_CFG_SUPPRESS_HANDSHAKE_ERRORS); if (value != null) { suppressHandshakeError = convertBooleanValue(value); } long maxLogEntries = SSLChannelConstants.DEFAULT_HANDSHAKE_FAILURE_STOP_LOGGING; value = bag.get(SSLChannelProvider.SSL_CFG_SUPPRESS_HANDSHAKE_ERRORS_COUNT); if (value != null) { maxLogEntries = convertLongValue(value); } return new SSLHandshakeErrorTracker(!suppressHandshakeError, maxLogEntries); }
[ "private", "SSLHandshakeErrorTracker", "createSSLHandshakeErrorTracker", "(", "ChannelData", "inputData", ")", "{", "Map", "<", "Object", ",", "Object", ">", "bag", "=", "inputData", ".", "getPropertyBag", "(", ")", ";", "// Even though they are of type Boolean and Long i...
Create an SSLHandshakeErrorTracker using the properties in the property bag. These properties may or may not be there if the channel is created programmatically, and as such this provides defaults which the map will be created with. These defaults should match the defaults from metatype. @param inputData
[ "Create", "an", "SSLHandshakeErrorTracker", "using", "the", "properties", "in", "the", "property", "bag", ".", "These", "properties", "may", "or", "may", "not", "be", "there", "if", "the", "channel", "is", "created", "programmatically", "and", "as", "such", "t...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLChannel.java#L149-L165
amzn/ion-java
src/com/amazon/ion/impl/IonWriterSystem.java
IonWriterSystem.setSymbolTable
@Override public final void setSymbolTable(SymbolTable symbols) throws IOException { if (symbols == null || _Private_Utils.symtabIsSharedNotSystem(symbols)) { throw new IllegalArgumentException("symbol table must be local or system to be set, or reset"); } if (getDepth() > 0) { throw new IllegalStateException("the symbol table cannot be set, or reset, while a container is open"); } _symbol_table = symbols; }
java
@Override public final void setSymbolTable(SymbolTable symbols) throws IOException { if (symbols == null || _Private_Utils.symtabIsSharedNotSystem(symbols)) { throw new IllegalArgumentException("symbol table must be local or system to be set, or reset"); } if (getDepth() > 0) { throw new IllegalStateException("the symbol table cannot be set, or reset, while a container is open"); } _symbol_table = symbols; }
[ "@", "Override", "public", "final", "void", "setSymbolTable", "(", "SymbolTable", "symbols", ")", "throws", "IOException", "{", "if", "(", "symbols", "==", "null", "||", "_Private_Utils", ".", "symtabIsSharedNotSystem", "(", "symbols", ")", ")", "{", "throw", ...
{@inheritDoc} <p> This implementation simply validates that the argument is not a shared symbol table, and assigns it to {@link #_symbol_table}.
[ "{" ]
train
https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/IonWriterSystem.java#L121-L132
Azure/azure-sdk-for-java
compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/SnapshotsInner.java
SnapshotsInner.beginCreateOrUpdateAsync
public Observable<SnapshotInner> beginCreateOrUpdateAsync(String resourceGroupName, String snapshotName, SnapshotInner snapshot) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, snapshotName, snapshot).map(new Func1<ServiceResponse<SnapshotInner>, SnapshotInner>() { @Override public SnapshotInner call(ServiceResponse<SnapshotInner> response) { return response.body(); } }); }
java
public Observable<SnapshotInner> beginCreateOrUpdateAsync(String resourceGroupName, String snapshotName, SnapshotInner snapshot) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, snapshotName, snapshot).map(new Func1<ServiceResponse<SnapshotInner>, SnapshotInner>() { @Override public SnapshotInner call(ServiceResponse<SnapshotInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "SnapshotInner", ">", "beginCreateOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "snapshotName", ",", "SnapshotInner", "snapshot", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", "...
Creates or updates a snapshot. @param resourceGroupName The name of the resource group. @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters. @param snapshot Snapshot object supplied in the body of the Put disk operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the SnapshotInner object
[ "Creates", "or", "updates", "a", "snapshot", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/SnapshotsInner.java#L248-L255
phax/ph-jaxb22-plugin
src/main/java/com/helger/jaxb22/plugin/PluginValueExtender.java
PluginValueExtender.run
@Override public boolean run (@Nonnull final Outline aOutline, @Nonnull final Options aOpts, @Nonnull final ErrorHandler aErrorHandler) { _addDefaultCtors (aOutline); final ICommonsMap <JClass, JType> aAllCtorClasses = _addValueCtors (aOutline); // Create all getters _addValueGetter (aOutline, aAllCtorClasses); return true; }
java
@Override public boolean run (@Nonnull final Outline aOutline, @Nonnull final Options aOpts, @Nonnull final ErrorHandler aErrorHandler) { _addDefaultCtors (aOutline); final ICommonsMap <JClass, JType> aAllCtorClasses = _addValueCtors (aOutline); // Create all getters _addValueGetter (aOutline, aAllCtorClasses); return true; }
[ "@", "Override", "public", "boolean", "run", "(", "@", "Nonnull", "final", "Outline", "aOutline", ",", "@", "Nonnull", "final", "Options", "aOpts", ",", "@", "Nonnull", "final", "ErrorHandler", "aErrorHandler", ")", "{", "_addDefaultCtors", "(", "aOutline", ")...
Main method to create methods for value: constructors, derived constructors, setter and getter. @param aOutline JAXB Outline @param aOpts Options @param aErrorHandler Error handler
[ "Main", "method", "to", "create", "methods", "for", "value", ":", "constructors", "derived", "constructors", "setter", "and", "getter", "." ]
train
https://github.com/phax/ph-jaxb22-plugin/blob/8f965b136ba54a2924d4c73ed2983c2fd0eb3daf/src/main/java/com/helger/jaxb22/plugin/PluginValueExtender.java#L417-L429
rjstanford/protea-http
src/main/java/cc/protea/util/http/Message.java
Message.setHeaders
@SuppressWarnings("unchecked") public T setHeaders(final Map<String, List<String>> headers) { this.headers = headers; return (T) this; }
java
@SuppressWarnings("unchecked") public T setHeaders(final Map<String, List<String>> headers) { this.headers = headers; return (T) this; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "T", "setHeaders", "(", "final", "Map", "<", "String", ",", "List", "<", "String", ">", ">", "headers", ")", "{", "this", ".", "headers", "=", "headers", ";", "return", "(", "T", ")", "this"...
Sets all of the headers in one call. @param headers A Map of headers, where the header name is a String, and the value is a List of one or more values. @return this Message, to support chained method calls
[ "Sets", "all", "of", "the", "headers", "in", "one", "call", "." ]
train
https://github.com/rjstanford/protea-http/blob/4d4a18805639181a738faff199e39d58337169ea/src/main/java/cc/protea/util/http/Message.java#L133-L137
apache/groovy
src/main/java/org/codehaus/groovy/runtime/memoize/StampedCommonCache.java
StampedCommonCache.doWithWriteLock
private <R> R doWithWriteLock(Action<K, V, R> action) { long stamp = sl.writeLock(); try { return action.doWith(commonCache); } finally { sl.unlockWrite(stamp); } }
java
private <R> R doWithWriteLock(Action<K, V, R> action) { long stamp = sl.writeLock(); try { return action.doWith(commonCache); } finally { sl.unlockWrite(stamp); } }
[ "private", "<", "R", ">", "R", "doWithWriteLock", "(", "Action", "<", "K", ",", "V", ",", "R", ">", "action", ")", "{", "long", "stamp", "=", "sl", ".", "writeLock", "(", ")", ";", "try", "{", "return", "action", ".", "doWith", "(", "commonCache", ...
deal with the backed cache guarded by write lock @param action the content to complete
[ "deal", "with", "the", "backed", "cache", "guarded", "by", "write", "lock" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/memoize/StampedCommonCache.java#L269-L276
xetorthio/jedis
src/main/java/redis/clients/jedis/BinaryJedis.java
BinaryJedis.sdiffstore
@Override public Long sdiffstore(final byte[] dstkey, final byte[]... keys) { checkIsInMultiOrPipeline(); client.sdiffstore(dstkey, keys); return client.getIntegerReply(); }
java
@Override public Long sdiffstore(final byte[] dstkey, final byte[]... keys) { checkIsInMultiOrPipeline(); client.sdiffstore(dstkey, keys); return client.getIntegerReply(); }
[ "@", "Override", "public", "Long", "sdiffstore", "(", "final", "byte", "[", "]", "dstkey", ",", "final", "byte", "[", "]", "...", "keys", ")", "{", "checkIsInMultiOrPipeline", "(", ")", ";", "client", ".", "sdiffstore", "(", "dstkey", ",", "keys", ")", ...
This command works exactly like {@link #sdiff(byte[]...) SDIFF} but instead of being returned the resulting set is stored in dstkey. @param dstkey @param keys @return Status code reply
[ "This", "command", "works", "exactly", "like", "{" ]
train
https://github.com/xetorthio/jedis/blob/ef4ab403f9d8fd88bd05092fea96de2e9db0bede/src/main/java/redis/clients/jedis/BinaryJedis.java#L1612-L1617
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/BaseField.java
BaseField.setupTableLookup
public ScreenComponent setupTableLookup(ScreenLoc itsLocation, ComponentParent targetScreen, int iDisplayFieldDesc, Rec record, String iQueryKeySeq, String iDisplayFieldSeq, boolean bIncludeFormButton) { return this.setupTableLookup(itsLocation, targetScreen, this, iDisplayFieldDesc, record, iQueryKeySeq, iDisplayFieldSeq, true, bIncludeFormButton); }
java
public ScreenComponent setupTableLookup(ScreenLoc itsLocation, ComponentParent targetScreen, int iDisplayFieldDesc, Rec record, String iQueryKeySeq, String iDisplayFieldSeq, boolean bIncludeFormButton) { return this.setupTableLookup(itsLocation, targetScreen, this, iDisplayFieldDesc, record, iQueryKeySeq, iDisplayFieldSeq, true, bIncludeFormButton); }
[ "public", "ScreenComponent", "setupTableLookup", "(", "ScreenLoc", "itsLocation", ",", "ComponentParent", "targetScreen", ",", "int", "iDisplayFieldDesc", ",", "Rec", "record", ",", "String", "iQueryKeySeq", ",", "String", "iDisplayFieldSeq", ",", "boolean", "bIncludeFo...
Same as setupTablePopup for larger files (that don't fit in a popup). @return Return the component or ScreenField that is created for this field.
[ "Same", "as", "setupTablePopup", "for", "larger", "files", "(", "that", "don", "t", "fit", "in", "a", "popup", ")", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/BaseField.java#L1254-L1257
modelmapper/modelmapper
core/src/main/java/org/modelmapper/internal/TypeInfoRegistry.java
TypeInfoRegistry.typeInfoFor
static <T> TypeInfoImpl<T> typeInfoFor(T source, Class<T> sourceType, InheritingConfiguration configuration) { if (configuration.valueAccessStore.getFirstSupportedReader(sourceType) != null) return new TypeInfoImpl<T>(source, sourceType, configuration); return typeInfoFor(sourceType, configuration); }
java
static <T> TypeInfoImpl<T> typeInfoFor(T source, Class<T> sourceType, InheritingConfiguration configuration) { if (configuration.valueAccessStore.getFirstSupportedReader(sourceType) != null) return new TypeInfoImpl<T>(source, sourceType, configuration); return typeInfoFor(sourceType, configuration); }
[ "static", "<", "T", ">", "TypeInfoImpl", "<", "T", ">", "typeInfoFor", "(", "T", "source", ",", "Class", "<", "T", ">", "sourceType", ",", "InheritingConfiguration", "configuration", ")", "{", "if", "(", "configuration", ".", "valueAccessStore", ".", "getFir...
Returns a non-cached TypeInfoImpl instance if there is no supported ValueAccessReader for the {@code sourceType}, else a cached TypeInfoImpl instance is returned.
[ "Returns", "a", "non", "-", "cached", "TypeInfoImpl", "instance", "if", "there", "is", "no", "supported", "ValueAccessReader", "for", "the", "{" ]
train
https://github.com/modelmapper/modelmapper/blob/491d165ded9dc9aba7ce8b56984249e1a1363204/core/src/main/java/org/modelmapper/internal/TypeInfoRegistry.java#L66-L71
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutParser.java
LayoutParser.parseDocument
public static Layout parseDocument(Document document) { return new Layout(instance.parseChildren(document, null, Tag.LAYOUT)); }
java
public static Layout parseDocument(Document document) { return new Layout(instance.parseChildren(document, null, Tag.LAYOUT)); }
[ "public", "static", "Layout", "parseDocument", "(", "Document", "document", ")", "{", "return", "new", "Layout", "(", "instance", ".", "parseChildren", "(", "document", ",", "null", ",", "Tag", ".", "LAYOUT", ")", ")", ";", "}" ]
Parse the layout from an XML document. @param document An XML document. @return The root layout element.
[ "Parse", "the", "layout", "from", "an", "XML", "document", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutParser.java#L150-L152
finmath/finmath-lib
src/main/java6/net/finmath/fouriermethod/products/AbstractProductFourierTransform.java
AbstractProductFourierTransform.getValue
public double getValue(ProcessCharacteristicFunctionInterface model) { final CharacteristicFunctionInterface modelCF = model.apply(getMaturity()); final CharacteristicFunctionInterface productCF = this; final double lineOfIntegration = 0.5 * getIntegrationDomainImagUpperBound()+getIntegrationDomainImagLowerBound(); DoubleUnaryOperator integrand = new DoubleUnaryOperator() { @Override public double applyAsDouble(double real) { Complex z = new Complex(real,lineOfIntegration); return modelCF.apply(z.negate()).multiply(productCF.apply(z)).getReal(); } }; RealIntegralInterface integrator = new SimpsonRealIntegrator(-100.0, 100.0, 20000, true); return integrator.integrate(integrand) / 2.0 / Math.PI; }
java
public double getValue(ProcessCharacteristicFunctionInterface model) { final CharacteristicFunctionInterface modelCF = model.apply(getMaturity()); final CharacteristicFunctionInterface productCF = this; final double lineOfIntegration = 0.5 * getIntegrationDomainImagUpperBound()+getIntegrationDomainImagLowerBound(); DoubleUnaryOperator integrand = new DoubleUnaryOperator() { @Override public double applyAsDouble(double real) { Complex z = new Complex(real,lineOfIntegration); return modelCF.apply(z.negate()).multiply(productCF.apply(z)).getReal(); } }; RealIntegralInterface integrator = new SimpsonRealIntegrator(-100.0, 100.0, 20000, true); return integrator.integrate(integrand) / 2.0 / Math.PI; }
[ "public", "double", "getValue", "(", "ProcessCharacteristicFunctionInterface", "model", ")", "{", "final", "CharacteristicFunctionInterface", "modelCF", "=", "model", ".", "apply", "(", "getMaturity", "(", ")", ")", ";", "final", "CharacteristicFunctionInterface", "prod...
This method returns the value random variable of the product within the specified model, evaluated at a given evalutationTime. Note: For a lattice this is often the value conditional to evalutationTime, for a Monte-Carlo simulation this is the (sum of) value discounted to evaluation time. Cashflows prior evaluationTime are not considered. @param model The model used to price the product. @return The random variable representing the value of the product discounted to evaluation time
[ "This", "method", "returns", "the", "value", "random", "variable", "of", "the", "product", "within", "the", "specified", "model", "evaluated", "at", "a", "given", "evalutationTime", ".", "Note", ":", "For", "a", "lattice", "this", "is", "often", "the", "valu...
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/fouriermethod/products/AbstractProductFourierTransform.java#L32-L49
grpc/grpc-java
core/src/main/java/io/grpc/internal/GrpcUtil.java
GrpcUtil.authorityToUri
public static URI authorityToUri(String authority) { Preconditions.checkNotNull(authority, "authority"); URI uri; try { uri = new URI(null, authority, null, null, null); } catch (URISyntaxException ex) { throw new IllegalArgumentException("Invalid authority: " + authority, ex); } return uri; }
java
public static URI authorityToUri(String authority) { Preconditions.checkNotNull(authority, "authority"); URI uri; try { uri = new URI(null, authority, null, null, null); } catch (URISyntaxException ex) { throw new IllegalArgumentException("Invalid authority: " + authority, ex); } return uri; }
[ "public", "static", "URI", "authorityToUri", "(", "String", "authority", ")", "{", "Preconditions", ".", "checkNotNull", "(", "authority", ",", "\"authority\"", ")", ";", "URI", "uri", ";", "try", "{", "uri", "=", "new", "URI", "(", "null", ",", "authority...
Parse an authority into a URI for retrieving the host and port.
[ "Parse", "an", "authority", "into", "a", "URI", "for", "retrieving", "the", "host", "and", "port", "." ]
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/GrpcUtil.java#L472-L481
thelinmichael/spotify-web-api-java
src/main/java/com/wrapper/spotify/SpotifyApi.java
SpotifyApi.addTracksToPlaylist
@Deprecated public AddTracksToPlaylistRequest.Builder addTracksToPlaylist(String user_id, String playlist_id, String[] uris) { return new AddTracksToPlaylistRequest.Builder(accessToken) .setDefaults(httpManager, scheme, host, port) .user_id(user_id) .playlist_id(playlist_id) .uris(concat(uris, ',')); }
java
@Deprecated public AddTracksToPlaylistRequest.Builder addTracksToPlaylist(String user_id, String playlist_id, String[] uris) { return new AddTracksToPlaylistRequest.Builder(accessToken) .setDefaults(httpManager, scheme, host, port) .user_id(user_id) .playlist_id(playlist_id) .uris(concat(uris, ',')); }
[ "@", "Deprecated", "public", "AddTracksToPlaylistRequest", ".", "Builder", "addTracksToPlaylist", "(", "String", "user_id", ",", "String", "playlist_id", ",", "String", "[", "]", "uris", ")", "{", "return", "new", "AddTracksToPlaylistRequest", ".", "Builder", "(", ...
Add tracks to a playlist. @deprecated Playlist IDs are unique for themselves. This parameter is thus no longer used. (https://developer.spotify.com/community/news/2018/06/12/changes-to-playlist-uris/) @param user_id The owners username. @param playlist_id The playlists ID. @param uris URIs of the tracks to add. Maximum: 100 track URIs. @return An {@link AddTracksToPlaylistRequest.Builder}. @see <a href="https://developer.spotify.com/web-api/user-guide/#spotify-uris-and-ids">Spotify: URLs &amp; IDs</a>
[ "Add", "tracks", "to", "a", "playlist", "." ]
train
https://github.com/thelinmichael/spotify-web-api-java/blob/c06b8512344c0310d0c1df362fa267879021da2e/src/main/java/com/wrapper/spotify/SpotifyApi.java#L1060-L1067
apache/incubator-druid
server/src/main/java/org/apache/druid/server/coordination/ChangeRequestHistory.java
ChangeRequestHistory.getRequestsSince
public synchronized ListenableFuture<ChangeRequestsSnapshot<T>> getRequestsSince(final Counter counter) { final CustomSettableFuture<T> future = new CustomSettableFuture<>(waitingFutures); if (counter.counter < 0) { future.setException(new IAE("counter[%s] must be >= 0", counter)); return future; } Counter lastCounter = getLastCounter(); if (counter.counter == lastCounter.counter) { if (!counter.matches(lastCounter)) { ChangeRequestsSnapshot<T> reset = ChangeRequestsSnapshot.fail( StringUtils.format("counter[%s] failed to match with [%s]", counter, lastCounter) ); future.set(reset); } else { synchronized (waitingFutures) { waitingFutures.put(future, counter); } } } else { try { future.set(getRequestsSinceWithoutWait(counter)); } catch (Exception ex) { future.setException(ex); } } return future; }
java
public synchronized ListenableFuture<ChangeRequestsSnapshot<T>> getRequestsSince(final Counter counter) { final CustomSettableFuture<T> future = new CustomSettableFuture<>(waitingFutures); if (counter.counter < 0) { future.setException(new IAE("counter[%s] must be >= 0", counter)); return future; } Counter lastCounter = getLastCounter(); if (counter.counter == lastCounter.counter) { if (!counter.matches(lastCounter)) { ChangeRequestsSnapshot<T> reset = ChangeRequestsSnapshot.fail( StringUtils.format("counter[%s] failed to match with [%s]", counter, lastCounter) ); future.set(reset); } else { synchronized (waitingFutures) { waitingFutures.put(future, counter); } } } else { try { future.set(getRequestsSinceWithoutWait(counter)); } catch (Exception ex) { future.setException(ex); } } return future; }
[ "public", "synchronized", "ListenableFuture", "<", "ChangeRequestsSnapshot", "<", "T", ">", ">", "getRequestsSince", "(", "final", "Counter", "counter", ")", "{", "final", "CustomSettableFuture", "<", "T", ">", "future", "=", "new", "CustomSettableFuture", "<>", "...
Returns a Future that, on completion, returns list of segment updates and associated counter. If there are no update since given counter then Future completion waits till an updates is provided. If counter is older than max number of changes maintained then {@link ChangeRequestsSnapshot} is returned with {@link ChangeRequestsSnapshot#resetCounter} set to True. If there were no updates to provide immediately then a future is created and returned to caller. This future is added to the "waitingFutures" list and all the futures in the list get resolved as soon as a segment update is provided.
[ "Returns", "a", "Future", "that", "on", "completion", "returns", "list", "of", "segment", "updates", "and", "associated", "counter", ".", "If", "there", "are", "no", "update", "since", "given", "counter", "then", "Future", "completion", "waits", "till", "an", ...
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/server/coordination/ChangeRequestHistory.java#L108-L140
jenkinsci/support-core-plugin
src/main/java/com/cloudbees/jenkins/support/util/WordReplacer.java
WordReplacer.replaceWords
public static void replaceWords(StringBuilder input, String[] words, String[] replaces) { replaceWords(input, words, replaces, false); }
java
public static void replaceWords(StringBuilder input, String[] words, String[] replaces) { replaceWords(input, words, replaces, false); }
[ "public", "static", "void", "replaceWords", "(", "StringBuilder", "input", ",", "String", "[", "]", "words", ",", "String", "[", "]", "replaces", ")", "{", "replaceWords", "(", "input", ",", "words", ",", "replaces", ",", "false", ")", ";", "}" ]
See {@link #replaceWords(String, String[], String[])} @param input the text where the replacements take place @param words the words to look for and replace @param replaces the new words to use
[ "See", "{" ]
train
https://github.com/jenkinsci/support-core-plugin/blob/bcbe1dfd5bf48ac89903645cd48ed897c1a04688/src/main/java/com/cloudbees/jenkins/support/util/WordReplacer.java#L40-L42
ReactiveX/RxNetty
rxnetty-common/src/main/java/io/reactivex/netty/events/ListenersHolder.java
ListenersHolder.invokeListeners
public void invokeListeners(Action3<T, Long, TimeUnit> invocationAction, long duration, TimeUnit timeUnit) { ListenerInvocationException exception = null; for (ListenerHolder<T> listener : listeners) { if (!listener.subscription.isUnsubscribed()) { try { invocationAction.call(listener.delegate, duration, timeUnit); } catch (Throwable e) { exception = handleListenerError(exception, listener, e); } } } if (null != exception) { exception.finish(); /*Do not bubble event notification errors to the caller, event notifications are best effort.*/ logger.error("Error occured while invoking event listeners.", exception); } }
java
public void invokeListeners(Action3<T, Long, TimeUnit> invocationAction, long duration, TimeUnit timeUnit) { ListenerInvocationException exception = null; for (ListenerHolder<T> listener : listeners) { if (!listener.subscription.isUnsubscribed()) { try { invocationAction.call(listener.delegate, duration, timeUnit); } catch (Throwable e) { exception = handleListenerError(exception, listener, e); } } } if (null != exception) { exception.finish(); /*Do not bubble event notification errors to the caller, event notifications are best effort.*/ logger.error("Error occured while invoking event listeners.", exception); } }
[ "public", "void", "invokeListeners", "(", "Action3", "<", "T", ",", "Long", ",", "TimeUnit", ">", "invocationAction", ",", "long", "duration", ",", "TimeUnit", "timeUnit", ")", "{", "ListenerInvocationException", "exception", "=", "null", ";", "for", "(", "Lis...
Invoke listeners with an action expressed by the passed {@code invocationAction}. This method does the necessary validations required for invoking a listener and also guards against a listener throwing exceptions on invocation. @param invocationAction The action to perform on all listeners. @param duration Duration. @param timeUnit Time unit for the duration.
[ "Invoke", "listeners", "with", "an", "action", "expressed", "by", "the", "passed", "{", "@code", "invocationAction", "}", ".", "This", "method", "does", "the", "necessary", "validations", "required", "for", "invoking", "a", "listener", "and", "also", "guards", ...
train
https://github.com/ReactiveX/RxNetty/blob/a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6/rxnetty-common/src/main/java/io/reactivex/netty/events/ListenersHolder.java#L134-L151
apache/incubator-gobblin
gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/metrics/kafka/PusherUtils.java
PusherUtils.getPusher
public static Pusher getPusher(String pusherClassName, String brokers, String topic, Optional<Config> config) { try { Class<?> pusherClass = Class.forName(pusherClassName); return (Pusher) GobblinConstructorUtils.invokeLongestConstructor(pusherClass, brokers, topic, config); } catch (ReflectiveOperationException e) { throw new RuntimeException("Could not instantiate kafka pusher", e); } }
java
public static Pusher getPusher(String pusherClassName, String brokers, String topic, Optional<Config> config) { try { Class<?> pusherClass = Class.forName(pusherClassName); return (Pusher) GobblinConstructorUtils.invokeLongestConstructor(pusherClass, brokers, topic, config); } catch (ReflectiveOperationException e) { throw new RuntimeException("Could not instantiate kafka pusher", e); } }
[ "public", "static", "Pusher", "getPusher", "(", "String", "pusherClassName", ",", "String", "brokers", ",", "String", "topic", ",", "Optional", "<", "Config", ">", "config", ")", "{", "try", "{", "Class", "<", "?", ">", "pusherClass", "=", "Class", ".", ...
Create a {@link Pusher} @param pusherClassName the {@link Pusher} class to instantiate @param brokers brokers to connect to @param topic the topic to write to @param config additional configuration for configuring the {@link Pusher} @return a {@link Pusher}
[ "Create", "a", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/metrics/kafka/PusherUtils.java#L38-L47
alkacon/opencms-core
src/org/opencms/site/CmsSiteManagerImpl.java
CmsSiteManagerImpl.getSiteTitle
public String getSiteTitle(CmsObject cms, CmsResource resource) throws CmsException { String title = cms.readPropertyObject(resource, CmsPropertyDefinition.PROPERTY_TITLE, false).getValue(); if (title == null) { title = resource.getRootPath(); } if (resource.getRootPath().equals(getSharedFolder())) { title = SHARED_FOLDER_TITLE; } return title; }
java
public String getSiteTitle(CmsObject cms, CmsResource resource) throws CmsException { String title = cms.readPropertyObject(resource, CmsPropertyDefinition.PROPERTY_TITLE, false).getValue(); if (title == null) { title = resource.getRootPath(); } if (resource.getRootPath().equals(getSharedFolder())) { title = SHARED_FOLDER_TITLE; } return title; }
[ "public", "String", "getSiteTitle", "(", "CmsObject", "cms", ",", "CmsResource", "resource", ")", "throws", "CmsException", "{", "String", "title", "=", "cms", ".", "readPropertyObject", "(", "resource", ",", "CmsPropertyDefinition", ".", "PROPERTY_TITLE", ",", "f...
Returns the site title.<p> @param cms the cms context @param resource the site root resource @return the title @throws CmsException in case reading the title property fails
[ "Returns", "the", "site", "title", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/site/CmsSiteManagerImpl.java#L992-L1002
OpenLiberty/open-liberty
dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/common/logging/LogUtils.java
LogUtils.getL7dLogger
public static Logger getL7dLogger(Class<?> cls, String resourcename, String loggerName) { return createLogger(cls, resourcename, loggerName); }
java
public static Logger getL7dLogger(Class<?> cls, String resourcename, String loggerName) { return createLogger(cls, resourcename, loggerName); }
[ "public", "static", "Logger", "getL7dLogger", "(", "Class", "<", "?", ">", "cls", ",", "String", "resourcename", ",", "String", "loggerName", ")", "{", "return", "createLogger", "(", "cls", ",", "resourcename", ",", "loggerName", ")", ";", "}" ]
Get a Logger with an associated resource bundle. @param cls the Class to contain the Logger (to find resources) @param resourcename the resource name @param loggerName the full name for the logger @return an appropriate Logger
[ "Get", "a", "Logger", "with", "an", "associated", "resource", "bundle", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/common/logging/LogUtils.java#L228-L232
alkacon/opencms-core
src/org/opencms/module/CmsModule.java
CmsModule.isEqual
private boolean isEqual(Object a, Object b) { if (a == null) { return (b == null); } if (b == null) { return false; } return a.equals(b); }
java
private boolean isEqual(Object a, Object b) { if (a == null) { return (b == null); } if (b == null) { return false; } return a.equals(b); }
[ "private", "boolean", "isEqual", "(", "Object", "a", ",", "Object", "b", ")", "{", "if", "(", "a", "==", "null", ")", "{", "return", "(", "b", "==", "null", ")", ";", "}", "if", "(", "b", "==", "null", ")", "{", "return", "false", ";", "}", "...
Checks if two objects are either both null, or equal.<p> @param a the first object to check @param b the second object to check @return true if the two object are either both null, or equal
[ "Checks", "if", "two", "objects", "are", "either", "both", "null", "or", "equal", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/module/CmsModule.java#L1790-L1799
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/subnet/SubnetClient.java
SubnetClient.modifySubnetAttributes
public void modifySubnetAttributes(String subnetId, String name) { ModifySubnetAttributesRequest request = new ModifySubnetAttributesRequest(); modifySubnetAttributes(request.withName(name).withSubnetId(subnetId)); }
java
public void modifySubnetAttributes(String subnetId, String name) { ModifySubnetAttributesRequest request = new ModifySubnetAttributesRequest(); modifySubnetAttributes(request.withName(name).withSubnetId(subnetId)); }
[ "public", "void", "modifySubnetAttributes", "(", "String", "subnetId", ",", "String", "name", ")", "{", "ModifySubnetAttributesRequest", "request", "=", "new", "ModifySubnetAttributesRequest", "(", ")", ";", "modifySubnetAttributes", "(", "request", ".", "withName", "...
Modifying the special attribute to new value of the subnet owned by the user. @param subnetId The id of the subnet @param name The name of the subnet after modifying
[ "Modifying", "the", "special", "attribute", "to", "new", "value", "of", "the", "subnet", "owned", "by", "the", "user", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/subnet/SubnetClient.java#L281-L284
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/ManagedBeanHome.java
ManagedBeanHome.createLocalBusinessObject
@Override public Object createLocalBusinessObject(int interfaceIndex, ManagedObjectContext context) throws RemoteException, CreateException { return createBusinessObject(null, false); }
java
@Override public Object createLocalBusinessObject(int interfaceIndex, ManagedObjectContext context) throws RemoteException, CreateException { return createBusinessObject(null, false); }
[ "@", "Override", "public", "Object", "createLocalBusinessObject", "(", "int", "interfaceIndex", ",", "ManagedObjectContext", "context", ")", "throws", "RemoteException", ",", "CreateException", "{", "return", "createBusinessObject", "(", "null", ",", "false", ")", ";"...
Method to create a local business reference object. Override EJSHome to ensure to handle managed beans properly. Use the createBusinessObject method specific to managed beans.
[ "Method", "to", "create", "a", "local", "business", "reference", "object", ".", "Override", "EJSHome", "to", "ensure", "to", "handle", "managed", "beans", "properly", ".", "Use", "the", "createBusinessObject", "method", "specific", "to", "managed", "beans", "." ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/ManagedBeanHome.java#L275-L281
infinispan/infinispan
core/src/main/java/org/infinispan/cache/impl/AbstractDelegatingCache.java
AbstractDelegatingCache.unwrapCache
public static <K, V> Cache<K, V> unwrapCache(Cache<K, V> cache) { if (cache instanceof AbstractDelegatingCache) { return unwrapCache(((AbstractDelegatingCache<K, V>) cache).getDelegate()); } return cache; }
java
public static <K, V> Cache<K, V> unwrapCache(Cache<K, V> cache) { if (cache instanceof AbstractDelegatingCache) { return unwrapCache(((AbstractDelegatingCache<K, V>) cache).getDelegate()); } return cache; }
[ "public", "static", "<", "K", ",", "V", ">", "Cache", "<", "K", ",", "V", ">", "unwrapCache", "(", "Cache", "<", "K", ",", "V", ">", "cache", ")", "{", "if", "(", "cache", "instanceof", "AbstractDelegatingCache", ")", "{", "return", "unwrapCache", "(...
Fully unwraps a given cache returning the base cache. Will unwrap all <b>AbstractDelegatingCache</b> wrappers. @param cache @param <K> @param <V> @return
[ "Fully", "unwraps", "a", "given", "cache", "returning", "the", "base", "cache", ".", "Will", "unwrap", "all", "<b", ">", "AbstractDelegatingCache<", "/", "b", ">", "wrappers", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/cache/impl/AbstractDelegatingCache.java#L634-L639
mapsforge/mapsforge
mapsforge-map/src/main/java/org/mapsforge/map/layer/cache/FileSystemTileCache.java
FileSystemTileCache.storeData
private void storeData(Job key, TileBitmap bitmap) { OutputStream outputStream = null; try { File file = getOutputFile(key); if (file == null) { // if the file cannot be written, silently return return; } outputStream = new FileOutputStream(file); bitmap.compress(outputStream); try { lock.writeLock().lock(); if (this.lruCache.put(key.getKey(), file) != null) { LOGGER.warning("overwriting cached entry: " + key.getKey()); } } finally { lock.writeLock().unlock(); } } catch (Exception e) { // we are catching now any exception and then disable the file cache // this should ensure that no exception in the storage thread will // ever crash the main app. If there is a runtime exception, the thread // will exit (via destroy). LOGGER.log(Level.SEVERE, "Disabling filesystem cache", e); // most likely cause is that the disk is full, just disable the // cache otherwise // more and more exceptions will be thrown. this.destroy(); try { lock.writeLock().lock(); this.lruCache = new FileWorkingSetCache<String>(0); } finally { lock.writeLock().unlock(); } } finally { IOUtils.closeQuietly(outputStream); } }
java
private void storeData(Job key, TileBitmap bitmap) { OutputStream outputStream = null; try { File file = getOutputFile(key); if (file == null) { // if the file cannot be written, silently return return; } outputStream = new FileOutputStream(file); bitmap.compress(outputStream); try { lock.writeLock().lock(); if (this.lruCache.put(key.getKey(), file) != null) { LOGGER.warning("overwriting cached entry: " + key.getKey()); } } finally { lock.writeLock().unlock(); } } catch (Exception e) { // we are catching now any exception and then disable the file cache // this should ensure that no exception in the storage thread will // ever crash the main app. If there is a runtime exception, the thread // will exit (via destroy). LOGGER.log(Level.SEVERE, "Disabling filesystem cache", e); // most likely cause is that the disk is full, just disable the // cache otherwise // more and more exceptions will be thrown. this.destroy(); try { lock.writeLock().lock(); this.lruCache = new FileWorkingSetCache<String>(0); } finally { lock.writeLock().unlock(); } } finally { IOUtils.closeQuietly(outputStream); } }
[ "private", "void", "storeData", "(", "Job", "key", ",", "TileBitmap", "bitmap", ")", "{", "OutputStream", "outputStream", "=", "null", ";", "try", "{", "File", "file", "=", "getOutputFile", "(", "key", ")", ";", "if", "(", "file", "==", "null", ")", "{...
stores the bitmap data on disk with filename key @param key filename @param bitmap tile image
[ "stores", "the", "bitmap", "data", "on", "disk", "with", "filename", "key" ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map/src/main/java/org/mapsforge/map/layer/cache/FileSystemTileCache.java#L387-L425
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/JobSchedulesInner.java
JobSchedulesInner.createAsync
public Observable<JobScheduleInner> createAsync(String resourceGroupName, String automationAccountName, UUID jobScheduleId, JobScheduleCreateParameters parameters) { return createWithServiceResponseAsync(resourceGroupName, automationAccountName, jobScheduleId, parameters).map(new Func1<ServiceResponse<JobScheduleInner>, JobScheduleInner>() { @Override public JobScheduleInner call(ServiceResponse<JobScheduleInner> response) { return response.body(); } }); }
java
public Observable<JobScheduleInner> createAsync(String resourceGroupName, String automationAccountName, UUID jobScheduleId, JobScheduleCreateParameters parameters) { return createWithServiceResponseAsync(resourceGroupName, automationAccountName, jobScheduleId, parameters).map(new Func1<ServiceResponse<JobScheduleInner>, JobScheduleInner>() { @Override public JobScheduleInner call(ServiceResponse<JobScheduleInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "JobScheduleInner", ">", "createAsync", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ",", "UUID", "jobScheduleId", ",", "JobScheduleCreateParameters", "parameters", ")", "{", "return", "createWithServiceResponseAsy...
Create a job schedule. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param jobScheduleId The job schedule name. @param parameters The parameters supplied to the create job schedule operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the JobScheduleInner object
[ "Create", "a", "job", "schedule", "." ]
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/JobSchedulesInner.java#L310-L317
looly/hutool
hutool-db/src/main/java/cn/hutool/db/SqlConnRunner.java
SqlConnRunner.find
public <T> T find(Connection conn, Collection<String> fields, Entity where, RsHandler<T> rsh) throws SQLException { final Query query = new Query(SqlUtil.buildConditions(where), where.getTableName()); query.setFields(fields); return find(conn, query, rsh); }
java
public <T> T find(Connection conn, Collection<String> fields, Entity where, RsHandler<T> rsh) throws SQLException { final Query query = new Query(SqlUtil.buildConditions(where), where.getTableName()); query.setFields(fields); return find(conn, query, rsh); }
[ "public", "<", "T", ">", "T", "find", "(", "Connection", "conn", ",", "Collection", "<", "String", ">", "fields", ",", "Entity", "where", ",", "RsHandler", "<", "T", ">", "rsh", ")", "throws", "SQLException", "{", "final", "Query", "query", "=", "new",...
查询<br> 此方法不会关闭Connection @param <T> 结果对象类型 @param conn 数据库连接对象 @param fields 返回的字段列表,null则返回所有字段 @param where 条件实体类(包含表名) @param rsh 结果集处理对象 @return 结果对象 @throws SQLException SQL执行异常
[ "查询<br", ">", "此方法不会关闭Connection" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/SqlConnRunner.java#L330-L334
sarl/sarl
contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java
PyGenerator._generate
protected void _generate(SarlAnnotationType annotation, IExtraLanguageGeneratorContext context) { final JvmDeclaredType jvmType = getJvmModelAssociations().getInferredType(annotation); final PyAppendable appendable = createAppendable(jvmType, context); if (generateTypeDeclaration( this.qualifiedNameProvider.getFullyQualifiedName(annotation).toString(), annotation.getName(), false, Collections.emptyList(), getTypeBuilder().getDocumentation(annotation), true, annotation.getMembers(), appendable, context, null)) { final QualifiedName name = getQualifiedNameProvider().getFullyQualifiedName(annotation); writeFile(name, appendable, context); } }
java
protected void _generate(SarlAnnotationType annotation, IExtraLanguageGeneratorContext context) { final JvmDeclaredType jvmType = getJvmModelAssociations().getInferredType(annotation); final PyAppendable appendable = createAppendable(jvmType, context); if (generateTypeDeclaration( this.qualifiedNameProvider.getFullyQualifiedName(annotation).toString(), annotation.getName(), false, Collections.emptyList(), getTypeBuilder().getDocumentation(annotation), true, annotation.getMembers(), appendable, context, null)) { final QualifiedName name = getQualifiedNameProvider().getFullyQualifiedName(annotation); writeFile(name, appendable, context); } }
[ "protected", "void", "_generate", "(", "SarlAnnotationType", "annotation", ",", "IExtraLanguageGeneratorContext", "context", ")", "{", "final", "JvmDeclaredType", "jvmType", "=", "getJvmModelAssociations", "(", ")", ".", "getInferredType", "(", "annotation", ")", ";", ...
Generate the given object. @param annotation the annotation. @param context the context.
[ "Generate", "the", "given", "object", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java#L725-L737
Azure/azure-sdk-for-java
authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleDefinitionsInner.java
RoleDefinitionsInner.createOrUpdateAsync
public Observable<RoleDefinitionInner> createOrUpdateAsync(String scope, String roleDefinitionId) { return createOrUpdateWithServiceResponseAsync(scope, roleDefinitionId).map(new Func1<ServiceResponse<RoleDefinitionInner>, RoleDefinitionInner>() { @Override public RoleDefinitionInner call(ServiceResponse<RoleDefinitionInner> response) { return response.body(); } }); }
java
public Observable<RoleDefinitionInner> createOrUpdateAsync(String scope, String roleDefinitionId) { return createOrUpdateWithServiceResponseAsync(scope, roleDefinitionId).map(new Func1<ServiceResponse<RoleDefinitionInner>, RoleDefinitionInner>() { @Override public RoleDefinitionInner call(ServiceResponse<RoleDefinitionInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "RoleDefinitionInner", ">", "createOrUpdateAsync", "(", "String", "scope", ",", "String", "roleDefinitionId", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "scope", ",", "roleDefinitionId", ")", ".", "map", "(", "new",...
Creates or updates a role definition. @param scope The scope of the role definition. @param roleDefinitionId The ID of the role definition. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the RoleDefinitionInner object
[ "Creates", "or", "updates", "a", "role", "definition", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleDefinitionsInner.java#L293-L300
glyptodon/guacamole-client
guacamole/src/main/java/org/apache/guacamole/extension/Extension.java
Extension.getListenerClass
@SuppressWarnings("unchecked") // We check this ourselves with isAssignableFrom() private Class<Listener> getListenerClass(String name) throws GuacamoleException { try { // Get listener class Class<?> listenerClass = classLoader.loadClass(name); // Verify the located class is actually a subclass of Listener if (!Listener.class.isAssignableFrom(listenerClass)) throw new GuacamoleServerException("Listeners MUST implement a Listener subclass."); // Return located class return (Class<Listener>) listenerClass; } catch (ClassNotFoundException e) { throw new GuacamoleException("Listener class not found.", e); } catch (LinkageError e) { throw new GuacamoleException("Listener class cannot be loaded (wrong version of API?).", e); } }
java
@SuppressWarnings("unchecked") // We check this ourselves with isAssignableFrom() private Class<Listener> getListenerClass(String name) throws GuacamoleException { try { // Get listener class Class<?> listenerClass = classLoader.loadClass(name); // Verify the located class is actually a subclass of Listener if (!Listener.class.isAssignableFrom(listenerClass)) throw new GuacamoleServerException("Listeners MUST implement a Listener subclass."); // Return located class return (Class<Listener>) listenerClass; } catch (ClassNotFoundException e) { throw new GuacamoleException("Listener class not found.", e); } catch (LinkageError e) { throw new GuacamoleException("Listener class cannot be loaded (wrong version of API?).", e); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "// We check this ourselves with isAssignableFrom()", "private", "Class", "<", "Listener", ">", "getListenerClass", "(", "String", "name", ")", "throws", "GuacamoleException", "{", "try", "{", "// Get listener class", "C...
Retrieve the Listener subclass having the given name. If the class having the given name does not exist or isn't actually a subclass of Listener, an exception will be thrown. @param name The name of the Listener class to retrieve. @return The subclass of Listener having the given name. @throws GuacamoleException If no such class exists, or if the class with the given name is not a subclass of Listener.
[ "Retrieve", "the", "Listener", "subclass", "having", "the", "given", "name", ".", "If", "the", "class", "having", "the", "given", "name", "does", "not", "exist", "or", "isn", "t", "actually", "a", "subclass", "of", "Listener", "an", "exception", "will", "b...
train
https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/guacamole/src/main/java/org/apache/guacamole/extension/Extension.java#L283-L307
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/authorization/providers/YamlProvider.java
YamlProvider.policiesFromSource
public static PolicyCollection policiesFromSource( final YamlSource source, final Set<Attribute> forcedContext ) throws IOException { return policiesFromSource(source, forcedContext, null); }
java
public static PolicyCollection policiesFromSource( final YamlSource source, final Set<Attribute> forcedContext ) throws IOException { return policiesFromSource(source, forcedContext, null); }
[ "public", "static", "PolicyCollection", "policiesFromSource", "(", "final", "YamlSource", "source", ",", "final", "Set", "<", "Attribute", ">", "forcedContext", ")", "throws", "IOException", "{", "return", "policiesFromSource", "(", "source", ",", "forcedContext", "...
Load policies from a source @param source source @param forcedContext Context to require for all policies parsed @return policies @throws IOException
[ "Load", "policies", "from", "a", "source" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/authorization/providers/YamlProvider.java#L153-L160
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/Where.java
Where.notIn
public Where<T, ID> notIn(String columnName, Iterable<?> objects) throws SQLException { addClause(new In(columnName, findColumnFieldType(columnName), objects, false)); return this; }
java
public Where<T, ID> notIn(String columnName, Iterable<?> objects) throws SQLException { addClause(new In(columnName, findColumnFieldType(columnName), objects, false)); return this; }
[ "public", "Where", "<", "T", ",", "ID", ">", "notIn", "(", "String", "columnName", ",", "Iterable", "<", "?", ">", "objects", ")", "throws", "SQLException", "{", "addClause", "(", "new", "In", "(", "columnName", ",", "findColumnFieldType", "(", "columnName...
Same as {@link #in(String, Iterable)} except with a NOT IN clause.
[ "Same", "as", "{" ]
train
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L226-L229
jenkinsci/github-plugin
src/main/java/org/jenkinsci/plugins/github/status/sources/ConditionalStatusResultSource.java
ConditionalStatusResultSource.get
@Override public StatusResult get(@Nonnull Run<?, ?> run, @Nonnull TaskListener listener) throws IOException, InterruptedException { for (ConditionalResult conditionalResult : getResults()) { if (conditionalResult.matches(run)) { return new StatusResult( defaultIfNull(EnumUtils.getEnum(GHCommitState.class, conditionalResult.getState()), ERROR), new ExpandableMessage(conditionalResult.getMessage()).expandAll(run, listener) ); } } return new StatusResult( PENDING, new ExpandableMessage("Can't define which status to set").expandAll(run, listener) ); }
java
@Override public StatusResult get(@Nonnull Run<?, ?> run, @Nonnull TaskListener listener) throws IOException, InterruptedException { for (ConditionalResult conditionalResult : getResults()) { if (conditionalResult.matches(run)) { return new StatusResult( defaultIfNull(EnumUtils.getEnum(GHCommitState.class, conditionalResult.getState()), ERROR), new ExpandableMessage(conditionalResult.getMessage()).expandAll(run, listener) ); } } return new StatusResult( PENDING, new ExpandableMessage("Can't define which status to set").expandAll(run, listener) ); }
[ "@", "Override", "public", "StatusResult", "get", "(", "@", "Nonnull", "Run", "<", "?", ",", "?", ">", "run", ",", "@", "Nonnull", "TaskListener", "listener", ")", "throws", "IOException", ",", "InterruptedException", "{", "for", "(", "ConditionalResult", "c...
First matching result win. Or will be used pending state. Messages are expanded with token macro and env variables @return first matched result or pending state with warn msg
[ "First", "matching", "result", "win", ".", "Or", "will", "be", "used", "pending", "state", ".", "Messages", "are", "expanded", "with", "token", "macro", "and", "env", "variables" ]
train
https://github.com/jenkinsci/github-plugin/blob/4e05b9aeb488af5342c78f78aa3c55114e8d462a/src/main/java/org/jenkinsci/plugins/github/status/sources/ConditionalStatusResultSource.java#L48-L65
webmetrics/browsermob-proxy
src/main/java/org/browsermob/proxy/jetty/util/ByteBufferOutputStream.java
ByteBufferOutputStream.postwrite
public void postwrite(byte[] b,int offset, int length) throws IOException { System.arraycopy(b,offset,_buf,_pos,length); _pos+=length; }
java
public void postwrite(byte[] b,int offset, int length) throws IOException { System.arraycopy(b,offset,_buf,_pos,length); _pos+=length; }
[ "public", "void", "postwrite", "(", "byte", "[", "]", "b", ",", "int", "offset", ",", "int", "length", ")", "throws", "IOException", "{", "System", ".", "arraycopy", "(", "b", ",", "offset", ",", "_buf", ",", "_pos", ",", "length", ")", ";", "_pos", ...
Write bytes into the postreserve. The capacity is not checked. @param b @param offset @param length @exception IOException
[ "Write", "bytes", "into", "the", "postreserve", ".", "The", "capacity", "is", "not", "checked", "." ]
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/util/ByteBufferOutputStream.java#L259-L264
SerhatSurguvec/SwipableLayout
app/src/main/java/com/serhatsurguvec/swipablelayoutdemo/Activity/SwipableActivity.java
SwipableActivity.addTransitionListener
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private boolean addTransitionListener(final ImageView imageView, final Item item) { final Transition transition = getWindow().getSharedElementEnterTransition(); if (transition != null) { // There is an entering shared element transition so add a listener to it transition.addListener(new Transition.TransitionListener() { @Override public void onTransitionEnd(Transition transition) { // As the transition has ended, we can now load the full-size image loadFullSizeImage(imageView, item); // Make sure we remove ourselves as a listener transition.removeListener(this); } @Override public void onTransitionStart(Transition transition) { // No-op } @Override public void onTransitionCancel(Transition transition) { // Make sure we remove ourselves as a listener transition.removeListener(this); } @Override public void onTransitionPause(Transition transition) { // No-op } @Override public void onTransitionResume(Transition transition) { // No-op } }); return true; } // If we reach here then we have not added a listener return false; }
java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private boolean addTransitionListener(final ImageView imageView, final Item item) { final Transition transition = getWindow().getSharedElementEnterTransition(); if (transition != null) { // There is an entering shared element transition so add a listener to it transition.addListener(new Transition.TransitionListener() { @Override public void onTransitionEnd(Transition transition) { // As the transition has ended, we can now load the full-size image loadFullSizeImage(imageView, item); // Make sure we remove ourselves as a listener transition.removeListener(this); } @Override public void onTransitionStart(Transition transition) { // No-op } @Override public void onTransitionCancel(Transition transition) { // Make sure we remove ourselves as a listener transition.removeListener(this); } @Override public void onTransitionPause(Transition transition) { // No-op } @Override public void onTransitionResume(Transition transition) { // No-op } }); return true; } // If we reach here then we have not added a listener return false; }
[ "@", "TargetApi", "(", "Build", ".", "VERSION_CODES", ".", "LOLLIPOP", ")", "private", "boolean", "addTransitionListener", "(", "final", "ImageView", "imageView", ",", "final", "Item", "item", ")", "{", "final", "Transition", "transition", "=", "getWindow", "(",...
Try and add a {@link Transition.TransitionListener} to the entering shared element {@link Transition}. We do this so that we can load the full-size image after the transition has completed. @param imageView @param item @return true if we were successful in adding a listener to the enter transition
[ "Try", "and", "add", "a", "{", "@link", "Transition", ".", "TransitionListener", "}", "to", "the", "entering", "shared", "element", "{", "@link", "Transition", "}", ".", "We", "do", "this", "so", "that", "we", "can", "load", "the", "full", "-", "size", ...
train
https://github.com/SerhatSurguvec/SwipableLayout/blob/3d7e3e9fe91c7a1e9584c2350ca3256d7487e7f1/app/src/main/java/com/serhatsurguvec/swipablelayoutdemo/Activity/SwipableActivity.java#L207-L249
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/authorization/BasicEnvironmentalContext.java
BasicEnvironmentalContext.staticContextFor
public static BasicEnvironmentalContext staticContextFor(String key, String value) { if (null == key) { throw new IllegalArgumentException("key cannot be null"); } if (null == value) { throw new IllegalArgumentException("value cannot be null"); } return new BasicEnvironmentalContext(key, value, null); }
java
public static BasicEnvironmentalContext staticContextFor(String key, String value) { if (null == key) { throw new IllegalArgumentException("key cannot be null"); } if (null == value) { throw new IllegalArgumentException("value cannot be null"); } return new BasicEnvironmentalContext(key, value, null); }
[ "public", "static", "BasicEnvironmentalContext", "staticContextFor", "(", "String", "key", ",", "String", "value", ")", "{", "if", "(", "null", "==", "key", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"key cannot be null\"", ")", ";", "}", "if",...
@param key key @param value value to use for equality match @return context with equality matching
[ "@param", "key", "key", "@param", "value", "value", "to", "use", "for", "equality", "match" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/authorization/BasicEnvironmentalContext.java#L71-L79
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPlot.java
SVGPlot.svgText
public Element svgText(double x, double y, String text) { return SVGUtil.svgText(document, x, y, text); }
java
public Element svgText(double x, double y, String text) { return SVGUtil.svgText(document, x, y, text); }
[ "public", "Element", "svgText", "(", "double", "x", ",", "double", "y", ",", "String", "text", ")", "{", "return", "SVGUtil", ".", "svgText", "(", "document", ",", "x", ",", "y", ",", "text", ")", ";", "}" ]
Create a SVG text element. @param x first point x @param y first point y @param text Content of text element. @return New text element.
[ "Create", "a", "SVG", "text", "element", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPlot.java#L291-L293
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsratecontrol.java
nsratecontrol.get
public static nsratecontrol get(nitro_service service, options option) throws Exception{ nsratecontrol obj = new nsratecontrol(); nsratecontrol[] response = (nsratecontrol[])obj.get_resources(service,option); return response[0]; }
java
public static nsratecontrol get(nitro_service service, options option) throws Exception{ nsratecontrol obj = new nsratecontrol(); nsratecontrol[] response = (nsratecontrol[])obj.get_resources(service,option); return response[0]; }
[ "public", "static", "nsratecontrol", "get", "(", "nitro_service", "service", ",", "options", "option", ")", "throws", "Exception", "{", "nsratecontrol", "obj", "=", "new", "nsratecontrol", "(", ")", ";", "nsratecontrol", "[", "]", "response", "=", "(", "nsrate...
Use this API to fetch all the nsratecontrol resources that are configured on netscaler.
[ "Use", "this", "API", "to", "fetch", "all", "the", "nsratecontrol", "resources", "that", "are", "configured", "on", "netscaler", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsratecontrol.java#L217-L221