repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
204
func_name
stringlengths
5
103
whole_func_string
stringlengths
87
3.44k
language
stringclasses
1 value
func_code_string
stringlengths
87
3.44k
func_code_tokens
listlengths
21
714
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
482
split_name
stringclasses
1 value
func_code_url
stringlengths
102
309
btrplace/scheduler
json/src/main/java/org/btrplace/json/JSONs.java
JSONs.requiredNode
public static Node requiredNode(Model mo, JSONObject o, String id) throws JSONConverterException { checkKeys(o, id); try { return getNode(mo, (Integer) o.get(id)); } catch (ClassCastException e) { throw new JSONConverterException("Unable to read a Node identifier from string at key '" + id + "'", e); } }
java
public static Node requiredNode(Model mo, JSONObject o, String id) throws JSONConverterException { checkKeys(o, id); try { return getNode(mo, (Integer) o.get(id)); } catch (ClassCastException e) { throw new JSONConverterException("Unable to read a Node identifier from string at key '" + id + "'", e); } }
[ "public", "static", "Node", "requiredNode", "(", "Model", "mo", ",", "JSONObject", "o", ",", "String", "id", ")", "throws", "JSONConverterException", "{", "checkKeys", "(", "o", ",", "id", ")", ";", "try", "{", "return", "getNode", "(", "mo", ",", "(", ...
Read an expected node. @param mo the associated model to browse @param o the object to parse @param id the key in the map that points to the node identifier @return the node @throws JSONConverterException if the key does not point to a node identifier
[ "Read", "an", "expected", "node", "." ]
train
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/JSONs.java#L359-L366
jbundle/jbundle
base/remote/src/main/java/org/jbundle/base/remote/BaseTaskSession.java
BaseTaskSession.init
public void init(BaseSession parentSessionObject, Record record, Map<String, Object> objectID) { if (m_application == null) m_application = new MainApplication(null, null, null); this.addToApplication(); super.init(parentSessionObject, record, objectID); }
java
public void init(BaseSession parentSessionObject, Record record, Map<String, Object> objectID) { if (m_application == null) m_application = new MainApplication(null, null, null); this.addToApplication(); super.init(parentSessionObject, record, objectID); }
[ "public", "void", "init", "(", "BaseSession", "parentSessionObject", ",", "Record", "record", ",", "Map", "<", "String", ",", "Object", ">", "objectID", ")", "{", "if", "(", "m_application", "==", "null", ")", "m_application", "=", "new", "MainApplication", ...
Build a new task session. @param parentSessionObject Parent that created this session object (usually null for task sessions). @param record Main record for this session (always null for task sessions). @param objectID ObjectID of the object that this SessionObject represents (usually null for task sessions).
[ "Build", "a", "new", "task", "session", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/BaseTaskSession.java#L92-L98
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/SimpleMMcifConsumer.java
SimpleMMcifConsumer.addInformationFromESN
private void addInformationFromESN(EntitySrcNat esn, int eId, EntityInfo c) { c.setAtcc(esn.getPdbx_atcc()); c.setCell(esn.getPdbx_cell()); c.setOrganismCommon(esn.getCommon_name()); c.setOrganismScientific(esn.getPdbx_organism_scientific()); c.setOrganismTaxId(esn.getPdbx_ncbi_taxonomy_id()); }
java
private void addInformationFromESN(EntitySrcNat esn, int eId, EntityInfo c) { c.setAtcc(esn.getPdbx_atcc()); c.setCell(esn.getPdbx_cell()); c.setOrganismCommon(esn.getCommon_name()); c.setOrganismScientific(esn.getPdbx_organism_scientific()); c.setOrganismTaxId(esn.getPdbx_ncbi_taxonomy_id()); }
[ "private", "void", "addInformationFromESN", "(", "EntitySrcNat", "esn", ",", "int", "eId", ",", "EntityInfo", "c", ")", "{", "c", ".", "setAtcc", "(", "esn", ".", "getPdbx_atcc", "(", ")", ")", ";", "c", ".", "setCell", "(", "esn", ".", "getPdbx_cell", ...
Add the information to entity info from ESN. @param esn @param eId @param c
[ "Add", "the", "information", "to", "entity", "info", "from", "ESN", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/SimpleMMcifConsumer.java#L1212-L1220
jmeetsma/Iglu-Util
src/main/java/org/ijsberg/iglu/util/formatting/PatternMatchingSupport.java
PatternMatchingSupport.valueMatchesRegularExpression
public static boolean valueMatchesRegularExpression(String val, Pattern regexp) { Matcher m = regexp.matcher(val); try { return m.matches(); } catch (StackOverflowError e) { e.printStackTrace(); System.out.println("-> [" + val + "][" + regexp + "]"); System.out.println("-> " + val.length()); System.exit(0); } return false; }
java
public static boolean valueMatchesRegularExpression(String val, Pattern regexp) { Matcher m = regexp.matcher(val); try { return m.matches(); } catch (StackOverflowError e) { e.printStackTrace(); System.out.println("-> [" + val + "][" + regexp + "]"); System.out.println("-> " + val.length()); System.exit(0); } return false; }
[ "public", "static", "boolean", "valueMatchesRegularExpression", "(", "String", "val", ",", "Pattern", "regexp", ")", "{", "Matcher", "m", "=", "regexp", ".", "matcher", "(", "val", ")", ";", "try", "{", "return", "m", ".", "matches", "(", ")", ";", "}", ...
Returns true only if the value matches the regular expression at least once. @param val string value that may match the expression @param regexp regular expression @return true if val matches regular expression regexp
[ "Returns", "true", "only", "if", "the", "value", "matches", "the", "regular", "expression", "at", "least", "once", "." ]
train
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/formatting/PatternMatchingSupport.java#L63-L75
lessthanoptimal/ejml
main/ejml-dsparse/src/org/ejml/sparse/csc/CommonOps_DSCC.java
CommonOps_DSCC.elementMult
public static void elementMult( DMatrixSparseCSC A, DMatrixSparseCSC B, DMatrixSparseCSC C , @Nullable IGrowArray gw, @Nullable DGrowArray gx) { if( A.numCols != B.numCols || A.numRows != B.numRows ) throw new MatrixDimensionException("All inputs must have the same number of rows and columns. "+stringShapes(A,B)); C.reshape(A.numRows,A.numCols); ImplCommonOps_DSCC.elementMult(A,B,C,gw,gx); }
java
public static void elementMult( DMatrixSparseCSC A, DMatrixSparseCSC B, DMatrixSparseCSC C , @Nullable IGrowArray gw, @Nullable DGrowArray gx) { if( A.numCols != B.numCols || A.numRows != B.numRows ) throw new MatrixDimensionException("All inputs must have the same number of rows and columns. "+stringShapes(A,B)); C.reshape(A.numRows,A.numCols); ImplCommonOps_DSCC.elementMult(A,B,C,gw,gx); }
[ "public", "static", "void", "elementMult", "(", "DMatrixSparseCSC", "A", ",", "DMatrixSparseCSC", "B", ",", "DMatrixSparseCSC", "C", ",", "@", "Nullable", "IGrowArray", "gw", ",", "@", "Nullable", "DGrowArray", "gx", ")", "{", "if", "(", "A", ".", "numCols",...
Performs an element-wise multiplication.<br> C[i,j] = A[i,j]*B[i,j]<br> All matrices must have the same shape. @param A (Input) Matrix. @param B (Input) Matrix @param C (Output) Matrix. data array is grown to min(A.nz_length,B.nz_length), resulting a in a large speed boost. @param gw (Optional) Storage for internal workspace. Can be null. @param gx (Optional) Storage for internal workspace. Can be null.
[ "Performs", "an", "element", "-", "wise", "multiplication", ".", "<br", ">", "C", "[", "i", "j", "]", "=", "A", "[", "i", "j", "]", "*", "B", "[", "i", "j", "]", "<br", ">", "All", "matrices", "must", "have", "the", "same", "shape", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-dsparse/src/org/ejml/sparse/csc/CommonOps_DSCC.java#L565-L572
dlemmermann/CalendarFX
CalendarFXView/src/main/java/com/calendarfx/view/DateControl.java
DateControl.setEntryEditPolicy
public final void setEntryEditPolicy(Callback<EntryEditParameter, Boolean> policy) { Objects.requireNonNull(policy, "The edit entry policy can not be null"); this.entryEditPolicy.set(policy); }
java
public final void setEntryEditPolicy(Callback<EntryEditParameter, Boolean> policy) { Objects.requireNonNull(policy, "The edit entry policy can not be null"); this.entryEditPolicy.set(policy); }
[ "public", "final", "void", "setEntryEditPolicy", "(", "Callback", "<", "EntryEditParameter", ",", "Boolean", ">", "policy", ")", "{", "Objects", ".", "requireNonNull", "(", "policy", ",", "\"The edit entry policy can not be null\"", ")", ";", "this", ".", "entryEdit...
Sets the value of {@link #entryEditPolicy}. @param policy the entry edit policy callback @see EditOperation
[ "Sets", "the", "value", "of", "{", "@link", "#entryEditPolicy", "}", "." ]
train
https://github.com/dlemmermann/CalendarFX/blob/f2b91c2622c3f29d004485b6426b23b86c331f96/CalendarFXView/src/main/java/com/calendarfx/view/DateControl.java#L1152-L1155
Erudika/para
para-client/src/main/java/com/erudika/para/client/ParaClient.java
ParaClient.validationConstraints
public Map<String, Map<String, Map<String, Map<String, ?>>>> validationConstraints() { return getEntity(invokeGet("_constraints", null), Map.class); }
java
public Map<String, Map<String, Map<String, Map<String, ?>>>> validationConstraints() { return getEntity(invokeGet("_constraints", null), Map.class); }
[ "public", "Map", "<", "String", ",", "Map", "<", "String", ",", "Map", "<", "String", ",", "Map", "<", "String", ",", "?", ">", ">", ">", ">", "validationConstraints", "(", ")", "{", "return", "getEntity", "(", "invokeGet", "(", "\"_constraints\"", ","...
Returns the validation constraints map. @return a map containing all validation constraints.
[ "Returns", "the", "validation", "constraints", "map", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-client/src/main/java/com/erudika/para/client/ParaClient.java#L1358-L1360
rey5137/material
material/src/main/java/com/rey/material/widget/DatePicker.java
DatePicker.setDateRange
public void setDateRange(int minDay, int minMonth, int minYear, int maxDay, int maxMonth, int maxYear){ mAdapter.setDateRange(minDay, minMonth, minYear, maxDay, maxMonth, maxYear); }
java
public void setDateRange(int minDay, int minMonth, int minYear, int maxDay, int maxMonth, int maxYear){ mAdapter.setDateRange(minDay, minMonth, minYear, maxDay, maxMonth, maxYear); }
[ "public", "void", "setDateRange", "(", "int", "minDay", ",", "int", "minMonth", ",", "int", "minYear", ",", "int", "maxDay", ",", "int", "maxMonth", ",", "int", "maxYear", ")", "{", "mAdapter", ".", "setDateRange", "(", "minDay", ",", "minMonth", ",", "m...
Set the range of selectable dates. @param minDay The day value of minimum date. @param minMonth The month value of minimum date. @param minYear The year value of minimum date. @param maxDay The day value of maximum date. @param maxMonth The month value of maximum date. @param maxYear The year value of maximum date.
[ "Set", "the", "range", "of", "selectable", "dates", "." ]
train
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/widget/DatePicker.java#L388-L390
cloudfoundry-community/java-nats
client/src/main/java/nats/codec/AbstractFrameDecoder.java
AbstractFrameDecoder.indexOf
private int indexOf(ByteBuf haystack, byte[] needle) { for (int i = haystack.readerIndex(); i < haystack.writerIndex(); i++) { int haystackIndex = i; int needleIndex; for (needleIndex = 0; needleIndex < needle.length; needleIndex++) { if (haystack.getByte(haystackIndex) != needle[needleIndex]) { break; } else { haystackIndex++; if (haystackIndex == haystack.writerIndex() && needleIndex != needle.length - 1) { return -1; } } } if (needleIndex == needle.length) { // Found the needle from the haystack! return i - haystack.readerIndex(); } } return -1; }
java
private int indexOf(ByteBuf haystack, byte[] needle) { for (int i = haystack.readerIndex(); i < haystack.writerIndex(); i++) { int haystackIndex = i; int needleIndex; for (needleIndex = 0; needleIndex < needle.length; needleIndex++) { if (haystack.getByte(haystackIndex) != needle[needleIndex]) { break; } else { haystackIndex++; if (haystackIndex == haystack.writerIndex() && needleIndex != needle.length - 1) { return -1; } } } if (needleIndex == needle.length) { // Found the needle from the haystack! return i - haystack.readerIndex(); } } return -1; }
[ "private", "int", "indexOf", "(", "ByteBuf", "haystack", ",", "byte", "[", "]", "needle", ")", "{", "for", "(", "int", "i", "=", "haystack", ".", "readerIndex", "(", ")", ";", "i", "<", "haystack", ".", "writerIndex", "(", ")", ";", "i", "++", ")",...
Returns the number of bytes between the readerIndex of the haystack and the first needle found in the haystack. -1 is returned if no needle is found in the haystack. <p/> Copied from {@link io.netty.handler.codec.DelimiterBasedFrameDecoder}.
[ "Returns", "the", "number", "of", "bytes", "between", "the", "readerIndex", "of", "the", "haystack", "and", "the", "first", "needle", "found", "in", "the", "haystack", ".", "-", "1", "is", "returned", "if", "no", "needle", "is", "found", "in", "the", "ha...
train
https://github.com/cloudfoundry-community/java-nats/blob/f95de9f8f4ee7bf457898ab3bb37c8914b230304/client/src/main/java/nats/codec/AbstractFrameDecoder.java#L80-L102
MGunlogson/CuckooFilter4J
src/main/java/com/github/mgunlogson/cuckoofilter4j/FilterTable.java
FilterTable.insertToBucket
boolean insertToBucket(long bucketIndex, long tag) { for (int i = 0; i < CuckooFilter.BUCKET_SIZE; i++) { if (checkTag(bucketIndex, i, 0)) { writeTagNoClear(bucketIndex, i, tag); return true; } } return false; }
java
boolean insertToBucket(long bucketIndex, long tag) { for (int i = 0; i < CuckooFilter.BUCKET_SIZE; i++) { if (checkTag(bucketIndex, i, 0)) { writeTagNoClear(bucketIndex, i, tag); return true; } } return false; }
[ "boolean", "insertToBucket", "(", "long", "bucketIndex", ",", "long", "tag", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "CuckooFilter", ".", "BUCKET_SIZE", ";", "i", "++", ")", "{", "if", "(", "checkTag", "(", "bucketIndex", ",", "i",...
inserts a tag into an empty position in the chosen bucket. @param bucketIndex index @param tag tag @return true if insert succeeded(bucket not full)
[ "inserts", "a", "tag", "into", "an", "empty", "position", "in", "the", "chosen", "bucket", "." ]
train
https://github.com/MGunlogson/CuckooFilter4J/blob/e8472aa150b201f05046d1c81cac5a5ca4348db8/src/main/java/com/github/mgunlogson/cuckoofilter4j/FilterTable.java#L93-L102
landawn/AbacusUtil
src/com/landawn/abacus/util/DateUtil.java
DateUtil.addWeeks
public static <T extends java.util.Date> T addWeeks(final T date, final int amount) { return roll(date, amount, CalendarUnit.WEEK); }
java
public static <T extends java.util.Date> T addWeeks(final T date, final int amount) { return roll(date, amount, CalendarUnit.WEEK); }
[ "public", "static", "<", "T", "extends", "java", ".", "util", ".", "Date", ">", "T", "addWeeks", "(", "final", "T", "date", ",", "final", "int", "amount", ")", "{", "return", "roll", "(", "date", ",", "amount", ",", "CalendarUnit", ".", "WEEK", ")", ...
Adds a number of weeks to a date returning a new object. The original {@code Date} is unchanged. @param date the date, not null @param amount the amount to add, may be negative @return the new {@code Date} with the amount added @throws IllegalArgumentException if the date is null
[ "Adds", "a", "number", "of", "weeks", "to", "a", "date", "returning", "a", "new", "object", ".", "The", "original", "{", "@code", "Date", "}", "is", "unchanged", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/DateUtil.java#L979-L981
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.beginGetVpnProfilePackageUrl
public String beginGetVpnProfilePackageUrl(String resourceGroupName, String virtualNetworkGatewayName) { return beginGetVpnProfilePackageUrlWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).toBlocking().single().body(); }
java
public String beginGetVpnProfilePackageUrl(String resourceGroupName, String virtualNetworkGatewayName) { return beginGetVpnProfilePackageUrlWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).toBlocking().single().body(); }
[ "public", "String", "beginGetVpnProfilePackageUrl", "(", "String", "resourceGroupName", ",", "String", "virtualNetworkGatewayName", ")", "{", "return", "beginGetVpnProfilePackageUrlWithServiceResponseAsync", "(", "resourceGroupName", ",", "virtualNetworkGatewayName", ")", ".", ...
Gets pre-generated VPN profile for P2S client of the virtual network gateway in the specified resource group. The profile needs to be generated first using generateVpnProfile. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayName The name of the virtual network 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 String object if successful.
[ "Gets", "pre", "-", "generated", "VPN", "profile", "for", "P2S", "client", "of", "the", "virtual", "network", "gateway", "in", "the", "specified", "resource", "group", ".", "The", "profile", "needs", "to", "be", "generated", "first", "using", "generateVpnProfi...
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#L1866-L1868
facebookarchive/hadoop-20
src/core/org/apache/hadoop/io/UTF8.java
UTF8.getBytes
public static byte[] getBytes(String string) { byte[] result = new byte[utf8Length(string)]; try { // avoid sync'd allocations writeChars(result, string, 0, string.length()); } catch (IOException e) { throw new RuntimeException(e); } return result; }
java
public static byte[] getBytes(String string) { byte[] result = new byte[utf8Length(string)]; try { // avoid sync'd allocations writeChars(result, string, 0, string.length()); } catch (IOException e) { throw new RuntimeException(e); } return result; }
[ "public", "static", "byte", "[", "]", "getBytes", "(", "String", "string", ")", "{", "byte", "[", "]", "result", "=", "new", "byte", "[", "utf8Length", "(", "string", ")", "]", ";", "try", "{", "// avoid sync'd allocations", "writeChars", "(", "result", ...
Convert a string to a UTF-8 encoded byte array. @see String#getBytes(String)
[ "Convert", "a", "string", "to", "a", "UTF", "-", "8", "encoded", "byte", "array", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/UTF8.java#L259-L267
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/KeyEncoder.java
KeyEncoder.encodeDesc
public static int encodeDesc(Integer value, byte[] dst, int dstOffset) { if (value == null) { dst[dstOffset] = NULL_BYTE_LOW; return 1; } else { dst[dstOffset] = NOT_NULL_BYTE_LOW; DataEncoder.encode(~value.intValue(), dst, dstOffset + 1); return 5; } }
java
public static int encodeDesc(Integer value, byte[] dst, int dstOffset) { if (value == null) { dst[dstOffset] = NULL_BYTE_LOW; return 1; } else { dst[dstOffset] = NOT_NULL_BYTE_LOW; DataEncoder.encode(~value.intValue(), dst, dstOffset + 1); return 5; } }
[ "public", "static", "int", "encodeDesc", "(", "Integer", "value", ",", "byte", "[", "]", "dst", ",", "int", "dstOffset", ")", "{", "if", "(", "value", "==", "null", ")", "{", "dst", "[", "dstOffset", "]", "=", "NULL_BYTE_LOW", ";", "return", "1", ";"...
Encodes the given signed Integer object into exactly 1 or 5 bytes for descending order. If the Integer object is never expected to be null, consider encoding as an int primitive. @param value optional signed Integer value to encode @param dst destination for encoded bytes @param dstOffset offset into destination array @return amount of bytes written
[ "Encodes", "the", "given", "signed", "Integer", "object", "into", "exactly", "1", "or", "5", "bytes", "for", "descending", "order", ".", "If", "the", "Integer", "object", "is", "never", "expected", "to", "be", "null", "consider", "encoding", "as", "an", "i...
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/KeyEncoder.java#L62-L71
paylogic/java-fogbugz
src/main/java/org/paylogic/fogbugz/FogbugzManager.java
FogbugzManager.createMilestone
public boolean createMilestone(FogbugzMilestone milestone) { try { HashMap<String, String> params = new HashMap<String, String>(); // If id = 0, create new case. if (milestone.getId() != 0) { throw new Exception("Editing existing milestones is not supported, please set the id to 0."); } params.put("cmd", "newFixFor"); params.put("ixProject", "-1"); params.put("fAssignable", "1"); // 1 means true somehow... params.put("sFixFor", milestone.getName()); Document doc = this.getFogbugzDocument(params); FogbugzManager.log.info("Fogbugz response got when saving milestone: " + doc.toString()); // If we got this far, all is probably well. // TODO: parse XML that gets returned to check status furreal. return true; } catch (Exception e) { FogbugzManager.log.log(Level.SEVERE, "Exception while creating milestone " + milestone.getName(), e); } return false; }
java
public boolean createMilestone(FogbugzMilestone milestone) { try { HashMap<String, String> params = new HashMap<String, String>(); // If id = 0, create new case. if (milestone.getId() != 0) { throw new Exception("Editing existing milestones is not supported, please set the id to 0."); } params.put("cmd", "newFixFor"); params.put("ixProject", "-1"); params.put("fAssignable", "1"); // 1 means true somehow... params.put("sFixFor", milestone.getName()); Document doc = this.getFogbugzDocument(params); FogbugzManager.log.info("Fogbugz response got when saving milestone: " + doc.toString()); // If we got this far, all is probably well. // TODO: parse XML that gets returned to check status furreal. return true; } catch (Exception e) { FogbugzManager.log.log(Level.SEVERE, "Exception while creating milestone " + milestone.getName(), e); } return false; }
[ "public", "boolean", "createMilestone", "(", "FogbugzMilestone", "milestone", ")", "{", "try", "{", "HashMap", "<", "String", ",", "String", ">", "params", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "// If id = 0, create new case....
Creates new Milestone in Fogbugz. Please leave id of milestone object empty. Only creates global milestones. @param milestone to edit/create
[ "Creates", "new", "Milestone", "in", "Fogbugz", ".", "Please", "leave", "id", "of", "milestone", "object", "empty", ".", "Only", "creates", "global", "milestones", "." ]
train
https://github.com/paylogic/java-fogbugz/blob/75651d82b2476e9ba2a0805311e18ee36882c2df/src/main/java/org/paylogic/fogbugz/FogbugzManager.java#L456-L480
loldevs/riotapi
rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/SummonerTeamService.java
SummonerTeamService.createTeam
public Team createTeam(String name, String tag) { return client.sendRpcAndWait(SERVICE, "createTeam", name, tag); }
java
public Team createTeam(String name, String tag) { return client.sendRpcAndWait(SERVICE, "createTeam", name, tag); }
[ "public", "Team", "createTeam", "(", "String", "name", ",", "String", "tag", ")", "{", "return", "client", ".", "sendRpcAndWait", "(", "SERVICE", ",", "\"createTeam\"", ",", "name", ",", "tag", ")", ";", "}" ]
Create a new ranked team with the specified name and tag @param name The name @param tag The tag @return The created team
[ "Create", "a", "new", "ranked", "team", "with", "the", "specified", "name", "and", "tag" ]
train
https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/SummonerTeamService.java#L95-L97
b3log/latke
latke-core/src/main/java/org/b3log/latke/util/Locales.java
Locales.getLocale
public static Locale getLocale(final HttpServletRequest request) { Locale locale = null; // Gets from session final HttpSession session = request.getSession(false); if (session != null) { locale = (Locale) session.getAttribute(Keys.LOCALE); } if (null == locale) { // Gets from request header final String languageHeader = request.getHeader("Accept-Language"); LOGGER.log(Level.DEBUG, "[Accept-Language={0}]", languageHeader); String language = "zh"; String country = "CN"; if (StringUtils.isNotBlank(languageHeader)) { language = getLanguage(languageHeader); country = getCountry(languageHeader); } locale = new Locale(language, country); if (!hasLocale(locale)) { // Uses default locale = Latkes.getLocale(); LOGGER.log(Level.DEBUG, "Using the default locale[{0}]", locale.toString()); } else { LOGGER.log(Level.DEBUG, "Got locale[{0}] from request.", locale.toString()); } } else { LOGGER.log(Level.DEBUG, "Got locale[{0}] from session.", locale.toString()); } return locale; }
java
public static Locale getLocale(final HttpServletRequest request) { Locale locale = null; // Gets from session final HttpSession session = request.getSession(false); if (session != null) { locale = (Locale) session.getAttribute(Keys.LOCALE); } if (null == locale) { // Gets from request header final String languageHeader = request.getHeader("Accept-Language"); LOGGER.log(Level.DEBUG, "[Accept-Language={0}]", languageHeader); String language = "zh"; String country = "CN"; if (StringUtils.isNotBlank(languageHeader)) { language = getLanguage(languageHeader); country = getCountry(languageHeader); } locale = new Locale(language, country); if (!hasLocale(locale)) { // Uses default locale = Latkes.getLocale(); LOGGER.log(Level.DEBUG, "Using the default locale[{0}]", locale.toString()); } else { LOGGER.log(Level.DEBUG, "Got locale[{0}] from request.", locale.toString()); } } else { LOGGER.log(Level.DEBUG, "Got locale[{0}] from session.", locale.toString()); } return locale; }
[ "public", "static", "Locale", "getLocale", "(", "final", "HttpServletRequest", "request", ")", "{", "Locale", "locale", "=", "null", ";", "// Gets from session", "final", "HttpSession", "session", "=", "request", ".", "getSession", "(", "false", ")", ";", "if", ...
Gets locale with the specified request. <p> By the following steps: <ol> <li>Gets from session of the specified request</li> <li>Gets from the specified request header</li> <li>Using {@link Latkes#getLocale() server configuration}</li> </ol> @param request the specified request @return locale
[ "Gets", "locale", "with", "the", "specified", "request", ".", "<p", ">", "By", "the", "following", "steps", ":", "<ol", ">", "<li", ">", "Gets", "from", "session", "of", "the", "specified", "request<", "/", "li", ">", "<li", ">", "Gets", "from", "the",...
train
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Locales.java#L87-L125
Stratio/stratio-cassandra
src/java/org/apache/cassandra/hadoop/ConfigHelper.java
ConfigHelper.setInputRange
public static void setInputRange(Configuration conf, String startToken, String endToken) { KeyRange range = new KeyRange().setStart_token(startToken).setEnd_token(endToken); conf.set(INPUT_KEYRANGE_CONFIG, thriftToString(range)); }
java
public static void setInputRange(Configuration conf, String startToken, String endToken) { KeyRange range = new KeyRange().setStart_token(startToken).setEnd_token(endToken); conf.set(INPUT_KEYRANGE_CONFIG, thriftToString(range)); }
[ "public", "static", "void", "setInputRange", "(", "Configuration", "conf", ",", "String", "startToken", ",", "String", "endToken", ")", "{", "KeyRange", "range", "=", "new", "KeyRange", "(", ")", ".", "setStart_token", "(", "startToken", ")", ".", "setEnd_toke...
Set the KeyRange to limit the rows. @param conf Job configuration you are about to run
[ "Set", "the", "KeyRange", "to", "limit", "the", "rows", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/hadoop/ConfigHelper.java#L244-L248
google/error-prone
check_api/src/main/java/com/google/errorprone/matchers/Matchers.java
Matchers.isField
public static Matcher<VariableTree> isField() { return new Matcher<VariableTree>() { @Override public boolean matches(VariableTree variableTree, VisitorState state) { Element element = ASTHelpers.getSymbol(variableTree); return element.getKind() == ElementKind.FIELD; } }; }
java
public static Matcher<VariableTree> isField() { return new Matcher<VariableTree>() { @Override public boolean matches(VariableTree variableTree, VisitorState state) { Element element = ASTHelpers.getSymbol(variableTree); return element.getKind() == ElementKind.FIELD; } }; }
[ "public", "static", "Matcher", "<", "VariableTree", ">", "isField", "(", ")", "{", "return", "new", "Matcher", "<", "VariableTree", ">", "(", ")", "{", "@", "Override", "public", "boolean", "matches", "(", "VariableTree", "variableTree", ",", "VisitorState", ...
Matches if a {@link VariableTree} is a field declaration, as opposed to a local variable, enum constant, parameter to a method, etc.
[ "Matches", "if", "a", "{" ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/matchers/Matchers.java#L1099-L1107
Azure/azure-sdk-for-java
sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstancesInner.java
ManagedInstancesInner.beginUpdateAsync
public Observable<ManagedInstanceInner> beginUpdateAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).map(new Func1<ServiceResponse<ManagedInstanceInner>, ManagedInstanceInner>() { @Override public ManagedInstanceInner call(ServiceResponse<ManagedInstanceInner> response) { return response.body(); } }); }
java
public Observable<ManagedInstanceInner> beginUpdateAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).map(new Func1<ServiceResponse<ManagedInstanceInner>, ManagedInstanceInner>() { @Override public ManagedInstanceInner call(ServiceResponse<ManagedInstanceInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ManagedInstanceInner", ">", "beginUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "managedInstanceName", ",", "ManagedInstanceUpdate", "parameters", ")", "{", "return", "beginUpdateWithServiceResponseAsync", "(", "resourceGroupNa...
Updates a managed instance. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param managedInstanceName The name of the managed instance. @param parameters The requested managed instance resource state. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ManagedInstanceInner object
[ "Updates", "a", "managed", "instance", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstancesInner.java#L866-L873
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java
AppServicePlansInner.updateVnetRouteAsync
public Observable<VnetRouteInner> updateVnetRouteAsync(String resourceGroupName, String name, String vnetName, String routeName, VnetRouteInner route) { return updateVnetRouteWithServiceResponseAsync(resourceGroupName, name, vnetName, routeName, route).map(new Func1<ServiceResponse<VnetRouteInner>, VnetRouteInner>() { @Override public VnetRouteInner call(ServiceResponse<VnetRouteInner> response) { return response.body(); } }); }
java
public Observable<VnetRouteInner> updateVnetRouteAsync(String resourceGroupName, String name, String vnetName, String routeName, VnetRouteInner route) { return updateVnetRouteWithServiceResponseAsync(resourceGroupName, name, vnetName, routeName, route).map(new Func1<ServiceResponse<VnetRouteInner>, VnetRouteInner>() { @Override public VnetRouteInner call(ServiceResponse<VnetRouteInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VnetRouteInner", ">", "updateVnetRouteAsync", "(", "String", "resourceGroupName", ",", "String", "name", ",", "String", "vnetName", ",", "String", "routeName", ",", "VnetRouteInner", "route", ")", "{", "return", "updateVnetRouteWithServic...
Create or update a Virtual Network route in an App Service plan. Create or update a Virtual Network route in an App Service plan. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service plan. @param vnetName Name of the Virtual Network. @param routeName Name of the Virtual Network route. @param route Definition of the Virtual Network route. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VnetRouteInner object
[ "Create", "or", "update", "a", "Virtual", "Network", "route", "in", "an", "App", "Service", "plan", ".", "Create", "or", "update", "a", "Virtual", "Network", "route", "in", "an", "App", "Service", "plan", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java#L3844-L3851
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java
FeatureShapes.getFeatureShape
private FeatureShape getFeatureShape(Map<Long, FeatureShape> featureIds, long featureId) { FeatureShape featureShape = featureIds.get(featureId); if (featureShape == null) { featureShape = new FeatureShape(featureId); featureIds.put(featureId, featureShape); } return featureShape; }
java
private FeatureShape getFeatureShape(Map<Long, FeatureShape> featureIds, long featureId) { FeatureShape featureShape = featureIds.get(featureId); if (featureShape == null) { featureShape = new FeatureShape(featureId); featureIds.put(featureId, featureShape); } return featureShape; }
[ "private", "FeatureShape", "getFeatureShape", "(", "Map", "<", "Long", ",", "FeatureShape", ">", "featureIds", ",", "long", "featureId", ")", "{", "FeatureShape", "featureShape", "=", "featureIds", ".", "get", "(", "featureId", ")", ";", "if", "(", "featureSha...
Get the map shapes for the feature ids and feature id @param featureIds feature ids @param featureId feature id @return feature shape
[ "Get", "the", "map", "shapes", "for", "the", "feature", "ids", "and", "feature", "id" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java#L162-L170
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java
MethodBuilder.buildMethodDoc
public void buildMethodDoc(XMLNode node, Content memberDetailsTree) { if (writer == null) { return; } int size = methods.size(); if (size > 0) { Content methodDetailsTree = writer.getMethodDetailsTreeHeader( classDoc, memberDetailsTree); for (currentMethodIndex = 0; currentMethodIndex < size; currentMethodIndex++) { Content methodDocTree = writer.getMethodDocTreeHeader( (MethodDoc) methods.get(currentMethodIndex), methodDetailsTree); buildChildren(node, methodDocTree); methodDetailsTree.addContent(writer.getMethodDoc( methodDocTree, (currentMethodIndex == size - 1))); } memberDetailsTree.addContent( writer.getMethodDetails(methodDetailsTree)); } }
java
public void buildMethodDoc(XMLNode node, Content memberDetailsTree) { if (writer == null) { return; } int size = methods.size(); if (size > 0) { Content methodDetailsTree = writer.getMethodDetailsTreeHeader( classDoc, memberDetailsTree); for (currentMethodIndex = 0; currentMethodIndex < size; currentMethodIndex++) { Content methodDocTree = writer.getMethodDocTreeHeader( (MethodDoc) methods.get(currentMethodIndex), methodDetailsTree); buildChildren(node, methodDocTree); methodDetailsTree.addContent(writer.getMethodDoc( methodDocTree, (currentMethodIndex == size - 1))); } memberDetailsTree.addContent( writer.getMethodDetails(methodDetailsTree)); } }
[ "public", "void", "buildMethodDoc", "(", "XMLNode", "node", ",", "Content", "memberDetailsTree", ")", "{", "if", "(", "writer", "==", "null", ")", "{", "return", ";", "}", "int", "size", "=", "methods", ".", "size", "(", ")", ";", "if", "(", "size", ...
Build the method documentation. @param node the XML element that specifies which components to document @param memberDetailsTree the content tree to which the documentation will be added
[ "Build", "the", "method", "documentation", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java#L155-L175
resilience4j/resilience4j
resilience4j-metrics/src/main/java/io/github/resilience4j/metrics/RateLimiterMetrics.java
RateLimiterMetrics.ofIterable
public static RateLimiterMetrics ofIterable(String prefix, Iterable<RateLimiter> rateLimiters) { return new RateLimiterMetrics(prefix, rateLimiters); }
java
public static RateLimiterMetrics ofIterable(String prefix, Iterable<RateLimiter> rateLimiters) { return new RateLimiterMetrics(prefix, rateLimiters); }
[ "public", "static", "RateLimiterMetrics", "ofIterable", "(", "String", "prefix", ",", "Iterable", "<", "RateLimiter", ">", "rateLimiters", ")", "{", "return", "new", "RateLimiterMetrics", "(", "prefix", ",", "rateLimiters", ")", ";", "}" ]
Creates a new instance {@link RateLimiterMetrics} with an {@link Iterable} of rate limiters as a source. @param rateLimiters the rate limiters
[ "Creates", "a", "new", "instance", "{", "@link", "RateLimiterMetrics", "}", "with", "an", "{", "@link", "Iterable", "}", "of", "rate", "limiters", "as", "a", "source", "." ]
train
https://github.com/resilience4j/resilience4j/blob/fa843d30f531c00f0c3dc218b65a7f2bb51af336/resilience4j-metrics/src/main/java/io/github/resilience4j/metrics/RateLimiterMetrics.java#L102-L104
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.router_new_duration_GET
public OvhOrder router_new_duration_GET(String duration, String vrack) throws IOException { String qPath = "/order/router/new/{duration}"; StringBuilder sb = path(qPath, duration); query(sb, "vrack", vrack); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder router_new_duration_GET(String duration, String vrack) throws IOException { String qPath = "/order/router/new/{duration}"; StringBuilder sb = path(qPath, duration); query(sb, "vrack", vrack); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "router_new_duration_GET", "(", "String", "duration", ",", "String", "vrack", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/router/new/{duration}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "duration",...
Get prices and contracts information REST: GET /order/router/new/{duration} @param vrack [required] The name of your vrack @param duration [required] Duration
[ "Get", "prices", "and", "contracts", "information" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L925-L931
lucee/Lucee
core/src/main/java/lucee/transformer/library/tag/TagLibFactory.java
TagLibFactory.loadFromDirectory
public static TagLib[] loadFromDirectory(Resource dir, Identification id) throws TagLibException { if (!dir.isDirectory()) return new TagLib[0]; ArrayList<TagLib> arr = new ArrayList<TagLib>(); Resource[] files = dir.listResources(new ExtensionResourceFilter(new String[] { "tld", "tldx" })); for (int i = 0; i < files.length; i++) { if (files[i].isFile()) arr.add(TagLibFactory.loadFromFile(files[i], id)); } return arr.toArray(new TagLib[arr.size()]); }
java
public static TagLib[] loadFromDirectory(Resource dir, Identification id) throws TagLibException { if (!dir.isDirectory()) return new TagLib[0]; ArrayList<TagLib> arr = new ArrayList<TagLib>(); Resource[] files = dir.listResources(new ExtensionResourceFilter(new String[] { "tld", "tldx" })); for (int i = 0; i < files.length; i++) { if (files[i].isFile()) arr.add(TagLibFactory.loadFromFile(files[i], id)); } return arr.toArray(new TagLib[arr.size()]); }
[ "public", "static", "TagLib", "[", "]", "loadFromDirectory", "(", "Resource", "dir", ",", "Identification", "id", ")", "throws", "TagLibException", "{", "if", "(", "!", "dir", ".", "isDirectory", "(", ")", ")", "return", "new", "TagLib", "[", "0", "]", "...
Laedt mehrere TagLib's die innerhalb eines Verzeichnisses liegen. @param dir Verzeichnis im dem die TagLib's liegen. @param saxParser Definition des Sax Parser mit dem die TagLib's eingelesen werden sollen. @return TagLib's als Array @throws TagLibException
[ "Laedt", "mehrere", "TagLib", "s", "die", "innerhalb", "eines", "Verzeichnisses", "liegen", "." ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/library/tag/TagLibFactory.java#L469-L479
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/internal/PageFlowTagUtils.java
PageFlowTagUtils.getToken
public static String getToken(HttpServletRequest request, String action) { FlowController flowController = PageFlowUtils.getCurrentPageFlow(request); if (flowController != null) { MappingAndController mac = getActionMapping(request, flowController, action); if (mac != null) return getToken(request, mac.mapping); } return null; }
java
public static String getToken(HttpServletRequest request, String action) { FlowController flowController = PageFlowUtils.getCurrentPageFlow(request); if (flowController != null) { MappingAndController mac = getActionMapping(request, flowController, action); if (mac != null) return getToken(request, mac.mapping); } return null; }
[ "public", "static", "String", "getToken", "(", "HttpServletRequest", "request", ",", "String", "action", ")", "{", "FlowController", "flowController", "=", "PageFlowUtils", ".", "getCurrentPageFlow", "(", "request", ")", ";", "if", "(", "flowController", "!=", "nu...
Get or generate a token used to prevent double submits to an action. The token is stored in the session, and checked (and removed) when processing an action with the <code>preventDoubleSubmit</code> attribute set to <code>true</code>.
[ "Get", "or", "generate", "a", "token", "used", "to", "prevent", "double", "submits", "to", "an", "action", ".", "The", "token", "is", "stored", "in", "the", "session", "and", "checked", "(", "and", "removed", ")", "when", "processing", "an", "action", "w...
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/internal/PageFlowTagUtils.java#L144-L154
Whiley/WhileyCompiler
src/main/java/wyil/type/util/TypeSubtractor.java
TypeSubtractor.countFieldMatches
private int countFieldMatches(Tuple<Type.Field> lhsFields, Tuple<Type.Field> rhsFields) { int matches = 0; for (int i = 0; i != lhsFields.size(); ++i) { Type.Field lhsField = lhsFields.get(i); Identifier lhsFieldName = lhsField.getName(); for (int j = 0; j != rhsFields.size(); ++j) { Type.Field rhsField = rhsFields.get(j); Identifier rhsFieldName = rhsField.getName(); if (lhsFieldName.equals(rhsFieldName)) { matches++; break; } } } return matches; }
java
private int countFieldMatches(Tuple<Type.Field> lhsFields, Tuple<Type.Field> rhsFields) { int matches = 0; for (int i = 0; i != lhsFields.size(); ++i) { Type.Field lhsField = lhsFields.get(i); Identifier lhsFieldName = lhsField.getName(); for (int j = 0; j != rhsFields.size(); ++j) { Type.Field rhsField = rhsFields.get(j); Identifier rhsFieldName = rhsField.getName(); if (lhsFieldName.equals(rhsFieldName)) { matches++; break; } } } return matches; }
[ "private", "int", "countFieldMatches", "(", "Tuple", "<", "Type", ".", "Field", ">", "lhsFields", ",", "Tuple", "<", "Type", ".", "Field", ">", "rhsFields", ")", "{", "int", "matches", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "!="...
Simply count the number of fields in the lhs which match a field in the rhs. This provides critical information. For example, when subtracting <code>{int f, int g}</code> from <code>{int f, int h}</code> it is apparent that not all fields in the lhs are matched. @param lhsFields @param rhsFields @return
[ "Simply", "count", "the", "number", "of", "fields", "in", "the", "lhs", "which", "match", "a", "field", "in", "the", "rhs", ".", "This", "provides", "critical", "information", ".", "For", "example", "when", "subtracting", "<code", ">", "{", "int", "f", "...
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/type/util/TypeSubtractor.java#L155-L170
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/FindBugs2.java
FindBugs2.logRecoverableException
private void logRecoverableException(ClassDescriptor classDescriptor, Detector2 detector, Throwable e) { bugReporter.logError( "Exception analyzing " + classDescriptor.toDottedClassName() + " using detector " + detector.getDetectorClassName(), e); }
java
private void logRecoverableException(ClassDescriptor classDescriptor, Detector2 detector, Throwable e) { bugReporter.logError( "Exception analyzing " + classDescriptor.toDottedClassName() + " using detector " + detector.getDetectorClassName(), e); }
[ "private", "void", "logRecoverableException", "(", "ClassDescriptor", "classDescriptor", ",", "Detector2", "detector", ",", "Throwable", "e", ")", "{", "bugReporter", ".", "logError", "(", "\"Exception analyzing \"", "+", "classDescriptor", ".", "toDottedClassName", "("...
Report an exception that occurred while analyzing a class with a detector. @param classDescriptor class being analyzed @param detector detector doing the analysis @param e the exception
[ "Report", "an", "exception", "that", "occurred", "while", "analyzing", "a", "class", "with", "a", "detector", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/FindBugs2.java#L1159-L1163
fozziethebeat/S-Space
src/main/java/edu/ucla/sspace/util/TimeSpan.java
TimeSpan.insideRange
public boolean insideRange(long startDate, long endDate) { Calendar c1 = Calendar.getInstance(); Calendar c2 = Calendar.getInstance(); c1.setTimeInMillis(startDate); c2.setTimeInMillis(endDate); return isInRange(c1, c2); }
java
public boolean insideRange(long startDate, long endDate) { Calendar c1 = Calendar.getInstance(); Calendar c2 = Calendar.getInstance(); c1.setTimeInMillis(startDate); c2.setTimeInMillis(endDate); return isInRange(c1, c2); }
[ "public", "boolean", "insideRange", "(", "long", "startDate", ",", "long", "endDate", ")", "{", "Calendar", "c1", "=", "Calendar", ".", "getInstance", "(", ")", ";", "Calendar", "c2", "=", "Calendar", ".", "getInstance", "(", ")", ";", "c1", ".", "setTim...
Returns {@code true} if the end date occurs after the start date during the period of time represented by this time span.
[ "Returns", "{" ]
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/util/TimeSpan.java#L358-L364
davidcarboni-archive/httpino
src/main/java/com/github/davidcarboni/httpino/Http.java
Http.deserialiseResponseMessage
protected <T> T deserialiseResponseMessage(CloseableHttpResponse response, Class<T> responseClass) throws IOException { T body = null; HttpEntity entity = response.getEntity(); if (entity != null && responseClass != null) { try (InputStream inputStream = entity.getContent()) { try { body = Serialiser.deserialise(inputStream, responseClass); } catch (JsonSyntaxException e) { // This can happen if an error HTTP code is received and the // body of the response doesn't contain the expected object: body = null; } } } else { EntityUtils.consume(entity); } return body; }
java
protected <T> T deserialiseResponseMessage(CloseableHttpResponse response, Class<T> responseClass) throws IOException { T body = null; HttpEntity entity = response.getEntity(); if (entity != null && responseClass != null) { try (InputStream inputStream = entity.getContent()) { try { body = Serialiser.deserialise(inputStream, responseClass); } catch (JsonSyntaxException e) { // This can happen if an error HTTP code is received and the // body of the response doesn't contain the expected object: body = null; } } } else { EntityUtils.consume(entity); } return body; }
[ "protected", "<", "T", ">", "T", "deserialiseResponseMessage", "(", "CloseableHttpResponse", "response", ",", "Class", "<", "T", ">", "responseClass", ")", "throws", "IOException", "{", "T", "body", "=", "null", ";", "HttpEntity", "entity", "=", "response", "....
Deserialises the given {@link CloseableHttpResponse} to the specified type. @param response The response. @param responseClass The type to deserialise to. This can be null, in which case {@link EntityUtils#consume(HttpEntity)} will be used to consume the response body (if any). @param <T> The type to deserialise to. @return The deserialised response, or null if the response does not contain an entity. @throws IOException If an error occurs.
[ "Deserialises", "the", "given", "{", "@link", "CloseableHttpResponse", "}", "to", "the", "specified", "type", "." ]
train
https://github.com/davidcarboni-archive/httpino/blob/a78c91874e6d9b2e452cf3aa68d4fea804d977ca/src/main/java/com/github/davidcarboni/httpino/Http.java#L475-L494
openbase/jul
exception/src/main/java/org/openbase/jul/exception/StackTracePrinter.java
StackTracePrinter.printAllStackTrackes
@Deprecated public static void printAllStackTrackes(final Logger logger, final LogLevel logLevel) { printAllStackTraces(null, logger, logLevel); }
java
@Deprecated public static void printAllStackTrackes(final Logger logger, final LogLevel logLevel) { printAllStackTraces(null, logger, logLevel); }
[ "@", "Deprecated", "public", "static", "void", "printAllStackTrackes", "(", "final", "Logger", "logger", ",", "final", "LogLevel", "logLevel", ")", "{", "printAllStackTraces", "(", "null", ",", "logger", ",", "logLevel", ")", ";", "}" ]
Marked as deprecated because of the erroneous name. Call printAllStackTraces instead. @param logger the logger used for printing. @param logLevel the level to print.
[ "Marked", "as", "deprecated", "because", "of", "the", "erroneous", "name", ".", "Call", "printAllStackTraces", "instead", "." ]
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/exception/src/main/java/org/openbase/jul/exception/StackTracePrinter.java#L116-L119
hdbeukel/james-core
src/main/java/org/jamesframework/core/subset/algo/LRSubsetSearch.java
LRSubsetSearch.greedyMoves
private int greedyMoves(int n, SubsetNeighbourhood neigh){ int applied = 0; boolean cont = true; while(applied < n && cont){ // go through all moves to find the best one Move<? super SubsetSolution> bestMove = null; double bestDelta = -Double.MAX_VALUE, delta; Evaluation newEvaluation, bestEvaluation = null; SubsetValidation newValidation, bestValidation = null; for(Move<? super SubsetSolution> move : neigh.getAllMoves(getCurrentSolution())){ // validate move (IMPORTANT: ignore current subset size) newValidation = getProblem().validate(move, getCurrentSolution(), getCurrentSolutionValidation()); if(newValidation.passed(false)){ // evaluate move newEvaluation = getProblem().evaluate(move, getCurrentSolution(), getCurrentSolutionEvaluation()); // compute delta delta = computeDelta(newEvaluation, getCurrentSolutionEvaluation()); // new best move? if(delta > bestDelta){ bestDelta = delta; bestMove = move; bestEvaluation = newEvaluation; bestValidation = newValidation; } } } // apply best move, if any if(bestMove != null){ // apply move bestMove.apply(getCurrentSolution()); // update current and best solution (NOTe: best solution will only be updated // if it is fully valid, also taking into account the current subset size) updateCurrentAndBestSolution(getCurrentSolution(), bestEvaluation, bestValidation); // increase counter applied++; } else { // no valid move found, stop cont = false; } } // return actual number of applied moves return applied; }
java
private int greedyMoves(int n, SubsetNeighbourhood neigh){ int applied = 0; boolean cont = true; while(applied < n && cont){ // go through all moves to find the best one Move<? super SubsetSolution> bestMove = null; double bestDelta = -Double.MAX_VALUE, delta; Evaluation newEvaluation, bestEvaluation = null; SubsetValidation newValidation, bestValidation = null; for(Move<? super SubsetSolution> move : neigh.getAllMoves(getCurrentSolution())){ // validate move (IMPORTANT: ignore current subset size) newValidation = getProblem().validate(move, getCurrentSolution(), getCurrentSolutionValidation()); if(newValidation.passed(false)){ // evaluate move newEvaluation = getProblem().evaluate(move, getCurrentSolution(), getCurrentSolutionEvaluation()); // compute delta delta = computeDelta(newEvaluation, getCurrentSolutionEvaluation()); // new best move? if(delta > bestDelta){ bestDelta = delta; bestMove = move; bestEvaluation = newEvaluation; bestValidation = newValidation; } } } // apply best move, if any if(bestMove != null){ // apply move bestMove.apply(getCurrentSolution()); // update current and best solution (NOTe: best solution will only be updated // if it is fully valid, also taking into account the current subset size) updateCurrentAndBestSolution(getCurrentSolution(), bestEvaluation, bestValidation); // increase counter applied++; } else { // no valid move found, stop cont = false; } } // return actual number of applied moves return applied; }
[ "private", "int", "greedyMoves", "(", "int", "n", ",", "SubsetNeighbourhood", "neigh", ")", "{", "int", "applied", "=", "0", ";", "boolean", "cont", "=", "true", ";", "while", "(", "applied", "<", "n", "&&", "cont", ")", "{", "// go through all moves to fi...
Greedily apply a series of n moves generated by the given neighbourhood, where the move yielding the most improvement (or smallest decline) is iteratively selected. Returns the actual number of performed moves, which is always lower than or equal to the requested number of moves. It may be strictly lower in case no more moves can be applied at some point. @param n number of requested moves @return actual number of applied moves, lower than or equal to requested number of moves
[ "Greedily", "apply", "a", "series", "of", "n", "moves", "generated", "by", "the", "given", "neighbourhood", "where", "the", "move", "yielding", "the", "most", "improvement", "(", "or", "smallest", "decline", ")", "is", "iteratively", "selected", ".", "Returns"...
train
https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/subset/algo/LRSubsetSearch.java#L235-L277
jMetal/jMetal
jmetal-core/src/main/java/org/uma/jmetal/util/SolutionUtils.java
SolutionUtils.getBestSolution
public static <S extends Solution<?>> S getBestSolution(S solution1, S solution2, Comparator<S> comparator, BinaryOperator<S> equalityPolicy) { S result; int flag = comparator.compare(solution1, solution2); if (flag == -1) { result = solution1; } else if (flag == 1) { result = solution2; } else { result = equalityPolicy.apply(solution1, solution2); } return result; }
java
public static <S extends Solution<?>> S getBestSolution(S solution1, S solution2, Comparator<S> comparator, BinaryOperator<S> equalityPolicy) { S result; int flag = comparator.compare(solution1, solution2); if (flag == -1) { result = solution1; } else if (flag == 1) { result = solution2; } else { result = equalityPolicy.apply(solution1, solution2); } return result; }
[ "public", "static", "<", "S", "extends", "Solution", "<", "?", ">", ">", "S", "getBestSolution", "(", "S", "solution1", ",", "S", "solution2", ",", "Comparator", "<", "S", ">", "comparator", ",", "BinaryOperator", "<", "S", ">", "equalityPolicy", ")", "{...
Return the best solution between those passed as arguments. If they are equal or incomparable one of them is chosen based on the given policy. @return The best solution
[ "Return", "the", "best", "solution", "between", "those", "passed", "as", "arguments", ".", "If", "they", "are", "equal", "or", "incomparable", "one", "of", "them", "is", "chosen", "based", "on", "the", "given", "policy", "." ]
train
https://github.com/jMetal/jMetal/blob/bc981e6aede275d26c5216c9a01227d9675b0cf7/jmetal-core/src/main/java/org/uma/jmetal/util/SolutionUtils.java#L44-L56
spring-projects/spring-android
spring-android-rest-template/src/main/java/org/springframework/http/client/HttpComponentsAndroidClientHttpRequestFactory.java
HttpComponentsAndroidClientHttpRequestFactory.createHttpRequest
protected HttpUriRequest createHttpRequest(HttpMethod httpMethod, URI uri) { switch (httpMethod) { case GET: return new HttpGet(uri); case DELETE: return new HttpDelete(uri); case HEAD: return new HttpHead(uri); case OPTIONS: return new HttpOptions(uri); case POST: return new HttpPost(uri); case PUT: return new HttpPut(uri); case TRACE: return new HttpTrace(uri); default: throw new IllegalArgumentException("Invalid HTTP method: " + httpMethod); } }
java
protected HttpUriRequest createHttpRequest(HttpMethod httpMethod, URI uri) { switch (httpMethod) { case GET: return new HttpGet(uri); case DELETE: return new HttpDelete(uri); case HEAD: return new HttpHead(uri); case OPTIONS: return new HttpOptions(uri); case POST: return new HttpPost(uri); case PUT: return new HttpPut(uri); case TRACE: return new HttpTrace(uri); default: throw new IllegalArgumentException("Invalid HTTP method: " + httpMethod); } }
[ "protected", "HttpUriRequest", "createHttpRequest", "(", "HttpMethod", "httpMethod", ",", "URI", "uri", ")", "{", "switch", "(", "httpMethod", ")", "{", "case", "GET", ":", "return", "new", "HttpGet", "(", "uri", ")", ";", "case", "DELETE", ":", "return", ...
Create a HttpComponents HttpUriRequest object for the given HTTP method and URI specification. @param httpMethod the HTTP method @param uri the URI @return the HttpComponents HttpUriRequest object
[ "Create", "a", "HttpComponents", "HttpUriRequest", "object", "for", "the", "given", "HTTP", "method", "and", "URI", "specification", "." ]
train
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/http/client/HttpComponentsAndroidClientHttpRequestFactory.java#L147-L166
apache/flink
flink-core/src/main/java/org/apache/flink/core/io/SimpleVersionedSerialization.java
SimpleVersionedSerialization.readVersionAndDeSerialize
public static <T> T readVersionAndDeSerialize(SimpleVersionedSerializer<T> serializer, byte[] bytes) throws IOException { checkNotNull(serializer, "serializer"); checkNotNull(bytes, "bytes"); checkArgument(bytes.length >= 4, "byte array below minimum length (4 bytes)"); final byte[] dataOnly = Arrays.copyOfRange(bytes, 8, bytes.length); final int version = ((bytes[0] & 0xff) << 24) | ((bytes[1] & 0xff) << 16) | ((bytes[2] & 0xff) << 8) | (bytes[3] & 0xff); final int length = ((bytes[4] & 0xff) << 24) | ((bytes[5] & 0xff) << 16) | ((bytes[6] & 0xff) << 8) | (bytes[7] & 0xff); if (length == dataOnly.length) { return serializer.deserialize(version, dataOnly); } else { throw new IOException("Corrupt data, conflicting lengths. Length fields: " + length + ", data: " + dataOnly.length); } }
java
public static <T> T readVersionAndDeSerialize(SimpleVersionedSerializer<T> serializer, byte[] bytes) throws IOException { checkNotNull(serializer, "serializer"); checkNotNull(bytes, "bytes"); checkArgument(bytes.length >= 4, "byte array below minimum length (4 bytes)"); final byte[] dataOnly = Arrays.copyOfRange(bytes, 8, bytes.length); final int version = ((bytes[0] & 0xff) << 24) | ((bytes[1] & 0xff) << 16) | ((bytes[2] & 0xff) << 8) | (bytes[3] & 0xff); final int length = ((bytes[4] & 0xff) << 24) | ((bytes[5] & 0xff) << 16) | ((bytes[6] & 0xff) << 8) | (bytes[7] & 0xff); if (length == dataOnly.length) { return serializer.deserialize(version, dataOnly); } else { throw new IOException("Corrupt data, conflicting lengths. Length fields: " + length + ", data: " + dataOnly.length); } }
[ "public", "static", "<", "T", ">", "T", "readVersionAndDeSerialize", "(", "SimpleVersionedSerializer", "<", "T", ">", "serializer", ",", "byte", "[", "]", "bytes", ")", "throws", "IOException", "{", "checkNotNull", "(", "serializer", ",", "\"serializer\"", ")", ...
Deserializes the version and datum from a byte array. The first four bytes will be read as the version, in <i>big-endian</i> encoding. The remaining bytes will be passed to the serializer for deserialization, via {@link SimpleVersionedSerializer#deserialize(int, byte[])}. @param serializer The serializer to deserialize the datum with. @param bytes The bytes to deserialize from. @return The deserialized datum. @throws IOException Exceptions from the {@link SimpleVersionedSerializer#deserialize(int, byte[])} method are forwarded.
[ "Deserializes", "the", "version", "and", "datum", "from", "a", "byte", "array", ".", "The", "first", "four", "bytes", "will", "be", "read", "as", "the", "version", "in", "<i", ">", "big", "-", "endian<", "/", "i", ">", "encoding", ".", "The", "remainin...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/io/SimpleVersionedSerialization.java#L146-L170
Patreon/patreon-java
src/main/java/com/patreon/PatreonAPI.java
PatreonAPI.fetchPageOfPledges
public JSONAPIDocument<List<Pledge>> fetchPageOfPledges(String campaignId, int pageSize, String pageCursor) throws IOException { return fetchPageOfPledges(campaignId, pageSize, pageCursor, null); }
java
public JSONAPIDocument<List<Pledge>> fetchPageOfPledges(String campaignId, int pageSize, String pageCursor) throws IOException { return fetchPageOfPledges(campaignId, pageSize, pageCursor, null); }
[ "public", "JSONAPIDocument", "<", "List", "<", "Pledge", ">", ">", "fetchPageOfPledges", "(", "String", "campaignId", ",", "int", "pageSize", ",", "String", "pageCursor", ")", "throws", "IOException", "{", "return", "fetchPageOfPledges", "(", "campaignId", ",", ...
Retrieve pledges for the specified campaign @param campaignId id for campaign to retrieve @param pageSize how many pledges to return @param pageCursor A cursor retreived from a previous API call, or null for the initial page. See {@link #getNextCursorFromDocument(JSONAPIDocument)} @return the page of pledges @throws IOException Thrown when the GET request failed
[ "Retrieve", "pledges", "for", "the", "specified", "campaign" ]
train
https://github.com/Patreon/patreon-java/blob/669104b3389f19635ffab75c593db9c022334092/src/main/java/com/patreon/PatreonAPI.java#L128-L130
QSFT/Doradus
doradus-dynamodb/src/main/java/com/dell/doradus/db/dynamodb/DDBTransaction.java
DDBTransaction.mapColumnValue
private AttributeValue mapColumnValue(String storeName, DColumn col) { AttributeValue attrValue = new AttributeValue(); if (!DBService.isSystemTable(storeName)) { if (col.getRawValue().length == 0) { attrValue.setS(DynamoDBService.NULL_COLUMN_MARKER); } else { attrValue.setB(ByteBuffer.wrap(col.getRawValue())); } } else { String strValue = col.getValue(); if (strValue.length() == 0) { strValue = DynamoDBService.NULL_COLUMN_MARKER; } attrValue.setS(strValue); } return attrValue; }
java
private AttributeValue mapColumnValue(String storeName, DColumn col) { AttributeValue attrValue = new AttributeValue(); if (!DBService.isSystemTable(storeName)) { if (col.getRawValue().length == 0) { attrValue.setS(DynamoDBService.NULL_COLUMN_MARKER); } else { attrValue.setB(ByteBuffer.wrap(col.getRawValue())); } } else { String strValue = col.getValue(); if (strValue.length() == 0) { strValue = DynamoDBService.NULL_COLUMN_MARKER; } attrValue.setS(strValue); } return attrValue; }
[ "private", "AttributeValue", "mapColumnValue", "(", "String", "storeName", ",", "DColumn", "col", ")", "{", "AttributeValue", "attrValue", "=", "new", "AttributeValue", "(", ")", ";", "if", "(", "!", "DBService", ".", "isSystemTable", "(", "storeName", ")", ")...
Create the appropriate AttributeValue for the given column value type and length.
[ "Create", "the", "appropriate", "AttributeValue", "for", "the", "given", "column", "value", "type", "and", "length", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-dynamodb/src/main/java/com/dell/doradus/db/dynamodb/DDBTransaction.java#L120-L136
lucee/Lucee
core/src/main/java/lucee/runtime/text/xml/XMLCaster.java
XMLCaster.toNode
@Deprecated public static Node toNode(Object o) throws PageException { if (o instanceof XMLStruct) return ((XMLStruct) o).toNode(); if (o instanceof Node) return (Node) o; throw new CasterException(o, "node"); }
java
@Deprecated public static Node toNode(Object o) throws PageException { if (o instanceof XMLStruct) return ((XMLStruct) o).toNode(); if (o instanceof Node) return (Node) o; throw new CasterException(o, "node"); }
[ "@", "Deprecated", "public", "static", "Node", "toNode", "(", "Object", "o", ")", "throws", "PageException", "{", "if", "(", "o", "instanceof", "XMLStruct", ")", "return", "(", "(", "XMLStruct", ")", "o", ")", ".", "toNode", "(", ")", ";", "if", "(", ...
casts a value to a XML Node @param doc XML Document @param o Object to cast @return XML Element Object @throws PageException @deprecated replaced with toRawNode
[ "casts", "a", "value", "to", "a", "XML", "Node" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/text/xml/XMLCaster.java#L331-L336
watson-developer-cloud/java-sdk
text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/util/WaveUtils.java
WaveUtils.writeInt
private static void writeInt(int value, byte[] array, int offset) { for (int i = 0; i < 4; i++) { array[offset + i] = (byte) (value >>> (8 * i)); } }
java
private static void writeInt(int value, byte[] array, int offset) { for (int i = 0; i < 4; i++) { array[offset + i] = (byte) (value >>> (8 * i)); } }
[ "private", "static", "void", "writeInt", "(", "int", "value", ",", "byte", "[", "]", "array", ",", "int", "offset", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "4", ";", "i", "++", ")", "{", "array", "[", "offset", "+", "i", "]...
Writes an number into an array using 4 bytes. @param value the number to write @param array the byte array @param offset the offset
[ "Writes", "an", "number", "into", "an", "array", "using", "4", "bytes", "." ]
train
https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/util/WaveUtils.java#L46-L50
schallee/alib4j
core/src/main/java/net/darkmist/alib/res/PkgRes.java
PkgRes.getResourcePathFor
public static String getResourcePathFor(CharSequence name, Object obj) { if(obj == null) throw new NullPointerException("obj is null"); return getResourcePathFor(name,obj.getClass()); }
java
public static String getResourcePathFor(CharSequence name, Object obj) { if(obj == null) throw new NullPointerException("obj is null"); return getResourcePathFor(name,obj.getClass()); }
[ "public", "static", "String", "getResourcePathFor", "(", "CharSequence", "name", ",", "Object", "obj", ")", "{", "if", "(", "obj", "==", "null", ")", "throw", "new", "NullPointerException", "(", "\"obj is null\"", ")", ";", "return", "getResourcePathFor", "(", ...
Gets a resource path using obj's class's package name as the prefix. @param name The name of the resource. @param obj The object to use for the package name @return Path of a resource prefixed by obj's class package name. @throws NullPointerException if name or obj are null.
[ "Gets", "a", "resource", "path", "using", "obj", "s", "class", "s", "package", "name", "as", "the", "prefix", "." ]
train
https://github.com/schallee/alib4j/blob/0e0718aee574bbb62268e1cf58e99286529ce529/core/src/main/java/net/darkmist/alib/res/PkgRes.java#L216-L221
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/ConcurrentServiceReferenceSetMap.java
ConcurrentServiceReferenceSetMap.removeReference
public boolean removeReference(K key, ServiceReference<V> reference) { if (key == null) return false; ConcurrentServiceReferenceSet<V> csrs = elementMap.get(key); if (csrs == null) { return false; } return csrs.removeReference(reference); }
java
public boolean removeReference(K key, ServiceReference<V> reference) { if (key == null) return false; ConcurrentServiceReferenceSet<V> csrs = elementMap.get(key); if (csrs == null) { return false; } return csrs.removeReference(reference); }
[ "public", "boolean", "removeReference", "(", "K", "key", ",", "ServiceReference", "<", "V", ">", "reference", ")", "{", "if", "(", "key", "==", "null", ")", "return", "false", ";", "ConcurrentServiceReferenceSet", "<", "V", ">", "csrs", "=", "elementMap", ...
Removes the reference associated with the key. @param key Key associated with this reference @param reference ServiceReference for the target service @return true if reference was unset (not previously replaced)
[ "Removes", "the", "reference", "associated", "with", "the", "key", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/ConcurrentServiceReferenceSetMap.java#L142-L151
operasoftware/operaprestodriver
src/com/opera/core/systems/runner/launcher/OperaLauncherProtocol.java
OperaLauncherProtocol.sendRequestHeader
private void sendRequestHeader(MessageType type, int size) throws IOException { ByteBuffer buf = ByteBuffer.allocate(8); buf.order(ByteOrder.BIG_ENDIAN); buf.put((byte) 'L'); buf.put((byte) '1'); buf.put(type.getValue()); buf.put((byte) 0); // request buf.putInt(size); buf.flip(); logger.finest("SEND: type=" + (0) + ", command=" + ((int) type.getValue()) + ", size=" + size); os.write(buf.array()); }
java
private void sendRequestHeader(MessageType type, int size) throws IOException { ByteBuffer buf = ByteBuffer.allocate(8); buf.order(ByteOrder.BIG_ENDIAN); buf.put((byte) 'L'); buf.put((byte) '1'); buf.put(type.getValue()); buf.put((byte) 0); // request buf.putInt(size); buf.flip(); logger.finest("SEND: type=" + (0) + ", command=" + ((int) type.getValue()) + ", size=" + size); os.write(buf.array()); }
[ "private", "void", "sendRequestHeader", "(", "MessageType", "type", ",", "int", "size", ")", "throws", "IOException", "{", "ByteBuffer", "buf", "=", "ByteBuffer", ".", "allocate", "(", "8", ")", ";", "buf", ".", "order", "(", "ByteOrder", ".", "BIG_ENDIAN", ...
Send the 8 byte header before a Opera Launcher message body (payload). @param type the payload type to be sent after @param size size of the payload following the header @throws IOException if socket send error or protocol parse error
[ "Send", "the", "8", "byte", "header", "before", "a", "Opera", "Launcher", "message", "body", "(", "payload", ")", "." ]
train
https://github.com/operasoftware/operaprestodriver/blob/1ccceda80f1c1a0489171d17dcaa6e7b18fb4c01/src/com/opera/core/systems/runner/launcher/OperaLauncherProtocol.java#L127-L138
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/domain/RemoteDomainProvider.java
RemoteDomainProvider.loadRepresentativeDomainAssignments
private void loadRepresentativeDomainAssignments() throws IOException { AssignmentXMLSerializer results = null; try { URL u = new URL(url + "getRepresentativeDomains"); logger.info("Fetching {}",u); InputStream response = URLConnectionTools.getInputStream(u); String xml = JFatCatClient.convertStreamToString(response); results = AssignmentXMLSerializer.fromXML(xml); Map<String,String> data = results.getAssignments(); logger.info("got {} ranges from server.",data.size()); for (String key: data.keySet()){ String range = data.get(key); // work around list in results; String[] spl = range.split(","); SortedSet<String> value = new TreeSet<String>(); for (String s : spl){ value.add(s); } serializedCache.put(key, value); } } catch (MalformedURLException e){ logger.error("Malformed Domain server: "+url,e); throw new IllegalArgumentException("Invalid Server: "+url, e); } }
java
private void loadRepresentativeDomainAssignments() throws IOException { AssignmentXMLSerializer results = null; try { URL u = new URL(url + "getRepresentativeDomains"); logger.info("Fetching {}",u); InputStream response = URLConnectionTools.getInputStream(u); String xml = JFatCatClient.convertStreamToString(response); results = AssignmentXMLSerializer.fromXML(xml); Map<String,String> data = results.getAssignments(); logger.info("got {} ranges from server.",data.size()); for (String key: data.keySet()){ String range = data.get(key); // work around list in results; String[] spl = range.split(","); SortedSet<String> value = new TreeSet<String>(); for (String s : spl){ value.add(s); } serializedCache.put(key, value); } } catch (MalformedURLException e){ logger.error("Malformed Domain server: "+url,e); throw new IllegalArgumentException("Invalid Server: "+url, e); } }
[ "private", "void", "loadRepresentativeDomainAssignments", "(", ")", "throws", "IOException", "{", "AssignmentXMLSerializer", "results", "=", "null", ";", "try", "{", "URL", "u", "=", "new", "URL", "(", "url", "+", "\"getRepresentativeDomains\"", ")", ";", "logger"...
Requests the domain assignments for the current PDB IDs from the PDB. @throws IOException if the server cannot be reached
[ "Requests", "the", "domain", "assignments", "for", "the", "current", "PDB", "IDs", "from", "the", "PDB", ".", "@throws", "IOException", "if", "the", "server", "cannot", "be", "reached" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/domain/RemoteDomainProvider.java#L97-L127
atomix/catalyst
common/src/main/java/io/atomix/catalyst/util/PropertiesReader.java
PropertiesReader.getEnum
public <T extends Enum<T>> T getEnum(String property, Class<T> type) { return Enum.valueOf(type, getString(property)); }
java
public <T extends Enum<T>> T getEnum(String property, Class<T> type) { return Enum.valueOf(type, getString(property)); }
[ "public", "<", "T", "extends", "Enum", "<", "T", ">", ">", "T", "getEnum", "(", "String", "property", ",", "Class", "<", "T", ">", "type", ")", "{", "return", "Enum", ".", "valueOf", "(", "type", ",", "getString", "(", "property", ")", ")", ";", ...
Reads an enum property. @param property The property name. @param type The enum type. @param <T> The enum type. @return The property value. @throws ConfigurationException if the property is not present
[ "Reads", "an", "enum", "property", "." ]
train
https://github.com/atomix/catalyst/blob/140e762cb975cd8ee1fd85119043c5b8bf917c5c/common/src/main/java/io/atomix/catalyst/util/PropertiesReader.java#L202-L204
gallandarakhneorg/afc
core/maths/mathgeom/tobeincluded/src/d3/continuous/Path3d.java
Path3d.quadTo
public void quadTo(Point3d controlPoint, Point3d endPoint) { ensureSlots(true, 6); this.types[this.numTypesProperty.get()] = PathElementType.QUAD_TO; this.numTypesProperty.set(this.numTypesProperty.get()+1); this.coordsProperty[this.numCoordsProperty.get()] = controlPoint.xProperty; this.numCoordsProperty.set(this.numCoordsProperty.get()+1); this.coordsProperty[this.numCoordsProperty.get()] = controlPoint.yProperty; this.numCoordsProperty.set(this.numCoordsProperty.get()+1); this.coordsProperty[this.numCoordsProperty.get()] = controlPoint.zProperty; this.numCoordsProperty.set(this.numCoordsProperty.get()+1); this.coordsProperty[this.numCoordsProperty.get()] = endPoint.xProperty; this.numCoordsProperty.set(this.numCoordsProperty.get()+1); this.coordsProperty[this.numCoordsProperty.get()] = endPoint.yProperty; this.numCoordsProperty.set(this.numCoordsProperty.get()+1); this.coordsProperty[this.numCoordsProperty.get()] = endPoint.zProperty; this.numCoordsProperty.set(this.numCoordsProperty.get()+1); this.isEmptyProperty = null; this.isPolylineProperty.set(false); this.graphicalBounds = null; this.logicalBounds = null; }
java
public void quadTo(Point3d controlPoint, Point3d endPoint) { ensureSlots(true, 6); this.types[this.numTypesProperty.get()] = PathElementType.QUAD_TO; this.numTypesProperty.set(this.numTypesProperty.get()+1); this.coordsProperty[this.numCoordsProperty.get()] = controlPoint.xProperty; this.numCoordsProperty.set(this.numCoordsProperty.get()+1); this.coordsProperty[this.numCoordsProperty.get()] = controlPoint.yProperty; this.numCoordsProperty.set(this.numCoordsProperty.get()+1); this.coordsProperty[this.numCoordsProperty.get()] = controlPoint.zProperty; this.numCoordsProperty.set(this.numCoordsProperty.get()+1); this.coordsProperty[this.numCoordsProperty.get()] = endPoint.xProperty; this.numCoordsProperty.set(this.numCoordsProperty.get()+1); this.coordsProperty[this.numCoordsProperty.get()] = endPoint.yProperty; this.numCoordsProperty.set(this.numCoordsProperty.get()+1); this.coordsProperty[this.numCoordsProperty.get()] = endPoint.zProperty; this.numCoordsProperty.set(this.numCoordsProperty.get()+1); this.isEmptyProperty = null; this.isPolylineProperty.set(false); this.graphicalBounds = null; this.logicalBounds = null; }
[ "public", "void", "quadTo", "(", "Point3d", "controlPoint", ",", "Point3d", "endPoint", ")", "{", "ensureSlots", "(", "true", ",", "6", ")", ";", "this", ".", "types", "[", "this", ".", "numTypesProperty", ".", "get", "(", ")", "]", "=", "PathElementType...
Adds a curved segment, defined by two new points, to the path by drawing a Quadratic curve that intersects both the current coordinates and the specified endPoint, using the specified controlPoint as a quadratic parametric control point. All coordinates are specified in Point3d. We store the property here, and not the value. So when the points changes, the path will be automatically updated. @param controlPoint the quadratic control point @param endPoint the final end point
[ "Adds", "a", "curved", "segment", "defined", "by", "two", "new", "points", "to", "the", "path", "by", "drawing", "a", "Quadratic", "curve", "that", "intersects", "both", "the", "current", "coordinates", "and", "the", "specified", "endPoint", "using", "the", ...
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/Path3d.java#L2185-L2214
GoogleCloudPlatform/bigdata-interop
gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageReadChannel.java
GoogleCloudStorageReadChannel.getInitialMetadata
@Nullable protected GoogleCloudStorageItemInfo getInitialMetadata() throws IOException { if (!readOptions.getFastFailOnNotFound()) { return null; } StorageObject object; try { object = ResilientOperation.retry( ResilientOperation.getGoogleRequestCallable(createRequest()), readBackOff.get(), RetryDeterminer.SOCKET_ERRORS, IOException.class, sleeper); } catch (IOException e) { throw errorExtractor.itemNotFound(e) ? GoogleCloudStorageExceptions.getFileNotFoundException(bucketName, objectName) : new IOException("Error reading " + resourceIdString, e); } catch (InterruptedException e) { // From the sleep throw new IOException("Thread interrupt received.", e); } return createItemInfoForStorageObject(new StorageResourceId(bucketName, objectName), object); }
java
@Nullable protected GoogleCloudStorageItemInfo getInitialMetadata() throws IOException { if (!readOptions.getFastFailOnNotFound()) { return null; } StorageObject object; try { object = ResilientOperation.retry( ResilientOperation.getGoogleRequestCallable(createRequest()), readBackOff.get(), RetryDeterminer.SOCKET_ERRORS, IOException.class, sleeper); } catch (IOException e) { throw errorExtractor.itemNotFound(e) ? GoogleCloudStorageExceptions.getFileNotFoundException(bucketName, objectName) : new IOException("Error reading " + resourceIdString, e); } catch (InterruptedException e) { // From the sleep throw new IOException("Thread interrupt received.", e); } return createItemInfoForStorageObject(new StorageResourceId(bucketName, objectName), object); }
[ "@", "Nullable", "protected", "GoogleCloudStorageItemInfo", "getInitialMetadata", "(", ")", "throws", "IOException", "{", "if", "(", "!", "readOptions", ".", "getFastFailOnNotFound", "(", ")", ")", "{", "return", "null", ";", "}", "StorageObject", "object", ";", ...
Returns {@link GoogleCloudStorageItemInfo} used to initialize metadata in constructor. By default returns {@code null} which means that metadata will be lazily initialized during first read.
[ "Returns", "{" ]
train
https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageReadChannel.java#L294-L316
spring-projects/spring-security-oauth
spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/token/store/jwk/JwkDefinitionSource.java
JwkDefinitionSource.loadJwkDefinitions
static Map<String, JwkDefinitionHolder> loadJwkDefinitions(URL jwkSetUrl) { InputStream jwkSetSource; try { jwkSetSource = jwkSetUrl.openStream(); } catch (IOException ex) { throw new JwkException("An I/O error occurred while reading from the JWK Set source: " + ex.getMessage(), ex); } Set<JwkDefinition> jwkDefinitionSet = jwkSetConverter.convert(jwkSetSource); Map<String, JwkDefinitionHolder> jwkDefinitions = new LinkedHashMap<String, JwkDefinitionHolder>(); for (JwkDefinition jwkDefinition : jwkDefinitionSet) { if (JwkDefinition.KeyType.RSA.equals(jwkDefinition.getKeyType())) { jwkDefinitions.put(jwkDefinition.getKeyId(), new JwkDefinitionHolder(jwkDefinition, createRsaVerifier((RsaJwkDefinition) jwkDefinition))); } else if (JwkDefinition.KeyType.EC.equals(jwkDefinition.getKeyType())) { jwkDefinitions.put(jwkDefinition.getKeyId(), new JwkDefinitionHolder(jwkDefinition, createEcVerifier((EllipticCurveJwkDefinition) jwkDefinition))); } } return jwkDefinitions; }
java
static Map<String, JwkDefinitionHolder> loadJwkDefinitions(URL jwkSetUrl) { InputStream jwkSetSource; try { jwkSetSource = jwkSetUrl.openStream(); } catch (IOException ex) { throw new JwkException("An I/O error occurred while reading from the JWK Set source: " + ex.getMessage(), ex); } Set<JwkDefinition> jwkDefinitionSet = jwkSetConverter.convert(jwkSetSource); Map<String, JwkDefinitionHolder> jwkDefinitions = new LinkedHashMap<String, JwkDefinitionHolder>(); for (JwkDefinition jwkDefinition : jwkDefinitionSet) { if (JwkDefinition.KeyType.RSA.equals(jwkDefinition.getKeyType())) { jwkDefinitions.put(jwkDefinition.getKeyId(), new JwkDefinitionHolder(jwkDefinition, createRsaVerifier((RsaJwkDefinition) jwkDefinition))); } else if (JwkDefinition.KeyType.EC.equals(jwkDefinition.getKeyType())) { jwkDefinitions.put(jwkDefinition.getKeyId(), new JwkDefinitionHolder(jwkDefinition, createEcVerifier((EllipticCurveJwkDefinition) jwkDefinition))); } } return jwkDefinitions; }
[ "static", "Map", "<", "String", ",", "JwkDefinitionHolder", ">", "loadJwkDefinitions", "(", "URL", "jwkSetUrl", ")", "{", "InputStream", "jwkSetSource", ";", "try", "{", "jwkSetSource", "=", "jwkSetUrl", ".", "openStream", "(", ")", ";", "}", "catch", "(", "...
Fetches the JWK Set from the provided <code>URL</code> and returns a <code>Map</code> keyed by the JWK keyId (&quot;kid&quot;) and mapped to an association of the {@link JwkDefinition} and {@link SignatureVerifier}. Uses a {@link JwkSetConverter} to convert the JWK Set URL source to a set of {@link JwkDefinition}(s) followed by the instantiation of a {@link SignatureVerifier} which is associated to it's {@link JwkDefinition}. @param jwkSetUrl the JWK Set URL @return a <code>Map</code> keyed by the JWK keyId and mapped to an association of {@link JwkDefinition} and {@link SignatureVerifier} @see JwkSetConverter
[ "Fetches", "the", "JWK", "Set", "from", "the", "provided", "<code", ">", "URL<", "/", "code", ">", "and", "returns", "a", "<code", ">", "Map<", "/", "code", ">", "keyed", "by", "the", "JWK", "keyId", "(", "&quot", ";", "kid&quot", ";", ")", "and", ...
train
https://github.com/spring-projects/spring-security-oauth/blob/bbae0027eceb2c74a21ac26bbc86142dc732ffbe/spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/token/store/jwk/JwkDefinitionSource.java#L128-L151
javagl/ND
nd-distance/src/main/java/de/javagl/nd/distance/tuples/d/DoubleTupleDistanceFunctions.java
DoubleTupleDistanceFunctions.computeEuclidean
public static double computeEuclidean(DoubleTuple t0, DoubleTuple t1) { return Math.sqrt(computeEuclideanSquared(t0, t1)); }
java
public static double computeEuclidean(DoubleTuple t0, DoubleTuple t1) { return Math.sqrt(computeEuclideanSquared(t0, t1)); }
[ "public", "static", "double", "computeEuclidean", "(", "DoubleTuple", "t0", ",", "DoubleTuple", "t1", ")", "{", "return", "Math", ".", "sqrt", "(", "computeEuclideanSquared", "(", "t0", ",", "t1", ")", ")", ";", "}" ]
Computes the Euclidean distance between the given tuples @param t0 The first tuple @param t1 The second tuple @return The distance @throws IllegalArgumentException If the given tuples do not have the same {@link Tuple#getSize() size}
[ "Computes", "the", "Euclidean", "distance", "between", "the", "given", "tuples" ]
train
https://github.com/javagl/ND/blob/bcb655aaf5fc88af6194f73a27cca079186ff559/nd-distance/src/main/java/de/javagl/nd/distance/tuples/d/DoubleTupleDistanceFunctions.java#L104-L107
avianey/facebook-api-android-maven
facebook/src/main/java/com/facebook/Settings.java
Settings.setLimitEventAndDataUsage
public static void setLimitEventAndDataUsage(Context context, boolean limitEventUsage) { SharedPreferences preferences = context.getSharedPreferences(APP_EVENT_PREFERENCES, Context.MODE_PRIVATE); SharedPreferences.Editor editor = preferences.edit(); editor.putBoolean("limitEventUsage", limitEventUsage); editor.commit(); }
java
public static void setLimitEventAndDataUsage(Context context, boolean limitEventUsage) { SharedPreferences preferences = context.getSharedPreferences(APP_EVENT_PREFERENCES, Context.MODE_PRIVATE); SharedPreferences.Editor editor = preferences.edit(); editor.putBoolean("limitEventUsage", limitEventUsage); editor.commit(); }
[ "public", "static", "void", "setLimitEventAndDataUsage", "(", "Context", "context", ",", "boolean", "limitEventUsage", ")", "{", "SharedPreferences", "preferences", "=", "context", ".", "getSharedPreferences", "(", "APP_EVENT_PREFERENCES", ",", "Context", ".", "MODE_PRI...
Sets whether data such as that generated through AppEventsLogger and sent to Facebook should be restricted from being used for purposes other than analytics and conversions, such as for targeting ads to this user. Defaults to false. This value is stored on the device and persists across app launches. Changes to this setting will apply to app events currently queued to be flushed. @param context Used to persist this value across app runs.
[ "Sets", "whether", "data", "such", "as", "that", "generated", "through", "AppEventsLogger", "and", "sent", "to", "Facebook", "should", "be", "restricted", "from", "being", "used", "for", "purposes", "other", "than", "analytics", "and", "conversions", "such", "as...
train
https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/Settings.java#L486-L491
tvesalainen/util
util/src/main/java/org/vesalainen/util/CharSequences.java
CharSequences.startsWith
public static boolean startsWith(CharSequence seq, CharSequence pattern, IntUnaryOperator op) { if (pattern.length() > seq.length()) { return false; } int length = pattern.length(); for (int ii=0;ii<length;ii++) { if (op.applyAsInt(seq.charAt(ii)) != op.applyAsInt(pattern.charAt(ii))) { return false; } } return true; }
java
public static boolean startsWith(CharSequence seq, CharSequence pattern, IntUnaryOperator op) { if (pattern.length() > seq.length()) { return false; } int length = pattern.length(); for (int ii=0;ii<length;ii++) { if (op.applyAsInt(seq.charAt(ii)) != op.applyAsInt(pattern.charAt(ii))) { return false; } } return true; }
[ "public", "static", "boolean", "startsWith", "(", "CharSequence", "seq", ",", "CharSequence", "pattern", ",", "IntUnaryOperator", "op", ")", "{", "if", "(", "pattern", ".", "length", "(", ")", ">", "seq", ".", "length", "(", ")", ")", "{", "return", "fal...
Return true if seq start match pattern after both characters have been converted with op. @param seq @param pattern @param op @return
[ "Return", "true", "if", "seq", "start", "match", "pattern", "after", "both", "characters", "have", "been", "converted", "with", "op", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/CharSequences.java#L81-L96
stevespringett/Alpine
alpine/src/main/java/alpine/auth/LdapConnectionWrapper.java
LdapConnectionWrapper.getAttribute
public String getAttribute(final DirContext ctx, final String dn, final String attributeName) throws NamingException { final Attributes attributes = ctx.getAttributes(dn); return getAttribute(attributes, attributeName); }
java
public String getAttribute(final DirContext ctx, final String dn, final String attributeName) throws NamingException { final Attributes attributes = ctx.getAttributes(dn); return getAttribute(attributes, attributeName); }
[ "public", "String", "getAttribute", "(", "final", "DirContext", "ctx", ",", "final", "String", "dn", ",", "final", "String", "attributeName", ")", "throws", "NamingException", "{", "final", "Attributes", "attributes", "=", "ctx", ".", "getAttributes", "(", "dn",...
Retrieves an attribute by its name for the specified dn. @param ctx the DirContext to use @param dn the distinguished name of the entry to obtain the attribute value for @param attributeName the name of the attribute to return @return the value of the attribute, or null if not found @throws NamingException if an exception is thrown @since 1.4.0
[ "Retrieves", "an", "attribute", "by", "its", "name", "for", "the", "specified", "dn", "." ]
train
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/auth/LdapConnectionWrapper.java#L225-L228
sdl/Testy
src/main/java/com/sdl/selenium/extjs3/form/ComboBox.java
ComboBox.setValueWithJs
private boolean setValueWithJs(final String componentId, final String value) { boolean selected; String script = "return (function(){var c = Ext.getCmp('" + componentId + "'); var record = c.findRecord(c.displayField, '" + value + "');" + "if(record){c.onSelect(record, c.store.indexOf(record)); return true;} return false;})()"; log.warn("force ComboBox Value with js: " + script); selected = (Boolean) WebLocatorUtils.doExecuteScript(script); log.warn("force ComboBox select result: " + selected); return selected; }
java
private boolean setValueWithJs(final String componentId, final String value) { boolean selected; String script = "return (function(){var c = Ext.getCmp('" + componentId + "'); var record = c.findRecord(c.displayField, '" + value + "');" + "if(record){c.onSelect(record, c.store.indexOf(record)); return true;} return false;})()"; log.warn("force ComboBox Value with js: " + script); selected = (Boolean) WebLocatorUtils.doExecuteScript(script); log.warn("force ComboBox select result: " + selected); return selected; }
[ "private", "boolean", "setValueWithJs", "(", "final", "String", "componentId", ",", "final", "String", "value", ")", "{", "boolean", "selected", ";", "String", "script", "=", "\"return (function(){var c = Ext.getCmp('\"", "+", "componentId", "+", "\"'); var record = c....
this method is used in case normal flow for selection fails @param componentId ComboBox id so we can use directly js to force selection of that value @param value value @return true or false
[ "this", "method", "is", "used", "in", "case", "normal", "flow", "for", "selection", "fails" ]
train
https://github.com/sdl/Testy/blob/b3ae061554016f926f04694a39ff00dab7576609/src/main/java/com/sdl/selenium/extjs3/form/ComboBox.java#L118-L126
phax/ph-oton
ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload/FineUploaderBasic.java
FineUploaderBasic.setCustomHeaders
@Nonnull public FineUploaderBasic setCustomHeaders (@Nullable final Map <String, String> aCustomHeaders) { m_aRequestCustomHeaders.setAll (aCustomHeaders); return this; }
java
@Nonnull public FineUploaderBasic setCustomHeaders (@Nullable final Map <String, String> aCustomHeaders) { m_aRequestCustomHeaders.setAll (aCustomHeaders); return this; }
[ "@", "Nonnull", "public", "FineUploaderBasic", "setCustomHeaders", "(", "@", "Nullable", "final", "Map", "<", "String", ",", "String", ">", "aCustomHeaders", ")", "{", "m_aRequestCustomHeaders", ".", "setAll", "(", "aCustomHeaders", ")", ";", "return", "this", "...
Additional headers sent along with the XHR POST request. Note that is option is only relevant to the ajax/XHR uploader. @param aCustomHeaders Custom headers to be set. @return this
[ "Additional", "headers", "sent", "along", "with", "the", "XHR", "POST", "request", ".", "Note", "that", "is", "option", "is", "only", "relevant", "to", "the", "ajax", "/", "XHR", "uploader", "." ]
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload/FineUploaderBasic.java#L248-L253
d-sauer/JCalcAPI
src/main/java/org/jdice/calc/Num.java
Num.toObject
public <T> T toObject(Class<T> toClass, NumConverter numConverter) { return (T) toObject(toClass, numConverter, null); }
java
public <T> T toObject(Class<T> toClass, NumConverter numConverter) { return (T) toObject(toClass, numConverter, null); }
[ "public", "<", "T", ">", "T", "toObject", "(", "Class", "<", "T", ">", "toClass", ",", "NumConverter", "numConverter", ")", "{", "return", "(", "T", ")", "toObject", "(", "toClass", ",", "numConverter", ",", "null", ")", ";", "}" ]
Convert <tt>Num</tt> to defined custom object @param customObject @return
[ "Convert", "<tt", ">", "Num<", "/", "tt", ">", "to", "defined", "custom", "object" ]
train
https://github.com/d-sauer/JCalcAPI/blob/36ae1f9adfe611a6f1bd8ef87cf1dc0ec88ac035/src/main/java/org/jdice/calc/Num.java#L511-L513
junit-team/junit4
src/main/java/org/junit/runners/model/RunnerBuilder.java
RunnerBuilder.safeRunnerForClass
public Runner safeRunnerForClass(Class<?> testClass) { try { Runner runner = runnerForClass(testClass); if (runner != null) { configureRunner(runner); } return runner; } catch (Throwable e) { return new ErrorReportingRunner(testClass, e); } }
java
public Runner safeRunnerForClass(Class<?> testClass) { try { Runner runner = runnerForClass(testClass); if (runner != null) { configureRunner(runner); } return runner; } catch (Throwable e) { return new ErrorReportingRunner(testClass, e); } }
[ "public", "Runner", "safeRunnerForClass", "(", "Class", "<", "?", ">", "testClass", ")", "{", "try", "{", "Runner", "runner", "=", "runnerForClass", "(", "testClass", ")", ";", "if", "(", "runner", "!=", "null", ")", "{", "configureRunner", "(", "runner", ...
Always returns a runner for the given test class. <p>In case of an exception a runner will be returned that prints an error instead of running tests. <p>Note that some of the internal JUnit implementations of RunnerBuilder will return {@code null} from this method, but no RunnerBuilder passed to a Runner constructor will return {@code null} from this method. @param testClass class to be run @return a Runner
[ "Always", "returns", "a", "runner", "for", "the", "given", "test", "class", "." ]
train
https://github.com/junit-team/junit4/blob/d9861ecdb6e487f6c352437ee823879aca3b81d4/src/main/java/org/junit/runners/model/RunnerBuilder.java#L68-L78
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJBFactoryHome.java
EJBFactoryHome.createBeanO
@Override public BeanO createBeanO(EJBThreadData threadData, ContainerTx tx, BeanId id) throws RemoteException { throw new ContainerEJBException("EJBContainer internal error"); }
java
@Override public BeanO createBeanO(EJBThreadData threadData, ContainerTx tx, BeanId id) throws RemoteException { throw new ContainerEJBException("EJBContainer internal error"); }
[ "@", "Override", "public", "BeanO", "createBeanO", "(", "EJBThreadData", "threadData", ",", "ContainerTx", "tx", ",", "BeanId", "id", ")", "throws", "RemoteException", "{", "throw", "new", "ContainerEJBException", "(", "\"EJBContainer internal error\"", ")", ";", "}...
This method creates and returns a new <code>BeanO</code> instance appropriate for this home. <p> The returned <code>BeanO</code> has a newly created enterprise bean instance associated with it, and the enterprise bean instance has had its set...Context() method called on it to set its context to the returned <code>BeanO</code>. <p> This method must only be called when a new <code>BeanO</code> instance is needed. It always creates a new <code>BeanO</code> instance and a new instance of the associated enterprise bean. <p> @param threadData the <code>EJBThreadData</code> associated with the currently running thread <p> @param tx the <code>ContainerTx</code> to associate with the newly created <code>BeanO</code> <p> @param id the <code>BeanId</code> to associate with the newly created <code>BeanO</code> <p> @return newly created <code>BeanO</code> associated with a newly created bean instance of type of beans managed by this home <p>
[ "This", "method", "creates", "and", "returns", "a", "new", "<code", ">", "BeanO<", "/", "code", ">", "instance", "appropriate", "for", "this", "home", ".", "<p", ">" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJBFactoryHome.java#L152-L157
hazelcast/hazelcast
hazelcast-client/src/main/java/com/hazelcast/client/spi/impl/ClientPartitionServiceImpl.java
ClientPartitionServiceImpl.processPartitionResponse
private void processPartitionResponse(Connection connection, Collection<Map.Entry<Address, List<Integer>>> partitions, int partitionStateVersion, boolean partitionStateVersionExist) { while (true) { PartitionTable current = this.partitionTable.get(); if (!shouldBeApplied(connection, partitions, partitionStateVersion, partitionStateVersionExist, current)) { return; } Int2ObjectHashMap<Address> newPartitions = convertToPartitionToAddressMap(partitions); PartitionTable newMetaData = new PartitionTable(connection, partitionStateVersion, newPartitions); if (this.partitionTable.compareAndSet(current, newMetaData)) { // partition count is set once at the start. Even if we reset the partition table when switching cluster //we want to remember the partition count. That is why it is a different field. if (partitionCount == 0) { partitionCount = newPartitions.size(); } if (logger.isFinestEnabled()) { logger.finest("Processed partition response. partitionStateVersion : " + (partitionStateVersionExist ? partitionStateVersion : "NotAvailable") + ", partitionCount :" + newPartitions.size() + ", connection : " + connection); } return; } } }
java
private void processPartitionResponse(Connection connection, Collection<Map.Entry<Address, List<Integer>>> partitions, int partitionStateVersion, boolean partitionStateVersionExist) { while (true) { PartitionTable current = this.partitionTable.get(); if (!shouldBeApplied(connection, partitions, partitionStateVersion, partitionStateVersionExist, current)) { return; } Int2ObjectHashMap<Address> newPartitions = convertToPartitionToAddressMap(partitions); PartitionTable newMetaData = new PartitionTable(connection, partitionStateVersion, newPartitions); if (this.partitionTable.compareAndSet(current, newMetaData)) { // partition count is set once at the start. Even if we reset the partition table when switching cluster //we want to remember the partition count. That is why it is a different field. if (partitionCount == 0) { partitionCount = newPartitions.size(); } if (logger.isFinestEnabled()) { logger.finest("Processed partition response. partitionStateVersion : " + (partitionStateVersionExist ? partitionStateVersion : "NotAvailable") + ", partitionCount :" + newPartitions.size() + ", connection : " + connection); } return; } } }
[ "private", "void", "processPartitionResponse", "(", "Connection", "connection", ",", "Collection", "<", "Map", ".", "Entry", "<", "Address", ",", "List", "<", "Integer", ">", ">", ">", "partitions", ",", "int", "partitionStateVersion", ",", "boolean", "partition...
The partitions can be empty on the response, client will not apply the empty partition table, see {@link ClientPartitionListenerService#getPartitions(PartitionTableView)}
[ "The", "partitions", "can", "be", "empty", "on", "the", "response", "client", "will", "not", "apply", "the", "empty", "partition", "table", "see", "{" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast-client/src/main/java/com/hazelcast/client/spi/impl/ClientPartitionServiceImpl.java#L171-L197
projectodd/stilts
stomp-server-core/src/main/java/org/projectodd/stilts/stomp/server/protocol/websockets/ServerHandshakeHandler.java
ServerHandshakeHandler.handleHttpRequest
protected void handleHttpRequest(final ChannelHandlerContext channelContext, final HttpRequest request) throws Exception { if (isWebSocketsUpgradeRequest( request )) { final Handshake handshake = findHandshake( request ); if (handshake != null) { HttpResponse response = handshake.generateResponse( request ); response.addHeader( Names.UPGRADE, Values.WEBSOCKET ); response.addHeader( Names.CONNECTION, Values.UPGRADE ); final ChannelPipeline pipeline = channelContext.getChannel().getPipeline(); reconfigureUpstream( pipeline, handshake ); Channel channel = channelContext.getChannel(); ChannelFuture future = channel.write( response ); future.addListener( new ChannelFutureListener() { public void operationComplete(ChannelFuture future) throws Exception { reconfigureDownstream( pipeline, handshake ); pipeline.replace( ServerHandshakeHandler.this, "websocket-disconnection-negotiator", new WebSocketDisconnectionNegotiator() ); forwardConnectEventUpstream( channelContext ); decodeHost( channelContext, request ); decodeSession( channelContext, request ); } } ); return; } } // Send an error page otherwise. sendHttpResponse( channelContext, request, new DefaultHttpResponse( HttpVersion.HTTP_1_1, HttpResponseStatus.FORBIDDEN ) ); }
java
protected void handleHttpRequest(final ChannelHandlerContext channelContext, final HttpRequest request) throws Exception { if (isWebSocketsUpgradeRequest( request )) { final Handshake handshake = findHandshake( request ); if (handshake != null) { HttpResponse response = handshake.generateResponse( request ); response.addHeader( Names.UPGRADE, Values.WEBSOCKET ); response.addHeader( Names.CONNECTION, Values.UPGRADE ); final ChannelPipeline pipeline = channelContext.getChannel().getPipeline(); reconfigureUpstream( pipeline, handshake ); Channel channel = channelContext.getChannel(); ChannelFuture future = channel.write( response ); future.addListener( new ChannelFutureListener() { public void operationComplete(ChannelFuture future) throws Exception { reconfigureDownstream( pipeline, handshake ); pipeline.replace( ServerHandshakeHandler.this, "websocket-disconnection-negotiator", new WebSocketDisconnectionNegotiator() ); forwardConnectEventUpstream( channelContext ); decodeHost( channelContext, request ); decodeSession( channelContext, request ); } } ); return; } } // Send an error page otherwise. sendHttpResponse( channelContext, request, new DefaultHttpResponse( HttpVersion.HTTP_1_1, HttpResponseStatus.FORBIDDEN ) ); }
[ "protected", "void", "handleHttpRequest", "(", "final", "ChannelHandlerContext", "channelContext", ",", "final", "HttpRequest", "request", ")", "throws", "Exception", "{", "if", "(", "isWebSocketsUpgradeRequest", "(", "request", ")", ")", "{", "final", "Handshake", ...
Handle initial HTTP portion of the handshake. @param channelContext @param request @throws Exception
[ "Handle", "initial", "HTTP", "portion", "of", "the", "handshake", "." ]
train
https://github.com/projectodd/stilts/blob/6ba81d4162325b98f591c206520476cf575d0567/stomp-server-core/src/main/java/org/projectodd/stilts/stomp/server/protocol/websockets/ServerHandshakeHandler.java#L101-L134
Stratio/cassandra-lucene-index
plugin/src/main/java/com/stratio/cassandra/lucene/schema/mapping/SingleColumnMapper.java
SingleColumnMapper.base
public final T base(String field, Object value) { return value == null ? null : doBase(field, value); }
java
public final T base(String field, Object value) { return value == null ? null : doBase(field, value); }
[ "public", "final", "T", "base", "(", "String", "field", ",", "Object", "value", ")", "{", "return", "value", "==", "null", "?", "null", ":", "doBase", "(", "field", ",", "value", ")", ";", "}" ]
Returns the {@link Column} query value resulting from the mapping of the specified object. @param field the field name @param value the object to be mapped, never is {@code null} @return the {@link Column} index value resulting from the mapping of the specified object
[ "Returns", "the", "{", "@link", "Column", "}", "query", "value", "resulting", "from", "the", "mapping", "of", "the", "specified", "object", "." ]
train
https://github.com/Stratio/cassandra-lucene-index/blob/a94a4d9af6c25d40e1108729974c35c27c54441c/plugin/src/main/java/com/stratio/cassandra/lucene/schema/mapping/SingleColumnMapper.java#L146-L148
twitter/chill
chill-java/src/main/java/com/twitter/chill/config/ConfiguredInstantiator.java
ConfiguredInstantiator.setReflect
public static void setReflect(Config conf, Class<? extends KryoInstantiator> instClass) { conf.set(KEY, instClass.getName()); }
java
public static void setReflect(Config conf, Class<? extends KryoInstantiator> instClass) { conf.set(KEY, instClass.getName()); }
[ "public", "static", "void", "setReflect", "(", "Config", "conf", ",", "Class", "<", "?", "extends", "KryoInstantiator", ">", "instClass", ")", "{", "conf", ".", "set", "(", "KEY", ",", "instClass", ".", "getName", "(", ")", ")", ";", "}" ]
In this mode, we are just refecting to another delegated class. This is preferred if you don't have any configuration to do at runtime (i.e. you can make a named class that has all the logic for your KryoInstantiator).
[ "In", "this", "mode", "we", "are", "just", "refecting", "to", "another", "delegated", "class", ".", "This", "is", "preferred", "if", "you", "don", "t", "have", "any", "configuration", "to", "do", "at", "runtime", "(", "i", ".", "e", ".", "you", "can", ...
train
https://github.com/twitter/chill/blob/0919984ec3aeb320ff522911c726425e9f18ea41/chill-java/src/main/java/com/twitter/chill/config/ConfiguredInstantiator.java#L89-L91
unbescape/unbescape
src/main/java/org/unbescape/properties/PropertiesEscape.java
PropertiesEscape.escapePropertiesKeyMinimal
public static void escapePropertiesKeyMinimal(final String text, final Writer writer) throws IOException { escapePropertiesKey(text, writer, PropertiesKeyEscapeLevel.LEVEL_1_BASIC_ESCAPE_SET); }
java
public static void escapePropertiesKeyMinimal(final String text, final Writer writer) throws IOException { escapePropertiesKey(text, writer, PropertiesKeyEscapeLevel.LEVEL_1_BASIC_ESCAPE_SET); }
[ "public", "static", "void", "escapePropertiesKeyMinimal", "(", "final", "String", "text", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "escapePropertiesKey", "(", "text", ",", "writer", ",", "PropertiesKeyEscapeLevel", ".", "LEVEL_1_BASIC_ESCAP...
<p> Perform a Java Properties Key level 1 (only basic set) <strong>escape</strong> operation on a <tt>String</tt> input, writing results to a <tt>Writer</tt>. </p> <p> <em>Level 1</em> means this method will only escape the Java Properties Key basic escape set: </p> <ul> <li>The <em>Single Escape Characters</em>: <tt>&#92;t</tt> (<tt>U+0009</tt>), <tt>&#92;n</tt> (<tt>U+000A</tt>), <tt>&#92;f</tt> (<tt>U+000C</tt>), <tt>&#92;r</tt> (<tt>U+000D</tt>), <tt>&#92;&nbsp;</tt> (<tt>U+0020</tt>), <tt>&#92;:</tt> (<tt>U+003A</tt>), <tt>&#92;=</tt> (<tt>U+003D</tt>) and <tt>&#92;&#92;</tt> (<tt>U+005C</tt>). </li> <li> Two ranges of non-displayable, control characters (some of which are already part of the <em>single escape characters</em> list): <tt>U+0000</tt> to <tt>U+001F</tt> and <tt>U+007F</tt> to <tt>U+009F</tt>. </li> </ul> <p> This method calls {@link #escapePropertiesKey(String, Writer, PropertiesKeyEscapeLevel)} with the following preconfigured values: </p> <ul> <li><tt>level</tt>: {@link PropertiesKeyEscapeLevel#LEVEL_1_BASIC_ESCAPE_SET}</li> </ul> <p> This method is <strong>thread-safe</strong>. </p> @param text the <tt>String</tt> to be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs
[ "<p", ">", "Perform", "a", "Java", "Properties", "Key", "level", "1", "(", "only", "basic", "set", ")", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "String<", "/", "tt", ">", "input", "writing", "results", "to", ...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/properties/PropertiesEscape.java#L936-L939
stephanenicolas/toothpick
toothpick-runtime/src/main/java/toothpick/ScopeImpl.java
ScopeImpl.installInternalProvider
private <T> InternalProviderImpl installInternalProvider(Class<T> clazz, String bindingName, InternalProviderImpl<? extends T> internalProvider, boolean isBound, boolean isTestProvider) { if (bindingName == null) { if (isBound) { return installUnNamedProvider(mapClassesToUnNamedBoundProviders, clazz, internalProvider, isTestProvider); } else { return installUnNamedProvider(mapClassesToUnNamedUnBoundProviders, clazz, internalProvider, isTestProvider); } } else { return installNamedProvider(mapClassesToNamedBoundProviders, clazz, bindingName, internalProvider, isTestProvider); } }
java
private <T> InternalProviderImpl installInternalProvider(Class<T> clazz, String bindingName, InternalProviderImpl<? extends T> internalProvider, boolean isBound, boolean isTestProvider) { if (bindingName == null) { if (isBound) { return installUnNamedProvider(mapClassesToUnNamedBoundProviders, clazz, internalProvider, isTestProvider); } else { return installUnNamedProvider(mapClassesToUnNamedUnBoundProviders, clazz, internalProvider, isTestProvider); } } else { return installNamedProvider(mapClassesToNamedBoundProviders, clazz, bindingName, internalProvider, isTestProvider); } }
[ "private", "<", "T", ">", "InternalProviderImpl", "installInternalProvider", "(", "Class", "<", "T", ">", "clazz", ",", "String", "bindingName", ",", "InternalProviderImpl", "<", "?", "extends", "T", ">", "internalProvider", ",", "boolean", "isBound", ",", "bool...
Installs a provider either in the scope or the pool of unbound providers. @param clazz the class for which to install the provider. @param bindingName the name, possibly {@code null}, for which to install the scoped provider. @param internalProvider the internal provider to install. @param isBound whether or not the provider is bound to the scope or belongs to the pool of unbound providers. @param isTestProvider whether or not is a test provider, installed through a Test Module that should override existing providers for the same class-bindingname. @param <T> the type of {@code clazz}. Note to maintainers : we don't use this method directly, both {@link #installBoundProvider(Class, String, InternalProviderImpl, boolean)} and {@link #installUnBoundProvider(Class, String, InternalProviderImpl)} are a facade of this method and make the calls more clear.
[ "Installs", "a", "provider", "either", "in", "the", "scope", "or", "the", "pool", "of", "unbound", "providers", "." ]
train
https://github.com/stephanenicolas/toothpick/blob/54476ca9a5fa48809c15a46e43e38db9ed7e1a75/toothpick-runtime/src/main/java/toothpick/ScopeImpl.java#L479-L490
Metatavu/edelphi
edelphi-persistence/src/main/java/fi/metatavu/edelphi/dao/panels/PanelUserDAO.java
PanelUserDAO.updateJoinType
public PanelUser updateJoinType(PanelUser panelUser, PanelUserJoinType joinType, User modifier) { panelUser.setJoinType(joinType); panelUser.setLastModified(new Date()); panelUser.setLastModifier(modifier); return persist(panelUser); }
java
public PanelUser updateJoinType(PanelUser panelUser, PanelUserJoinType joinType, User modifier) { panelUser.setJoinType(joinType); panelUser.setLastModified(new Date()); panelUser.setLastModifier(modifier); return persist(panelUser); }
[ "public", "PanelUser", "updateJoinType", "(", "PanelUser", "panelUser", ",", "PanelUserJoinType", "joinType", ",", "User", "modifier", ")", "{", "panelUser", ".", "setJoinType", "(", "joinType", ")", ";", "panelUser", ".", "setLastModified", "(", "new", "Date", ...
Updates panel user's join type @param panelUser panel user @param joinType new join type @param modifier modifier @return updated user
[ "Updates", "panel", "user", "s", "join", "type" ]
train
https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/edelphi-persistence/src/main/java/fi/metatavu/edelphi/dao/panels/PanelUserDAO.java#L180-L186
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/Solo.java
Solo.pinchToZoom
public void pinchToZoom(PointF startPoint1, PointF startPoint2, PointF endPoint1, PointF endPoint2) { if(config.commandLogging){ Log.d(config.commandLoggingTag, "pinchToZoom("+startPoint1+", "+startPoint2+", "+endPoint1+", "+endPoint2+")"); } if (android.os.Build.VERSION.SDK_INT < 14){ throw new RuntimeException("pinchToZoom() requires API level >= 14"); } zoomer.generateZoomGesture(startPoint1, startPoint2, endPoint1, endPoint2); }
java
public void pinchToZoom(PointF startPoint1, PointF startPoint2, PointF endPoint1, PointF endPoint2) { if(config.commandLogging){ Log.d(config.commandLoggingTag, "pinchToZoom("+startPoint1+", "+startPoint2+", "+endPoint1+", "+endPoint2+")"); } if (android.os.Build.VERSION.SDK_INT < 14){ throw new RuntimeException("pinchToZoom() requires API level >= 14"); } zoomer.generateZoomGesture(startPoint1, startPoint2, endPoint1, endPoint2); }
[ "public", "void", "pinchToZoom", "(", "PointF", "startPoint1", ",", "PointF", "startPoint2", ",", "PointF", "endPoint1", ",", "PointF", "endPoint2", ")", "{", "if", "(", "config", ".", "commandLogging", ")", "{", "Log", ".", "d", "(", "config", ".", "comma...
Zooms in or out if startPoint1 and startPoint2 are larger or smaller then endPoint1 and endPoint2. Requires API level >= 14. @param startPoint1 First "finger" down on the screen @param startPoint2 Second "finger" down on the screen @param endPoint1 Corresponding ending point of startPoint1 @param endPoint2 Corresponding ending point of startPoint2
[ "Zooms", "in", "or", "out", "if", "startPoint1", "and", "startPoint2", "are", "larger", "or", "smaller", "then", "endPoint1", "and", "endPoint2", ".", "Requires", "API", "level", ">", "=", "14", "." ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Solo.java#L2409-L2419
qiniu/happy-dns-java
src/main/java/qiniu/happydns/local/Hosts.java
Hosts.putAllInRandomOrder
public synchronized Hosts putAllInRandomOrder(String domain, String[] ips) { Random random = new Random(); int index = (int) (random.nextLong() % ips.length); if (index < 0) { index += ips.length; } LinkedList<String> ipList = new LinkedList<String>(); for (int i = 0; i < ips.length; i++) { ipList.add(ips[(i + index) % ips.length]); } hosts.put(domain, ipList); return this; }
java
public synchronized Hosts putAllInRandomOrder(String domain, String[] ips) { Random random = new Random(); int index = (int) (random.nextLong() % ips.length); if (index < 0) { index += ips.length; } LinkedList<String> ipList = new LinkedList<String>(); for (int i = 0; i < ips.length; i++) { ipList.add(ips[(i + index) % ips.length]); } hosts.put(domain, ipList); return this; }
[ "public", "synchronized", "Hosts", "putAllInRandomOrder", "(", "String", "domain", ",", "String", "[", "]", "ips", ")", "{", "Random", "random", "=", "new", "Random", "(", ")", ";", "int", "index", "=", "(", "int", ")", "(", "random", ".", "nextLong", ...
avoid many server visit first ip in same time.s @param domain 域名 @param ips IP 列表 @return 当前host 实例
[ "avoid", "many", "server", "visit", "first", "ip", "in", "same", "time", ".", "s" ]
train
https://github.com/qiniu/happy-dns-java/blob/2900e918d6f9609371a073780224eff170a0d499/src/main/java/qiniu/happydns/local/Hosts.java#L49-L61
greenjoe/lambdaFromString
src/main/java/pl/joegreen/lambdaFromString/LambdaFactory.java
LambdaFactory.createLambda
public <T> T createLambda(String code, TypeReference<T> typeReference) throws LambdaCreationException { String helperClassSource = helperProvider.getHelperClassSource(typeReference.toString(), code, imports, staticImports); try { Class<?> helperClass = classFactory.createClass(helperProvider.getHelperClassName(), helperClassSource, javaCompiler, createOptionsForCompilationClasspath(compilationClassPath), parentClassLoader); Method lambdaReturningMethod = helperClass.getMethod(helperProvider.getLambdaReturningMethodName()); @SuppressWarnings("unchecked") // the whole point of the class template and runtime compilation is to make this cast work well :-) T lambda = (T) lambdaReturningMethod.invoke(null); return lambda; } catch (ReflectiveOperationException | RuntimeException | NoClassDefFoundError e) { // NoClassDefFoundError can be thrown if provided parent class loader cannot load classes used by the lambda throw new LambdaCreationException(e); } catch (ClassCompilationException classCompilationException) { // that catch differs from the catch above as the exact exception type is known and additional details can be extracted throw new LambdaCreationException(classCompilationException); } }
java
public <T> T createLambda(String code, TypeReference<T> typeReference) throws LambdaCreationException { String helperClassSource = helperProvider.getHelperClassSource(typeReference.toString(), code, imports, staticImports); try { Class<?> helperClass = classFactory.createClass(helperProvider.getHelperClassName(), helperClassSource, javaCompiler, createOptionsForCompilationClasspath(compilationClassPath), parentClassLoader); Method lambdaReturningMethod = helperClass.getMethod(helperProvider.getLambdaReturningMethodName()); @SuppressWarnings("unchecked") // the whole point of the class template and runtime compilation is to make this cast work well :-) T lambda = (T) lambdaReturningMethod.invoke(null); return lambda; } catch (ReflectiveOperationException | RuntimeException | NoClassDefFoundError e) { // NoClassDefFoundError can be thrown if provided parent class loader cannot load classes used by the lambda throw new LambdaCreationException(e); } catch (ClassCompilationException classCompilationException) { // that catch differs from the catch above as the exact exception type is known and additional details can be extracted throw new LambdaCreationException(classCompilationException); } }
[ "public", "<", "T", ">", "T", "createLambda", "(", "String", "code", ",", "TypeReference", "<", "T", ">", "typeReference", ")", "throws", "LambdaCreationException", "{", "String", "helperClassSource", "=", "helperProvider", ".", "getHelperClassSource", "(", "typeR...
Creates lambda from the given code. @param code source of the lambda as you would write it in Java expression {TYPE} lambda = ({CODE}); @param typeReference a subclass of TypeReference class with the generic argument representing the type of the lambda , for example <br> {@code new TypeReference<Function<Integer,Integer>>(){}; } @param <T> type of the lambda you want to get @throws LambdaCreationException when anything goes wrong (no other exceptions are thrown including runtimes), if the exception was caused by compilation failure it will contain a CompilationDetails instance describing them
[ "Creates", "lambda", "from", "the", "given", "code", "." ]
train
https://github.com/greenjoe/lambdaFromString/blob/67d383f3922ab066e908b852a531880772bbdf29/src/main/java/pl/joegreen/lambdaFromString/LambdaFactory.java#L69-L85
vdmeer/skb-java-base
src/main/java/de/vandermeer/skb/base/shell/SkbShellFactory.java
SkbShellFactory.newShell
public static SkbShell newShell(MessageRenderer renderer, boolean useConsole){ return SkbShellFactory.newShell(null, renderer, useConsole); }
java
public static SkbShell newShell(MessageRenderer renderer, boolean useConsole){ return SkbShellFactory.newShell(null, renderer, useConsole); }
[ "public", "static", "SkbShell", "newShell", "(", "MessageRenderer", "renderer", ",", "boolean", "useConsole", ")", "{", "return", "SkbShellFactory", ".", "newShell", "(", "null", ",", "renderer", ",", "useConsole", ")", ";", "}" ]
Returns a new shell with given STG and console flag. @param renderer a renderer for help messages @param useConsole flag to use (true) or not to use (false) console, of false then no output will happen (except for errors on runShell() and some help commands) @return new shell
[ "Returns", "a", "new", "shell", "with", "given", "STG", "and", "console", "flag", "." ]
train
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/shell/SkbShellFactory.java#L55-L57
dustin/java-memcached-client
src/main/java/net/spy/memcached/MemcachedClient.java
MemcachedClient.asyncGetAndTouch
@Override public OperationFuture<CASValue<Object>> asyncGetAndTouch(final String key, final int exp) { return asyncGetAndTouch(key, exp, transcoder); }
java
@Override public OperationFuture<CASValue<Object>> asyncGetAndTouch(final String key, final int exp) { return asyncGetAndTouch(key, exp, transcoder); }
[ "@", "Override", "public", "OperationFuture", "<", "CASValue", "<", "Object", ">", ">", "asyncGetAndTouch", "(", "final", "String", "key", ",", "final", "int", "exp", ")", "{", "return", "asyncGetAndTouch", "(", "key", ",", "exp", ",", "transcoder", ")", "...
Get the given key to reset its expiration time. @param key the key to fetch @param exp the new expiration to set for the given key @return a future that will hold the return value of the fetch @throws IllegalStateException in the rare circumstance where queue is too full to accept any more requests
[ "Get", "the", "given", "key", "to", "reset", "its", "expiration", "time", "." ]
train
https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/MemcachedClient.java#L1487-L1491
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceClient.java
InstanceClient.setMetadataInstance
@BetaApi public final Operation setMetadataInstance(String instance, Metadata metadataResource) { SetMetadataInstanceHttpRequest request = SetMetadataInstanceHttpRequest.newBuilder() .setInstance(instance) .setMetadataResource(metadataResource) .build(); return setMetadataInstance(request); }
java
@BetaApi public final Operation setMetadataInstance(String instance, Metadata metadataResource) { SetMetadataInstanceHttpRequest request = SetMetadataInstanceHttpRequest.newBuilder() .setInstance(instance) .setMetadataResource(metadataResource) .build(); return setMetadataInstance(request); }
[ "@", "BetaApi", "public", "final", "Operation", "setMetadataInstance", "(", "String", "instance", ",", "Metadata", "metadataResource", ")", "{", "SetMetadataInstanceHttpRequest", "request", "=", "SetMetadataInstanceHttpRequest", ".", "newBuilder", "(", ")", ".", "setIns...
Sets metadata for the specified instance to the data included in the request. <p>Sample code: <pre><code> try (InstanceClient instanceClient = InstanceClient.create()) { ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]"); Metadata metadataResource = Metadata.newBuilder().build(); Operation response = instanceClient.setMetadataInstance(instance.toString(), metadataResource); } </code></pre> @param instance Name of the instance scoping this request. @param metadataResource A metadata key/value entry. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Sets", "metadata", "for", "the", "specified", "instance", "to", "the", "data", "included", "in", "the", "request", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceClient.java#L2561-L2570
Azure/azure-sdk-for-java
resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java
ResourcesInner.beginDeleteByIdAsync
public Observable<Void> beginDeleteByIdAsync(String resourceId, String apiVersion) { return beginDeleteByIdWithServiceResponseAsync(resourceId, apiVersion).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> beginDeleteByIdAsync(String resourceId, String apiVersion) { return beginDeleteByIdWithServiceResponseAsync(resourceId, apiVersion).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "beginDeleteByIdAsync", "(", "String", "resourceId", ",", "String", "apiVersion", ")", "{", "return", "beginDeleteByIdWithServiceResponseAsync", "(", "resourceId", ",", "apiVersion", ")", ".", "map", "(", "new", "Func1", "...
Deletes a resource by ID. @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} @param apiVersion The API version to use for the operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Deletes", "a", "resource", "by", "ID", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java#L2012-L2019
ebean-orm/ebean-querybean
src/main/java/io/ebean/typequery/PBaseCompareable.java
PBaseCompareable.inRangeWith
public final R inRangeWith(TQProperty<R> highProperty, T value) { expr().inRangeWith(_name, highProperty._name, value); return _root; }
java
public final R inRangeWith(TQProperty<R> highProperty, T value) { expr().inRangeWith(_name, highProperty._name, value); return _root; }
[ "public", "final", "R", "inRangeWith", "(", "TQProperty", "<", "R", ">", "highProperty", ",", "T", "value", ")", "{", "expr", "(", ")", ".", "inRangeWith", "(", "_name", ",", "highProperty", ".", "_name", ",", "value", ")", ";", "return", "_root", ";",...
Value in Range between 2 properties. <pre>{@code .startDate.inRangeWith(endDate, now) // which equates to startDate <= now and (endDate > now or endDate is null) }</pre> <p> This is a convenience expression combining a number of simple expressions. The most common use of this could be called "effective dating" where 2 date or timestamp columns represent the date range in which
[ "Value", "in", "Range", "between", "2", "properties", "." ]
train
https://github.com/ebean-orm/ebean-querybean/blob/821650cb817c9c0fdcc97f93408dc79170b12423/src/main/java/io/ebean/typequery/PBaseCompareable.java#L111-L114
meertensinstituut/mtas
src/main/java/mtas/codec/MtasCodecPostingsFormat.java
MtasCodecPostingsFormat.getTerm
public static String getTerm(IndexInput inTerm, Long ref) throws IOException { try { inTerm.seek(ref); return inTerm.readString(); } catch (Exception e) { throw new IOException(e); } }
java
public static String getTerm(IndexInput inTerm, Long ref) throws IOException { try { inTerm.seek(ref); return inTerm.readString(); } catch (Exception e) { throw new IOException(e); } }
[ "public", "static", "String", "getTerm", "(", "IndexInput", "inTerm", ",", "Long", "ref", ")", "throws", "IOException", "{", "try", "{", "inTerm", ".", "seek", "(", "ref", ")", ";", "return", "inTerm", ".", "readString", "(", ")", ";", "}", "catch", "(...
Gets the term. @param inTerm the in term @param ref the ref @return the term @throws IOException Signals that an I/O exception has occurred.
[ "Gets", "the", "term", "." ]
train
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/MtasCodecPostingsFormat.java#L292-L299
btrplace/scheduler
choco/src/main/java/org/btrplace/scheduler/choco/runner/single/InstanceSolverRunner.java
InstanceSolverRunner.checkNodesExistence
private static void checkNodesExistence(Model mo, Collection<Node> ns) throws SchedulerModelingException { for (Node node : ns) { if (!mo.getMapping().contains(node)) { throw new SchedulerModelingException(mo, "Unknown node '" + node + "'"); } } }
java
private static void checkNodesExistence(Model mo, Collection<Node> ns) throws SchedulerModelingException { for (Node node : ns) { if (!mo.getMapping().contains(node)) { throw new SchedulerModelingException(mo, "Unknown node '" + node + "'"); } } }
[ "private", "static", "void", "checkNodesExistence", "(", "Model", "mo", ",", "Collection", "<", "Node", ">", "ns", ")", "throws", "SchedulerModelingException", "{", "for", "(", "Node", "node", ":", "ns", ")", "{", "if", "(", "!", "mo", ".", "getMapping", ...
Check for the existence of nodes in a model @param mo the model to check @param ns the nodes to check @throws SchedulerModelingException if at least one of the given nodes is not in the RP.
[ "Check", "for", "the", "existence", "of", "nodes", "in", "a", "model" ]
train
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/choco/src/main/java/org/btrplace/scheduler/choco/runner/single/InstanceSolverRunner.java#L301-L307
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java
NNStorage.findFile
private File findFile(NameNodeDirType dirType, String name) { for (StorageDirectory sd : dirIterable(dirType)) { File candidate = new File(sd.getCurrentDir(), name); if (sd.getCurrentDir().canRead() && candidate.exists()) { return candidate; } } return null; }
java
private File findFile(NameNodeDirType dirType, String name) { for (StorageDirectory sd : dirIterable(dirType)) { File candidate = new File(sd.getCurrentDir(), name); if (sd.getCurrentDir().canRead() && candidate.exists()) { return candidate; } } return null; }
[ "private", "File", "findFile", "(", "NameNodeDirType", "dirType", ",", "String", "name", ")", "{", "for", "(", "StorageDirectory", "sd", ":", "dirIterable", "(", "dirType", ")", ")", "{", "File", "candidate", "=", "new", "File", "(", "sd", ".", "getCurrent...
Return the first readable storage file of the given name across any of the 'current' directories in SDs of the given type, or null if no such file exists.
[ "Return", "the", "first", "readable", "storage", "file", "of", "the", "given", "name", "across", "any", "of", "the", "current", "directories", "in", "SDs", "of", "the", "given", "type", "or", "null", "if", "no", "such", "file", "exists", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java#L801-L810
undertow-io/undertow
core/src/main/java/io/undertow/server/HttpServerExchange.java
HttpServerExchange.getResponseChannel
public StreamSinkChannel getResponseChannel() { if (responseChannel != null) { return null; } final ConduitWrapper<StreamSinkConduit>[] wrappers = responseWrappers; this.responseWrappers = null; final ConduitStreamSinkChannel sinkChannel = connection.getSinkChannel(); if (sinkChannel == null) { return null; } if(wrappers != null) { final WrapperStreamSinkConduitFactory factory = new WrapperStreamSinkConduitFactory(wrappers, responseWrapperCount, this, sinkChannel.getConduit()); sinkChannel.setConduit(factory.create()); } else { sinkChannel.setConduit(connection.getSinkConduit(this, sinkChannel.getConduit())); } this.responseChannel = new WriteDispatchChannel(sinkChannel); this.startResponse(); return responseChannel; }
java
public StreamSinkChannel getResponseChannel() { if (responseChannel != null) { return null; } final ConduitWrapper<StreamSinkConduit>[] wrappers = responseWrappers; this.responseWrappers = null; final ConduitStreamSinkChannel sinkChannel = connection.getSinkChannel(); if (sinkChannel == null) { return null; } if(wrappers != null) { final WrapperStreamSinkConduitFactory factory = new WrapperStreamSinkConduitFactory(wrappers, responseWrapperCount, this, sinkChannel.getConduit()); sinkChannel.setConduit(factory.create()); } else { sinkChannel.setConduit(connection.getSinkConduit(this, sinkChannel.getConduit())); } this.responseChannel = new WriteDispatchChannel(sinkChannel); this.startResponse(); return responseChannel; }
[ "public", "StreamSinkChannel", "getResponseChannel", "(", ")", "{", "if", "(", "responseChannel", "!=", "null", ")", "{", "return", "null", ";", "}", "final", "ConduitWrapper", "<", "StreamSinkConduit", ">", "[", "]", "wrappers", "=", "responseWrappers", ";", ...
Get the response channel. The channel must be closed and fully flushed before the next response can be started. In order to close the channel you must first call {@link org.xnio.channels.StreamSinkChannel#shutdownWrites()}, and then call {@link org.xnio.channels.StreamSinkChannel#flush()} until it returns true. Alternatively you can call {@link #endExchange()}, which will close the channel as part of its cleanup. <p> Closing a fixed-length response before the corresponding number of bytes has been written will cause the connection to be reset and subsequent requests to fail; thus it is important to ensure that the proper content length is delivered when one is specified. The response channel may not be writable until after the response headers have been sent. <p> If this method is not called then an empty or default response body will be used, depending on the response code set. <p> The returned channel will begin to write out headers when the first write request is initiated, or when {@link org.xnio.channels.StreamSinkChannel#shutdownWrites()} is called on the channel with no content being written. Once the channel is acquired, however, the response code and headers may not be modified. <p> @return the response channel, or {@code null} if another party already acquired the channel
[ "Get", "the", "response", "channel", ".", "The", "channel", "must", "be", "closed", "and", "fully", "flushed", "before", "the", "next", "response", "can", "be", "started", ".", "In", "order", "to", "close", "the", "channel", "you", "must", "first", "call",...
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/HttpServerExchange.java#L1303-L1322
ef-labs/vertx-when
vertx-when/src/main/java/com/englishtown/vertx/promises/impl/DefaultWhenFileSystem.java
DefaultWhenFileSystem.chmodRecursive
@Override public Promise<Void> chmodRecursive(String path, String perms, String dirPerms) { return adapter.toPromise(handler -> vertx.fileSystem().chmodRecursive(path, perms, dirPerms, handler)); }
java
@Override public Promise<Void> chmodRecursive(String path, String perms, String dirPerms) { return adapter.toPromise(handler -> vertx.fileSystem().chmodRecursive(path, perms, dirPerms, handler)); }
[ "@", "Override", "public", "Promise", "<", "Void", ">", "chmodRecursive", "(", "String", "path", ",", "String", "perms", ",", "String", "dirPerms", ")", "{", "return", "adapter", ".", "toPromise", "(", "handler", "->", "vertx", ".", "fileSystem", "(", ")",...
Change the permissions on the file represented by {@code path} to {@code perms}, asynchronously.<p> The permission String takes the form rwxr-x--- as specified in {<a href="http://download.oracle.com/javase/7/docs/api/java/nio/file/attribute/PosixFilePermissions.html">here</a>}. <p> If the file is directory then all contents will also have their permissions changed recursively. Any directory permissions will be set to {@code dirPerms}, whilst any normal file permissions will be set to {@code perms}. @param path the path to the file @param perms the permissions string @param dirPerms the directory permissions @return a promise for completion
[ "Change", "the", "permissions", "on", "the", "file", "represented", "by", "{", "@code", "path", "}", "to", "{", "@code", "perms", "}", "asynchronously", ".", "<p", ">", "The", "permission", "String", "takes", "the", "form", "rwxr", "-", "x", "---", "as",...
train
https://github.com/ef-labs/vertx-when/blob/dc4fde973f58130f2eb2159206ee78b867048f4d/vertx-when/src/main/java/com/englishtown/vertx/promises/impl/DefaultWhenFileSystem.java#L123-L126
b3log/latke
latke-core/src/main/java/org/b3log/latke/repository/jdbc/JdbcRepository.java
JdbcRepository.buildSelect
private void buildSelect(final StringBuilder selectBuilder, final List<Projection> projections) { selectBuilder.append("SELECT "); if (null == projections || projections.isEmpty()) { selectBuilder.append(" * "); return; } selectBuilder.append(projections.stream().map(Projection::getKey).collect(Collectors.joining(", "))); }
java
private void buildSelect(final StringBuilder selectBuilder, final List<Projection> projections) { selectBuilder.append("SELECT "); if (null == projections || projections.isEmpty()) { selectBuilder.append(" * "); return; } selectBuilder.append(projections.stream().map(Projection::getKey).collect(Collectors.joining(", "))); }
[ "private", "void", "buildSelect", "(", "final", "StringBuilder", "selectBuilder", ",", "final", "List", "<", "Projection", ">", "projections", ")", "{", "selectBuilder", ".", "append", "(", "\"SELECT \"", ")", ";", "if", "(", "null", "==", "projections", "||",...
Builds 'SELECT' part with the specified select build and projections. @param selectBuilder the specified select builder @param projections the specified projections
[ "Builds", "SELECT", "part", "with", "the", "specified", "select", "build", "and", "projections", "." ]
train
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/repository/jdbc/JdbcRepository.java#L581-L590
hypfvieh/java-utils
src/main/java/com/github/hypfvieh/util/StringUtil.java
StringUtil.defaultIfBlank
public static String defaultIfBlank(String _str, String _default) { return isBlank(_str) ? _default : _str; }
java
public static String defaultIfBlank(String _str, String _default) { return isBlank(_str) ? _default : _str; }
[ "public", "static", "String", "defaultIfBlank", "(", "String", "_str", ",", "String", "_default", ")", "{", "return", "isBlank", "(", "_str", ")", "?", "_default", ":", "_str", ";", "}" ]
Checks if given String is blank (see {@link #isBlank(String)}.<br> If String is blank, the given default is returned, otherwise the String is returned. @param _str string to check @param _default default in case of blank string @return _str or _default
[ "Checks", "if", "given", "String", "is", "blank", "(", "see", "{" ]
train
https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/util/StringUtil.java#L345-L347
apache/flink
flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/validation/InvalidVertexIdsValidator.java
InvalidVertexIdsValidator.validate
@Override public boolean validate(Graph<K, VV, EV> graph) throws Exception { DataSet<Tuple1<K>> edgeIds = graph.getEdges() .flatMap(new MapEdgeIds<>()).distinct(); DataSet<K> invalidIds = graph.getVertices().coGroup(edgeIds).where(0) .equalTo(0).with(new GroupInvalidIds<>()).first(1); return invalidIds.map(new KToTupleMap<>()).count() == 0; }
java
@Override public boolean validate(Graph<K, VV, EV> graph) throws Exception { DataSet<Tuple1<K>> edgeIds = graph.getEdges() .flatMap(new MapEdgeIds<>()).distinct(); DataSet<K> invalidIds = graph.getVertices().coGroup(edgeIds).where(0) .equalTo(0).with(new GroupInvalidIds<>()).first(1); return invalidIds.map(new KToTupleMap<>()).count() == 0; }
[ "@", "Override", "public", "boolean", "validate", "(", "Graph", "<", "K", ",", "VV", ",", "EV", ">", "graph", ")", "throws", "Exception", "{", "DataSet", "<", "Tuple1", "<", "K", ">>", "edgeIds", "=", "graph", ".", "getEdges", "(", ")", ".", "flatMap...
Checks that the edge set input contains valid vertex Ids, i.e. that they also exist in the vertex input set. @return a boolean stating whether a graph is valid with respect to its vertex ids.
[ "Checks", "that", "the", "edge", "set", "input", "contains", "valid", "vertex", "Ids", "i", ".", "e", ".", "that", "they", "also", "exist", "in", "the", "vertex", "input", "set", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/validation/InvalidVertexIdsValidator.java#L48-L56
threerings/narya
core/src/main/java/com/threerings/admin/server/persist/ConfigRecord.java
ConfigRecord.getKey
public static Key<ConfigRecord> getKey (String node, String object, String field) { return newKey(_R, node, object, field); }
java
public static Key<ConfigRecord> getKey (String node, String object, String field) { return newKey(_R, node, object, field); }
[ "public", "static", "Key", "<", "ConfigRecord", ">", "getKey", "(", "String", "node", ",", "String", "object", ",", "String", "field", ")", "{", "return", "newKey", "(", "_R", ",", "node", ",", "object", ",", "field", ")", ";", "}" ]
Create and return a primary {@link Key} to identify a {@link ConfigRecord} with the supplied key values.
[ "Create", "and", "return", "a", "primary", "{" ]
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/admin/server/persist/ConfigRecord.java#L84-L87
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.task_contactChange_id_refuse_POST
public void task_contactChange_id_refuse_POST(Long id, String token) throws IOException { String qPath = "/me/task/contactChange/{id}/refuse"; StringBuilder sb = path(qPath, id); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "token", token); exec(qPath, "POST", sb.toString(), o); }
java
public void task_contactChange_id_refuse_POST(Long id, String token) throws IOException { String qPath = "/me/task/contactChange/{id}/refuse"; StringBuilder sb = path(qPath, id); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "token", token); exec(qPath, "POST", sb.toString(), o); }
[ "public", "void", "task_contactChange_id_refuse_POST", "(", "Long", "id", ",", "String", "token", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/task/contactChange/{id}/refuse\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "id", ...
Refuse this change request REST: POST /me/task/contactChange/{id}/refuse @param token [required] The token you received by email for this request @param id [required]
[ "Refuse", "this", "change", "request" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L2477-L2483
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/api/Table.java
Table.insertColumn
public Table insertColumn(int index, Column<?> column) { validateColumn(column); columnList.add(index, column); return this; }
java
public Table insertColumn(int index, Column<?> column) { validateColumn(column); columnList.add(index, column); return this; }
[ "public", "Table", "insertColumn", "(", "int", "index", ",", "Column", "<", "?", ">", "column", ")", "{", "validateColumn", "(", "column", ")", ";", "columnList", ".", "add", "(", "index", ",", "column", ")", ";", "return", "this", ";", "}" ]
Adds the given column to this table at the given position in the column list @param index Zero-based index into the column list @param column Column to be added
[ "Adds", "the", "given", "column", "to", "this", "table", "at", "the", "given", "position", "in", "the", "column", "list" ]
train
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/api/Table.java#L245-L249
aws/aws-sdk-java
aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/IntegrationResponse.java
IntegrationResponse.withResponseTemplates
public IntegrationResponse withResponseTemplates(java.util.Map<String, String> responseTemplates) { setResponseTemplates(responseTemplates); return this; }
java
public IntegrationResponse withResponseTemplates(java.util.Map<String, String> responseTemplates) { setResponseTemplates(responseTemplates); return this; }
[ "public", "IntegrationResponse", "withResponseTemplates", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "responseTemplates", ")", "{", "setResponseTemplates", "(", "responseTemplates", ")", ";", "return", "this", ";", "}" ]
<p> The collection of response templates for the integration response as a string-to-string map of key-value pairs. Response templates are represented as a key/value map, with a content-type as the key and a template as the value. </p> @param responseTemplates The collection of response templates for the integration response as a string-to-string map of key-value pairs. Response templates are represented as a key/value map, with a content-type as the key and a template as the value. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "collection", "of", "response", "templates", "for", "the", "integration", "response", "as", "a", "string", "-", "to", "-", "string", "map", "of", "key", "-", "value", "pairs", ".", "Response", "templates", "are", "represented", "as", "a",...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/IntegrationResponse.java#L455-L458
jmrozanec/cron-utils
src/main/java/com/cronutils/mapper/CronMapper.java
CronMapper.returnAlwaysExpression
@VisibleForTesting static Function<CronField, CronField> returnAlwaysExpression(final CronFieldName name) { return field -> new CronField(name, always(), FieldConstraintsBuilder.instance().forField(name).createConstraintsInstance()); }
java
@VisibleForTesting static Function<CronField, CronField> returnAlwaysExpression(final CronFieldName name) { return field -> new CronField(name, always(), FieldConstraintsBuilder.instance().forField(name).createConstraintsInstance()); }
[ "@", "VisibleForTesting", "static", "Function", "<", "CronField", ",", "CronField", ">", "returnAlwaysExpression", "(", "final", "CronFieldName", "name", ")", "{", "return", "field", "->", "new", "CronField", "(", "name", ",", "always", "(", ")", ",", "FieldCo...
Creates a Function that returns an Always instance. @param name - Cron field name @return new CronField -> CronField instance, never null
[ "Creates", "a", "Function", "that", "returns", "an", "Always", "instance", "." ]
train
https://github.com/jmrozanec/cron-utils/blob/adac5ec8fd9160b082f9762a6eedea0715731170/src/main/java/com/cronutils/mapper/CronMapper.java#L240-L243
roboconf/roboconf-platform
core/roboconf-target-jclouds/src/main/java/net/roboconf/target/jclouds/internal/JCloudsHandler.java
JCloudsHandler.jcloudContext
ComputeService jcloudContext( Map<String,String> targetProperties ) throws TargetException { validate( targetProperties ); ComputeServiceContext context = ContextBuilder .newBuilder( targetProperties.get( PROVIDER_ID )) .endpoint( targetProperties.get( ENDPOINT )) .credentials( targetProperties.get( IDENTITY ), targetProperties.get( CREDENTIAL )) .buildView( ComputeServiceContext.class ); return context.getComputeService(); }
java
ComputeService jcloudContext( Map<String,String> targetProperties ) throws TargetException { validate( targetProperties ); ComputeServiceContext context = ContextBuilder .newBuilder( targetProperties.get( PROVIDER_ID )) .endpoint( targetProperties.get( ENDPOINT )) .credentials( targetProperties.get( IDENTITY ), targetProperties.get( CREDENTIAL )) .buildView( ComputeServiceContext.class ); return context.getComputeService(); }
[ "ComputeService", "jcloudContext", "(", "Map", "<", "String", ",", "String", ">", "targetProperties", ")", "throws", "TargetException", "{", "validate", "(", "targetProperties", ")", ";", "ComputeServiceContext", "context", "=", "ContextBuilder", ".", "newBuilder", ...
Creates a JCloud context. @param targetProperties the target properties @return a non-null object @throws TargetException if the target properties are invalid
[ "Creates", "a", "JCloud", "context", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-target-jclouds/src/main/java/net/roboconf/target/jclouds/internal/JCloudsHandler.java#L233-L243
jenkinsci/jenkins
cli/src/main/java/hudson/cli/CLI.java
CLI.loadKey
public static KeyPair loadKey(String pemString, String passwd) throws IOException, GeneralSecurityException { return PrivateKeyProvider.loadKey(pemString, passwd); }
java
public static KeyPair loadKey(String pemString, String passwd) throws IOException, GeneralSecurityException { return PrivateKeyProvider.loadKey(pemString, passwd); }
[ "public", "static", "KeyPair", "loadKey", "(", "String", "pemString", ",", "String", "passwd", ")", "throws", "IOException", ",", "GeneralSecurityException", "{", "return", "PrivateKeyProvider", ".", "loadKey", "(", "pemString", ",", "passwd", ")", ";", "}" ]
Loads RSA/DSA private key in a PEM format into {@link KeyPair}.
[ "Loads", "RSA", "/", "DSA", "private", "key", "in", "a", "PEM", "format", "into", "{" ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/cli/src/main/java/hudson/cli/CLI.java#L390-L392
Deep-Symmetry/beat-link
src/main/java/org/deepsymmetry/beatlink/data/TimeFinder.java
TimeFinder.getTimeFor
public long getTimeFor(int player) { TrackPositionUpdate update = positions.get(player); if (update != null) { return interpolateTimeSinceUpdate(update, System.nanoTime()); } return -1; // We don't know. }
java
public long getTimeFor(int player) { TrackPositionUpdate update = positions.get(player); if (update != null) { return interpolateTimeSinceUpdate(update, System.nanoTime()); } return -1; // We don't know. }
[ "public", "long", "getTimeFor", "(", "int", "player", ")", "{", "TrackPositionUpdate", "update", "=", "positions", ".", "get", "(", "player", ")", ";", "if", "(", "update", "!=", "null", ")", "{", "return", "interpolateTimeSinceUpdate", "(", "update", ",", ...
Get the best guess we have for the current track position on the specified player. @param player the player number whose position is desired @return the milliseconds into the track that we believe playback has reached, or -1 if we don't know @throws IllegalStateException if the TimeFinder is not running
[ "Get", "the", "best", "guess", "we", "have", "for", "the", "current", "track", "position", "on", "the", "specified", "player", "." ]
train
https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/TimeFinder.java#L252-L258
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/TmdbSeasons.java
TmdbSeasons.getSeasonAccountState
public MediaState getSeasonAccountState(int tvID, String sessionID) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, tvID); parameters.add(Param.SESSION_ID, sessionID); URL url = new ApiUrl(apiKey, MethodBase.SEASON).subMethod(MethodSub.ACCOUNT_STATES).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { return MAPPER.readValue(webpage, MediaState.class); } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get account state", url, ex); } }
java
public MediaState getSeasonAccountState(int tvID, String sessionID) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, tvID); parameters.add(Param.SESSION_ID, sessionID); URL url = new ApiUrl(apiKey, MethodBase.SEASON).subMethod(MethodSub.ACCOUNT_STATES).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { return MAPPER.readValue(webpage, MediaState.class); } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get account state", url, ex); } }
[ "public", "MediaState", "getSeasonAccountState", "(", "int", "tvID", ",", "String", "sessionID", ")", "throws", "MovieDbException", "{", "TmdbParameters", "parameters", "=", "new", "TmdbParameters", "(", ")", ";", "parameters", ".", "add", "(", "Param", ".", "ID...
This method lets users get the status of whether or not the TV episodes of a season have been rated. A valid session id is required. @param tvID @param sessionID @return @throws MovieDbException
[ "This", "method", "lets", "users", "get", "the", "status", "of", "whether", "or", "not", "the", "TV", "episodes", "of", "a", "season", "have", "been", "rated", "." ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbSeasons.java#L111-L124
jbossas/jboss-invocation
src/main/java/org/jboss/invocation/proxy/MethodIdentifier.java
MethodIdentifier.getIdentifier
public static MethodIdentifier getIdentifier(final Class<?> returnType, final String name, final Class<?>... parameterTypes) { return new MethodIdentifier(returnType.getName(), name, namesOf(parameterTypes)); }
java
public static MethodIdentifier getIdentifier(final Class<?> returnType, final String name, final Class<?>... parameterTypes) { return new MethodIdentifier(returnType.getName(), name, namesOf(parameterTypes)); }
[ "public", "static", "MethodIdentifier", "getIdentifier", "(", "final", "Class", "<", "?", ">", "returnType", ",", "final", "String", "name", ",", "final", "Class", "<", "?", ">", "...", "parameterTypes", ")", "{", "return", "new", "MethodIdentifier", "(", "r...
Construct a new instance using class objects for the parameter types. @param returnType the method return type @param name the method name @param parameterTypes the method parameter types @return the identifier
[ "Construct", "a", "new", "instance", "using", "class", "objects", "for", "the", "parameter", "types", "." ]
train
https://github.com/jbossas/jboss-invocation/blob/f72586a554264cbc78fcdad9fdd3e84b833249c9/src/main/java/org/jboss/invocation/proxy/MethodIdentifier.java#L219-L221
apache/reef
lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/formats/ConfigurationModule.java
ConfigurationModule.set
public final <T> ConfigurationModule set(final Param<List> opt, final List implList) { final ConfigurationModule c = deepCopy(); c.processSet(opt); c.setParamLists.put(opt, implList); return c; }
java
public final <T> ConfigurationModule set(final Param<List> opt, final List implList) { final ConfigurationModule c = deepCopy(); c.processSet(opt); c.setParamLists.put(opt, implList); return c; }
[ "public", "final", "<", "T", ">", "ConfigurationModule", "set", "(", "final", "Param", "<", "List", ">", "opt", ",", "final", "List", "implList", ")", "{", "final", "ConfigurationModule", "c", "=", "deepCopy", "(", ")", ";", "c", ".", "processSet", "(", ...
Binds a list to a specific optional/required Param using ConfigurationModule. @param opt target optional/required Param @param implList List object to be injected @param <T> type @return the Configuration module
[ "Binds", "a", "list", "to", "a", "specific", "optional", "/", "required", "Param", "using", "ConfigurationModule", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/formats/ConfigurationModule.java#L196-L201
OpenLiberty/open-liberty
dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/stat/StatsCreator.java
StatsCreator.addSubStatsToParent
public static void addSubStatsToParent(SPIStats parentStats, SPIStats subStats) { StatsImpl p = (StatsImpl) parentStats; StatsImpl s = (StatsImpl) subStats; p.add(s); }
java
public static void addSubStatsToParent(SPIStats parentStats, SPIStats subStats) { StatsImpl p = (StatsImpl) parentStats; StatsImpl s = (StatsImpl) subStats; p.add(s); }
[ "public", "static", "void", "addSubStatsToParent", "(", "SPIStats", "parentStats", ",", "SPIStats", "subStats", ")", "{", "StatsImpl", "p", "=", "(", "StatsImpl", ")", "parentStats", ";", "StatsImpl", "s", "=", "(", "StatsImpl", ")", "subStats", ";", "p", "....
This method adds one Stats object as a subStats of another Stats object @param parentStats This Stats is the parent @param subStats This Stats is the child
[ "This", "method", "adds", "one", "Stats", "object", "as", "a", "subStats", "of", "another", "Stats", "object" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/stat/StatsCreator.java#L135-L139
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/FeaturesImpl.java
FeaturesImpl.updatePhraseListAsync
public Observable<OperationStatus> updatePhraseListAsync(UUID appId, String versionId, int phraselistId, UpdatePhraseListOptionalParameter updatePhraseListOptionalParameter) { return updatePhraseListWithServiceResponseAsync(appId, versionId, phraselistId, updatePhraseListOptionalParameter).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
java
public Observable<OperationStatus> updatePhraseListAsync(UUID appId, String versionId, int phraselistId, UpdatePhraseListOptionalParameter updatePhraseListOptionalParameter) { return updatePhraseListWithServiceResponseAsync(appId, versionId, phraselistId, updatePhraseListOptionalParameter).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OperationStatus", ">", "updatePhraseListAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "int", "phraselistId", ",", "UpdatePhraseListOptionalParameter", "updatePhraseListOptionalParameter", ")", "{", "return", "updatePhraseListWi...
Updates the phrases, the state and the name of the phraselist feature. @param appId The application ID. @param versionId The version ID. @param phraselistId The ID of the feature to be updated. @param updatePhraseListOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatus object
[ "Updates", "the", "phrases", "the", "state", "and", "the", "name", "of", "the", "phraselist", "feature", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/FeaturesImpl.java#L675-L682
sai-pullabhotla/catatumbo
src/main/java/com/jmethods/catatumbo/impl/EntityIntrospector.java
EntityIntrospector.processIdentifierField
private void processIdentifierField(Field field) { Identifier identifier = field.getAnnotation(Identifier.class); boolean autoGenerated = identifier.autoGenerated(); IdentifierMetadata identifierMetadata = new IdentifierMetadata(field, autoGenerated); entityMetadata.setIdentifierMetadata(identifierMetadata); }
java
private void processIdentifierField(Field field) { Identifier identifier = field.getAnnotation(Identifier.class); boolean autoGenerated = identifier.autoGenerated(); IdentifierMetadata identifierMetadata = new IdentifierMetadata(field, autoGenerated); entityMetadata.setIdentifierMetadata(identifierMetadata); }
[ "private", "void", "processIdentifierField", "(", "Field", "field", ")", "{", "Identifier", "identifier", "=", "field", ".", "getAnnotation", "(", "Identifier", ".", "class", ")", ";", "boolean", "autoGenerated", "=", "identifier", ".", "autoGenerated", "(", ")"...
Processes the identifier field and builds the identifier metadata. @param field the identifier field
[ "Processes", "the", "identifier", "field", "and", "builds", "the", "identifier", "metadata", "." ]
train
https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/EntityIntrospector.java#L259-L264
Azure/azure-sdk-for-java
redis/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/redis/v2018_03_01/implementation/LinkedServersInner.java
LinkedServersInner.createAsync
public Observable<RedisLinkedServerWithPropertiesInner> createAsync(String resourceGroupName, String name, String linkedServerName, RedisLinkedServerCreateParameters parameters) { return createWithServiceResponseAsync(resourceGroupName, name, linkedServerName, parameters).map(new Func1<ServiceResponse<RedisLinkedServerWithPropertiesInner>, RedisLinkedServerWithPropertiesInner>() { @Override public RedisLinkedServerWithPropertiesInner call(ServiceResponse<RedisLinkedServerWithPropertiesInner> response) { return response.body(); } }); }
java
public Observable<RedisLinkedServerWithPropertiesInner> createAsync(String resourceGroupName, String name, String linkedServerName, RedisLinkedServerCreateParameters parameters) { return createWithServiceResponseAsync(resourceGroupName, name, linkedServerName, parameters).map(new Func1<ServiceResponse<RedisLinkedServerWithPropertiesInner>, RedisLinkedServerWithPropertiesInner>() { @Override public RedisLinkedServerWithPropertiesInner call(ServiceResponse<RedisLinkedServerWithPropertiesInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "RedisLinkedServerWithPropertiesInner", ">", "createAsync", "(", "String", "resourceGroupName", ",", "String", "name", ",", "String", "linkedServerName", ",", "RedisLinkedServerCreateParameters", "parameters", ")", "{", "return", "createWithServ...
Adds a linked server to the Redis cache (requires Premium SKU). @param resourceGroupName The name of the resource group. @param name The name of the Redis cache. @param linkedServerName The name of the linked server that is being added to the Redis cache. @param parameters Parameters supplied to the Create Linked server operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Adds", "a", "linked", "server", "to", "the", "Redis", "cache", "(", "requires", "Premium", "SKU", ")", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/redis/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/redis/v2018_03_01/implementation/LinkedServersInner.java#L132-L139
xvik/generics-resolver
src/main/java/ru/vyarus/java/generics/resolver/util/GenericInfoUtils.java
GenericInfoUtils.create
public static GenericsInfo create(final Class<?> type, final Class<?>... ignoreClasses) { // root class may contain generics or it may be inner class final LinkedHashMap<String, Type> generics = GenericsResolutionUtils.resolveRawGenerics(type); return create(type, generics, null, ignoreClasses); }
java
public static GenericsInfo create(final Class<?> type, final Class<?>... ignoreClasses) { // root class may contain generics or it may be inner class final LinkedHashMap<String, Type> generics = GenericsResolutionUtils.resolveRawGenerics(type); return create(type, generics, null, ignoreClasses); }
[ "public", "static", "GenericsInfo", "create", "(", "final", "Class", "<", "?", ">", "type", ",", "final", "Class", "<", "?", ">", "...", "ignoreClasses", ")", "{", "// root class may contain generics or it may be inner class", "final", "LinkedHashMap", "<", "String"...
Root class analysis. If root class has generics - they will be resolved as lower known bound. <p> The result must be cached. @param type class to analyze @param ignoreClasses exclude classes from hierarchy analysis @return analyzed type generics info
[ "Root", "class", "analysis", ".", "If", "root", "class", "has", "generics", "-", "they", "will", "be", "resolved", "as", "lower", "known", "bound", ".", "<p", ">", "The", "result", "must", "be", "cached", "." ]
train
https://github.com/xvik/generics-resolver/blob/d7d9d2783265df1178230e8f0b7cb6d853b67a7b/src/main/java/ru/vyarus/java/generics/resolver/util/GenericInfoUtils.java#L40-L44
samskivert/samskivert
src/main/java/com/samskivert/util/IntSets.java
IntSets.difference
public static IntSet difference (IntSet set1, IntSet set2) { return and(set1, notView(set2)); }
java
public static IntSet difference (IntSet set1, IntSet set2) { return and(set1, notView(set2)); }
[ "public", "static", "IntSet", "difference", "(", "IntSet", "set1", ",", "IntSet", "set2", ")", "{", "return", "and", "(", "set1", ",", "notView", "(", "set2", ")", ")", ";", "}" ]
Creates a new IntSet, initially populated with ints contained in set1 but not in set2. Set2 may also contain elements not present in set1, these are ignored.
[ "Creates", "a", "new", "IntSet", "initially", "populated", "with", "ints", "contained", "in", "set1", "but", "not", "in", "set2", ".", "Set2", "may", "also", "contain", "elements", "not", "present", "in", "set1", "these", "are", "ignored", "." ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/IntSets.java#L131-L134
grails/grails-core
grails-core/src/main/groovy/org/grails/compiler/injection/GrailsASTUtils.java
GrailsASTUtils.buildGetPropertyExpression
public static MethodCallExpression buildGetPropertyExpression(final Expression objectExpression, final String propertyName, final ClassNode targetClassNode) { return buildGetPropertyExpression(objectExpression, propertyName, targetClassNode, false); }
java
public static MethodCallExpression buildGetPropertyExpression(final Expression objectExpression, final String propertyName, final ClassNode targetClassNode) { return buildGetPropertyExpression(objectExpression, propertyName, targetClassNode, false); }
[ "public", "static", "MethodCallExpression", "buildGetPropertyExpression", "(", "final", "Expression", "objectExpression", ",", "final", "String", "propertyName", ",", "final", "ClassNode", "targetClassNode", ")", "{", "return", "buildGetPropertyExpression", "(", "objectExpr...
Build static direct call to getter of a property @param objectExpression @param propertyName @param targetClassNode @return The method call expression
[ "Build", "static", "direct", "call", "to", "getter", "of", "a", "property" ]
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/org/grails/compiler/injection/GrailsASTUtils.java#L1301-L1303
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Start.java
Start.oneArg
private void oneArg(String[] args, int index) { if ((index + 1) < args.length) { setOption(args[index], args[index+1]); } else { usageError("main.requires_argument", args[index]); } }
java
private void oneArg(String[] args, int index) { if ((index + 1) < args.length) { setOption(args[index], args[index+1]); } else { usageError("main.requires_argument", args[index]); } }
[ "private", "void", "oneArg", "(", "String", "[", "]", "args", ",", "int", "index", ")", "{", "if", "(", "(", "index", "+", "1", ")", "<", "args", ".", "length", ")", "{", "setOption", "(", "args", "[", "index", "]", ",", "args", "[", "index", "...
Set one arg option. Error and exit if one argument is not provided.
[ "Set", "one", "arg", "option", ".", "Error", "and", "exit", "if", "one", "argument", "is", "not", "provided", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Start.java#L528-L534
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/zip/Zip4jExtensions.java
Zip4jExtensions.zipFiles
public static void zipFiles(final ZipFile zipFile4j, final File... toAdd) throws ZipException { zipFiles(zipFile4j, Zip4jConstants.COMP_DEFLATE, Zip4jConstants.DEFLATE_LEVEL_NORMAL, toAdd); }
java
public static void zipFiles(final ZipFile zipFile4j, final File... toAdd) throws ZipException { zipFiles(zipFile4j, Zip4jConstants.COMP_DEFLATE, Zip4jConstants.DEFLATE_LEVEL_NORMAL, toAdd); }
[ "public", "static", "void", "zipFiles", "(", "final", "ZipFile", "zipFile4j", ",", "final", "File", "...", "toAdd", ")", "throws", "ZipException", "{", "zipFiles", "(", "zipFile4j", ",", "Zip4jConstants", ".", "COMP_DEFLATE", ",", "Zip4jConstants", ".", "DEFLATE...
Adds a file or several files to the given zip file with the parameters Zip4jConstants.COMP_DEFLATE for the compression method and Zip4jConstants.DEFLATE_LEVEL_NORMAL as the compression level. @param zipFile4j the zip file4j @param toAdd the to add @throws ZipException the zip exception
[ "Adds", "a", "file", "or", "several", "files", "to", "the", "given", "zip", "file", "with", "the", "parameters", "Zip4jConstants", ".", "COMP_DEFLATE", "for", "the", "compression", "method", "and", "Zip4jConstants", ".", "DEFLATE_LEVEL_NORMAL", "as", "the", "com...
train
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/zip/Zip4jExtensions.java#L78-L82