repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
218
func_name
stringlengths
5
140
whole_func_string
stringlengths
79
3.99k
language
stringclasses
1 value
func_code_string
stringlengths
79
3.99k
func_code_tokens
listlengths
20
624
func_documentation_string
stringlengths
61
1.96k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
107
339
igniterealtime/Smack
smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java
AbstractXMPPConnection.populateHostAddresses
protected List<HostAddress> populateHostAddresses() { List<HostAddress> failedAddresses = new LinkedList<>(); if (config.hostAddress != null) { hostAddresses = new ArrayList<>(1); HostAddress hostAddress = new HostAddress(config.port, config.hostAddress); hostAddresses.add(hostAddress); } else if (config.host != null) { hostAddresses = new ArrayList<>(1); HostAddress hostAddress = DNSUtil.getDNSResolver().lookupHostAddress(config.host, config.port, failedAddresses, config.getDnssecMode()); if (hostAddress != null) { hostAddresses.add(hostAddress); } } else { // N.B.: Important to use config.serviceName and not AbstractXMPPConnection.serviceName DnsName dnsName = DnsName.from(config.getXMPPServiceDomain()); hostAddresses = DNSUtil.resolveXMPPServiceDomain(dnsName, failedAddresses, config.getDnssecMode()); } // Either the populated host addresses are not empty *or* there must be at least one failed address. assert (!hostAddresses.isEmpty() || !failedAddresses.isEmpty()); return failedAddresses; }
java
protected List<HostAddress> populateHostAddresses() { List<HostAddress> failedAddresses = new LinkedList<>(); if (config.hostAddress != null) { hostAddresses = new ArrayList<>(1); HostAddress hostAddress = new HostAddress(config.port, config.hostAddress); hostAddresses.add(hostAddress); } else if (config.host != null) { hostAddresses = new ArrayList<>(1); HostAddress hostAddress = DNSUtil.getDNSResolver().lookupHostAddress(config.host, config.port, failedAddresses, config.getDnssecMode()); if (hostAddress != null) { hostAddresses.add(hostAddress); } } else { // N.B.: Important to use config.serviceName and not AbstractXMPPConnection.serviceName DnsName dnsName = DnsName.from(config.getXMPPServiceDomain()); hostAddresses = DNSUtil.resolveXMPPServiceDomain(dnsName, failedAddresses, config.getDnssecMode()); } // Either the populated host addresses are not empty *or* there must be at least one failed address. assert (!hostAddresses.isEmpty() || !failedAddresses.isEmpty()); return failedAddresses; }
[ "protected", "List", "<", "HostAddress", ">", "populateHostAddresses", "(", ")", "{", "List", "<", "HostAddress", ">", "failedAddresses", "=", "new", "LinkedList", "<>", "(", ")", ";", "if", "(", "config", ".", "hostAddress", "!=", "null", ")", "{", "hostA...
Populates {@link #hostAddresses} with the resolved addresses or with the configured host address. If no host address was configured and all lookups failed, for example with NX_DOMAIN, then {@link #hostAddresses} will be populated with the empty list. @return a list of host addresses where DNS (SRV) RR resolution failed.
[ "Populates", "{", "@link", "#hostAddresses", "}", "with", "the", "resolved", "addresses", "or", "with", "the", "configured", "host", "address", ".", "If", "no", "host", "address", "was", "configured", "and", "all", "lookups", "failed", "for", "example", "with"...
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java#L731-L752
zxing/zxing
javase/src/main/java/com/google/zxing/client/j2se/MatrixToImageWriter.java
MatrixToImageWriter.writeToStream
public static void writeToStream(BitMatrix matrix, String format, OutputStream stream, MatrixToImageConfig config) throws IOException { BufferedImage image = toBufferedImage(matrix, config); if (!ImageIO.write(image, format, stream)) { throw new IOException("Could not write an image of format " + format); } }
java
public static void writeToStream(BitMatrix matrix, String format, OutputStream stream, MatrixToImageConfig config) throws IOException { BufferedImage image = toBufferedImage(matrix, config); if (!ImageIO.write(image, format, stream)) { throw new IOException("Could not write an image of format " + format); } }
[ "public", "static", "void", "writeToStream", "(", "BitMatrix", "matrix", ",", "String", "format", ",", "OutputStream", "stream", ",", "MatrixToImageConfig", "config", ")", "throws", "IOException", "{", "BufferedImage", "image", "=", "toBufferedImage", "(", "matrix",...
As {@link #writeToStream(BitMatrix, String, OutputStream)}, but allows customization of the output. @param matrix {@link BitMatrix} to write @param format image format @param stream {@link OutputStream} to write image to @param config output configuration @throws IOException if writes to the stream fail
[ "As", "{", "@link", "#writeToStream", "(", "BitMatrix", "String", "OutputStream", ")", "}", "but", "allows", "customization", "of", "the", "output", "." ]
train
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/javase/src/main/java/com/google/zxing/client/j2se/MatrixToImageWriter.java#L156-L162
elki-project/elki
elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/SLINK.java
SLINK.run
public PointerHierarchyRepresentationResult run(Database database, Relation<O> relation) { DBIDs ids = relation.getDBIDs(); WritableDBIDDataStore pi = DataStoreUtil.makeDBIDStorage(ids, DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_STATIC); WritableDoubleDataStore lambda = DataStoreUtil.makeDoubleStorage(ids, DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_STATIC, Double.POSITIVE_INFINITY); // Temporary storage for m. WritableDoubleDataStore m = DataStoreUtil.makeDoubleStorage(ids, DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_TEMP); final Logging log = getLogger(); // To allow CLINK logger override FiniteProgress progress = log.isVerbose() ? new FiniteProgress("Running SLINK", ids.size(), log) : null; ArrayDBIDs aids = DBIDUtil.ensureArray(ids); // First element is trivial/special: DBIDArrayIter id = aids.iter(), it = aids.iter(); // Step 1: initialize for(; id.valid(); id.advance()) { // P(n+1) = n+1: pi.put(id, id); // L(n+1) = infinity already. } // First element is finished already (start at seek(1) below!) log.incrementProcessed(progress); // Optimized branch if(getDistanceFunction() instanceof PrimitiveDistanceFunction) { PrimitiveDistanceFunction<? super O> distf = (PrimitiveDistanceFunction<? super O>) getDistanceFunction(); for(id.seek(1); id.valid(); id.advance()) { step2primitive(id, it, id.getOffset(), relation, distf, m); process(id, aids, it, id.getOffset(), pi, lambda, m); // SLINK or CLINK log.incrementProcessed(progress); } } else { // Fallback branch DistanceQuery<O> distQ = database.getDistanceQuery(relation, getDistanceFunction()); for(id.seek(1); id.valid(); id.advance()) { step2(id, it, id.getOffset(), distQ, m); process(id, aids, it, id.getOffset(), pi, lambda, m); // SLINK or CLINK log.incrementProcessed(progress); } } log.ensureCompleted(progress); // We don't need m anymore. m.destroy(); m = null; return new PointerHierarchyRepresentationResult(ids, pi, lambda, getDistanceFunction().isSquared()); }
java
public PointerHierarchyRepresentationResult run(Database database, Relation<O> relation) { DBIDs ids = relation.getDBIDs(); WritableDBIDDataStore pi = DataStoreUtil.makeDBIDStorage(ids, DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_STATIC); WritableDoubleDataStore lambda = DataStoreUtil.makeDoubleStorage(ids, DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_STATIC, Double.POSITIVE_INFINITY); // Temporary storage for m. WritableDoubleDataStore m = DataStoreUtil.makeDoubleStorage(ids, DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_TEMP); final Logging log = getLogger(); // To allow CLINK logger override FiniteProgress progress = log.isVerbose() ? new FiniteProgress("Running SLINK", ids.size(), log) : null; ArrayDBIDs aids = DBIDUtil.ensureArray(ids); // First element is trivial/special: DBIDArrayIter id = aids.iter(), it = aids.iter(); // Step 1: initialize for(; id.valid(); id.advance()) { // P(n+1) = n+1: pi.put(id, id); // L(n+1) = infinity already. } // First element is finished already (start at seek(1) below!) log.incrementProcessed(progress); // Optimized branch if(getDistanceFunction() instanceof PrimitiveDistanceFunction) { PrimitiveDistanceFunction<? super O> distf = (PrimitiveDistanceFunction<? super O>) getDistanceFunction(); for(id.seek(1); id.valid(); id.advance()) { step2primitive(id, it, id.getOffset(), relation, distf, m); process(id, aids, it, id.getOffset(), pi, lambda, m); // SLINK or CLINK log.incrementProcessed(progress); } } else { // Fallback branch DistanceQuery<O> distQ = database.getDistanceQuery(relation, getDistanceFunction()); for(id.seek(1); id.valid(); id.advance()) { step2(id, it, id.getOffset(), distQ, m); process(id, aids, it, id.getOffset(), pi, lambda, m); // SLINK or CLINK log.incrementProcessed(progress); } } log.ensureCompleted(progress); // We don't need m anymore. m.destroy(); m = null; return new PointerHierarchyRepresentationResult(ids, pi, lambda, getDistanceFunction().isSquared()); }
[ "public", "PointerHierarchyRepresentationResult", "run", "(", "Database", "database", ",", "Relation", "<", "O", ">", "relation", ")", "{", "DBIDs", "ids", "=", "relation", ".", "getDBIDs", "(", ")", ";", "WritableDBIDDataStore", "pi", "=", "DataStoreUtil", ".",...
Performs the SLINK algorithm on the given database. @param database Database to process @param relation Data relation to use
[ "Performs", "the", "SLINK", "algorithm", "on", "the", "given", "database", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/SLINK.java#L101-L149
googleapis/google-cloud-java
google-cloud-clients/google-cloud-talent/src/main/java/com/google/cloud/talent/v4beta1/JobServiceClient.java
JobServiceClient.batchDeleteJobs
public final void batchDeleteJobs(TenantOrProjectName parent, String filter) { BatchDeleteJobsRequest request = BatchDeleteJobsRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setFilter(filter) .build(); batchDeleteJobs(request); }
java
public final void batchDeleteJobs(TenantOrProjectName parent, String filter) { BatchDeleteJobsRequest request = BatchDeleteJobsRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setFilter(filter) .build(); batchDeleteJobs(request); }
[ "public", "final", "void", "batchDeleteJobs", "(", "TenantOrProjectName", "parent", ",", "String", "filter", ")", "{", "BatchDeleteJobsRequest", "request", "=", "BatchDeleteJobsRequest", ".", "newBuilder", "(", ")", ".", "setParent", "(", "parent", "==", "null", "...
Deletes a list of [Job][google.cloud.talent.v4beta1.Job]s by filter. <p>Sample code: <pre><code> try (JobServiceClient jobServiceClient = JobServiceClient.create()) { TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]"); String filter = ""; jobServiceClient.batchDeleteJobs(parent, filter); } </code></pre> @param parent Required. <p>The resource name of the tenant under which the job is created. <p>The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/api-test-project/tenant/foo". <p>Tenant id is optional and the default tenant is used if unspecified, for example, "projects/api-test-project". @param filter Required. <p>The filter string specifies the jobs to be deleted. <p>Supported operator: =, AND <p>The fields eligible for filtering are: <p>&#42; `companyName` (Required) &#42; `requisitionId` (Required) <p>Sample Query: companyName = "projects/api-test-project/companies/123" AND requisitionId = "req-1" @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Deletes", "a", "list", "of", "[", "Job", "]", "[", "google", ".", "cloud", ".", "talent", ".", "v4beta1", ".", "Job", "]", "s", "by", "filter", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-talent/src/main/java/com/google/cloud/talent/v4beta1/JobServiceClient.java#L763-L771
DV8FromTheWorld/JDA
src/main/java/net/dv8tion/jda/core/requests/RestAction.java
RestAction.queueAfter
public ScheduledFuture<?> queueAfter(long delay, TimeUnit unit, Consumer<? super T> success) { return queueAfter(delay, unit, success, api.get().getRateLimitPool()); }
java
public ScheduledFuture<?> queueAfter(long delay, TimeUnit unit, Consumer<? super T> success) { return queueAfter(delay, unit, success, api.get().getRateLimitPool()); }
[ "public", "ScheduledFuture", "<", "?", ">", "queueAfter", "(", "long", "delay", ",", "TimeUnit", "unit", ",", "Consumer", "<", "?", "super", "T", ">", "success", ")", "{", "return", "queueAfter", "(", "delay", ",", "unit", ",", "success", ",", "api", "...
Schedules a call to {@link #queue(java.util.function.Consumer)} to be executed after the specified {@code delay}. <br>This is an <b>asynchronous</b> operation that will return a {@link java.util.concurrent.ScheduledFuture ScheduledFuture} representing the task. <p>This operation gives no access to the failure callback. <br>Use {@link #queueAfter(long, java.util.concurrent.TimeUnit, java.util.function.Consumer, java.util.function.Consumer)} to access the failure consumer for {@link #queue(java.util.function.Consumer, java.util.function.Consumer)}! <p>The global JDA {@link java.util.concurrent.ScheduledExecutorService ScheduledExecutorService} is used for this operation. <br>You can change the core pool size for this Executor through {@link net.dv8tion.jda.core.JDABuilder#setCorePoolSize(int) JDABuilder.setCorePoolSize(int)} or provide your own Executor with {@link #queueAfter(long, java.util.concurrent.TimeUnit, java.util.function.Consumer, java.util.concurrent.ScheduledExecutorService)} @param delay The delay after which this computation should be executed, negative to execute immediately @param unit The {@link java.util.concurrent.TimeUnit TimeUnit} to convert the specified {@code delay} @param success The success {@link java.util.function.Consumer Consumer} that should be called once the {@link #queue(java.util.function.Consumer)} operation completes successfully. @throws java.lang.IllegalArgumentException If the provided TimeUnit is {@code null} @return {@link java.util.concurrent.ScheduledFuture ScheduledFuture} representing the delayed operation
[ "Schedules", "a", "call", "to", "{", "@link", "#queue", "(", "java", ".", "util", ".", "function", ".", "Consumer", ")", "}", "to", "be", "executed", "after", "the", "specified", "{", "@code", "delay", "}", ".", "<br", ">", "This", "is", "an", "<b", ...
train
https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/requests/RestAction.java#L598-L601
Azure/azure-sdk-for-java
storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/StorageAccountsInner.java
StorageAccountsInner.listServiceSAS
public ListServiceSasResponseInner listServiceSAS(String resourceGroupName, String accountName, ServiceSasParameters parameters) { return listServiceSASWithServiceResponseAsync(resourceGroupName, accountName, parameters).toBlocking().single().body(); }
java
public ListServiceSasResponseInner listServiceSAS(String resourceGroupName, String accountName, ServiceSasParameters parameters) { return listServiceSASWithServiceResponseAsync(resourceGroupName, accountName, parameters).toBlocking().single().body(); }
[ "public", "ListServiceSasResponseInner", "listServiceSAS", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "ServiceSasParameters", "parameters", ")", "{", "return", "listServiceSASWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ...
List service SAS credentials of a specific resource. @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. @param parameters The parameters to provide to list service SAS credentials. @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 ListServiceSasResponseInner object if successful.
[ "List", "service", "SAS", "credentials", "of", "a", "specific", "resource", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/StorageAccountsInner.java#L1109-L1111
SpoonLabs/gumtree-spoon-ast-diff
src/main/java/gumtree/spoon/builder/Json4SpoonGenerator.java
Json4SpoonGenerator.getJSONwithOperations
public JsonObject getJSONwithOperations(TreeContext context, ITree tree, List<Operation> operations) { OperationNodePainter opNodePainter = new OperationNodePainter(operations); Collection<NodePainter> painters = new ArrayList<NodePainter>(); painters.add(opNodePainter); return getJSONwithCustorLabels(context, tree, painters); }
java
public JsonObject getJSONwithOperations(TreeContext context, ITree tree, List<Operation> operations) { OperationNodePainter opNodePainter = new OperationNodePainter(operations); Collection<NodePainter> painters = new ArrayList<NodePainter>(); painters.add(opNodePainter); return getJSONwithCustorLabels(context, tree, painters); }
[ "public", "JsonObject", "getJSONwithOperations", "(", "TreeContext", "context", ",", "ITree", "tree", ",", "List", "<", "Operation", ">", "operations", ")", "{", "OperationNodePainter", "opNodePainter", "=", "new", "OperationNodePainter", "(", "operations", ")", ";"...
Decorates a node with the affected operator, if any. @param context @param tree @param operations @return
[ "Decorates", "a", "node", "with", "the", "affected", "operator", "if", "any", "." ]
train
https://github.com/SpoonLabs/gumtree-spoon-ast-diff/blob/361364ddaad3e8f0921a068275d4d21b6e836e85/src/main/java/gumtree/spoon/builder/Json4SpoonGenerator.java#L76-L82
ZuInnoTe/hadoopcryptoledger
hiveudf/src/main/java/org/zuinnote/hadoop/bitcoin/hive/udf/BitcoinTransactionHashUDF.java
BitcoinTransactionHashUDF.readListOfInputsFromTable
private List<BitcoinTransactionInput> readListOfInputsFromTable(ListObjectInspector loi, Object listOfInputsObject) { int listLength=loi.getListLength(listOfInputsObject); List<BitcoinTransactionInput> result = new ArrayList<>(listLength); StructObjectInspector listOfInputsElementObjectInspector = (StructObjectInspector)loi.getListElementObjectInspector(); for (int i=0;i<listLength;i++) { Object currentlistofinputsObject = loi.getListElement(listOfInputsObject,i); StructField prevtransactionhashSF = listOfInputsElementObjectInspector.getStructFieldRef("prevtransactionhash"); StructField previoustxoutindexSF = listOfInputsElementObjectInspector.getStructFieldRef("previoustxoutindex"); StructField txinscriptlengthSF = listOfInputsElementObjectInspector.getStructFieldRef("txinscriptlength"); StructField txinscriptSF = listOfInputsElementObjectInspector.getStructFieldRef("txinscript"); StructField seqnoSF = listOfInputsElementObjectInspector.getStructFieldRef("seqno"); boolean prevFieldsNull = (prevtransactionhashSF==null) || (previoustxoutindexSF==null); boolean inFieldsNull = (txinscriptlengthSF==null) || (txinscriptSF==null); boolean otherAttribNull = seqnoSF==null; if (prevFieldsNull || inFieldsNull || otherAttribNull) { LOG.warn("Invalid BitcoinTransactionInput detected at position "+i); return new ArrayList<>(); } byte[] currentPrevTransactionHash = wboi.getPrimitiveJavaObject(listOfInputsElementObjectInspector.getStructFieldData(currentlistofinputsObject,prevtransactionhashSF)); long currentPreviousTxOutIndex = wloi.get(listOfInputsElementObjectInspector.getStructFieldData(currentlistofinputsObject,previoustxoutindexSF)); byte[] currentTxInScriptLength= wboi.getPrimitiveJavaObject(listOfInputsElementObjectInspector.getStructFieldData(currentlistofinputsObject,txinscriptlengthSF)); byte[] currentTxInScript= wboi.getPrimitiveJavaObject(listOfInputsElementObjectInspector.getStructFieldData(currentlistofinputsObject,txinscriptSF)); long currentSeqNo = wloi.get(listOfInputsElementObjectInspector.getStructFieldData(currentlistofinputsObject,seqnoSF)); BitcoinTransactionInput currentBitcoinTransactionInput = new BitcoinTransactionInput(currentPrevTransactionHash,currentPreviousTxOutIndex,currentTxInScriptLength,currentTxInScript,currentSeqNo); result.add(currentBitcoinTransactionInput); } return result; }
java
private List<BitcoinTransactionInput> readListOfInputsFromTable(ListObjectInspector loi, Object listOfInputsObject) { int listLength=loi.getListLength(listOfInputsObject); List<BitcoinTransactionInput> result = new ArrayList<>(listLength); StructObjectInspector listOfInputsElementObjectInspector = (StructObjectInspector)loi.getListElementObjectInspector(); for (int i=0;i<listLength;i++) { Object currentlistofinputsObject = loi.getListElement(listOfInputsObject,i); StructField prevtransactionhashSF = listOfInputsElementObjectInspector.getStructFieldRef("prevtransactionhash"); StructField previoustxoutindexSF = listOfInputsElementObjectInspector.getStructFieldRef("previoustxoutindex"); StructField txinscriptlengthSF = listOfInputsElementObjectInspector.getStructFieldRef("txinscriptlength"); StructField txinscriptSF = listOfInputsElementObjectInspector.getStructFieldRef("txinscript"); StructField seqnoSF = listOfInputsElementObjectInspector.getStructFieldRef("seqno"); boolean prevFieldsNull = (prevtransactionhashSF==null) || (previoustxoutindexSF==null); boolean inFieldsNull = (txinscriptlengthSF==null) || (txinscriptSF==null); boolean otherAttribNull = seqnoSF==null; if (prevFieldsNull || inFieldsNull || otherAttribNull) { LOG.warn("Invalid BitcoinTransactionInput detected at position "+i); return new ArrayList<>(); } byte[] currentPrevTransactionHash = wboi.getPrimitiveJavaObject(listOfInputsElementObjectInspector.getStructFieldData(currentlistofinputsObject,prevtransactionhashSF)); long currentPreviousTxOutIndex = wloi.get(listOfInputsElementObjectInspector.getStructFieldData(currentlistofinputsObject,previoustxoutindexSF)); byte[] currentTxInScriptLength= wboi.getPrimitiveJavaObject(listOfInputsElementObjectInspector.getStructFieldData(currentlistofinputsObject,txinscriptlengthSF)); byte[] currentTxInScript= wboi.getPrimitiveJavaObject(listOfInputsElementObjectInspector.getStructFieldData(currentlistofinputsObject,txinscriptSF)); long currentSeqNo = wloi.get(listOfInputsElementObjectInspector.getStructFieldData(currentlistofinputsObject,seqnoSF)); BitcoinTransactionInput currentBitcoinTransactionInput = new BitcoinTransactionInput(currentPrevTransactionHash,currentPreviousTxOutIndex,currentTxInScriptLength,currentTxInScript,currentSeqNo); result.add(currentBitcoinTransactionInput); } return result; }
[ "private", "List", "<", "BitcoinTransactionInput", ">", "readListOfInputsFromTable", "(", "ListObjectInspector", "loi", ",", "Object", "listOfInputsObject", ")", "{", "int", "listLength", "=", "loi", ".", "getListLength", "(", "listOfInputsObject", ")", ";", "List", ...
Read list of Bitcoin transaction inputs from a table in Hive in any format (e.g. ORC, Parquet) @param loi ObjectInspector for processing the Object containing a list @param listOfInputsObject object containing the list of inputs to a Bitcoin Transaction @return a list of BitcoinTransactionInputs
[ "Read", "list", "of", "Bitcoin", "transaction", "inputs", "from", "a", "table", "in", "Hive", "in", "any", "format", "(", "e", ".", "g", ".", "ORC", "Parquet", ")" ]
train
https://github.com/ZuInnoTe/hadoopcryptoledger/blob/5c9bfb61dd1a82374cd0de8413a7c66391ee4414/hiveudf/src/main/java/org/zuinnote/hadoop/bitcoin/hive/udf/BitcoinTransactionHashUDF.java#L185-L212
brianwhu/xillium
data/src/main/java/org/xillium/data/DataBinder.java
DataBinder.putNamedObject
@SuppressWarnings("unchecked") public <T, V> T putNamedObject(String name, V object) { return (T)_named.put(name, object); }
java
@SuppressWarnings("unchecked") public <T, V> T putNamedObject(String name, V object) { return (T)_named.put(name, object); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ",", "V", ">", "T", "putNamedObject", "(", "String", "name", ",", "V", "object", ")", "{", "return", "(", "T", ")", "_named", ".", "put", "(", "name", ",", "object", ")", ";", ...
Puts a named object into this binder returning the original object under the name, if any.
[ "Puts", "a", "named", "object", "into", "this", "binder", "returning", "the", "original", "object", "under", "the", "name", "if", "any", "." ]
train
https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/data/src/main/java/org/xillium/data/DataBinder.java#L104-L107
mnlipp/jgrapes
org.jgrapes.core/src/org/jgrapes/core/internal/HandlerReference.java
HandlerReference.newRef
public static HandlerReference newRef( ComponentType component, Method method, int priority, HandlerScope filter) { if (handlerTracking.isLoggable(Level.FINE)) { return new VerboseHandlerReference( component, method, priority, filter); } else { return new HandlerReference(component, method, priority, filter); } }
java
public static HandlerReference newRef( ComponentType component, Method method, int priority, HandlerScope filter) { if (handlerTracking.isLoggable(Level.FINE)) { return new VerboseHandlerReference( component, method, priority, filter); } else { return new HandlerReference(component, method, priority, filter); } }
[ "public", "static", "HandlerReference", "newRef", "(", "ComponentType", "component", ",", "Method", "method", ",", "int", "priority", ",", "HandlerScope", "filter", ")", "{", "if", "(", "handlerTracking", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")",...
Create a new {@link HandlerReference} from the given values. @param component the component @param method the method @param priority the priority @param filter the filter @return the handler reference
[ "Create", "a", "new", "{", "@link", "HandlerReference", "}", "from", "the", "given", "values", "." ]
train
https://github.com/mnlipp/jgrapes/blob/8b5d874935d84c34a52d3e3d3745e869b5203fa0/org.jgrapes.core/src/org/jgrapes/core/internal/HandlerReference.java#L166-L175
hypfvieh/java-utils
src/main/java/com/github/hypfvieh/system/NativeLibraryLoader.java
NativeLibraryLoader.extractToTemp
private File extractToTemp(InputStream _fileToExtract, String _tmpName, String _fileSuffix) throws IOException { if (_fileToExtract == null) { throw new IOException("Null stream"); } File tempFile = File.createTempFile(_tmpName, _fileSuffix); tempFile.deleteOnExit(); if (!tempFile.exists()) { throw new FileNotFoundException("File " + tempFile.getAbsolutePath() + " could not be created"); } byte[] buffer = new byte[1024]; int readBytes; OutputStream os = new FileOutputStream(tempFile); try { while ((readBytes = _fileToExtract.read(buffer)) != -1) { os.write(buffer, 0, readBytes); } } finally { os.close(); _fileToExtract.close(); } return tempFile; }
java
private File extractToTemp(InputStream _fileToExtract, String _tmpName, String _fileSuffix) throws IOException { if (_fileToExtract == null) { throw new IOException("Null stream"); } File tempFile = File.createTempFile(_tmpName, _fileSuffix); tempFile.deleteOnExit(); if (!tempFile.exists()) { throw new FileNotFoundException("File " + tempFile.getAbsolutePath() + " could not be created"); } byte[] buffer = new byte[1024]; int readBytes; OutputStream os = new FileOutputStream(tempFile); try { while ((readBytes = _fileToExtract.read(buffer)) != -1) { os.write(buffer, 0, readBytes); } } finally { os.close(); _fileToExtract.close(); } return tempFile; }
[ "private", "File", "extractToTemp", "(", "InputStream", "_fileToExtract", ",", "String", "_tmpName", ",", "String", "_fileSuffix", ")", "throws", "IOException", "{", "if", "(", "_fileToExtract", "==", "null", ")", "{", "throw", "new", "IOException", "(", "\"Null...
Extract the file behind InputStream _fileToExtract to the tmp-folder. @param _fileToExtract InputStream with file to extract @param _tmpName temp file name @param _fileSuffix temp file suffix @return temp file object @throws IOException on any error
[ "Extract", "the", "file", "behind", "InputStream", "_fileToExtract", "to", "the", "tmp", "-", "folder", "." ]
train
https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/system/NativeLibraryLoader.java#L235-L259
pressgang-ccms/PressGangCCMSCommonUtilities
src/main/java/org/jboss/pressgang/ccms/utils/common/ExceptionUtilities.java
ExceptionUtilities.getStackTrace
public static String getStackTrace(final Throwable ex) { final StringWriter sw = new StringWriter(); final PrintWriter pw = new PrintWriter(sw, true); ex.printStackTrace(pw); pw.flush(); sw.flush(); return sw.toString(); }
java
public static String getStackTrace(final Throwable ex) { final StringWriter sw = new StringWriter(); final PrintWriter pw = new PrintWriter(sw, true); ex.printStackTrace(pw); pw.flush(); sw.flush(); return sw.toString(); }
[ "public", "static", "String", "getStackTrace", "(", "final", "Throwable", "ex", ")", "{", "final", "StringWriter", "sw", "=", "new", "StringWriter", "(", ")", ";", "final", "PrintWriter", "pw", "=", "new", "PrintWriter", "(", "sw", ",", "true", ")", ";", ...
A standard function to get the stack trace from a thrown Exception @param ex The thrown exception @return The stack trace from the exception
[ "A", "standard", "function", "to", "get", "the", "stack", "trace", "from", "a", "thrown", "Exception" ]
train
https://github.com/pressgang-ccms/PressGangCCMSCommonUtilities/blob/5ebf5ed30a94c34c33f4708caa04a8da99cbb15c/src/main/java/org/jboss/pressgang/ccms/utils/common/ExceptionUtilities.java#L33-L40
zaproxy/zaproxy
src/org/zaproxy/zap/utils/HarUtils.java
HarUtils.createHarEntry
public static HarEntry createHarEntry(HttpMessage httpMessage) { HarEntryTimings timings = new HarEntryTimings(0, 0, httpMessage.getTimeElapsedMillis()); return new HarEntry( new Date(httpMessage.getTimeSentMillis()), httpMessage.getTimeElapsedMillis(), createHarRequest(httpMessage), createHarResponse(httpMessage), new HarCache(), timings); }
java
public static HarEntry createHarEntry(HttpMessage httpMessage) { HarEntryTimings timings = new HarEntryTimings(0, 0, httpMessage.getTimeElapsedMillis()); return new HarEntry( new Date(httpMessage.getTimeSentMillis()), httpMessage.getTimeElapsedMillis(), createHarRequest(httpMessage), createHarResponse(httpMessage), new HarCache(), timings); }
[ "public", "static", "HarEntry", "createHarEntry", "(", "HttpMessage", "httpMessage", ")", "{", "HarEntryTimings", "timings", "=", "new", "HarEntryTimings", "(", "0", ",", "0", ",", "httpMessage", ".", "getTimeElapsedMillis", "(", ")", ")", ";", "return", "new", ...
Creates a {@code HarEntry} from the given message. @param httpMessage the HTTP message. @return the {@code HarEntry}, never {@code null}. @see #createHarEntry(int, int, HttpMessage) @see #createMessageHarCustomFields(int, int, String)
[ "Creates", "a", "{", "@code", "HarEntry", "}", "from", "the", "given", "message", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/utils/HarUtils.java#L177-L187
mikepenz/Android-Iconics
library-core/src/main/java/com/mikepenz/iconics/IconicsDrawable.java
IconicsDrawable.backgroundColorRes
@NonNull public IconicsDrawable backgroundColorRes(@ColorRes int colorResId) { return backgroundColor(ContextCompat.getColor(mContext, colorResId)); }
java
@NonNull public IconicsDrawable backgroundColorRes(@ColorRes int colorResId) { return backgroundColor(ContextCompat.getColor(mContext, colorResId)); }
[ "@", "NonNull", "public", "IconicsDrawable", "backgroundColorRes", "(", "@", "ColorRes", "int", "colorResId", ")", "{", "return", "backgroundColor", "(", "ContextCompat", ".", "getColor", "(", "mContext", ",", "colorResId", ")", ")", ";", "}" ]
Set background color from res. @return The current IconicsDrawable for chaining.
[ "Set", "background", "color", "from", "res", "." ]
train
https://github.com/mikepenz/Android-Iconics/blob/0b2c8f7d07b6d2715a417563c66311e7e1fcc7d8/library-core/src/main/java/com/mikepenz/iconics/IconicsDrawable.java#L839-L842
BrunoEberhard/minimal-j
src/main/java/org/minimalj/frontend/form/Form.java
Form.addDependecy
@SuppressWarnings("rawtypes") public <FROM, TO> void addDependecy(FROM from, PropertyUpdater<FROM, TO, T> updater, TO to) { PropertyInterface fromProperty = Keys.getProperty(from); if (!propertyUpdater.containsKey(fromProperty)) { propertyUpdater.put(fromProperty, new HashMap<PropertyInterface, PropertyUpdater>()); } PropertyInterface toProperty = Keys.getProperty(to); propertyUpdater.get(fromProperty).put(toProperty, updater); addDependecy(from, to); }
java
@SuppressWarnings("rawtypes") public <FROM, TO> void addDependecy(FROM from, PropertyUpdater<FROM, TO, T> updater, TO to) { PropertyInterface fromProperty = Keys.getProperty(from); if (!propertyUpdater.containsKey(fromProperty)) { propertyUpdater.put(fromProperty, new HashMap<PropertyInterface, PropertyUpdater>()); } PropertyInterface toProperty = Keys.getProperty(to); propertyUpdater.get(fromProperty).put(toProperty, updater); addDependecy(from, to); }
[ "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "public", "<", "FROM", ",", "TO", ">", "void", "addDependecy", "(", "FROM", "from", ",", "PropertyUpdater", "<", "FROM", ",", "TO", ",", "T", ">", "updater", ",", "TO", "to", ")", "{", "PropertyInterface...
Declares that if the key or property <i>from</i> changes the specified updater should be called and after its return the <i>to</i> key or property could have changed.<p> This is used if there is a more complex relation between two fields. @param <FROM> the type (class) of the fromKey / field @param <TO> the type (class) of the toKey / field @param from the field triggering the update @param updater the updater doing the change of the to field @param to the changed field by the updater
[ "Declares", "that", "if", "the", "key", "or", "property", "<i", ">", "from<", "/", "i", ">", "changes", "the", "specified", "updater", "should", "be", "called", "and", "after", "its", "return", "the", "<i", ">", "to<", "/", "i", ">", "key", "or", "pr...
train
https://github.com/BrunoEberhard/minimal-j/blob/f7c5461b2b47a10b383aee1e2f1f150f6773703b/src/main/java/org/minimalj/frontend/form/Form.java#L272-L281
dmak/jaxb-xew-plugin
src/main/java/com/sun/tools/xjc/addon/xew/CommonUtils.java
CommonUtils.copyFields
public static <S, D extends S> void copyFields(final S src, D dest) throws IllegalArgumentException { Class<?> targetClass = src.getClass(); do { Field[] fields = targetClass.getDeclaredFields(); for (Field field : fields) { // Skip static fields: if (Modifier.isStatic(field.getModifiers())) { continue; } try { if ((!Modifier.isPublic(field.getModifiers()) || !Modifier.isPublic(field.getDeclaringClass().getModifiers()) || Modifier.isFinal(field.getModifiers())) && !field.isAccessible()) { field.setAccessible(true); } Object srcValue = field.get(src); field.set(dest, srcValue); } catch (IllegalAccessException ex) { throw new IllegalStateException( "Shouldn't be illegal to access field '" + field.getName() + "': " + ex); } } targetClass = targetClass.getSuperclass(); } while (targetClass != null && targetClass != Object.class); }
java
public static <S, D extends S> void copyFields(final S src, D dest) throws IllegalArgumentException { Class<?> targetClass = src.getClass(); do { Field[] fields = targetClass.getDeclaredFields(); for (Field field : fields) { // Skip static fields: if (Modifier.isStatic(field.getModifiers())) { continue; } try { if ((!Modifier.isPublic(field.getModifiers()) || !Modifier.isPublic(field.getDeclaringClass().getModifiers()) || Modifier.isFinal(field.getModifiers())) && !field.isAccessible()) { field.setAccessible(true); } Object srcValue = field.get(src); field.set(dest, srcValue); } catch (IllegalAccessException ex) { throw new IllegalStateException( "Shouldn't be illegal to access field '" + field.getName() + "': " + ex); } } targetClass = targetClass.getSuperclass(); } while (targetClass != null && targetClass != Object.class); }
[ "public", "static", "<", "S", ",", "D", "extends", "S", ">", "void", "copyFields", "(", "final", "S", "src", ",", "D", "dest", ")", "throws", "IllegalArgumentException", "{", "Class", "<", "?", ">", "targetClass", "=", "src", ".", "getClass", "(", ")",...
Perform the copying of all fields from {@code src} to {@code dest}. The code was copied from {@code org.springframework.util.ReflectionUtils#shallowCopyFieldState(Object, Object)}.
[ "Perform", "the", "copying", "of", "all", "fields", "from", "{" ]
train
https://github.com/dmak/jaxb-xew-plugin/blob/d564d6bf8e50c46b056cdb4b46d1d4bee4adfbe3/src/main/java/com/sun/tools/xjc/addon/xew/CommonUtils.java#L209-L236
mikepenz/FastAdapter
library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/dialog/FastAdapterDialog.java
FastAdapterDialog.withPositiveButton
public FastAdapterDialog<Item> withPositiveButton(String text, OnClickListener listener) { return withButton(BUTTON_POSITIVE, text, listener); }
java
public FastAdapterDialog<Item> withPositiveButton(String text, OnClickListener listener) { return withButton(BUTTON_POSITIVE, text, listener); }
[ "public", "FastAdapterDialog", "<", "Item", ">", "withPositiveButton", "(", "String", "text", ",", "OnClickListener", "listener", ")", "{", "return", "withButton", "(", "BUTTON_POSITIVE", ",", "text", ",", "listener", ")", ";", "}" ]
Set a listener to be invoked when the positive button of the dialog is pressed. @param text The text to display in the positive button @param listener The {@link DialogInterface.OnClickListener} to use. @return This Builder object to allow for chaining of calls to set methods
[ "Set", "a", "listener", "to", "be", "invoked", "when", "the", "positive", "button", "of", "the", "dialog", "is", "pressed", "." ]
train
https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/dialog/FastAdapterDialog.java#L131-L133
facebookarchive/hadoop-20
src/contrib/benchmark/src/java/org/apache/hadoop/mapred/MapOutputCorrectness.java
MapOutputCorrectness.possiblyFail
private static void possiblyFail(float chanceFailure, Random random) { float value = random.nextFloat(); if (value < chanceFailure) { LOG.fatal("shouldFail: Failing with value " + value + " < " + chanceFailure); System.exit(-1); } }
java
private static void possiblyFail(float chanceFailure, Random random) { float value = random.nextFloat(); if (value < chanceFailure) { LOG.fatal("shouldFail: Failing with value " + value + " < " + chanceFailure); System.exit(-1); } }
[ "private", "static", "void", "possiblyFail", "(", "float", "chanceFailure", ",", "Random", "random", ")", "{", "float", "value", "=", "random", ".", "nextFloat", "(", ")", ";", "if", "(", "value", "<", "chanceFailure", ")", "{", "LOG", ".", "fatal", "(",...
Should fail? @param chanceFailure Chances of failure [0.0,1.0] @param random Pseudo-random variable
[ "Should", "fail?" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/benchmark/src/java/org/apache/hadoop/mapred/MapOutputCorrectness.java#L373-L380
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/ComparableExtensions.java
ComparableExtensions.operator_greaterEqualsThan
@Pure /* not guaranteed, since compareTo() is invoked */ @Inline("($1.compareTo($2) >= 0)") public static <C> boolean operator_greaterEqualsThan(Comparable<? super C> left, C right) { return left.compareTo(right) >= 0; }
java
@Pure /* not guaranteed, since compareTo() is invoked */ @Inline("($1.compareTo($2) >= 0)") public static <C> boolean operator_greaterEqualsThan(Comparable<? super C> left, C right) { return left.compareTo(right) >= 0; }
[ "@", "Pure", "/* not guaranteed, since compareTo() is invoked */", "@", "Inline", "(", "\"($1.compareTo($2) >= 0)\"", ")", "public", "static", "<", "C", ">", "boolean", "operator_greaterEqualsThan", "(", "Comparable", "<", "?", "super", "C", ">", "left", ",", "C", "...
The comparison operator <code>greater than or equals</code>. @param left a comparable @param right the value to compare with @return <code>left.compareTo(right) >= 0</code>
[ "The", "comparison", "operator", "<code", ">", "greater", "than", "or", "equals<", "/", "code", ">", "." ]
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/ComparableExtensions.java#L74-L78
blinkfox/zealot
src/main/java/com/blinkfox/zealot/core/Zealot.java
Zealot.buildSqlInfo
@SuppressWarnings("unchecked") public static SqlInfo buildSqlInfo(String nameSpace, SqlInfo sqlInfo, Node node, Object paramObj) { // 获取所有子节点,并分别将其使用StringBuilder拼接起来 List<Node> nodes = node.selectNodes(ZealotConst.ATTR_CHILD); for (Node n: nodes) { if (ZealotConst.NODETYPE_TEXT.equals(n.getNodeTypeName())) { // 如果子节点node 是文本节点,则直接获取其文本 sqlInfo.getJoin().append(n.getText()); } else if (ZealotConst.NODETYPE_ELEMENT.equals(n.getNodeTypeName())) { // 如果子节点node 是元素节点,则再判断其是什么元素,动态判断条件和参数 ConditContext.buildSqlInfo(new BuildSource(nameSpace, sqlInfo, n, paramObj), n.getName()); } } return buildFinalSql(sqlInfo, paramObj); }
java
@SuppressWarnings("unchecked") public static SqlInfo buildSqlInfo(String nameSpace, SqlInfo sqlInfo, Node node, Object paramObj) { // 获取所有子节点,并分别将其使用StringBuilder拼接起来 List<Node> nodes = node.selectNodes(ZealotConst.ATTR_CHILD); for (Node n: nodes) { if (ZealotConst.NODETYPE_TEXT.equals(n.getNodeTypeName())) { // 如果子节点node 是文本节点,则直接获取其文本 sqlInfo.getJoin().append(n.getText()); } else if (ZealotConst.NODETYPE_ELEMENT.equals(n.getNodeTypeName())) { // 如果子节点node 是元素节点,则再判断其是什么元素,动态判断条件和参数 ConditContext.buildSqlInfo(new BuildSource(nameSpace, sqlInfo, n, paramObj), n.getName()); } } return buildFinalSql(sqlInfo, paramObj); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "SqlInfo", "buildSqlInfo", "(", "String", "nameSpace", ",", "SqlInfo", "sqlInfo", ",", "Node", "node", ",", "Object", "paramObj", ")", "{", "// 获取所有子节点,并分别将其使用StringBuilder拼接起来", "List", "<", ...
构建完整的SqlInfo对象. @param nameSpace xml命名空间 @param sqlInfo SqlInfo对象 @param node dom4j对象节点 @param paramObj 参数对象 @return 返回SqlInfo对象
[ "构建完整的SqlInfo对象", "." ]
train
https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/Zealot.java#L107-L122
kuali/ojb-1.0.4
src/xdoclet/java/src/xdoclet/modules/ojb/OjbTagsHandler.java
OjbTagsHandler.ifHasProperty
public void ifHasProperty(String template, Properties attributes) throws XDocletException { String value = getPropertyValue(attributes.getProperty(ATTRIBUTE_LEVEL), attributes.getProperty(ATTRIBUTE_NAME)); if (value != null) { generate(template); } }
java
public void ifHasProperty(String template, Properties attributes) throws XDocletException { String value = getPropertyValue(attributes.getProperty(ATTRIBUTE_LEVEL), attributes.getProperty(ATTRIBUTE_NAME)); if (value != null) { generate(template); } }
[ "public", "void", "ifHasProperty", "(", "String", "template", ",", "Properties", "attributes", ")", "throws", "XDocletException", "{", "String", "value", "=", "getPropertyValue", "(", "attributes", ".", "getProperty", "(", "ATTRIBUTE_LEVEL", ")", ",", "attributes", ...
Determines whether the current object on the specified level has a specific property, and if so, processes the template @param template The template @param attributes The attributes of the tag @exception XDocletException If an error occurs @doc.tag type="block" @doc.param name="level" optional="false" description="The level for the current object" values="class,field,reference,collection" @doc.param name="name" optional="false" description="The name of the property"
[ "Determines", "whether", "the", "current", "object", "on", "the", "specified", "level", "has", "a", "specific", "property", "and", "if", "so", "processes", "the", "template" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/OjbTagsHandler.java#L1490-L1498
pravega/pravega
segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/BookKeeperLog.java
BookKeeperLog.handleWriteException
private void handleWriteException(int responseCode, Write write) { assert responseCode != BKException.Code.OK : "cannot handle an exception when responseCode == " + BKException.Code.OK; Exception ex = BKException.create(responseCode); try { if (ex instanceof BKException.BKLedgerFencedException) { // We were fenced out. ex = new DataLogWriterNotPrimaryException("BookKeeperLog is not primary anymore.", ex); } else if (ex instanceof BKException.BKNotEnoughBookiesException) { // Insufficient Bookies to complete the operation. This is a retryable exception. ex = new DataLogNotAvailableException("BookKeeperLog is not available.", ex); } else if (ex instanceof BKException.BKLedgerClosedException) { // LedgerClosed can happen because we just rolled over the ledgers or because BookKeeper closed a ledger // due to some error. In either case, this is a retryable exception. ex = new WriteFailureException("Active Ledger is closed.", ex); } else if (ex instanceof BKException.BKWriteException) { // Write-related failure or current Ledger closed. This is a retryable exception. ex = new WriteFailureException("Unable to write to active Ledger.", ex); } else if (ex instanceof BKException.BKClientClosedException) { // The BookKeeper client was closed externally. We cannot restart it here. We should close. ex = new ObjectClosedException(this, ex); } else { // All the other kind of exceptions go in the same bucket. ex = new DurableDataLogException("General exception while accessing BookKeeper.", ex); } } finally { write.fail(ex, !isRetryable(ex)); } }
java
private void handleWriteException(int responseCode, Write write) { assert responseCode != BKException.Code.OK : "cannot handle an exception when responseCode == " + BKException.Code.OK; Exception ex = BKException.create(responseCode); try { if (ex instanceof BKException.BKLedgerFencedException) { // We were fenced out. ex = new DataLogWriterNotPrimaryException("BookKeeperLog is not primary anymore.", ex); } else if (ex instanceof BKException.BKNotEnoughBookiesException) { // Insufficient Bookies to complete the operation. This is a retryable exception. ex = new DataLogNotAvailableException("BookKeeperLog is not available.", ex); } else if (ex instanceof BKException.BKLedgerClosedException) { // LedgerClosed can happen because we just rolled over the ledgers or because BookKeeper closed a ledger // due to some error. In either case, this is a retryable exception. ex = new WriteFailureException("Active Ledger is closed.", ex); } else if (ex instanceof BKException.BKWriteException) { // Write-related failure or current Ledger closed. This is a retryable exception. ex = new WriteFailureException("Unable to write to active Ledger.", ex); } else if (ex instanceof BKException.BKClientClosedException) { // The BookKeeper client was closed externally. We cannot restart it here. We should close. ex = new ObjectClosedException(this, ex); } else { // All the other kind of exceptions go in the same bucket. ex = new DurableDataLogException("General exception while accessing BookKeeper.", ex); } } finally { write.fail(ex, !isRetryable(ex)); } }
[ "private", "void", "handleWriteException", "(", "int", "responseCode", ",", "Write", "write", ")", "{", "assert", "responseCode", "!=", "BKException", ".", "Code", ".", "OK", ":", "\"cannot handle an exception when responseCode == \"", "+", "BKException", ".", "Code",...
Handles an exception after a Write operation, converts it to a Pravega Exception and completes the given future exceptionally using it. @param responseCode The BookKeeper response code to interpret. @param write The Write that failed.
[ "Handles", "an", "exception", "after", "a", "Write", "operation", "converts", "it", "to", "a", "Pravega", "Exception", "and", "completes", "the", "given", "future", "exceptionally", "using", "it", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/BookKeeperLog.java#L616-L643
Azure/azure-sdk-for-java
eventhubs/data-plane/azure-eventhubs-eph/src/main/java/com/microsoft/azure/eventprocessorhost/EventProcessorHost.java
EventProcessorHost.registerEventProcessor
public <T extends IEventProcessor> CompletableFuture<Void> registerEventProcessor(Class<T> eventProcessorType) { DefaultEventProcessorFactory<T> defaultFactory = new DefaultEventProcessorFactory<T>(); defaultFactory.setEventProcessorClass(eventProcessorType); return registerEventProcessorFactory(defaultFactory, EventProcessorOptions.getDefaultOptions()); }
java
public <T extends IEventProcessor> CompletableFuture<Void> registerEventProcessor(Class<T> eventProcessorType) { DefaultEventProcessorFactory<T> defaultFactory = new DefaultEventProcessorFactory<T>(); defaultFactory.setEventProcessorClass(eventProcessorType); return registerEventProcessorFactory(defaultFactory, EventProcessorOptions.getDefaultOptions()); }
[ "public", "<", "T", "extends", "IEventProcessor", ">", "CompletableFuture", "<", "Void", ">", "registerEventProcessor", "(", "Class", "<", "T", ">", "eventProcessorType", ")", "{", "DefaultEventProcessorFactory", "<", "T", ">", "defaultFactory", "=", "new", "Defau...
Register class for event processor and start processing. <p> This overload uses the default event processor factory, which simply creates new instances of the registered event processor class, and uses all the default options. <p> The returned CompletableFuture completes when host initialization is finished. Initialization failures are reported by completing the future with an exception, so it is important to call get() on the future and handle any exceptions thrown. <pre> class MyEventProcessor implements IEventProcessor { ... } EventProcessorHost host = new EventProcessorHost(...); {@literal CompletableFuture<Void>} foo = host.registerEventProcessor(MyEventProcessor.class); foo.get(); </pre> @param <T> Not actually a parameter. Represents the type of your class that implements IEventProcessor. @param eventProcessorType Class that implements IEventProcessor. @return Future that completes when initialization is finished.
[ "Register", "class", "for", "event", "processor", "and", "start", "processing", ".", "<p", ">", "This", "overload", "uses", "the", "default", "event", "processor", "factory", "which", "simply", "creates", "new", "instances", "of", "the", "registered", "event", ...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventhubs/data-plane/azure-eventhubs-eph/src/main/java/com/microsoft/azure/eventprocessorhost/EventProcessorHost.java#L404-L408
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/io/stream/StreamHelper.java
StreamHelper.writeStream
@Nonnull public static ESuccess writeStream (@WillClose @Nonnull final OutputStream aOS, @Nonnull final byte [] aBuf) { return writeStream (aOS, aBuf, 0, aBuf.length); }
java
@Nonnull public static ESuccess writeStream (@WillClose @Nonnull final OutputStream aOS, @Nonnull final byte [] aBuf) { return writeStream (aOS, aBuf, 0, aBuf.length); }
[ "@", "Nonnull", "public", "static", "ESuccess", "writeStream", "(", "@", "WillClose", "@", "Nonnull", "final", "OutputStream", "aOS", ",", "@", "Nonnull", "final", "byte", "[", "]", "aBuf", ")", "{", "return", "writeStream", "(", "aOS", ",", "aBuf", ",", ...
Write bytes to an {@link OutputStream}. @param aOS The output stream to write to. May not be <code>null</code>. Is closed independent of error or success. @param aBuf The byte array to be written. May not be <code>null</code>. @return {@link ESuccess}
[ "Write", "bytes", "to", "an", "{", "@link", "OutputStream", "}", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/stream/StreamHelper.java#L1303-L1307
sawano/java-commons
src/main/java/se/sawano/java/commons/lang/validate/AbstractValidate.java
AbstractValidate.inclusiveBetween
public long inclusiveBetween(long start, long end, long value) { if (value < start || value > end) { fail(String.format(DEFAULT_INCLUSIVE_BETWEEN_EX_MESSAGE, value, start, end)); } return value; }
java
public long inclusiveBetween(long start, long end, long value) { if (value < start || value > end) { fail(String.format(DEFAULT_INCLUSIVE_BETWEEN_EX_MESSAGE, value, start, end)); } return value; }
[ "public", "long", "inclusiveBetween", "(", "long", "start", ",", "long", "end", ",", "long", "value", ")", "{", "if", "(", "value", "<", "start", "||", "value", ">", "end", ")", "{", "fail", "(", "String", ".", "format", "(", "DEFAULT_INCLUSIVE_BETWEEN_E...
Validate that the specified primitive value falls between the two inclusive values specified; otherwise, throws an exception. <pre>Validate.inclusiveBetween(0, 2, 1);</pre> @param start the inclusive start value @param end the inclusive end value @param value the value to validate @return the value @throws IllegalArgumentValidationException if the value falls outside the boundaries (inclusive)
[ "Validate", "that", "the", "specified", "primitive", "value", "falls", "between", "the", "two", "inclusive", "values", "specified", ";", "otherwise", "throws", "an", "exception", ".", "<pre", ">", "Validate", ".", "inclusiveBetween", "(", "0", "2", "1", ")", ...
train
https://github.com/sawano/java-commons/blob/6f219c9e8dec4401dbe528d17ae6ec1ef9c0d284/src/main/java/se/sawano/java/commons/lang/validate/AbstractValidate.java#L1283-L1288
riversun/string-grabber
src/main/java/org/riversun/string_grabber/StringCropper.java
StringCropper.getBeforeOf
public String getBeforeOf(String srcStr, String token) { return getBeforeOfWithDetails(srcStr, token).str; }
java
public String getBeforeOf(String srcStr, String token) { return getBeforeOfWithDetails(srcStr, token).str; }
[ "public", "String", "getBeforeOf", "(", "String", "srcStr", ",", "String", "token", ")", "{", "return", "getBeforeOfWithDetails", "(", "srcStr", ",", "token", ")", ".", "str", ";", "}" ]
returns the string that is cropped before token with position-detail-info<br> @param srcStr @param token @return
[ "returns", "the", "string", "that", "is", "cropped", "before", "token", "with", "position", "-", "detail", "-", "info<br", ">" ]
train
https://github.com/riversun/string-grabber/blob/b5aadc21fe15f50d35392188dec6ab81dcf8d464/src/main/java/org/riversun/string_grabber/StringCropper.java#L221-L223
cchabanois/transmorph
src/main/java/net/entropysoft/transmorph/converters/beans/BeanPropertyTypeProvider.java
BeanPropertyTypeProvider.setPropertyDestinationType
public void setPropertyDestinationType(Class<?> clazz, String propertyName, TypeReference<?> destinationType) { propertiesDestinationTypes.put(new ClassProperty(clazz, propertyName), destinationType); }
java
public void setPropertyDestinationType(Class<?> clazz, String propertyName, TypeReference<?> destinationType) { propertiesDestinationTypes.put(new ClassProperty(clazz, propertyName), destinationType); }
[ "public", "void", "setPropertyDestinationType", "(", "Class", "<", "?", ">", "clazz", ",", "String", "propertyName", ",", "TypeReference", "<", "?", ">", "destinationType", ")", "{", "propertiesDestinationTypes", ".", "put", "(", "new", "ClassProperty", "(", "cl...
set the property destination type for given property @param propertyName @param destinationType
[ "set", "the", "property", "destination", "type", "for", "given", "property" ]
train
https://github.com/cchabanois/transmorph/blob/118550f30b9680a84eab7496bd8b04118740dcec/src/main/java/net/entropysoft/transmorph/converters/beans/BeanPropertyTypeProvider.java#L40-L43
jblas-project/jblas
src/main/java/org/jblas/util/LibraryLoader.java
LibraryLoader.fatJarLibraryPath
private String fatJarLibraryPath(String linkage, String flavor) { String sep = "/"; //System.getProperty("file.separator"); String os_name = getUnifiedOSName(); String os_arch = System.getProperty("os.arch"); String path = sep + "lib" + sep + linkage + sep + os_name + sep + os_arch + sep; if (null != flavor) path += flavor + sep; return path; }
java
private String fatJarLibraryPath(String linkage, String flavor) { String sep = "/"; //System.getProperty("file.separator"); String os_name = getUnifiedOSName(); String os_arch = System.getProperty("os.arch"); String path = sep + "lib" + sep + linkage + sep + os_name + sep + os_arch + sep; if (null != flavor) path += flavor + sep; return path; }
[ "private", "String", "fatJarLibraryPath", "(", "String", "linkage", ",", "String", "flavor", ")", "{", "String", "sep", "=", "\"/\"", ";", "//System.getProperty(\"file.separator\");\r", "String", "os_name", "=", "getUnifiedOSName", "(", ")", ";", "String", "os_arch"...
Compute the path to the library. The path is basically "/" + os.name + "/" + os.arch + "/" + libname.
[ "Compute", "the", "path", "to", "the", "library", ".", "The", "path", "is", "basically", "/", "+", "os", ".", "name", "+", "/", "+", "os", ".", "arch", "+", "/", "+", "libname", "." ]
train
https://github.com/jblas-project/jblas/blob/2818f231228e655cda80dfd8e0b87709fdfd8a70/src/main/java/org/jblas/util/LibraryLoader.java#L220-L228
beihaifeiwu/dolphin
dolphin-mybatis-generator/src/main/java/com/freetmp/mbg/plugin/XMLMergePlugin.java
XMLMergePlugin.getDirectory
public File getDirectory(String targetProject, String targetPackage) throws ShellException { // targetProject is interpreted as a directory that must exist // // targetPackage is interpreted as a sub directory, but in package // format (with dots instead of slashes). The sub directory will be // created // if it does not already exist File project = new File(targetProject); if (!project.isDirectory()) { throw new ShellException(getString("Warning.9", //$NON-NLS-1$ targetProject)); } StringBuilder sb = new StringBuilder(); StringTokenizer st = new StringTokenizer(targetPackage, "."); //$NON-NLS-1$ while (st.hasMoreTokens()) { sb.append(st.nextToken()); sb.append(File.separatorChar); } File directory = new File(project, sb.toString()); if (!directory.isDirectory()) { boolean rc = directory.mkdirs(); if (!rc) { throw new ShellException(getString("Warning.10", //$NON-NLS-1$ directory.getAbsolutePath())); } } return directory; }
java
public File getDirectory(String targetProject, String targetPackage) throws ShellException { // targetProject is interpreted as a directory that must exist // // targetPackage is interpreted as a sub directory, but in package // format (with dots instead of slashes). The sub directory will be // created // if it does not already exist File project = new File(targetProject); if (!project.isDirectory()) { throw new ShellException(getString("Warning.9", //$NON-NLS-1$ targetProject)); } StringBuilder sb = new StringBuilder(); StringTokenizer st = new StringTokenizer(targetPackage, "."); //$NON-NLS-1$ while (st.hasMoreTokens()) { sb.append(st.nextToken()); sb.append(File.separatorChar); } File directory = new File(project, sb.toString()); if (!directory.isDirectory()) { boolean rc = directory.mkdirs(); if (!rc) { throw new ShellException(getString("Warning.10", //$NON-NLS-1$ directory.getAbsolutePath())); } } return directory; }
[ "public", "File", "getDirectory", "(", "String", "targetProject", ",", "String", "targetPackage", ")", "throws", "ShellException", "{", "// targetProject is interpreted as a directory that must exist", "//", "// targetPackage is interpreted as a sub directory, but in package", "// fo...
从DefaultShellCallback中借用的解析文件夹的函数 @param targetProject target project @param targetPackage target package @return file instance @throws ShellException Cannot get infos form environment
[ "从DefaultShellCallback中借用的解析文件夹的函数" ]
train
https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-mybatis-generator/src/main/java/com/freetmp/mbg/plugin/XMLMergePlugin.java#L61-L93
jamesdbloom/mockserver
mockserver-core/src/main/java/org/mockserver/model/HttpRequest.java
HttpRequest.withBody
public HttpRequest withBody(String body, Charset charset) { if (body != null) { this.body = new StringBody(body, charset); } return this; }
java
public HttpRequest withBody(String body, Charset charset) { if (body != null) { this.body = new StringBody(body, charset); } return this; }
[ "public", "HttpRequest", "withBody", "(", "String", "body", ",", "Charset", "charset", ")", "{", "if", "(", "body", "!=", "null", ")", "{", "this", ".", "body", "=", "new", "StringBody", "(", "body", ",", "charset", ")", ";", "}", "return", "this", "...
The exact string body to match on such as "this is an exact string body" @param body the body on such as "this is an exact string body" @param charset character set the string will be encoded in
[ "The", "exact", "string", "body", "to", "match", "on", "such", "as", "this", "is", "an", "exact", "string", "body" ]
train
https://github.com/jamesdbloom/mockserver/blob/8b84fdd877e57b4eb780c9f8c8b1d65bcb448025/mockserver-core/src/main/java/org/mockserver/model/HttpRequest.java#L249-L254
fabric8io/docker-maven-plugin
src/main/java/io/fabric8/maven/docker/util/EnvUtil.java
EnvUtil.greaterOrEqualsVersion
public static boolean greaterOrEqualsVersion(String versionA, String versionB) { String largerVersion = extractLargerVersion(versionA, versionB); return largerVersion != null && largerVersion.equals(versionA); }
java
public static boolean greaterOrEqualsVersion(String versionA, String versionB) { String largerVersion = extractLargerVersion(versionA, versionB); return largerVersion != null && largerVersion.equals(versionA); }
[ "public", "static", "boolean", "greaterOrEqualsVersion", "(", "String", "versionA", ",", "String", "versionB", ")", "{", "String", "largerVersion", "=", "extractLargerVersion", "(", "versionA", ",", "versionB", ")", ";", "return", "largerVersion", "!=", "null", "&...
Check whether the first given API version is larger or equals the second given version @param versionA first version to check against @param versionB the second version @return true if versionA is greater or equals versionB, false otherwise
[ "Check", "whether", "the", "first", "given", "API", "version", "is", "larger", "or", "equals", "the", "second", "given", "version" ]
train
https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/util/EnvUtil.java#L85-L88
raphw/byte-buddy
byte-buddy-dep/src/main/java/net/bytebuddy/utility/visitor/MetadataAwareClassVisitor.java
MetadataAwareClassVisitor.onVisitMethod
protected MethodVisitor onVisitMethod(int modifiers, String internalName, String descriptor, String signature, String[] exception) { return super.visitMethod(modifiers, internalName, descriptor, signature, exception); }
java
protected MethodVisitor onVisitMethod(int modifiers, String internalName, String descriptor, String signature, String[] exception) { return super.visitMethod(modifiers, internalName, descriptor, signature, exception); }
[ "protected", "MethodVisitor", "onVisitMethod", "(", "int", "modifiers", ",", "String", "internalName", ",", "String", "descriptor", ",", "String", "signature", ",", "String", "[", "]", "exception", ")", "{", "return", "super", ".", "visitMethod", "(", "modifiers...
An order-sensitive invocation of {@link ClassVisitor#visitMethod(int, String, String, String, String[])}. @param modifiers The method's modifiers. @param internalName The method's internal name. @param descriptor The field type's descriptor. @param signature The method's generic signature or {@code null} if the method is not generic. @param exception The method's declared exceptions or {@code null} if no exceptions are declared. @return A method visitor to visit the method or {@code null} to ignore it.
[ "An", "order", "-", "sensitive", "invocation", "of", "{", "@link", "ClassVisitor#visitMethod", "(", "int", "String", "String", "String", "String", "[]", ")", "}", "." ]
train
https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/utility/visitor/MetadataAwareClassVisitor.java#L262-L264
hexagonframework/spring-data-ebean
src/main/java/org/springframework/data/ebean/repository/query/StringQuery.java
StringQuery.getBindingFor
public ParameterBinding getBindingFor(String name) { Assert.hasText(name, PARAMETER_NAME_MISSING); for (ParameterBinding binding : bindings) { if (binding.hasName(name)) { return binding; } } throw new IllegalArgumentException(String.format("No parameter binding found for name %s!", name)); }
java
public ParameterBinding getBindingFor(String name) { Assert.hasText(name, PARAMETER_NAME_MISSING); for (ParameterBinding binding : bindings) { if (binding.hasName(name)) { return binding; } } throw new IllegalArgumentException(String.format("No parameter binding found for name %s!", name)); }
[ "public", "ParameterBinding", "getBindingFor", "(", "String", "name", ")", "{", "Assert", ".", "hasText", "(", "name", ",", "PARAMETER_NAME_MISSING", ")", ";", "for", "(", "ParameterBinding", "binding", ":", "bindings", ")", "{", "if", "(", "binding", ".", "...
Returns the {@link ParameterBinding} for the given name. @param name must not be {@literal null} or empty. @return
[ "Returns", "the", "{", "@link", "ParameterBinding", "}", "for", "the", "given", "name", "." ]
train
https://github.com/hexagonframework/spring-data-ebean/blob/dd11b97654982403b50dd1d5369cadad71fce410/src/main/java/org/springframework/data/ebean/repository/query/StringQuery.java#L95-L106
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.createSession
public CreateSessionResponse createSession(CreateSessionRequest request) { checkNotNull(request, "The parameter request should NOT be null."); if (request.getPreset() == null && request.getPresets() == null) { throw new IllegalArgumentException("The parameter preset and presets should NOT both be null or empty."); } InternalRequest internalRequest = createRequest(HttpMethodName.POST, request, LIVE_SESSION); return invokeHttpClient(internalRequest, CreateSessionResponse.class); }
java
public CreateSessionResponse createSession(CreateSessionRequest request) { checkNotNull(request, "The parameter request should NOT be null."); if (request.getPreset() == null && request.getPresets() == null) { throw new IllegalArgumentException("The parameter preset and presets should NOT both be null or empty."); } InternalRequest internalRequest = createRequest(HttpMethodName.POST, request, LIVE_SESSION); return invokeHttpClient(internalRequest, CreateSessionResponse.class); }
[ "public", "CreateSessionResponse", "createSession", "(", "CreateSessionRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"The parameter request should NOT be null.\"", ")", ";", "if", "(", "request", ".", "getPreset", "(", ")", "==", "null", "&&", ...
Create a live session in the live stream service. @param request The request object containing all options for creating live session. @return the response
[ "Create", "a", "live", "session", "in", "the", "live", "stream", "service", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L528-L537
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/filters/SPSMMappingFilter.java
SPSMMappingFilter.comparePrecedence
private int comparePrecedence(char sourceRelation, char targetRelation) { int result = -1; int sourcePrecedence = getPrecedenceNumber(sourceRelation); int targetPrecedence = getPrecedenceNumber(targetRelation); if (sourcePrecedence < targetPrecedence) { result = 1; } else if (sourcePrecedence == targetPrecedence) { result = 0; } else { result = -1; } return result; }
java
private int comparePrecedence(char sourceRelation, char targetRelation) { int result = -1; int sourcePrecedence = getPrecedenceNumber(sourceRelation); int targetPrecedence = getPrecedenceNumber(targetRelation); if (sourcePrecedence < targetPrecedence) { result = 1; } else if (sourcePrecedence == targetPrecedence) { result = 0; } else { result = -1; } return result; }
[ "private", "int", "comparePrecedence", "(", "char", "sourceRelation", ",", "char", "targetRelation", ")", "{", "int", "result", "=", "-", "1", ";", "int", "sourcePrecedence", "=", "getPrecedenceNumber", "(", "sourceRelation", ")", ";", "int", "targetPrecedence", ...
Compares the semantic relation of the source and target in the order of precedence = > < ! ?. Returning -1 if sourceRelation is less precedent than targetRelation, 0 if sourceRelation is equally precedent than targetRelation, 1 if sourceRelation is more precedent than targetRelation. @param sourceRelation source relation from IMappingElement. @param targetRelation target relation from IMappingElement. @return -1 if sourceRelation is less precedent than targetRelation, 0 if sourceRelation is equally precedent than targetRelation, 1 if sourceRelation is more precedent than targetRelation.
[ "Compares", "the", "semantic", "relation", "of", "the", "source", "and", "target", "in", "the", "order", "of", "precedence", "=", ">", "<", "!", "?", ".", "Returning", "-", "1", "if", "sourceRelation", "is", "less", "precedent", "than", "targetRelation", "...
train
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/filters/SPSMMappingFilter.java#L512-L526
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/GitLabApiForm.java
GitLabApiForm.withParam
public <T> GitLabApiForm withParam(String name, List<T> values) { return (withParam(name, values, false)); }
java
public <T> GitLabApiForm withParam(String name, List<T> values) { return (withParam(name, values, false)); }
[ "public", "<", "T", ">", "GitLabApiForm", "withParam", "(", "String", "name", ",", "List", "<", "T", ">", "values", ")", "{", "return", "(", "withParam", "(", "name", ",", "values", ",", "false", ")", ")", ";", "}" ]
Fluent method for adding a List type query and form parameters to a get() or post() call. @param <T> the type contained by the List @param name the name of the field/attribute to add @param values a List containing the values of the field/attribute to add @return this GitLabAPiForm instance
[ "Fluent", "method", "for", "adding", "a", "List", "type", "query", "and", "form", "parameters", "to", "a", "get", "()", "or", "post", "()", "call", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/GitLabApiForm.java#L106-L108
UrielCh/ovh-java-sdk
ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java
ApiOvhEmailexchange.organizationName_service_exchangeService_publicFolder_path_permission_allowedAccountId_PUT
public void organizationName_service_exchangeService_publicFolder_path_permission_allowedAccountId_PUT(String organizationName, String exchangeService, String path, Long allowedAccountId, OvhExchangePublicFolderPermission body) throws IOException { String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/publicFolder/{path}/permission/{allowedAccountId}"; StringBuilder sb = path(qPath, organizationName, exchangeService, path, allowedAccountId); exec(qPath, "PUT", sb.toString(), body); }
java
public void organizationName_service_exchangeService_publicFolder_path_permission_allowedAccountId_PUT(String organizationName, String exchangeService, String path, Long allowedAccountId, OvhExchangePublicFolderPermission body) throws IOException { String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/publicFolder/{path}/permission/{allowedAccountId}"; StringBuilder sb = path(qPath, organizationName, exchangeService, path, allowedAccountId); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "organizationName_service_exchangeService_publicFolder_path_permission_allowedAccountId_PUT", "(", "String", "organizationName", ",", "String", "exchangeService", ",", "String", "path", ",", "Long", "allowedAccountId", ",", "OvhExchangePublicFolderPermission", "bo...
Alter this object properties REST: PUT /email/exchange/{organizationName}/service/{exchangeService}/publicFolder/{path}/permission/{allowedAccountId} @param body [required] New object properties @param organizationName [required] The internal name of your exchange organization @param exchangeService [required] The internal name of your exchange service @param path [required] Path for public folder @param allowedAccountId [required] Account id
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L265-L269
line/armeria
core/src/main/java/com/linecorp/armeria/server/docs/TypeSignature.java
TypeSignature.ofUnresolved
public static TypeSignature ofUnresolved(String unresolvedTypeName) { requireNonNull(unresolvedTypeName, "unresolvedTypeName"); return new TypeSignature('?' + unresolvedTypeName, ImmutableList.of()); }
java
public static TypeSignature ofUnresolved(String unresolvedTypeName) { requireNonNull(unresolvedTypeName, "unresolvedTypeName"); return new TypeSignature('?' + unresolvedTypeName, ImmutableList.of()); }
[ "public", "static", "TypeSignature", "ofUnresolved", "(", "String", "unresolvedTypeName", ")", "{", "requireNonNull", "(", "unresolvedTypeName", ",", "\"unresolvedTypeName\"", ")", ";", "return", "new", "TypeSignature", "(", "'", "'", "+", "unresolvedTypeName", ",", ...
Creates a new unresolved type signature with the specified type name.
[ "Creates", "a", "new", "unresolved", "type", "signature", "with", "the", "specified", "type", "name", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/docs/TypeSignature.java#L204-L207
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/network/channel_binding.java
channel_binding.get
public static channel_binding get(nitro_service service, String id) throws Exception{ channel_binding obj = new channel_binding(); obj.set_id(id); channel_binding response = (channel_binding) obj.get_resource(service); return response; }
java
public static channel_binding get(nitro_service service, String id) throws Exception{ channel_binding obj = new channel_binding(); obj.set_id(id); channel_binding response = (channel_binding) obj.get_resource(service); return response; }
[ "public", "static", "channel_binding", "get", "(", "nitro_service", "service", ",", "String", "id", ")", "throws", "Exception", "{", "channel_binding", "obj", "=", "new", "channel_binding", "(", ")", ";", "obj", ".", "set_id", "(", "id", ")", ";", "channel_b...
Use this API to fetch channel_binding resource of given name .
[ "Use", "this", "API", "to", "fetch", "channel_binding", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/network/channel_binding.java#L105-L110
VoltDB/voltdb
third_party/java/src/org/apache/commons_voltpatches/cli/DefaultParser.java
DefaultParser.handleLongOptionWithEqual
private void handleLongOptionWithEqual(String token) throws ParseException { int pos = token.indexOf('='); String value = token.substring(pos + 1); String opt = token.substring(0, pos); List<String> matchingOpts = options.getMatchingOptions(opt); if (matchingOpts.isEmpty()) { handleUnknownToken(currentToken); } else if (matchingOpts.size() > 1) { throw new AmbiguousOptionException(opt, matchingOpts); } else { Option option = options.getOption(matchingOpts.get(0)); if (option.acceptsArg()) { handleOption(option); currentOption.addValueForProcessing(value); currentOption = null; } else { handleUnknownToken(currentToken); } } }
java
private void handleLongOptionWithEqual(String token) throws ParseException { int pos = token.indexOf('='); String value = token.substring(pos + 1); String opt = token.substring(0, pos); List<String> matchingOpts = options.getMatchingOptions(opt); if (matchingOpts.isEmpty()) { handleUnknownToken(currentToken); } else if (matchingOpts.size() > 1) { throw new AmbiguousOptionException(opt, matchingOpts); } else { Option option = options.getOption(matchingOpts.get(0)); if (option.acceptsArg()) { handleOption(option); currentOption.addValueForProcessing(value); currentOption = null; } else { handleUnknownToken(currentToken); } } }
[ "private", "void", "handleLongOptionWithEqual", "(", "String", "token", ")", "throws", "ParseException", "{", "int", "pos", "=", "token", ".", "indexOf", "(", "'", "'", ")", ";", "String", "value", "=", "token", ".", "substring", "(", "pos", "+", "1", ")...
Handles the following tokens: --L=V -L=V --l=V -l=V @param token the command line token to handle
[ "Handles", "the", "following", "tokens", ":" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/commons_voltpatches/cli/DefaultParser.java#L416-L448
akquinet/androlog
androlog/src/main/java/de/akquinet/android/androlog/LogHelper.java
LogHelper.println
public static int println(int priority, String tag, String msg) { return android.util.Log.println(priority, tag, msg); }
java
public static int println(int priority, String tag, String msg) { return android.util.Log.println(priority, tag, msg); }
[ "public", "static", "int", "println", "(", "int", "priority", ",", "String", "tag", ",", "String", "msg", ")", "{", "return", "android", ".", "util", ".", "Log", ".", "println", "(", "priority", ",", "tag", ",", "msg", ")", ";", "}" ]
Low-level logging call. @param priority The priority/type of this log message @param tag Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs. @param msg The message you would like logged. @return The number of bytes written.
[ "Low", "-", "level", "logging", "call", "." ]
train
https://github.com/akquinet/androlog/blob/82fa81354c01c9b1d1928062b634ba21f14be560/androlog/src/main/java/de/akquinet/android/androlog/LogHelper.java#L183-L185
google/error-prone
core/src/main/java/com/google/errorprone/bugpatterns/ConstantOverflow.java
ConstantOverflow.longFix
private Fix longFix(ExpressionTree expr, VisitorState state) { BinaryTree binExpr = null; while (expr instanceof BinaryTree) { binExpr = (BinaryTree) expr; expr = binExpr.getLeftOperand(); } if (!(expr instanceof LiteralTree) || expr.getKind() != Kind.INT_LITERAL) { return null; } Type intType = state.getSymtab().intType; if (!isSameType(getType(binExpr), intType, state)) { return null; } SuggestedFix.Builder fix = SuggestedFix.builder().postfixWith(expr, "L"); Tree parent = state.getPath().getParentPath().getLeaf(); if (parent instanceof VariableTree && isSameType(getType(parent), intType, state)) { fix.replace(((VariableTree) parent).getType(), "long"); } return fix.build(); }
java
private Fix longFix(ExpressionTree expr, VisitorState state) { BinaryTree binExpr = null; while (expr instanceof BinaryTree) { binExpr = (BinaryTree) expr; expr = binExpr.getLeftOperand(); } if (!(expr instanceof LiteralTree) || expr.getKind() != Kind.INT_LITERAL) { return null; } Type intType = state.getSymtab().intType; if (!isSameType(getType(binExpr), intType, state)) { return null; } SuggestedFix.Builder fix = SuggestedFix.builder().postfixWith(expr, "L"); Tree parent = state.getPath().getParentPath().getLeaf(); if (parent instanceof VariableTree && isSameType(getType(parent), intType, state)) { fix.replace(((VariableTree) parent).getType(), "long"); } return fix.build(); }
[ "private", "Fix", "longFix", "(", "ExpressionTree", "expr", ",", "VisitorState", "state", ")", "{", "BinaryTree", "binExpr", "=", "null", ";", "while", "(", "expr", "instanceof", "BinaryTree", ")", "{", "binExpr", "=", "(", "BinaryTree", ")", "expr", ";", ...
If the left operand of an int binary expression is an int literal, suggest making it a long.
[ "If", "the", "left", "operand", "of", "an", "int", "binary", "expression", "is", "an", "int", "literal", "suggest", "making", "it", "a", "long", "." ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/ConstantOverflow.java#L86-L105
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java
ZipUtil.zip
private static void zip(File file, String srcRootDir, ZipOutputStream out) throws UtilException { if (file == null) { return; } final String subPath = FileUtil.subPath(srcRootDir, file); // 获取文件相对于压缩文件夹根目录的子路径 if (file.isDirectory()) {// 如果是目录,则压缩压缩目录中的文件或子目录 final File[] files = file.listFiles(); if (ArrayUtil.isEmpty(files) && StrUtil.isNotEmpty(subPath)) { // 加入目录,只有空目录时才加入目录,非空时会在创建文件时自动添加父级目录 addDir(subPath, out); } // 压缩目录下的子文件或目录 for (File childFile : files) { zip(childFile, srcRootDir, out); } } else {// 如果是文件或其它符号,则直接压缩该文件 addFile(file, subPath, out); } }
java
private static void zip(File file, String srcRootDir, ZipOutputStream out) throws UtilException { if (file == null) { return; } final String subPath = FileUtil.subPath(srcRootDir, file); // 获取文件相对于压缩文件夹根目录的子路径 if (file.isDirectory()) {// 如果是目录,则压缩压缩目录中的文件或子目录 final File[] files = file.listFiles(); if (ArrayUtil.isEmpty(files) && StrUtil.isNotEmpty(subPath)) { // 加入目录,只有空目录时才加入目录,非空时会在创建文件时自动添加父级目录 addDir(subPath, out); } // 压缩目录下的子文件或目录 for (File childFile : files) { zip(childFile, srcRootDir, out); } } else {// 如果是文件或其它符号,则直接压缩该文件 addFile(file, subPath, out); } }
[ "private", "static", "void", "zip", "(", "File", "file", ",", "String", "srcRootDir", ",", "ZipOutputStream", "out", ")", "throws", "UtilException", "{", "if", "(", "file", "==", "null", ")", "{", "return", ";", "}", "final", "String", "subPath", "=", "F...
递归压缩文件夹<br> srcRootDir决定了路径截取的位置,例如:<br> file的路径为d:/a/b/c/d.txt,srcRootDir为d:/a/b,则压缩后的文件与目录为结构为c/d.txt @param out 压缩文件存储对象 @param srcRootDir 被压缩的文件夹根目录 @param file 当前递归压缩的文件或目录对象 @throws UtilException IO异常
[ "递归压缩文件夹<br", ">", "srcRootDir决定了路径截取的位置,例如:<br", ">", "file的路径为d", ":", "/", "a", "/", "b", "/", "c", "/", "d", ".", "txt,srcRootDir为d", ":", "/", "a", "/", "b,则压缩后的文件与目录为结构为c", "/", "d", ".", "txt" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java#L772-L791
prestodb/presto
presto-main/src/main/java/com/facebook/presto/server/remotetask/HttpRemoteTask.java
HttpRemoteTask.doRemoveRemoteSource
private void doRemoveRemoteSource(RequestErrorTracker errorTracker, Request request, SettableFuture<?> future) { errorTracker.startRequest(); FutureCallback<StatusResponse> callback = new FutureCallback<StatusResponse>() { @Override public void onSuccess(@Nullable StatusResponse response) { if (response == null) { throw new PrestoException(GENERIC_INTERNAL_ERROR, "Request failed with null response"); } if (response.getStatusCode() != OK.code()) { throw new PrestoException(GENERIC_INTERNAL_ERROR, "Request failed with HTTP status " + response.getStatusCode()); } future.set(null); } @Override public void onFailure(Throwable failedReason) { if (failedReason instanceof RejectedExecutionException && httpClient.isClosed()) { log.error("Unable to destroy exchange source at %s. HTTP client is closed", request.getUri()); future.setException(failedReason); return; } // record failure try { errorTracker.requestFailed(failedReason); } catch (PrestoException e) { future.setException(e); return; } // if throttled due to error, asynchronously wait for timeout and try again ListenableFuture<?> errorRateLimit = errorTracker.acquireRequestPermit(); if (errorRateLimit.isDone()) { doRemoveRemoteSource(errorTracker, request, future); } else { errorRateLimit.addListener(() -> doRemoveRemoteSource(errorTracker, request, future), errorScheduledExecutor); } } }; addCallback(httpClient.executeAsync(request, createStatusResponseHandler()), callback, directExecutor()); }
java
private void doRemoveRemoteSource(RequestErrorTracker errorTracker, Request request, SettableFuture<?> future) { errorTracker.startRequest(); FutureCallback<StatusResponse> callback = new FutureCallback<StatusResponse>() { @Override public void onSuccess(@Nullable StatusResponse response) { if (response == null) { throw new PrestoException(GENERIC_INTERNAL_ERROR, "Request failed with null response"); } if (response.getStatusCode() != OK.code()) { throw new PrestoException(GENERIC_INTERNAL_ERROR, "Request failed with HTTP status " + response.getStatusCode()); } future.set(null); } @Override public void onFailure(Throwable failedReason) { if (failedReason instanceof RejectedExecutionException && httpClient.isClosed()) { log.error("Unable to destroy exchange source at %s. HTTP client is closed", request.getUri()); future.setException(failedReason); return; } // record failure try { errorTracker.requestFailed(failedReason); } catch (PrestoException e) { future.setException(e); return; } // if throttled due to error, asynchronously wait for timeout and try again ListenableFuture<?> errorRateLimit = errorTracker.acquireRequestPermit(); if (errorRateLimit.isDone()) { doRemoveRemoteSource(errorTracker, request, future); } else { errorRateLimit.addListener(() -> doRemoveRemoteSource(errorTracker, request, future), errorScheduledExecutor); } } }; addCallback(httpClient.executeAsync(request, createStatusResponseHandler()), callback, directExecutor()); }
[ "private", "void", "doRemoveRemoteSource", "(", "RequestErrorTracker", "errorTracker", ",", "Request", "request", ",", "SettableFuture", "<", "?", ">", "future", ")", "{", "errorTracker", ".", "startRequest", "(", ")", ";", "FutureCallback", "<", "StatusResponse", ...
/ This method may call itself recursively when retrying for failures
[ "/", "This", "method", "may", "call", "itself", "recursively", "when", "retrying", "for", "failures" ]
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/server/remotetask/HttpRemoteTask.java#L423-L468
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/MatrixFeatures_DDRM.java
MatrixFeatures_DDRM.isZeros
public static boolean isZeros(DMatrixD1 m , double tol ) { int length = m.getNumElements(); for( int i = 0; i < length; i++ ) { if( Math.abs(m.get(i)) > tol ) return false; } return true; }
java
public static boolean isZeros(DMatrixD1 m , double tol ) { int length = m.getNumElements(); for( int i = 0; i < length; i++ ) { if( Math.abs(m.get(i)) > tol ) return false; } return true; }
[ "public", "static", "boolean", "isZeros", "(", "DMatrixD1", "m", ",", "double", "tol", ")", "{", "int", "length", "=", "m", ".", "getNumElements", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{",...
Checks to see all the elements in the matrix are zeros @param m A matrix. Not modified. @return True if all elements are zeros or false if not
[ "Checks", "to", "see", "all", "the", "elements", "in", "the", "matrix", "are", "zeros" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/MatrixFeatures_DDRM.java#L87-L96
davidmoten/rxjava2-extras
src/main/java/com/github/davidmoten/rx2/Strings.java
Strings.toInputStream
public static InputStream toInputStream(Publisher<String> publisher, Charset charset) { return FlowableStringInputStream.createInputStream(publisher, charset); }
java
public static InputStream toInputStream(Publisher<String> publisher, Charset charset) { return FlowableStringInputStream.createInputStream(publisher, charset); }
[ "public", "static", "InputStream", "toInputStream", "(", "Publisher", "<", "String", ">", "publisher", ",", "Charset", "charset", ")", "{", "return", "FlowableStringInputStream", ".", "createInputStream", "(", "publisher", ",", "charset", ")", ";", "}" ]
Returns an {@link InputStream} that offers the concatenated String data emitted by a subscription to the given publisher using the given character set. @param publisher the source of the String data @param charset the character set of the bytes to be read in the InputStream @return offers the concatenated String data emitted by a subscription to the given publisher using the given character set
[ "Returns", "an", "{", "@link", "InputStream", "}", "that", "offers", "the", "concatenated", "String", "data", "emitted", "by", "a", "subscription", "to", "the", "given", "publisher", "using", "the", "given", "character", "set", "." ]
train
https://github.com/davidmoten/rxjava2-extras/blob/bf5ece3f97191f29a81957a6529bc3cfa4d7b328/src/main/java/com/github/davidmoten/rx2/Strings.java#L380-L382
auth0/auth0-java
src/main/java/com/auth0/json/mgmt/guardian/TwilioFactorProvider.java
TwilioFactorProvider.setMessagingServiceSID
@Deprecated @JsonProperty("messaging_service_sid") public void setMessagingServiceSID(String messagingServiceSID) throws IllegalArgumentException { if (from != null) { throw new IllegalArgumentException("You must specify either `from` or `messagingServiceSID`, but not both"); } this.messagingServiceSID = messagingServiceSID; }
java
@Deprecated @JsonProperty("messaging_service_sid") public void setMessagingServiceSID(String messagingServiceSID) throws IllegalArgumentException { if (from != null) { throw new IllegalArgumentException("You must specify either `from` or `messagingServiceSID`, but not both"); } this.messagingServiceSID = messagingServiceSID; }
[ "@", "Deprecated", "@", "JsonProperty", "(", "\"messaging_service_sid\"", ")", "public", "void", "setMessagingServiceSID", "(", "String", "messagingServiceSID", ")", "throws", "IllegalArgumentException", "{", "if", "(", "from", "!=", "null", ")", "{", "throw", "new"...
Setter for the Twilio Messaging Service SID. @param messagingServiceSID the messaging service SID. @throws IllegalArgumentException when both `from` and `messagingServiceSID` are set @deprecated use the constructor instead
[ "Setter", "for", "the", "Twilio", "Messaging", "Service", "SID", "." ]
train
https://github.com/auth0/auth0-java/blob/b7bc099ee9c6cde5a87c4ecfebc6d811aeb1027c/src/main/java/com/auth0/json/mgmt/guardian/TwilioFactorProvider.java#L101-L108
hibernate/hibernate-ogm
neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/embedded/dialect/impl/EmbeddedNeo4jAssociationQueries.java
EmbeddedNeo4jAssociationQueries.findRelationship
@Override public Relationship findRelationship(GraphDatabaseService executionEngine, AssociationKey associationKey, RowKey rowKey) { Object[] queryValues = relationshipValues( associationKey, rowKey ); Result result = executionEngine.execute( findRelationshipQuery, params( queryValues ) ); return singleResult( result ); }
java
@Override public Relationship findRelationship(GraphDatabaseService executionEngine, AssociationKey associationKey, RowKey rowKey) { Object[] queryValues = relationshipValues( associationKey, rowKey ); Result result = executionEngine.execute( findRelationshipQuery, params( queryValues ) ); return singleResult( result ); }
[ "@", "Override", "public", "Relationship", "findRelationship", "(", "GraphDatabaseService", "executionEngine", ",", "AssociationKey", "associationKey", ",", "RowKey", "rowKey", ")", "{", "Object", "[", "]", "queryValues", "=", "relationshipValues", "(", "associationKey"...
Returns the relationship corresponding to the {@link AssociationKey} and {@link RowKey}. @param executionEngine the {@link GraphDatabaseService} used to run the query @param associationKey represents the association @param rowKey represents a row in an association @return the corresponding relationship
[ "Returns", "the", "relationship", "corresponding", "to", "the", "{", "@link", "AssociationKey", "}", "and", "{", "@link", "RowKey", "}", "." ]
train
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/embedded/dialect/impl/EmbeddedNeo4jAssociationQueries.java#L64-L69
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/DataTracker.java
DataTracker.replaceReaders
private void replaceReaders(Collection<SSTableReader> oldSSTables, Collection<SSTableReader> newSSTables, boolean notify) { View currentView, newView; do { currentView = view.get(); newView = currentView.replace(oldSSTables, newSSTables); } while (!view.compareAndSet(currentView, newView)); if (!oldSSTables.isEmpty() && notify) notifySSTablesChanged(oldSSTables, newSSTables, OperationType.UNKNOWN); for (SSTableReader sstable : newSSTables) sstable.setTrackedBy(this); Refs.release(Refs.selfRefs(oldSSTables)); }
java
private void replaceReaders(Collection<SSTableReader> oldSSTables, Collection<SSTableReader> newSSTables, boolean notify) { View currentView, newView; do { currentView = view.get(); newView = currentView.replace(oldSSTables, newSSTables); } while (!view.compareAndSet(currentView, newView)); if (!oldSSTables.isEmpty() && notify) notifySSTablesChanged(oldSSTables, newSSTables, OperationType.UNKNOWN); for (SSTableReader sstable : newSSTables) sstable.setTrackedBy(this); Refs.release(Refs.selfRefs(oldSSTables)); }
[ "private", "void", "replaceReaders", "(", "Collection", "<", "SSTableReader", ">", "oldSSTables", ",", "Collection", "<", "SSTableReader", ">", "newSSTables", ",", "boolean", "notify", ")", "{", "View", "currentView", ",", "newView", ";", "do", "{", "currentView...
A special kind of replacement for SSTableReaders that were cloned with a new index summary sampling level (see SSTableReader.cloneWithNewSummarySamplingLevel and CASSANDRA-5519). This does not mark the old reader as compacted. @param oldSSTables replaced readers @param newSSTables replacement readers
[ "A", "special", "kind", "of", "replacement", "for", "SSTableReaders", "that", "were", "cloned", "with", "a", "new", "index", "summary", "sampling", "level", "(", "see", "SSTableReader", ".", "cloneWithNewSummarySamplingLevel", "and", "CASSANDRA", "-", "5519", ")",...
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/DataTracker.java#L397-L414
apache/incubator-gobblin
gobblin-modules/gobblin-azkaban/src/main/java/org/apache/gobblin/service/modules/orchestration/AzkabanJobHelper.java
AzkabanJobHelper.isAzkabanJobPresent
public static boolean isAzkabanJobPresent(String sessionId, AzkabanProjectConfig azkabanProjectConfig) throws IOException { log.info("Checking if Azkaban project: " + azkabanProjectConfig.getAzkabanProjectName() + " exists"); try { // NOTE: hacky way to determine if project already exists because Azkaban does not provides a way to // .. check if the project already exists or not boolean isPresent = StringUtils.isNotBlank(AzkabanAjaxAPIClient.getProjectId(sessionId, azkabanProjectConfig)); log.info("Project exists: " + isPresent); return isPresent; } catch (IOException e) { // Project doesn't exists if (String.format("Project %s doesn't exist.", azkabanProjectConfig.getAzkabanProjectName()) .equalsIgnoreCase(e.getMessage())) { log.info("Project does not exists."); return false; } // Project exists but with no read access to current user if ("Permission denied. Need READ access.".equalsIgnoreCase(e.getMessage())) { log.info("Project exists, but current user does not has READ access."); return true; } // Some other error log.error("Issue in checking if project is present", e); throw e; } }
java
public static boolean isAzkabanJobPresent(String sessionId, AzkabanProjectConfig azkabanProjectConfig) throws IOException { log.info("Checking if Azkaban project: " + azkabanProjectConfig.getAzkabanProjectName() + " exists"); try { // NOTE: hacky way to determine if project already exists because Azkaban does not provides a way to // .. check if the project already exists or not boolean isPresent = StringUtils.isNotBlank(AzkabanAjaxAPIClient.getProjectId(sessionId, azkabanProjectConfig)); log.info("Project exists: " + isPresent); return isPresent; } catch (IOException e) { // Project doesn't exists if (String.format("Project %s doesn't exist.", azkabanProjectConfig.getAzkabanProjectName()) .equalsIgnoreCase(e.getMessage())) { log.info("Project does not exists."); return false; } // Project exists but with no read access to current user if ("Permission denied. Need READ access.".equalsIgnoreCase(e.getMessage())) { log.info("Project exists, but current user does not has READ access."); return true; } // Some other error log.error("Issue in checking if project is present", e); throw e; } }
[ "public", "static", "boolean", "isAzkabanJobPresent", "(", "String", "sessionId", ",", "AzkabanProjectConfig", "azkabanProjectConfig", ")", "throws", "IOException", "{", "log", ".", "info", "(", "\"Checking if Azkaban project: \"", "+", "azkabanProjectConfig", ".", "getAz...
* Checks if an Azkaban project exists by name. @param sessionId Session Id. @param azkabanProjectConfig Azkaban Project Config that contains project name. @return true if project exists else false. @throws IOException
[ "*", "Checks", "if", "an", "Azkaban", "project", "exists", "by", "name", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-azkaban/src/main/java/org/apache/gobblin/service/modules/orchestration/AzkabanJobHelper.java#L56-L82
Red5/red5-io
src/main/java/org/red5/io/utils/IOUtils.java
IOUtils.writeExtendedMediumInt
public final static void writeExtendedMediumInt(ByteBuffer out, int value) { value = ((value & 0xff000000) >> 24) | (value << 8); out.putInt(value); }
java
public final static void writeExtendedMediumInt(ByteBuffer out, int value) { value = ((value & 0xff000000) >> 24) | (value << 8); out.putInt(value); }
[ "public", "final", "static", "void", "writeExtendedMediumInt", "(", "ByteBuffer", "out", ",", "int", "value", ")", "{", "value", "=", "(", "(", "value", "&", "0xff000000", ")", ">>", "24", ")", "|", "(", "value", "<<", "8", ")", ";", "out", ".", "put...
Writes extended medium integer (equivalent to a regular integer whose most significant byte has been moved to its end, past its least significant byte) @param out Output buffer @param value Integer to write
[ "Writes", "extended", "medium", "integer", "(", "equivalent", "to", "a", "regular", "integer", "whose", "most", "significant", "byte", "has", "been", "moved", "to", "its", "end", "past", "its", "least", "significant", "byte", ")" ]
train
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/utils/IOUtils.java#L102-L105
Stratio/stratio-cassandra
src/java/org/apache/cassandra/concurrent/SEPWorker.java
SEPWorker.maybeStop
private void maybeStop(long stopCheck, long now) { long delta = now - stopCheck; if (delta <= 0) { // if stopCheck has caught up with present, we've been spinning too much, so if we can atomically // set it to the past again, we should stop a worker if (pool.stopCheck.compareAndSet(stopCheck, now - stopCheckInterval)) { // try and stop ourselves; // if we've already been assigned work stop another worker if (!assign(Work.STOP_SIGNALLED, true)) pool.schedule(Work.STOP_SIGNALLED); } } else if (soleSpinnerSpinTime > stopCheckInterval && pool.spinningCount.get() == 1) { // permit self-stopping assign(Work.STOP_SIGNALLED, true); } else { // if stop check has gotten too far behind present, update it so new spins can affect it while (delta > stopCheckInterval * 2 && !pool.stopCheck.compareAndSet(stopCheck, now - stopCheckInterval)) { stopCheck = pool.stopCheck.get(); delta = now - stopCheck; } } }
java
private void maybeStop(long stopCheck, long now) { long delta = now - stopCheck; if (delta <= 0) { // if stopCheck has caught up with present, we've been spinning too much, so if we can atomically // set it to the past again, we should stop a worker if (pool.stopCheck.compareAndSet(stopCheck, now - stopCheckInterval)) { // try and stop ourselves; // if we've already been assigned work stop another worker if (!assign(Work.STOP_SIGNALLED, true)) pool.schedule(Work.STOP_SIGNALLED); } } else if (soleSpinnerSpinTime > stopCheckInterval && pool.spinningCount.get() == 1) { // permit self-stopping assign(Work.STOP_SIGNALLED, true); } else { // if stop check has gotten too far behind present, update it so new spins can affect it while (delta > stopCheckInterval * 2 && !pool.stopCheck.compareAndSet(stopCheck, now - stopCheckInterval)) { stopCheck = pool.stopCheck.get(); delta = now - stopCheck; } } }
[ "private", "void", "maybeStop", "(", "long", "stopCheck", ",", "long", "now", ")", "{", "long", "delta", "=", "now", "-", "stopCheck", ";", "if", "(", "delta", "<=", "0", ")", "{", "// if stopCheck has caught up with present, we've been spinning too much, so if we c...
realtime we have spun too much and deschedule; if we get too far behind realtime, we reset to our initial offset
[ "realtime", "we", "have", "spun", "too", "much", "and", "deschedule", ";", "if", "we", "get", "too", "far", "behind", "realtime", "we", "reset", "to", "our", "initial", "offset" ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/concurrent/SEPWorker.java#L261-L290
Azure/azure-sdk-for-java
storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/StorageAccountsInner.java
StorageAccountsInner.deleteManagementPoliciesAsync
public Observable<Void> deleteManagementPoliciesAsync(String resourceGroupName, String accountName) { return deleteManagementPoliciesWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> deleteManagementPoliciesAsync(String resourceGroupName, String accountName) { return deleteManagementPoliciesWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "deleteManagementPoliciesAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ")", "{", "return", "deleteManagementPoliciesWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ")", ".", "ma...
Deletes the data policy rules associated with the specified storage account. @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Deletes", "the", "data", "policy", "rules", "associated", "with", "the", "specified", "storage", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/StorageAccountsInner.java#L1489-L1496
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/xml/hints/HintRule.java
HintRule.addRemoveVendor
public void addRemoveVendor(String source, String name, String value, boolean regex, Confidence confidence) { removeVendor.add(new EvidenceMatcher(source, name, value, regex, confidence)); }
java
public void addRemoveVendor(String source, String name, String value, boolean regex, Confidence confidence) { removeVendor.add(new EvidenceMatcher(source, name, value, regex, confidence)); }
[ "public", "void", "addRemoveVendor", "(", "String", "source", ",", "String", "name", ",", "String", "value", ",", "boolean", "regex", ",", "Confidence", "confidence", ")", "{", "removeVendor", ".", "add", "(", "new", "EvidenceMatcher", "(", "source", ",", "n...
Adds a given vendor to the list of evidence to remove when matched. @param source the source of the evidence @param name the name of the evidence @param value the value of the evidence @param regex whether value is a regex @param confidence the confidence of the evidence
[ "Adds", "a", "given", "vendor", "to", "the", "list", "of", "evidence", "to", "remove", "when", "matched", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/xml/hints/HintRule.java#L213-L215
jmeter-maven-plugin/jmeter-maven-plugin
src/main/java/com/lazerycode/jmeter/configuration/ArtifactHelpers.java
ArtifactHelpers.artifactIsNotExcluded
public static boolean artifactIsNotExcluded(Collection<Exclusion> exclusions, Artifact artifact) { return Optional.ofNullable(exclusions).orElse(Collections.emptyList()) .stream().noneMatch(selectedExclusion -> null != artifact && selectedExclusion.getGroupId().equals(artifact.getGroupId()) && (selectedExclusion.getArtifactId().equals(artifact.getArtifactId()) || (selectedExclusion.getArtifactId().equals(ARTIFACT_STAR))) ); }
java
public static boolean artifactIsNotExcluded(Collection<Exclusion> exclusions, Artifact artifact) { return Optional.ofNullable(exclusions).orElse(Collections.emptyList()) .stream().noneMatch(selectedExclusion -> null != artifact && selectedExclusion.getGroupId().equals(artifact.getGroupId()) && (selectedExclusion.getArtifactId().equals(artifact.getArtifactId()) || (selectedExclusion.getArtifactId().equals(ARTIFACT_STAR))) ); }
[ "public", "static", "boolean", "artifactIsNotExcluded", "(", "Collection", "<", "Exclusion", ">", "exclusions", ",", "Artifact", "artifact", ")", "{", "return", "Optional", ".", "ofNullable", "(", "exclusions", ")", ".", "orElse", "(", "Collections", ".", "empty...
Check that an artifact is not excluded @param exclusions Collection of exclusions @param artifact Specific artifact to search through collection for @return boolean
[ "Check", "that", "an", "artifact", "is", "not", "excluded" ]
train
https://github.com/jmeter-maven-plugin/jmeter-maven-plugin/blob/63dc8b49cc6b9542deb681e25a2ada6025ddbf6b/src/main/java/com/lazerycode/jmeter/configuration/ArtifactHelpers.java#L124-L130
kaazing/java.client
amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpChannel.java
AmqpChannel.publishBasic
public AmqpChannel publishBasic(ByteBuffer body, AmqpProperties properties, String exchange, String routingKey, boolean mandatory, boolean immediate) { @SuppressWarnings("unchecked") Map<String, Object> amqpProps = (Map<String, Object>)Collections.EMPTY_MAP; if (properties != null) { amqpProps = properties.getProperties(); } HashMap<String, Object> props = (HashMap<String, Object>)amqpProps; return publishBasic(body, props, exchange, routingKey, mandatory, immediate); }
java
public AmqpChannel publishBasic(ByteBuffer body, AmqpProperties properties, String exchange, String routingKey, boolean mandatory, boolean immediate) { @SuppressWarnings("unchecked") Map<String, Object> amqpProps = (Map<String, Object>)Collections.EMPTY_MAP; if (properties != null) { amqpProps = properties.getProperties(); } HashMap<String, Object> props = (HashMap<String, Object>)amqpProps; return publishBasic(body, props, exchange, routingKey, mandatory, immediate); }
[ "public", "AmqpChannel", "publishBasic", "(", "ByteBuffer", "body", ",", "AmqpProperties", "properties", ",", "String", "exchange", ",", "String", "routingKey", ",", "boolean", "mandatory", ",", "boolean", "immediate", ")", "{", "@", "SuppressWarnings", "(", "\"un...
This method publishes a message to a specific exchange. The message will be routed to queues as defined by the exchange configuration and distributed to any active consumers when the transaction, if any, is committed. @param body @param headers @param exchange @param routingKey @param mandatory @param immediate @return AmqpChannel
[ "This", "method", "publishes", "a", "message", "to", "a", "specific", "exchange", ".", "The", "message", "will", "be", "routed", "to", "queues", "as", "defined", "by", "the", "exchange", "configuration", "and", "distributed", "to", "any", "active", "consumers"...
train
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpChannel.java#L834-L843
ManfredTremmel/gwt-bean-validators
mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/util/PhoneNumberUtil.java
PhoneNumberUtil.formatE123National
public final String formatE123National(final String pphoneNumber, final String pcountryCode) { return this.formatE123National(this.parsePhoneNumber(pphoneNumber, pcountryCode)); }
java
public final String formatE123National(final String pphoneNumber, final String pcountryCode) { return this.formatE123National(this.parsePhoneNumber(pphoneNumber, pcountryCode)); }
[ "public", "final", "String", "formatE123National", "(", "final", "String", "pphoneNumber", ",", "final", "String", "pcountryCode", ")", "{", "return", "this", ".", "formatE123National", "(", "this", ".", "parsePhoneNumber", "(", "pphoneNumber", ",", "pcountryCode", ...
format phone number in E123 national format. @param pphoneNumber phone number to format @param pcountryCode iso code of country @return formated phone number as String
[ "format", "phone", "number", "in", "E123", "national", "format", "." ]
train
https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/util/PhoneNumberUtil.java#L604-L606
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HealthCheckClient.java
HealthCheckClient.insertHealthCheck
@BetaApi public final Operation insertHealthCheck(ProjectName project, HealthCheck healthCheckResource) { InsertHealthCheckHttpRequest request = InsertHealthCheckHttpRequest.newBuilder() .setProject(project == null ? null : project.toString()) .setHealthCheckResource(healthCheckResource) .build(); return insertHealthCheck(request); }
java
@BetaApi public final Operation insertHealthCheck(ProjectName project, HealthCheck healthCheckResource) { InsertHealthCheckHttpRequest request = InsertHealthCheckHttpRequest.newBuilder() .setProject(project == null ? null : project.toString()) .setHealthCheckResource(healthCheckResource) .build(); return insertHealthCheck(request); }
[ "@", "BetaApi", "public", "final", "Operation", "insertHealthCheck", "(", "ProjectName", "project", ",", "HealthCheck", "healthCheckResource", ")", "{", "InsertHealthCheckHttpRequest", "request", "=", "InsertHealthCheckHttpRequest", ".", "newBuilder", "(", ")", ".", "se...
Creates a HealthCheck resource in the specified project using the data included in the request. <p>Sample code: <pre><code> try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) { ProjectName project = ProjectName.of("[PROJECT]"); HealthCheck healthCheckResource = HealthCheck.newBuilder().build(); Operation response = healthCheckClient.insertHealthCheck(project, healthCheckResource); } </code></pre> @param project Project ID for this request. @param healthCheckResource An HealthCheck resource. This resource defines a template for how individual virtual machines should be checked for health, via one of the supported protocols. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "a", "HealthCheck", "resource", "in", "the", "specified", "project", "using", "the", "data", "included", "in", "the", "request", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HealthCheckClient.java#L373-L382
medallia/Word2VecJava
src/main/java/com/medallia/word2vec/util/Common.java
Common.readResourceToStringChecked
public static String readResourceToStringChecked(Class<?> clazz, String fn) throws IOException { try (InputStream stream = getResourceAsStream(clazz, fn)) { return IOUtils.toString(asReaderUTF8Lenient(stream)); } }
java
public static String readResourceToStringChecked(Class<?> clazz, String fn) throws IOException { try (InputStream stream = getResourceAsStream(clazz, fn)) { return IOUtils.toString(asReaderUTF8Lenient(stream)); } }
[ "public", "static", "String", "readResourceToStringChecked", "(", "Class", "<", "?", ">", "clazz", ",", "String", "fn", ")", "throws", "IOException", "{", "try", "(", "InputStream", "stream", "=", "getResourceAsStream", "(", "clazz", ",", "fn", ")", ")", "{"...
Read the lines (as UTF8) of the resource file fn from the package of the given class into a string
[ "Read", "the", "lines", "(", "as", "UTF8", ")", "of", "the", "resource", "file", "fn", "from", "the", "package", "of", "the", "given", "class", "into", "a", "string" ]
train
https://github.com/medallia/Word2VecJava/blob/eb31fbb99ac6bbab82d7f807b3e2240edca50eb7/src/main/java/com/medallia/word2vec/util/Common.java#L136-L140
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceAvailabilityEstimatePersistenceImpl.java
CommerceAvailabilityEstimatePersistenceImpl.removeByUUID_G
@Override public CommerceAvailabilityEstimate removeByUUID_G(String uuid, long groupId) throws NoSuchAvailabilityEstimateException { CommerceAvailabilityEstimate commerceAvailabilityEstimate = findByUUID_G(uuid, groupId); return remove(commerceAvailabilityEstimate); }
java
@Override public CommerceAvailabilityEstimate removeByUUID_G(String uuid, long groupId) throws NoSuchAvailabilityEstimateException { CommerceAvailabilityEstimate commerceAvailabilityEstimate = findByUUID_G(uuid, groupId); return remove(commerceAvailabilityEstimate); }
[ "@", "Override", "public", "CommerceAvailabilityEstimate", "removeByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "throws", "NoSuchAvailabilityEstimateException", "{", "CommerceAvailabilityEstimate", "commerceAvailabilityEstimate", "=", "findByUUID_G", "(", "uu...
Removes the commerce availability estimate where uuid = &#63; and groupId = &#63; from the database. @param uuid the uuid @param groupId the group ID @return the commerce availability estimate that was removed
[ "Removes", "the", "commerce", "availability", "estimate", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#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/CommerceAvailabilityEstimatePersistenceImpl.java#L824-L831
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java
GeometryUtilities.getPolygonArea
public static double getPolygonArea( int[] x, int[] y, int N ) { int i, j; double area = 0; for( i = 0; i < N; i++ ) { j = (i + 1) % N; area += x[i] * y[j]; area -= y[i] * x[j]; } area /= 2; return (area < 0 ? -area : area); }
java
public static double getPolygonArea( int[] x, int[] y, int N ) { int i, j; double area = 0; for( i = 0; i < N; i++ ) { j = (i + 1) % N; area += x[i] * y[j]; area -= y[i] * x[j]; } area /= 2; return (area < 0 ? -area : area); }
[ "public", "static", "double", "getPolygonArea", "(", "int", "[", "]", "x", ",", "int", "[", "]", "y", ",", "int", "N", ")", "{", "int", "i", ",", "j", ";", "double", "area", "=", "0", ";", "for", "(", "i", "=", "0", ";", "i", "<", "N", ";",...
Calculates the area of a polygon from its vertices. @param x the array of x coordinates. @param y the array of y coordinates. @param N the number of sides of the polygon. @return the area of the polygon.
[ "Calculates", "the", "area", "of", "a", "polygon", "from", "its", "vertices", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java#L284-L296
eFaps/eFaps-Kernel
src/main/java/org/efaps/admin/index/Index.java
Index.getDirectory
public static Directory getDirectory() throws EFapsException { IDirectoryProvider provider = null; if (EFapsSystemConfiguration.get().containsAttributeValue(KernelSettings.INDEXDIRECTORYPROVCLASS)) { final String clazzname = EFapsSystemConfiguration.get().getAttributeValue( KernelSettings.INDEXDIRECTORYPROVCLASS); try { final Class<?> clazz = Class.forName(clazzname, false, EFapsClassLoader.getInstance()); provider = (IDirectoryProvider) clazz.newInstance(); } catch (final ClassNotFoundException | InstantiationException | IllegalAccessException e) { throw new EFapsException(Index.class, "Could not instanciate IDirectoryProvider", e); } } else { provider = new IDirectoryProvider() { @Override public Directory getDirectory() throws EFapsException { return new RAMDirectory(); } @Override public Directory getTaxonomyDirectory() throws EFapsException { return null; } }; } return provider.getDirectory(); }
java
public static Directory getDirectory() throws EFapsException { IDirectoryProvider provider = null; if (EFapsSystemConfiguration.get().containsAttributeValue(KernelSettings.INDEXDIRECTORYPROVCLASS)) { final String clazzname = EFapsSystemConfiguration.get().getAttributeValue( KernelSettings.INDEXDIRECTORYPROVCLASS); try { final Class<?> clazz = Class.forName(clazzname, false, EFapsClassLoader.getInstance()); provider = (IDirectoryProvider) clazz.newInstance(); } catch (final ClassNotFoundException | InstantiationException | IllegalAccessException e) { throw new EFapsException(Index.class, "Could not instanciate IDirectoryProvider", e); } } else { provider = new IDirectoryProvider() { @Override public Directory getDirectory() throws EFapsException { return new RAMDirectory(); } @Override public Directory getTaxonomyDirectory() throws EFapsException { return null; } }; } return provider.getDirectory(); }
[ "public", "static", "Directory", "getDirectory", "(", ")", "throws", "EFapsException", "{", "IDirectoryProvider", "provider", "=", "null", ";", "if", "(", "EFapsSystemConfiguration", ".", "get", "(", ")", ".", "containsAttributeValue", "(", "KernelSettings", ".", ...
Gets the directory. @return the directory @throws EFapsException on error
[ "Gets", "the", "directory", "." ]
train
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/index/Index.java#L95-L127
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/UcsApi.java
UcsApi.deleteContact
public ApiSuccessResponse deleteContact(String id, DeletelData deletelData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = deleteContactWithHttpInfo(id, deletelData); return resp.getData(); }
java
public ApiSuccessResponse deleteContact(String id, DeletelData deletelData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = deleteContactWithHttpInfo(id, deletelData); return resp.getData(); }
[ "public", "ApiSuccessResponse", "deleteContact", "(", "String", "id", ",", "DeletelData", "deletelData", ")", "throws", "ApiException", "{", "ApiResponse", "<", "ApiSuccessResponse", ">", "resp", "=", "deleteContactWithHttpInfo", "(", "id", ",", "deletelData", ")", ...
Delete an existing contact @param id id of the Contact (required) @param deletelData Request parameters. (optional) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Delete", "an", "existing", "contact" ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/UcsApi.java#L403-L406
lucee/Lucee
core/src/main/java/lucee/commons/collection/LinkedHashMapPro.java
LinkedHashMapPro.createEntry
@Override void createEntry(int hash, K key, V value, int bucketIndex) { HashMapPro.Entry<K, V> old = table[bucketIndex]; Entry<K, V> e = new Entry<K, V>(hash, key, value, old); table[bucketIndex] = e; e.addBefore(header); size++; }
java
@Override void createEntry(int hash, K key, V value, int bucketIndex) { HashMapPro.Entry<K, V> old = table[bucketIndex]; Entry<K, V> e = new Entry<K, V>(hash, key, value, old); table[bucketIndex] = e; e.addBefore(header); size++; }
[ "@", "Override", "void", "createEntry", "(", "int", "hash", ",", "K", "key", ",", "V", "value", ",", "int", "bucketIndex", ")", "{", "HashMapPro", ".", "Entry", "<", "K", ",", "V", ">", "old", "=", "table", "[", "bucketIndex", "]", ";", "Entry", "<...
This override differs from addEntry in that it doesn't resize the table or remove the eldest entry.
[ "This", "override", "differs", "from", "addEntry", "in", "that", "it", "doesn", "t", "resize", "the", "table", "or", "remove", "the", "eldest", "entry", "." ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/collection/LinkedHashMapPro.java#L368-L375
alkacon/opencms-core
src-gwt/org/opencms/acacia/client/CmsAttributeHandler.java
CmsAttributeHandler.addChoiceOption
private void addChoiceOption(CmsAttributeValueView reference, List<String> choicePath) { String attributeChoice = choicePath.get(0); CmsType optionType = getAttributeType().getAttributeType(attributeChoice); int valueIndex = reference.getValueIndex() + 1; CmsEntity choiceEntity = m_entityBackEnd.createEntity(null, getAttributeType().getId()); CmsAttributeValueView valueWidget = reference; if (reference.hasValue()) { valueWidget = new CmsAttributeValueView( this, m_widgetService.getAttributeLabel(attributeChoice), m_widgetService.getAttributeHelp(attributeChoice)); if (optionType.isSimpleType() && m_widgetService.isDisplaySingleLine(attributeChoice)) { valueWidget.setCompactMode(CmsAttributeValueView.COMPACT_MODE_SINGLE_LINE); } } List<CmsChoiceMenuEntryBean> menuEntries = CmsRenderer.getChoiceEntries(getAttributeType(), true); for (CmsChoiceMenuEntryBean menuEntry : menuEntries) { valueWidget.addChoice(m_widgetService, menuEntry); } m_entity.insertAttributeValue(m_attributeName, choiceEntity, valueIndex); ((FlowPanel)reference.getParent()).insert(valueWidget, valueIndex); insertHandlers(valueWidget.getValueIndex()); if (optionType.isSimpleType()) { String defaultValue = m_widgetService.getDefaultAttributeValue(attributeChoice, getSimplePath(valueIndex)); I_CmsFormEditWidget widget = m_widgetService.getAttributeFormWidget(attributeChoice); choiceEntity.addAttributeValue(attributeChoice, defaultValue); valueWidget.setValueWidget(widget, defaultValue, defaultValue, true); } else { CmsEntity value = m_entityBackEnd.createEntity(null, optionType.getId()); choiceEntity.addAttributeValue(attributeChoice, value); List<String> remainingAttributeNames = tail(choicePath); createNestedEntitiesForChoicePath(value, remainingAttributeNames); I_CmsEntityRenderer renderer = m_widgetService.getRendererForAttribute(attributeChoice, optionType); valueWidget.setValueEntity(renderer, value); } updateButtonVisisbility(); }
java
private void addChoiceOption(CmsAttributeValueView reference, List<String> choicePath) { String attributeChoice = choicePath.get(0); CmsType optionType = getAttributeType().getAttributeType(attributeChoice); int valueIndex = reference.getValueIndex() + 1; CmsEntity choiceEntity = m_entityBackEnd.createEntity(null, getAttributeType().getId()); CmsAttributeValueView valueWidget = reference; if (reference.hasValue()) { valueWidget = new CmsAttributeValueView( this, m_widgetService.getAttributeLabel(attributeChoice), m_widgetService.getAttributeHelp(attributeChoice)); if (optionType.isSimpleType() && m_widgetService.isDisplaySingleLine(attributeChoice)) { valueWidget.setCompactMode(CmsAttributeValueView.COMPACT_MODE_SINGLE_LINE); } } List<CmsChoiceMenuEntryBean> menuEntries = CmsRenderer.getChoiceEntries(getAttributeType(), true); for (CmsChoiceMenuEntryBean menuEntry : menuEntries) { valueWidget.addChoice(m_widgetService, menuEntry); } m_entity.insertAttributeValue(m_attributeName, choiceEntity, valueIndex); ((FlowPanel)reference.getParent()).insert(valueWidget, valueIndex); insertHandlers(valueWidget.getValueIndex()); if (optionType.isSimpleType()) { String defaultValue = m_widgetService.getDefaultAttributeValue(attributeChoice, getSimplePath(valueIndex)); I_CmsFormEditWidget widget = m_widgetService.getAttributeFormWidget(attributeChoice); choiceEntity.addAttributeValue(attributeChoice, defaultValue); valueWidget.setValueWidget(widget, defaultValue, defaultValue, true); } else { CmsEntity value = m_entityBackEnd.createEntity(null, optionType.getId()); choiceEntity.addAttributeValue(attributeChoice, value); List<String> remainingAttributeNames = tail(choicePath); createNestedEntitiesForChoicePath(value, remainingAttributeNames); I_CmsEntityRenderer renderer = m_widgetService.getRendererForAttribute(attributeChoice, optionType); valueWidget.setValueEntity(renderer, value); } updateButtonVisisbility(); }
[ "private", "void", "addChoiceOption", "(", "CmsAttributeValueView", "reference", ",", "List", "<", "String", ">", "choicePath", ")", "{", "String", "attributeChoice", "=", "choicePath", ".", "get", "(", "0", ")", ";", "CmsType", "optionType", "=", "getAttributeT...
Adds a new choice option.<p> @param reference the reference view @param choicePath the choice attribute path
[ "Adds", "a", "new", "choice", "option", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/CmsAttributeHandler.java#L1128-L1169
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/DateTimeField.java
DateTimeField.setTime
public int setTime(java.util.Date time, boolean bDisplayOption, int iMoveMode) { java.util.Date m_DateTime = (java.util.Date)m_data; int iYear = DBConstants.FIRST_YEAR; int iMonth = DBConstants.FIRST_DAY; int iDate = DBConstants.FIRST_MONTH; if (m_DateTime != null) //|| (m_CurrentLength == 0)) { m_calendar.setTime(m_DateTime); iYear = m_calendar.get(Calendar.YEAR); iMonth = m_calendar.get(Calendar.MONTH); iDate = m_calendar.get(Calendar.DATE); } m_calendar.setTime(time); int iHour = m_calendar.get(Calendar.HOUR_OF_DAY); int iMinute = m_calendar.get(Calendar.MINUTE); int iSecond = m_calendar.get(Calendar.SECOND); m_calendar.set(iYear, iMonth, iDate, iHour, iMinute, iSecond); java.util.Date dateNew = m_calendar.getTime(); return this.setDateTime(dateNew, bDisplayOption, iMoveMode); }
java
public int setTime(java.util.Date time, boolean bDisplayOption, int iMoveMode) { java.util.Date m_DateTime = (java.util.Date)m_data; int iYear = DBConstants.FIRST_YEAR; int iMonth = DBConstants.FIRST_DAY; int iDate = DBConstants.FIRST_MONTH; if (m_DateTime != null) //|| (m_CurrentLength == 0)) { m_calendar.setTime(m_DateTime); iYear = m_calendar.get(Calendar.YEAR); iMonth = m_calendar.get(Calendar.MONTH); iDate = m_calendar.get(Calendar.DATE); } m_calendar.setTime(time); int iHour = m_calendar.get(Calendar.HOUR_OF_DAY); int iMinute = m_calendar.get(Calendar.MINUTE); int iSecond = m_calendar.get(Calendar.SECOND); m_calendar.set(iYear, iMonth, iDate, iHour, iMinute, iSecond); java.util.Date dateNew = m_calendar.getTime(); return this.setDateTime(dateNew, bDisplayOption, iMoveMode); }
[ "public", "int", "setTime", "(", "java", ".", "util", ".", "Date", "time", ",", "boolean", "bDisplayOption", ",", "int", "iMoveMode", ")", "{", "java", ".", "util", ".", "Date", "m_DateTime", "=", "(", "java", ".", "util", ".", "Date", ")", "m_data", ...
Change the time without changing the date. @param time The date to set (only time portion is used). @param bDisplayOption Display changed fields if true. @param iMoveMode The move mode. @return The error code (or NORMAL_RETURN).
[ "Change", "the", "time", "without", "changing", "the", "date", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/DateTimeField.java#L331-L351
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/util/CollectionUtils.java
CollectionUtils.getIndex
public static <T> int getIndex(List<T> l, T o) { int i = 0; for (Object o1 : l) { if (o == o1) return i; else i++; } return -1; }
java
public static <T> int getIndex(List<T> l, T o) { int i = 0; for (Object o1 : l) { if (o == o1) return i; else i++; } return -1; }
[ "public", "static", "<", "T", ">", "int", "getIndex", "(", "List", "<", "T", ">", "l", ",", "T", "o", ")", "{", "int", "i", "=", "0", ";", "for", "(", "Object", "o1", ":", "l", ")", "{", "if", "(", "o", "==", "o1", ")", "return", "i", ";"...
Returns the index of the first occurrence in the list of the specified object, using object identity (==) not equality as the criterion for object presence. If this list does not contain the element, return -1. @param l The {@link List} to find the object in. @param o The sought-after object. @return Whether or not the List was changed.
[ "Returns", "the", "index", "of", "the", "first", "occurrence", "in", "the", "list", "of", "the", "specified", "object", "using", "object", "identity", "(", "==", ")", "not", "equality", "as", "the", "criterion", "for", "object", "presence", ".", "If", "thi...
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/CollectionUtils.java#L284-L293
LearnLib/learnlib
oracles/membership-oracles/src/main/java/de/learnlib/oracle/membership/AbstractSULOmegaOracle.java
AbstractSULOmegaOracle.newOracle
public static <S, I, O> AbstractSULOmegaOracle<S, I, O, ?> newOracle(ObservableSUL<S, I, O> sul) { return newOracle(sul, !sul.canFork()); }
java
public static <S, I, O> AbstractSULOmegaOracle<S, I, O, ?> newOracle(ObservableSUL<S, I, O> sul) { return newOracle(sul, !sul.canFork()); }
[ "public", "static", "<", "S", ",", "I", ",", "O", ">", "AbstractSULOmegaOracle", "<", "S", ",", "I", ",", "O", ",", "?", ">", "newOracle", "(", "ObservableSUL", "<", "S", ",", "I", ",", "O", ">", "sul", ")", "{", "return", "newOracle", "(", "sul"...
Creates a new {@link AbstractSULOmegaOracle} that assumes the {@link SUL} can not make deep copies. @see #newOracle(ObservableSUL, boolean) @param <S> the state type @param <I> the input type @param <O> the output type
[ "Creates", "a", "new", "{", "@link", "AbstractSULOmegaOracle", "}", "that", "assumes", "the", "{", "@link", "SUL", "}", "can", "not", "make", "deep", "copies", "." ]
train
https://github.com/LearnLib/learnlib/blob/fa38a14adcc0664099f180d671ffa42480318d7b/oracles/membership-oracles/src/main/java/de/learnlib/oracle/membership/AbstractSULOmegaOracle.java#L185-L187
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/SimpleMMcifConsumer.java
SimpleMMcifConsumer.addInfoFromESS
private void addInfoFromESS(EntitySrcSyn ess, int eId, EntityInfo c) { c.setOrganismCommon(ess.getOrganism_common_name()); c.setOrganismScientific(ess.getOrganism_scientific()); c.setOrganismTaxId(ess.getNcbi_taxonomy_id()); }
java
private void addInfoFromESS(EntitySrcSyn ess, int eId, EntityInfo c) { c.setOrganismCommon(ess.getOrganism_common_name()); c.setOrganismScientific(ess.getOrganism_scientific()); c.setOrganismTaxId(ess.getNcbi_taxonomy_id()); }
[ "private", "void", "addInfoFromESS", "(", "EntitySrcSyn", "ess", ",", "int", "eId", ",", "EntityInfo", "c", ")", "{", "c", ".", "setOrganismCommon", "(", "ess", ".", "getOrganism_common_name", "(", ")", ")", ";", "c", ".", "setOrganismScientific", "(", "ess"...
Add the information from ESS to Entity info. @param ess @param eId @param c
[ "Add", "the", "information", "from", "ESS", "to", "Entity", "info", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/SimpleMMcifConsumer.java#L1227-L1232
alkacon/opencms-core
src/org/opencms/ade/configuration/CmsADEManager.java
CmsADEManager.getFavoriteList
public List<CmsContainerElementBean> getFavoriteList(CmsObject cms) throws CmsException { CmsUser user = cms.getRequestContext().getCurrentUser(); Object obj = user.getAdditionalInfo(ADDINFO_ADE_FAVORITE_LIST); List<CmsContainerElementBean> favList = new ArrayList<CmsContainerElementBean>(); if (obj instanceof String) { try { JSONArray array = new JSONArray((String)obj); for (int i = 0; i < array.length(); i++) { try { favList.add(elementFromJson(array.getJSONObject(i))); } catch (Throwable e) { // should never happen, catches wrong or no longer existing values LOG.warn(e.getLocalizedMessage()); } } } catch (Throwable e) { // should never happen, catches json parsing LOG.warn(e.getLocalizedMessage()); } } else { // save to be better next time saveFavoriteList(cms, favList); } return favList; }
java
public List<CmsContainerElementBean> getFavoriteList(CmsObject cms) throws CmsException { CmsUser user = cms.getRequestContext().getCurrentUser(); Object obj = user.getAdditionalInfo(ADDINFO_ADE_FAVORITE_LIST); List<CmsContainerElementBean> favList = new ArrayList<CmsContainerElementBean>(); if (obj instanceof String) { try { JSONArray array = new JSONArray((String)obj); for (int i = 0; i < array.length(); i++) { try { favList.add(elementFromJson(array.getJSONObject(i))); } catch (Throwable e) { // should never happen, catches wrong or no longer existing values LOG.warn(e.getLocalizedMessage()); } } } catch (Throwable e) { // should never happen, catches json parsing LOG.warn(e.getLocalizedMessage()); } } else { // save to be better next time saveFavoriteList(cms, favList); } return favList; }
[ "public", "List", "<", "CmsContainerElementBean", ">", "getFavoriteList", "(", "CmsObject", "cms", ")", "throws", "CmsException", "{", "CmsUser", "user", "=", "cms", ".", "getRequestContext", "(", ")", ".", "getCurrentUser", "(", ")", ";", "Object", "obj", "="...
Returns the favorite list, or creates it if not available.<p> @param cms the cms context @return the favorite list @throws CmsException if something goes wrong
[ "Returns", "the", "favorite", "list", "or", "creates", "it", "if", "not", "available", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/CmsADEManager.java#L568-L595
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/JsMainImpl.java
JsMainImpl.createMessageEngine
private MessagingEngine createMessageEngine(JsMEConfig me) throws Exception { String thisMethodName = CLASS_NAME + ".createMessageEngine(JsMEConfig)"; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, thisMethodName, "replace ME name here"); } JsMessagingEngine engineImpl = null; bus = new JsBusImpl(me, this, (me.getSIBus().getName()));// getBusProxy(me); engineImpl = new JsMessagingEngineImpl(this, bus, me); MessagingEngine engine = new MessagingEngine(me, engineImpl); _messagingEngines.put(defaultMEUUID, engine); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, thisMethodName, engine.toString()); } return engine; }
java
private MessagingEngine createMessageEngine(JsMEConfig me) throws Exception { String thisMethodName = CLASS_NAME + ".createMessageEngine(JsMEConfig)"; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, thisMethodName, "replace ME name here"); } JsMessagingEngine engineImpl = null; bus = new JsBusImpl(me, this, (me.getSIBus().getName()));// getBusProxy(me); engineImpl = new JsMessagingEngineImpl(this, bus, me); MessagingEngine engine = new MessagingEngine(me, engineImpl); _messagingEngines.put(defaultMEUUID, engine); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, thisMethodName, engine.toString()); } return engine; }
[ "private", "MessagingEngine", "createMessageEngine", "(", "JsMEConfig", "me", ")", "throws", "Exception", "{", "String", "thisMethodName", "=", "CLASS_NAME", "+", "\".createMessageEngine(JsMEConfig)\"", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ...
Create a single Message Engine admin object using suppled config object.
[ "Create", "a", "single", "Message", "Engine", "admin", "object", "using", "suppled", "config", "object", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/JsMainImpl.java#L472-L493
GoogleCloudPlatform/appengine-plugins-core
src/main/java/com/google/cloud/tools/managedcloudsdk/install/ExtractorFactory.java
ExtractorFactory.newExtractor
public Extractor newExtractor(Path archive, Path destination, ProgressListener progressListener) throws UnknownArchiveTypeException { if (archive.toString().toLowerCase().endsWith(".tar.gz")) { return new Extractor(archive, destination, new TarGzExtractorProvider(), progressListener); } if (archive.toString().toLowerCase().endsWith(".zip")) { return new Extractor(archive, destination, new ZipExtractorProvider(), progressListener); } throw new UnknownArchiveTypeException(archive); }
java
public Extractor newExtractor(Path archive, Path destination, ProgressListener progressListener) throws UnknownArchiveTypeException { if (archive.toString().toLowerCase().endsWith(".tar.gz")) { return new Extractor(archive, destination, new TarGzExtractorProvider(), progressListener); } if (archive.toString().toLowerCase().endsWith(".zip")) { return new Extractor(archive, destination, new ZipExtractorProvider(), progressListener); } throw new UnknownArchiveTypeException(archive); }
[ "public", "Extractor", "newExtractor", "(", "Path", "archive", ",", "Path", "destination", ",", "ProgressListener", "progressListener", ")", "throws", "UnknownArchiveTypeException", "{", "if", "(", "archive", ".", "toString", "(", ")", ".", "toLowerCase", "(", ")"...
Creates a new extractor based on filetype. Filetype determination is based on the filename string, this method makes no attempt to validate the file contents to verify they are the type defined by the file extension. @param archive the archive to extract @param destination the destination folder for extracted files @param progressListener a listener for progress @return {@link Extractor} with {@link TarGzExtractorProvider} for ".tar.gz", {@link ZipExtractorProvider} for ".zip" @throws UnknownArchiveTypeException if not ".tar.gz" or ".zip"
[ "Creates", "a", "new", "extractor", "based", "on", "filetype", ".", "Filetype", "determination", "is", "based", "on", "the", "filename", "string", "this", "method", "makes", "no", "attempt", "to", "validate", "the", "file", "contents", "to", "verify", "they", ...
train
https://github.com/GoogleCloudPlatform/appengine-plugins-core/blob/d22e9fa1103522409ab6fdfbf68c4a5a0bc5b97d/src/main/java/com/google/cloud/tools/managedcloudsdk/install/ExtractorFactory.java#L37-L47
blinkfox/zealot
src/main/java/com/blinkfox/zealot/core/ZealotKhala.java
ZealotKhala.doIn
private ZealotKhala doIn(String prefix, String field, Object[] values, boolean match, boolean positive) { return this.doInByType(prefix, field, values, match, ZealotConst.OBJTYPE_ARRAY, positive); }
java
private ZealotKhala doIn(String prefix, String field, Object[] values, boolean match, boolean positive) { return this.doInByType(prefix, field, values, match, ZealotConst.OBJTYPE_ARRAY, positive); }
[ "private", "ZealotKhala", "doIn", "(", "String", "prefix", ",", "String", "field", ",", "Object", "[", "]", "values", ",", "boolean", "match", ",", "boolean", "positive", ")", "{", "return", "this", ".", "doInByType", "(", "prefix", ",", "field", ",", "v...
执行生成in范围查询SQL片段的方法. @param prefix 前缀 @param field 数据库字段 @param values 数组的值 @param match 是否匹配 @param positive true则表示是in,否则是not in @return ZealotKhala实例的当前实例
[ "执行生成in范围查询SQL片段的方法", "." ]
train
https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/ZealotKhala.java#L480-L482
Azure/azure-sdk-for-java
datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ProjectsInner.java
ProjectsInner.updateAsync
public Observable<ProjectInner> updateAsync(String groupName, String serviceName, String projectName, ProjectInner parameters) { return updateWithServiceResponseAsync(groupName, serviceName, projectName, parameters).map(new Func1<ServiceResponse<ProjectInner>, ProjectInner>() { @Override public ProjectInner call(ServiceResponse<ProjectInner> response) { return response.body(); } }); }
java
public Observable<ProjectInner> updateAsync(String groupName, String serviceName, String projectName, ProjectInner parameters) { return updateWithServiceResponseAsync(groupName, serviceName, projectName, parameters).map(new Func1<ServiceResponse<ProjectInner>, ProjectInner>() { @Override public ProjectInner call(ServiceResponse<ProjectInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ProjectInner", ">", "updateAsync", "(", "String", "groupName", ",", "String", "serviceName", ",", "String", "projectName", ",", "ProjectInner", "parameters", ")", "{", "return", "updateWithServiceResponseAsync", "(", "groupName", ",", "...
Update project. The project resource is a nested resource representing a stored migration project. The PATCH method updates an existing project. @param groupName Name of the resource group @param serviceName Name of the service @param projectName Name of the project @param parameters Information about the project @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ProjectInner object
[ "Update", "project", ".", "The", "project", "resource", "is", "a", "nested", "resource", "representing", "a", "stored", "migration", "project", ".", "The", "PATCH", "method", "updates", "an", "existing", "project", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ProjectsInner.java#L657-L664
molgenis/molgenis
molgenis-r/src/main/java/org/molgenis/r/RScriptExecutor.java
RScriptExecutor.executeScriptExecuteRequest
private String executeScriptExecuteRequest(String rScript) throws IOException { URI uri = getScriptExecutionUri(); HttpPost httpPost = new HttpPost(uri); NameValuePair nameValuePair = new BasicNameValuePair("x", rScript); httpPost.setEntity(new UrlEncodedFormEntity(singletonList(nameValuePair))); String openCpuSessionKey; try (CloseableHttpResponse response = httpClient.execute(httpPost)) { int statusCode = response.getStatusLine().getStatusCode(); if (statusCode >= 200 && statusCode < 300) { Header openCpuSessionKeyHeader = response.getFirstHeader("X-ocpu-session"); if (openCpuSessionKeyHeader == null) { throw new IOException("Missing 'X-ocpu-session' header"); } openCpuSessionKey = openCpuSessionKeyHeader.getValue(); EntityUtils.consume(response.getEntity()); } else if (statusCode == 400) { HttpEntity entity = response.getEntity(); String rErrorMessage = EntityUtils.toString(entity); EntityUtils.consume(entity); throw new ScriptException(rErrorMessage); } else { throw new ClientProtocolException(format(FORMAT_UNEXPECTED_RESPONSE_STATUS, statusCode)); } } return openCpuSessionKey; }
java
private String executeScriptExecuteRequest(String rScript) throws IOException { URI uri = getScriptExecutionUri(); HttpPost httpPost = new HttpPost(uri); NameValuePair nameValuePair = new BasicNameValuePair("x", rScript); httpPost.setEntity(new UrlEncodedFormEntity(singletonList(nameValuePair))); String openCpuSessionKey; try (CloseableHttpResponse response = httpClient.execute(httpPost)) { int statusCode = response.getStatusLine().getStatusCode(); if (statusCode >= 200 && statusCode < 300) { Header openCpuSessionKeyHeader = response.getFirstHeader("X-ocpu-session"); if (openCpuSessionKeyHeader == null) { throw new IOException("Missing 'X-ocpu-session' header"); } openCpuSessionKey = openCpuSessionKeyHeader.getValue(); EntityUtils.consume(response.getEntity()); } else if (statusCode == 400) { HttpEntity entity = response.getEntity(); String rErrorMessage = EntityUtils.toString(entity); EntityUtils.consume(entity); throw new ScriptException(rErrorMessage); } else { throw new ClientProtocolException(format(FORMAT_UNEXPECTED_RESPONSE_STATUS, statusCode)); } } return openCpuSessionKey; }
[ "private", "String", "executeScriptExecuteRequest", "(", "String", "rScript", ")", "throws", "IOException", "{", "URI", "uri", "=", "getScriptExecutionUri", "(", ")", ";", "HttpPost", "httpPost", "=", "new", "HttpPost", "(", "uri", ")", ";", "NameValuePair", "na...
Execute R script using OpenCPU @param rScript R script @return OpenCPU session key @throws IOException if error occured during script execution request
[ "Execute", "R", "script", "using", "OpenCPU" ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-r/src/main/java/org/molgenis/r/RScriptExecutor.java#L79-L105
OpenCompare/OpenCompare
org.opencompare/pcmdata-importers/src/main/java/data_omdb/OMDBCSVProductFactory.java
OMDBCSVProductFactory.mkCSVProduct
public String mkCSVProduct(OMDBProduct p, OMDBMediaType t) { if (t.equals(OMDBMediaType.MOVIE)) return mkCSVProductMovie(p) ; if (t.equals(OMDBMediaType.SERIES)) return mkCSVProductSerie(p) ; if (t.equals(OMDBMediaType.EPISODE)) return mkCSVProductEpisode(p); return null; }
java
public String mkCSVProduct(OMDBProduct p, OMDBMediaType t) { if (t.equals(OMDBMediaType.MOVIE)) return mkCSVProductMovie(p) ; if (t.equals(OMDBMediaType.SERIES)) return mkCSVProductSerie(p) ; if (t.equals(OMDBMediaType.EPISODE)) return mkCSVProductEpisode(p); return null; }
[ "public", "String", "mkCSVProduct", "(", "OMDBProduct", "p", ",", "OMDBMediaType", "t", ")", "{", "if", "(", "t", ".", "equals", "(", "OMDBMediaType", ".", "MOVIE", ")", ")", "return", "mkCSVProductMovie", "(", "p", ")", ";", "if", "(", "t", ".", "equa...
A CSV representation of "Product" (in fact a CSV line) the CSV representation depends on OMDB type @param p @param t @return
[ "A", "CSV", "representation", "of", "Product", "(", "in", "fact", "a", "CSV", "line", ")", "the", "CSV", "representation", "depends", "on", "OMDB", "type" ]
train
https://github.com/OpenCompare/OpenCompare/blob/6cd776466b375cb8ecca08fcd94e573d65e20b14/org.opencompare/pcmdata-importers/src/main/java/data_omdb/OMDBCSVProductFactory.java#L33-L45
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-core/src/main/java/org/deeplearning4j/evaluation/EvaluationTools.java
EvaluationTools.exportRocChartsToHtmlFile
public static void exportRocChartsToHtmlFile(ROCMultiClass roc, File file) throws Exception { String rocAsHtml = rocChartToHtml(roc); FileUtils.writeStringToFile(file, rocAsHtml, StandardCharsets.UTF_8); }
java
public static void exportRocChartsToHtmlFile(ROCMultiClass roc, File file) throws Exception { String rocAsHtml = rocChartToHtml(roc); FileUtils.writeStringToFile(file, rocAsHtml, StandardCharsets.UTF_8); }
[ "public", "static", "void", "exportRocChartsToHtmlFile", "(", "ROCMultiClass", "roc", ",", "File", "file", ")", "throws", "Exception", "{", "String", "rocAsHtml", "=", "rocChartToHtml", "(", "roc", ")", ";", "FileUtils", ".", "writeStringToFile", "(", "file", ",...
Given a {@link ROCMultiClass} chart, export the ROC chart and precision vs. recall charts to a stand-alone HTML file @param roc ROC to export @param file File to export to
[ "Given", "a", "{" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-core/src/main/java/org/deeplearning4j/evaluation/EvaluationTools.java#L133-L136
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/particles/ParticleIO.java
ParticleIO.loadConfiguredSystem
public static ParticleSystem loadConfiguredSystem(InputStream ref, Color mask) throws IOException { return loadConfiguredSystem(ref, null, null, mask); }
java
public static ParticleSystem loadConfiguredSystem(InputStream ref, Color mask) throws IOException { return loadConfiguredSystem(ref, null, null, mask); }
[ "public", "static", "ParticleSystem", "loadConfiguredSystem", "(", "InputStream", "ref", ",", "Color", "mask", ")", "throws", "IOException", "{", "return", "loadConfiguredSystem", "(", "ref", ",", "null", ",", "null", ",", "mask", ")", ";", "}" ]
Load a set of configured emitters into a single system @param ref The stream to read the XML from @param mask The mask used to make the particle image transparent @return A configured particle system @throws IOException Indicates a failure to find, read or parse the XML file
[ "Load", "a", "set", "of", "configured", "emitters", "into", "a", "single", "system" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/particles/ParticleIO.java#L95-L98
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.getRegexEntityRoles
public List<EntityRole> getRegexEntityRoles(UUID appId, String versionId, UUID entityId) { return getRegexEntityRolesWithServiceResponseAsync(appId, versionId, entityId).toBlocking().single().body(); }
java
public List<EntityRole> getRegexEntityRoles(UUID appId, String versionId, UUID entityId) { return getRegexEntityRolesWithServiceResponseAsync(appId, versionId, entityId).toBlocking().single().body(); }
[ "public", "List", "<", "EntityRole", ">", "getRegexEntityRoles", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "entityId", ")", "{", "return", "getRegexEntityRolesWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "entityId", ")", "."...
Get All Entity Roles for a given entity. @param appId The application ID. @param versionId The version ID. @param entityId entity Id @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the List&lt;EntityRole&gt; object if successful.
[ "Get", "All", "Entity", "Roles", "for", "a", "given", "entity", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L8499-L8501
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
Resolve.accessMethod
Symbol accessMethod(Symbol sym, DiagnosticPosition pos, Symbol location, Type site, Name name, boolean qualified, List<Type> argtypes, List<Type> typeargtypes) { return accessInternal(sym, pos, location, site, name, qualified, argtypes, typeargtypes, methodLogResolveHelper); }
java
Symbol accessMethod(Symbol sym, DiagnosticPosition pos, Symbol location, Type site, Name name, boolean qualified, List<Type> argtypes, List<Type> typeargtypes) { return accessInternal(sym, pos, location, site, name, qualified, argtypes, typeargtypes, methodLogResolveHelper); }
[ "Symbol", "accessMethod", "(", "Symbol", "sym", ",", "DiagnosticPosition", "pos", ",", "Symbol", "location", ",", "Type", "site", ",", "Name", "name", ",", "boolean", "qualified", ",", "List", "<", "Type", ">", "argtypes", ",", "List", "<", "Type", ">", ...
Variant of the generalized access routine, to be used for generating method resolution diagnostics
[ "Variant", "of", "the", "generalized", "access", "routine", "to", "be", "used", "for", "generating", "method", "resolution", "diagnostics" ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java#L2458-L2467
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/launchable/LauncherModel.java
LauncherModel.computeVector
private Force computeVector(Force vector) { if (target != null) { return computeVector(vector, target); } vector.setDestination(vector.getDirectionHorizontal(), vector.getDirectionVertical()); return vector; }
java
private Force computeVector(Force vector) { if (target != null) { return computeVector(vector, target); } vector.setDestination(vector.getDirectionHorizontal(), vector.getDirectionVertical()); return vector; }
[ "private", "Force", "computeVector", "(", "Force", "vector", ")", "{", "if", "(", "target", "!=", "null", ")", "{", "return", "computeVector", "(", "vector", ",", "target", ")", ";", "}", "vector", ".", "setDestination", "(", "vector", ".", "getDirectionHo...
Compute the vector used for launch. @param vector The initial vector used for launch. @return The vector used for launch.
[ "Compute", "the", "vector", "used", "for", "launch", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/launchable/LauncherModel.java#L188-L196
dkpro/dkpro-jwpl
de.tudarmstadt.ukp.wikipedia.api/src/main/java/de/tudarmstadt/ukp/wikipedia/api/Wikipedia.java
Wikipedia.getCategory
public Category getCategory(int pageId) { long hibernateId = __getCategoryHibernateId(pageId); if (hibernateId == -1) { return null; } try { Category cat = new Category(this, hibernateId); return cat; } catch (WikiPageNotFoundException e) { return null; } }
java
public Category getCategory(int pageId) { long hibernateId = __getCategoryHibernateId(pageId); if (hibernateId == -1) { return null; } try { Category cat = new Category(this, hibernateId); return cat; } catch (WikiPageNotFoundException e) { return null; } }
[ "public", "Category", "getCategory", "(", "int", "pageId", ")", "{", "long", "hibernateId", "=", "__getCategoryHibernateId", "(", "pageId", ")", ";", "if", "(", "hibernateId", "==", "-", "1", ")", "{", "return", "null", ";", "}", "try", "{", "Category", ...
Gets the category for a given pageId. @param pageId The id of the {@link Category}. @return The category object or null if no category with this pageId exists.
[ "Gets", "the", "category", "for", "a", "given", "pageId", "." ]
train
https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.api/src/main/java/de/tudarmstadt/ukp/wikipedia/api/Wikipedia.java#L473-L485
jeremylong/DependencyCheck
utils/src/main/java/org/owasp/dependencycheck/utils/Settings.java
Settings.setInt
public void setInt(@NotNull final String key, @NotNull final int value) { props.setProperty(key, String.valueOf(value)); LOGGER.debug("Setting: {}='{}'", key, value); }
java
public void setInt(@NotNull final String key, @NotNull final int value) { props.setProperty(key, String.valueOf(value)); LOGGER.debug("Setting: {}='{}'", key, value); }
[ "public", "void", "setInt", "(", "@", "NotNull", "final", "String", "key", ",", "@", "NotNull", "final", "int", "value", ")", "{", "props", ".", "setProperty", "(", "key", ",", "String", ".", "valueOf", "(", "value", ")", ")", ";", "LOGGER", ".", "de...
Sets a property value. @param key the key for the property @param value the value for the property
[ "Sets", "a", "property", "value", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/utils/src/main/java/org/owasp/dependencycheck/utils/Settings.java#L746-L749
j256/ormlite-core
src/main/java/com/j256/ormlite/dao/DaoManager.java
DaoManager.registerDaoWithTableConfig
public static synchronized void registerDaoWithTableConfig(ConnectionSource connectionSource, Dao<?, ?> dao) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } if (dao instanceof BaseDaoImpl) { DatabaseTableConfig<?> tableConfig = ((BaseDaoImpl<?, ?>) dao).getTableConfig(); if (tableConfig != null) { addDaoToTableMap(new TableConfigConnectionSource(connectionSource, tableConfig), dao); return; } } addDaoToClassMap(new ClassConnectionSource(connectionSource, dao.getDataClass()), dao); }
java
public static synchronized void registerDaoWithTableConfig(ConnectionSource connectionSource, Dao<?, ?> dao) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } if (dao instanceof BaseDaoImpl) { DatabaseTableConfig<?> tableConfig = ((BaseDaoImpl<?, ?>) dao).getTableConfig(); if (tableConfig != null) { addDaoToTableMap(new TableConfigConnectionSource(connectionSource, tableConfig), dao); return; } } addDaoToClassMap(new ClassConnectionSource(connectionSource, dao.getDataClass()), dao); }
[ "public", "static", "synchronized", "void", "registerDaoWithTableConfig", "(", "ConnectionSource", "connectionSource", ",", "Dao", "<", "?", ",", "?", ">", "dao", ")", "{", "if", "(", "connectionSource", "==", "null", ")", "{", "throw", "new", "IllegalArgumentEx...
Same as {@link #registerDao(ConnectionSource, Dao)} but this allows you to register it just with its {@link DatabaseTableConfig}. This allows multiple versions of the DAO to be configured if necessary.
[ "Same", "as", "{" ]
train
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/dao/DaoManager.java#L200-L212
grails/grails-core
grails-core/src/main/groovy/grails/util/GrailsClassUtils.java
GrailsClassUtils.getBooleanFromMap
public static boolean getBooleanFromMap(String key, Map<?, ?> map, boolean defaultValue) { if (map == null) return defaultValue; if (map.containsKey(key)) { Object o = map.get(key); if (o == null) { return defaultValue; } if (o instanceof Boolean) { return (Boolean)o; } return Boolean.valueOf(o.toString()); } return defaultValue; }
java
public static boolean getBooleanFromMap(String key, Map<?, ?> map, boolean defaultValue) { if (map == null) return defaultValue; if (map.containsKey(key)) { Object o = map.get(key); if (o == null) { return defaultValue; } if (o instanceof Boolean) { return (Boolean)o; } return Boolean.valueOf(o.toString()); } return defaultValue; }
[ "public", "static", "boolean", "getBooleanFromMap", "(", "String", "key", ",", "Map", "<", "?", ",", "?", ">", "map", ",", "boolean", "defaultValue", ")", "{", "if", "(", "map", "==", "null", ")", "return", "defaultValue", ";", "if", "(", "map", ".", ...
Retrieves a boolean value from a Map for the given key @param key The key that references the boolean value @param map The map to look in @return A boolean value which will be false if the map is null, the map doesn't contain the key or the value is false
[ "Retrieves", "a", "boolean", "value", "from", "a", "Map", "for", "the", "given", "key" ]
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/grails/util/GrailsClassUtils.java#L824-L837
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstructorBuilder.java
ConstructorBuilder.getInstance
public static ConstructorBuilder getInstance(Context context, ClassDoc classDoc, ConstructorWriter writer) { return new ConstructorBuilder(context, classDoc, writer); }
java
public static ConstructorBuilder getInstance(Context context, ClassDoc classDoc, ConstructorWriter writer) { return new ConstructorBuilder(context, classDoc, writer); }
[ "public", "static", "ConstructorBuilder", "getInstance", "(", "Context", "context", ",", "ClassDoc", "classDoc", ",", "ConstructorWriter", "writer", ")", "{", "return", "new", "ConstructorBuilder", "(", "context", ",", "classDoc", ",", "writer", ")", ";", "}" ]
Construct a new ConstructorBuilder. @param context the build context. @param classDoc the class whoses members are being documented. @param writer the doclet specific writer.
[ "Construct", "a", "new", "ConstructorBuilder", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstructorBuilder.java#L116-L119
cdk/cdk
storage/smiles/src/main/java/org/openscience/cdk/smiles/SmilesParser.java
SmilesParser.parseMolCXSMILES
private void parseMolCXSMILES(String title, IAtomContainer mol) { CxSmilesState cxstate; int pos; if (title != null && title.startsWith("|")) { if ((pos = CxSmilesParser.processCx(title, cxstate = new CxSmilesState())) >= 0) { // set the correct title mol.setTitle(title.substring(pos)); final Map<IAtom, IAtomContainer> atomToMol = Maps.newHashMapWithExpectedSize(mol.getAtomCount()); final List<IAtom> atoms = new ArrayList<>(mol.getAtomCount()); for (IAtom atom : mol.atoms()) { atoms.add(atom); atomToMol.put(atom, mol); } assignCxSmilesInfo(mol.getBuilder(), mol, atoms, atomToMol, cxstate); } } }
java
private void parseMolCXSMILES(String title, IAtomContainer mol) { CxSmilesState cxstate; int pos; if (title != null && title.startsWith("|")) { if ((pos = CxSmilesParser.processCx(title, cxstate = new CxSmilesState())) >= 0) { // set the correct title mol.setTitle(title.substring(pos)); final Map<IAtom, IAtomContainer> atomToMol = Maps.newHashMapWithExpectedSize(mol.getAtomCount()); final List<IAtom> atoms = new ArrayList<>(mol.getAtomCount()); for (IAtom atom : mol.atoms()) { atoms.add(atom); atomToMol.put(atom, mol); } assignCxSmilesInfo(mol.getBuilder(), mol, atoms, atomToMol, cxstate); } } }
[ "private", "void", "parseMolCXSMILES", "(", "String", "title", ",", "IAtomContainer", "mol", ")", "{", "CxSmilesState", "cxstate", ";", "int", "pos", ";", "if", "(", "title", "!=", "null", "&&", "title", ".", "startsWith", "(", "\"|\"", ")", ")", "{", "i...
Parses CXSMILES layer and set attributes for atoms and bonds on the provided molecule. @param title SMILES title field @param mol molecule
[ "Parses", "CXSMILES", "layer", "and", "set", "attributes", "for", "atoms", "and", "bonds", "on", "the", "provided", "molecule", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/storage/smiles/src/main/java/org/openscience/cdk/smiles/SmilesParser.java#L310-L330
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
MSPDIReader.readAssignmentExtendedAttributes
private void readAssignmentExtendedAttributes(Project.Assignments.Assignment xml, ResourceAssignment mpx) { for (Project.Assignments.Assignment.ExtendedAttribute attrib : xml.getExtendedAttribute()) { int xmlFieldID = Integer.parseInt(attrib.getFieldID()) & 0x0000FFFF; AssignmentField mpxFieldID = MPPAssignmentField.getInstance(xmlFieldID); TimeUnit durationFormat = DatatypeConverter.parseDurationTimeUnits(attrib.getDurationFormat(), null); DatatypeConverter.parseExtendedAttribute(m_projectFile, mpx, attrib.getValue(), mpxFieldID, durationFormat); } }
java
private void readAssignmentExtendedAttributes(Project.Assignments.Assignment xml, ResourceAssignment mpx) { for (Project.Assignments.Assignment.ExtendedAttribute attrib : xml.getExtendedAttribute()) { int xmlFieldID = Integer.parseInt(attrib.getFieldID()) & 0x0000FFFF; AssignmentField mpxFieldID = MPPAssignmentField.getInstance(xmlFieldID); TimeUnit durationFormat = DatatypeConverter.parseDurationTimeUnits(attrib.getDurationFormat(), null); DatatypeConverter.parseExtendedAttribute(m_projectFile, mpx, attrib.getValue(), mpxFieldID, durationFormat); } }
[ "private", "void", "readAssignmentExtendedAttributes", "(", "Project", ".", "Assignments", ".", "Assignment", "xml", ",", "ResourceAssignment", "mpx", ")", "{", "for", "(", "Project", ".", "Assignments", ".", "Assignment", ".", "ExtendedAttribute", "attrib", ":", ...
This method processes any extended attributes associated with a resource assignment. @param xml MSPDI resource assignment instance @param mpx MPX task instance
[ "This", "method", "processes", "any", "extended", "attributes", "associated", "with", "a", "resource", "assignment", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L1721-L1730
lotaris/rox-client-java
rox-client-java/src/main/java/com/lotaris/rox/core/filters/FilterUtils.java
FilterUtils.isRunnable
private static boolean isRunnable(FilterTargetData targetData, String[] filters) { if (filters == null || filters.length == 0) { return true; } for (String filter : filters) { String[] filterSplitted = filter.split(":"); // We must evaluate all the filters and return only when there is a valid match if ( (filterSplitted.length == 1 && targetData.anyMatch(filterSplitted[0])) || // Any filter ("key".equalsIgnoreCase(filterSplitted[0]) && targetData.keyMatch(filterSplitted[1])) || // Key filter ("name".equalsIgnoreCase(filterSplitted[0]) && targetData.nameMatch(filterSplitted[1])) || // Name filter ("tag".equalsIgnoreCase(filterSplitted[0]) && targetData.tagMatch(filterSplitted[1])) || // Tag filter ("ticket".equalsIgnoreCase(filterSplitted[0]) && targetData.ticketMatch(filterSplitted[1])) // Ticket filter ) { return true; } } return false; }
java
private static boolean isRunnable(FilterTargetData targetData, String[] filters) { if (filters == null || filters.length == 0) { return true; } for (String filter : filters) { String[] filterSplitted = filter.split(":"); // We must evaluate all the filters and return only when there is a valid match if ( (filterSplitted.length == 1 && targetData.anyMatch(filterSplitted[0])) || // Any filter ("key".equalsIgnoreCase(filterSplitted[0]) && targetData.keyMatch(filterSplitted[1])) || // Key filter ("name".equalsIgnoreCase(filterSplitted[0]) && targetData.nameMatch(filterSplitted[1])) || // Name filter ("tag".equalsIgnoreCase(filterSplitted[0]) && targetData.tagMatch(filterSplitted[1])) || // Tag filter ("ticket".equalsIgnoreCase(filterSplitted[0]) && targetData.ticketMatch(filterSplitted[1])) // Ticket filter ) { return true; } } return false; }
[ "private", "static", "boolean", "isRunnable", "(", "FilterTargetData", "targetData", ",", "String", "[", "]", "filters", ")", "{", "if", "(", "filters", "==", "null", "||", "filters", ".", "length", "==", "0", ")", "{", "return", "true", ";", "}", "for",...
Define if a test is runnable based on the object that represents the test meta data @param targetData The meta data @param filters The filters @return True if the test can be run
[ "Define", "if", "a", "test", "is", "runnable", "based", "on", "the", "object", "that", "represents", "the", "test", "meta", "data" ]
train
https://github.com/lotaris/rox-client-java/blob/1b33f7560347c382c59a40c4037d175ab8127fde/rox-client-java/src/main/java/com/lotaris/rox/core/filters/FilterUtils.java#L76-L97
casmi/casmi
src/main/java/casmi/graphics/element/Bezier.java
Bezier.setNode
public void setNode(int number, Vector3D v) { setNode(number, v.getX(), v.getY(), v.getZ()); }
java
public void setNode(int number, Vector3D v) { setNode(number, v.getX(), v.getY(), v.getZ()); }
[ "public", "void", "setNode", "(", "int", "number", ",", "Vector3D", "v", ")", "{", "setNode", "(", "number", ",", "v", ".", "getX", "(", ")", ",", "v", ".", "getY", "(", ")", ",", "v", ".", "getZ", "(", ")", ")", ";", "}" ]
Sets coordinate of nodes of this Bezier. @param number The number of a node. The node whose number is 0 or 3 is a anchor point, and the node whose number is 1 or 2 is a control point. @param v The coordinates of this node.
[ "Sets", "coordinate", "of", "nodes", "of", "this", "Bezier", "." ]
train
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Bezier.java#L179-L181
ronmamo/reflections
src/main/java/org/reflections/Reflections.java
Reflections.save
public File save(final String filename, final Serializer serializer) { File file = serializer.save(this, filename); if (log != null) //noinspection ConstantConditions log.info("Reflections successfully saved in " + file.getAbsolutePath() + " using " + serializer.getClass().getSimpleName()); return file; }
java
public File save(final String filename, final Serializer serializer) { File file = serializer.save(this, filename); if (log != null) //noinspection ConstantConditions log.info("Reflections successfully saved in " + file.getAbsolutePath() + " using " + serializer.getClass().getSimpleName()); return file; }
[ "public", "File", "save", "(", "final", "String", "filename", ",", "final", "Serializer", "serializer", ")", "{", "File", "file", "=", "serializer", ".", "save", "(", "this", ",", "filename", ")", ";", "if", "(", "log", "!=", "null", ")", "//noinspection...
serialize to a given directory and filename using given serializer <p>* it is preferred to specify a designated directory (for example META-INF/reflections), so that it could be found later much faster using the load method
[ "serialize", "to", "a", "given", "directory", "and", "filename", "using", "given", "serializer", "<p", ">", "*", "it", "is", "preferred", "to", "specify", "a", "designated", "directory", "(", "for", "example", "META", "-", "INF", "/", "reflections", ")", "...
train
https://github.com/ronmamo/reflections/blob/084cf4a759a06d88e88753ac00397478c2e0ed52/src/main/java/org/reflections/Reflections.java#L669-L674
minio/minio-java
api/src/main/java/io/minio/MinioClient.java
MinioClient.setAppInfo
@SuppressWarnings("unused") public void setAppInfo(String name, String version) { if (name == null || version == null) { // nothing to do return; } this.userAgent = DEFAULT_USER_AGENT + " " + name.trim() + "/" + version.trim(); }
java
@SuppressWarnings("unused") public void setAppInfo(String name, String version) { if (name == null || version == null) { // nothing to do return; } this.userAgent = DEFAULT_USER_AGENT + " " + name.trim() + "/" + version.trim(); }
[ "@", "SuppressWarnings", "(", "\"unused\"", ")", "public", "void", "setAppInfo", "(", "String", "name", ",", "String", "version", ")", "{", "if", "(", "name", "==", "null", "||", "version", "==", "null", ")", "{", "// nothing to do", "return", ";", "}", ...
Sets application's name/version to user agent. For more information about user agent refer <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html">#rfc2616</a>. @param name Your application name. @param version Your application version.
[ "Sets", "application", "s", "name", "/", "version", "to", "user", "agent", ".", "For", "more", "information", "about", "user", "agent", "refer", "<a", "href", "=", "http", ":", "//", "www", ".", "w3", ".", "org", "/", "Protocols", "/", "rfc2616", "/", ...
train
https://github.com/minio/minio-java/blob/b2028f56403c89ce2d5900ae813bc1314c87bc7f/api/src/main/java/io/minio/MinioClient.java#L1438-L1446
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/SealedObject.java
SealedObject.getObject
public final Object getObject(Key key) throws IOException, ClassNotFoundException, NoSuchAlgorithmException, InvalidKeyException { if (key == null) { throw new NullPointerException("key is null"); } try { return unseal(key, null); } catch (NoSuchProviderException nspe) { // we've already caught NoSuchProviderException's and converted // them into NoSuchAlgorithmException's with details about // the failing algorithm throw new NoSuchAlgorithmException("algorithm not found"); } catch (IllegalBlockSizeException ibse) { throw new InvalidKeyException(ibse.getMessage()); } catch (BadPaddingException bpe) { throw new InvalidKeyException(bpe.getMessage()); } }
java
public final Object getObject(Key key) throws IOException, ClassNotFoundException, NoSuchAlgorithmException, InvalidKeyException { if (key == null) { throw new NullPointerException("key is null"); } try { return unseal(key, null); } catch (NoSuchProviderException nspe) { // we've already caught NoSuchProviderException's and converted // them into NoSuchAlgorithmException's with details about // the failing algorithm throw new NoSuchAlgorithmException("algorithm not found"); } catch (IllegalBlockSizeException ibse) { throw new InvalidKeyException(ibse.getMessage()); } catch (BadPaddingException bpe) { throw new InvalidKeyException(bpe.getMessage()); } }
[ "public", "final", "Object", "getObject", "(", "Key", "key", ")", "throws", "IOException", ",", "ClassNotFoundException", ",", "NoSuchAlgorithmException", ",", "InvalidKeyException", "{", "if", "(", "key", "==", "null", ")", "{", "throw", "new", "NullPointerExcept...
Retrieves the original (encapsulated) object. <p>This method creates a cipher for the algorithm that had been used in the sealing operation. If the default provider package provides an implementation of that algorithm, an instance of Cipher containing that implementation is used. If the algorithm is not available in the default package, other packages are searched. The Cipher object is initialized for decryption, using the given <code>key</code> and the parameters (if any) that had been used in the sealing operation. <p>The encapsulated object is unsealed and de-serialized, before it is returned. @param key the key used to unseal the object. @return the original object. @exception IOException if an error occurs during de-serialiazation. @exception ClassNotFoundException if an error occurs during de-serialiazation. @exception NoSuchAlgorithmException if the algorithm to unseal the object is not available. @exception InvalidKeyException if the given key cannot be used to unseal the object (e.g., it has the wrong algorithm). @exception NullPointerException if <code>key</code> is null.
[ "Retrieves", "the", "original", "(", "encapsulated", ")", "object", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/SealedObject.java#L242-L262
crnk-project/crnk-framework
crnk-operations/src/main/java/io/crnk/operations/server/OperationsModule.java
OperationsModule.checkAccess
private void checkAccess(List<Operation> operations, QueryContext queryContext) { for (Operation operation : operations) { checkAccess(operation, queryContext); } }
java
private void checkAccess(List<Operation> operations, QueryContext queryContext) { for (Operation operation : operations) { checkAccess(operation, queryContext); } }
[ "private", "void", "checkAccess", "(", "List", "<", "Operation", ">", "operations", ",", "QueryContext", "queryContext", ")", "{", "for", "(", "Operation", "operation", ":", "operations", ")", "{", "checkAccess", "(", "operation", ",", "queryContext", ")", ";"...
This is not strictly necessary, but allows to catch security issues early before accessing the individual repositories
[ "This", "is", "not", "strictly", "necessary", "but", "allows", "to", "catch", "security", "issues", "early", "before", "accessing", "the", "individual", "repositories" ]
train
https://github.com/crnk-project/crnk-framework/blob/2fd3ef9a991788d46fd2e83b43c8ea37cbaf8681/crnk-operations/src/main/java/io/crnk/operations/server/OperationsModule.java#L117-L121
rundeck/rundeck
core/src/main/java/com/dtolabs/utils/Mapper.java
Mapper.mapEntries
public static Map mapEntries(Mapper mapper, Map map, boolean includeNull){ HashMap h = new HashMap(); for (Object e : map.entrySet()) { Map.Entry entry = (Map.Entry) e; Object k = entry.getKey(); Object v = entry.getValue(); Object nk = mapper.map(k); Object o = mapper.map(v); if (includeNull || (o != null && nk != null)) { h.put(nk, o); } } return h; }
java
public static Map mapEntries(Mapper mapper, Map map, boolean includeNull){ HashMap h = new HashMap(); for (Object e : map.entrySet()) { Map.Entry entry = (Map.Entry) e; Object k = entry.getKey(); Object v = entry.getValue(); Object nk = mapper.map(k); Object o = mapper.map(v); if (includeNull || (o != null && nk != null)) { h.put(nk, o); } } return h; }
[ "public", "static", "Map", "mapEntries", "(", "Mapper", "mapper", ",", "Map", "map", ",", "boolean", "includeNull", ")", "{", "HashMap", "h", "=", "new", "HashMap", "(", ")", ";", "for", "(", "Object", "e", ":", "map", ".", "entrySet", "(", ")", ")",...
Create a new Map by mapping all values from the original map, and mapping all keys. @param mapper a Mapper to map both values and keys @param map Map input @param includeNull if true, allow null as either key or value after mapping @return a new Map with both keys and values mapped using the Mapper
[ "Create", "a", "new", "Map", "by", "mapping", "all", "values", "from", "the", "original", "map", "and", "mapping", "all", "keys", "." ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/utils/Mapper.java#L463-L476
Javacord/Javacord
javacord-core/src/main/java/org/javacord/core/entity/server/ServerImpl.java
ServerImpl.getOrCreateServerVoiceChannel
public ServerVoiceChannel getOrCreateServerVoiceChannel(JsonNode data) { long id = Long.parseLong(data.get("id").asText()); ChannelType type = ChannelType.fromId(data.get("type").asInt()); synchronized (this) { if (type == ChannelType.SERVER_VOICE_CHANNEL) { return getVoiceChannelById(id).orElseGet(() -> new ServerVoiceChannelImpl(api, this, data)); } } // Invalid channel type return null; }
java
public ServerVoiceChannel getOrCreateServerVoiceChannel(JsonNode data) { long id = Long.parseLong(data.get("id").asText()); ChannelType type = ChannelType.fromId(data.get("type").asInt()); synchronized (this) { if (type == ChannelType.SERVER_VOICE_CHANNEL) { return getVoiceChannelById(id).orElseGet(() -> new ServerVoiceChannelImpl(api, this, data)); } } // Invalid channel type return null; }
[ "public", "ServerVoiceChannel", "getOrCreateServerVoiceChannel", "(", "JsonNode", "data", ")", "{", "long", "id", "=", "Long", ".", "parseLong", "(", "data", ".", "get", "(", "\"id\"", ")", ".", "asText", "(", ")", ")", ";", "ChannelType", "type", "=", "Ch...
Gets or creates a server voice channel. @param data The json data of the channel. @return The server voice channel.
[ "Gets", "or", "creates", "a", "server", "voice", "channel", "." ]
train
https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/entity/server/ServerImpl.java#L637-L647
gresrun/jesque
src/main/java/net/greghaines/jesque/utils/ReflectionUtils.java
ReflectionUtils.invokeSetters
public static <T> T invokeSetters(final T instance, final Map<String,Object> vars) throws ReflectiveOperationException { if (instance != null && vars != null) { final Class<?> clazz = instance.getClass(); final Method[] methods = clazz.getMethods(); for (final Entry<String,Object> entry : vars.entrySet()) { final String methodName = "set" + entry.getKey().substring(0, 1).toUpperCase(Locale.US) + entry.getKey().substring(1); boolean found = false; for (final Method method : methods) { if (methodName.equals(method.getName()) && method.getParameterTypes().length == 1) { method.invoke(instance, entry.getValue()); found = true; break; } } if (!found) { throw new NoSuchMethodException("Expected setter named '" + methodName + "' for var '" + entry.getKey() + "'"); } } } return instance; }
java
public static <T> T invokeSetters(final T instance, final Map<String,Object> vars) throws ReflectiveOperationException { if (instance != null && vars != null) { final Class<?> clazz = instance.getClass(); final Method[] methods = clazz.getMethods(); for (final Entry<String,Object> entry : vars.entrySet()) { final String methodName = "set" + entry.getKey().substring(0, 1).toUpperCase(Locale.US) + entry.getKey().substring(1); boolean found = false; for (final Method method : methods) { if (methodName.equals(method.getName()) && method.getParameterTypes().length == 1) { method.invoke(instance, entry.getValue()); found = true; break; } } if (!found) { throw new NoSuchMethodException("Expected setter named '" + methodName + "' for var '" + entry.getKey() + "'"); } } } return instance; }
[ "public", "static", "<", "T", ">", "T", "invokeSetters", "(", "final", "T", "instance", ",", "final", "Map", "<", "String", ",", "Object", ">", "vars", ")", "throws", "ReflectiveOperationException", "{", "if", "(", "instance", "!=", "null", "&&", "vars", ...
Invoke the setters for the given variables on the given instance. @param <T> the instance type @param instance the instance to inject with the variables @param vars the variables to inject @return the instance @throws ReflectiveOperationException if there was a problem finding or invoking a setter method
[ "Invoke", "the", "setters", "for", "the", "given", "variables", "on", "the", "given", "instance", "." ]
train
https://github.com/gresrun/jesque/blob/44749183dccc40962a94c2af547ea7d0d880b5d1/src/main/java/net/greghaines/jesque/utils/ReflectionUtils.java#L462-L485
xdcrafts/flower
flower-tools/src/main/java/com/github/xdcrafts/flower/tools/ListApi.java
ListApi.getMapUnsafe
public static <A, B> Map<A, B> getMapUnsafe(final List list, final Integer... path) { return getUnsafe(list, Map.class, path); }
java
public static <A, B> Map<A, B> getMapUnsafe(final List list, final Integer... path) { return getUnsafe(list, Map.class, path); }
[ "public", "static", "<", "A", ",", "B", ">", "Map", "<", "A", ",", "B", ">", "getMapUnsafe", "(", "final", "List", "list", ",", "final", "Integer", "...", "path", ")", "{", "return", "getUnsafe", "(", "list", ",", "Map", ".", "class", ",", "path", ...
Get map value by path. @param <A> map key type @param <B> map value type @param list subject @param path nodes to walk in map @return value
[ "Get", "map", "value", "by", "path", "." ]
train
https://github.com/xdcrafts/flower/blob/96a8e49102fea434bd383a3c7852f0ee9545f999/flower-tools/src/main/java/com/github/xdcrafts/flower/tools/ListApi.java#L196-L198
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.task_domain_id_argument_key_GET
public OvhDomainTaskArgument task_domain_id_argument_key_GET(Long id, String key) throws IOException { String qPath = "/me/task/domain/{id}/argument/{key}"; StringBuilder sb = path(qPath, id, key); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhDomainTaskArgument.class); }
java
public OvhDomainTaskArgument task_domain_id_argument_key_GET(Long id, String key) throws IOException { String qPath = "/me/task/domain/{id}/argument/{key}"; StringBuilder sb = path(qPath, id, key); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhDomainTaskArgument.class); }
[ "public", "OvhDomainTaskArgument", "task_domain_id_argument_key_GET", "(", "Long", "id", ",", "String", "key", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/task/domain/{id}/argument/{key}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ...
Get this object properties REST: GET /me/task/domain/{id}/argument/{key} @param id [required] Id of the task @param key [required] Key of the argument
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L2374-L2379
joniles/mpxj
src/main/java/net/sf/mpxj/Task.java
Task.setBaselineEstimatedDuration
public void setBaselineEstimatedDuration(int baselineNumber, Duration value) { set(selectField(TaskFieldLists.BASELINE_ESTIMATED_DURATIONS, baselineNumber), value); }
java
public void setBaselineEstimatedDuration(int baselineNumber, Duration value) { set(selectField(TaskFieldLists.BASELINE_ESTIMATED_DURATIONS, baselineNumber), value); }
[ "public", "void", "setBaselineEstimatedDuration", "(", "int", "baselineNumber", ",", "Duration", "value", ")", "{", "set", "(", "selectField", "(", "TaskFieldLists", ".", "BASELINE_ESTIMATED_DURATIONS", ",", "baselineNumber", ")", ",", "value", ")", ";", "}" ]
Set a baseline value. @param baselineNumber baseline index (1-10) @param value baseline value
[ "Set", "a", "baseline", "value", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Task.java#L4361-L4364