repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 218 | func_name stringlengths 4 140 | whole_func_string stringlengths 153 5.32k | language stringclasses 1
value | func_code_string stringlengths 72 4k | func_code_tokens listlengths 20 832 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 102 339 |
|---|---|---|---|---|---|---|---|---|---|---|
micronaut-projects/micronaut-core | inject/src/main/java/io/micronaut/context/env/DefaultPropertyPlaceholderResolver.java | DefaultPropertyPlaceholderResolver.resolveExpression | @Nullable
protected <T> T resolveExpression(String context, String expression, Class<T> type) {
"""
Resolves a single expression.
@param context The context of the expression
@param expression The expression
@param type The class
@param <T> The type the expression should be converted to
@return The reso... | java | @Nullable
protected <T> T resolveExpression(String context, String expression, Class<T> type) {
if (environment.containsProperty(expression)) {
return environment.getProperty(expression, type)
.orElseThrow(() ->
new ConfigurationException("Could no... | [
"@",
"Nullable",
"protected",
"<",
"T",
">",
"T",
"resolveExpression",
"(",
"String",
"context",
",",
"String",
"expression",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"if",
"(",
"environment",
".",
"containsProperty",
"(",
"expression",
")",
")",
"... | Resolves a single expression.
@param context The context of the expression
@param expression The expression
@param type The class
@param <T> The type the expression should be converted to
@return The resolved and converted expression | [
"Resolves",
"a",
"single",
"expression",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/env/DefaultPropertyPlaceholderResolver.java#L173-L189 |
ngageoint/geopackage-android-map | geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java | GoogleMapShapeConverter.toMultiLineString | public MultiLineString toMultiLineString(List<Polyline> polylineList,
boolean hasZ, boolean hasM) {
"""
Convert a list of {@link Polyline} to a {@link MultiLineString}
@param polylineList polyline list
@param hasZ has z flag
@param hasM has m flag
... | java | public MultiLineString toMultiLineString(List<Polyline> polylineList,
boolean hasZ, boolean hasM) {
MultiLineString multiLineString = new MultiLineString(hasZ, hasM);
for (Polyline polyline : polylineList) {
LineString lineString = toLineString(... | [
"public",
"MultiLineString",
"toMultiLineString",
"(",
"List",
"<",
"Polyline",
">",
"polylineList",
",",
"boolean",
"hasZ",
",",
"boolean",
"hasM",
")",
"{",
"MultiLineString",
"multiLineString",
"=",
"new",
"MultiLineString",
"(",
"hasZ",
",",
"hasM",
")",
";"... | Convert a list of {@link Polyline} to a {@link MultiLineString}
@param polylineList polyline list
@param hasZ has z flag
@param hasM has m flag
@return multi line string | [
"Convert",
"a",
"list",
"of",
"{",
"@link",
"Polyline",
"}",
"to",
"a",
"{",
"@link",
"MultiLineString",
"}"
] | train | https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L840-L851 |
actorapp/droidkit-actors | actors/src/main/java/com/droidkit/actors/ActorSystem.java | ActorSystem.addDispatcher | public void addDispatcher(String dispatcherId, AbsActorDispatcher dispatcher) {
"""
Registering custom dispatcher
@param dispatcherId dispatcher id
@param dispatcher dispatcher object
"""
synchronized (dispatchers) {
if (dispatchers.containsKey(dispatcherId)) {
return;... | java | public void addDispatcher(String dispatcherId, AbsActorDispatcher dispatcher) {
synchronized (dispatchers) {
if (dispatchers.containsKey(dispatcherId)) {
return;
}
dispatchers.put(dispatcherId, dispatcher);
}
} | [
"public",
"void",
"addDispatcher",
"(",
"String",
"dispatcherId",
",",
"AbsActorDispatcher",
"dispatcher",
")",
"{",
"synchronized",
"(",
"dispatchers",
")",
"{",
"if",
"(",
"dispatchers",
".",
"containsKey",
"(",
"dispatcherId",
")",
")",
"{",
"return",
";",
... | Registering custom dispatcher
@param dispatcherId dispatcher id
@param dispatcher dispatcher object | [
"Registering",
"custom",
"dispatcher"
] | train | https://github.com/actorapp/droidkit-actors/blob/fdb72fcfdd1c5e54a970f203a33a71fa54344217/actors/src/main/java/com/droidkit/actors/ActorSystem.java#L83-L90 |
VoltDB/voltdb | src/frontend/org/voltdb/ProcedureStatsCollector.java | ProcedureStatsCollector.beginProcedure | public final SingleCallStatsToken beginProcedure() {
"""
Called when a procedure begins executing. Caches the time the procedure starts.
Note: This does not touch internal mutable state besides fuzzyInvocationCounter.
"""
long invocations = fuzzyInvocationCounter.getAndIncrement();
boolean sa... | java | public final SingleCallStatsToken beginProcedure() {
long invocations = fuzzyInvocationCounter.getAndIncrement();
boolean samplingProcedure = (invocations % m_procSamplingInterval == 0) || m_isUAC;
boolean samplingStmts = invocations % m_stmtSamplingInterval == 0;
long startTimeNanos =... | [
"public",
"final",
"SingleCallStatsToken",
"beginProcedure",
"(",
")",
"{",
"long",
"invocations",
"=",
"fuzzyInvocationCounter",
".",
"getAndIncrement",
"(",
")",
";",
"boolean",
"samplingProcedure",
"=",
"(",
"invocations",
"%",
"m_procSamplingInterval",
"==",
"0",
... | Called when a procedure begins executing. Caches the time the procedure starts.
Note: This does not touch internal mutable state besides fuzzyInvocationCounter. | [
"Called",
"when",
"a",
"procedure",
"begins",
"executing",
".",
"Caches",
"the",
"time",
"the",
"procedure",
"starts",
".",
"Note",
":",
"This",
"does",
"not",
"touch",
"internal",
"mutable",
"state",
"besides",
"fuzzyInvocationCounter",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/ProcedureStatsCollector.java#L120-L129 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectMinCardinalityImpl_CustomFieldSerializer.java | OWLObjectMinCardinalityImpl_CustomFieldSerializer.deserializeInstance | @Override
public void deserializeInstance(SerializationStreamReader streamReader, OWLObjectMinCardinalityImpl instance) throws SerializationException {
"""
Deserializes the content of the object from the
{@link com.google.gwt.user.client.rpc.SerializationStreamReader}.
@param streamReader the {@link com.go... | java | @Override
public void deserializeInstance(SerializationStreamReader streamReader, OWLObjectMinCardinalityImpl instance) throws SerializationException {
deserialize(streamReader, instance);
} | [
"@",
"Override",
"public",
"void",
"deserializeInstance",
"(",
"SerializationStreamReader",
"streamReader",
",",
"OWLObjectMinCardinalityImpl",
"instance",
")",
"throws",
"SerializationException",
"{",
"deserialize",
"(",
"streamReader",
",",
"instance",
")",
";",
"}"
] | Deserializes the content of the object from the
{@link com.google.gwt.user.client.rpc.SerializationStreamReader}.
@param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the
object's content from
@param instance the object instance to deserialize
@throws com.google.gwt.user... | [
"Deserializes",
"the",
"content",
"of",
"the",
"object",
"from",
"the",
"{",
"@link",
"com",
".",
"google",
".",
"gwt",
".",
"user",
".",
"client",
".",
"rpc",
".",
"SerializationStreamReader",
"}",
"."
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectMinCardinalityImpl_CustomFieldSerializer.java#L95-L98 |
aws/aws-sdk-java | aws-java-sdk-ecs/src/main/java/com/amazonaws/services/ecs/model/LinuxParameters.java | LinuxParameters.getTmpfs | public java.util.List<Tmpfs> getTmpfs() {
"""
<p>
The container path, mount options, and size (in MiB) of the tmpfs mount. This parameter maps to the
<code>--tmpfs</code> option to <a href="https://docs.docker.com/engine/reference/run/">docker run</a>.
</p>
<note>
<p>
If you are using tasks that use the Farg... | java | public java.util.List<Tmpfs> getTmpfs() {
if (tmpfs == null) {
tmpfs = new com.amazonaws.internal.SdkInternalList<Tmpfs>();
}
return tmpfs;
} | [
"public",
"java",
".",
"util",
".",
"List",
"<",
"Tmpfs",
">",
"getTmpfs",
"(",
")",
"{",
"if",
"(",
"tmpfs",
"==",
"null",
")",
"{",
"tmpfs",
"=",
"new",
"com",
".",
"amazonaws",
".",
"internal",
".",
"SdkInternalList",
"<",
"Tmpfs",
">",
"(",
")"... | <p>
The container path, mount options, and size (in MiB) of the tmpfs mount. This parameter maps to the
<code>--tmpfs</code> option to <a href="https://docs.docker.com/engine/reference/run/">docker run</a>.
</p>
<note>
<p>
If you are using tasks that use the Fargate launch type, the <code>tmpfs</code> parameter is not ... | [
"<p",
">",
"The",
"container",
"path",
"mount",
"options",
"and",
"size",
"(",
"in",
"MiB",
")",
"of",
"the",
"tmpfs",
"mount",
".",
"This",
"parameter",
"maps",
"to",
"the",
"<code",
">",
"--",
"tmpfs<",
"/",
"code",
">",
"option",
"to",
"<a",
"href... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ecs/src/main/java/com/amazonaws/services/ecs/model/LinuxParameters.java#L494-L499 |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/CmsEditorBase.java | CmsEditorBase.saveEntities | public void saveEntities(Set<String> entityIds, boolean clearOnSuccess, Command callback) {
"""
Saves the given entity.<p>
@param entityIds the entity ids
@param clearOnSuccess <code>true</code> to clear all entities from entity back-end on success
@param callback the callback executed on success
"""
... | java | public void saveEntities(Set<String> entityIds, boolean clearOnSuccess, Command callback) {
List<CmsEntity> entities = new ArrayList<CmsEntity>();
for (String entityId : entityIds) {
CmsEntity entity = m_entityBackend.getEntity(entityId);
if (entity != null) {
... | [
"public",
"void",
"saveEntities",
"(",
"Set",
"<",
"String",
">",
"entityIds",
",",
"boolean",
"clearOnSuccess",
",",
"Command",
"callback",
")",
"{",
"List",
"<",
"CmsEntity",
">",
"entities",
"=",
"new",
"ArrayList",
"<",
"CmsEntity",
">",
"(",
")",
";",... | Saves the given entity.<p>
@param entityIds the entity ids
@param clearOnSuccess <code>true</code> to clear all entities from entity back-end on success
@param callback the callback executed on success | [
"Saves",
"the",
"given",
"entity",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/CmsEditorBase.java#L537-L547 |
artikcloud/artikcloud-java | src/main/java/cloud/artik/api/DevicesManagementApi.java | DevicesManagementApi.getProperties | public MetadataEnvelope getProperties(String did, Boolean includeTimestamp) throws ApiException {
"""
Read a device's properties.
Read a device's properties.
@param did Device ID. (required)
@param includeTimestamp Include timestamp. (optional)
@return MetadataEnvelope
@throws ApiException If fail to ... | java | public MetadataEnvelope getProperties(String did, Boolean includeTimestamp) throws ApiException {
ApiResponse<MetadataEnvelope> resp = getPropertiesWithHttpInfo(did, includeTimestamp);
return resp.getData();
} | [
"public",
"MetadataEnvelope",
"getProperties",
"(",
"String",
"did",
",",
"Boolean",
"includeTimestamp",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"MetadataEnvelope",
">",
"resp",
"=",
"getPropertiesWithHttpInfo",
"(",
"did",
",",
"includeTimestamp",
")"... | Read a device's properties.
Read a device's properties.
@param did Device ID. (required)
@param includeTimestamp Include timestamp. (optional)
@return MetadataEnvelope
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Read",
"a",
"device'",
";",
"s",
"properties",
".",
"Read",
"a",
"device'",
";",
"s",
"properties",
"."
] | train | https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/DevicesManagementApi.java#L760-L763 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/impl/DefaultFaceletContext.java | DefaultFaceletContext.pushCompositeComponentClient | @Override
public void pushCompositeComponentClient(final TemplateClient client) {
"""
/*
@Override
public TemplateManager popCompositeComponentClient(boolean cleanClientStack)
{
if (!this._compositeComponentClients.isEmpty())
{
if (cleanClientStack)
{
_clientsStack.get(_currentClientStack).clear();
}
... | java | @Override
public void pushCompositeComponentClient(final TemplateClient client)
{
TemplateContext itc = new TemplateContextImpl();
itc.setCompositeComponentClient(
new CompositeComponentTemplateManager(this._facelet, client, getPageContext()));
_isolatedTemplateContext.ad... | [
"@",
"Override",
"public",
"void",
"pushCompositeComponentClient",
"(",
"final",
"TemplateClient",
"client",
")",
"{",
"TemplateContext",
"itc",
"=",
"new",
"TemplateContextImpl",
"(",
")",
";",
"itc",
".",
"setCompositeComponentClient",
"(",
"new",
"CompositeComponen... | /*
@Override
public TemplateManager popCompositeComponentClient(boolean cleanClientStack)
{
if (!this._compositeComponentClients.isEmpty())
{
if (cleanClientStack)
{
_clientsStack.get(_currentClientStack).clear();
}
_currentClientStack--;
return this._compositeComponentClients.remove(0);
}
if (_currentTemplateContext >... | [
"/",
"*",
"@Override",
"public",
"TemplateManager",
"popCompositeComponentClient",
"(",
"boolean",
"cleanClientStack",
")",
"{",
"if",
"(",
"!this",
".",
"_compositeComponentClients",
".",
"isEmpty",
"()",
")",
"{",
"if",
"(",
"cleanClientStack",
")",
"{",
"_clien... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/impl/DefaultFaceletContext.java#L596-L605 |
netplex/json-smart-v2 | json-smart/src/main/java/net/minidev/json/parser/JSONParserBase.java | JSONParserBase.parse | protected <T> T parse(JsonReaderI<T> mapper) throws ParseException {
"""
use to return Primitive Type, or String, Or JsonObject or JsonArray
generated by a ContainerFactory
"""
this.pos = -1;
T result;
try {
read();
result = readFirst(mapper);
if (checkTaillingData) {
if (!checkTaillingSpac... | java | protected <T> T parse(JsonReaderI<T> mapper) throws ParseException {
this.pos = -1;
T result;
try {
read();
result = readFirst(mapper);
if (checkTaillingData) {
if (!checkTaillingSpace)
skipSpace();
if (c != EOI)
throw new ParseException(pos - 1, ERROR_UNEXPECTED_TOKEN, c);
}
} cat... | [
"protected",
"<",
"T",
">",
"T",
"parse",
"(",
"JsonReaderI",
"<",
"T",
">",
"mapper",
")",
"throws",
"ParseException",
"{",
"this",
".",
"pos",
"=",
"-",
"1",
";",
"T",
"result",
";",
"try",
"{",
"read",
"(",
")",
";",
"result",
"=",
"readFirst",
... | use to return Primitive Type, or String, Or JsonObject or JsonArray
generated by a ContainerFactory | [
"use",
"to",
"return",
"Primitive",
"Type",
"or",
"String",
"Or",
"JsonObject",
"or",
"JsonArray",
"generated",
"by",
"a",
"ContainerFactory"
] | train | https://github.com/netplex/json-smart-v2/blob/bfb3daef039e22a7bbff5f76bf14ea23330cd70e/json-smart/src/main/java/net/minidev/json/parser/JSONParserBase.java#L153-L171 |
cantrowitz/RxBroadcast | rxbroadcast/src/main/java/com/cantrowitz/rxbroadcast/RxBroadcast.java | RxBroadcast.fromBroadcast | public static Observable<Intent> fromBroadcast(
Context context,
IntentFilter intentFilter,
OrderedBroadcastAbortStrategy orderedBroadcastAbortStrategy) {
"""
Create {@link Observable} that wraps {@link BroadcastReceiver} and emits received intents.
<p>
<em>This is only useful... | java | public static Observable<Intent> fromBroadcast(
Context context,
IntentFilter intentFilter,
OrderedBroadcastAbortStrategy orderedBroadcastAbortStrategy) {
BroadcastRegistrar broadcastRegistrar = new BroadcastRegistrar(context, intentFilter);
return createBroadcastObse... | [
"public",
"static",
"Observable",
"<",
"Intent",
">",
"fromBroadcast",
"(",
"Context",
"context",
",",
"IntentFilter",
"intentFilter",
",",
"OrderedBroadcastAbortStrategy",
"orderedBroadcastAbortStrategy",
")",
"{",
"BroadcastRegistrar",
"broadcastRegistrar",
"=",
"new",
... | Create {@link Observable} that wraps {@link BroadcastReceiver} and emits received intents.
<p>
<em>This is only useful in conjunction with Ordered Broadcasts, e.g.,
{@link Context#sendOrderedBroadcast(Intent, String)}</em>
@param context the context the {@link BroadcastReceiver} will be
created from
@... | [
"Create",
"{",
"@link",
"Observable",
"}",
"that",
"wraps",
"{",
"@link",
"BroadcastReceiver",
"}",
"and",
"emits",
"received",
"intents",
".",
"<p",
">",
"<em",
">",
"This",
"is",
"only",
"useful",
"in",
"conjunction",
"with",
"Ordered",
"Broadcasts",
"e",
... | train | https://github.com/cantrowitz/RxBroadcast/blob/8b479d0e28617e9b86fa4d462c6675c131b0c5d0/rxbroadcast/src/main/java/com/cantrowitz/rxbroadcast/RxBroadcast.java#L57-L63 |
UrielCh/ovh-java-sdk | ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java | ApiOvhCloud.project_serviceName_instance_instanceId_applicationAccess_POST | public OvhApplicationAccess project_serviceName_instance_instanceId_applicationAccess_POST(String serviceName, String instanceId) throws IOException {
"""
Return initial credentials of applications installed from public image
REST: POST /cloud/project/{serviceName}/instance/{instanceId}/applicationAccess
@para... | java | public OvhApplicationAccess project_serviceName_instance_instanceId_applicationAccess_POST(String serviceName, String instanceId) throws IOException {
String qPath = "/cloud/project/{serviceName}/instance/{instanceId}/applicationAccess";
StringBuilder sb = path(qPath, serviceName, instanceId);
String resp = exec(... | [
"public",
"OvhApplicationAccess",
"project_serviceName_instance_instanceId_applicationAccess_POST",
"(",
"String",
"serviceName",
",",
"String",
"instanceId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/cloud/project/{serviceName}/instance/{instanceId}/applicationA... | Return initial credentials of applications installed from public image
REST: POST /cloud/project/{serviceName}/instance/{instanceId}/applicationAccess
@param instanceId [required] Instance id
@param serviceName [required] Project id | [
"Return",
"initial",
"credentials",
"of",
"applications",
"installed",
"from",
"public",
"image"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L1894-L1899 |
helun/Ektorp | org.ektorp/src/main/java/org/ektorp/util/Base64.java | Base64.encodeBytes | @edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "DM_DEFAULT_ENCODING")
public static String encodeBytes( byte[] source, int off, int len, int options ) throws java.io.IOException {
"""
Encodes a byte array into Base64 notation.
<p>
Example options:<pre>
GZIP: gzip-compresses object before encoding... | java | @edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "DM_DEFAULT_ENCODING")
public static String encodeBytes( byte[] source, int off, int len, int options ) throws java.io.IOException {
byte[] encoded = encodeBytesToBytes( source, off, len, options );
// Return value according to relevant enco... | [
"@",
"edu",
".",
"umd",
".",
"cs",
".",
"findbugs",
".",
"annotations",
".",
"SuppressWarnings",
"(",
"value",
"=",
"\"DM_DEFAULT_ENCODING\"",
")",
"public",
"static",
"String",
"encodeBytes",
"(",
"byte",
"[",
"]",
"source",
",",
"int",
"off",
",",
"int",... | Encodes a byte array into Base64 notation.
<p>
Example options:<pre>
GZIP: gzip-compresses object before encoding it.
DO_BREAK_LINES: break lines at 76 characters
<i>Note: Technically, this makes your encoding non-compliant.</i>
</pre>
<p>
Example: <code>encodeBytes( myData, Base64.GZIP )</code> or
<p>
Example: <code>e... | [
"Encodes",
"a",
"byte",
"array",
"into",
"Base64",
"notation",
".",
"<p",
">",
"Example",
"options",
":",
"<pre",
">",
"GZIP",
":",
"gzip",
"-",
"compresses",
"object",
"before",
"encoding",
"it",
".",
"DO_BREAK_LINES",
":",
"break",
"lines",
"at",
"76",
... | train | https://github.com/helun/Ektorp/blob/b822c0d656aefb90a5e0cb5ec2de3daa969e3eaa/org.ektorp/src/main/java/org/ektorp/util/Base64.java#L670-L682 |
FasterXML/woodstox | src/main/java/com/ctc/wstx/sw/BaseNsStreamWriter.java | BaseNsStreamWriter.checkStartElement | protected void checkStartElement(String localName, String prefix)
throws XMLStreamException {
"""
Method that is called to ensure that we can start writing an
element, both from structural point of view, and from syntactic
(close previously open start element, if any).
"""
// Need to finish a... | java | protected void checkStartElement(String localName, String prefix)
throws XMLStreamException
{
// Need to finish an open start element?
if (mStartElementOpen) {
closeStartElement(mEmptyElement);
} else if (mState == STATE_PROLOG) {
verifyRootElement(localName, ... | [
"protected",
"void",
"checkStartElement",
"(",
"String",
"localName",
",",
"String",
"prefix",
")",
"throws",
"XMLStreamException",
"{",
"// Need to finish an open start element?",
"if",
"(",
"mStartElementOpen",
")",
"{",
"closeStartElement",
"(",
"mEmptyElement",
")",
... | Method that is called to ensure that we can start writing an
element, both from structural point of view, and from syntactic
(close previously open start element, if any). | [
"Method",
"that",
"is",
"called",
"to",
"ensure",
"that",
"we",
"can",
"start",
"writing",
"an",
"element",
"both",
"from",
"structural",
"point",
"of",
"view",
"and",
"from",
"syntactic",
"(",
"close",
"previously",
"open",
"start",
"element",
"if",
"any",
... | train | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sw/BaseNsStreamWriter.java#L471-L490 |
lessthanoptimal/ejml | examples/src/org/ejml/example/PrincipalComponentAnalysis.java | PrincipalComponentAnalysis.getBasisVector | public double[] getBasisVector( int which ) {
"""
Returns a vector from the PCA's basis.
@param which Which component's vector is to be returned.
@return Vector from the PCA basis.
"""
if( which < 0 || which >= numComponents )
throw new IllegalArgumentException("Invalid component");
... | java | public double[] getBasisVector( int which ) {
if( which < 0 || which >= numComponents )
throw new IllegalArgumentException("Invalid component");
DMatrixRMaj v = new DMatrixRMaj(1,A.numCols);
CommonOps_DDRM.extract(V_t,which,which+1,0,A.numCols,v,0,0);
return v.data;
} | [
"public",
"double",
"[",
"]",
"getBasisVector",
"(",
"int",
"which",
")",
"{",
"if",
"(",
"which",
"<",
"0",
"||",
"which",
">=",
"numComponents",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid component\"",
")",
";",
"DMatrixRMaj",
"v",
"=... | Returns a vector from the PCA's basis.
@param which Which component's vector is to be returned.
@return Vector from the PCA basis. | [
"Returns",
"a",
"vector",
"from",
"the",
"PCA",
"s",
"basis",
"."
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/examples/src/org/ejml/example/PrincipalComponentAnalysis.java#L160-L168 |
ironjacamar/ironjacamar | common/src/main/java/org/ironjacamar/common/metadata/common/AbstractParser.java | AbstractParser.elementAsInteger | protected Integer elementAsInteger(XMLStreamReader reader, String key, Map<String, String> expressions)
throws XMLStreamException, ParserException {
"""
convert an xml element in Integer value
@param reader the StAX reader
@param key The key
@param expressions The expressions
@return the integer repres... | java | protected Integer elementAsInteger(XMLStreamReader reader, String key, Map<String, String> expressions)
throws XMLStreamException, ParserException
{
Integer integerValue = null;
String elementtext = rawElementText(reader);
if (key != null && expressions != null && elementtext != null && elem... | [
"protected",
"Integer",
"elementAsInteger",
"(",
"XMLStreamReader",
"reader",
",",
"String",
"key",
",",
"Map",
"<",
"String",
",",
"String",
">",
"expressions",
")",
"throws",
"XMLStreamException",
",",
"ParserException",
"{",
"Integer",
"integerValue",
"=",
"nul... | convert an xml element in Integer value
@param reader the StAX reader
@param key The key
@param expressions The expressions
@return the integer representing element
@throws XMLStreamException StAX exception
@throws ParserException in case it isn't a number | [
"convert",
"an",
"xml",
"element",
"in",
"Integer",
"value"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/common/src/main/java/org/ironjacamar/common/metadata/common/AbstractParser.java#L256-L274 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileSystem.java | FileSystem.newInstance | public static FileSystem newInstance(URI uri, Configuration conf) throws IOException {
"""
Returns the FileSystem for this URI's scheme and authority. The scheme
of the URI determines a configuration property name,
<tt>fs.<i>scheme</i>.class</tt> whose value names the FileSystem class.
The entire URI is passed... | java | public static FileSystem newInstance(URI uri, Configuration conf) throws IOException {
String scheme = uri.getScheme();
String authority = uri.getAuthority();
if (scheme == null) { // no scheme: use default FS
return newInstance(conf);
}
if (authority == null) { ... | [
"public",
"static",
"FileSystem",
"newInstance",
"(",
"URI",
"uri",
",",
"Configuration",
"conf",
")",
"throws",
"IOException",
"{",
"String",
"scheme",
"=",
"uri",
".",
"getScheme",
"(",
")",
";",
"String",
"authority",
"=",
"uri",
".",
"getAuthority",
"(",... | Returns the FileSystem for this URI's scheme and authority. The scheme
of the URI determines a configuration property name,
<tt>fs.<i>scheme</i>.class</tt> whose value names the FileSystem class.
The entire URI is passed to the FileSystem instance's initialize method.
This always returns a new FileSystem object. | [
"Returns",
"the",
"FileSystem",
"for",
"this",
"URI",
"s",
"scheme",
"and",
"authority",
".",
"The",
"scheme",
"of",
"the",
"URI",
"determines",
"a",
"configuration",
"property",
"name",
"<tt",
">",
"fs",
".",
"<i",
">",
"scheme<",
"/",
"i",
">",
".",
... | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L219-L235 |
legsem/legstar.avro | legstar.avro.cob2avro/src/main/java/com/legstar/avro/cob2avro/io/ZosVarRdwDatumReader.java | ZosVarRdwDatumReader.readRecord | public ReadRecordStatus readRecord(byte[] hostBytes, int processed) throws IOException {
"""
Reads a full record from the stream.
<p/>
A positive bytesPrefetched signals that part of the record was already
read previously in which case we just read the complement.
<p/>
Otherwise we start by reading the rdw an... | java | public ReadRecordStatus readRecord(byte[] hostBytes, int processed) throws IOException {
int bytesRead = 0;
if (getBytesPrefetched() == 0) {
bytesRead = readFully(hostBytes, 0, RDW_LEN);
if (bytesRead < RDW_LEN) {
throw new IOException(
"No... | [
"public",
"ReadRecordStatus",
"readRecord",
"(",
"byte",
"[",
"]",
"hostBytes",
",",
"int",
"processed",
")",
"throws",
"IOException",
"{",
"int",
"bytesRead",
"=",
"0",
";",
"if",
"(",
"getBytesPrefetched",
"(",
")",
"==",
"0",
")",
"{",
"bytesRead",
"=",... | Reads a full record from the stream.
<p/>
A positive bytesPrefetched signals that part of the record was already
read previously in which case we just read the complement.
<p/>
Otherwise we start by reading the rdw and the actual record.
@param hostBytes a buffer where to read the record
@return the status of the read... | [
"Reads",
"a",
"full",
"record",
"from",
"the",
"stream",
".",
"<p",
"/",
">",
"A",
"positive",
"bytesPrefetched",
"signals",
"that",
"part",
"of",
"the",
"record",
"was",
"already",
"read",
"previously",
"in",
"which",
"case",
"we",
"just",
"read",
"the",
... | train | https://github.com/legsem/legstar.avro/blob/bad5e0bf41700951eee1ad6a5d6d0c47b3da8f0b/legstar.avro.cob2avro/src/main/java/com/legstar/avro/cob2avro/io/ZosVarRdwDatumReader.java#L60-L76 |
igniterealtime/Smack | smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoStore.java | OmemoStore.getFingerprintAndMaybeBuildSession | public OmemoFingerprint getFingerprintAndMaybeBuildSession(OmemoManager.LoggedInOmemoManager managerGuard, OmemoDevice contactsDevice)
throws CannotEstablishOmemoSessionException, CorruptedOmemoKeyException,
SmackException.NotConnectedException, InterruptedException, SmackException.NoResponseExc... | java | public OmemoFingerprint getFingerprintAndMaybeBuildSession(OmemoManager.LoggedInOmemoManager managerGuard, OmemoDevice contactsDevice)
throws CannotEstablishOmemoSessionException, CorruptedOmemoKeyException,
SmackException.NotConnectedException, InterruptedException, SmackException.NoResponseExc... | [
"public",
"OmemoFingerprint",
"getFingerprintAndMaybeBuildSession",
"(",
"OmemoManager",
".",
"LoggedInOmemoManager",
"managerGuard",
",",
"OmemoDevice",
"contactsDevice",
")",
"throws",
"CannotEstablishOmemoSessionException",
",",
"CorruptedOmemoKeyException",
",",
"SmackException... | Return the fingerprint of the given devices announced identityKey.
If we have no local copy of the identityKey of the contact, build a fresh session in order to get the key.
@param managerGuard authenticated OmemoManager
@param contactsDevice OmemoDevice we want to get the fingerprint from
@return fingerprint
@throws... | [
"Return",
"the",
"fingerprint",
"of",
"the",
"given",
"devices",
"announced",
"identityKey",
".",
"If",
"we",
"have",
"no",
"local",
"copy",
"of",
"the",
"identityKey",
"of",
"the",
"contact",
"build",
"a",
"fresh",
"session",
"in",
"order",
"to",
"get",
"... | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoStore.java#L628-L648 |
wildfly/wildfly-core | cli/src/main/java/org/jboss/as/cli/util/CLIExpressionResolver.java | CLIExpressionResolver.resolveLax | public static String resolveLax(String input) {
"""
Attempts to substitute all the found expressions in the input with their corresponding resolved values. If any of the
found expressions failed to resolve, try to resolve expressions as more as possible and return the resolved value. If the
input does not contai... | java | public static String resolveLax(String input) {
try {
return resolve(input, false);
} catch (UnresolvedExpressionException e) {
// XXX OK. It should not reach here as exceptionIfNotResolved is false.
return input;
}
} | [
"public",
"static",
"String",
"resolveLax",
"(",
"String",
"input",
")",
"{",
"try",
"{",
"return",
"resolve",
"(",
"input",
",",
"false",
")",
";",
"}",
"catch",
"(",
"UnresolvedExpressionException",
"e",
")",
"{",
"// XXX OK. It should not reach here as exceptio... | Attempts to substitute all the found expressions in the input with their corresponding resolved values. If any of the
found expressions failed to resolve, try to resolve expressions as more as possible and return the resolved value. If the
input does not contain any expression, the input is returned as is. see https://... | [
"Attempts",
"to",
"substitute",
"all",
"the",
"found",
"expressions",
"in",
"the",
"input",
"with",
"their",
"corresponding",
"resolved",
"values",
".",
"If",
"any",
"of",
"the",
"found",
"expressions",
"failed",
"to",
"resolve",
"try",
"to",
"resolve",
"expre... | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/util/CLIExpressionResolver.java#L95-L102 |
Alluxio/alluxio | core/common/src/main/java/alluxio/security/authentication/AuthenticatedUserInjector.java | AuthenticatedUserInjector.authenticateCall | private <ReqT, RespT> boolean authenticateCall(ServerCall<ReqT, RespT> call, Metadata headers) {
"""
Authenticates given call against auth-server state.
Fails the call if it's not originating from an authenticated client channel.
It sets thread-local authentication information for the call with the user informat... | java | private <ReqT, RespT> boolean authenticateCall(ServerCall<ReqT, RespT> call, Metadata headers) {
// Fail validation for cancelled server calls.
if (call.isCancelled()) {
LOG.debug("Server call has been cancelled: %s",
call.getMethodDescriptor().getFullMethodName());
return false;
}
... | [
"private",
"<",
"ReqT",
",",
"RespT",
">",
"boolean",
"authenticateCall",
"(",
"ServerCall",
"<",
"ReqT",
",",
"RespT",
">",
"call",
",",
"Metadata",
"headers",
")",
"{",
"// Fail validation for cancelled server calls.",
"if",
"(",
"call",
".",
"isCancelled",
"(... | Authenticates given call against auth-server state.
Fails the call if it's not originating from an authenticated client channel.
It sets thread-local authentication information for the call with the user information
that is kept on auth-server. | [
"Authenticates",
"given",
"call",
"against",
"auth",
"-",
"server",
"state",
".",
"Fails",
"the",
"call",
"if",
"it",
"s",
"not",
"originating",
"from",
"an",
"authenticated",
"client",
"channel",
".",
"It",
"sets",
"thread",
"-",
"local",
"authentication",
... | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/security/authentication/AuthenticatedUserInjector.java#L79-L113 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java | OutboundTcpConnectionPool.reset | public void reset(InetAddress remoteEP) {
"""
reconnect to @param remoteEP (after the current message backlog is exhausted).
Used by Ec2MultiRegionSnitch to force nodes in the same region to communicate over their private IPs.
@param remoteEP
"""
SystemKeyspace.updatePreferredIP(id, remoteEP);
... | java | public void reset(InetAddress remoteEP)
{
SystemKeyspace.updatePreferredIP(id, remoteEP);
resetEndpoint = remoteEP;
for (OutboundTcpConnection conn : new OutboundTcpConnection[] { cmdCon, ackCon })
conn.softCloseSocket();
// release previous metrics and create new one wi... | [
"public",
"void",
"reset",
"(",
"InetAddress",
"remoteEP",
")",
"{",
"SystemKeyspace",
".",
"updatePreferredIP",
"(",
"id",
",",
"remoteEP",
")",
";",
"resetEndpoint",
"=",
"remoteEP",
";",
"for",
"(",
"OutboundTcpConnection",
"conn",
":",
"new",
"OutboundTcpCon... | reconnect to @param remoteEP (after the current message backlog is exhausted).
Used by Ec2MultiRegionSnitch to force nodes in the same region to communicate over their private IPs.
@param remoteEP | [
"reconnect",
"to"
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java#L90-L100 |
codelibs/jcifs | src/main/java/jcifs/smb1/util/Hexdump.java | Hexdump.toHexChars | public static void toHexChars( int val, char dst[], int dstIndex, int size ) {
"""
This is the same as {@link jcifs.smb1.util.Hexdump#toHexString(int val, int
size)} but provides a more practical form when trying to avoid {@link
java.lang.String} concatenation and {@link java.lang.StringBuffer}.
"""
... | java | public static void toHexChars( int val, char dst[], int dstIndex, int size ) {
while( size > 0 ) {
int i = dstIndex + size - 1;
if( i < dst.length ) {
dst[i] = HEX_DIGITS[val & 0x000F];
}
if( val != 0 ) {
val >>>= 4;
}
... | [
"public",
"static",
"void",
"toHexChars",
"(",
"int",
"val",
",",
"char",
"dst",
"[",
"]",
",",
"int",
"dstIndex",
",",
"int",
"size",
")",
"{",
"while",
"(",
"size",
">",
"0",
")",
"{",
"int",
"i",
"=",
"dstIndex",
"+",
"size",
"-",
"1",
";",
... | This is the same as {@link jcifs.smb1.util.Hexdump#toHexString(int val, int
size)} but provides a more practical form when trying to avoid {@link
java.lang.String} concatenation and {@link java.lang.StringBuffer}. | [
"This",
"is",
"the",
"same",
"as",
"{"
] | train | https://github.com/codelibs/jcifs/blob/ac6a8ba2925648ae003ca2508aec32316065dc34/src/main/java/jcifs/smb1/util/Hexdump.java#L138-L149 |
roboconf/roboconf-platform | miscellaneous/roboconf-tooling-core/src/main/java/net/roboconf/tooling/core/autocompletion/CompletionUtils.java | CompletionUtils.findAllTypes | public static Map<String,RoboconfTypeBean> findAllTypes( File appDirectory ) {
"""
Finds all the Roboconf types.
@param appDirectory the application's directory (can be null)
@return a non-null map of types (key = type name, value = type)
"""
List<File> graphFiles = new ArrayList<> ();
File graphDirecto... | java | public static Map<String,RoboconfTypeBean> findAllTypes( File appDirectory ) {
List<File> graphFiles = new ArrayList<> ();
File graphDirectory = appDirectory;
if( graphDirectory != null
&& graphDirectory.exists())
graphFiles = Utils.listAllFiles( graphDirectory, Constants.FILE_EXT_GRAPH );
Map<String,R... | [
"public",
"static",
"Map",
"<",
"String",
",",
"RoboconfTypeBean",
">",
"findAllTypes",
"(",
"File",
"appDirectory",
")",
"{",
"List",
"<",
"File",
">",
"graphFiles",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"File",
"graphDirectory",
"=",
"appDirectory"... | Finds all the Roboconf types.
@param appDirectory the application's directory (can be null)
@return a non-null map of types (key = type name, value = type) | [
"Finds",
"all",
"the",
"Roboconf",
"types",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-tooling-core/src/main/java/net/roboconf/tooling/core/autocompletion/CompletionUtils.java#L181-L218 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/convert/ST_GeomFromText.java | ST_GeomFromText.toGeometry | public static Geometry toGeometry(String wkt) throws SQLException {
"""
Convert well known text parameter into a Geometry
@param wkt Well known text
@return Geometry instance or null if parameter is null
@throws ParseException If wkt is invalid
"""
if(wkt == null) {
return null;
... | java | public static Geometry toGeometry(String wkt) throws SQLException {
if(wkt == null) {
return null;
}
WKTReader wktReader = new WKTReader();
try {
return wktReader.read(wkt);
} catch (ParseException ex) {
throw new SQLException("Cannot parse the... | [
"public",
"static",
"Geometry",
"toGeometry",
"(",
"String",
"wkt",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"wkt",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"WKTReader",
"wktReader",
"=",
"new",
"WKTReader",
"(",
")",
";",
"try",
"{",
... | Convert well known text parameter into a Geometry
@param wkt Well known text
@return Geometry instance or null if parameter is null
@throws ParseException If wkt is invalid | [
"Convert",
"well",
"known",
"text",
"parameter",
"into",
"a",
"Geometry"
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/convert/ST_GeomFromText.java#L57-L67 |
hibernate/hibernate-ogm | infinispan-remote/src/main/java/org/hibernate/ogm/datastore/infinispanremote/configuration/impl/InfinispanRemoteConfiguration.java | InfinispanRemoteConfiguration.loadResourceFile | private void loadResourceFile(URL configurationResourceUrl, Properties hotRodConfiguration) {
"""
Load the properties from the resource file if one is specified
"""
if ( configurationResourceUrl != null ) {
try ( InputStream openStream = configurationResourceUrl.openStream() ) {
hotRodConfiguration.lo... | java | private void loadResourceFile(URL configurationResourceUrl, Properties hotRodConfiguration) {
if ( configurationResourceUrl != null ) {
try ( InputStream openStream = configurationResourceUrl.openStream() ) {
hotRodConfiguration.load( openStream );
}
catch (IOException e) {
throw log.failedLoadingHot... | [
"private",
"void",
"loadResourceFile",
"(",
"URL",
"configurationResourceUrl",
",",
"Properties",
"hotRodConfiguration",
")",
"{",
"if",
"(",
"configurationResourceUrl",
"!=",
"null",
")",
"{",
"try",
"(",
"InputStream",
"openStream",
"=",
"configurationResourceUrl",
... | Load the properties from the resource file if one is specified | [
"Load",
"the",
"properties",
"from",
"the",
"resource",
"file",
"if",
"one",
"is",
"specified"
] | train | https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/infinispan-remote/src/main/java/org/hibernate/ogm/datastore/infinispanremote/configuration/impl/InfinispanRemoteConfiguration.java#L276-L285 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/context/flash/FlashImpl.java | FlashImpl._createFlashCookie | private Cookie _createFlashCookie(String name, String value, ExternalContext externalContext) {
"""
Creates a Cookie with the given name and value.
In addition, it will be configured with maxAge=-1, the current request path and secure value.
@param name
@param value
@param externalContext
@return
"""
... | java | private Cookie _createFlashCookie(String name, String value, ExternalContext externalContext)
{
Cookie cookie = new Cookie(name, value);
cookie.setMaxAge(-1);
cookie.setPath(_getCookiePath(externalContext));
cookie.setSecure(externalContext.isSecure());
//cookie.setHttpOnly(... | [
"private",
"Cookie",
"_createFlashCookie",
"(",
"String",
"name",
",",
"String",
"value",
",",
"ExternalContext",
"externalContext",
")",
"{",
"Cookie",
"cookie",
"=",
"new",
"Cookie",
"(",
"name",
",",
"value",
")",
";",
"cookie",
".",
"setMaxAge",
"(",
"-"... | Creates a Cookie with the given name and value.
In addition, it will be configured with maxAge=-1, the current request path and secure value.
@param name
@param value
@param externalContext
@return | [
"Creates",
"a",
"Cookie",
"with",
"the",
"given",
"name",
"and",
"value",
".",
"In",
"addition",
"it",
"will",
"be",
"configured",
"with",
"maxAge",
"=",
"-",
"1",
"the",
"current",
"request",
"path",
"and",
"secure",
"value",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/context/flash/FlashImpl.java#L1177-L1190 |
elastic/elasticsearch-hadoop | mr/src/main/java/org/elasticsearch/hadoop/mr/security/TokenUtil.java | TokenUtil.addTokenForJob | public static void addTokenForJob(final RestClient client, ClusterName clusterName, User user, Job job) {
"""
Retrieves an authentication token from the given user, obtaining a new token if necessary,
and adds it to the credentials for the given map reduce job.
@param client The Elasticsearch client
@param cl... | java | public static void addTokenForJob(final RestClient client, ClusterName clusterName, User user, Job job) {
Token<EsTokenIdentifier> token = getAuthToken(clusterName, user);
if (token == null) {
token = obtainToken(client, user);
}
job.getCredentials().addToken(token.getService... | [
"public",
"static",
"void",
"addTokenForJob",
"(",
"final",
"RestClient",
"client",
",",
"ClusterName",
"clusterName",
",",
"User",
"user",
",",
"Job",
"job",
")",
"{",
"Token",
"<",
"EsTokenIdentifier",
">",
"token",
"=",
"getAuthToken",
"(",
"clusterName",
"... | Retrieves an authentication token from the given user, obtaining a new token if necessary,
and adds it to the credentials for the given map reduce job.
@param client The Elasticsearch client
@param clusterName the name of the cluster you are connecting to
@param user The user for whom to obtain the token
@param job Th... | [
"Retrieves",
"an",
"authentication",
"token",
"from",
"the",
"given",
"user",
"obtaining",
"a",
"new",
"token",
"if",
"necessary",
"and",
"adds",
"it",
"to",
"the",
"credentials",
"for",
"the",
"given",
"map",
"reduce",
"job",
"."
] | train | https://github.com/elastic/elasticsearch-hadoop/blob/f3acaba268ff96efae8eb946088c748c777c22cc/mr/src/main/java/org/elasticsearch/hadoop/mr/security/TokenUtil.java#L169-L175 |
JM-Lab/utils-java8 | src/main/java/kr/jm/utils/helper/JMLambda.java | JMLambda.consumeIfNotNull | public static <T> void consumeIfNotNull(T target, Consumer<T> consumer) {
"""
Consume if not null.
@param <T> the type parameter
@param target the target
@param consumer the consumer
"""
Optional.ofNullable(target).ifPresent(consumer);
} | java | public static <T> void consumeIfNotNull(T target, Consumer<T> consumer) {
Optional.ofNullable(target).ifPresent(consumer);
} | [
"public",
"static",
"<",
"T",
">",
"void",
"consumeIfNotNull",
"(",
"T",
"target",
",",
"Consumer",
"<",
"T",
">",
"consumer",
")",
"{",
"Optional",
".",
"ofNullable",
"(",
"target",
")",
".",
"ifPresent",
"(",
"consumer",
")",
";",
"}"
] | Consume if not null.
@param <T> the type parameter
@param target the target
@param consumer the consumer | [
"Consume",
"if",
"not",
"null",
"."
] | train | https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/helper/JMLambda.java#L196-L198 |
apache/flink | flink-core/src/main/java/org/apache/flink/configuration/Configuration.java | Configuration.setInteger | @PublicEvolving
public void setInteger(ConfigOption<Integer> key, int value) {
"""
Adds the given value to the configuration object.
The main key of the config option will be used to map the value.
@param key
the option specifying the key to be added
@param value
the value of the key/value pair to be added... | java | @PublicEvolving
public void setInteger(ConfigOption<Integer> key, int value) {
setValueInternal(key.key(), value);
} | [
"@",
"PublicEvolving",
"public",
"void",
"setInteger",
"(",
"ConfigOption",
"<",
"Integer",
">",
"key",
",",
"int",
"value",
")",
"{",
"setValueInternal",
"(",
"key",
".",
"key",
"(",
")",
",",
"value",
")",
";",
"}"
] | Adds the given value to the configuration object.
The main key of the config option will be used to map the value.
@param key
the option specifying the key to be added
@param value
the value of the key/value pair to be added | [
"Adds",
"the",
"given",
"value",
"to",
"the",
"configuration",
"object",
".",
"The",
"main",
"key",
"of",
"the",
"config",
"option",
"will",
"be",
"used",
"to",
"map",
"the",
"value",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java#L264-L267 |
eFaps/eFaps-Kernel | src/main/java/org/efaps/db/store/AbstractStoreResource.java | AbstractStoreResource.insertDefaults | protected void insertDefaults()
throws EFapsException {
"""
Insert default values in the table. (if necessary).
@throws EFapsException on error
"""
if (!getExist()[0] && getGeneralID() != null) {
try {
final ConnectionResource res = Context.getThreadContext().getCon... | java | protected void insertDefaults()
throws EFapsException
{
if (!getExist()[0] && getGeneralID() != null) {
try {
final ConnectionResource res = Context.getThreadContext().getConnectionResource();
Context.getDbType().newInsert(AbstractStoreResource.TABLENAME_S... | [
"protected",
"void",
"insertDefaults",
"(",
")",
"throws",
"EFapsException",
"{",
"if",
"(",
"!",
"getExist",
"(",
")",
"[",
"0",
"]",
"&&",
"getGeneralID",
"(",
")",
"!=",
"null",
")",
"{",
"try",
"{",
"final",
"ConnectionResource",
"res",
"=",
"Context... | Insert default values in the table. (if necessary).
@throws EFapsException on error | [
"Insert",
"default",
"values",
"in",
"the",
"table",
".",
"(",
"if",
"necessary",
")",
"."
] | train | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/store/AbstractStoreResource.java#L227-L244 |
craterdog/java-primitive-types | src/main/java/craterdog/primitives/Probability.java | Probability.sans | static public Probability sans(Probability probability1, Probability probability2) {
"""
This function returns the material nonimplication of the specified probabilities. The value
of the material nonimplication of two probabilities is P and not(Q).
@param probability1 The first probability.
@param probabili... | java | static public Probability sans(Probability probability1, Probability probability2) {
double p1 = probability1.value;
double p2 = probability2.value;
return new Probability(p1 * (1.0d - p2));
} | [
"static",
"public",
"Probability",
"sans",
"(",
"Probability",
"probability1",
",",
"Probability",
"probability2",
")",
"{",
"double",
"p1",
"=",
"probability1",
".",
"value",
";",
"double",
"p2",
"=",
"probability2",
".",
"value",
";",
"return",
"new",
"Proba... | This function returns the material nonimplication of the specified probabilities. The value
of the material nonimplication of two probabilities is P and not(Q).
@param probability1 The first probability.
@param probability2 The second probability.
@return The material nonimplication of the two probabilities. | [
"This",
"function",
"returns",
"the",
"material",
"nonimplication",
"of",
"the",
"specified",
"probabilities",
".",
"The",
"value",
"of",
"the",
"material",
"nonimplication",
"of",
"two",
"probabilities",
"is",
"P",
"and",
"not",
"(",
"Q",
")",
"."
] | train | https://github.com/craterdog/java-primitive-types/blob/730f9bceacfac69f99b094464a7da5747c07a59e/src/main/java/craterdog/primitives/Probability.java#L163-L167 |
primefaces/primefaces | src/main/java/org/primefaces/util/ComponentUtils.java | ComponentUtils.getConverter | public static Converter getConverter(FacesContext context, UIComponent component) {
"""
Finds appropriate converter for a given value holder
@param context FacesContext instance
@param component ValueHolder instance to look converter for
@return Converter
"""
if (!(component instanceof ... | java | public static Converter getConverter(FacesContext context, UIComponent component) {
if (!(component instanceof ValueHolder)) {
return null;
}
Converter converter = ((ValueHolder) component).getConverter();
if (converter != null) {
return converter;
}
... | [
"public",
"static",
"Converter",
"getConverter",
"(",
"FacesContext",
"context",
",",
"UIComponent",
"component",
")",
"{",
"if",
"(",
"!",
"(",
"component",
"instanceof",
"ValueHolder",
")",
")",
"{",
"return",
"null",
";",
"}",
"Converter",
"converter",
"=",... | Finds appropriate converter for a given value holder
@param context FacesContext instance
@param component ValueHolder instance to look converter for
@return Converter | [
"Finds",
"appropriate",
"converter",
"for",
"a",
"given",
"value",
"holder"
] | train | https://github.com/primefaces/primefaces/blob/b8cdd5ed395d09826e40e3302d6b14901d3ef4e7/src/main/java/org/primefaces/util/ComponentUtils.java#L139-L166 |
jbossas/jboss-vfs | src/main/java/org/jboss/vfs/VFSUtils.java | VFSUtils.copyStream | public static void copyStream(InputStream is, OutputStream os, int bufferSize)
throws IOException {
"""
Copy input stream to output stream without closing streams. Flushes output stream when done.
@param is input stream
@param os output stream
@param bufferSize the buffer size to u... | java | public static void copyStream(InputStream is, OutputStream os, int bufferSize)
throws IOException {
if (is == null) {
throw MESSAGES.nullArgument("input stream");
}
if (os == null) {
throw MESSAGES.nullArgument("output stream");
}
byte[] buff =... | [
"public",
"static",
"void",
"copyStream",
"(",
"InputStream",
"is",
",",
"OutputStream",
"os",
",",
"int",
"bufferSize",
")",
"throws",
"IOException",
"{",
"if",
"(",
"is",
"==",
"null",
")",
"{",
"throw",
"MESSAGES",
".",
"nullArgument",
"(",
"\"input strea... | Copy input stream to output stream without closing streams. Flushes output stream when done.
@param is input stream
@param os output stream
@param bufferSize the buffer size to use
@throws IOException for any error | [
"Copy",
"input",
"stream",
"to",
"output",
"stream",
"without",
"closing",
"streams",
".",
"Flushes",
"output",
"stream",
"when",
"done",
"."
] | train | https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VFSUtils.java#L429-L441 |
BlueBrain/bluima | modules/bluima_abbreviations/src/main/java/com/wcohen/ss/lookup/SoftDictionary.java | SoftDictionary.put | public void put(String id, StringWrapper toInsert,Object value) {
"""
Insert a prepared string into the dictionary.
<p>Id is a special tag used to handle 'leave one out'
lookups. If you do a lookup on a string with a non-null
id, you get the closest matches that do not have the same
id.
"""
MyWrapper w... | java | public void put(String id, StringWrapper toInsert,Object value)
{
MyWrapper wrapper = asMyWrapper(toInsert);
Token[] tokens = wrapper.getTokens();
for (int i=0; i<tokens.length; i++) {
ArrayList stringsWithToken = (ArrayList) index.get(tokens[i]);
if (stringsWithToken==null) index.put( tokens[i], (stri... | [
"public",
"void",
"put",
"(",
"String",
"id",
",",
"StringWrapper",
"toInsert",
",",
"Object",
"value",
")",
"{",
"MyWrapper",
"wrapper",
"=",
"asMyWrapper",
"(",
"toInsert",
")",
";",
"Token",
"[",
"]",
"tokens",
"=",
"wrapper",
".",
"getTokens",
"(",
"... | Insert a prepared string into the dictionary.
<p>Id is a special tag used to handle 'leave one out'
lookups. If you do a lookup on a string with a non-null
id, you get the closest matches that do not have the same
id. | [
"Insert",
"a",
"prepared",
"string",
"into",
"the",
"dictionary",
"."
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_abbreviations/src/main/java/com/wcohen/ss/lookup/SoftDictionary.java#L164-L177 |
alkacon/opencms-core | src/org/opencms/ui/dialogs/CmsRestoreDeletedDialog.java | CmsRestoreDeletedDialog.initDeletedResources | private void initDeletedResources(CmsObject cms, List<I_CmsHistoryResource> deletedResources) throws CmsException {
"""
Fills the list of resources to select from.<p>
@param cms the cms context
@param deletedResources the deleted resources
@throws CmsException if something goes wrong
"""
Collec... | java | private void initDeletedResources(CmsObject cms, List<I_CmsHistoryResource> deletedResources) throws CmsException {
Collections.sort(deletedResources, new Comparator<I_CmsHistoryResource>() {
public int compare(I_CmsHistoryResource first, I_CmsHistoryResource second) {
return firs... | [
"private",
"void",
"initDeletedResources",
"(",
"CmsObject",
"cms",
",",
"List",
"<",
"I_CmsHistoryResource",
">",
"deletedResources",
")",
"throws",
"CmsException",
"{",
"Collections",
".",
"sort",
"(",
"deletedResources",
",",
"new",
"Comparator",
"<",
"I_CmsHisto... | Fills the list of resources to select from.<p>
@param cms the cms context
@param deletedResources the deleted resources
@throws CmsException if something goes wrong | [
"Fills",
"the",
"list",
"of",
"resources",
"to",
"select",
"from",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/dialogs/CmsRestoreDeletedDialog.java#L257-L309 |
sagiegurari/fax4j | src/main/java/org/fax4j/spi/FaxClientSpiFactory.java | FaxClientSpiFactory.createFaxJobMonitor | private static FaxJobMonitor createFaxJobMonitor(Map<String,String> systemConfig) {
"""
This function creates the fax job monitor used by the fax4j framework.
@param systemConfig
The system configuration
@return The logger
"""
//get class name
String className=systemConfig.get(FaxClient... | java | private static FaxJobMonitor createFaxJobMonitor(Map<String,String> systemConfig)
{
//get class name
String className=systemConfig.get(FaxClientSpiFactory.FAX_JOB_MONITOR_CLASS_NAME_PROPERTY_KEY);
if((className==null)||(className.length()==0))
{
className=FaxJobMonitorImp... | [
"private",
"static",
"FaxJobMonitor",
"createFaxJobMonitor",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"systemConfig",
")",
"{",
"//get class name",
"String",
"className",
"=",
"systemConfig",
".",
"get",
"(",
"FaxClientSpiFactory",
".",
"FAX_JOB_MONITOR_CLASS_NA... | This function creates the fax job monitor used by the fax4j framework.
@param systemConfig
The system configuration
@return The logger | [
"This",
"function",
"creates",
"the",
"fax",
"job",
"monitor",
"used",
"by",
"the",
"fax4j",
"framework",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/FaxClientSpiFactory.java#L414-L427 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java | DebuggableThreadPoolExecutor.logExceptionsAfterExecute | public static void logExceptionsAfterExecute(Runnable r, Throwable t) {
"""
Send @param t and any exception wrapped by @param r to the default uncaught exception handler,
or log them if none such is set up
"""
Throwable hiddenThrowable = extractThrowable(r);
if (hiddenThrowable != null)
... | java | public static void logExceptionsAfterExecute(Runnable r, Throwable t)
{
Throwable hiddenThrowable = extractThrowable(r);
if (hiddenThrowable != null)
handleOrLog(hiddenThrowable);
// ThreadPoolExecutor will re-throw exceptions thrown by its Task (which will be seen by
//... | [
"public",
"static",
"void",
"logExceptionsAfterExecute",
"(",
"Runnable",
"r",
",",
"Throwable",
"t",
")",
"{",
"Throwable",
"hiddenThrowable",
"=",
"extractThrowable",
"(",
"r",
")",
";",
"if",
"(",
"hiddenThrowable",
"!=",
"null",
")",
"handleOrLog",
"(",
"h... | Send @param t and any exception wrapped by @param r to the default uncaught exception handler,
or log them if none such is set up | [
"Send"
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java#L208-L219 |
VoltDB/voltdb | third_party/java/src/com/google_voltpatches/common/util/concurrent/Futures.java | Futures.lazyTransform | @GwtIncompatible // TODO
public static <I, O> Future<O> lazyTransform(
final Future<I> input, final Function<? super I, ? extends O> function) {
"""
Like {@link #transform(ListenableFuture, Function)} except that the transformation {@code
function} is invoked on each call to {@link Future#get() get()} on ... | java | @GwtIncompatible // TODO
public static <I, O> Future<O> lazyTransform(
final Future<I> input, final Function<? super I, ? extends O> function) {
checkNotNull(input);
checkNotNull(function);
return new Future<O>() {
@Override
public boolean cancel(boolean mayInterruptIfRunning) {
... | [
"@",
"GwtIncompatible",
"// TODO",
"public",
"static",
"<",
"I",
",",
"O",
">",
"Future",
"<",
"O",
">",
"lazyTransform",
"(",
"final",
"Future",
"<",
"I",
">",
"input",
",",
"final",
"Function",
"<",
"?",
"super",
"I",
",",
"?",
"extends",
"O",
">",... | Like {@link #transform(ListenableFuture, Function)} except that the transformation {@code
function} is invoked on each call to {@link Future#get() get()} on the returned future.
<p>The returned {@code Future} reflects the input's cancellation state directly, and any
attempt to cancel the returned Future is likewise pa... | [
"Like",
"{",
"@link",
"#transform",
"(",
"ListenableFuture",
"Function",
")",
"}",
"except",
"that",
"the",
"transformation",
"{",
"@code",
"function",
"}",
"is",
"invoked",
"on",
"each",
"call",
"to",
"{",
"@link",
"Future#get",
"()",
"get",
"()",
"}",
"o... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/util/concurrent/Futures.java#L655-L696 |
jclawson/jackson-dataformat-hocon | src/main/java/com/jasonclawson/jackson/dataformat/hocon/HoconNodeCursor.java | HoconNodeCursor.iterateChildren | public final HoconNodeCursor iterateChildren() {
"""
Method called to create a new context for iterating all
contents of the current structured value (JSON array or object)
@return a cursor over the children of this node
"""
ConfigValue n = currentNode();
if (n == null) throw new IllegalStateExc... | java | public final HoconNodeCursor iterateChildren() {
ConfigValue n = currentNode();
if (n == null) throw new IllegalStateException("No current node");
boolean numericallyIndexed = isNumericallyIndexed(n);
if (!numericallyIndexed) {
if (isArray(n)) { // false since we have already re... | [
"public",
"final",
"HoconNodeCursor",
"iterateChildren",
"(",
")",
"{",
"ConfigValue",
"n",
"=",
"currentNode",
"(",
")",
";",
"if",
"(",
"n",
"==",
"null",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"No current node\"",
")",
";",
"boolean",
"numeric... | Method called to create a new context for iterating all
contents of the current structured value (JSON array or object)
@return a cursor over the children of this node | [
"Method",
"called",
"to",
"create",
"a",
"new",
"context",
"for",
"iterating",
"all",
"contents",
"of",
"the",
"current",
"structured",
"value",
"(",
"JSON",
"array",
"or",
"object",
")"
] | train | https://github.com/jclawson/jackson-dataformat-hocon/blob/32149c89f5f9288ce6860f87e7bf55acea03cdbf/src/main/java/com/jasonclawson/jackson/dataformat/hocon/HoconNodeCursor.java#L83-L98 |
citrusframework/citrus | modules/citrus-ws/src/main/java/com/consol/citrus/ws/validation/AbstractSoapAttachmentValidator.java | AbstractSoapAttachmentValidator.findAttachment | protected SoapAttachment findAttachment(SoapMessage soapMessage, SoapAttachment controlAttachment) {
"""
Finds attachment in list of soap attachments on incoming soap message. By default
uses content id of control attachment as search key. If no proper attachment with this content id
was found in soap message th... | java | protected SoapAttachment findAttachment(SoapMessage soapMessage, SoapAttachment controlAttachment) {
List<SoapAttachment> attachments = soapMessage.getAttachments();
Attachment matching = null;
if (controlAttachment.getContentId() == null) {
if (attachments.size() == 1) {
... | [
"protected",
"SoapAttachment",
"findAttachment",
"(",
"SoapMessage",
"soapMessage",
",",
"SoapAttachment",
"controlAttachment",
")",
"{",
"List",
"<",
"SoapAttachment",
">",
"attachments",
"=",
"soapMessage",
".",
"getAttachments",
"(",
")",
";",
"Attachment",
"matchi... | Finds attachment in list of soap attachments on incoming soap message. By default
uses content id of control attachment as search key. If no proper attachment with this content id
was found in soap message throws validation exception.
@param soapMessage
@param controlAttachment
@return | [
"Finds",
"attachment",
"in",
"list",
"of",
"soap",
"attachments",
"on",
"incoming",
"soap",
"message",
".",
"By",
"default",
"uses",
"content",
"id",
"of",
"control",
"attachment",
"as",
"search",
"key",
".",
"If",
"no",
"proper",
"attachment",
"with",
"this... | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/validation/AbstractSoapAttachmentValidator.java#L73-L98 |
WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor | SurveyorCore/src/main/java/org/wwarn/surveyor/client/core/DefaultLocalJSONDataProvider.java | DefaultLocalJSONDataProvider.calculateFacetList | private FacetList calculateFacetList(AbstractDataTable table, String[] facetFields) {
"""
facet field -> list of facet field values
@param table gwt datatable as internal table data source
@param facetFields list of field to calculate facet values for
"""
if(facetFields == null || facetFields.length ... | java | private FacetList calculateFacetList(AbstractDataTable table, String[] facetFields) {
if(facetFields == null || facetFields.length == 0){
throw new NullPointerException("Facet field list empty");
}
FacetList facetList = new FacetList();
for (String facetField : facetFields) ... | [
"private",
"FacetList",
"calculateFacetList",
"(",
"AbstractDataTable",
"table",
",",
"String",
"[",
"]",
"facetFields",
")",
"{",
"if",
"(",
"facetFields",
"==",
"null",
"||",
"facetFields",
".",
"length",
"==",
"0",
")",
"{",
"throw",
"new",
"NullPointerExce... | facet field -> list of facet field values
@param table gwt datatable as internal table data source
@param facetFields list of field to calculate facet values for | [
"facet",
"field",
"-",
">",
"list",
"of",
"facet",
"field",
"values"
] | train | https://github.com/WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor/blob/224280bcd6e8045bda6b673584caf0aea5e4c841/SurveyorCore/src/main/java/org/wwarn/surveyor/client/core/DefaultLocalJSONDataProvider.java#L304-L314 |
prestodb/presto | presto-main/src/main/java/com/facebook/presto/sql/planner/EqualityInference.java | EqualityInference.rewriteExpression | public Expression rewriteExpression(Expression expression, Predicate<Symbol> symbolScope) {
"""
Attempts to rewrite an Expression in terms of the symbols allowed by the symbol scope
given the known equalities. Returns null if unsuccessful.
This method checks if rewritten expression is non-deterministic.
"""
... | java | public Expression rewriteExpression(Expression expression, Predicate<Symbol> symbolScope)
{
checkArgument(isDeterministic(expression), "Only deterministic expressions may be considered for rewrite");
return rewriteExpression(expression, symbolScope, true);
} | [
"public",
"Expression",
"rewriteExpression",
"(",
"Expression",
"expression",
",",
"Predicate",
"<",
"Symbol",
">",
"symbolScope",
")",
"{",
"checkArgument",
"(",
"isDeterministic",
"(",
"expression",
")",
",",
"\"Only deterministic expressions may be considered for rewrite... | Attempts to rewrite an Expression in terms of the symbols allowed by the symbol scope
given the known equalities. Returns null if unsuccessful.
This method checks if rewritten expression is non-deterministic. | [
"Attempts",
"to",
"rewrite",
"an",
"Expression",
"in",
"terms",
"of",
"the",
"symbols",
"allowed",
"by",
"the",
"symbol",
"scope",
"given",
"the",
"known",
"equalities",
".",
"Returns",
"null",
"if",
"unsuccessful",
".",
"This",
"method",
"checks",
"if",
"re... | train | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/planner/EqualityInference.java#L99-L103 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/event/SequenceHandler.java | SequenceHandler.doRecordChange | public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) {
"""
Called when a change is the record status is about to happen/has happened.
@param field If this file change is due to a field, this is the field.
@param iChangeType The type of change that occurred.
@param bDisplayOption I... | java | public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption)
{ // Read a valid record
int iErrorCode = super.doRecordChange(field, iChangeType, bDisplayOption); // Initialize the record (Move the header record data down)
if (iErrorCode != DBConstants.NORMAL_RETURN)
... | [
"public",
"int",
"doRecordChange",
"(",
"FieldInfo",
"field",
",",
"int",
"iChangeType",
",",
"boolean",
"bDisplayOption",
")",
"{",
"// Read a valid record",
"int",
"iErrorCode",
"=",
"super",
".",
"doRecordChange",
"(",
"field",
",",
"iChangeType",
",",
"bDispla... | Called when a change is the record status is about to happen/has happened.
@param field If this file change is due to a field, this is the field.
@param iChangeType The type of change that occurred.
@param bDisplayOption If true, display any changes.
@return an error code. | [
"Called",
"when",
"a",
"change",
"is",
"the",
"record",
"status",
"is",
"about",
"to",
"happen",
"/",
"has",
"happened",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/SequenceHandler.java#L73-L88 |
m-m-m/util | cli/src/main/java/net/sf/mmm/util/cli/base/CliState.java | CliState.addOption | private void addOption(String nameOrAlias, CliOptionContainer option) {
"""
This method {@link #getOption(String) registers} the given {@link CliOptionContainer option} with the given
{@code name}.
@param nameOrAlias is the {@link CliOption#name()} or {@link CliOption#aliases() alias} of the option.
@param op... | java | private void addOption(String nameOrAlias, CliOptionContainer option) {
CliOptionContainer old = this.name2OptionMap.put(nameOrAlias, option);
if (old != null) {
throw new DuplicateObjectException(option, nameOrAlias);
}
} | [
"private",
"void",
"addOption",
"(",
"String",
"nameOrAlias",
",",
"CliOptionContainer",
"option",
")",
"{",
"CliOptionContainer",
"old",
"=",
"this",
".",
"name2OptionMap",
".",
"put",
"(",
"nameOrAlias",
",",
"option",
")",
";",
"if",
"(",
"old",
"!=",
"nu... | This method {@link #getOption(String) registers} the given {@link CliOptionContainer option} with the given
{@code name}.
@param nameOrAlias is the {@link CliOption#name()} or {@link CliOption#aliases() alias} of the option.
@param option is the {@link CliOptionContainer option} to register. | [
"This",
"method",
"{",
"@link",
"#getOption",
"(",
"String",
")",
"registers",
"}",
"the",
"given",
"{",
"@link",
"CliOptionContainer",
"option",
"}",
"with",
"the",
"given",
"{",
"@code",
"name",
"}",
"."
] | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/cli/src/main/java/net/sf/mmm/util/cli/base/CliState.java#L358-L364 |
zaproxy/zaproxy | src/org/zaproxy/zap/extension/script/ScriptAPI.java | ScriptAPI.getAndValidateScriptName | private String getAndValidateScriptName(JSONObject params) throws ApiException {
"""
Gets and validates that the parameter named {@value #ACTION_PARAM_SCRIPT_NAME}, in {@code parameters}, represents an
existing script name.
<p>
The parameter must exist, that is, it should be a mandatory parameter, otherwise a r... | java | private String getAndValidateScriptName(JSONObject params) throws ApiException {
String scriptName = params.getString(ACTION_PARAM_SCRIPT_NAME);
if (extension.getScript(scriptName) == null) {
throw new ApiException(ApiException.Type.DOES_NOT_EXIST, ACTION_PARAM_SCRIPT_NAME);
}
return scriptName;
} | [
"private",
"String",
"getAndValidateScriptName",
"(",
"JSONObject",
"params",
")",
"throws",
"ApiException",
"{",
"String",
"scriptName",
"=",
"params",
".",
"getString",
"(",
"ACTION_PARAM_SCRIPT_NAME",
")",
";",
"if",
"(",
"extension",
".",
"getScript",
"(",
"sc... | Gets and validates that the parameter named {@value #ACTION_PARAM_SCRIPT_NAME}, in {@code parameters}, represents an
existing script name.
<p>
The parameter must exist, that is, it should be a mandatory parameter, otherwise a runtime exception is thrown.
@param params the parameters of the API request.
@return the nam... | [
"Gets",
"and",
"validates",
"that",
"the",
"parameter",
"named",
"{",
"@value",
"#ACTION_PARAM_SCRIPT_NAME",
"}",
"in",
"{",
"@code",
"parameters",
"}",
"represents",
"an",
"existing",
"script",
"name",
".",
"<p",
">",
"The",
"parameter",
"must",
"exist",
"tha... | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/script/ScriptAPI.java#L193-L199 |
apiman/apiman | gateway/engine/policies/src/main/java/io/apiman/gateway/engine/policies/TimeRestrictedAccessPolicy.java | TimeRestrictedAccessPolicy.canProcessRequest | private boolean canProcessRequest(TimeRestrictedAccessConfig config, String destination) {
"""
Evaluates whether the destination provided matches any of the configured
pathsToIgnore and matches specified time range.
@param config
The {@link IgnoredResourcesConfig} containing the
pathsToIgnore
@param destina... | java | private boolean canProcessRequest(TimeRestrictedAccessConfig config, String destination) {
if (destination == null || destination.trim().length() == 0) {
destination = "/"; //$NON-NLS-1$
}
List<TimeRestrictedAccess> rulesEnabledForPath = getRulesMatchingPath(config, destination);... | [
"private",
"boolean",
"canProcessRequest",
"(",
"TimeRestrictedAccessConfig",
"config",
",",
"String",
"destination",
")",
"{",
"if",
"(",
"destination",
"==",
"null",
"||",
"destination",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
... | Evaluates whether the destination provided matches any of the configured
pathsToIgnore and matches specified time range.
@param config
The {@link IgnoredResourcesConfig} containing the
pathsToIgnore
@param destination
The destination to evaluate
@return true if any path matches the destination. false otherwise | [
"Evaluates",
"whether",
"the",
"destination",
"provided",
"matches",
"any",
"of",
"the",
"configured",
"pathsToIgnore",
"and",
"matches",
"specified",
"time",
"range",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/policies/src/main/java/io/apiman/gateway/engine/policies/TimeRestrictedAccessPolicy.java#L90-L109 |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/csskit/OutputUtil.java | OutputUtil.appendArray | public static <T> StringBuilder appendArray(StringBuilder sb, T[] array, String delimiter) {
"""
Appends all elements of <code>array</code> to buffer, separated by delimiter
@param <T> Type of elements stored in <code>array</code>
@param sb StringBuilder to be modified
@param array Array of elements
@param del... | java | public static <T> StringBuilder appendArray(StringBuilder sb, T[] array, String delimiter) {
boolean firstRun = true;
for(T elem: array) {
if(!firstRun)
sb.append(delimiter);
else
firstRun = false;
sb.append(elem.toString());
}
return sb;
} | [
"public",
"static",
"<",
"T",
">",
"StringBuilder",
"appendArray",
"(",
"StringBuilder",
"sb",
",",
"T",
"[",
"]",
"array",
",",
"String",
"delimiter",
")",
"{",
"boolean",
"firstRun",
"=",
"true",
";",
"for",
"(",
"T",
"elem",
":",
"array",
")",
"{",
... | Appends all elements of <code>array</code> to buffer, separated by delimiter
@param <T> Type of elements stored in <code>array</code>
@param sb StringBuilder to be modified
@param array Array of elements
@param delimiter Delimiter to separate elements
@return Modified <code>sb</code> to allow chaining | [
"Appends",
"all",
"elements",
"of",
"<code",
">",
"array<",
"/",
"code",
">",
"to",
"buffer",
"separated",
"by",
"delimiter"
] | train | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/OutputUtil.java#L84-L99 |
phax/ph-oton | ph-oton-app/src/main/java/com/helger/photon/app/resource/WebSiteResourceWithCondition.java | WebSiteResourceWithCondition.createForCSS | @Nonnull
public static WebSiteResourceWithCondition createForCSS (@Nonnull final ICSSPathProvider aPP, final boolean bRegular) {
"""
Factory method for CSS resources.
@param aPP
The path provider.
@param bRegular
<code>true</code> for regular version, <code>false</code> for the
minified/optimized version.... | java | @Nonnull
public static WebSiteResourceWithCondition createForCSS (@Nonnull final ICSSPathProvider aPP, final boolean bRegular)
{
return createForCSS (aPP.getCSSItemPath (bRegular),
aPP.getConditionalComment (),
aPP.isBundlable (),
aPP.ge... | [
"@",
"Nonnull",
"public",
"static",
"WebSiteResourceWithCondition",
"createForCSS",
"(",
"@",
"Nonnull",
"final",
"ICSSPathProvider",
"aPP",
",",
"final",
"boolean",
"bRegular",
")",
"{",
"return",
"createForCSS",
"(",
"aPP",
".",
"getCSSItemPath",
"(",
"bRegular",
... | Factory method for CSS resources.
@param aPP
The path provider.
@param bRegular
<code>true</code> for regular version, <code>false</code> for the
minified/optimized version.
@return New {@link WebSiteResourceWithCondition} object. Never
<code>null</code>. | [
"Factory",
"method",
"for",
"CSS",
"resources",
"."
] | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-app/src/main/java/com/helger/photon/app/resource/WebSiteResourceWithCondition.java#L273-L280 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocPath.java | DocPath.forRoot | public static DocPath forRoot(PackageDoc pd) {
"""
Return the inverse path for a package.
For example, if the package is java.lang,
the inverse path is ../...
"""
String name = (pd == null) ? "" : pd.name();
if (name.isEmpty())
return empty;
return new DocPath(name.replace... | java | public static DocPath forRoot(PackageDoc pd) {
String name = (pd == null) ? "" : pd.name();
if (name.isEmpty())
return empty;
return new DocPath(name.replace('.', '/').replaceAll("[^/]+", ".."));
} | [
"public",
"static",
"DocPath",
"forRoot",
"(",
"PackageDoc",
"pd",
")",
"{",
"String",
"name",
"=",
"(",
"pd",
"==",
"null",
")",
"?",
"\"\"",
":",
"pd",
".",
"name",
"(",
")",
";",
"if",
"(",
"name",
".",
"isEmpty",
"(",
")",
")",
"return",
"emp... | Return the inverse path for a package.
For example, if the package is java.lang,
the inverse path is ../... | [
"Return",
"the",
"inverse",
"path",
"for",
"a",
"package",
".",
"For",
"example",
"if",
"the",
"package",
"is",
"java",
".",
"lang",
"the",
"inverse",
"path",
"is",
"..",
"/",
"..."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocPath.java#L99-L104 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/TableId.java | TableId.of | public static TableId of(String project, String dataset, String table) {
"""
Creates a table identity given project's, dataset's and table's user-defined ids.
"""
return new TableId(checkNotNull(project), checkNotNull(dataset), checkNotNull(table));
} | java | public static TableId of(String project, String dataset, String table) {
return new TableId(checkNotNull(project), checkNotNull(dataset), checkNotNull(table));
} | [
"public",
"static",
"TableId",
"of",
"(",
"String",
"project",
",",
"String",
"dataset",
",",
"String",
"table",
")",
"{",
"return",
"new",
"TableId",
"(",
"checkNotNull",
"(",
"project",
")",
",",
"checkNotNull",
"(",
"dataset",
")",
",",
"checkNotNull",
... | Creates a table identity given project's, dataset's and table's user-defined ids. | [
"Creates",
"a",
"table",
"identity",
"given",
"project",
"s",
"dataset",
"s",
"and",
"table",
"s",
"user",
"-",
"defined",
"ids",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/TableId.java#L73-L75 |
geomajas/geomajas-project-client-gwt | plugin/widget-layer/layer-gwt/src/main/java/org/geomajas/widget/layer/client/presenter/CreateClientWmsPresenterImpl.java | CreateClientWmsPresenterImpl.createClientWmsLayerInfo | public ClientWmsLayerInfo createClientWmsLayerInfo(WmsSelectedLayerInfo wmsSelectedLayerInfo, MapWidget mapWidget) {
"""
Factory method for {@link ClientWmsLayerInfo} from
{@link org.geomajas.widget.layer.client.presenter.WmsSelectedLayerInfo} and {@link MapWidget}.
Could be a static method in a util class.
@... | java | public ClientWmsLayerInfo createClientWmsLayerInfo(WmsSelectedLayerInfo wmsSelectedLayerInfo, MapWidget mapWidget) {
WmsLayerConfiguration wmsConfig = new WmsLayerConfiguration();
wmsConfig.setFormat("image/png");
wmsConfig.setLayers(wmsSelectedLayerInfo.getWmsLayerInfo().getName());
wmsConfig.setVersion(wmsSel... | [
"public",
"ClientWmsLayerInfo",
"createClientWmsLayerInfo",
"(",
"WmsSelectedLayerInfo",
"wmsSelectedLayerInfo",
",",
"MapWidget",
"mapWidget",
")",
"{",
"WmsLayerConfiguration",
"wmsConfig",
"=",
"new",
"WmsLayerConfiguration",
"(",
")",
";",
"wmsConfig",
".",
"setFormat",... | Factory method for {@link ClientWmsLayerInfo} from
{@link org.geomajas.widget.layer.client.presenter.WmsSelectedLayerInfo} and {@link MapWidget}.
Could be a static method in a util class.
@param wmsSelectedLayerInfo
@param mapWidget
@return | [
"Factory",
"method",
"for",
"{",
"@link",
"ClientWmsLayerInfo",
"}",
"from",
"{",
"@link",
"org",
".",
"geomajas",
".",
"widget",
".",
"layer",
".",
"client",
".",
"presenter",
".",
"WmsSelectedLayerInfo",
"}",
"and",
"{",
"@link",
"MapWidget",
"}",
".",
"... | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-layer/layer-gwt/src/main/java/org/geomajas/widget/layer/client/presenter/CreateClientWmsPresenterImpl.java#L223-L246 |
alkacon/opencms-core | src/org/opencms/ade/configuration/CmsResourceTypeConfig.java | CmsResourceTypeConfig.getAddMenuVisibility | public AddMenuVisibility getAddMenuVisibility(CmsUUID elementViewId, AddMenuType menuType) {
"""
Gets the visibility status in the 'add' menu for this type and the given element view.<p>
@param elementViewId the id of the view for which to compute the visibility status
@param menuType the menu type for which w... | java | public AddMenuVisibility getAddMenuVisibility(CmsUUID elementViewId, AddMenuType menuType) {
if (isAddDisabled()) {
return AddMenuVisibility.disabled;
}
if (elementViewId.equals(getElementView())) {
if (isCreateDisabled() && (menuType == AddMenuType.ade)) {
... | [
"public",
"AddMenuVisibility",
"getAddMenuVisibility",
"(",
"CmsUUID",
"elementViewId",
",",
"AddMenuType",
"menuType",
")",
"{",
"if",
"(",
"isAddDisabled",
"(",
")",
")",
"{",
"return",
"AddMenuVisibility",
".",
"disabled",
";",
"}",
"if",
"(",
"elementViewId",
... | Gets the visibility status in the 'add' menu for this type and the given element view.<p>
@param elementViewId the id of the view for which to compute the visibility status
@param menuType the menu type for which we want to evaluate the visibility
@return the visibility status | [
"Gets",
"the",
"visibility",
"status",
"in",
"the",
"add",
"menu",
"for",
"this",
"type",
"and",
"the",
"given",
"element",
"view",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/CmsResourceTypeConfig.java#L417-L435 |
joniles/mpxj | src/main/java/net/sf/mpxj/Task.java | Task.setBaselineWork | public void setBaselineWork(int baselineNumber, Duration value) {
"""
Set a baseline value.
@param baselineNumber baseline index (1-10)
@param value baseline value
"""
set(selectField(TaskFieldLists.BASELINE_WORKS, baselineNumber), value);
} | java | public void setBaselineWork(int baselineNumber, Duration value)
{
set(selectField(TaskFieldLists.BASELINE_WORKS, baselineNumber), value);
} | [
"public",
"void",
"setBaselineWork",
"(",
"int",
"baselineNumber",
",",
"Duration",
"value",
")",
"{",
"set",
"(",
"selectField",
"(",
"TaskFieldLists",
".",
"BASELINE_WORKS",
",",
"baselineNumber",
")",
",",
"value",
")",
";",
"}"
] | Set a baseline value.
@param baselineNumber baseline index (1-10)
@param value baseline value | [
"Set",
"a",
"baseline",
"value",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Task.java#L4024-L4027 |
mgormley/optimize | src/main/java/edu/jhu/hlt/util/Utilities.java | Utilities.sampleWithoutReplacement | public static int[] sampleWithoutReplacement(int m, int n) {
"""
Samples a set of m integers without replacement from the range [0,...,n-1].
@param m The number of integers to return.
@param n The number of integers from which to sample.
@return The sample as an unsorted integer array.
"""
// This i... | java | public static int[] sampleWithoutReplacement(int m, int n) {
// This implements a modified form of the genshuf() function from
// Programming Pearls pg. 129.
// TODO: Design a faster method that only generates min(m, n-m) integers.
int[] array = getIndexArray(n);
... | [
"public",
"static",
"int",
"[",
"]",
"sampleWithoutReplacement",
"(",
"int",
"m",
",",
"int",
"n",
")",
"{",
"// This implements a modified form of the genshuf() function from",
"// Programming Pearls pg. 129.",
"// TODO: Design a faster method that only generates min(m, n-m) integer... | Samples a set of m integers without replacement from the range [0,...,n-1].
@param m The number of integers to return.
@param n The number of integers from which to sample.
@return The sample as an unsorted integer array. | [
"Samples",
"a",
"set",
"of",
"m",
"integers",
"without",
"replacement",
"from",
"the",
"range",
"[",
"0",
"...",
"n",
"-",
"1",
"]",
"."
] | train | https://github.com/mgormley/optimize/blob/3d1b93260b99febb8a5ecd9e8543c223e151a8d3/src/main/java/edu/jhu/hlt/util/Utilities.java#L419-L434 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/dgmimpl/NumberNumberMinus.java | NumberNumberMinus.minus | public static Number minus(Number left, Number right) {
"""
Subtraction of two Numbers.
@param left a Number
@param right another Number to subtract to the first one
@return the subtraction
"""
return NumberMath.subtract(left, right);
} | java | public static Number minus(Number left, Number right) {
return NumberMath.subtract(left, right);
} | [
"public",
"static",
"Number",
"minus",
"(",
"Number",
"left",
",",
"Number",
"right",
")",
"{",
"return",
"NumberMath",
".",
"subtract",
"(",
"left",
",",
"right",
")",
";",
"}"
] | Subtraction of two Numbers.
@param left a Number
@param right another Number to subtract to the first one
@return the subtraction | [
"Subtraction",
"of",
"two",
"Numbers",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/dgmimpl/NumberNumberMinus.java#L42-L44 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/util/HashUtil.java | HashUtil.hashToIndex | public static int hashToIndex(int hash, int length) {
"""
A function that calculates the index (e.g. to be used in an array/list) for a given hash. The returned value will always
be equal or larger than 0 and will always be smaller than 'length'.
The reason this function exists is to deal correctly with negati... | java | public static int hashToIndex(int hash, int length) {
checkPositive(length, "length must be larger than 0");
if (hash == Integer.MIN_VALUE) {
return 0;
}
return abs(hash) % length;
} | [
"public",
"static",
"int",
"hashToIndex",
"(",
"int",
"hash",
",",
"int",
"length",
")",
"{",
"checkPositive",
"(",
"length",
",",
"\"length must be larger than 0\"",
")",
";",
"if",
"(",
"hash",
"==",
"Integer",
".",
"MIN_VALUE",
")",
"{",
"return",
"0",
... | A function that calculates the index (e.g. to be used in an array/list) for a given hash. The returned value will always
be equal or larger than 0 and will always be smaller than 'length'.
The reason this function exists is to deal correctly with negative and especially the Integer.MIN_VALUE; since that can't
be used ... | [
"A",
"function",
"that",
"calculates",
"the",
"index",
"(",
"e",
".",
"g",
".",
"to",
"be",
"used",
"in",
"an",
"array",
"/",
"list",
")",
"for",
"a",
"given",
"hash",
".",
"The",
"returned",
"value",
"will",
"always",
"be",
"equal",
"or",
"larger",
... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/HashUtil.java#L333-L341 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/SubnetsInner.java | SubnetsInner.createOrUpdateAsync | public Observable<SubnetInner> createOrUpdateAsync(String resourceGroupName, String virtualNetworkName, String subnetName, SubnetInner subnetParameters) {
"""
Creates or updates a subnet in the specified virtual network.
@param resourceGroupName The name of the resource group.
@param virtualNetworkName The nam... | java | public Observable<SubnetInner> createOrUpdateAsync(String resourceGroupName, String virtualNetworkName, String subnetName, SubnetInner subnetParameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, virtualNetworkName, subnetName, subnetParameters).map(new Func1<ServiceResponse<SubnetInner>... | [
"public",
"Observable",
"<",
"SubnetInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualNetworkName",
",",
"String",
"subnetName",
",",
"SubnetInner",
"subnetParameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync"... | Creates or updates a subnet in the specified virtual network.
@param resourceGroupName The name of the resource group.
@param virtualNetworkName The name of the virtual network.
@param subnetName The name of the subnet.
@param subnetParameters Parameters supplied to the create or update subnet operation.
@throws Illeg... | [
"Creates",
"or",
"updates",
"a",
"subnet",
"in",
"the",
"specified",
"virtual",
"network",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/SubnetsInner.java#L480-L487 |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.faulttolerance.2.0/src/com/ibm/ws/microprofile/faulttolerance20/state/FaultToleranceStateFactory.java | FaultToleranceStateFactory.createRetryState | public RetryState createRetryState(RetryPolicy policy, MetricRecorder metricRecorder) {
"""
Create an object implementing Retry
@param policy the RetryPolicy, may be {@code null}
@return a new RetryState
"""
if (policy == null) {
return new RetryStateNullImpl();
} else {
... | java | public RetryState createRetryState(RetryPolicy policy, MetricRecorder metricRecorder) {
if (policy == null) {
return new RetryStateNullImpl();
} else {
return new RetryStateImpl(policy, metricRecorder);
}
} | [
"public",
"RetryState",
"createRetryState",
"(",
"RetryPolicy",
"policy",
",",
"MetricRecorder",
"metricRecorder",
")",
"{",
"if",
"(",
"policy",
"==",
"null",
")",
"{",
"return",
"new",
"RetryStateNullImpl",
"(",
")",
";",
"}",
"else",
"{",
"return",
"new",
... | Create an object implementing Retry
@param policy the RetryPolicy, may be {@code null}
@return a new RetryState | [
"Create",
"an",
"object",
"implementing",
"Retry"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.faulttolerance.2.0/src/com/ibm/ws/microprofile/faulttolerance20/state/FaultToleranceStateFactory.java#L53-L59 |
roboconf/roboconf-platform | core/roboconf-dm/src/main/java/net/roboconf/dm/internal/commands/CreateInstanceCommandExecution.java | CreateInstanceCommandExecution.verify | public static void verify( CommandExecutionContext executionContext, Component component )
throws CommandException {
"""
Verifies a new VM model can be created according to a given context.
@param executionContext
@param component
@throws CommandException
"""
if( executionContext != null
&& Constant... | java | public static void verify( CommandExecutionContext executionContext, Component component )
throws CommandException {
if( executionContext != null
&& Constants.TARGET_INSTALLER.equalsIgnoreCase( component.getInstallerName())
&& executionContext.getMaxVm() > 0
&& executionContext.getMaxVm() <= executionCo... | [
"public",
"static",
"void",
"verify",
"(",
"CommandExecutionContext",
"executionContext",
",",
"Component",
"component",
")",
"throws",
"CommandException",
"{",
"if",
"(",
"executionContext",
"!=",
"null",
"&&",
"Constants",
".",
"TARGET_INSTALLER",
".",
"equalsIgnore... | Verifies a new VM model can be created according to a given context.
@param executionContext
@param component
@throws CommandException | [
"Verifies",
"a",
"new",
"VM",
"model",
"can",
"be",
"created",
"according",
"to",
"a",
"given",
"context",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-dm/src/main/java/net/roboconf/dm/internal/commands/CreateInstanceCommandExecution.java#L85-L94 |
xdcrafts/flower | flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapDotApi.java | MapDotApi.dotGetString | public static Optional<String> dotGetString(final Map map, final String pathString) {
"""
Get string value by path.
@param map subject
@param pathString nodes to walk in map
@return value
"""
return dotGet(map, String.class, pathString);
} | java | public static Optional<String> dotGetString(final Map map, final String pathString) {
return dotGet(map, String.class, pathString);
} | [
"public",
"static",
"Optional",
"<",
"String",
">",
"dotGetString",
"(",
"final",
"Map",
"map",
",",
"final",
"String",
"pathString",
")",
"{",
"return",
"dotGet",
"(",
"map",
",",
"String",
".",
"class",
",",
"pathString",
")",
";",
"}"
] | Get string value by path.
@param map subject
@param pathString nodes to walk in map
@return value | [
"Get",
"string",
"value",
"by",
"path",
"."
] | train | https://github.com/xdcrafts/flower/blob/96a8e49102fea434bd383a3c7852f0ee9545f999/flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapDotApi.java#L136-L138 |
lucee/Lucee | core/src/main/java/lucee/runtime/config/XMLConfigAdmin.java | XMLConfigAdmin.updateUpdate | public void updateUpdate(String type, String location) throws SecurityException {
"""
updates update settingd for Lucee
@param type
@param location
@throws SecurityException
"""
checkWriteAccess();
if (!(config instanceof ConfigServer)) {
throw new SecurityException("can't change update setting fr... | java | public void updateUpdate(String type, String location) throws SecurityException {
checkWriteAccess();
if (!(config instanceof ConfigServer)) {
throw new SecurityException("can't change update setting from this context, access is denied");
}
Element update = _getRootElement("update");
update.setAttribute("typ... | [
"public",
"void",
"updateUpdate",
"(",
"String",
"type",
",",
"String",
"location",
")",
"throws",
"SecurityException",
"{",
"checkWriteAccess",
"(",
")",
";",
"if",
"(",
"!",
"(",
"config",
"instanceof",
"ConfigServer",
")",
")",
"{",
"throw",
"new",
"Secur... | updates update settingd for Lucee
@param type
@param location
@throws SecurityException | [
"updates",
"update",
"settingd",
"for",
"Lucee"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/XMLConfigAdmin.java#L3442-L3457 |
ddf-project/DDF | core/src/main/java/io/ddf/util/ConfigHandler.java | ConfigHandler.locateConfigFileName | private String locateConfigFileName(String configDir, String configFileName) throws IOException {
"""
Search in current dir and working up, looking for the config file
@return
@throws IOException
"""
String curDir = new File(".").getCanonicalPath();
String path = null;
// Go for at most 10 le... | java | private String locateConfigFileName(String configDir, String configFileName) throws IOException {
String curDir = new File(".").getCanonicalPath();
String path = null;
// Go for at most 10 levels up
for (int i = 0; i < 10; i++) {
path = String.format("%s/%s", curDir, configFileName);
if (U... | [
"private",
"String",
"locateConfigFileName",
"(",
"String",
"configDir",
",",
"String",
"configFileName",
")",
"throws",
"IOException",
"{",
"String",
"curDir",
"=",
"new",
"File",
"(",
"\".\"",
")",
".",
"getCanonicalPath",
"(",
")",
";",
"String",
"path",
"=... | Search in current dir and working up, looking for the config file
@return
@throws IOException | [
"Search",
"in",
"current",
"dir",
"and",
"working",
"up",
"looking",
"for",
"the",
"config",
"file"
] | train | https://github.com/ddf-project/DDF/blob/e4e68315dcec1ed8b287bf1ee73baa88e7e41eba/core/src/main/java/io/ddf/util/ConfigHandler.java#L201-L227 |
meltmedia/cadmium | servlets/src/main/java/com/meltmedia/cadmium/servlets/AbstractSecureRedirectStrategy.java | AbstractSecureRedirectStrategy.changeProtocolAndPort | public static URI changeProtocolAndPort(String protocol, int port, HttpServletRequest request) throws URISyntaxException {
"""
Constructs a URI for request and calls changeProtocolAndPort(String, int, URI).
@param protocol the new protocol (scheme) in the resulting URI.
@param port the new port in the resultin... | java | public static URI changeProtocolAndPort(String protocol, int port, HttpServletRequest request) throws URISyntaxException {
return changeProtocolAndPort(
protocol,
port,
URI.create(
request.getRequestURL()
.append((StringUtils.isEmpty(request.getQueryString()) ? ""... | [
"public",
"static",
"URI",
"changeProtocolAndPort",
"(",
"String",
"protocol",
",",
"int",
"port",
",",
"HttpServletRequest",
"request",
")",
"throws",
"URISyntaxException",
"{",
"return",
"changeProtocolAndPort",
"(",
"protocol",
",",
"port",
",",
"URI",
".",
"cr... | Constructs a URI for request and calls changeProtocolAndPort(String, int, URI).
@param protocol the new protocol (scheme) in the resulting URI.
@param port the new port in the resulting URI, or the default port if -1 is provided.
@param request the request to use as the URI template.
@return a new URI object with the ... | [
"Constructs",
"a",
"URI",
"for",
"request",
"and",
"calls",
"changeProtocolAndPort",
"(",
"String",
"int",
"URI",
")",
"."
] | train | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/servlets/src/main/java/com/meltmedia/cadmium/servlets/AbstractSecureRedirectStrategy.java#L187-L195 |
johncarl81/transfuse | transfuse-core/src/main/java/org/androidtransfuse/analysis/InjectionPointFactory.java | InjectionPointFactory.buildInjectionPoint | public ConstructorInjectionPoint buildInjectionPoint(ASTType containingType, ASTConstructor astConstructor, AnalysisContext context) {
"""
Build a Constructor InjectionPoint from the given ASTConstructor
@param astConstructor required ASTConstructor
@param context required AnalysisContext
@return Const... | java | public ConstructorInjectionPoint buildInjectionPoint(ASTType containingType, ASTConstructor astConstructor, AnalysisContext context) {
ConstructorInjectionPoint constructorInjectionPoint = new ConstructorInjectionPoint(containingType, astConstructor);
constructorInjectionPoint.addThrows(astConstructor.... | [
"public",
"ConstructorInjectionPoint",
"buildInjectionPoint",
"(",
"ASTType",
"containingType",
",",
"ASTConstructor",
"astConstructor",
",",
"AnalysisContext",
"context",
")",
"{",
"ConstructorInjectionPoint",
"constructorInjectionPoint",
"=",
"new",
"ConstructorInjectionPoint",... | Build a Constructor InjectionPoint from the given ASTConstructor
@param astConstructor required ASTConstructor
@param context required AnalysisContext
@return ConstructorInjectionPoint | [
"Build",
"a",
"Constructor",
"InjectionPoint",
"from",
"the",
"given",
"ASTConstructor"
] | train | https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-core/src/main/java/org/androidtransfuse/analysis/InjectionPointFactory.java#L70-L88 |
softindex/datakernel | cloud-fs/src/main/java/io/datakernel/remotefs/RemoteFsClusterClient.java | RemoteFsClusterClient.markDead | public boolean markDead(Object partitionId, @Nullable Throwable e) {
"""
Mark partition as dead. It means that no operations will use it and it would not be given to the server selector.
Next call of {@link #checkDeadPartitions()} or {@link #checkAllPartitions()} will ping this partition and possibly
mark it as ... | java | public boolean markDead(Object partitionId, @Nullable Throwable e) {
FsClient client = aliveClients.remove(partitionId);
if (client != null) {
logger.warn("marking " + partitionId + " as dead (" + e + ')');
deadClients.put(partitionId, client);
return true;
}
return false;
} | [
"public",
"boolean",
"markDead",
"(",
"Object",
"partitionId",
",",
"@",
"Nullable",
"Throwable",
"e",
")",
"{",
"FsClient",
"client",
"=",
"aliveClients",
".",
"remove",
"(",
"partitionId",
")",
";",
"if",
"(",
"client",
"!=",
"null",
")",
"{",
"logger",
... | Mark partition as dead. It means that no operations will use it and it would not be given to the server selector.
Next call of {@link #checkDeadPartitions()} or {@link #checkAllPartitions()} will ping this partition and possibly
mark it as alive again.
@param partitionId id of the partition to be marked
@param e ... | [
"Mark",
"partition",
"as",
"dead",
".",
"It",
"means",
"that",
"no",
"operations",
"will",
"use",
"it",
"and",
"it",
"would",
"not",
"be",
"given",
"to",
"the",
"server",
"selector",
".",
"Next",
"call",
"of",
"{",
"@link",
"#checkDeadPartitions",
"()",
... | train | https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/cloud-fs/src/main/java/io/datakernel/remotefs/RemoteFsClusterClient.java#L210-L218 |
sporniket/core | sporniket-core-ml/src/main/java/com/sporniket/libre/lang/xml/XmlStringTools.java | XmlStringTools.doAppendComment | private static StringBuffer doAppendComment(StringBuffer buffer, String comment) {
"""
Add a comment to a StringBuffer.
If the buffer is null, a new one is created.
@param buffer
StringBuffer to fill
@param comment
the comment
@return the buffer
"""
buffer.append(SEQUENCE__COMMENT__OPEN).append(com... | java | private static StringBuffer doAppendComment(StringBuffer buffer, String comment)
{
buffer.append(SEQUENCE__COMMENT__OPEN).append(comment).append(SEQUENCE__COMMENT__CLOSE);
return buffer;
} | [
"private",
"static",
"StringBuffer",
"doAppendComment",
"(",
"StringBuffer",
"buffer",
",",
"String",
"comment",
")",
"{",
"buffer",
".",
"append",
"(",
"SEQUENCE__COMMENT__OPEN",
")",
".",
"append",
"(",
"comment",
")",
".",
"append",
"(",
"SEQUENCE__COMMENT__CLO... | Add a comment to a StringBuffer.
If the buffer is null, a new one is created.
@param buffer
StringBuffer to fill
@param comment
the comment
@return the buffer | [
"Add",
"a",
"comment",
"to",
"a",
"StringBuffer",
"."
] | train | https://github.com/sporniket/core/blob/3480ebd72a07422fcc09971be2607ee25efb2c26/sporniket-core-ml/src/main/java/com/sporniket/libre/lang/xml/XmlStringTools.java#L470-L474 |
Harium/keel | src/main/java/com/harium/keel/catalano/math/distance/Distance.java | Distance.Minkowski | public static double Minkowski(double[] u, double[] v, double p) {
"""
Gets the Minkowski distance between two points.
@param u A point in space.
@param v A point in space.
@param p Order between two points.
@return The Minkowski distance between x and y.
"""
double distance = 0;
for (int... | java | public static double Minkowski(double[] u, double[] v, double p) {
double distance = 0;
for (int i = 0; i < u.length; i++) {
distance += Math.pow(Math.abs(u[i] - v[i]), p);
}
return Math.pow(distance, 1 / p);
} | [
"public",
"static",
"double",
"Minkowski",
"(",
"double",
"[",
"]",
"u",
",",
"double",
"[",
"]",
"v",
",",
"double",
"p",
")",
"{",
"double",
"distance",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"u",
".",
"length",
";",
... | Gets the Minkowski distance between two points.
@param u A point in space.
@param v A point in space.
@param p Order between two points.
@return The Minkowski distance between x and y. | [
"Gets",
"the",
"Minkowski",
"distance",
"between",
"two",
"points",
"."
] | train | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/distance/Distance.java#L757-L763 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/search/bingvideosearch/src/main/java/com/microsoft/azure/cognitiveservices/search/videosearch/implementation/BingVideosImpl.java | BingVideosImpl.searchAsync | public Observable<VideosModel> searchAsync(String query, SearchOptionalParameter searchOptionalParameter) {
"""
The Video Search API lets you send a search query to Bing and get back a list of videos that are relevant to the search query. This section provides technical details about the query parameters and heade... | java | public Observable<VideosModel> searchAsync(String query, SearchOptionalParameter searchOptionalParameter) {
return searchWithServiceResponseAsync(query, searchOptionalParameter).map(new Func1<ServiceResponse<VideosModel>, VideosModel>() {
@Override
public VideosModel call(ServiceResponse... | [
"public",
"Observable",
"<",
"VideosModel",
">",
"searchAsync",
"(",
"String",
"query",
",",
"SearchOptionalParameter",
"searchOptionalParameter",
")",
"{",
"return",
"searchWithServiceResponseAsync",
"(",
"query",
",",
"searchOptionalParameter",
")",
".",
"map",
"(",
... | The Video Search API lets you send a search query to Bing and get back a list of videos that are relevant to the search query. This section provides technical details about the query parameters and headers that you use to request videos and the JSON response objects that contain them. For examples that show how to make... | [
"The",
"Video",
"Search",
"API",
"lets",
"you",
"send",
"a",
"search",
"query",
"to",
"Bing",
"and",
"get",
"back",
"a",
"list",
"of",
"videos",
"that",
"are",
"relevant",
"to",
"the",
"search",
"query",
".",
"This",
"section",
"provides",
"technical",
"... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/search/bingvideosearch/src/main/java/com/microsoft/azure/cognitiveservices/search/videosearch/implementation/BingVideosImpl.java#L120-L127 |
google/closure-templates | java/src/com/google/template/soy/jssrc/dsl/FormattingContext.java | FormattingContext.enterCaseBody | FormattingContext enterCaseBody() {
"""
For use only by {@link Switch#doFormatInitialStatements}. It's not an error for bodies of case
clauses to be brace-delimited, but it is slightly less readable, so omit them.
"""
maybeIndent();
curIndent = curIndent + " ";
endLine();
curScope = new Scope... | java | FormattingContext enterCaseBody() {
maybeIndent();
curIndent = curIndent + " ";
endLine();
curScope = new Scope(curScope, /* emitClosingBrace= */ false);
return this;
} | [
"FormattingContext",
"enterCaseBody",
"(",
")",
"{",
"maybeIndent",
"(",
")",
";",
"curIndent",
"=",
"curIndent",
"+",
"\" \"",
";",
"endLine",
"(",
")",
";",
"curScope",
"=",
"new",
"Scope",
"(",
"curScope",
",",
"/* emitClosingBrace= */",
"false",
")",
";... | For use only by {@link Switch#doFormatInitialStatements}. It's not an error for bodies of case
clauses to be brace-delimited, but it is slightly less readable, so omit them. | [
"For",
"use",
"only",
"by",
"{"
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/dsl/FormattingContext.java#L117-L123 |
DiUS/pact-jvm | pact-jvm-consumer-java8/src/main/java/io/pactfoundation/consumer/dsl/LambdaDslObject.java | LambdaDslObject.eachLike | public LambdaDslObject eachLike(String name, PactDslJsonRootValue value, int numberExamples) {
"""
Attribute that is an array where each item is a primitive that must match the provided value
@param name field name
@param value Value that each item in the array must match
@param numberExamples Number of examp... | java | public LambdaDslObject eachLike(String name, PactDslJsonRootValue value, int numberExamples) {
object.eachLike(name, value, numberExamples);
return this;
} | [
"public",
"LambdaDslObject",
"eachLike",
"(",
"String",
"name",
",",
"PactDslJsonRootValue",
"value",
",",
"int",
"numberExamples",
")",
"{",
"object",
".",
"eachLike",
"(",
"name",
",",
"value",
",",
"numberExamples",
")",
";",
"return",
"this",
";",
"}"
] | Attribute that is an array where each item is a primitive that must match the provided value
@param name field name
@param value Value that each item in the array must match
@param numberExamples Number of examples to generate | [
"Attribute",
"that",
"is",
"an",
"array",
"where",
"each",
"item",
"is",
"a",
"primitive",
"that",
"must",
"match",
"the",
"provided",
"value"
] | train | https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer-java8/src/main/java/io/pactfoundation/consumer/dsl/LambdaDslObject.java#L427-L430 |
ehcache/ehcache3 | impl/src/main/java/org/ehcache/impl/internal/util/ThreadFactoryUtil.java | ThreadFactoryUtil.threadFactory | public static ThreadFactory threadFactory(final String alias) {
"""
Return a {@code ThreadFactory} that will generate threads named "Ehcache [alias]-incrementingNumber"
@param alias the alias to use in the name. If null, the alias used will be "_default_"
@return the new thread factory
"""
return new T... | java | public static ThreadFactory threadFactory(final String alias) {
return new ThreadFactory() {
private final ThreadGroup threadGroup = Thread.currentThread().getThreadGroup();
private final AtomicInteger threadCount = new AtomicInteger();
private final String poolAlias = (alias == null ? "_default_"... | [
"public",
"static",
"ThreadFactory",
"threadFactory",
"(",
"final",
"String",
"alias",
")",
"{",
"return",
"new",
"ThreadFactory",
"(",
")",
"{",
"private",
"final",
"ThreadGroup",
"threadGroup",
"=",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getThreadGrou... | Return a {@code ThreadFactory} that will generate threads named "Ehcache [alias]-incrementingNumber"
@param alias the alias to use in the name. If null, the alias used will be "_default_"
@return the new thread factory | [
"Return",
"a",
"{",
"@code",
"ThreadFactory",
"}",
"that",
"will",
"generate",
"threads",
"named",
"Ehcache",
"[",
"alias",
"]",
"-",
"incrementingNumber"
] | train | https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/impl/internal/util/ThreadFactoryUtil.java#L42-L57 |
RestComm/sipunit | src/main/java/org/cafesip/sipunit/SipAssert.java | SipAssert.assertLastOperationSuccess | public static void assertLastOperationSuccess(String msg, SipActionObject op) {
"""
Asserts that the last SIP operation performed by the given object was successful. Assertion
failure output includes the given message text.
@param msg message text to output if the assertion fails.
@param op the SipUnit object... | java | public static void assertLastOperationSuccess(String msg, SipActionObject op) {
assertNotNull("Null assert object passed in", op);
assertTrue(msg, op.getErrorMessage().length() == 0);
} | [
"public",
"static",
"void",
"assertLastOperationSuccess",
"(",
"String",
"msg",
",",
"SipActionObject",
"op",
")",
"{",
"assertNotNull",
"(",
"\"Null assert object passed in\"",
",",
"op",
")",
";",
"assertTrue",
"(",
"msg",
",",
"op",
".",
"getErrorMessage",
"(",... | Asserts that the last SIP operation performed by the given object was successful. Assertion
failure output includes the given message text.
@param msg message text to output if the assertion fails.
@param op the SipUnit object that executed an operation. | [
"Asserts",
"that",
"the",
"last",
"SIP",
"operation",
"performed",
"by",
"the",
"given",
"object",
"was",
"successful",
".",
"Assertion",
"failure",
"output",
"includes",
"the",
"given",
"message",
"text",
"."
] | train | https://github.com/RestComm/sipunit/blob/18a6be2e29be3fbdc14226e8c41b25e2d57378b1/src/main/java/org/cafesip/sipunit/SipAssert.java#L77-L80 |
vkostyukov/la4j | src/main/java/org/la4j/matrix/SparseMatrix.java | SparseMatrix.from1DArray | public static SparseMatrix from1DArray(int rows, int columns, double[] array) {
"""
Creates a new {@link SparseMatrix} from the given 1D {@code array} with
compressing (copying) the underlying array.
"""
return CRSMatrix.from1DArray(rows, columns, array);
} | java | public static SparseMatrix from1DArray(int rows, int columns, double[] array) {
return CRSMatrix.from1DArray(rows, columns, array);
} | [
"public",
"static",
"SparseMatrix",
"from1DArray",
"(",
"int",
"rows",
",",
"int",
"columns",
",",
"double",
"[",
"]",
"array",
")",
"{",
"return",
"CRSMatrix",
".",
"from1DArray",
"(",
"rows",
",",
"columns",
",",
"array",
")",
";",
"}"
] | Creates a new {@link SparseMatrix} from the given 1D {@code array} with
compressing (copying) the underlying array. | [
"Creates",
"a",
"new",
"{"
] | train | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/matrix/SparseMatrix.java#L109-L111 |
alkacon/opencms-core | src/org/opencms/db/CmsAliasManager.java | CmsAliasManager.saveAliases | public synchronized void saveAliases(CmsObject cms, CmsUUID structureId, List<CmsAlias> aliases)
throws CmsException {
"""
Saves the aliases for a given structure id, <b>completely replacing</b> any existing aliases for the same structure id.<p>
@param cms the current CMS context
@param structureId the st... | java | public synchronized void saveAliases(CmsObject cms, CmsUUID structureId, List<CmsAlias> aliases)
throws CmsException {
m_securityManager.saveAliases(cms.getRequestContext(), cms.readResource(structureId), aliases);
touch(cms, cms.readResource(structureId));
} | [
"public",
"synchronized",
"void",
"saveAliases",
"(",
"CmsObject",
"cms",
",",
"CmsUUID",
"structureId",
",",
"List",
"<",
"CmsAlias",
">",
"aliases",
")",
"throws",
"CmsException",
"{",
"m_securityManager",
".",
"saveAliases",
"(",
"cms",
".",
"getRequestContext"... | Saves the aliases for a given structure id, <b>completely replacing</b> any existing aliases for the same structure id.<p>
@param cms the current CMS context
@param structureId the structure id of a resource
@param aliases the list of aliases which should be written
@throws CmsException if something goes wrong | [
"Saves",
"the",
"aliases",
"for",
"a",
"given",
"structure",
"id",
"<b",
">",
"completely",
"replacing<",
"/",
"b",
">",
"any",
"existing",
"aliases",
"for",
"the",
"same",
"structure",
"id",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsAliasManager.java#L240-L245 |
actorapp/actor-platform | actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/ActorSDKLauncher.java | ActorSDKLauncher.startProfileActivity | public static void startProfileActivity(Context context, int uid) {
"""
Launch User Profile Activity
@param context current context
@param uid user id
"""
// Ignore call if context is empty, simple work-around when fragment was disconnected from
// activity
if (context ... | java | public static void startProfileActivity(Context context, int uid) {
// Ignore call if context is empty, simple work-around when fragment was disconnected from
// activity
if (context == null) {
return;
}
Bundle b = new Bundle();
b.putInt(Intents.EXTRA... | [
"public",
"static",
"void",
"startProfileActivity",
"(",
"Context",
"context",
",",
"int",
"uid",
")",
"{",
"// Ignore call if context is empty, simple work-around when fragment was disconnected from",
"// activity",
"if",
"(",
"context",
"==",
"null",
")",
"{",
"return",
... | Launch User Profile Activity
@param context current context
@param uid user id | [
"Launch",
"User",
"Profile",
"Activity"
] | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/ActorSDKLauncher.java#L19-L29 |
aoindustries/ao-encoding | src/main/java/com/aoindustries/encoding/TextInShEncoder.java | TextInShEncoder.getEscapedCharacter | private static String getEscapedCharacter(char c) throws IOException {
"""
Encodes a single character and returns its String representation
or null if no modification is necessary. Implemented as
<a href="https://www.gnu.org/software/bash/manual/html_node/ANSI_002dC-Quoting.html">ANSI-C quoting</a>.
The only c... | java | private static String getEscapedCharacter(char c) throws IOException {
switch(c) {
case '\\' : return "\\\\";
case '\'' : return "\\'";
case '"' : return "\\\"";
case '?' : return "\\?";
}
if(
(c >= 0x20 && c <= 0x7E) // common case first
|| (c >= 0xA0 && c <= 0xFFFD)
) return null;
// 01 ... | [
"private",
"static",
"String",
"getEscapedCharacter",
"(",
"char",
"c",
")",
"throws",
"IOException",
"{",
"switch",
"(",
"c",
")",
"{",
"case",
"'",
"'",
":",
"return",
"\"\\\\\\\\\"",
";",
"case",
"'",
"'",
":",
"return",
"\"\\\\'\"",
";",
"case",
"'",... | Encodes a single character and returns its String representation
or null if no modification is necessary. Implemented as
<a href="https://www.gnu.org/software/bash/manual/html_node/ANSI_002dC-Quoting.html">ANSI-C quoting</a>.
The only character not supported is NULL (\x00).
@see ShValidator#checkCharacter(char)
@thr... | [
"Encodes",
"a",
"single",
"character",
"and",
"returns",
"its",
"String",
"representation",
"or",
"null",
"if",
"no",
"modification",
"is",
"necessary",
".",
"Implemented",
"as",
"<a",
"href",
"=",
"https",
":",
"//",
"www",
".",
"gnu",
".",
"org",
"/",
... | train | https://github.com/aoindustries/ao-encoding/blob/54eeb8ff58ab7b44bb02549bbe2572625b449e4e/src/main/java/com/aoindustries/encoding/TextInShEncoder.java#L132-L151 |
HanSolo/SteelSeries-Swing | src/main/java/eu/hansolo/steelseries/tools/GradientWrapper.java | GradientWrapper.interpolateColor | private Color interpolateColor(final Color COLOR1, final Color COLOR2, final float FRACTION) {
"""
Returns the interpolated color that you get if you multiply the delta between
color2 and color1 with the given fraction (for each channel) and interpolation. The fraction should
be a value between 0 and 1.
@param ... | java | private Color interpolateColor(final Color COLOR1, final Color COLOR2, final float FRACTION) {
assert (Float.compare(FRACTION, 0f) >= 0 && Float.compare(FRACTION, 1f) <= 0);
final float INT_TO_FLOAT_CONST = 1f / 255f;
final float RED1 = COLOR1.getRed() * INT_TO_FLOAT_CONST;
final float... | [
"private",
"Color",
"interpolateColor",
"(",
"final",
"Color",
"COLOR1",
",",
"final",
"Color",
"COLOR2",
",",
"final",
"float",
"FRACTION",
")",
"{",
"assert",
"(",
"Float",
".",
"compare",
"(",
"FRACTION",
",",
"0f",
")",
">=",
"0",
"&&",
"Float",
".",... | Returns the interpolated color that you get if you multiply the delta between
color2 and color1 with the given fraction (for each channel) and interpolation. The fraction should
be a value between 0 and 1.
@param COLOR1 The first color as integer in the hex format 0xALPHA RED GREEN BLUE, e.g. 0xFF00FF00 for a pure gree... | [
"Returns",
"the",
"interpolated",
"color",
"that",
"you",
"get",
"if",
"you",
"multiply",
"the",
"delta",
"between",
"color2",
"and",
"color1",
"with",
"the",
"given",
"fraction",
"(",
"for",
"each",
"channel",
")",
"and",
"interpolation",
".",
"The",
"fract... | train | https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/tools/GradientWrapper.java#L176-L207 |
derari/cthul | objects/src/main/java/org/cthul/objects/Boxing.java | Boxing.deepUnbox | public static Object deepUnbox(Object[] src) {
"""
Returns any multidimensional array into an array of primitives.
@param src source array
@return multidimensional array of primitives
"""
Class<?> resultType = arrayBoxingType(src.getClass());
return deepUnbox(resultType, src);
} | java | public static Object deepUnbox(Object[] src) {
Class<?> resultType = arrayBoxingType(src.getClass());
return deepUnbox(resultType, src);
} | [
"public",
"static",
"Object",
"deepUnbox",
"(",
"Object",
"[",
"]",
"src",
")",
"{",
"Class",
"<",
"?",
">",
"resultType",
"=",
"arrayBoxingType",
"(",
"src",
".",
"getClass",
"(",
")",
")",
";",
"return",
"deepUnbox",
"(",
"resultType",
",",
"src",
")... | Returns any multidimensional array into an array of primitives.
@param src source array
@return multidimensional array of primitives | [
"Returns",
"any",
"multidimensional",
"array",
"into",
"an",
"array",
"of",
"primitives",
"."
] | train | https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/objects/src/main/java/org/cthul/objects/Boxing.java#L672-L675 |
Jasig/uPortal | uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/HandlerUtils.java | HandlerUtils.getPLFNode | public static Element getPLFNode(
Element compViewNode, IPerson person, boolean create, boolean includeChildNodes)
throws PortalException {
"""
This method returns the PLF version of the passed in compViewNode. If create is false and a
node with the same id is not found in the PLF then nul... | java | public static Element getPLFNode(
Element compViewNode, IPerson person, boolean create, boolean includeChildNodes)
throws PortalException {
Document plf = (Document) person.getAttribute(Constants.PLF);
String ID = compViewNode.getAttribute(Constants.ATT_ID);
Element plfNo... | [
"public",
"static",
"Element",
"getPLFNode",
"(",
"Element",
"compViewNode",
",",
"IPerson",
"person",
",",
"boolean",
"create",
",",
"boolean",
"includeChildNodes",
")",
"throws",
"PortalException",
"{",
"Document",
"plf",
"=",
"(",
"Document",
")",
"person",
"... | This method returns the PLF version of the passed in compViewNode. If create is false and a
node with the same id is not found in the PLF then null is returned. If the create is true
then an attempt is made to create the node along with any necessary ancestor nodes needed to
represent the path along the tree. | [
"This",
"method",
"returns",
"the",
"PLF",
"version",
"of",
"the",
"passed",
"in",
"compViewNode",
".",
"If",
"create",
"is",
"false",
"and",
"a",
"node",
"with",
"the",
"same",
"id",
"is",
"not",
"found",
"in",
"the",
"PLF",
"then",
"null",
"is",
"ret... | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/HandlerUtils.java#L36-L53 |
hsiafan/requests | src/main/java/net/dongliu/requests/RequestBuilder.java | RequestBuilder.basicAuth | public RequestBuilder basicAuth(String user, String password) {
"""
Set http basicAuth by BasicAuth(DigestAuth/NTLMAuth not supported now)
"""
this.basicAuth = new BasicAuth(user, password);
return this;
} | java | public RequestBuilder basicAuth(String user, String password) {
this.basicAuth = new BasicAuth(user, password);
return this;
} | [
"public",
"RequestBuilder",
"basicAuth",
"(",
"String",
"user",
",",
"String",
"password",
")",
"{",
"this",
".",
"basicAuth",
"=",
"new",
"BasicAuth",
"(",
"user",
",",
"password",
")",
";",
"return",
"this",
";",
"}"
] | Set http basicAuth by BasicAuth(DigestAuth/NTLMAuth not supported now) | [
"Set",
"http",
"basicAuth",
"by",
"BasicAuth",
"(",
"DigestAuth",
"/",
"NTLMAuth",
"not",
"supported",
"now",
")"
] | train | https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/RequestBuilder.java#L385-L388 |
GenesysPureEngage/provisioning-client-java | src/main/java/com/genesys/provisioning/UsersApi.java | UsersApi.updateUser | public void updateUser(String userDBID, User user) throws ProvisioningApiException {
"""
Updates the attributes of a user with the given DBID.
@param userDBID the DBID of the user to be updated. (required)
@param user the new attributes of the user. (required)
@throws ProvisioningApiException if the call is uns... | java | public void updateUser(String userDBID, User user) throws ProvisioningApiException {
try {
ApiSuccessResponse resp = usersApi.updateUser(userDBID, new UpdateUserData().data(Converters.convertUserToUpdateUserDataData(user)));
if (!resp.getStatus().getCode().equals(0)) {
throw new ProvisioningApiExcepti... | [
"public",
"void",
"updateUser",
"(",
"String",
"userDBID",
",",
"User",
"user",
")",
"throws",
"ProvisioningApiException",
"{",
"try",
"{",
"ApiSuccessResponse",
"resp",
"=",
"usersApi",
".",
"updateUser",
"(",
"userDBID",
",",
"new",
"UpdateUserData",
"(",
")",... | Updates the attributes of a user with the given DBID.
@param userDBID the DBID of the user to be updated. (required)
@param user the new attributes of the user. (required)
@throws ProvisioningApiException if the call is unsuccessful. | [
"Updates",
"the",
"attributes",
"of",
"a",
"user",
"with",
"the",
"given",
"DBID",
"."
] | train | https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/provisioning/UsersApi.java#L70-L80 |
Azure/azure-sdk-for-java | labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentsInner.java | EnvironmentsInner.getAsync | public Observable<EnvironmentInner> getAsync(String resourceGroupName, String labAccountName, String labName, String environmentSettingName, String environmentName, String expand) {
"""
Get environment.
@param resourceGroupName The name of the resource group.
@param labAccountName The name of the lab Account.
... | java | public Observable<EnvironmentInner> getAsync(String resourceGroupName, String labAccountName, String labName, String environmentSettingName, String environmentName, String expand) {
return getWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, expand).ma... | [
"public",
"Observable",
"<",
"EnvironmentInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"labAccountName",
",",
"String",
"labName",
",",
"String",
"environmentSettingName",
",",
"String",
"environmentName",
",",
"String",
"expand",
")",
... | Get environment.
@param resourceGroupName The name of the resource group.
@param labAccountName The name of the lab Account.
@param labName The name of the lab.
@param environmentSettingName The name of the environment Setting.
@param environmentName The name of the environment.
@param expand Specify the $expand query... | [
"Get",
"environment",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentsInner.java#L569-L576 |
apereo/cas | core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/EncodingUtils.java | EncodingUtils.encryptValueAsJwtRsaOeap256Aes256Sha512 | public static String encryptValueAsJwtRsaOeap256Aes256Sha512(final Key key, final Serializable value) {
"""
Encrypt value as jwt rsa oeap 256 aes 256 sha 512 string.
@param key the key
@param value the value
@return the string
"""
return encryptValueAsJwt(key, value, KeyManagementAlgorithmIdenti... | java | public static String encryptValueAsJwtRsaOeap256Aes256Sha512(final Key key, final Serializable value) {
return encryptValueAsJwt(key, value, KeyManagementAlgorithmIdentifiers.RSA_OAEP_256,
CipherExecutor.DEFAULT_CONTENT_ENCRYPTION_ALGORITHM);
} | [
"public",
"static",
"String",
"encryptValueAsJwtRsaOeap256Aes256Sha512",
"(",
"final",
"Key",
"key",
",",
"final",
"Serializable",
"value",
")",
"{",
"return",
"encryptValueAsJwt",
"(",
"key",
",",
"value",
",",
"KeyManagementAlgorithmIdentifiers",
".",
"RSA_OAEP_256",
... | Encrypt value as jwt rsa oeap 256 aes 256 sha 512 string.
@param key the key
@param value the value
@return the string | [
"Encrypt",
"value",
"as",
"jwt",
"rsa",
"oeap",
"256",
"aes",
"256",
"sha",
"512",
"string",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/EncodingUtils.java#L390-L393 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceAddressRestrictionPersistenceImpl.java | CommerceAddressRestrictionPersistenceImpl.findByCommerceCountryId | @Override
public List<CommerceAddressRestriction> findByCommerceCountryId(
long commerceCountryId, int start, int end) {
"""
Returns a range of all the commerce address restrictions where commerceCountryId = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. ... | java | @Override
public List<CommerceAddressRestriction> findByCommerceCountryId(
long commerceCountryId, int start, int end) {
return findByCommerceCountryId(commerceCountryId, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceAddressRestriction",
">",
"findByCommerceCountryId",
"(",
"long",
"commerceCountryId",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByCommerceCountryId",
"(",
"commerceCountryId",
",",
"start",
","... | Returns a range of all the commerce address restrictions where commerceCountryId = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the fir... | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"address",
"restrictions",
"where",
"commerceCountryId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceAddressRestrictionPersistenceImpl.java#L144-L148 |
line/armeria | core/src/main/java/com/linecorp/armeria/internal/ArmeriaHttpUtil.java | ArmeriaHttpUtil.toArmeria | public static HttpHeaders toArmeria(HttpRequest in) throws URISyntaxException {
"""
Converts the headers of the given Netty HTTP/1.x request into Armeria HTTP/2 headers.
The following headers are only used if they can not be found in the {@code HOST} header or the
{@code Request-Line} as defined by <a href="http... | java | public static HttpHeaders toArmeria(HttpRequest in) throws URISyntaxException {
final URI requestTargetUri = toUri(in);
final io.netty.handler.codec.http.HttpHeaders inHeaders = in.headers();
final HttpHeaders out = new DefaultHttpHeaders(true, inHeaders.size());
out.path(toHttp2Path(r... | [
"public",
"static",
"HttpHeaders",
"toArmeria",
"(",
"HttpRequest",
"in",
")",
"throws",
"URISyntaxException",
"{",
"final",
"URI",
"requestTargetUri",
"=",
"toUri",
"(",
"in",
")",
";",
"final",
"io",
".",
"netty",
".",
"handler",
".",
"codec",
".",
"http",... | Converts the headers of the given Netty HTTP/1.x request into Armeria HTTP/2 headers.
The following headers are only used if they can not be found in the {@code HOST} header or the
{@code Request-Line} as defined by <a href="https://tools.ietf.org/html/rfc7230">rfc7230</a>
<ul>
<li>{@link ExtensionHeaderNames#SCHEME}</... | [
"Converts",
"the",
"headers",
"of",
"the",
"given",
"Netty",
"HTTP",
"/",
"1",
".",
"x",
"request",
"into",
"Armeria",
"HTTP",
"/",
"2",
"headers",
".",
"The",
"following",
"headers",
"are",
"only",
"used",
"if",
"they",
"can",
"not",
"be",
"found",
"i... | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/internal/ArmeriaHttpUtil.java#L527-L546 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentScansInner.java | ManagedDatabaseVulnerabilityAssessmentScansInner.initiateScan | public void initiateScan(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) {
"""
Executes a Vulnerability Assessment database scan.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manage... | java | public void initiateScan(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) {
initiateScanWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId).toBlocking().last().body();
} | [
"public",
"void",
"initiateScan",
"(",
"String",
"resourceGroupName",
",",
"String",
"managedInstanceName",
",",
"String",
"databaseName",
",",
"String",
"scanId",
")",
"{",
"initiateScanWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"managedInstanceName",
",",... | Executes a Vulnerability Assessment database scan.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param managedInstanceName The name of the managed instance.
@param databaseName The name of the database.
... | [
"Executes",
"a",
"Vulnerability",
"Assessment",
"database",
"scan",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentScansInner.java#L331-L333 |
geomajas/geomajas-project-client-gwt2 | common-gwt/command/src/main/java/org/geomajas/gwt/client/util/Log.java | Log.logInfo | public static void logInfo(String message, Throwable t) {
"""
Info logging with cause.
@param message message
@param t cause
"""
logInfo(message + SEP + getMessage(t));
} | java | public static void logInfo(String message, Throwable t) {
logInfo(message + SEP + getMessage(t));
} | [
"public",
"static",
"void",
"logInfo",
"(",
"String",
"message",
",",
"Throwable",
"t",
")",
"{",
"logInfo",
"(",
"message",
"+",
"SEP",
"+",
"getMessage",
"(",
"t",
")",
")",
";",
"}"
] | Info logging with cause.
@param message message
@param t cause | [
"Info",
"logging",
"with",
"cause",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/common-gwt/command/src/main/java/org/geomajas/gwt/client/util/Log.java#L109-L111 |
pmwmedia/tinylog | tinylog-api/src/main/java/org/tinylog/TaggedLogger.java | TaggedLogger.isCoveredByMinimumLevel | private static boolean isCoveredByMinimumLevel(final String tag, final Level level) {
"""
Checks if a given tag and severity level is covered by the logging provider's minimum level.
@param tag
Tag to check
@param level
Severity level to check
@return {@code true} if given severity level is covered, otherwi... | java | private static boolean isCoveredByMinimumLevel(final String tag, final Level level) {
return provider.getMinimumLevel(tag).ordinal() <= level.ordinal();
} | [
"private",
"static",
"boolean",
"isCoveredByMinimumLevel",
"(",
"final",
"String",
"tag",
",",
"final",
"Level",
"level",
")",
"{",
"return",
"provider",
".",
"getMinimumLevel",
"(",
"tag",
")",
".",
"ordinal",
"(",
")",
"<=",
"level",
".",
"ordinal",
"(",
... | Checks if a given tag and severity level is covered by the logging provider's minimum level.
@param tag
Tag to check
@param level
Severity level to check
@return {@code true} if given severity level is covered, otherwise {@code false} | [
"Checks",
"if",
"a",
"given",
"tag",
"and",
"severity",
"level",
"is",
"covered",
"by",
"the",
"logging",
"provider",
"s",
"minimum",
"level",
"."
] | train | https://github.com/pmwmedia/tinylog/blob/d03d4ef84a1310155037e08ca8822a91697d1086/tinylog-api/src/main/java/org/tinylog/TaggedLogger.java#L757-L759 |
netty/netty | buffer/src/main/java/io/netty/buffer/Unpooled.java | Unpooled.copiedBuffer | public static ByteBuf copiedBuffer(char[] array, int offset, int length, Charset charset) {
"""
Creates a new big-endian buffer whose content is a subregion of
the specified {@code array} encoded in the specified {@code charset}.
The new buffer's {@code readerIndex} and {@code writerIndex} are
{@code 0} and the... | java | public static ByteBuf copiedBuffer(char[] array, int offset, int length, Charset charset) {
if (array == null) {
throw new NullPointerException("array");
}
if (length == 0) {
return EMPTY_BUFFER;
}
return copiedBuffer(CharBuffer.wrap(array, offset, length)... | [
"public",
"static",
"ByteBuf",
"copiedBuffer",
"(",
"char",
"[",
"]",
"array",
",",
"int",
"offset",
",",
"int",
"length",
",",
"Charset",
"charset",
")",
"{",
"if",
"(",
"array",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"ar... | Creates a new big-endian buffer whose content is a subregion of
the specified {@code array} encoded in the specified {@code charset}.
The new buffer's {@code readerIndex} and {@code writerIndex} are
{@code 0} and the length of the encoded string respectively. | [
"Creates",
"a",
"new",
"big",
"-",
"endian",
"buffer",
"whose",
"content",
"is",
"a",
"subregion",
"of",
"the",
"specified",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/Unpooled.java#L641-L649 |
actframework/actframework | src/main/java/act/event/EventBus.java | EventBus.emitAsync | public EventBus emitAsync(ActEvent event, Object... args) {
"""
Overload {@link #emitAsync(EventObject, Object...)} for performance
tuning.
@see #emitAsync(EventObject, Object...)
"""
return _emitWithOnceBus(eventContextAsync(event, args));
} | java | public EventBus emitAsync(ActEvent event, Object... args) {
return _emitWithOnceBus(eventContextAsync(event, args));
} | [
"public",
"EventBus",
"emitAsync",
"(",
"ActEvent",
"event",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"_emitWithOnceBus",
"(",
"eventContextAsync",
"(",
"event",
",",
"args",
")",
")",
";",
"}"
] | Overload {@link #emitAsync(EventObject, Object...)} for performance
tuning.
@see #emitAsync(EventObject, Object...) | [
"Overload",
"{"
] | train | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/event/EventBus.java#L1044-L1046 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowManagedObjectException.java | PageFlowManagedObjectException.sendError | public void sendError( ServletRequest request, ServletResponse response )
throws IOException {
"""
Handle the error by writing a message to the response.
@param request the current HttpServletRequest
@param response the current HttpServletResponse
"""
InternalUtils.sendError( _messageKeyPre... | java | public void sendError( ServletRequest request, ServletResponse response )
throws IOException
{
InternalUtils.sendError( _messageKeyPrefix, getMessageArgs(), request, response, null,
InternalUtils.avoidDirectResponseOutput( request ) );
} | [
"public",
"void",
"sendError",
"(",
"ServletRequest",
"request",
",",
"ServletResponse",
"response",
")",
"throws",
"IOException",
"{",
"InternalUtils",
".",
"sendError",
"(",
"_messageKeyPrefix",
",",
"getMessageArgs",
"(",
")",
",",
"request",
",",
"response",
"... | Handle the error by writing a message to the response.
@param request the current HttpServletRequest
@param response the current HttpServletResponse | [
"Handle",
"the",
"error",
"by",
"writing",
"a",
"message",
"to",
"the",
"response",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowManagedObjectException.java#L107-L112 |
bazaarvoice/emodb | common/client/src/main/java/com/bazaarvoice/emodb/client/uri/EmoUriComponent.java | EmoUriComponent.decodeOctets | private static int decodeOctets(int i, ByteBuffer bb, StringBuilder sb) {
"""
Decodes octets to characters using the UTF-8 decoding and appends
the characters to a StringBuffer.
@return the index to the next unchecked character in the string to decode
"""
// If there is only one octet and is an ASC... | java | private static int decodeOctets(int i, ByteBuffer bb, StringBuilder sb) {
// If there is only one octet and is an ASCII character
if (bb.limit() == 1 && (bb.get(0) & 0xFF) < 0x80) {
// Octet can be appended directly
sb.append((char) bb.get(0));
return i + 2;
}... | [
"private",
"static",
"int",
"decodeOctets",
"(",
"int",
"i",
",",
"ByteBuffer",
"bb",
",",
"StringBuilder",
"sb",
")",
"{",
"// If there is only one octet and is an ASCII character",
"if",
"(",
"bb",
".",
"limit",
"(",
")",
"==",
"1",
"&&",
"(",
"bb",
".",
"... | Decodes octets to characters using the UTF-8 decoding and appends
the characters to a StringBuffer.
@return the index to the next unchecked character in the string to decode | [
"Decodes",
"octets",
"to",
"characters",
"using",
"the",
"UTF",
"-",
"8",
"decoding",
"and",
"appends",
"the",
"characters",
"to",
"a",
"StringBuffer",
"."
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/common/client/src/main/java/com/bazaarvoice/emodb/client/uri/EmoUriComponent.java#L822-L834 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/QPath.java | QPath.getCommonAncestorPath | public static QPath getCommonAncestorPath(QPath firstPath, QPath secondPath) throws PathNotFoundException {
"""
Get common ancestor path.
@param firstPath
@param secondPath
@return The common ancestor of two paths.
@throws PathNotFoundException
"""
if (!firstPath.getEntries()[0].equals(secondPath.... | java | public static QPath getCommonAncestorPath(QPath firstPath, QPath secondPath) throws PathNotFoundException
{
if (!firstPath.getEntries()[0].equals(secondPath.getEntries()[0]))
{
throw new PathNotFoundException("For the given ways there is no common ancestor.");
}
List<QPathEntry> ca... | [
"public",
"static",
"QPath",
"getCommonAncestorPath",
"(",
"QPath",
"firstPath",
",",
"QPath",
"secondPath",
")",
"throws",
"PathNotFoundException",
"{",
"if",
"(",
"!",
"firstPath",
".",
"getEntries",
"(",
")",
"[",
"0",
"]",
".",
"equals",
"(",
"secondPath",... | Get common ancestor path.
@param firstPath
@param secondPath
@return The common ancestor of two paths.
@throws PathNotFoundException | [
"Get",
"common",
"ancestor",
"path",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/QPath.java#L211-L233 |
hypercube1024/firefly | firefly/src/main/java/com/firefly/codec/http2/model/HttpFields.java | HttpFields.putDateField | public void putDateField(HttpHeader name, long date) {
"""
Sets the value of a date field.
@param name the field name
@param date the field date value
"""
String d = DateGenerator.formatDate(date);
put(name, d);
} | java | public void putDateField(HttpHeader name, long date) {
String d = DateGenerator.formatDate(date);
put(name, d);
} | [
"public",
"void",
"putDateField",
"(",
"HttpHeader",
"name",
",",
"long",
"date",
")",
"{",
"String",
"d",
"=",
"DateGenerator",
".",
"formatDate",
"(",
"date",
")",
";",
"put",
"(",
"name",
",",
"d",
")",
";",
"}"
] | Sets the value of a date field.
@param name the field name
@param date the field date value | [
"Sets",
"the",
"value",
"of",
"a",
"date",
"field",
"."
] | train | https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly/src/main/java/com/firefly/codec/http2/model/HttpFields.java#L673-L676 |
casbin/jcasbin | src/main/java/org/casbin/jcasbin/main/Enforcer.java | Enforcer.addPermissionForUser | public boolean addPermissionForUser(String user, String... permission) {
"""
addPermissionForUser adds a permission for a user or role.
Returns false if the user or role already has the permission (aka not affected).
@param user the user.
@param permission the permission, usually be (obj, act). It is actually... | java | public boolean addPermissionForUser(String user, String... permission) {
List<String> params = new ArrayList<>();
params.add(user);
Collections.addAll(params, permission);
return addPolicy(params);
} | [
"public",
"boolean",
"addPermissionForUser",
"(",
"String",
"user",
",",
"String",
"...",
"permission",
")",
"{",
"List",
"<",
"String",
">",
"params",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"params",
".",
"add",
"(",
"user",
")",
";",
"Collection... | addPermissionForUser adds a permission for a user or role.
Returns false if the user or role already has the permission (aka not affected).
@param user the user.
@param permission the permission, usually be (obj, act). It is actually the rule without the subject.
@return succeeds or not. | [
"addPermissionForUser",
"adds",
"a",
"permission",
"for",
"a",
"user",
"or",
"role",
".",
"Returns",
"false",
"if",
"the",
"user",
"or",
"role",
"already",
"has",
"the",
"permission",
"(",
"aka",
"not",
"affected",
")",
"."
] | train | https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/main/Enforcer.java#L251-L258 |
apache/reef | lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/EvaluatorSetupHelper.java | EvaluatorSetupHelper.getResources | Map<String, LocalResource> getResources(
final ResourceLaunchEvent resourceLaunchEvent)
throws IOException {
"""
Sets up the LocalResources for a new Evaluator.
@param resourceLaunchEvent
@return
@throws IOException
"""
final Map<String, LocalResource> result = new HashMap<>();
result... | java | Map<String, LocalResource> getResources(
final ResourceLaunchEvent resourceLaunchEvent)
throws IOException {
final Map<String, LocalResource> result = new HashMap<>();
result.putAll(getGlobalResources());
final File localStagingFolder = this.tempFileCreator.createTempDirectory(this.fileNames.g... | [
"Map",
"<",
"String",
",",
"LocalResource",
">",
"getResources",
"(",
"final",
"ResourceLaunchEvent",
"resourceLaunchEvent",
")",
"throws",
"IOException",
"{",
"final",
"Map",
"<",
"String",
",",
"LocalResource",
">",
"result",
"=",
"new",
"HashMap",
"<>",
"(",
... | Sets up the LocalResources for a new Evaluator.
@param resourceLaunchEvent
@return
@throws IOException | [
"Sets",
"up",
"the",
"LocalResources",
"for",
"a",
"new",
"Evaluator",
"."
] | train | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/EvaluatorSetupHelper.java#L94-L131 |
timols/java-gitlab-api | src/main/java/org/gitlab/api/GitlabAPI.java | GitlabAPI.deleteAward | public void deleteAward(GitlabMergeRequest mergeRequest, GitlabAward award) throws IOException {
"""
Delete an award for a merge request
@param mergeRequest
@param award
@throws IOException on gitlab api call error
"""
String tailUrl = GitlabProject.URL + "/" + mergeRequest.getProjectId() + Gitlab... | java | public void deleteAward(GitlabMergeRequest mergeRequest, GitlabAward award) throws IOException {
String tailUrl = GitlabProject.URL + "/" + mergeRequest.getProjectId() + GitlabMergeRequest.URL + "/"
+ mergeRequest.getIid() + GitlabAward.URL + "/" + award.getId();
retrieve().method(DELET... | [
"public",
"void",
"deleteAward",
"(",
"GitlabMergeRequest",
"mergeRequest",
",",
"GitlabAward",
"award",
")",
"throws",
"IOException",
"{",
"String",
"tailUrl",
"=",
"GitlabProject",
".",
"URL",
"+",
"\"/\"",
"+",
"mergeRequest",
".",
"getProjectId",
"(",
")",
"... | Delete an award for a merge request
@param mergeRequest
@param award
@throws IOException on gitlab api call error | [
"Delete",
"an",
"award",
"for",
"a",
"merge",
"request"
] | train | https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L3492-L3497 |
TheHortonMachine/hortonmachine | dbs/src/main/java/org/hortonmachine/dbs/mbtiles/MBTilesDb.java | MBTilesDb.addTile | public synchronized void addTile( int x, int y, int z, byte[] imageBytes ) throws Exception {
"""
Add a single tile.
@param x the x tile index.
@param y the y tile index.
@param z the zoom level.
@return the tile image bytes.
@throws Exception
"""
database.execOnConnection(connection -> {
... | java | public synchronized void addTile( int x, int y, int z, byte[] imageBytes ) throws Exception {
database.execOnConnection(connection -> {
try (IHMPreparedStatement pstmt = connection.prepareStatement(insertTileSql);) {
pstmt.setInt(1, z);
pstmt.setInt(2, x);
... | [
"public",
"synchronized",
"void",
"addTile",
"(",
"int",
"x",
",",
"int",
"y",
",",
"int",
"z",
",",
"byte",
"[",
"]",
"imageBytes",
")",
"throws",
"Exception",
"{",
"database",
".",
"execOnConnection",
"(",
"connection",
"->",
"{",
"try",
"(",
"IHMPrepa... | Add a single tile.
@param x the x tile index.
@param y the y tile index.
@param z the zoom level.
@return the tile image bytes.
@throws Exception | [
"Add",
"a",
"single",
"tile",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/dbs/src/main/java/org/hortonmachine/dbs/mbtiles/MBTilesDb.java#L218-L229 |
michel-kraemer/citeproc-java | citeproc-java/src/main/java/de/undercouch/citeproc/zotero/ZoteroItemDataProvider.java | ZoteroItemDataProvider.uniquify | private static String uniquify(String id, Set<String> knownIds) {
"""
Makes the given ID unique
@param id the ID
@param knownIds a set of known IDs to compare to
@return the unique IDs
"""
int n = 10;
String olda = id;
while (knownIds.contains(id)) {
id = olda + Integer.toString(n, Character.MAX_RA... | java | private static String uniquify(String id, Set<String> knownIds) {
int n = 10;
String olda = id;
while (knownIds.contains(id)) {
id = olda + Integer.toString(n, Character.MAX_RADIX);
++n;
}
return id;
} | [
"private",
"static",
"String",
"uniquify",
"(",
"String",
"id",
",",
"Set",
"<",
"String",
">",
"knownIds",
")",
"{",
"int",
"n",
"=",
"10",
";",
"String",
"olda",
"=",
"id",
";",
"while",
"(",
"knownIds",
".",
"contains",
"(",
"id",
")",
")",
"{",... | Makes the given ID unique
@param id the ID
@param knownIds a set of known IDs to compare to
@return the unique IDs | [
"Makes",
"the",
"given",
"ID",
"unique"
] | train | https://github.com/michel-kraemer/citeproc-java/blob/1d5bf0e7bbb2bdc47309530babf0ecaba838bf10/citeproc-java/src/main/java/de/undercouch/citeproc/zotero/ZoteroItemDataProvider.java#L133-L141 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.