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
threerings/narya
core/src/main/java/com/threerings/presents/peer/server/PeerManager.java
PeerManager.lookupNodeDatum
public <T> T lookupNodeDatum (Function<NodeObject,T> op) { for (T value : Iterables.filter(Iterables.transform(getNodeObjects(), op), Predicates.notNull())) { return value; } return null; }
java
public <T> T lookupNodeDatum (Function<NodeObject,T> op) { for (T value : Iterables.filter(Iterables.transform(getNodeObjects(), op), Predicates.notNull())) { return value; } return null; }
[ "public", "<", "T", ">", "T", "lookupNodeDatum", "(", "Function", "<", "NodeObject", ",", "T", ">", "op", ")", "{", "for", "(", "T", "value", ":", "Iterables", ".", "filter", "(", "Iterables", ".", "transform", "(", "getNodeObjects", "(", ")", ",", "...
Locates a datum from among the set of peer {@link NodeObject}s. Objects are searched in arbitrary order and the first non-null value returned by the supplied lookup operation is returned to the caller. Null if all lookup operations returned null.
[ "Locates", "a", "datum", "from", "among", "the", "set", "of", "peer", "{" ]
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L430-L437
zxing/zxing
android-integration/src/main/java/com/google/zxing/integration/android/IntentIntegrator.java
IntentIntegrator.startActivityForResult
protected void startActivityForResult(Intent intent, int code) { if (fragment == null) { activity.startActivityForResult(intent, code); } else { fragment.startActivityForResult(intent, code); } }
java
protected void startActivityForResult(Intent intent, int code) { if (fragment == null) { activity.startActivityForResult(intent, code); } else { fragment.startActivityForResult(intent, code); } }
[ "protected", "void", "startActivityForResult", "(", "Intent", "intent", ",", "int", "code", ")", "{", "if", "(", "fragment", "==", "null", ")", "{", "activity", ".", "startActivityForResult", "(", "intent", ",", "code", ")", ";", "}", "else", "{", "fragmen...
Start an activity. This method is defined to allow different methods of activity starting for newer versions of Android and for compatibility library. @param intent Intent to start. @param code Request code for the activity @see Activity#startActivityForResult(Intent, int) @see Fragment#startActivityForResult(Intent, int)
[ "Start", "an", "activity", ".", "This", "method", "is", "defined", "to", "allow", "different", "methods", "of", "activity", "starting", "for", "newer", "versions", "of", "Android", "and", "for", "compatibility", "library", "." ]
train
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/android-integration/src/main/java/com/google/zxing/integration/android/IntentIntegrator.java#L342-L348
GCRC/nunaliit
nunaliit2-dbWeb/src/main/java/ca/carleton/gcrc/dbWeb/DbWebServlet.java
DbWebServlet.performQuery
private void performQuery(HttpServletRequest request, HttpServletResponse response) throws Exception { User user = AuthenticationUtils.getUserFromRequest(request); String tableName = getTableNameFromRequest(request); DbTableAccess tableAccess = DbTableAccess.getAccess(dbSecurity, tableName, new DbUserAdaptor(user)); List<RecordSelector> whereMap = getRecordSelectorsFromRequest(request); List<FieldSelector> selectSpecifiers = getFieldSelectorsFromRequest(request); List<FieldSelector> groupByColumnNames = getGroupByFromRequest(request); List<OrderSpecifier> orderBy = getOrderByList(request); Integer limit = getLimitFromRequest(request); Integer offset = getOffsetFromRequest(request); JSONArray queriedObjects = tableAccess.query( whereMap ,selectSpecifiers ,groupByColumnNames ,orderBy ,limit ,offset ); JSONObject obj = new JSONObject(); obj.put("queried", queriedObjects); sendJsonResponse(response, obj); }
java
private void performQuery(HttpServletRequest request, HttpServletResponse response) throws Exception { User user = AuthenticationUtils.getUserFromRequest(request); String tableName = getTableNameFromRequest(request); DbTableAccess tableAccess = DbTableAccess.getAccess(dbSecurity, tableName, new DbUserAdaptor(user)); List<RecordSelector> whereMap = getRecordSelectorsFromRequest(request); List<FieldSelector> selectSpecifiers = getFieldSelectorsFromRequest(request); List<FieldSelector> groupByColumnNames = getGroupByFromRequest(request); List<OrderSpecifier> orderBy = getOrderByList(request); Integer limit = getLimitFromRequest(request); Integer offset = getOffsetFromRequest(request); JSONArray queriedObjects = tableAccess.query( whereMap ,selectSpecifiers ,groupByColumnNames ,orderBy ,limit ,offset ); JSONObject obj = new JSONObject(); obj.put("queried", queriedObjects); sendJsonResponse(response, obj); }
[ "private", "void", "performQuery", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "throws", "Exception", "{", "User", "user", "=", "AuthenticationUtils", ".", "getUserFromRequest", "(", "request", ")", ";", "String", "tableName", ...
Perform a SQL query of a specified table, that must be accessible via dbSec. The http parms must include: table=<tableName> specifying a valid and accessible table. the http parms may include one or more (each) of: select=<e1>[,<e2>[,...]] where each <ei> is the name of a valid and accessible column or is an expression of one of the forms: sum(<c>), max(<c>), min(<c>) where <c> is the name of a valid and accessible column. groupBy=<c1>[,<c2>[,...]] where each <ci> is the name of a valid and accessible column. where=<whereclause> where multiple where clauses are combined using logical AND and <whereClause> is of the form: <c>,<comparator> where <c> is the name of a valid and accessible column, and <comparator> is one of: eq(<value>) where value is a valid comparison value for the column's data type. ne(<value>) where value is a valid comparison value for the column's data type. ge(<value>) where value is a valid comparison value for the column's data type. le(<value>) where value is a valid comparison value for the column's data type. gt(<value>) where value is a valid comparison value for the column's data type. lt(<value>) where value is a valid comparison value for the column's data type. isNull. isNotNull. @param request http request containing the query parameters. @param response http response to be sent. @throws Exception (for a variety of reasons detected while parsing and validating the http parms).
[ "Perform", "a", "SQL", "query", "of", "a", "specified", "table", "that", "must", "be", "accessible", "via", "dbSec", "." ]
train
https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-dbWeb/src/main/java/ca/carleton/gcrc/dbWeb/DbWebServlet.java#L231-L257
networknt/light-4j
dump/src/main/java/com/networknt/dump/QueryParametersDumper.java
QueryParametersDumper.putDumpInfoTo
@Override protected void putDumpInfoTo(Map<String, Object> result) { if(this.queryParametersMap.size() > 0) { result.put(DumpConstants.QUERY_PARAMETERS, queryParametersMap); } }
java
@Override protected void putDumpInfoTo(Map<String, Object> result) { if(this.queryParametersMap.size() > 0) { result.put(DumpConstants.QUERY_PARAMETERS, queryParametersMap); } }
[ "@", "Override", "protected", "void", "putDumpInfoTo", "(", "Map", "<", "String", ",", "Object", ">", "result", ")", "{", "if", "(", "this", ".", "queryParametersMap", ".", "size", "(", ")", ">", "0", ")", "{", "result", ".", "put", "(", "DumpConstants...
put queryParametersMap to result. @param result a Map you want to put dumping info to.
[ "put", "queryParametersMap", "to", "result", "." ]
train
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/dump/src/main/java/com/networknt/dump/QueryParametersDumper.java#L55-L60
biojava/biojava
biojava-genome/src/main/java/org/biojava/nbio/genome/util/ChromosomeMappingTools.java
ChromosomeMappingTools.getTranscriptDNASequence
public static DNASequence getTranscriptDNASequence(TwoBitFacade twoBitFacade, String chromosome, List<Integer> exonStarts, List<Integer> exonEnds, int cdsStart, int cdsEnd, Character orientation) throws Exception { List<Range<Integer>> cdsRegion = getCDSRegions(exonStarts, exonEnds, cdsStart, cdsEnd); String dnaSequence = ""; for (Range<Integer> range : cdsRegion) { String exonSequence = twoBitFacade.getSequence(chromosome,range.lowerEndpoint(), range.upperEndpoint()); dnaSequence += exonSequence; } if (orientation.equals('-')) { dnaSequence = new StringBuilder(dnaSequence).reverse().toString(); DNASequence dna = new DNASequence(dnaSequence); SequenceView<NucleotideCompound> compliment = dna.getComplement(); dnaSequence = compliment.getSequenceAsString(); } return new DNASequence(dnaSequence.toUpperCase()); }
java
public static DNASequence getTranscriptDNASequence(TwoBitFacade twoBitFacade, String chromosome, List<Integer> exonStarts, List<Integer> exonEnds, int cdsStart, int cdsEnd, Character orientation) throws Exception { List<Range<Integer>> cdsRegion = getCDSRegions(exonStarts, exonEnds, cdsStart, cdsEnd); String dnaSequence = ""; for (Range<Integer> range : cdsRegion) { String exonSequence = twoBitFacade.getSequence(chromosome,range.lowerEndpoint(), range.upperEndpoint()); dnaSequence += exonSequence; } if (orientation.equals('-')) { dnaSequence = new StringBuilder(dnaSequence).reverse().toString(); DNASequence dna = new DNASequence(dnaSequence); SequenceView<NucleotideCompound> compliment = dna.getComplement(); dnaSequence = compliment.getSequenceAsString(); } return new DNASequence(dnaSequence.toUpperCase()); }
[ "public", "static", "DNASequence", "getTranscriptDNASequence", "(", "TwoBitFacade", "twoBitFacade", ",", "String", "chromosome", ",", "List", "<", "Integer", ">", "exonStarts", ",", "List", "<", "Integer", ">", "exonEnds", ",", "int", "cdsStart", ",", "int", "cd...
Extracts the DNA sequence transcribed from the input genetic coordinates. @param chromosome the name of the chromosome @param exonStarts The list holding the genetic coordinates pointing to the start positions of the exons (including UTR regions) @param exonEnds The list holding the genetic coordinates pointing to the end positions of the exons (including UTR regions) @param cdsStart The start position of a coding region @param cdsEnd The end position of a coding region @param orientation The orientation of the strand where the gene is living @return the DNA sequence transcribed from the input genetic coordinates
[ "Extracts", "the", "DNA", "sequence", "transcribed", "from", "the", "input", "genetic", "coordinates", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/util/ChromosomeMappingTools.java#L955-L971
voldemort/voldemort
src/java/voldemort/tools/admin/command/AdminCommandMeta.java
SubCommandMetaClearRebalance.doMetaClearRebalance
public static void doMetaClearRebalance(AdminClient adminClient, List<Integer> nodeIds) { AdminToolUtils.assertServerNotInOfflineState(adminClient, nodeIds); System.out.println("Setting " + MetadataStore.SERVER_STATE_KEY + " to " + MetadataStore.VoldemortState.NORMAL_SERVER); doMetaSet(adminClient, nodeIds, MetadataStore.SERVER_STATE_KEY, MetadataStore.VoldemortState.NORMAL_SERVER.toString()); RebalancerState state = RebalancerState.create("[]"); System.out.println("Cleaning up " + MetadataStore.REBALANCING_STEAL_INFO + " to " + state.toJsonString()); doMetaSet(adminClient, nodeIds, MetadataStore.REBALANCING_STEAL_INFO, state.toJsonString()); System.out.println("Cleaning up " + MetadataStore.REBALANCING_SOURCE_CLUSTER_XML + " to empty string"); doMetaSet(adminClient, nodeIds, MetadataStore.REBALANCING_SOURCE_CLUSTER_XML, ""); }
java
public static void doMetaClearRebalance(AdminClient adminClient, List<Integer> nodeIds) { AdminToolUtils.assertServerNotInOfflineState(adminClient, nodeIds); System.out.println("Setting " + MetadataStore.SERVER_STATE_KEY + " to " + MetadataStore.VoldemortState.NORMAL_SERVER); doMetaSet(adminClient, nodeIds, MetadataStore.SERVER_STATE_KEY, MetadataStore.VoldemortState.NORMAL_SERVER.toString()); RebalancerState state = RebalancerState.create("[]"); System.out.println("Cleaning up " + MetadataStore.REBALANCING_STEAL_INFO + " to " + state.toJsonString()); doMetaSet(adminClient, nodeIds, MetadataStore.REBALANCING_STEAL_INFO, state.toJsonString()); System.out.println("Cleaning up " + MetadataStore.REBALANCING_SOURCE_CLUSTER_XML + " to empty string"); doMetaSet(adminClient, nodeIds, MetadataStore.REBALANCING_SOURCE_CLUSTER_XML, ""); }
[ "public", "static", "void", "doMetaClearRebalance", "(", "AdminClient", "adminClient", ",", "List", "<", "Integer", ">", "nodeIds", ")", "{", "AdminToolUtils", ".", "assertServerNotInOfflineState", "(", "adminClient", ",", "nodeIds", ")", ";", "System", ".", "out"...
Removes metadata related to rebalancing. @param adminClient An instance of AdminClient points to given cluster @param nodeIds Node ids to clear metadata after rebalancing
[ "Removes", "metadata", "related", "to", "rebalancing", "." ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/tools/admin/command/AdminCommandMeta.java#L658-L676
crawljax/crawljax
core/src/main/java/com/crawljax/util/DomUtils.java
DomUtils.removeTags
public static Document removeTags(Document dom, String tagName) { NodeList list; try { list = XPathHelper.evaluateXpathExpression(dom, "//" + tagName.toUpperCase()); while (list.getLength() > 0) { Node sc = list.item(0); if (sc != null) { sc.getParentNode().removeChild(sc); } list = XPathHelper.evaluateXpathExpression(dom, "//" + tagName.toUpperCase()); } } catch (XPathExpressionException e) { LOGGER.error("Error while removing tag " + tagName, e); } return dom; }
java
public static Document removeTags(Document dom, String tagName) { NodeList list; try { list = XPathHelper.evaluateXpathExpression(dom, "//" + tagName.toUpperCase()); while (list.getLength() > 0) { Node sc = list.item(0); if (sc != null) { sc.getParentNode().removeChild(sc); } list = XPathHelper.evaluateXpathExpression(dom, "//" + tagName.toUpperCase()); } } catch (XPathExpressionException e) { LOGGER.error("Error while removing tag " + tagName, e); } return dom; }
[ "public", "static", "Document", "removeTags", "(", "Document", "dom", ",", "String", "tagName", ")", "{", "NodeList", "list", ";", "try", "{", "list", "=", "XPathHelper", ".", "evaluateXpathExpression", "(", "dom", ",", "\"//\"", "+", "tagName", ".", "toUppe...
Removes all the given tags from the document. @param dom the document object. @param tagName the tag name, examples: script, style, meta @return the changed dom.
[ "Removes", "all", "the", "given", "tags", "from", "the", "document", "." ]
train
https://github.com/crawljax/crawljax/blob/d339f4f622ca902ccd35322065821e52a62ec543/core/src/main/java/com/crawljax/util/DomUtils.java#L171-L193
OpenLiberty/open-liberty
dev/com.ibm.ws.security.mp.jwt_fat_tck/fat/src/org/eclipse/microprofile/jwt/tck/util/TokenUtils.java
TokenUtils.readPrivateKey
public static PrivateKey readPrivateKey(String pemResName) throws Exception { InputStream contentIS = TokenUtils.class.getResourceAsStream(pemResName); byte[] tmp = new byte[4096]; int length = contentIS.read(tmp); PrivateKey privateKey = decodePrivateKey(new String(tmp, 0, length)); return privateKey; }
java
public static PrivateKey readPrivateKey(String pemResName) throws Exception { InputStream contentIS = TokenUtils.class.getResourceAsStream(pemResName); byte[] tmp = new byte[4096]; int length = contentIS.read(tmp); PrivateKey privateKey = decodePrivateKey(new String(tmp, 0, length)); return privateKey; }
[ "public", "static", "PrivateKey", "readPrivateKey", "(", "String", "pemResName", ")", "throws", "Exception", "{", "InputStream", "contentIS", "=", "TokenUtils", ".", "class", ".", "getResourceAsStream", "(", "pemResName", ")", ";", "byte", "[", "]", "tmp", "=", ...
Read a PEM encoded private key from the classpath @param pemResName - key file resource name @return PrivateKey @throws Exception on decode failure
[ "Read", "a", "PEM", "encoded", "private", "key", "from", "the", "classpath" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.mp.jwt_fat_tck/fat/src/org/eclipse/microprofile/jwt/tck/util/TokenUtils.java#L162-L168
BBN-E/bue-common-open
common-core-open/src/main/java/com/bbn/bue/common/primitives/DoubleUtils.java
DoubleUtils.min
public static double min(final double[] data, final int startInclusive, final int endExclusive) { checkArgument(endExclusive > startInclusive); checkArgument(startInclusive >= 0); checkArgument(endExclusive <= data.length); double minValue = Double.POSITIVE_INFINITY; for (int i = startInclusive; i < endExclusive; ++i) { minValue = Math.min(minValue, data[i]); } return minValue; }
java
public static double min(final double[] data, final int startInclusive, final int endExclusive) { checkArgument(endExclusive > startInclusive); checkArgument(startInclusive >= 0); checkArgument(endExclusive <= data.length); double minValue = Double.POSITIVE_INFINITY; for (int i = startInclusive; i < endExclusive; ++i) { minValue = Math.min(minValue, data[i]); } return minValue; }
[ "public", "static", "double", "min", "(", "final", "double", "[", "]", "data", ",", "final", "int", "startInclusive", ",", "final", "int", "endExclusive", ")", "{", "checkArgument", "(", "endExclusive", ">", "startInclusive", ")", ";", "checkArgument", "(", ...
Returns the maximum value in the array within the specified bounds. If the supplied range is empty or invalid, an {@link IllegalArgumentException} is thrown.
[ "Returns", "the", "maximum", "value", "in", "the", "array", "within", "the", "specified", "bounds", ".", "If", "the", "supplied", "range", "is", "empty", "or", "invalid", "an", "{" ]
train
https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/primitives/DoubleUtils.java#L177-L187
liferay/com-liferay-commerce
commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceListPersistenceImpl.java
CommercePriceListPersistenceImpl.removeByUUID_G
@Override public CommercePriceList removeByUUID_G(String uuid, long groupId) throws NoSuchPriceListException { CommercePriceList commercePriceList = findByUUID_G(uuid, groupId); return remove(commercePriceList); }
java
@Override public CommercePriceList removeByUUID_G(String uuid, long groupId) throws NoSuchPriceListException { CommercePriceList commercePriceList = findByUUID_G(uuid, groupId); return remove(commercePriceList); }
[ "@", "Override", "public", "CommercePriceList", "removeByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "throws", "NoSuchPriceListException", "{", "CommercePriceList", "commercePriceList", "=", "findByUUID_G", "(", "uuid", ",", "groupId", ")", ";", "re...
Removes the commerce price list where uuid = &#63; and groupId = &#63; from the database. @param uuid the uuid @param groupId the group ID @return the commerce price list that was removed
[ "Removes", "the", "commerce", "price", "list", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceListPersistenceImpl.java#L818-L824
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/config/loader/AbstractLoader.java
AbstractLoader.loadConfig
public Observable<Tuple2<LoaderType, BucketConfig>> loadConfig(final NetworkAddress seedNode, final String bucket, final String password) { LOGGER.debug("Loading Config for bucket {}", bucket); return loadConfig(seedNode, bucket, bucket, password); }
java
public Observable<Tuple2<LoaderType, BucketConfig>> loadConfig(final NetworkAddress seedNode, final String bucket, final String password) { LOGGER.debug("Loading Config for bucket {}", bucket); return loadConfig(seedNode, bucket, bucket, password); }
[ "public", "Observable", "<", "Tuple2", "<", "LoaderType", ",", "BucketConfig", ">", ">", "loadConfig", "(", "final", "NetworkAddress", "seedNode", ",", "final", "String", "bucket", ",", "final", "String", "password", ")", "{", "LOGGER", ".", "debug", "(", "\...
Initiate the config loading process. @param seedNode the seed node. @param bucket the name of the bucket. @param password the password of the bucket. @return a valid {@link BucketConfig}.
[ "Initiate", "the", "config", "loading", "process", "." ]
train
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/config/loader/AbstractLoader.java#L121-L125
kaazing/gateway
server/src/main/java/org/kaazing/gateway/server/config/parse/GatewayConfigParser.java
GatewayConfigParser.bufferToTraceLog
private static InputStream bufferToTraceLog(InputStream input, String message, Logger log) { InputStream output; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); int read; byte[] data = new byte[16384]; while ((read = input.read(data, 0, data.length)) != -1) { buffer.write(data, 0, read); } buffer.flush(); log.trace(message + "\n\n\n" + new String(buffer.toByteArray(), CHARSET_OUTPUT) + "\n\n\n"); output = new ByteArrayInputStream(buffer.toByteArray()); } catch (Exception e) { throw new RuntimeException("could not buffer stream", e); } return output; }
java
private static InputStream bufferToTraceLog(InputStream input, String message, Logger log) { InputStream output; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); int read; byte[] data = new byte[16384]; while ((read = input.read(data, 0, data.length)) != -1) { buffer.write(data, 0, read); } buffer.flush(); log.trace(message + "\n\n\n" + new String(buffer.toByteArray(), CHARSET_OUTPUT) + "\n\n\n"); output = new ByteArrayInputStream(buffer.toByteArray()); } catch (Exception e) { throw new RuntimeException("could not buffer stream", e); } return output; }
[ "private", "static", "InputStream", "bufferToTraceLog", "(", "InputStream", "input", ",", "String", "message", ",", "Logger", "log", ")", "{", "InputStream", "output", ";", "try", "{", "ByteArrayOutputStream", "buffer", "=", "new", "ByteArrayOutputStream", "(", ")...
Buffer a stream, flushing it to <code>log</code> and returning it as input @param input @param message @param log @return
[ "Buffer", "a", "stream", "flushing", "it", "to", "<code", ">", "log<", "/", "code", ">", "and", "returning", "it", "as", "input" ]
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/server/src/main/java/org/kaazing/gateway/server/config/parse/GatewayConfigParser.java#L436-L452
james-hu/jabb-core
src/main/java/net/sf/jabb/spring/rest/AbstractRestClient.java
AbstractRestClient.addBasicAuthHeader
protected void addBasicAuthHeader(HttpHeaders headers, String key){ headers.add(HEADER_AUTHORIZATION, buildBasicAuthValue(key)); }
java
protected void addBasicAuthHeader(HttpHeaders headers, String key){ headers.add(HEADER_AUTHORIZATION, buildBasicAuthValue(key)); }
[ "protected", "void", "addBasicAuthHeader", "(", "HttpHeaders", "headers", ",", "String", "key", ")", "{", "headers", ".", "add", "(", "HEADER_AUTHORIZATION", ",", "buildBasicAuthValue", "(", "key", ")", ")", ";", "}" ]
Add HTTP Basic Auth header @param headers the headers, it must not be a read-only one, if it is, use {@link #copy(HttpHeaders)} to make a writable copy first @param key the API key
[ "Add", "HTTP", "Basic", "Auth", "header" ]
train
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/spring/rest/AbstractRestClient.java#L659-L661
sai-pullabhotla/catatumbo
src/main/java/com/jmethods/catatumbo/impl/EntityIntrospector.java
EntityIntrospector.initEntityMetadata
private void initEntityMetadata(Entity entity) { String kind = entity.kind(); if (kind.trim().length() == 0) { kind = entityClass.getSimpleName(); } entityMetadata = new EntityMetadata(entityClass, kind); }
java
private void initEntityMetadata(Entity entity) { String kind = entity.kind(); if (kind.trim().length() == 0) { kind = entityClass.getSimpleName(); } entityMetadata = new EntityMetadata(entityClass, kind); }
[ "private", "void", "initEntityMetadata", "(", "Entity", "entity", ")", "{", "String", "kind", "=", "entity", ".", "kind", "(", ")", ";", "if", "(", "kind", ".", "trim", "(", ")", ".", "length", "(", ")", "==", "0", ")", "{", "kind", "=", "entityCla...
Initializes the metadata using the given {@link Entity} annotation. @param entity the {@link Entity} annotation.
[ "Initializes", "the", "metadata", "using", "the", "given", "{", "@link", "Entity", "}", "annotation", "." ]
train
https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/EntityIntrospector.java#L177-L183
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/RadioCheckField.java
RadioCheckField.getRadioGroup
public PdfFormField getRadioGroup(boolean noToggleToOff, boolean radiosInUnison) { PdfFormField field = PdfFormField.createRadioButton(writer, noToggleToOff); if (radiosInUnison) field.setFieldFlags(PdfFormField.FF_RADIOSINUNISON); field.setFieldName(fieldName); if ((options & READ_ONLY) != 0) field.setFieldFlags(PdfFormField.FF_READ_ONLY); if ((options & REQUIRED) != 0) field.setFieldFlags(PdfFormField.FF_REQUIRED); field.setValueAsName(checked ? onValue : "Off"); return field; }
java
public PdfFormField getRadioGroup(boolean noToggleToOff, boolean radiosInUnison) { PdfFormField field = PdfFormField.createRadioButton(writer, noToggleToOff); if (radiosInUnison) field.setFieldFlags(PdfFormField.FF_RADIOSINUNISON); field.setFieldName(fieldName); if ((options & READ_ONLY) != 0) field.setFieldFlags(PdfFormField.FF_READ_ONLY); if ((options & REQUIRED) != 0) field.setFieldFlags(PdfFormField.FF_REQUIRED); field.setValueAsName(checked ? onValue : "Off"); return field; }
[ "public", "PdfFormField", "getRadioGroup", "(", "boolean", "noToggleToOff", ",", "boolean", "radiosInUnison", ")", "{", "PdfFormField", "field", "=", "PdfFormField", ".", "createRadioButton", "(", "writer", ",", "noToggleToOff", ")", ";", "if", "(", "radiosInUnison"...
Gets a radio group. It's composed of the field specific keys, without the widget ones. This field is to be used as a field aggregator with {@link PdfFormField#addKid(PdfFormField) addKid()}. @param noToggleToOff if <CODE>true</CODE>, exactly one radio button must be selected at all times; clicking the currently selected button has no effect. If <CODE>false</CODE>, clicking the selected button deselects it, leaving no button selected. @param radiosInUnison if <CODE>true</CODE>, a group of radio buttons within a radio button field that use the same value for the on state will turn on and off in unison; that is if one is checked, they are all checked. If <CODE>false</CODE>, the buttons are mutually exclusive (the same behavior as HTML radio buttons) @return the radio group
[ "Gets", "a", "radio", "group", ".", "It", "s", "composed", "of", "the", "field", "specific", "keys", "without", "the", "widget", "ones", ".", "This", "field", "is", "to", "be", "used", "as", "a", "field", "aggregator", "with", "{" ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/RadioCheckField.java#L324-L335
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java
VirtualMachinesInner.convertToManagedDisksAsync
public Observable<OperationStatusResponseInner> convertToManagedDisksAsync(String resourceGroupName, String vmName) { return convertToManagedDisksWithServiceResponseAsync(resourceGroupName, vmName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() { @Override public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) { return response.body(); } }); }
java
public Observable<OperationStatusResponseInner> convertToManagedDisksAsync(String resourceGroupName, String vmName) { return convertToManagedDisksWithServiceResponseAsync(resourceGroupName, vmName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() { @Override public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OperationStatusResponseInner", ">", "convertToManagedDisksAsync", "(", "String", "resourceGroupName", ",", "String", "vmName", ")", "{", "return", "convertToManagedDisksWithServiceResponseAsync", "(", "resourceGroupName", ",", "vmName", ")", "....
Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before invoking this operation. @param resourceGroupName The name of the resource group. @param vmName The name of the virtual machine. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Converts", "virtual", "machine", "disks", "from", "blob", "-", "based", "to", "managed", "disks", ".", "Virtual", "machine", "must", "be", "stop", "-", "deallocated", "before", "invoking", "this", "operation", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java#L1159-L1166
Jasig/uPortal
uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/groups/RDBMEntityGroupStore.java
RDBMEntityGroupStore.findEntitiesForGroup
@Override public Iterator findEntitiesForGroup(IEntityGroup group) throws GroupsException { Collection entities = new ArrayList(); Connection conn = null; String groupID = group.getLocalKey(); Class cls = group.getLeafType(); try { conn = RDBMServices.getConnection(); Statement stmnt = conn.createStatement(); try { String query = "SELECT " + MEMBER_MEMBER_KEY_COLUMN + " FROM " + MEMBER_TABLE + " WHERE " + MEMBER_GROUP_ID_COLUMN + " = '" + groupID + "' AND " + MEMBER_IS_GROUP_COLUMN + " = '" + MEMBER_IS_ENTITY + "'"; ResultSet rs = stmnt.executeQuery(query); try { while (rs.next()) { String key = rs.getString(1); IEntity e = newEntity(cls, key); entities.add(e); } } finally { rs.close(); } } finally { stmnt.close(); } } catch (SQLException sqle) { LOG.error("Problem retrieving Entities for Group: " + group, sqle); throw new GroupsException("Problem retrieving Entities for Group", sqle); } finally { RDBMServices.releaseConnection(conn); } return entities.iterator(); }
java
@Override public Iterator findEntitiesForGroup(IEntityGroup group) throws GroupsException { Collection entities = new ArrayList(); Connection conn = null; String groupID = group.getLocalKey(); Class cls = group.getLeafType(); try { conn = RDBMServices.getConnection(); Statement stmnt = conn.createStatement(); try { String query = "SELECT " + MEMBER_MEMBER_KEY_COLUMN + " FROM " + MEMBER_TABLE + " WHERE " + MEMBER_GROUP_ID_COLUMN + " = '" + groupID + "' AND " + MEMBER_IS_GROUP_COLUMN + " = '" + MEMBER_IS_ENTITY + "'"; ResultSet rs = stmnt.executeQuery(query); try { while (rs.next()) { String key = rs.getString(1); IEntity e = newEntity(cls, key); entities.add(e); } } finally { rs.close(); } } finally { stmnt.close(); } } catch (SQLException sqle) { LOG.error("Problem retrieving Entities for Group: " + group, sqle); throw new GroupsException("Problem retrieving Entities for Group", sqle); } finally { RDBMServices.releaseConnection(conn); } return entities.iterator(); }
[ "@", "Override", "public", "Iterator", "findEntitiesForGroup", "(", "IEntityGroup", "group", ")", "throws", "GroupsException", "{", "Collection", "entities", "=", "new", "ArrayList", "(", ")", ";", "Connection", "conn", "=", "null", ";", "String", "groupID", "="...
Find the <code>IEntities</code> that are members of the <code>IEntityGroup</code>. @param group the entity group in question @return java.util.Iterator
[ "Find", "the", "<code", ">", "IEntities<", "/", "code", ">", "that", "are", "members", "of", "the", "<code", ">", "IEntityGroup<", "/", "code", ">", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/groups/RDBMEntityGroupStore.java#L446-L494
wisdom-framework/wisdom
core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/CompilerExecutor.java
CompilerExecutor.getLongMessage
public static String getLongMessage(AbstractWisdomMojo mojo, Object exception) { try { return (String) exception.getClass().getMethod("getLongMessage").invoke(exception); } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { mojo.getLog().error("Cannot extract the long message from the Compilation Failure Exception " + exception, e); } return null; }
java
public static String getLongMessage(AbstractWisdomMojo mojo, Object exception) { try { return (String) exception.getClass().getMethod("getLongMessage").invoke(exception); } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { mojo.getLog().error("Cannot extract the long message from the Compilation Failure Exception " + exception, e); } return null; }
[ "public", "static", "String", "getLongMessage", "(", "AbstractWisdomMojo", "mojo", ",", "Object", "exception", ")", "{", "try", "{", "return", "(", "String", ")", "exception", ".", "getClass", "(", ")", ".", "getMethod", "(", "\"getLongMessage\"", ")", ".", ...
We can't access the {@link org.apache.maven.plugin.compiler.CompilationFailureException} directly, because the mojo is loaded in another classloader. So, we have to use this method to retrieve the 'compilation failures'. @param mojo the mojo @param exception the exception that must be a {@link org.apache.maven.plugin.compile.CompilationFailureException} @return the long message, {@literal null} if it can't be extracted from the exception
[ "We", "can", "t", "access", "the", "{", "@link", "org", ".", "apache", ".", "maven", ".", "plugin", ".", "compiler", ".", "CompilationFailureException", "}", "directly", "because", "the", "mojo", "is", "loaded", "in", "another", "classloader", ".", "So", "...
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/CompilerExecutor.java#L190-L198
gallandarakhneorg/afc
advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/RoadPolyline.java
RoadPolyline.getBeginPoint
@Pure <CT extends RoadConnection> CT getBeginPoint(Class<CT> connectionClass) { final StandardRoadConnection connection = this.firstConnection; if (connection == null) { return null; } if (connectionClass.isAssignableFrom(StandardRoadConnection.class)) { return connectionClass.cast(connection); } if (connectionClass.isAssignableFrom(RoadConnectionWithArrivalSegment.class)) { return connectionClass.cast(new RoadConnectionWithArrivalSegment(connection, this, true)); } throw new IllegalArgumentException("unsupported RoadConnection class"); //$NON-NLS-1$ }
java
@Pure <CT extends RoadConnection> CT getBeginPoint(Class<CT> connectionClass) { final StandardRoadConnection connection = this.firstConnection; if (connection == null) { return null; } if (connectionClass.isAssignableFrom(StandardRoadConnection.class)) { return connectionClass.cast(connection); } if (connectionClass.isAssignableFrom(RoadConnectionWithArrivalSegment.class)) { return connectionClass.cast(new RoadConnectionWithArrivalSegment(connection, this, true)); } throw new IllegalArgumentException("unsupported RoadConnection class"); //$NON-NLS-1$ }
[ "@", "Pure", "<", "CT", "extends", "RoadConnection", ">", "CT", "getBeginPoint", "(", "Class", "<", "CT", ">", "connectionClass", ")", "{", "final", "StandardRoadConnection", "connection", "=", "this", ".", "firstConnection", ";", "if", "(", "connection", "=="...
Replies the first point of this segment. @param <CT> is the type of the connection to reply @param connectionClass is the type of the connection to reply @return the first point of <code>null</code>
[ "Replies", "the", "first", "point", "of", "this", "segment", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/RoadPolyline.java#L242-L255
alkacon/opencms-core
src/org/opencms/db/CmsSecurityManager.java
CmsSecurityManager.writeGroup
public void writeGroup(CmsRequestContext context, CmsGroup group) throws CmsException, CmsRoleViolationException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { checkRole(dbc, CmsRole.ACCOUNT_MANAGER.forOrgUnit(getParentOrganizationalUnit(group.getName()))); m_driverManager.writeGroup(dbc, group); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_WRITE_GROUP_1, group.getName()), e); } finally { dbc.clear(); } }
java
public void writeGroup(CmsRequestContext context, CmsGroup group) throws CmsException, CmsRoleViolationException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { checkRole(dbc, CmsRole.ACCOUNT_MANAGER.forOrgUnit(getParentOrganizationalUnit(group.getName()))); m_driverManager.writeGroup(dbc, group); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_WRITE_GROUP_1, group.getName()), e); } finally { dbc.clear(); } }
[ "public", "void", "writeGroup", "(", "CmsRequestContext", "context", ",", "CmsGroup", "group", ")", "throws", "CmsException", ",", "CmsRoleViolationException", "{", "CmsDbContext", "dbc", "=", "m_dbContextFactory", ".", "getDbContext", "(", "context", ")", ";", "try...
Writes an already existing group.<p> The group id has to be a valid OpenCms group id.<br> The group with the given id will be completely overridden by the given data.<p> @param context the current request context @param group the group that should be written @throws CmsRoleViolationException if the current user does not own the role {@link CmsRole#ACCOUNT_MANAGER} for the current project @throws CmsException if operation was not successful
[ "Writes", "an", "already", "existing", "group", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L6666-L6677
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPoolImpl.java
SlotPoolImpl.failAllocation
@Override public Optional<ResourceID> failAllocation(final AllocationID allocationID, final Exception cause) { componentMainThreadExecutor.assertRunningInMainThread(); final PendingRequest pendingRequest = pendingRequests.removeKeyB(allocationID); if (pendingRequest != null) { // request was still pending failPendingRequest(pendingRequest, cause); return Optional.empty(); } else { return tryFailingAllocatedSlot(allocationID, cause); } // TODO: add some unit tests when the previous two are ready, the allocation may failed at any phase }
java
@Override public Optional<ResourceID> failAllocation(final AllocationID allocationID, final Exception cause) { componentMainThreadExecutor.assertRunningInMainThread(); final PendingRequest pendingRequest = pendingRequests.removeKeyB(allocationID); if (pendingRequest != null) { // request was still pending failPendingRequest(pendingRequest, cause); return Optional.empty(); } else { return tryFailingAllocatedSlot(allocationID, cause); } // TODO: add some unit tests when the previous two are ready, the allocation may failed at any phase }
[ "@", "Override", "public", "Optional", "<", "ResourceID", ">", "failAllocation", "(", "final", "AllocationID", "allocationID", ",", "final", "Exception", "cause", ")", "{", "componentMainThreadExecutor", ".", "assertRunningInMainThread", "(", ")", ";", "final", "Pen...
Fail the specified allocation and release the corresponding slot if we have one. This may triggered by JobManager when some slot allocation failed with rpcTimeout. Or this could be triggered by TaskManager, when it finds out something went wrong with the slot, and decided to take it back. @param allocationID Represents the allocation which should be failed @param cause The cause of the failure @return Optional task executor if it has no more slots registered
[ "Fail", "the", "specified", "allocation", "and", "release", "the", "corresponding", "slot", "if", "we", "have", "one", ".", "This", "may", "triggered", "by", "JobManager", "when", "some", "slot", "allocation", "failed", "with", "rpcTimeout", ".", "Or", "this",...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPoolImpl.java#L635-L651
google/closure-compiler
src/com/google/javascript/jscomp/JsMessageVisitor.java
JsMessageVisitor.maybeInitMetaDataFromJsDocOrHelpVar
private void maybeInitMetaDataFromJsDocOrHelpVar( Builder builder, Node varNode, @Nullable Node parentOfVarNode) throws MalformedException { // First check description in @desc if (maybeInitMetaDataFromJsDoc(builder, varNode)) { return; } // Check the preceding node for meta data if ((parentOfVarNode != null) && maybeInitMetaDataFromHelpVar(builder, varNode.getPrevious())) { return; } // Check the subsequent node for meta data maybeInitMetaDataFromHelpVar(builder, varNode.getNext()); }
java
private void maybeInitMetaDataFromJsDocOrHelpVar( Builder builder, Node varNode, @Nullable Node parentOfVarNode) throws MalformedException { // First check description in @desc if (maybeInitMetaDataFromJsDoc(builder, varNode)) { return; } // Check the preceding node for meta data if ((parentOfVarNode != null) && maybeInitMetaDataFromHelpVar(builder, varNode.getPrevious())) { return; } // Check the subsequent node for meta data maybeInitMetaDataFromHelpVar(builder, varNode.getNext()); }
[ "private", "void", "maybeInitMetaDataFromJsDocOrHelpVar", "(", "Builder", "builder", ",", "Node", "varNode", ",", "@", "Nullable", "Node", "parentOfVarNode", ")", "throws", "MalformedException", "{", "// First check description in @desc", "if", "(", "maybeInitMetaDataFromJs...
Initializes the meta data in a JsMessage by examining the nodes just before and after a message VAR node. @param builder the message builder whose meta data will be initialized @param varNode the message VAR node @param parentOfVarNode {@code varNode}'s parent node
[ "Initializes", "the", "meta", "data", "in", "a", "JsMessage", "by", "examining", "the", "nodes", "just", "before", "and", "after", "a", "message", "VAR", "node", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/JsMessageVisitor.java#L494-L511
UrielCh/ovh-java-sdk
ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java
ApiOvhEmaildomain.delegatedAccount_email_responder_DELETE
public OvhTaskSpecialAccount delegatedAccount_email_responder_DELETE(String email) throws IOException { String qPath = "/email/domain/delegatedAccount/{email}/responder"; StringBuilder sb = path(qPath, email); String resp = exec(qPath, "DELETE", sb.toString(), null); return convertTo(resp, OvhTaskSpecialAccount.class); }
java
public OvhTaskSpecialAccount delegatedAccount_email_responder_DELETE(String email) throws IOException { String qPath = "/email/domain/delegatedAccount/{email}/responder"; StringBuilder sb = path(qPath, email); String resp = exec(qPath, "DELETE", sb.toString(), null); return convertTo(resp, OvhTaskSpecialAccount.class); }
[ "public", "OvhTaskSpecialAccount", "delegatedAccount_email_responder_DELETE", "(", "String", "email", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/domain/delegatedAccount/{email}/responder\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",...
Delete an existing responder in server REST: DELETE /email/domain/delegatedAccount/{email}/responder @param email [required] Email
[ "Delete", "an", "existing", "responder", "in", "server" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L347-L352
UrielCh/ovh-java-sdk
ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java
ApiOvhXdsl.serviceName_monitoringNotifications_id_PUT
public void serviceName_monitoringNotifications_id_PUT(String serviceName, Long id, OvhMonitoringNotification body) throws IOException { String qPath = "/xdsl/{serviceName}/monitoringNotifications/{id}"; StringBuilder sb = path(qPath, serviceName, id); exec(qPath, "PUT", sb.toString(), body); }
java
public void serviceName_monitoringNotifications_id_PUT(String serviceName, Long id, OvhMonitoringNotification body) throws IOException { String qPath = "/xdsl/{serviceName}/monitoringNotifications/{id}"; StringBuilder sb = path(qPath, serviceName, id); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "serviceName_monitoringNotifications_id_PUT", "(", "String", "serviceName", ",", "Long", "id", ",", "OvhMonitoringNotification", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/xdsl/{serviceName}/monitoringNotifications/{id}\"", ";", ...
Alter this object properties REST: PUT /xdsl/{serviceName}/monitoringNotifications/{id} @param body [required] New object properties @param serviceName [required] The internal name of your XDSL offer @param id [required] Id of the object
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java#L1400-L1404
http-builder-ng/http-builder-ng
http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java
HttpBuilder.deleteAsync
public CompletableFuture<Object> deleteAsync(final Consumer<HttpConfig> configuration) { return CompletableFuture.supplyAsync(() -> delete(configuration), getExecutor()); }
java
public CompletableFuture<Object> deleteAsync(final Consumer<HttpConfig> configuration) { return CompletableFuture.supplyAsync(() -> delete(configuration), getExecutor()); }
[ "public", "CompletableFuture", "<", "Object", ">", "deleteAsync", "(", "final", "Consumer", "<", "HttpConfig", ">", "configuration", ")", "{", "return", "CompletableFuture", ".", "supplyAsync", "(", "(", ")", "->", "delete", "(", "configuration", ")", ",", "ge...
Executes an asynchronous DELETE request on the configured URI (asynchronous alias to the `delete(Consumer)` method), with additional configuration provided by the configuration function. This method is generally used for Java-specific configuration. [source,java] ---- HttpBuilder http = HttpBuilder.configure(config -> { config.getRequest().setUri("http://localhost:10101"); }); CompletableFuture<Object> future = http.deleteAsync(config -> { config.getRequest().getUri().setPath("/foo"); }); Object result = future.get(); ---- The configuration `closure` allows additional configuration for this request based on the {@link HttpConfig} interface. @param configuration the additional configuration function (delegated to {@link HttpConfig}) @return the {@link CompletableFuture} containing the result of the request
[ "Executes", "an", "asynchronous", "DELETE", "request", "on", "the", "configured", "URI", "(", "asynchronous", "alias", "to", "the", "delete", "(", "Consumer", ")", "method", ")", "with", "additional", "configuration", "provided", "by", "the", "configuration", "f...
train
https://github.com/http-builder-ng/http-builder-ng/blob/865f37732c102c748d3db8b905199dac9222a525/http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java#L1219-L1221
Samsung/GearVRf
GVRf/Extensions/3DCursor/IODevices/io_hand_template/src/main/java/com/sample/hand/template/IOHand.java
IOHand.addSceneObject
public void addSceneObject(int key, GVRSceneObject sceneObject) { // only add if not present if (!auxSceneObjects.containsKey(key)) { auxSceneObjects.put(key, sceneObject); handSceneObject.addChildObject(sceneObject); } }
java
public void addSceneObject(int key, GVRSceneObject sceneObject) { // only add if not present if (!auxSceneObjects.containsKey(key)) { auxSceneObjects.put(key, sceneObject); handSceneObject.addChildObject(sceneObject); } }
[ "public", "void", "addSceneObject", "(", "int", "key", ",", "GVRSceneObject", "sceneObject", ")", "{", "// only add if not present", "if", "(", "!", "auxSceneObjects", ".", "containsKey", "(", "key", ")", ")", "{", "auxSceneObjects", ".", "put", "(", "key", ",...
Add a {@link GVRSceneObject} to this {@link IOHand} @param key an int value that uniquely helps identify this {@link GVRSceneObject}. So that it can easily be looked up later on. @param sceneObject {@link GVRSceneObject} that is to be added.
[ "Add", "a", "{", "@link", "GVRSceneObject", "}", "to", "this", "{", "@link", "IOHand", "}" ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/3DCursor/IODevices/io_hand_template/src/main/java/com/sample/hand/template/IOHand.java#L77-L83
jferard/fastods
fastods/src/main/java/com/github/jferard/fastods/odselement/OdsElements.java
OdsElements.addAutofilter
public void addAutofilter(final Table table, final int r1, final int c1, final int r2, final int c2) { this.contentElement.addAutofilter(table, r1, c1, r2, c2); }
java
public void addAutofilter(final Table table, final int r1, final int c1, final int r2, final int c2) { this.contentElement.addAutofilter(table, r1, c1, r2, c2); }
[ "public", "void", "addAutofilter", "(", "final", "Table", "table", ",", "final", "int", "r1", ",", "final", "int", "c1", ",", "final", "int", "r2", ",", "final", "int", "c2", ")", "{", "this", ".", "contentElement", ".", "addAutofilter", "(", "table", ...
Add an autofilter to a table @param table the table @param r1 from row @param c1 from col @param r2 to row @param c2 to col
[ "Add", "an", "autofilter", "to", "a", "table" ]
train
https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/odselement/OdsElements.java#L438-L440
wavesoftware/java-eid-exceptions
src/main/java/pl/wavesoftware/eid/utils/EidPreconditions.java
EidPreconditions.checkElementIndex
public static int checkElementIndex(int index, int size, final String eid) { if (isSizeIllegal(size)) { throw new EidIllegalArgumentException(ensureEid(eid)); } if (isIndexAndSizeIllegal(index, size)) { throw new EidIndexOutOfBoundsException(ensureEid(eid)); } return index; }
java
public static int checkElementIndex(int index, int size, final String eid) { if (isSizeIllegal(size)) { throw new EidIllegalArgumentException(ensureEid(eid)); } if (isIndexAndSizeIllegal(index, size)) { throw new EidIndexOutOfBoundsException(ensureEid(eid)); } return index; }
[ "public", "static", "int", "checkElementIndex", "(", "int", "index", ",", "int", "size", ",", "final", "String", "eid", ")", "{", "if", "(", "isSizeIllegal", "(", "size", ")", ")", "{", "throw", "new", "EidIllegalArgumentException", "(", "ensureEid", "(", ...
Ensures that {@code index} specifies a valid <i>element</i> in an array, list or string of size {@code size}. An element index may range from zero, inclusive, to {@code size}, exclusive. <p> Please, note that for performance reasons, Eid is not evaluated until it's needed. If you are using {@code Validator}, please use {@link #checkElementIndex(int, int, Eid)} instead. @param index a user-supplied index identifying an element of an array, list or string @param size the size of that array, list or string @param eid the text to use to describe this index in an error message @return the value of {@code index} @throws EidIndexOutOfBoundsException if {@code index} is negative or is not less than {@code size} @throws EidIllegalArgumentException if {@code size} is negative
[ "Ensures", "that", "{", "@code", "index", "}", "specifies", "a", "valid", "<i", ">", "element<", "/", "i", ">", "in", "an", "array", "list", "or", "string", "of", "size", "{", "@code", "size", "}", ".", "An", "element", "index", "may", "range", "from...
train
https://github.com/wavesoftware/java-eid-exceptions/blob/3d3a3103c5858b6cbf68d2609a8949b717c38a56/src/main/java/pl/wavesoftware/eid/utils/EidPreconditions.java#L426-L434
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java
ApiOvhDedicatedCloud.serviceName_PUT
public void serviceName_PUT(String serviceName, net.minidev.ovh.api.dedicatedcloud.OvhDedicatedCloud body) throws IOException { String qPath = "/dedicatedCloud/{serviceName}"; StringBuilder sb = path(qPath, serviceName); exec(qPath, "PUT", sb.toString(), body); }
java
public void serviceName_PUT(String serviceName, net.minidev.ovh.api.dedicatedcloud.OvhDedicatedCloud body) throws IOException { String qPath = "/dedicatedCloud/{serviceName}"; StringBuilder sb = path(qPath, serviceName); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "serviceName_PUT", "(", "String", "serviceName", ",", "net", ".", "minidev", ".", "ovh", ".", "api", ".", "dedicatedcloud", ".", "OvhDedicatedCloud", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicatedCloud/{serviceNa...
Alter this object properties REST: PUT /dedicatedCloud/{serviceName} @param body [required] New object properties @param serviceName [required] Domain of the service @deprecated
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java#L2610-L2614
alexvasilkov/GestureViews
library/src/main/java/com/alexvasilkov/gestures/StateController.java
StateController.getMovementArea
public void getMovementArea(State state, RectF out) { movBounds.set(state).getExternalBounds(out); }
java
public void getMovementArea(State state, RectF out) { movBounds.set(state).getExternalBounds(out); }
[ "public", "void", "getMovementArea", "(", "State", "state", ",", "RectF", "out", ")", "{", "movBounds", ".", "set", "(", "state", ")", ".", "getExternalBounds", "(", "out", ")", ";", "}" ]
Calculates area in which {@link State#getX()} &amp; {@link State#getY()} values can change. Note, that this is different from {@link Settings#setMovementArea(int, int)} which defines part of the viewport in which image can move. @param state Current state @param out Output movement area rectangle
[ "Calculates", "area", "in", "which", "{", "@link", "State#getX", "()", "}", "&amp", ";", "{", "@link", "State#getY", "()", "}", "values", "can", "change", ".", "Note", "that", "this", "is", "different", "from", "{", "@link", "Settings#setMovementArea", "(", ...
train
https://github.com/alexvasilkov/GestureViews/blob/f0a4c266e31dcad23bd0d9013531bc1c501b9c9f/library/src/main/java/com/alexvasilkov/gestures/StateController.java#L322-L324
codelibs/jcifs
src/main/java/jcifs/smb1/smb1/NtlmPasswordAuthentication.java
NtlmPasswordAuthentication.getAnsiHash
public byte[] getAnsiHash( byte[] challenge ) { if( hashesExternal ) { return ansiHash; } switch (LM_COMPATIBILITY) { case 0: case 1: return getPreNTLMResponse( password, challenge ); case 2: return getNTLMResponse( password, challenge ); case 3: case 4: case 5: if( clientChallenge == null ) { clientChallenge = new byte[8]; RANDOM.nextBytes( clientChallenge ); } return getLMv2Response(domain, username, password, challenge, clientChallenge); default: return getPreNTLMResponse( password, challenge ); } }
java
public byte[] getAnsiHash( byte[] challenge ) { if( hashesExternal ) { return ansiHash; } switch (LM_COMPATIBILITY) { case 0: case 1: return getPreNTLMResponse( password, challenge ); case 2: return getNTLMResponse( password, challenge ); case 3: case 4: case 5: if( clientChallenge == null ) { clientChallenge = new byte[8]; RANDOM.nextBytes( clientChallenge ); } return getLMv2Response(domain, username, password, challenge, clientChallenge); default: return getPreNTLMResponse( password, challenge ); } }
[ "public", "byte", "[", "]", "getAnsiHash", "(", "byte", "[", "]", "challenge", ")", "{", "if", "(", "hashesExternal", ")", "{", "return", "ansiHash", ";", "}", "switch", "(", "LM_COMPATIBILITY", ")", "{", "case", "0", ":", "case", "1", ":", "return", ...
Computes the 24 byte ANSI password hash given the 8 byte server challenge.
[ "Computes", "the", "24", "byte", "ANSI", "password", "hash", "given", "the", "8", "byte", "server", "challenge", "." ]
train
https://github.com/codelibs/jcifs/blob/ac6a8ba2925648ae003ca2508aec32316065dc34/src/main/java/jcifs/smb1/smb1/NtlmPasswordAuthentication.java#L414-L436
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/event/SubCountHandler.java
SubCountHandler.setCount
public int setCount(double dFieldCount, boolean bDisableListeners, int iMoveMode) { int iErrorCode = DBConstants.NORMAL_RETURN; if (m_fldMain != null) { boolean[] rgbEnabled = null; if (bDisableListeners) rgbEnabled = m_fldMain.setEnableListeners(false); int iOriginalValue = (int)m_fldMain.getValue(); boolean bOriginalModified = m_fldMain.isModified(); int iOldOpenMode = m_fldMain.getRecord().setOpenMode(m_fldMain.getRecord().getOpenMode() & ~DBConstants.OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY); // don't trigger refresh and write iErrorCode = m_fldMain.setValue(dFieldCount, true, iMoveMode); // Set in main file's field if the record is not current m_fldMain.getRecord().setOpenMode(iOldOpenMode); if (iOriginalValue == (int)m_fldMain.getValue()) if (bOriginalModified == false) m_fldMain.setModified(bOriginalModified); // Make sure this didn't change if change was just null to 0. if (rgbEnabled != null) m_fldMain.setEnableListeners(rgbEnabled); } return iErrorCode; }
java
public int setCount(double dFieldCount, boolean bDisableListeners, int iMoveMode) { int iErrorCode = DBConstants.NORMAL_RETURN; if (m_fldMain != null) { boolean[] rgbEnabled = null; if (bDisableListeners) rgbEnabled = m_fldMain.setEnableListeners(false); int iOriginalValue = (int)m_fldMain.getValue(); boolean bOriginalModified = m_fldMain.isModified(); int iOldOpenMode = m_fldMain.getRecord().setOpenMode(m_fldMain.getRecord().getOpenMode() & ~DBConstants.OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY); // don't trigger refresh and write iErrorCode = m_fldMain.setValue(dFieldCount, true, iMoveMode); // Set in main file's field if the record is not current m_fldMain.getRecord().setOpenMode(iOldOpenMode); if (iOriginalValue == (int)m_fldMain.getValue()) if (bOriginalModified == false) m_fldMain.setModified(bOriginalModified); // Make sure this didn't change if change was just null to 0. if (rgbEnabled != null) m_fldMain.setEnableListeners(rgbEnabled); } return iErrorCode; }
[ "public", "int", "setCount", "(", "double", "dFieldCount", ",", "boolean", "bDisableListeners", ",", "int", "iMoveMode", ")", "{", "int", "iErrorCode", "=", "DBConstants", ".", "NORMAL_RETURN", ";", "if", "(", "m_fldMain", "!=", "null", ")", "{", "boolean", ...
Reset the field count. @param bDisableListeners Disable the field listeners (used for grid count verification) @param iMoveMode Move mode.
[ "Reset", "the", "field", "count", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/SubCountHandler.java#L312-L332
Alluxio/alluxio
core/server/worker/src/main/java/alluxio/worker/block/BlockMetadataManager.java
BlockMetadataManager.getBlockMeta
public BlockMeta getBlockMeta(long blockId) throws BlockDoesNotExistException { for (StorageTier tier : mTiers) { for (StorageDir dir : tier.getStorageDirs()) { if (dir.hasBlockMeta(blockId)) { return dir.getBlockMeta(blockId); } } } throw new BlockDoesNotExistException(ExceptionMessage.BLOCK_META_NOT_FOUND, blockId); }
java
public BlockMeta getBlockMeta(long blockId) throws BlockDoesNotExistException { for (StorageTier tier : mTiers) { for (StorageDir dir : tier.getStorageDirs()) { if (dir.hasBlockMeta(blockId)) { return dir.getBlockMeta(blockId); } } } throw new BlockDoesNotExistException(ExceptionMessage.BLOCK_META_NOT_FOUND, blockId); }
[ "public", "BlockMeta", "getBlockMeta", "(", "long", "blockId", ")", "throws", "BlockDoesNotExistException", "{", "for", "(", "StorageTier", "tier", ":", "mTiers", ")", "{", "for", "(", "StorageDir", "dir", ":", "tier", ".", "getStorageDirs", "(", ")", ")", "...
Gets the metadata of a block given its block id. @param blockId the block id @return metadata of the block @throws BlockDoesNotExistException if no BlockMeta for this block id is found
[ "Gets", "the", "metadata", "of", "a", "block", "given", "its", "block", "id", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/worker/src/main/java/alluxio/worker/block/BlockMetadataManager.java#L186-L195
ironjacamar/ironjacamar
sjc/src/main/java/org/ironjacamar/sjc/Main.java
Main.configurationInteger
private static int configurationInteger(Properties properties, String key, int defaultValue) { if (properties != null) { if (properties.containsKey(key)) return Integer.valueOf(properties.getProperty(key)); } return defaultValue; }
java
private static int configurationInteger(Properties properties, String key, int defaultValue) { if (properties != null) { if (properties.containsKey(key)) return Integer.valueOf(properties.getProperty(key)); } return defaultValue; }
[ "private", "static", "int", "configurationInteger", "(", "Properties", "properties", ",", "String", "key", ",", "int", "defaultValue", ")", "{", "if", "(", "properties", "!=", "null", ")", "{", "if", "(", "properties", ".", "containsKey", "(", "key", ")", ...
Get configuration integer @param properties The properties @param key The key @param defaultValue The default value @return The value
[ "Get", "configuration", "integer" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/sjc/src/main/java/org/ironjacamar/sjc/Main.java#L463-L472
Azure/azure-sdk-for-java
compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineScaleSetsInner.java
VirtualMachineScaleSetsInner.getOSUpgradeHistoryAsync
public Observable<Page<UpgradeOperationHistoricalStatusInfoInner>> getOSUpgradeHistoryAsync(final String resourceGroupName, final String vmScaleSetName) { return getOSUpgradeHistoryWithServiceResponseAsync(resourceGroupName, vmScaleSetName) .map(new Func1<ServiceResponse<Page<UpgradeOperationHistoricalStatusInfoInner>>, Page<UpgradeOperationHistoricalStatusInfoInner>>() { @Override public Page<UpgradeOperationHistoricalStatusInfoInner> call(ServiceResponse<Page<UpgradeOperationHistoricalStatusInfoInner>> response) { return response.body(); } }); }
java
public Observable<Page<UpgradeOperationHistoricalStatusInfoInner>> getOSUpgradeHistoryAsync(final String resourceGroupName, final String vmScaleSetName) { return getOSUpgradeHistoryWithServiceResponseAsync(resourceGroupName, vmScaleSetName) .map(new Func1<ServiceResponse<Page<UpgradeOperationHistoricalStatusInfoInner>>, Page<UpgradeOperationHistoricalStatusInfoInner>>() { @Override public Page<UpgradeOperationHistoricalStatusInfoInner> call(ServiceResponse<Page<UpgradeOperationHistoricalStatusInfoInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "UpgradeOperationHistoricalStatusInfoInner", ">", ">", "getOSUpgradeHistoryAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "vmScaleSetName", ")", "{", "return", "getOSUpgradeHistoryWithServiceResponseAsync...
Gets list of OS upgrades on a VM scale set instance. @param resourceGroupName The name of the resource group. @param vmScaleSetName The name of the VM scale set. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;UpgradeOperationHistoricalStatusInfoInner&gt; object
[ "Gets", "list", "of", "OS", "upgrades", "on", "a", "VM", "scale", "set", "instance", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineScaleSetsInner.java#L1793-L1801
Deep-Symmetry/beat-link
src/main/java/org/deepsymmetry/beatlink/data/MetadataFinder.java
MetadataFinder.getCueList
CueList getCueList(int rekordboxId, CdjStatus.TrackSourceSlot slot, Client client) throws IOException { Message response = client.simpleRequest(Message.KnownType.CUE_LIST_REQ, null, client.buildRMST(Message.MenuIdentifier.DATA, slot), new NumberField(rekordboxId)); if (response.knownType == Message.KnownType.CUE_LIST) { return new CueList(response); } logger.error("Unexpected response type when requesting cue list: {}", response); return null; }
java
CueList getCueList(int rekordboxId, CdjStatus.TrackSourceSlot slot, Client client) throws IOException { Message response = client.simpleRequest(Message.KnownType.CUE_LIST_REQ, null, client.buildRMST(Message.MenuIdentifier.DATA, slot), new NumberField(rekordboxId)); if (response.knownType == Message.KnownType.CUE_LIST) { return new CueList(response); } logger.error("Unexpected response type when requesting cue list: {}", response); return null; }
[ "CueList", "getCueList", "(", "int", "rekordboxId", ",", "CdjStatus", ".", "TrackSourceSlot", "slot", ",", "Client", "client", ")", "throws", "IOException", "{", "Message", "response", "=", "client", ".", "simpleRequest", "(", "Message", ".", "KnownType", ".", ...
Requests the cue list for a specific track ID, given a dbserver connection to a player that has already been set up. @param rekordboxId the track of interest @param slot identifies the media slot we are querying @param client the dbserver client that is communicating with the appropriate player @return the retrieved cue list, or {@code null} if none was available @throws IOException if there is a communication problem
[ "Requests", "the", "cue", "list", "for", "a", "specific", "track", "ID", "given", "a", "dbserver", "connection", "to", "a", "player", "that", "has", "already", "been", "set", "up", "." ]
train
https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/MetadataFinder.java#L188-L197
ironjacamar/ironjacamar
core/src/main/java/org/ironjacamar/core/tx/narayana/XAResourceRecoveryImpl.java
XAResourceRecoveryImpl.openConnection
private Object openConnection(ManagedConnection mc, Subject s) throws ResourceException { if (plugin == null) return null; log.debugf("Open connection (%s, %s)", mc, s); return mc.getConnection(s, null); }
java
private Object openConnection(ManagedConnection mc, Subject s) throws ResourceException { if (plugin == null) return null; log.debugf("Open connection (%s, %s)", mc, s); return mc.getConnection(s, null); }
[ "private", "Object", "openConnection", "(", "ManagedConnection", "mc", ",", "Subject", "s", ")", "throws", "ResourceException", "{", "if", "(", "plugin", "==", "null", ")", "return", "null", ";", "log", ".", "debugf", "(", "\"Open connection (%s, %s)\"", ",", ...
Open a connection @param mc The managed connection @param s The subject @return The connection handle @exception ResourceException Thrown in case of an error
[ "Open", "a", "connection" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/tx/narayana/XAResourceRecoveryImpl.java#L407-L415
before/quality-check
modules/quality-check/src/main/java/net/sf/qualitycheck/ConditionalCheck.java
ConditionalCheck.noNullElements
@ArgumentsChecked @Throws({ IllegalNullArgumentException.class, IllegalNullElementsException.class }) public static <T> void noNullElements(final boolean condition, @Nonnull final T[] array, @Nullable final String name) { if (condition) { Check.noNullElements(array, name); } }
java
@ArgumentsChecked @Throws({ IllegalNullArgumentException.class, IllegalNullElementsException.class }) public static <T> void noNullElements(final boolean condition, @Nonnull final T[] array, @Nullable final String name) { if (condition) { Check.noNullElements(array, name); } }
[ "@", "ArgumentsChecked", "@", "Throws", "(", "{", "IllegalNullArgumentException", ".", "class", ",", "IllegalNullElementsException", ".", "class", "}", ")", "public", "static", "<", "T", ">", "void", "noNullElements", "(", "final", "boolean", "condition", ",", "...
Ensures that an array does not contain {@code null}. @param condition condition must be {@code true}^ so that the check will be performed @param array reference to an array @param name name of object reference (in source code) @throws IllegalNullElementsException if the given argument {@code array} contains {@code null}
[ "Ensures", "that", "an", "array", "does", "not", "contain", "{", "@code", "null", "}", "." ]
train
https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/ConditionalCheck.java#L1133-L1139
spothero/volley-jackson-extension
Library/src/com/spothero/volley/JacksonNetwork.java
JacksonNetwork.entityToBytes
private byte[] entityToBytes(HttpEntity entity) throws IOException, ServerError { PoolingByteArrayOutputStream bytes = new PoolingByteArrayOutputStream(mPool, (int) entity.getContentLength()); byte[] buffer = null; try { InputStream in = entity.getContent(); if (in == null) { throw new ServerError(); } buffer = mPool.getBuf(1024); int count; while ((count = in.read(buffer)) != -1) { bytes.write(buffer, 0, count); } return bytes.toByteArray(); } finally { try { // Close the InputStream and release the resources by "consuming the content". entity.consumeContent(); } catch (IOException e) { // This can happen if there was an exception above that left the entity in // an invalid state. VolleyLog.v("Error occured when calling consumingContent"); } mPool.returnBuf(buffer); bytes.close(); } }
java
private byte[] entityToBytes(HttpEntity entity) throws IOException, ServerError { PoolingByteArrayOutputStream bytes = new PoolingByteArrayOutputStream(mPool, (int) entity.getContentLength()); byte[] buffer = null; try { InputStream in = entity.getContent(); if (in == null) { throw new ServerError(); } buffer = mPool.getBuf(1024); int count; while ((count = in.read(buffer)) != -1) { bytes.write(buffer, 0, count); } return bytes.toByteArray(); } finally { try { // Close the InputStream and release the resources by "consuming the content". entity.consumeContent(); } catch (IOException e) { // This can happen if there was an exception above that left the entity in // an invalid state. VolleyLog.v("Error occured when calling consumingContent"); } mPool.returnBuf(buffer); bytes.close(); } }
[ "private", "byte", "[", "]", "entityToBytes", "(", "HttpEntity", "entity", ")", "throws", "IOException", ",", "ServerError", "{", "PoolingByteArrayOutputStream", "bytes", "=", "new", "PoolingByteArrayOutputStream", "(", "mPool", ",", "(", "int", ")", "entity", "."...
Copied from {@link com.android.volley.toolbox.BasicNetwork} Reads the contents of HttpEntity into a byte[].
[ "Copied", "from", "{", "@link", "com", ".", "android", ".", "volley", ".", "toolbox", ".", "BasicNetwork", "}" ]
train
https://github.com/spothero/volley-jackson-extension/blob/9b02df3e3e8fc648c80aec2dfae456de949fb74b/Library/src/com/spothero/volley/JacksonNetwork.java#L127-L153
before/uadetector
modules/uadetector-core/src/main/java/net/sf/uadetector/datastore/UpdateOperationWithCacheFileTask.java
UpdateOperationWithCacheFileTask.readAndSave
protected static void readAndSave(@Nonnull final File file, @Nonnull final DataStore store) throws IOException { Check.notNull(file, "file"); Check.notNull(store, "store"); final URL url = store.getDataUrl(); final Charset charset = store.getCharset(); final boolean isEqual = url.toExternalForm().equals(UrlUtil.toUrl(file).toExternalForm()); if (!isEqual) { // check if the data can be read in successfully final String data = UrlUtil.read(url, charset); if (Data.EMPTY.equals(store.getDataReader().read(data))) { throw new IllegalStateException("The read in content can not be transformed to an instance of 'Data'."); } final File tempFile = createTemporaryFile(file); FileOutputStream outputStream = null; boolean threw = true; try { // write data to temporary file outputStream = new FileOutputStream(tempFile); outputStream.write(data.getBytes(charset)); // delete the original file deleteFile(file); threw = false; } finally { Closeables.close(outputStream, threw); } // rename the new file to the original one renameFile(tempFile, file); } else { LOG.debug(MSG_SAME_RESOURCES); } }
java
protected static void readAndSave(@Nonnull final File file, @Nonnull final DataStore store) throws IOException { Check.notNull(file, "file"); Check.notNull(store, "store"); final URL url = store.getDataUrl(); final Charset charset = store.getCharset(); final boolean isEqual = url.toExternalForm().equals(UrlUtil.toUrl(file).toExternalForm()); if (!isEqual) { // check if the data can be read in successfully final String data = UrlUtil.read(url, charset); if (Data.EMPTY.equals(store.getDataReader().read(data))) { throw new IllegalStateException("The read in content can not be transformed to an instance of 'Data'."); } final File tempFile = createTemporaryFile(file); FileOutputStream outputStream = null; boolean threw = true; try { // write data to temporary file outputStream = new FileOutputStream(tempFile); outputStream.write(data.getBytes(charset)); // delete the original file deleteFile(file); threw = false; } finally { Closeables.close(outputStream, threw); } // rename the new file to the original one renameFile(tempFile, file); } else { LOG.debug(MSG_SAME_RESOURCES); } }
[ "protected", "static", "void", "readAndSave", "(", "@", "Nonnull", "final", "File", "file", ",", "@", "Nonnull", "final", "DataStore", "store", ")", "throws", "IOException", "{", "Check", ".", "notNull", "(", "file", ",", "\"file\"", ")", ";", "Check", "."...
Reads the content from the given {@link URL} and saves it to the passed file. @param file file in which the entire contents from the given URL can be saved @param store a data store for <em>UAS data</em> @throws net.sf.qualitycheck.exception.IllegalNullArgumentException if any of the passed arguments is {@code null} @throws IOException if an I/O error occurs
[ "Reads", "the", "content", "from", "the", "given", "{", "@link", "URL", "}", "and", "saves", "it", "to", "the", "passed", "file", "." ]
train
https://github.com/before/uadetector/blob/215fb652723c52866572cff885f52a3fe67b9db5/modules/uadetector-core/src/main/java/net/sf/uadetector/datastore/UpdateOperationWithCacheFileTask.java#L131-L169
marklogic/java-client-api
marklogic-client-api/src/main/java/com/marklogic/client/query/StructuredQueryBuilder.java
StructuredQueryBuilder.geoJSONPropertyPair
public GeospatialIndex geoJSONPropertyPair(JSONProperty parent, JSONProperty lat, JSONProperty lon) { if ( parent == null ) throw new IllegalArgumentException("parent cannot be null"); if ( lat == null ) throw new IllegalArgumentException("lat cannot be null"); if ( lon == null ) throw new IllegalArgumentException("lon cannot be null"); return new GeoJSONPropertyPairImpl(parent, lat, lon); }
java
public GeospatialIndex geoJSONPropertyPair(JSONProperty parent, JSONProperty lat, JSONProperty lon) { if ( parent == null ) throw new IllegalArgumentException("parent cannot be null"); if ( lat == null ) throw new IllegalArgumentException("lat cannot be null"); if ( lon == null ) throw new IllegalArgumentException("lon cannot be null"); return new GeoJSONPropertyPairImpl(parent, lat, lon); }
[ "public", "GeospatialIndex", "geoJSONPropertyPair", "(", "JSONProperty", "parent", ",", "JSONProperty", "lat", ",", "JSONProperty", "lon", ")", "{", "if", "(", "parent", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"parent cannot be null\"", ...
Identifies a parent json property with child latitude and longitude json properties to match with a geospatial query. @param parent the parent json property of lat and lon @param lat the json property with the latitude coordinate @param lon the json property with the longitude coordinate @return the specification for the index on the geospatial coordinates
[ "Identifies", "a", "parent", "json", "property", "with", "child", "latitude", "and", "longitude", "json", "properties", "to", "match", "with", "a", "geospatial", "query", "." ]
train
https://github.com/marklogic/java-client-api/blob/acf60229a928abd4a8cc4b21b641d56957467da7/marklogic-client-api/src/main/java/com/marklogic/client/query/StructuredQueryBuilder.java#L857-L862
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
BpmnParse.parseBoundaryConditionalEventDefinition
public BoundaryConditionalEventActivityBehavior parseBoundaryConditionalEventDefinition(Element element, boolean interrupting, ActivityImpl conditionalActivity) { conditionalActivity.getProperties().set(BpmnProperties.TYPE, ActivityTypes.BOUNDARY_CONDITIONAL); ConditionalEventDefinition conditionalEventDefinition = parseConditionalEventDefinition(element, conditionalActivity); conditionalEventDefinition.setInterrupting(interrupting); addEventSubscriptionDeclaration(conditionalEventDefinition, conditionalActivity.getEventScope(), element); for (BpmnParseListener parseListener : parseListeners) { parseListener.parseBoundaryConditionalEventDefinition(element, interrupting, conditionalActivity); } return new BoundaryConditionalEventActivityBehavior(conditionalEventDefinition); }
java
public BoundaryConditionalEventActivityBehavior parseBoundaryConditionalEventDefinition(Element element, boolean interrupting, ActivityImpl conditionalActivity) { conditionalActivity.getProperties().set(BpmnProperties.TYPE, ActivityTypes.BOUNDARY_CONDITIONAL); ConditionalEventDefinition conditionalEventDefinition = parseConditionalEventDefinition(element, conditionalActivity); conditionalEventDefinition.setInterrupting(interrupting); addEventSubscriptionDeclaration(conditionalEventDefinition, conditionalActivity.getEventScope(), element); for (BpmnParseListener parseListener : parseListeners) { parseListener.parseBoundaryConditionalEventDefinition(element, interrupting, conditionalActivity); } return new BoundaryConditionalEventActivityBehavior(conditionalEventDefinition); }
[ "public", "BoundaryConditionalEventActivityBehavior", "parseBoundaryConditionalEventDefinition", "(", "Element", "element", ",", "boolean", "interrupting", ",", "ActivityImpl", "conditionalActivity", ")", "{", "conditionalActivity", ".", "getProperties", "(", ")", ".", "set",...
Parses the given element as conditional boundary event. @param element the XML element which contains the conditional event information @param interrupting indicates if the event is interrupting or not @param conditionalActivity the conditional event activity @return the boundary conditional event behavior which contains the condition
[ "Parses", "the", "given", "element", "as", "conditional", "boundary", "event", "." ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java#L3456-L3468
weld/core
impl/src/main/java/org/jboss/weld/util/BeanMethods.java
BeanMethods.filterMethods
public static <T> Collection<EnhancedAnnotatedMethod<?, ? super T>> filterMethods(final Collection<EnhancedAnnotatedMethod<?, ? super T>> methods) { return methods.stream().filter(m -> !m.getJavaMember().isBridge() && !m.getJavaMember().isSynthetic()).collect(Collectors.toList()); }
java
public static <T> Collection<EnhancedAnnotatedMethod<?, ? super T>> filterMethods(final Collection<EnhancedAnnotatedMethod<?, ? super T>> methods) { return methods.stream().filter(m -> !m.getJavaMember().isBridge() && !m.getJavaMember().isSynthetic()).collect(Collectors.toList()); }
[ "public", "static", "<", "T", ">", "Collection", "<", "EnhancedAnnotatedMethod", "<", "?", ",", "?", "super", "T", ">", ">", "filterMethods", "(", "final", "Collection", "<", "EnhancedAnnotatedMethod", "<", "?", ",", "?", "super", "T", ">", ">", "methods",...
Oracle JDK 8 compiler (unlike prev versions) generates bridge methods which have method and parameter annotations copied from the original method. However such methods should not become observers, producers, disposers, initializers and lifecycle callbacks. Moreover, JDK8u60 propagates parameter annotations to the synthetic method generated for a lambda. Therefore, we should also ignore synthetic methods. @param methods @return a collection with bridge and synthetic methods filtered out @see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6695379 @see https://issues.jboss.org/browse/WELD-2019
[ "Oracle", "JDK", "8", "compiler", "(", "unlike", "prev", "versions", ")", "generates", "bridge", "methods", "which", "have", "method", "and", "parameter", "annotations", "copied", "from", "the", "original", "method", ".", "However", "such", "methods", "should", ...
train
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/BeanMethods.java#L311-L313
devnied/Bit-lib4j
src/main/java/fr/devnied/bitlib/BitUtils.java
BitUtils.setNextLong
public void setNextLong(final long pValue, final int pLength) { if (pLength > Long.SIZE) { throw new IllegalArgumentException("Long overflow with length > 64"); } setNextValue(pValue, pLength, Long.SIZE - 1); }
java
public void setNextLong(final long pValue, final int pLength) { if (pLength > Long.SIZE) { throw new IllegalArgumentException("Long overflow with length > 64"); } setNextValue(pValue, pLength, Long.SIZE - 1); }
[ "public", "void", "setNextLong", "(", "final", "long", "pValue", ",", "final", "int", "pLength", ")", "{", "if", "(", "pLength", ">", "Long", ".", "SIZE", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Long overflow with length > 64\"", ")", ";"...
Add Long to the current position with the specified size Be careful with java long bit sign @param pValue the value to set @param pLength the length of the long
[ "Add", "Long", "to", "the", "current", "position", "with", "the", "specified", "size" ]
train
https://github.com/devnied/Bit-lib4j/blob/bdfa79fd12e7e3d5cf1196291825ef1bb12a1ee0/src/main/java/fr/devnied/bitlib/BitUtils.java#L571-L578
Omertron/api-thetvdb
src/main/java/com/omertron/thetvdbapi/TheTVDBApi.java
TheTVDBApi.getTVEpisode
private Episode getTVEpisode(String seriesId, int seasonNbr, int episodeNbr, String language, String episodeType) throws TvDbException { if (!isValidNumber(seriesId) || !isValidNumber(seasonNbr) || !isValidNumber(episodeNbr)) { // Invalid number passed return new Episode(); } StringBuilder urlBuilder = new StringBuilder(); urlBuilder.append(BASE_URL) .append(apiKey) .append(SERIES_URL) .append(seriesId) .append(episodeType) .append(seasonNbr) .append("/") .append(episodeNbr) .append("/"); if (StringUtils.isNotBlank(language)) { urlBuilder.append(language).append(XML_EXTENSION); } LOG.trace(URL, urlBuilder.toString()); return TvdbParser.getEpisode(urlBuilder.toString()); }
java
private Episode getTVEpisode(String seriesId, int seasonNbr, int episodeNbr, String language, String episodeType) throws TvDbException { if (!isValidNumber(seriesId) || !isValidNumber(seasonNbr) || !isValidNumber(episodeNbr)) { // Invalid number passed return new Episode(); } StringBuilder urlBuilder = new StringBuilder(); urlBuilder.append(BASE_URL) .append(apiKey) .append(SERIES_URL) .append(seriesId) .append(episodeType) .append(seasonNbr) .append("/") .append(episodeNbr) .append("/"); if (StringUtils.isNotBlank(language)) { urlBuilder.append(language).append(XML_EXTENSION); } LOG.trace(URL, urlBuilder.toString()); return TvdbParser.getEpisode(urlBuilder.toString()); }
[ "private", "Episode", "getTVEpisode", "(", "String", "seriesId", ",", "int", "seasonNbr", ",", "int", "episodeNbr", ",", "String", "language", ",", "String", "episodeType", ")", "throws", "TvDbException", "{", "if", "(", "!", "isValidNumber", "(", "seriesId", ...
Generic function to get either the standard TV episode list or the DVD list @param seriesId @param seasonNbr @param episodeNbr @param language @param episodeType @return @throws com.omertron.thetvdbapi.TvDbException
[ "Generic", "function", "to", "get", "either", "the", "standard", "TV", "episode", "list", "or", "the", "DVD", "list" ]
train
https://github.com/Omertron/api-thetvdb/blob/2ff9f9580e76043f19d2fc3234d87e16a95fa485/src/main/java/com/omertron/thetvdbapi/TheTVDBApi.java#L209-L231
alkacon/opencms-core
src/org/opencms/db/CmsSecurityManager.java
CmsSecurityManager.readPropertyObject
public CmsProperty readPropertyObject(CmsRequestContext context, CmsResource resource, String key, boolean search) throws CmsException { return readPropertyObject(context, resource, key, search, null); }
java
public CmsProperty readPropertyObject(CmsRequestContext context, CmsResource resource, String key, boolean search) throws CmsException { return readPropertyObject(context, resource, key, search, null); }
[ "public", "CmsProperty", "readPropertyObject", "(", "CmsRequestContext", "context", ",", "CmsResource", "resource", ",", "String", "key", ",", "boolean", "search", ")", "throws", "CmsException", "{", "return", "readPropertyObject", "(", "context", ",", "resource", "...
Reads a property object from a resource specified by a property name.<p> Returns <code>{@link CmsProperty#getNullProperty()}</code> if the property is not found.<p> @param context the context of the current request @param resource the resource where the property is mapped to @param key the property key name @param search if <code>true</code>, the property is searched on all parent folders of the resource. if it's not found attached directly to the resource. @return the required property, or <code>{@link CmsProperty#getNullProperty()}</code> if the property was not found @throws CmsException if something goes wrong
[ "Reads", "a", "property", "object", "from", "a", "resource", "specified", "by", "a", "property", "name", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L4835-L4839
algolia/algoliasearch-client-java
src/main/java/com/algolia/search/saas/APIClient.java
APIClient.updateApiKey
public JSONObject updateApiKey(String key, List<String> acls, int validity, int maxQueriesPerIPPerHour, int maxHitsPerQuery, List<String> indexes) throws AlgoliaException { JSONObject jsonObject = generateUserKeyJson(acls, validity, maxQueriesPerIPPerHour, maxHitsPerQuery, indexes); return updateApiKey(key, jsonObject); }
java
public JSONObject updateApiKey(String key, List<String> acls, int validity, int maxQueriesPerIPPerHour, int maxHitsPerQuery, List<String> indexes) throws AlgoliaException { JSONObject jsonObject = generateUserKeyJson(acls, validity, maxQueriesPerIPPerHour, maxHitsPerQuery, indexes); return updateApiKey(key, jsonObject); }
[ "public", "JSONObject", "updateApiKey", "(", "String", "key", ",", "List", "<", "String", ">", "acls", ",", "int", "validity", ",", "int", "maxQueriesPerIPPerHour", ",", "int", "maxHitsPerQuery", ",", "List", "<", "String", ">", "indexes", ")", "throws", "Al...
Update an api key @param acls the list of ACL for this key. Defined by an array of strings that can contains the following values: - search: allow to search (https and http) - addObject: allows to add/update an object in the index (https only) - deleteObject : allows to delete an existing object (https only) - deleteIndex : allows to delete index content (https only) - settings : allows to get index settings (https only) - editSettings : allows to change index settings (https only) @param validity the number of seconds after which the key will be automatically removed (0 means no time limit for this key) @param maxQueriesPerIPPerHour Specify the maximum number of API calls allowed from an IP address per hour. Defaults to 0 (no rate limit). @param maxHitsPerQuery Specify the maximum number of hits this API key can retrieve in one call. Defaults to 0 (unlimited) @param indexes the list of targeted indexes
[ "Update", "an", "api", "key" ]
train
https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/APIClient.java#L925-L928
selenide/selenide
src/main/java/com/codeborne/selenide/impl/ScreenShotLaboratory.java
ScreenShotLaboratory.takeScreenShot
public String takeScreenShot(Driver driver, String fileName) { return ifWebDriverStarted(driver, webDriver -> ifReportsFolderNotNull(driver.config(), config -> takeScreenShot(config, webDriver, fileName))); }
java
public String takeScreenShot(Driver driver, String fileName) { return ifWebDriverStarted(driver, webDriver -> ifReportsFolderNotNull(driver.config(), config -> takeScreenShot(config, webDriver, fileName))); }
[ "public", "String", "takeScreenShot", "(", "Driver", "driver", ",", "String", "fileName", ")", "{", "return", "ifWebDriverStarted", "(", "driver", ",", "webDriver", "->", "ifReportsFolderNotNull", "(", "driver", ".", "config", "(", ")", ",", "config", "->", "t...
Takes screenshot of current browser window. Stores 2 files: html of page (if "savePageSource" option is enabled), and (if possible) image in PNG format. @param fileName name of file (without extension) to store screenshot to. @return the name of last saved screenshot or null if failed to create screenshot
[ "Takes", "screenshot", "of", "current", "browser", "window", ".", "Stores", "2", "files", ":", "html", "of", "page", "(", "if", "savePageSource", "option", "is", "enabled", ")", "and", "(", "if", "possible", ")", "image", "in", "PNG", "format", "." ]
train
https://github.com/selenide/selenide/blob/b867baf171942cf07725d83a985237428569883f/src/main/java/com/codeborne/selenide/impl/ScreenShotLaboratory.java#L78-L82
febit/wit
wit-core/src/main/java/org/febit/wit_shaded/asm/ClassWriter.java
ClassWriter.newClassItem
Item newClassItem(final String value) { Item result = get(key2.set(CLASS, value, null, null)); if (result == null) { pool.putBS(CLASS, newUTF8(value)); result = new Item(poolIndex++, key2); put(result); } return result; }
java
Item newClassItem(final String value) { Item result = get(key2.set(CLASS, value, null, null)); if (result == null) { pool.putBS(CLASS, newUTF8(value)); result = new Item(poolIndex++, key2); put(result); } return result; }
[ "Item", "newClassItem", "(", "final", "String", "value", ")", "{", "Item", "result", "=", "get", "(", "key2", ".", "set", "(", "CLASS", ",", "value", ",", "null", ",", "null", ")", ")", ";", "if", "(", "result", "==", "null", ")", "{", "pool", "....
Adds a class reference to the constant pool of the class being build. Does nothing if the constant pool already contains a similar item. <i>This method is intended for {@link Attribute} sub classes, and is normally not needed by class generators or adapters.</i> @param value the internal name of the class. @return a new or already existing class reference item.
[ "Adds", "a", "class", "reference", "to", "the", "constant", "pool", "of", "the", "class", "being", "build", ".", "Does", "nothing", "if", "the", "constant", "pool", "already", "contains", "a", "similar", "item", ".", "<i", ">", "This", "method", "is", "i...
train
https://github.com/febit/wit/blob/89ee29efbc5633b79c30c3c7b953c9f4130575af/wit-core/src/main/java/org/febit/wit_shaded/asm/ClassWriter.java#L549-L557
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/search/FileSearchExtensions.java
FileSearchExtensions.containsFile
public static boolean containsFile(final File fileToSearch, final String pathname) { final String[] allFiles = fileToSearch.list(); if (allFiles == null) { return false; } final List<String> list = Arrays.asList(allFiles); return list.contains(pathname); }
java
public static boolean containsFile(final File fileToSearch, final String pathname) { final String[] allFiles = fileToSearch.list(); if (allFiles == null) { return false; } final List<String> list = Arrays.asList(allFiles); return list.contains(pathname); }
[ "public", "static", "boolean", "containsFile", "(", "final", "File", "fileToSearch", ",", "final", "String", "pathname", ")", "{", "final", "String", "[", "]", "allFiles", "=", "fileToSearch", ".", "list", "(", ")", ";", "if", "(", "allFiles", "==", "null"...
Checks if the given file contains in the parent file. @param fileToSearch The parent directory to search. @param pathname The file to search. @return 's true if the file exists in the parent directory otherwise false.
[ "Checks", "if", "the", "given", "file", "contains", "in", "the", "parent", "file", "." ]
train
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/search/FileSearchExtensions.java#L80-L89
facebookarchive/nifty
nifty-ssl/src/main/java/com/facebook/nifty/ssl/NiftyOpenSslServerContext.java
NiftyOpenSslServerContext.newEngine
public SSLEngine newEngine() { if (nextProtocols.isEmpty()) { return new OpenSslEngine(ctx, bufferPool, null); } else { return new OpenSslEngine( ctx, bufferPool, nextProtocols.get(nextProtocols.size() - 1)); } }
java
public SSLEngine newEngine() { if (nextProtocols.isEmpty()) { return new OpenSslEngine(ctx, bufferPool, null); } else { return new OpenSslEngine( ctx, bufferPool, nextProtocols.get(nextProtocols.size() - 1)); } }
[ "public", "SSLEngine", "newEngine", "(", ")", "{", "if", "(", "nextProtocols", ".", "isEmpty", "(", ")", ")", "{", "return", "new", "OpenSslEngine", "(", "ctx", ",", "bufferPool", ",", "null", ")", ";", "}", "else", "{", "return", "new", "OpenSslEngine",...
Returns a new server-side {@link SSLEngine} with the current configuration.
[ "Returns", "a", "new", "server", "-", "side", "{" ]
train
https://github.com/facebookarchive/nifty/blob/ccacff7f0a723abe0b9ed399bcc3bc85784e7396/nifty-ssl/src/main/java/com/facebook/nifty/ssl/NiftyOpenSslServerContext.java#L266-L273
Harium/keel
src/main/java/com/harium/keel/catalano/math/tools/ImageStatistics.java
ImageStatistics.Variance
public static float Variance(ImageSource fastBitmap, float mean, int startX, int startY, int width, int height) { float sum = 0; if (fastBitmap.isGrayscale()) { for (int i = startX; i < height; i++) { for (int j = startY; j < width; j++) { sum += Math.pow(fastBitmap.getRGB(j, i) - mean, 2); } } return sum / (float) ((width * height) - 1); } else { throw new IllegalArgumentException("ImageStatistics: Only compute variance in grayscale images."); } }
java
public static float Variance(ImageSource fastBitmap, float mean, int startX, int startY, int width, int height) { float sum = 0; if (fastBitmap.isGrayscale()) { for (int i = startX; i < height; i++) { for (int j = startY; j < width; j++) { sum += Math.pow(fastBitmap.getRGB(j, i) - mean, 2); } } return sum / (float) ((width * height) - 1); } else { throw new IllegalArgumentException("ImageStatistics: Only compute variance in grayscale images."); } }
[ "public", "static", "float", "Variance", "(", "ImageSource", "fastBitmap", ",", "float", "mean", ",", "int", "startX", ",", "int", "startY", ",", "int", "width", ",", "int", "height", ")", "{", "float", "sum", "=", "0", ";", "if", "(", "fastBitmap", "....
Calculate Variance. @param fastBitmap Image to be processed. @param mean Mean. @param startX Initial X axis coordinate. @param startY Initial Y axis coordinate. @param width Width. @param height Height. @return Variance.
[ "Calculate", "Variance", "." ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/tools/ImageStatistics.java#L228-L241
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/handler/bundle/AbstractResourceBundleHandler.java
AbstractResourceBundleHandler.getStoredBundlePath
private String getStoredBundlePath(String rootDir, String bundleName) { if (bundleName.indexOf('/') != -1) { bundleName = bundleName.replace('/', File.separatorChar); } if (!bundleName.startsWith(File.separator)) { rootDir += File.separator; } return rootDir + PathNormalizer.escapeToPhysicalPath(bundleName); }
java
private String getStoredBundlePath(String rootDir, String bundleName) { if (bundleName.indexOf('/') != -1) { bundleName = bundleName.replace('/', File.separatorChar); } if (!bundleName.startsWith(File.separator)) { rootDir += File.separator; } return rootDir + PathNormalizer.escapeToPhysicalPath(bundleName); }
[ "private", "String", "getStoredBundlePath", "(", "String", "rootDir", ",", "String", "bundleName", ")", "{", "if", "(", "bundleName", ".", "indexOf", "(", "'", "'", ")", "!=", "-", "1", ")", "{", "bundleName", "=", "bundleName", ".", "replace", "(", "'",...
Resolves the file path of the bundle from the root directory. @param rootDir the rootDir @param bundleName the bundle name @return the file path
[ "Resolves", "the", "file", "path", "of", "the", "bundle", "from", "the", "root", "directory", "." ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/handler/bundle/AbstractResourceBundleHandler.java#L449-L459
ptgoetz/flux
flux-examples/src/main/java/org/apache/storm/flux/examples/WordCounter.java
WordCounter.execute
public void execute(Tuple input, BasicOutputCollector collector) { collector.emit(tuple(input.getValues().get(0), 1)); }
java
public void execute(Tuple input, BasicOutputCollector collector) { collector.emit(tuple(input.getValues().get(0), 1)); }
[ "public", "void", "execute", "(", "Tuple", "input", ",", "BasicOutputCollector", "collector", ")", "{", "collector", ".", "emit", "(", "tuple", "(", "input", ".", "getValues", "(", ")", ".", "get", "(", "0", ")", ",", "1", ")", ")", ";", "}" ]
/* Just output the word value with a count of 1. The HBaseBolt will handle incrementing the counter.
[ "/", "*", "Just", "output", "the", "word", "value", "with", "a", "count", "of", "1", ".", "The", "HBaseBolt", "will", "handle", "incrementing", "the", "counter", "." ]
train
https://github.com/ptgoetz/flux/blob/24b060a13a4f1fd876fa25cebe03a7d5b6f20b20/flux-examples/src/main/java/org/apache/storm/flux/examples/WordCounter.java#L54-L56
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelCBEFormatter.java
HpelCBEFormatter.formatRecord
@Override public String formatRecord(RepositoryLogRecord record, Locale locale) { if (null == record) { throw new IllegalArgumentException("Record cannot be null"); } return getFormattedRecord(record, locale); }
java
@Override public String formatRecord(RepositoryLogRecord record, Locale locale) { if (null == record) { throw new IllegalArgumentException("Record cannot be null"); } return getFormattedRecord(record, locale); }
[ "@", "Override", "public", "String", "formatRecord", "(", "RepositoryLogRecord", "record", ",", "Locale", "locale", ")", "{", "if", "(", "null", "==", "record", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Record cannot be null\"", ")", ";", "}"...
Formats a RepositoryLogRecord into a localized CBE format output String. @param record the RepositoryLogRecord to be formatted @param locale the Locale to use for localization when formatting this record. @return the formated string output.
[ "Formats", "a", "RepositoryLogRecord", "into", "a", "localized", "CBE", "format", "output", "String", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelCBEFormatter.java#L51-L58
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/mysql/AbstractMySQLQuery.java
AbstractMySQLQuery.bufferResult
@WithBridgeMethods(value = MySQLQuery.class, castRequired = true) public C bufferResult() { return addFlag(Position.AFTER_SELECT, SQL_BUFFER_RESULT); }
java
@WithBridgeMethods(value = MySQLQuery.class, castRequired = true) public C bufferResult() { return addFlag(Position.AFTER_SELECT, SQL_BUFFER_RESULT); }
[ "@", "WithBridgeMethods", "(", "value", "=", "MySQLQuery", ".", "class", ",", "castRequired", "=", "true", ")", "public", "C", "bufferResult", "(", ")", "{", "return", "addFlag", "(", "Position", ".", "AFTER_SELECT", ",", "SQL_BUFFER_RESULT", ")", ";", "}" ]
SQL_BUFFER_RESULT forces the result to be put into a temporary table. This helps MySQL free the table locks early and helps in cases where it takes a long time to send the result set to the client. This option can be used only for top-level SELECT statements, not for subqueries or following UNION. @return the current object
[ "SQL_BUFFER_RESULT", "forces", "the", "result", "to", "be", "put", "into", "a", "temporary", "table", ".", "This", "helps", "MySQL", "free", "the", "table", "locks", "early", "and", "helps", "in", "cases", "where", "it", "takes", "a", "long", "time", "to",...
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/mysql/AbstractMySQLQuery.java#L89-L92
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/map/impl/querycache/subscriber/EventPublisherHelper.java
EventPublisherHelper.publishCacheWideEvent
static void publishCacheWideEvent(InternalQueryCache queryCache, int numberOfEntriesAffected, EntryEventType eventType) { if (!hasListener(queryCache)) { return; } DefaultQueryCache defaultQueryCache = (DefaultQueryCache) queryCache; QueryCacheContext context = defaultQueryCache.context; String mapName = defaultQueryCache.mapName; String cacheId = defaultQueryCache.cacheId; QueryCacheEventService eventService = getQueryCacheEventService(context); LocalCacheWideEventData eventData = new LocalCacheWideEventData(cacheId, eventType.getType(), numberOfEntriesAffected); eventService.publish(mapName, cacheId, eventData, cacheId.hashCode(), queryCache.getExtractors()); }
java
static void publishCacheWideEvent(InternalQueryCache queryCache, int numberOfEntriesAffected, EntryEventType eventType) { if (!hasListener(queryCache)) { return; } DefaultQueryCache defaultQueryCache = (DefaultQueryCache) queryCache; QueryCacheContext context = defaultQueryCache.context; String mapName = defaultQueryCache.mapName; String cacheId = defaultQueryCache.cacheId; QueryCacheEventService eventService = getQueryCacheEventService(context); LocalCacheWideEventData eventData = new LocalCacheWideEventData(cacheId, eventType.getType(), numberOfEntriesAffected); eventService.publish(mapName, cacheId, eventData, cacheId.hashCode(), queryCache.getExtractors()); }
[ "static", "void", "publishCacheWideEvent", "(", "InternalQueryCache", "queryCache", ",", "int", "numberOfEntriesAffected", ",", "EntryEventType", "eventType", ")", "{", "if", "(", "!", "hasListener", "(", "queryCache", ")", ")", "{", "return", ";", "}", "DefaultQu...
As a result of map-wide events like {@link EntryEventType#CLEAR_ALL} or {@link EntryEventType#EVICT_ALL} we also publish a matching event for query-cache listeners.
[ "As", "a", "result", "of", "map", "-", "wide", "events", "like", "{" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/querycache/subscriber/EventPublisherHelper.java#L89-L107
khmarbaise/sapm
src/main/java/com/soebes/subversion/sapm/AccessRule.java
AccessRule.addNegative
public void addNegative(User user, AccessLevel accessLevel) { getAccessList().add(new Access(user, accessLevel, true)); }
java
public void addNegative(User user, AccessLevel accessLevel) { getAccessList().add(new Access(user, accessLevel, true)); }
[ "public", "void", "addNegative", "(", "User", "user", ",", "AccessLevel", "accessLevel", ")", "{", "getAccessList", "(", ")", ".", "add", "(", "new", "Access", "(", "user", ",", "accessLevel", ",", "true", ")", ")", ";", "}" ]
Add the user to the access list with it's appropriate {@link AccessLevel} but this rule means not this user (~user) @param user The user which it shouldn't be. @param accessLevel The level of access for the non users.
[ "Add", "the", "user", "to", "the", "access", "list", "with", "it", "s", "appropriate", "{" ]
train
https://github.com/khmarbaise/sapm/blob/b5da5b0d8929324f03cb3a4233a3534813f93eea/src/main/java/com/soebes/subversion/sapm/AccessRule.java#L146-L148
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java
DocEnv.getMethodDoc
public MethodDocImpl getMethodDoc(MethodSymbol meth) { assert !meth.isConstructor() : "not expecting a constructor symbol"; MethodDocImpl result = (MethodDocImpl)methodMap.get(meth); if (result != null) return result; result = new MethodDocImpl(this, meth); methodMap.put(meth, result); return result; }
java
public MethodDocImpl getMethodDoc(MethodSymbol meth) { assert !meth.isConstructor() : "not expecting a constructor symbol"; MethodDocImpl result = (MethodDocImpl)methodMap.get(meth); if (result != null) return result; result = new MethodDocImpl(this, meth); methodMap.put(meth, result); return result; }
[ "public", "MethodDocImpl", "getMethodDoc", "(", "MethodSymbol", "meth", ")", "{", "assert", "!", "meth", ".", "isConstructor", "(", ")", ":", "\"not expecting a constructor symbol\"", ";", "MethodDocImpl", "result", "=", "(", "MethodDocImpl", ")", "methodMap", ".", ...
Return the MethodDoc for a MethodSymbol. Should be called only on symbols representing methods.
[ "Return", "the", "MethodDoc", "for", "a", "MethodSymbol", ".", "Should", "be", "called", "only", "on", "symbols", "representing", "methods", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java#L675-L682
jaxio/celerio
celerio-engine/src/main/java/com/jaxio/celerio/ConfigurationCheck.java
ConfigurationCheck.checkVersionOnJoinedInheritance
private void checkVersionOnJoinedInheritance(List<String> errors, Config config) { for (Entity entity : config.getProject().getRootEntities().getList()) { if (entity.hasInheritance() && entity.getInheritance().is(JOINED)) { for (Entity child : entity.getAllChildrenRecursive()) { for (Attribute attribute : child.getAttributes().getList()) { if (attribute.isVersion()) { errors.add(attribute.getFullColumnName() + " is a version column, you should not have @Version in a child joined entity." + " Use ignore=true in columnConfig or remove it from your table."); } } } } } }
java
private void checkVersionOnJoinedInheritance(List<String> errors, Config config) { for (Entity entity : config.getProject().getRootEntities().getList()) { if (entity.hasInheritance() && entity.getInheritance().is(JOINED)) { for (Entity child : entity.getAllChildrenRecursive()) { for (Attribute attribute : child.getAttributes().getList()) { if (attribute.isVersion()) { errors.add(attribute.getFullColumnName() + " is a version column, you should not have @Version in a child joined entity." + " Use ignore=true in columnConfig or remove it from your table."); } } } } } }
[ "private", "void", "checkVersionOnJoinedInheritance", "(", "List", "<", "String", ">", "errors", ",", "Config", "config", ")", "{", "for", "(", "Entity", "entity", ":", "config", ".", "getProject", "(", ")", ".", "getRootEntities", "(", ")", ".", "getList", ...
In case of JOINED inheritance we may have added some columns that are in the table but that are not in the entityConfigs. We check here that we have not added a version column in a child. @param errors @param config
[ "In", "case", "of", "JOINED", "inheritance", "we", "may", "have", "added", "some", "columns", "that", "are", "in", "the", "table", "but", "that", "are", "not", "in", "the", "entityConfigs", ".", "We", "check", "here", "that", "we", "have", "not", "added"...
train
https://github.com/jaxio/celerio/blob/fbfacb639e286f9f3f3a18986f74ea275bebd887/celerio-engine/src/main/java/com/jaxio/celerio/ConfigurationCheck.java#L123-L136
EasyinnovaSL/Tiff-Library-4J
src/main/java/com/easyinnova/tiff/profiles/BaselineProfile.java
BaselineProfile.CheckPalleteImage
private void CheckPalleteImage(IfdTags metadata, int nifd) { // Color Map if (!metadata.containsTagId(TiffTags.getTagId("ColorMap"))) { validation.addErrorLoc("Missing Color Map", "IFD" + nifd); } else { int n = metadata.get(TiffTags.getTagId("ColorMap")).getCardinality(); if (n != 3 * (int) Math.pow(2, metadata.get(TiffTags.getTagId("BitsPerSample")) .getFirstNumericValue())) validation.addError("Incorrect Color Map Cardinality", "IFD" + nifd, metadata.get(320) .getCardinality()); } // Bits per Sample long bps = metadata.get(TiffTags.getTagId("BitsPerSample")).getFirstNumericValue(); if (bps != 4 && bps != 8) validation.addError("Invalid Bits per Sample", "IFD" + nifd, bps); // Compression long comp = metadata.get(TiffTags.getTagId("Compression")).getFirstNumericValue(); // if (comp != 1 && comp != 32773) if (comp < 1) validation.addError("Invalid Compression", "IFD" + nifd, comp); }
java
private void CheckPalleteImage(IfdTags metadata, int nifd) { // Color Map if (!metadata.containsTagId(TiffTags.getTagId("ColorMap"))) { validation.addErrorLoc("Missing Color Map", "IFD" + nifd); } else { int n = metadata.get(TiffTags.getTagId("ColorMap")).getCardinality(); if (n != 3 * (int) Math.pow(2, metadata.get(TiffTags.getTagId("BitsPerSample")) .getFirstNumericValue())) validation.addError("Incorrect Color Map Cardinality", "IFD" + nifd, metadata.get(320) .getCardinality()); } // Bits per Sample long bps = metadata.get(TiffTags.getTagId("BitsPerSample")).getFirstNumericValue(); if (bps != 4 && bps != 8) validation.addError("Invalid Bits per Sample", "IFD" + nifd, bps); // Compression long comp = metadata.get(TiffTags.getTagId("Compression")).getFirstNumericValue(); // if (comp != 1 && comp != 32773) if (comp < 1) validation.addError("Invalid Compression", "IFD" + nifd, comp); }
[ "private", "void", "CheckPalleteImage", "(", "IfdTags", "metadata", ",", "int", "nifd", ")", "{", "// Color Map", "if", "(", "!", "metadata", ".", "containsTagId", "(", "TiffTags", ".", "getTagId", "(", "\"ColorMap\"", ")", ")", ")", "{", "validation", ".", ...
Check Pallete Color Image. @param metadata the metadata @param nifd the IFD number
[ "Check", "Pallete", "Color", "Image", "." ]
train
https://github.com/EasyinnovaSL/Tiff-Library-4J/blob/682605d3ed207a66213278c054c98f1b909472b7/src/main/java/com/easyinnova/tiff/profiles/BaselineProfile.java#L288-L310
vznet/mongo-jackson-mapper
src/main/java/net/vz/mongodb/jackson/DBQuery.java
DBQuery.notIn
public static Query notIn(String field, Object... values) { return new Query().notIn(field, values); }
java
public static Query notIn(String field, Object... values) { return new Query().notIn(field, values); }
[ "public", "static", "Query", "notIn", "(", "String", "field", ",", "Object", "...", "values", ")", "{", "return", "new", "Query", "(", ")", ".", "notIn", "(", "field", ",", "values", ")", ";", "}" ]
The field is not in the given set of values @param field The field to compare @param values The value to compare to @return the query
[ "The", "field", "is", "not", "in", "the", "given", "set", "of", "values" ]
train
https://github.com/vznet/mongo-jackson-mapper/blob/ecd189aefa89636cddf70fb383f5d676be347976/src/main/java/net/vz/mongodb/jackson/DBQuery.java#L139-L141
CloudSlang/score
engine/orchestrator/score-orchestrator-impl/src/main/java/io/cloudslang/orchestrator/services/CancelExecutionServiceImpl.java
CancelExecutionServiceImpl.cancelPausedRun
private void cancelPausedRun(ExecutionState executionStateToCancel) { final List<ExecutionState> branches = executionStateService.readByExecutionId(executionStateToCancel.getExecutionId()); // If the parent is paused because one of the branches is paused, OR, it was paused by the user / no-workers-in-group, but has branches that were not finished (and thus, were paused) - // The parent itself will return to the queue after all the branches are ended (due to this cancellation), and then it'll be canceled as well. if (branches.size() > 1) { // more than 1 means that it has paused branches (branches is at least 1 - the parent) for (ExecutionState branch : branches) { if (!EMPTY_BRANCH.equals(branch.getBranchId())) { // exclude the base execution returnCanceledRunToQueue(branch); executionStateService.deleteExecutionState(branch.getExecutionId(), branch.getBranchId()); } } executionStateToCancel.setStatus(ExecutionStatus.PENDING_CANCEL); // when the parent will return to queue - should have the correct status } else { returnCanceledRunToQueue(executionStateToCancel); } }
java
private void cancelPausedRun(ExecutionState executionStateToCancel) { final List<ExecutionState> branches = executionStateService.readByExecutionId(executionStateToCancel.getExecutionId()); // If the parent is paused because one of the branches is paused, OR, it was paused by the user / no-workers-in-group, but has branches that were not finished (and thus, were paused) - // The parent itself will return to the queue after all the branches are ended (due to this cancellation), and then it'll be canceled as well. if (branches.size() > 1) { // more than 1 means that it has paused branches (branches is at least 1 - the parent) for (ExecutionState branch : branches) { if (!EMPTY_BRANCH.equals(branch.getBranchId())) { // exclude the base execution returnCanceledRunToQueue(branch); executionStateService.deleteExecutionState(branch.getExecutionId(), branch.getBranchId()); } } executionStateToCancel.setStatus(ExecutionStatus.PENDING_CANCEL); // when the parent will return to queue - should have the correct status } else { returnCanceledRunToQueue(executionStateToCancel); } }
[ "private", "void", "cancelPausedRun", "(", "ExecutionState", "executionStateToCancel", ")", "{", "final", "List", "<", "ExecutionState", ">", "branches", "=", "executionStateService", ".", "readByExecutionId", "(", "executionStateToCancel", ".", "getExecutionId", "(", "...
If it doesn't - just cancel it straight away - extract the Run Object, set its context accordingly and put into the queue.
[ "If", "it", "doesn", "t", "-", "just", "cancel", "it", "straight", "away", "-", "extract", "the", "Run", "Object", "set", "its", "context", "accordingly", "and", "put", "into", "the", "queue", "." ]
train
https://github.com/CloudSlang/score/blob/796134e917843f4d95a90f7740d69dc5257a1a0e/engine/orchestrator/score-orchestrator-impl/src/main/java/io/cloudslang/orchestrator/services/CancelExecutionServiceImpl.java#L101-L117
kaazing/gateway
management/src/main/java/org/kaazing/gateway/management/context/DefaultManagementContext.java
DefaultManagementContext.addSessionManagementBean
@Override public SessionManagementBean addSessionManagementBean(ServiceManagementBean serviceManagementBean, IoSessionEx session) { SessionManagementBean sessionManagementBean = new SessionManagementBeanImpl(serviceManagementBean, session); for (ManagementServiceHandler handler : managementServiceHandlers) { handler.addSessionManagementBean(sessionManagementBean); } return sessionManagementBean; }
java
@Override public SessionManagementBean addSessionManagementBean(ServiceManagementBean serviceManagementBean, IoSessionEx session) { SessionManagementBean sessionManagementBean = new SessionManagementBeanImpl(serviceManagementBean, session); for (ManagementServiceHandler handler : managementServiceHandlers) { handler.addSessionManagementBean(sessionManagementBean); } return sessionManagementBean; }
[ "@", "Override", "public", "SessionManagementBean", "addSessionManagementBean", "(", "ServiceManagementBean", "serviceManagementBean", ",", "IoSessionEx", "session", ")", "{", "SessionManagementBean", "sessionManagementBean", "=", "new", "SessionManagementBeanImpl", "(", "servi...
Create a SessionManagementBean for a resource address on the local Gateway instance. <p/> XXX We need to do something more if we're going to support some idea of storing sessions from another Gateway instance in the same repository, as we won't generally have ServiceContext or IoSessions to work with (since the other instance will be in a different process, perhaps on a different machine.) <p/> NOTE: we store the service resource address on the management bean because we need it later to do protocol-specific things like reconstruct JMX session mbean names. NOTE: the managementProcessors are called during the constructor, so the bean has not yet been loaded into the list of sessionManagement beans.
[ "Create", "a", "SessionManagementBean", "for", "a", "resource", "address", "on", "the", "local", "Gateway", "instance", ".", "<p", "/", ">", "XXX", "We", "need", "to", "do", "something", "more", "if", "we", "re", "going", "to", "support", "some", "idea", ...
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/management/src/main/java/org/kaazing/gateway/management/context/DefaultManagementContext.java#L554-L565
nulab/backlog4j
src/main/java/com/nulabinc/backlog4j/api/option/UpdatePullRequestParams.java
UpdatePullRequestParams.attachmentIds
public UpdatePullRequestParams attachmentIds(List<Long> attachmentIds) { for (Long attachmentId : attachmentIds) { parameters.add(new NameValuePair("attachmentId[]", attachmentId.toString())); } return this; }
java
public UpdatePullRequestParams attachmentIds(List<Long> attachmentIds) { for (Long attachmentId : attachmentIds) { parameters.add(new NameValuePair("attachmentId[]", attachmentId.toString())); } return this; }
[ "public", "UpdatePullRequestParams", "attachmentIds", "(", "List", "<", "Long", ">", "attachmentIds", ")", "{", "for", "(", "Long", "attachmentId", ":", "attachmentIds", ")", "{", "parameters", ".", "add", "(", "new", "NameValuePair", "(", "\"attachmentId[]\"", ...
Sets the pull request attachment files. @param attachmentIds the attachment file identifiers @return UpdatePullRequestParams instance
[ "Sets", "the", "pull", "request", "attachment", "files", "." ]
train
https://github.com/nulab/backlog4j/blob/862ae0586ad808b2ec413f665b8dfc0c9a107b4e/src/main/java/com/nulabinc/backlog4j/api/option/UpdatePullRequestParams.java#L130-L135
leancloud/java-sdk-all
android-sdk/mixpush-android/src/main/java/cn/leancloud/AVHMSPushMessageReceiver.java
AVHMSPushMessageReceiver.onPushMsg
@Override public void onPushMsg(Context var1, byte[] var2, String var3) { try { String message = new String(var2, "UTF-8"); AndroidNotificationManager androidNotificationManager = AndroidNotificationManager.getInstance(); androidNotificationManager.processMixPushMessage(message); } catch (Exception ex) { LOGGER.e("failed to process PushMessage.", ex); } }
java
@Override public void onPushMsg(Context var1, byte[] var2, String var3) { try { String message = new String(var2, "UTF-8"); AndroidNotificationManager androidNotificationManager = AndroidNotificationManager.getInstance(); androidNotificationManager.processMixPushMessage(message); } catch (Exception ex) { LOGGER.e("failed to process PushMessage.", ex); } }
[ "@", "Override", "public", "void", "onPushMsg", "(", "Context", "var1", ",", "byte", "[", "]", "var2", ",", "String", "var3", ")", "{", "try", "{", "String", "message", "=", "new", "String", "(", "var2", ",", "\"UTF-8\"", ")", ";", "AndroidNotificationMa...
收到透传消息 消息格式类似于: {"alert":"", "title":"", "action":"", "silent":true} SDK 内部会转换成 {"content":\\"{"alert":"", "title":"", "action":"", "silent":true}\\"} 再发送给本地的 Receiver。 所以,开发者如果想自己处理透传消息,则需要从 Receiver#onReceive(Context context, Intent intent) 的 intent 中通过 getStringExtra("content") 获取到实际的数据。 @param var1 @param var2 @param var3
[ "收到透传消息" ]
train
https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/android-sdk/mixpush-android/src/main/java/cn/leancloud/AVHMSPushMessageReceiver.java#L81-L90
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MeasureFormat.java
MeasureFormat.getInstance
public static MeasureFormat getInstance(ULocale locale, FormatWidth formatWidth, NumberFormat format) { PluralRules rules = PluralRules.forLocale(locale); NumericFormatters formatters = null; MeasureFormatData data = localeMeasureFormatData.get(locale); if (data == null) { data = loadLocaleData(locale); localeMeasureFormatData.put(locale, data); } if (formatWidth == FormatWidth.NUMERIC) { formatters = localeToNumericDurationFormatters.get(locale); if (formatters == null) { formatters = loadNumericFormatters(locale); localeToNumericDurationFormatters.put(locale, formatters); } } NumberFormat intFormat = NumberFormat.getInstance(locale); intFormat.setMaximumFractionDigits(0); intFormat.setMinimumFractionDigits(0); intFormat.setRoundingMode(BigDecimal.ROUND_DOWN); return new MeasureFormat( locale, data, formatWidth, new ImmutableNumberFormat(format), rules, formatters, new ImmutableNumberFormat(NumberFormat.getInstance(locale, formatWidth.getCurrencyStyle())), new ImmutableNumberFormat(intFormat)); }
java
public static MeasureFormat getInstance(ULocale locale, FormatWidth formatWidth, NumberFormat format) { PluralRules rules = PluralRules.forLocale(locale); NumericFormatters formatters = null; MeasureFormatData data = localeMeasureFormatData.get(locale); if (data == null) { data = loadLocaleData(locale); localeMeasureFormatData.put(locale, data); } if (formatWidth == FormatWidth.NUMERIC) { formatters = localeToNumericDurationFormatters.get(locale); if (formatters == null) { formatters = loadNumericFormatters(locale); localeToNumericDurationFormatters.put(locale, formatters); } } NumberFormat intFormat = NumberFormat.getInstance(locale); intFormat.setMaximumFractionDigits(0); intFormat.setMinimumFractionDigits(0); intFormat.setRoundingMode(BigDecimal.ROUND_DOWN); return new MeasureFormat( locale, data, formatWidth, new ImmutableNumberFormat(format), rules, formatters, new ImmutableNumberFormat(NumberFormat.getInstance(locale, formatWidth.getCurrencyStyle())), new ImmutableNumberFormat(intFormat)); }
[ "public", "static", "MeasureFormat", "getInstance", "(", "ULocale", "locale", ",", "FormatWidth", "formatWidth", ",", "NumberFormat", "format", ")", "{", "PluralRules", "rules", "=", "PluralRules", ".", "forLocale", "(", "locale", ")", ";", "NumericFormatters", "f...
Create a format from the locale, formatWidth, and format. @param locale the locale. @param formatWidth hints how long formatted strings should be. @param format This is defensively copied. @return The new MeasureFormat object.
[ "Create", "a", "format", "from", "the", "locale", "formatWidth", "and", "format", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MeasureFormat.java#L235-L263
rvs-fluid-it/mvn-fluid-cd
mvn-ext-freeze/src/main/java/be/fluid_it/mvn/cd/x/freeze/replace/FreezeHandler.java
FreezeHandler.printSaxException
void printSaxException(String message, SAXException e) { System.err.println(); System.err.println("*** SAX Exception -- " + message); System.err.println(" SystemId = \"" + documentLocator.getSystemId() + "\""); e.printStackTrace(System.err); }
java
void printSaxException(String message, SAXException e) { System.err.println(); System.err.println("*** SAX Exception -- " + message); System.err.println(" SystemId = \"" + documentLocator.getSystemId() + "\""); e.printStackTrace(System.err); }
[ "void", "printSaxException", "(", "String", "message", ",", "SAXException", "e", ")", "{", "System", ".", "err", ".", "println", "(", ")", ";", "System", ".", "err", ".", "println", "(", "\"*** SAX Exception -- \"", "+", "message", ")", ";", "System", ".",...
Utility method to print information about a SAXException. @param message A message to be included in the error output. @param e The exception to be printed.
[ "Utility", "method", "to", "print", "information", "about", "a", "SAXException", "." ]
train
https://github.com/rvs-fluid-it/mvn-fluid-cd/blob/2aad8ed1cb40f94bd24bad7e6a127956cc277077/mvn-ext-freeze/src/main/java/be/fluid_it/mvn/cd/x/freeze/replace/FreezeHandler.java#L326-L332
OpenLiberty/open-liberty
dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/common/logging/LogUtils.java
LogUtils.getLogger
public static Logger getLogger(Class<?> cls, String resourcename, String loggerName) { return createLogger(cls, resourcename, loggerName); }
java
public static Logger getLogger(Class<?> cls, String resourcename, String loggerName) { return createLogger(cls, resourcename, loggerName); }
[ "public", "static", "Logger", "getLogger", "(", "Class", "<", "?", ">", "cls", ",", "String", "resourcename", ",", "String", "loggerName", ")", "{", "return", "createLogger", "(", "cls", ",", "resourcename", ",", "loggerName", ")", ";", "}" ]
Get a Logger with an associated resource bundle. @param cls the Class to contain the Logger (to find resources) @param resourcename the resource name @param loggerName the full name for the logger @return an appropriate Logger
[ "Get", "a", "Logger", "with", "an", "associated", "resource", "bundle", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/common/logging/LogUtils.java#L189-L193
rimerosolutions/ant-git-tasks
src/main/java/com/rimerosolutions/ant/git/AbstractGitRepoAwareTask.java
AbstractGitRepoAwareTask.translateFilePathUsingPrefix
protected String translateFilePathUsingPrefix(String file, String prefix) throws IOException { if (file.equals(prefix)) { return "."; } String result = new File(file).getCanonicalPath().substring(prefix.length() + 1); if (File.separatorChar != '/') { result = result.replace(File.separatorChar, '/'); } return result; }
java
protected String translateFilePathUsingPrefix(String file, String prefix) throws IOException { if (file.equals(prefix)) { return "."; } String result = new File(file).getCanonicalPath().substring(prefix.length() + 1); if (File.separatorChar != '/') { result = result.replace(File.separatorChar, '/'); } return result; }
[ "protected", "String", "translateFilePathUsingPrefix", "(", "String", "file", ",", "String", "prefix", ")", "throws", "IOException", "{", "if", "(", "file", ".", "equals", "(", "prefix", ")", ")", "{", "return", "\".\"", ";", "}", "String", "result", "=", ...
return either a "." if file and prefix have the same value, or the right part of file - length of prefix plus one removed @param file file on which a git operation needs to be done @param prefix folder of the git sandbox @return path relative to git sandbox folder @throws IOException the method uses File#getCanonicalPath which can throw IOException
[ "return", "either", "a", ".", "if", "file", "and", "prefix", "have", "the", "same", "value", "or", "the", "right", "part", "of", "file", "-", "length", "of", "prefix", "plus", "one", "removed" ]
train
https://github.com/rimerosolutions/ant-git-tasks/blob/bfb32fe68afe6b9dcfd0a5194497d748ef3e8a6f/src/main/java/com/rimerosolutions/ant/git/AbstractGitRepoAwareTask.java#L99-L108
knightliao/disconf
disconf-web/src/main/java/com/baidu/unbiz/common/genericdao/mapper/GenericMapper.java
GenericMapper.getSetters
private List<Setter> getSetters(ResultSetMetaData meta) throws SQLException { int columnCount = meta.getColumnCount(); List<Setter> setters = new ArrayList<Setter>(columnCount); for (int i = 1; i <= columnCount; i++) { String column = meta.getColumnName(i); Method setMethod = orMapping.getSetter(column); if (setMethod != null) { Setter setter = new Setter(setMethod, column, setMethod.getParameterTypes()[0]); setters.add(setter); } } return setters; }
java
private List<Setter> getSetters(ResultSetMetaData meta) throws SQLException { int columnCount = meta.getColumnCount(); List<Setter> setters = new ArrayList<Setter>(columnCount); for (int i = 1; i <= columnCount; i++) { String column = meta.getColumnName(i); Method setMethod = orMapping.getSetter(column); if (setMethod != null) { Setter setter = new Setter(setMethod, column, setMethod.getParameterTypes()[0]); setters.add(setter); } } return setters; }
[ "private", "List", "<", "Setter", ">", "getSetters", "(", "ResultSetMetaData", "meta", ")", "throws", "SQLException", "{", "int", "columnCount", "=", "meta", ".", "getColumnCount", "(", ")", ";", "List", "<", "Setter", ">", "setters", "=", "new", "ArrayList"...
@param meta @param genericMapper2 @return 下午3:45:38 created by Darwin(Tianxin) @throws SQLException
[ "@param", "meta", "@param", "genericMapper2" ]
train
https://github.com/knightliao/disconf/blob/d413cbce9334fe38a5a24982ce4db3a6ed8e98ea/disconf-web/src/main/java/com/baidu/unbiz/common/genericdao/mapper/GenericMapper.java#L102-L116
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java
FeatureShapes.removeShapesNotWithinMap
public int removeShapesNotWithinMap(BoundingBox boundingBox, String database) { int count = 0; Map<String, Map<Long, FeatureShape>> tables = getTables(database); if (tables != null) { for (String table : tables.keySet()) { count += removeShapesNotWithinMap(boundingBox, database, table); } } return count; }
java
public int removeShapesNotWithinMap(BoundingBox boundingBox, String database) { int count = 0; Map<String, Map<Long, FeatureShape>> tables = getTables(database); if (tables != null) { for (String table : tables.keySet()) { count += removeShapesNotWithinMap(boundingBox, database, table); } } return count; }
[ "public", "int", "removeShapesNotWithinMap", "(", "BoundingBox", "boundingBox", ",", "String", "database", ")", "{", "int", "count", "=", "0", ";", "Map", "<", "String", ",", "Map", "<", "Long", ",", "FeatureShape", ">", ">", "tables", "=", "getTables", "(...
Remove all map shapes in the database that are not visible in the bounding box @param boundingBox bounding box @param database GeoPackage database @return count of removed features @since 3.2.0
[ "Remove", "all", "map", "shapes", "in", "the", "database", "that", "are", "not", "visible", "in", "the", "bounding", "box" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java#L490-L504
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.project_serviceName_storage_containerId_GET
public OvhContainerDetail project_serviceName_storage_containerId_GET(String serviceName, String containerId) throws IOException { String qPath = "/cloud/project/{serviceName}/storage/{containerId}"; StringBuilder sb = path(qPath, serviceName, containerId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhContainerDetail.class); }
java
public OvhContainerDetail project_serviceName_storage_containerId_GET(String serviceName, String containerId) throws IOException { String qPath = "/cloud/project/{serviceName}/storage/{containerId}"; StringBuilder sb = path(qPath, serviceName, containerId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhContainerDetail.class); }
[ "public", "OvhContainerDetail", "project_serviceName_storage_containerId_GET", "(", "String", "serviceName", ",", "String", "containerId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/cloud/project/{serviceName}/storage/{containerId}\"", ";", "StringBuilder", ...
Get storage container REST: GET /cloud/project/{serviceName}/storage/{containerId} @param containerId [required] Container id @param serviceName [required] Service name
[ "Get", "storage", "container" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L619-L624
LearnLib/learnlib
oracles/parallelism/src/main/java/de/learnlib/oracle/parallelism/ParallelOracleBuilders.java
ParallelOracleBuilders.newStaticParallelOracle
@Nonnull @SafeVarargs public static <I, D> StaticParallelOracleBuilder<I, D> newStaticParallelOracle(MembershipOracle<I, D> firstOracle, MembershipOracle<I, D>... otherOracles) { return newStaticParallelOracle(Lists.asList(firstOracle, otherOracles)); }
java
@Nonnull @SafeVarargs public static <I, D> StaticParallelOracleBuilder<I, D> newStaticParallelOracle(MembershipOracle<I, D> firstOracle, MembershipOracle<I, D>... otherOracles) { return newStaticParallelOracle(Lists.asList(firstOracle, otherOracles)); }
[ "@", "Nonnull", "@", "SafeVarargs", "public", "static", "<", "I", ",", "D", ">", "StaticParallelOracleBuilder", "<", "I", ",", "D", ">", "newStaticParallelOracle", "(", "MembershipOracle", "<", "I", ",", "D", ">", "firstOracle", ",", "MembershipOracle", "<", ...
Convenience method for {@link #newStaticParallelOracle(Collection)}. @param firstOracle the first (mandatory) oracle @param otherOracles further (optional) oracles to be used by other threads @param <I> input symbol type @param <D> output domain type @return a preconfigured oracle builder
[ "Convenience", "method", "for", "{", "@link", "#newStaticParallelOracle", "(", "Collection", ")", "}", "." ]
train
https://github.com/LearnLib/learnlib/blob/fa38a14adcc0664099f180d671ffa42480318d7b/oracles/parallelism/src/main/java/de/learnlib/oracle/parallelism/ParallelOracleBuilders.java#L162-L167
baratine/baratine
kraken/src/main/java/com/caucho/v5/kelp/query/EnvKelp.java
EnvKelp.scanObjectInstance
private void scanObjectInstance(String type, String []fields, int fieldLen) throws IOException { PathMapHessian pathMap = _pathMap; for (int i = 0; i < fieldLen; i++) { String key = fields[i]; PathHessian path = pathMap.get(key); if (path == null) { skipObject(); } else { _pathMap = path.getPathMap(); path.scan(this, _values); _pathMap = pathMap; } } }
java
private void scanObjectInstance(String type, String []fields, int fieldLen) throws IOException { PathMapHessian pathMap = _pathMap; for (int i = 0; i < fieldLen; i++) { String key = fields[i]; PathHessian path = pathMap.get(key); if (path == null) { skipObject(); } else { _pathMap = path.getPathMap(); path.scan(this, _values); _pathMap = pathMap; } } }
[ "private", "void", "scanObjectInstance", "(", "String", "type", ",", "String", "[", "]", "fields", ",", "int", "fieldLen", ")", "throws", "IOException", "{", "PathMapHessian", "pathMap", "=", "_pathMap", ";", "for", "(", "int", "i", "=", "0", ";", "i", "...
/* private void scanMap(String type) throws IOException { String key; PathMapHessian pathMap = _pathMap; while ((key = scanKey()) != null) { PathHessian path = pathMap.get(key); if (path != null) { _pathMap = path.getPathMap(); path.scan(this, _values); _pathMap = pathMap; } else { skipObject(); } } }
[ "/", "*", "private", "void", "scanMap", "(", "String", "type", ")", "throws", "IOException", "{", "String", "key", ";" ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/query/EnvKelp.java#L951-L972
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/component/SeaGlassIcon.java
SeaGlassIcon.getIconHeight
@Override public int getIconHeight(SynthContext context) { if (context == null) { return height; } JComponent c = context.getComponent(); if (c instanceof JToolBar) { JToolBar toolbar = (JToolBar) c; if (toolbar.getOrientation() == JToolBar.HORIZONTAL) { // we only do the -1 hack for UIResource borders, assuming // that the border is probably going to be our border if (toolbar.getBorder() instanceof UIResource) { return c.getHeight() - 1; } else { return c.getHeight(); } } else { return scale(context, width); } } else { return scale(context, height); } }
java
@Override public int getIconHeight(SynthContext context) { if (context == null) { return height; } JComponent c = context.getComponent(); if (c instanceof JToolBar) { JToolBar toolbar = (JToolBar) c; if (toolbar.getOrientation() == JToolBar.HORIZONTAL) { // we only do the -1 hack for UIResource borders, assuming // that the border is probably going to be our border if (toolbar.getBorder() instanceof UIResource) { return c.getHeight() - 1; } else { return c.getHeight(); } } else { return scale(context, width); } } else { return scale(context, height); } }
[ "@", "Override", "public", "int", "getIconHeight", "(", "SynthContext", "context", ")", "{", "if", "(", "context", "==", "null", ")", "{", "return", "height", ";", "}", "JComponent", "c", "=", "context", ".", "getComponent", "(", ")", ";", "if", "(", "...
Returns the icon's height. This is a cover method for <code> getIconHeight(null)</code>. @param context the SynthContext describing the component/region, the style, and the state. @return an int specifying the fixed height of the icon.
[ "Returns", "the", "icon", "s", "height", ".", "This", "is", "a", "cover", "method", "for", "<code", ">", "getIconHeight", "(", "null", ")", "<", "/", "code", ">", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/component/SeaGlassIcon.java#L241-L267
alkacon/opencms-core
src-setup/org/opencms/setup/db/CmsUpdateDBManager.java
CmsUpdateDBManager.needUpdate
public boolean needUpdate() { String pool = "default"; double currentVersion = 8.5; m_detectedVersion = 8.5; CmsSetupDb setupDb = new CmsSetupDb(null); try { setupDb.setConnection( getDbDriver(pool), getDbUrl(pool), getDbParams(pool), getDbUser(pool), m_dbPools.get(pool).get("pwd")); if (!setupDb.hasTableOrColumn("CMS_USERS", "USER_OU")) { m_detectedVersion = 6; } else if (!setupDb.hasTableOrColumn("CMS_ONLINE_URLNAME_MAPPINGS", null)) { m_detectedVersion = 7; } else if (!setupDb.hasTableOrColumn("CMS_USER_PUBLISH_LIST", null)) { m_detectedVersion = 8; } } finally { setupDb.closeConnection(); } return currentVersion != m_detectedVersion; }
java
public boolean needUpdate() { String pool = "default"; double currentVersion = 8.5; m_detectedVersion = 8.5; CmsSetupDb setupDb = new CmsSetupDb(null); try { setupDb.setConnection( getDbDriver(pool), getDbUrl(pool), getDbParams(pool), getDbUser(pool), m_dbPools.get(pool).get("pwd")); if (!setupDb.hasTableOrColumn("CMS_USERS", "USER_OU")) { m_detectedVersion = 6; } else if (!setupDb.hasTableOrColumn("CMS_ONLINE_URLNAME_MAPPINGS", null)) { m_detectedVersion = 7; } else if (!setupDb.hasTableOrColumn("CMS_USER_PUBLISH_LIST", null)) { m_detectedVersion = 8; } } finally { setupDb.closeConnection(); } return currentVersion != m_detectedVersion; }
[ "public", "boolean", "needUpdate", "(", ")", "{", "String", "pool", "=", "\"default\"", ";", "double", "currentVersion", "=", "8.5", ";", "m_detectedVersion", "=", "8.5", ";", "CmsSetupDb", "setupDb", "=", "new", "CmsSetupDb", "(", "null", ")", ";", "try", ...
Checks if an update is needed.<p> @return if an update is needed
[ "Checks", "if", "an", "update", "is", "needed", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/db/CmsUpdateDBManager.java#L242-L271
opendigitaleducation/web-utils
src/main/java/org/vertx/java/core/http/RouteMatcher.java
RouteMatcher.traceWithRegEx
public RouteMatcher traceWithRegEx(String regex, Handler<HttpServerRequest> handler) { addRegEx(regex, handler, traceBindings); return this; }
java
public RouteMatcher traceWithRegEx(String regex, Handler<HttpServerRequest> handler) { addRegEx(regex, handler, traceBindings); return this; }
[ "public", "RouteMatcher", "traceWithRegEx", "(", "String", "regex", ",", "Handler", "<", "HttpServerRequest", ">", "handler", ")", "{", "addRegEx", "(", "regex", ",", "handler", ",", "traceBindings", ")", ";", "return", "this", ";", "}" ]
Specify a handler that will be called for a matching HTTP TRACE @param regex A regular expression @param handler The handler to call
[ "Specify", "a", "handler", "that", "will", "be", "called", "for", "a", "matching", "HTTP", "TRACE" ]
train
https://github.com/opendigitaleducation/web-utils/blob/5c12f7e8781a9a0fbbe7b8d9fb741627aa97a1e3/src/main/java/org/vertx/java/core/http/RouteMatcher.java#L269-L272
lessthanoptimal/ejml
main/ejml-dsparse/src/org/ejml/sparse/csc/CommonOps_DSCC.java
CommonOps_DSCC.permutationMatrix
public static DMatrixSparseCSC permutationMatrix(int[] p, boolean inverse, int N, DMatrixSparseCSC P) { if( P == null ) P = new DMatrixSparseCSC(N,N,N); else P.reshape(N,N,N); P.indicesSorted = true; P.nz_length = N; // each column should have one element inside of it if( !inverse ) { for (int i = 0; i < N; i++) { P.col_idx[i + 1] = i + 1; P.nz_rows[p[i]] = i; P.nz_values[i] = 1; } } else { for (int i = 0; i < N; i++) { P.col_idx[i + 1] = i + 1; P.nz_rows[i] = p[i]; P.nz_values[i] = 1; } } return P; }
java
public static DMatrixSparseCSC permutationMatrix(int[] p, boolean inverse, int N, DMatrixSparseCSC P) { if( P == null ) P = new DMatrixSparseCSC(N,N,N); else P.reshape(N,N,N); P.indicesSorted = true; P.nz_length = N; // each column should have one element inside of it if( !inverse ) { for (int i = 0; i < N; i++) { P.col_idx[i + 1] = i + 1; P.nz_rows[p[i]] = i; P.nz_values[i] = 1; } } else { for (int i = 0; i < N; i++) { P.col_idx[i + 1] = i + 1; P.nz_rows[i] = p[i]; P.nz_values[i] = 1; } } return P; }
[ "public", "static", "DMatrixSparseCSC", "permutationMatrix", "(", "int", "[", "]", "p", ",", "boolean", "inverse", ",", "int", "N", ",", "DMatrixSparseCSC", "P", ")", "{", "if", "(", "P", "==", "null", ")", "P", "=", "new", "DMatrixSparseCSC", "(", "N", ...
Converts the permutation vector into a matrix. B = P*A. B[p[i],:] = A[i,:] @param p (Input) Permutation vector @param inverse (Input) If it is the inverse. B[i,:] = A[p[i],:) @param P (Output) Permutation matrix
[ "Converts", "the", "permutation", "vector", "into", "a", "matrix", ".", "B", "=", "P", "*", "A", ".", "B", "[", "p", "[", "i", "]", ":", "]", "=", "A", "[", "i", ":", "]" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-dsparse/src/org/ejml/sparse/csc/CommonOps_DSCC.java#L810-L835
galaxyproject/blend4j
src/main/java/com/github/jmchilton/blend4j/BaseClient.java
BaseClient.deleteResponse
protected ClientResponse deleteResponse(final WebResource webResource, java.lang.Object requestEntity, final boolean checkResponse) { final ClientResponse response = webResource.type(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON).delete(ClientResponse.class, requestEntity); if(checkResponse) { this.checkResponse(response); } return response; }
java
protected ClientResponse deleteResponse(final WebResource webResource, java.lang.Object requestEntity, final boolean checkResponse) { final ClientResponse response = webResource.type(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON).delete(ClientResponse.class, requestEntity); if(checkResponse) { this.checkResponse(response); } return response; }
[ "protected", "ClientResponse", "deleteResponse", "(", "final", "WebResource", "webResource", ",", "java", ".", "lang", ".", "Object", "requestEntity", ",", "final", "boolean", "checkResponse", ")", "{", "final", "ClientResponse", "response", "=", "webResource", ".",...
Gets the response for a DELETE request. @param webResource The {@link WebResource} to send the request to. @param requestEntity The request entity. @param checkResponse True if an exception should be thrown on failure, false otherwise. @return The {@link ClientResponse} for this request. @throws ResponseException If the response was not successful.
[ "Gets", "the", "response", "for", "a", "DELETE", "request", "." ]
train
https://github.com/galaxyproject/blend4j/blob/a2ec4e412be40013bb88a3a2cf2478abd19ce162/src/main/java/com/github/jmchilton/blend4j/BaseClient.java#L90-L96
mygreen/super-csv-annotation
src/main/java/com/github/mygreen/supercsv/builder/time/AbstractTemporalProcessorBuilder.java
AbstractTemporalProcessorBuilder.createFormatter
protected DateTimeFormatter createFormatter(final FieldAccessor field, final Configuration config) { final Optional<CsvDateTimeFormat> formatAnno = field.getAnnotation(CsvDateTimeFormat.class); if(!formatAnno.isPresent()) { return DateTimeFormatter.ofPattern(getDefaultPattern()); } String pattern = formatAnno.get().pattern(); if(pattern.isEmpty()) { pattern = getDefaultPattern(); } final ResolverStyle style = formatAnno.get().lenient() ? ResolverStyle.LENIENT : ResolverStyle.STRICT; final Locale locale = Utils.getLocale(formatAnno.get().locale()); final ZoneId zone = formatAnno.get().timezone().isEmpty() ? ZoneId.systemDefault() : TimeZone.getTimeZone(formatAnno.get().timezone()).toZoneId(); return DateTimeFormatter.ofPattern(pattern, locale) .withResolverStyle(style) .withZone(zone); }
java
protected DateTimeFormatter createFormatter(final FieldAccessor field, final Configuration config) { final Optional<CsvDateTimeFormat> formatAnno = field.getAnnotation(CsvDateTimeFormat.class); if(!formatAnno.isPresent()) { return DateTimeFormatter.ofPattern(getDefaultPattern()); } String pattern = formatAnno.get().pattern(); if(pattern.isEmpty()) { pattern = getDefaultPattern(); } final ResolverStyle style = formatAnno.get().lenient() ? ResolverStyle.LENIENT : ResolverStyle.STRICT; final Locale locale = Utils.getLocale(formatAnno.get().locale()); final ZoneId zone = formatAnno.get().timezone().isEmpty() ? ZoneId.systemDefault() : TimeZone.getTimeZone(formatAnno.get().timezone()).toZoneId(); return DateTimeFormatter.ofPattern(pattern, locale) .withResolverStyle(style) .withZone(zone); }
[ "protected", "DateTimeFormatter", "createFormatter", "(", "final", "FieldAccessor", "field", ",", "final", "Configuration", "config", ")", "{", "final", "Optional", "<", "CsvDateTimeFormat", ">", "formatAnno", "=", "field", ".", "getAnnotation", "(", "CsvDateTimeForma...
変換規則から、{@link DateTimeFormatter}のインスタンスを作成する。 <p>アノテーション{@link CsvDateTimeFormat}が付与されていない場合は、各種タイプごとの標準の書式で作成する。</p> @param field フィールド情報 @param config システム設定 @return {@link DateTimeFormatter}のインスタンス。
[ "変換規則から、", "{" ]
train
https://github.com/mygreen/super-csv-annotation/blob/9910320cb6dc143be972c7d10d9ab5ffb09c3b84/src/main/java/com/github/mygreen/supercsv/builder/time/AbstractTemporalProcessorBuilder.java#L60-L81
StripesFramework/stripes-stuff
src/main/java/org/stripesstuff/plugin/jstl/JstlBundleInterceptor.java
JstlBundleInterceptor.setMessageResourceBundle
@Override protected void setMessageResourceBundle(HttpServletRequest request, ResourceBundle bundle) { Config.set(request, Config.FMT_LOCALIZATION_CONTEXT, new LocalizationContext(bundle, request.getLocale())); LOGGER.debug("Enabled JSTL localization using: ", bundle); LOGGER.debug("Loaded resource bundle ", bundle, " as default bundle"); }
java
@Override protected void setMessageResourceBundle(HttpServletRequest request, ResourceBundle bundle) { Config.set(request, Config.FMT_LOCALIZATION_CONTEXT, new LocalizationContext(bundle, request.getLocale())); LOGGER.debug("Enabled JSTL localization using: ", bundle); LOGGER.debug("Loaded resource bundle ", bundle, " as default bundle"); }
[ "@", "Override", "protected", "void", "setMessageResourceBundle", "(", "HttpServletRequest", "request", ",", "ResourceBundle", "bundle", ")", "{", "Config", ".", "set", "(", "request", ",", "Config", ".", "FMT_LOCALIZATION_CONTEXT", ",", "new", "LocalizationContext", ...
Sets the message resource bundle in the request using the JSTL's mechanism.
[ "Sets", "the", "message", "resource", "bundle", "in", "the", "request", "using", "the", "JSTL", "s", "mechanism", "." ]
train
https://github.com/StripesFramework/stripes-stuff/blob/51ad92b4bd5862ba34d7c18c5829fb00ea3a3811/src/main/java/org/stripesstuff/plugin/jstl/JstlBundleInterceptor.java#L104-L110
TheHortonMachine/hortonmachine
gears/src/main/java/oms3/Compound.java
Compound.out2out
public void out2out(String out, Object to, String to_out) { controller.mapOut(out, to, to_out); }
java
public void out2out(String out, Object to, String to_out) { controller.mapOut(out, to, to_out); }
[ "public", "void", "out2out", "(", "String", "out", ",", "Object", "to", ",", "String", "to_out", ")", "{", "controller", ".", "mapOut", "(", "out", ",", "to", ",", "to_out", ")", ";", "}" ]
Maps a Compound Output field to a internal simple output field. @param out Compount output field. @param to internal Component @param to_out output field of the internal component
[ "Maps", "a", "Compound", "Output", "field", "to", "a", "internal", "simple", "output", "field", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/Compound.java#L241-L243
palatable/lambda
src/main/java/com/jnape/palatable/lambda/adt/Try.java
Try.withResources
public static <A extends AutoCloseable, B extends AutoCloseable, C extends AutoCloseable, D> Try<Exception, D> withResources( CheckedSupplier<? extends Exception, ? extends A> aSupplier, CheckedFn1<? extends Exception, ? super A, ? extends B> bFn, CheckedFn1<? extends Exception, ? super B, ? extends C> cFn, CheckedFn1<? extends Exception, ? super C, ? extends Try<? extends Exception, ? extends D>> fn) { return withResources(aSupplier, bFn, b -> withResources(() -> cFn.apply(b), fn::apply)); }
java
public static <A extends AutoCloseable, B extends AutoCloseable, C extends AutoCloseable, D> Try<Exception, D> withResources( CheckedSupplier<? extends Exception, ? extends A> aSupplier, CheckedFn1<? extends Exception, ? super A, ? extends B> bFn, CheckedFn1<? extends Exception, ? super B, ? extends C> cFn, CheckedFn1<? extends Exception, ? super C, ? extends Try<? extends Exception, ? extends D>> fn) { return withResources(aSupplier, bFn, b -> withResources(() -> cFn.apply(b), fn::apply)); }
[ "public", "static", "<", "A", "extends", "AutoCloseable", ",", "B", "extends", "AutoCloseable", ",", "C", "extends", "AutoCloseable", ",", "D", ">", "Try", "<", "Exception", ",", "D", ">", "withResources", "(", "CheckedSupplier", "<", "?", "extends", "Except...
Convenience overload of {@link Try#withResources(CheckedSupplier, CheckedFn1, CheckedFn1) withResources} that cascades two dependent resource creations via nested calls. @param aSupplier the first resource supplier @param bFn the second resource function @param cFn the final resource function @param fn the function body @param <A> the first resource type @param <B> the second resource type @param <C> the final resource type @param <D> the function return type @return a {@link Try} representing the result of the function's application to the final dependent resource
[ "Convenience", "overload", "of", "{", "@link", "Try#withResources", "(", "CheckedSupplier", "CheckedFn1", "CheckedFn1", ")", "withResources", "}", "that", "cascades", "two", "dependent", "resource", "creations", "via", "nested", "calls", "." ]
train
https://github.com/palatable/lambda/blob/b643ba836c5916d1d8193822e5efb4e7b40c489a/src/main/java/com/jnape/palatable/lambda/adt/Try.java#L364-L370
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java
AnnotationTypeBuilder.getInstance
public static AnnotationTypeBuilder getInstance(Context context, AnnotationTypeDoc annotationTypeDoc, AnnotationTypeWriter writer) throws Exception { return new AnnotationTypeBuilder(context, annotationTypeDoc, writer); }
java
public static AnnotationTypeBuilder getInstance(Context context, AnnotationTypeDoc annotationTypeDoc, AnnotationTypeWriter writer) throws Exception { return new AnnotationTypeBuilder(context, annotationTypeDoc, writer); }
[ "public", "static", "AnnotationTypeBuilder", "getInstance", "(", "Context", "context", ",", "AnnotationTypeDoc", "annotationTypeDoc", ",", "AnnotationTypeWriter", "writer", ")", "throws", "Exception", "{", "return", "new", "AnnotationTypeBuilder", "(", "context", ",", "...
Construct a new ClassBuilder. @param context the build context. @param annotationTypeDoc the class being documented. @param writer the doclet specific writer.
[ "Construct", "a", "new", "ClassBuilder", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java#L90-L95
VoltDB/voltdb
src/frontend/org/voltdb/compilereport/ReportMaker.java
ReportMaker.liveReport
public static String liveReport() { byte[] reportbytes = VoltDB.instance().getCatalogContext().getFileInJar(VoltCompiler.CATLOG_REPORT); String report = new String(reportbytes, Charsets.UTF_8); // remove commented out code report = report.replace("<!--##RESOURCES", ""); report = report.replace("##RESOURCES-->", ""); // inject the cluster overview //String clusterStr = "<h4>System Overview</h4>\n<p>" + getLiveSystemOverview() + "</p><br/>\n"; //report = report.replace("<!--##CLUSTER##-->", clusterStr); // inject the running system platform properties PlatformProperties pp = PlatformProperties.getPlatformProperties(); String ppStr = "<h4>Cluster Platform</h4>\n<p>" + pp.toHTML() + "</p><br/>\n"; report = report.replace("<!--##PLATFORM2##-->", ppStr); // change the live/static var to live if (VoltDB.instance().getConfig().m_isEnterprise) { report = report.replace("&b=r&", "&b=e&"); } else { report = report.replace("&b=r&", "&b=c&"); } return report; }
java
public static String liveReport() { byte[] reportbytes = VoltDB.instance().getCatalogContext().getFileInJar(VoltCompiler.CATLOG_REPORT); String report = new String(reportbytes, Charsets.UTF_8); // remove commented out code report = report.replace("<!--##RESOURCES", ""); report = report.replace("##RESOURCES-->", ""); // inject the cluster overview //String clusterStr = "<h4>System Overview</h4>\n<p>" + getLiveSystemOverview() + "</p><br/>\n"; //report = report.replace("<!--##CLUSTER##-->", clusterStr); // inject the running system platform properties PlatformProperties pp = PlatformProperties.getPlatformProperties(); String ppStr = "<h4>Cluster Platform</h4>\n<p>" + pp.toHTML() + "</p><br/>\n"; report = report.replace("<!--##PLATFORM2##-->", ppStr); // change the live/static var to live if (VoltDB.instance().getConfig().m_isEnterprise) { report = report.replace("&b=r&", "&b=e&"); } else { report = report.replace("&b=r&", "&b=c&"); } return report; }
[ "public", "static", "String", "liveReport", "(", ")", "{", "byte", "[", "]", "reportbytes", "=", "VoltDB", ".", "instance", "(", ")", ".", "getCatalogContext", "(", ")", ".", "getFileInJar", "(", "VoltCompiler", ".", "CATLOG_REPORT", ")", ";", "String", "r...
Find the pre-compild catalog report in the jarfile, and modify it for use in the the built-in web portal.
[ "Find", "the", "pre", "-", "compild", "catalog", "report", "in", "the", "jarfile", "and", "modify", "it", "for", "use", "in", "the", "the", "built", "-", "in", "web", "portal", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/compilereport/ReportMaker.java#L1150-L1176
jglobus/JGlobus
gss/src/main/java/org/globus/gsi/gssapi/SSLUtil.java
SSLUtil.toLong
public static long toLong(byte[]buf, int off) { return ((long)(toInt(buf, off)) << 32) + (toInt(buf, off+4) & 0xFFFFFFFFL); }
java
public static long toLong(byte[]buf, int off) { return ((long)(toInt(buf, off)) << 32) + (toInt(buf, off+4) & 0xFFFFFFFFL); }
[ "public", "static", "long", "toLong", "(", "byte", "[", "]", "buf", ",", "int", "off", ")", "{", "return", "(", "(", "long", ")", "(", "toInt", "(", "buf", ",", "off", ")", ")", "<<", "32", ")", "+", "(", "toInt", "(", "buf", ",", "off", "+",...
Converts 8 bytes to a <code>long</code> at the specified offset in the given byte array. @param buf the byte array containing the 8 bytes to be converted to a <code>long</code>. @param off offset in the byte array @return the <code>long</code> value of the 8 bytes.
[ "Converts", "8", "bytes", "to", "a", "<code", ">", "long<", "/", "code", ">", "at", "the", "specified", "offset", "in", "the", "given", "byte", "array", "." ]
train
https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/gss/src/main/java/org/globus/gsi/gssapi/SSLUtil.java#L201-L203
patka/cassandra-migration
cassandra-migration/src/main/java/org/cognitor/cassandra/migration/scanner/FileSystemLocationScanner.java
FileSystemLocationScanner.findResourceNames
public Set<String> findResourceNames(String location, URI locationUri) throws IOException { String filePath = toFilePath(locationUri); File folder = new File(filePath); if (!folder.isDirectory()) { LOGGER.debug("Skipping path as it is not a directory: " + filePath); return new TreeSet<>(); } String classPathRootOnDisk = filePath.substring(0, filePath.length() - location.length()); if (!classPathRootOnDisk.endsWith(File.separator)) { classPathRootOnDisk = classPathRootOnDisk + File.separator; } LOGGER.debug("Scanning starting at classpath root in filesystem: " + classPathRootOnDisk); return findResourceNamesFromFileSystem(classPathRootOnDisk, location, folder); }
java
public Set<String> findResourceNames(String location, URI locationUri) throws IOException { String filePath = toFilePath(locationUri); File folder = new File(filePath); if (!folder.isDirectory()) { LOGGER.debug("Skipping path as it is not a directory: " + filePath); return new TreeSet<>(); } String classPathRootOnDisk = filePath.substring(0, filePath.length() - location.length()); if (!classPathRootOnDisk.endsWith(File.separator)) { classPathRootOnDisk = classPathRootOnDisk + File.separator; } LOGGER.debug("Scanning starting at classpath root in filesystem: " + classPathRootOnDisk); return findResourceNamesFromFileSystem(classPathRootOnDisk, location, folder); }
[ "public", "Set", "<", "String", ">", "findResourceNames", "(", "String", "location", ",", "URI", "locationUri", ")", "throws", "IOException", "{", "String", "filePath", "=", "toFilePath", "(", "locationUri", ")", ";", "File", "folder", "=", "new", "File", "(...
Scans a path on the filesystem for resources inside the given classpath location. @param location The system-independent location on the classpath. @param locationUri The system-specific physical location URI. @return a sorted set containing all the resources inside the given location @throws IOException if an error accessing the filesystem happens
[ "Scans", "a", "path", "on", "the", "filesystem", "for", "resources", "inside", "the", "given", "classpath", "location", "." ]
train
https://github.com/patka/cassandra-migration/blob/c61840c23b17a18df704d136909c26ff46bd5c77/cassandra-migration/src/main/java/org/cognitor/cassandra/migration/scanner/FileSystemLocationScanner.java#L34-L48
rterp/GMapsFX
GMapsFX/src/main/java/com/lynden/gmapsfx/javascript/JavascriptRuntime.java
JavascriptRuntime.getConstructor
@Override public String getConstructor(String javascriptObjectType, Object... args) { return getFunction("new " + javascriptObjectType, args); }
java
@Override public String getConstructor(String javascriptObjectType, Object... args) { return getFunction("new " + javascriptObjectType, args); }
[ "@", "Override", "public", "String", "getConstructor", "(", "String", "javascriptObjectType", ",", "Object", "...", "args", ")", "{", "return", "getFunction", "(", "\"new \"", "+", "javascriptObjectType", ",", "args", ")", ";", "}" ]
Gets a constructor as a string which then can be passed to the execute(). @param javascriptObjectType The type of JavaScript object to create @param args The args of the constructor @return A string which can be passed to the JavaScript environment to create a new object.
[ "Gets", "a", "constructor", "as", "a", "string", "which", "then", "can", "be", "passed", "to", "the", "execute", "()", "." ]
train
https://github.com/rterp/GMapsFX/blob/4623d3f768e8ad78fc50ee32dd204d236e01059f/GMapsFX/src/main/java/com/lynden/gmapsfx/javascript/JavascriptRuntime.java#L79-L82
googleapis/google-cloud-java
google-cloud-clients/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/MetricsClient.java
MetricsClient.updateLogMetric
public final LogMetric updateLogMetric(String metricName, LogMetric metric) { UpdateLogMetricRequest request = UpdateLogMetricRequest.newBuilder().setMetricName(metricName).setMetric(metric).build(); return updateLogMetric(request); }
java
public final LogMetric updateLogMetric(String metricName, LogMetric metric) { UpdateLogMetricRequest request = UpdateLogMetricRequest.newBuilder().setMetricName(metricName).setMetric(metric).build(); return updateLogMetric(request); }
[ "public", "final", "LogMetric", "updateLogMetric", "(", "String", "metricName", ",", "LogMetric", "metric", ")", "{", "UpdateLogMetricRequest", "request", "=", "UpdateLogMetricRequest", ".", "newBuilder", "(", ")", ".", "setMetricName", "(", "metricName", ")", ".", ...
Creates or updates a logs-based metric. <p>Sample code: <pre><code> try (MetricsClient metricsClient = MetricsClient.create()) { MetricName metricName = ProjectMetricName.of("[PROJECT]", "[METRIC]"); LogMetric metric = LogMetric.newBuilder().build(); LogMetric response = metricsClient.updateLogMetric(metricName.toString(), metric); } </code></pre> @param metricName The resource name of the metric to update: <p>"projects/[PROJECT_ID]/metrics/[METRIC_ID]" <p>The updated metric must be provided in the request and it's `name` field must be the same as `[METRIC_ID]` If the metric does not exist in `[PROJECT_ID]`, then a new metric is created. @param metric The updated metric. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "or", "updates", "a", "logs", "-", "based", "metric", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/MetricsClient.java#L552-L557
UrielCh/ovh-java-sdk
ovh-java-sdk-core/src/main/java/net/minidev/ovh/core/ApiOvhCore.java
ApiOvhCore.registerHandler
public void registerHandler(String method, String url, OphApiHandler handler) { if (mtdHandler == null) mtdHandler = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); TreeMap<String, OphApiHandler> reg; if (method == null) method = "ALL"; reg = mtdHandler.get(method); if (reg == null) { reg = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); mtdHandler.put(method, reg); } reg.put(url, handler); }
java
public void registerHandler(String method, String url, OphApiHandler handler) { if (mtdHandler == null) mtdHandler = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); TreeMap<String, OphApiHandler> reg; if (method == null) method = "ALL"; reg = mtdHandler.get(method); if (reg == null) { reg = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); mtdHandler.put(method, reg); } reg.put(url, handler); }
[ "public", "void", "registerHandler", "(", "String", "method", ",", "String", "url", ",", "OphApiHandler", "handler", ")", "{", "if", "(", "mtdHandler", "==", "null", ")", "mtdHandler", "=", "new", "TreeMap", "<>", "(", "String", ".", "CASE_INSENSITIVE_ORDER", ...
register and handlet linked to a method @param method GET PUT POST DELETE or ALL @param url @param handler
[ "register", "and", "handlet", "linked", "to", "a", "method" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-core/src/main/java/net/minidev/ovh/core/ApiOvhCore.java#L62-L75
cesarferreira/AndroidQuickUtils
library/src/main/java/quickutils/core/cache/GsonCache.java
GsonCache.saveAsync
public static void saveAsync(String key, Object object, SaveToCacheCallback callback) { new SaveTask(key, object, callback).execute(); }
java
public static void saveAsync(String key, Object object, SaveToCacheCallback callback) { new SaveTask(key, object, callback).execute(); }
[ "public", "static", "void", "saveAsync", "(", "String", "key", ",", "Object", "object", ",", "SaveToCacheCallback", "callback", ")", "{", "new", "SaveTask", "(", "key", ",", "object", ",", "callback", ")", ".", "execute", "(", ")", ";", "}" ]
Put an object into Reservoir with the given key asynchronously. Previously stored object with the same key (if any) will be overwritten. @param key the key string. @param object the object to be stored. @param callback a callback of type {@link quickutils.core.cache.interfaces.SaveToCacheCallback .ReservoirPutCallback} which is called upon completion.
[ "Put", "an", "object", "into", "Reservoir", "with", "the", "given", "key", "asynchronously", ".", "Previously", "stored", "object", "with", "the", "same", "key", "(", "if", "any", ")", "will", "be", "overwritten", "." ]
train
https://github.com/cesarferreira/AndroidQuickUtils/blob/73a91daedbb9f7be7986ea786fbc441c9e5a881c/library/src/main/java/quickutils/core/cache/GsonCache.java#L69-L71
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-backend-impls/nd4j-native/src/main/java/org/nd4j/linalg/cpu/nativecpu/blas/CpuLapack.java
CpuLapack.getri
@Override public void getri(int N, INDArray A, int lda, int[] IPIV, INDArray WORK, int lwork, int INFO) { }
java
@Override public void getri(int N, INDArray A, int lda, int[] IPIV, INDArray WORK, int lwork, int INFO) { }
[ "@", "Override", "public", "void", "getri", "(", "int", "N", ",", "INDArray", "A", ",", "int", "lda", ",", "int", "[", "]", "IPIV", ",", "INDArray", "WORK", ",", "int", "lwork", ",", "int", "INFO", ")", "{", "}" ]
Generate inverse given LU decomp @param N @param A @param lda @param IPIV @param WORK @param lwork @param INFO
[ "Generate", "inverse", "given", "LU", "decomp" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-native/src/main/java/org/nd4j/linalg/cpu/nativecpu/blas/CpuLapack.java#L286-L289
ReactiveX/RxNetty
rxnetty-tcp/src/main/java/io/reactivex/netty/protocol/tcp/client/TcpClient.java
TcpClient.newClient
public static TcpClient<ByteBuf, ByteBuf> newClient(String host, int port) { return newClient(new InetSocketAddress(host, port)); }
java
public static TcpClient<ByteBuf, ByteBuf> newClient(String host, int port) { return newClient(new InetSocketAddress(host, port)); }
[ "public", "static", "TcpClient", "<", "ByteBuf", ",", "ByteBuf", ">", "newClient", "(", "String", "host", ",", "int", "port", ")", "{", "return", "newClient", "(", "new", "InetSocketAddress", "(", "host", ",", "port", ")", ")", ";", "}" ]
Creates a new TCP client instance with the passed address of the target server. @param host Hostname for the target server. @param port Port for the target server. @return A new {@code TcpClient} instance.
[ "Creates", "a", "new", "TCP", "client", "instance", "with", "the", "passed", "address", "of", "the", "target", "server", "." ]
train
https://github.com/ReactiveX/RxNetty/blob/a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6/rxnetty-tcp/src/main/java/io/reactivex/netty/protocol/tcp/client/TcpClient.java#L320-L322
fozziethebeat/S-Space
src/main/java/edu/ucla/sspace/matrix/MatrixIO.java
MatrixIO.readMatrixArray
@Deprecated public static double[][] readMatrixArray(File input, Format format) throws IOException { // Use the same code path for reading the Matrix object and then dump to // an array. This comes at a potential 2X space usage, but greatly // reduces the possibilities for bugs. return readMatrix(input, format).toDenseArray(); }
java
@Deprecated public static double[][] readMatrixArray(File input, Format format) throws IOException { // Use the same code path for reading the Matrix object and then dump to // an array. This comes at a potential 2X space usage, but greatly // reduces the possibilities for bugs. return readMatrix(input, format).toDenseArray(); }
[ "@", "Deprecated", "public", "static", "double", "[", "]", "[", "]", "readMatrixArray", "(", "File", "input", ",", "Format", "format", ")", "throws", "IOException", "{", "// Use the same code path for reading the Matrix object and then dump to", "// an array. This comes at...
Reads in the content of the file as a two dimensional Java array matrix. This method has been deprecated in favor of using purely {@link Matrix} objects for all operations. If a Java array is needed, the {@link Matrix#toArray()} method may be used to generate one. @return a two-dimensional array of the matrix contained in provided file
[ "Reads", "in", "the", "content", "of", "the", "file", "as", "a", "two", "dimensional", "Java", "array", "matrix", ".", "This", "method", "has", "been", "deprecated", "in", "favor", "of", "using", "purely", "{", "@link", "Matrix", "}", "objects", "for", "...
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/matrix/MatrixIO.java#L692-L699
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/closure/support/Algorithms.java
Algorithms.findAll
public Collection findAll(Collection collection, Constraint constraint) { return findAll(collection.iterator(), constraint); }
java
public Collection findAll(Collection collection, Constraint constraint) { return findAll(collection.iterator(), constraint); }
[ "public", "Collection", "findAll", "(", "Collection", "collection", ",", "Constraint", "constraint", ")", "{", "return", "findAll", "(", "collection", ".", "iterator", "(", ")", ",", "constraint", ")", ";", "}" ]
Find all the elements in the collection that match the specified constraint. @param collection @param constraint @return The objects that match, or a empty collection if none match
[ "Find", "all", "the", "elements", "in", "the", "collection", "that", "match", "the", "specified", "constraint", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/closure/support/Algorithms.java#L135-L137
neoremind/fluent-validator
fluent-validator/src/main/java/com/baidu/unbiz/fluentvalidator/util/ArrayUtil.java
ArrayUtil.hasIntersection
public static <T> boolean hasIntersection(T[] from, T[] target) { if (isEmpty(target)) { return true; } if (isEmpty(from)) { return false; } for (int i = 0; i < from.length; i++) { for (int j = 0; j < target.length; j++) { if (from[i] == target[j]) { return true; } } } return false; }
java
public static <T> boolean hasIntersection(T[] from, T[] target) { if (isEmpty(target)) { return true; } if (isEmpty(from)) { return false; } for (int i = 0; i < from.length; i++) { for (int j = 0; j < target.length; j++) { if (from[i] == target[j]) { return true; } } } return false; }
[ "public", "static", "<", "T", ">", "boolean", "hasIntersection", "(", "T", "[", "]", "from", ",", "T", "[", "]", "target", ")", "{", "if", "(", "isEmpty", "(", "target", ")", ")", "{", "return", "true", ";", "}", "if", "(", "isEmpty", "(", "from"...
验证数组是否有交集 <p/> <pre> Class<?>[] from = new Class<?>[] {}; Class<?>[] target = new Class<?>[] {}; assertThat(ArrayUtil.hasIntersection(from, target), Matchers.is(true)); from = new Class<?>[] {String.class}; target = new Class<?>[] {}; assertThat(ArrayUtil.hasIntersection(from, target), Matchers.is(true)); from = new Class<?>[] {}; target = new Class<?>[] {String.class}; assertThat(ArrayUtil.hasIntersection(from, target), Matchers.is(false)); from = new Class<?>[] {String.class}; target = new Class<?>[] {String.class}; assertThat(ArrayUtil.hasIntersection(from, target), Matchers.is(true)); from = new Class<?>[] {String.class, Object.class}; target = new Class<?>[] {String.class}; assertThat(ArrayUtil.hasIntersection(from, target), Matchers.is(true)); from = new Class<?>[] {String.class}; target = new Class<?>[] {String.class, Object.class}; assertThat(ArrayUtil.hasIntersection(from, target), Matchers.is(true)); from = new Class<?>[] {Integer.class}; target = new Class<?>[] {Object.class}; assertThat(ArrayUtil.hasIntersection(from, target), Matchers.is(false)); </pre> @param from 基础数组 @param target 目标数组,看是否存在于基础数组中 @return 如果有交集, 则返回<code>true</code>
[ "验证数组是否有交集", "<p", "/", ">", "<pre", ">", "Class<?", ">", "[]", "from", "=", "new", "Class<?", ">", "[]", "{}", ";", "Class<?", ">", "[]", "target", "=", "new", "Class<?", ">", "[]", "{}", ";", "assertThat", "(", "ArrayUtil", ".", "hasIntersection", ...
train
https://github.com/neoremind/fluent-validator/blob/b516970591aa9468b44ba63938b98ec341fd6ead/fluent-validator/src/main/java/com/baidu/unbiz/fluentvalidator/util/ArrayUtil.java#L69-L86
jbundle/jbundle
base/message/core/src/main/java/org/jbundle/base/message/core/trx/TrxMessageHeader.java
TrxMessageHeader.moveMapInfo
public void moveMapInfo(Map<String,Object> mapReplyHeader, Map<String,Object> mapInHeader, String strReplyParam, String strInParam) { if (mapInHeader != null) if (mapInHeader.get(strInParam) != null) if (mapReplyHeader != null) mapReplyHeader.put(strReplyParam, mapInHeader.get(strInParam)); }
java
public void moveMapInfo(Map<String,Object> mapReplyHeader, Map<String,Object> mapInHeader, String strReplyParam, String strInParam) { if (mapInHeader != null) if (mapInHeader.get(strInParam) != null) if (mapReplyHeader != null) mapReplyHeader.put(strReplyParam, mapInHeader.get(strInParam)); }
[ "public", "void", "moveMapInfo", "(", "Map", "<", "String", ",", "Object", ">", "mapReplyHeader", ",", "Map", "<", "String", ",", "Object", ">", "mapInHeader", ",", "String", "strReplyParam", ",", "String", "strInParam", ")", "{", "if", "(", "mapInHeader", ...
Move this param from the header map to the reply map (if non null).
[ "Move", "this", "param", "from", "the", "header", "map", "to", "the", "reply", "map", "(", "if", "non", "null", ")", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/core/src/main/java/org/jbundle/base/message/core/trx/TrxMessageHeader.java#L396-L402
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java
Symtab.enterClass
public ClassSymbol enterClass(ModuleSymbol msym, Name flatname) { Assert.checkNonNull(msym); PackageSymbol ps = lookupPackage(msym, Convert.packagePart(flatname)); Assert.checkNonNull(ps); Assert.checkNonNull(ps.modle); ClassSymbol c = getClass(ps.modle, flatname); if (c == null) { c = defineClass(Convert.shortName(flatname), ps); doEnterClass(ps.modle, c); return c; } else return c; }
java
public ClassSymbol enterClass(ModuleSymbol msym, Name flatname) { Assert.checkNonNull(msym); PackageSymbol ps = lookupPackage(msym, Convert.packagePart(flatname)); Assert.checkNonNull(ps); Assert.checkNonNull(ps.modle); ClassSymbol c = getClass(ps.modle, flatname); if (c == null) { c = defineClass(Convert.shortName(flatname), ps); doEnterClass(ps.modle, c); return c; } else return c; }
[ "public", "ClassSymbol", "enterClass", "(", "ModuleSymbol", "msym", ",", "Name", "flatname", ")", "{", "Assert", ".", "checkNonNull", "(", "msym", ")", ";", "PackageSymbol", "ps", "=", "lookupPackage", "(", "msym", ",", "Convert", ".", "packagePart", "(", "f...
Create a new member or toplevel class symbol with given flat name and enter in `classes' unless already there.
[ "Create", "a", "new", "member", "or", "toplevel", "class", "symbol", "with", "given", "flat", "name", "and", "enter", "in", "classes", "unless", "already", "there", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java#L705-L717
alkacon/opencms-core
src/org/opencms/staticexport/CmsLinkManager.java
CmsLinkManager.substituteLinkForUnknownTarget
public String substituteLinkForUnknownTarget(CmsObject cms, String link) { return substituteLinkForUnknownTarget(cms, link, false); }
java
public String substituteLinkForUnknownTarget(CmsObject cms, String link) { return substituteLinkForUnknownTarget(cms, link, false); }
[ "public", "String", "substituteLinkForUnknownTarget", "(", "CmsObject", "cms", ",", "String", "link", ")", "{", "return", "substituteLinkForUnknownTarget", "(", "cms", ",", "link", ",", "false", ")", ";", "}" ]
Returns a link <i>from</i> the URI stored in the provided OpenCms user context <i>to</i> the given <code>link</code>, for use on web pages.<p> A number of tests are performed with the <code>link</code> in order to find out how to create the link:<ul> <li>If <code>link</code> is empty, an empty String is returned. <li>If <code>link</code> starts with an URI scheme component, for example <code>http://</code>, and does not point to an internal OpenCms site, it is returned unchanged. <li>If <code>link</code> is an absolute URI that starts with a configured site root, the site root is cut from the link and the same result as {@link #substituteLink(CmsObject, String, String)} is returned. <li>Otherwise the same result as {@link #substituteLink(CmsObject, String)} is returned. </ul> @param cms the current OpenCms user context @param link the link to process @return a link <i>from</i> the URI stored in the provided OpenCms user context <i>to</i> the given <code>link</code>
[ "Returns", "a", "link", "<i", ">", "from<", "/", "i", ">", "the", "URI", "stored", "in", "the", "provided", "OpenCms", "user", "context", "<i", ">", "to<", "/", "i", ">", "the", "given", "<code", ">", "link<", "/", "code", ">", "for", "use", "on", ...
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/staticexport/CmsLinkManager.java#L868-L872