repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 188 | func_name stringlengths 7 127 | whole_func_string stringlengths 77 3.91k | language stringclasses 1
value | func_code_string stringlengths 77 3.91k | func_code_tokens listlengths 20 745 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 477 | split_name stringclasses 1
value | func_code_url stringlengths 111 288 |
|---|---|---|---|---|---|---|---|---|---|---|
h2oai/h2o-3 | h2o-core/src/main/java/hex/Distribution.java | Distribution.gammaDenom | public double gammaDenom(double w, double y, double z, double f) {
switch (distribution) {
case gaussian:
case gamma:
return w;
case bernoulli:
case quasibinomial:
double ff = y-z;
return w * ff*(1-ff);
case multinomial:
double absz = Math.abs(z);
return w * (absz*(1-absz));
case poisson:
return w * (y-z); //y-z == exp(f)
case tweedie:
return w * exp(f*(2- tweediePower));
case modified_huber:
double yf = (2*y-1)*f;
if (yf < -1) return -w*4*yf;
else if (yf > 1) return 0;
else return w*(1-yf)*(1-yf);
default:
throw H2O.unimpl();
}
} | java | public double gammaDenom(double w, double y, double z, double f) {
switch (distribution) {
case gaussian:
case gamma:
return w;
case bernoulli:
case quasibinomial:
double ff = y-z;
return w * ff*(1-ff);
case multinomial:
double absz = Math.abs(z);
return w * (absz*(1-absz));
case poisson:
return w * (y-z); //y-z == exp(f)
case tweedie:
return w * exp(f*(2- tweediePower));
case modified_huber:
double yf = (2*y-1)*f;
if (yf < -1) return -w*4*yf;
else if (yf > 1) return 0;
else return w*(1-yf)*(1-yf);
default:
throw H2O.unimpl();
}
} | [
"public",
"double",
"gammaDenom",
"(",
"double",
"w",
",",
"double",
"y",
",",
"double",
"z",
",",
"double",
"f",
")",
"{",
"switch",
"(",
"distribution",
")",
"{",
"case",
"gaussian",
":",
"case",
"gamma",
":",
"return",
"w",
";",
"case",
"bernoulli",... | Contribution to denominator for GBM's leaf node prediction
@param w weight
@param y response
@param z residual
@param f predicted value (including offset)
@return weighted contribution to denominator | [
"Contribution",
"to",
"denominator",
"for",
"GBM",
"s",
"leaf",
"node",
"prediction"
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/hex/Distribution.java#L291-L315 |
foundation-runtime/service-directory | 2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/config/ServiceDirectoryConfig.java | ServiceDirectoryConfig.getBoolean | public boolean getBoolean(String name, boolean defaultVal){
if(this.configuration.containsKey(name)){
return this.configuration.getBoolean(name);
} else {
return defaultVal;
}
} | java | public boolean getBoolean(String name, boolean defaultVal){
if(this.configuration.containsKey(name)){
return this.configuration.getBoolean(name);
} else {
return defaultVal;
}
} | [
"public",
"boolean",
"getBoolean",
"(",
"String",
"name",
",",
"boolean",
"defaultVal",
")",
"{",
"if",
"(",
"this",
".",
"configuration",
".",
"containsKey",
"(",
"name",
")",
")",
"{",
"return",
"this",
".",
"configuration",
".",
"getBoolean",
"(",
"name... | Get the property object as Boolean, or return defaultVal if property is not defined.
@param name
property name.
@param defaultVal
default property value.
@return
property value as boolean, return defaultVal if property is undefined. | [
"Get",
"the",
"property",
"object",
"as",
"Boolean",
"or",
"return",
"defaultVal",
"if",
"property",
"is",
"not",
"defined",
"."
] | train | https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/config/ServiceDirectoryConfig.java#L117-L123 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java | ComputeNodeOperations.updateComputeNodeUser | private void updateComputeNodeUser(String poolId, String nodeId, String userName, NodeUpdateUserParameter nodeUpdateUserParameter, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
ComputeNodeUpdateUserOptions options = new ComputeNodeUpdateUserOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
this.parentBatchClient.protocolLayer().computeNodes().updateUser(poolId, nodeId, userName, nodeUpdateUserParameter, options);
} | java | private void updateComputeNodeUser(String poolId, String nodeId, String userName, NodeUpdateUserParameter nodeUpdateUserParameter, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
ComputeNodeUpdateUserOptions options = new ComputeNodeUpdateUserOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
this.parentBatchClient.protocolLayer().computeNodes().updateUser(poolId, nodeId, userName, nodeUpdateUserParameter, options);
} | [
"private",
"void",
"updateComputeNodeUser",
"(",
"String",
"poolId",
",",
"String",
"nodeId",
",",
"String",
"userName",
",",
"NodeUpdateUserParameter",
"nodeUpdateUserParameter",
",",
"Iterable",
"<",
"BatchClientBehavior",
">",
"additionalBehaviors",
")",
"throws",
"B... | Updates the specified user account on the specified compute node.
@param poolId The ID of the pool that contains the compute node.
@param nodeId The ID of the compute node where the user account will be updated.
@param userName The name of the user account to update.
@param nodeUpdateUserParameter The set of changes to be made to the user account.
@param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request.
@throws BatchErrorException Exception thrown when an error response is received from the Batch service.
@throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. | [
"Updates",
"the",
"specified",
"user",
"account",
"on",
"the",
"specified",
"compute",
"node",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java#L213-L219 |
pravega/pravega | common/src/main/java/io/pravega/common/util/ByteArraySegment.java | ByteArraySegment.copyFrom | public void copyFrom(ByteArraySegment source, int targetOffset, int length) {
Preconditions.checkState(!this.readOnly, "Cannot modify a read-only ByteArraySegment.");
Exceptions.checkArrayRange(targetOffset, length, this.length, "index", "values.length");
Preconditions.checkElementIndex(length, source.getLength() + 1, "length");
System.arraycopy(source.array, source.startOffset, this.array, targetOffset + this.startOffset, length);
} | java | public void copyFrom(ByteArraySegment source, int targetOffset, int length) {
Preconditions.checkState(!this.readOnly, "Cannot modify a read-only ByteArraySegment.");
Exceptions.checkArrayRange(targetOffset, length, this.length, "index", "values.length");
Preconditions.checkElementIndex(length, source.getLength() + 1, "length");
System.arraycopy(source.array, source.startOffset, this.array, targetOffset + this.startOffset, length);
} | [
"public",
"void",
"copyFrom",
"(",
"ByteArraySegment",
"source",
",",
"int",
"targetOffset",
",",
"int",
"length",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"!",
"this",
".",
"readOnly",
",",
"\"Cannot modify a read-only ByteArraySegment.\"",
")",
";",
"E... | Copies a specified number of bytes from the given ByteArraySegment into this ByteArraySegment.
@param source The ByteArraySegment to copy bytes from.
@param targetOffset The offset within this ByteArraySegment to start copying at.
@param length The number of bytes to copy.
@throws IllegalStateException If the ByteArraySegment is readonly.
@throws ArrayIndexOutOfBoundsException If targetOffset or length are invalid. | [
"Copies",
"a",
"specified",
"number",
"of",
"bytes",
"from",
"the",
"given",
"ByteArraySegment",
"into",
"this",
"ByteArraySegment",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/ByteArraySegment.java#L180-L186 |
javamelody/javamelody | javamelody-core/src/main/java/net/bull/javamelody/MonitoringProxy.java | MonitoringProxy.createProxy | public static <T> T createProxy(T facade, String name) {
return createProxy(facade, new MonitoringProxy(facade, name));
} | java | public static <T> T createProxy(T facade, String name) {
return createProxy(facade, new MonitoringProxy(facade, name));
} | [
"public",
"static",
"<",
"T",
">",
"T",
"createProxy",
"(",
"T",
"facade",
",",
"String",
"name",
")",
"{",
"return",
"createProxy",
"(",
"facade",
",",
"new",
"MonitoringProxy",
"(",
"facade",
",",
"name",
")",
")",
";",
"}"
] | Création d'un proxy de monitoring pour une façade, en spécifiant le nom qui sera affiché dans le monitoring.
@param <T> Type de la façade (une interface en général).
@param facade Instance de la façade
@param name override of the interface name in the statistics
@return Proxy de la façade | [
"Création",
"d",
"un",
"proxy",
"de",
"monitoring",
"pour",
"une",
"façade",
"en",
"spécifiant",
"le",
"nom",
"qui",
"sera",
"affiché",
"dans",
"le",
"monitoring",
"."
] | train | https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-core/src/main/java/net/bull/javamelody/MonitoringProxy.java#L116-L118 |
OwlPlatform/java-owl-worldmodel | src/main/java/com/owlplatform/worldmodel/client/ClientWorldConnection.java | ClientWorldConnection.getStreamRequest | public synchronized StepResponse getStreamRequest(final String idRegex,
final long start, final long interval, String... attributes) {
StreamRequestMessage req = new StreamRequestMessage();
req.setIdRegex(idRegex);
req.setBeginTimestamp(start);
req.setUpdateInterval(interval);
if (attributes != null) {
req.setAttributeRegexes(attributes);
}
StepResponse resp = new StepResponse(this, 0);
try {
while (!this.isReady) {
log.debug("Trying to wait until connection is ready.");
synchronized (this) {
try {
this.wait();
} catch (InterruptedException ie) {
// Ignored
}
}
}
long reqId = this.wmi.sendMessage(req);
resp.setTicketNumber(reqId);
this.outstandingSteps.put(Long.valueOf(reqId), resp);
return resp;
} catch (Exception e) {
resp.setError(e);
return resp;
}
} | java | public synchronized StepResponse getStreamRequest(final String idRegex,
final long start, final long interval, String... attributes) {
StreamRequestMessage req = new StreamRequestMessage();
req.setIdRegex(idRegex);
req.setBeginTimestamp(start);
req.setUpdateInterval(interval);
if (attributes != null) {
req.setAttributeRegexes(attributes);
}
StepResponse resp = new StepResponse(this, 0);
try {
while (!this.isReady) {
log.debug("Trying to wait until connection is ready.");
synchronized (this) {
try {
this.wait();
} catch (InterruptedException ie) {
// Ignored
}
}
}
long reqId = this.wmi.sendMessage(req);
resp.setTicketNumber(reqId);
this.outstandingSteps.put(Long.valueOf(reqId), resp);
return resp;
} catch (Exception e) {
resp.setError(e);
return resp;
}
} | [
"public",
"synchronized",
"StepResponse",
"getStreamRequest",
"(",
"final",
"String",
"idRegex",
",",
"final",
"long",
"start",
",",
"final",
"long",
"interval",
",",
"String",
"...",
"attributes",
")",
"{",
"StreamRequestMessage",
"req",
"=",
"new",
"StreamReques... | Sends a stream request to the world model for the specified identifier and
attribute regular expressions, beginning with data at time {@code start},
and updating no more frequently than every {@code interval} milliseconds.
@param idRegex
the regular expression for matching identifiers
@param start
the earliest data to stream.
@param interval
the minimum time between attribute value updates.
@param attributes
the attribute regular expressions to match.
@return a {@code StepResponse} for the request. | [
"Sends",
"a",
"stream",
"request",
"to",
"the",
"world",
"model",
"for",
"the",
"specified",
"identifier",
"and",
"attribute",
"regular",
"expressions",
"beginning",
"with",
"data",
"at",
"time",
"{",
"@code",
"start",
"}",
"and",
"updating",
"no",
"more",
"... | train | https://github.com/OwlPlatform/java-owl-worldmodel/blob/a850e8b930c6e9787c7cad30c0de887858ca563d/src/main/java/com/owlplatform/worldmodel/client/ClientWorldConnection.java#L396-L427 |
alkacon/opencms-core | src/org/opencms/workplace/CmsWorkplaceManager.java | CmsWorkplaceManager.checkWorkplaceRequest | public void checkWorkplaceRequest(HttpServletRequest request, CmsObject cms) {
try {
if ((OpenCms.getSiteManager().getSites().size() > 1)
&& !OpenCms.getSiteManager().isWorkplaceRequest(request)) {
// this is a multi site-configuration, but not a request to the configured Workplace site
CmsUser user = cms.getRequestContext().getCurrentUser();
// to limit the number of times broadcast is called for a user, we use an expiring cache
// with the user name as key
if (null == m_workplaceServerUserChecks.getIfPresent(user.getName())) {
m_workplaceServerUserChecks.put(user.getName(), "");
OpenCms.getSessionManager().sendBroadcast(
null,
Messages.get().getBundle(getWorkplaceLocale(cms)).key(
Messages.ERR_WORKPLACE_SERVER_CHECK_FAILED_0),
user);
}
}
} catch (Exception e) {
LOG.error(e.getLocalizedMessage(), e);
}
} | java | public void checkWorkplaceRequest(HttpServletRequest request, CmsObject cms) {
try {
if ((OpenCms.getSiteManager().getSites().size() > 1)
&& !OpenCms.getSiteManager().isWorkplaceRequest(request)) {
// this is a multi site-configuration, but not a request to the configured Workplace site
CmsUser user = cms.getRequestContext().getCurrentUser();
// to limit the number of times broadcast is called for a user, we use an expiring cache
// with the user name as key
if (null == m_workplaceServerUserChecks.getIfPresent(user.getName())) {
m_workplaceServerUserChecks.put(user.getName(), "");
OpenCms.getSessionManager().sendBroadcast(
null,
Messages.get().getBundle(getWorkplaceLocale(cms)).key(
Messages.ERR_WORKPLACE_SERVER_CHECK_FAILED_0),
user);
}
}
} catch (Exception e) {
LOG.error(e.getLocalizedMessage(), e);
}
} | [
"public",
"void",
"checkWorkplaceRequest",
"(",
"HttpServletRequest",
"request",
",",
"CmsObject",
"cms",
")",
"{",
"try",
"{",
"if",
"(",
"(",
"OpenCms",
".",
"getSiteManager",
"(",
")",
".",
"getSites",
"(",
")",
".",
"size",
"(",
")",
">",
"1",
")",
... | Checks whether the workplace is accessed through the workplace server, and sends an error message otherwise.<p>
@param request the request to check
@param cms the CmsObject to use | [
"Checks",
"whether",
"the",
"workplace",
"is",
"accessed",
"through",
"the",
"workplace",
"server",
"and",
"sends",
"an",
"error",
"message",
"otherwise",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsWorkplaceManager.java#L675-L699 |
ehcache/ehcache3 | clustered/server/src/main/java/org/ehcache/clustered/server/management/ClusterTierManagement.java | ClusterTierManagement.init | private void init() {
ServerSideServerStore serverStore = ehcacheStateService.getStore(storeIdentifier);
ServerStoreBinding serverStoreBinding = new ServerStoreBinding(storeIdentifier, serverStore);
CompletableFuture<Void> r1 = managementRegistry.register(serverStoreBinding);
ServerSideConfiguration.Pool pool = ehcacheStateService.getDedicatedResourcePool(storeIdentifier);
CompletableFuture<Void> allOf;
if (pool != null) {
allOf = CompletableFuture.allOf(r1, managementRegistry.register(new PoolBinding(storeIdentifier, pool, PoolBinding.AllocationType.DEDICATED)));
} else {
allOf = r1;
}
allOf.thenRun(() -> {
managementRegistry.refresh();
managementRegistry.pushServerEntityNotification(serverStoreBinding, EHCACHE_SERVER_STORE_CREATED.name());
});
} | java | private void init() {
ServerSideServerStore serverStore = ehcacheStateService.getStore(storeIdentifier);
ServerStoreBinding serverStoreBinding = new ServerStoreBinding(storeIdentifier, serverStore);
CompletableFuture<Void> r1 = managementRegistry.register(serverStoreBinding);
ServerSideConfiguration.Pool pool = ehcacheStateService.getDedicatedResourcePool(storeIdentifier);
CompletableFuture<Void> allOf;
if (pool != null) {
allOf = CompletableFuture.allOf(r1, managementRegistry.register(new PoolBinding(storeIdentifier, pool, PoolBinding.AllocationType.DEDICATED)));
} else {
allOf = r1;
}
allOf.thenRun(() -> {
managementRegistry.refresh();
managementRegistry.pushServerEntityNotification(serverStoreBinding, EHCACHE_SERVER_STORE_CREATED.name());
});
} | [
"private",
"void",
"init",
"(",
")",
"{",
"ServerSideServerStore",
"serverStore",
"=",
"ehcacheStateService",
".",
"getStore",
"(",
"storeIdentifier",
")",
";",
"ServerStoreBinding",
"serverStoreBinding",
"=",
"new",
"ServerStoreBinding",
"(",
"storeIdentifier",
",",
... | the goal of the following code is to send the management metadata from the entity into the monitoring tree AFTER the entity creation | [
"the",
"goal",
"of",
"the",
"following",
"code",
"is",
"to",
"send",
"the",
"management",
"metadata",
"from",
"the",
"entity",
"into",
"the",
"monitoring",
"tree",
"AFTER",
"the",
"entity",
"creation"
] | train | https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/clustered/server/src/main/java/org/ehcache/clustered/server/management/ClusterTierManagement.java#L91-L106 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/zookeeper/ZooKeeperStateHandleStore.java | ZooKeeperStateHandleStore.releaseAndTryRemoveAll | public void releaseAndTryRemoveAll() throws Exception {
Collection<String> children = getAllPaths();
Exception exception = null;
for (String child : children) {
try {
releaseAndTryRemove('/' + child);
} catch (Exception e) {
exception = ExceptionUtils.firstOrSuppressed(e, exception);
}
}
if (exception != null) {
throw new Exception("Could not properly release and try removing all state nodes.", exception);
}
} | java | public void releaseAndTryRemoveAll() throws Exception {
Collection<String> children = getAllPaths();
Exception exception = null;
for (String child : children) {
try {
releaseAndTryRemove('/' + child);
} catch (Exception e) {
exception = ExceptionUtils.firstOrSuppressed(e, exception);
}
}
if (exception != null) {
throw new Exception("Could not properly release and try removing all state nodes.", exception);
}
} | [
"public",
"void",
"releaseAndTryRemoveAll",
"(",
")",
"throws",
"Exception",
"{",
"Collection",
"<",
"String",
">",
"children",
"=",
"getAllPaths",
"(",
")",
";",
"Exception",
"exception",
"=",
"null",
";",
"for",
"(",
"String",
"child",
":",
"children",
")"... | Releases all lock nodes of this ZooKeeperStateHandleStores and tries to remove all state nodes which
are not locked anymore.
<p>The delete operation is executed asynchronously
@throws Exception if the delete operation fails | [
"Releases",
"all",
"lock",
"nodes",
"of",
"this",
"ZooKeeperStateHandleStores",
"and",
"tries",
"to",
"remove",
"all",
"state",
"nodes",
"which",
"are",
"not",
"locked",
"anymore",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/zookeeper/ZooKeeperStateHandleStore.java#L369-L385 |
meltmedia/cadmium | servlets/src/main/java/com/meltmedia/cadmium/servlets/BasicFileServlet.java | BasicFileServlet.copyPartialContent | public static void copyPartialContent(InputStream in, OutputStream out, Range r) throws IOException {
IOUtils.copyLarge(in, out, r.start, r.length);
} | java | public static void copyPartialContent(InputStream in, OutputStream out, Range r) throws IOException {
IOUtils.copyLarge(in, out, r.start, r.length);
} | [
"public",
"static",
"void",
"copyPartialContent",
"(",
"InputStream",
"in",
",",
"OutputStream",
"out",
",",
"Range",
"r",
")",
"throws",
"IOException",
"{",
"IOUtils",
".",
"copyLarge",
"(",
"in",
",",
"out",
",",
"r",
".",
"start",
",",
"r",
".",
"leng... | Copies the given range of bytes from the input stream to the output stream.
@param in
@param out
@param r
@throws IOException | [
"Copies",
"the",
"given",
"range",
"of",
"bytes",
"from",
"the",
"input",
"stream",
"to",
"the",
"output",
"stream",
"."
] | train | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/servlets/src/main/java/com/meltmedia/cadmium/servlets/BasicFileServlet.java#L225-L227 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/util/GwtEventUtil.java | GwtEventUtil.getPosition | public static Coordinate getPosition(MouseEvent<?> event, int offsetX, int offsetY) {
return new Coordinate(event.getX() + offsetX, event.getY() + offsetY);
} | java | public static Coordinate getPosition(MouseEvent<?> event, int offsetX, int offsetY) {
return new Coordinate(event.getX() + offsetX, event.getY() + offsetY);
} | [
"public",
"static",
"Coordinate",
"getPosition",
"(",
"MouseEvent",
"<",
"?",
">",
"event",
",",
"int",
"offsetX",
",",
"int",
"offsetY",
")",
"{",
"return",
"new",
"Coordinate",
"(",
"event",
".",
"getX",
"(",
")",
"+",
"offsetX",
",",
"event",
".",
"... | Get the position of a mouse event.
@param event
The mouse event itself.
@param offsetX
An extra value to be added to the X axis.
@param offsetY
An extra value to be added to the Y axis.
@return Returns a coordinate holding the event's X and Y ordinate, where the origin is the upper left corner of
the DOM element catching the event. If used in a
{@link org.geomajas.gwt.client.controller.GraphicsController}, these are screen coordinates. | [
"Get",
"the",
"position",
"of",
"a",
"mouse",
"event",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/util/GwtEventUtil.java#L65-L67 |
percolate/caffeine | caffeine/src/main/java/com/percolate/caffeine/ToastUtils.java | ToastUtils.quickToast | public static Toast quickToast(Context context, String message, boolean longLength) {
final Toast toast;
if (longLength) {
toast = Toast.makeText(context, message, Toast.LENGTH_LONG);
} else {
toast = Toast.makeText(context, message, Toast.LENGTH_SHORT);
}
toast.show();
return toast;
} | java | public static Toast quickToast(Context context, String message, boolean longLength) {
final Toast toast;
if (longLength) {
toast = Toast.makeText(context, message, Toast.LENGTH_LONG);
} else {
toast = Toast.makeText(context, message, Toast.LENGTH_SHORT);
}
toast.show();
return toast;
} | [
"public",
"static",
"Toast",
"quickToast",
"(",
"Context",
"context",
",",
"String",
"message",
",",
"boolean",
"longLength",
")",
"{",
"final",
"Toast",
"toast",
";",
"if",
"(",
"longLength",
")",
"{",
"toast",
"=",
"Toast",
".",
"makeText",
"(",
"context... | Display a toast with the given message.
@param context The current Context or Activity that this method is called from
@param message Message to display
@param longLength if true, will use Toast.LENGTH_LONG (approx 3.5 sec) instead of
@return Toast object that is being displayed. Note,show() has already been called on this object. | [
"Display",
"a",
"toast",
"with",
"the",
"given",
"message",
"."
] | train | https://github.com/percolate/caffeine/blob/e2265cab474a6397f4d75b1ed928c356a7b9672e/caffeine/src/main/java/com/percolate/caffeine/ToastUtils.java#L33-L42 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/JobConfigurationUtils.java | JobConfigurationUtils.putPropertiesIntoConfiguration | public static void putPropertiesIntoConfiguration(Properties properties, Configuration configuration) {
for (String name : properties.stringPropertyNames()) {
configuration.set(name, properties.getProperty(name));
}
} | java | public static void putPropertiesIntoConfiguration(Properties properties, Configuration configuration) {
for (String name : properties.stringPropertyNames()) {
configuration.set(name, properties.getProperty(name));
}
} | [
"public",
"static",
"void",
"putPropertiesIntoConfiguration",
"(",
"Properties",
"properties",
",",
"Configuration",
"configuration",
")",
"{",
"for",
"(",
"String",
"name",
":",
"properties",
".",
"stringPropertyNames",
"(",
")",
")",
"{",
"configuration",
".",
"... | Put all configuration properties in a given {@link Properties} object into a given
{@link Configuration} object.
@param properties the given {@link Properties} object
@param configuration the given {@link Configuration} object | [
"Put",
"all",
"configuration",
"properties",
"in",
"a",
"given",
"{",
"@link",
"Properties",
"}",
"object",
"into",
"a",
"given",
"{",
"@link",
"Configuration",
"}",
"object",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/JobConfigurationUtils.java#L66-L70 |
mikepenz/FastAdapter | app/src/main/java/com/mikepenz/fastadapter/app/helpers/CustomStickyRecyclerHeadersDecoration.java | CustomStickyRecyclerHeadersDecoration.findHeaderPositionUnder | public int findHeaderPositionUnder(int x, int y) {
for (int i = 0; i < mHeaderRects.size(); i++) {
Rect rect = mHeaderRects.get(mHeaderRects.keyAt(i));
if (rect.contains(x, y)) {
return mHeaderRects.keyAt(i);
}
}
return -1;
} | java | public int findHeaderPositionUnder(int x, int y) {
for (int i = 0; i < mHeaderRects.size(); i++) {
Rect rect = mHeaderRects.get(mHeaderRects.keyAt(i));
if (rect.contains(x, y)) {
return mHeaderRects.keyAt(i);
}
}
return -1;
} | [
"public",
"int",
"findHeaderPositionUnder",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"mHeaderRects",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"Rect",
"rect",
"=",
"mHeaderRects",
".",
"g... | Gets the position of the header under the specified (x, y) coordinates.
@param x x-coordinate
@param y y-coordinate
@return position of header, or -1 if not found | [
"Gets",
"the",
"position",
"of",
"the",
"header",
"under",
"the",
"specified",
"(",
"x",
"y",
")",
"coordinates",
"."
] | train | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/app/src/main/java/com/mikepenz/fastadapter/app/helpers/CustomStickyRecyclerHeadersDecoration.java#L134-L142 |
BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/menu/MenuFlyoutExample.java | MenuFlyoutExample.buildMenu | private WMenu buildMenu(final WText selectedMenuText) {
WMenu menu = new WMenu(WMenu.MenuType.FLYOUT);
// The Colours menu just shows simple text
WSubMenu colourMenu = new WSubMenu("Colours");
addMenuItem(colourMenu, "Red", selectedMenuText);
addMenuItem(colourMenu, "Green", selectedMenuText);
addMenuItem(colourMenu, "Blue", selectedMenuText);
colourMenu.addSeparator();
colourMenu.add(new WMenuItem("Disable colour menu", new ToggleDisabledAction(colourMenu)));
menu.add(colourMenu);
// The Shapes menu shows grouping of items
WSubMenu shapeMenu = new WSubMenu("Shapes");
addMenuItem(shapeMenu, "Circle", selectedMenuText);
WMenuItemGroup triangleGroup = new WMenuItemGroup("Triangles");
shapeMenu.add(triangleGroup);
addMenuItem(triangleGroup, "Equilateral", selectedMenuText);
addMenuItem(triangleGroup, "Isosceles", selectedMenuText);
addMenuItem(triangleGroup, "Scalene", selectedMenuText);
addMenuItem(triangleGroup, "Right-angled", selectedMenuText);
addMenuItem(triangleGroup, "Obtuse", selectedMenuText);
WMenuItemGroup quadGroup = new WMenuItemGroup("Quadrilaterals");
shapeMenu.add(quadGroup);
addMenuItem(quadGroup, "Square", selectedMenuText);
addMenuItem(quadGroup, "Rectangle", selectedMenuText);
addMenuItem(quadGroup, "Rhombus", selectedMenuText);
addMenuItem(quadGroup, "Trapezoid", selectedMenuText);
addMenuItem(quadGroup, "Parallelogram", selectedMenuText);
shapeMenu.addSeparator();
shapeMenu.add(new WMenuItem("Disable shape menu", new ToggleDisabledAction(shapeMenu)));
menu.add(shapeMenu);
// The Image menu shows use of decorated labels and images
WSubMenu imageMenu = new WSubMenu("Images");
imageMenu.add(createImageMenuItem("/image/flag.png", "Flag", "eg-menu-image-1",
selectedMenuText));
imageMenu.add(createImageMenuItem("/image/attachment.png", "Attachment", "eg-menu-image-2",
selectedMenuText));
imageMenu.add(createImageMenuItem("/image/settings.png", "Settings", "eg-menu-image-3",
selectedMenuText));
imageMenu.addSeparator();
imageMenu.add(new WMenuItem("Disable image menu", new ToggleDisabledAction(imageMenu)));
menu.add(imageMenu);
WSubMenu sitesMenu = new WSubMenu("External apps");
sitesMenu.add(new WMenuItem("Example website", "http://www.example.com/"));
WMenuItem google = new WMenuItem("Example (new window)", "http://www.example.com/");
google.setTargetWindow("exampleWindow");
sitesMenu.add(google);
menu.add(sitesMenu);
// Add an item to toggle the states of all the menus
menu.add(new WMenuItem("Toggle top-level menus", new ToggleDisabledAction(colourMenu,
shapeMenu, imageMenu,
sitesMenu)));
menu.add(new WMenuItem("Link", "http://www.example.com"));
menu.add(new WMenuItem("No Action"));
return menu;
} | java | private WMenu buildMenu(final WText selectedMenuText) {
WMenu menu = new WMenu(WMenu.MenuType.FLYOUT);
// The Colours menu just shows simple text
WSubMenu colourMenu = new WSubMenu("Colours");
addMenuItem(colourMenu, "Red", selectedMenuText);
addMenuItem(colourMenu, "Green", selectedMenuText);
addMenuItem(colourMenu, "Blue", selectedMenuText);
colourMenu.addSeparator();
colourMenu.add(new WMenuItem("Disable colour menu", new ToggleDisabledAction(colourMenu)));
menu.add(colourMenu);
// The Shapes menu shows grouping of items
WSubMenu shapeMenu = new WSubMenu("Shapes");
addMenuItem(shapeMenu, "Circle", selectedMenuText);
WMenuItemGroup triangleGroup = new WMenuItemGroup("Triangles");
shapeMenu.add(triangleGroup);
addMenuItem(triangleGroup, "Equilateral", selectedMenuText);
addMenuItem(triangleGroup, "Isosceles", selectedMenuText);
addMenuItem(triangleGroup, "Scalene", selectedMenuText);
addMenuItem(triangleGroup, "Right-angled", selectedMenuText);
addMenuItem(triangleGroup, "Obtuse", selectedMenuText);
WMenuItemGroup quadGroup = new WMenuItemGroup("Quadrilaterals");
shapeMenu.add(quadGroup);
addMenuItem(quadGroup, "Square", selectedMenuText);
addMenuItem(quadGroup, "Rectangle", selectedMenuText);
addMenuItem(quadGroup, "Rhombus", selectedMenuText);
addMenuItem(quadGroup, "Trapezoid", selectedMenuText);
addMenuItem(quadGroup, "Parallelogram", selectedMenuText);
shapeMenu.addSeparator();
shapeMenu.add(new WMenuItem("Disable shape menu", new ToggleDisabledAction(shapeMenu)));
menu.add(shapeMenu);
// The Image menu shows use of decorated labels and images
WSubMenu imageMenu = new WSubMenu("Images");
imageMenu.add(createImageMenuItem("/image/flag.png", "Flag", "eg-menu-image-1",
selectedMenuText));
imageMenu.add(createImageMenuItem("/image/attachment.png", "Attachment", "eg-menu-image-2",
selectedMenuText));
imageMenu.add(createImageMenuItem("/image/settings.png", "Settings", "eg-menu-image-3",
selectedMenuText));
imageMenu.addSeparator();
imageMenu.add(new WMenuItem("Disable image menu", new ToggleDisabledAction(imageMenu)));
menu.add(imageMenu);
WSubMenu sitesMenu = new WSubMenu("External apps");
sitesMenu.add(new WMenuItem("Example website", "http://www.example.com/"));
WMenuItem google = new WMenuItem("Example (new window)", "http://www.example.com/");
google.setTargetWindow("exampleWindow");
sitesMenu.add(google);
menu.add(sitesMenu);
// Add an item to toggle the states of all the menus
menu.add(new WMenuItem("Toggle top-level menus", new ToggleDisabledAction(colourMenu,
shapeMenu, imageMenu,
sitesMenu)));
menu.add(new WMenuItem("Link", "http://www.example.com"));
menu.add(new WMenuItem("No Action"));
return menu;
} | [
"private",
"WMenu",
"buildMenu",
"(",
"final",
"WText",
"selectedMenuText",
")",
"{",
"WMenu",
"menu",
"=",
"new",
"WMenu",
"(",
"WMenu",
".",
"MenuType",
".",
"FLYOUT",
")",
";",
"// The Colours menu just shows simple text",
"WSubMenu",
"colourMenu",
"=",
"new",
... | Builds up a menu bar for inclusion in the example.
@param selectedMenuText the WText to display the selected menu item.
@return a menu for the example. | [
"Builds",
"up",
"a",
"menu",
"bar",
"for",
"inclusion",
"in",
"the",
"example",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/menu/MenuFlyoutExample.java#L64-L129 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/taglib/el/EvalHelper.java | EvalHelper.evalBoolean | public static Boolean evalBoolean(String propertyName, String propertyValue, Tag tag, PageContext pageContext) throws JspException{
return (Boolean) ExpressionEvaluatorManager.evaluate(propertyName,
propertyValue, Boolean.class, tag, pageContext);
} | java | public static Boolean evalBoolean(String propertyName, String propertyValue, Tag tag, PageContext pageContext) throws JspException{
return (Boolean) ExpressionEvaluatorManager.evaluate(propertyName,
propertyValue, Boolean.class, tag, pageContext);
} | [
"public",
"static",
"Boolean",
"evalBoolean",
"(",
"String",
"propertyName",
",",
"String",
"propertyValue",
",",
"Tag",
"tag",
",",
"PageContext",
"pageContext",
")",
"throws",
"JspException",
"{",
"return",
"(",
"Boolean",
")",
"ExpressionEvaluatorManager",
".",
... | Evaluate the boolean EL expression passed as parameter
@param propertyName the property name
@param propertyValue the property value
@param tag the tag
@param pageContext the page context
@return the value corresponding to the EL expression passed as parameter
@throws JspException if an exception occurs | [
"Evaluate",
"the",
"boolean",
"EL",
"expression",
"passed",
"as",
"parameter"
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/taglib/el/EvalHelper.java#L54-L58 |
thymeleaf/thymeleaf | src/main/java/org/thymeleaf/expression/Uris.java | Uris.escapePathSegment | public String escapePathSegment(final String text, final String encoding) {
return UriEscape.escapeUriPathSegment(text, encoding);
} | java | public String escapePathSegment(final String text, final String encoding) {
return UriEscape.escapeUriPathSegment(text, encoding);
} | [
"public",
"String",
"escapePathSegment",
"(",
"final",
"String",
"text",
",",
"final",
"String",
"encoding",
")",
"{",
"return",
"UriEscape",
".",
"escapeUriPathSegment",
"(",
"text",
",",
"encoding",
")",
";",
"}"
] | <p>
Perform am URI path segment <strong>escape</strong> operation
on a {@code String} input.
</p>
<p>
This method simply calls the equivalent method in the {@code UriEscape} class from the
<a href="http://www.unbescape.org">Unbescape</a> library.
</p>
<p>
The following are the only allowed chars in an URI path segment (will not be escaped):
</p>
<ul>
<li>{@code A-Z a-z 0-9}</li>
<li>{@code - . _ ~}</li>
<li>{@code ! $ & ' ( ) * + , ; =}</li>
<li>{@code : @}</li>
</ul>
<p>
All other chars will be escaped by converting them to the sequence of bytes that
represents them in the specified <em>encoding</em> and then representing each byte
in {@code %HH} syntax, being {@code HH} the hexadecimal representation of the byte.
</p>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param text the {@code String} to be escaped.
@param encoding the encoding to be used for escaping.
@return The escaped result {@code String}. As a memory-performance improvement, will return the exact
same object as the {@code text} input argument if no escaping modifications were required (and
no additional {@code String} objects will be created during processing). Will
return {@code null} if {@code text} is {@code null}. | [
"<p",
">",
"Perform",
"am",
"URI",
"path",
"segment",
"<strong",
">",
"escape<",
"/",
"strong",
">",
"operation",
"on",
"a",
"{",
"@code",
"String",
"}",
"input",
".",
"<",
"/",
"p",
">",
"<p",
">",
"This",
"method",
"simply",
"calls",
"the",
"equiva... | train | https://github.com/thymeleaf/thymeleaf/blob/2b0e6d6d7571fbe638904b5fd222fc9e77188879/src/main/java/org/thymeleaf/expression/Uris.java#L297-L299 |
BioPAX/Paxtools | paxtools-console/src/main/java/org/biopax/paxtools/examples/UseOfReflection.java | UseOfReflection.getBiopaxPropertyValues | public static Set getBiopaxPropertyValues(BioPAXElement bpe, String property) {
// get the BioPAX L3 property editors map
EditorMap em = SimpleEditorMap.L3;
// get the 'organism' biopax property editor,
// if exists for this type of bpe
@SuppressWarnings("unchecked") PropertyEditor<BioPAXElement, Object> editor
= (PropertyEditor<BioPAXElement, Object>) em
.getEditorForProperty(property, bpe.getModelInterface());
// if the biopax object does have such property, get values
if (editor != null) {
return editor.getValueFromBean(bpe);
} else
return null;
} | java | public static Set getBiopaxPropertyValues(BioPAXElement bpe, String property) {
// get the BioPAX L3 property editors map
EditorMap em = SimpleEditorMap.L3;
// get the 'organism' biopax property editor,
// if exists for this type of bpe
@SuppressWarnings("unchecked") PropertyEditor<BioPAXElement, Object> editor
= (PropertyEditor<BioPAXElement, Object>) em
.getEditorForProperty(property, bpe.getModelInterface());
// if the biopax object does have such property, get values
if (editor != null) {
return editor.getValueFromBean(bpe);
} else
return null;
} | [
"public",
"static",
"Set",
"getBiopaxPropertyValues",
"(",
"BioPAXElement",
"bpe",
",",
"String",
"property",
")",
"{",
"// get the BioPAX L3 property editors map",
"EditorMap",
"em",
"=",
"SimpleEditorMap",
".",
"L3",
";",
"// get the 'organism' biopax property editor, ",
... | Example 2.
How to get values from a biopax property if the type of the biopax object
is not known at runtime, and you do not want to always remember the
domain and range of the property nor write many if-else statements to
find out.
@param bpe BioPAX object
@param property BioPAX property
@return the BioPAX property values or null | [
"Example",
"2",
"."
] | train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-console/src/main/java/org/biopax/paxtools/examples/UseOfReflection.java#L68-L84 |
lagom/lagom | service/javadsl/api/src/main/java/com/lightbend/lagom/javadsl/api/Descriptor.java | Descriptor.replaceAllCalls | public Descriptor replaceAllCalls(PSequence<Call<?, ?>> calls) {
return new Descriptor(name, calls, pathParamSerializers, messageSerializers, serializerFactory, exceptionSerializer, autoAcl, acls, headerFilter, locatableService, circuitBreaker, topicCalls);
} | java | public Descriptor replaceAllCalls(PSequence<Call<?, ?>> calls) {
return new Descriptor(name, calls, pathParamSerializers, messageSerializers, serializerFactory, exceptionSerializer, autoAcl, acls, headerFilter, locatableService, circuitBreaker, topicCalls);
} | [
"public",
"Descriptor",
"replaceAllCalls",
"(",
"PSequence",
"<",
"Call",
"<",
"?",
",",
"?",
">",
">",
"calls",
")",
"{",
"return",
"new",
"Descriptor",
"(",
"name",
",",
"calls",
",",
"pathParamSerializers",
",",
"messageSerializers",
",",
"serializerFactory... | Replace all the service calls provided by this descriptor with the the given service calls.
@param calls The calls to replace the existing ones with.
@return A copy of this descriptor with the new calls. | [
"Replace",
"all",
"the",
"service",
"calls",
"provided",
"by",
"this",
"descriptor",
"with",
"the",
"the",
"given",
"service",
"calls",
"."
] | train | https://github.com/lagom/lagom/blob/3763055a9d1aace793a5d970f4e688aea61b1a5a/service/javadsl/api/src/main/java/com/lightbend/lagom/javadsl/api/Descriptor.java#L720-L722 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/mapreduce/aggregation/Aggregations.java | Aggregations.doubleMax | public static <Key, Value> Aggregation<Key, Double, Double> doubleMax() {
return new AggregationAdapter(new DoubleMaxAggregation<Key, Value>());
} | java | public static <Key, Value> Aggregation<Key, Double, Double> doubleMax() {
return new AggregationAdapter(new DoubleMaxAggregation<Key, Value>());
} | [
"public",
"static",
"<",
"Key",
",",
"Value",
">",
"Aggregation",
"<",
"Key",
",",
"Double",
",",
"Double",
">",
"doubleMax",
"(",
")",
"{",
"return",
"new",
"AggregationAdapter",
"(",
"new",
"DoubleMaxAggregation",
"<",
"Key",
",",
"Value",
">",
"(",
")... | Returns an aggregation to find the double maximum of all supplied values.<br/>
This aggregation is similar to: <pre>SELECT MAX(value) FROM x</pre>
@param <Key> the input key type
@param <Value> the supplied value type
@return the maximum value over all supplied values | [
"Returns",
"an",
"aggregation",
"to",
"find",
"the",
"double",
"maximum",
"of",
"all",
"supplied",
"values",
".",
"<br",
"/",
">",
"This",
"aggregation",
"is",
"similar",
"to",
":",
"<pre",
">",
"SELECT",
"MAX",
"(",
"value",
")",
"FROM",
"x<",
"/",
"p... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/mapreduce/aggregation/Aggregations.java#L234-L236 |
CenturyLinkCloud/mdw | mdw-workflow/assets/com/centurylink/mdw/microservice/MicroserviceRestAdapter.java | MicroserviceRestAdapter.notifyServiceSummaryUpdate | protected void notifyServiceSummaryUpdate(ServiceSummary serviceSummary) throws ActivityException {
WorkflowServices wfs = ServiceLocator.getWorkflowServices();
try {
wfs.notify("service-summary-update-" + getMasterRequestId(), null, 2);
} catch (ServiceException e) {
throw new ActivityException("Cannot publish Service Summary update event", e);
}
} | java | protected void notifyServiceSummaryUpdate(ServiceSummary serviceSummary) throws ActivityException {
WorkflowServices wfs = ServiceLocator.getWorkflowServices();
try {
wfs.notify("service-summary-update-" + getMasterRequestId(), null, 2);
} catch (ServiceException e) {
throw new ActivityException("Cannot publish Service Summary update event", e);
}
} | [
"protected",
"void",
"notifyServiceSummaryUpdate",
"(",
"ServiceSummary",
"serviceSummary",
")",
"throws",
"ActivityException",
"{",
"WorkflowServices",
"wfs",
"=",
"ServiceLocator",
".",
"getWorkflowServices",
"(",
")",
";",
"try",
"{",
"wfs",
".",
"notify",
"(",
"... | Standard behavior is to publish event fitting standard pattern of default event
used in DependenciesWaitActivity (Microservice Dependencies Wait) | [
"Standard",
"behavior",
"is",
"to",
"publish",
"event",
"fitting",
"standard",
"pattern",
"of",
"default",
"event",
"used",
"in",
"DependenciesWaitActivity",
"(",
"Microservice",
"Dependencies",
"Wait",
")"
] | train | https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-workflow/assets/com/centurylink/mdw/microservice/MicroserviceRestAdapter.java#L144-L151 |
dbracewell/mango | src/main/java/com/davidbracewell/json/JsonWriter.java | JsonWriter.property | protected JsonWriter property(String key, Object[] array) throws IOException {
return property(key, Arrays.asList(array));
} | java | protected JsonWriter property(String key, Object[] array) throws IOException {
return property(key, Arrays.asList(array));
} | [
"protected",
"JsonWriter",
"property",
"(",
"String",
"key",
",",
"Object",
"[",
"]",
"array",
")",
"throws",
"IOException",
"{",
"return",
"property",
"(",
"key",
",",
"Arrays",
".",
"asList",
"(",
"array",
")",
")",
";",
"}"
] | Writes an array with the given key name
@param key the key name for the array
@param array the array to be written
@return This structured writer
@throws IOException Something went wrong writing | [
"Writes",
"an",
"array",
"with",
"the",
"given",
"key",
"name"
] | train | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/json/JsonWriter.java#L250-L252 |
groupby/api-java | src/main/java/com/groupbyinc/api/AbstractBridge.java | AbstractBridge.generateSecuredPayload | public static AesContent generateSecuredPayload(String customerId, String clientKey, String requestJson) throws GeneralSecurityException {
AesEncryption encryption = new AesEncryption(clientKey, customerId);
return encryption.encrypt(requestJson);
} | java | public static AesContent generateSecuredPayload(String customerId, String clientKey, String requestJson) throws GeneralSecurityException {
AesEncryption encryption = new AesEncryption(clientKey, customerId);
return encryption.encrypt(requestJson);
} | [
"public",
"static",
"AesContent",
"generateSecuredPayload",
"(",
"String",
"customerId",
",",
"String",
"clientKey",
",",
"String",
"requestJson",
")",
"throws",
"GeneralSecurityException",
"{",
"AesEncryption",
"encryption",
"=",
"new",
"AesEncryption",
"(",
"clientKey... | <code>
Generates a secured payload
</code>
@param customerId The customerId as seen in Command Center. Ensure this is not the subdomain, which can be `customerId-cors.groupbycloud.com`
@param clientKey The customerId as seen in Command Center
@param requestJson The query to encrypt | [
"<code",
">",
"Generates",
"a",
"secured",
"payload",
"<",
"/",
"code",
">"
] | train | https://github.com/groupby/api-java/blob/257c4ed0777221e5e4ade3b29b9921300fac4e2e/src/main/java/com/groupbyinc/api/AbstractBridge.java#L540-L543 |
amaembo/streamex | src/main/java/one/util/streamex/DoubleStreamEx.java | DoubleStreamEx.joining | public String joining(CharSequence delimiter, CharSequence prefix, CharSequence suffix) {
return collect(DoubleCollector.joining(delimiter, prefix, suffix));
} | java | public String joining(CharSequence delimiter, CharSequence prefix, CharSequence suffix) {
return collect(DoubleCollector.joining(delimiter, prefix, suffix));
} | [
"public",
"String",
"joining",
"(",
"CharSequence",
"delimiter",
",",
"CharSequence",
"prefix",
",",
"CharSequence",
"suffix",
")",
"{",
"return",
"collect",
"(",
"DoubleCollector",
".",
"joining",
"(",
"delimiter",
",",
"prefix",
",",
"suffix",
")",
")",
";",... | Returns a {@link String} which is the concatenation of the results of
calling {@link String#valueOf(double)} on each element of this stream,
separated by the specified delimiter, with the specified prefix and
suffix in encounter order.
<p>
This is a terminal operation.
@param delimiter the delimiter to be used between each element
@param prefix the sequence of characters to be used at the beginning of
the joined result
@param suffix the sequence of characters to be used at the end of the
joined result
@return the result of concatenation. For empty input stream
{@code prefix + suffix} is returned.
@since 0.3.1 | [
"Returns",
"a",
"{",
"@link",
"String",
"}",
"which",
"is",
"the",
"concatenation",
"of",
"the",
"results",
"of",
"calling",
"{",
"@link",
"String#valueOf",
"(",
"double",
")",
"}",
"on",
"each",
"element",
"of",
"this",
"stream",
"separated",
"by",
"the",... | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/DoubleStreamEx.java#L1360-L1362 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java | HtmlDocletWriter.getNavShowLists | protected Content getNavShowLists(DocPath link) {
DocLink dl = new DocLink(link, path.getPath(), null);
Content framesContent = getHyperLink(dl, framesLabel, "", "_top");
Content li = HtmlTree.LI(framesContent);
return li;
} | java | protected Content getNavShowLists(DocPath link) {
DocLink dl = new DocLink(link, path.getPath(), null);
Content framesContent = getHyperLink(dl, framesLabel, "", "_top");
Content li = HtmlTree.LI(framesContent);
return li;
} | [
"protected",
"Content",
"getNavShowLists",
"(",
"DocPath",
"link",
")",
"{",
"DocLink",
"dl",
"=",
"new",
"DocLink",
"(",
"link",
",",
"path",
".",
"getPath",
"(",
")",
",",
"null",
")",
";",
"Content",
"framesContent",
"=",
"getHyperLink",
"(",
"dl",
",... | Get "FRAMES" link, to switch to the frame version of the output.
@param link File to be linked, "index.html"
@return a content tree for the link | [
"Get",
"FRAMES",
"link",
"to",
"switch",
"to",
"the",
"frame",
"version",
"of",
"the",
"output",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java#L620-L625 |
haraldk/TwelveMonkeys | imageio/imageio-pict/src/main/java/com/twelvemonkeys/imageio/plugins/pict/QuickDrawContext.java | QuickDrawContext.frameArc | public void frameArc(final Rectangle2D pRectangle, int pStartAngle, int pArcAngle) {
frameShape(toArc(pRectangle, pStartAngle, pArcAngle, false));
} | java | public void frameArc(final Rectangle2D pRectangle, int pStartAngle, int pArcAngle) {
frameShape(toArc(pRectangle, pStartAngle, pArcAngle, false));
} | [
"public",
"void",
"frameArc",
"(",
"final",
"Rectangle2D",
"pRectangle",
",",
"int",
"pStartAngle",
",",
"int",
"pArcAngle",
")",
"{",
"frameShape",
"(",
"toArc",
"(",
"pRectangle",
",",
"pStartAngle",
",",
"pArcAngle",
",",
"false",
")",
")",
";",
"}"
] | FrameArc(r,int,int) // outline arc with the size, pattern, and pattern mode of
the graphics pen.
@param pRectangle the rectangle to frame
@param pStartAngle start angle in degrees (starting from 12'o clock, this differs from Java)
@param pArcAngle rotation angle in degrees (starting from {@code pStartAngle}, this differs from Java arcs) | [
"FrameArc",
"(",
"r",
"int",
"int",
")",
"//",
"outline",
"arc",
"with",
"the",
"size",
"pattern",
"and",
"pattern",
"mode",
"of",
"the",
"graphics",
"pen",
"."
] | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-pict/src/main/java/com/twelvemonkeys/imageio/plugins/pict/QuickDrawContext.java#L728-L730 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java | ElementsExceptionsFactory.newServiceInvocationException | public static ServiceInvocationException newServiceInvocationException(String message, Object... args) {
return newServiceInvocationException(null, message, args);
} | java | public static ServiceInvocationException newServiceInvocationException(String message, Object... args) {
return newServiceInvocationException(null, message, args);
} | [
"public",
"static",
"ServiceInvocationException",
"newServiceInvocationException",
"(",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"newServiceInvocationException",
"(",
"null",
",",
"message",
",",
"args",
")",
";",
"}"
] | Constructs and initializes a new {@link ServiceInvocationException} with the given {@link String message}
formatted with the given {@link Object[] arguments}.
@param message {@link String} describing the {@link ServiceInvocationException exception}.
@param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}.
@return a new {@link ServiceInvocationException} with the given {@link String message}.
@see #newServiceInvocationException(Throwable, String, Object...)
@see org.cp.elements.service.ServiceInvocationException | [
"Constructs",
"and",
"initializes",
"a",
"new",
"{",
"@link",
"ServiceInvocationException",
"}",
"with",
"the",
"given",
"{",
"@link",
"String",
"message",
"}",
"formatted",
"with",
"the",
"given",
"{",
"@link",
"Object",
"[]",
"arguments",
"}",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java#L671-L673 |
twitter/cloudhopper-commons | ch-commons-ssl/src/main/java/com/cloudhopper/commons/ssl/SslContextFactory.java | SslContextFactory.streamCopy | private static void streamCopy(InputStream is, OutputStream os, byte[] buf, boolean close) throws IOException {
int len;
if (buf == null) {
buf = new byte[4096];
}
while ((len = is.read(buf)) > 0) {
os.write(buf, 0, len);
}
os.flush();
if (close) {
is.close();
}
} | java | private static void streamCopy(InputStream is, OutputStream os, byte[] buf, boolean close) throws IOException {
int len;
if (buf == null) {
buf = new byte[4096];
}
while ((len = is.read(buf)) > 0) {
os.write(buf, 0, len);
}
os.flush();
if (close) {
is.close();
}
} | [
"private",
"static",
"void",
"streamCopy",
"(",
"InputStream",
"is",
",",
"OutputStream",
"os",
",",
"byte",
"[",
"]",
"buf",
",",
"boolean",
"close",
")",
"throws",
"IOException",
"{",
"int",
"len",
";",
"if",
"(",
"buf",
"==",
"null",
")",
"{",
"buf"... | Copy the contents of is to os.
@param is
@param os
@param buf Can be null
@param close If true, is is closed after the copy.
@throws IOException | [
"Copy",
"the",
"contents",
"of",
"is",
"to",
"os",
"."
] | train | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-ssl/src/main/java/com/cloudhopper/commons/ssl/SslContextFactory.java#L382-L394 |
joniles/mpxj | src/main/java/net/sf/mpxj/Task.java | Task.setFieldByAlias | public void setFieldByAlias(String alias, Object value)
{
set(getParentFile().getCustomFields().getFieldByAlias(FieldTypeClass.TASK, alias), value);
} | java | public void setFieldByAlias(String alias, Object value)
{
set(getParentFile().getCustomFields().getFieldByAlias(FieldTypeClass.TASK, alias), value);
} | [
"public",
"void",
"setFieldByAlias",
"(",
"String",
"alias",
",",
"Object",
"value",
")",
"{",
"set",
"(",
"getParentFile",
"(",
")",
".",
"getCustomFields",
"(",
")",
".",
"getFieldByAlias",
"(",
"FieldTypeClass",
".",
"TASK",
",",
"alias",
")",
",",
"val... | Set the value of a field using its alias.
@param alias field alias
@param value field value | [
"Set",
"the",
"value",
"of",
"a",
"field",
"using",
"its",
"alias",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Task.java#L3743-L3746 |
assaydepot/assaydepot-java | src/main/java/com/assaydepot/AssayDepotTreeImpl.java | AssayDepotTreeImpl.buildFacetString | private String buildFacetString(List<String> facetNames, List<String>facetValues ) {
StringBuilder builder = new StringBuilder();
if( facetNames != null && facetValues != null )
{
int pairsCount = -1;
if( facetNames.size() != facetValues.size() ) {
pairsCount = facetNames.size() > facetValues.size() ? facetValues.size() : facetNames.size();
log.warn( "facetNames and facetValues lists were of different sizes, your query may not be accurate" );
} else {
pairsCount = facetNames.size();
}
for( int i=0; i < pairsCount; i++ ) {
try {
builder.append( "&facets[").append( facetNames.get( i )).append( "][]=" )
.append( URLEncoder.encode( facetValues.get( i ), "UTF-8" ));
} catch (UnsupportedEncodingException ignore) {
}
}
} else {
log.error( "facetNames or facetValues was null, you are defaulting to a regular query using no facet matching" );
}
return builder.toString();
} | java | private String buildFacetString(List<String> facetNames, List<String>facetValues ) {
StringBuilder builder = new StringBuilder();
if( facetNames != null && facetValues != null )
{
int pairsCount = -1;
if( facetNames.size() != facetValues.size() ) {
pairsCount = facetNames.size() > facetValues.size() ? facetValues.size() : facetNames.size();
log.warn( "facetNames and facetValues lists were of different sizes, your query may not be accurate" );
} else {
pairsCount = facetNames.size();
}
for( int i=0; i < pairsCount; i++ ) {
try {
builder.append( "&facets[").append( facetNames.get( i )).append( "][]=" )
.append( URLEncoder.encode( facetValues.get( i ), "UTF-8" ));
} catch (UnsupportedEncodingException ignore) {
}
}
} else {
log.error( "facetNames or facetValues was null, you are defaulting to a regular query using no facet matching" );
}
return builder.toString();
} | [
"private",
"String",
"buildFacetString",
"(",
"List",
"<",
"String",
">",
"facetNames",
",",
"List",
"<",
"String",
">",
"facetValues",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"facetNames",
"!=",
"null",
... | Takes in a list of names/values and pairs them up to make a good url. if the list
sizes don't match up does the best it can by matching up the smallest number of pairs.
@param facetNames
@param facetValues
@return | [
"Takes",
"in",
"a",
"list",
"of",
"names",
"/",
"values",
"and",
"pairs",
"them",
"up",
"to",
"make",
"a",
"good",
"url",
".",
"if",
"the",
"list",
"sizes",
"don",
"t",
"match",
"up",
"does",
"the",
"best",
"it",
"can",
"by",
"matching",
"up",
"the... | train | https://github.com/assaydepot/assaydepot-java/blob/26a1af17651dbee3d7e9c17932eabea828933d01/src/main/java/com/assaydepot/AssayDepotTreeImpl.java#L203-L229 |
google/closure-compiler | src/com/google/javascript/jscomp/AbstractPeepholeOptimization.java | AbstractPeepholeOptimization.areNodesEqualForInlining | protected boolean areNodesEqualForInlining(Node n1, Node n2) {
/* Our implementation delegates to the compiler. We provide this
* method because we don't want to expose Compiler to PeepholeOptimizations.
*/
checkNotNull(compiler);
return compiler.areNodesEqualForInlining(n1, n2);
} | java | protected boolean areNodesEqualForInlining(Node n1, Node n2) {
/* Our implementation delegates to the compiler. We provide this
* method because we don't want to expose Compiler to PeepholeOptimizations.
*/
checkNotNull(compiler);
return compiler.areNodesEqualForInlining(n1, n2);
} | [
"protected",
"boolean",
"areNodesEqualForInlining",
"(",
"Node",
"n1",
",",
"Node",
"n2",
")",
"{",
"/* Our implementation delegates to the compiler. We provide this\n * method because we don't want to expose Compiler to PeepholeOptimizations.\n */",
"checkNotNull",
"(",
"compile... | Are the nodes equal for the purpose of inlining?
If type aware optimizations are on, type equality is checked. | [
"Are",
"the",
"nodes",
"equal",
"for",
"the",
"purpose",
"of",
"inlining?",
"If",
"type",
"aware",
"optimizations",
"are",
"on",
"type",
"equality",
"is",
"checked",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/AbstractPeepholeOptimization.java#L62-L68 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/topology/ST_Graph.java | ST_Graph.createGraph | public static boolean createGraph(Connection connection,
String inputTable,
String spatialFieldName,
double tolerance,
boolean orientBySlope) throws SQLException {
return createGraph(connection, inputTable, spatialFieldName, tolerance, orientBySlope, false);
} | java | public static boolean createGraph(Connection connection,
String inputTable,
String spatialFieldName,
double tolerance,
boolean orientBySlope) throws SQLException {
return createGraph(connection, inputTable, spatialFieldName, tolerance, orientBySlope, false);
} | [
"public",
"static",
"boolean",
"createGraph",
"(",
"Connection",
"connection",
",",
"String",
"inputTable",
",",
"String",
"spatialFieldName",
",",
"double",
"tolerance",
",",
"boolean",
"orientBySlope",
")",
"throws",
"SQLException",
"{",
"return",
"createGraph",
"... | Create the nodes and edges tables from the input table containing
LINESTRINGs in the given column and using the given
tolerance, and potentially orienting edges by slope.
<p/>
The tolerance value is used specify the side length of a square Envelope
around each node used to snap together other nodes within the same
Envelope. Note, however, that edge geometries are left untouched.
Note also that coordinates within a given tolerance of each
other are not necessarily snapped together. Only the first and last
coordinates of a geometry are considered to be potential nodes, and
only nodes within a given tolerance of each other are snapped
together. The tolerance works only in metric units.
<p/>
The boolean orientBySlope is set to true if edges should be oriented by
the z-value of their first and last coordinates (decreasing).
<p/>
If the input table has name 'input', then the output tables are named
'input_nodes' and 'input_edges'.
@param connection Connection
@param inputTable Input table
@param spatialFieldName Name of column containing LINESTRINGs
@param tolerance Tolerance
@param orientBySlope True if edges should be oriented by the z-value of
their first and last coordinates (decreasing)
@return true if both output tables were created
@throws SQLException | [
"Create",
"the",
"nodes",
"and",
"edges",
"tables",
"from",
"the",
"input",
"table",
"containing",
"LINESTRINGs",
"in",
"the",
"given",
"column",
"and",
"using",
"the",
"given",
"tolerance",
"and",
"potentially",
"orienting",
"edges",
"by",
"slope",
".",
"<p",... | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/topology/ST_Graph.java#L191-L197 |
aws/aws-sdk-java | aws-java-sdk-cognitoidentity/src/main/java/com/amazonaws/services/cognitoidentity/model/CreateIdentityPoolResult.java | CreateIdentityPoolResult.withIdentityPoolTags | public CreateIdentityPoolResult withIdentityPoolTags(java.util.Map<String, String> identityPoolTags) {
setIdentityPoolTags(identityPoolTags);
return this;
} | java | public CreateIdentityPoolResult withIdentityPoolTags(java.util.Map<String, String> identityPoolTags) {
setIdentityPoolTags(identityPoolTags);
return this;
} | [
"public",
"CreateIdentityPoolResult",
"withIdentityPoolTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"identityPoolTags",
")",
"{",
"setIdentityPoolTags",
"(",
"identityPoolTags",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The tags that are assigned to the identity pool. A tag is a label that you can apply to identity pools to
categorize and manage them in different ways, such as by purpose, owner, environment, or other criteria.
</p>
@param identityPoolTags
The tags that are assigned to the identity pool. A tag is a label that you can apply to identity pools to
categorize and manage them 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",
"tags",
"that",
"are",
"assigned",
"to",
"the",
"identity",
"pool",
".",
"A",
"tag",
"is",
"a",
"label",
"that",
"you",
"can",
"apply",
"to",
"identity",
"pools",
"to",
"categorize",
"and",
"manage",
"them",
"in",
"different",
"ways",
... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-cognitoidentity/src/main/java/com/amazonaws/services/cognitoidentity/model/CreateIdentityPoolResult.java#L569-L572 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/jitdeploy/CORBA_Utils.java | CORBA_Utils.getRequiredOutputStreamType | static Type getRequiredOutputStreamType(Class<?> clazz,
int rmicCompatible) // PM46698
{
// NOTE: This logic must be kept in sync with write_value
if (clazz == Void.TYPE || // nothing to write
clazz == Object.class || // writeAny
clazz.isPrimitive() || // write_<primitive>
(clazz.isInterface() &&
(clazz == Serializable.class || // writeAny
clazz == Externalizable.class || // writeAny
isCORBAObject(clazz, rmicCompatible) || // write_Object
(Remote.class).isAssignableFrom(clazz) || // writeRemoteObject
isAbstractInterface(clazz, rmicCompatible)))) // writeAbstractObject
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getRequiredOutputStreamType: " + clazz.getName() +
" => org.omg.CORBA.portable.OutputStream");
return TYPE_CORBA_OutputStream;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getRequiredOutputStreamType: " + clazz.getName() +
" => org.omg.CORBA_2_3.portable.OutputStream");
// requires 'write_value'
return TYPE_CORBA_2_3_OutputStream;
} | java | static Type getRequiredOutputStreamType(Class<?> clazz,
int rmicCompatible) // PM46698
{
// NOTE: This logic must be kept in sync with write_value
if (clazz == Void.TYPE || // nothing to write
clazz == Object.class || // writeAny
clazz.isPrimitive() || // write_<primitive>
(clazz.isInterface() &&
(clazz == Serializable.class || // writeAny
clazz == Externalizable.class || // writeAny
isCORBAObject(clazz, rmicCompatible) || // write_Object
(Remote.class).isAssignableFrom(clazz) || // writeRemoteObject
isAbstractInterface(clazz, rmicCompatible)))) // writeAbstractObject
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getRequiredOutputStreamType: " + clazz.getName() +
" => org.omg.CORBA.portable.OutputStream");
return TYPE_CORBA_OutputStream;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getRequiredOutputStreamType: " + clazz.getName() +
" => org.omg.CORBA_2_3.portable.OutputStream");
// requires 'write_value'
return TYPE_CORBA_2_3_OutputStream;
} | [
"static",
"Type",
"getRequiredOutputStreamType",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"int",
"rmicCompatible",
")",
"// PM46698",
"{",
"// NOTE: This logic must be kept in sync with write_value",
"if",
"(",
"clazz",
"==",
"Void",
".",
"TYPE",
"||",
"// nothing t... | Returns the ASM Type object for the OutputStream required to write
an instance of the specified class. <p>
Many parameter and return value types may be serialized using the
original org.omg.CORBA.portable.OutputStream implementation,
however, some require the new CORBA_2_3 subclass. This method
consolidates the logic to determine when the subclass is
required. <p>
Determining which type of outputstream class is required may be
useful in avoiding a cast in generated Stub and Tie classes. <p>
@param clazz class for a method parameter or return type
that needs to be written to an output stream.
@param rmicCompatible rmic compatibility flags | [
"Returns",
"the",
"ASM",
"Type",
"object",
"for",
"the",
"OutputStream",
"required",
"to",
"write",
"an",
"instance",
"of",
"the",
"specified",
"class",
".",
"<p",
">"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/jitdeploy/CORBA_Utils.java#L128-L155 |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/properties/JSONHelpers.java | JSONHelpers.loadJSONAsset | public static JSONObject loadJSONAsset(Context context, final String asset) {
if (asset == null) {
return new JSONObject();
}
return getJsonObject(org.gearvrf.widgetlib.main.Utility.readTextFile(context, asset));
} | java | public static JSONObject loadJSONAsset(Context context, final String asset) {
if (asset == null) {
return new JSONObject();
}
return getJsonObject(org.gearvrf.widgetlib.main.Utility.readTextFile(context, asset));
} | [
"public",
"static",
"JSONObject",
"loadJSONAsset",
"(",
"Context",
"context",
",",
"final",
"String",
"asset",
")",
"{",
"if",
"(",
"asset",
"==",
"null",
")",
"{",
"return",
"new",
"JSONObject",
"(",
")",
";",
"}",
"return",
"getJsonObject",
"(",
"org",
... | Load a JSON file from the application's "asset" directory.
@param context Valid {@link Context}
@param asset Name of the JSON file
@return New instance of {@link JSONObject} | [
"Load",
"a",
"JSON",
"file",
"from",
"the",
"application",
"s",
"asset",
"directory",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/properties/JSONHelpers.java#L1138-L1143 |
mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/GeometryCollection.java | GeometryCollection.fromGeometry | public static GeometryCollection fromGeometry(@NonNull Geometry geometry) {
List<Geometry> geometries = Arrays.asList(geometry);
return new GeometryCollection(TYPE, null, geometries);
} | java | public static GeometryCollection fromGeometry(@NonNull Geometry geometry) {
List<Geometry> geometries = Arrays.asList(geometry);
return new GeometryCollection(TYPE, null, geometries);
} | [
"public",
"static",
"GeometryCollection",
"fromGeometry",
"(",
"@",
"NonNull",
"Geometry",
"geometry",
")",
"{",
"List",
"<",
"Geometry",
">",
"geometries",
"=",
"Arrays",
".",
"asList",
"(",
"geometry",
")",
";",
"return",
"new",
"GeometryCollection",
"(",
"T... | Create a new instance of this class by giving the collection a single GeoJSON {@link Geometry}.
@param geometry a non-null object of type geometry which makes up this collection
@return a new instance of this class defined by the values passed inside this static factory
method
@since 3.0.0 | [
"Create",
"a",
"new",
"instance",
"of",
"this",
"class",
"by",
"giving",
"the",
"collection",
"a",
"single",
"GeoJSON",
"{",
"@link",
"Geometry",
"}",
"."
] | train | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/GeometryCollection.java#L126-L129 |
realtime-framework/RealtimeMessaging-Android | library/src/main/java/ibt/ortc/extensibility/OrtcClient.java | OrtcClient.subscribeWithBuffer | public void subscribeWithBuffer(String channel, String subscriberId, final OnMessageWithBuffer onMessage){
if (subscriberId != null) {
HashMap options = new HashMap();
options.put("channel", channel);
options.put("subscribeOnReconnected", true);
options.put("subscriberId", subscriberId);
this.subscribeWithOptions(options, new OnMessageWithOptions() {
@Override
public void run(OrtcClient sender, Map msgOptions) {
if (msgOptions.containsKey("channel") && msgOptions.containsKey("message")) {
final String channel = (String) msgOptions.get("channel");
final String message = (String) msgOptions.get("message");
final String seqId = (String) msgOptions.get("seqId");
onMessage.run(sender, channel, seqId, message);
}
}
});
}else{
raiseOrtcEvent(
EventEnum.OnException,
this,
new OrtcGcmException(
"subscribeWithBuffer called with no subscriberId"));
}
} | java | public void subscribeWithBuffer(String channel, String subscriberId, final OnMessageWithBuffer onMessage){
if (subscriberId != null) {
HashMap options = new HashMap();
options.put("channel", channel);
options.put("subscribeOnReconnected", true);
options.put("subscriberId", subscriberId);
this.subscribeWithOptions(options, new OnMessageWithOptions() {
@Override
public void run(OrtcClient sender, Map msgOptions) {
if (msgOptions.containsKey("channel") && msgOptions.containsKey("message")) {
final String channel = (String) msgOptions.get("channel");
final String message = (String) msgOptions.get("message");
final String seqId = (String) msgOptions.get("seqId");
onMessage.run(sender, channel, seqId, message);
}
}
});
}else{
raiseOrtcEvent(
EventEnum.OnException,
this,
new OrtcGcmException(
"subscribeWithBuffer called with no subscriberId"));
}
} | [
"public",
"void",
"subscribeWithBuffer",
"(",
"String",
"channel",
",",
"String",
"subscriberId",
",",
"final",
"OnMessageWithBuffer",
"onMessage",
")",
"{",
"if",
"(",
"subscriberId",
"!=",
"null",
")",
"{",
"HashMap",
"options",
"=",
"new",
"HashMap",
"(",
"... | Subscribes to a channel to receive messages published to it.
@param channel
The channel name.
@param subscriberId
The subscriberId associated to the channel.
@param OnMessageWithBuffer
The callback called when a message arrives at the channel and message seqId number. | [
"Subscribes",
"to",
"a",
"channel",
"to",
"receive",
"messages",
"published",
"to",
"it",
"."
] | train | https://github.com/realtime-framework/RealtimeMessaging-Android/blob/f0d87b92ed7c591bcfe2b9cf45b947865570e061/library/src/main/java/ibt/ortc/extensibility/OrtcClient.java#L707-L733 |
burberius/eve-esi | src/main/java/net/troja/eve/esi/api/OpportunitiesApi.java | OpportunitiesApi.getOpportunitiesTasksTaskId | public OpportunitiesTasksResponse getOpportunitiesTasksTaskId(Integer taskId, String datasource, String ifNoneMatch)
throws ApiException {
ApiResponse<OpportunitiesTasksResponse> resp = getOpportunitiesTasksTaskIdWithHttpInfo(taskId, datasource,
ifNoneMatch);
return resp.getData();
} | java | public OpportunitiesTasksResponse getOpportunitiesTasksTaskId(Integer taskId, String datasource, String ifNoneMatch)
throws ApiException {
ApiResponse<OpportunitiesTasksResponse> resp = getOpportunitiesTasksTaskIdWithHttpInfo(taskId, datasource,
ifNoneMatch);
return resp.getData();
} | [
"public",
"OpportunitiesTasksResponse",
"getOpportunitiesTasksTaskId",
"(",
"Integer",
"taskId",
",",
"String",
"datasource",
",",
"String",
"ifNoneMatch",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"OpportunitiesTasksResponse",
">",
"resp",
"=",
"getOpportun... | Get opportunities task Return information of an opportunities task ---
This route expires daily at 11:05
@param taskId
ID of an opportunities task (required)
@param datasource
The server name you would like data from (optional, default to
tranquility)
@param ifNoneMatch
ETag from a previous request. A 304 will be returned if this
matches the current ETag (optional)
@return OpportunitiesTasksResponse
@throws ApiException
If fail to call the API, e.g. server error or cannot
deserialize the response body | [
"Get",
"opportunities",
"task",
"Return",
"information",
"of",
"an",
"opportunities",
"task",
"---",
"This",
"route",
"expires",
"daily",
"at",
"11",
":",
"05"
] | train | https://github.com/burberius/eve-esi/blob/24a941c592cfc15f23471ef849b282fbc582ca13/src/main/java/net/troja/eve/esi/api/OpportunitiesApi.java#L748-L753 |
aws/aws-sdk-java | aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/PutIntegrationResponseRequest.java | PutIntegrationResponseRequest.withResponseTemplates | public PutIntegrationResponseRequest withResponseTemplates(java.util.Map<String, String> responseTemplates) {
setResponseTemplates(responseTemplates);
return this;
} | java | public PutIntegrationResponseRequest withResponseTemplates(java.util.Map<String, String> responseTemplates) {
setResponseTemplates(responseTemplates);
return this;
} | [
"public",
"PutIntegrationResponseRequest",
"withResponseTemplates",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"responseTemplates",
")",
"{",
"setResponseTemplates",
"(",
"responseTemplates",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Specifies a put integration response's templates.
</p>
@param responseTemplates
Specifies a put integration response's templates.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Specifies",
"a",
"put",
"integration",
"response",
"s",
"templates",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/PutIntegrationResponseRequest.java#L450-L453 |
joniles/mpxj | src/main/java/net/sf/mpxj/Resource.java | Resource.setEnterpriseDate | public void setEnterpriseDate(int index, Date value)
{
set(selectField(ResourceFieldLists.ENTERPRISE_DATE, index), value);
} | java | public void setEnterpriseDate(int index, Date value)
{
set(selectField(ResourceFieldLists.ENTERPRISE_DATE, index), value);
} | [
"public",
"void",
"setEnterpriseDate",
"(",
"int",
"index",
",",
"Date",
"value",
")",
"{",
"set",
"(",
"selectField",
"(",
"ResourceFieldLists",
".",
"ENTERPRISE_DATE",
",",
"index",
")",
",",
"value",
")",
";",
"}"
] | Set an enterprise field value.
@param index field index
@param value field value | [
"Set",
"an",
"enterprise",
"field",
"value",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Resource.java#L2073-L2076 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getTrailingCharCount | @Nonnegative
public static int getTrailingCharCount (@Nullable final String s, final char c)
{
int ret = 0;
if (s != null)
{
int nLast = s.length () - 1;
while (nLast >= 0 && s.charAt (nLast) == c)
{
++ret;
--nLast;
}
}
return ret;
} | java | @Nonnegative
public static int getTrailingCharCount (@Nullable final String s, final char c)
{
int ret = 0;
if (s != null)
{
int nLast = s.length () - 1;
while (nLast >= 0 && s.charAt (nLast) == c)
{
++ret;
--nLast;
}
}
return ret;
} | [
"@",
"Nonnegative",
"public",
"static",
"int",
"getTrailingCharCount",
"(",
"@",
"Nullable",
"final",
"String",
"s",
",",
"final",
"char",
"c",
")",
"{",
"int",
"ret",
"=",
"0",
";",
"if",
"(",
"s",
"!=",
"null",
")",
"{",
"int",
"nLast",
"=",
"s",
... | Get the number of specified chars, the passed string ends with.
@param s
The string to be parsed. May be <code>null</code>.
@param c
The char to be searched.
@return Always ≥ 0. | [
"Get",
"the",
"number",
"of",
"specified",
"chars",
"the",
"passed",
"string",
"ends",
"with",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L861-L875 |
elki-project/elki | elki-input/src/main/java/de/lmu/ifi/dbs/elki/datasource/filter/transform/FastMultidimensionalScalingTransform.java | FastMultidimensionalScalingTransform.updateMatrix | protected void updateMatrix(double[][] mat, final double[] evec, double eval) {
final int size = mat.length;
for(int i = 0; i < size; i++) {
final double[] mati = mat[i];
final double eveci = evec[i];
for(int j = 0; j < size; j++) {
mati[j] -= eval * eveci * evec[j];
}
}
} | java | protected void updateMatrix(double[][] mat, final double[] evec, double eval) {
final int size = mat.length;
for(int i = 0; i < size; i++) {
final double[] mati = mat[i];
final double eveci = evec[i];
for(int j = 0; j < size; j++) {
mati[j] -= eval * eveci * evec[j];
}
}
} | [
"protected",
"void",
"updateMatrix",
"(",
"double",
"[",
"]",
"[",
"]",
"mat",
",",
"final",
"double",
"[",
"]",
"evec",
",",
"double",
"eval",
")",
"{",
"final",
"int",
"size",
"=",
"mat",
".",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";... | Update matrix, by removing the effects of a known Eigenvector.
@param mat Matrix
@param evec Known normalized Eigenvector
@param eval Eigenvalue | [
"Update",
"matrix",
"by",
"removing",
"the",
"effects",
"of",
"a",
"known",
"Eigenvector",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-input/src/main/java/de/lmu/ifi/dbs/elki/datasource/filter/transform/FastMultidimensionalScalingTransform.java#L304-L313 |
ops4j/org.ops4j.pax.exam2 | core/pax-exam-spi/src/main/java/org/ops4j/pax/exam/spi/war/FileFinder.java | FileFinder.findFile | public static File findFile(File rootDir, FilenameFilter filter) {
File[] files = rootDir.listFiles(filter);
Arrays.sort(files);
if (files.length > 0) {
return files[0];
}
files = rootDir.listFiles(directoryFilter);
Arrays.sort(files);
for (File subDir : files) {
File found = findFile(subDir, filter);
if (found != null) {
return found;
}
}
return null;
} | java | public static File findFile(File rootDir, FilenameFilter filter) {
File[] files = rootDir.listFiles(filter);
Arrays.sort(files);
if (files.length > 0) {
return files[0];
}
files = rootDir.listFiles(directoryFilter);
Arrays.sort(files);
for (File subDir : files) {
File found = findFile(subDir, filter);
if (found != null) {
return found;
}
}
return null;
} | [
"public",
"static",
"File",
"findFile",
"(",
"File",
"rootDir",
",",
"FilenameFilter",
"filter",
")",
"{",
"File",
"[",
"]",
"files",
"=",
"rootDir",
".",
"listFiles",
"(",
"filter",
")",
";",
"Arrays",
".",
"sort",
"(",
"files",
")",
";",
"if",
"(",
... | Finds a file matching the given file name filter in the given root directory or any
subdirectory. The files and directories are scanned in alphabetical order, so the result is
deterministic.
<p>
The method returns the first matching result, if any, and ignores all other matches.
@param rootDir
root directory
@param filter
file name filter
@return matching file, or null | [
"Finds",
"a",
"file",
"matching",
"the",
"given",
"file",
"name",
"filter",
"in",
"the",
"given",
"root",
"directory",
"or",
"any",
"subdirectory",
".",
"The",
"files",
"and",
"directories",
"are",
"scanned",
"in",
"alphabetical",
"order",
"so",
"the",
"resu... | train | https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/core/pax-exam-spi/src/main/java/org/ops4j/pax/exam/spi/war/FileFinder.java#L86-L102 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java | ULocale.getDisplayCountryInternal | private static String getDisplayCountryInternal(ULocale locale, ULocale displayLocale) {
return LocaleDisplayNames.getInstance(displayLocale)
.regionDisplayName(locale.getCountry());
} | java | private static String getDisplayCountryInternal(ULocale locale, ULocale displayLocale) {
return LocaleDisplayNames.getInstance(displayLocale)
.regionDisplayName(locale.getCountry());
} | [
"private",
"static",
"String",
"getDisplayCountryInternal",
"(",
"ULocale",
"locale",
",",
"ULocale",
"displayLocale",
")",
"{",
"return",
"LocaleDisplayNames",
".",
"getInstance",
"(",
"displayLocale",
")",
".",
"regionDisplayName",
"(",
"locale",
".",
"getCountry",
... | displayLocaleID is canonical, localeID need not be since parsing will fix this. | [
"displayLocaleID",
"is",
"canonical",
"localeID",
"need",
"not",
"be",
"since",
"parsing",
"will",
"fix",
"this",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java#L1611-L1614 |
TNG/JGiven | jgiven-core/src/main/java/com/tngtech/jgiven/report/model/StepFormatter.java | StepFormatter.nextIndex | private static int nextIndex( String description, int defaultIndex ) {
Pattern startsWithNumber = Pattern.compile( "(\\d+).*" );
Matcher matcher = startsWithNumber.matcher( description );
if( matcher.matches() ) {
return Integer.parseInt( matcher.group( 1 ) ) - 1;
}
return defaultIndex;
} | java | private static int nextIndex( String description, int defaultIndex ) {
Pattern startsWithNumber = Pattern.compile( "(\\d+).*" );
Matcher matcher = startsWithNumber.matcher( description );
if( matcher.matches() ) {
return Integer.parseInt( matcher.group( 1 ) ) - 1;
}
return defaultIndex;
} | [
"private",
"static",
"int",
"nextIndex",
"(",
"String",
"description",
",",
"int",
"defaultIndex",
")",
"{",
"Pattern",
"startsWithNumber",
"=",
"Pattern",
".",
"compile",
"(",
"\"(\\\\d+).*\"",
")",
";",
"Matcher",
"matcher",
"=",
"startsWithNumber",
".",
"matc... | Returns the next index of the argument by decrementing 1 from the possibly parsed number
@param description this String will be searched from the start for a number
@param defaultIndex this will be returned if the match does not succeed
@return the parsed index or the defaultIndex | [
"Returns",
"the",
"next",
"index",
"of",
"the",
"argument",
"by",
"decrementing",
"1",
"from",
"the",
"possibly",
"parsed",
"number"
] | train | https://github.com/TNG/JGiven/blob/1a69248fc6d7eb380cdc4542e3be273842889748/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/StepFormatter.java#L319-L328 |
fozziethebeat/S-Space | src/main/java/edu/ucla/sspace/util/WorkQueue.java | WorkQueue.run | public void run(Collection<Runnable> tasks) {
// Create a semphore that the wrapped runnables will execute
int numTasks = tasks.size();
CountDownLatch latch = new CountDownLatch(numTasks);
for (Runnable r : tasks) {
if (r == null)
throw new NullPointerException("Cannot run null tasks");
workQueue.offer(new CountingRunnable(r, latch));
}
try {
// Wait until all the tasks have finished
latch.await();
}
catch (InterruptedException ie) {
throw new IllegalStateException("Not all tasks finished", ie);
}
} | java | public void run(Collection<Runnable> tasks) {
// Create a semphore that the wrapped runnables will execute
int numTasks = tasks.size();
CountDownLatch latch = new CountDownLatch(numTasks);
for (Runnable r : tasks) {
if (r == null)
throw new NullPointerException("Cannot run null tasks");
workQueue.offer(new CountingRunnable(r, latch));
}
try {
// Wait until all the tasks have finished
latch.await();
}
catch (InterruptedException ie) {
throw new IllegalStateException("Not all tasks finished", ie);
}
} | [
"public",
"void",
"run",
"(",
"Collection",
"<",
"Runnable",
">",
"tasks",
")",
"{",
"// Create a semphore that the wrapped runnables will execute",
"int",
"numTasks",
"=",
"tasks",
".",
"size",
"(",
")",
";",
"CountDownLatch",
"latch",
"=",
"new",
"CountDownLatch",... | Executes the tasks using a thread pool and returns once all tasks have
finished.
@throws IllegalStateException if interrupted while waiting for the tasks
to finish | [
"Executes",
"the",
"tasks",
"using",
"a",
"thread",
"pool",
"and",
"returns",
"once",
"all",
"tasks",
"have",
"finished",
"."
] | train | https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/util/WorkQueue.java#L309-L325 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java | PageFlowUtils.getCurrentActionResolver | public static ActionResolver getCurrentActionResolver( HttpServletRequest request )
{
ServletContext servletContext = InternalUtils.getServletContext( request );
return getCurrentActionResolver( request, servletContext );
} | java | public static ActionResolver getCurrentActionResolver( HttpServletRequest request )
{
ServletContext servletContext = InternalUtils.getServletContext( request );
return getCurrentActionResolver( request, servletContext );
} | [
"public",
"static",
"ActionResolver",
"getCurrentActionResolver",
"(",
"HttpServletRequest",
"request",
")",
"{",
"ServletContext",
"servletContext",
"=",
"InternalUtils",
".",
"getServletContext",
"(",
"request",
")",
";",
"return",
"getCurrentActionResolver",
"(",
"requ... | Get the current ActionResolver.
@deprecated Use {@link #getCurrentPageFlow(HttpServletRequest, ServletContext)} instead.
@return the current ActionResolver from the user session, or <code>null</code> if there is none. | [
"Get",
"the",
"current",
"ActionResolver",
".",
"@deprecated",
"Use",
"{",
"@link",
"#getCurrentPageFlow",
"(",
"HttpServletRequest",
"ServletContext",
")",
"}",
"instead",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java#L285-L289 |
j-easy/easy-random | easy-random-core/src/main/java/org/jeasy/random/util/ReflectionUtils.java | ReflectionUtils.getReadMethod | public static Optional<Method> getReadMethod(Field field) {
String fieldName = field.getName();
Class<?> fieldClass = field.getDeclaringClass();
String capitalizedFieldName = fieldName.substring(0, 1).toUpperCase(ENGLISH) + fieldName.substring(1);
// try to find getProperty
Optional<Method> getter = getPublicMethod("get" + capitalizedFieldName, fieldClass);
if (getter.isPresent()) {
return getter;
}
// try to find isProperty for boolean properties
return getPublicMethod("is" + capitalizedFieldName, fieldClass);
} | java | public static Optional<Method> getReadMethod(Field field) {
String fieldName = field.getName();
Class<?> fieldClass = field.getDeclaringClass();
String capitalizedFieldName = fieldName.substring(0, 1).toUpperCase(ENGLISH) + fieldName.substring(1);
// try to find getProperty
Optional<Method> getter = getPublicMethod("get" + capitalizedFieldName, fieldClass);
if (getter.isPresent()) {
return getter;
}
// try to find isProperty for boolean properties
return getPublicMethod("is" + capitalizedFieldName, fieldClass);
} | [
"public",
"static",
"Optional",
"<",
"Method",
">",
"getReadMethod",
"(",
"Field",
"field",
")",
"{",
"String",
"fieldName",
"=",
"field",
".",
"getName",
"(",
")",
";",
"Class",
"<",
"?",
">",
"fieldClass",
"=",
"field",
".",
"getDeclaringClass",
"(",
"... | Get the read method for given field.
@param field field to get the read method for.
@return Optional of read method or empty if field has no read method | [
"Get",
"the",
"read",
"method",
"for",
"given",
"field",
"."
] | train | https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/util/ReflectionUtils.java#L510-L521 |
sebastiangraf/jSCSI | bundles/commons/src/main/java/org/jscsi/parser/datasegment/AbstractDataSegment.java | AbstractDataSegment.resizeBuffer | protected void resizeBuffer (final int additionalLength, final boolean copyData) {
if (additionalLength < 0) { throw new IllegalArgumentException("The length must be greater or equal than 0."); }
dataBuffer.position(length);
// reallocate a bigger dataBuffer, if needed
if (length + additionalLength > dataBuffer.capacity()) {
final ByteBuffer newBuffer = ByteBuffer.allocate(getTotalLength(length + additionalLength));
// copy old data...
if (copyData) {
dataBuffer.flip();
newBuffer.put(dataBuffer);
}
dataBuffer = newBuffer;
dataBuffer.limit(getTotalLength(length + additionalLength));
}
length += additionalLength;
} | java | protected void resizeBuffer (final int additionalLength, final boolean copyData) {
if (additionalLength < 0) { throw new IllegalArgumentException("The length must be greater or equal than 0."); }
dataBuffer.position(length);
// reallocate a bigger dataBuffer, if needed
if (length + additionalLength > dataBuffer.capacity()) {
final ByteBuffer newBuffer = ByteBuffer.allocate(getTotalLength(length + additionalLength));
// copy old data...
if (copyData) {
dataBuffer.flip();
newBuffer.put(dataBuffer);
}
dataBuffer = newBuffer;
dataBuffer.limit(getTotalLength(length + additionalLength));
}
length += additionalLength;
} | [
"protected",
"void",
"resizeBuffer",
"(",
"final",
"int",
"additionalLength",
",",
"final",
"boolean",
"copyData",
")",
"{",
"if",
"(",
"additionalLength",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The length must be greater or equal than... | This method resizes the data buffer, if necessary. A resizing is not needed, when the <code>neededLength</code>
is greater than the capacity of allocated data buffer. The flag <code>copyData</code> indicates, if the old
buffer has to be copied into the new bigger data buffer.
@param additionalLength The length, which is now needed to store all informations in the data buffer.
@param copyData <code>true</code>, if old buffer has to be copied into the new buffer. <code>false</code>
indicates, that the new buffer is initialized with zeros. | [
"This",
"method",
"resizes",
"the",
"data",
"buffer",
"if",
"necessary",
".",
"A",
"resizing",
"is",
"not",
"needed",
"when",
"the",
"<code",
">",
"neededLength<",
"/",
"code",
">",
"is",
"greater",
"than",
"the",
"capacity",
"of",
"allocated",
"data",
"bu... | train | https://github.com/sebastiangraf/jSCSI/blob/6169bfe73f0b15de7d6485453555389e782ae888/bundles/commons/src/main/java/org/jscsi/parser/datasegment/AbstractDataSegment.java#L131-L154 |
jenkinsci/jenkins | core/src/main/java/hudson/model/ParameterValue.java | ParameterValue.buildEnvVars | @Deprecated
public void buildEnvVars(AbstractBuild<?,?> build, Map<String,String> env) {
if (env instanceof EnvVars) {
if (Util.isOverridden(ParameterValue.class, getClass(), "buildEnvironment", Run.class, EnvVars.class)) {
// if the subtype already derives buildEnvironment, then delegate to it
buildEnvironment(build, (EnvVars) env);
} else if (Util.isOverridden(ParameterValue.class, getClass(), "buildEnvVars", AbstractBuild.class, EnvVars.class)) {
buildEnvVars(build, (EnvVars) env);
}
}
// otherwise no-op by default
} | java | @Deprecated
public void buildEnvVars(AbstractBuild<?,?> build, Map<String,String> env) {
if (env instanceof EnvVars) {
if (Util.isOverridden(ParameterValue.class, getClass(), "buildEnvironment", Run.class, EnvVars.class)) {
// if the subtype already derives buildEnvironment, then delegate to it
buildEnvironment(build, (EnvVars) env);
} else if (Util.isOverridden(ParameterValue.class, getClass(), "buildEnvVars", AbstractBuild.class, EnvVars.class)) {
buildEnvVars(build, (EnvVars) env);
}
}
// otherwise no-op by default
} | [
"@",
"Deprecated",
"public",
"void",
"buildEnvVars",
"(",
"AbstractBuild",
"<",
"?",
",",
"?",
">",
"build",
",",
"Map",
"<",
"String",
",",
"String",
">",
"env",
")",
"{",
"if",
"(",
"env",
"instanceof",
"EnvVars",
")",
"{",
"if",
"(",
"Util",
".",
... | Adds environmental variables for the builds to the given map.
<p>
This provides a means for a parameter to pass the parameter
values to the build to be performed.
<p>
When this method is invoked, the map already contains the
current "planned export" list. The implementation is
expected to add more values to this map (or do nothing)
<p>
Formerly, environment variables would be by convention all upper case.
(This is so that a Windows/Unix heterogeneous environment
won't get inconsistent result depending on which platform to
execute.) But now see {@link EnvVars} why upper casing is a bad idea.
@param env
never null.
@param build
The build for which this parameter is being used. Never null.
@deprecated as of 1.344
Use {@link #buildEnvironment(Run, EnvVars)} instead. | [
"Adds",
"environmental",
"variables",
"for",
"the",
"builds",
"to",
"the",
"given",
"map",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/ParameterValue.java#L151-L162 |
b3dgs/lionengine | lionengine-core/src/main/java/com/b3dgs/lionengine/UtilReflection.java | UtilReflection.createReduce | @SuppressWarnings("unchecked")
public static <T> T createReduce(Class<T> type, Object... params) throws NoSuchMethodException
{
Check.notNull(type);
Check.notNull(params);
final Class<?>[] paramTypes = getParamTypes(params);
final Queue<Class<?>> typesQueue = new ArrayDeque<>(Arrays.asList(paramTypes));
final Queue<Object> paramsQueue = new ArrayDeque<>(Arrays.asList(params));
boolean stop = false;
while (!stop)
{
final int typesLength = typesQueue.size();
final Class<?>[] typesArray = typesQueue.toArray(new Class<?>[typesLength]);
for (final Constructor<?> constructor : type.getDeclaredConstructors())
{
final Class<?>[] constructorTypes = constructor.getParameterTypes();
if (constructorTypes.length == typesLength
&& (typesLength == 0 || hasCompatibleConstructor(typesArray, constructorTypes)))
{
return create(type, (Constructor<T>) constructor, paramsQueue.toArray());
}
}
stop = paramsQueue.isEmpty();
typesQueue.poll();
paramsQueue.poll();
}
throw new NoSuchMethodException(ERROR_NO_CONSTRUCTOR_COMPATIBLE
+ type.getName()
+ ERROR_WITH
+ Arrays.asList(paramTypes));
} | java | @SuppressWarnings("unchecked")
public static <T> T createReduce(Class<T> type, Object... params) throws NoSuchMethodException
{
Check.notNull(type);
Check.notNull(params);
final Class<?>[] paramTypes = getParamTypes(params);
final Queue<Class<?>> typesQueue = new ArrayDeque<>(Arrays.asList(paramTypes));
final Queue<Object> paramsQueue = new ArrayDeque<>(Arrays.asList(params));
boolean stop = false;
while (!stop)
{
final int typesLength = typesQueue.size();
final Class<?>[] typesArray = typesQueue.toArray(new Class<?>[typesLength]);
for (final Constructor<?> constructor : type.getDeclaredConstructors())
{
final Class<?>[] constructorTypes = constructor.getParameterTypes();
if (constructorTypes.length == typesLength
&& (typesLength == 0 || hasCompatibleConstructor(typesArray, constructorTypes)))
{
return create(type, (Constructor<T>) constructor, paramsQueue.toArray());
}
}
stop = paramsQueue.isEmpty();
typesQueue.poll();
paramsQueue.poll();
}
throw new NoSuchMethodException(ERROR_NO_CONSTRUCTOR_COMPATIBLE
+ type.getName()
+ ERROR_WITH
+ Arrays.asList(paramTypes));
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"createReduce",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"Object",
"...",
"params",
")",
"throws",
"NoSuchMethodException",
"{",
"Check",
".",
"notNull",
"(",
"typ... | Create a class instance with its parameters. Use a compatible constructor with the following parameters, reducing
parameter types array as a queue until empty in order to find a constructor.
@param <T> The element type used.
@param type The class type (must not be <code>null</code>).
@param params The maximum parameters in sequential order (must not be <code>null</code>).
@return The constructor found.
@throws NoSuchMethodException If no constructor found.
@throws LionEngineException If invalid parameters. | [
"Create",
"a",
"class",
"instance",
"with",
"its",
"parameters",
".",
"Use",
"a",
"compatible",
"constructor",
"with",
"the",
"following",
"parameters",
"reducing",
"parameter",
"types",
"array",
"as",
"a",
"queue",
"until",
"empty",
"in",
"order",
"to",
"find... | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/UtilReflection.java#L85-L117 |
opsmatters/opsmatters-core | src/main/java/com/opsmatters/core/util/FormatUtilities.java | FormatUtilities.getDateTime | static public long getDateTime(String s, String format, boolean useTZ, boolean throwException)
{
long ret = 0L;
SimpleDateFormat df = null;
try
{
if(s!= null && s.length() > 0)
{
df = formatPool.getFormat(format);
if(useTZ)
df.setTimeZone(DateUtilities.getCurrentTimeZone());
else
df.setTimeZone(TimeZone.getTimeZone("GMT"));
Date dt = df.parse(s);
ret = dt.getTime();
}
}
catch(ParseException e)
{
if(throwException)
throw new RuntimeException(e);
}
if(df != null)
formatPool.release(df);
return ret;
} | java | static public long getDateTime(String s, String format, boolean useTZ, boolean throwException)
{
long ret = 0L;
SimpleDateFormat df = null;
try
{
if(s!= null && s.length() > 0)
{
df = formatPool.getFormat(format);
if(useTZ)
df.setTimeZone(DateUtilities.getCurrentTimeZone());
else
df.setTimeZone(TimeZone.getTimeZone("GMT"));
Date dt = df.parse(s);
ret = dt.getTime();
}
}
catch(ParseException e)
{
if(throwException)
throw new RuntimeException(e);
}
if(df != null)
formatPool.release(df);
return ret;
} | [
"static",
"public",
"long",
"getDateTime",
"(",
"String",
"s",
",",
"String",
"format",
",",
"boolean",
"useTZ",
",",
"boolean",
"throwException",
")",
"{",
"long",
"ret",
"=",
"0L",
";",
"SimpleDateFormat",
"df",
"=",
"null",
";",
"try",
"{",
"if",
"(",... | Returns the given date time parsed using the given format.
@param s The formatted date to be parsed
@param format The format to use when parsing the date
@param useTZ <CODE>true</CODE> if the date should be parsed using the current timezone
@param throwException <CODE>true</CODE> if an exception should be thrown for an illegal date format
@return The given date parsed using the given format | [
"Returns",
"the",
"given",
"date",
"time",
"parsed",
"using",
"the",
"given",
"format",
"."
] | train | https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/util/FormatUtilities.java#L273-L301 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.collectEntries | public static <K, V, E> Map<K, V> collectEntries(Iterator<E> self, @ClosureParams(FirstParam.FirstGenericType.class) Closure<?> transform) {
return collectEntries(self, new LinkedHashMap<K, V>(), transform);
} | java | public static <K, V, E> Map<K, V> collectEntries(Iterator<E> self, @ClosureParams(FirstParam.FirstGenericType.class) Closure<?> transform) {
return collectEntries(self, new LinkedHashMap<K, V>(), transform);
} | [
"public",
"static",
"<",
"K",
",",
"V",
",",
"E",
">",
"Map",
"<",
"K",
",",
"V",
">",
"collectEntries",
"(",
"Iterator",
"<",
"E",
">",
"self",
",",
"@",
"ClosureParams",
"(",
"FirstParam",
".",
"FirstGenericType",
".",
"class",
")",
"Closure",
"<",... | A variant of collectEntries for Iterators.
@param self an Iterator
@param transform the closure used for transforming, which has an item from self as the parameter and
should return a Map.Entry, a Map or a two-element list containing the resulting key and value
@return a Map of the transformed entries
@see #collectEntries(Iterable, Closure)
@since 1.8.7 | [
"A",
"variant",
"of",
"collectEntries",
"for",
"Iterators",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L4022-L4024 |
ocelotds/ocelot | ocelot-web/src/main/java/org/ocelotds/core/mtc/MessageToClientManager.java | MessageToClientManager._getDataService | Object _getDataService(T session, Class cls) throws DataServiceException {
String dataServiceClassName = cls.getName();
DataService dataServiceAnno = (DataService) cls.getAnnotation(DataService.class);
IDataServiceResolver resolver = getResolver(dataServiceAnno.resolver());
Scope scope = resolver.getScope(cls);
Object dataService = null;
Map<String, Object> sessionBeans = getSessionBeans(session);
logger.debug("{} : scope : {}", dataServiceClassName, scope);
if (scope.equals(Scope.SESSION)) {
dataService = sessionBeans.get(dataServiceClassName);
logger.debug("{} : scope : session is in session : {}", dataServiceClassName, (dataService != null));
}
if (dataService == null) {
dataService = resolver.resolveDataService(cls);
if (scope.equals(Scope.SESSION)) {
logger.debug("Store {} scope session in session", dataServiceClassName);
sessionBeans.put(dataServiceClassName, dataService);
}
}
return dataService;
} | java | Object _getDataService(T session, Class cls) throws DataServiceException {
String dataServiceClassName = cls.getName();
DataService dataServiceAnno = (DataService) cls.getAnnotation(DataService.class);
IDataServiceResolver resolver = getResolver(dataServiceAnno.resolver());
Scope scope = resolver.getScope(cls);
Object dataService = null;
Map<String, Object> sessionBeans = getSessionBeans(session);
logger.debug("{} : scope : {}", dataServiceClassName, scope);
if (scope.equals(Scope.SESSION)) {
dataService = sessionBeans.get(dataServiceClassName);
logger.debug("{} : scope : session is in session : {}", dataServiceClassName, (dataService != null));
}
if (dataService == null) {
dataService = resolver.resolveDataService(cls);
if (scope.equals(Scope.SESSION)) {
logger.debug("Store {} scope session in session", dataServiceClassName);
sessionBeans.put(dataServiceClassName, dataService);
}
}
return dataService;
} | [
"Object",
"_getDataService",
"(",
"T",
"session",
",",
"Class",
"cls",
")",
"throws",
"DataServiceException",
"{",
"String",
"dataServiceClassName",
"=",
"cls",
".",
"getName",
"(",
")",
";",
"DataService",
"dataServiceAnno",
"=",
"(",
"DataService",
")",
"cls",... | Get Dataservice, store dataservice in session if session scope.<br>
@param session
@param cls
@return
@throws DataServiceException | [
"Get",
"Dataservice",
"store",
"dataservice",
"in",
"session",
"if",
"session",
"scope",
".",
"<br",
">"
] | train | https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/core/mtc/MessageToClientManager.java#L93-L113 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java | ClassDescriptor.getAttributeDescriptorsForPath | public ArrayList getAttributeDescriptorsForPath(String aPath, Map pathHints)
{
return getAttributeDescriptorsForCleanPath(SqlHelper.cleanPath(aPath), pathHints);
} | java | public ArrayList getAttributeDescriptorsForPath(String aPath, Map pathHints)
{
return getAttributeDescriptorsForCleanPath(SqlHelper.cleanPath(aPath), pathHints);
} | [
"public",
"ArrayList",
"getAttributeDescriptorsForPath",
"(",
"String",
"aPath",
",",
"Map",
"pathHints",
")",
"{",
"return",
"getAttributeDescriptorsForCleanPath",
"(",
"SqlHelper",
".",
"cleanPath",
"(",
"aPath",
")",
",",
"pathHints",
")",
";",
"}"
] | return all AttributeDescriptors for the path<br>
ie: partner.addresses.street returns a Collection of 3 AttributeDescriptors
(ObjectReferenceDescriptor, CollectionDescriptor, FieldDescriptor)<br>
ie: partner.addresses returns a Collection of 2 AttributeDescriptors
(ObjectReferenceDescriptor, CollectionDescriptor)
@param aPath the cleaned path to the attribute
@param pathHints a Map containing the class to be used for a segment or <em>null</em>
if no segment was used.
@return ArrayList of AttributeDescriptors | [
"return",
"all",
"AttributeDescriptors",
"for",
"the",
"path<br",
">",
"ie",
":",
"partner",
".",
"addresses",
".",
"street",
"returns",
"a",
"Collection",
"of",
"3",
"AttributeDescriptors",
"(",
"ObjectReferenceDescriptor",
"CollectionDescriptor",
"FieldDescriptor",
... | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java#L1193-L1196 |
Jasig/uPortal | uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/PLFIntegrator.java | PLFIntegrator.appendChild | static Element appendChild(Element plfChild, Element parent, boolean copyChildren) {
Document document = parent.getOwnerDocument();
Element copy = (Element) document.importNode(plfChild, false);
parent.appendChild(copy);
// set the identifier for the doc if warrented
String id = copy.getAttribute(Constants.ATT_ID);
if (id != null && !id.equals("")) copy.setIdAttribute(Constants.ATT_ID, true);
if (copyChildren) {
NodeList children = plfChild.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
if (children.item(i) instanceof Element)
appendChild((Element) children.item(i), copy, true);
}
}
return copy;
} | java | static Element appendChild(Element plfChild, Element parent, boolean copyChildren) {
Document document = parent.getOwnerDocument();
Element copy = (Element) document.importNode(plfChild, false);
parent.appendChild(copy);
// set the identifier for the doc if warrented
String id = copy.getAttribute(Constants.ATT_ID);
if (id != null && !id.equals("")) copy.setIdAttribute(Constants.ATT_ID, true);
if (copyChildren) {
NodeList children = plfChild.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
if (children.item(i) instanceof Element)
appendChild((Element) children.item(i), copy, true);
}
}
return copy;
} | [
"static",
"Element",
"appendChild",
"(",
"Element",
"plfChild",
",",
"Element",
"parent",
",",
"boolean",
"copyChildren",
")",
"{",
"Document",
"document",
"=",
"parent",
".",
"getOwnerDocument",
"(",
")",
";",
"Element",
"copy",
"=",
"(",
"Element",
")",
"d... | This method copies a plf node and any of its children into the passed in compViewParent. | [
"This",
"method",
"copies",
"a",
"plf",
"node",
"and",
"any",
"of",
"its",
"children",
"into",
"the",
"passed",
"in",
"compViewParent",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/PLFIntegrator.java#L208-L225 |
Erudika/para | para-server/src/main/java/com/erudika/para/rest/RestUtils.java | RestUtils.getPagerFromParams | public static Pager getPagerFromParams(MultivaluedMap<String, String> params) {
Pager pager = new Pager();
pager.setPage(NumberUtils.toLong(paramOrDefault(params, "page", ""), 0));
if (pager.getPage() > Config.MAX_PAGES) {
pager.setPage(Config.MAX_PAGES);
}
pager.setLimit(NumberUtils.toInt(paramOrDefault(params, "limit", ""), pager.getLimit()));
if (pager.getLimit() > Config.MAX_PAGE_LIMIT) {
pager.setLimit(Config.MAX_PAGE_LIMIT);
}
pager.setSortby(paramOrDefault(params, "sort", pager.getSortby()));
pager.setDesc(Boolean.parseBoolean(paramOrDefault(params, "desc", "true")));
pager.setLastKey(paramOrDefault(params, "lastKey", null));
return pager;
} | java | public static Pager getPagerFromParams(MultivaluedMap<String, String> params) {
Pager pager = new Pager();
pager.setPage(NumberUtils.toLong(paramOrDefault(params, "page", ""), 0));
if (pager.getPage() > Config.MAX_PAGES) {
pager.setPage(Config.MAX_PAGES);
}
pager.setLimit(NumberUtils.toInt(paramOrDefault(params, "limit", ""), pager.getLimit()));
if (pager.getLimit() > Config.MAX_PAGE_LIMIT) {
pager.setLimit(Config.MAX_PAGE_LIMIT);
}
pager.setSortby(paramOrDefault(params, "sort", pager.getSortby()));
pager.setDesc(Boolean.parseBoolean(paramOrDefault(params, "desc", "true")));
pager.setLastKey(paramOrDefault(params, "lastKey", null));
return pager;
} | [
"public",
"static",
"Pager",
"getPagerFromParams",
"(",
"MultivaluedMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"{",
"Pager",
"pager",
"=",
"new",
"Pager",
"(",
")",
";",
"pager",
".",
"setPage",
"(",
"NumberUtils",
".",
"toLong",
"(",
"paramOr... | Returns a {@link Pager} instance populated from request parameters.
@param params query params map
@return a Pager | [
"Returns",
"a",
"{"
] | train | https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-server/src/main/java/com/erudika/para/rest/RestUtils.java#L898-L912 |
javalite/activejdbc | activejdbc/src/main/java/org/javalite/activejdbc/MetaModel.java | MetaModel.getAssociationForTarget | public <A extends Association> A getAssociationForTarget(Class<? extends Model> targetModelClass, Class<A> associationClass){
Association result = null;
for (Association association : associations) {
if (association.getClass().getName().equals(associationClass.getName()) && association.getTargetClass().getName().equals(targetModelClass.getName())) {
result = association; break;
}
}
return (A) result;
} | java | public <A extends Association> A getAssociationForTarget(Class<? extends Model> targetModelClass, Class<A> associationClass){
Association result = null;
for (Association association : associations) {
if (association.getClass().getName().equals(associationClass.getName()) && association.getTargetClass().getName().equals(targetModelClass.getName())) {
result = association; break;
}
}
return (A) result;
} | [
"public",
"<",
"A",
"extends",
"Association",
">",
"A",
"getAssociationForTarget",
"(",
"Class",
"<",
"?",
"extends",
"Model",
">",
"targetModelClass",
",",
"Class",
"<",
"A",
">",
"associationClass",
")",
"{",
"Association",
"result",
"=",
"null",
";",
"for... | Returns association of this table with the target table. Will return null if there is no association.
@param targetModelClass association of this model and the target model.
@param associationClass class of association in requested.
@return association of this table with the target table. Will return null if there is no association with target
table and specified type. | [
"Returns",
"association",
"of",
"this",
"table",
"with",
"the",
"target",
"table",
".",
"Will",
"return",
"null",
"if",
"there",
"is",
"no",
"association",
"."
] | train | https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/MetaModel.java#L292-L300 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/SavedState.java | SavedState.getString | public String getString(String nameOfField, String defaultValue) {
String value = (String) stringData.get(nameOfField);
if (value == null) {
return defaultValue;
}
return value;
} | java | public String getString(String nameOfField, String defaultValue) {
String value = (String) stringData.get(nameOfField);
if (value == null) {
return defaultValue;
}
return value;
} | [
"public",
"String",
"getString",
"(",
"String",
"nameOfField",
",",
"String",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"(",
"String",
")",
"stringData",
".",
"get",
"(",
"nameOfField",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"retur... | Get the String at the given location
@param nameOfField location of string
@param defaultValue The value to return if the specified value hasn't been set
@return String stored at the location given | [
"Get",
"the",
"String",
"at",
"the",
"given",
"location"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/SavedState.java#L110-L118 |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/VMCommandLine.java | VMCommandLine.launchVM | @Inline(value = "VMCommandLine.launchVM(($1).getCanonicalName(), ($2))", imported = {VMCommandLine.class},
statementExpression = true)
public static Process launchVM(Class<?> classToLaunch, String... additionalParams) throws IOException {
return launchVM(classToLaunch.getCanonicalName(), additionalParams);
} | java | @Inline(value = "VMCommandLine.launchVM(($1).getCanonicalName(), ($2))", imported = {VMCommandLine.class},
statementExpression = true)
public static Process launchVM(Class<?> classToLaunch, String... additionalParams) throws IOException {
return launchVM(classToLaunch.getCanonicalName(), additionalParams);
} | [
"@",
"Inline",
"(",
"value",
"=",
"\"VMCommandLine.launchVM(($1).getCanonicalName(), ($2))\"",
",",
"imported",
"=",
"{",
"VMCommandLine",
".",
"class",
"}",
",",
"statementExpression",
"=",
"true",
")",
"public",
"static",
"Process",
"launchVM",
"(",
"Class",
"<",
... | Run a new VM with the class path of the current VM.
@param classToLaunch is the class to launch.
@param additionalParams is the list of additional parameters
@return the process that is running the new virtual machine, neither <code>null</code>
@throws IOException when a IO error occurs. | [
"Run",
"a",
"new",
"VM",
"with",
"the",
"class",
"path",
"of",
"the",
"current",
"VM",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/VMCommandLine.java#L280-L284 |
UrielCh/ovh-java-sdk | ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java | ApiOvhDomain.serviceName_ukRegistrars_GET | public ArrayList<OvhUkRegistrar> serviceName_ukRegistrars_GET(String serviceName) throws IOException {
String qPath = "/domain/{serviceName}/ukRegistrars";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t4);
} | java | public ArrayList<OvhUkRegistrar> serviceName_ukRegistrars_GET(String serviceName) throws IOException {
String qPath = "/domain/{serviceName}/ukRegistrars";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t4);
} | [
"public",
"ArrayList",
"<",
"OvhUkRegistrar",
">",
"serviceName_ukRegistrars_GET",
"(",
"String",
"serviceName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/domain/{serviceName}/ukRegistrars\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
... | Return the list of all .uk registrars
REST: GET /domain/{serviceName}/ukRegistrars
@param serviceName [required] The internal name of your domain | [
"Return",
"the",
"list",
"of",
"all",
".",
"uk",
"registrars"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L1102-L1107 |
hyperledger/fabric-sdk-java | src/main/java/org/hyperledger/fabric/sdk/Channel.java | Channel.sendTransactionProposal | public Collection<ProposalResponse> sendTransactionProposal(TransactionProposalRequest transactionProposalRequest, Collection<Peer> peers) throws ProposalException, InvalidArgumentException {
return sendProposal(transactionProposalRequest, peers);
} | java | public Collection<ProposalResponse> sendTransactionProposal(TransactionProposalRequest transactionProposalRequest, Collection<Peer> peers) throws ProposalException, InvalidArgumentException {
return sendProposal(transactionProposalRequest, peers);
} | [
"public",
"Collection",
"<",
"ProposalResponse",
">",
"sendTransactionProposal",
"(",
"TransactionProposalRequest",
"transactionProposalRequest",
",",
"Collection",
"<",
"Peer",
">",
"peers",
")",
"throws",
"ProposalException",
",",
"InvalidArgumentException",
"{",
"return"... | Send a transaction proposal to specific peers.
@param transactionProposalRequest The transaction proposal to be sent to the peers.
@param peers
@return responses from peers.
@throws InvalidArgumentException
@throws ProposalException | [
"Send",
"a",
"transaction",
"proposal",
"to",
"specific",
"peers",
"."
] | train | https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/Channel.java#L4354-L4357 |
google/closure-templates | java/src/com/google/template/soy/jbcsrc/restricted/Expression.java | Expression.areAllCheap | public static boolean areAllCheap(Expression first, Expression... rest) {
return areAllCheap(ImmutableList.<Expression>builder().add(first).add(rest).build());
} | java | public static boolean areAllCheap(Expression first, Expression... rest) {
return areAllCheap(ImmutableList.<Expression>builder().add(first).add(rest).build());
} | [
"public",
"static",
"boolean",
"areAllCheap",
"(",
"Expression",
"first",
",",
"Expression",
"...",
"rest",
")",
"{",
"return",
"areAllCheap",
"(",
"ImmutableList",
".",
"<",
"Expression",
">",
"builder",
"(",
")",
".",
"add",
"(",
"first",
")",
".",
"add"... | Returns true if all referenced expressions are {@linkplain #isCheap() cheap}. | [
"Returns",
"true",
"if",
"all",
"referenced",
"expressions",
"are",
"{"
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/restricted/Expression.java#L162-L164 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/utils/SerializationUtils.java | SerializationUtils.fromByteArrayFst | public static <T> T fromByteArrayFst(byte[] data, Class<T> clazz) {
return fromByteArrayFst(data, clazz, null);
} | java | public static <T> T fromByteArrayFst(byte[] data, Class<T> clazz) {
return fromByteArrayFst(data, clazz, null);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"fromByteArrayFst",
"(",
"byte",
"[",
"]",
"data",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"return",
"fromByteArrayFst",
"(",
"data",
",",
"clazz",
",",
"null",
")",
";",
"}"
] | Deserialize a byte array back to an object.
<p>
This method uses FST lib.
</p>
@param data
@param clazz
@return
@since 0.6.0 | [
"Deserialize",
"a",
"byte",
"array",
"back",
"to",
"an",
"object",
"."
] | train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/SerializationUtils.java#L851-L853 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/CATMainConsumer.java | CATMainConsumer.unlockAll | public void unlockAll(int requestNumber, boolean incrementUnlockCount)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "unlockAll", new Object[]{requestNumber,incrementUnlockCount});
checkNotBrowserSession(); // F171893
if (subConsumer != null)
{
subConsumer.unlockAll(requestNumber,incrementUnlockCount);
}
else
{
super.unlockAll(requestNumber,incrementUnlockCount);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "unlockAll");
} | java | public void unlockAll(int requestNumber, boolean incrementUnlockCount)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "unlockAll", new Object[]{requestNumber,incrementUnlockCount});
checkNotBrowserSession(); // F171893
if (subConsumer != null)
{
subConsumer.unlockAll(requestNumber,incrementUnlockCount);
}
else
{
super.unlockAll(requestNumber,incrementUnlockCount);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "unlockAll");
} | [
"public",
"void",
"unlockAll",
"(",
"int",
"requestNumber",
",",
"boolean",
"incrementUnlockCount",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"th... | Unlocks all messages locked by this consumer and has an Option to
increment the unlock count or not on unlock of messages. This call
is delegated to the sub consumer if one exists or the
<code>CATConsumer</code> version is used.
@param requestNumber The request number which replies should be sent to.
@param incrementUnlockCount Option to increment the unlock count or not on unlock of messages | [
"Unlocks",
"all",
"messages",
"locked",
"by",
"this",
"consumer",
"and",
"has",
"an",
"Option",
"to",
"increment",
"the",
"unlock",
"count",
"or",
"not",
"on",
"unlock",
"of",
"messages",
".",
"This",
"call",
"is",
"delegated",
"to",
"the",
"sub",
"consume... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/CATMainConsumer.java#L1166-L1182 |
BellaDati/belladati-sdk-java | src/main/java/com/belladati/sdk/impl/BellaDatiServiceImpl.java | BellaDatiServiceImpl.readObject | private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
try {
Field domainList = getClass().getDeclaredField("domainList");
domainList.setAccessible(true);
domainList.set(this, new DomainList());
Field dashboardList = getClass().getDeclaredField("dashboardList");
dashboardList.setAccessible(true);
dashboardList.set(this, new DashboardList());
Field reportList = getClass().getDeclaredField("reportList");
reportList.setAccessible(true);
reportList.set(this, new ReportList());
Field dataSetList = getClass().getDeclaredField("dataSetList");
dataSetList.setAccessible(true);
dataSetList.set(this, new DataSetList());
Field commentLists = getClass().getDeclaredField("commentLists");
commentLists.setAccessible(true);
commentLists.set(this, Collections.synchronizedMap(new HashMap<String, PaginatedList<Comment>>()));
Field reportAttributeValues = getClass().getDeclaredField("dataSetAttributeValues");
reportAttributeValues.setAccessible(true);
reportAttributeValues.set(this, new HashMap<String, Map<String, CachedListImpl<AttributeValue>>>());
Field dataSourceList = getClass().getDeclaredField("dataSourceList");
dataSourceList.setAccessible(true);
dataSourceList.set(this, new HashMap<String, CachedListImpl<DataSource>>());
Field importFormList = getClass().getDeclaredField("importFormList");
importFormList.setAccessible(true);
importFormList.set(this, new ImportFormList());
Field dataSourceImportList = getClass().getDeclaredField("dataSourceImportList");
dataSourceImportList.setAccessible(true);
dataSourceImportList.set(this, new HashMap<String, CachedListImpl<DataSourceImport>>());
} catch (NoSuchFieldException e) {
throw new InternalConfigurationException("Failed to set service fields", e);
} catch (IllegalAccessException e) {
throw new InternalConfigurationException("Failed to set service fields", e);
} catch (SecurityException e) {
throw new InternalConfigurationException("Failed to set service fields", e);
} catch (IllegalArgumentException e) {
throw new InternalConfigurationException("Failed to set service fields", e);
}
} | java | private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
try {
Field domainList = getClass().getDeclaredField("domainList");
domainList.setAccessible(true);
domainList.set(this, new DomainList());
Field dashboardList = getClass().getDeclaredField("dashboardList");
dashboardList.setAccessible(true);
dashboardList.set(this, new DashboardList());
Field reportList = getClass().getDeclaredField("reportList");
reportList.setAccessible(true);
reportList.set(this, new ReportList());
Field dataSetList = getClass().getDeclaredField("dataSetList");
dataSetList.setAccessible(true);
dataSetList.set(this, new DataSetList());
Field commentLists = getClass().getDeclaredField("commentLists");
commentLists.setAccessible(true);
commentLists.set(this, Collections.synchronizedMap(new HashMap<String, PaginatedList<Comment>>()));
Field reportAttributeValues = getClass().getDeclaredField("dataSetAttributeValues");
reportAttributeValues.setAccessible(true);
reportAttributeValues.set(this, new HashMap<String, Map<String, CachedListImpl<AttributeValue>>>());
Field dataSourceList = getClass().getDeclaredField("dataSourceList");
dataSourceList.setAccessible(true);
dataSourceList.set(this, new HashMap<String, CachedListImpl<DataSource>>());
Field importFormList = getClass().getDeclaredField("importFormList");
importFormList.setAccessible(true);
importFormList.set(this, new ImportFormList());
Field dataSourceImportList = getClass().getDeclaredField("dataSourceImportList");
dataSourceImportList.setAccessible(true);
dataSourceImportList.set(this, new HashMap<String, CachedListImpl<DataSourceImport>>());
} catch (NoSuchFieldException e) {
throw new InternalConfigurationException("Failed to set service fields", e);
} catch (IllegalAccessException e) {
throw new InternalConfigurationException("Failed to set service fields", e);
} catch (SecurityException e) {
throw new InternalConfigurationException("Failed to set service fields", e);
} catch (IllegalArgumentException e) {
throw new InternalConfigurationException("Failed to set service fields", e);
}
} | [
"private",
"void",
"readObject",
"(",
"ObjectInputStream",
"in",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"in",
".",
"defaultReadObject",
"(",
")",
";",
"try",
"{",
"Field",
"domainList",
"=",
"getClass",
"(",
")",
".",
"getDeclaredField... | Deserialization. Sets up the element lists and maps as empty objects.
@param in Input stream of object to be de-serialized
@throws IOException Thrown if IO error occurs during class reading
@throws ClassNotFoundException Thrown if desired class does not exist | [
"Deserialization",
".",
"Sets",
"up",
"the",
"element",
"lists",
"and",
"maps",
"as",
"empty",
"objects",
"."
] | train | https://github.com/BellaDati/belladati-sdk-java/blob/1a732a57ebc825ddf47ce405723cc958adb1a43f/src/main/java/com/belladati/sdk/impl/BellaDatiServiceImpl.java#L556-L603 |
iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/graph/GraphRenderer.java | GraphRenderer.render | public void render(OutputStream target, Graph graph) throws IOException {
BufferedImage bi =
new BufferedImage(graph.width, graph.height,
GraphConfiguration.imageType);
Graphics2D g2d = bi.createGraphics();
graph.draw(g2d);
ImageIO.write(bi, "png", target);
} | java | public void render(OutputStream target, Graph graph) throws IOException {
BufferedImage bi =
new BufferedImage(graph.width, graph.height,
GraphConfiguration.imageType);
Graphics2D g2d = bi.createGraphics();
graph.draw(g2d);
ImageIO.write(bi, "png", target);
} | [
"public",
"void",
"render",
"(",
"OutputStream",
"target",
",",
"Graph",
"graph",
")",
"throws",
"IOException",
"{",
"BufferedImage",
"bi",
"=",
"new",
"BufferedImage",
"(",
"graph",
".",
"width",
",",
"graph",
".",
"height",
",",
"GraphConfiguration",
".",
... | Send a PNG format byte stream for the argument Graph to the provided
OutputStream
@param target OutputStream to write PNG format bytes
@param graph Graph to send to the target
@throws IOException for usual reasons. | [
"Send",
"a",
"PNG",
"format",
"byte",
"stream",
"for",
"the",
"argument",
"Graph",
"to",
"the",
"provided",
"OutputStream"
] | train | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/graph/GraphRenderer.java#L87-L95 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/Environment.java | Environment.callService | public void callService(String url, String templateName, Object model, XmlHttpResponse result) {
callService(url, templateName, model, result, null);
} | java | public void callService(String url, String templateName, Object model, XmlHttpResponse result) {
callService(url, templateName, model, result, null);
} | [
"public",
"void",
"callService",
"(",
"String",
"url",
",",
"String",
"templateName",
",",
"Object",
"model",
",",
"XmlHttpResponse",
"result",
")",
"{",
"callService",
"(",
"url",
",",
"templateName",
",",
"model",
",",
"result",
",",
"null",
")",
";",
"}... | Performs POST to supplied url of result of applying template with model.
All namespaces registered in this environment will be registered with result.
@param url url to post to.
@param templateName name of template to use.
@param model model for template.
@param result result to populate with response. | [
"Performs",
"POST",
"to",
"supplied",
"url",
"of",
"result",
"of",
"applying",
"template",
"with",
"model",
".",
"All",
"namespaces",
"registered",
"in",
"this",
"environment",
"will",
"be",
"registered",
"with",
"result",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/Environment.java#L234-L236 |
astrapi69/jaulp-wicket | jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/socialnet/googleplus/share/GooglePlusSharePanel.java | GooglePlusSharePanel.newWebMarkupContainer | protected WebMarkupContainer newWebMarkupContainer(final String id,
final IModel<GooglePlusShareModelBean> model)
{
final WebMarkupContainer googlePlusButton = ComponentFactory.newWebMarkupContainer(id,
model);
googlePlusButton.add(new AttributeModifier("class", model.getObject().getCssClass()));
googlePlusButton
.add(new AttributeModifier("data-annotation", model.getObject().getDataAnnotation()));
googlePlusButton.add(new AttributeModifier("data-width", model.getObject().getDataWith()));
googlePlusButton.add(new AttributeModifier("data-href", model.getObject().getDataHref()));
return googlePlusButton;
} | java | protected WebMarkupContainer newWebMarkupContainer(final String id,
final IModel<GooglePlusShareModelBean> model)
{
final WebMarkupContainer googlePlusButton = ComponentFactory.newWebMarkupContainer(id,
model);
googlePlusButton.add(new AttributeModifier("class", model.getObject().getCssClass()));
googlePlusButton
.add(new AttributeModifier("data-annotation", model.getObject().getDataAnnotation()));
googlePlusButton.add(new AttributeModifier("data-width", model.getObject().getDataWith()));
googlePlusButton.add(new AttributeModifier("data-href", model.getObject().getDataHref()));
return googlePlusButton;
} | [
"protected",
"WebMarkupContainer",
"newWebMarkupContainer",
"(",
"final",
"String",
"id",
",",
"final",
"IModel",
"<",
"GooglePlusShareModelBean",
">",
"model",
")",
"{",
"final",
"WebMarkupContainer",
"googlePlusButton",
"=",
"ComponentFactory",
".",
"newWebMarkupContain... | Factory method for creating the new {@link WebMarkupContainer}. This method is invoked in the
constructor from the derived classes and can be overridden so users can provide their own
version of a new {@link WebMarkupContainer}.
@param id
the id
@param model
the model
@return the new {@link WebMarkupContainer} | [
"Factory",
"method",
"for",
"creating",
"the",
"new",
"{",
"@link",
"WebMarkupContainer",
"}",
".",
"This",
"method",
"is",
"invoked",
"in",
"the",
"constructor",
"from",
"the",
"derived",
"classes",
"and",
"can",
"be",
"overridden",
"so",
"users",
"can",
"p... | train | https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/socialnet/googleplus/share/GooglePlusSharePanel.java#L102-L113 |
lukas-krecan/JsonUnit | json-unit/src/main/java/net/javacrumbs/jsonunit/JsonAssert.java | JsonAssert.assertJsonPartEquals | public static void assertJsonPartEquals(Object expected, Object fullJson, String path, Configuration configuration) {
Diff diff = create(expected, fullJson, FULL_JSON, path, configuration);
diff.failIfDifferent();
} | java | public static void assertJsonPartEquals(Object expected, Object fullJson, String path, Configuration configuration) {
Diff diff = create(expected, fullJson, FULL_JSON, path, configuration);
diff.failIfDifferent();
} | [
"public",
"static",
"void",
"assertJsonPartEquals",
"(",
"Object",
"expected",
",",
"Object",
"fullJson",
",",
"String",
"path",
",",
"Configuration",
"configuration",
")",
"{",
"Diff",
"diff",
"=",
"create",
"(",
"expected",
",",
"fullJson",
",",
"FULL_JSON",
... | Compares part of the JSON. Path has this format "root.array[0].value". | [
"Compares",
"part",
"of",
"the",
"JSON",
".",
"Path",
"has",
"this",
"format",
"root",
".",
"array",
"[",
"0",
"]",
".",
"value",
"."
] | train | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit/src/main/java/net/javacrumbs/jsonunit/JsonAssert.java#L80-L83 |
FasterXML/woodstox | src/main/java/com/ctc/wstx/dtd/DTDValidatorBase.java | DTDValidatorBase.mayHaveNsDefaults | @Override
public boolean mayHaveNsDefaults(String elemPrefix, String elemLN)
{
mTmpKey.reset(elemPrefix, elemLN);
DTDElement elem = mElemSpecs.get(mTmpKey);
mCurrElem = elem;
return (elem != null) && elem.hasNsDefaults();
} | java | @Override
public boolean mayHaveNsDefaults(String elemPrefix, String elemLN)
{
mTmpKey.reset(elemPrefix, elemLN);
DTDElement elem = mElemSpecs.get(mTmpKey);
mCurrElem = elem;
return (elem != null) && elem.hasNsDefaults();
} | [
"@",
"Override",
"public",
"boolean",
"mayHaveNsDefaults",
"(",
"String",
"elemPrefix",
",",
"String",
"elemLN",
")",
"{",
"mTmpKey",
".",
"reset",
"(",
"elemPrefix",
",",
"elemLN",
")",
";",
"DTDElement",
"elem",
"=",
"mElemSpecs",
".",
"get",
"(",
"mTmpKey... | Calling this method before {@link #checkNsDefaults} is necessary
to pass information regarding the current element; although
it will become available later on (via normal XMLValidator interface),
that's too late (after namespace binding and resolving). | [
"Calling",
"this",
"method",
"before",
"{"
] | train | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/dtd/DTDValidatorBase.java#L381-L388 |
albfernandez/itext2 | src/main/java/com/lowagie/text/Image.java | Image.getInstance | public static Image getInstance(int width, int height, byte[] data, byte[] globals) {
Image img = new ImgJBIG2(width, height, data, globals);
return img;
} | java | public static Image getInstance(int width, int height, byte[] data, byte[] globals) {
Image img = new ImgJBIG2(width, height, data, globals);
return img;
} | [
"public",
"static",
"Image",
"getInstance",
"(",
"int",
"width",
",",
"int",
"height",
",",
"byte",
"[",
"]",
"data",
",",
"byte",
"[",
"]",
"globals",
")",
"{",
"Image",
"img",
"=",
"new",
"ImgJBIG2",
"(",
"width",
",",
"height",
",",
"data",
",",
... | Creates a JBIG2 Image.
@param width the width of the image
@param height the height of the image
@param data the raw image data
@param globals JBIG2 globals
@since 2.1.5 | [
"Creates",
"a",
"JBIG2",
"Image",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/Image.java#L477-L480 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/BaseField.java | BaseField.createScreenComponent | public static ScreenComponent createScreenComponent(String componentType, ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, Map<String,Object> properties)
{
String screenFieldClass = null;
if (!componentType.contains("."))
screenFieldClass = ScreenModel.BASE_PACKAGE + componentType;
else if (componentType.startsWith("."))
screenFieldClass = DBConstants.ROOT_PACKAGE + componentType.substring(1);
else
screenFieldClass = componentType;
ScreenComponent screenField = (ScreenComponent)ClassServiceUtility.getClassService().makeObjectFromClassName(screenFieldClass);
if (screenField == null)
{
Utility.getLogger().warning("Screen component not found " + componentType);
screenField = (ScreenComponent)ClassServiceUtility.getClassService().makeObjectFromClassName(ScreenModel.BASE_PACKAGE + ScreenModel.EDIT_TEXT);
}
screenField.init(itsLocation, targetScreen, converter, iDisplayFieldDesc, properties);
return screenField;
} | java | public static ScreenComponent createScreenComponent(String componentType, ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, Map<String,Object> properties)
{
String screenFieldClass = null;
if (!componentType.contains("."))
screenFieldClass = ScreenModel.BASE_PACKAGE + componentType;
else if (componentType.startsWith("."))
screenFieldClass = DBConstants.ROOT_PACKAGE + componentType.substring(1);
else
screenFieldClass = componentType;
ScreenComponent screenField = (ScreenComponent)ClassServiceUtility.getClassService().makeObjectFromClassName(screenFieldClass);
if (screenField == null)
{
Utility.getLogger().warning("Screen component not found " + componentType);
screenField = (ScreenComponent)ClassServiceUtility.getClassService().makeObjectFromClassName(ScreenModel.BASE_PACKAGE + ScreenModel.EDIT_TEXT);
}
screenField.init(itsLocation, targetScreen, converter, iDisplayFieldDesc, properties);
return screenField;
} | [
"public",
"static",
"ScreenComponent",
"createScreenComponent",
"(",
"String",
"componentType",
",",
"ScreenLoc",
"itsLocation",
",",
"ComponentParent",
"targetScreen",
",",
"Convert",
"converter",
",",
"int",
"iDisplayFieldDesc",
",",
"Map",
"<",
"String",
",",
"Obje... | Create a screen component of this type.
@param componentType
@param itsLocation
@param targetScreen
@param convert
@param iDisplayFieldDesc
@param properties
@return | [
"Create",
"a",
"screen",
"component",
"of",
"this",
"type",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/BaseField.java#L1412-L1429 |
UrielCh/ovh-java-sdk | ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java | ApiOvhCloud.serviceName_pca_pcaServiceName_sessions_sessionId_files_fileId_GET | public OvhFile serviceName_pca_pcaServiceName_sessions_sessionId_files_fileId_GET(String serviceName, String pcaServiceName, String sessionId, String fileId) throws IOException {
String qPath = "/cloud/{serviceName}/pca/{pcaServiceName}/sessions/{sessionId}/files/{fileId}";
StringBuilder sb = path(qPath, serviceName, pcaServiceName, sessionId, fileId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhFile.class);
} | java | public OvhFile serviceName_pca_pcaServiceName_sessions_sessionId_files_fileId_GET(String serviceName, String pcaServiceName, String sessionId, String fileId) throws IOException {
String qPath = "/cloud/{serviceName}/pca/{pcaServiceName}/sessions/{sessionId}/files/{fileId}";
StringBuilder sb = path(qPath, serviceName, pcaServiceName, sessionId, fileId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhFile.class);
} | [
"public",
"OvhFile",
"serviceName_pca_pcaServiceName_sessions_sessionId_files_fileId_GET",
"(",
"String",
"serviceName",
",",
"String",
"pcaServiceName",
",",
"String",
"sessionId",
",",
"String",
"fileId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/cl... | Get this object properties
REST: GET /cloud/{serviceName}/pca/{pcaServiceName}/sessions/{sessionId}/files/{fileId}
@param serviceName [required] The internal name of your public cloud passport
@param pcaServiceName [required] The internal name of your PCA offer
@param sessionId [required] Session ID
@param fileId [required] File id
@deprecated | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L2515-L2520 |
davidcarboni-archive/httpino | src/main/java/com/github/davidcarboni/httpino/Endpoint.java | Endpoint.setParameter | public Endpoint setParameter(String name, Object value) {
Endpoint configured = new Endpoint(this);
if (StringUtils.isNotBlank(name) && value != null) {
configured.parameters.put(name, value.toString());
}
return configured;
} | java | public Endpoint setParameter(String name, Object value) {
Endpoint configured = new Endpoint(this);
if (StringUtils.isNotBlank(name) && value != null) {
configured.parameters.put(name, value.toString());
}
return configured;
} | [
"public",
"Endpoint",
"setParameter",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"Endpoint",
"configured",
"=",
"new",
"Endpoint",
"(",
"this",
")",
";",
"if",
"(",
"StringUtils",
".",
"isNotBlank",
"(",
"name",
")",
"&&",
"value",
"!=",
"n... | Creates a new {@link Endpoint} instance with an additional GET parameter.
Typical usage is to add a request-specific parameter to an endpoint, which is why this method returns a new instance, rather than modifying the existing one.
This allows you add different parameters/values at different times without affecting the original instance.
@param name The parameter name.
@param value The parameter value.
@return A new {@link Endpoint} instance with the specified parameter added. | [
"Creates",
"a",
"new",
"{",
"@link",
"Endpoint",
"}",
"instance",
"with",
"an",
"additional",
"GET",
"parameter",
"."
] | train | https://github.com/davidcarboni-archive/httpino/blob/a78c91874e6d9b2e452cf3aa68d4fea804d977ca/src/main/java/com/github/davidcarboni/httpino/Endpoint.java#L74-L80 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnsessionpolicy_binding.java | vpnsessionpolicy_binding.get | public static vpnsessionpolicy_binding get(nitro_service service, String name) throws Exception{
vpnsessionpolicy_binding obj = new vpnsessionpolicy_binding();
obj.set_name(name);
vpnsessionpolicy_binding response = (vpnsessionpolicy_binding) obj.get_resource(service);
return response;
} | java | public static vpnsessionpolicy_binding get(nitro_service service, String name) throws Exception{
vpnsessionpolicy_binding obj = new vpnsessionpolicy_binding();
obj.set_name(name);
vpnsessionpolicy_binding response = (vpnsessionpolicy_binding) obj.get_resource(service);
return response;
} | [
"public",
"static",
"vpnsessionpolicy_binding",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"vpnsessionpolicy_binding",
"obj",
"=",
"new",
"vpnsessionpolicy_binding",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"... | Use this API to fetch vpnsessionpolicy_binding resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"vpnsessionpolicy_binding",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnsessionpolicy_binding.java#L136-L141 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/BindDataSourceBuilder.java | BindDataSourceBuilder.generateSchema | private static void generateSchema(SQLiteDatabaseSchema schema) throws FileNotFoundException, IOException {
// when we run in JUNIT of Kripton, we don't have to generate schemas
// if (BindDataSourceSubProcessor.JUNIT_TEST_MODE)
// return;
if (!schema.generateSchema)
return;
// and now, write schema.create.v and schema.drop.v
String schemaCreation = defineFileName(schema);
String schemaLocation = KriptonOptions.getSchemaLocation();
File schemaCreatePath = new File(schemaLocation).getAbsoluteFile();
File schemaCreateFile = new File(schemaLocation, schemaCreation).getAbsoluteFile();
schemaCreatePath.mkdirs();
AnnotationProcessorUtilis.infoOnGeneratedFile(BindDataSource.class, schemaCreateFile);
FileOutputStream fos = new FileOutputStream(schemaCreateFile);
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fos));
bw.write("------------------------------------------------------------------------------------\n");
bw.write("--\n");
bw.write("-- Filename: " + schemaCreation + "\n");
bw.write("--\n");
bw.write(String.format("-- Date: %s", (new Date()).toString()) + "\n");
bw.write("--\n");
if (!BindDataSourceSubProcessor.JUNIT_TEST_MODE) {
bw.write(String.format("-- This file was generated by Kripton Annotation Processor v. %s\n",
Version.getVersion()));
bw.write(String.format("--\n"));
}
bw.write("------------------------------------------------------------------------------------\n");
bw.newLine();
for (String sql : schema.sqlForCreate) {
bw.write(sql);
bw.newLine();
}
bw.close();
} | java | private static void generateSchema(SQLiteDatabaseSchema schema) throws FileNotFoundException, IOException {
// when we run in JUNIT of Kripton, we don't have to generate schemas
// if (BindDataSourceSubProcessor.JUNIT_TEST_MODE)
// return;
if (!schema.generateSchema)
return;
// and now, write schema.create.v and schema.drop.v
String schemaCreation = defineFileName(schema);
String schemaLocation = KriptonOptions.getSchemaLocation();
File schemaCreatePath = new File(schemaLocation).getAbsoluteFile();
File schemaCreateFile = new File(schemaLocation, schemaCreation).getAbsoluteFile();
schemaCreatePath.mkdirs();
AnnotationProcessorUtilis.infoOnGeneratedFile(BindDataSource.class, schemaCreateFile);
FileOutputStream fos = new FileOutputStream(schemaCreateFile);
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fos));
bw.write("------------------------------------------------------------------------------------\n");
bw.write("--\n");
bw.write("-- Filename: " + schemaCreation + "\n");
bw.write("--\n");
bw.write(String.format("-- Date: %s", (new Date()).toString()) + "\n");
bw.write("--\n");
if (!BindDataSourceSubProcessor.JUNIT_TEST_MODE) {
bw.write(String.format("-- This file was generated by Kripton Annotation Processor v. %s\n",
Version.getVersion()));
bw.write(String.format("--\n"));
}
bw.write("------------------------------------------------------------------------------------\n");
bw.newLine();
for (String sql : schema.sqlForCreate) {
bw.write(sql);
bw.newLine();
}
bw.close();
} | [
"private",
"static",
"void",
"generateSchema",
"(",
"SQLiteDatabaseSchema",
"schema",
")",
"throws",
"FileNotFoundException",
",",
"IOException",
"{",
"// when we run in JUNIT of Kripton, we don't have to generate schemas",
"// if (BindDataSourceSubProcessor.JUNIT_TEST_MODE)",
"// retu... | Generate schema.
@param schema
the schema
@throws FileNotFoundException
the file not found exception
@throws IOException
Signals that an I/O exception has occurred. | [
"Generate",
"schema",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/BindDataSourceBuilder.java#L159-L197 |
hellojavaer/ddal | ddal-sequence/src/main/java/org/hellojavaer/ddal/sequence/HttpSequenceRangeGetter.java | HttpSequenceRangeGetter.get | @Override
public SequenceRange get(String schemaName, String tableName, int step) throws Exception {
Map<String, String> param = new HashMap<>();
param.put("clientId", clientId);
param.put("accessToken", accessToken);
param.put("schemaName", schemaName);
param.put("tableName", tableName);
param.put("step", String.valueOf(step));
String result = HttpUtils.sendPost(accessUrl, param);
Map<String, String> resultMap = parseHttpKvString(result);
if (resultMap.isEmpty()) {
return null;
} else {
if (resultMap.get("errorCode") != null) {
authorize();
result = HttpUtils.sendPost(accessUrl, param);
resultMap = parseHttpKvString(result);
if (resultMap.get("errorCode") != null) {
throw new GetSequenceFailedException("clientId:" + clientId
+ " access data failed, return message is:" + result);
}
}
SequenceRange sequenceRange = new SequenceRange();
sequenceRange.setBeginValue(parseLong(resultMap.get("beginValue")));
sequenceRange.setEndValue(parseLong(resultMap.get("endValue")));
return sequenceRange;
}
} | java | @Override
public SequenceRange get(String schemaName, String tableName, int step) throws Exception {
Map<String, String> param = new HashMap<>();
param.put("clientId", clientId);
param.put("accessToken", accessToken);
param.put("schemaName", schemaName);
param.put("tableName", tableName);
param.put("step", String.valueOf(step));
String result = HttpUtils.sendPost(accessUrl, param);
Map<String, String> resultMap = parseHttpKvString(result);
if (resultMap.isEmpty()) {
return null;
} else {
if (resultMap.get("errorCode") != null) {
authorize();
result = HttpUtils.sendPost(accessUrl, param);
resultMap = parseHttpKvString(result);
if (resultMap.get("errorCode") != null) {
throw new GetSequenceFailedException("clientId:" + clientId
+ " access data failed, return message is:" + result);
}
}
SequenceRange sequenceRange = new SequenceRange();
sequenceRange.setBeginValue(parseLong(resultMap.get("beginValue")));
sequenceRange.setEndValue(parseLong(resultMap.get("endValue")));
return sequenceRange;
}
} | [
"@",
"Override",
"public",
"SequenceRange",
"get",
"(",
"String",
"schemaName",
",",
"String",
"tableName",
",",
"int",
"step",
")",
"throws",
"Exception",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"param",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";"... | param: clientId= &accessToken= &schemaName= &tableName= &step=
return: beginValue= &endValue= &errorCode= &errorMessage= | [
"param",
":",
"clientId",
"=",
"&accessToken",
"=",
"&schemaName",
"=",
"&tableName",
"=",
"&step",
"=",
"return",
":",
"beginValue",
"=",
"&endValue",
"=",
"&errorCode",
"=",
"&errorMessage",
"="
] | train | https://github.com/hellojavaer/ddal/blob/876dc32ece8bb983df64e94bdcc9045f0ee5cc3b/ddal-sequence/src/main/java/org/hellojavaer/ddal/sequence/HttpSequenceRangeGetter.java#L52-L79 |
jbundle/jbundle | main/msg/src/main/java/org/jbundle/main/msg/db/MessageTransport.java | MessageTransport.createMessageTransport | public Object createMessageTransport(String messageTransportType, Task task)
{
MessageTransport messageTransport = this.getMessageTransport(messageTransportType);
String className = null;
if (messageTransport != null)
className = ((PropertiesField)messageTransport.getField(MessageTransport.PROPERTIES)).getProperty("className");
if (className == null)
{
String packageName = BaseMessageTransport.class.getPackage().getName();
className = packageName + '.' + messageTransportType.toLowerCase() + '.' + messageTransportType + "MessageTransport";
}
BaseMessageTransport transport = (BaseMessageTransport)ClassServiceUtility.getClassService().makeObjectFromClassName(className);
if (transport != null)
transport.init(task, null, null);
return transport;
} | java | public Object createMessageTransport(String messageTransportType, Task task)
{
MessageTransport messageTransport = this.getMessageTransport(messageTransportType);
String className = null;
if (messageTransport != null)
className = ((PropertiesField)messageTransport.getField(MessageTransport.PROPERTIES)).getProperty("className");
if (className == null)
{
String packageName = BaseMessageTransport.class.getPackage().getName();
className = packageName + '.' + messageTransportType.toLowerCase() + '.' + messageTransportType + "MessageTransport";
}
BaseMessageTransport transport = (BaseMessageTransport)ClassServiceUtility.getClassService().makeObjectFromClassName(className);
if (transport != null)
transport.init(task, null, null);
return transport;
} | [
"public",
"Object",
"createMessageTransport",
"(",
"String",
"messageTransportType",
",",
"Task",
"task",
")",
"{",
"MessageTransport",
"messageTransport",
"=",
"this",
".",
"getMessageTransport",
"(",
"messageTransportType",
")",
";",
"String",
"className",
"=",
"nul... | Get the message transport for this type
@param messageTransportType
@returns The concrete BaseMessageTransport implementation. | [
"Get",
"the",
"message",
"transport",
"for",
"this",
"type"
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg/src/main/java/org/jbundle/main/msg/db/MessageTransport.java#L221-L237 |
gallandarakhneorg/afc | advanced/gis/gisinputoutput/src/main/java/org/arakhne/afc/gis/io/xml/XMLGISElementUtil.java | XMLGISElementUtil.readMapElement | public static MapElement readMapElement(Element element, String elementNodeName,
PathBuilder pathBuilder, XMLResources resources) throws IOException {
return readMapElement(element, elementNodeName, null, pathBuilder, resources);
} | java | public static MapElement readMapElement(Element element, String elementNodeName,
PathBuilder pathBuilder, XMLResources resources) throws IOException {
return readMapElement(element, elementNodeName, null, pathBuilder, resources);
} | [
"public",
"static",
"MapElement",
"readMapElement",
"(",
"Element",
"element",
",",
"String",
"elementNodeName",
",",
"PathBuilder",
"pathBuilder",
",",
"XMLResources",
"resources",
")",
"throws",
"IOException",
"{",
"return",
"readMapElement",
"(",
"element",
",",
... | Read a map element from the XML description.
@param element is the XML node to read.
@param elementNodeName is the name of the XML node that should contains the map element data.
It must be one of {@link #NODE_POINT}, {@link #NODE_CIRCLE}, {@link #NODE_POLYGON}, {@link #NODE_POLYLINE},
{@link #NODE_MULTIPOINT}, or {@code null} for the XML node name itself.
@param pathBuilder is the tool to make paths absolute.
@param resources is the tool that permits to gather the resources.
@return the map element.
@throws IOException in case of error. | [
"Read",
"a",
"map",
"element",
"from",
"the",
"XML",
"description",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisinputoutput/src/main/java/org/arakhne/afc/gis/io/xml/XMLGISElementUtil.java#L239-L242 |
openbase/jul | schedule/src/main/java/org/openbase/jul/schedule/Timeout.java | Timeout.internal_start | private void internal_start(final long waitTime) throws RejectedExecutionException, CouldNotPerformException {
synchronized (lock) {
if (isActive()) {
logger.debug("Reject start, not interrupted or expired.");
return;
}
expired = false;
timerTask = GlobalScheduledExecutorService.schedule((Callable<Void>) () -> {
synchronized (lock) {
try {
logger.debug("Wait for timeout TimeOut interrupted.");
if (timerTask.isCancelled()) {
logger.debug("TimeOut was canceled.");
return null;
}
logger.debug("Expire...");
expired = true;
} finally {
timerTask = null;
}
}
try {
expired();
} catch (Exception ex) {
ExceptionPrinter.printHistory(new CouldNotPerformException("Error during timeout handling!", ex), logger, LogLevel.WARN);
}
logger.debug("Worker finished.");
return null;
}, waitTime, TimeUnit.MILLISECONDS);
}
} | java | private void internal_start(final long waitTime) throws RejectedExecutionException, CouldNotPerformException {
synchronized (lock) {
if (isActive()) {
logger.debug("Reject start, not interrupted or expired.");
return;
}
expired = false;
timerTask = GlobalScheduledExecutorService.schedule((Callable<Void>) () -> {
synchronized (lock) {
try {
logger.debug("Wait for timeout TimeOut interrupted.");
if (timerTask.isCancelled()) {
logger.debug("TimeOut was canceled.");
return null;
}
logger.debug("Expire...");
expired = true;
} finally {
timerTask = null;
}
}
try {
expired();
} catch (Exception ex) {
ExceptionPrinter.printHistory(new CouldNotPerformException("Error during timeout handling!", ex), logger, LogLevel.WARN);
}
logger.debug("Worker finished.");
return null;
}, waitTime, TimeUnit.MILLISECONDS);
}
} | [
"private",
"void",
"internal_start",
"(",
"final",
"long",
"waitTime",
")",
"throws",
"RejectedExecutionException",
",",
"CouldNotPerformException",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"if",
"(",
"isActive",
"(",
")",
")",
"{",
"logger",
".",
"debug",
... | Internal synchronized start method.
@param waitTime The time to wait until the timeout is reached.
@throws RejectedExecutionException is thrown if the timeout task could not be scheduled.
@throws CouldNotPerformException is thrown in case the timeout could not be started. | [
"Internal",
"synchronized",
"start",
"method",
"."
] | train | https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/schedule/src/main/java/org/openbase/jul/schedule/Timeout.java#L167-L198 |
JOML-CI/JOML | src/org/joml/Quaternionf.java | Quaternionf.rotationAxis | public Quaternionf rotationAxis(float angle, Vector3fc axis) {
return rotationAxis(angle, axis.x(), axis.y(), axis.z());
} | java | public Quaternionf rotationAxis(float angle, Vector3fc axis) {
return rotationAxis(angle, axis.x(), axis.y(), axis.z());
} | [
"public",
"Quaternionf",
"rotationAxis",
"(",
"float",
"angle",
",",
"Vector3fc",
"axis",
")",
"{",
"return",
"rotationAxis",
"(",
"angle",
",",
"axis",
".",
"x",
"(",
")",
",",
"axis",
".",
"y",
"(",
")",
",",
"axis",
".",
"z",
"(",
")",
")",
";",... | Set this quaternion to a rotation of the given angle in radians about the supplied axis.
@see #rotationAxis(float, float, float, float)
@param angle
the rotation angle in radians
@param axis
the axis to rotate about
@return this | [
"Set",
"this",
"quaternion",
"to",
"a",
"rotation",
"of",
"the",
"given",
"angle",
"in",
"radians",
"about",
"the",
"supplied",
"axis",
"."
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Quaternionf.java#L552-L554 |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/equation/TokenList.java | TokenList.extractSubList | public TokenList extractSubList( Token begin , Token end ) {
if( begin == end ) {
remove(begin);
return new TokenList(begin,begin);
} else {
if( first == begin ) {
first = end.next;
}
if( last == end ) {
last = begin.previous;
}
if( begin.previous != null ) {
begin.previous.next = end.next;
}
if( end.next != null ) {
end.next.previous = begin.previous;
}
begin.previous = null;
end.next = null;
TokenList ret = new TokenList(begin,end);
size -= ret.size();
return ret;
}
} | java | public TokenList extractSubList( Token begin , Token end ) {
if( begin == end ) {
remove(begin);
return new TokenList(begin,begin);
} else {
if( first == begin ) {
first = end.next;
}
if( last == end ) {
last = begin.previous;
}
if( begin.previous != null ) {
begin.previous.next = end.next;
}
if( end.next != null ) {
end.next.previous = begin.previous;
}
begin.previous = null;
end.next = null;
TokenList ret = new TokenList(begin,end);
size -= ret.size();
return ret;
}
} | [
"public",
"TokenList",
"extractSubList",
"(",
"Token",
"begin",
",",
"Token",
"end",
")",
"{",
"if",
"(",
"begin",
"==",
"end",
")",
"{",
"remove",
"(",
"begin",
")",
";",
"return",
"new",
"TokenList",
"(",
"begin",
",",
"begin",
")",
";",
"}",
"else... | Removes elements from begin to end from the list, inclusive. Returns a new list which
is composed of the removed elements | [
"Removes",
"elements",
"from",
"begin",
"to",
"end",
"from",
"the",
"list",
"inclusive",
".",
"Returns",
"a",
"new",
"list",
"which",
"is",
"composed",
"of",
"the",
"removed",
"elements"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/TokenList.java#L188-L212 |
apache/incubator-gobblin | gobblin-modules/gobblin-crypto/src/main/java/org/apache/gobblin/crypto/GPGFileDecryptor.java | GPGFileDecryptor.decryptFile | public InputStream decryptFile(InputStream inputStream, String passPhrase) throws IOException {
PGPEncryptedDataList enc = getPGPEncryptedDataList(inputStream);
PGPPBEEncryptedData pbe = (PGPPBEEncryptedData) enc.get(0);
InputStream clear;
try {
clear = pbe.getDataStream(new JcePBEDataDecryptorFactoryBuilder(
new JcaPGPDigestCalculatorProviderBuilder().setProvider(BouncyCastleProvider.PROVIDER_NAME).build())
.setProvider(BouncyCastleProvider.PROVIDER_NAME).build(passPhrase.toCharArray()));
JcaPGPObjectFactory pgpFact = new JcaPGPObjectFactory(clear);
return new LazyMaterializeDecryptorInputStream(pgpFact);
} catch (PGPException e) {
throw new IOException(e);
}
} | java | public InputStream decryptFile(InputStream inputStream, String passPhrase) throws IOException {
PGPEncryptedDataList enc = getPGPEncryptedDataList(inputStream);
PGPPBEEncryptedData pbe = (PGPPBEEncryptedData) enc.get(0);
InputStream clear;
try {
clear = pbe.getDataStream(new JcePBEDataDecryptorFactoryBuilder(
new JcaPGPDigestCalculatorProviderBuilder().setProvider(BouncyCastleProvider.PROVIDER_NAME).build())
.setProvider(BouncyCastleProvider.PROVIDER_NAME).build(passPhrase.toCharArray()));
JcaPGPObjectFactory pgpFact = new JcaPGPObjectFactory(clear);
return new LazyMaterializeDecryptorInputStream(pgpFact);
} catch (PGPException e) {
throw new IOException(e);
}
} | [
"public",
"InputStream",
"decryptFile",
"(",
"InputStream",
"inputStream",
",",
"String",
"passPhrase",
")",
"throws",
"IOException",
"{",
"PGPEncryptedDataList",
"enc",
"=",
"getPGPEncryptedDataList",
"(",
"inputStream",
")",
";",
"PGPPBEEncryptedData",
"pbe",
"=",
"... | Taking in a file inputstream and a passPhrase, generate a decrypted file inputstream.
@param inputStream file inputstream
@param passPhrase passPhrase
@return
@throws IOException | [
"Taking",
"in",
"a",
"file",
"inputstream",
"and",
"a",
"passPhrase",
"generate",
"a",
"decrypted",
"file",
"inputstream",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-crypto/src/main/java/org/apache/gobblin/crypto/GPGFileDecryptor.java#L62-L79 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/service/db/DBTransaction.java | DBTransaction.deleteColumns | public void deleteColumns(String storeName, String rowKey, Collection<String> columnNames) {
for(String columnName: columnNames) {
deleteColumn(storeName, rowKey, columnName);
}
} | java | public void deleteColumns(String storeName, String rowKey, Collection<String> columnNames) {
for(String columnName: columnNames) {
deleteColumn(storeName, rowKey, columnName);
}
} | [
"public",
"void",
"deleteColumns",
"(",
"String",
"storeName",
",",
"String",
"rowKey",
",",
"Collection",
"<",
"String",
">",
"columnNames",
")",
"{",
"for",
"(",
"String",
"columnName",
":",
"columnNames",
")",
"{",
"deleteColumn",
"(",
"storeName",
",",
"... | Add updates that will delete all given columns names for the given store name and
row key. If a column update exists for the same store/row/column, the results are
undefined when the transaction is committed.
@param storeName Name of store that owns row.
@param rowKey Row key in string form.
@param columnNames Collection of column names in string form. | [
"Add",
"updates",
"that",
"will",
"delete",
"all",
"given",
"columns",
"names",
"for",
"the",
"given",
"store",
"name",
"and",
"row",
"key",
".",
"If",
"a",
"column",
"update",
"exists",
"for",
"the",
"same",
"store",
"/",
"row",
"/",
"column",
"the",
... | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/db/DBTransaction.java#L256-L260 |
wiibaker/robotframework-rest-java | src/main/java/org/wuokko/robot/restlib/JsonPathLibrary.java | JsonPathLibrary.jsonShouldBeEqual | @RobotKeyword
public boolean jsonShouldBeEqual(String from, String to, boolean useExactMatch, String method, String data, String contentType) throws Exception {
System.out.println("*DEBUG* Comparing JSON sources");
boolean equal = false;
String fromJson = requestUtil.readSource(from, method, data, contentType);
String toJson = requestUtil.readSource(to, method, data, contentType);
if (StringUtils.isNotBlank(fromJson) && StringUtils.isNotBlank(toJson)) {
if (useExactMatch) {
if (fromJson.equals(toJson)) {
System.out.println("*DEBUG* JSON strings are equal by exact compare");
equal = true;
} else {
System.out.println("*ERROR* JSON strings are NOT equal by exact compare");
equal = false;
throw new JsonNotEqualException("JSON strings are NOT equal by exact compare");
}
} else {
equal = diff.compare(fromJson, toJson);
if (!equal) {
throw new JsonNotEqualException("JSON strings are NOT equal by compare");
}
}
} else {
System.out.println("*ERROR* Either from or to JSON was empty");
throw new JsonNotValidException("One of the JSON strings is empty");
}
return equal;
} | java | @RobotKeyword
public boolean jsonShouldBeEqual(String from, String to, boolean useExactMatch, String method, String data, String contentType) throws Exception {
System.out.println("*DEBUG* Comparing JSON sources");
boolean equal = false;
String fromJson = requestUtil.readSource(from, method, data, contentType);
String toJson = requestUtil.readSource(to, method, data, contentType);
if (StringUtils.isNotBlank(fromJson) && StringUtils.isNotBlank(toJson)) {
if (useExactMatch) {
if (fromJson.equals(toJson)) {
System.out.println("*DEBUG* JSON strings are equal by exact compare");
equal = true;
} else {
System.out.println("*ERROR* JSON strings are NOT equal by exact compare");
equal = false;
throw new JsonNotEqualException("JSON strings are NOT equal by exact compare");
}
} else {
equal = diff.compare(fromJson, toJson);
if (!equal) {
throw new JsonNotEqualException("JSON strings are NOT equal by compare");
}
}
} else {
System.out.println("*ERROR* Either from or to JSON was empty");
throw new JsonNotValidException("One of the JSON strings is empty");
}
return equal;
} | [
"@",
"RobotKeyword",
"public",
"boolean",
"jsonShouldBeEqual",
"(",
"String",
"from",
",",
"String",
"to",
",",
"boolean",
"useExactMatch",
",",
"String",
"method",
",",
"String",
"data",
",",
"String",
"contentType",
")",
"throws",
"Exception",
"{",
"System",
... | Checks if the given JSON contents are equal. The third parameter
specifies whether exact string match should be used or diffing by the
JSON objects ie. the order of the attributes does not matter.
`from` and `to` can be either URI or the actual JSON content.
You can add optional method (ie GET, POST, PUT), data or content type as parameters.
Method defaults to GET.
Example:
| Json Should Be Equal | http://example.com/test.json | http://foobar.com/test.json | true |
| Json Should Be Equal | { element: { param:hello, foo:bar } } | { element: { foo:bar, param:hello } } | true |
| Json Should Be Equal | { element: { param:hello, foo:bar } } | { element: { foo:bar, param:hello } } | true | POST | {hello: world} | application/json | | [
"Checks",
"if",
"the",
"given",
"JSON",
"contents",
"are",
"equal",
".",
"The",
"third",
"parameter",
"specifies",
"whether",
"exact",
"string",
"match",
"should",
"be",
"used",
"or",
"diffing",
"by",
"the",
"JSON",
"objects",
"ie",
".",
"the",
"order",
"o... | train | https://github.com/wiibaker/robotframework-rest-java/blob/e30a7e494c143b644ee4282137a5a38e75d9d97b/src/main/java/org/wuokko/robot/restlib/JsonPathLibrary.java#L181-L212 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/FileOperations.java | FileOperations.getFileFromTask | public void getFileFromTask(String jobId, String taskId, String fileName, Iterable<BatchClientBehavior> additionalBehaviors, OutputStream outputStream) throws BatchErrorException, IOException {
FileGetFromTaskOptions options = new FileGetFromTaskOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
this.parentBatchClient.protocolLayer().files().getFromTask(jobId, taskId, fileName, options, outputStream);
} | java | public void getFileFromTask(String jobId, String taskId, String fileName, Iterable<BatchClientBehavior> additionalBehaviors, OutputStream outputStream) throws BatchErrorException, IOException {
FileGetFromTaskOptions options = new FileGetFromTaskOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
this.parentBatchClient.protocolLayer().files().getFromTask(jobId, taskId, fileName, options, outputStream);
} | [
"public",
"void",
"getFileFromTask",
"(",
"String",
"jobId",
",",
"String",
"taskId",
",",
"String",
"fileName",
",",
"Iterable",
"<",
"BatchClientBehavior",
">",
"additionalBehaviors",
",",
"OutputStream",
"outputStream",
")",
"throws",
"BatchErrorException",
",",
... | Downloads the specified file from the specified task's directory on its compute node.
@param jobId The ID of the job containing the task.
@param taskId The ID of the task.
@param fileName The name of the file to download.
@param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request.
@param outputStream A stream into which the file contents will be written.
@throws BatchErrorException Exception thrown when an error response is received from the Batch service.
@throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. | [
"Downloads",
"the",
"specified",
"file",
"from",
"the",
"specified",
"task",
"s",
"directory",
"on",
"its",
"compute",
"node",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/FileOperations.java#L279-L285 |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/KeyMap.java | KeyMap.putIfAbsent | public final V putIfAbsent(K key, LazyFactory<V> factory) {
final int hash = hash(key);
final int slot = indexOf(hash);
// search the chain from the slot
for (Entry<K, V> entry = table[slot]; entry != null; entry = entry.next) {
if (entry.hashCode == hash && entry.key.equals(key)) {
// found match
return entry.value;
}
}
// no match, insert a new value
V value = factory.create();
insertNewEntry(hash, key, value, slot);
// return the created value
return value;
} | java | public final V putIfAbsent(K key, LazyFactory<V> factory) {
final int hash = hash(key);
final int slot = indexOf(hash);
// search the chain from the slot
for (Entry<K, V> entry = table[slot]; entry != null; entry = entry.next) {
if (entry.hashCode == hash && entry.key.equals(key)) {
// found match
return entry.value;
}
}
// no match, insert a new value
V value = factory.create();
insertNewEntry(hash, key, value, slot);
// return the created value
return value;
} | [
"public",
"final",
"V",
"putIfAbsent",
"(",
"K",
"key",
",",
"LazyFactory",
"<",
"V",
">",
"factory",
")",
"{",
"final",
"int",
"hash",
"=",
"hash",
"(",
"key",
")",
";",
"final",
"int",
"slot",
"=",
"indexOf",
"(",
"hash",
")",
";",
"// search the c... | Inserts a value for the given key, if no value is yet contained for that key. Otherwise,
returns the value currently contained for the key.
<p>The value that is inserted in case that the key is not contained, yet, is lazily created
using the given factory.
@param key The key to insert.
@param factory The factory that produces the value, if no value is contained, yet, for the key.
@return The value in the map after this operation (either the previously contained value, or the
newly created value).
@throws java.lang.NullPointerException Thrown, if the key is null. | [
"Inserts",
"a",
"value",
"for",
"the",
"given",
"key",
"if",
"no",
"value",
"is",
"yet",
"contained",
"for",
"that",
"key",
".",
"Otherwise",
"returns",
"the",
"value",
"currently",
"contained",
"for",
"the",
"key",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/KeyMap.java#L157-L175 |
glyptodon/guacamole-client | guacamole/src/main/java/org/apache/guacamole/rest/auth/TokenRESTService.java | TokenRESTService.createToken | @POST
public APIAuthenticationResult createToken(@FormParam("username") String username,
@FormParam("password") String password,
@FormParam("token") String token,
@Context HttpServletRequest consumedRequest,
MultivaluedMap<String, String> parameters)
throws GuacamoleException {
// Reconstitute the HTTP request with the map of parameters
HttpServletRequest request = new APIRequest(consumedRequest, parameters);
// Build credentials from request
Credentials credentials = getCredentials(request, username, password);
// Create/update session producing possibly-new token
token = authenticationService.authenticate(credentials, token);
// Pull corresponding session
GuacamoleSession session = authenticationService.getGuacamoleSession(token);
if (session == null)
throw new GuacamoleResourceNotFoundException("No such token.");
// Build list of all available auth providers
List<DecoratedUserContext> userContexts = session.getUserContexts();
List<String> authProviderIdentifiers = new ArrayList<String>(userContexts.size());
for (UserContext userContext : userContexts)
authProviderIdentifiers.add(userContext.getAuthenticationProvider().getIdentifier());
// Return possibly-new auth token
AuthenticatedUser authenticatedUser = session.getAuthenticatedUser();
return new APIAuthenticationResult(
token,
authenticatedUser.getIdentifier(),
authenticatedUser.getAuthenticationProvider().getIdentifier(),
authProviderIdentifiers
);
} | java | @POST
public APIAuthenticationResult createToken(@FormParam("username") String username,
@FormParam("password") String password,
@FormParam("token") String token,
@Context HttpServletRequest consumedRequest,
MultivaluedMap<String, String> parameters)
throws GuacamoleException {
// Reconstitute the HTTP request with the map of parameters
HttpServletRequest request = new APIRequest(consumedRequest, parameters);
// Build credentials from request
Credentials credentials = getCredentials(request, username, password);
// Create/update session producing possibly-new token
token = authenticationService.authenticate(credentials, token);
// Pull corresponding session
GuacamoleSession session = authenticationService.getGuacamoleSession(token);
if (session == null)
throw new GuacamoleResourceNotFoundException("No such token.");
// Build list of all available auth providers
List<DecoratedUserContext> userContexts = session.getUserContexts();
List<String> authProviderIdentifiers = new ArrayList<String>(userContexts.size());
for (UserContext userContext : userContexts)
authProviderIdentifiers.add(userContext.getAuthenticationProvider().getIdentifier());
// Return possibly-new auth token
AuthenticatedUser authenticatedUser = session.getAuthenticatedUser();
return new APIAuthenticationResult(
token,
authenticatedUser.getIdentifier(),
authenticatedUser.getAuthenticationProvider().getIdentifier(),
authProviderIdentifiers
);
} | [
"@",
"POST",
"public",
"APIAuthenticationResult",
"createToken",
"(",
"@",
"FormParam",
"(",
"\"username\"",
")",
"String",
"username",
",",
"@",
"FormParam",
"(",
"\"password\"",
")",
"String",
"password",
",",
"@",
"FormParam",
"(",
"\"token\"",
")",
"String",... | Authenticates a user, generates an auth token, associates that auth token
with the user's UserContext for use by further requests. If an existing
token is provided, the authentication procedure will attempt to update
or reuse the provided token.
@param username
The username of the user who is to be authenticated.
@param password
The password of the user who is to be authenticated.
@param token
An optional existing auth token for the user who is to be
authenticated.
@param consumedRequest
The HttpServletRequest associated with the login attempt. The
parameters of this request may not be accessible, as the request may
have been fully consumed by JAX-RS.
@param parameters
A MultivaluedMap containing all parameters from the given HTTP
request. All request parameters must be made available through this
map, even if those parameters are no longer accessible within the
now-fully-consumed HTTP request.
@return
An authentication response object containing the possible-new auth
token, as well as other related data.
@throws GuacamoleException
If an error prevents successful authentication. | [
"Authenticates",
"a",
"user",
"generates",
"an",
"auth",
"token",
"associates",
"that",
"auth",
"token",
"with",
"the",
"user",
"s",
"UserContext",
"for",
"use",
"by",
"further",
"requests",
".",
"If",
"an",
"existing",
"token",
"is",
"provided",
"the",
"aut... | train | https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/guacamole/src/main/java/org/apache/guacamole/rest/auth/TokenRESTService.java#L159-L196 |
orhanobut/hawk | hawk/src/main/java/com/orhanobut/hawk/Hawk.java | Hawk.put | public static <T> boolean put(String key, T value) {
return hawkFacade.put(key, value);
} | java | public static <T> boolean put(String key, T value) {
return hawkFacade.put(key, value);
} | [
"public",
"static",
"<",
"T",
">",
"boolean",
"put",
"(",
"String",
"key",
",",
"T",
"value",
")",
"{",
"return",
"hawkFacade",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"}"
] | Saves any type including any collection, primitive values or custom objects
@param key is required to differentiate the given data
@param value is the data that is going to be encrypted and persisted
@return true if the operation is successful. Any failure in any step will return false | [
"Saves",
"any",
"type",
"including",
"any",
"collection",
"primitive",
"values",
"or",
"custom",
"objects"
] | train | https://github.com/orhanobut/hawk/blob/0d22dde128b1ab5f50ac20d802db79cf402aa150/hawk/src/main/java/com/orhanobut/hawk/Hawk.java#L39-L41 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.withStream | public static <T, U extends InputStream> T withStream(U stream, @ClosureParams(value=FirstParam.class) Closure<T> closure) throws IOException {
try {
T result = closure.call(stream);
InputStream temp = stream;
stream = null;
temp.close();
return result;
} finally {
closeWithWarning(stream);
}
} | java | public static <T, U extends InputStream> T withStream(U stream, @ClosureParams(value=FirstParam.class) Closure<T> closure) throws IOException {
try {
T result = closure.call(stream);
InputStream temp = stream;
stream = null;
temp.close();
return result;
} finally {
closeWithWarning(stream);
}
} | [
"public",
"static",
"<",
"T",
",",
"U",
"extends",
"InputStream",
">",
"T",
"withStream",
"(",
"U",
"stream",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"FirstParam",
".",
"class",
")",
"Closure",
"<",
"T",
">",
"closure",
")",
"throws",
"IOException"... | Allows this input stream to be used within the closure, ensuring that it
is flushed and closed before this method returns.
@param stream the stream which is used and then closed
@param closure the closure that the stream is passed into
@return the value returned by the closure
@throws IOException if an IOException occurs.
@since 1.5.2 | [
"Allows",
"this",
"input",
"stream",
"to",
"be",
"used",
"within",
"the",
"closure",
"ensuring",
"that",
"it",
"is",
"flushed",
"and",
"closed",
"before",
"this",
"method",
"returns",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L1183-L1195 |
JOML-CI/JOML | src/org/joml/Intersectionf.java | Intersectionf.findClosestPointOnLineSegment | public static Vector3f findClosestPointOnLineSegment(float aX, float aY, float aZ, float bX, float bY, float bZ, float pX, float pY, float pZ, Vector3f result) {
float abX = bX - aX, abY = bY - aY, abZ = bZ - aZ;
float t = ((pX - aX) * abX + (pY - aY) * abY + (pZ - aZ) * abZ) / (abX * abX + abY * abY + abZ * abZ);
if (t < 0.0f) t = 0.0f;
if (t > 1.0f) t = 1.0f;
result.x = aX + t * abX;
result.y = aY + t * abY;
result.z = aZ + t * abZ;
return result;
} | java | public static Vector3f findClosestPointOnLineSegment(float aX, float aY, float aZ, float bX, float bY, float bZ, float pX, float pY, float pZ, Vector3f result) {
float abX = bX - aX, abY = bY - aY, abZ = bZ - aZ;
float t = ((pX - aX) * abX + (pY - aY) * abY + (pZ - aZ) * abZ) / (abX * abX + abY * abY + abZ * abZ);
if (t < 0.0f) t = 0.0f;
if (t > 1.0f) t = 1.0f;
result.x = aX + t * abX;
result.y = aY + t * abY;
result.z = aZ + t * abZ;
return result;
} | [
"public",
"static",
"Vector3f",
"findClosestPointOnLineSegment",
"(",
"float",
"aX",
",",
"float",
"aY",
",",
"float",
"aZ",
",",
"float",
"bX",
",",
"float",
"bY",
",",
"float",
"bZ",
",",
"float",
"pX",
",",
"float",
"pY",
",",
"float",
"pZ",
",",
"V... | Find the point on the given line segment which is closest to the specified point <code>(pX, pY, pZ)</code>, and store the result in <code>result</code>.
@param aX
the x coordinate of the first end point of the line segment
@param aY
the y coordinate of the first end point of the line segment
@param aZ
the z coordinate of the first end point of the line segment
@param bX
the x coordinate of the second end point of the line segment
@param bY
the y coordinate of the second end point of the line segment
@param bZ
the z coordinate of the second end point of the line segment
@param pX
the x coordinate of the point
@param pY
the y coordinate of the point
@param pZ
the z coordinate of the point
@param result
will hold the result
@return result | [
"Find",
"the",
"point",
"on",
"the",
"given",
"line",
"segment",
"which",
"is",
"closest",
"to",
"the",
"specified",
"point",
"<code",
">",
"(",
"pX",
"pY",
"pZ",
")",
"<",
"/",
"code",
">",
"and",
"store",
"the",
"result",
"in",
"<code",
">",
"resul... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Intersectionf.java#L1307-L1316 |
alkacon/opencms-core | src/org/opencms/flex/CmsFlexResponse.java | CmsFlexResponse.addIntHeader | @Override
public void addIntHeader(String name, int value) {
addHeader(name, String.valueOf(value));
} | java | @Override
public void addIntHeader(String name, int value) {
addHeader(name, String.valueOf(value));
} | [
"@",
"Override",
"public",
"void",
"addIntHeader",
"(",
"String",
"name",
",",
"int",
"value",
")",
"{",
"addHeader",
"(",
"name",
",",
"String",
".",
"valueOf",
"(",
"value",
")",
")",
";",
"}"
] | Method overload from the standard HttpServletRequest API.<p>
@see javax.servlet.http.HttpServletResponse#addIntHeader(java.lang.String, int) | [
"Method",
"overload",
"from",
"the",
"standard",
"HttpServletRequest",
"API",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/flex/CmsFlexResponse.java#L482-L486 |
azkaban/azkaban | azkaban-common/src/main/java/azkaban/server/HttpRequestUtils.java | HttpRequestUtils.getIntParam | public static int getIntParam(final HttpServletRequest request, final String name)
throws ServletException {
final String p = getParam(request, name);
return Integer.parseInt(p);
} | java | public static int getIntParam(final HttpServletRequest request, final String name)
throws ServletException {
final String p = getParam(request, name);
return Integer.parseInt(p);
} | [
"public",
"static",
"int",
"getIntParam",
"(",
"final",
"HttpServletRequest",
"request",
",",
"final",
"String",
"name",
")",
"throws",
"ServletException",
"{",
"final",
"String",
"p",
"=",
"getParam",
"(",
"request",
",",
"name",
")",
";",
"return",
"Integer"... | Returns the param and parses it into an int. Will throw an exception if not found, or a parse
error if the type is incorrect. | [
"Returns",
"the",
"param",
"and",
"parses",
"it",
"into",
"an",
"int",
".",
"Will",
"throw",
"an",
"exception",
"if",
"not",
"found",
"or",
"a",
"parse",
"error",
"if",
"the",
"type",
"is",
"incorrect",
"."
] | train | https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-common/src/main/java/azkaban/server/HttpRequestUtils.java#L213-L217 |
EdwardRaff/JSAT | JSAT/src/jsat/linear/Matrix.java | Matrix.transposeMultiply | public Vec transposeMultiply(double c, Vec b)
{
DenseVector toReturns = new DenseVector(this.cols());
this.transposeMultiply(c, b, toReturns);
return toReturns;
} | java | public Vec transposeMultiply(double c, Vec b)
{
DenseVector toReturns = new DenseVector(this.cols());
this.transposeMultiply(c, b, toReturns);
return toReturns;
} | [
"public",
"Vec",
"transposeMultiply",
"(",
"double",
"c",
",",
"Vec",
"b",
")",
"{",
"DenseVector",
"toReturns",
"=",
"new",
"DenseVector",
"(",
"this",
".",
"cols",
"(",
")",
")",
";",
"this",
".",
"transposeMultiply",
"(",
"c",
",",
"b",
",",
"toRetu... | Creates a new vector equal to <i><b>x</b> = A'*<b>b</b>*c</i>
@param c the scalar constant to multiply by
@param b the vector to multiply by
@return the new vector equal to <i>A'*b*c</i> | [
"Creates",
"a",
"new",
"vector",
"equal",
"to",
"<i",
">",
"<b",
">",
"x<",
"/",
"b",
">",
"=",
"A",
"*",
"<b",
">",
"b<",
"/",
"b",
">",
"*",
"c<",
"/",
"i",
">"
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/Matrix.java#L519-L524 |
rolfl/MicroBench | src/main/java/net/tuis/ubench/UBench.java | UBench.addTask | public <T> UBench addTask(String name, Supplier<T> task, Predicate<T> check) {
return putTask(name, () -> {
long start = System.nanoTime();
T result = task.get();
long time = System.nanoTime() - start;
if (check != null && !check.test(result)) {
throw new UBenchRuntimeException(String.format("Task %s failed Result: %s", name, result));
}
return time;
});
} | java | public <T> UBench addTask(String name, Supplier<T> task, Predicate<T> check) {
return putTask(name, () -> {
long start = System.nanoTime();
T result = task.get();
long time = System.nanoTime() - start;
if (check != null && !check.test(result)) {
throw new UBenchRuntimeException(String.format("Task %s failed Result: %s", name, result));
}
return time;
});
} | [
"public",
"<",
"T",
">",
"UBench",
"addTask",
"(",
"String",
"name",
",",
"Supplier",
"<",
"T",
">",
"task",
",",
"Predicate",
"<",
"T",
">",
"check",
")",
"{",
"return",
"putTask",
"(",
"name",
",",
"(",
")",
"->",
"{",
"long",
"start",
"=",
"Sy... | Include a named task (and validator) in to the benchmark.
@param <T>
The type of the task return value (which is the input to be
tested in the validator)
@param name
The name of the task. Only one task with any one name is
allowed.
@param task
The task to perform
@param check
The check of the results from the task.
@return The same object, for chaining calls. | [
"Include",
"a",
"named",
"task",
"(",
"and",
"validator",
")",
"in",
"to",
"the",
"benchmark",
"."
] | train | https://github.com/rolfl/MicroBench/blob/f2bfa92dacd7ea0d6b8eae4d4fe2975139d317ce/src/main/java/net/tuis/ubench/UBench.java#L128-L138 |
jboss/jboss-jsf-api_spec | src/main/java/javax/faces/TypedCollections.java | TypedCollections.dynamicallyCastCollection | @SuppressWarnings("unchecked")
static <E,TypedC extends Collection<E>> TypedC dynamicallyCastCollection(Collection<?> c,
Class<E> type,
Class<TypedC> collectionType) {
if (c == null)
return null;
if (!collectionType.isInstance(c))
throw new ClassCastException(c.getClass().getName());
assert checkCollectionMembers(c, type) :
"The collection contains members with a type other than " + type.getName();
return collectionType.cast(c);
} | java | @SuppressWarnings("unchecked")
static <E,TypedC extends Collection<E>> TypedC dynamicallyCastCollection(Collection<?> c,
Class<E> type,
Class<TypedC> collectionType) {
if (c == null)
return null;
if (!collectionType.isInstance(c))
throw new ClassCastException(c.getClass().getName());
assert checkCollectionMembers(c, type) :
"The collection contains members with a type other than " + type.getName();
return collectionType.cast(c);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"static",
"<",
"E",
",",
"TypedC",
"extends",
"Collection",
"<",
"E",
">",
">",
"TypedC",
"dynamicallyCastCollection",
"(",
"Collection",
"<",
"?",
">",
"c",
",",
"Class",
"<",
"E",
">",
"type",
",",
"C... | Dynamically check that the members of the collection are all
instances of the given type (or null), and that the collection
itself is of the given collection type.
@param <E>
the collection's element type
@param c
the collection to cast
@param type
the class of the collection's element type.
@return the dynamically-type checked collection.
@throws java.lang.ClassCastException | [
"Dynamically",
"check",
"that",
"the",
"members",
"of",
"the",
"collection",
"are",
"all",
"instances",
"of",
"the",
"given",
"type",
"(",
"or",
"null",
")",
"and",
"that",
"the",
"collection",
"itself",
"is",
"of",
"the",
"given",
"collection",
"type",
".... | train | https://github.com/jboss/jboss-jsf-api_spec/blob/cb33d215acbab847f2db5cdf2c6fe4d99c0a01c3/src/main/java/javax/faces/TypedCollections.java#L77-L89 |
killbilling/recurly-java-library | src/main/java/com/ning/billing/recurly/RecurlyClient.java | RecurlyClient.postSubscriptionUsage | public Usage postSubscriptionUsage(final String subscriptionCode, final String addOnCode, final Usage usage) {
return doPOST(Subscription.SUBSCRIPTION_RESOURCE +
"/" +
subscriptionCode +
AddOn.ADDONS_RESOURCE +
"/" +
addOnCode +
Usage.USAGE_RESOURCE,
usage, Usage.class);
} | java | public Usage postSubscriptionUsage(final String subscriptionCode, final String addOnCode, final Usage usage) {
return doPOST(Subscription.SUBSCRIPTION_RESOURCE +
"/" +
subscriptionCode +
AddOn.ADDONS_RESOURCE +
"/" +
addOnCode +
Usage.USAGE_RESOURCE,
usage, Usage.class);
} | [
"public",
"Usage",
"postSubscriptionUsage",
"(",
"final",
"String",
"subscriptionCode",
",",
"final",
"String",
"addOnCode",
",",
"final",
"Usage",
"usage",
")",
"{",
"return",
"doPOST",
"(",
"Subscription",
".",
"SUBSCRIPTION_RESOURCE",
"+",
"\"/\"",
"+",
"subscr... | Post usage to subscription
<p>
@param subscriptionCode The recurly id of the {@link Subscription }
@param addOnCode recurly id of {@link AddOn}
@param usage the usage to post on recurly
@return the {@link Usage} object as identified by the passed in object | [
"Post",
"usage",
"to",
"subscription",
"<p",
">"
] | train | https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L709-L718 |
greatman/craftconomy3 | src/main/java/com/greatmancode/craftconomy3/account/AccountManager.java | AccountManager.getAccount | public Account getAccount(String name, boolean bankAccount) {
String newName = name;
if (!Common.getInstance().getMainConfig().getBoolean("System.Case-sentitive")) {
newName = name.toLowerCase();
}
Account account;
if (bankAccount && bankList.containsKey(newName)) {
account = bankList.get(newName);
} else if (!bankAccount && accountList.containsKey(newName)) {
account = accountList.get(newName);
} else {
account = Common.getInstance().getStorageHandler().getStorageEngine().getAccount(newName, bankAccount);
if (bankAccount) {
bankList.put(newName, account);
} else {
accountList.put(newName, account);
}
}
return account;
} | java | public Account getAccount(String name, boolean bankAccount) {
String newName = name;
if (!Common.getInstance().getMainConfig().getBoolean("System.Case-sentitive")) {
newName = name.toLowerCase();
}
Account account;
if (bankAccount && bankList.containsKey(newName)) {
account = bankList.get(newName);
} else if (!bankAccount && accountList.containsKey(newName)) {
account = accountList.get(newName);
} else {
account = Common.getInstance().getStorageHandler().getStorageEngine().getAccount(newName, bankAccount);
if (bankAccount) {
bankList.put(newName, account);
} else {
accountList.put(newName, account);
}
}
return account;
} | [
"public",
"Account",
"getAccount",
"(",
"String",
"name",
",",
"boolean",
"bankAccount",
")",
"{",
"String",
"newName",
"=",
"name",
";",
"if",
"(",
"!",
"Common",
".",
"getInstance",
"(",
")",
".",
"getMainConfig",
"(",
")",
".",
"getBoolean",
"(",
"\"S... | Retrieve a account. Accounts prefixed with bank: are bank accounts.
@param name The name of the account to retrieve
@param bankAccount If the account is a bank account
@return A economy account | [
"Retrieve",
"a",
"account",
".",
"Accounts",
"prefixed",
"with",
"bank",
":",
"are",
"bank",
"accounts",
"."
] | train | https://github.com/greatman/craftconomy3/blob/51b1b3de7d039e20c7418d1e70b8c4b02b8cf840/src/main/java/com/greatmancode/craftconomy3/account/AccountManager.java#L43-L62 |
negusoft/holoaccent | HoloAccent/src/com/negusoft/holoaccent/widget/AccentSwitch.java | AccentSwitch.setSwitchTextAppearance | public void setSwitchTextAppearance(Context context, int resid) {
TypedArray appearance = context.obtainStyledAttributes(resid,
R.styleable.TextAppearanceAccentSwitch);
ColorStateList colors;
int ts;
colors = appearance
.getColorStateList(R.styleable.TextAppearanceAccentSwitch_android_textColor);
if (colors != null) {
mTextColors = colors;
} else {
// If no color set in TextAppearance, default to the view's
// textColor
mTextColors = getTextColors();
}
ts = appearance.getDimensionPixelSize(
R.styleable.TextAppearanceAccentSwitch_android_textSize, 0);
if (ts != 0) {
if (ts != mTextPaint.getTextSize()) {
mTextPaint.setTextSize(ts);
requestLayout();
}
}
int typefaceIndex, styleIndex;
typefaceIndex = appearance.getInt(
R.styleable.TextAppearanceAccentSwitch_android_typeface, -1);
styleIndex = appearance.getInt(
R.styleable.TextAppearanceAccentSwitch_android_textStyle, -1);
setSwitchTypefaceByIndex(typefaceIndex, styleIndex);
boolean allCaps = appearance.getBoolean(
R.styleable.TextAppearanceAccentSwitch_android_textAllCaps, false);
if (allCaps) {
mSwitchTransformationMethod = new AllCapsTransformationMethod(
getContext());
mSwitchTransformationMethod.setLengthChangesAllowed(true);
} else {
mSwitchTransformationMethod = null;
}
appearance.recycle();
} | java | public void setSwitchTextAppearance(Context context, int resid) {
TypedArray appearance = context.obtainStyledAttributes(resid,
R.styleable.TextAppearanceAccentSwitch);
ColorStateList colors;
int ts;
colors = appearance
.getColorStateList(R.styleable.TextAppearanceAccentSwitch_android_textColor);
if (colors != null) {
mTextColors = colors;
} else {
// If no color set in TextAppearance, default to the view's
// textColor
mTextColors = getTextColors();
}
ts = appearance.getDimensionPixelSize(
R.styleable.TextAppearanceAccentSwitch_android_textSize, 0);
if (ts != 0) {
if (ts != mTextPaint.getTextSize()) {
mTextPaint.setTextSize(ts);
requestLayout();
}
}
int typefaceIndex, styleIndex;
typefaceIndex = appearance.getInt(
R.styleable.TextAppearanceAccentSwitch_android_typeface, -1);
styleIndex = appearance.getInt(
R.styleable.TextAppearanceAccentSwitch_android_textStyle, -1);
setSwitchTypefaceByIndex(typefaceIndex, styleIndex);
boolean allCaps = appearance.getBoolean(
R.styleable.TextAppearanceAccentSwitch_android_textAllCaps, false);
if (allCaps) {
mSwitchTransformationMethod = new AllCapsTransformationMethod(
getContext());
mSwitchTransformationMethod.setLengthChangesAllowed(true);
} else {
mSwitchTransformationMethod = null;
}
appearance.recycle();
} | [
"public",
"void",
"setSwitchTextAppearance",
"(",
"Context",
"context",
",",
"int",
"resid",
")",
"{",
"TypedArray",
"appearance",
"=",
"context",
".",
"obtainStyledAttributes",
"(",
"resid",
",",
"R",
".",
"styleable",
".",
"TextAppearanceAccentSwitch",
")",
";",... | Sets the switch text color, size, style, hint color, and highlight color
from the specified TextAppearance resource.
@attr ref android.R.styleable#Switch_switchTextAppearance | [
"Sets",
"the",
"switch",
"text",
"color",
"size",
"style",
"hint",
"color",
"and",
"highlight",
"color",
"from",
"the",
"specified",
"TextAppearance",
"resource",
"."
] | train | https://github.com/negusoft/holoaccent/blob/7121a02dde94834e770cb81174d0bdc596323324/HoloAccent/src/com/negusoft/holoaccent/widget/AccentSwitch.java#L255-L301 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.