repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 201 | func_name stringlengths 4 126 | whole_func_string stringlengths 75 3.57k | language stringclasses 1
value | func_code_string stringlengths 75 3.57k | func_code_tokens listlengths 21 599 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
Azure/azure-sdk-for-java | cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/CollectionPartitionsInner.java | CollectionPartitionsInner.listUsages | public List<PartitionUsageInner> listUsages(String resourceGroupName, String accountName, String databaseRid, String collectionRid) {
return listUsagesWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid).toBlocking().single().body();
} | java | public List<PartitionUsageInner> listUsages(String resourceGroupName, String accountName, String databaseRid, String collectionRid) {
return listUsagesWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid).toBlocking().single().body();
} | [
"public",
"List",
"<",
"PartitionUsageInner",
">",
"listUsages",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"databaseRid",
",",
"String",
"collectionRid",
")",
"{",
"return",
"listUsagesWithServiceResponseAsync",
"(",
"resourceGroup... | Retrieves the usages (most recent storage data) for the given collection, split by partition.
@param resourceGroupName Name of an Azure resource group.
@param accountName Cosmos DB database account name.
@param databaseRid Cosmos DB database rid.
@param collectionRid Cosmos DB collection rid.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the List<PartitionUsageInner> object if successful. | [
"Retrieves",
"the",
"usages",
"(",
"most",
"recent",
"storage",
"data",
")",
"for",
"the",
"given",
"collection",
"split",
"by",
"partition",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/CollectionPartitionsInner.java#L189-L191 |
threerings/narya | core/src/main/java/com/threerings/presents/peer/server/PeerManager.java | PeerManager.queryLock | public void queryLock (NodeObject.Lock lock, ResultListener<String> listener)
{
// if it's being resolved, add the listener to the list
LockHandler handler = _locks.get(lock);
if (handler != null) {
handler.listeners.add(listener);
return;
}
// otherwise, return its present value
listener.requestCompleted(queryLock(lock));
} | java | public void queryLock (NodeObject.Lock lock, ResultListener<String> listener)
{
// if it's being resolved, add the listener to the list
LockHandler handler = _locks.get(lock);
if (handler != null) {
handler.listeners.add(listener);
return;
}
// otherwise, return its present value
listener.requestCompleted(queryLock(lock));
} | [
"public",
"void",
"queryLock",
"(",
"NodeObject",
".",
"Lock",
"lock",
",",
"ResultListener",
"<",
"String",
">",
"listener",
")",
"{",
"// if it's being resolved, add the listener to the list",
"LockHandler",
"handler",
"=",
"_locks",
".",
"get",
"(",
"lock",
")",
... | Determines the owner of the specified lock, waiting for any resolution to complete before
notifying the supplied listener. | [
"Determines",
"the",
"owner",
"of",
"the",
"specified",
"lock",
"waiting",
"for",
"any",
"resolution",
"to",
"complete",
"before",
"notifying",
"the",
"supplied",
"listener",
"."
] | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L876-L887 |
ngageoint/geopackage-android-map | geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/FeatureOverlayQuery.java | FeatureOverlayQuery.isOnAtCurrentZoom | public boolean isOnAtCurrentZoom(GoogleMap map, LatLng latLng) {
float zoom = MapUtils.getCurrentZoom(map);
boolean on = isOnAtCurrentZoom(zoom, latLng);
return on;
} | java | public boolean isOnAtCurrentZoom(GoogleMap map, LatLng latLng) {
float zoom = MapUtils.getCurrentZoom(map);
boolean on = isOnAtCurrentZoom(zoom, latLng);
return on;
} | [
"public",
"boolean",
"isOnAtCurrentZoom",
"(",
"GoogleMap",
"map",
",",
"LatLng",
"latLng",
")",
"{",
"float",
"zoom",
"=",
"MapUtils",
".",
"getCurrentZoom",
"(",
"map",
")",
";",
"boolean",
"on",
"=",
"isOnAtCurrentZoom",
"(",
"zoom",
",",
"latLng",
")",
... | Determine if the the feature overlay is on for the current zoom level of the map at the location
@param map google map
@param latLng lat lon location
@return true if on
@since 1.2.6 | [
"Determine",
"if",
"the",
"the",
"feature",
"overlay",
"is",
"on",
"for",
"the",
"current",
"zoom",
"level",
"of",
"the",
"map",
"at",
"the",
"location"
] | train | https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/FeatureOverlayQuery.java#L173-L177 |
Azure/azure-sdk-for-java | servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java | ClientFactory.acceptSessionFromEntityPathAsync | public static CompletableFuture<IMessageSession> acceptSessionFromEntityPathAsync(MessagingFactory messagingFactory, String entityPath, String sessionId) {
return acceptSessionFromEntityPathAsync(messagingFactory, entityPath, sessionId, DEFAULTRECEIVEMODE);
} | java | public static CompletableFuture<IMessageSession> acceptSessionFromEntityPathAsync(MessagingFactory messagingFactory, String entityPath, String sessionId) {
return acceptSessionFromEntityPathAsync(messagingFactory, entityPath, sessionId, DEFAULTRECEIVEMODE);
} | [
"public",
"static",
"CompletableFuture",
"<",
"IMessageSession",
">",
"acceptSessionFromEntityPathAsync",
"(",
"MessagingFactory",
"messagingFactory",
",",
"String",
"entityPath",
",",
"String",
"sessionId",
")",
"{",
"return",
"acceptSessionFromEntityPathAsync",
"(",
"mess... | Asynchronously accepts a session from service bus using the client settings. Session Id can be null, if null, service will return the first available session.
@param messagingFactory messaging factory (which represents a connection) on which the session receiver needs to be created.
@param entityPath path of entity
@param sessionId session id, if null, service will return the first available session, otherwise, service will return specified session
@return a CompletableFuture representing the pending session accepting | [
"Asynchronously",
"accepts",
"a",
"session",
"from",
"service",
"bus",
"using",
"the",
"client",
"settings",
".",
"Session",
"Id",
"can",
"be",
"null",
"if",
"null",
"service",
"will",
"return",
"the",
"first",
"available",
"session",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java#L724-L726 |
elki-project/elki | elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/MiniMax.java | MiniMax.findPrototype | private static double findPrototype(DistanceQuery<?> dq, DBIDs cx, DBIDs cy, DBIDVar prototype, double minMaxDist) {
for(DBIDIter i = cx.iter(); i.valid(); i.advance()) {
// Maximum distance of i to all elements in cy
double maxDist = findMax(dq, i, cy, 0., minMaxDist);
if(maxDist >= minMaxDist) {
// We already have an at least equally good candidate.
continue;
}
// Maximum distance of i to all elements in cx
maxDist = findMax(dq, i, cx, maxDist, minMaxDist);
// New best solution?
if(maxDist < minMaxDist) {
minMaxDist = maxDist;
prototype.set(i);
}
}
return minMaxDist;
} | java | private static double findPrototype(DistanceQuery<?> dq, DBIDs cx, DBIDs cy, DBIDVar prototype, double minMaxDist) {
for(DBIDIter i = cx.iter(); i.valid(); i.advance()) {
// Maximum distance of i to all elements in cy
double maxDist = findMax(dq, i, cy, 0., minMaxDist);
if(maxDist >= minMaxDist) {
// We already have an at least equally good candidate.
continue;
}
// Maximum distance of i to all elements in cx
maxDist = findMax(dq, i, cx, maxDist, minMaxDist);
// New best solution?
if(maxDist < minMaxDist) {
minMaxDist = maxDist;
prototype.set(i);
}
}
return minMaxDist;
} | [
"private",
"static",
"double",
"findPrototype",
"(",
"DistanceQuery",
"<",
"?",
">",
"dq",
",",
"DBIDs",
"cx",
",",
"DBIDs",
"cy",
",",
"DBIDVar",
"prototype",
",",
"double",
"minMaxDist",
")",
"{",
"for",
"(",
"DBIDIter",
"i",
"=",
"cx",
".",
"iter",
... | Find the prototypes.
@param dq Distance query
@param cx First set
@param cy Second set
@param prototype Prototype output variable
@param minMaxDist Previously best distance.
@return New best distance | [
"Find",
"the",
"prototypes",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/MiniMax.java#L314-L332 |
jcuda/jcusparse | JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java | JCusparse.cusparseXbsrsm2_zeroPivot | public static int cusparseXbsrsm2_zeroPivot(
cusparseHandle handle,
bsrsm2Info info,
Pointer position)
{
return checkResult(cusparseXbsrsm2_zeroPivotNative(handle, info, position));
} | java | public static int cusparseXbsrsm2_zeroPivot(
cusparseHandle handle,
bsrsm2Info info,
Pointer position)
{
return checkResult(cusparseXbsrsm2_zeroPivotNative(handle, info, position));
} | [
"public",
"static",
"int",
"cusparseXbsrsm2_zeroPivot",
"(",
"cusparseHandle",
"handle",
",",
"bsrsm2Info",
"info",
",",
"Pointer",
"position",
")",
"{",
"return",
"checkResult",
"(",
"cusparseXbsrsm2_zeroPivotNative",
"(",
"handle",
",",
"info",
",",
"position",
")... | <pre>
Description: Solution of triangular linear system op(A) * X = alpha * B,
with multiple right-hand-sides, where A is a sparse matrix in CSR storage
format, rhs B and solution X are dense tall matrices.
This routine implements algorithm 2 for this problem.
</pre> | [
"<pre",
">",
"Description",
":",
"Solution",
"of",
"triangular",
"linear",
"system",
"op",
"(",
"A",
")",
"*",
"X",
"=",
"alpha",
"*",
"B",
"with",
"multiple",
"right",
"-",
"hand",
"-",
"sides",
"where",
"A",
"is",
"a",
"sparse",
"matrix",
"in",
"CS... | train | https://github.com/jcuda/jcusparse/blob/7687a62a4ef6b76cb91cf7da93d4cf5ade96a791/JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java#L5071-L5077 |
dickschoeller/gedbrowser | gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/util/DateParser.java | DateParser.stripPrefix | private String stripPrefix(final String input, final String searchString) {
return input.substring(searchString.length(), input.length()).trim();
} | java | private String stripPrefix(final String input, final String searchString) {
return input.substring(searchString.length(), input.length()).trim();
} | [
"private",
"String",
"stripPrefix",
"(",
"final",
"String",
"input",
",",
"final",
"String",
"searchString",
")",
"{",
"return",
"input",
".",
"substring",
"(",
"searchString",
".",
"length",
"(",
")",
",",
"input",
".",
"length",
"(",
")",
")",
".",
"tr... | Strip the searchString with and trim the result.
@param input the source string
@param searchString the string to look for in the source
@return the stripped string | [
"Strip",
"the",
"searchString",
"with",
"and",
"trim",
"the",
"result",
"."
] | train | https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/util/DateParser.java#L183-L185 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java | DBCleanService.resolveDialect | private static String resolveDialect(Connection jdbcConn, WorkspaceEntry wsEntry) throws DBCleanException
{
String dialect = DBInitializerHelper.getDatabaseDialect(wsEntry);
if (dialect.startsWith(DBConstants.DB_DIALECT_AUTO))
{
try
{
dialect = DialectDetecter.detect(jdbcConn.getMetaData());
}
catch (SQLException e)
{
throw new DBCleanException(e);
}
}
return dialect;
} | java | private static String resolveDialect(Connection jdbcConn, WorkspaceEntry wsEntry) throws DBCleanException
{
String dialect = DBInitializerHelper.getDatabaseDialect(wsEntry);
if (dialect.startsWith(DBConstants.DB_DIALECT_AUTO))
{
try
{
dialect = DialectDetecter.detect(jdbcConn.getMetaData());
}
catch (SQLException e)
{
throw new DBCleanException(e);
}
}
return dialect;
} | [
"private",
"static",
"String",
"resolveDialect",
"(",
"Connection",
"jdbcConn",
",",
"WorkspaceEntry",
"wsEntry",
")",
"throws",
"DBCleanException",
"{",
"String",
"dialect",
"=",
"DBInitializerHelper",
".",
"getDatabaseDialect",
"(",
"wsEntry",
")",
";",
"if",
"(",... | Resolves dialect which it is used in workspace configuration. First of all,
method will try to get parameter {@link JDBCWorkspaceDataContainer#DB_DIALECT} from
a configuration. And only then method will try to detect dialect using {@link DialectDetecter} in case
if dialect is set as {@link DialectConstants#DB_DIALECT_AUTO}.
@param wsEntry
workspace configuration
@return dialect
@throws DBCleanException | [
"Resolves",
"dialect",
"which",
"it",
"is",
"used",
"in",
"workspace",
"configuration",
".",
"First",
"of",
"all",
"method",
"will",
"try",
"to",
"get",
"parameter",
"{",
"@link",
"JDBCWorkspaceDataContainer#DB_DIALECT",
"}",
"from",
"a",
"configuration",
".",
"... | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java#L313-L330 |
PawelAdamski/HttpClientMock | src/main/java/com/github/paweladamski/httpclientmock/HttpClientResponseBuilder.java | HttpClientResponseBuilder.doReturnJSON | public HttpClientResponseBuilder doReturnJSON(String response, Charset charset) {
return doReturn(response, charset).withHeader("Content-type", APPLICATION_JSON.toString());
} | java | public HttpClientResponseBuilder doReturnJSON(String response, Charset charset) {
return doReturn(response, charset).withHeader("Content-type", APPLICATION_JSON.toString());
} | [
"public",
"HttpClientResponseBuilder",
"doReturnJSON",
"(",
"String",
"response",
",",
"Charset",
"charset",
")",
"{",
"return",
"doReturn",
"(",
"response",
",",
"charset",
")",
".",
"withHeader",
"(",
"\"Content-type\"",
",",
"APPLICATION_JSON",
".",
"toString",
... | Adds action which returns provided JSON in provided encoding and status 200. Additionally it sets "Content-type" header to "application/json".
@param response JSON to return
@return response builder | [
"Adds",
"action",
"which",
"returns",
"provided",
"JSON",
"in",
"provided",
"encoding",
"and",
"status",
"200",
".",
"Additionally",
"it",
"sets",
"Content",
"-",
"type",
"header",
"to",
"application",
"/",
"json",
"."
] | train | https://github.com/PawelAdamski/HttpClientMock/blob/0205498434bbc0c78c187a51181cac9b266a28fb/src/main/java/com/github/paweladamski/httpclientmock/HttpClientResponseBuilder.java#L155-L157 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsfContainer_fat_2.3/fat/src/com/ibm/ws/jsf/container/fat/utils/JSFUtils.java | JSFUtils.waitForPageResponse | public static boolean waitForPageResponse(HtmlPage page, String responseMessage) throws InterruptedException {
int i = 0;
boolean isTextFound = false;
while (!isTextFound && i < 5) {
isTextFound = page.asText().contains(responseMessage);
i++;
Thread.sleep(1000);
Log.info(c, "waitForPageResponse", "Waiting for: " + responseMessage + " isTextFound: " + isTextFound + " i: " + i);
}
return isTextFound;
} | java | public static boolean waitForPageResponse(HtmlPage page, String responseMessage) throws InterruptedException {
int i = 0;
boolean isTextFound = false;
while (!isTextFound && i < 5) {
isTextFound = page.asText().contains(responseMessage);
i++;
Thread.sleep(1000);
Log.info(c, "waitForPageResponse", "Waiting for: " + responseMessage + " isTextFound: " + isTextFound + " i: " + i);
}
return isTextFound;
} | [
"public",
"static",
"boolean",
"waitForPageResponse",
"(",
"HtmlPage",
"page",
",",
"String",
"responseMessage",
")",
"throws",
"InterruptedException",
"{",
"int",
"i",
"=",
"0",
";",
"boolean",
"isTextFound",
"=",
"false",
";",
"while",
"(",
"!",
"isTextFound",... | Create a custom wait mechanism that waits for any background JavaScript to finish
and verifies a message in the page response.
@param page The current HtmlPage
@return A boolean value indicating if the response message was found
@throws InterruptedException | [
"Create",
"a",
"custom",
"wait",
"mechanism",
"that",
"waits",
"for",
"any",
"background",
"JavaScript",
"to",
"finish",
"and",
"verifies",
"a",
"message",
"in",
"the",
"page",
"response",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsfContainer_fat_2.3/fat/src/com/ibm/ws/jsf/container/fat/utils/JSFUtils.java#L72-L82 |
geomajas/geomajas-project-server | api/src/main/java/org/geomajas/layer/feature/attribute/AssociationValue.java | AssociationValue.setManyToOneAttribute | public void setManyToOneAttribute(String name, AssociationValue value) {
ensureAttributes();
Attribute attribute = new ManyToOneAttribute(value);
attribute.setEditable(isEditable(name));
getAllAttributes().put(name, attribute);
} | java | public void setManyToOneAttribute(String name, AssociationValue value) {
ensureAttributes();
Attribute attribute = new ManyToOneAttribute(value);
attribute.setEditable(isEditable(name));
getAllAttributes().put(name, attribute);
} | [
"public",
"void",
"setManyToOneAttribute",
"(",
"String",
"name",
",",
"AssociationValue",
"value",
")",
"{",
"ensureAttributes",
"(",
")",
";",
"Attribute",
"attribute",
"=",
"new",
"ManyToOneAttribute",
"(",
"value",
")",
";",
"attribute",
".",
"setEditable",
... | Sets the specified many-to-one attribute to the specified value.
@param name name of the attribute
@param value value of the attribute
@since 1.9.0 | [
"Sets",
"the",
"specified",
"many",
"-",
"to",
"-",
"one",
"attribute",
"to",
"the",
"specified",
"value",
"."
] | train | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/api/src/main/java/org/geomajas/layer/feature/attribute/AssociationValue.java#L380-L386 |
benjamin-bader/droptools | dropwizard-jooq/src/main/java/com/bendb/dropwizard/jooq/PostgresSupport.java | PostgresSupport.arrayAggNoNulls | @Support({SQLDialect.POSTGRES})
public static <T> Field<T[]> arrayAggNoNulls(Field<T> field) {
return DSL.field("array_remove(array_agg({0}), NULL)", field.getDataType().getArrayType(), field);
} | java | @Support({SQLDialect.POSTGRES})
public static <T> Field<T[]> arrayAggNoNulls(Field<T> field) {
return DSL.field("array_remove(array_agg({0}), NULL)", field.getDataType().getArrayType(), field);
} | [
"@",
"Support",
"(",
"{",
"SQLDialect",
".",
"POSTGRES",
"}",
")",
"public",
"static",
"<",
"T",
">",
"Field",
"<",
"T",
"[",
"]",
">",
"arrayAggNoNulls",
"(",
"Field",
"<",
"T",
">",
"field",
")",
"{",
"return",
"DSL",
".",
"field",
"(",
"\"array_... | Like {@link #arrayAgg}, but uses {@code array_remove} to eliminate
SQL {@code NULL} values from the result.
@param field the field to be aggregated
@param <T> the type of the field
@return a {@link Field} representing the array aggregate
@see <a href="http://www.postgresql.org/docs/9.3/static/functions-aggregate.html"/> | [
"Like",
"{",
"@link",
"#arrayAgg",
"}",
"but",
"uses",
"{",
"@code",
"array_remove",
"}",
"to",
"eliminate",
"SQL",
"{",
"@code",
"NULL",
"}",
"values",
"from",
"the",
"result",
"."
] | train | https://github.com/benjamin-bader/droptools/blob/f1964465d725dfb07a5b6eb16f7bbe794896d1e0/dropwizard-jooq/src/main/java/com/bendb/dropwizard/jooq/PostgresSupport.java#L41-L44 |
JOML-CI/JOML | src/org/joml/Intersectionf.java | Intersectionf.intersectLineSegmentAab | public static int intersectLineSegmentAab(Vector3fc p0, Vector3fc p1, Vector3fc min, Vector3fc max, Vector2f result) {
return intersectLineSegmentAab(p0.x(), p0.y(), p0.z(), p1.x(), p1.y(), p1.z(), min.x(), min.y(), min.z(), max.x(), max.y(), max.z(), result);
} | java | public static int intersectLineSegmentAab(Vector3fc p0, Vector3fc p1, Vector3fc min, Vector3fc max, Vector2f result) {
return intersectLineSegmentAab(p0.x(), p0.y(), p0.z(), p1.x(), p1.y(), p1.z(), min.x(), min.y(), min.z(), max.x(), max.y(), max.z(), result);
} | [
"public",
"static",
"int",
"intersectLineSegmentAab",
"(",
"Vector3fc",
"p0",
",",
"Vector3fc",
"p1",
",",
"Vector3fc",
"min",
",",
"Vector3fc",
"max",
",",
"Vector2f",
"result",
")",
"{",
"return",
"intersectLineSegmentAab",
"(",
"p0",
".",
"x",
"(",
")",
"... | Determine whether the undirected line segment with the end points <code>p0</code> and <code>p1</code>
intersects the axis-aligned box given as its minimum corner <code>min</code> and maximum corner <code>max</code>,
and return the values of the parameter <i>t</i> in the ray equation <i>p(t) = origin + p0 * (p1 - p0)</i> of the near and far point of intersection.
<p>
This method returns <code>true</code> for a line segment whose either end point lies inside the axis-aligned box.
<p>
Reference: <a href="https://dl.acm.org/citation.cfm?id=1198748">An Efficient and Robust Ray–Box Intersection</a>
@see #intersectLineSegmentAab(Vector3fc, Vector3fc, Vector3fc, Vector3fc, Vector2f)
@param p0
the line segment's first end point
@param p1
the line segment's second end point
@param min
the minimum corner of the axis-aligned box
@param max
the maximum corner of the axis-aligned box
@param result
a vector which will hold the resulting values of the parameter
<i>t</i> in the ray equation <i>p(t) = p0 + t * (p1 - p0)</i> of the near and far point of intersection
iff the line segment intersects the axis-aligned box
@return {@link #INSIDE} if the line segment lies completely inside of the axis-aligned box; or
{@link #OUTSIDE} if the line segment lies completely outside of the axis-aligned box; or
{@link #ONE_INTERSECTION} if one of the end points of the line segment lies inside of the axis-aligned box; or
{@link #TWO_INTERSECTION} if the line segment intersects two sides of the axis-aligned box
or lies on an edge or a side of the box | [
"Determine",
"whether",
"the",
"undirected",
"line",
"segment",
"with",
"the",
"end",
"points",
"<code",
">",
"p0<",
"/",
"code",
">",
"and",
"<code",
">",
"p1<",
"/",
"code",
">",
"intersects",
"the",
"axis",
"-",
"aligned",
"box",
"given",
"as",
"its",... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Intersectionf.java#L2569-L2571 |
paymill/paymill-java | src/main/java/com/paymill/services/SubscriptionService.java | SubscriptionService.changeOfferKeepCaptureDateAndRefund | public Subscription changeOfferKeepCaptureDateAndRefund( String subscription, Offer offer ) {
return changeOfferKeepCaptureDateAndRefund( new Subscription( subscription ), offer );
} | java | public Subscription changeOfferKeepCaptureDateAndRefund( String subscription, Offer offer ) {
return changeOfferKeepCaptureDateAndRefund( new Subscription( subscription ), offer );
} | [
"public",
"Subscription",
"changeOfferKeepCaptureDateAndRefund",
"(",
"String",
"subscription",
",",
"Offer",
"offer",
")",
"{",
"return",
"changeOfferKeepCaptureDateAndRefund",
"(",
"new",
"Subscription",
"(",
"subscription",
")",
",",
"offer",
")",
";",
"}"
] | Change the offer of a subscription.<br>
<br>
The plan will be changed immediately.The next_capture_at date will remain unchanged. A refund will be given if
due.<br>
If the new amount is higher than the old one, there will be no additional charge. The next charge date will not
change. If the new amount is less then the old one, a refund happens. The next charge date will not change.<br>
<strong>IMPORTANT</strong><br>
Permitted up only until one day (24 hours) before the next charge date.<br>
@param subscription the subscription
@param offer the new offer
@return the updated subscription | [
"Change",
"the",
"offer",
"of",
"a",
"subscription",
".",
"<br",
">",
"<br",
">",
"The",
"plan",
"will",
"be",
"changed",
"immediately",
".",
"The",
"next_capture_at",
"date",
"will",
"remain",
"unchanged",
".",
"A",
"refund",
"will",
"be",
"given",
"if",
... | train | https://github.com/paymill/paymill-java/blob/17281a0d4376c76f1711af9f09bfc138c90ba65a/src/main/java/com/paymill/services/SubscriptionService.java#L456-L458 |
kaazing/gateway | mina.netty/src/main/java/org/kaazing/mina/netty/util/threadlocal/VicariousThreadLocal.java | VicariousThreadLocal.runWith | public void runWith(T value, Runnable doRun) {
WeakReference<Holder> ref = local.get();
Holder holder = ref != null ? ref.get() : createHolder();
Object oldValue = holder.value;
holder.value = value;
try {
doRun.run();
} finally {
holder.value = oldValue;
}
} | java | public void runWith(T value, Runnable doRun) {
WeakReference<Holder> ref = local.get();
Holder holder = ref != null ? ref.get() : createHolder();
Object oldValue = holder.value;
holder.value = value;
try {
doRun.run();
} finally {
holder.value = oldValue;
}
} | [
"public",
"void",
"runWith",
"(",
"T",
"value",
",",
"Runnable",
"doRun",
")",
"{",
"WeakReference",
"<",
"Holder",
">",
"ref",
"=",
"local",
".",
"get",
"(",
")",
";",
"Holder",
"holder",
"=",
"ref",
"!=",
"null",
"?",
"ref",
".",
"get",
"(",
")",... | Executes task with thread-local set to the specified value. The state is restored however the task exits. If
uninitialised before running the task, it will remain so upon exiting. Setting the thread-local within the task
does not affect the state after exitign. | [
"Executes",
"task",
"with",
"thread",
"-",
"local",
"set",
"to",
"the",
"specified",
"value",
".",
"The",
"state",
"is",
"restored",
"however",
"the",
"task",
"exits",
".",
"If",
"uninitialised",
"before",
"running",
"the",
"task",
"it",
"will",
"remain",
... | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.netty/src/main/java/org/kaazing/mina/netty/util/threadlocal/VicariousThreadLocal.java#L241-L251 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java | QueryReferenceBroker.retrieveReferences | public void retrieveReferences(Object newObj, ClassDescriptor cld, boolean forced) throws PersistenceBrokerException
{
Iterator i = cld.getObjectReferenceDescriptors().iterator();
// turn off auto prefetching for related proxies
final Class saveClassToPrefetch = classToPrefetch;
classToPrefetch = null;
pb.getInternalCache().enableMaterializationCache();
try
{
while (i.hasNext())
{
ObjectReferenceDescriptor rds = (ObjectReferenceDescriptor) i.next();
retrieveReference(newObj, cld, rds, forced);
}
pb.getInternalCache().disableMaterializationCache();
}
catch(RuntimeException e)
{
pb.getInternalCache().doLocalClear();
throw e;
}
finally
{
classToPrefetch = saveClassToPrefetch;
}
} | java | public void retrieveReferences(Object newObj, ClassDescriptor cld, boolean forced) throws PersistenceBrokerException
{
Iterator i = cld.getObjectReferenceDescriptors().iterator();
// turn off auto prefetching for related proxies
final Class saveClassToPrefetch = classToPrefetch;
classToPrefetch = null;
pb.getInternalCache().enableMaterializationCache();
try
{
while (i.hasNext())
{
ObjectReferenceDescriptor rds = (ObjectReferenceDescriptor) i.next();
retrieveReference(newObj, cld, rds, forced);
}
pb.getInternalCache().disableMaterializationCache();
}
catch(RuntimeException e)
{
pb.getInternalCache().doLocalClear();
throw e;
}
finally
{
classToPrefetch = saveClassToPrefetch;
}
} | [
"public",
"void",
"retrieveReferences",
"(",
"Object",
"newObj",
",",
"ClassDescriptor",
"cld",
",",
"boolean",
"forced",
")",
"throws",
"PersistenceBrokerException",
"{",
"Iterator",
"i",
"=",
"cld",
".",
"getObjectReferenceDescriptors",
"(",
")",
".",
"iterator",
... | Retrieve all References
@param newObj the instance to be loaded or refreshed
@param cld the ClassDescriptor of the instance
@param forced if set to true loading is forced even if cld differs. | [
"Retrieve",
"all",
"References"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java#L524-L552 |
pip-services3-java/pip-services3-commons-java | src/org/pipservices3/commons/refer/References.java | References.getOneRequired | public <T> T getOneRequired(Class<T> type, Object locator) throws ReferenceException {
List<T> components = find(type, locator, true);
return components.size() > 0 ? components.get(0) : null;
} | java | public <T> T getOneRequired(Class<T> type, Object locator) throws ReferenceException {
List<T> components = find(type, locator, true);
return components.size() > 0 ? components.get(0) : null;
} | [
"public",
"<",
"T",
">",
"T",
"getOneRequired",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"Object",
"locator",
")",
"throws",
"ReferenceException",
"{",
"List",
"<",
"T",
">",
"components",
"=",
"find",
"(",
"type",
",",
"locator",
",",
"true",
")",
... | Gets a required component reference that matches specified locator and
matching to the specified type.
@param type the Class type that defined the type of the result.
@param locator the locator to find a reference by.
@return a matching component reference.
@throws ReferenceException when no references found. | [
"Gets",
"a",
"required",
"component",
"reference",
"that",
"matches",
"specified",
"locator",
"and",
"matching",
"to",
"the",
"specified",
"type",
"."
] | train | https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/refer/References.java#L214-L217 |
danielnorberg/rut | rut/src/main/java/io/norberg/rut/Encoding.java | Encoding.utf8Read4 | private static int utf8Read4(int cu1, int cu2, int cu3, int cu4) {
if ((cu2 & 0xC0) != 0x80) {
return INVALID;
}
if (cu1 == 0xF0 && cu2 < 0x90) {
return INVALID; // overlong
}
if (cu1 == 0xF4 && cu2 >= 0x90) {
return INVALID; // > U+10FFFF
}
if ((cu3 & 0xC0) != 0x80) {
return INVALID;
}
if ((cu4 & 0xC0) != 0x80) {
return INVALID;
}
return (cu1 << 18) + (cu2 << 12) + (cu3 << 6) + cu4 - 0x3C82080;
} | java | private static int utf8Read4(int cu1, int cu2, int cu3, int cu4) {
if ((cu2 & 0xC0) != 0x80) {
return INVALID;
}
if (cu1 == 0xF0 && cu2 < 0x90) {
return INVALID; // overlong
}
if (cu1 == 0xF4 && cu2 >= 0x90) {
return INVALID; // > U+10FFFF
}
if ((cu3 & 0xC0) != 0x80) {
return INVALID;
}
if ((cu4 & 0xC0) != 0x80) {
return INVALID;
}
return (cu1 << 18) + (cu2 << 12) + (cu3 << 6) + cu4 - 0x3C82080;
} | [
"private",
"static",
"int",
"utf8Read4",
"(",
"int",
"cu1",
",",
"int",
"cu2",
",",
"int",
"cu3",
",",
"int",
"cu4",
")",
"{",
"if",
"(",
"(",
"cu2",
"&",
"0xC0",
")",
"!=",
"0x80",
")",
"{",
"return",
"INVALID",
";",
"}",
"if",
"(",
"cu1",
"==... | Read a 4 byte UTF8 sequence.
@return the resulting code point or {@link #INVALID} if invalid. | [
"Read",
"a",
"4",
"byte",
"UTF8",
"sequence",
"."
] | train | https://github.com/danielnorberg/rut/blob/6cd99e0d464da934d446b554ab5bbecaf294fcdc/rut/src/main/java/io/norberg/rut/Encoding.java#L243-L260 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/URLRewriterService.java | URLRewriterService.dumpURLRewriters | public static void dumpURLRewriters( ServletRequest request, PrintStream output )
{
ArrayList/*< URLRewriter >*/ rewriters = getRewriters( request );
if ( output == null ) output = System.err;
output.println( "*** List of URLRewriter objects: " + rewriters );
if ( rewriters != null )
{
int count = 0;
for ( Iterator i = rewriters.iterator(); i.hasNext(); )
{
URLRewriter rewriter = ( URLRewriter ) i.next();
output.println( " " + count++ + ". " + rewriter.getClass().getName() );
output.println( " allows other rewriters: " + rewriter.allowOtherRewriters() );
output.println( " rewriter: " + rewriter );
}
}
else
{
output.println( " No URLRewriter objects are registered with this request." );
}
} | java | public static void dumpURLRewriters( ServletRequest request, PrintStream output )
{
ArrayList/*< URLRewriter >*/ rewriters = getRewriters( request );
if ( output == null ) output = System.err;
output.println( "*** List of URLRewriter objects: " + rewriters );
if ( rewriters != null )
{
int count = 0;
for ( Iterator i = rewriters.iterator(); i.hasNext(); )
{
URLRewriter rewriter = ( URLRewriter ) i.next();
output.println( " " + count++ + ". " + rewriter.getClass().getName() );
output.println( " allows other rewriters: " + rewriter.allowOtherRewriters() );
output.println( " rewriter: " + rewriter );
}
}
else
{
output.println( " No URLRewriter objects are registered with this request." );
}
} | [
"public",
"static",
"void",
"dumpURLRewriters",
"(",
"ServletRequest",
"request",
",",
"PrintStream",
"output",
")",
"{",
"ArrayList",
"/*< URLRewriter >*/",
"rewriters",
"=",
"getRewriters",
"(",
"request",
")",
";",
"if",
"(",
"output",
"==",
"null",
")",
"out... | Print out information about the chain of URLRewriters in this request.
@param request the current HttpServletRequest.
@param output a PrintStream to output chain of URLRewriters in this request.
If <code>null</null>, <code>System.err</code> is used. | [
"Print",
"out",
"information",
"about",
"the",
"chain",
"of",
"URLRewriters",
"in",
"this",
"request",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/URLRewriterService.java#L355-L377 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bmr/BmrClient.java | BmrClient.getStep | public GetStepResponse getStep(String clusterId, String stepId) {
return getStep(new GetStepRequest().withClusterId(clusterId).withStepId(stepId));
} | java | public GetStepResponse getStep(String clusterId, String stepId) {
return getStep(new GetStepRequest().withClusterId(clusterId).withStepId(stepId));
} | [
"public",
"GetStepResponse",
"getStep",
"(",
"String",
"clusterId",
",",
"String",
"stepId",
")",
"{",
"return",
"getStep",
"(",
"new",
"GetStepRequest",
"(",
")",
".",
"withClusterId",
"(",
"clusterId",
")",
".",
"withStepId",
"(",
"stepId",
")",
")",
";",
... | Describe the detail information of the target step.
@param clusterId The ID of the cluster which owns the step.
@param stepId The ID of the target step.
@return The response containing the detail information of the target step. | [
"Describe",
"the",
"detail",
"information",
"of",
"the",
"target",
"step",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bmr/BmrClient.java#L566-L568 |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java | HttpHeaders.setIntHeader | @Deprecated
public static void setIntHeader(HttpMessage message, String name, Iterable<Integer> values) {
message.headers().set(name, values);
} | java | @Deprecated
public static void setIntHeader(HttpMessage message, String name, Iterable<Integer> values) {
message.headers().set(name, values);
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"setIntHeader",
"(",
"HttpMessage",
"message",
",",
"String",
"name",
",",
"Iterable",
"<",
"Integer",
">",
"values",
")",
"{",
"message",
".",
"headers",
"(",
")",
".",
"set",
"(",
"name",
",",
"values",
")... | @deprecated Use {@link #set(CharSequence, Iterable)} instead.
@see #setIntHeader(HttpMessage, CharSequence, Iterable) | [
"@deprecated",
"Use",
"{",
"@link",
"#set",
"(",
"CharSequence",
"Iterable",
")",
"}",
"instead",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L785-L788 |
duracloud/duracloud | chunk/src/main/java/org/duracloud/chunk/FileChunker.java | FileChunker.addContentFrom | protected void addContentFrom(File baseDir, String destSpaceId) {
Collection<File> files = listFiles(baseDir,
options.getFileFilter(),
options.getDirFilter());
for (File file : files) {
try {
doAddContent(baseDir, destSpaceId, file);
} catch (Exception e) {
StringBuilder sb = new StringBuilder("Error: ");
sb.append("Unable to addContentFrom [");
sb.append(baseDir);
sb.append(", ");
sb.append(destSpaceId);
sb.append("] : ");
sb.append(e.getMessage());
sb.append("\n");
sb.append(ExceptionUtil.getStackTraceAsString(e));
log.error(sb.toString());
}
}
} | java | protected void addContentFrom(File baseDir, String destSpaceId) {
Collection<File> files = listFiles(baseDir,
options.getFileFilter(),
options.getDirFilter());
for (File file : files) {
try {
doAddContent(baseDir, destSpaceId, file);
} catch (Exception e) {
StringBuilder sb = new StringBuilder("Error: ");
sb.append("Unable to addContentFrom [");
sb.append(baseDir);
sb.append(", ");
sb.append(destSpaceId);
sb.append("] : ");
sb.append(e.getMessage());
sb.append("\n");
sb.append(ExceptionUtil.getStackTraceAsString(e));
log.error(sb.toString());
}
}
} | [
"protected",
"void",
"addContentFrom",
"(",
"File",
"baseDir",
",",
"String",
"destSpaceId",
")",
"{",
"Collection",
"<",
"File",
">",
"files",
"=",
"listFiles",
"(",
"baseDir",
",",
"options",
".",
"getFileFilter",
"(",
")",
",",
"options",
".",
"getDirFilt... | This method loops the arg baseDir and pushes the found content to the
arg destSpace.
@param baseDir of content to push to DataStore
@param destSpaceId of content destination | [
"This",
"method",
"loops",
"the",
"arg",
"baseDir",
"and",
"pushes",
"the",
"found",
"content",
"to",
"the",
"arg",
"destSpace",
"."
] | train | https://github.com/duracloud/duracloud/blob/dc4f3a1716d43543cc3b2e1880605f9389849b66/chunk/src/main/java/org/duracloud/chunk/FileChunker.java#L167-L189 |
hypercube1024/firefly | firefly-common/src/main/java/com/firefly/utils/function/Actions.java | Actions.toFunc | public static <T1, T2, T3, T4, R> Func4<T1, T2, T3, T4, R> toFunc(final Action4<T1, T2, T3, T4> action, final R result) {
return new Func4<T1, T2, T3, T4, R>() {
@Override
public R call(T1 t1, T2 t2, T3 t3, T4 t4) {
action.call(t1, t2, t3, t4);
return result;
}
};
} | java | public static <T1, T2, T3, T4, R> Func4<T1, T2, T3, T4, R> toFunc(final Action4<T1, T2, T3, T4> action, final R result) {
return new Func4<T1, T2, T3, T4, R>() {
@Override
public R call(T1 t1, T2 t2, T3 t3, T4 t4) {
action.call(t1, t2, t3, t4);
return result;
}
};
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
",",
"R",
">",
"Func4",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
",",
"R",
">",
"toFunc",
"(",
"final",
"Action4",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
">",
"action",... | Converts an {@link Action4} to a function that calls the action and returns a specified value.
@param action the {@link Action4} to convert
@param result the value to return from the function call
@return a {@link Func4} that calls {@code action} and returns {@code result} | [
"Converts",
"an",
"{",
"@link",
"Action4",
"}",
"to",
"a",
"function",
"that",
"calls",
"the",
"action",
"and",
"returns",
"a",
"specified",
"value",
"."
] | train | https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/function/Actions.java#L270-L278 |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/env/Diagnostics.java | Diagnostics.memInfo | public static void memInfo(final Map<String, Object> infos) {
infos.put("heap.used", MEM_BEAN.getHeapMemoryUsage());
infos.put("offHeap.used", MEM_BEAN.getNonHeapMemoryUsage());
infos.put("heap.pendingFinalize", MEM_BEAN.getObjectPendingFinalizationCount());
} | java | public static void memInfo(final Map<String, Object> infos) {
infos.put("heap.used", MEM_BEAN.getHeapMemoryUsage());
infos.put("offHeap.used", MEM_BEAN.getNonHeapMemoryUsage());
infos.put("heap.pendingFinalize", MEM_BEAN.getObjectPendingFinalizationCount());
} | [
"public",
"static",
"void",
"memInfo",
"(",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"infos",
")",
"{",
"infos",
".",
"put",
"(",
"\"heap.used\"",
",",
"MEM_BEAN",
".",
"getHeapMemoryUsage",
"(",
")",
")",
";",
"infos",
".",
"put",
"(",
"\"of... | Collects system information as delivered from the {@link MemoryMXBean}.
@param infos a map where the infos are passed in. | [
"Collects",
"system",
"information",
"as",
"delivered",
"from",
"the",
"{",
"@link",
"MemoryMXBean",
"}",
"."
] | train | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/env/Diagnostics.java#L98-L102 |
Omertron/api-themoviedb | src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java | TheMovieDbApi.modifyFavoriteStatus | public StatusCode modifyFavoriteStatus(String sessionId, int accountId, Integer mediaId, MediaType mediaType, boolean isFavorite) throws MovieDbException {
return tmdbAccount.modifyFavoriteStatus(sessionId, accountId, mediaType, mediaId, isFavorite);
} | java | public StatusCode modifyFavoriteStatus(String sessionId, int accountId, Integer mediaId, MediaType mediaType, boolean isFavorite) throws MovieDbException {
return tmdbAccount.modifyFavoriteStatus(sessionId, accountId, mediaType, mediaId, isFavorite);
} | [
"public",
"StatusCode",
"modifyFavoriteStatus",
"(",
"String",
"sessionId",
",",
"int",
"accountId",
",",
"Integer",
"mediaId",
",",
"MediaType",
"mediaType",
",",
"boolean",
"isFavorite",
")",
"throws",
"MovieDbException",
"{",
"return",
"tmdbAccount",
".",
"modify... | Add or remove a movie to an accounts favourite list.
@param sessionId sessionId
@param accountId accountId
@param mediaId mediaId
@param mediaType mediaType
@param isFavorite isFavorite
@return StatusCode
@throws MovieDbException exception | [
"Add",
"or",
"remove",
"a",
"movie",
"to",
"an",
"accounts",
"favourite",
"list",
"."
] | train | https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L234-L236 |
albfernandez/itext2 | src/main/java/com/lowagie/text/rtf/document/RtfDocumentSettings.java | RtfDocumentSettings.setNewPassword | public boolean setNewPassword(String oldPwd, String newPwd) {
boolean result = false;
if (this.protectionHash.equals(RtfProtection.generateHash(oldPwd))) {
this.protectionHash = RtfProtection.generateHash(newPwd);
result = true;
}
return result;
} | java | public boolean setNewPassword(String oldPwd, String newPwd) {
boolean result = false;
if (this.protectionHash.equals(RtfProtection.generateHash(oldPwd))) {
this.protectionHash = RtfProtection.generateHash(newPwd);
result = true;
}
return result;
} | [
"public",
"boolean",
"setNewPassword",
"(",
"String",
"oldPwd",
",",
"String",
"newPwd",
")",
"{",
"boolean",
"result",
"=",
"false",
";",
"if",
"(",
"this",
".",
"protectionHash",
".",
"equals",
"(",
"RtfProtection",
".",
"generateHash",
"(",
"oldPwd",
")",... | Author: Howard Shank (hgshank@yahoo.com)
@param oldPwd Old password - clear text
@param newPwd New password - clear text
@return true if password set, false if password not set
@since 2.1.1 | [
"Author",
":",
"Howard",
"Shank",
"(",
"hgshank"
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/rtf/document/RtfDocumentSettings.java#L498-L505 |
remkop/picocli | src/main/java/picocli/CommandLine.java | CommandLine.getCommandMethods | public static List<Method> getCommandMethods(Class<?> cls, String methodName) {
Set<Method> candidates = new HashSet<Method>();
// traverse public member methods (excludes static/non-public, includes inherited)
candidates.addAll(Arrays.asList(Assert.notNull(cls, "class").getMethods()));
// traverse directly declared methods (includes static/non-public, excludes inherited)
candidates.addAll(Arrays.asList(Assert.notNull(cls, "class").getDeclaredMethods()));
List<Method> result = new ArrayList<Method>();
for (Method method : candidates) {
if (method.isAnnotationPresent(Command.class)) {
if (methodName == null || methodName.equals(method.getName())) { result.add(method); }
}
}
Collections.sort(result, new Comparator<Method>() {
public int compare(Method o1, Method o2) { return o1.getName().compareTo(o2.getName()); }
});
return result;
} | java | public static List<Method> getCommandMethods(Class<?> cls, String methodName) {
Set<Method> candidates = new HashSet<Method>();
// traverse public member methods (excludes static/non-public, includes inherited)
candidates.addAll(Arrays.asList(Assert.notNull(cls, "class").getMethods()));
// traverse directly declared methods (includes static/non-public, excludes inherited)
candidates.addAll(Arrays.asList(Assert.notNull(cls, "class").getDeclaredMethods()));
List<Method> result = new ArrayList<Method>();
for (Method method : candidates) {
if (method.isAnnotationPresent(Command.class)) {
if (methodName == null || methodName.equals(method.getName())) { result.add(method); }
}
}
Collections.sort(result, new Comparator<Method>() {
public int compare(Method o1, Method o2) { return o1.getName().compareTo(o2.getName()); }
});
return result;
} | [
"public",
"static",
"List",
"<",
"Method",
">",
"getCommandMethods",
"(",
"Class",
"<",
"?",
">",
"cls",
",",
"String",
"methodName",
")",
"{",
"Set",
"<",
"Method",
">",
"candidates",
"=",
"new",
"HashSet",
"<",
"Method",
">",
"(",
")",
";",
"// trave... | Helper to get methods of a class annotated with {@link Command @Command} via reflection, optionally filtered by method name (not {@link Command#name() @Command.name}).
Methods have to be either public (inherited) members or be declared by {@code cls}, that is "inherited" static or protected methods will not be picked up.
@param cls the class to search for methods annotated with {@code @Command}
@param methodName if not {@code null}, return only methods whose method name (not {@link Command#name() @Command.name}) equals this string. Ignored if {@code null}.
@return the matching command methods, or an empty list
@see #invoke(String, Class, String...)
@since 3.6.0 | [
"Helper",
"to",
"get",
"methods",
"of",
"a",
"class",
"annotated",
"with",
"{",
"@link",
"Command",
"@Command",
"}",
"via",
"reflection",
"optionally",
"filtered",
"by",
"method",
"name",
"(",
"not",
"{",
"@link",
"Command#name",
"()",
"@Command",
".",
"name... | train | https://github.com/remkop/picocli/blob/3c5384f0d12817401d1921c3013c1282e2edcab2/src/main/java/picocli/CommandLine.java#L2712-L2729 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/spatial/Mathlib.java | Mathlib.lineIntersection | public static Coordinate lineIntersection(Coordinate c1, Coordinate c2, Coordinate c3, Coordinate c4) {
LineSegment ls1 = new LineSegment(c1, c2);
LineSegment ls2 = new LineSegment(c3, c4);
return ls1.getIntersection(ls2);
} | java | public static Coordinate lineIntersection(Coordinate c1, Coordinate c2, Coordinate c3, Coordinate c4) {
LineSegment ls1 = new LineSegment(c1, c2);
LineSegment ls2 = new LineSegment(c3, c4);
return ls1.getIntersection(ls2);
} | [
"public",
"static",
"Coordinate",
"lineIntersection",
"(",
"Coordinate",
"c1",
",",
"Coordinate",
"c2",
",",
"Coordinate",
"c3",
",",
"Coordinate",
"c4",
")",
"{",
"LineSegment",
"ls1",
"=",
"new",
"LineSegment",
"(",
"c1",
",",
"c2",
")",
";",
"LineSegment"... | Calculates the intersection point of 2 lines.
@param c1
First coordinate of the first line.
@param c2
Second coordinate of the first line.
@param c3
First coordinate of the second line.
@param c4
Second coordinate of the second line.
@return Returns a coordinate. | [
"Calculates",
"the",
"intersection",
"point",
"of",
"2",
"lines",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/Mathlib.java#L64-L68 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/runtime/JCuda.java | JCuda.cudaDeviceGetP2PAttribute | public static int cudaDeviceGetP2PAttribute(int value[], int attr, int srcDevice, int dstDevice)
{
return checkResult(cudaDeviceGetP2PAttributeNative(value, attr, srcDevice, dstDevice));
} | java | public static int cudaDeviceGetP2PAttribute(int value[], int attr, int srcDevice, int dstDevice)
{
return checkResult(cudaDeviceGetP2PAttributeNative(value, attr, srcDevice, dstDevice));
} | [
"public",
"static",
"int",
"cudaDeviceGetP2PAttribute",
"(",
"int",
"value",
"[",
"]",
",",
"int",
"attr",
",",
"int",
"srcDevice",
",",
"int",
"dstDevice",
")",
"{",
"return",
"checkResult",
"(",
"cudaDeviceGetP2PAttributeNative",
"(",
"value",
",",
"attr",
"... | Queries attributes of the link between two devices.<br>
<br>
Returns in *value the value of the requested attribute attrib of the
link between srcDevice and dstDevice. The supported attributes are:
<ul>
<li>CudaDevP2PAttrPerformanceRank: A relative value indicating the
performance of the link between two devices. Lower value means better
performance (0 being the value used for most performant link).
</li>
<li>CudaDevP2PAttrAccessSupported: 1 if peer access is enabled.</li>
<li>CudaDevP2PAttrNativeAtomicSupported: 1 if native atomic operations over
the link are supported.
</li>
</ul>
<br>
Returns ::cudaErrorInvalidDevice if srcDevice or dstDevice are not valid
or if they represent the same device.<br>
<br>
Returns ::cudaErrorInvalidValue if attrib is not valid or if value is
a null pointer.
<br>
@param value Returned value of the requested attribute
@param attrib The requested attribute of the link between srcDevice and dstDevice.
@param srcDevice The source device of the target link.
@param dstDevice The destination device of the target link.
@return cudaSuccess, cudaErrorInvalidDevice, cudaErrorInvalidValue
@see JCuda#cudaCtxEnablePeerAccess
@see JCuda#cudaCtxDisablePeerAccess
@see JCuda#cudaCtxCanAccessPeer | [
"Queries",
"attributes",
"of",
"the",
"link",
"between",
"two",
"devices",
".",
"<br",
">",
"<br",
">",
"Returns",
"in",
"*",
"value",
"the",
"value",
"of",
"the",
"requested",
"attribute",
"attrib",
"of",
"the",
"link",
"between",
"srcDevice",
"and",
"dst... | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/runtime/JCuda.java#L1751-L1754 |
mygreen/super-csv-annotation | src/main/java/com/github/mygreen/supercsv/io/LazyCsvAnnotationBeanWriter.java | LazyCsvAnnotationBeanWriter.writeAll | public void writeAll(final Collection<T> sources, final boolean continueOnError) throws IOException {
Objects.requireNonNull(sources, "sources should not be null.");
if(!initialized) {
init();
}
if(beanMappingCache.getOriginal().isHeader() && getLineNumber() == 0) {
writeHeader();
}
for(T record : sources) {
try {
write(record);
} catch(SuperCsvBindingException e) {
if(!continueOnError) {
throw e;
}
}
}
super.flush();
} | java | public void writeAll(final Collection<T> sources, final boolean continueOnError) throws IOException {
Objects.requireNonNull(sources, "sources should not be null.");
if(!initialized) {
init();
}
if(beanMappingCache.getOriginal().isHeader() && getLineNumber() == 0) {
writeHeader();
}
for(T record : sources) {
try {
write(record);
} catch(SuperCsvBindingException e) {
if(!continueOnError) {
throw e;
}
}
}
super.flush();
} | [
"public",
"void",
"writeAll",
"(",
"final",
"Collection",
"<",
"T",
">",
"sources",
",",
"final",
"boolean",
"continueOnError",
")",
"throws",
"IOException",
"{",
"Objects",
".",
"requireNonNull",
"(",
"sources",
",",
"\"sources should not be null.\"",
")",
";",
... | レコードのデータを全て書き込みます。
<p>ヘッダー行も自動的に処理されます。2回目以降に呼び出した場合、ヘッダー情報は書き込まれません。</p>
@param sources 書き込むレコードのデータ。
@param continueOnError continueOnError レコードの処理中に、
例外{@link SuperCsvBindingException}が発生しても、続行するかどうか指定します。
trueの場合、例外が発生しても、次の処理を行います。
@throws NullPointerException sources is null.
@throws IOException レコードの出力に失敗した場合。
@throws SuperCsvBindingException セルの値に問題がある場合
@throws SuperCsvException 設定など、その他に問題がある場合 | [
"レコードのデータを全て書き込みます。",
"<p",
">",
"ヘッダー行も自動的に処理されます。2回目以降に呼び出した場合、ヘッダー情報は書き込まれません。<",
"/",
"p",
">"
] | train | https://github.com/mygreen/super-csv-annotation/blob/9910320cb6dc143be972c7d10d9ab5ffb09c3b84/src/main/java/com/github/mygreen/supercsv/io/LazyCsvAnnotationBeanWriter.java#L251-L275 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF3.java | CommonOps_DDF3.multAddOuter | public static void multAddOuter( double alpha , DMatrix3x3 A , double beta , DMatrix3 u , DMatrix3 v , DMatrix3x3 C ) {
C.a11 = alpha*A.a11 + beta*u.a1*v.a1;
C.a12 = alpha*A.a12 + beta*u.a1*v.a2;
C.a13 = alpha*A.a13 + beta*u.a1*v.a3;
C.a21 = alpha*A.a21 + beta*u.a2*v.a1;
C.a22 = alpha*A.a22 + beta*u.a2*v.a2;
C.a23 = alpha*A.a23 + beta*u.a2*v.a3;
C.a31 = alpha*A.a31 + beta*u.a3*v.a1;
C.a32 = alpha*A.a32 + beta*u.a3*v.a2;
C.a33 = alpha*A.a33 + beta*u.a3*v.a3;
} | java | public static void multAddOuter( double alpha , DMatrix3x3 A , double beta , DMatrix3 u , DMatrix3 v , DMatrix3x3 C ) {
C.a11 = alpha*A.a11 + beta*u.a1*v.a1;
C.a12 = alpha*A.a12 + beta*u.a1*v.a2;
C.a13 = alpha*A.a13 + beta*u.a1*v.a3;
C.a21 = alpha*A.a21 + beta*u.a2*v.a1;
C.a22 = alpha*A.a22 + beta*u.a2*v.a2;
C.a23 = alpha*A.a23 + beta*u.a2*v.a3;
C.a31 = alpha*A.a31 + beta*u.a3*v.a1;
C.a32 = alpha*A.a32 + beta*u.a3*v.a2;
C.a33 = alpha*A.a33 + beta*u.a3*v.a3;
} | [
"public",
"static",
"void",
"multAddOuter",
"(",
"double",
"alpha",
",",
"DMatrix3x3",
"A",
",",
"double",
"beta",
",",
"DMatrix3",
"u",
",",
"DMatrix3",
"v",
",",
"DMatrix3x3",
"C",
")",
"{",
"C",
".",
"a11",
"=",
"alpha",
"*",
"A",
".",
"a11",
"+",... | C = αA + βu*v<sup>T</sup>
@param alpha scale factor applied to A
@param A matrix
@param beta scale factor applies to outer product
@param u vector
@param v vector
@param C Storage for solution. Can be same instance as A. | [
"C",
"=",
"&alpha",
";",
"A",
"+",
"&beta",
";",
"u",
"*",
"v<sup",
">",
"T<",
"/",
"sup",
">"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF3.java#L648-L658 |
steveash/jopenfst | src/main/java/com/github/steveash/jopenfst/io/Convert.java | Convert.importSymbols | private static Optional<MutableSymbolTable> importSymbols(String filename) {
URL resource;
try {
resource = Resources.getResource(filename);
} catch (IllegalArgumentException e) {
return Optional.absent();
}
return importSymbolsFrom(asCharSource(resource, Charsets.UTF_8));
} | java | private static Optional<MutableSymbolTable> importSymbols(String filename) {
URL resource;
try {
resource = Resources.getResource(filename);
} catch (IllegalArgumentException e) {
return Optional.absent();
}
return importSymbolsFrom(asCharSource(resource, Charsets.UTF_8));
} | [
"private",
"static",
"Optional",
"<",
"MutableSymbolTable",
">",
"importSymbols",
"(",
"String",
"filename",
")",
"{",
"URL",
"resource",
";",
"try",
"{",
"resource",
"=",
"Resources",
".",
"getResource",
"(",
"filename",
")",
";",
"}",
"catch",
"(",
"Illega... | Imports an openfst's symbols file
@param filename the symbols' filename
@return HashMap containing the impprted string-to-id mapping | [
"Imports",
"an",
"openfst",
"s",
"symbols",
"file"
] | train | https://github.com/steveash/jopenfst/blob/4c675203015c1cfad2072556cb532b6edc73261d/src/main/java/com/github/steveash/jopenfst/io/Convert.java#L235-L244 |
carewebframework/carewebframework-core | org.carewebframework.plugin-parent/org.carewebframework.plugin.statuspanel/src/main/java/org/carewebframework/plugin/statuspanel/StatusPanel.java | StatusPanel.eventCallback | @Override
public void eventCallback(String eventName, Object eventData) {
String pane = StrUtil.piece(eventName, ".", 2);
Label lbl = getLabel(pane.isEmpty() ? "default" : pane);
lbl.setLabel(eventData.toString());
lbl.setHint(eventData.toString());
} | java | @Override
public void eventCallback(String eventName, Object eventData) {
String pane = StrUtil.piece(eventName, ".", 2);
Label lbl = getLabel(pane.isEmpty() ? "default" : pane);
lbl.setLabel(eventData.toString());
lbl.setHint(eventData.toString());
} | [
"@",
"Override",
"public",
"void",
"eventCallback",
"(",
"String",
"eventName",
",",
"Object",
"eventData",
")",
"{",
"String",
"pane",
"=",
"StrUtil",
".",
"piece",
"(",
"eventName",
",",
"\".\"",
",",
"2",
")",
";",
"Label",
"lbl",
"=",
"getLabel",
"("... | Handler for the STATUS event. The second level of the event name identifies the pane where
the status information (the event data) is to be displayed. For example, the event
STATUS.TIMING would display the status information in the pane whose associated label has an
id of "TIMING", creating one dynamically if necessary. If there is no second level event
name, the default pane is used. | [
"Handler",
"for",
"the",
"STATUS",
"event",
".",
"The",
"second",
"level",
"of",
"the",
"event",
"name",
"identifies",
"the",
"pane",
"where",
"the",
"status",
"information",
"(",
"the",
"event",
"data",
")",
"is",
"to",
"be",
"displayed",
".",
"For",
"e... | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.plugin-parent/org.carewebframework.plugin.statuspanel/src/main/java/org/carewebframework/plugin/statuspanel/StatusPanel.java#L58-L64 |
couchbase/couchbase-lite-java | src/main/java/com/couchbase/lite/MutableArray.java | MutableArray.setDictionary | @NonNull
@Override
public MutableArray setDictionary(int index, Dictionary value) {
return setValue(index, value);
} | java | @NonNull
@Override
public MutableArray setDictionary(int index, Dictionary value) {
return setValue(index, value);
} | [
"@",
"NonNull",
"@",
"Override",
"public",
"MutableArray",
"setDictionary",
"(",
"int",
"index",
",",
"Dictionary",
"value",
")",
"{",
"return",
"setValue",
"(",
"index",
",",
"value",
")",
";",
"}"
] | Sets a Dictionary object at the given index.
@param index the index. This value must not exceed the bounds of the array.
@param value the Dictionary object
@return The self object | [
"Sets",
"a",
"Dictionary",
"object",
"at",
"the",
"given",
"index",
"."
] | train | https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/MutableArray.java#L247-L251 |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/domassign/DeclarationTransformerImpl.java | DeclarationTransformerImpl.processAdditionalCSSGenericProperty | private boolean processAdditionalCSSGenericProperty(Declaration d, Map<String, CSSProperty> properties, Map<String, Term<?>> values)
{
if (d.size() == 1)
{
Term<?> term = d.get(0);
if (term instanceof TermIdent)
return genericProperty(GenericCSSPropertyProxy.class, (TermIdent) term, true, properties, d.getProperty());
else
return genericTerm(TermLength.class, term, d.getProperty(), null, ValueRange.ALLOW_ALL, properties, values)
|| genericTerm(TermPercent.class, term, d.getProperty(), null, ValueRange.ALLOW_ALL, properties, values)
|| genericTerm(TermInteger.class, term, d.getProperty(), null, ValueRange.ALLOW_ALL, properties, values)
|| genericTermColor(term, d.getProperty(), null, properties, values);
}
else
{
log.warn("Ignoring unsupported property " + d.getProperty() + " with multiple values");
return false;
}
} | java | private boolean processAdditionalCSSGenericProperty(Declaration d, Map<String, CSSProperty> properties, Map<String, Term<?>> values)
{
if (d.size() == 1)
{
Term<?> term = d.get(0);
if (term instanceof TermIdent)
return genericProperty(GenericCSSPropertyProxy.class, (TermIdent) term, true, properties, d.getProperty());
else
return genericTerm(TermLength.class, term, d.getProperty(), null, ValueRange.ALLOW_ALL, properties, values)
|| genericTerm(TermPercent.class, term, d.getProperty(), null, ValueRange.ALLOW_ALL, properties, values)
|| genericTerm(TermInteger.class, term, d.getProperty(), null, ValueRange.ALLOW_ALL, properties, values)
|| genericTermColor(term, d.getProperty(), null, properties, values);
}
else
{
log.warn("Ignoring unsupported property " + d.getProperty() + " with multiple values");
return false;
}
} | [
"private",
"boolean",
"processAdditionalCSSGenericProperty",
"(",
"Declaration",
"d",
",",
"Map",
"<",
"String",
",",
"CSSProperty",
">",
"properties",
",",
"Map",
"<",
"String",
",",
"Term",
"<",
"?",
">",
">",
"values",
")",
"{",
"if",
"(",
"d",
".",
"... | Processes an unknown property and stores its value. Unknown properties containing
multiple values are ignored (the interpretation is not clear).
@param d the declaration.
@param properties the properties.
@param values the values.
@return <code>true</code>, if the property has been pared successfully | [
"Processes",
"an",
"unknown",
"property",
"and",
"stores",
"its",
"value",
".",
"Unknown",
"properties",
"containing",
"multiple",
"values",
"are",
"ignored",
"(",
"the",
"interpretation",
"is",
"not",
"clear",
")",
"."
] | train | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/DeclarationTransformerImpl.java#L1949-L1968 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/nio/NodeIOService.java | NodeIOService.initRestApiConfig | @SuppressWarnings("deprecation")
private static RestApiConfig initRestApiConfig(HazelcastProperties properties, Config config) {
boolean isAdvancedNetwork = config.getAdvancedNetworkConfig().isEnabled();
RestApiConfig restApiConfig = config.getNetworkConfig().getRestApiConfig();
boolean isRestConfigPresent = isAdvancedNetwork
? config.getAdvancedNetworkConfig().getEndpointConfigs().get(EndpointQualifier.REST) != null
: restApiConfig != null;
if (isRestConfigPresent) {
// ensure the legacy Hazelcast group properties are not provided
ensurePropertyNotConfigured(properties, GroupProperty.REST_ENABLED);
ensurePropertyNotConfigured(properties, GroupProperty.HTTP_HEALTHCHECK_ENABLED);
}
if (isRestConfigPresent && isAdvancedNetwork) {
restApiConfig = new RestApiConfig();
restApiConfig.setEnabled(true);
RestServerEndpointConfig restServerEndpointConfig = config.getAdvancedNetworkConfig().getRestEndpointConfig();
restApiConfig.setEnabledGroups(restServerEndpointConfig.getEnabledGroups());
} else if (!isRestConfigPresent) {
restApiConfig = new RestApiConfig();
if (checkAndLogPropertyDeprecated(properties, GroupProperty.REST_ENABLED)) {
restApiConfig.setEnabled(true);
restApiConfig.enableAllGroups();
}
if (checkAndLogPropertyDeprecated(properties, GroupProperty.HTTP_HEALTHCHECK_ENABLED)) {
restApiConfig.setEnabled(true);
restApiConfig.enableGroups(RestEndpointGroup.HEALTH_CHECK);
}
}
return restApiConfig;
} | java | @SuppressWarnings("deprecation")
private static RestApiConfig initRestApiConfig(HazelcastProperties properties, Config config) {
boolean isAdvancedNetwork = config.getAdvancedNetworkConfig().isEnabled();
RestApiConfig restApiConfig = config.getNetworkConfig().getRestApiConfig();
boolean isRestConfigPresent = isAdvancedNetwork
? config.getAdvancedNetworkConfig().getEndpointConfigs().get(EndpointQualifier.REST) != null
: restApiConfig != null;
if (isRestConfigPresent) {
// ensure the legacy Hazelcast group properties are not provided
ensurePropertyNotConfigured(properties, GroupProperty.REST_ENABLED);
ensurePropertyNotConfigured(properties, GroupProperty.HTTP_HEALTHCHECK_ENABLED);
}
if (isRestConfigPresent && isAdvancedNetwork) {
restApiConfig = new RestApiConfig();
restApiConfig.setEnabled(true);
RestServerEndpointConfig restServerEndpointConfig = config.getAdvancedNetworkConfig().getRestEndpointConfig();
restApiConfig.setEnabledGroups(restServerEndpointConfig.getEnabledGroups());
} else if (!isRestConfigPresent) {
restApiConfig = new RestApiConfig();
if (checkAndLogPropertyDeprecated(properties, GroupProperty.REST_ENABLED)) {
restApiConfig.setEnabled(true);
restApiConfig.enableAllGroups();
}
if (checkAndLogPropertyDeprecated(properties, GroupProperty.HTTP_HEALTHCHECK_ENABLED)) {
restApiConfig.setEnabled(true);
restApiConfig.enableGroups(RestEndpointGroup.HEALTH_CHECK);
}
}
return restApiConfig;
} | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"private",
"static",
"RestApiConfig",
"initRestApiConfig",
"(",
"HazelcastProperties",
"properties",
",",
"Config",
"config",
")",
"{",
"boolean",
"isAdvancedNetwork",
"=",
"config",
".",
"getAdvancedNetworkConfig",
... | Initializes {@link RestApiConfig} if not provided based on legacy group properties. Also checks (fails fast)
if both the {@link RestApiConfig} and system properties are used. | [
"Initializes",
"{"
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/nio/NodeIOService.java#L82-L116 |
looly/hutool | hutool-cron/src/main/java/cn/hutool/cron/pattern/matcher/ValueMatcherBuilder.java | ValueMatcherBuilder.parseStep | private static List<Integer> parseStep(String value, ValueParser parser) {
final List<String> parts = StrUtil.split(value, StrUtil.C_SLASH);
int size = parts.size();
List<Integer> results;
if (size == 1) {// 普通形式
results = parseRange(value, -1, parser);
} else if (size == 2) {// 间隔形式
final int step = parser.parse(parts.get(1));
if (step < 1) {
throw new CronException("Non positive divisor for field: [{}]", value);
}
results = parseRange(parts.get(0), step, parser);
} else {
throw new CronException("Invalid syntax of field: [{}]", value);
}
return results;
} | java | private static List<Integer> parseStep(String value, ValueParser parser) {
final List<String> parts = StrUtil.split(value, StrUtil.C_SLASH);
int size = parts.size();
List<Integer> results;
if (size == 1) {// 普通形式
results = parseRange(value, -1, parser);
} else if (size == 2) {// 间隔形式
final int step = parser.parse(parts.get(1));
if (step < 1) {
throw new CronException("Non positive divisor for field: [{}]", value);
}
results = parseRange(parts.get(0), step, parser);
} else {
throw new CronException("Invalid syntax of field: [{}]", value);
}
return results;
} | [
"private",
"static",
"List",
"<",
"Integer",
">",
"parseStep",
"(",
"String",
"value",
",",
"ValueParser",
"parser",
")",
"{",
"final",
"List",
"<",
"String",
">",
"parts",
"=",
"StrUtil",
".",
"split",
"(",
"value",
",",
"StrUtil",
".",
"C_SLASH",
")",
... | 处理间隔形式的表达式<br>
处理的形式包括:
<ul>
<li><strong>a</strong> 或 <strong>*</strong></li>
<li><strong>a/b</strong> 或 <strong>*/b</strong></li>
<li><strong>a-b/2</strong></li>
</ul>
@param value 表达式值
@param parser 针对这个时间字段的解析器
@return List | [
"处理间隔形式的表达式<br",
">",
"处理的形式包括:",
"<ul",
">",
"<li",
">",
"<strong",
">",
"a<",
"/",
"strong",
">",
"或",
"<strong",
">",
"*",
"<",
"/",
"strong",
">",
"<",
"/",
"li",
">",
"<li",
">",
"<strong",
">",
"a/",
";",
"b<",
"/",
"strong",
">",
"或",
... | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-cron/src/main/java/cn/hutool/cron/pattern/matcher/ValueMatcherBuilder.java#L85-L102 |
stevespringett/Alpine | alpine/src/main/java/alpine/resources/AlpineResource.java | AlpineResource.contOnValidationError | @SafeVarargs
protected final List<ValidationError> contOnValidationError(final Set<ConstraintViolation<Object>>... violationsArray) {
final List<ValidationError> errors = new ArrayList<>();
for (final Set<ConstraintViolation<Object>> violations : violationsArray) {
for (final ConstraintViolation violation : violations) {
if (violation.getPropertyPath().iterator().next().getName() != null) {
final String path = violation.getPropertyPath() != null ? violation.getPropertyPath().toString() : null;
final String message = violation.getMessage() != null ? StringUtils.removeStart(violation.getMessage(), path + ".") : null;
final String messageTemplate = violation.getMessageTemplate();
final String invalidValue = violation.getInvalidValue() != null ? violation.getInvalidValue().toString() : null;
final ValidationError error = new ValidationError(message, messageTemplate, path, invalidValue);
errors.add(error);
}
}
}
return errors;
} | java | @SafeVarargs
protected final List<ValidationError> contOnValidationError(final Set<ConstraintViolation<Object>>... violationsArray) {
final List<ValidationError> errors = new ArrayList<>();
for (final Set<ConstraintViolation<Object>> violations : violationsArray) {
for (final ConstraintViolation violation : violations) {
if (violation.getPropertyPath().iterator().next().getName() != null) {
final String path = violation.getPropertyPath() != null ? violation.getPropertyPath().toString() : null;
final String message = violation.getMessage() != null ? StringUtils.removeStart(violation.getMessage(), path + ".") : null;
final String messageTemplate = violation.getMessageTemplate();
final String invalidValue = violation.getInvalidValue() != null ? violation.getInvalidValue().toString() : null;
final ValidationError error = new ValidationError(message, messageTemplate, path, invalidValue);
errors.add(error);
}
}
}
return errors;
} | [
"@",
"SafeVarargs",
"protected",
"final",
"List",
"<",
"ValidationError",
">",
"contOnValidationError",
"(",
"final",
"Set",
"<",
"ConstraintViolation",
"<",
"Object",
">",
">",
"...",
"violationsArray",
")",
"{",
"final",
"List",
"<",
"ValidationError",
">",
"e... | Accepts the result from one of the many validation methods available and
returns a List of ValidationErrors. If the size of the List is 0, no errors
were encounter during validation.
Usage:
<pre>
Validator validator = getValidator();
List<ValidationError> errors = contOnValidationError(
validator.validateProperty(myObject, "uuid"),
validator.validateProperty(myObject, "name")
);
// If validation fails, this line will be reached.
</pre>
@param violationsArray a Set of one or more ConstraintViolations
@return a List of zero or more ValidationErrors
@since 1.0.0 | [
"Accepts",
"the",
"result",
"from",
"one",
"of",
"the",
"many",
"validation",
"methods",
"available",
"and",
"returns",
"a",
"List",
"of",
"ValidationErrors",
".",
"If",
"the",
"size",
"of",
"the",
"List",
"is",
"0",
"no",
"errors",
"were",
"encounter",
"d... | train | https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/resources/AlpineResource.java#L168-L184 |
dnsjava/dnsjava | org/xbill/DNS/ZoneTransferIn.java | ZoneTransferIn.newIXFR | public static ZoneTransferIn
newIXFR(Name zone, long serial, boolean fallback, String host, int port,
TSIG key)
throws UnknownHostException
{
if (port == 0)
port = SimpleResolver.DEFAULT_PORT;
return newIXFR(zone, serial, fallback,
new InetSocketAddress(host, port), key);
} | java | public static ZoneTransferIn
newIXFR(Name zone, long serial, boolean fallback, String host, int port,
TSIG key)
throws UnknownHostException
{
if (port == 0)
port = SimpleResolver.DEFAULT_PORT;
return newIXFR(zone, serial, fallback,
new InetSocketAddress(host, port), key);
} | [
"public",
"static",
"ZoneTransferIn",
"newIXFR",
"(",
"Name",
"zone",
",",
"long",
"serial",
",",
"boolean",
"fallback",
",",
"String",
"host",
",",
"int",
"port",
",",
"TSIG",
"key",
")",
"throws",
"UnknownHostException",
"{",
"if",
"(",
"port",
"==",
"0"... | Instantiates a ZoneTransferIn object to do an IXFR (incremental zone
transfer).
@param zone The zone to transfer.
@param serial The existing serial number.
@param fallback If true, fall back to AXFR if IXFR is not supported.
@param host The host from which to transfer the zone.
@param port The port to connect to on the server, or 0 for the default.
@param key The TSIG key used to authenticate the transfer, or null.
@return The ZoneTransferIn object.
@throws UnknownHostException The host does not exist. | [
"Instantiates",
"a",
"ZoneTransferIn",
"object",
"to",
"do",
"an",
"IXFR",
"(",
"incremental",
"zone",
"transfer",
")",
"."
] | train | https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/ZoneTransferIn.java#L268-L277 |
michael-rapp/AndroidUtil | library/src/main/java/de/mrapp/android/util/logging/Logger.java | Logger.logVerbose | public final void logVerbose(@NonNull final Class<?> tag, @NonNull final String message) {
Condition.INSTANCE.ensureNotNull(tag, "The tag may not be null");
Condition.INSTANCE.ensureNotNull(message, "The message may not be null");
Condition.INSTANCE.ensureNotEmpty(message, "The message may not be empty");
if (LogLevel.VERBOSE.getRank() >= getLogLevel().getRank()) {
Log.v(ClassUtil.INSTANCE.getTruncatedName(tag), message);
}
} | java | public final void logVerbose(@NonNull final Class<?> tag, @NonNull final String message) {
Condition.INSTANCE.ensureNotNull(tag, "The tag may not be null");
Condition.INSTANCE.ensureNotNull(message, "The message may not be null");
Condition.INSTANCE.ensureNotEmpty(message, "The message may not be empty");
if (LogLevel.VERBOSE.getRank() >= getLogLevel().getRank()) {
Log.v(ClassUtil.INSTANCE.getTruncatedName(tag), message);
}
} | [
"public",
"final",
"void",
"logVerbose",
"(",
"@",
"NonNull",
"final",
"Class",
"<",
"?",
">",
"tag",
",",
"@",
"NonNull",
"final",
"String",
"message",
")",
"{",
"Condition",
".",
"INSTANCE",
".",
"ensureNotNull",
"(",
"tag",
",",
"\"The tag may not be null... | Logs a specific message on the log level VERBOSE.
@param tag
The tag, which identifies the source of the log message, as an instance of the class
{@link Class}. The tag may not be null
@param message
The message, which should be logged, as a {@link String}. The message may neither be
null, nor empty | [
"Logs",
"a",
"specific",
"message",
"on",
"the",
"log",
"level",
"VERBOSE",
"."
] | train | https://github.com/michael-rapp/AndroidUtil/blob/67ec0e5732344eeb4d946dd1f96d782939e449f4/library/src/main/java/de/mrapp/android/util/logging/Logger.java#L82-L90 |
joniles/mpxj | src/main/java/net/sf/mpxj/Task.java | Task.removePredecessor | public boolean removePredecessor(Task targetTask, RelationType type, Duration lag)
{
boolean matchFound = false;
//
// Retrieve the list of predecessors
//
List<Relation> predecessorList = getPredecessors();
if (!predecessorList.isEmpty())
{
//
// Ensure that we have a valid lag duration
//
if (lag == null)
{
lag = Duration.getInstance(0, TimeUnit.DAYS);
}
//
// Ensure that there is a predecessor relationship between
// these two tasks, and remove it.
//
matchFound = removeRelation(predecessorList, targetTask, type, lag);
//
// If we have removed a predecessor, then we must remove the
// corresponding successor entry from the target task list
//
if (matchFound)
{
//
// Retrieve the list of successors
//
List<Relation> successorList = targetTask.getSuccessors();
if (!successorList.isEmpty())
{
//
// Ensure that there is a successor relationship between
// these two tasks, and remove it.
//
removeRelation(successorList, this, type, lag);
}
}
}
return matchFound;
} | java | public boolean removePredecessor(Task targetTask, RelationType type, Duration lag)
{
boolean matchFound = false;
//
// Retrieve the list of predecessors
//
List<Relation> predecessorList = getPredecessors();
if (!predecessorList.isEmpty())
{
//
// Ensure that we have a valid lag duration
//
if (lag == null)
{
lag = Duration.getInstance(0, TimeUnit.DAYS);
}
//
// Ensure that there is a predecessor relationship between
// these two tasks, and remove it.
//
matchFound = removeRelation(predecessorList, targetTask, type, lag);
//
// If we have removed a predecessor, then we must remove the
// corresponding successor entry from the target task list
//
if (matchFound)
{
//
// Retrieve the list of successors
//
List<Relation> successorList = targetTask.getSuccessors();
if (!successorList.isEmpty())
{
//
// Ensure that there is a successor relationship between
// these two tasks, and remove it.
//
removeRelation(successorList, this, type, lag);
}
}
}
return matchFound;
} | [
"public",
"boolean",
"removePredecessor",
"(",
"Task",
"targetTask",
",",
"RelationType",
"type",
",",
"Duration",
"lag",
")",
"{",
"boolean",
"matchFound",
"=",
"false",
";",
"//",
"// Retrieve the list of predecessors",
"//",
"List",
"<",
"Relation",
">",
"prede... | This method allows a predecessor relationship to be removed from this
task instance. It will only delete relationships that exactly match the
given targetTask, type and lag time.
@param targetTask the predecessor task
@param type relation type
@param lag relation lag
@return returns true if the relation is found and removed | [
"This",
"method",
"allows",
"a",
"predecessor",
"relationship",
"to",
"be",
"removed",
"from",
"this",
"task",
"instance",
".",
"It",
"will",
"only",
"delete",
"relationships",
"that",
"exactly",
"match",
"the",
"given",
"targetTask",
"type",
"and",
"lag",
"ti... | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Task.java#L4589-L4635 |
spring-projects/spring-hateoas | src/main/java/org/springframework/hateoas/mediatype/hal/HalConfiguration.java | HalConfiguration.withRenderSingleLinksFor | public HalConfiguration withRenderSingleLinksFor(LinkRelation relation, RenderSingleLinks renderSingleLinks) {
Assert.notNull(relation, "Link relation must not be null!");
Assert.notNull(renderSingleLinks, "RenderSingleLinks must not be null!");
return withRenderSingleLinksFor(relation.value(), renderSingleLinks);
} | java | public HalConfiguration withRenderSingleLinksFor(LinkRelation relation, RenderSingleLinks renderSingleLinks) {
Assert.notNull(relation, "Link relation must not be null!");
Assert.notNull(renderSingleLinks, "RenderSingleLinks must not be null!");
return withRenderSingleLinksFor(relation.value(), renderSingleLinks);
} | [
"public",
"HalConfiguration",
"withRenderSingleLinksFor",
"(",
"LinkRelation",
"relation",
",",
"RenderSingleLinks",
"renderSingleLinks",
")",
"{",
"Assert",
".",
"notNull",
"(",
"relation",
",",
"\"Link relation must not be null!\"",
")",
";",
"Assert",
".",
"notNull",
... | Configures how to render a single link for a given particular {@link LinkRelation}. This will override what has
been configured via {@link #withRenderSingleLinks(RenderSingleLinks)} for that particular link relation.
@param relation must not be {@literal null}.
@param renderSingleLinks must not be {@literal null}.
@return | [
"Configures",
"how",
"to",
"render",
"a",
"single",
"link",
"for",
"a",
"given",
"particular",
"{",
"@link",
"LinkRelation",
"}",
".",
"This",
"will",
"override",
"what",
"has",
"been",
"configured",
"via",
"{",
"@link",
"#withRenderSingleLinks",
"(",
"RenderS... | train | https://github.com/spring-projects/spring-hateoas/blob/70ebff9309f086cd8d6a97daf67e0dc215c87d9c/src/main/java/org/springframework/hateoas/mediatype/hal/HalConfiguration.java#L68-L74 |
denisneuling/apitrary.jar | apitrary-api-client/src/main/java/com/apitrary/api/transport/ApiClientTransportFactory.java | ApiClientTransportFactory.newTransport | public Transport newTransport(ApitraryApi apitraryApi) {
List<Class<Transport>> knownTransports = getAvailableTransports();
if (knownTransports.isEmpty()) {
throw new ApiTransportException("No transport provider available. Is there one on the classpath?");
}
return newTransport(apitraryApi, knownTransports.get(knownTransports.size() - 1));
} | java | public Transport newTransport(ApitraryApi apitraryApi) {
List<Class<Transport>> knownTransports = getAvailableTransports();
if (knownTransports.isEmpty()) {
throw new ApiTransportException("No transport provider available. Is there one on the classpath?");
}
return newTransport(apitraryApi, knownTransports.get(knownTransports.size() - 1));
} | [
"public",
"Transport",
"newTransport",
"(",
"ApitraryApi",
"apitraryApi",
")",
"{",
"List",
"<",
"Class",
"<",
"Transport",
">>",
"knownTransports",
"=",
"getAvailableTransports",
"(",
")",
";",
"if",
"(",
"knownTransports",
".",
"isEmpty",
"(",
")",
")",
"{",... | <p>newTransport.</p>
@param apitraryApi a {@link com.apitrary.api.ApitraryApi} object.
@return a {@link com.apitrary.api.transport.Transport} object. | [
"<p",
">",
"newTransport",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/denisneuling/apitrary.jar/blob/b7f639a1e735c60ba2b1b62851926757f5de8628/apitrary-api-client/src/main/java/com/apitrary/api/transport/ApiClientTransportFactory.java#L60-L66 |
chennaione/sugar | library/src/main/java/com/orm/SugarDataSource.java | SugarDataSource.bulkInsert | public void bulkInsert(final List<T> objects, final SuccessCallback<List<Long>> successCallback, final ErrorCallback errorCallback) {
checkNotNull(successCallback);
checkNotNull(errorCallback);
checkNotNull(objects);
final Callable<List<Long>> call = new Callable<List<Long>>() {
@Override
public List<Long> call() throws Exception {
List<Long> ids = new ArrayList<>(objects.size());
for (int i = 0; i < objects.size(); i++) {
Long id = SugarRecord.save(objects.get(i));
ids.add(i, id);
}
return ids;
}
};
final Future<List<Long>> future = doInBackground(call);
List<Long> ids;
try {
ids = future.get();
if (null == ids || ids.isEmpty()) {
errorCallback.onError(new Exception("Error when performing bulk insert"));
} else {
successCallback.onSuccess(ids);
}
} catch (Exception e) {
errorCallback.onError(e);
}
} | java | public void bulkInsert(final List<T> objects, final SuccessCallback<List<Long>> successCallback, final ErrorCallback errorCallback) {
checkNotNull(successCallback);
checkNotNull(errorCallback);
checkNotNull(objects);
final Callable<List<Long>> call = new Callable<List<Long>>() {
@Override
public List<Long> call() throws Exception {
List<Long> ids = new ArrayList<>(objects.size());
for (int i = 0; i < objects.size(); i++) {
Long id = SugarRecord.save(objects.get(i));
ids.add(i, id);
}
return ids;
}
};
final Future<List<Long>> future = doInBackground(call);
List<Long> ids;
try {
ids = future.get();
if (null == ids || ids.isEmpty()) {
errorCallback.onError(new Exception("Error when performing bulk insert"));
} else {
successCallback.onSuccess(ids);
}
} catch (Exception e) {
errorCallback.onError(e);
}
} | [
"public",
"void",
"bulkInsert",
"(",
"final",
"List",
"<",
"T",
">",
"objects",
",",
"final",
"SuccessCallback",
"<",
"List",
"<",
"Long",
">",
">",
"successCallback",
",",
"final",
"ErrorCallback",
"errorCallback",
")",
"{",
"checkNotNull",
"(",
"successCallb... | Method that performs a bulk insert. It works on top of SugarRecord class, and executes the query
asynchronously using Futures.
@param objects the list of objects that you want to insert. They must be SugarRecord extended objects or @Table annotatd objects.
@param successCallback the callback for successful bulk insert operation
@param errorCallback the callback for an error in bulk insert operation | [
"Method",
"that",
"performs",
"a",
"bulk",
"insert",
".",
"It",
"works",
"on",
"top",
"of",
"SugarRecord",
"class",
"and",
"executes",
"the",
"query",
"asynchronously",
"using",
"Futures",
"."
] | train | https://github.com/chennaione/sugar/blob/2ff1b9d5b11563346b69b4e97324107ff680a61a/library/src/main/java/com/orm/SugarDataSource.java#L91-L125 |
meertensinstituut/mtas | src/main/java/mtas/codec/util/CodecInfo.java | CodecInfo.getObjectById | public MtasToken getObjectById(String field, int docId, int mtasId)
throws IOException {
try {
Long ref;
Long objectRefApproxCorrection;
IndexDoc doc = getDoc(field, docId);
IndexInput inObjectId = indexInputList.get("indexObjectId");
IndexInput inObject = indexInputList.get("object");
IndexInput inTerm = indexInputList.get("term");
if (doc.storageFlags == MtasCodecPostingsFormat.MTAS_STORAGE_BYTE) {
inObjectId.seek(doc.fpIndexObjectId + (mtasId * 1L));
objectRefApproxCorrection = Long.valueOf(inObjectId.readByte());
} else if (doc.storageFlags == MtasCodecPostingsFormat.MTAS_STORAGE_SHORT) {
inObjectId.seek(doc.fpIndexObjectId + (mtasId * 2L));
objectRefApproxCorrection = Long.valueOf(inObjectId.readShort());
} else if (doc.storageFlags == MtasCodecPostingsFormat.MTAS_STORAGE_INTEGER) {
inObjectId.seek(doc.fpIndexObjectId + (mtasId * 4L));
objectRefApproxCorrection = Long.valueOf(inObjectId.readInt());
} else {
inObjectId.seek(doc.fpIndexObjectId + (mtasId * 8L));
objectRefApproxCorrection = Long.valueOf(inObjectId.readLong());
}
ref = objectRefApproxCorrection + doc.objectRefApproxOffset
+ (mtasId * (long) doc.objectRefApproxQuotient);
return MtasCodecPostingsFormat.getToken(inObject, inTerm, ref);
} catch (Exception e) {
throw new IOException(e);
}
} | java | public MtasToken getObjectById(String field, int docId, int mtasId)
throws IOException {
try {
Long ref;
Long objectRefApproxCorrection;
IndexDoc doc = getDoc(field, docId);
IndexInput inObjectId = indexInputList.get("indexObjectId");
IndexInput inObject = indexInputList.get("object");
IndexInput inTerm = indexInputList.get("term");
if (doc.storageFlags == MtasCodecPostingsFormat.MTAS_STORAGE_BYTE) {
inObjectId.seek(doc.fpIndexObjectId + (mtasId * 1L));
objectRefApproxCorrection = Long.valueOf(inObjectId.readByte());
} else if (doc.storageFlags == MtasCodecPostingsFormat.MTAS_STORAGE_SHORT) {
inObjectId.seek(doc.fpIndexObjectId + (mtasId * 2L));
objectRefApproxCorrection = Long.valueOf(inObjectId.readShort());
} else if (doc.storageFlags == MtasCodecPostingsFormat.MTAS_STORAGE_INTEGER) {
inObjectId.seek(doc.fpIndexObjectId + (mtasId * 4L));
objectRefApproxCorrection = Long.valueOf(inObjectId.readInt());
} else {
inObjectId.seek(doc.fpIndexObjectId + (mtasId * 8L));
objectRefApproxCorrection = Long.valueOf(inObjectId.readLong());
}
ref = objectRefApproxCorrection + doc.objectRefApproxOffset
+ (mtasId * (long) doc.objectRefApproxQuotient);
return MtasCodecPostingsFormat.getToken(inObject, inTerm, ref);
} catch (Exception e) {
throw new IOException(e);
}
} | [
"public",
"MtasToken",
"getObjectById",
"(",
"String",
"field",
",",
"int",
"docId",
",",
"int",
"mtasId",
")",
"throws",
"IOException",
"{",
"try",
"{",
"Long",
"ref",
";",
"Long",
"objectRefApproxCorrection",
";",
"IndexDoc",
"doc",
"=",
"getDoc",
"(",
"fi... | Gets the object by id.
@param field
the field
@param docId
the doc id
@param mtasId
the mtas id
@return the object by id
@throws IOException
Signals that an I/O exception has occurred. | [
"Gets",
"the",
"object",
"by",
"id",
"."
] | train | https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecInfo.java#L155-L183 |
dbflute-session/tomcat-boot | src/main/java/org/dbflute/tomcat/util/BotmReflectionUtil.java | BotmReflectionUtil.getWholeMethodFlexibly | public static Method getWholeMethodFlexibly(Class<?> clazz, String methodName, Class<?>[] argTypes) {
assertObjectNotNull("clazz", clazz);
assertStringNotNullAndNotTrimmedEmpty("methodName", methodName);
return findMethod(clazz, methodName, argTypes, VisibilityType.WHOLE, true);
} | java | public static Method getWholeMethodFlexibly(Class<?> clazz, String methodName, Class<?>[] argTypes) {
assertObjectNotNull("clazz", clazz);
assertStringNotNullAndNotTrimmedEmpty("methodName", methodName);
return findMethod(clazz, methodName, argTypes, VisibilityType.WHOLE, true);
} | [
"public",
"static",
"Method",
"getWholeMethodFlexibly",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"argTypes",
")",
"{",
"assertObjectNotNull",
"(",
"\"clazz\"",
",",
"clazz",
")",
";",
"assert... | Get the method in whole methods that means as follows:
<pre>
o target class's methods = all
o superclass's methods = all (also contains private)
</pre>
And it has the flexibly searching so you can specify types of sub-class to argTypes. <br>
But if overload methods exist, it returns the first-found method. <br>
And no cache so you should cache it yourself if you call several times.
@param clazz The type of class that defines the method. (NotNull)
@param methodName The name of method. (NotNull)
@param argTypes The type of argument. (NotNull)
@return The instance of method. (NullAllowed: if null, not found) | [
"Get",
"the",
"method",
"in",
"whole",
"methods",
"that",
"means",
"as",
"follows",
":",
"<pre",
">",
"o",
"target",
"class",
"s",
"methods",
"=",
"all",
"o",
"superclass",
"s",
"methods",
"=",
"all",
"(",
"also",
"contains",
"private",
")",
"<",
"/",
... | train | https://github.com/dbflute-session/tomcat-boot/blob/fe941f88b6be083781873126f5b12d4c16bb9073/src/main/java/org/dbflute/tomcat/util/BotmReflectionUtil.java#L422-L426 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java | ApiOvhIpLoadbalancing.serviceName_http_frontend_frontendId_PUT | public void serviceName_http_frontend_frontendId_PUT(String serviceName, Long frontendId, OvhFrontendHttp body) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/http/frontend/{frontendId}";
StringBuilder sb = path(qPath, serviceName, frontendId);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void serviceName_http_frontend_frontendId_PUT(String serviceName, Long frontendId, OvhFrontendHttp body) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/http/frontend/{frontendId}";
StringBuilder sb = path(qPath, serviceName, frontendId);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"serviceName_http_frontend_frontendId_PUT",
"(",
"String",
"serviceName",
",",
"Long",
"frontendId",
",",
"OvhFrontendHttp",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ipLoadbalancing/{serviceName}/http/frontend/{frontendId}\"",
"... | Alter this object properties
REST: PUT /ipLoadbalancing/{serviceName}/http/frontend/{frontendId}
@param body [required] New object properties
@param serviceName [required] The internal name of your IP load balancing
@param frontendId [required] Id of your frontend | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L338-L342 |
versionone/VersionOne.SDK.Java.ObjectModel | src/main/java/com/versionone/Oid.java | Oid.fromToken | public static Oid fromToken(String oidtoken, IMetaModel meta) throws OidException {
try {
if (oidtoken.equals(NullOidToken)) {
return Null;
}
String[] parts = oidtoken.split(SEPARATOR);
IAssetType type = meta.getAssetType(parts[0]);
int id = Integer.parseInt(parts[1]);
if (parts.length > 2) {
int moment = Integer.parseInt(parts[2]);
return new com.versionone.Oid(type, id, moment);
}
return new com.versionone.Oid(type, id);
} catch (Exception e) {
throw new OidException("Invalid OID token", oidtoken, e);
}
} | java | public static Oid fromToken(String oidtoken, IMetaModel meta) throws OidException {
try {
if (oidtoken.equals(NullOidToken)) {
return Null;
}
String[] parts = oidtoken.split(SEPARATOR);
IAssetType type = meta.getAssetType(parts[0]);
int id = Integer.parseInt(parts[1]);
if (parts.length > 2) {
int moment = Integer.parseInt(parts[2]);
return new com.versionone.Oid(type, id, moment);
}
return new com.versionone.Oid(type, id);
} catch (Exception e) {
throw new OidException("Invalid OID token", oidtoken, e);
}
} | [
"public",
"static",
"Oid",
"fromToken",
"(",
"String",
"oidtoken",
",",
"IMetaModel",
"meta",
")",
"throws",
"OidException",
"{",
"try",
"{",
"if",
"(",
"oidtoken",
".",
"equals",
"(",
"NullOidToken",
")",
")",
"{",
"return",
"Null",
";",
"}",
"String",
... | Create an OID from a token
@param oidtoken - token to parse
@param meta - metamodel
@return an Oid
@throws OidException - if the OID cannot be created. | [
"Create",
"an",
"OID",
"from",
"a",
"token"
] | train | https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/Oid.java#L154-L170 |
alkacon/opencms-core | src/org/opencms/file/wrapper/CmsResourceWrapperXmlPage.java | CmsResourceWrapperXmlPage.getResourceForLocale | private CmsResource getResourceForLocale(CmsResource xmlPage, Locale locale) {
CmsWrappedResource wrap = new CmsWrappedResource(xmlPage);
wrap.setRootPath(xmlPage.getRootPath() + "/" + locale.getLanguage() + "/");
int plainId;
try {
plainId = OpenCms.getResourceManager().getResourceType(
CmsResourceTypePlain.getStaticTypeName()).getTypeId();
} catch (CmsLoaderException e) {
// this should really never happen
plainId = CmsResourceTypePlain.getStaticTypeId();
}
wrap.setTypeId(plainId);
wrap.setFolder(true);
return wrap.getResource();
} | java | private CmsResource getResourceForLocale(CmsResource xmlPage, Locale locale) {
CmsWrappedResource wrap = new CmsWrappedResource(xmlPage);
wrap.setRootPath(xmlPage.getRootPath() + "/" + locale.getLanguage() + "/");
int plainId;
try {
plainId = OpenCms.getResourceManager().getResourceType(
CmsResourceTypePlain.getStaticTypeName()).getTypeId();
} catch (CmsLoaderException e) {
// this should really never happen
plainId = CmsResourceTypePlain.getStaticTypeId();
}
wrap.setTypeId(plainId);
wrap.setFolder(true);
return wrap.getResource();
} | [
"private",
"CmsResource",
"getResourceForLocale",
"(",
"CmsResource",
"xmlPage",
",",
"Locale",
"locale",
")",
"{",
"CmsWrappedResource",
"wrap",
"=",
"new",
"CmsWrappedResource",
"(",
"xmlPage",
")",
";",
"wrap",
".",
"setRootPath",
"(",
"xmlPage",
".",
"getRootP... | Creates a new virtual resource for the locale in the xml page as a folder.<p>
The new created resource uses the values of the origin resource of the xml page where it is possible.<p>
@param xmlPage the xml page resource with the locale to create a resource of
@param locale the locale in the xml page to use for the new resource
@return a new created CmsResource | [
"Creates",
"a",
"new",
"virtual",
"resource",
"for",
"the",
"locale",
"in",
"the",
"xml",
"page",
"as",
"a",
"folder",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/wrapper/CmsResourceWrapperXmlPage.java#L1047-L1063 |
lessthanoptimal/ejml | main/ejml-zdense/src/org/ejml/dense/row/SpecializedOps_ZDRM.java | SpecializedOps_ZDRM.pivotMatrix | public static ZMatrixRMaj pivotMatrix(ZMatrixRMaj ret, int pivots[], int numPivots, boolean transposed ) {
if( ret == null ) {
ret = new ZMatrixRMaj(numPivots, numPivots);
} else {
if( ret.numCols != numPivots || ret.numRows != numPivots )
throw new IllegalArgumentException("Unexpected matrix dimension");
CommonOps_ZDRM.fill(ret, 0,0);
}
if( transposed ) {
for( int i = 0; i < numPivots; i++ ) {
ret.set(pivots[i],i,1,0);
}
} else {
for( int i = 0; i < numPivots; i++ ) {
ret.set(i,pivots[i],1,0);
}
}
return ret;
} | java | public static ZMatrixRMaj pivotMatrix(ZMatrixRMaj ret, int pivots[], int numPivots, boolean transposed ) {
if( ret == null ) {
ret = new ZMatrixRMaj(numPivots, numPivots);
} else {
if( ret.numCols != numPivots || ret.numRows != numPivots )
throw new IllegalArgumentException("Unexpected matrix dimension");
CommonOps_ZDRM.fill(ret, 0,0);
}
if( transposed ) {
for( int i = 0; i < numPivots; i++ ) {
ret.set(pivots[i],i,1,0);
}
} else {
for( int i = 0; i < numPivots; i++ ) {
ret.set(i,pivots[i],1,0);
}
}
return ret;
} | [
"public",
"static",
"ZMatrixRMaj",
"pivotMatrix",
"(",
"ZMatrixRMaj",
"ret",
",",
"int",
"pivots",
"[",
"]",
",",
"int",
"numPivots",
",",
"boolean",
"transposed",
")",
"{",
"if",
"(",
"ret",
"==",
"null",
")",
"{",
"ret",
"=",
"new",
"ZMatrixRMaj",
"(",... | <p>
Creates a pivot matrix that exchanges the rows in a matrix:
<br>
A' = P*A<br>
</p>
<p>
For example, if element 0 in 'pivots' is 2 then the first row in A' will be the 3rd row in A.
</p>
@param ret If null then a new matrix is declared otherwise the results are written to it. Is modified.
@param pivots Specifies the new order of rows in a matrix.
@param numPivots How many elements in pivots are being used.
@param transposed If the transpose of the matrix is returned.
@return A pivot matrix. | [
"<p",
">",
"Creates",
"a",
"pivot",
"matrix",
"that",
"exchanges",
"the",
"rows",
"in",
"a",
"matrix",
":",
"<br",
">",
"A",
"=",
"P",
"*",
"A<br",
">",
"<",
"/",
"p",
">",
"<p",
">",
"For",
"example",
"if",
"element",
"0",
"in",
"pivots",
"is",
... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/SpecializedOps_ZDRM.java#L93-L114 |
ist-dresden/composum | sling/core/commons/src/main/java/com/composum/sling/core/util/JsonUtil.java | JsonUtil.writeValue | public static void writeValue(JsonWriter writer, String name, String value) throws IOException {
writer.name(name).value(value);
} | java | public static void writeValue(JsonWriter writer, String name, String value) throws IOException {
writer.name(name).value(value);
} | [
"public",
"static",
"void",
"writeValue",
"(",
"JsonWriter",
"writer",
",",
"String",
"name",
",",
"String",
"value",
")",
"throws",
"IOException",
"{",
"writer",
".",
"name",
"(",
"name",
")",
".",
"value",
"(",
"value",
")",
";",
"}"
] | helper methods to decouple value write from value get (can probably throw an exception) | [
"helper",
"methods",
"to",
"decouple",
"value",
"write",
"from",
"value",
"get",
"(",
"can",
"probably",
"throw",
"an",
"exception",
")"
] | train | https://github.com/ist-dresden/composum/blob/ebc79f559f6022c935240c19102539bdfb1bd1e2/sling/core/commons/src/main/java/com/composum/sling/core/util/JsonUtil.java#L920-L922 |
scaleset/scaleset-geo | src/main/java/com/scaleset/geo/math/GoogleMapsTileMath.java | GoogleMapsTileMath.lngLatToMeters | public Envelope lngLatToMeters(Envelope env) {
Coordinate min = lngLatToMeters(env.getMinX(), env.getMinY());
Coordinate max = lngLatToMeters(env.getMaxX(), env.getMaxY());
Envelope result = new Envelope(min.x, max.x, min.y, max.y);
return result;
} | java | public Envelope lngLatToMeters(Envelope env) {
Coordinate min = lngLatToMeters(env.getMinX(), env.getMinY());
Coordinate max = lngLatToMeters(env.getMaxX(), env.getMaxY());
Envelope result = new Envelope(min.x, max.x, min.y, max.y);
return result;
} | [
"public",
"Envelope",
"lngLatToMeters",
"(",
"Envelope",
"env",
")",
"{",
"Coordinate",
"min",
"=",
"lngLatToMeters",
"(",
"env",
".",
"getMinX",
"(",
")",
",",
"env",
".",
"getMinY",
"(",
")",
")",
";",
"Coordinate",
"max",
"=",
"lngLatToMeters",
"(",
"... | Transforms given lat/lon in WGS84 Datum to XY in Spherical Mercator
EPSG:3857
@param env The envelope to transform
@return The envelope transformed to EPSG:3857 | [
"Transforms",
"given",
"lat",
"/",
"lon",
"in",
"WGS84",
"Datum",
"to",
"XY",
"in",
"Spherical",
"Mercator",
"EPSG",
":",
"3857"
] | train | https://github.com/scaleset/scaleset-geo/blob/5cff2349668037dc287928a6c1a1f67c76d96b02/src/main/java/com/scaleset/geo/math/GoogleMapsTileMath.java#L95-L100 |
OpenLiberty/open-liberty | dev/com.ibm.ws.concurrent/src/com/ibm/ws/concurrent/internal/ThreadGroupTracker.java | ThreadGroupTracker.threadFactoryDestroyed | void threadFactoryDestroyed(String threadFactoryName, ThreadGroup parentGroup) {
Collection<ThreadGroup> groupsToDestroy = new LinkedList<ThreadGroup>();
for (ConcurrentHashMap<String, ThreadGroup> threadFactoryToThreadGroup : metadataIdentifierToThreadGroups.values()) {
ThreadGroup group = threadFactoryToThreadGroup.remove(threadFactoryName);
if (group != null)
groupsToDestroy.add(group);
}
groupsToDestroy.add(parentGroup);
AccessController.doPrivileged(new InterruptAndDestroyThreadGroups(groupsToDestroy, deferrableScheduledExecutor), serverAccessControlContext);
} | java | void threadFactoryDestroyed(String threadFactoryName, ThreadGroup parentGroup) {
Collection<ThreadGroup> groupsToDestroy = new LinkedList<ThreadGroup>();
for (ConcurrentHashMap<String, ThreadGroup> threadFactoryToThreadGroup : metadataIdentifierToThreadGroups.values()) {
ThreadGroup group = threadFactoryToThreadGroup.remove(threadFactoryName);
if (group != null)
groupsToDestroy.add(group);
}
groupsToDestroy.add(parentGroup);
AccessController.doPrivileged(new InterruptAndDestroyThreadGroups(groupsToDestroy, deferrableScheduledExecutor), serverAccessControlContext);
} | [
"void",
"threadFactoryDestroyed",
"(",
"String",
"threadFactoryName",
",",
"ThreadGroup",
"parentGroup",
")",
"{",
"Collection",
"<",
"ThreadGroup",
">",
"groupsToDestroy",
"=",
"new",
"LinkedList",
"<",
"ThreadGroup",
">",
"(",
")",
";",
"for",
"(",
"ConcurrentHa... | Invoke this method when destroying a ManagedThreadFactory in order to interrupt all managed threads
that it created.
@param threadFactoryName unique identifier for the managed thread factory. | [
"Invoke",
"this",
"method",
"when",
"destroying",
"a",
"ManagedThreadFactory",
"in",
"order",
"to",
"interrupt",
"all",
"managed",
"threads",
"that",
"it",
"created",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.concurrent/src/com/ibm/ws/concurrent/internal/ThreadGroupTracker.java#L149-L158 |
icode/ameba | src/main/java/ameba/lib/Fibers.java | Fibers.runInFiber | public static <V> V runInFiber(FiberScheduler scheduler, SuspendableCallable<V> target) throws ExecutionException, InterruptedException {
return FiberUtil.runInFiber(scheduler, target);
} | java | public static <V> V runInFiber(FiberScheduler scheduler, SuspendableCallable<V> target) throws ExecutionException, InterruptedException {
return FiberUtil.runInFiber(scheduler, target);
} | [
"public",
"static",
"<",
"V",
">",
"V",
"runInFiber",
"(",
"FiberScheduler",
"scheduler",
",",
"SuspendableCallable",
"<",
"V",
">",
"target",
")",
"throws",
"ExecutionException",
",",
"InterruptedException",
"{",
"return",
"FiberUtil",
".",
"runInFiber",
"(",
"... | Runs an action in a new fiber, awaits the fiber's termination, and returns its result.
@param <V>
@param scheduler the {@link FiberScheduler} to use when scheduling the fiber.
@param target the operation
@return the operations return value
@throws ExecutionException
@throws InterruptedException | [
"Runs",
"an",
"action",
"in",
"a",
"new",
"fiber",
"awaits",
"the",
"fiber",
"s",
"termination",
"and",
"returns",
"its",
"result",
"."
] | train | https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/lib/Fibers.java#L262-L264 |
eclipse/xtext-extras | org.eclipse.xtext.xbase/src-gen/org/eclipse/xtext/xbase/serializer/AbstractXbaseSemanticSequencer.java | AbstractXbaseSemanticSequencer.sequence_XSynchronizedExpression | protected void sequence_XSynchronizedExpression(ISerializationContext context, XSynchronizedExpression semanticObject) {
if (errorAcceptor != null) {
if (transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XSYNCHRONIZED_EXPRESSION__PARAM) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XSYNCHRONIZED_EXPRESSION__PARAM));
if (transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XSYNCHRONIZED_EXPRESSION__EXPRESSION) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XSYNCHRONIZED_EXPRESSION__EXPRESSION));
}
SequenceFeeder feeder = createSequencerFeeder(context, semanticObject);
feeder.accept(grammarAccess.getXSynchronizedExpressionAccess().getParamXExpressionParserRuleCall_1_0(), semanticObject.getParam());
feeder.accept(grammarAccess.getXSynchronizedExpressionAccess().getExpressionXExpressionParserRuleCall_3_0(), semanticObject.getExpression());
feeder.finish();
} | java | protected void sequence_XSynchronizedExpression(ISerializationContext context, XSynchronizedExpression semanticObject) {
if (errorAcceptor != null) {
if (transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XSYNCHRONIZED_EXPRESSION__PARAM) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XSYNCHRONIZED_EXPRESSION__PARAM));
if (transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XSYNCHRONIZED_EXPRESSION__EXPRESSION) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XSYNCHRONIZED_EXPRESSION__EXPRESSION));
}
SequenceFeeder feeder = createSequencerFeeder(context, semanticObject);
feeder.accept(grammarAccess.getXSynchronizedExpressionAccess().getParamXExpressionParserRuleCall_1_0(), semanticObject.getParam());
feeder.accept(grammarAccess.getXSynchronizedExpressionAccess().getExpressionXExpressionParserRuleCall_3_0(), semanticObject.getExpression());
feeder.finish();
} | [
"protected",
"void",
"sequence_XSynchronizedExpression",
"(",
"ISerializationContext",
"context",
",",
"XSynchronizedExpression",
"semanticObject",
")",
"{",
"if",
"(",
"errorAcceptor",
"!=",
"null",
")",
"{",
"if",
"(",
"transientValues",
".",
"isValueTransient",
"(",
... | Contexts:
XExpression returns XSynchronizedExpression
XAssignment returns XSynchronizedExpression
XAssignment.XBinaryOperation_1_1_0_0_0 returns XSynchronizedExpression
XOrExpression returns XSynchronizedExpression
XOrExpression.XBinaryOperation_1_0_0_0 returns XSynchronizedExpression
XAndExpression returns XSynchronizedExpression
XAndExpression.XBinaryOperation_1_0_0_0 returns XSynchronizedExpression
XEqualityExpression returns XSynchronizedExpression
XEqualityExpression.XBinaryOperation_1_0_0_0 returns XSynchronizedExpression
XRelationalExpression returns XSynchronizedExpression
XRelationalExpression.XInstanceOfExpression_1_0_0_0_0 returns XSynchronizedExpression
XRelationalExpression.XBinaryOperation_1_1_0_0_0 returns XSynchronizedExpression
XOtherOperatorExpression returns XSynchronizedExpression
XOtherOperatorExpression.XBinaryOperation_1_0_0_0 returns XSynchronizedExpression
XAdditiveExpression returns XSynchronizedExpression
XAdditiveExpression.XBinaryOperation_1_0_0_0 returns XSynchronizedExpression
XMultiplicativeExpression returns XSynchronizedExpression
XMultiplicativeExpression.XBinaryOperation_1_0_0_0 returns XSynchronizedExpression
XUnaryOperation returns XSynchronizedExpression
XCastedExpression returns XSynchronizedExpression
XCastedExpression.XCastedExpression_1_0_0_0 returns XSynchronizedExpression
XPostfixOperation returns XSynchronizedExpression
XPostfixOperation.XPostfixOperation_1_0_0 returns XSynchronizedExpression
XMemberFeatureCall returns XSynchronizedExpression
XMemberFeatureCall.XAssignment_1_0_0_0_0 returns XSynchronizedExpression
XMemberFeatureCall.XMemberFeatureCall_1_1_0_0_0 returns XSynchronizedExpression
XPrimaryExpression returns XSynchronizedExpression
XParenthesizedExpression returns XSynchronizedExpression
XExpressionOrVarDeclaration returns XSynchronizedExpression
XSynchronizedExpression returns XSynchronizedExpression
Constraint:
(param=XExpression expression=XExpression) | [
"Contexts",
":",
"XExpression",
"returns",
"XSynchronizedExpression",
"XAssignment",
"returns",
"XSynchronizedExpression",
"XAssignment",
".",
"XBinaryOperation_1_1_0_0_0",
"returns",
"XSynchronizedExpression",
"XOrExpression",
"returns",
"XSynchronizedExpression",
"XOrExpression",
... | train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src-gen/org/eclipse/xtext/xbase/serializer/AbstractXbaseSemanticSequencer.java#L1566-L1577 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java | SeaGlassSynthPainterImpl.paintTabbedPaneTabBorder | public void paintTabbedPaneTabBorder(SynthContext context, Graphics g, int x, int y, int w, int h, int tabIndex, int orientation) {
paintBorder(context, g, x, y, w, h, null);
} | java | public void paintTabbedPaneTabBorder(SynthContext context, Graphics g, int x, int y, int w, int h, int tabIndex, int orientation) {
paintBorder(context, g, x, y, w, h, null);
} | [
"public",
"void",
"paintTabbedPaneTabBorder",
"(",
"SynthContext",
"context",
",",
"Graphics",
"g",
",",
"int",
"x",
",",
"int",
"y",
",",
"int",
"w",
",",
"int",
"h",
",",
"int",
"tabIndex",
",",
"int",
"orientation",
")",
"{",
"paintBorder",
"(",
"cont... | Paints the border of a tab of a tabbed pane. This implementation invokes
the method of the same name without the orientation.
@param context SynthContext identifying the <code>JComponent</code>
and <code>Region</code> to paint to
@param g <code>Graphics</code> to paint to
@param x X coordinate of the area to paint to
@param y Y coordinate of the area to paint to
@param w Width of the area to paint to
@param h Height of the area to paint to
@param tabIndex Index of tab being painted.
@param orientation One of <code>JTabbedPane.TOP</code>, <code>
JTabbedPane.LEFT</code>, <code>
JTabbedPane.BOTTOM</code> , or <code>
JTabbedPane.RIGHT</code> | [
"Paints",
"the",
"border",
"of",
"a",
"tab",
"of",
"a",
"tabbed",
"pane",
".",
"This",
"implementation",
"invokes",
"the",
"method",
"of",
"the",
"same",
"name",
"without",
"the",
"orientation",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java#L2127-L2129 |
osglworks/java-tool-ext | src/main/java/org/osgl/util/Token.java | Token.isTokenValid | @SuppressWarnings("unused")
public static boolean isTokenValid(byte[] secret, String oid, String token) {
if (S.anyBlank(oid, token)) {
return false;
}
String s = Crypto.decryptAES(token, secret);
String[] sa = s.split("\\|");
if (sa.length < 2) return false;
if (!S.isEqual(oid, sa[0])) return false;
try {
long due = Long.parseLong(sa[1]);
return (due < 1 || due > System.currentTimeMillis());
} catch (Exception e) {
return false;
}
} | java | @SuppressWarnings("unused")
public static boolean isTokenValid(byte[] secret, String oid, String token) {
if (S.anyBlank(oid, token)) {
return false;
}
String s = Crypto.decryptAES(token, secret);
String[] sa = s.split("\\|");
if (sa.length < 2) return false;
if (!S.isEqual(oid, sa[0])) return false;
try {
long due = Long.parseLong(sa[1]);
return (due < 1 || due > System.currentTimeMillis());
} catch (Exception e) {
return false;
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"public",
"static",
"boolean",
"isTokenValid",
"(",
"byte",
"[",
"]",
"secret",
",",
"String",
"oid",
",",
"String",
"token",
")",
"{",
"if",
"(",
"S",
".",
"anyBlank",
"(",
"oid",
",",
"token",
")",
")"... | Check if a string is a valid token
@param secret the secret to decrypt the string
@param oid the ID supposed to be encapsulated in the token
@param token the token string
@return {@code true} if the token is valid | [
"Check",
"if",
"a",
"string",
"is",
"a",
"valid",
"token"
] | train | https://github.com/osglworks/java-tool-ext/blob/43f034bd0a42e571e437f44aa20487d45248a30b/src/main/java/org/osgl/util/Token.java#L415-L430 |
brettwooldridge/SansOrm | src/main/java/com/zaxxer/sansorm/OrmElf.java | OrmElf.insertListBatched | public static <T> void insertListBatched(Connection connection, Iterable<T> iterable) throws SQLException
{
OrmWriter.insertListBatched(connection, iterable);
} | java | public static <T> void insertListBatched(Connection connection, Iterable<T> iterable) throws SQLException
{
OrmWriter.insertListBatched(connection, iterable);
} | [
"public",
"static",
"<",
"T",
">",
"void",
"insertListBatched",
"(",
"Connection",
"connection",
",",
"Iterable",
"<",
"T",
">",
"iterable",
")",
"throws",
"SQLException",
"{",
"OrmWriter",
".",
"insertListBatched",
"(",
"connection",
",",
"iterable",
")",
";"... | Insert a collection of objects using JDBC batching.
@param connection a SQL connection
@param iterable a list (or other {@link Iterable} collection) of annotated objects to insert
@param <T> the class template
@throws SQLException if a {@link SQLException} occurs | [
"Insert",
"a",
"collection",
"of",
"objects",
"using",
"JDBC",
"batching",
"."
] | train | https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/OrmElf.java#L233-L236 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/SplitMergeLineFitSegment.java | SplitMergeLineFitSegment.selectSplitBetween | protected int selectSplitBetween(int indexStart, int indexEnd) {
Point2D_I32 a = contour.get(indexStart);
Point2D_I32 c = contour.get(indexEnd);
line.p.set(a.x,a.y);
line.slope.set(c.x-a.x,c.y-a.y);
int bestIndex = -1;
double bestDistanceSq = splitThresholdSq(contour.get(indexStart), contour.get(indexEnd));
// adjusting using 'minimumSideLengthPixel' to ensure it doesn't create a new line which is too short
int minLength = Math.max(1,minimumSideLengthPixel);// 1 is the minimum so that you don't split on the same corner
int length = indexEnd-indexStart-minLength;
// don't try splitting at the two end points
for( int i = minLength; i <= length; i++ ) {
int index = indexStart+i;
Point2D_I32 b = contour.get(index);
point2D.set(b.x,b.y);
double dist = Distance2D_F64.distanceSq(line, point2D);
if( dist >= bestDistanceSq ) {
bestDistanceSq = dist;
bestIndex = index;
}
}
return bestIndex;
} | java | protected int selectSplitBetween(int indexStart, int indexEnd) {
Point2D_I32 a = contour.get(indexStart);
Point2D_I32 c = contour.get(indexEnd);
line.p.set(a.x,a.y);
line.slope.set(c.x-a.x,c.y-a.y);
int bestIndex = -1;
double bestDistanceSq = splitThresholdSq(contour.get(indexStart), contour.get(indexEnd));
// adjusting using 'minimumSideLengthPixel' to ensure it doesn't create a new line which is too short
int minLength = Math.max(1,minimumSideLengthPixel);// 1 is the minimum so that you don't split on the same corner
int length = indexEnd-indexStart-minLength;
// don't try splitting at the two end points
for( int i = minLength; i <= length; i++ ) {
int index = indexStart+i;
Point2D_I32 b = contour.get(index);
point2D.set(b.x,b.y);
double dist = Distance2D_F64.distanceSq(line, point2D);
if( dist >= bestDistanceSq ) {
bestDistanceSq = dist;
bestIndex = index;
}
}
return bestIndex;
} | [
"protected",
"int",
"selectSplitBetween",
"(",
"int",
"indexStart",
",",
"int",
"indexEnd",
")",
"{",
"Point2D_I32",
"a",
"=",
"contour",
".",
"get",
"(",
"indexStart",
")",
";",
"Point2D_I32",
"c",
"=",
"contour",
".",
"get",
"(",
"indexEnd",
")",
";",
... | Finds the point between indexStart and the end point which is the greater distance from the line
(set up prior to calling). Returns the index if the distance is less than tolerance, otherwise -1 | [
"Finds",
"the",
"point",
"between",
"indexStart",
"and",
"the",
"end",
"point",
"which",
"is",
"the",
"greater",
"distance",
"from",
"the",
"line",
"(",
"set",
"up",
"prior",
"to",
"calling",
")",
".",
"Returns",
"the",
"index",
"if",
"the",
"distance",
... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/SplitMergeLineFitSegment.java#L119-L147 |
apache/incubator-gobblin | gobblin-data-management/src/main/java/org/apache/gobblin/data/management/conversion/hive/watermarker/PartitionLevelWatermarker.java | PartitionLevelWatermarker.onTableProcessBegin | @Override
public void onTableProcessBegin(Table table, long tableProcessTime) {
Preconditions.checkNotNull(table);
if (!this.expectedHighWatermarks.hasPartitionWatermarks(tableKey(table))) {
this.expectedHighWatermarks.setPartitionWatermarks(tableKey(table), Maps.<String, Long> newHashMap());
}
} | java | @Override
public void onTableProcessBegin(Table table, long tableProcessTime) {
Preconditions.checkNotNull(table);
if (!this.expectedHighWatermarks.hasPartitionWatermarks(tableKey(table))) {
this.expectedHighWatermarks.setPartitionWatermarks(tableKey(table), Maps.<String, Long> newHashMap());
}
} | [
"@",
"Override",
"public",
"void",
"onTableProcessBegin",
"(",
"Table",
"table",
",",
"long",
"tableProcessTime",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"table",
")",
";",
"if",
"(",
"!",
"this",
".",
"expectedHighWatermarks",
".",
"hasPartitionWat... | Initializes the expected high watermarks for a {@link Table}
{@inheritDoc}
@see org.apache.gobblin.data.management.conversion.hive.watermarker.HiveSourceWatermarker#onTableProcessBegin(org.apache.hadoop.hive.ql.metadata.Table, long) | [
"Initializes",
"the",
"expected",
"high",
"watermarks",
"for",
"a",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/conversion/hive/watermarker/PartitionLevelWatermarker.java#L211-L219 |
ironjacamar/ironjacamar | core/src/main/java/org/ironjacamar/core/tracer/Tracer.java | Tracer.destroyManagedConnectionPool | public static synchronized void destroyManagedConnectionPool(String poolName, Object mcp)
{
log.tracef("%s", new TraceEvent(poolName,
Integer.toHexString(System.identityHashCode(mcp)),
TraceEvent.MANAGED_CONNECTION_POOL_DESTROY,
"NONE"));
} | java | public static synchronized void destroyManagedConnectionPool(String poolName, Object mcp)
{
log.tracef("%s", new TraceEvent(poolName,
Integer.toHexString(System.identityHashCode(mcp)),
TraceEvent.MANAGED_CONNECTION_POOL_DESTROY,
"NONE"));
} | [
"public",
"static",
"synchronized",
"void",
"destroyManagedConnectionPool",
"(",
"String",
"poolName",
",",
"Object",
"mcp",
")",
"{",
"log",
".",
"tracef",
"(",
"\"%s\"",
",",
"new",
"TraceEvent",
"(",
"poolName",
",",
"Integer",
".",
"toHexString",
"(",
"Sys... | Destroy managed connection pool
@param poolName The name of the pool
@param mcp The managed connection pool | [
"Destroy",
"managed",
"connection",
"pool"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/tracer/Tracer.java#L571-L577 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/ZipFile.java | ZipFile.getInputStream | public InputStream getInputStream(ZipEntry entry) throws IOException {
if (entry == null) {
throw new NullPointerException("entry");
}
long jzentry = 0;
ZipFileInputStream in = null;
synchronized (this) {
ensureOpen();
if (!zc.isUTF8() && (entry.flag & EFS) != 0) {
jzentry = getEntry(jzfile, zc.getBytesUTF8(entry.name), true);
} else {
jzentry = getEntry(jzfile, zc.getBytes(entry.name), true);
}
if (jzentry == 0) {
return null;
}
in = new ZipFileInputStream(jzentry);
switch (getEntryMethod(jzentry)) {
case STORED:
synchronized (streams) {
streams.put(in, null);
}
return in;
case DEFLATED:
// MORE: Compute good size for inflater stream:
long size = getEntrySize(jzentry) + 2; // Inflater likes a bit of slack
if (size > 65536) size = 8192;
if (size <= 0) size = 4096;
Inflater inf = getInflater();
InputStream is =
new ZipFileInflaterInputStream(in, inf, (int)size);
synchronized (streams) {
streams.put(is, inf);
}
return is;
default:
throw new ZipException("invalid compression method");
}
}
} | java | public InputStream getInputStream(ZipEntry entry) throws IOException {
if (entry == null) {
throw new NullPointerException("entry");
}
long jzentry = 0;
ZipFileInputStream in = null;
synchronized (this) {
ensureOpen();
if (!zc.isUTF8() && (entry.flag & EFS) != 0) {
jzentry = getEntry(jzfile, zc.getBytesUTF8(entry.name), true);
} else {
jzentry = getEntry(jzfile, zc.getBytes(entry.name), true);
}
if (jzentry == 0) {
return null;
}
in = new ZipFileInputStream(jzentry);
switch (getEntryMethod(jzentry)) {
case STORED:
synchronized (streams) {
streams.put(in, null);
}
return in;
case DEFLATED:
// MORE: Compute good size for inflater stream:
long size = getEntrySize(jzentry) + 2; // Inflater likes a bit of slack
if (size > 65536) size = 8192;
if (size <= 0) size = 4096;
Inflater inf = getInflater();
InputStream is =
new ZipFileInflaterInputStream(in, inf, (int)size);
synchronized (streams) {
streams.put(is, inf);
}
return is;
default:
throw new ZipException("invalid compression method");
}
}
} | [
"public",
"InputStream",
"getInputStream",
"(",
"ZipEntry",
"entry",
")",
"throws",
"IOException",
"{",
"if",
"(",
"entry",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"entry\"",
")",
";",
"}",
"long",
"jzentry",
"=",
"0",
";",
"... | Returns an input stream for reading the contents of the specified
zip file entry.
<p> Closing this ZIP file will, in turn, close all input
streams that have been returned by invocations of this method.
@param entry the zip file entry
@return the input stream for reading the contents of the specified
zip file entry.
@throws ZipException if a ZIP format error has occurred
@throws IOException if an I/O error has occurred
@throws IllegalStateException if the zip file has been closed | [
"Returns",
"an",
"input",
"stream",
"for",
"reading",
"the",
"contents",
"of",
"the",
"specified",
"zip",
"file",
"entry",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/ZipFile.java#L350-L390 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringParser.java | StringParser.parseBoolObjExact | @Nullable
public static Boolean parseBoolObjExact (@Nullable final String sStr, @Nullable final Boolean aDefault)
{
if (Boolean.TRUE.toString ().equalsIgnoreCase (sStr))
return Boolean.TRUE;
if (Boolean.FALSE.toString ().equalsIgnoreCase (sStr))
return Boolean.FALSE;
return aDefault;
} | java | @Nullable
public static Boolean parseBoolObjExact (@Nullable final String sStr, @Nullable final Boolean aDefault)
{
if (Boolean.TRUE.toString ().equalsIgnoreCase (sStr))
return Boolean.TRUE;
if (Boolean.FALSE.toString ().equalsIgnoreCase (sStr))
return Boolean.FALSE;
return aDefault;
} | [
"@",
"Nullable",
"public",
"static",
"Boolean",
"parseBoolObjExact",
"(",
"@",
"Nullable",
"final",
"String",
"sStr",
",",
"@",
"Nullable",
"final",
"Boolean",
"aDefault",
")",
"{",
"if",
"(",
"Boolean",
".",
"TRUE",
".",
"toString",
"(",
")",
".",
"equals... | Returns a <code>Boolean</code> with a value represented by the specified
string. The <code>Boolean</code> returned represents a <code>true</code>
value if the string argument is not <code>null</code> and is equal,
ignoring case, to the string {@code "true"}, and it will return
<code>false</code> if the string argument is not <code>null</code> and is
equal, ignoring case, to the string {@code "false"}. In all other cases
<code>aDefault</code> is returned.
@param sStr
The string to be parsed. May be <code>null</code>.
@param aDefault
The default value to be returned if the value is neither "true" nor
"false". May be <code>null</code>.
@return the <code>Boolean</code> value represented by the string. Never
<code>null</code>. | [
"Returns",
"a",
"<code",
">",
"Boolean<",
"/",
"code",
">",
"with",
"a",
"value",
"represented",
"by",
"the",
"specified",
"string",
".",
"The",
"<code",
">",
"Boolean<",
"/",
"code",
">",
"returned",
"represents",
"a",
"<code",
">",
"true<",
"/",
"code"... | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringParser.java#L237-L245 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDValidation.java | SDValidation.validateBool | protected static void validateBool(String opName, SDVariable v) {
if (v == null)
return;
if (v.dataType() != DataType.BOOL)
throw new IllegalStateException("Cannot apply operation \"" + opName + "\" to variable \"" + v.getVarName() + "\" with non-boolean point data type " + v.dataType());
} | java | protected static void validateBool(String opName, SDVariable v) {
if (v == null)
return;
if (v.dataType() != DataType.BOOL)
throw new IllegalStateException("Cannot apply operation \"" + opName + "\" to variable \"" + v.getVarName() + "\" with non-boolean point data type " + v.dataType());
} | [
"protected",
"static",
"void",
"validateBool",
"(",
"String",
"opName",
",",
"SDVariable",
"v",
")",
"{",
"if",
"(",
"v",
"==",
"null",
")",
"return",
";",
"if",
"(",
"v",
".",
"dataType",
"(",
")",
"!=",
"DataType",
".",
"BOOL",
")",
"throw",
"new",... | Validate that the operation is being applied on a boolean type SDVariable
@param opName Operation name to print in the exception
@param v Variable to validate datatype for (input to operation) | [
"Validate",
"that",
"the",
"operation",
"is",
"being",
"applied",
"on",
"a",
"boolean",
"type",
"SDVariable"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDValidation.java#L118-L123 |
line/armeria | core/src/main/java/com/linecorp/armeria/common/logging/LoggingDecoratorBuilder.java | LoggingDecoratorBuilder.headersSanitizer | public T headersSanitizer(Function<? super HttpHeaders, ? extends HttpHeaders> headersSanitizer) {
requireNonNull(headersSanitizer, "headersSanitizer");
requestHeadersSanitizer(headersSanitizer);
requestTrailersSanitizer(headersSanitizer);
responseHeadersSanitizer(headersSanitizer);
responseTrailersSanitizer(headersSanitizer);
return self();
} | java | public T headersSanitizer(Function<? super HttpHeaders, ? extends HttpHeaders> headersSanitizer) {
requireNonNull(headersSanitizer, "headersSanitizer");
requestHeadersSanitizer(headersSanitizer);
requestTrailersSanitizer(headersSanitizer);
responseHeadersSanitizer(headersSanitizer);
responseTrailersSanitizer(headersSanitizer);
return self();
} | [
"public",
"T",
"headersSanitizer",
"(",
"Function",
"<",
"?",
"super",
"HttpHeaders",
",",
"?",
"extends",
"HttpHeaders",
">",
"headersSanitizer",
")",
"{",
"requireNonNull",
"(",
"headersSanitizer",
",",
"\"headersSanitizer\"",
")",
";",
"requestHeadersSanitizer",
... | Sets the {@link Function} to use to sanitize request, response and trailing headers before logging.
It is common to have the {@link Function} that removes sensitive headers, like {@code "Cookie"} and
{@code "Set-Cookie"}, before logging. This method is a shortcut of:
<pre>{@code
builder.requestHeadersSanitizer(headersSanitizer);
builder.requestTrailersSanitizer(headersSanitizer);
builder.responseHeadersSanitizer(headersSanitizer);
builder.responseTrailersSanitizer(headersSanitizer);
}</pre>
@see #requestHeadersSanitizer(Function)
@see #requestTrailersSanitizer(Function)
@see #responseHeadersSanitizer(Function)
@see #responseTrailersSanitizer(Function) | [
"Sets",
"the",
"{",
"@link",
"Function",
"}",
"to",
"use",
"to",
"sanitize",
"request",
"response",
"and",
"trailing",
"headers",
"before",
"logging",
".",
"It",
"is",
"common",
"to",
"have",
"the",
"{",
"@link",
"Function",
"}",
"that",
"removes",
"sensit... | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/common/logging/LoggingDecoratorBuilder.java#L188-L195 |
droidpl/android-json-viewer | android-json-viewer/src/main/java/com/github/droidpl/android/jsonviewer/JSONViewerActivity.java | JSONViewerActivity.startActivity | public static void startActivity(@NonNull Context context, @Nullable JSONArray jsonArray) {
Intent intent = new Intent(context, JSONViewerActivity.class);
Bundle bundle = new Bundle();
if (jsonArray != null) {
bundle.putString(JSON_ARRAY_STATE, jsonArray.toString());
}
intent.putExtras(bundle);
context.startActivity(intent);
} | java | public static void startActivity(@NonNull Context context, @Nullable JSONArray jsonArray) {
Intent intent = new Intent(context, JSONViewerActivity.class);
Bundle bundle = new Bundle();
if (jsonArray != null) {
bundle.putString(JSON_ARRAY_STATE, jsonArray.toString());
}
intent.putExtras(bundle);
context.startActivity(intent);
} | [
"public",
"static",
"void",
"startActivity",
"(",
"@",
"NonNull",
"Context",
"context",
",",
"@",
"Nullable",
"JSONArray",
"jsonArray",
")",
"{",
"Intent",
"intent",
"=",
"new",
"Intent",
"(",
"context",
",",
"JSONViewerActivity",
".",
"class",
")",
";",
"Bu... | Starts an activity with a json array.
@param context The context to start the activity.
@param jsonArray The json array. | [
"Starts",
"an",
"activity",
"with",
"a",
"json",
"array",
"."
] | train | https://github.com/droidpl/android-json-viewer/blob/7345a7a0e6636399015a03fad8243a47f5fcdd8f/android-json-viewer/src/main/java/com/github/droidpl/android/jsonviewer/JSONViewerActivity.java#L58-L66 |
CenturyLinkCloud/mdw | mdw-common/src/com/centurylink/mdw/model/workflow/Process.java | Process.setAttribute | public void setAttribute(String attrname, String value) {
if (attributes == null)
attributes = new ArrayList<Attribute>();
Attribute.setAttribute(attributes, attrname, value);
} | java | public void setAttribute(String attrname, String value) {
if (attributes == null)
attributes = new ArrayList<Attribute>();
Attribute.setAttribute(attributes, attrname, value);
} | [
"public",
"void",
"setAttribute",
"(",
"String",
"attrname",
",",
"String",
"value",
")",
"{",
"if",
"(",
"attributes",
"==",
"null",
")",
"attributes",
"=",
"new",
"ArrayList",
"<",
"Attribute",
">",
"(",
")",
";",
"Attribute",
".",
"setAttribute",
"(",
... | Set the value of a process attribute.
If the value is null, the attribute is removed.
If the attribute does not exist and the value is not null, the attribute
is created.
@param attrname
@param value | [
"Set",
"the",
"value",
"of",
"a",
"process",
"attribute",
".",
"If",
"the",
"value",
"is",
"null",
"the",
"attribute",
"is",
"removed",
".",
"If",
"the",
"attribute",
"does",
"not",
"exist",
"and",
"the",
"value",
"is",
"not",
"null",
"the",
"attribute",... | train | https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-common/src/com/centurylink/mdw/model/workflow/Process.java#L450-L454 |
ArcBees/gwtquery | gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/events/EventsListener.java | EventsListener.hasHandlers | public boolean hasHandlers(int eventBits, String eventName, Function handler) {
for (int i = 0, j = elementEvents.length(); i < j; i++) {
BindFunction function = elementEvents.get(i);
if ((function.hasEventType(eventBits) || function.isTypeOf(eventName))
&& (handler == null || function.isEquals(handler))) {
return true;
}
}
return false;
} | java | public boolean hasHandlers(int eventBits, String eventName, Function handler) {
for (int i = 0, j = elementEvents.length(); i < j; i++) {
BindFunction function = elementEvents.get(i);
if ((function.hasEventType(eventBits) || function.isTypeOf(eventName))
&& (handler == null || function.isEquals(handler))) {
return true;
}
}
return false;
} | [
"public",
"boolean",
"hasHandlers",
"(",
"int",
"eventBits",
",",
"String",
"eventName",
",",
"Function",
"handler",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"j",
"=",
"elementEvents",
".",
"length",
"(",
")",
";",
"i",
"<",
"j",
";",
"i",
... | Return true if the element is listening for the
given eventBit or eventName and the handler matches. | [
"Return",
"true",
"if",
"the",
"element",
"is",
"listening",
"for",
"the",
"given",
"eventBit",
"or",
"eventName",
"and",
"the",
"handler",
"matches",
"."
] | train | https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/events/EventsListener.java#L705-L714 |
apache/predictionio-sdk-java | client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java | EventClient.unsetUser | public String unsetUser(String uid, List<String> properties, DateTime eventTime)
throws ExecutionException, InterruptedException, IOException {
return createEvent(unsetUserAsFuture(uid, properties, eventTime));
} | java | public String unsetUser(String uid, List<String> properties, DateTime eventTime)
throws ExecutionException, InterruptedException, IOException {
return createEvent(unsetUserAsFuture(uid, properties, eventTime));
} | [
"public",
"String",
"unsetUser",
"(",
"String",
"uid",
",",
"List",
"<",
"String",
">",
"properties",
",",
"DateTime",
"eventTime",
")",
"throws",
"ExecutionException",
",",
"InterruptedException",
",",
"IOException",
"{",
"return",
"createEvent",
"(",
"unsetUserA... | Unsets properties of a user. The list must not be empty.
@param uid ID of the user
@param properties a list of all the properties to unset
@param eventTime timestamp of the event
@return ID of this event | [
"Unsets",
"properties",
"of",
"a",
"user",
".",
"The",
"list",
"must",
"not",
"be",
"empty",
"."
] | train | https://github.com/apache/predictionio-sdk-java/blob/16052c96b136340c175c3f9c2692e720850df219/client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java#L381-L384 |
javers/javers | javers-core/src/main/java/org/javers/core/metamodel/clazz/ClientsClassDefinitionBuilder.java | ClientsClassDefinitionBuilder.withIgnoredProperties | public T withIgnoredProperties(List<String> ignoredProperties) {
Validate.argumentIsNotNull(ignoredProperties);
if (includedProperties.size() > 0) {
throw new JaversException(JaversExceptionCode.IGNORED_AND_INCLUDED_PROPERTIES_MIX, clazz.getSimpleName());
}
this.ignoredProperties = ignoredProperties;
return (T) this;
} | java | public T withIgnoredProperties(List<String> ignoredProperties) {
Validate.argumentIsNotNull(ignoredProperties);
if (includedProperties.size() > 0) {
throw new JaversException(JaversExceptionCode.IGNORED_AND_INCLUDED_PROPERTIES_MIX, clazz.getSimpleName());
}
this.ignoredProperties = ignoredProperties;
return (T) this;
} | [
"public",
"T",
"withIgnoredProperties",
"(",
"List",
"<",
"String",
">",
"ignoredProperties",
")",
"{",
"Validate",
".",
"argumentIsNotNull",
"(",
"ignoredProperties",
")",
";",
"if",
"(",
"includedProperties",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"thr... | List of class properties to be ignored by JaVers.
<br/><br/>
Properties can be also ignored with the {@link DiffIgnore} annotation.
<br/><br/>
You can either specify includedProperties or ignoredProperties, not both.
@see DiffIgnore
@throws IllegalArgumentException If includedProperties was already set. | [
"List",
"of",
"class",
"properties",
"to",
"be",
"ignored",
"by",
"JaVers",
".",
"<br",
"/",
">",
"<br",
"/",
">"
] | train | https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-core/src/main/java/org/javers/core/metamodel/clazz/ClientsClassDefinitionBuilder.java#L49-L56 |
tvesalainen/bcc | src/main/java/org/vesalainen/bcc/Assembler.java | Assembler.if_tcmpeq | public void if_tcmpeq(TypeMirror type, String target) throws IOException
{
pushType(type);
if_tcmpeq(target);
popType();
} | java | public void if_tcmpeq(TypeMirror type, String target) throws IOException
{
pushType(type);
if_tcmpeq(target);
popType();
} | [
"public",
"void",
"if_tcmpeq",
"(",
"TypeMirror",
"type",
",",
"String",
"target",
")",
"throws",
"IOException",
"{",
"pushType",
"(",
"type",
")",
";",
"if_tcmpeq",
"(",
"target",
")",
";",
"popType",
"(",
")",
";",
"}"
] | eq succeeds if and only if value1 == value2
<p>Stack: ..., value1, value2 => ...
@param type
@param target
@throws IOException | [
"eq",
"succeeds",
"if",
"and",
"only",
"if",
"value1",
"==",
"value2",
"<p",
">",
"Stack",
":",
"...",
"value1",
"value2",
"=",
">",
";",
"..."
] | train | https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/Assembler.java#L676-L681 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java | AsynchronousRequest.getAllContinentRegionID | public void getAllContinentRegionID(int continentID, int floorID, Callback<List<Integer>> callback) throws NullPointerException {
gw2API.getAllContinentRegionIDs(Integer.toString(continentID), Integer.toString(floorID)).enqueue(callback);
} | java | public void getAllContinentRegionID(int continentID, int floorID, Callback<List<Integer>> callback) throws NullPointerException {
gw2API.getAllContinentRegionIDs(Integer.toString(continentID), Integer.toString(floorID)).enqueue(callback);
} | [
"public",
"void",
"getAllContinentRegionID",
"(",
"int",
"continentID",
",",
"int",
"floorID",
",",
"Callback",
"<",
"List",
"<",
"Integer",
">",
">",
"callback",
")",
"throws",
"NullPointerException",
"{",
"gw2API",
".",
"getAllContinentRegionIDs",
"(",
"Integer"... | For more info on continents API go <a href="https://wiki.guildwars2.com/wiki/API:2/continents">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions
@param continentID {@link Continent#id}
@param floorID {@link ContinentFloor#id}
@param callback callback that is going to be used for {@link Call#enqueue(Callback)}
@throws NullPointerException if given {@link Callback} is empty
@see ContinentRegion continents region info | [
"For",
"more",
"info",
"on",
"continents",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"continents",
">",
"here<",
"/",
"a",
">",
"<br",
"/",
">",
"Give",
"use... | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L1076-L1078 |
apache/incubator-heron | heron/api/src/java/org/apache/heron/api/Config.java | Config.addClasspath | public void addClasspath(Map<String, Object> conf, String classpath) {
String cpKey = Config.TOPOLOGY_ADDITIONAL_CLASSPATH;
if (conf.containsKey(cpKey)) {
String newEntry = String.format("%s:%s", conf.get(cpKey), classpath);
conf.put(cpKey, newEntry);
} else {
conf.put(cpKey, classpath);
}
} | java | public void addClasspath(Map<String, Object> conf, String classpath) {
String cpKey = Config.TOPOLOGY_ADDITIONAL_CLASSPATH;
if (conf.containsKey(cpKey)) {
String newEntry = String.format("%s:%s", conf.get(cpKey), classpath);
conf.put(cpKey, newEntry);
} else {
conf.put(cpKey, classpath);
}
} | [
"public",
"void",
"addClasspath",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"conf",
",",
"String",
"classpath",
")",
"{",
"String",
"cpKey",
"=",
"Config",
".",
"TOPOLOGY_ADDITIONAL_CLASSPATH",
";",
"if",
"(",
"conf",
".",
"containsKey",
"(",
"cpKey",
... | /*
Appends the given classpath to the additional classpath config | [
"/",
"*",
"Appends",
"the",
"given",
"classpath",
"to",
"the",
"additional",
"classpath",
"config"
] | train | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/api/src/java/org/apache/heron/api/Config.java#L836-L845 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/util/BinaryHeapPriorityQueue.java | BinaryHeapPriorityQueue.relaxPriority | public boolean relaxPriority(E key, double priority) {
Entry<E> entry = getEntry(key);
if (entry == null) {
entry = makeEntry(key);
}
if (compare(priority, entry.priority) <= 0) {
return false;
}
entry.priority = priority;
heapifyUp(entry);
return true;
} | java | public boolean relaxPriority(E key, double priority) {
Entry<E> entry = getEntry(key);
if (entry == null) {
entry = makeEntry(key);
}
if (compare(priority, entry.priority) <= 0) {
return false;
}
entry.priority = priority;
heapifyUp(entry);
return true;
} | [
"public",
"boolean",
"relaxPriority",
"(",
"E",
"key",
",",
"double",
"priority",
")",
"{",
"Entry",
"<",
"E",
">",
"entry",
"=",
"getEntry",
"(",
"key",
")",
";",
"if",
"(",
"entry",
"==",
"null",
")",
"{",
"entry",
"=",
"makeEntry",
"(",
"key",
"... | Promotes a key in the queue, adding it if it wasn't there already. If the specified priority is worse than the current priority, nothing happens. Faster than add if you don't care about whether the key is new.
@param key an <code>Object</code> value
@return whether the priority actually improved. | [
"Promotes",
"a",
"key",
"in",
"the",
"queue",
"adding",
"it",
"if",
"it",
"wasn",
"t",
"there",
"already",
".",
"If",
"the",
"specified",
"priority",
"is",
"worse",
"than",
"the",
"current",
"priority",
"nothing",
"happens",
".",
"Faster",
"than",
"add",
... | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/BinaryHeapPriorityQueue.java#L318-L329 |
jboss-integration/fuse-bxms-integ | switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/config/builder/patch/PatchedRuntimeEnvironmentBuilder.java | PatchedRuntimeEnvironmentBuilder.addEnvironmentEntry | public RuntimeEnvironmentBuilder addEnvironmentEntry(String name, Object value) {
if (name == null || value == null) {
return this;
}
_runtimeEnvironment.addToEnvironment(name, value);
return this;
} | java | public RuntimeEnvironmentBuilder addEnvironmentEntry(String name, Object value) {
if (name == null || value == null) {
return this;
}
_runtimeEnvironment.addToEnvironment(name, value);
return this;
} | [
"public",
"RuntimeEnvironmentBuilder",
"addEnvironmentEntry",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"name",
"==",
"null",
"||",
"value",
"==",
"null",
")",
"{",
"return",
"this",
";",
"}",
"_runtimeEnvironment",
".",
"addToEnviron... | Adds an environmentEntry name/value pair.
@param name name
@param value value
@return this RuntimeEnvironmentBuilder | [
"Adds",
"an",
"environmentEntry",
"name",
"/",
"value",
"pair",
"."
] | train | https://github.com/jboss-integration/fuse-bxms-integ/blob/ca5c012bf867ea15d1250f0991af3cd7e708aaaf/switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/config/builder/patch/PatchedRuntimeEnvironmentBuilder.java#L373-L380 |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/service/AbstractLazyService.java | AbstractLazyService.sendAndFlushWhenConnected | private static void sendAndFlushWhenConnected(final Endpoint endpoint, final CouchbaseRequest request) {
whenState(endpoint, LifecycleState.CONNECTED, new Action1<LifecycleState>() {
@Override
public void call(LifecycleState lifecycleState) {
endpoint.send(request);
endpoint.send(SignalFlush.INSTANCE);
}
});
} | java | private static void sendAndFlushWhenConnected(final Endpoint endpoint, final CouchbaseRequest request) {
whenState(endpoint, LifecycleState.CONNECTED, new Action1<LifecycleState>() {
@Override
public void call(LifecycleState lifecycleState) {
endpoint.send(request);
endpoint.send(SignalFlush.INSTANCE);
}
});
} | [
"private",
"static",
"void",
"sendAndFlushWhenConnected",
"(",
"final",
"Endpoint",
"endpoint",
",",
"final",
"CouchbaseRequest",
"request",
")",
"{",
"whenState",
"(",
"endpoint",
",",
"LifecycleState",
".",
"CONNECTED",
",",
"new",
"Action1",
"<",
"LifecycleState"... | Helper method to send the request and also a flush afterwards.
@param endpoint the endpoint to send the reques to.
@param request the reques to send. | [
"Helper",
"method",
"to",
"send",
"the",
"request",
"and",
"also",
"a",
"flush",
"afterwards",
"."
] | train | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/service/AbstractLazyService.java#L98-L106 |
james-hu/jabb-core | src/main/java/net/sf/jabb/spring/rest/AbstractRestClient.java | AbstractRestClient.buildAddBasicAuthHeaderRequestInterceptor | protected ClientHttpRequestInterceptor buildAddBasicAuthHeaderRequestInterceptor(String user, String password){
return new AddHeaderRequestInterceptor(HEADER_AUTHORIZATION, buildBasicAuthValue(user, password));
} | java | protected ClientHttpRequestInterceptor buildAddBasicAuthHeaderRequestInterceptor(String user, String password){
return new AddHeaderRequestInterceptor(HEADER_AUTHORIZATION, buildBasicAuthValue(user, password));
} | [
"protected",
"ClientHttpRequestInterceptor",
"buildAddBasicAuthHeaderRequestInterceptor",
"(",
"String",
"user",
",",
"String",
"password",
")",
"{",
"return",
"new",
"AddHeaderRequestInterceptor",
"(",
"HEADER_AUTHORIZATION",
",",
"buildBasicAuthValue",
"(",
"user",
",",
"... | Build a ClientHttpRequestInterceptor that adds BasicAuth header
@param user the user name, may be null or empty
@param password the password, may be null or empty
@return the ClientHttpRequestInterceptor built | [
"Build",
"a",
"ClientHttpRequestInterceptor",
"that",
"adds",
"BasicAuth",
"header"
] | train | https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/spring/rest/AbstractRestClient.java#L523-L525 |
axibase/atsd-jdbc | src/main/java/com/axibase/tsd/driver/jdbc/ext/AtsdMeta.java | AtsdMeta.appendMetaColumns | private static void appendMetaColumns(StringBuilder buffer, MetadataColumnDefinition[] values) {
for (MetadataColumnDefinition column : values) {
buffer.append(", ").append(column.getColumnNamePrefix());
}
} | java | private static void appendMetaColumns(StringBuilder buffer, MetadataColumnDefinition[] values) {
for (MetadataColumnDefinition column : values) {
buffer.append(", ").append(column.getColumnNamePrefix());
}
} | [
"private",
"static",
"void",
"appendMetaColumns",
"(",
"StringBuilder",
"buffer",
",",
"MetadataColumnDefinition",
"[",
"]",
"values",
")",
"{",
"for",
"(",
"MetadataColumnDefinition",
"column",
":",
"values",
")",
"{",
"buffer",
".",
"append",
"(",
"\", \"",
")... | Append metric and entity metadata columns to series requests. This method must not be used while processing meta tables.
@param buffer StringBuilder to append to
@param values columns to append | [
"Append",
"metric",
"and",
"entity",
"metadata",
"columns",
"to",
"series",
"requests",
".",
"This",
"method",
"must",
"not",
"be",
"used",
"while",
"processing",
"meta",
"tables",
"."
] | train | https://github.com/axibase/atsd-jdbc/blob/8bbd9d65f645272aa1d7fc07081bd10bd3e0c376/src/main/java/com/axibase/tsd/driver/jdbc/ext/AtsdMeta.java#L578-L582 |
wildfly-extras/wildfly-camel | config/src/main/java/org/wildfly/extras/config/internal/IllegalArgumentAssertion.java | IllegalArgumentAssertion.assertNotNull | public static <T> T assertNotNull(T value, String name) {
if (value == null)
throw new IllegalArgumentException("Null " + name);
return value;
} | java | public static <T> T assertNotNull(T value, String name) {
if (value == null)
throw new IllegalArgumentException("Null " + name);
return value;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"assertNotNull",
"(",
"T",
"value",
",",
"String",
"name",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Null \"",
"+",
"name",
")",
";",
"return",
"value",
... | Throws an IllegalArgumentException when the given value is null.
@param value the value to assert if not null
@param name the name of the argument
@param <T> The generic type of the value to assert if not null
@return the value | [
"Throws",
"an",
"IllegalArgumentException",
"when",
"the",
"given",
"value",
"is",
"null",
"."
] | train | https://github.com/wildfly-extras/wildfly-camel/blob/9ebd7e28574f277a6d5b583e8a4c357e1538c370/config/src/main/java/org/wildfly/extras/config/internal/IllegalArgumentAssertion.java#L41-L46 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.getDeletedSecretsAsync | public Observable<Page<DeletedSecretItem>> getDeletedSecretsAsync(final String vaultBaseUrl, final Integer maxresults) {
return getDeletedSecretsWithServiceResponseAsync(vaultBaseUrl, maxresults)
.map(new Func1<ServiceResponse<Page<DeletedSecretItem>>, Page<DeletedSecretItem>>() {
@Override
public Page<DeletedSecretItem> call(ServiceResponse<Page<DeletedSecretItem>> response) {
return response.body();
}
});
} | java | public Observable<Page<DeletedSecretItem>> getDeletedSecretsAsync(final String vaultBaseUrl, final Integer maxresults) {
return getDeletedSecretsWithServiceResponseAsync(vaultBaseUrl, maxresults)
.map(new Func1<ServiceResponse<Page<DeletedSecretItem>>, Page<DeletedSecretItem>>() {
@Override
public Page<DeletedSecretItem> call(ServiceResponse<Page<DeletedSecretItem>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"DeletedSecretItem",
">",
">",
"getDeletedSecretsAsync",
"(",
"final",
"String",
"vaultBaseUrl",
",",
"final",
"Integer",
"maxresults",
")",
"{",
"return",
"getDeletedSecretsWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
... | Lists deleted secrets for the specified vault.
The Get Deleted Secrets operation returns the secrets that have been deleted for a vault enabled for soft-delete. This operation requires the secrets/list permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param maxresults Maximum number of results to return in a page. If not specified the service will return up to 25 results.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<DeletedSecretItem> object | [
"Lists",
"deleted",
"secrets",
"for",
"the",
"specified",
"vault",
".",
"The",
"Get",
"Deleted",
"Secrets",
"operation",
"returns",
"the",
"secrets",
"that",
"have",
"been",
"deleted",
"for",
"a",
"vault",
"enabled",
"for",
"soft",
"-",
"delete",
".",
"This"... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L4561-L4569 |
aws/aws-sdk-java | aws-java-sdk-cognitoidp/src/main/java/com/amazonaws/services/cognitoidp/model/CreateUserPoolRequest.java | CreateUserPoolRequest.withUserPoolTags | public CreateUserPoolRequest withUserPoolTags(java.util.Map<String, String> userPoolTags) {
setUserPoolTags(userPoolTags);
return this;
} | java | public CreateUserPoolRequest withUserPoolTags(java.util.Map<String, String> userPoolTags) {
setUserPoolTags(userPoolTags);
return this;
} | [
"public",
"CreateUserPoolRequest",
"withUserPoolTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"userPoolTags",
")",
"{",
"setUserPoolTags",
"(",
"userPoolTags",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The tag keys and values to assign to the user pool. A tag is a label that you can use to categorize and manage
user pools in different ways, such as by purpose, owner, environment, or other criteria.
</p>
@param userPoolTags
The tag keys and values to assign to the user pool. A tag is a label that you can use to categorize and
manage user pools in different ways, such as by purpose, owner, environment, or other criteria.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"tag",
"keys",
"and",
"values",
"to",
"assign",
"to",
"the",
"user",
"pool",
".",
"A",
"tag",
"is",
"a",
"label",
"that",
"you",
"can",
"use",
"to",
"categorize",
"and",
"manage",
"user",
"pools",
"in",
"different",
"ways",
"such",
... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-cognitoidp/src/main/java/com/amazonaws/services/cognitoidp/model/CreateUserPoolRequest.java#L1116-L1119 |
Viascom/groundwork | foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/builder/FoxHttpClientBuilder.java | FoxHttpClientBuilder.addFoxHttpPlaceholderEntry | public FoxHttpClientBuilder addFoxHttpPlaceholderEntry(String placeholder, String value) {
foxHttpClient.getFoxHttpPlaceholderStrategy().addPlaceholder(placeholder, value);
return this;
} | java | public FoxHttpClientBuilder addFoxHttpPlaceholderEntry(String placeholder, String value) {
foxHttpClient.getFoxHttpPlaceholderStrategy().addPlaceholder(placeholder, value);
return this;
} | [
"public",
"FoxHttpClientBuilder",
"addFoxHttpPlaceholderEntry",
"(",
"String",
"placeholder",
",",
"String",
"value",
")",
"{",
"foxHttpClient",
".",
"getFoxHttpPlaceholderStrategy",
"(",
")",
".",
"addPlaceholder",
"(",
"placeholder",
",",
"value",
")",
";",
"return"... | Add a FoxHttpPlaceholderEntry to the FoxHttpPlaceholderStrategy
@param placeholder name of the placeholder (without escape char)
@param value value of the placeholder
@return FoxHttpClientBuilder (this) | [
"Add",
"a",
"FoxHttpPlaceholderEntry",
"to",
"the",
"FoxHttpPlaceholderStrategy"
] | train | https://github.com/Viascom/groundwork/blob/d3f7d0df65e2e75861fc7db938090683f2cdf919/foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/builder/FoxHttpClientBuilder.java#L292-L295 |
chhh/MSFTBX | MSFileToolbox/src/main/java/umich/ms/datatypes/LCMSRange.java | LCMSRange.create | public static final LCMSRange create(Range<Integer> scanRange, Integer msLevel,
DoubleRange mzRange) {
return new LCMSRange(scanRange, msLevel, mzRange);
} | java | public static final LCMSRange create(Range<Integer> scanRange, Integer msLevel,
DoubleRange mzRange) {
return new LCMSRange(scanRange, msLevel, mzRange);
} | [
"public",
"static",
"final",
"LCMSRange",
"create",
"(",
"Range",
"<",
"Integer",
">",
"scanRange",
",",
"Integer",
"msLevel",
",",
"DoubleRange",
"mzRange",
")",
"{",
"return",
"new",
"LCMSRange",
"(",
"scanRange",
",",
"msLevel",
",",
"mzRange",
")",
";",
... | A range, containing all scans within the scan number range at a specific MS-Level and a
specific precursor range.
@param scanRange null means the whole range of scan numbers in the run
@param msLevel null means any ms-level
@param mzRange null means all ranges. You can't use non-null here, if {@code msLevel} is null | [
"A",
"range",
"containing",
"all",
"scans",
"within",
"the",
"scan",
"number",
"range",
"at",
"a",
"specific",
"MS",
"-",
"Level",
"and",
"a",
"specific",
"precursor",
"range",
"."
] | train | https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/datatypes/LCMSRange.java#L110-L113 |
apache/incubator-heron | heron/packing/src/java/org/apache/heron/packing/binpacking/FirstFitDecreasingPacking.java | FirstFitDecreasingPacking.placeFFDInstance | private void placeFFDInstance(PackingPlanBuilder planBuilder, String componentName)
throws ConstraintViolationException {
if (this.numContainers == 0) {
planBuilder.updateNumContainers(++numContainers);
}
try {
planBuilder.addInstance(new ContainerIdScorer(), componentName);
} catch (ResourceExceededException e) {
planBuilder.updateNumContainers(++numContainers);
planBuilder.addInstance(numContainers, componentName);
}
} | java | private void placeFFDInstance(PackingPlanBuilder planBuilder, String componentName)
throws ConstraintViolationException {
if (this.numContainers == 0) {
planBuilder.updateNumContainers(++numContainers);
}
try {
planBuilder.addInstance(new ContainerIdScorer(), componentName);
} catch (ResourceExceededException e) {
planBuilder.updateNumContainers(++numContainers);
planBuilder.addInstance(numContainers, componentName);
}
} | [
"private",
"void",
"placeFFDInstance",
"(",
"PackingPlanBuilder",
"planBuilder",
",",
"String",
"componentName",
")",
"throws",
"ConstraintViolationException",
"{",
"if",
"(",
"this",
".",
"numContainers",
"==",
"0",
")",
"{",
"planBuilder",
".",
"updateNumContainers"... | Assign a particular instance to an existing container or to a new container | [
"Assign",
"a",
"particular",
"instance",
"to",
"an",
"existing",
"container",
"or",
"to",
"a",
"new",
"container"
] | train | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/packing/src/java/org/apache/heron/packing/binpacking/FirstFitDecreasingPacking.java#L286-L298 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/FdfWriter.java | FdfWriter.writeTo | public void writeTo(OutputStream os) throws IOException {
Wrt wrt = new Wrt(os, this);
wrt.writeTo();
} | java | public void writeTo(OutputStream os) throws IOException {
Wrt wrt = new Wrt(os, this);
wrt.writeTo();
} | [
"public",
"void",
"writeTo",
"(",
"OutputStream",
"os",
")",
"throws",
"IOException",
"{",
"Wrt",
"wrt",
"=",
"new",
"Wrt",
"(",
"os",
",",
"this",
")",
";",
"wrt",
".",
"writeTo",
"(",
")",
";",
"}"
] | Writes the content to a stream.
@param os the stream
@throws IOException on error | [
"Writes",
"the",
"content",
"to",
"a",
"stream",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/FdfWriter.java#L77-L80 |
spring-projects/spring-security-oauth | spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/endpoint/FrameworkEndpointHandlerMapping.java | FrameworkEndpointHandlerMapping.setMappings | public void setMappings(Map<String, String> patternMap) {
this.mappings = new HashMap<String, String>(patternMap);
for (String key : mappings.keySet()) {
String result = mappings.get(key);
if (result.startsWith(FORWARD)) {
result = result.substring(FORWARD.length());
}
if (result.startsWith(REDIRECT)) {
result = result.substring(REDIRECT.length());
}
mappings.put(key, result);
}
} | java | public void setMappings(Map<String, String> patternMap) {
this.mappings = new HashMap<String, String>(patternMap);
for (String key : mappings.keySet()) {
String result = mappings.get(key);
if (result.startsWith(FORWARD)) {
result = result.substring(FORWARD.length());
}
if (result.startsWith(REDIRECT)) {
result = result.substring(REDIRECT.length());
}
mappings.put(key, result);
}
} | [
"public",
"void",
"setMappings",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"patternMap",
")",
"{",
"this",
".",
"mappings",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
"patternMap",
")",
";",
"for",
"(",
"String",
"key",
":",
... | Custom mappings for framework endpoint paths. The keys in the map are the default framework endpoint path, e.g.
"/oauth/authorize", and the values are the desired runtime paths.
@param patternMap the mappings to set | [
"Custom",
"mappings",
"for",
"framework",
"endpoint",
"paths",
".",
"The",
"keys",
"in",
"the",
"map",
"are",
"the",
"default",
"framework",
"endpoint",
"path",
"e",
".",
"g",
".",
"/",
"oauth",
"/",
"authorize",
"and",
"the",
"values",
"are",
"the",
"de... | train | https://github.com/spring-projects/spring-security-oauth/blob/bbae0027eceb2c74a21ac26bbc86142dc732ffbe/spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/endpoint/FrameworkEndpointHandlerMapping.java#L73-L85 |
JavaEden/Orchid | OrchidCore/src/main/java/com/eden/orchid/utilities/OrchidUtils.java | OrchidUtils.getRelativeFilename | public static String getRelativeFilename(String sourcePath, String baseDir) {
if (sourcePath.contains(baseDir)) {
int indexOf = sourcePath.indexOf(baseDir);
if (indexOf + baseDir.length() < sourcePath.length()) {
String relative = sourcePath.substring((indexOf + baseDir.length()));
if (relative.startsWith("/")) {
relative = relative.substring(1);
}
else if (relative.startsWith("\\")) {
relative = relative.substring(1);
}
return relative;
}
}
return sourcePath;
} | java | public static String getRelativeFilename(String sourcePath, String baseDir) {
if (sourcePath.contains(baseDir)) {
int indexOf = sourcePath.indexOf(baseDir);
if (indexOf + baseDir.length() < sourcePath.length()) {
String relative = sourcePath.substring((indexOf + baseDir.length()));
if (relative.startsWith("/")) {
relative = relative.substring(1);
}
else if (relative.startsWith("\\")) {
relative = relative.substring(1);
}
return relative;
}
}
return sourcePath;
} | [
"public",
"static",
"String",
"getRelativeFilename",
"(",
"String",
"sourcePath",
",",
"String",
"baseDir",
")",
"{",
"if",
"(",
"sourcePath",
".",
"contains",
"(",
"baseDir",
")",
")",
"{",
"int",
"indexOf",
"=",
"sourcePath",
".",
"indexOf",
"(",
"baseDir"... | Removes the base directory from a file path. Leading slashes are also removed from the resulting file path.
@param sourcePath The original file path
@param baseDir the base directory that should be removed from the original file path
@return the file path relative to the base directory | [
"Removes",
"the",
"base",
"directory",
"from",
"a",
"file",
"path",
".",
"Leading",
"slashes",
"are",
"also",
"removed",
"from",
"the",
"resulting",
"file",
"path",
"."
] | train | https://github.com/JavaEden/Orchid/blob/47cde156fc3a7aea894cde41b7f76c503dad9811/OrchidCore/src/main/java/com/eden/orchid/utilities/OrchidUtils.java#L79-L98 |
google/closure-templates | java/src/com/google/template/soy/pysrc/internal/GenPyCallExprVisitor.java | GenPyCallExprVisitor.visitCallBasicNode | @Override
protected PyExpr visitCallBasicNode(CallBasicNode node) {
String calleeName = node.getCalleeName();
// Build the Python expr text for the callee.
String calleeExprText;
TemplateNode template = getTemplateIfInSameFile(node);
if (template != null) {
// If in the same module no namespace is required.
calleeExprText = getLocalTemplateName(template);
} else {
// If in another module, the module name is required along with the function name.
int secondToLastDotIndex = calleeName.lastIndexOf('.', calleeName.lastIndexOf('.') - 1);
calleeExprText = calleeName.substring(secondToLastDotIndex + 1);
}
String callExprText = calleeExprText + "(" + genObjToPass(node) + ", ijData)";
return escapeCall(callExprText, node.getEscapingDirectives());
} | java | @Override
protected PyExpr visitCallBasicNode(CallBasicNode node) {
String calleeName = node.getCalleeName();
// Build the Python expr text for the callee.
String calleeExprText;
TemplateNode template = getTemplateIfInSameFile(node);
if (template != null) {
// If in the same module no namespace is required.
calleeExprText = getLocalTemplateName(template);
} else {
// If in another module, the module name is required along with the function name.
int secondToLastDotIndex = calleeName.lastIndexOf('.', calleeName.lastIndexOf('.') - 1);
calleeExprText = calleeName.substring(secondToLastDotIndex + 1);
}
String callExprText = calleeExprText + "(" + genObjToPass(node) + ", ijData)";
return escapeCall(callExprText, node.getEscapingDirectives());
} | [
"@",
"Override",
"protected",
"PyExpr",
"visitCallBasicNode",
"(",
"CallBasicNode",
"node",
")",
"{",
"String",
"calleeName",
"=",
"node",
".",
"getCalleeName",
"(",
")",
";",
"// Build the Python expr text for the callee.",
"String",
"calleeExprText",
";",
"TemplateNod... | Visits basic call nodes and builds the call expression. If the callee is in the file, it can be
accessed directly, but if it's in another file, the module name must be prefixed.
@param node The basic call node.
@return The call Python expression. | [
"Visits",
"basic",
"call",
"nodes",
"and",
"builds",
"the",
"call",
"expression",
".",
"If",
"the",
"callee",
"is",
"in",
"the",
"file",
"it",
"can",
"be",
"accessed",
"directly",
"but",
"if",
"it",
"s",
"in",
"another",
"file",
"the",
"module",
"name",
... | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/pysrc/internal/GenPyCallExprVisitor.java#L130-L148 |
signalapp/libsignal-service-java | java/src/main/java/org/whispersystems/signalservice/api/SignalServiceMessageReceiver.java | SignalServiceMessageReceiver.retrieveAttachment | public InputStream retrieveAttachment(SignalServiceAttachmentPointer pointer, File destination, int maxSizeBytes)
throws IOException, InvalidMessageException
{
return retrieveAttachment(pointer, destination, maxSizeBytes, null);
} | java | public InputStream retrieveAttachment(SignalServiceAttachmentPointer pointer, File destination, int maxSizeBytes)
throws IOException, InvalidMessageException
{
return retrieveAttachment(pointer, destination, maxSizeBytes, null);
} | [
"public",
"InputStream",
"retrieveAttachment",
"(",
"SignalServiceAttachmentPointer",
"pointer",
",",
"File",
"destination",
",",
"int",
"maxSizeBytes",
")",
"throws",
"IOException",
",",
"InvalidMessageException",
"{",
"return",
"retrieveAttachment",
"(",
"pointer",
",",... | Retrieves a SignalServiceAttachment.
@param pointer The {@link SignalServiceAttachmentPointer}
received in a {@link SignalServiceDataMessage}.
@param destination The download destination for this attachment.
@return An InputStream that streams the plaintext attachment contents.
@throws IOException
@throws InvalidMessageException | [
"Retrieves",
"a",
"SignalServiceAttachment",
"."
] | train | https://github.com/signalapp/libsignal-service-java/blob/64f1150c5e4062d67d31c9a2a9c3a0237d022902/java/src/main/java/org/whispersystems/signalservice/api/SignalServiceMessageReceiver.java#L99-L103 |
zaproxy/zaproxy | src/org/parosproxy/paros/view/WorkbenchPanel.java | WorkbenchPanel.removePanels | public void removePanels(List<AbstractPanel> panels, PanelType panelType) {
validateNotNull(panels, "panels");
validateNotNull(panelType, "panelType");
removePanels(getTabbedFull(), panels);
switch (panelType) {
case SELECT:
removePanels(getTabbedSelect(), panels);
break;
case STATUS:
removePanels(getTabbedStatus(), panels);
break;
case WORK:
removePanels(getTabbedWork(), panels);
break;
default:
break;
}
} | java | public void removePanels(List<AbstractPanel> panels, PanelType panelType) {
validateNotNull(panels, "panels");
validateNotNull(panelType, "panelType");
removePanels(getTabbedFull(), panels);
switch (panelType) {
case SELECT:
removePanels(getTabbedSelect(), panels);
break;
case STATUS:
removePanels(getTabbedStatus(), panels);
break;
case WORK:
removePanels(getTabbedWork(), panels);
break;
default:
break;
}
} | [
"public",
"void",
"removePanels",
"(",
"List",
"<",
"AbstractPanel",
">",
"panels",
",",
"PanelType",
"panelType",
")",
"{",
"validateNotNull",
"(",
"panels",
",",
"\"panels\"",
")",
";",
"validateNotNull",
"(",
"panelType",
",",
"\"panelType\"",
")",
";",
"re... | Removes the given panels of given panel type from the workbench panel.
@param panels the panels to remove from the workbench panel
@param panelType the type of the panels
@throws IllegalArgumentException if any of the parameters is {@code null}.
@since 2.5.0
@see #addPanels(List, PanelType)
@see #removePanel(AbstractPanel, PanelType) | [
"Removes",
"the",
"given",
"panels",
"of",
"given",
"panel",
"type",
"from",
"the",
"workbench",
"panel",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/view/WorkbenchPanel.java#L947-L966 |
bwkimmel/jdcp | jdcp-core/src/main/java/ca/eandb/jdcp/remote/JobStatus.java | JobStatus.withNewEventId | public JobStatus withNewEventId() {
return new JobStatus(jobId, description, state, Double.NaN, status, getNextEventId());
} | java | public JobStatus withNewEventId() {
return new JobStatus(jobId, description, state, Double.NaN, status, getNextEventId());
} | [
"public",
"JobStatus",
"withNewEventId",
"(",
")",
"{",
"return",
"new",
"JobStatus",
"(",
"jobId",
",",
"description",
",",
"state",
",",
"Double",
".",
"NaN",
",",
"status",
",",
"getNextEventId",
"(",
")",
")",
";",
"}"
] | Creates a copy of this <code>JobStatus</code> with an auto-generated
event ID. The event ID will be greater than any previously generated
event ID.
@return A copy of this <code>JobStatus</code> with an auto-generated
event ID. | [
"Creates",
"a",
"copy",
"of",
"this",
"<code",
">",
"JobStatus<",
"/",
"code",
">",
"with",
"an",
"auto",
"-",
"generated",
"event",
"ID",
".",
"The",
"event",
"ID",
"will",
"be",
"greater",
"than",
"any",
"previously",
"generated",
"event",
"ID",
"."
] | train | https://github.com/bwkimmel/jdcp/blob/630c5150c245054e2556ff370f4bad2ec793dfb7/jdcp-core/src/main/java/ca/eandb/jdcp/remote/JobStatus.java#L174-L176 |
diffplug/durian | src/com/diffplug/common/base/StackDumper.java | StackDumper.wrapAndDumpWhenContains | public static PrintStream wrapAndDumpWhenContains(PrintStream source, String trigger) {
StringPrinter wrapped = new StringPrinter(StringPrinter.stringsToLines(perLine -> {
source.println(perLine);
if (perLine.contains(trigger)) {
dump("Triggered by " + trigger);
}
}));
return wrapped.toPrintStream();
} | java | public static PrintStream wrapAndDumpWhenContains(PrintStream source, String trigger) {
StringPrinter wrapped = new StringPrinter(StringPrinter.stringsToLines(perLine -> {
source.println(perLine);
if (perLine.contains(trigger)) {
dump("Triggered by " + trigger);
}
}));
return wrapped.toPrintStream();
} | [
"public",
"static",
"PrintStream",
"wrapAndDumpWhenContains",
"(",
"PrintStream",
"source",
",",
"String",
"trigger",
")",
"{",
"StringPrinter",
"wrapped",
"=",
"new",
"StringPrinter",
"(",
"StringPrinter",
".",
"stringsToLines",
"(",
"perLine",
"->",
"{",
"source",... | Returns a PrintStream which will redirect all of its output to the source PrintStream. If
the trigger string is passed through the wrapped PrintStream, then it will dump the
stack trace of the call that printed the trigger.
@param source
the returned PrintStream will delegate to this stream
@param trigger
the string which triggers a stack dump
@return a PrintStream with the above properties | [
"Returns",
"a",
"PrintStream",
"which",
"will",
"redirect",
"all",
"of",
"its",
"output",
"to",
"the",
"source",
"PrintStream",
".",
"If",
"the",
"trigger",
"string",
"is",
"passed",
"through",
"the",
"wrapped",
"PrintStream",
"then",
"it",
"will",
"dump",
"... | train | https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/StackDumper.java#L98-L106 |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeDecoderBits.java | QrCodeDecoderBits.decodeEci | int decodeEci( PackedBits8 data, int bitLocation ) {
// NOTE: I'm having trouble testing this code. Just finding an encoding which will do ECI is difficult
// almost all use UTF-8 by default and that supports a lot of characters
// number of 1 bits before first 0 define number of additional codewords
int firstByte = data.read(bitLocation,8,true);
bitLocation += 8;
int numCodeWords = 1;
while( (firstByte&(1 << (7-numCodeWords))) != 0 ) {
numCodeWords++;
}
// trip the bits that indicate the number of code words
if( numCodeWords > 1) {
firstByte <<= numCodeWords-1;
firstByte >>= numCodeWords-1;
}
// read the 6-digit designator
int assignmentValue = firstByte;
for (int i = 1; i < numCodeWords; i++) {
assignmentValue <<= 8;
assignmentValue |= data.read(bitLocation,8,true);
bitLocation += 8;
}
encodingEci = getEciCharacterSet(assignmentValue);
return bitLocation;
} | java | int decodeEci( PackedBits8 data, int bitLocation ) {
// NOTE: I'm having trouble testing this code. Just finding an encoding which will do ECI is difficult
// almost all use UTF-8 by default and that supports a lot of characters
// number of 1 bits before first 0 define number of additional codewords
int firstByte = data.read(bitLocation,8,true);
bitLocation += 8;
int numCodeWords = 1;
while( (firstByte&(1 << (7-numCodeWords))) != 0 ) {
numCodeWords++;
}
// trip the bits that indicate the number of code words
if( numCodeWords > 1) {
firstByte <<= numCodeWords-1;
firstByte >>= numCodeWords-1;
}
// read the 6-digit designator
int assignmentValue = firstByte;
for (int i = 1; i < numCodeWords; i++) {
assignmentValue <<= 8;
assignmentValue |= data.read(bitLocation,8,true);
bitLocation += 8;
}
encodingEci = getEciCharacterSet(assignmentValue);
return bitLocation;
} | [
"int",
"decodeEci",
"(",
"PackedBits8",
"data",
",",
"int",
"bitLocation",
")",
"{",
"// NOTE: I'm having trouble testing this code. Just finding an encoding which will do ECI is difficult",
"// almost all use UTF-8 by default and that supports a lot of characters",
"// number of 1 bit... | Decodes Extended Channel Interpretation (ECI) Mode. Allows character set to be changed
@param data encoded data
@return Location it has read up to in bits | [
"Decodes",
"Extended",
"Channel",
"Interpretation",
"(",
"ECI",
")",
"Mode",
".",
"Allows",
"character",
"set",
"to",
"be",
"changed"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeDecoderBits.java#L422-L451 |
termsuite/termsuite-core | src/main/java/fr/univnantes/termsuite/engines/contextualizer/Contextualizer.java | Contextualizer.toAssocRateVector | public void toAssocRateVector(Term t, CrossTable table, AssociationRate assocRateFunction, boolean normalize) {
double assocRate;
for(Entry coterm:t.getContext().getEntries()) {
ContextData contextData = computeContextData(table, t, coterm.getCoTerm());
assocRate = assocRateFunction.getValue(contextData);
t.getContext().setAssocRate(coterm.getCoTerm(), assocRate);
}
if(normalize)
t.getContext().normalize();
} | java | public void toAssocRateVector(Term t, CrossTable table, AssociationRate assocRateFunction, boolean normalize) {
double assocRate;
for(Entry coterm:t.getContext().getEntries()) {
ContextData contextData = computeContextData(table, t, coterm.getCoTerm());
assocRate = assocRateFunction.getValue(contextData);
t.getContext().setAssocRate(coterm.getCoTerm(), assocRate);
}
if(normalize)
t.getContext().normalize();
} | [
"public",
"void",
"toAssocRateVector",
"(",
"Term",
"t",
",",
"CrossTable",
"table",
",",
"AssociationRate",
"assocRateFunction",
",",
"boolean",
"normalize",
")",
"{",
"double",
"assocRate",
";",
"for",
"(",
"Entry",
"coterm",
":",
"t",
".",
"getContext",
"("... | Normalize this vector according to a cross table
and an association rate measure.
This method recomputes all <code>{@link Entry}.frequency</code> values
with the normalized ones.
@param contextVector
@param table
the pre-computed co-occurrences {@link CrossTable}
@param assocRateFunction
the {@link AssociationRate} measure implementation
@param normalize | [
"Normalize",
"this",
"vector",
"according",
"to",
"a",
"cross",
"table",
"and",
"an",
"association",
"rate",
"measure",
"."
] | train | https://github.com/termsuite/termsuite-core/blob/731e5d0bc7c14180713c01a9c7dffe1925f26130/src/main/java/fr/univnantes/termsuite/engines/contextualizer/Contextualizer.java#L165-L175 |
brettwooldridge/SansOrm | src/main/java/com/zaxxer/sansorm/SqlClosureElf.java | SqlClosureElf.numberFromSql | public static Number numberFromSql(String sql, Object... args)
{
return SqlClosure.sqlExecute(c -> numberFromSql(c, sql, args));
} | java | public static Number numberFromSql(String sql, Object... args)
{
return SqlClosure.sqlExecute(c -> numberFromSql(c, sql, args));
} | [
"public",
"static",
"Number",
"numberFromSql",
"(",
"String",
"sql",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"SqlClosure",
".",
"sqlExecute",
"(",
"c",
"->",
"numberFromSql",
"(",
"c",
",",
"sql",
",",
"args",
")",
")",
";",
"}"
] | Get a single Number from a SQL query, useful for getting a COUNT(), SUM(), MIN/MAX(), etc.
from a SQL statement. If the SQL query is parametrized, the parameter values can
be passed in as arguments following the {@code sql} String parameter.
@param sql a SQL statement string
@param args optional values for a parametrized query
@return the resulting number or {@code null} | [
"Get",
"a",
"single",
"Number",
"from",
"a",
"SQL",
"query",
"useful",
"for",
"getting",
"a",
"COUNT",
"()",
"SUM",
"()",
"MIN",
"/",
"MAX",
"()",
"etc",
".",
"from",
"a",
"SQL",
"statement",
".",
"If",
"the",
"SQL",
"query",
"is",
"parametrized",
"t... | train | https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/SqlClosureElf.java#L142-L145 |
apache/incubator-atlas | repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepository.java | GraphBackedMetadataRepository.addTrait | @Override
@GraphTransaction
public void addTrait(String guid, ITypedStruct traitInstance) throws RepositoryException {
Preconditions.checkNotNull(guid, "guid cannot be null");
Preconditions.checkNotNull(traitInstance, "Trait instance cannot be null");
GraphTransactionInterceptor.lockObjectAndReleasePostCommit(guid);
addTraitImpl(guid, traitInstance);
} | java | @Override
@GraphTransaction
public void addTrait(String guid, ITypedStruct traitInstance) throws RepositoryException {
Preconditions.checkNotNull(guid, "guid cannot be null");
Preconditions.checkNotNull(traitInstance, "Trait instance cannot be null");
GraphTransactionInterceptor.lockObjectAndReleasePostCommit(guid);
addTraitImpl(guid, traitInstance);
} | [
"@",
"Override",
"@",
"GraphTransaction",
"public",
"void",
"addTrait",
"(",
"String",
"guid",
",",
"ITypedStruct",
"traitInstance",
")",
"throws",
"RepositoryException",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"guid",
",",
"\"guid cannot be null\"",
")",
";... | Adds a new trait to an existing entity represented by a guid.
@param guid globally unique identifier for the entity
@param traitInstance trait instance that needs to be added to entity
@throws RepositoryException | [
"Adds",
"a",
"new",
"trait",
"to",
"an",
"existing",
"entity",
"represented",
"by",
"a",
"guid",
"."
] | train | https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepository.java#L329-L337 |
foundation-runtime/configuration | configuration-api/src/main/java/com/cisco/oss/foundation/configuration/xml/NamespaceDefinitionMessage.java | NamespaceDefinitionMessage.addDependenciesRecursively | protected void addDependenciesRecursively(Namespace namespace, List<Namespace> namespaceList, String dependencyId, List<String> extendedDependencies) throws XmlException {
if(extendedDependencies.contains(dependencyId)) {
return;
}
if(namespace.getId().equals(dependencyId)) {
throw new XmlException("Circular dependency found in " + namespace.getId());
}
Namespace dependency = find(namespaceList, dependencyId);
extendedDependencies.add(dependency.getId());
for(String indirectDependencyId: dependency.getDirectDependencyIds()) {
addDependenciesRecursively(namespace, namespaceList, indirectDependencyId, extendedDependencies);
}
} | java | protected void addDependenciesRecursively(Namespace namespace, List<Namespace> namespaceList, String dependencyId, List<String> extendedDependencies) throws XmlException {
if(extendedDependencies.contains(dependencyId)) {
return;
}
if(namespace.getId().equals(dependencyId)) {
throw new XmlException("Circular dependency found in " + namespace.getId());
}
Namespace dependency = find(namespaceList, dependencyId);
extendedDependencies.add(dependency.getId());
for(String indirectDependencyId: dependency.getDirectDependencyIds()) {
addDependenciesRecursively(namespace, namespaceList, indirectDependencyId, extendedDependencies);
}
} | [
"protected",
"void",
"addDependenciesRecursively",
"(",
"Namespace",
"namespace",
",",
"List",
"<",
"Namespace",
">",
"namespaceList",
",",
"String",
"dependencyId",
",",
"List",
"<",
"String",
">",
"extendedDependencies",
")",
"throws",
"XmlException",
"{",
"if",
... | Adds dependencyId, and all of it's depdencies recursively using namespaceList, to extendedDependencies for namespace.
@throws XmlException | [
"Adds",
"dependencyId",
"and",
"all",
"of",
"it",
"s",
"depdencies",
"recursively",
"using",
"namespaceList",
"to",
"extendedDependencies",
"for",
"namespace",
"."
] | train | https://github.com/foundation-runtime/configuration/blob/c5bd171a2cca0dc1c8d568f987843ca47c6d1eed/configuration-api/src/main/java/com/cisco/oss/foundation/configuration/xml/NamespaceDefinitionMessage.java#L169-L182 |
alkacon/opencms-core | src/org/opencms/module/CmsModuleUpdater.java | CmsModuleUpdater.readModuleData | public static CmsModuleImportData readModuleData(CmsObject cms, String importFile, I_CmsReport report)
throws CmsException {
CmsModuleImportData result = new CmsModuleImportData();
CmsModule module = CmsModuleImportExportHandler.readModuleFromImport(importFile);
cms = OpenCms.initCmsObject(cms);
String importSite = module.getImportSite();
if (!CmsStringUtil.isEmptyOrWhitespaceOnly(importSite)) {
cms.getRequestContext().setSiteRoot(importSite);
} else {
String siteToSet = cms.getRequestContext().getSiteRoot();
if ("".equals(siteToSet)) {
siteToSet = "/";
}
module.setSite(siteToSet);
}
result.setModule(module);
result.setCms(cms);
CmsImportResourceDataReader importer = new CmsImportResourceDataReader(result);
CmsImportParameters params = new CmsImportParameters(importFile, "/", false);
importer.importData(cms, report, params); // This only reads the module data into Java objects
return result;
} | java | public static CmsModuleImportData readModuleData(CmsObject cms, String importFile, I_CmsReport report)
throws CmsException {
CmsModuleImportData result = new CmsModuleImportData();
CmsModule module = CmsModuleImportExportHandler.readModuleFromImport(importFile);
cms = OpenCms.initCmsObject(cms);
String importSite = module.getImportSite();
if (!CmsStringUtil.isEmptyOrWhitespaceOnly(importSite)) {
cms.getRequestContext().setSiteRoot(importSite);
} else {
String siteToSet = cms.getRequestContext().getSiteRoot();
if ("".equals(siteToSet)) {
siteToSet = "/";
}
module.setSite(siteToSet);
}
result.setModule(module);
result.setCms(cms);
CmsImportResourceDataReader importer = new CmsImportResourceDataReader(result);
CmsImportParameters params = new CmsImportParameters(importFile, "/", false);
importer.importData(cms, report, params); // This only reads the module data into Java objects
return result;
} | [
"public",
"static",
"CmsModuleImportData",
"readModuleData",
"(",
"CmsObject",
"cms",
",",
"String",
"importFile",
",",
"I_CmsReport",
"report",
")",
"throws",
"CmsException",
"{",
"CmsModuleImportData",
"result",
"=",
"new",
"CmsModuleImportData",
"(",
")",
";",
"C... | Reads the module data from an import zip file.<p>
@param cms the CMS context
@param importFile the import file
@param report the report to write to
@return the module data
@throws CmsException if something goes wrong | [
"Reads",
"the",
"module",
"data",
"from",
"an",
"import",
"zip",
"file",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/module/CmsModuleUpdater.java#L209-L233 |
apache/incubator-druid | server/src/main/java/org/apache/druid/segment/realtime/appenderator/StreamAppenderatorDriver.java | StreamAppenderatorDriver.moveSegmentOut | public void moveSegmentOut(final String sequenceName, final List<SegmentIdWithShardSpec> identifiers)
{
synchronized (segments) {
final SegmentsForSequence activeSegmentsForSequence = segments.get(sequenceName);
if (activeSegmentsForSequence == null) {
throw new ISE("WTF?! Asked to remove segments for sequenceName[%s] which doesn't exist...", sequenceName);
}
for (final SegmentIdWithShardSpec identifier : identifiers) {
log.info("Moving segment[%s] out of active list.", identifier);
final long key = identifier.getInterval().getStartMillis();
final SegmentsOfInterval segmentsOfInterval = activeSegmentsForSequence.get(key);
if (segmentsOfInterval == null ||
segmentsOfInterval.getAppendingSegment() == null ||
!segmentsOfInterval.getAppendingSegment().getSegmentIdentifier().equals(identifier)) {
throw new ISE("WTF?! Asked to remove segment[%s] that didn't exist...", identifier);
}
segmentsOfInterval.finishAppendingToCurrentActiveSegment(SegmentWithState::finishAppending);
}
}
} | java | public void moveSegmentOut(final String sequenceName, final List<SegmentIdWithShardSpec> identifiers)
{
synchronized (segments) {
final SegmentsForSequence activeSegmentsForSequence = segments.get(sequenceName);
if (activeSegmentsForSequence == null) {
throw new ISE("WTF?! Asked to remove segments for sequenceName[%s] which doesn't exist...", sequenceName);
}
for (final SegmentIdWithShardSpec identifier : identifiers) {
log.info("Moving segment[%s] out of active list.", identifier);
final long key = identifier.getInterval().getStartMillis();
final SegmentsOfInterval segmentsOfInterval = activeSegmentsForSequence.get(key);
if (segmentsOfInterval == null ||
segmentsOfInterval.getAppendingSegment() == null ||
!segmentsOfInterval.getAppendingSegment().getSegmentIdentifier().equals(identifier)) {
throw new ISE("WTF?! Asked to remove segment[%s] that didn't exist...", identifier);
}
segmentsOfInterval.finishAppendingToCurrentActiveSegment(SegmentWithState::finishAppending);
}
}
} | [
"public",
"void",
"moveSegmentOut",
"(",
"final",
"String",
"sequenceName",
",",
"final",
"List",
"<",
"SegmentIdWithShardSpec",
">",
"identifiers",
")",
"{",
"synchronized",
"(",
"segments",
")",
"{",
"final",
"SegmentsForSequence",
"activeSegmentsForSequence",
"=",
... | Move a set of identifiers out from "active", making way for newer segments.
This method is to support KafkaIndexTask's legacy mode and will be removed in the future.
See KakfaIndexTask.runLegacy(). | [
"Move",
"a",
"set",
"of",
"identifiers",
"out",
"from",
"active",
"making",
"way",
"for",
"newer",
"segments",
".",
"This",
"method",
"is",
"to",
"support",
"KafkaIndexTask",
"s",
"legacy",
"mode",
"and",
"will",
"be",
"removed",
"in",
"the",
"future",
"."... | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/segment/realtime/appenderator/StreamAppenderatorDriver.java#L188-L208 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/MediaApi.java | MediaApi.setComment | public ApiSuccessResponse setComment(String mediatype, String id, AddCommentData addCommentData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = setCommentWithHttpInfo(mediatype, id, addCommentData);
return resp.getData();
} | java | public ApiSuccessResponse setComment(String mediatype, String id, AddCommentData addCommentData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = setCommentWithHttpInfo(mediatype, id, addCommentData);
return resp.getData();
} | [
"public",
"ApiSuccessResponse",
"setComment",
"(",
"String",
"mediatype",
",",
"String",
"id",
",",
"AddCommentData",
"addCommentData",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"ApiSuccessResponse",
">",
"resp",
"=",
"setCommentWithHttpInfo",
"(",
"medi... | Set a comment
Set a comment on the specified interaction. If a comment already exists, it's overridden.
@param mediatype The media channel. (required)
@param id The ID of the interaction. (required)
@param addCommentData (required)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Set",
"a",
"comment",
"Set",
"a",
"comment",
"on",
"the",
"specified",
"interaction",
".",
"If",
"a",
"comment",
"already",
"exists",
"it'",
";",
"s",
"overridden",
"."
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/MediaApi.java#L4057-L4060 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.