repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
igniterealtime/Smack
smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java
AbstractXMPPConnection.populateHostAddresses
protected List<HostAddress> populateHostAddresses() { """ 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. """ 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", ")", "{", "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", ";", "}" ]
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", "NX_DOMAIN", "then", "{", "@link", "#hostAddresses", "}", "will", "be", "populated", "with", "the", "empty", "list", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java#L731-L752
jbundle/jbundle
base/screen/model/src/main/java/org/jbundle/base/screen/model/BaseGridTableScreen.java
BaseGridTableScreen.setSelectQuery
public boolean setSelectQuery(Rec recMaint, boolean bUpdateOnSelect) { """ Find the sub-screen that uses this grid query and set for selection. When you select a new record here, you read the same record in the SelectQuery. @param recMaint The record which is synced on record change. @param bUpdateOnSelect Do I update the current record if a selection occurs. @return True if successful. """ if (recMaint == null) return true; // BaseTable Set! if (this.getMainRecord() != null) if (this.getMainRecord() != recMaint) if (this.getMainRecord().getBaseRecord().getTableNames(false).equals(recMaint.getTableNames(false))) { // Only trigger when the grid table sends the selection message this.getMainRecord().addListener(new OnSelectHandler((Record)recMaint, bUpdateOnSelect, DBConstants.USER_DEFINED_TYPE)); return true; // BaseTable Set! } return false; }
java
public boolean setSelectQuery(Rec recMaint, boolean bUpdateOnSelect) { if (recMaint == null) return true; // BaseTable Set! if (this.getMainRecord() != null) if (this.getMainRecord() != recMaint) if (this.getMainRecord().getBaseRecord().getTableNames(false).equals(recMaint.getTableNames(false))) { // Only trigger when the grid table sends the selection message this.getMainRecord().addListener(new OnSelectHandler((Record)recMaint, bUpdateOnSelect, DBConstants.USER_DEFINED_TYPE)); return true; // BaseTable Set! } return false; }
[ "public", "boolean", "setSelectQuery", "(", "Rec", "recMaint", ",", "boolean", "bUpdateOnSelect", ")", "{", "if", "(", "recMaint", "==", "null", ")", "return", "true", ";", "// BaseTable Set!", "if", "(", "this", ".", "getMainRecord", "(", ")", "!=", "null", ")", "if", "(", "this", ".", "getMainRecord", "(", ")", "!=", "recMaint", ")", "if", "(", "this", ".", "getMainRecord", "(", ")", ".", "getBaseRecord", "(", ")", ".", "getTableNames", "(", "false", ")", ".", "equals", "(", "recMaint", ".", "getTableNames", "(", "false", ")", ")", ")", "{", "// Only trigger when the grid table sends the selection message", "this", ".", "getMainRecord", "(", ")", ".", "addListener", "(", "new", "OnSelectHandler", "(", "(", "Record", ")", "recMaint", ",", "bUpdateOnSelect", ",", "DBConstants", ".", "USER_DEFINED_TYPE", ")", ")", ";", "return", "true", ";", "// BaseTable Set!", "}", "return", "false", ";", "}" ]
Find the sub-screen that uses this grid query and set for selection. When you select a new record here, you read the same record in the SelectQuery. @param recMaint The record which is synced on record change. @param bUpdateOnSelect Do I update the current record if a selection occurs. @return True if successful.
[ "Find", "the", "sub", "-", "screen", "that", "uses", "this", "grid", "query", "and", "set", "for", "selection", ".", "When", "you", "select", "a", "new", "record", "here", "you", "read", "the", "same", "record", "in", "the", "SelectQuery", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/BaseGridTableScreen.java#L164-L176
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault-cryptography/src/main/java/com/microsoft/azure/keyvault/cryptography/EcKey.java
EcKey.fromJsonWebKey
public static EcKey fromJsonWebKey(JsonWebKey jwk) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException, InvalidKeySpecException, NoSuchProviderException { """ Converts JSON web key to EC key pair, does not include the private key. @param jwk @return EcKey @throws NoSuchAlgorithmException @throws InvalidAlgorithmParameterException @throws InvalidKeySpecException @throws NoSuchProviderException """ return fromJsonWebKey(jwk, false, null); }
java
public static EcKey fromJsonWebKey(JsonWebKey jwk) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException, InvalidKeySpecException, NoSuchProviderException { return fromJsonWebKey(jwk, false, null); }
[ "public", "static", "EcKey", "fromJsonWebKey", "(", "JsonWebKey", "jwk", ")", "throws", "NoSuchAlgorithmException", ",", "InvalidAlgorithmParameterException", ",", "InvalidKeySpecException", ",", "NoSuchProviderException", "{", "return", "fromJsonWebKey", "(", "jwk", ",", "false", ",", "null", ")", ";", "}" ]
Converts JSON web key to EC key pair, does not include the private key. @param jwk @return EcKey @throws NoSuchAlgorithmException @throws InvalidAlgorithmParameterException @throws InvalidKeySpecException @throws NoSuchProviderException
[ "Converts", "JSON", "web", "key", "to", "EC", "key", "pair", "does", "not", "include", "the", "private", "key", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault-cryptography/src/main/java/com/microsoft/azure/keyvault/cryptography/EcKey.java#L197-L199
BranchMetrics/android-branch-deep-linking
Branch-SDK/src/io/branch/referral/Branch.java
Branch.redeemRewards
public void redeemRewards(@NonNull final String bucket, final int count, BranchReferralStateChangedListener callback) { """ <p>Redeems the specified number of credits from the named bucket, if there are sufficient credits within it. If the number to redeem exceeds the number available in the bucket, all of the available credits will be redeemed instead.</p> @param bucket A {@link String} value containing the name of the referral bucket to attempt to redeem credits from. @param count A {@link Integer} specifying the number of credits to attempt to redeem from the specified bucket. @param callback A {@link BranchReferralStateChangedListener} callback instance that will trigger actions defined therein upon a executing redeem rewards. """ ServerRequestRedeemRewards req = new ServerRequestRedeemRewards(context_, bucket, count, callback); if (!req.constructError_ && !req.handleErrors(context_)) { handleNewRequest(req); } }
java
public void redeemRewards(@NonNull final String bucket, final int count, BranchReferralStateChangedListener callback) { ServerRequestRedeemRewards req = new ServerRequestRedeemRewards(context_, bucket, count, callback); if (!req.constructError_ && !req.handleErrors(context_)) { handleNewRequest(req); } }
[ "public", "void", "redeemRewards", "(", "@", "NonNull", "final", "String", "bucket", ",", "final", "int", "count", ",", "BranchReferralStateChangedListener", "callback", ")", "{", "ServerRequestRedeemRewards", "req", "=", "new", "ServerRequestRedeemRewards", "(", "context_", ",", "bucket", ",", "count", ",", "callback", ")", ";", "if", "(", "!", "req", ".", "constructError_", "&&", "!", "req", ".", "handleErrors", "(", "context_", ")", ")", "{", "handleNewRequest", "(", "req", ")", ";", "}", "}" ]
<p>Redeems the specified number of credits from the named bucket, if there are sufficient credits within it. If the number to redeem exceeds the number available in the bucket, all of the available credits will be redeemed instead.</p> @param bucket A {@link String} value containing the name of the referral bucket to attempt to redeem credits from. @param count A {@link Integer} specifying the number of credits to attempt to redeem from the specified bucket. @param callback A {@link BranchReferralStateChangedListener} callback instance that will trigger actions defined therein upon a executing redeem rewards.
[ "<p", ">", "Redeems", "the", "specified", "number", "of", "credits", "from", "the", "named", "bucket", "if", "there", "are", "sufficient", "credits", "within", "it", ".", "If", "the", "number", "to", "redeem", "exceeds", "the", "number", "available", "in", "the", "bucket", "all", "of", "the", "available", "credits", "will", "be", "redeemed", "instead", ".", "<", "/", "p", ">" ]
train
https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/Branch.java#L1916-L1922
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/script/Script.java
Script.writeBytes
public static void writeBytes(OutputStream os, byte[] buf) throws IOException { """ Writes out the given byte buffer to the output stream with the correct opcode prefix To write an integer call writeBytes(out, Utils.reverseBytes(Utils.encodeMPI(val, false))); """ if (buf.length < OP_PUSHDATA1) { os.write(buf.length); os.write(buf); } else if (buf.length < 256) { os.write(OP_PUSHDATA1); os.write(buf.length); os.write(buf); } else if (buf.length < 65536) { os.write(OP_PUSHDATA2); Utils.uint16ToByteStreamLE(buf.length, os); os.write(buf); } else { throw new RuntimeException("Unimplemented"); } }
java
public static void writeBytes(OutputStream os, byte[] buf) throws IOException { if (buf.length < OP_PUSHDATA1) { os.write(buf.length); os.write(buf); } else if (buf.length < 256) { os.write(OP_PUSHDATA1); os.write(buf.length); os.write(buf); } else if (buf.length < 65536) { os.write(OP_PUSHDATA2); Utils.uint16ToByteStreamLE(buf.length, os); os.write(buf); } else { throw new RuntimeException("Unimplemented"); } }
[ "public", "static", "void", "writeBytes", "(", "OutputStream", "os", ",", "byte", "[", "]", "buf", ")", "throws", "IOException", "{", "if", "(", "buf", ".", "length", "<", "OP_PUSHDATA1", ")", "{", "os", ".", "write", "(", "buf", ".", "length", ")", ";", "os", ".", "write", "(", "buf", ")", ";", "}", "else", "if", "(", "buf", ".", "length", "<", "256", ")", "{", "os", ".", "write", "(", "OP_PUSHDATA1", ")", ";", "os", ".", "write", "(", "buf", ".", "length", ")", ";", "os", ".", "write", "(", "buf", ")", ";", "}", "else", "if", "(", "buf", ".", "length", "<", "65536", ")", "{", "os", ".", "write", "(", "OP_PUSHDATA2", ")", ";", "Utils", ".", "uint16ToByteStreamLE", "(", "buf", ".", "length", ",", "os", ")", ";", "os", ".", "write", "(", "buf", ")", ";", "}", "else", "{", "throw", "new", "RuntimeException", "(", "\"Unimplemented\"", ")", ";", "}", "}" ]
Writes out the given byte buffer to the output stream with the correct opcode prefix To write an integer call writeBytes(out, Utils.reverseBytes(Utils.encodeMPI(val, false)));
[ "Writes", "out", "the", "given", "byte", "buffer", "to", "the", "output", "stream", "with", "the", "correct", "opcode", "prefix", "To", "write", "an", "integer", "call", "writeBytes", "(", "out", "Utils", ".", "reverseBytes", "(", "Utils", ".", "encodeMPI", "(", "val", "false", ")))", ";" ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/script/Script.java#L320-L335
milaboratory/milib
src/main/java/com/milaboratory/core/alignment/BandedLinearAligner.java
BandedLinearAligner.alignLeftAdded
public static Alignment<NucleotideSequence> alignLeftAdded(LinearGapAlignmentScoring scoring, NucleotideSequence seq1, NucleotideSequence seq2, int offset1, int length1, int addedNucleotides1, int offset2, int length2, int addedNucleotides2, int width) { """ Semi-semi-global alignment with artificially added letters. <p>Alignment where second sequence is aligned to the left part of first sequence.</p> <p>Whole second sequence must be highly similar to the first sequence, except last {@code width} letters, which are to be checked whether they can improve alignment or not.</p> @param scoring scoring system @param seq1 first sequence @param seq2 second sequence @param offset1 offset in first sequence @param length1 length of first sequence's part to be aligned @param addedNucleotides1 number of artificially added letters to the first sequence @param offset2 offset in second sequence @param length2 length of second sequence's part to be aligned @param addedNucleotides2 number of artificially added letters to the second sequence @param width width of banded alignment matrix. In other terms max allowed number of indels """ try { MutationsBuilder<NucleotideSequence> mutations = new MutationsBuilder<>(NucleotideSequence.ALPHABET); BandedSemiLocalResult result = alignLeftAdded0(scoring, seq1, seq2, offset1, length1, addedNucleotides1, offset2, length2, addedNucleotides2, width, mutations, AlignmentCache.get()); return new Alignment<>(seq1, mutations.createAndDestroy(), new Range(result.sequence1Stop, offset1 + length1), new Range(result.sequence2Stop, offset2 + length2), result.score); } finally { AlignmentCache.release(); } }
java
public static Alignment<NucleotideSequence> alignLeftAdded(LinearGapAlignmentScoring scoring, NucleotideSequence seq1, NucleotideSequence seq2, int offset1, int length1, int addedNucleotides1, int offset2, int length2, int addedNucleotides2, int width) { try { MutationsBuilder<NucleotideSequence> mutations = new MutationsBuilder<>(NucleotideSequence.ALPHABET); BandedSemiLocalResult result = alignLeftAdded0(scoring, seq1, seq2, offset1, length1, addedNucleotides1, offset2, length2, addedNucleotides2, width, mutations, AlignmentCache.get()); return new Alignment<>(seq1, mutations.createAndDestroy(), new Range(result.sequence1Stop, offset1 + length1), new Range(result.sequence2Stop, offset2 + length2), result.score); } finally { AlignmentCache.release(); } }
[ "public", "static", "Alignment", "<", "NucleotideSequence", ">", "alignLeftAdded", "(", "LinearGapAlignmentScoring", "scoring", ",", "NucleotideSequence", "seq1", ",", "NucleotideSequence", "seq2", ",", "int", "offset1", ",", "int", "length1", ",", "int", "addedNucleotides1", ",", "int", "offset2", ",", "int", "length2", ",", "int", "addedNucleotides2", ",", "int", "width", ")", "{", "try", "{", "MutationsBuilder", "<", "NucleotideSequence", ">", "mutations", "=", "new", "MutationsBuilder", "<>", "(", "NucleotideSequence", ".", "ALPHABET", ")", ";", "BandedSemiLocalResult", "result", "=", "alignLeftAdded0", "(", "scoring", ",", "seq1", ",", "seq2", ",", "offset1", ",", "length1", ",", "addedNucleotides1", ",", "offset2", ",", "length2", ",", "addedNucleotides2", ",", "width", ",", "mutations", ",", "AlignmentCache", ".", "get", "(", ")", ")", ";", "return", "new", "Alignment", "<>", "(", "seq1", ",", "mutations", ".", "createAndDestroy", "(", ")", ",", "new", "Range", "(", "result", ".", "sequence1Stop", ",", "offset1", "+", "length1", ")", ",", "new", "Range", "(", "result", ".", "sequence2Stop", ",", "offset2", "+", "length2", ")", ",", "result", ".", "score", ")", ";", "}", "finally", "{", "AlignmentCache", ".", "release", "(", ")", ";", "}", "}" ]
Semi-semi-global alignment with artificially added letters. <p>Alignment where second sequence is aligned to the left part of first sequence.</p> <p>Whole second sequence must be highly similar to the first sequence, except last {@code width} letters, which are to be checked whether they can improve alignment or not.</p> @param scoring scoring system @param seq1 first sequence @param seq2 second sequence @param offset1 offset in first sequence @param length1 length of first sequence's part to be aligned @param addedNucleotides1 number of artificially added letters to the first sequence @param offset2 offset in second sequence @param length2 length of second sequence's part to be aligned @param addedNucleotides2 number of artificially added letters to the second sequence @param width width of banded alignment matrix. In other terms max allowed number of indels
[ "Semi", "-", "semi", "-", "global", "alignment", "with", "artificially", "added", "letters", "." ]
train
https://github.com/milaboratory/milib/blob/2349b3dccdd3c7948643760e570238d6e30d5a34/src/main/java/com/milaboratory/core/alignment/BandedLinearAligner.java#L596-L610
percolate/caffeine
caffeine/src/main/java/com/percolate/caffeine/ViewUtils.java
ViewUtils.showView
public static void showView(View parentView, int id) { """ Sets visibility of the given view to <code>View.VISIBLE</code>. @param parentView The View used to call findViewId() on. @param id R.id.xxxx value for the view to show. """ if (parentView != null) { View view = parentView.findViewById(id); if (view != null) { view.setVisibility(View.VISIBLE); } else { Log.e("Caffeine", "View does not exist. Could not show it."); } } }
java
public static void showView(View parentView, int id) { if (parentView != null) { View view = parentView.findViewById(id); if (view != null) { view.setVisibility(View.VISIBLE); } else { Log.e("Caffeine", "View does not exist. Could not show it."); } } }
[ "public", "static", "void", "showView", "(", "View", "parentView", ",", "int", "id", ")", "{", "if", "(", "parentView", "!=", "null", ")", "{", "View", "view", "=", "parentView", ".", "findViewById", "(", "id", ")", ";", "if", "(", "view", "!=", "null", ")", "{", "view", ".", "setVisibility", "(", "View", ".", "VISIBLE", ")", ";", "}", "else", "{", "Log", ".", "e", "(", "\"Caffeine\"", ",", "\"View does not exist. Could not show it.\"", ")", ";", "}", "}", "}" ]
Sets visibility of the given view to <code>View.VISIBLE</code>. @param parentView The View used to call findViewId() on. @param id R.id.xxxx value for the view to show.
[ "Sets", "visibility", "of", "the", "given", "view", "to", "<code", ">", "View", ".", "VISIBLE<", "/", "code", ">", "." ]
train
https://github.com/percolate/caffeine/blob/e2265cab474a6397f4d75b1ed928c356a7b9672e/caffeine/src/main/java/com/percolate/caffeine/ViewUtils.java#L283-L292
codelibs/fess
src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java
FessMessages.addErrorsCrudFailedToDeleteCrudTable
public FessMessages addErrorsCrudFailedToDeleteCrudTable(String property, String arg0) { """ Add the created action message for the key 'errors.crud_failed_to_delete_crud_table' with parameters. <pre> message: Failed to delete the data. ({0}) </pre> @param property The property name for the message. (NotNull) @param arg0 The parameter arg0 for message. (NotNull) @return this. (NotNull) """ assertPropertyNotNull(property); add(property, new UserMessage(ERRORS_crud_failed_to_delete_crud_table, arg0)); return this; }
java
public FessMessages addErrorsCrudFailedToDeleteCrudTable(String property, String arg0) { assertPropertyNotNull(property); add(property, new UserMessage(ERRORS_crud_failed_to_delete_crud_table, arg0)); return this; }
[ "public", "FessMessages", "addErrorsCrudFailedToDeleteCrudTable", "(", "String", "property", ",", "String", "arg0", ")", "{", "assertPropertyNotNull", "(", "property", ")", ";", "add", "(", "property", ",", "new", "UserMessage", "(", "ERRORS_crud_failed_to_delete_crud_table", ",", "arg0", ")", ")", ";", "return", "this", ";", "}" ]
Add the created action message for the key 'errors.crud_failed_to_delete_crud_table' with parameters. <pre> message: Failed to delete the data. ({0}) </pre> @param property The property name for the message. (NotNull) @param arg0 The parameter arg0 for message. (NotNull) @return this. (NotNull)
[ "Add", "the", "created", "action", "message", "for", "the", "key", "errors", ".", "crud_failed_to_delete_crud_table", "with", "parameters", ".", "<pre", ">", "message", ":", "Failed", "to", "delete", "the", "data", ".", "(", "{", "0", "}", ")", "<", "/", "pre", ">" ]
train
https://github.com/codelibs/fess/blob/e5e4b722549d32a4958dfd94965b21937bfe64cf/src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java#L2155-L2159
CenturyLinkCloud/mdw
mdw-workflow/src/com/centurylink/mdw/workflow/activity/timer/TimerWaitActivity.java
TimerWaitActivity.getWaitPeriodInSeconds
protected int getWaitPeriodInSeconds() throws ActivityException { """ Method that returns the wait period for the activity @return Wait period """ String unit = super.getAttributeValue(WAIT_UNIT); int factor; if (MINUTES.equals(unit)) factor = 60; else if (HOURS.equals(unit)) factor = 3600; else if (DAYS.equals(unit)) factor = 86400; else factor = 1; // Means specified value is already in seconds int retTime; String timeAttr; try { timeAttr = super.getAttributeValueSmart(WorkAttributeConstant.TIMER_WAIT); } catch (PropertyException e) { throw new ActivityException(-1, "failed to evaluate time expression", e); } retTime = StringHelper.getInteger(timeAttr, DEFAULT_WAIT); return retTime*factor; }
java
protected int getWaitPeriodInSeconds() throws ActivityException { String unit = super.getAttributeValue(WAIT_UNIT); int factor; if (MINUTES.equals(unit)) factor = 60; else if (HOURS.equals(unit)) factor = 3600; else if (DAYS.equals(unit)) factor = 86400; else factor = 1; // Means specified value is already in seconds int retTime; String timeAttr; try { timeAttr = super.getAttributeValueSmart(WorkAttributeConstant.TIMER_WAIT); } catch (PropertyException e) { throw new ActivityException(-1, "failed to evaluate time expression", e); } retTime = StringHelper.getInteger(timeAttr, DEFAULT_WAIT); return retTime*factor; }
[ "protected", "int", "getWaitPeriodInSeconds", "(", ")", "throws", "ActivityException", "{", "String", "unit", "=", "super", ".", "getAttributeValue", "(", "WAIT_UNIT", ")", ";", "int", "factor", ";", "if", "(", "MINUTES", ".", "equals", "(", "unit", ")", ")", "factor", "=", "60", ";", "else", "if", "(", "HOURS", ".", "equals", "(", "unit", ")", ")", "factor", "=", "3600", ";", "else", "if", "(", "DAYS", ".", "equals", "(", "unit", ")", ")", "factor", "=", "86400", ";", "else", "factor", "=", "1", ";", "// Means specified value is already in seconds", "int", "retTime", ";", "String", "timeAttr", ";", "try", "{", "timeAttr", "=", "super", ".", "getAttributeValueSmart", "(", "WorkAttributeConstant", ".", "TIMER_WAIT", ")", ";", "}", "catch", "(", "PropertyException", "e", ")", "{", "throw", "new", "ActivityException", "(", "-", "1", ",", "\"failed to evaluate time expression\"", ",", "e", ")", ";", "}", "retTime", "=", "StringHelper", ".", "getInteger", "(", "timeAttr", ",", "DEFAULT_WAIT", ")", ";", "return", "retTime", "*", "factor", ";", "}" ]
Method that returns the wait period for the activity @return Wait period
[ "Method", "that", "returns", "the", "wait", "period", "for", "the", "activity" ]
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-workflow/src/com/centurylink/mdw/workflow/activity/timer/TimerWaitActivity.java#L135-L151
groovy/groovy-core
src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.addAll
public static <T> boolean addAll(Collection<T> self, Iterator<T> items) { """ Adds all items from the iterator to the Collection. @param self the collection @param items the items to add @return true if the collection changed """ boolean changed = false; while (items.hasNext()) { T next = items.next(); if (self.add(next)) changed = true; } return changed; }
java
public static <T> boolean addAll(Collection<T> self, Iterator<T> items) { boolean changed = false; while (items.hasNext()) { T next = items.next(); if (self.add(next)) changed = true; } return changed; }
[ "public", "static", "<", "T", ">", "boolean", "addAll", "(", "Collection", "<", "T", ">", "self", ",", "Iterator", "<", "T", ">", "items", ")", "{", "boolean", "changed", "=", "false", ";", "while", "(", "items", ".", "hasNext", "(", ")", ")", "{", "T", "next", "=", "items", ".", "next", "(", ")", ";", "if", "(", "self", ".", "add", "(", "next", ")", ")", "changed", "=", "true", ";", "}", "return", "changed", ";", "}" ]
Adds all items from the iterator to the Collection. @param self the collection @param items the items to add @return true if the collection changed
[ "Adds", "all", "items", "from", "the", "iterator", "to", "the", "Collection", "." ]
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L9371-L9378
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 { """ 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 """ 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", ",", "config", ")", ";", "if", "(", "!", "ImageIO", ".", "write", "(", "image", ",", "format", ",", "stream", ")", ")", "{", "throw", "new", "IOException", "(", "\"Could not write an image of format \"", "+", "format", ")", ";", "}", "}" ]
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
phax/ph-javacc-maven-plugin
src/main/java/org/codehaus/mojo/javacc/JJDocMojo.java
JJDocMojo.scanForGrammars
private GrammarInfo [] scanForGrammars (final File sourceDirectory) throws MavenReportException { """ Searches the specified source directory to find grammar files that can be documented. @param sourceDirectory The source directory to scan for grammar files. @return An array of grammar infos describing the found grammar files or <code>null</code> if the source directory does not exist. @throws MavenReportException If there is a problem while scanning for .jj files. """ if (!sourceDirectory.isDirectory ()) { return null; } GrammarInfo [] grammarInfos; getLog ().debug ("Scanning for grammars: " + sourceDirectory); try { final String [] includes = { "**/*.jj", "**/*.JJ", "**/*.jjt", "**/*.JJT", "**/*.jtb", "**/*.JTB" }; final GrammarDirectoryScanner scanner = new GrammarDirectoryScanner (); scanner.setSourceDirectory (sourceDirectory); scanner.setIncludes (includes); scanner.scan (); grammarInfos = scanner.getIncludedGrammars (); } catch (final Exception e) { throw new MavenReportException ("Failed to scan for grammars: " + sourceDirectory, e); } getLog ().debug ("Found grammars: " + Arrays.asList (grammarInfos)); return grammarInfos; }
java
private GrammarInfo [] scanForGrammars (final File sourceDirectory) throws MavenReportException { if (!sourceDirectory.isDirectory ()) { return null; } GrammarInfo [] grammarInfos; getLog ().debug ("Scanning for grammars: " + sourceDirectory); try { final String [] includes = { "**/*.jj", "**/*.JJ", "**/*.jjt", "**/*.JJT", "**/*.jtb", "**/*.JTB" }; final GrammarDirectoryScanner scanner = new GrammarDirectoryScanner (); scanner.setSourceDirectory (sourceDirectory); scanner.setIncludes (includes); scanner.scan (); grammarInfos = scanner.getIncludedGrammars (); } catch (final Exception e) { throw new MavenReportException ("Failed to scan for grammars: " + sourceDirectory, e); } getLog ().debug ("Found grammars: " + Arrays.asList (grammarInfos)); return grammarInfos; }
[ "private", "GrammarInfo", "[", "]", "scanForGrammars", "(", "final", "File", "sourceDirectory", ")", "throws", "MavenReportException", "{", "if", "(", "!", "sourceDirectory", ".", "isDirectory", "(", ")", ")", "{", "return", "null", ";", "}", "GrammarInfo", "[", "]", "grammarInfos", ";", "getLog", "(", ")", ".", "debug", "(", "\"Scanning for grammars: \"", "+", "sourceDirectory", ")", ";", "try", "{", "final", "String", "[", "]", "includes", "=", "{", "\"**/*.jj\"", ",", "\"**/*.JJ\"", ",", "\"**/*.jjt\"", ",", "\"**/*.JJT\"", ",", "\"**/*.jtb\"", ",", "\"**/*.JTB\"", "}", ";", "final", "GrammarDirectoryScanner", "scanner", "=", "new", "GrammarDirectoryScanner", "(", ")", ";", "scanner", ".", "setSourceDirectory", "(", "sourceDirectory", ")", ";", "scanner", ".", "setIncludes", "(", "includes", ")", ";", "scanner", ".", "scan", "(", ")", ";", "grammarInfos", "=", "scanner", ".", "getIncludedGrammars", "(", ")", ";", "}", "catch", "(", "final", "Exception", "e", ")", "{", "throw", "new", "MavenReportException", "(", "\"Failed to scan for grammars: \"", "+", "sourceDirectory", ",", "e", ")", ";", "}", "getLog", "(", ")", ".", "debug", "(", "\"Found grammars: \"", "+", "Arrays", ".", "asList", "(", "grammarInfos", ")", ")", ";", "return", "grammarInfos", ";", "}" ]
Searches the specified source directory to find grammar files that can be documented. @param sourceDirectory The source directory to scan for grammar files. @return An array of grammar infos describing the found grammar files or <code>null</code> if the source directory does not exist. @throws MavenReportException If there is a problem while scanning for .jj files.
[ "Searches", "the", "specified", "source", "directory", "to", "find", "grammar", "files", "that", "can", "be", "documented", "." ]
train
https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/JJDocMojo.java#L519-L545
mguymon/model-citizen
core/src/main/java/com/tobedevoured/modelcitizen/ModelFactory.java
ModelFactory.createModel
@SuppressWarnings( { """ Create a Model for a registered Blueprint. Values set in the model will not be overridden by defaults in the Blueprint. @param <T> model Class @param referenceModel Object @param withPolicies boolean if Policies should be applied to the create @return Model @throws CreateModelException model failed to create """"rawtypes", "unchecked"}) public <T> T createModel(T referenceModel, boolean withPolicies) throws CreateModelException { Erector erector = erectors.get(referenceModel.getClass()); if (erector == null) { throw new CreateModelException("Unregistered class: " + referenceModel.getClass()); } return createModel(erector, referenceModel, withPolicies); }
java
@SuppressWarnings({"rawtypes", "unchecked"}) public <T> T createModel(T referenceModel, boolean withPolicies) throws CreateModelException { Erector erector = erectors.get(referenceModel.getClass()); if (erector == null) { throw new CreateModelException("Unregistered class: " + referenceModel.getClass()); } return createModel(erector, referenceModel, withPolicies); }
[ "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "public", "<", "T", ">", "T", "createModel", "(", "T", "referenceModel", ",", "boolean", "withPolicies", ")", "throws", "CreateModelException", "{", "Erector", "erector", "=", "erectors", ".", "get", "(", "referenceModel", ".", "getClass", "(", ")", ")", ";", "if", "(", "erector", "==", "null", ")", "{", "throw", "new", "CreateModelException", "(", "\"Unregistered class: \"", "+", "referenceModel", ".", "getClass", "(", ")", ")", ";", "}", "return", "createModel", "(", "erector", ",", "referenceModel", ",", "withPolicies", ")", ";", "}" ]
Create a Model for a registered Blueprint. Values set in the model will not be overridden by defaults in the Blueprint. @param <T> model Class @param referenceModel Object @param withPolicies boolean if Policies should be applied to the create @return Model @throws CreateModelException model failed to create
[ "Create", "a", "Model", "for", "a", "registered", "Blueprint", ".", "Values", "set", "in", "the", "model", "will", "not", "be", "overridden", "by", "defaults", "in", "the", "Blueprint", "." ]
train
https://github.com/mguymon/model-citizen/blob/9078ab4121897a21e598dd4f0efa6996b46e4dea/core/src/main/java/com/tobedevoured/modelcitizen/ModelFactory.java#L497-L506
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.getStream
public GetStreamResponse getStream(GetStreamRequest request) { """ Get detail of stream in the live stream service. @param request The request object containing all options for querying detail of stream @return the response """ checkNotNull(request, "The parameter request should NOT be null."); checkStringNotEmpty(request.getPlayDomain(), "playDomain should NOT be empty."); checkStringNotEmpty(request.getApp(), "App should NOT be empty."); checkStringNotEmpty(request.getStream(), "Stream should NOT be empty."); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, LIVE_DOMAIN, request.getPlayDomain(), LIVE_APP, request.getApp(), LIVE_STREAM, request.getStream()); return invokeHttpClient(internalRequest, GetStreamResponse.class); }
java
public GetStreamResponse getStream(GetStreamRequest request) { checkNotNull(request, "The parameter request should NOT be null."); checkStringNotEmpty(request.getPlayDomain(), "playDomain should NOT be empty."); checkStringNotEmpty(request.getApp(), "App should NOT be empty."); checkStringNotEmpty(request.getStream(), "Stream should NOT be empty."); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, LIVE_DOMAIN, request.getPlayDomain(), LIVE_APP, request.getApp(), LIVE_STREAM, request.getStream()); return invokeHttpClient(internalRequest, GetStreamResponse.class); }
[ "public", "GetStreamResponse", "getStream", "(", "GetStreamRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"The parameter request should NOT be null.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getPlayDomain", "(", ")", ",", "\"playDomain should NOT be empty.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getApp", "(", ")", ",", "\"App should NOT be empty.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getStream", "(", ")", ",", "\"Stream should NOT be empty.\"", ")", ";", "InternalRequest", "internalRequest", "=", "createRequest", "(", "HttpMethodName", ".", "GET", ",", "request", ",", "LIVE_DOMAIN", ",", "request", ".", "getPlayDomain", "(", ")", ",", "LIVE_APP", ",", "request", ".", "getApp", "(", ")", ",", "LIVE_STREAM", ",", "request", ".", "getStream", "(", ")", ")", ";", "return", "invokeHttpClient", "(", "internalRequest", ",", "GetStreamResponse", ".", "class", ")", ";", "}" ]
Get detail of stream in the live stream service. @param request The request object containing all options for querying detail of stream @return the response
[ "Get", "detail", "of", "stream", "in", "the", "live", "stream", "service", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1463-L1475
wdullaer/MaterialDateTimePicker
library/src/main/java/com/wdullaer/materialdatetimepicker/date/MonthView.java
MonthView.getDayFromLocation
public int getDayFromLocation(float x, float y) { """ Calculates the day that the given x position is in, accounting for week number. Returns the day or -1 if the position wasn't in a day. @param x The x position of the touch event @return The day number, or -1 if the position wasn't in a day """ final int day = getInternalDayFromLocation(x, y); if (day < 1 || day > mNumCells) { return -1; } return day; }
java
public int getDayFromLocation(float x, float y) { final int day = getInternalDayFromLocation(x, y); if (day < 1 || day > mNumCells) { return -1; } return day; }
[ "public", "int", "getDayFromLocation", "(", "float", "x", ",", "float", "y", ")", "{", "final", "int", "day", "=", "getInternalDayFromLocation", "(", "x", ",", "y", ")", ";", "if", "(", "day", "<", "1", "||", "day", ">", "mNumCells", ")", "{", "return", "-", "1", ";", "}", "return", "day", ";", "}" ]
Calculates the day that the given x position is in, accounting for week number. Returns the day or -1 if the position wasn't in a day. @param x The x position of the touch event @return The day number, or -1 if the position wasn't in a day
[ "Calculates", "the", "day", "that", "the", "given", "x", "position", "is", "in", "accounting", "for", "week", "number", ".", "Returns", "the", "day", "or", "-", "1", "if", "the", "position", "wasn", "t", "in", "a", "day", "." ]
train
https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/date/MonthView.java#L503-L509
operasoftware/operaprestodriver
src/com/opera/core/systems/OperaWebElement.java
OperaWebElement.saveScreenshot
public String saveScreenshot(String filename, long timeout) { """ Take a screenshot of the area this element covers. Saves a copy of the image to the given filename. @param filename the location to save the screenshot @param timeout the number of milliseconds to wait before taking the screenshot @return the MD5 hash of the screenshot """ return saveScreenshot(filename, timeout, true, new ArrayList<String>()); }
java
public String saveScreenshot(String filename, long timeout) { return saveScreenshot(filename, timeout, true, new ArrayList<String>()); }
[ "public", "String", "saveScreenshot", "(", "String", "filename", ",", "long", "timeout", ")", "{", "return", "saveScreenshot", "(", "filename", ",", "timeout", ",", "true", ",", "new", "ArrayList", "<", "String", ">", "(", ")", ")", ";", "}" ]
Take a screenshot of the area this element covers. Saves a copy of the image to the given filename. @param filename the location to save the screenshot @param timeout the number of milliseconds to wait before taking the screenshot @return the MD5 hash of the screenshot
[ "Take", "a", "screenshot", "of", "the", "area", "this", "element", "covers", ".", "Saves", "a", "copy", "of", "the", "image", "to", "the", "given", "filename", "." ]
train
https://github.com/operasoftware/operaprestodriver/blob/1ccceda80f1c1a0489171d17dcaa6e7b18fb4c01/src/com/opera/core/systems/OperaWebElement.java#L345-L347
vanilladb/vanillacore
src/main/java/org/vanilladb/core/query/algebra/ProductPlan.java
ProductPlan.productHistogram
public static Histogram productHistogram(Histogram hist1, Histogram hist2) { """ Returns a histogram that, for each field, approximates the value distribution of products from the specified histograms. @param hist1 the left-hand-side histogram @param hist2 the right-hand-side histogram @return a histogram that, for each field, approximates the value distribution of the products """ Set<String> prodFlds = new HashSet<String>(hist1.fields()); prodFlds.addAll(hist2.fields()); Histogram prodHist = new Histogram(prodFlds); double numRec1 = hist1.recordsOutput(); double numRec2 = hist2.recordsOutput(); if (Double.compare(numRec1, 1.0) < 0 || Double.compare(numRec2, 1.0) < 0) return prodHist; for (String fld : hist1.fields()) for (Bucket bkt : hist1.buckets(fld)) prodHist.addBucket(fld, new Bucket(bkt.valueRange(), bkt.frequency() * numRec2, bkt.distinctValues(), bkt.valuePercentiles())); for (String fld : hist2.fields()) for (Bucket bkt : hist2.buckets(fld)) prodHist.addBucket(fld, new Bucket(bkt.valueRange(), bkt.frequency() * numRec1, bkt.distinctValues(), bkt.valuePercentiles())); return prodHist; }
java
public static Histogram productHistogram(Histogram hist1, Histogram hist2) { Set<String> prodFlds = new HashSet<String>(hist1.fields()); prodFlds.addAll(hist2.fields()); Histogram prodHist = new Histogram(prodFlds); double numRec1 = hist1.recordsOutput(); double numRec2 = hist2.recordsOutput(); if (Double.compare(numRec1, 1.0) < 0 || Double.compare(numRec2, 1.0) < 0) return prodHist; for (String fld : hist1.fields()) for (Bucket bkt : hist1.buckets(fld)) prodHist.addBucket(fld, new Bucket(bkt.valueRange(), bkt.frequency() * numRec2, bkt.distinctValues(), bkt.valuePercentiles())); for (String fld : hist2.fields()) for (Bucket bkt : hist2.buckets(fld)) prodHist.addBucket(fld, new Bucket(bkt.valueRange(), bkt.frequency() * numRec1, bkt.distinctValues(), bkt.valuePercentiles())); return prodHist; }
[ "public", "static", "Histogram", "productHistogram", "(", "Histogram", "hist1", ",", "Histogram", "hist2", ")", "{", "Set", "<", "String", ">", "prodFlds", "=", "new", "HashSet", "<", "String", ">", "(", "hist1", ".", "fields", "(", ")", ")", ";", "prodFlds", ".", "addAll", "(", "hist2", ".", "fields", "(", ")", ")", ";", "Histogram", "prodHist", "=", "new", "Histogram", "(", "prodFlds", ")", ";", "double", "numRec1", "=", "hist1", ".", "recordsOutput", "(", ")", ";", "double", "numRec2", "=", "hist2", ".", "recordsOutput", "(", ")", ";", "if", "(", "Double", ".", "compare", "(", "numRec1", ",", "1.0", ")", "<", "0", "||", "Double", ".", "compare", "(", "numRec2", ",", "1.0", ")", "<", "0", ")", "return", "prodHist", ";", "for", "(", "String", "fld", ":", "hist1", ".", "fields", "(", ")", ")", "for", "(", "Bucket", "bkt", ":", "hist1", ".", "buckets", "(", "fld", ")", ")", "prodHist", ".", "addBucket", "(", "fld", ",", "new", "Bucket", "(", "bkt", ".", "valueRange", "(", ")", ",", "bkt", ".", "frequency", "(", ")", "*", "numRec2", ",", "bkt", ".", "distinctValues", "(", ")", ",", "bkt", ".", "valuePercentiles", "(", ")", ")", ")", ";", "for", "(", "String", "fld", ":", "hist2", ".", "fields", "(", ")", ")", "for", "(", "Bucket", "bkt", ":", "hist2", ".", "buckets", "(", "fld", ")", ")", "prodHist", ".", "addBucket", "(", "fld", ",", "new", "Bucket", "(", "bkt", ".", "valueRange", "(", ")", ",", "bkt", ".", "frequency", "(", ")", "*", "numRec1", ",", "bkt", ".", "distinctValues", "(", ")", ",", "bkt", ".", "valuePercentiles", "(", ")", ")", ")", ";", "return", "prodHist", ";", "}" ]
Returns a histogram that, for each field, approximates the value distribution of products from the specified histograms. @param hist1 the left-hand-side histogram @param hist2 the right-hand-side histogram @return a histogram that, for each field, approximates the value distribution of the products
[ "Returns", "a", "histogram", "that", "for", "each", "field", "approximates", "the", "value", "distribution", "of", "products", "from", "the", "specified", "histograms", "." ]
train
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/query/algebra/ProductPlan.java#L41-L61
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/preview/CmsFocalPointController.java
CmsFocalPointController.handleMove
private void handleMove(NativeEvent nativeEvent) { """ Handles mouse drag.<p> @param nativeEvent the mousemove event """ Element imageElem = m_image.getElement(); int offsetX = ((int)pageX(nativeEvent)) - imageElem.getParentElement().getAbsoluteLeft(); int offsetY = ((int)pageY(nativeEvent)) - imageElem.getParentElement().getAbsoluteTop(); if (m_coordinateTransform != null) { CmsPoint screenPoint = new CmsPoint(offsetX, offsetY); screenPoint = m_region.constrain(screenPoint); // make sure we remain in the screen region corresponding to original image (or crop). m_pointWidget.setCenterCoordsRelativeToParent((int)screenPoint.getX(), (int)screenPoint.getY()); CmsPoint logicalPoint = m_coordinateTransform.transformForward(screenPoint); m_focalPoint = logicalPoint; } }
java
private void handleMove(NativeEvent nativeEvent) { Element imageElem = m_image.getElement(); int offsetX = ((int)pageX(nativeEvent)) - imageElem.getParentElement().getAbsoluteLeft(); int offsetY = ((int)pageY(nativeEvent)) - imageElem.getParentElement().getAbsoluteTop(); if (m_coordinateTransform != null) { CmsPoint screenPoint = new CmsPoint(offsetX, offsetY); screenPoint = m_region.constrain(screenPoint); // make sure we remain in the screen region corresponding to original image (or crop). m_pointWidget.setCenterCoordsRelativeToParent((int)screenPoint.getX(), (int)screenPoint.getY()); CmsPoint logicalPoint = m_coordinateTransform.transformForward(screenPoint); m_focalPoint = logicalPoint; } }
[ "private", "void", "handleMove", "(", "NativeEvent", "nativeEvent", ")", "{", "Element", "imageElem", "=", "m_image", ".", "getElement", "(", ")", ";", "int", "offsetX", "=", "(", "(", "int", ")", "pageX", "(", "nativeEvent", ")", ")", "-", "imageElem", ".", "getParentElement", "(", ")", ".", "getAbsoluteLeft", "(", ")", ";", "int", "offsetY", "=", "(", "(", "int", ")", "pageY", "(", "nativeEvent", ")", ")", "-", "imageElem", ".", "getParentElement", "(", ")", ".", "getAbsoluteTop", "(", ")", ";", "if", "(", "m_coordinateTransform", "!=", "null", ")", "{", "CmsPoint", "screenPoint", "=", "new", "CmsPoint", "(", "offsetX", ",", "offsetY", ")", ";", "screenPoint", "=", "m_region", ".", "constrain", "(", "screenPoint", ")", ";", "// make sure we remain in the screen region corresponding to original image (or crop).", "m_pointWidget", ".", "setCenterCoordsRelativeToParent", "(", "(", "int", ")", "screenPoint", ".", "getX", "(", ")", ",", "(", "int", ")", "screenPoint", ".", "getY", "(", ")", ")", ";", "CmsPoint", "logicalPoint", "=", "m_coordinateTransform", ".", "transformForward", "(", "screenPoint", ")", ";", "m_focalPoint", "=", "logicalPoint", ";", "}", "}" ]
Handles mouse drag.<p> @param nativeEvent the mousemove event
[ "Handles", "mouse", "drag", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/preview/CmsFocalPointController.java#L306-L318
threerings/gwt-utils
src/main/java/com/threerings/gwt/ui/Widgets.java
Widgets.newRow
public static HorizontalPanel newRow (String styleName, Widget... contents) { """ Creates a row of widgets in a horizontal panel with a 5 pixel gap between them. """ return newRow(HasAlignment.ALIGN_MIDDLE, styleName, contents); }
java
public static HorizontalPanel newRow (String styleName, Widget... contents) { return newRow(HasAlignment.ALIGN_MIDDLE, styleName, contents); }
[ "public", "static", "HorizontalPanel", "newRow", "(", "String", "styleName", ",", "Widget", "...", "contents", ")", "{", "return", "newRow", "(", "HasAlignment", ".", "ALIGN_MIDDLE", ",", "styleName", ",", "contents", ")", ";", "}" ]
Creates a row of widgets in a horizontal panel with a 5 pixel gap between them.
[ "Creates", "a", "row", "of", "widgets", "in", "a", "horizontal", "panel", "with", "a", "5", "pixel", "gap", "between", "them", "." ]
train
https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/Widgets.java#L147-L150
zandero/rest.vertx
src/main/java/com/zandero/rest/RestRouter.java
RestRouter.notFound
public static void notFound(Router router, Class<? extends NotFoundResponseWriter> notFound) { """ Handles not found route for all requests @param router to add route to @param notFound handler """ notFound(router, null, notFound); }
java
public static void notFound(Router router, Class<? extends NotFoundResponseWriter> notFound) { notFound(router, null, notFound); }
[ "public", "static", "void", "notFound", "(", "Router", "router", ",", "Class", "<", "?", "extends", "NotFoundResponseWriter", ">", "notFound", ")", "{", "notFound", "(", "router", ",", "null", ",", "notFound", ")", ";", "}" ]
Handles not found route for all requests @param router to add route to @param notFound handler
[ "Handles", "not", "found", "route", "for", "all", "requests" ]
train
https://github.com/zandero/rest.vertx/blob/ba458720cf59e076953eab9dac7227eeaf9e58ce/src/main/java/com/zandero/rest/RestRouter.java#L268-L270
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) { """ Performs the SLINK algorithm on the given database. @param database Database to process @param relation Data relation to use """ 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", ".", "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", "(", ")", ")", ";", "}" ]
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
drinkjava2/jBeanBox
jbeanbox/src/main/java/com/github/drinkjava2/jbeanbox/AopUtils.java
AopUtils.createProxyBean
public static Object createProxyBean(Class<?> clazz, BeanBox box, BeanBoxContext ctx) { """ Create a ProxyBean @param clazz The target class @param box The BeanBox of target class @param ctx The BeanBoxContext @return A Proxy Bean with AOP support """ BeanBoxException.assureNotNull(clazz, "Try to create a proxy bean, but beanClass not found."); Enhancer enhancer = new Enhancer(); enhancer.setSuperclass(clazz); if (box.getConstructorParams() != null && box.getConstructorParams().length > 0) { BeanBox[] boxes = box.getConstructorParams(); Class<?>[] argsTypes = new Class<?>[boxes.length]; Object[] realArgsValue = new Object[boxes.length]; for (int i = 0; i < boxes.length; i++) { argsTypes[i] = boxes[i].getType(); Object realValue = ctx.getBean(boxes[i]); if (realValue != null && realValue instanceof String) realValue = ctx.getValueTranslator().translate((String) realValue, boxes[i].getType()); realArgsValue[i] = realValue; } enhancer.setCallback(new ProxyBean(box, ctx)); return enhancer.create(argsTypes, realArgsValue); } else { enhancer.setCallback(new ProxyBean(box, ctx)); return enhancer.create(); } }
java
public static Object createProxyBean(Class<?> clazz, BeanBox box, BeanBoxContext ctx) { BeanBoxException.assureNotNull(clazz, "Try to create a proxy bean, but beanClass not found."); Enhancer enhancer = new Enhancer(); enhancer.setSuperclass(clazz); if (box.getConstructorParams() != null && box.getConstructorParams().length > 0) { BeanBox[] boxes = box.getConstructorParams(); Class<?>[] argsTypes = new Class<?>[boxes.length]; Object[] realArgsValue = new Object[boxes.length]; for (int i = 0; i < boxes.length; i++) { argsTypes[i] = boxes[i].getType(); Object realValue = ctx.getBean(boxes[i]); if (realValue != null && realValue instanceof String) realValue = ctx.getValueTranslator().translate((String) realValue, boxes[i].getType()); realArgsValue[i] = realValue; } enhancer.setCallback(new ProxyBean(box, ctx)); return enhancer.create(argsTypes, realArgsValue); } else { enhancer.setCallback(new ProxyBean(box, ctx)); return enhancer.create(); } }
[ "public", "static", "Object", "createProxyBean", "(", "Class", "<", "?", ">", "clazz", ",", "BeanBox", "box", ",", "BeanBoxContext", "ctx", ")", "{", "BeanBoxException", ".", "assureNotNull", "(", "clazz", ",", "\"Try to create a proxy bean, but beanClass not found.\"", ")", ";", "Enhancer", "enhancer", "=", "new", "Enhancer", "(", ")", ";", "enhancer", ".", "setSuperclass", "(", "clazz", ")", ";", "if", "(", "box", ".", "getConstructorParams", "(", ")", "!=", "null", "&&", "box", ".", "getConstructorParams", "(", ")", ".", "length", ">", "0", ")", "{", "BeanBox", "[", "]", "boxes", "=", "box", ".", "getConstructorParams", "(", ")", ";", "Class", "<", "?", ">", "[", "]", "argsTypes", "=", "new", "Class", "<", "?", ">", "[", "boxes", ".", "length", "]", ";", "Object", "[", "]", "realArgsValue", "=", "new", "Object", "[", "boxes", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "boxes", ".", "length", ";", "i", "++", ")", "{", "argsTypes", "[", "i", "]", "=", "boxes", "[", "i", "]", ".", "getType", "(", ")", ";", "Object", "realValue", "=", "ctx", ".", "getBean", "(", "boxes", "[", "i", "]", ")", ";", "if", "(", "realValue", "!=", "null", "&&", "realValue", "instanceof", "String", ")", "realValue", "=", "ctx", ".", "getValueTranslator", "(", ")", ".", "translate", "(", "(", "String", ")", "realValue", ",", "boxes", "[", "i", "]", ".", "getType", "(", ")", ")", ";", "realArgsValue", "[", "i", "]", "=", "realValue", ";", "}", "enhancer", ".", "setCallback", "(", "new", "ProxyBean", "(", "box", ",", "ctx", ")", ")", ";", "return", "enhancer", ".", "create", "(", "argsTypes", ",", "realArgsValue", ")", ";", "}", "else", "{", "enhancer", ".", "setCallback", "(", "new", "ProxyBean", "(", "box", ",", "ctx", ")", ")", ";", "return", "enhancer", ".", "create", "(", ")", ";", "}", "}" ]
Create a ProxyBean @param clazz The target class @param box The BeanBox of target class @param ctx The BeanBoxContext @return A Proxy Bean with AOP support
[ "Create", "a", "ProxyBean" ]
train
https://github.com/drinkjava2/jBeanBox/blob/01c216599ffa2e5f2d9c01df2adaad0f45567c04/jbeanbox/src/main/java/com/github/drinkjava2/jbeanbox/AopUtils.java#L34-L55
cesarferreira/AndroidQuickUtils
library/src/main/java/quickutils/core/categories/security.java
security.privateBase64Encoder
private static String privateBase64Encoder(String toEncode, int flags) { """ private Encoder in base64 @param toEncode String to be encoded @param flags flags to encode the String @return encoded String in base64 """ byte[] data = null; try { data = toEncode.getBytes("UTF-8"); } catch (UnsupportedEncodingException e1) { e1.printStackTrace(); } if (flags == -1) { flags = Base64.DEFAULT; } return Base64.encodeToString(data, flags); }
java
private static String privateBase64Encoder(String toEncode, int flags) { byte[] data = null; try { data = toEncode.getBytes("UTF-8"); } catch (UnsupportedEncodingException e1) { e1.printStackTrace(); } if (flags == -1) { flags = Base64.DEFAULT; } return Base64.encodeToString(data, flags); }
[ "private", "static", "String", "privateBase64Encoder", "(", "String", "toEncode", ",", "int", "flags", ")", "{", "byte", "[", "]", "data", "=", "null", ";", "try", "{", "data", "=", "toEncode", ".", "getBytes", "(", "\"UTF-8\"", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "e1", ")", "{", "e1", ".", "printStackTrace", "(", ")", ";", "}", "if", "(", "flags", "==", "-", "1", ")", "{", "flags", "=", "Base64", ".", "DEFAULT", ";", "}", "return", "Base64", ".", "encodeToString", "(", "data", ",", "flags", ")", ";", "}" ]
private Encoder in base64 @param toEncode String to be encoded @param flags flags to encode the String @return encoded String in base64
[ "private", "Encoder", "in", "base64" ]
train
https://github.com/cesarferreira/AndroidQuickUtils/blob/73a91daedbb9f7be7986ea786fbc441c9e5a881c/library/src/main/java/quickutils/core/categories/security.java#L53-L66
alibaba/vlayout
vlayout/src/main/java/com/alibaba/android/vlayout/VirtualLayoutManager.java
VirtualLayoutManager.updateSpecWithExtra
private int updateSpecWithExtra(int spec, int startInset, int endInset) { """ Update measure spec with insets @param spec @param startInset @param endInset @return """ if (startInset == 0 && endInset == 0) { return spec; } final int mode = View.MeasureSpec.getMode(spec); if (mode == View.MeasureSpec.AT_MOST || mode == View.MeasureSpec.EXACTLY) { int size = View.MeasureSpec.getSize(spec); if (size - startInset - endInset < 0) { return View.MeasureSpec.makeMeasureSpec(0, mode); } else { return View.MeasureSpec.makeMeasureSpec( View.MeasureSpec.getSize(spec) - startInset - endInset, mode); } } return spec; }
java
private int updateSpecWithExtra(int spec, int startInset, int endInset) { if (startInset == 0 && endInset == 0) { return spec; } final int mode = View.MeasureSpec.getMode(spec); if (mode == View.MeasureSpec.AT_MOST || mode == View.MeasureSpec.EXACTLY) { int size = View.MeasureSpec.getSize(spec); if (size - startInset - endInset < 0) { return View.MeasureSpec.makeMeasureSpec(0, mode); } else { return View.MeasureSpec.makeMeasureSpec( View.MeasureSpec.getSize(spec) - startInset - endInset, mode); } } return spec; }
[ "private", "int", "updateSpecWithExtra", "(", "int", "spec", ",", "int", "startInset", ",", "int", "endInset", ")", "{", "if", "(", "startInset", "==", "0", "&&", "endInset", "==", "0", ")", "{", "return", "spec", ";", "}", "final", "int", "mode", "=", "View", ".", "MeasureSpec", ".", "getMode", "(", "spec", ")", ";", "if", "(", "mode", "==", "View", ".", "MeasureSpec", ".", "AT_MOST", "||", "mode", "==", "View", ".", "MeasureSpec", ".", "EXACTLY", ")", "{", "int", "size", "=", "View", ".", "MeasureSpec", ".", "getSize", "(", "spec", ")", ";", "if", "(", "size", "-", "startInset", "-", "endInset", "<", "0", ")", "{", "return", "View", ".", "MeasureSpec", ".", "makeMeasureSpec", "(", "0", ",", "mode", ")", ";", "}", "else", "{", "return", "View", ".", "MeasureSpec", ".", "makeMeasureSpec", "(", "View", ".", "MeasureSpec", ".", "getSize", "(", "spec", ")", "-", "startInset", "-", "endInset", ",", "mode", ")", ";", "}", "}", "return", "spec", ";", "}" ]
Update measure spec with insets @param spec @param startInset @param endInset @return
[ "Update", "measure", "spec", "with", "insets" ]
train
https://github.com/alibaba/vlayout/blob/8a5a51d9d2eeb91fed2ee331a4cf3496282452ce/vlayout/src/main/java/com/alibaba/android/vlayout/VirtualLayoutManager.java#L1531-L1546
Azure/azure-sdk-for-java
labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/LabsInner.java
LabsInner.registerAsync
public Observable<Void> registerAsync(String resourceGroupName, String labAccountName, String labName) { """ Register to managed lab. @param resourceGroupName The name of the resource group. @param labAccountName The name of the lab Account. @param labName The name of the lab. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful. """ return registerWithServiceResponseAsync(resourceGroupName, labAccountName, labName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> registerAsync(String resourceGroupName, String labAccountName, String labName) { return registerWithServiceResponseAsync(resourceGroupName, labAccountName, labName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "registerAsync", "(", "String", "resourceGroupName", ",", "String", "labAccountName", ",", "String", "labName", ")", "{", "return", "registerWithServiceResponseAsync", "(", "resourceGroupName", ",", "labAccountName", ",", "labName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Void", ">", ",", "Void", ">", "(", ")", "{", "@", "Override", "public", "Void", "call", "(", "ServiceResponse", "<", "Void", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Register to managed lab. @param resourceGroupName The name of the resource group. @param labAccountName The name of the lab Account. @param labName The name of the lab. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Register", "to", "managed", "lab", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/LabsInner.java#L1063-L1070
Wadpam/guja
guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java
GeneratedDContactDaoImpl.queryByCreatedDate
public Iterable<DContact> queryByCreatedDate(Object parent, java.util.Date createdDate) { """ query-by method for field createdDate @param createdDate the specified attribute @return an Iterable of DContacts for the specified createdDate """ return queryByField(parent, DContactMapper.Field.CREATEDDATE.getFieldName(), createdDate); }
java
public Iterable<DContact> queryByCreatedDate(Object parent, java.util.Date createdDate) { return queryByField(parent, DContactMapper.Field.CREATEDDATE.getFieldName(), createdDate); }
[ "public", "Iterable", "<", "DContact", ">", "queryByCreatedDate", "(", "Object", "parent", ",", "java", ".", "util", ".", "Date", "createdDate", ")", "{", "return", "queryByField", "(", "parent", ",", "DContactMapper", ".", "Field", ".", "CREATEDDATE", ".", "getFieldName", "(", ")", ",", "createdDate", ")", ";", "}" ]
query-by method for field createdDate @param createdDate the specified attribute @return an Iterable of DContacts for the specified createdDate
[ "query", "-", "by", "method", "for", "field", "createdDate" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L142-L144
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/ConnectionListenerImpl.java
ConnectionListenerImpl.commsFailure
public void commsFailure(SICoreConnection conn, SIConnectionLostException exception) { """ This method is called when a connection is closed due to a communications failure. Examine the SICommsException to determine the nature of the failure. <p>The conn parameter is ignored. The JMS API uses a 1 to 1 mapping of ConnectionListenerImpl to JMS Connection instances, so we should only ever receive calls for our own connection. @see com.ibm.wsspi.sib.core.SICoreConnectionListener#commsFailure(com.ibm.wsspi.sib.core.SICoreConnection, com.ibm.wsspi.sib.core.SICommsException) """ if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "commsFailure", new Object[]{conn, exception}); JMSException jmse = (JMSException)JmsErrorUtils.newThrowable(JMSException.class, "COMMS_FAILURE_CWSIA0343", new Object[] { exception }, exception, "ConnectionListenerImpl.commsFailure#1", this, tc); connection.reportException(jmse); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "commsFailure"); }
java
public void commsFailure(SICoreConnection conn, SIConnectionLostException exception) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "commsFailure", new Object[]{conn, exception}); JMSException jmse = (JMSException)JmsErrorUtils.newThrowable(JMSException.class, "COMMS_FAILURE_CWSIA0343", new Object[] { exception }, exception, "ConnectionListenerImpl.commsFailure#1", this, tc); connection.reportException(jmse); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "commsFailure"); }
[ "public", "void", "commsFailure", "(", "SICoreConnection", "conn", ",", "SIConnectionLostException", "exception", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"commsFailure\"", ",", "new", "Object", "[", "]", "{", "conn", ",", "exception", "}", ")", ";", "JMSException", "jmse", "=", "(", "JMSException", ")", "JmsErrorUtils", ".", "newThrowable", "(", "JMSException", ".", "class", ",", "\"COMMS_FAILURE_CWSIA0343\"", ",", "new", "Object", "[", "]", "{", "exception", "}", ",", "exception", ",", "\"ConnectionListenerImpl.commsFailure#1\"", ",", "this", ",", "tc", ")", ";", "connection", ".", "reportException", "(", "jmse", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"commsFailure\"", ")", ";", "}" ]
This method is called when a connection is closed due to a communications failure. Examine the SICommsException to determine the nature of the failure. <p>The conn parameter is ignored. The JMS API uses a 1 to 1 mapping of ConnectionListenerImpl to JMS Connection instances, so we should only ever receive calls for our own connection. @see com.ibm.wsspi.sib.core.SICoreConnectionListener#commsFailure(com.ibm.wsspi.sib.core.SICoreConnection, com.ibm.wsspi.sib.core.SICommsException)
[ "This", "method", "is", "called", "when", "a", "connection", "is", "closed", "due", "to", "a", "communications", "failure", ".", "Examine", "the", "SICommsException", "to", "determine", "the", "nature", "of", "the", "failure", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/ConnectionListenerImpl.java#L99-L111
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/core/Block.java
Block.verifyTransactions
public void verifyTransactions(final int height, final EnumSet<VerifyFlag> flags) throws VerificationException { """ Checks the block contents @param height block height, if known, or -1 otherwise. If valid, used to validate the coinbase input script of v2 and above blocks. @param flags flags to indicate which tests should be applied (i.e. whether to test for height in the coinbase transaction). @throws VerificationException if there was an error verifying the block. """ // Now we need to check that the body of the block actually matches the headers. The network won't generate // an invalid block, but if we didn't validate this then an untrusted man-in-the-middle could obtain the next // valid block from the network and simply replace the transactions in it with their own fictional // transactions that reference spent or non-existent inputs. if (transactions.isEmpty()) throw new VerificationException("Block had no transactions"); if (this.getOptimalEncodingMessageSize() > MAX_BLOCK_SIZE) throw new VerificationException("Block larger than MAX_BLOCK_SIZE"); checkTransactions(height, flags); checkMerkleRoot(); checkSigOps(); for (Transaction transaction : transactions) transaction.verify(); }
java
public void verifyTransactions(final int height, final EnumSet<VerifyFlag> flags) throws VerificationException { // Now we need to check that the body of the block actually matches the headers. The network won't generate // an invalid block, but if we didn't validate this then an untrusted man-in-the-middle could obtain the next // valid block from the network and simply replace the transactions in it with their own fictional // transactions that reference spent or non-existent inputs. if (transactions.isEmpty()) throw new VerificationException("Block had no transactions"); if (this.getOptimalEncodingMessageSize() > MAX_BLOCK_SIZE) throw new VerificationException("Block larger than MAX_BLOCK_SIZE"); checkTransactions(height, flags); checkMerkleRoot(); checkSigOps(); for (Transaction transaction : transactions) transaction.verify(); }
[ "public", "void", "verifyTransactions", "(", "final", "int", "height", ",", "final", "EnumSet", "<", "VerifyFlag", ">", "flags", ")", "throws", "VerificationException", "{", "// Now we need to check that the body of the block actually matches the headers. The network won't generate", "// an invalid block, but if we didn't validate this then an untrusted man-in-the-middle could obtain the next", "// valid block from the network and simply replace the transactions in it with their own fictional", "// transactions that reference spent or non-existent inputs.", "if", "(", "transactions", ".", "isEmpty", "(", ")", ")", "throw", "new", "VerificationException", "(", "\"Block had no transactions\"", ")", ";", "if", "(", "this", ".", "getOptimalEncodingMessageSize", "(", ")", ">", "MAX_BLOCK_SIZE", ")", "throw", "new", "VerificationException", "(", "\"Block larger than MAX_BLOCK_SIZE\"", ")", ";", "checkTransactions", "(", "height", ",", "flags", ")", ";", "checkMerkleRoot", "(", ")", ";", "checkSigOps", "(", ")", ";", "for", "(", "Transaction", "transaction", ":", "transactions", ")", "transaction", ".", "verify", "(", ")", ";", "}" ]
Checks the block contents @param height block height, if known, or -1 otherwise. If valid, used to validate the coinbase input script of v2 and above blocks. @param flags flags to indicate which tests should be applied (i.e. whether to test for height in the coinbase transaction). @throws VerificationException if there was an error verifying the block.
[ "Checks", "the", "block", "contents" ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Block.java#L728-L742
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/execution/dispatch/ParallelNodeDispatcher.java
ParallelNodeDispatcher.genSetThreadLocalRefValue
private static Task genSetThreadLocalRefValue(final String refid, final String value) { """ Return a task configured to set the thread local value for a particular refid @param refid the refid @param value the value to set @return the Task """ final SetThreadLocalTask task = new SetThreadLocalTask(); task.setRefid(refid); task.setValue(value); return task; }
java
private static Task genSetThreadLocalRefValue(final String refid, final String value) { final SetThreadLocalTask task = new SetThreadLocalTask(); task.setRefid(refid); task.setValue(value); return task; }
[ "private", "static", "Task", "genSetThreadLocalRefValue", "(", "final", "String", "refid", ",", "final", "String", "value", ")", "{", "final", "SetThreadLocalTask", "task", "=", "new", "SetThreadLocalTask", "(", ")", ";", "task", ".", "setRefid", "(", "refid", ")", ";", "task", ".", "setValue", "(", "value", ")", ";", "return", "task", ";", "}" ]
Return a task configured to set the thread local value for a particular refid @param refid the refid @param value the value to set @return the Task
[ "Return", "a", "task", "configured", "to", "set", "the", "thread", "local", "value", "for", "a", "particular", "refid" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/execution/dispatch/ParallelNodeDispatcher.java#L325-L330
craftercms/deployer
src/main/java/org/craftercms/deployer/utils/ConfigUtils.java
ConfigUtils.getBooleanProperty
public static Boolean getBooleanProperty(Configuration config, String key) throws DeployerConfigurationException { """ Returns the specified Boolean property from the configuration @param config the configuration @param key the key of the property @return the Boolean value of the property, or null if not found @throws DeployerConfigurationException if an error occurred """ return getBooleanProperty(config, key, null); }
java
public static Boolean getBooleanProperty(Configuration config, String key) throws DeployerConfigurationException { return getBooleanProperty(config, key, null); }
[ "public", "static", "Boolean", "getBooleanProperty", "(", "Configuration", "config", ",", "String", "key", ")", "throws", "DeployerConfigurationException", "{", "return", "getBooleanProperty", "(", "config", ",", "key", ",", "null", ")", ";", "}" ]
Returns the specified Boolean property from the configuration @param config the configuration @param key the key of the property @return the Boolean value of the property, or null if not found @throws DeployerConfigurationException if an error occurred
[ "Returns", "the", "specified", "Boolean", "property", "from", "the", "configuration" ]
train
https://github.com/craftercms/deployer/blob/3ed446e3cc8af1055de2de6f871907f90ef27f63/src/main/java/org/craftercms/deployer/utils/ConfigUtils.java#L140-L142
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) { """ 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 """ 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", "?", "null", ":", "parent", ".", "toString", "(", ")", ")", ".", "setFilter", "(", "filter", ")", ".", "build", "(", ")", ";", "batchDeleteJobs", "(", "request", ")", ";", "}" ]
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
citrusframework/citrus
modules/citrus-selenium/src/main/java/com/consol/citrus/selenium/endpoint/SeleniumBrowser.java
SeleniumBrowser.getStoredFile
public String getStoredFile(String filename) { """ Retrieve resource object @param filename Resource to retrieve. @return String with the path to the resource. """ try { File stored = new File(temporaryStorage.toFile(), filename); if (!stored.exists()) { throw new CitrusRuntimeException("Failed to access stored file: " + stored.getCanonicalPath()); } return stored.getCanonicalPath(); } catch (IOException e) { throw new CitrusRuntimeException("Failed to retrieve file: " + filename, e); } }
java
public String getStoredFile(String filename) { try { File stored = new File(temporaryStorage.toFile(), filename); if (!stored.exists()) { throw new CitrusRuntimeException("Failed to access stored file: " + stored.getCanonicalPath()); } return stored.getCanonicalPath(); } catch (IOException e) { throw new CitrusRuntimeException("Failed to retrieve file: " + filename, e); } }
[ "public", "String", "getStoredFile", "(", "String", "filename", ")", "{", "try", "{", "File", "stored", "=", "new", "File", "(", "temporaryStorage", ".", "toFile", "(", ")", ",", "filename", ")", ";", "if", "(", "!", "stored", ".", "exists", "(", ")", ")", "{", "throw", "new", "CitrusRuntimeException", "(", "\"Failed to access stored file: \"", "+", "stored", ".", "getCanonicalPath", "(", ")", ")", ";", "}", "return", "stored", ".", "getCanonicalPath", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "CitrusRuntimeException", "(", "\"Failed to retrieve file: \"", "+", "filename", ",", "e", ")", ";", "}", "}" ]
Retrieve resource object @param filename Resource to retrieve. @return String with the path to the resource.
[ "Retrieve", "resource", "object" ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-selenium/src/main/java/com/consol/citrus/selenium/endpoint/SeleniumBrowser.java#L181-L193
lessthanoptimal/ejml
main/ejml-dsparse/src/org/ejml/sparse/csc/CommonOps_DSCC.java
CommonOps_DSCC.sumRows
public static DMatrixRMaj sumRows(DMatrixSparseCSC input , @Nullable DMatrixRMaj output ) { """ <p> Computes the sum of each row in the input matrix and returns the results in a vector:<br> <br> b<sub>j</sub> = sum(i=1:n ; a<sub>ji</sub>) </p> @param input Input matrix @param output Optional storage for output. Reshaped into a column vector. Modified. @return Vector containing the sum of each row """ if( output == null ) { output = new DMatrixRMaj(input.numRows,1); } else { output.reshape(input.numRows,1); } Arrays.fill(output.data,0,input.numRows,0); for (int col = 0; col < input.numCols; col++) { int idx0 = input.col_idx[col]; int idx1 = input.col_idx[col + 1]; for (int i = idx0; i < idx1; i++) { output.data[input.nz_rows[i]] += input.nz_values[i]; } } return output; }
java
public static DMatrixRMaj sumRows(DMatrixSparseCSC input , @Nullable DMatrixRMaj output ) { if( output == null ) { output = new DMatrixRMaj(input.numRows,1); } else { output.reshape(input.numRows,1); } Arrays.fill(output.data,0,input.numRows,0); for (int col = 0; col < input.numCols; col++) { int idx0 = input.col_idx[col]; int idx1 = input.col_idx[col + 1]; for (int i = idx0; i < idx1; i++) { output.data[input.nz_rows[i]] += input.nz_values[i]; } } return output; }
[ "public", "static", "DMatrixRMaj", "sumRows", "(", "DMatrixSparseCSC", "input", ",", "@", "Nullable", "DMatrixRMaj", "output", ")", "{", "if", "(", "output", "==", "null", ")", "{", "output", "=", "new", "DMatrixRMaj", "(", "input", ".", "numRows", ",", "1", ")", ";", "}", "else", "{", "output", ".", "reshape", "(", "input", ".", "numRows", ",", "1", ")", ";", "}", "Arrays", ".", "fill", "(", "output", ".", "data", ",", "0", ",", "input", ".", "numRows", ",", "0", ")", ";", "for", "(", "int", "col", "=", "0", ";", "col", "<", "input", ".", "numCols", ";", "col", "++", ")", "{", "int", "idx0", "=", "input", ".", "col_idx", "[", "col", "]", ";", "int", "idx1", "=", "input", ".", "col_idx", "[", "col", "+", "1", "]", ";", "for", "(", "int", "i", "=", "idx0", ";", "i", "<", "idx1", ";", "i", "++", ")", "{", "output", ".", "data", "[", "input", ".", "nz_rows", "[", "i", "]", "]", "+=", "input", ".", "nz_values", "[", "i", "]", ";", "}", "}", "return", "output", ";", "}" ]
<p> Computes the sum of each row in the input matrix and returns the results in a vector:<br> <br> b<sub>j</sub> = sum(i=1:n ; a<sub>ji</sub>) </p> @param input Input matrix @param output Optional storage for output. Reshaped into a column vector. Modified. @return Vector containing the sum of each row
[ "<p", ">", "Computes", "the", "sum", "of", "each", "row", "in", "the", "input", "matrix", "and", "returns", "the", "results", "in", "a", "vector", ":", "<br", ">", "<br", ">", "b<sub", ">", "j<", "/", "sub", ">", "=", "sum", "(", "i", "=", "1", ":", "n", ";", "a<sub", ">", "ji<", "/", "sub", ">", ")", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-dsparse/src/org/ejml/sparse/csc/CommonOps_DSCC.java#L1393-L1412
op4j/op4j-jodatime
src/main/java/org/op4j/jodatime/functions/FnPeriod.java
FnPeriod.baseDateTimeFieldCollectionToPeriod
public static final Function<Collection<? extends BaseDateTime>, Period> baseDateTimeFieldCollectionToPeriod(final PeriodType periodType, final Chronology chronology) { """ <p> It creates a {@link Period} with the specified {@link PeriodType} and {@link Chronology}. The input received by the {@link Function} must have size 2 and represents the start and end instants of the {@link Period} </p> @param periodType the {@link PeriodType} to be created. It specifies which duration fields are to be used @param chronology {@link Chronology} to be used @return the {@link Period} created from the input and arguments """ return new BaseDateTimeFieldCollectionToPeriod(periodType, chronology); }
java
public static final Function<Collection<? extends BaseDateTime>, Period> baseDateTimeFieldCollectionToPeriod(final PeriodType periodType, final Chronology chronology) { return new BaseDateTimeFieldCollectionToPeriod(periodType, chronology); }
[ "public", "static", "final", "Function", "<", "Collection", "<", "?", "extends", "BaseDateTime", ">", ",", "Period", ">", "baseDateTimeFieldCollectionToPeriod", "(", "final", "PeriodType", "periodType", ",", "final", "Chronology", "chronology", ")", "{", "return", "new", "BaseDateTimeFieldCollectionToPeriod", "(", "periodType", ",", "chronology", ")", ";", "}" ]
<p> It creates a {@link Period} with the specified {@link PeriodType} and {@link Chronology}. The input received by the {@link Function} must have size 2 and represents the start and end instants of the {@link Period} </p> @param periodType the {@link PeriodType} to be created. It specifies which duration fields are to be used @param chronology {@link Chronology} to be used @return the {@link Period} created from the input and arguments
[ "<p", ">", "It", "creates", "a", "{", "@link", "Period", "}", "with", "the", "specified", "{", "@link", "PeriodType", "}", "and", "{", "@link", "Chronology", "}", ".", "The", "input", "received", "by", "the", "{", "@link", "Function", "}", "must", "have", "size", "2", "and", "represents", "the", "start", "and", "end", "instants", "of", "the", "{", "@link", "Period", "}", "<", "/", "p", ">" ]
train
https://github.com/op4j/op4j-jodatime/blob/26e5b8cda8553fb3b5a4a64b3109dbbf5df21194/src/main/java/org/op4j/jodatime/functions/FnPeriod.java#L614-L616
fcrepo3/fcrepo
fcrepo-common/src/main/java/org/fcrepo/utilities/xml/XercesXmlSerializers.java
XercesXmlSerializers.writeConsoleWithDocType
public static void writeConsoleWithDocType(Document ele, Writer out) throws IOException { """ This method is used in object conversion. None of the standard formats -- FOXML, METS, ATOM -- have DOCTYPE declarations, so the inability of XSLT to propagate that information is probably irrelevant. However, the line wrapping issue remains. method: "XML" charset: "UTF-8" indenting: TRUE indent-width: 2 line-width: 80 preserve-space: FALSE omit-XML-declaration: FALSE omit-DOCTYPE: FALSE @param ele @param out @throws IOException """ XMLSerializer serializer = new XMLSerializer(out, CONSOLE_WITH_DOCTYPE); serializer.serialize(ele); }
java
public static void writeConsoleWithDocType(Document ele, Writer out) throws IOException { XMLSerializer serializer = new XMLSerializer(out, CONSOLE_WITH_DOCTYPE); serializer.serialize(ele); }
[ "public", "static", "void", "writeConsoleWithDocType", "(", "Document", "ele", ",", "Writer", "out", ")", "throws", "IOException", "{", "XMLSerializer", "serializer", "=", "new", "XMLSerializer", "(", "out", ",", "CONSOLE_WITH_DOCTYPE", ")", ";", "serializer", ".", "serialize", "(", "ele", ")", ";", "}" ]
This method is used in object conversion. None of the standard formats -- FOXML, METS, ATOM -- have DOCTYPE declarations, so the inability of XSLT to propagate that information is probably irrelevant. However, the line wrapping issue remains. method: "XML" charset: "UTF-8" indenting: TRUE indent-width: 2 line-width: 80 preserve-space: FALSE omit-XML-declaration: FALSE omit-DOCTYPE: FALSE @param ele @param out @throws IOException
[ "This", "method", "is", "used", "in", "object", "conversion", ".", "None", "of", "the", "standard", "formats", "--", "FOXML", "METS", "ATOM", "--", "have", "DOCTYPE", "declarations", "so", "the", "inability", "of", "XSLT", "to", "propagate", "that", "information", "is", "probably", "irrelevant", ".", "However", "the", "line", "wrapping", "issue", "remains", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-common/src/main/java/org/fcrepo/utilities/xml/XercesXmlSerializers.java#L108-L113
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/BugInstance.java
BugInstance.setProperty
@Nonnull public BugInstance setProperty(String name, String value) { """ Set value of given property. @param name name of the property to set @param value the value of the property @return this object, so calls can be chained """ BugProperty prop = lookupProperty(name); if (prop != null) { prop.setValue(value); } else { prop = new BugProperty(name, value); addProperty(prop); } return this; }
java
@Nonnull public BugInstance setProperty(String name, String value) { BugProperty prop = lookupProperty(name); if (prop != null) { prop.setValue(value); } else { prop = new BugProperty(name, value); addProperty(prop); } return this; }
[ "@", "Nonnull", "public", "BugInstance", "setProperty", "(", "String", "name", ",", "String", "value", ")", "{", "BugProperty", "prop", "=", "lookupProperty", "(", "name", ")", ";", "if", "(", "prop", "!=", "null", ")", "{", "prop", ".", "setValue", "(", "value", ")", ";", "}", "else", "{", "prop", "=", "new", "BugProperty", "(", "name", ",", "value", ")", ";", "addProperty", "(", "prop", ")", ";", "}", "return", "this", ";", "}" ]
Set value of given property. @param name name of the property to set @param value the value of the property @return this object, so calls can be chained
[ "Set", "value", "of", "given", "property", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/BugInstance.java#L711-L721
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/IntegerField.java
IntegerField.setValue
public int setValue(double value, boolean bDisplayOption, int moveMode) { """ /* Set the Value of this field as a double. @param value The value of this field. @param iDisplayOption If true, display the new field. @param iMoveMove The move mode. @return An error code (NORMAL_RETURN for success). """ // Set this field's value Integer tempLong = new Integer((int)value); int iErrorCode = this.setData(tempLong, bDisplayOption, moveMode); return iErrorCode; }
java
public int setValue(double value, boolean bDisplayOption, int moveMode) { // Set this field's value Integer tempLong = new Integer((int)value); int iErrorCode = this.setData(tempLong, bDisplayOption, moveMode); return iErrorCode; }
[ "public", "int", "setValue", "(", "double", "value", ",", "boolean", "bDisplayOption", ",", "int", "moveMode", ")", "{", "// Set this field's value", "Integer", "tempLong", "=", "new", "Integer", "(", "(", "int", ")", "value", ")", ";", "int", "iErrorCode", "=", "this", ".", "setData", "(", "tempLong", ",", "bDisplayOption", ",", "moveMode", ")", ";", "return", "iErrorCode", ";", "}" ]
/* Set the Value of this field as a double. @param value The value of this field. @param iDisplayOption If true, display the new field. @param iMoveMove The move mode. @return An error code (NORMAL_RETURN for success).
[ "/", "*", "Set", "the", "Value", "of", "this", "field", "as", "a", "double", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/IntegerField.java#L191-L196
Harium/keel
src/main/java/com/harium/keel/catalano/core/ArraysUtil.java
ArraysUtil.Shuffle
public static void Shuffle(double[] array, long seed) { """ Shuffle an array. @param array Array. @param seed Random seed. """ Random random = new Random(); if (seed != 0) random.setSeed(seed); for (int i = array.length - 1; i > 0; i--) { int index = random.nextInt(i + 1); double temp = array[index]; array[index] = array[i]; array[i] = temp; } }
java
public static void Shuffle(double[] array, long seed) { Random random = new Random(); if (seed != 0) random.setSeed(seed); for (int i = array.length - 1; i > 0; i--) { int index = random.nextInt(i + 1); double temp = array[index]; array[index] = array[i]; array[i] = temp; } }
[ "public", "static", "void", "Shuffle", "(", "double", "[", "]", "array", ",", "long", "seed", ")", "{", "Random", "random", "=", "new", "Random", "(", ")", ";", "if", "(", "seed", "!=", "0", ")", "random", ".", "setSeed", "(", "seed", ")", ";", "for", "(", "int", "i", "=", "array", ".", "length", "-", "1", ";", "i", ">", "0", ";", "i", "--", ")", "{", "int", "index", "=", "random", ".", "nextInt", "(", "i", "+", "1", ")", ";", "double", "temp", "=", "array", "[", "index", "]", ";", "array", "[", "index", "]", "=", "array", "[", "i", "]", ";", "array", "[", "i", "]", "=", "temp", ";", "}", "}" ]
Shuffle an array. @param array Array. @param seed Random seed.
[ "Shuffle", "an", "array", "." ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/core/ArraysUtil.java#L293-L303
phax/ph-commons
ph-security/src/main/java/com/helger/security/authentication/result/AuthIdentificationResult.java
AuthIdentificationResult.createSuccess
@Nonnull public static AuthIdentificationResult createSuccess (@Nonnull final IAuthToken aAuthToken) { """ Factory method for success authentication. @param aAuthToken The auth token. May not be <code>null</code>. @return Never <code>null</code>. """ ValueEnforcer.notNull (aAuthToken, "AuthToken"); return new AuthIdentificationResult (aAuthToken, null); }
java
@Nonnull public static AuthIdentificationResult createSuccess (@Nonnull final IAuthToken aAuthToken) { ValueEnforcer.notNull (aAuthToken, "AuthToken"); return new AuthIdentificationResult (aAuthToken, null); }
[ "@", "Nonnull", "public", "static", "AuthIdentificationResult", "createSuccess", "(", "@", "Nonnull", "final", "IAuthToken", "aAuthToken", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aAuthToken", ",", "\"AuthToken\"", ")", ";", "return", "new", "AuthIdentificationResult", "(", "aAuthToken", ",", "null", ")", ";", "}" ]
Factory method for success authentication. @param aAuthToken The auth token. May not be <code>null</code>. @return Never <code>null</code>.
[ "Factory", "method", "for", "success", "authentication", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-security/src/main/java/com/helger/security/authentication/result/AuthIdentificationResult.java#L106-L111
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/application/greedyensemble/VisualizePairwiseGainMatrix.java
VisualizePairwiseGainMatrix.showVisualization
private void showVisualization(VisualizerContext context, SimilarityMatrixVisualizer factory, VisualizationTask task) { """ Show a single visualization. @param context Visualizer context @param factory Visualizer factory @param task Visualization task """ VisualizationPlot plot = new VisualizationPlot(); Visualization vis = factory.makeVisualization(context, task, plot, 1.0, 1.0, null); plot.getRoot().appendChild(vis.getLayer()); plot.getRoot().setAttribute(SVGConstants.SVG_WIDTH_ATTRIBUTE, "20cm"); plot.getRoot().setAttribute(SVGConstants.SVG_HEIGHT_ATTRIBUTE, "20cm"); plot.getRoot().setAttribute(SVGConstants.SVG_VIEW_BOX_ATTRIBUTE, "0 0 1 1"); plot.updateStyleElement(); (new SimpleSVGViewer()).setPlot(plot); }
java
private void showVisualization(VisualizerContext context, SimilarityMatrixVisualizer factory, VisualizationTask task) { VisualizationPlot plot = new VisualizationPlot(); Visualization vis = factory.makeVisualization(context, task, plot, 1.0, 1.0, null); plot.getRoot().appendChild(vis.getLayer()); plot.getRoot().setAttribute(SVGConstants.SVG_WIDTH_ATTRIBUTE, "20cm"); plot.getRoot().setAttribute(SVGConstants.SVG_HEIGHT_ATTRIBUTE, "20cm"); plot.getRoot().setAttribute(SVGConstants.SVG_VIEW_BOX_ATTRIBUTE, "0 0 1 1"); plot.updateStyleElement(); (new SimpleSVGViewer()).setPlot(plot); }
[ "private", "void", "showVisualization", "(", "VisualizerContext", "context", ",", "SimilarityMatrixVisualizer", "factory", ",", "VisualizationTask", "task", ")", "{", "VisualizationPlot", "plot", "=", "new", "VisualizationPlot", "(", ")", ";", "Visualization", "vis", "=", "factory", ".", "makeVisualization", "(", "context", ",", "task", ",", "plot", ",", "1.0", ",", "1.0", ",", "null", ")", ";", "plot", ".", "getRoot", "(", ")", ".", "appendChild", "(", "vis", ".", "getLayer", "(", ")", ")", ";", "plot", ".", "getRoot", "(", ")", ".", "setAttribute", "(", "SVGConstants", ".", "SVG_WIDTH_ATTRIBUTE", ",", "\"20cm\"", ")", ";", "plot", ".", "getRoot", "(", ")", ".", "setAttribute", "(", "SVGConstants", ".", "SVG_HEIGHT_ATTRIBUTE", ",", "\"20cm\"", ")", ";", "plot", ".", "getRoot", "(", ")", ".", "setAttribute", "(", "SVGConstants", ".", "SVG_VIEW_BOX_ATTRIBUTE", ",", "\"0 0 1 1\"", ")", ";", "plot", ".", "updateStyleElement", "(", ")", ";", "(", "new", "SimpleSVGViewer", "(", ")", ")", ".", "setPlot", "(", "plot", ")", ";", "}" ]
Show a single visualization. @param context Visualizer context @param factory Visualizer factory @param task Visualization task
[ "Show", "a", "single", "visualization", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/application/greedyensemble/VisualizePairwiseGainMatrix.java#L265-L275
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) { """ 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 """ 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", ".", "get", "(", ")", ".", "getRateLimitPool", "(", ")", ")", ";", "}" ]
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", ">", "asynchronous<", "/", "b", ">", "operation", "that", "will", "return", "a", "{", "@link", "java", ".", "util", ".", "concurrent", ".", "ScheduledFuture", "ScheduledFuture", "}", "representing", "the", "task", "." ]
train
https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/requests/RestAction.java#L598-L601
awin/rabbiteasy
rabbiteasy-core/src/main/java/com/zanox/rabbiteasy/MessageReader.java
MessageReader.readBodyAsString
public String readBodyAsString() { """ Extracts the message body and interprets it as a string. @return The message body as string """ Charset charset = readCharset(); byte[] bodyContent = message.getBodyContent(); return new String(bodyContent, charset); }
java
public String readBodyAsString() { Charset charset = readCharset(); byte[] bodyContent = message.getBodyContent(); return new String(bodyContent, charset); }
[ "public", "String", "readBodyAsString", "(", ")", "{", "Charset", "charset", "=", "readCharset", "(", ")", ";", "byte", "[", "]", "bodyContent", "=", "message", ".", "getBodyContent", "(", ")", ";", "return", "new", "String", "(", "bodyContent", ",", "charset", ")", ";", "}" ]
Extracts the message body and interprets it as a string. @return The message body as string
[ "Extracts", "the", "message", "body", "and", "interprets", "it", "as", "a", "string", "." ]
train
https://github.com/awin/rabbiteasy/blob/c161efda6c0f7ef319aedf09dfe40a4a90165510/rabbiteasy-core/src/main/java/com/zanox/rabbiteasy/MessageReader.java#L80-L84
gallandarakhneorg/afc
advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/StandardRoadConnection.java
StandardRoadConnection.addConnectedSegment
void addConnectedSegment(RoadPolyline segment, boolean attachToStartPoint) { """ Add a segment to this connection point. <p>The segments are ordered according to there geo-localization along a trigonometric cicle. The first segment has the nearest angle to the vector (1,0), and the following segments are ordered according to the positive value of there angles to this unity vector (counterclockwise order). @param segment is the segment to add. @param attachToStartPoint indicates if the segment must be attached by its start point (if value is <code>true</code>) or by its end point (if value is <code>false</code>). """ if (segment == null) { return; } if (this.connectedSegments.isEmpty()) { this.connectedSegments.add(new Connection(segment, attachToStartPoint)); } else { // Compute the angle to the unit vector for the new segment final double newSegmentAngle = computeAngle(segment, attachToStartPoint); // Search for the insertion index final int insertionIndex = searchInsertionIndex(newSegmentAngle, 0, this.connectedSegments.size() - 1); // Insert this.connectedSegments.add(insertionIndex, new Connection(segment, attachToStartPoint)); } fireIteratorUpdate(); }
java
void addConnectedSegment(RoadPolyline segment, boolean attachToStartPoint) { if (segment == null) { return; } if (this.connectedSegments.isEmpty()) { this.connectedSegments.add(new Connection(segment, attachToStartPoint)); } else { // Compute the angle to the unit vector for the new segment final double newSegmentAngle = computeAngle(segment, attachToStartPoint); // Search for the insertion index final int insertionIndex = searchInsertionIndex(newSegmentAngle, 0, this.connectedSegments.size() - 1); // Insert this.connectedSegments.add(insertionIndex, new Connection(segment, attachToStartPoint)); } fireIteratorUpdate(); }
[ "void", "addConnectedSegment", "(", "RoadPolyline", "segment", ",", "boolean", "attachToStartPoint", ")", "{", "if", "(", "segment", "==", "null", ")", "{", "return", ";", "}", "if", "(", "this", ".", "connectedSegments", ".", "isEmpty", "(", ")", ")", "{", "this", ".", "connectedSegments", ".", "add", "(", "new", "Connection", "(", "segment", ",", "attachToStartPoint", ")", ")", ";", "}", "else", "{", "// Compute the angle to the unit vector for the new segment", "final", "double", "newSegmentAngle", "=", "computeAngle", "(", "segment", ",", "attachToStartPoint", ")", ";", "// Search for the insertion index", "final", "int", "insertionIndex", "=", "searchInsertionIndex", "(", "newSegmentAngle", ",", "0", ",", "this", ".", "connectedSegments", ".", "size", "(", ")", "-", "1", ")", ";", "// Insert", "this", ".", "connectedSegments", ".", "add", "(", "insertionIndex", ",", "new", "Connection", "(", "segment", ",", "attachToStartPoint", ")", ")", ";", "}", "fireIteratorUpdate", "(", ")", ";", "}" ]
Add a segment to this connection point. <p>The segments are ordered according to there geo-localization along a trigonometric cicle. The first segment has the nearest angle to the vector (1,0), and the following segments are ordered according to the positive value of there angles to this unity vector (counterclockwise order). @param segment is the segment to add. @param attachToStartPoint indicates if the segment must be attached by its start point (if value is <code>true</code>) or by its end point (if value is <code>false</code>).
[ "Add", "a", "segment", "to", "this", "connection", "point", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/StandardRoadConnection.java#L310-L326
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/code/Types.java
Types.functionalInterfaceBridges
public List<Symbol> functionalInterfaceBridges(TypeSymbol origin) { """ Find the minimal set of methods that are overridden by the functional descriptor in 'origin'. All returned methods are assumed to have different erased signatures. """ Assert.check(isFunctionalInterface(origin)); Symbol descSym = findDescriptorSymbol(origin); CompoundScope members = membersClosure(origin.type, false); ListBuffer<Symbol> overridden = new ListBuffer<>(); outer: for (Symbol m2 : members.getElementsByName(descSym.name, bridgeFilter)) { if (m2 == descSym) continue; else if (descSym.overrides(m2, origin, Types.this, false)) { for (Symbol m3 : overridden) { if (isSameType(m3.erasure(Types.this), m2.erasure(Types.this)) || (m3.overrides(m2, origin, Types.this, false) && (pendingBridges((ClassSymbol)origin, m3.enclClass()) || (((MethodSymbol)m2).binaryImplementation((ClassSymbol)m3.owner, Types.this) != null)))) { continue outer; } } overridden.add(m2); } } return overridden.toList(); }
java
public List<Symbol> functionalInterfaceBridges(TypeSymbol origin) { Assert.check(isFunctionalInterface(origin)); Symbol descSym = findDescriptorSymbol(origin); CompoundScope members = membersClosure(origin.type, false); ListBuffer<Symbol> overridden = new ListBuffer<>(); outer: for (Symbol m2 : members.getElementsByName(descSym.name, bridgeFilter)) { if (m2 == descSym) continue; else if (descSym.overrides(m2, origin, Types.this, false)) { for (Symbol m3 : overridden) { if (isSameType(m3.erasure(Types.this), m2.erasure(Types.this)) || (m3.overrides(m2, origin, Types.this, false) && (pendingBridges((ClassSymbol)origin, m3.enclClass()) || (((MethodSymbol)m2).binaryImplementation((ClassSymbol)m3.owner, Types.this) != null)))) { continue outer; } } overridden.add(m2); } } return overridden.toList(); }
[ "public", "List", "<", "Symbol", ">", "functionalInterfaceBridges", "(", "TypeSymbol", "origin", ")", "{", "Assert", ".", "check", "(", "isFunctionalInterface", "(", "origin", ")", ")", ";", "Symbol", "descSym", "=", "findDescriptorSymbol", "(", "origin", ")", ";", "CompoundScope", "members", "=", "membersClosure", "(", "origin", ".", "type", ",", "false", ")", ";", "ListBuffer", "<", "Symbol", ">", "overridden", "=", "new", "ListBuffer", "<>", "(", ")", ";", "outer", ":", "for", "(", "Symbol", "m2", ":", "members", ".", "getElementsByName", "(", "descSym", ".", "name", ",", "bridgeFilter", ")", ")", "{", "if", "(", "m2", "==", "descSym", ")", "continue", ";", "else", "if", "(", "descSym", ".", "overrides", "(", "m2", ",", "origin", ",", "Types", ".", "this", ",", "false", ")", ")", "{", "for", "(", "Symbol", "m3", ":", "overridden", ")", "{", "if", "(", "isSameType", "(", "m3", ".", "erasure", "(", "Types", ".", "this", ")", ",", "m2", ".", "erasure", "(", "Types", ".", "this", ")", ")", "||", "(", "m3", ".", "overrides", "(", "m2", ",", "origin", ",", "Types", ".", "this", ",", "false", ")", "&&", "(", "pendingBridges", "(", "(", "ClassSymbol", ")", "origin", ",", "m3", ".", "enclClass", "(", ")", ")", "||", "(", "(", "(", "MethodSymbol", ")", "m2", ")", ".", "binaryImplementation", "(", "(", "ClassSymbol", ")", "m3", ".", "owner", ",", "Types", ".", "this", ")", "!=", "null", ")", ")", ")", ")", "{", "continue", "outer", ";", "}", "}", "overridden", ".", "add", "(", "m2", ")", ";", "}", "}", "return", "overridden", ".", "toList", "(", ")", ";", "}" ]
Find the minimal set of methods that are overridden by the functional descriptor in 'origin'. All returned methods are assumed to have different erased signatures.
[ "Find", "the", "minimal", "set", "of", "methods", "that", "are", "overridden", "by", "the", "functional", "descriptor", "in", "origin", ".", "All", "returned", "methods", "are", "assumed", "to", "have", "different", "erased", "signatures", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/code/Types.java#L658-L678
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTable.java
WTable.updateBeanValueForColumnInRow
private void updateBeanValueForColumnInRow(final WTableRowRenderer rowRenderer, final UIContext rowContext, final List<Integer> rowIndex, final int col, final TableModel model) { """ Update the column in the row. @param rowRenderer the table row renderer @param rowContext the row context @param rowIndex the row id to update @param col the column to update @param model the table model """ // The actual component is wrapped in a renderer wrapper, so we have to fetch it from that WComponent renderer = ((Container) rowRenderer.getRenderer(col)).getChildAt(0); UIContextHolder.pushContext(rowContext); try { // If the column is a Container then call updateBeanValue to let the column renderer and its children update // the "bean" returned by getValueAt(row, col) if (renderer instanceof Container) { WebUtilities.updateBeanValue(renderer); } else if (renderer instanceof DataBound) { // Update Databound renderer Object oldValue = model.getValueAt(rowIndex, col); Object newValue = ((DataBound) renderer).getData(); if (!Util.equals(oldValue, newValue)) { model.setValueAt(newValue, rowIndex, col); } } } finally { UIContextHolder.popContext(); } }
java
private void updateBeanValueForColumnInRow(final WTableRowRenderer rowRenderer, final UIContext rowContext, final List<Integer> rowIndex, final int col, final TableModel model) { // The actual component is wrapped in a renderer wrapper, so we have to fetch it from that WComponent renderer = ((Container) rowRenderer.getRenderer(col)).getChildAt(0); UIContextHolder.pushContext(rowContext); try { // If the column is a Container then call updateBeanValue to let the column renderer and its children update // the "bean" returned by getValueAt(row, col) if (renderer instanceof Container) { WebUtilities.updateBeanValue(renderer); } else if (renderer instanceof DataBound) { // Update Databound renderer Object oldValue = model.getValueAt(rowIndex, col); Object newValue = ((DataBound) renderer).getData(); if (!Util.equals(oldValue, newValue)) { model.setValueAt(newValue, rowIndex, col); } } } finally { UIContextHolder.popContext(); } }
[ "private", "void", "updateBeanValueForColumnInRow", "(", "final", "WTableRowRenderer", "rowRenderer", ",", "final", "UIContext", "rowContext", ",", "final", "List", "<", "Integer", ">", "rowIndex", ",", "final", "int", "col", ",", "final", "TableModel", "model", ")", "{", "// The actual component is wrapped in a renderer wrapper, so we have to fetch it from that", "WComponent", "renderer", "=", "(", "(", "Container", ")", "rowRenderer", ".", "getRenderer", "(", "col", ")", ")", ".", "getChildAt", "(", "0", ")", ";", "UIContextHolder", ".", "pushContext", "(", "rowContext", ")", ";", "try", "{", "// If the column is a Container then call updateBeanValue to let the column renderer and its children update", "// the \"bean\" returned by getValueAt(row, col)", "if", "(", "renderer", "instanceof", "Container", ")", "{", "WebUtilities", ".", "updateBeanValue", "(", "renderer", ")", ";", "}", "else", "if", "(", "renderer", "instanceof", "DataBound", ")", "{", "// Update Databound renderer", "Object", "oldValue", "=", "model", ".", "getValueAt", "(", "rowIndex", ",", "col", ")", ";", "Object", "newValue", "=", "(", "(", "DataBound", ")", "renderer", ")", ".", "getData", "(", ")", ";", "if", "(", "!", "Util", ".", "equals", "(", "oldValue", ",", "newValue", ")", ")", "{", "model", ".", "setValueAt", "(", "newValue", ",", "rowIndex", ",", "col", ")", ";", "}", "}", "}", "finally", "{", "UIContextHolder", ".", "popContext", "(", ")", ";", "}", "}" ]
Update the column in the row. @param rowRenderer the table row renderer @param rowContext the row context @param rowIndex the row id to update @param col the column to update @param model the table model
[ "Update", "the", "column", "in", "the", "row", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTable.java#L440-L465
aws/aws-sdk-java
aws-java-sdk-cognitoidp/src/main/java/com/amazonaws/services/cognitoidp/model/InitiateAuthRequest.java
InitiateAuthRequest.withClientMetadata
public InitiateAuthRequest withClientMetadata(java.util.Map<String, String> clientMetadata) { """ <p> This is a random key-value pair map which can contain any key and will be passed to your PreAuthentication Lambda trigger as-is. It can be used to implement additional validations around authentication. </p> @param clientMetadata This is a random key-value pair map which can contain any key and will be passed to your PreAuthentication Lambda trigger as-is. It can be used to implement additional validations around authentication. @return Returns a reference to this object so that method calls can be chained together. """ setClientMetadata(clientMetadata); return this; }
java
public InitiateAuthRequest withClientMetadata(java.util.Map<String, String> clientMetadata) { setClientMetadata(clientMetadata); return this; }
[ "public", "InitiateAuthRequest", "withClientMetadata", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "clientMetadata", ")", "{", "setClientMetadata", "(", "clientMetadata", ")", ";", "return", "this", ";", "}" ]
<p> This is a random key-value pair map which can contain any key and will be passed to your PreAuthentication Lambda trigger as-is. It can be used to implement additional validations around authentication. </p> @param clientMetadata This is a random key-value pair map which can contain any key and will be passed to your PreAuthentication Lambda trigger as-is. It can be used to implement additional validations around authentication. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "This", "is", "a", "random", "key", "-", "value", "pair", "map", "which", "can", "contain", "any", "key", "and", "will", "be", "passed", "to", "your", "PreAuthentication", "Lambda", "trigger", "as", "-", "is", ".", "It", "can", "be", "used", "to", "implement", "additional", "validations", "around", "authentication", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-cognitoidp/src/main/java/com/amazonaws/services/cognitoidp/model/InitiateAuthRequest.java#L946-L949
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/jsr305/TypeQualifierApplications.java
TypeQualifierApplications.getDirectTypeQualifierAnnotation
public static @CheckForNull @CheckReturnValue TypeQualifierAnnotation getDirectTypeQualifierAnnotation(XMethod xmethod, int parameter, TypeQualifierValue<?> typeQualifierValue) { """ Get the TypeQualifierAnnotation directly applied to given method parameter. @param xmethod a method @param parameter a parameter (0 == first parameter) @param typeQualifierValue the kind of TypeQualifierValue we are looking for @return TypeQualifierAnnotation directly applied to the parameter, or null if there is no directly applied TypeQualifierAnnotation """ XMethod bridge = xmethod.bridgeTo(); if (bridge != null) { xmethod = bridge; } Set<TypeQualifierAnnotation> applications = new HashSet<>(); getDirectApplications(applications, xmethod, parameter); if (DEBUG_METHOD != null && DEBUG_METHOD.equals(xmethod.getName())) { System.out.println(" Direct applications are: " + applications); } return findMatchingTypeQualifierAnnotation(applications, typeQualifierValue); }
java
public static @CheckForNull @CheckReturnValue TypeQualifierAnnotation getDirectTypeQualifierAnnotation(XMethod xmethod, int parameter, TypeQualifierValue<?> typeQualifierValue) { XMethod bridge = xmethod.bridgeTo(); if (bridge != null) { xmethod = bridge; } Set<TypeQualifierAnnotation> applications = new HashSet<>(); getDirectApplications(applications, xmethod, parameter); if (DEBUG_METHOD != null && DEBUG_METHOD.equals(xmethod.getName())) { System.out.println(" Direct applications are: " + applications); } return findMatchingTypeQualifierAnnotation(applications, typeQualifierValue); }
[ "public", "static", "@", "CheckForNull", "@", "CheckReturnValue", "TypeQualifierAnnotation", "getDirectTypeQualifierAnnotation", "(", "XMethod", "xmethod", ",", "int", "parameter", ",", "TypeQualifierValue", "<", "?", ">", "typeQualifierValue", ")", "{", "XMethod", "bridge", "=", "xmethod", ".", "bridgeTo", "(", ")", ";", "if", "(", "bridge", "!=", "null", ")", "{", "xmethod", "=", "bridge", ";", "}", "Set", "<", "TypeQualifierAnnotation", ">", "applications", "=", "new", "HashSet", "<>", "(", ")", ";", "getDirectApplications", "(", "applications", ",", "xmethod", ",", "parameter", ")", ";", "if", "(", "DEBUG_METHOD", "!=", "null", "&&", "DEBUG_METHOD", ".", "equals", "(", "xmethod", ".", "getName", "(", ")", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\" Direct applications are: \"", "+", "applications", ")", ";", "}", "return", "findMatchingTypeQualifierAnnotation", "(", "applications", ",", "typeQualifierValue", ")", ";", "}" ]
Get the TypeQualifierAnnotation directly applied to given method parameter. @param xmethod a method @param parameter a parameter (0 == first parameter) @param typeQualifierValue the kind of TypeQualifierValue we are looking for @return TypeQualifierAnnotation directly applied to the parameter, or null if there is no directly applied TypeQualifierAnnotation
[ "Get", "the", "TypeQualifierAnnotation", "directly", "applied", "to", "given", "method", "parameter", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/jsr305/TypeQualifierApplications.java#L924-L937
apereo/cas
support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/AbstractSamlProfileHandlerController.java
AbstractSamlProfileHandlerController.buildCasAssertion
protected Assertion buildCasAssertion(final Authentication authentication, final Service service, final RegisteredService registeredService, final Map<String, List<Object>> attributesToCombine) { """ Build cas assertion. @param authentication the authentication @param service the service @param registeredService the registered service @param attributesToCombine the attributes to combine @return the assertion """ val attributes = registeredService.getAttributeReleasePolicy().getAttributes(authentication.getPrincipal(), service, registeredService); val principalId = registeredService.getUsernameAttributeProvider().resolveUsername(authentication.getPrincipal(), service, registeredService); val principal = new AttributePrincipalImpl(principalId, (Map) attributes); val authnAttrs = new LinkedHashMap<>(authentication.getAttributes()); authnAttrs.putAll(attributesToCombine); return new AssertionImpl(principal, DateTimeUtils.dateOf(authentication.getAuthenticationDate()), null, DateTimeUtils.dateOf(authentication.getAuthenticationDate()), (Map) authnAttrs); }
java
protected Assertion buildCasAssertion(final Authentication authentication, final Service service, final RegisteredService registeredService, final Map<String, List<Object>> attributesToCombine) { val attributes = registeredService.getAttributeReleasePolicy().getAttributes(authentication.getPrincipal(), service, registeredService); val principalId = registeredService.getUsernameAttributeProvider().resolveUsername(authentication.getPrincipal(), service, registeredService); val principal = new AttributePrincipalImpl(principalId, (Map) attributes); val authnAttrs = new LinkedHashMap<>(authentication.getAttributes()); authnAttrs.putAll(attributesToCombine); return new AssertionImpl(principal, DateTimeUtils.dateOf(authentication.getAuthenticationDate()), null, DateTimeUtils.dateOf(authentication.getAuthenticationDate()), (Map) authnAttrs); }
[ "protected", "Assertion", "buildCasAssertion", "(", "final", "Authentication", "authentication", ",", "final", "Service", "service", ",", "final", "RegisteredService", "registeredService", ",", "final", "Map", "<", "String", ",", "List", "<", "Object", ">", ">", "attributesToCombine", ")", "{", "val", "attributes", "=", "registeredService", ".", "getAttributeReleasePolicy", "(", ")", ".", "getAttributes", "(", "authentication", ".", "getPrincipal", "(", ")", ",", "service", ",", "registeredService", ")", ";", "val", "principalId", "=", "registeredService", ".", "getUsernameAttributeProvider", "(", ")", ".", "resolveUsername", "(", "authentication", ".", "getPrincipal", "(", ")", ",", "service", ",", "registeredService", ")", ";", "val", "principal", "=", "new", "AttributePrincipalImpl", "(", "principalId", ",", "(", "Map", ")", "attributes", ")", ";", "val", "authnAttrs", "=", "new", "LinkedHashMap", "<>", "(", "authentication", ".", "getAttributes", "(", ")", ")", ";", "authnAttrs", ".", "putAll", "(", "attributesToCombine", ")", ";", "return", "new", "AssertionImpl", "(", "principal", ",", "DateTimeUtils", ".", "dateOf", "(", "authentication", ".", "getAuthenticationDate", "(", ")", ")", ",", "null", ",", "DateTimeUtils", ".", "dateOf", "(", "authentication", ".", "getAuthenticationDate", "(", ")", ")", ",", "(", "Map", ")", "authnAttrs", ")", ";", "}" ]
Build cas assertion. @param authentication the authentication @param service the service @param registeredService the registered service @param attributesToCombine the attributes to combine @return the assertion
[ "Build", "cas", "assertion", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/AbstractSamlProfileHandlerController.java#L159-L171
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WMenu.java
WMenu.isSelectable
private boolean isSelectable(final MenuItem item, final SelectionMode selectionMode) { """ Indicates whether the given menu item is selectable. @param item the menu item to check. @param selectionMode the select mode of the current menu/sub-menu @return true if the meu item is selectable, false otherwise. """ if (!(item instanceof MenuItemSelectable) || !item.isVisible() || (item instanceof Disableable && ((Disableable) item).isDisabled())) { return false; } // SubMenus are only selectable in a column menu type if (item instanceof WSubMenu && !MenuType.COLUMN.equals(getType())) { return false; } // Item is specificially set to selectable/unselectable Boolean itemSelectable = ((MenuItemSelectable) item).getSelectability(); if (itemSelectable != null) { return itemSelectable; } // Container has selection turned on return SelectionMode.SINGLE.equals(selectionMode) || SelectionMode.MULTIPLE.equals(selectionMode); }
java
private boolean isSelectable(final MenuItem item, final SelectionMode selectionMode) { if (!(item instanceof MenuItemSelectable) || !item.isVisible() || (item instanceof Disableable && ((Disableable) item).isDisabled())) { return false; } // SubMenus are only selectable in a column menu type if (item instanceof WSubMenu && !MenuType.COLUMN.equals(getType())) { return false; } // Item is specificially set to selectable/unselectable Boolean itemSelectable = ((MenuItemSelectable) item).getSelectability(); if (itemSelectable != null) { return itemSelectable; } // Container has selection turned on return SelectionMode.SINGLE.equals(selectionMode) || SelectionMode.MULTIPLE.equals(selectionMode); }
[ "private", "boolean", "isSelectable", "(", "final", "MenuItem", "item", ",", "final", "SelectionMode", "selectionMode", ")", "{", "if", "(", "!", "(", "item", "instanceof", "MenuItemSelectable", ")", "||", "!", "item", ".", "isVisible", "(", ")", "||", "(", "item", "instanceof", "Disableable", "&&", "(", "(", "Disableable", ")", "item", ")", ".", "isDisabled", "(", ")", ")", ")", "{", "return", "false", ";", "}", "// SubMenus are only selectable in a column menu type", "if", "(", "item", "instanceof", "WSubMenu", "&&", "!", "MenuType", ".", "COLUMN", ".", "equals", "(", "getType", "(", ")", ")", ")", "{", "return", "false", ";", "}", "// Item is specificially set to selectable/unselectable", "Boolean", "itemSelectable", "=", "(", "(", "MenuItemSelectable", ")", "item", ")", ".", "getSelectability", "(", ")", ";", "if", "(", "itemSelectable", "!=", "null", ")", "{", "return", "itemSelectable", ";", "}", "// Container has selection turned on", "return", "SelectionMode", ".", "SINGLE", ".", "equals", "(", "selectionMode", ")", "||", "SelectionMode", ".", "MULTIPLE", ".", "equals", "(", "selectionMode", ")", ";", "}" ]
Indicates whether the given menu item is selectable. @param item the menu item to check. @param selectionMode the select mode of the current menu/sub-menu @return true if the meu item is selectable, false otherwise.
[ "Indicates", "whether", "the", "given", "menu", "item", "is", "selectable", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WMenu.java#L568-L589
hankcs/HanLP
src/main/java/com/hankcs/hanlp/dependency/nnparser/parser_dll.java
parser_dll.parse
public int parse(List<String> words, List<String> postags, List<Integer> heads, List<String> deprels) { """ 分析句法 @param words 词语列表 @param postags 词性列表 @param heads 输出依存指向列表 @param deprels 输出依存名称列表 @return 节点的个数 """ Instance inst = new Instance(); inst.forms.add(SpecialOption.ROOT); inst.postags.add(SpecialOption.ROOT); for (int i = 0; i < words.size(); i++) { inst.forms.add(words.get(i)); inst.postags.add(postags.get(i)); } parser.predict(inst, heads, deprels); heads.remove(0); deprels.remove(0); return heads.size(); }
java
public int parse(List<String> words, List<String> postags, List<Integer> heads, List<String> deprels) { Instance inst = new Instance(); inst.forms.add(SpecialOption.ROOT); inst.postags.add(SpecialOption.ROOT); for (int i = 0; i < words.size(); i++) { inst.forms.add(words.get(i)); inst.postags.add(postags.get(i)); } parser.predict(inst, heads, deprels); heads.remove(0); deprels.remove(0); return heads.size(); }
[ "public", "int", "parse", "(", "List", "<", "String", ">", "words", ",", "List", "<", "String", ">", "postags", ",", "List", "<", "Integer", ">", "heads", ",", "List", "<", "String", ">", "deprels", ")", "{", "Instance", "inst", "=", "new", "Instance", "(", ")", ";", "inst", ".", "forms", ".", "add", "(", "SpecialOption", ".", "ROOT", ")", ";", "inst", ".", "postags", ".", "add", "(", "SpecialOption", ".", "ROOT", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "words", ".", "size", "(", ")", ";", "i", "++", ")", "{", "inst", ".", "forms", ".", "add", "(", "words", ".", "get", "(", "i", ")", ")", ";", "inst", ".", "postags", ".", "add", "(", "postags", ".", "get", "(", "i", ")", ")", ";", "}", "parser", ".", "predict", "(", "inst", ",", "heads", ",", "deprels", ")", ";", "heads", ".", "remove", "(", "0", ")", ";", "deprels", ".", "remove", "(", "0", ")", ";", "return", "heads", ".", "size", "(", ")", ";", "}" ]
分析句法 @param words 词语列表 @param postags 词性列表 @param heads 输出依存指向列表 @param deprels 输出依存名称列表 @return 节点的个数
[ "分析句法" ]
train
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/nnparser/parser_dll.java#L61-L78
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) { """ 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. """ 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", ",", "parameters", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
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
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/db/cql/CQLService.java
CQLService.executeQuery
private ResultSet executeQuery(Query query, String tableName, Object... values) { """ Execute the given query for the given table using the given values. """ m_logger.debug("Executing statement {} on table {}.{}; total params={}", new Object[]{query, m_keyspace, tableName, values.length}); try { PreparedStatement prepState = getPreparedQuery(query, tableName); BoundStatement boundState = prepState.bind(values); return m_session.execute(boundState); } catch (Exception e) { String params = "[" + Utils.concatenate(Arrays.asList(values), ",") + "]"; m_logger.error("Query failed: query={}, keyspace={}, table={}, params={}; error: {}", query, m_keyspace, tableName, params, e); throw e; } }
java
private ResultSet executeQuery(Query query, String tableName, Object... values) { m_logger.debug("Executing statement {} on table {}.{}; total params={}", new Object[]{query, m_keyspace, tableName, values.length}); try { PreparedStatement prepState = getPreparedQuery(query, tableName); BoundStatement boundState = prepState.bind(values); return m_session.execute(boundState); } catch (Exception e) { String params = "[" + Utils.concatenate(Arrays.asList(values), ",") + "]"; m_logger.error("Query failed: query={}, keyspace={}, table={}, params={}; error: {}", query, m_keyspace, tableName, params, e); throw e; } }
[ "private", "ResultSet", "executeQuery", "(", "Query", "query", ",", "String", "tableName", ",", "Object", "...", "values", ")", "{", "m_logger", ".", "debug", "(", "\"Executing statement {} on table {}.{}; total params={}\"", ",", "new", "Object", "[", "]", "{", "query", ",", "m_keyspace", ",", "tableName", ",", "values", ".", "length", "}", ")", ";", "try", "{", "PreparedStatement", "prepState", "=", "getPreparedQuery", "(", "query", ",", "tableName", ")", ";", "BoundStatement", "boundState", "=", "prepState", ".", "bind", "(", "values", ")", ";", "return", "m_session", ".", "execute", "(", "boundState", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "String", "params", "=", "\"[\"", "+", "Utils", ".", "concatenate", "(", "Arrays", ".", "asList", "(", "values", ")", ",", "\",\"", ")", "+", "\"]\"", ";", "m_logger", ".", "error", "(", "\"Query failed: query={}, keyspace={}, table={}, params={}; error: {}\"", ",", "query", ",", "m_keyspace", ",", "tableName", ",", "params", ",", "e", ")", ";", "throw", "e", ";", "}", "}" ]
Execute the given query for the given table using the given values.
[ "Execute", "the", "given", "query", "for", "the", "given", "table", "using", "the", "given", "values", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/db/cql/CQLService.java#L309-L322
jmxtrans/embedded-jmxtrans
src/main/java/org/jmxtrans/embedded/util/Preconditions.java
Preconditions.checkNotEmpty
public static String checkNotEmpty(String reference, @Nullable String message) throws IllegalArgumentException { """ Check the nullity and emptiness of the given <code>reference</code>. @param reference reference to check @param message exception message, can be <code>null</code> @return the given <code>reference</code> @throws IllegalArgumentException if the given <code>reference</code> is <code>null</code> """ if (reference == null || reference.isEmpty()) { throw new IllegalArgumentException(message == null ? "Null or empty value" : message); } return reference; }
java
public static String checkNotEmpty(String reference, @Nullable String message) throws IllegalArgumentException { if (reference == null || reference.isEmpty()) { throw new IllegalArgumentException(message == null ? "Null or empty value" : message); } return reference; }
[ "public", "static", "String", "checkNotEmpty", "(", "String", "reference", ",", "@", "Nullable", "String", "message", ")", "throws", "IllegalArgumentException", "{", "if", "(", "reference", "==", "null", "||", "reference", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "message", "==", "null", "?", "\"Null or empty value\"", ":", "message", ")", ";", "}", "return", "reference", ";", "}" ]
Check the nullity and emptiness of the given <code>reference</code>. @param reference reference to check @param message exception message, can be <code>null</code> @return the given <code>reference</code> @throws IllegalArgumentException if the given <code>reference</code> is <code>null</code>
[ "Check", "the", "nullity", "and", "emptiness", "of", "the", "given", "<code", ">", "reference<", "/", "code", ">", "." ]
train
https://github.com/jmxtrans/embedded-jmxtrans/blob/17224389e7d8323284cabc2a5167fc03bed6d223/src/main/java/org/jmxtrans/embedded/util/Preconditions.java#L82-L87
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/analyzer/RubyBundleAuditAnalyzer.java
RubyBundleAuditAnalyzer.addReferenceToVulnerability
private void addReferenceToVulnerability(String parentName, Vulnerability vulnerability, String nextLine) { """ Adds a reference to the vulnerability. @param parentName the parent name @param vulnerability the vulnerability @param nextLine the line to parse """ final String url = nextLine.substring("URL: ".length()); if (null != vulnerability) { final Reference ref = new Reference(); ref.setName(vulnerability.getName()); ref.setSource("bundle-audit"); ref.setUrl(url); vulnerability.getReferences().add(ref); } LOGGER.debug("bundle-audit ({}): {}", parentName, nextLine); }
java
private void addReferenceToVulnerability(String parentName, Vulnerability vulnerability, String nextLine) { final String url = nextLine.substring("URL: ".length()); if (null != vulnerability) { final Reference ref = new Reference(); ref.setName(vulnerability.getName()); ref.setSource("bundle-audit"); ref.setUrl(url); vulnerability.getReferences().add(ref); } LOGGER.debug("bundle-audit ({}): {}", parentName, nextLine); }
[ "private", "void", "addReferenceToVulnerability", "(", "String", "parentName", ",", "Vulnerability", "vulnerability", ",", "String", "nextLine", ")", "{", "final", "String", "url", "=", "nextLine", ".", "substring", "(", "\"URL: \"", ".", "length", "(", ")", ")", ";", "if", "(", "null", "!=", "vulnerability", ")", "{", "final", "Reference", "ref", "=", "new", "Reference", "(", ")", ";", "ref", ".", "setName", "(", "vulnerability", ".", "getName", "(", ")", ")", ";", "ref", ".", "setSource", "(", "\"bundle-audit\"", ")", ";", "ref", ".", "setUrl", "(", "url", ")", ";", "vulnerability", ".", "getReferences", "(", ")", ".", "add", "(", "ref", ")", ";", "}", "LOGGER", ".", "debug", "(", "\"bundle-audit ({}): {}\"", ",", "parentName", ",", "nextLine", ")", ";", "}" ]
Adds a reference to the vulnerability. @param parentName the parent name @param vulnerability the vulnerability @param nextLine the line to parse
[ "Adds", "a", "reference", "to", "the", "vulnerability", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/RubyBundleAuditAnalyzer.java#L398-L408
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java
ReflectUtil.invokeWithCheck
public static <T> T invokeWithCheck(Object obj, Method method, Object... args) throws UtilException { """ 执行方法<br> 执行前要检查给定参数: <pre> 1. 参数个数是否与方法参数个数一致 2. 如果某个参数为null但是方法这个位置的参数为原始类型,则赋予原始类型默认值 </pre> @param <T> 返回对象类型 @param obj 对象,如果执行静态方法,此值为<code>null</code> @param method 方法(对象方法或static方法都可) @param args 参数对象 @return 结果 @throws UtilException 一些列异常的包装 """ final Class<?>[] types = method.getParameterTypes(); if (null != types && null != args) { Assert.isTrue(args.length == types.length, "Params length [{}] is not fit for param length [{}] of method !", args.length, types.length); Class<?> type; for (int i = 0; i < args.length; i++) { type = types[i]; if (type.isPrimitive() && null == args[i]) { // 参数是原始类型,而传入参数为null时赋予默认值 args[i] = ClassUtil.getDefaultValue(type); } } } return invoke(obj, method, args); }
java
public static <T> T invokeWithCheck(Object obj, Method method, Object... args) throws UtilException { final Class<?>[] types = method.getParameterTypes(); if (null != types && null != args) { Assert.isTrue(args.length == types.length, "Params length [{}] is not fit for param length [{}] of method !", args.length, types.length); Class<?> type; for (int i = 0; i < args.length; i++) { type = types[i]; if (type.isPrimitive() && null == args[i]) { // 参数是原始类型,而传入参数为null时赋予默认值 args[i] = ClassUtil.getDefaultValue(type); } } } return invoke(obj, method, args); }
[ "public", "static", "<", "T", ">", "T", "invokeWithCheck", "(", "Object", "obj", ",", "Method", "method", ",", "Object", "...", "args", ")", "throws", "UtilException", "{", "final", "Class", "<", "?", ">", "[", "]", "types", "=", "method", ".", "getParameterTypes", "(", ")", ";", "if", "(", "null", "!=", "types", "&&", "null", "!=", "args", ")", "{", "Assert", ".", "isTrue", "(", "args", ".", "length", "==", "types", ".", "length", ",", "\"Params length [{}] is not fit for param length [{}] of method !\"", ",", "args", ".", "length", ",", "types", ".", "length", ")", ";", "Class", "<", "?", ">", "type", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "args", ".", "length", ";", "i", "++", ")", "{", "type", "=", "types", "[", "i", "]", ";", "if", "(", "type", ".", "isPrimitive", "(", ")", "&&", "null", "==", "args", "[", "i", "]", ")", "{", "// 参数是原始类型,而传入参数为null时赋予默认值\r", "args", "[", "i", "]", "=", "ClassUtil", ".", "getDefaultValue", "(", "type", ")", ";", "}", "}", "}", "return", "invoke", "(", "obj", ",", "method", ",", "args", ")", ";", "}" ]
执行方法<br> 执行前要检查给定参数: <pre> 1. 参数个数是否与方法参数个数一致 2. 如果某个参数为null但是方法这个位置的参数为原始类型,则赋予原始类型默认值 </pre> @param <T> 返回对象类型 @param obj 对象,如果执行静态方法,此值为<code>null</code> @param method 方法(对象方法或static方法都可) @param args 参数对象 @return 结果 @throws UtilException 一些列异常的包装
[ "执行方法<br", ">", "执行前要检查给定参数:" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java#L755-L770
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.vps_serviceName_ip_GET
public ArrayList<String> vps_serviceName_ip_GET(String serviceName, OvhGeolocationEnum country, Long number) throws IOException { """ Get allowed durations for 'ip' option REST: GET /order/vps/{serviceName}/ip @param number [required] Number of IPs to order @param country [required] Choose a geolocation for your IP Address @param serviceName [required] The internal name of your VPS offer """ String qPath = "/order/vps/{serviceName}/ip"; StringBuilder sb = path(qPath, serviceName); query(sb, "country", country); query(sb, "number", number); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
java
public ArrayList<String> vps_serviceName_ip_GET(String serviceName, OvhGeolocationEnum country, Long number) throws IOException { String qPath = "/order/vps/{serviceName}/ip"; StringBuilder sb = path(qPath, serviceName); query(sb, "country", country); query(sb, "number", number); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
[ "public", "ArrayList", "<", "String", ">", "vps_serviceName_ip_GET", "(", "String", "serviceName", ",", "OvhGeolocationEnum", "country", ",", "Long", "number", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/vps/{serviceName}/ip\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "query", "(", "sb", ",", "\"country\"", ",", "country", ")", ";", "query", "(", "sb", ",", "\"number\"", ",", "number", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "t1", ")", ";", "}" ]
Get allowed durations for 'ip' option REST: GET /order/vps/{serviceName}/ip @param number [required] Number of IPs to order @param country [required] Choose a geolocation for your IP Address @param serviceName [required] The internal name of your VPS offer
[ "Get", "allowed", "durations", "for", "ip", "option" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L3400-L3407
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/FaceAPIManager.java
FaceAPIManager.authenticate
public static FaceAPI authenticate(AzureRegions region, String subscriptionKey) { """ Initializes an instance of Face API client. @param region Supported Azure regions for Cognitive Services endpoints. @param subscriptionKey the Face API key @return the Face API client """ return authenticate("https://{AzureRegion}.api.cognitive.microsoft.com/face/v1.0/", subscriptionKey) .withAzureRegion(region); }
java
public static FaceAPI authenticate(AzureRegions region, String subscriptionKey) { return authenticate("https://{AzureRegion}.api.cognitive.microsoft.com/face/v1.0/", subscriptionKey) .withAzureRegion(region); }
[ "public", "static", "FaceAPI", "authenticate", "(", "AzureRegions", "region", ",", "String", "subscriptionKey", ")", "{", "return", "authenticate", "(", "\"https://{AzureRegion}.api.cognitive.microsoft.com/face/v1.0/\"", ",", "subscriptionKey", ")", ".", "withAzureRegion", "(", "region", ")", ";", "}" ]
Initializes an instance of Face API client. @param region Supported Azure regions for Cognitive Services endpoints. @param subscriptionKey the Face API key @return the Face API client
[ "Initializes", "an", "instance", "of", "Face", "API", "client", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/FaceAPIManager.java#L31-L34
aNNiMON/Lightweight-Stream-API
stream/src/main/java/com/annimon/stream/DoubleStream.java
DoubleStream.takeUntil
@NotNull public DoubleStream takeUntil(@NotNull final DoublePredicate stopPredicate) { """ Takes elements while the predicate returns {@code false}. Once predicate condition is satisfied by an element, the stream finishes with this element. <p>This is an intermediate operation. <p>Example: <pre> stopPredicate: (a) -&gt; a &gt; 2 stream: [1, 2, 3, 4, 1, 2, 3, 4] result: [1, 2, 3] </pre> @param stopPredicate the predicate used to take elements @return the new {@code DoubleStream} @since 1.1.6 """ return new DoubleStream(params, new DoubleTakeUntil(iterator, stopPredicate)); }
java
@NotNull public DoubleStream takeUntil(@NotNull final DoublePredicate stopPredicate) { return new DoubleStream(params, new DoubleTakeUntil(iterator, stopPredicate)); }
[ "@", "NotNull", "public", "DoubleStream", "takeUntil", "(", "@", "NotNull", "final", "DoublePredicate", "stopPredicate", ")", "{", "return", "new", "DoubleStream", "(", "params", ",", "new", "DoubleTakeUntil", "(", "iterator", ",", "stopPredicate", ")", ")", ";", "}" ]
Takes elements while the predicate returns {@code false}. Once predicate condition is satisfied by an element, the stream finishes with this element. <p>This is an intermediate operation. <p>Example: <pre> stopPredicate: (a) -&gt; a &gt; 2 stream: [1, 2, 3, 4, 1, 2, 3, 4] result: [1, 2, 3] </pre> @param stopPredicate the predicate used to take elements @return the new {@code DoubleStream} @since 1.1.6
[ "Takes", "elements", "while", "the", "predicate", "returns", "{", "@code", "false", "}", ".", "Once", "predicate", "condition", "is", "satisfied", "by", "an", "element", "the", "stream", "finishes", "with", "this", "element", "." ]
train
https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/DoubleStream.java#L719-L722
kopihao/peasy-recyclerview
peasy-recyclerview/src/main/java/com/kopirealm/peasyrecyclerview/PeasyRecyclerView.java
PeasyRecyclerView.onItemLongClick
public boolean onItemLongClick(final View view, final int viewType, final int position, final T item, final PeasyViewHolder viewHolder) { """ Indicate content is clicked with long tap @param view view @param viewType viewType @param position position @param item item @param viewHolder viewHolder @return true by default @see View.OnLongClickListener#onLongClick(View) Enhanced Implementation """ return true; }
java
public boolean onItemLongClick(final View view, final int viewType, final int position, final T item, final PeasyViewHolder viewHolder) { return true; }
[ "public", "boolean", "onItemLongClick", "(", "final", "View", "view", ",", "final", "int", "viewType", ",", "final", "int", "position", ",", "final", "T", "item", ",", "final", "PeasyViewHolder", "viewHolder", ")", "{", "return", "true", ";", "}" ]
Indicate content is clicked with long tap @param view view @param viewType viewType @param position position @param item item @param viewHolder viewHolder @return true by default @see View.OnLongClickListener#onLongClick(View) Enhanced Implementation
[ "Indicate", "content", "is", "clicked", "with", "long", "tap" ]
train
https://github.com/kopihao/peasy-recyclerview/blob/a26071849e5d5b5b1febe685f205558b49908f87/peasy-recyclerview/src/main/java/com/kopirealm/peasyrecyclerview/PeasyRecyclerView.java#L1076-L1078
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java
VirtualMachinesInner.beginCreateOrUpdateAsync
public Observable<VirtualMachineInner> beginCreateOrUpdateAsync(String resourceGroupName, String vmName, VirtualMachineInner parameters) { """ The operation to create or update a virtual machine. @param resourceGroupName The name of the resource group. @param vmName The name of the virtual machine. @param parameters Parameters supplied to the Create Virtual Machine operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VirtualMachineInner object """ return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, vmName, parameters).map(new Func1<ServiceResponse<VirtualMachineInner>, VirtualMachineInner>() { @Override public VirtualMachineInner call(ServiceResponse<VirtualMachineInner> response) { return response.body(); } }); }
java
public Observable<VirtualMachineInner> beginCreateOrUpdateAsync(String resourceGroupName, String vmName, VirtualMachineInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, vmName, parameters).map(new Func1<ServiceResponse<VirtualMachineInner>, VirtualMachineInner>() { @Override public VirtualMachineInner call(ServiceResponse<VirtualMachineInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VirtualMachineInner", ">", "beginCreateOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "vmName", ",", "VirtualMachineInner", "parameters", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "vmName", ",", "parameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "VirtualMachineInner", ">", ",", "VirtualMachineInner", ">", "(", ")", "{", "@", "Override", "public", "VirtualMachineInner", "call", "(", "ServiceResponse", "<", "VirtualMachineInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
The operation to create or update a virtual machine. @param resourceGroupName The name of the resource group. @param vmName The name of the virtual machine. @param parameters Parameters supplied to the Create Virtual Machine operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VirtualMachineInner object
[ "The", "operation", "to", "create", "or", "update", "a", "virtual", "machine", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java#L654-L661
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) { """ Decorates a node with the affected operator, if any. @param context @param tree @param operations @return """ 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", ")", ";", "Collection", "<", "NodePainter", ">", "painters", "=", "new", "ArrayList", "<", "NodePainter", ">", "(", ")", ";", "painters", ".", "add", "(", "opNodePainter", ")", ";", "return", "getJSONwithCustorLabels", "(", "context", ",", "tree", ",", "painters", ")", ";", "}" ]
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
glyptodon/guacamole-client
guacamole-ext/src/main/java/org/apache/guacamole/token/TokenFilter.java
TokenFilter.setTokens
public void setTokens(Map<String, String> tokens) { """ Replaces all current token values with the contents of the given map, where each map key represents a token name, and each map value represents a token value. @param tokens A map containing the token names and corresponding values to assign. """ tokenValues.clear(); tokenValues.putAll(tokens); }
java
public void setTokens(Map<String, String> tokens) { tokenValues.clear(); tokenValues.putAll(tokens); }
[ "public", "void", "setTokens", "(", "Map", "<", "String", ",", "String", ">", "tokens", ")", "{", "tokenValues", ".", "clear", "(", ")", ";", "tokenValues", ".", "putAll", "(", "tokens", ")", ";", "}" ]
Replaces all current token values with the contents of the given map, where each map key represents a token name, and each map value represents a token value. @param tokens A map containing the token names and corresponding values to assign.
[ "Replaces", "all", "current", "token", "values", "with", "the", "contents", "of", "the", "given", "map", "where", "each", "map", "key", "represents", "a", "token", "name", "and", "each", "map", "value", "represents", "a", "token", "value", "." ]
train
https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/guacamole-ext/src/main/java/org/apache/guacamole/token/TokenFilter.java#L155-L158
heroku/heroku.jar
heroku-api/src/main/java/com/heroku/api/HerokuAPI.java
HerokuAPI.createBuild
public Build createBuild(String appName, Build build) { """ Creates a build @param appName See {@link #listApps} for a list of apps that can be used. @param build the build information """ return connection.execute(new BuildCreate(appName, build), apiKey); }
java
public Build createBuild(String appName, Build build) { return connection.execute(new BuildCreate(appName, build), apiKey); }
[ "public", "Build", "createBuild", "(", "String", "appName", ",", "Build", "build", ")", "{", "return", "connection", ".", "execute", "(", "new", "BuildCreate", "(", "appName", ",", "build", ")", ",", "apiKey", ")", ";", "}" ]
Creates a build @param appName See {@link #listApps} for a list of apps that can be used. @param build the build information
[ "Creates", "a", "build" ]
train
https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L441-L443
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtend2/lib/StringConcatenation.java
StringConcatenation.appendSegments
protected void appendSegments(int index, List<String> otherSegments) { """ Add the list of segments to this sequence at the given index. The given indentation will be prepended to each line except the first one if the object has a multi-line string representation. @param index the index in this instance's list of segments. @param otherSegments the to-be-appended segments. May not be <code>null</code>. @since 2.5 """ growSegments(otherSegments.size()); if (segments.addAll(index, otherSegments)) { cachedToString = null; } }
java
protected void appendSegments(int index, List<String> otherSegments) { growSegments(otherSegments.size()); if (segments.addAll(index, otherSegments)) { cachedToString = null; } }
[ "protected", "void", "appendSegments", "(", "int", "index", ",", "List", "<", "String", ">", "otherSegments", ")", "{", "growSegments", "(", "otherSegments", ".", "size", "(", ")", ")", ";", "if", "(", "segments", ".", "addAll", "(", "index", ",", "otherSegments", ")", ")", "{", "cachedToString", "=", "null", ";", "}", "}" ]
Add the list of segments to this sequence at the given index. The given indentation will be prepended to each line except the first one if the object has a multi-line string representation. @param index the index in this instance's list of segments. @param otherSegments the to-be-appended segments. May not be <code>null</code>. @since 2.5
[ "Add", "the", "list", "of", "segments", "to", "this", "sequence", "at", "the", "given", "index", ".", "The", "given", "indentation", "will", "be", "prepended", "to", "each", "line", "except", "the", "first", "one", "if", "the", "object", "has", "a", "multi", "-", "line", "string", "representation", "." ]
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtend2/lib/StringConcatenation.java#L435-L440
UrielCh/ovh-java-sdk
ovh-java-sdk-service/src/main/java/net/minidev/ovh/api/ApiOvhService.java
ApiOvhService.serviceId_GET
public OvhService serviceId_GET(Long serviceId) throws IOException { """ Get this object properties REST: GET /service/{serviceId} @param serviceId [required] The internal ID of your service API beta """ String qPath = "/service/{serviceId}"; StringBuilder sb = path(qPath, serviceId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhService.class); }
java
public OvhService serviceId_GET(Long serviceId) throws IOException { String qPath = "/service/{serviceId}"; StringBuilder sb = path(qPath, serviceId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhService.class); }
[ "public", "OvhService", "serviceId_GET", "(", "Long", "serviceId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/service/{serviceId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceId", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhService", ".", "class", ")", ";", "}" ]
Get this object properties REST: GET /service/{serviceId} @param serviceId [required] The internal ID of your service API beta
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-service/src/main/java/net/minidev/ovh/api/ApiOvhService.java#L60-L65
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/locale/ResourceBundleMessagesGenerator.java
ResourceBundleMessagesGenerator.addLinkedResources
protected void addLinkedResources(String path, GeneratorContext context) { """ Adds the linked resources @param path the resource path @param context the generator context """ List<Locale> locales = new ArrayList<>(); Locale currentLocale = context.getLocale(); if (currentLocale != null) { locales.add(currentLocale); if (StringUtils.isNotEmpty(currentLocale.getVariant())) { locales.add(new Locale(currentLocale.getCountry(), currentLocale.getLanguage())); } if (StringUtils.isNotEmpty(currentLocale.getLanguage())) { locales.add(new Locale(currentLocale.getCountry())); } } // Adds fallback locale locales.add(control.getFallbackLocale()); Locale baseLocale = new Locale("", ""); if (!locales.contains(baseLocale)) { locales.add(baseLocale); } List<FilePathMapping> fMappings = getFileMappings(path, context, locales); addLinkedResources(path, context, fMappings); }
java
protected void addLinkedResources(String path, GeneratorContext context) { List<Locale> locales = new ArrayList<>(); Locale currentLocale = context.getLocale(); if (currentLocale != null) { locales.add(currentLocale); if (StringUtils.isNotEmpty(currentLocale.getVariant())) { locales.add(new Locale(currentLocale.getCountry(), currentLocale.getLanguage())); } if (StringUtils.isNotEmpty(currentLocale.getLanguage())) { locales.add(new Locale(currentLocale.getCountry())); } } // Adds fallback locale locales.add(control.getFallbackLocale()); Locale baseLocale = new Locale("", ""); if (!locales.contains(baseLocale)) { locales.add(baseLocale); } List<FilePathMapping> fMappings = getFileMappings(path, context, locales); addLinkedResources(path, context, fMappings); }
[ "protected", "void", "addLinkedResources", "(", "String", "path", ",", "GeneratorContext", "context", ")", "{", "List", "<", "Locale", ">", "locales", "=", "new", "ArrayList", "<>", "(", ")", ";", "Locale", "currentLocale", "=", "context", ".", "getLocale", "(", ")", ";", "if", "(", "currentLocale", "!=", "null", ")", "{", "locales", ".", "add", "(", "currentLocale", ")", ";", "if", "(", "StringUtils", ".", "isNotEmpty", "(", "currentLocale", ".", "getVariant", "(", ")", ")", ")", "{", "locales", ".", "add", "(", "new", "Locale", "(", "currentLocale", ".", "getCountry", "(", ")", ",", "currentLocale", ".", "getLanguage", "(", ")", ")", ")", ";", "}", "if", "(", "StringUtils", ".", "isNotEmpty", "(", "currentLocale", ".", "getLanguage", "(", ")", ")", ")", "{", "locales", ".", "add", "(", "new", "Locale", "(", "currentLocale", ".", "getCountry", "(", ")", ")", ")", ";", "}", "}", "// Adds fallback locale", "locales", ".", "add", "(", "control", ".", "getFallbackLocale", "(", ")", ")", ";", "Locale", "baseLocale", "=", "new", "Locale", "(", "\"\"", ",", "\"\"", ")", ";", "if", "(", "!", "locales", ".", "contains", "(", "baseLocale", ")", ")", "{", "locales", ".", "add", "(", "baseLocale", ")", ";", "}", "List", "<", "FilePathMapping", ">", "fMappings", "=", "getFileMappings", "(", "path", ",", "context", ",", "locales", ")", ";", "addLinkedResources", "(", "path", ",", "context", ",", "fMappings", ")", ";", "}" ]
Adds the linked resources @param path the resource path @param context the generator context
[ "Adds", "the", "linked", "resources" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/locale/ResourceBundleMessagesGenerator.java#L172-L195
imsweb/naaccr-xml
src/main/java/com/imsweb/naaccrxml/runtime/NaaccrStreamConfiguration.java
NaaccrStreamConfiguration.registerImplicitCollection
public void registerImplicitCollection(Class<?> clazz, String fieldName, Class<?> fieldClass) { """ Register an implicit collection (a collection that shouldn't appear as a tag in the XML). @param clazz class containing the field (the collection in this case), required @param fieldName field name, required @param fieldClass field type, required """ _xstream.addImplicitCollection(clazz, fieldName, fieldClass); }
java
public void registerImplicitCollection(Class<?> clazz, String fieldName, Class<?> fieldClass) { _xstream.addImplicitCollection(clazz, fieldName, fieldClass); }
[ "public", "void", "registerImplicitCollection", "(", "Class", "<", "?", ">", "clazz", ",", "String", "fieldName", ",", "Class", "<", "?", ">", "fieldClass", ")", "{", "_xstream", ".", "addImplicitCollection", "(", "clazz", ",", "fieldName", ",", "fieldClass", ")", ";", "}" ]
Register an implicit collection (a collection that shouldn't appear as a tag in the XML). @param clazz class containing the field (the collection in this case), required @param fieldName field name, required @param fieldClass field type, required
[ "Register", "an", "implicit", "collection", "(", "a", "collection", "that", "shouldn", "t", "appear", "as", "a", "tag", "in", "the", "XML", ")", "." ]
train
https://github.com/imsweb/naaccr-xml/blob/a3a501faa2a0c3411dd5248b2c1379f279131696/src/main/java/com/imsweb/naaccrxml/runtime/NaaccrStreamConfiguration.java#L301-L303
terrestris/shogun-core
src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/naming/PhysicalNamingStrategyShogunCore.java
PhysicalNamingStrategyShogunCore.toPhysicalColumnName
@Override public Identifier toPhysicalColumnName(Identifier columnIdentifier, JdbcEnvironment context) { """ Converts column names to lower case and limits the length if necessary. """ return convertToLimitedLowerCase(context, columnIdentifier, null); }
java
@Override public Identifier toPhysicalColumnName(Identifier columnIdentifier, JdbcEnvironment context) { return convertToLimitedLowerCase(context, columnIdentifier, null); }
[ "@", "Override", "public", "Identifier", "toPhysicalColumnName", "(", "Identifier", "columnIdentifier", ",", "JdbcEnvironment", "context", ")", "{", "return", "convertToLimitedLowerCase", "(", "context", ",", "columnIdentifier", ",", "null", ")", ";", "}" ]
Converts column names to lower case and limits the length if necessary.
[ "Converts", "column", "names", "to", "lower", "case", "and", "limits", "the", "length", "if", "necessary", "." ]
train
https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/naming/PhysicalNamingStrategyShogunCore.java#L56-L59
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/jvmmodel/JvmTypesBuilder.java
JvmTypesBuilder.setFileHeader
public void setFileHeader(/* @Nullable */ JvmDeclaredType jvmDeclaredType, /* @Nullable */ String headerText) { """ Attaches the given headText to the given {@link JvmDeclaredType}. """ if (jvmDeclaredType == null || headerText == null) { return; } FileHeaderAdapter fileHeaderAdapter = (FileHeaderAdapter) EcoreUtil.getAdapter(jvmDeclaredType.eAdapters(), FileHeaderAdapter.class); if (fileHeaderAdapter == null) { fileHeaderAdapter = new FileHeaderAdapter(); jvmDeclaredType.eAdapters().add(fileHeaderAdapter); } fileHeaderAdapter.setHeaderText(headerText); }
java
public void setFileHeader(/* @Nullable */ JvmDeclaredType jvmDeclaredType, /* @Nullable */ String headerText) { if (jvmDeclaredType == null || headerText == null) { return; } FileHeaderAdapter fileHeaderAdapter = (FileHeaderAdapter) EcoreUtil.getAdapter(jvmDeclaredType.eAdapters(), FileHeaderAdapter.class); if (fileHeaderAdapter == null) { fileHeaderAdapter = new FileHeaderAdapter(); jvmDeclaredType.eAdapters().add(fileHeaderAdapter); } fileHeaderAdapter.setHeaderText(headerText); }
[ "public", "void", "setFileHeader", "(", "/* @Nullable */", "JvmDeclaredType", "jvmDeclaredType", ",", "/* @Nullable */", "String", "headerText", ")", "{", "if", "(", "jvmDeclaredType", "==", "null", "||", "headerText", "==", "null", ")", "{", "return", ";", "}", "FileHeaderAdapter", "fileHeaderAdapter", "=", "(", "FileHeaderAdapter", ")", "EcoreUtil", ".", "getAdapter", "(", "jvmDeclaredType", ".", "eAdapters", "(", ")", ",", "FileHeaderAdapter", ".", "class", ")", ";", "if", "(", "fileHeaderAdapter", "==", "null", ")", "{", "fileHeaderAdapter", "=", "new", "FileHeaderAdapter", "(", ")", ";", "jvmDeclaredType", ".", "eAdapters", "(", ")", ".", "add", "(", "fileHeaderAdapter", ")", ";", "}", "fileHeaderAdapter", ".", "setHeaderText", "(", "headerText", ")", ";", "}" ]
Attaches the given headText to the given {@link JvmDeclaredType}.
[ "Attaches", "the", "given", "headText", "to", "the", "given", "{" ]
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/jvmmodel/JvmTypesBuilder.java#L305-L316
LGoodDatePicker/LGoodDatePicker
Project/src/main/java/com/github/lgooddatepicker/optionalusertools/PickerUtilities.java
PickerUtilities.isSameLocalDate
static public boolean isSameLocalDate(LocalDate first, LocalDate second) { """ isSameLocalDate, This compares two date variables to see if their values are equal. Returns true if the values are equal, otherwise returns false. More specifically: This returns true if both values are null (an empty date). Or, this returns true if both of the supplied dates contain a date and represent the same date. Otherwise this returns false. """ // If both values are null, return true. if (first == null && second == null) { return true; } // At least one value contains a date. If the other value is null, then return false. if (first == null || second == null) { return false; } // Both values contain dates. Return true if the dates are equal, otherwise return false. return first.isEqual(second); }
java
static public boolean isSameLocalDate(LocalDate first, LocalDate second) { // If both values are null, return true. if (first == null && second == null) { return true; } // At least one value contains a date. If the other value is null, then return false. if (first == null || second == null) { return false; } // Both values contain dates. Return true if the dates are equal, otherwise return false. return first.isEqual(second); }
[ "static", "public", "boolean", "isSameLocalDate", "(", "LocalDate", "first", ",", "LocalDate", "second", ")", "{", "// If both values are null, return true.", "if", "(", "first", "==", "null", "&&", "second", "==", "null", ")", "{", "return", "true", ";", "}", "// At least one value contains a date. If the other value is null, then return false.", "if", "(", "first", "==", "null", "||", "second", "==", "null", ")", "{", "return", "false", ";", "}", "// Both values contain dates. Return true if the dates are equal, otherwise return false.", "return", "first", ".", "isEqual", "(", "second", ")", ";", "}" ]
isSameLocalDate, This compares two date variables to see if their values are equal. Returns true if the values are equal, otherwise returns false. More specifically: This returns true if both values are null (an empty date). Or, this returns true if both of the supplied dates contain a date and represent the same date. Otherwise this returns false.
[ "isSameLocalDate", "This", "compares", "two", "date", "variables", "to", "see", "if", "their", "values", "are", "equal", ".", "Returns", "true", "if", "the", "values", "are", "equal", "otherwise", "returns", "false", "." ]
train
https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/github/lgooddatepicker/optionalusertools/PickerUtilities.java#L78-L89
ZuInnoTe/hadoopcryptoledger
hiveudf/src/main/java/org/zuinnote/hadoop/bitcoin/hive/udf/BitcoinTransactionHashUDF.java
BitcoinTransactionHashUDF.readListOfInputsFromTable
private List<BitcoinTransactionInput> readListOfInputsFromTable(ListObjectInspector loi, Object listOfInputsObject) { """ 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 """ 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", "<", "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", ";", "}" ]
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
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java
FileUtil.writeString
public static File writeString(String content, File file, String charset) throws IORuntimeException { """ 将String写入文件,覆盖模式 @param content 写入的内容 @param file 文件 @param charset 字符集 @return 被写入的文件 @throws IORuntimeException IO异常 """ return FileWriter.create(file, CharsetUtil.charset(charset)).write(content); }
java
public static File writeString(String content, File file, String charset) throws IORuntimeException { return FileWriter.create(file, CharsetUtil.charset(charset)).write(content); }
[ "public", "static", "File", "writeString", "(", "String", "content", ",", "File", "file", ",", "String", "charset", ")", "throws", "IORuntimeException", "{", "return", "FileWriter", ".", "create", "(", "file", ",", "CharsetUtil", ".", "charset", "(", "charset", ")", ")", ".", "write", "(", "content", ")", ";", "}" ]
将String写入文件,覆盖模式 @param content 写入的内容 @param file 文件 @param charset 字符集 @return 被写入的文件 @throws IORuntimeException IO异常
[ "将String写入文件,覆盖模式" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2747-L2749
powermock/powermock
powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java
PowerMock.createPartialMockForAllMethodsExcept
public static synchronized <T> T createPartialMockForAllMethodsExcept(Class<T> type, String methodNameToExclude, Class<?> firstArgumentType, Class<?>... moreTypes) { """ Mock all methods of a class except for a specific one. Use this method only if you have several overloaded methods. @param <T> The type of the mock. @param type The type that'll be used to create a mock instance. @param methodNameToExclude The name of the method not to mock. @param firstArgumentType The type of the first parameter of the method not to mock @param moreTypes Optionally more parameter types that defines the method. Note that this is only needed to separate overloaded methods. @return A mock object of type <T>. """ /* * The reason why we've split the first and "additional types" is * because it should not intervene with the mockAllExcept(type, * String...methodNames) method. */ final Class<?>[] argumentTypes = mergeArgumentTypes(firstArgumentType, moreTypes); return createMock(type, WhiteboxImpl.getAllMethodsExcept(type, methodNameToExclude, argumentTypes)); }
java
public static synchronized <T> T createPartialMockForAllMethodsExcept(Class<T> type, String methodNameToExclude, Class<?> firstArgumentType, Class<?>... moreTypes) { /* * The reason why we've split the first and "additional types" is * because it should not intervene with the mockAllExcept(type, * String...methodNames) method. */ final Class<?>[] argumentTypes = mergeArgumentTypes(firstArgumentType, moreTypes); return createMock(type, WhiteboxImpl.getAllMethodsExcept(type, methodNameToExclude, argumentTypes)); }
[ "public", "static", "synchronized", "<", "T", ">", "T", "createPartialMockForAllMethodsExcept", "(", "Class", "<", "T", ">", "type", ",", "String", "methodNameToExclude", ",", "Class", "<", "?", ">", "firstArgumentType", ",", "Class", "<", "?", ">", "...", "moreTypes", ")", "{", "/*\n * The reason why we've split the first and \"additional types\" is\n * because it should not intervene with the mockAllExcept(type,\n * String...methodNames) method.\n */", "final", "Class", "<", "?", ">", "[", "]", "argumentTypes", "=", "mergeArgumentTypes", "(", "firstArgumentType", ",", "moreTypes", ")", ";", "return", "createMock", "(", "type", ",", "WhiteboxImpl", ".", "getAllMethodsExcept", "(", "type", ",", "methodNameToExclude", ",", "argumentTypes", ")", ")", ";", "}" ]
Mock all methods of a class except for a specific one. Use this method only if you have several overloaded methods. @param <T> The type of the mock. @param type The type that'll be used to create a mock instance. @param methodNameToExclude The name of the method not to mock. @param firstArgumentType The type of the first parameter of the method not to mock @param moreTypes Optionally more parameter types that defines the method. Note that this is only needed to separate overloaded methods. @return A mock object of type <T>.
[ "Mock", "all", "methods", "of", "a", "class", "except", "for", "a", "specific", "one", ".", "Use", "this", "method", "only", "if", "you", "have", "several", "overloaded", "methods", "." ]
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java#L396-L406
infinispan/infinispan
server/core/src/main/java/org/infinispan/server/core/security/simple/SimpleServerAuthenticationProvider.java
SimpleServerAuthenticationProvider.addUser
public void addUser(String userName, String userRealm, char[] password, String... groups) { """ Add a user to the authentication table. @param userName the user name @param userRealm the user realm @param password the password @param groups the groups the user belongs to """ if (userName == null) { throw new IllegalArgumentException("userName is null"); } if (userRealm == null) { throw new IllegalArgumentException("userRealm is null"); } if (password == null) { throw new IllegalArgumentException("password is null"); } final String canonUserRealm = userRealm.toLowerCase().trim(); final String canonUserName = userName.toLowerCase().trim(); synchronized (map) { Map<String, Entry> realmMap = map.get(canonUserRealm); if (realmMap == null) { realmMap = new HashMap<String, Entry>(); map.put(canonUserRealm, realmMap); } realmMap.put(canonUserName, new Entry(canonUserName, canonUserRealm, password, groups != null ? groups : new String[0])); } }
java
public void addUser(String userName, String userRealm, char[] password, String... groups) { if (userName == null) { throw new IllegalArgumentException("userName is null"); } if (userRealm == null) { throw new IllegalArgumentException("userRealm is null"); } if (password == null) { throw new IllegalArgumentException("password is null"); } final String canonUserRealm = userRealm.toLowerCase().trim(); final String canonUserName = userName.toLowerCase().trim(); synchronized (map) { Map<String, Entry> realmMap = map.get(canonUserRealm); if (realmMap == null) { realmMap = new HashMap<String, Entry>(); map.put(canonUserRealm, realmMap); } realmMap.put(canonUserName, new Entry(canonUserName, canonUserRealm, password, groups != null ? groups : new String[0])); } }
[ "public", "void", "addUser", "(", "String", "userName", ",", "String", "userRealm", ",", "char", "[", "]", "password", ",", "String", "...", "groups", ")", "{", "if", "(", "userName", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"userName is null\"", ")", ";", "}", "if", "(", "userRealm", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"userRealm is null\"", ")", ";", "}", "if", "(", "password", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"password is null\"", ")", ";", "}", "final", "String", "canonUserRealm", "=", "userRealm", ".", "toLowerCase", "(", ")", ".", "trim", "(", ")", ";", "final", "String", "canonUserName", "=", "userName", ".", "toLowerCase", "(", ")", ".", "trim", "(", ")", ";", "synchronized", "(", "map", ")", "{", "Map", "<", "String", ",", "Entry", ">", "realmMap", "=", "map", ".", "get", "(", "canonUserRealm", ")", ";", "if", "(", "realmMap", "==", "null", ")", "{", "realmMap", "=", "new", "HashMap", "<", "String", ",", "Entry", ">", "(", ")", ";", "map", ".", "put", "(", "canonUserRealm", ",", "realmMap", ")", ";", "}", "realmMap", ".", "put", "(", "canonUserName", ",", "new", "Entry", "(", "canonUserName", ",", "canonUserRealm", ",", "password", ",", "groups", "!=", "null", "?", "groups", ":", "new", "String", "[", "0", "]", ")", ")", ";", "}", "}" ]
Add a user to the authentication table. @param userName the user name @param userRealm the user realm @param password the password @param groups the groups the user belongs to
[ "Add", "a", "user", "to", "the", "authentication", "table", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/core/src/main/java/org/infinispan/server/core/security/simple/SimpleServerAuthenticationProvider.java#L126-L146
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageBandMath.java
ImageBandMath.stdDev
public static void stdDev(Planar<GrayU16> input, GrayU16 output, @Nullable GrayU16 avg) { """ Computes the standard deviation for each pixel across all bands in the {@link Planar} image. @param input Planar image - not modified @param output Gray scale image containing average pixel values - modified @param avg Input Gray scale image containing average image. Can be null """ stdDev(input,output,avg,0,input.getNumBands() - 1); }
java
public static void stdDev(Planar<GrayU16> input, GrayU16 output, @Nullable GrayU16 avg) { stdDev(input,output,avg,0,input.getNumBands() - 1); }
[ "public", "static", "void", "stdDev", "(", "Planar", "<", "GrayU16", ">", "input", ",", "GrayU16", "output", ",", "@", "Nullable", "GrayU16", "avg", ")", "{", "stdDev", "(", "input", ",", "output", ",", "avg", ",", "0", ",", "input", ".", "getNumBands", "(", ")", "-", "1", ")", ";", "}" ]
Computes the standard deviation for each pixel across all bands in the {@link Planar} image. @param input Planar image - not modified @param output Gray scale image containing average pixel values - modified @param avg Input Gray scale image containing average image. Can be null
[ "Computes", "the", "standard", "deviation", "for", "each", "pixel", "across", "all", "bands", "in", "the", "{" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageBandMath.java#L527-L529
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/MapIterate.java
MapIterate.getIfAbsent
public static <K, V> V getIfAbsent(Map<K, V> map, K key, Function0<? extends V> instanceBlock) { """ Get and return the value in the Map that corresponds to the specified key, or if there is no value at the key, return the result of evaluating the specified {@link Function0}. """ if (map instanceof UnsortedMapIterable) { return ((MapIterable<K, V>) map).getIfAbsent(key, instanceBlock); } V result = map.get(key); if (MapIterate.isAbsent(result, map, key)) { result = instanceBlock.value(); } return result; }
java
public static <K, V> V getIfAbsent(Map<K, V> map, K key, Function0<? extends V> instanceBlock) { if (map instanceof UnsortedMapIterable) { return ((MapIterable<K, V>) map).getIfAbsent(key, instanceBlock); } V result = map.get(key); if (MapIterate.isAbsent(result, map, key)) { result = instanceBlock.value(); } return result; }
[ "public", "static", "<", "K", ",", "V", ">", "V", "getIfAbsent", "(", "Map", "<", "K", ",", "V", ">", "map", ",", "K", "key", ",", "Function0", "<", "?", "extends", "V", ">", "instanceBlock", ")", "{", "if", "(", "map", "instanceof", "UnsortedMapIterable", ")", "{", "return", "(", "(", "MapIterable", "<", "K", ",", "V", ">", ")", "map", ")", ".", "getIfAbsent", "(", "key", ",", "instanceBlock", ")", ";", "}", "V", "result", "=", "map", ".", "get", "(", "key", ")", ";", "if", "(", "MapIterate", ".", "isAbsent", "(", "result", ",", "map", ",", "key", ")", ")", "{", "result", "=", "instanceBlock", ".", "value", "(", ")", ";", "}", "return", "result", ";", "}" ]
Get and return the value in the Map that corresponds to the specified key, or if there is no value at the key, return the result of evaluating the specified {@link Function0}.
[ "Get", "and", "return", "the", "value", "in", "the", "Map", "that", "corresponds", "to", "the", "specified", "key", "or", "if", "there", "is", "no", "value", "at", "the", "key", "return", "the", "result", "of", "evaluating", "the", "specified", "{" ]
train
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/MapIterate.java#L176-L188
qmx/jitescript
src/main/java/me/qmx/jitescript/JiteClass.java
JiteClass.defineField
public FieldDefinition defineField(String fieldName, int modifiers, String signature, Object value) { """ Defines a new field on the target class @param fieldName the field name @param modifiers the modifier bitmask, made by OR'ing constants from ASM's {@link Opcodes} interface @param signature the field signature, on standard JVM notation @param value the default value (null for JVM default) @return the new field definition for further modification """ FieldDefinition field = new FieldDefinition(fieldName, modifiers, signature, value); this.fields.add(field); return field; }
java
public FieldDefinition defineField(String fieldName, int modifiers, String signature, Object value) { FieldDefinition field = new FieldDefinition(fieldName, modifiers, signature, value); this.fields.add(field); return field; }
[ "public", "FieldDefinition", "defineField", "(", "String", "fieldName", ",", "int", "modifiers", ",", "String", "signature", ",", "Object", "value", ")", "{", "FieldDefinition", "field", "=", "new", "FieldDefinition", "(", "fieldName", ",", "modifiers", ",", "signature", ",", "value", ")", ";", "this", ".", "fields", ".", "add", "(", "field", ")", ";", "return", "field", ";", "}" ]
Defines a new field on the target class @param fieldName the field name @param modifiers the modifier bitmask, made by OR'ing constants from ASM's {@link Opcodes} interface @param signature the field signature, on standard JVM notation @param value the default value (null for JVM default) @return the new field definition for further modification
[ "Defines", "a", "new", "field", "on", "the", "target", "class" ]
train
https://github.com/qmx/jitescript/blob/bda6d02f37a8083248d9a0c80ea76bb5a63151ae/src/main/java/me/qmx/jitescript/JiteClass.java#L155-L159
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.listDomainApp
public ListDomainAppResponse listDomainApp(ListDomainAppRequest request) { """ List a domain's app in the live stream service. @param request The request object containing all options for listing domain's app @return the response """ checkNotNull(request, "The parameter request should NOT be null."); checkStringNotEmpty(request.getPlayDomain(), "playDomain should NOT be empty."); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, LIVE_DOMAIN, request.getPlayDomain(), LIVE_APP); return invokeHttpClient(internalRequest, ListDomainAppResponse.class); }
java
public ListDomainAppResponse listDomainApp(ListDomainAppRequest request) { checkNotNull(request, "The parameter request should NOT be null."); checkStringNotEmpty(request.getPlayDomain(), "playDomain should NOT be empty."); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, LIVE_DOMAIN, request.getPlayDomain(), LIVE_APP); return invokeHttpClient(internalRequest, ListDomainAppResponse.class); }
[ "public", "ListDomainAppResponse", "listDomainApp", "(", "ListDomainAppRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"The parameter request should NOT be null.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getPlayDomain", "(", ")", ",", "\"playDomain should NOT be empty.\"", ")", ";", "InternalRequest", "internalRequest", "=", "createRequest", "(", "HttpMethodName", ".", "GET", ",", "request", ",", "LIVE_DOMAIN", ",", "request", ".", "getPlayDomain", "(", ")", ",", "LIVE_APP", ")", ";", "return", "invokeHttpClient", "(", "internalRequest", ",", "ListDomainAppResponse", ".", "class", ")", ";", "}" ]
List a domain's app in the live stream service. @param request The request object containing all options for listing domain's app @return the response
[ "List", "a", "domain", "s", "app", "in", "the", "live", "stream", "service", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1435-L1443
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java
VirtualNetworkGatewaysInner.beginReset
public VirtualNetworkGatewayInner beginReset(String resourceGroupName, String virtualNetworkGatewayName, String gatewayVip) { """ Resets the primary of the virtual network gateway in the specified resource group. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayName The name of the virtual network gateway. @param gatewayVip Virtual network gateway vip address supplied to the begin reset of the active-active feature enabled gateway. @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 VirtualNetworkGatewayInner object if successful. """ return beginResetWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName, gatewayVip).toBlocking().single().body(); }
java
public VirtualNetworkGatewayInner beginReset(String resourceGroupName, String virtualNetworkGatewayName, String gatewayVip) { return beginResetWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName, gatewayVip).toBlocking().single().body(); }
[ "public", "VirtualNetworkGatewayInner", "beginReset", "(", "String", "resourceGroupName", ",", "String", "virtualNetworkGatewayName", ",", "String", "gatewayVip", ")", "{", "return", "beginResetWithServiceResponseAsync", "(", "resourceGroupName", ",", "virtualNetworkGatewayName", ",", "gatewayVip", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Resets the primary of the virtual network gateway in the specified resource group. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayName The name of the virtual network gateway. @param gatewayVip Virtual network gateway vip address supplied to the begin reset of the active-active feature enabled gateway. @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 VirtualNetworkGatewayInner object if successful.
[ "Resets", "the", "primary", "of", "the", "virtual", "network", "gateway", "in", "the", "specified", "resource", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java#L1376-L1378
podio/podio-java
src/main/java/com/podio/hook/HookAPI.java
HookAPI.validateVerification
public void validateVerification(int id, String code) { """ Validates the hook using the code received from the verify call. On successful validation the hook will become active. @param id The id of the hook to be verified @param code The code received from the call to the endpoint """ getResourceFactory().getApiResource("/hook/" + id + "/verify/validate") .entity(new HookValidate(code), MediaType.APPLICATION_JSON) .post(); }
java
public void validateVerification(int id, String code) { getResourceFactory().getApiResource("/hook/" + id + "/verify/validate") .entity(new HookValidate(code), MediaType.APPLICATION_JSON) .post(); }
[ "public", "void", "validateVerification", "(", "int", "id", ",", "String", "code", ")", "{", "getResourceFactory", "(", ")", ".", "getApiResource", "(", "\"/hook/\"", "+", "id", "+", "\"/verify/validate\"", ")", ".", "entity", "(", "new", "HookValidate", "(", "code", ")", ",", "MediaType", ".", "APPLICATION_JSON", ")", ".", "post", "(", ")", ";", "}" ]
Validates the hook using the code received from the verify call. On successful validation the hook will become active. @param id The id of the hook to be verified @param code The code received from the call to the endpoint
[ "Validates", "the", "hook", "using", "the", "code", "received", "from", "the", "verify", "call", ".", "On", "successful", "validation", "the", "hook", "will", "become", "active", "." ]
train
https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/hook/HookAPI.java#L85-L89
brianwhu/xillium
data/src/main/java/org/xillium/data/DataBinder.java
DataBinder.putNamedObject
@SuppressWarnings("unchecked") public <T, V> T putNamedObject(String name, V object) { """ Puts a named object into this binder returning the original object under the name, if any. """ 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
LGoodDatePicker/LGoodDatePicker
Project/src/main/java/com/privatejgoodies/forms/layout/FormLayout.java
FormLayout.setRowSpec
public void setRowSpec(int rowIndex, RowSpec rowSpec) { """ Sets the RowSpec at the specified row index. @param rowIndex the index of the row to be changed @param rowSpec the RowSpec to be set @throws NullPointerException if {@code rowSpec} is {@code null} @throws IndexOutOfBoundsException if the row index is out of range """ checkNotNull(rowSpec, "The row spec must not be null."); rowSpecs.set(rowIndex - 1, rowSpec); }
java
public void setRowSpec(int rowIndex, RowSpec rowSpec) { checkNotNull(rowSpec, "The row spec must not be null."); rowSpecs.set(rowIndex - 1, rowSpec); }
[ "public", "void", "setRowSpec", "(", "int", "rowIndex", ",", "RowSpec", "rowSpec", ")", "{", "checkNotNull", "(", "rowSpec", ",", "\"The row spec must not be null.\"", ")", ";", "rowSpecs", ".", "set", "(", "rowIndex", "-", "1", ",", "rowSpec", ")", ";", "}" ]
Sets the RowSpec at the specified row index. @param rowIndex the index of the row to be changed @param rowSpec the RowSpec to be set @throws NullPointerException if {@code rowSpec} is {@code null} @throws IndexOutOfBoundsException if the row index is out of range
[ "Sets", "the", "RowSpec", "at", "the", "specified", "row", "index", "." ]
train
https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/privatejgoodies/forms/layout/FormLayout.java#L566-L569
js-lib-com/commons
src/main/java/js/util/Classes.java
Classes.getResourceAsStream
private static InputStream getResourceAsStream(String name, ClassLoader[] classLoaders) { """ Get named resource input stream from a list of class loaders. Traverses class loaders in given order searching for requested resource. Return first resource found or null if none found. @param name resource name with syntax as required by Java ClassLoader, @param classLoaders target class loaders. @return found resource as input stream or null. """ // Java standard class loader require resource name to be an absolute path without leading path separator // at this point <name> argument is guaranteed to not start with leading path separator for(ClassLoader classLoader : classLoaders) { InputStream stream = classLoader.getResourceAsStream(name); if(stream == null) { // it seems there are class loaders that require leading path separator // not confirmed rumor but found in similar libraries stream = classLoader.getResourceAsStream('/' + name); } if(stream != null) { return stream; } } return null; }
java
private static InputStream getResourceAsStream(String name, ClassLoader[] classLoaders) { // Java standard class loader require resource name to be an absolute path without leading path separator // at this point <name> argument is guaranteed to not start with leading path separator for(ClassLoader classLoader : classLoaders) { InputStream stream = classLoader.getResourceAsStream(name); if(stream == null) { // it seems there are class loaders that require leading path separator // not confirmed rumor but found in similar libraries stream = classLoader.getResourceAsStream('/' + name); } if(stream != null) { return stream; } } return null; }
[ "private", "static", "InputStream", "getResourceAsStream", "(", "String", "name", ",", "ClassLoader", "[", "]", "classLoaders", ")", "{", "// Java standard class loader require resource name to be an absolute path without leading path separator\r", "// at this point <name> argument is guaranteed to not start with leading path separator\r", "for", "(", "ClassLoader", "classLoader", ":", "classLoaders", ")", "{", "InputStream", "stream", "=", "classLoader", ".", "getResourceAsStream", "(", "name", ")", ";", "if", "(", "stream", "==", "null", ")", "{", "// it seems there are class loaders that require leading path separator\r", "// not confirmed rumor but found in similar libraries\r", "stream", "=", "classLoader", ".", "getResourceAsStream", "(", "'", "'", "+", "name", ")", ";", "}", "if", "(", "stream", "!=", "null", ")", "{", "return", "stream", ";", "}", "}", "return", "null", ";", "}" ]
Get named resource input stream from a list of class loaders. Traverses class loaders in given order searching for requested resource. Return first resource found or null if none found. @param name resource name with syntax as required by Java ClassLoader, @param classLoaders target class loaders. @return found resource as input stream or null.
[ "Get", "named", "resource", "input", "stream", "from", "a", "list", "of", "class", "loaders", ".", "Traverses", "class", "loaders", "in", "given", "order", "searching", "for", "requested", "resource", ".", "Return", "first", "resource", "found", "or", "null", "if", "none", "found", "." ]
train
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L1061-L1078
jOOQ/jOOX
jOOX-java-6/src/main/java/org/joox/Util.java
Util.createContent
static final DocumentFragment createContent(Document doc, String text) { """ Create some content in the context of a given document @return <ul> <li>A {@link DocumentFragment} if <code>text</code> is well-formed.</li> <li><code>null</code>, if <code>text</code> is plain text or not well formed</li> </ul> """ // [#150] Text might hold XML content, which can be leniently identified by the presence // of either < or & characters (other entities, like >, ", ' are not stricly XML content) if (text != null && (text.contains("<") || text.contains("&"))) { DocumentBuilder builder = JOOX.builder(); try { // [#128] Trimming will get rid of leading and trailing whitespace, which would // otherwise cause a HIERARCHY_REQUEST_ERR raised by the parser text = text.trim(); // There is a processing instruction. We can safely assume // valid XML and parse it as such if (text.startsWith("<?xml")) { Document parsed = builder.parse(new InputSource(new StringReader(text))); DocumentFragment fragment = parsed.createDocumentFragment(); fragment.appendChild(parsed.getDocumentElement()); return (DocumentFragment) doc.importNode(fragment, true); } // Any XML document fragment. To be on the safe side, fragments // are wrapped in a dummy root node else { String wrapped = "<dummy>" + text + "</dummy>"; Document parsed = builder.parse(new InputSource(new StringReader(wrapped))); DocumentFragment fragment = parsed.createDocumentFragment(); NodeList children = parsed.getDocumentElement().getChildNodes(); // appendChild removes children also from NodeList! while (children.getLength() > 0) { fragment.appendChild(children.item(0)); } return (DocumentFragment) doc.importNode(fragment, true); } } // This does not occur catch (IOException ignore) {} // The XML content is invalid catch (SAXException ignore) {} } // Plain text or invalid XML return null; }
java
static final DocumentFragment createContent(Document doc, String text) { // [#150] Text might hold XML content, which can be leniently identified by the presence // of either < or & characters (other entities, like >, ", ' are not stricly XML content) if (text != null && (text.contains("<") || text.contains("&"))) { DocumentBuilder builder = JOOX.builder(); try { // [#128] Trimming will get rid of leading and trailing whitespace, which would // otherwise cause a HIERARCHY_REQUEST_ERR raised by the parser text = text.trim(); // There is a processing instruction. We can safely assume // valid XML and parse it as such if (text.startsWith("<?xml")) { Document parsed = builder.parse(new InputSource(new StringReader(text))); DocumentFragment fragment = parsed.createDocumentFragment(); fragment.appendChild(parsed.getDocumentElement()); return (DocumentFragment) doc.importNode(fragment, true); } // Any XML document fragment. To be on the safe side, fragments // are wrapped in a dummy root node else { String wrapped = "<dummy>" + text + "</dummy>"; Document parsed = builder.parse(new InputSource(new StringReader(wrapped))); DocumentFragment fragment = parsed.createDocumentFragment(); NodeList children = parsed.getDocumentElement().getChildNodes(); // appendChild removes children also from NodeList! while (children.getLength() > 0) { fragment.appendChild(children.item(0)); } return (DocumentFragment) doc.importNode(fragment, true); } } // This does not occur catch (IOException ignore) {} // The XML content is invalid catch (SAXException ignore) {} } // Plain text or invalid XML return null; }
[ "static", "final", "DocumentFragment", "createContent", "(", "Document", "doc", ",", "String", "text", ")", "{", "// [#150] Text might hold XML content, which can be leniently identified by the presence", "// of either < or & characters (other entities, like >, \", ' are not stricly XML content)", "if", "(", "text", "!=", "null", "&&", "(", "text", ".", "contains", "(", "\"<\"", ")", "||", "text", ".", "contains", "(", "\"&\"", ")", ")", ")", "{", "DocumentBuilder", "builder", "=", "JOOX", ".", "builder", "(", ")", ";", "try", "{", "// [#128] Trimming will get rid of leading and trailing whitespace, which would", "// otherwise cause a HIERARCHY_REQUEST_ERR raised by the parser", "text", "=", "text", ".", "trim", "(", ")", ";", "// There is a processing instruction. We can safely assume", "// valid XML and parse it as such", "if", "(", "text", ".", "startsWith", "(", "\"<?xml\"", ")", ")", "{", "Document", "parsed", "=", "builder", ".", "parse", "(", "new", "InputSource", "(", "new", "StringReader", "(", "text", ")", ")", ")", ";", "DocumentFragment", "fragment", "=", "parsed", ".", "createDocumentFragment", "(", ")", ";", "fragment", ".", "appendChild", "(", "parsed", ".", "getDocumentElement", "(", ")", ")", ";", "return", "(", "DocumentFragment", ")", "doc", ".", "importNode", "(", "fragment", ",", "true", ")", ";", "}", "// Any XML document fragment. To be on the safe side, fragments", "// are wrapped in a dummy root node", "else", "{", "String", "wrapped", "=", "\"<dummy>\"", "+", "text", "+", "\"</dummy>\"", ";", "Document", "parsed", "=", "builder", ".", "parse", "(", "new", "InputSource", "(", "new", "StringReader", "(", "wrapped", ")", ")", ")", ";", "DocumentFragment", "fragment", "=", "parsed", ".", "createDocumentFragment", "(", ")", ";", "NodeList", "children", "=", "parsed", ".", "getDocumentElement", "(", ")", ".", "getChildNodes", "(", ")", ";", "// appendChild removes children also from NodeList!", "while", "(", "children", ".", "getLength", "(", ")", ">", "0", ")", "{", "fragment", ".", "appendChild", "(", "children", ".", "item", "(", "0", ")", ")", ";", "}", "return", "(", "DocumentFragment", ")", "doc", ".", "importNode", "(", "fragment", ",", "true", ")", ";", "}", "}", "// This does not occur", "catch", "(", "IOException", "ignore", ")", "{", "}", "// The XML content is invalid", "catch", "(", "SAXException", "ignore", ")", "{", "}", "}", "// Plain text or invalid XML", "return", "null", ";", "}" ]
Create some content in the context of a given document @return <ul> <li>A {@link DocumentFragment} if <code>text</code> is well-formed.</li> <li><code>null</code>, if <code>text</code> is plain text or not well formed</li> </ul>
[ "Create", "some", "content", "in", "the", "context", "of", "a", "given", "document" ]
train
https://github.com/jOOQ/jOOX/blob/3793b96f0cee126f64074da4d7fad63f91d2440e/jOOX-java-6/src/main/java/org/joox/Util.java#L99-L148
xebia-france/xebia-servlet-extras
src/main/java/fr/xebia/servlet/filter/ExpiresFilter.java
ExpiresFilter.startsWithIgnoreCase
protected static boolean startsWithIgnoreCase(String string, String prefix) { """ Return <code>true</code> if the given <code>string</code> starts with the given <code>prefix</code> ignoring case. @param string can be <code>null</code> @param prefix can be <code>null</code> """ if (string == null || prefix == null) { return string == null && prefix == null; } if (prefix.length() > string.length()) { return false; } return string.regionMatches(true, 0, prefix, 0, prefix.length()); }
java
protected static boolean startsWithIgnoreCase(String string, String prefix) { if (string == null || prefix == null) { return string == null && prefix == null; } if (prefix.length() > string.length()) { return false; } return string.regionMatches(true, 0, prefix, 0, prefix.length()); }
[ "protected", "static", "boolean", "startsWithIgnoreCase", "(", "String", "string", ",", "String", "prefix", ")", "{", "if", "(", "string", "==", "null", "||", "prefix", "==", "null", ")", "{", "return", "string", "==", "null", "&&", "prefix", "==", "null", ";", "}", "if", "(", "prefix", ".", "length", "(", ")", ">", "string", ".", "length", "(", ")", ")", "{", "return", "false", ";", "}", "return", "string", ".", "regionMatches", "(", "true", ",", "0", ",", "prefix", ",", "0", ",", "prefix", ".", "length", "(", ")", ")", ";", "}" ]
Return <code>true</code> if the given <code>string</code> starts with the given <code>prefix</code> ignoring case. @param string can be <code>null</code> @param prefix can be <code>null</code>
[ "Return", "<code", ">", "true<", "/", "code", ">", "if", "the", "given", "<code", ">", "string<", "/", "code", ">", "starts", "with", "the", "given", "<code", ">", "prefix<", "/", "code", ">", "ignoring", "case", "." ]
train
https://github.com/xebia-france/xebia-servlet-extras/blob/b263636fc78f8794dde57d92b835edb5e95ce379/src/main/java/fr/xebia/servlet/filter/ExpiresFilter.java#L1170-L1179
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/LocalUnitsManager.java
LocalUnitsManager.replaceUnit
public static void replaceUnit(/*String group, String unitName, */ Unit newUnit) { """ Dynamically change the unit collections. Currently we use this for aop. """ String group = newUnit.getGroup().getName(), unitName = newUnit.getName(); readWriteLock.writeLock().lock(); try { //unitMap List<Unit> unitList = unitMap.get(group); unitList.removeIf(unitToRemove -> Objects.equals(unitToRemove.getName(), unitName)); unitList.add(newUnit); //searchUnitByClassMap Map<Class<? extends Unit>, Unit> tmp = new HashMap<>(); for (Map.Entry<Class<? extends Unit>, Unit> classUnitEntry : searchUnitByClass.entrySet()) { Unit unit = classUnitEntry.getValue(); if (unit.getGroup().getName().equals(group) && unit.getName().equals(unitName)) { tmp.put(classUnitEntry.getKey(), newUnit); break; } } searchUnitByClass.putAll(tmp); //searchUnitMap searchUnitMap.put(Unit.fullName(group, unitName), newUnit); } finally { readWriteLock.writeLock().unlock(); } }
java
public static void replaceUnit(/*String group, String unitName, */ Unit newUnit) { String group = newUnit.getGroup().getName(), unitName = newUnit.getName(); readWriteLock.writeLock().lock(); try { //unitMap List<Unit> unitList = unitMap.get(group); unitList.removeIf(unitToRemove -> Objects.equals(unitToRemove.getName(), unitName)); unitList.add(newUnit); //searchUnitByClassMap Map<Class<? extends Unit>, Unit> tmp = new HashMap<>(); for (Map.Entry<Class<? extends Unit>, Unit> classUnitEntry : searchUnitByClass.entrySet()) { Unit unit = classUnitEntry.getValue(); if (unit.getGroup().getName().equals(group) && unit.getName().equals(unitName)) { tmp.put(classUnitEntry.getKey(), newUnit); break; } } searchUnitByClass.putAll(tmp); //searchUnitMap searchUnitMap.put(Unit.fullName(group, unitName), newUnit); } finally { readWriteLock.writeLock().unlock(); } }
[ "public", "static", "void", "replaceUnit", "(", "/*String group, String unitName, */", "Unit", "newUnit", ")", "{", "String", "group", "=", "newUnit", ".", "getGroup", "(", ")", ".", "getName", "(", ")", ",", "unitName", "=", "newUnit", ".", "getName", "(", ")", ";", "readWriteLock", ".", "writeLock", "(", ")", ".", "lock", "(", ")", ";", "try", "{", "//unitMap", "List", "<", "Unit", ">", "unitList", "=", "unitMap", ".", "get", "(", "group", ")", ";", "unitList", ".", "removeIf", "(", "unitToRemove", "->", "Objects", ".", "equals", "(", "unitToRemove", ".", "getName", "(", ")", ",", "unitName", ")", ")", ";", "unitList", ".", "add", "(", "newUnit", ")", ";", "//searchUnitByClassMap", "Map", "<", "Class", "<", "?", "extends", "Unit", ">", ",", "Unit", ">", "tmp", "=", "new", "HashMap", "<>", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "Class", "<", "?", "extends", "Unit", ">", ",", "Unit", ">", "classUnitEntry", ":", "searchUnitByClass", ".", "entrySet", "(", ")", ")", "{", "Unit", "unit", "=", "classUnitEntry", ".", "getValue", "(", ")", ";", "if", "(", "unit", ".", "getGroup", "(", ")", ".", "getName", "(", ")", ".", "equals", "(", "group", ")", "&&", "unit", ".", "getName", "(", ")", ".", "equals", "(", "unitName", ")", ")", "{", "tmp", ".", "put", "(", "classUnitEntry", ".", "getKey", "(", ")", ",", "newUnit", ")", ";", "break", ";", "}", "}", "searchUnitByClass", ".", "putAll", "(", "tmp", ")", ";", "//searchUnitMap", "searchUnitMap", ".", "put", "(", "Unit", ".", "fullName", "(", "group", ",", "unitName", ")", ",", "newUnit", ")", ";", "}", "finally", "{", "readWriteLock", ".", "writeLock", "(", ")", ".", "unlock", "(", ")", ";", "}", "}" ]
Dynamically change the unit collections. Currently we use this for aop.
[ "Dynamically", "change", "the", "unit", "collections", ".", "Currently", "we", "use", "this", "for", "aop", "." ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/LocalUnitsManager.java#L129-L154
roboconf/roboconf-platform
miscellaneous/roboconf-dm-rest-client/src/main/java/net/roboconf/dm/rest/client/delegates/ApplicationWsDelegate.java
ApplicationWsDelegate.setDescription
public void setDescription( String applicationName, String newDesc ) throws ApplicationWsException { """ Changes the description of an application. @param applicationName the application name @param newDesc the new description to set @throws ApplicationWsException if something went wrong """ this.logger.finer( "Updating the description of application " + applicationName + "." ); WebResource path = this.resource.path( UrlConstants.APP ).path( applicationName ).path( "description" ); ClientResponse response = this.wsClient.createBuilder( path ) .accept( MediaType.TEXT_PLAIN ) .post( ClientResponse.class, newDesc ); handleResponse( response ); this.logger.finer( String.valueOf( response.getStatusInfo())); }
java
public void setDescription( String applicationName, String newDesc ) throws ApplicationWsException { this.logger.finer( "Updating the description of application " + applicationName + "." ); WebResource path = this.resource.path( UrlConstants.APP ).path( applicationName ).path( "description" ); ClientResponse response = this.wsClient.createBuilder( path ) .accept( MediaType.TEXT_PLAIN ) .post( ClientResponse.class, newDesc ); handleResponse( response ); this.logger.finer( String.valueOf( response.getStatusInfo())); }
[ "public", "void", "setDescription", "(", "String", "applicationName", ",", "String", "newDesc", ")", "throws", "ApplicationWsException", "{", "this", ".", "logger", ".", "finer", "(", "\"Updating the description of application \"", "+", "applicationName", "+", "\".\"", ")", ";", "WebResource", "path", "=", "this", ".", "resource", ".", "path", "(", "UrlConstants", ".", "APP", ")", ".", "path", "(", "applicationName", ")", ".", "path", "(", "\"description\"", ")", ";", "ClientResponse", "response", "=", "this", ".", "wsClient", ".", "createBuilder", "(", "path", ")", ".", "accept", "(", "MediaType", ".", "TEXT_PLAIN", ")", ".", "post", "(", "ClientResponse", ".", "class", ",", "newDesc", ")", ";", "handleResponse", "(", "response", ")", ";", "this", ".", "logger", ".", "finer", "(", "String", ".", "valueOf", "(", "response", ".", "getStatusInfo", "(", ")", ")", ")", ";", "}" ]
Changes the description of an application. @param applicationName the application name @param newDesc the new description to set @throws ApplicationWsException if something went wrong
[ "Changes", "the", "description", "of", "an", "application", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-dm-rest-client/src/main/java/net/roboconf/dm/rest/client/delegates/ApplicationWsDelegate.java#L108-L120
Stratio/stratio-cassandra
src/java/org/apache/cassandra/cli/CliCompiler.java
CliCompiler.getColumn
public static String getColumn(Tree astNode, int pos) { """ Returns the pos'th (0-based index) column specifier in the astNode """ // Skip over keyspace, column family and rowKey return CliUtils.unescapeSQLString(astNode.getChild(pos + 2).getText()); }
java
public static String getColumn(Tree astNode, int pos) { // Skip over keyspace, column family and rowKey return CliUtils.unescapeSQLString(astNode.getChild(pos + 2).getText()); }
[ "public", "static", "String", "getColumn", "(", "Tree", "astNode", ",", "int", "pos", ")", "{", "// Skip over keyspace, column family and rowKey", "return", "CliUtils", ".", "unescapeSQLString", "(", "astNode", ".", "getChild", "(", "pos", "+", "2", ")", ".", "getText", "(", ")", ")", ";", "}" ]
Returns the pos'th (0-based index) column specifier in the astNode
[ "Returns", "the", "pos", "th", "(", "0", "-", "based", "index", ")", "column", "specifier", "in", "the", "astNode" ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/cli/CliCompiler.java#L166-L170
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Compiler.java
Compiler.compilePredicates
private void compilePredicates(int opPos, Expression[] predicates) throws TransformerException { """ Compiles predicates in the step. @param opPos The position of the first predicate the m_opMap array. @param predicates An empty pre-determined array of {@link org.apache.xpath.Expression}s, that will be filled in. @throws TransformerException """ for (int i = 0; OpCodes.OP_PREDICATE == getOp(opPos); i++) { predicates[i] = predicate(opPos); opPos = getNextOpPos(opPos); } }
java
private void compilePredicates(int opPos, Expression[] predicates) throws TransformerException { for (int i = 0; OpCodes.OP_PREDICATE == getOp(opPos); i++) { predicates[i] = predicate(opPos); opPos = getNextOpPos(opPos); } }
[ "private", "void", "compilePredicates", "(", "int", "opPos", ",", "Expression", "[", "]", "predicates", ")", "throws", "TransformerException", "{", "for", "(", "int", "i", "=", "0", ";", "OpCodes", ".", "OP_PREDICATE", "==", "getOp", "(", "opPos", ")", ";", "i", "++", ")", "{", "predicates", "[", "i", "]", "=", "predicate", "(", "opPos", ")", ";", "opPos", "=", "getNextOpPos", "(", "opPos", ")", ";", "}", "}" ]
Compiles predicates in the step. @param opPos The position of the first predicate the m_opMap array. @param predicates An empty pre-determined array of {@link org.apache.xpath.Expression}s, that will be filled in. @throws TransformerException
[ "Compiles", "predicates", "in", "the", "step", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Compiler.java#L998-L1007
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java
VirtualMachinesInner.beginCapture
public VirtualMachineCaptureResultInner beginCapture(String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters) { """ Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar VMs. @param resourceGroupName The name of the resource group. @param vmName The name of the virtual machine. @param parameters Parameters supplied to the Capture Virtual Machine operation. @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 VirtualMachineCaptureResultInner object if successful. """ return beginCaptureWithServiceResponseAsync(resourceGroupName, vmName, parameters).toBlocking().single().body(); }
java
public VirtualMachineCaptureResultInner beginCapture(String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters) { return beginCaptureWithServiceResponseAsync(resourceGroupName, vmName, parameters).toBlocking().single().body(); }
[ "public", "VirtualMachineCaptureResultInner", "beginCapture", "(", "String", "resourceGroupName", ",", "String", "vmName", ",", "VirtualMachineCaptureParameters", "parameters", ")", "{", "return", "beginCaptureWithServiceResponseAsync", "(", "resourceGroupName", ",", "vmName", ",", "parameters", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar VMs. @param resourceGroupName The name of the resource group. @param vmName The name of the virtual machine. @param parameters Parameters supplied to the Capture Virtual Machine operation. @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 VirtualMachineCaptureResultInner object if successful.
[ "Captures", "the", "VM", "by", "copying", "virtual", "hard", "disks", "of", "the", "VM", "and", "outputs", "a", "template", "that", "can", "be", "used", "to", "create", "similar", "VMs", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java#L455-L457
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) { """ 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 """ 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", ")", ")", "{", "return", "new", "VerboseHandlerReference", "(", "component", ",", "method", ",", "priority", ",", "filter", ")", ";", "}", "else", "{", "return", "new", "HandlerReference", "(", "component", ",", "method", ",", "priority", ",", "filter", ")", ";", "}", "}" ]
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
querydsl/querydsl
querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java
Expressions.stringTemplate
@Deprecated public static StringTemplate stringTemplate(String template, ImmutableList<?> args) { """ Create a new Template expression @deprecated Use {@link #stringTemplate(String, List)} instead. @param template template @param args template parameters @return template expression """ return stringTemplate(createTemplate(template), args); }
java
@Deprecated public static StringTemplate stringTemplate(String template, ImmutableList<?> args) { return stringTemplate(createTemplate(template), args); }
[ "@", "Deprecated", "public", "static", "StringTemplate", "stringTemplate", "(", "String", "template", ",", "ImmutableList", "<", "?", ">", "args", ")", "{", "return", "stringTemplate", "(", "createTemplate", "(", "template", ")", ",", "args", ")", ";", "}" ]
Create a new Template expression @deprecated Use {@link #stringTemplate(String, List)} instead. @param template template @param args template parameters @return template expression
[ "Create", "a", "new", "Template", "expression" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java#L901-L904
apache/groovy
src/main/java/org/codehaus/groovy/runtime/dgmimpl/NumberNumberPlus.java
NumberNumberPlus.plus
public static Number plus(Number left, Number right) { """ Add two numbers and return the result. @param left a Number @param right another Number to add @return the addition of both Numbers """ return NumberMath.add(left, right); }
java
public static Number plus(Number left, Number right) { return NumberMath.add(left, right); }
[ "public", "static", "Number", "plus", "(", "Number", "left", ",", "Number", "right", ")", "{", "return", "NumberMath", ".", "add", "(", "left", ",", "right", ")", ";", "}" ]
Add two numbers and return the result. @param left a Number @param right another Number to add @return the addition of both Numbers
[ "Add", "two", "numbers", "and", "return", "the", "result", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/dgmimpl/NumberNumberPlus.java#L42-L44
pressgang-ccms/PressGangCCMSBuilder
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java
DocBookBuildUtilities.addLevelsToDatabase
public static void addLevelsToDatabase(final BuildDatabase buildDatabase, final Level level) { """ Adds the levels in the provided Level object to the content spec database. @param buildDatabase @param level The content spec level to be added to the database. """ // Add the level to the database buildDatabase.add(level); // Add the child levels to the database for (final Level childLevel : level.getChildLevels()) { addLevelsToDatabase(buildDatabase, childLevel); } }
java
public static void addLevelsToDatabase(final BuildDatabase buildDatabase, final Level level) { // Add the level to the database buildDatabase.add(level); // Add the child levels to the database for (final Level childLevel : level.getChildLevels()) { addLevelsToDatabase(buildDatabase, childLevel); } }
[ "public", "static", "void", "addLevelsToDatabase", "(", "final", "BuildDatabase", "buildDatabase", ",", "final", "Level", "level", ")", "{", "// Add the level to the database", "buildDatabase", ".", "add", "(", "level", ")", ";", "// Add the child levels to the database", "for", "(", "final", "Level", "childLevel", ":", "level", ".", "getChildLevels", "(", ")", ")", "{", "addLevelsToDatabase", "(", "buildDatabase", ",", "childLevel", ")", ";", "}", "}" ]
Adds the levels in the provided Level object to the content spec database. @param buildDatabase @param level The content spec level to be added to the database.
[ "Adds", "the", "levels", "in", "the", "provided", "Level", "object", "to", "the", "content", "spec", "database", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java#L76-L84
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WComponentGroupRenderer.java
WComponentGroupRenderer.doRender
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { """ Paints the given WComponentGroup. @param component the WComponentGroup to paint. @param renderContext the RenderContext to paint to. """ WComponentGroup group = (WComponentGroup) component; XmlStringBuilder xml = renderContext.getWriter(); List<WComponent> components = group.getComponents(); if (components != null && !components.isEmpty()) { xml.appendTagOpen("ui:componentGroup"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); xml.appendClose(); for (WComponent comp : components) { xml.appendTagOpen("ui:component"); xml.appendAttribute("id", comp.getId()); xml.appendEnd(); } xml.appendEndTag("ui:componentGroup"); } }
java
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WComponentGroup group = (WComponentGroup) component; XmlStringBuilder xml = renderContext.getWriter(); List<WComponent> components = group.getComponents(); if (components != null && !components.isEmpty()) { xml.appendTagOpen("ui:componentGroup"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); xml.appendClose(); for (WComponent comp : components) { xml.appendTagOpen("ui:component"); xml.appendAttribute("id", comp.getId()); xml.appendEnd(); } xml.appendEndTag("ui:componentGroup"); } }
[ "@", "Override", "public", "void", "doRender", "(", "final", "WComponent", "component", ",", "final", "WebXmlRenderContext", "renderContext", ")", "{", "WComponentGroup", "group", "=", "(", "WComponentGroup", ")", "component", ";", "XmlStringBuilder", "xml", "=", "renderContext", ".", "getWriter", "(", ")", ";", "List", "<", "WComponent", ">", "components", "=", "group", ".", "getComponents", "(", ")", ";", "if", "(", "components", "!=", "null", "&&", "!", "components", ".", "isEmpty", "(", ")", ")", "{", "xml", ".", "appendTagOpen", "(", "\"ui:componentGroup\"", ")", ";", "xml", ".", "appendAttribute", "(", "\"id\"", ",", "component", ".", "getId", "(", ")", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"track\"", ",", "component", ".", "isTracking", "(", ")", ",", "\"true\"", ")", ";", "xml", ".", "appendClose", "(", ")", ";", "for", "(", "WComponent", "comp", ":", "components", ")", "{", "xml", ".", "appendTagOpen", "(", "\"ui:component\"", ")", ";", "xml", ".", "appendAttribute", "(", "\"id\"", ",", "comp", ".", "getId", "(", ")", ")", ";", "xml", ".", "appendEnd", "(", ")", ";", "}", "xml", ".", "appendEndTag", "(", "\"ui:componentGroup\"", ")", ";", "}", "}" ]
Paints the given WComponentGroup. @param component the WComponentGroup to paint. @param renderContext the RenderContext to paint to.
[ "Paints", "the", "given", "WComponentGroup", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WComponentGroupRenderer.java#L23-L43
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java
AsynchronousRequest.getPetInfo
public void getPetInfo(int[] ids, Callback<List<Pet>> callback) throws GuildWars2Exception, NullPointerException { """ For more info on pets API go <a href="https://wiki.guildwars2.com/wiki/API:2/pets">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @param ids list of pet id @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws GuildWars2Exception empty ID list @throws NullPointerException if given {@link Callback} is empty @see Pet pet info """ isParamValid(new ParamChecker(ids)); gw2API.getPetInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback); }
java
public void getPetInfo(int[] ids, Callback<List<Pet>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); gw2API.getPetInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback); }
[ "public", "void", "getPetInfo", "(", "int", "[", "]", "ids", ",", "Callback", "<", "List", "<", "Pet", ">", ">", "callback", ")", "throws", "GuildWars2Exception", ",", "NullPointerException", "{", "isParamValid", "(", "new", "ParamChecker", "(", "ids", ")", ")", ";", "gw2API", ".", "getPetInfo", "(", "processIds", "(", "ids", ")", ",", "GuildWars2", ".", "lang", ".", "getValue", "(", ")", ")", ".", "enqueue", "(", "callback", ")", ";", "}" ]
For more info on pets API go <a href="https://wiki.guildwars2.com/wiki/API:2/pets">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @param ids list of pet id @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws GuildWars2Exception empty ID list @throws NullPointerException if given {@link Callback} is empty @see Pet pet info
[ "For", "more", "info", "on", "pets", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "pets", ">", "here<", "/", "a", ">", "<br", "/", ">", "Give", "user", "the", "access", "to", "{", "@link", "Callback#onResponse", "(", "Call", "Response", ")", "}", "and", "{", "@link", "Callback#onFailure", "(", "Call", "Throwable", ")", "}", "methods", "for", "custom", "interactions" ]
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L1963-L1966
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/map/layer/AbstractLayer.java
AbstractLayer.updateShowing
protected void updateShowing(boolean fireEvents) { """ Update showing state. @param fireEvents Should events be fired if state changes? """ double scale = mapModel.getMapView().getCurrentScale(); if (visible) { boolean oldShowing = showing; showing = scale >= layerInfo.getMinimumScale().getPixelPerUnit() && scale <= layerInfo.getMaximumScale().getPixelPerUnit(); if (oldShowing != showing && fireEvents) { handlerManager.fireEvent(new LayerShownEvent(this, true)); } } else { showing = false; } }
java
protected void updateShowing(boolean fireEvents) { double scale = mapModel.getMapView().getCurrentScale(); if (visible) { boolean oldShowing = showing; showing = scale >= layerInfo.getMinimumScale().getPixelPerUnit() && scale <= layerInfo.getMaximumScale().getPixelPerUnit(); if (oldShowing != showing && fireEvents) { handlerManager.fireEvent(new LayerShownEvent(this, true)); } } else { showing = false; } }
[ "protected", "void", "updateShowing", "(", "boolean", "fireEvents", ")", "{", "double", "scale", "=", "mapModel", ".", "getMapView", "(", ")", ".", "getCurrentScale", "(", ")", ";", "if", "(", "visible", ")", "{", "boolean", "oldShowing", "=", "showing", ";", "showing", "=", "scale", ">=", "layerInfo", ".", "getMinimumScale", "(", ")", ".", "getPixelPerUnit", "(", ")", "&&", "scale", "<=", "layerInfo", ".", "getMaximumScale", "(", ")", ".", "getPixelPerUnit", "(", ")", ";", "if", "(", "oldShowing", "!=", "showing", "&&", "fireEvents", ")", "{", "handlerManager", ".", "fireEvent", "(", "new", "LayerShownEvent", "(", "this", ",", "true", ")", ")", ";", "}", "}", "else", "{", "showing", "=", "false", ";", "}", "}" ]
Update showing state. @param fireEvents Should events be fired if state changes?
[ "Update", "showing", "state", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/layer/AbstractLayer.java#L130-L142
Erudika/para
para-server/src/main/java/com/erudika/para/persistence/AWSDynamoUtils.java
AWSDynamoUtils.batchWrite
protected static void batchWrite(Map<String, List<WriteRequest>> items, int backoff) { """ Writes multiple items in batch. @param items a map of tables->write requests @param backoff backoff seconds """ if (items == null || items.isEmpty()) { return; } try { BatchWriteItemResult result = getClient().batchWriteItem(new BatchWriteItemRequest(). withReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL).withRequestItems(items)); if (result == null) { return; } logger.debug("batchWrite(): total {}, cc {}", items.size(), result.getConsumedCapacity()); if (result.getUnprocessedItems() != null && !result.getUnprocessedItems().isEmpty()) { Thread.sleep((long) backoff * 1000L); logger.warn("{} UNPROCESSED write requests!", result.getUnprocessedItems().size()); batchWrite(result.getUnprocessedItems(), backoff * 2); } } catch (Exception e) { logger.error(null, e); throwIfNecessary(e); } }
java
protected static void batchWrite(Map<String, List<WriteRequest>> items, int backoff) { if (items == null || items.isEmpty()) { return; } try { BatchWriteItemResult result = getClient().batchWriteItem(new BatchWriteItemRequest(). withReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL).withRequestItems(items)); if (result == null) { return; } logger.debug("batchWrite(): total {}, cc {}", items.size(), result.getConsumedCapacity()); if (result.getUnprocessedItems() != null && !result.getUnprocessedItems().isEmpty()) { Thread.sleep((long) backoff * 1000L); logger.warn("{} UNPROCESSED write requests!", result.getUnprocessedItems().size()); batchWrite(result.getUnprocessedItems(), backoff * 2); } } catch (Exception e) { logger.error(null, e); throwIfNecessary(e); } }
[ "protected", "static", "void", "batchWrite", "(", "Map", "<", "String", ",", "List", "<", "WriteRequest", ">", ">", "items", ",", "int", "backoff", ")", "{", "if", "(", "items", "==", "null", "||", "items", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "try", "{", "BatchWriteItemResult", "result", "=", "getClient", "(", ")", ".", "batchWriteItem", "(", "new", "BatchWriteItemRequest", "(", ")", ".", "withReturnConsumedCapacity", "(", "ReturnConsumedCapacity", ".", "TOTAL", ")", ".", "withRequestItems", "(", "items", ")", ")", ";", "if", "(", "result", "==", "null", ")", "{", "return", ";", "}", "logger", ".", "debug", "(", "\"batchWrite(): total {}, cc {}\"", ",", "items", ".", "size", "(", ")", ",", "result", ".", "getConsumedCapacity", "(", ")", ")", ";", "if", "(", "result", ".", "getUnprocessedItems", "(", ")", "!=", "null", "&&", "!", "result", ".", "getUnprocessedItems", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "Thread", ".", "sleep", "(", "(", "long", ")", "backoff", "*", "1000L", ")", ";", "logger", ".", "warn", "(", "\"{} UNPROCESSED write requests!\"", ",", "result", ".", "getUnprocessedItems", "(", ")", ".", "size", "(", ")", ")", ";", "batchWrite", "(", "result", ".", "getUnprocessedItems", "(", ")", ",", "backoff", "*", "2", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "error", "(", "null", ",", "e", ")", ";", "throwIfNecessary", "(", "e", ")", ";", "}", "}" ]
Writes multiple items in batch. @param items a map of tables->write requests @param backoff backoff seconds
[ "Writes", "multiple", "items", "in", "batch", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-server/src/main/java/com/erudika/para/persistence/AWSDynamoUtils.java#L453-L474
BioPAX/Paxtools
pattern/src/main/java/org/biopax/paxtools/pattern/miner/UbiquitousIDMiner.java
UbiquitousIDMiner.getValue
@Override public String getValue(Match m, int col) { """ Gets the ids of the small molecule reference and its physical entities. @param m current match @param col current column @return ubique IDs """ assert col == 0; return getRelatedIDs((SmallMoleculeReference) m.get("SMR", getPattern())); }
java
@Override public String getValue(Match m, int col) { assert col == 0; return getRelatedIDs((SmallMoleculeReference) m.get("SMR", getPattern())); }
[ "@", "Override", "public", "String", "getValue", "(", "Match", "m", ",", "int", "col", ")", "{", "assert", "col", "==", "0", ";", "return", "getRelatedIDs", "(", "(", "SmallMoleculeReference", ")", "m", ".", "get", "(", "\"SMR\"", ",", "getPattern", "(", ")", ")", ")", ";", "}" ]
Gets the ids of the small molecule reference and its physical entities. @param m current match @param col current column @return ubique IDs
[ "Gets", "the", "ids", "of", "the", "small", "molecule", "reference", "and", "its", "physical", "entities", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/miner/UbiquitousIDMiner.java#L75-L81
googleapis/google-cloud-java
google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java
DataLabelingServiceClient.listDatasets
public final ListDatasetsPagedResponse listDatasets(String parent, String filter) { """ Lists datasets under a project. Pagination is supported. <p>Sample code: <pre><code> try (DataLabelingServiceClient dataLabelingServiceClient = DataLabelingServiceClient.create()) { String formattedParent = DataLabelingServiceClient.formatProjectName("[PROJECT]"); String filter = ""; for (Dataset element : dataLabelingServiceClient.listDatasets(formattedParent, filter).iterateAll()) { // doThingsWith(element); } } </code></pre> @param parent Required. Dataset resource parent, format: projects/{project_id} @param filter Optional. Filter on dataset is not supported at this moment. @throws com.google.api.gax.rpc.ApiException if the remote call fails """ PROJECT_PATH_TEMPLATE.validate(parent, "listDatasets"); ListDatasetsRequest request = ListDatasetsRequest.newBuilder().setParent(parent).setFilter(filter).build(); return listDatasets(request); }
java
public final ListDatasetsPagedResponse listDatasets(String parent, String filter) { PROJECT_PATH_TEMPLATE.validate(parent, "listDatasets"); ListDatasetsRequest request = ListDatasetsRequest.newBuilder().setParent(parent).setFilter(filter).build(); return listDatasets(request); }
[ "public", "final", "ListDatasetsPagedResponse", "listDatasets", "(", "String", "parent", ",", "String", "filter", ")", "{", "PROJECT_PATH_TEMPLATE", ".", "validate", "(", "parent", ",", "\"listDatasets\"", ")", ";", "ListDatasetsRequest", "request", "=", "ListDatasetsRequest", ".", "newBuilder", "(", ")", ".", "setParent", "(", "parent", ")", ".", "setFilter", "(", "filter", ")", ".", "build", "(", ")", ";", "return", "listDatasets", "(", "request", ")", ";", "}" ]
Lists datasets under a project. Pagination is supported. <p>Sample code: <pre><code> try (DataLabelingServiceClient dataLabelingServiceClient = DataLabelingServiceClient.create()) { String formattedParent = DataLabelingServiceClient.formatProjectName("[PROJECT]"); String filter = ""; for (Dataset element : dataLabelingServiceClient.listDatasets(formattedParent, filter).iterateAll()) { // doThingsWith(element); } } </code></pre> @param parent Required. Dataset resource parent, format: projects/{project_id} @param filter Optional. Filter on dataset is not supported at this moment. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Lists", "datasets", "under", "a", "project", ".", "Pagination", "is", "supported", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java#L634-L639