repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 196 | func_name stringlengths 7 107 | whole_func_string stringlengths 76 3.82k | language stringclasses 1
value | func_code_string stringlengths 76 3.82k | func_code_tokens listlengths 22 717 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 508 | split_name stringclasses 1
value | func_code_url stringlengths 111 310 |
|---|---|---|---|---|---|---|---|---|---|---|
Jasig/uPortal | uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/utils/ResourceLoader.java | ResourceLoader.getResourceAsSAXInputSource | public static InputSource getResourceAsSAXInputSource(Class<?> requestingClass, String resource)
throws ResourceMissingException, IOException {
URL url = getResourceAsURL(requestingClass, resource);
InputSource source = new InputSource(url.openStream());
source.setPublicId(url.toExternalForm());
return source;
} | java | public static InputSource getResourceAsSAXInputSource(Class<?> requestingClass, String resource)
throws ResourceMissingException, IOException {
URL url = getResourceAsURL(requestingClass, resource);
InputSource source = new InputSource(url.openStream());
source.setPublicId(url.toExternalForm());
return source;
} | [
"public",
"static",
"InputSource",
"getResourceAsSAXInputSource",
"(",
"Class",
"<",
"?",
">",
"requestingClass",
",",
"String",
"resource",
")",
"throws",
"ResourceMissingException",
",",
"IOException",
"{",
"URL",
"url",
"=",
"getResourceAsURL",
"(",
"requestingClas... | Returns the requested resource as a SAX input source.
@param requestingClass the java.lang.Class object of the class that is attempting to load the
resource
@param resource a String describing the full or partial URL of the resource to load
@return the requested resource as a SAX input source
@throws ResourceMissingException
@throws java.io.IOException | [
"Returns",
"the",
"requested",
"resource",
"as",
"a",
"SAX",
"input",
"source",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/utils/ResourceLoader.java#L227-L233 |
weld/core | impl/src/main/java/org/jboss/weld/util/collections/Iterators.java | Iterators.addAll | public static <T> boolean addAll(Collection<T> target, Iterator<? extends T> iterator) {
Preconditions.checkArgumentNotNull(target, "target");
boolean modified = false;
while (iterator.hasNext()) {
modified |= target.add(iterator.next());
}
return modified;
} | java | public static <T> boolean addAll(Collection<T> target, Iterator<? extends T> iterator) {
Preconditions.checkArgumentNotNull(target, "target");
boolean modified = false;
while (iterator.hasNext()) {
modified |= target.add(iterator.next());
}
return modified;
} | [
"public",
"static",
"<",
"T",
">",
"boolean",
"addAll",
"(",
"Collection",
"<",
"T",
">",
"target",
",",
"Iterator",
"<",
"?",
"extends",
"T",
">",
"iterator",
")",
"{",
"Preconditions",
".",
"checkArgumentNotNull",
"(",
"target",
",",
"\"target\"",
")",
... | Add all elements in the iterator to the collection.
@param target
@param iterator
@return true if the target was modified, false otherwise | [
"Add",
"all",
"elements",
"in",
"the",
"iterator",
"to",
"the",
"collection",
"."
] | train | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/collections/Iterators.java#L46-L53 |
alkacon/opencms-core | src/org/opencms/main/CmsShellCommands.java | CmsShellCommands.clearCaches | public void clearCaches() throws Exception {
OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_CLEAR_CACHES, new HashMap<String, Object>()));
} | java | public void clearCaches() throws Exception {
OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_CLEAR_CACHES, new HashMap<String, Object>()));
} | [
"public",
"void",
"clearCaches",
"(",
")",
"throws",
"Exception",
"{",
"OpenCms",
".",
"fireCmsEvent",
"(",
"new",
"CmsEvent",
"(",
"I_CmsEventListener",
".",
"EVENT_CLEAR_CACHES",
",",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
")",
")",... | Clears all OpenCms internal caches.<p>
@throws Exception if something goes wrong | [
"Clears",
"all",
"OpenCms",
"internal",
"caches",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/CmsShellCommands.java#L262-L265 |
cdk/cdk | tool/builder3d/src/main/java/org/openscience/cdk/modeling/builder3d/AtomPlacer3D.java | AtomPlacer3D.getPlacedHeavyAtoms | public IAtomContainer getPlacedHeavyAtoms(IAtomContainer molecule, IAtom atom) {
List<IBond> bonds = molecule.getConnectedBondsList(atom);
IAtomContainer connectedAtoms = molecule.getBuilder().newInstance(IAtomContainer.class);
IAtom connectedAtom = null;
for (IBond bond : bonds) {
connectedAtom = bond.getOther(atom);
if (isPlacedHeavyAtom(connectedAtom)) {
connectedAtoms.addAtom(connectedAtom);
}
}
return connectedAtoms;
} | java | public IAtomContainer getPlacedHeavyAtoms(IAtomContainer molecule, IAtom atom) {
List<IBond> bonds = molecule.getConnectedBondsList(atom);
IAtomContainer connectedAtoms = molecule.getBuilder().newInstance(IAtomContainer.class);
IAtom connectedAtom = null;
for (IBond bond : bonds) {
connectedAtom = bond.getOther(atom);
if (isPlacedHeavyAtom(connectedAtom)) {
connectedAtoms.addAtom(connectedAtom);
}
}
return connectedAtoms;
} | [
"public",
"IAtomContainer",
"getPlacedHeavyAtoms",
"(",
"IAtomContainer",
"molecule",
",",
"IAtom",
"atom",
")",
"{",
"List",
"<",
"IBond",
">",
"bonds",
"=",
"molecule",
".",
"getConnectedBondsList",
"(",
"atom",
")",
";",
"IAtomContainer",
"connectedAtoms",
"=",... | Gets the placed Heavy Atoms connected to an atom.
@param molecule
@param atom The atom the atoms must be connected to.
@return The placed heavy atoms. | [
"Gets",
"the",
"placed",
"Heavy",
"Atoms",
"connected",
"to",
"an",
"atom",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/builder3d/src/main/java/org/openscience/cdk/modeling/builder3d/AtomPlacer3D.java#L558-L570 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/media/MediaClient.java | MediaClient.getTranscodingJob | public GetTranscodingJobResponse getTranscodingJob(GetTranscodingJobRequest request) {
checkNotNull(request, "The parameter request should NOT be null.");
checkStringNotEmpty(request.getJobId(), "The parameter jobId should NOT be null or empty string.");
InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, TRANSCODE_JOB, request.getJobId());
return invokeHttpClient(internalRequest, GetTranscodingJobResponse.class);
} | java | public GetTranscodingJobResponse getTranscodingJob(GetTranscodingJobRequest request) {
checkNotNull(request, "The parameter request should NOT be null.");
checkStringNotEmpty(request.getJobId(), "The parameter jobId should NOT be null or empty string.");
InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, TRANSCODE_JOB, request.getJobId());
return invokeHttpClient(internalRequest, GetTranscodingJobResponse.class);
} | [
"public",
"GetTranscodingJobResponse",
"getTranscodingJob",
"(",
"GetTranscodingJobRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"The parameter request should NOT be null.\"",
")",
";",
"checkStringNotEmpty",
"(",
"request",
".",
"getJobId",
"(",
")"... | Retrieve the status of a job.
@param request The request object containing all options for retrieving job status.
@return The status of a job. | [
"Retrieve",
"the",
"status",
"of",
"a",
"job",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/media/MediaClient.java#L488-L494 |
cloudfoundry/uaa | model/src/main/java/org/cloudfoundry/identity/uaa/provider/ExternalIdentityProviderDefinition.java | ExternalIdentityProviderDefinition.addAttributeMapping | @JsonIgnore
public void addAttributeMapping(String key, Object value) {
attributeMappings.put(key, value);
} | java | @JsonIgnore
public void addAttributeMapping(String key, Object value) {
attributeMappings.put(key, value);
} | [
"@",
"JsonIgnore",
"public",
"void",
"addAttributeMapping",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"attributeMappings",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"}"
] | adds an attribute mapping, where the key is known to the UAA and the value represents
the attribute name on the IDP
@param key - known to the UAA, such as {@link #EMAIL_ATTRIBUTE_NAME}, {@link #GROUP_ATTRIBUTE_NAME}, {@link #PHONE_NUMBER_ATTRIBUTE_NAME}
@param value - the name of the attribute on the IDP side, for example <code>emailAddress</code> | [
"adds",
"an",
"attribute",
"mapping",
"where",
"the",
"key",
"is",
"known",
"to",
"the",
"UAA",
"and",
"the",
"value",
"represents",
"the",
"attribute",
"name",
"on",
"the",
"IDP"
] | train | https://github.com/cloudfoundry/uaa/blob/e8df3d7060580c92d33461106399f9e4f36e3cd2/model/src/main/java/org/cloudfoundry/identity/uaa/provider/ExternalIdentityProviderDefinition.java#L75-L78 |
astrapi69/jaulp-wicket | jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/resource/ResourceModelFactory.java | ResourceModelFactory.newResourceModel | public static IModel<String> newResourceModel(final String resourceKey,
final Component component, final IModel<?> model, final String defaultValue,
final Object... parameters)
{
if ((parameters != null) && (parameters.length > 0))
{
for (int i = 0; i < parameters.length; i++)
{
if ((parameters[i] != null) && (parameters[i] instanceof ResourceBundleKey))
{
final ResourceBundleKey parameter = (ResourceBundleKey)parameters[i];
final IModel<String> parameterValue = newResourceModel(parameter, component);
parameters[i] = parameterValue.getObject();
}
}
}
return new StringResourceModel(resourceKey, component, model).setDefaultValue(defaultValue)
.setParameters(parameters);
} | java | public static IModel<String> newResourceModel(final String resourceKey,
final Component component, final IModel<?> model, final String defaultValue,
final Object... parameters)
{
if ((parameters != null) && (parameters.length > 0))
{
for (int i = 0; i < parameters.length; i++)
{
if ((parameters[i] != null) && (parameters[i] instanceof ResourceBundleKey))
{
final ResourceBundleKey parameter = (ResourceBundleKey)parameters[i];
final IModel<String> parameterValue = newResourceModel(parameter, component);
parameters[i] = parameterValue.getObject();
}
}
}
return new StringResourceModel(resourceKey, component, model).setDefaultValue(defaultValue)
.setParameters(parameters);
} | [
"public",
"static",
"IModel",
"<",
"String",
">",
"newResourceModel",
"(",
"final",
"String",
"resourceKey",
",",
"final",
"Component",
"component",
",",
"final",
"IModel",
"<",
"?",
">",
"model",
",",
"final",
"String",
"defaultValue",
",",
"final",
"Object",... | Factory method to create a new {@link StringResourceModel} from the given arguments.
@param resourceKey
the resource key
@param component
the component
@param model
the model
@param defaultValue
the default value
@param parameters
the parameters
@return a new {@link StringResourceModel} as an {@link IModel} | [
"Factory",
"method",
"to",
"create",
"a",
"new",
"{",
"@link",
"StringResourceModel",
"}",
"from",
"the",
"given",
"arguments",
"."
] | train | https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/resource/ResourceModelFactory.java#L167-L185 |
jtrfp/javamod | src/main/java/de/quippy/mp3/decoder/Bitstream.java | Bitstream.syncHeader | int syncHeader(byte syncmode) throws BitstreamException
{
boolean sync;
int headerstring;
// read additional 2 bytes
int bytesRead = readBytes(syncbuf, 0, 3);
if (bytesRead!=3) throw newBitstreamException(STREAM_EOF, null);
headerstring = ((syncbuf[0] << 16) & 0x00FF0000) | ((syncbuf[1] << 8) & 0x0000FF00) | ((syncbuf[2] << 0) & 0x000000FF);
do
{
headerstring <<= 8;
if (readBytes(syncbuf, 3, 1)!=1)
throw newBitstreamException(STREAM_EOF, null);
headerstring |= (syncbuf[3] & 0x000000FF);
sync = isSyncMark(headerstring, syncmode, syncword);
}
while (!sync);
current_frame_number++;
if (last_frame_number < current_frame_number) last_frame_number = current_frame_number;
return headerstring;
} | java | int syncHeader(byte syncmode) throws BitstreamException
{
boolean sync;
int headerstring;
// read additional 2 bytes
int bytesRead = readBytes(syncbuf, 0, 3);
if (bytesRead!=3) throw newBitstreamException(STREAM_EOF, null);
headerstring = ((syncbuf[0] << 16) & 0x00FF0000) | ((syncbuf[1] << 8) & 0x0000FF00) | ((syncbuf[2] << 0) & 0x000000FF);
do
{
headerstring <<= 8;
if (readBytes(syncbuf, 3, 1)!=1)
throw newBitstreamException(STREAM_EOF, null);
headerstring |= (syncbuf[3] & 0x000000FF);
sync = isSyncMark(headerstring, syncmode, syncword);
}
while (!sync);
current_frame_number++;
if (last_frame_number < current_frame_number) last_frame_number = current_frame_number;
return headerstring;
} | [
"int",
"syncHeader",
"(",
"byte",
"syncmode",
")",
"throws",
"BitstreamException",
"{",
"boolean",
"sync",
";",
"int",
"headerstring",
";",
"// read additional 2 bytes",
"int",
"bytesRead",
"=",
"readBytes",
"(",
"syncbuf",
",",
"0",
",",
"3",
")",
";",
"if",
... | Get next 32 bits from bitstream.
They are stored in the headerstring.
syncmod allows Synchro flag ID
The returned value is False at the end of stream. | [
"Get",
"next",
"32",
"bits",
"from",
"bitstream",
".",
"They",
"are",
"stored",
"in",
"the",
"headerstring",
".",
"syncmod",
"allows",
"Synchro",
"flag",
"ID",
"The",
"returned",
"value",
"is",
"False",
"at",
"the",
"end",
"of",
"stream",
"."
] | train | https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/mp3/decoder/Bitstream.java#L430-L458 |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/primitives/DoubleUtils.java | DoubleUtils.argMin | public static int argMin(final double[] x, final int startInclusive, final int endExclusive) {
checkArgument(endExclusive > startInclusive);
checkArgument(startInclusive >= 0);
checkArgument(endExclusive <= x.length);
double minValue = Double.MAX_VALUE;
int minIndex = 0;
for (int i = startInclusive; i < endExclusive; ++i) {
final double val = x[i];
if (val < minValue) {
minIndex = i;
minValue = val;
}
}
return minIndex;
} | java | public static int argMin(final double[] x, final int startInclusive, final int endExclusive) {
checkArgument(endExclusive > startInclusive);
checkArgument(startInclusive >= 0);
checkArgument(endExclusive <= x.length);
double minValue = Double.MAX_VALUE;
int minIndex = 0;
for (int i = startInclusive; i < endExclusive; ++i) {
final double val = x[i];
if (val < minValue) {
minIndex = i;
minValue = val;
}
}
return minIndex;
} | [
"public",
"static",
"int",
"argMin",
"(",
"final",
"double",
"[",
"]",
"x",
",",
"final",
"int",
"startInclusive",
",",
"final",
"int",
"endExclusive",
")",
"{",
"checkArgument",
"(",
"endExclusive",
">",
"startInclusive",
")",
";",
"checkArgument",
"(",
"st... | Returns the index of the first minimal element of the array within the specified bounds. That
is, if there is a unique minimum, its index is returned. If there are multiple values tied for
smallest, the index of the first is returned. If the supplied array is empty, an {@link
IllegalArgumentException} is thrown. | [
"Returns",
"the",
"index",
"of",
"the",
"first",
"minimal",
"element",
"of",
"the",
"array",
"within",
"the",
"specified",
"bounds",
".",
"That",
"is",
"if",
"there",
"is",
"a",
"unique",
"minimum",
"its",
"index",
"is",
"returned",
".",
"If",
"there",
"... | train | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/primitives/DoubleUtils.java#L93-L108 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/http/HttpHeaderMap.java | HttpHeaderMap.setIntHeader | public void setIntHeader (@Nonnull @Nonempty final String sName, final int nValue)
{
_setHeader (sName, Integer.toString (nValue));
} | java | public void setIntHeader (@Nonnull @Nonempty final String sName, final int nValue)
{
_setHeader (sName, Integer.toString (nValue));
} | [
"public",
"void",
"setIntHeader",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sName",
",",
"final",
"int",
"nValue",
")",
"{",
"_setHeader",
"(",
"sName",
",",
"Integer",
".",
"toString",
"(",
"nValue",
")",
")",
";",
"}"
] | Set the passed header as a number.
@param sName
Header name. May neither be <code>null</code> nor empty.
@param nValue
The value to be set. May not be <code>null</code>. | [
"Set",
"the",
"passed",
"header",
"as",
"a",
"number",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/http/HttpHeaderMap.java#L343-L346 |
hibernate/hibernate-ogm | neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/dialect/impl/BaseNeo4jAssociationQueries.java | BaseNeo4jAssociationQueries.createRelationshipForCollectionOfPrimitivesOrMap | private void createRelationshipForCollectionOfPrimitivesOrMap(AssociationKey associationKey, String collectionRole, String[] columnNames, StringBuilder queryBuilder) {
String relationshipType = collectionRole;
if ( isPartOfEmbedded( collectionRole ) ) {
queryBuilder.append( " MERGE (owner) " );
String[] pathToEmbedded = appendEmbeddedNodes( collectionRole, queryBuilder );
relationshipType = pathToEmbedded[pathToEmbedded.length - 1];
queryBuilder.append( " CREATE (e) -[r:" );
}
else {
queryBuilder.append( " CREATE (owner) -[r:" );
}
escapeIdentifier( queryBuilder, relationshipType );
int offset = ownerEntityKeyMetadata.getColumnNames().length;
appendProperties( queryBuilder, associationKey.getMetadata().getRowKeyIndexColumnNames(), offset );
queryBuilder.append( "]-> (new:" );
queryBuilder.append( EMBEDDED );
queryBuilder.append( ":" );
escapeIdentifier( queryBuilder, associationKey.getTable() );
queryBuilder.append( " {" );
// THe name of the property is the same as the relationship type
escapeIdentifier( queryBuilder, relationshipType );
queryBuilder.append( ": {" );
offset += associationKey.getMetadata().getRowKeyIndexColumnNames().length;
queryBuilder.append( offset );
queryBuilder.append( "}" );
queryBuilder.append( "}" );
queryBuilder.append( ")" );
queryBuilder.append( " RETURN r" );
} | java | private void createRelationshipForCollectionOfPrimitivesOrMap(AssociationKey associationKey, String collectionRole, String[] columnNames, StringBuilder queryBuilder) {
String relationshipType = collectionRole;
if ( isPartOfEmbedded( collectionRole ) ) {
queryBuilder.append( " MERGE (owner) " );
String[] pathToEmbedded = appendEmbeddedNodes( collectionRole, queryBuilder );
relationshipType = pathToEmbedded[pathToEmbedded.length - 1];
queryBuilder.append( " CREATE (e) -[r:" );
}
else {
queryBuilder.append( " CREATE (owner) -[r:" );
}
escapeIdentifier( queryBuilder, relationshipType );
int offset = ownerEntityKeyMetadata.getColumnNames().length;
appendProperties( queryBuilder, associationKey.getMetadata().getRowKeyIndexColumnNames(), offset );
queryBuilder.append( "]-> (new:" );
queryBuilder.append( EMBEDDED );
queryBuilder.append( ":" );
escapeIdentifier( queryBuilder, associationKey.getTable() );
queryBuilder.append( " {" );
// THe name of the property is the same as the relationship type
escapeIdentifier( queryBuilder, relationshipType );
queryBuilder.append( ": {" );
offset += associationKey.getMetadata().getRowKeyIndexColumnNames().length;
queryBuilder.append( offset );
queryBuilder.append( "}" );
queryBuilder.append( "}" );
queryBuilder.append( ")" );
queryBuilder.append( " RETURN r" );
} | [
"private",
"void",
"createRelationshipForCollectionOfPrimitivesOrMap",
"(",
"AssociationKey",
"associationKey",
",",
"String",
"collectionRole",
",",
"String",
"[",
"]",
"columnNames",
",",
"StringBuilder",
"queryBuilder",
")",
"{",
"String",
"relationshipType",
"=",
"col... | /*
Append query part related to the creation of a relationship for a collection of primitive or a Map like in the
following examples:
1) @ElementCollection List<String> alternatives
2) @MapKeyColumn(name = "addressType") Map<String, Address> addresses
Query example for embedded collection of primitives or Map:
MATCH (owner:ENTITY:table {id: {0}})
MERGE (owner) -[:relType]-> (e0:EMBEDDED) -[:relType2]-> (e:EMBEDDED)
CREATE (e) -[r:relType2]-> (new:EMBEDDED { property: {1}})
RETURN r
MATCH (owner:ENTITY:table {id: {0}})
CREATE (owner) -[r:relType2]-> (target:EMBEDDED { property: {1}})
RETURN r | [
"/",
"*",
"Append",
"query",
"part",
"related",
"to",
"the",
"creation",
"of",
"a",
"relationship",
"for",
"a",
"collection",
"of",
"primitive",
"or",
"a",
"Map",
"like",
"in",
"the",
"following",
"examples",
":"
] | train | https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/dialect/impl/BaseNeo4jAssociationQueries.java#L457-L485 |
wcm-io/wcm-io-handler | richtext/src/main/java/io/wcm/handler/richtext/DefaultRewriteContentHandler.java | DefaultRewriteContentHandler.getAnchorLink | private Link getAnchorLink(Element element) {
SyntheticLinkResource resource = new SyntheticLinkResource(resourceResolver);
ValueMap resourceProps = resource.getValueMap();
// get link metadata from data element
boolean foundMetadata = getAnchorMetadataFromData(resourceProps, element);
if (!foundMetadata) {
// support for legacy metadata stored in single "data" attribute
foundMetadata = getAnchorLegacyMetadataFromSingleData(resourceProps, element);
if (!foundMetadata) {
// support for legacy metadata stored in rel attribute
getAnchorLegacyMetadataFromRel(resourceProps, element);
}
}
// build anchor via linkhandler
return linkHandler.get(resource).build();
} | java | private Link getAnchorLink(Element element) {
SyntheticLinkResource resource = new SyntheticLinkResource(resourceResolver);
ValueMap resourceProps = resource.getValueMap();
// get link metadata from data element
boolean foundMetadata = getAnchorMetadataFromData(resourceProps, element);
if (!foundMetadata) {
// support for legacy metadata stored in single "data" attribute
foundMetadata = getAnchorLegacyMetadataFromSingleData(resourceProps, element);
if (!foundMetadata) {
// support for legacy metadata stored in rel attribute
getAnchorLegacyMetadataFromRel(resourceProps, element);
}
}
// build anchor via linkhandler
return linkHandler.get(resource).build();
} | [
"private",
"Link",
"getAnchorLink",
"(",
"Element",
"element",
")",
"{",
"SyntheticLinkResource",
"resource",
"=",
"new",
"SyntheticLinkResource",
"(",
"resourceResolver",
")",
";",
"ValueMap",
"resourceProps",
"=",
"resource",
".",
"getValueMap",
"(",
")",
";",
"... | Extracts link metadata from the DOM elements attributes and resolves them to a {@link Link} object.
@param element DOM element
@return Link metadata | [
"Extracts",
"link",
"metadata",
"from",
"the",
"DOM",
"elements",
"attributes",
"and",
"resolves",
"them",
"to",
"a",
"{"
] | train | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/richtext/src/main/java/io/wcm/handler/richtext/DefaultRewriteContentHandler.java#L182-L199 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java | HtmlDocletWriter.addMethodInfo | private void addMethodInfo(MethodDoc method, Content dl) {
ClassDoc[] intfacs = method.containingClass().interfaces();
MethodDoc overriddenMethod = method.overriddenMethod();
// Check whether there is any implementation or overridden info to be
// printed. If no overridden or implementation info needs to be
// printed, do not print this section.
if ((intfacs.length > 0 &&
new ImplementedMethods(method, this.configuration).build().length > 0) ||
overriddenMethod != null) {
MethodWriterImpl.addImplementsInfo(this, method, dl);
if (overriddenMethod != null) {
MethodWriterImpl.addOverridden(this,
method.overriddenType(), overriddenMethod, dl);
}
}
} | java | private void addMethodInfo(MethodDoc method, Content dl) {
ClassDoc[] intfacs = method.containingClass().interfaces();
MethodDoc overriddenMethod = method.overriddenMethod();
// Check whether there is any implementation or overridden info to be
// printed. If no overridden or implementation info needs to be
// printed, do not print this section.
if ((intfacs.length > 0 &&
new ImplementedMethods(method, this.configuration).build().length > 0) ||
overriddenMethod != null) {
MethodWriterImpl.addImplementsInfo(this, method, dl);
if (overriddenMethod != null) {
MethodWriterImpl.addOverridden(this,
method.overriddenType(), overriddenMethod, dl);
}
}
} | [
"private",
"void",
"addMethodInfo",
"(",
"MethodDoc",
"method",
",",
"Content",
"dl",
")",
"{",
"ClassDoc",
"[",
"]",
"intfacs",
"=",
"method",
".",
"containingClass",
"(",
")",
".",
"interfaces",
"(",
")",
";",
"MethodDoc",
"overriddenMethod",
"=",
"method"... | Add method information.
@param method the method to be documented
@param dl the content tree to which the method information will be added | [
"Add",
"method",
"information",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java#L214-L229 |
bignerdranch/expandable-recycler-view | expandablerecyclerview/src/main/java/com/bignerdranch/expandablerecyclerview/ExpandableRecyclerAdapter.java | ExpandableRecyclerAdapter.onCreateViewHolder | @NonNull
@Override
@UiThread
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int viewType) {
if (isParentViewType(viewType)) {
PVH pvh = onCreateParentViewHolder(viewGroup, viewType);
pvh.setParentViewHolderExpandCollapseListener(mParentViewHolderExpandCollapseListener);
pvh.mExpandableAdapter = this;
return pvh;
} else {
CVH cvh = onCreateChildViewHolder(viewGroup, viewType);
cvh.mExpandableAdapter = this;
return cvh;
}
} | java | @NonNull
@Override
@UiThread
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int viewType) {
if (isParentViewType(viewType)) {
PVH pvh = onCreateParentViewHolder(viewGroup, viewType);
pvh.setParentViewHolderExpandCollapseListener(mParentViewHolderExpandCollapseListener);
pvh.mExpandableAdapter = this;
return pvh;
} else {
CVH cvh = onCreateChildViewHolder(viewGroup, viewType);
cvh.mExpandableAdapter = this;
return cvh;
}
} | [
"@",
"NonNull",
"@",
"Override",
"@",
"UiThread",
"public",
"RecyclerView",
".",
"ViewHolder",
"onCreateViewHolder",
"(",
"@",
"NonNull",
"ViewGroup",
"viewGroup",
",",
"int",
"viewType",
")",
"{",
"if",
"(",
"isParentViewType",
"(",
"viewType",
")",
")",
"{",... | Implementation of Adapter.onCreateViewHolder(ViewGroup, int)
that determines if the list item is a parent or a child and calls through
to the appropriate implementation of either {@link #onCreateParentViewHolder(ViewGroup, int)}
or {@link #onCreateChildViewHolder(ViewGroup, int)}.
@param viewGroup The {@link ViewGroup} into which the new {@link android.view.View}
will be added after it is bound to an adapter position.
@param viewType The view type of the new {@code android.view.View}.
@return A new RecyclerView.ViewHolder
that holds a {@code android.view.View} of the given view type. | [
"Implementation",
"of",
"Adapter",
".",
"onCreateViewHolder",
"(",
"ViewGroup",
"int",
")",
"that",
"determines",
"if",
"the",
"list",
"item",
"is",
"a",
"parent",
"or",
"a",
"child",
"and",
"calls",
"through",
"to",
"the",
"appropriate",
"implementation",
"of... | train | https://github.com/bignerdranch/expandable-recycler-view/blob/930912510620894c531d236856fa79d646e2f1ed/expandablerecyclerview/src/main/java/com/bignerdranch/expandablerecyclerview/ExpandableRecyclerAdapter.java#L137-L151 |
akquinet/needle | src/main/java/de/akquinet/jbosscc/needle/db/transaction/TransactionHelper.java | TransactionHelper.executeInTransaction | public final <T> T executeInTransaction(final Runnable<T> runnable) throws Exception {
return executeInTransaction(runnable, true);
} | java | public final <T> T executeInTransaction(final Runnable<T> runnable) throws Exception {
return executeInTransaction(runnable, true);
} | [
"public",
"final",
"<",
"T",
">",
"T",
"executeInTransaction",
"(",
"final",
"Runnable",
"<",
"T",
">",
"runnable",
")",
"throws",
"Exception",
"{",
"return",
"executeInTransaction",
"(",
"runnable",
",",
"true",
")",
";",
"}"
] | see executeInTransaction(runnable, clearAfterCommit) .
@param <T>
result type of runnable.run()
@param runnable
algorithm to execute
@return return value of runnable.run()
@throws Exception
execution failed | [
"see",
"executeInTransaction",
"(",
"runnable",
"clearAfterCommit",
")",
"."
] | train | https://github.com/akquinet/needle/blob/8b411c521246b8212882485edc01644f9aac7e24/src/main/java/de/akquinet/jbosscc/needle/db/transaction/TransactionHelper.java#L140-L142 |
jingwei/krati | krati-main/src/main/java/krati/util/SourceWaterMarks.java | SourceWaterMarks.setLWMScn | public void setLWMScn(String source, long scn) {
WaterMarkEntry e = sourceWaterMarkMap.get(source);
if (e == null) {
e = new WaterMarkEntry(source);
sourceWaterMarkMap.put(source, e);
}
e.setLWMScn(scn);
} | java | public void setLWMScn(String source, long scn) {
WaterMarkEntry e = sourceWaterMarkMap.get(source);
if (e == null) {
e = new WaterMarkEntry(source);
sourceWaterMarkMap.put(source, e);
}
e.setLWMScn(scn);
} | [
"public",
"void",
"setLWMScn",
"(",
"String",
"source",
",",
"long",
"scn",
")",
"{",
"WaterMarkEntry",
"e",
"=",
"sourceWaterMarkMap",
".",
"get",
"(",
"source",
")",
";",
"if",
"(",
"e",
"==",
"null",
")",
"{",
"e",
"=",
"new",
"WaterMarkEntry",
"(",... | Sets the low water mark of a source
@param source - the source
@param scn - the water mark value | [
"Sets",
"the",
"low",
"water",
"mark",
"of",
"a",
"source"
] | train | https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/util/SourceWaterMarks.java#L213-L220 |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/endpoint/AbstractEndpointComponent.java | AbstractEndpointComponent.enrichEndpointConfiguration | protected void enrichEndpointConfiguration(EndpointConfiguration endpointConfiguration, Map<String, String> parameters, TestContext context) {
for (Map.Entry<String, String> parameterEntry : parameters.entrySet()) {
Field field = ReflectionUtils.findField(endpointConfiguration.getClass(), parameterEntry.getKey());
if (field == null) {
throw new CitrusRuntimeException(String.format("Unable to find parameter field on endpoint configuration '%s'", parameterEntry.getKey()));
}
Method setter = ReflectionUtils.findMethod(endpointConfiguration.getClass(), "set" + parameterEntry.getKey().substring(0, 1).toUpperCase() + parameterEntry.getKey().substring(1), field.getType());
if (setter == null) {
throw new CitrusRuntimeException(String.format("Unable to find parameter setter on endpoint configuration '%s'",
"set" + parameterEntry.getKey().substring(0, 1).toUpperCase() + parameterEntry.getKey().substring(1)));
}
if (parameterEntry.getValue() != null) {
ReflectionUtils.invokeMethod(setter, endpointConfiguration, TypeConversionUtils.convertStringToType(parameterEntry.getValue(), field.getType(), context));
} else {
ReflectionUtils.invokeMethod(setter, endpointConfiguration, field.getType().cast(null));
}
}
} | java | protected void enrichEndpointConfiguration(EndpointConfiguration endpointConfiguration, Map<String, String> parameters, TestContext context) {
for (Map.Entry<String, String> parameterEntry : parameters.entrySet()) {
Field field = ReflectionUtils.findField(endpointConfiguration.getClass(), parameterEntry.getKey());
if (field == null) {
throw new CitrusRuntimeException(String.format("Unable to find parameter field on endpoint configuration '%s'", parameterEntry.getKey()));
}
Method setter = ReflectionUtils.findMethod(endpointConfiguration.getClass(), "set" + parameterEntry.getKey().substring(0, 1).toUpperCase() + parameterEntry.getKey().substring(1), field.getType());
if (setter == null) {
throw new CitrusRuntimeException(String.format("Unable to find parameter setter on endpoint configuration '%s'",
"set" + parameterEntry.getKey().substring(0, 1).toUpperCase() + parameterEntry.getKey().substring(1)));
}
if (parameterEntry.getValue() != null) {
ReflectionUtils.invokeMethod(setter, endpointConfiguration, TypeConversionUtils.convertStringToType(parameterEntry.getValue(), field.getType(), context));
} else {
ReflectionUtils.invokeMethod(setter, endpointConfiguration, field.getType().cast(null));
}
}
} | [
"protected",
"void",
"enrichEndpointConfiguration",
"(",
"EndpointConfiguration",
"endpointConfiguration",
",",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
",",
"TestContext",
"context",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
... | Sets properties on endpoint configuration using method reflection.
@param endpointConfiguration
@param parameters
@param context | [
"Sets",
"properties",
"on",
"endpoint",
"configuration",
"using",
"method",
"reflection",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/endpoint/AbstractEndpointComponent.java#L110-L131 |
alkacon/opencms-core | src/org/opencms/jsp/decorator/CmsDecorationDefintion.java | CmsDecorationDefintion.createDecorationBundle | public CmsDecorationBundle createDecorationBundle(CmsObject cms, Locale locale) throws CmsException {
// get configfile basename and the list of all decoration map files
List<CmsResource> decorationMapFiles = getDecorationMapFiles(cms);
if (LOG.isDebugEnabled()) {
LOG.debug(
Messages.get().getBundle().key(
Messages.LOG_DECORATION_DEFINITION_MAP_FILES_2,
decorationMapFiles,
locale));
}
// create decoration maps
List<CmsDecorationMap> decorationMaps = getDecorationMaps(cms, decorationMapFiles);
if (LOG.isDebugEnabled()) {
LOG.debug(
Messages.get().getBundle().key(Messages.LOG_DECORATION_DEFINITION_MAPS_2, decorationMaps, locale));
}
// now that we have all decoration maps we can build the decoration bundle
// the bundele is depending on the locale, if a locale is given, only those decoration maps that contain the
// locale (or no locale at all) must be used. If no locale is given, all decoration maps are
// put into the decoration bundle
return createDecorationBundle(decorationMaps, locale);
} | java | public CmsDecorationBundle createDecorationBundle(CmsObject cms, Locale locale) throws CmsException {
// get configfile basename and the list of all decoration map files
List<CmsResource> decorationMapFiles = getDecorationMapFiles(cms);
if (LOG.isDebugEnabled()) {
LOG.debug(
Messages.get().getBundle().key(
Messages.LOG_DECORATION_DEFINITION_MAP_FILES_2,
decorationMapFiles,
locale));
}
// create decoration maps
List<CmsDecorationMap> decorationMaps = getDecorationMaps(cms, decorationMapFiles);
if (LOG.isDebugEnabled()) {
LOG.debug(
Messages.get().getBundle().key(Messages.LOG_DECORATION_DEFINITION_MAPS_2, decorationMaps, locale));
}
// now that we have all decoration maps we can build the decoration bundle
// the bundele is depending on the locale, if a locale is given, only those decoration maps that contain the
// locale (or no locale at all) must be used. If no locale is given, all decoration maps are
// put into the decoration bundle
return createDecorationBundle(decorationMaps, locale);
} | [
"public",
"CmsDecorationBundle",
"createDecorationBundle",
"(",
"CmsObject",
"cms",
",",
"Locale",
"locale",
")",
"throws",
"CmsException",
"{",
"// get configfile basename and the list of all decoration map files",
"List",
"<",
"CmsResource",
">",
"decorationMapFiles",
"=",
... | Creates a CmsDecorationBundle of text decoration to be used by the decorator.<p>
@param cms the CmsObject
@param locale the locale to build the decoration bundle for. If no locale is given, a bundle of all locales is build
@return CmsDecorationBundle including all decoration lists that match the locale
@throws CmsException if something goes wrong | [
"Creates",
"a",
"CmsDecorationBundle",
"of",
"text",
"decoration",
"to",
"be",
"used",
"by",
"the",
"decorator",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/decorator/CmsDecorationDefintion.java#L165-L189 |
hdbeukel/james-core | src/main/java/org/jamesframework/core/search/LocalSearch.java | LocalSearch.updateCurrentSolution | protected void updateCurrentSolution(SolutionType solution, Evaluation evaluation, Validation validation){
// store new current solution
curSolution = solution;
// store evaluation and validation
curSolutionEvaluation = evaluation;
curSolutionValidation = validation;
// inform listeners
fireNewCurrentSolution(curSolution, curSolutionEvaluation, curSolutionValidation);
} | java | protected void updateCurrentSolution(SolutionType solution, Evaluation evaluation, Validation validation){
// store new current solution
curSolution = solution;
// store evaluation and validation
curSolutionEvaluation = evaluation;
curSolutionValidation = validation;
// inform listeners
fireNewCurrentSolution(curSolution, curSolutionEvaluation, curSolutionValidation);
} | [
"protected",
"void",
"updateCurrentSolution",
"(",
"SolutionType",
"solution",
",",
"Evaluation",
"evaluation",
",",
"Validation",
"validation",
")",
"{",
"// store new current solution",
"curSolution",
"=",
"solution",
";",
"// store evaluation and validation",
"curSolutionE... | Update the current solution during search, given that it has already been evaluated and validated.
The new current solution and its evaluation/validation are stored and attached local search listeners
are informed about this update. The update always takes place, it is <b>not</b> required that the
current solution is valid.
@param solution new current solution
@param evaluation evaluation of new current solution
@param validation validation of new current solution | [
"Update",
"the",
"current",
"solution",
"during",
"search",
"given",
"that",
"it",
"has",
"already",
"been",
"evaluated",
"and",
"validated",
".",
"The",
"new",
"current",
"solution",
"and",
"its",
"evaluation",
"/",
"validation",
"are",
"stored",
"and",
"atta... | train | https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/search/LocalSearch.java#L245-L253 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/asynchronous/AsyncAtlasInfo.java | AsyncAtlasInfo.loadAtlasInformation | public static List<GVRAtlasInformation> loadAtlasInformation(InputStream ins) {
try {
int size = ins.available();
byte[] buffer = new byte[size];
ins.read(buffer);
return loadAtlasInformation(new JSONArray(new String(buffer, "UTF-8")));
} catch (JSONException je) {
je.printStackTrace();
} catch (IOException ex) {
ex.printStackTrace();
}
return null;
} | java | public static List<GVRAtlasInformation> loadAtlasInformation(InputStream ins) {
try {
int size = ins.available();
byte[] buffer = new byte[size];
ins.read(buffer);
return loadAtlasInformation(new JSONArray(new String(buffer, "UTF-8")));
} catch (JSONException je) {
je.printStackTrace();
} catch (IOException ex) {
ex.printStackTrace();
}
return null;
} | [
"public",
"static",
"List",
"<",
"GVRAtlasInformation",
">",
"loadAtlasInformation",
"(",
"InputStream",
"ins",
")",
"{",
"try",
"{",
"int",
"size",
"=",
"ins",
".",
"available",
"(",
")",
";",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"size",... | This method is a sync parse to the JSON stream of atlas information.
@return List of atlas information. | [
"This",
"method",
"is",
"a",
"sync",
"parse",
"to",
"the",
"JSON",
"stream",
"of",
"atlas",
"information",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/asynchronous/AsyncAtlasInfo.java#L41-L56 |
ept/warc-hadoop | src/main/java/com/martinkl/warc/mapred/WARCOutputFormat.java | WARCOutputFormat.getRecordWriter | @Override
public RecordWriter<NullWritable, WARCWritable> getRecordWriter(FileSystem fs, JobConf job, String filename,
Progressable progress) throws IOException {
return new WARCWriter(job, filename, progress);
} | java | @Override
public RecordWriter<NullWritable, WARCWritable> getRecordWriter(FileSystem fs, JobConf job, String filename,
Progressable progress) throws IOException {
return new WARCWriter(job, filename, progress);
} | [
"@",
"Override",
"public",
"RecordWriter",
"<",
"NullWritable",
",",
"WARCWritable",
">",
"getRecordWriter",
"(",
"FileSystem",
"fs",
",",
"JobConf",
"job",
",",
"String",
"filename",
",",
"Progressable",
"progress",
")",
"throws",
"IOException",
"{",
"return",
... | Creates a new output file in WARC format, and returns a RecordWriter for writing to it. | [
"Creates",
"a",
"new",
"output",
"file",
"in",
"WARC",
"format",
"and",
"returns",
"a",
"RecordWriter",
"for",
"writing",
"to",
"it",
"."
] | train | https://github.com/ept/warc-hadoop/blob/f41cbb8002c29053eed9206e50ab9787de7da67f/src/main/java/com/martinkl/warc/mapred/WARCOutputFormat.java#L38-L42 |
nabedge/mixer2 | src/main/java/org/mixer2/xhtml/AbstractJaxb.java | AbstractJaxb.insertBeforeId | public boolean insertBeforeId(String id, String insString)
throws TagTypeUnmatchException {
return InsertByIdUtil.insertBeforeId(id, insString, this);
} | java | public boolean insertBeforeId(String id, String insString)
throws TagTypeUnmatchException {
return InsertByIdUtil.insertBeforeId(id, insString, this);
} | [
"public",
"boolean",
"insertBeforeId",
"(",
"String",
"id",
",",
"String",
"insString",
")",
"throws",
"TagTypeUnmatchException",
"{",
"return",
"InsertByIdUtil",
".",
"insertBeforeId",
"(",
"id",
",",
"insString",
",",
"this",
")",
";",
"}"
] | <p>insert string before the element having specified id attribute.</p>
@param id
@param insString
@return true if success to insert. if no hit, return false.
@throws TagTypeUnmatchException | [
"<p",
">",
"insert",
"string",
"before",
"the",
"element",
"having",
"specified",
"id",
"attribute",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/nabedge/mixer2/blob/8c2db27cfcd65bf0b1e0242ef9362ebd8033777c/src/main/java/org/mixer2/xhtml/AbstractJaxb.java#L530-L533 |
Azure/azure-sdk-for-java | containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/ManagedClustersInner.java | ManagedClustersInner.beginUpdateTagsAsync | public Observable<ManagedClusterInner> beginUpdateTagsAsync(String resourceGroupName, String resourceName) {
return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<ManagedClusterInner>, ManagedClusterInner>() {
@Override
public ManagedClusterInner call(ServiceResponse<ManagedClusterInner> response) {
return response.body();
}
});
} | java | public Observable<ManagedClusterInner> beginUpdateTagsAsync(String resourceGroupName, String resourceName) {
return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<ManagedClusterInner>, ManagedClusterInner>() {
@Override
public ManagedClusterInner call(ServiceResponse<ManagedClusterInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ManagedClusterInner",
">",
"beginUpdateTagsAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
")",
"{",
"return",
"beginUpdateTagsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"resourceName",
")",
".",
"map... | Updates tags on a managed cluster.
Updates a managed cluster with the specified tags.
@param resourceGroupName The name of the resource group.
@param resourceName The name of the managed cluster resource.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ManagedClusterInner object | [
"Updates",
"tags",
"on",
"a",
"managed",
"cluster",
".",
"Updates",
"a",
"managed",
"cluster",
"with",
"the",
"specified",
"tags",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/ManagedClustersInner.java#L1191-L1198 |
opentok/Opentok-Java-SDK | src/main/java/com/opentok/OpenTok.java | OpenTok.setArchiveLayout | public void setArchiveLayout(String archiveId, ArchiveProperties properties) throws OpenTokException {
if (StringUtils.isEmpty(archiveId) || properties == null) {
throw new InvalidArgumentException("ArchiveId is not valid or properties are null");
}
this.client.setArchiveLayout(archiveId, properties);
} | java | public void setArchiveLayout(String archiveId, ArchiveProperties properties) throws OpenTokException {
if (StringUtils.isEmpty(archiveId) || properties == null) {
throw new InvalidArgumentException("ArchiveId is not valid or properties are null");
}
this.client.setArchiveLayout(archiveId, properties);
} | [
"public",
"void",
"setArchiveLayout",
"(",
"String",
"archiveId",
",",
"ArchiveProperties",
"properties",
")",
"throws",
"OpenTokException",
"{",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"archiveId",
")",
"||",
"properties",
"==",
"null",
")",
"{",
"throw"... | Sets the layout type for a composed archive. For a description of layout types, see
<a href="https://tokbox.com/developer/guides/archiving/layout-control.html">Customizing
the video layout for composed archives</a>.
@param archiveId {String} The archive ID.
@param properties This ArchiveProperties object defining the arachive layout. | [
"Sets",
"the",
"layout",
"type",
"for",
"a",
"composed",
"archive",
".",
"For",
"a",
"description",
"of",
"layout",
"types",
"see",
"<a",
"href",
"=",
"https",
":",
"//",
"tokbox",
".",
"com",
"/",
"developer",
"/",
"guides",
"/",
"archiving",
"/",
"la... | train | https://github.com/opentok/Opentok-Java-SDK/blob/d71b7999facc3131c415aebea874ea55776d477f/src/main/java/com/opentok/OpenTok.java#L502-L507 |
samskivert/samskivert | src/main/java/com/samskivert/util/Runnables.java | Runnables.asRunnable | public static Runnable asRunnable (Object instance, String methodName)
{
Class<?> clazz = instance.getClass();
Method method = findMethod(clazz, methodName);
if (Modifier.isStatic(method.getModifiers())) {
throw new IllegalArgumentException(
clazz.getName() + "." + methodName + "() must not be static");
}
return new MethodRunner(method, instance);
} | java | public static Runnable asRunnable (Object instance, String methodName)
{
Class<?> clazz = instance.getClass();
Method method = findMethod(clazz, methodName);
if (Modifier.isStatic(method.getModifiers())) {
throw new IllegalArgumentException(
clazz.getName() + "." + methodName + "() must not be static");
}
return new MethodRunner(method, instance);
} | [
"public",
"static",
"Runnable",
"asRunnable",
"(",
"Object",
"instance",
",",
"String",
"methodName",
")",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"instance",
".",
"getClass",
"(",
")",
";",
"Method",
"method",
"=",
"findMethod",
"(",
"clazz",
",",
"m... | Creates a runnable that invokes the specified method on the specified instance via
reflection.
<p> NOTE: if you specify a protected or private method this method will call {@link
Method#setAccessible} to make the method accessible. If you're writing secure code or need
to run in a sandbox, don't use this functionality.
@throws IllegalArgumentException if the supplied method name does not correspond to a
non-static zero-argument method of the supplied instance's class. | [
"Creates",
"a",
"runnable",
"that",
"invokes",
"the",
"specified",
"method",
"on",
"the",
"specified",
"instance",
"via",
"reflection",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/Runnables.java#L37-L46 |
facebookarchive/hive-dwrf | hive-dwrf/src/main/java/com/facebook/hive/orc/lazy/LazyTreeReader.java | LazyTreeReader.get | public Object get(long currentRow, Object previous) throws IOException {
seekToRow(currentRow);
return next(previous);
} | java | public Object get(long currentRow, Object previous) throws IOException {
seekToRow(currentRow);
return next(previous);
} | [
"public",
"Object",
"get",
"(",
"long",
"currentRow",
",",
"Object",
"previous",
")",
"throws",
"IOException",
"{",
"seekToRow",
"(",
"currentRow",
")",
";",
"return",
"next",
"(",
"previous",
")",
";",
"}"
] | Returns the value corresponding to currentRow, suitable for calling from outside
@param currentRow
@param previous
@return
@throws IOException | [
"Returns",
"the",
"value",
"corresponding",
"to",
"currentRow",
"suitable",
"for",
"calling",
"from",
"outside"
] | train | https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf/src/main/java/com/facebook/hive/orc/lazy/LazyTreeReader.java#L224-L227 |
mfornos/humanize | humanize-icu/src/main/java/humanize/ICUHumanize.java | ICUHumanize.formatDate | public static String formatDate(final Date value, final Locale locale)
{
return withinLocale(new Callable<String>()
{
public String call() throws Exception
{
return formatDate(value);
}
}, locale);
} | java | public static String formatDate(final Date value, final Locale locale)
{
return withinLocale(new Callable<String>()
{
public String call() throws Exception
{
return formatDate(value);
}
}, locale);
} | [
"public",
"static",
"String",
"formatDate",
"(",
"final",
"Date",
"value",
",",
"final",
"Locale",
"locale",
")",
"{",
"return",
"withinLocale",
"(",
"new",
"Callable",
"<",
"String",
">",
"(",
")",
"{",
"public",
"String",
"call",
"(",
")",
"throws",
"E... | <p>
Same as {@link #formatDate(Date) formatDate} for the specified locale.
</p>
@param value
Date to be formatted
@param locale
Target locale
@return String representation of the date | [
"<p",
">",
"Same",
"as",
"{",
"@link",
"#formatDate",
"(",
"Date",
")",
"formatDate",
"}",
"for",
"the",
"specified",
"locale",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/mfornos/humanize/blob/59fc103045de9d217c9e77dbcb7621f992f46c63/humanize-icu/src/main/java/humanize/ICUHumanize.java#L684-L693 |
jaxio/javaee-lab | javaee7-jpa-query-by-example/src/main/java/com/jaxio/jpa/querybyexample/GenericRepository.java | GenericRepository.findProperty | @Transactional
public <T> List<T> findProperty(Class<T> propertyType, E entity, SearchParameters sp, String path) {
return findProperty(propertyType, entity, sp, metamodelUtil.toAttributes(path, type));
} | java | @Transactional
public <T> List<T> findProperty(Class<T> propertyType, E entity, SearchParameters sp, String path) {
return findProperty(propertyType, entity, sp, metamodelUtil.toAttributes(path, type));
} | [
"@",
"Transactional",
"public",
"<",
"T",
">",
"List",
"<",
"T",
">",
"findProperty",
"(",
"Class",
"<",
"T",
">",
"propertyType",
",",
"E",
"entity",
",",
"SearchParameters",
"sp",
",",
"String",
"path",
")",
"{",
"return",
"findProperty",
"(",
"propert... | /*
Find a list of E property.
@param propertyType type of the property
@param entity a sample entity whose non-null properties may be used as search hints
@param sp carries additional search information
@param path the path to the property
@return the entities property matching the search. | [
"/",
"*",
"Find",
"a",
"list",
"of",
"E",
"property",
"."
] | train | https://github.com/jaxio/javaee-lab/blob/61238b967952446d81cc68424a4e809093a77fcf/javaee7-jpa-query-by-example/src/main/java/com/jaxio/jpa/querybyexample/GenericRepository.java#L244-L247 |
ckpoint/CheckPoint | src/main/java/hsim/checkpoint/core/repository/ValidationDataRepository.java | ValidationDataRepository.findByMethodAndUrlAndNameAndParentId | public ValidationData findByMethodAndUrlAndNameAndParentId(String method, String url, String name, Long parentId) {
if (parentId == null) {
return this.findByMethodAndUrlAndName(method, url, name).stream().filter(d -> d.getParentId() == null).findAny().orElse(null);
}
return this.findByMethodAndUrlAndName(method, url, name).stream()
.filter(d -> d.getParentId() != null && d.getParentId().equals(parentId)).findAny().orElse(null);
} | java | public ValidationData findByMethodAndUrlAndNameAndParentId(String method, String url, String name, Long parentId) {
if (parentId == null) {
return this.findByMethodAndUrlAndName(method, url, name).stream().filter(d -> d.getParentId() == null).findAny().orElse(null);
}
return this.findByMethodAndUrlAndName(method, url, name).stream()
.filter(d -> d.getParentId() != null && d.getParentId().equals(parentId)).findAny().orElse(null);
} | [
"public",
"ValidationData",
"findByMethodAndUrlAndNameAndParentId",
"(",
"String",
"method",
",",
"String",
"url",
",",
"String",
"name",
",",
"Long",
"parentId",
")",
"{",
"if",
"(",
"parentId",
"==",
"null",
")",
"{",
"return",
"this",
".",
"findByMethodAndUrl... | Find by method and url and name and parent id validation data.
@param method the method
@param url the url
@param name the name
@param parentId the parent id
@return the validation data | [
"Find",
"by",
"method",
"and",
"url",
"and",
"name",
"and",
"parent",
"id",
"validation",
"data",
"."
] | train | https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/core/repository/ValidationDataRepository.java#L239-L246 |
classgraph/classgraph | src/main/java/io/github/classgraph/MethodParameterInfo.java | MethodParameterInfo.modifiersToString | static void modifiersToString(final int modifiers, final StringBuilder buf) {
if ((modifiers & Modifier.FINAL) != 0) {
buf.append("final ");
}
if ((modifiers & 0x1000) != 0) {
buf.append("synthetic ");
}
if ((modifiers & 0x8000) != 0) {
buf.append("mandated ");
}
} | java | static void modifiersToString(final int modifiers, final StringBuilder buf) {
if ((modifiers & Modifier.FINAL) != 0) {
buf.append("final ");
}
if ((modifiers & 0x1000) != 0) {
buf.append("synthetic ");
}
if ((modifiers & 0x8000) != 0) {
buf.append("mandated ");
}
} | [
"static",
"void",
"modifiersToString",
"(",
"final",
"int",
"modifiers",
",",
"final",
"StringBuilder",
"buf",
")",
"{",
"if",
"(",
"(",
"modifiers",
"&",
"Modifier",
".",
"FINAL",
")",
"!=",
"0",
")",
"{",
"buf",
".",
"append",
"(",
"\"final \"",
")",
... | Convert modifiers into a string representation, e.g. "public static final".
@param modifiers
The field or method modifiers.
@param buf
The buffer to write the result into. | [
"Convert",
"modifiers",
"into",
"a",
"string",
"representation",
"e",
".",
"g",
".",
"public",
"static",
"final",
"."
] | train | https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/io/github/classgraph/MethodParameterInfo.java#L305-L315 |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/text/parsers/URLParser.java | URLParser.toAbsolute | public static URL toAbsolute(URL baseURL, String relative) {
try {
return new URL(baseURL, relative);
}
catch (MalformedURLException ex) {
throw new RuntimeException(ex);
}
} | java | public static URL toAbsolute(URL baseURL, String relative) {
try {
return new URL(baseURL, relative);
}
catch (MalformedURLException ex) {
throw new RuntimeException(ex);
}
} | [
"public",
"static",
"URL",
"toAbsolute",
"(",
"URL",
"baseURL",
",",
"String",
"relative",
")",
"{",
"try",
"{",
"return",
"new",
"URL",
"(",
"baseURL",
",",
"relative",
")",
";",
"}",
"catch",
"(",
"MalformedURLException",
"ex",
")",
"{",
"throw",
"new"... | Converts a relative URL to absolute URL.
@param baseURL
@param relative
@return | [
"Converts",
"a",
"relative",
"URL",
"to",
"absolute",
"URL",
"."
] | train | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/text/parsers/URLParser.java#L115-L122 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemTemplateElement.java | ElemTemplateElement.unexecuteNSDecls | void unexecuteNSDecls(TransformerImpl transformer, String ignorePrefix) throws TransformerException
{
try
{
if (null != m_prefixTable)
{
SerializationHandler rhandler = transformer.getResultTreeHandler();
int n = m_prefixTable.size();
for (int i = 0; i < n; i++)
{
XMLNSDecl decl = (XMLNSDecl) m_prefixTable.get(i);
if (!decl.getIsExcluded() && !(null != ignorePrefix && decl.getPrefix().equals(ignorePrefix)))
{
rhandler.endPrefixMapping(decl.getPrefix());
}
}
}
}
catch(org.xml.sax.SAXException se)
{
throw new TransformerException(se);
}
} | java | void unexecuteNSDecls(TransformerImpl transformer, String ignorePrefix) throws TransformerException
{
try
{
if (null != m_prefixTable)
{
SerializationHandler rhandler = transformer.getResultTreeHandler();
int n = m_prefixTable.size();
for (int i = 0; i < n; i++)
{
XMLNSDecl decl = (XMLNSDecl) m_prefixTable.get(i);
if (!decl.getIsExcluded() && !(null != ignorePrefix && decl.getPrefix().equals(ignorePrefix)))
{
rhandler.endPrefixMapping(decl.getPrefix());
}
}
}
}
catch(org.xml.sax.SAXException se)
{
throw new TransformerException(se);
}
} | [
"void",
"unexecuteNSDecls",
"(",
"TransformerImpl",
"transformer",
",",
"String",
"ignorePrefix",
")",
"throws",
"TransformerException",
"{",
"try",
"{",
"if",
"(",
"null",
"!=",
"m_prefixTable",
")",
"{",
"SerializationHandler",
"rhandler",
"=",
"transformer",
".",... | Send endPrefixMapping events to the result tree handler
for all declared prefix mappings in the stylesheet.
@param transformer non-null reference to the the current transform-time state.
@param ignorePrefix string prefix to not endPrefixMapping
@throws TransformerException | [
"Send",
"endPrefixMapping",
"events",
"to",
"the",
"result",
"tree",
"handler",
"for",
"all",
"declared",
"prefix",
"mappings",
"in",
"the",
"stylesheet",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemTemplateElement.java#L1226-L1251 |
apache/incubator-gobblin | gobblin-config-management/gobblin-config-client/src/main/java/org/apache/gobblin/config/client/ConfigClientUtils.java | ConfigClientUtils.isAncestorOrSame | public static boolean isAncestorOrSame(URI descendant, URI ancestor) {
Preconditions.checkNotNull(descendant, "input can not be null");
Preconditions.checkNotNull(ancestor, "input can not be null");
if (!stringSame(descendant.getScheme(), ancestor.getScheme())) {
return false;
}
if (!stringSame(descendant.getAuthority(), ancestor.getAuthority())) {
return false;
}
return isAncestorOrSame(getConfigKeyPath(descendant.getPath()), getConfigKeyPath(ancestor.getPath()));
} | java | public static boolean isAncestorOrSame(URI descendant, URI ancestor) {
Preconditions.checkNotNull(descendant, "input can not be null");
Preconditions.checkNotNull(ancestor, "input can not be null");
if (!stringSame(descendant.getScheme(), ancestor.getScheme())) {
return false;
}
if (!stringSame(descendant.getAuthority(), ancestor.getAuthority())) {
return false;
}
return isAncestorOrSame(getConfigKeyPath(descendant.getPath()), getConfigKeyPath(ancestor.getPath()));
} | [
"public",
"static",
"boolean",
"isAncestorOrSame",
"(",
"URI",
"descendant",
",",
"URI",
"ancestor",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"descendant",
",",
"\"input can not be null\"",
")",
";",
"Preconditions",
".",
"checkNotNull",
"(",
"ancestor",... | Utility method to check whether one URI is the ancestor of the other
return true iff both URI's scheme/authority name match and ancestor's path is the prefix of the descendant's path
@param descendant: the descendant URI to check
@param ancestor : the ancestor URI to check
@return | [
"Utility",
"method",
"to",
"check",
"whether",
"one",
"URI",
"is",
"the",
"ancestor",
"of",
"the",
"other"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-config-management/gobblin-config-client/src/main/java/org/apache/gobblin/config/client/ConfigClientUtils.java#L156-L169 |
aerogear/aerogear-unifiedpush-server | push-sender/src/main/java/org/jboss/aerogear/unifiedpush/message/NotificationRouter.java | NotificationRouter.submit | @TransactionAttribute(TransactionAttributeType.REQUIRED)
public void submit(PushApplication pushApplication, InternalUnifiedPushMessage message) {
logger.debug("Processing send request with '{}' payload", message.getMessage());
// collections for all the different variants:
final VariantMap variants = new VariantMap();
final List<String> variantIDs = message.getCriteria().getVariants();
// if the criteria payload did specify the "variants" field,
// we look up each of those mentioned variants, by their "variantID":
if (variantIDs != null) {
variantIDs.forEach(variantID -> {
Variant variant = genericVariantService.get().findByVariantID(variantID);
// does the variant exist ?
if (variant != null) {
variants.add(variant);
}
});
} else {
// No specific variants have been requested,
// we get all the variants, from the given PushApplicationEntity:
variants.addAll(pushApplication.getVariants());
}
// TODO: Not sure the transformation should be done here...
// There are likely better places to check if the metadata is way to long
String jsonMessageContent = message.toStrippedJsonString() ;
if (jsonMessageContent != null && jsonMessageContent.length() >= 4500) {
jsonMessageContent = message.toMinimizedJsonString();
}
final FlatPushMessageInformation pushMessageInformation =
metricsService.storeNewRequestFrom(
pushApplication.getPushApplicationID(),
jsonMessageContent,
message.getIpAddress(),
message.getClientIdentifier()
);
// we split the variants per type since each type may have its own configuration (e.g. batch size)
variants.forEach((variantType, variant) -> {
logger.info(String.format("Internal dispatching of push message for one %s variant (by %s)", variantType.getTypeName(), message.getClientIdentifier()));
dispatchVariantMessageEvent.fire(new MessageHolderWithVariants(pushMessageInformation, message, variantType, variant));
});
} | java | @TransactionAttribute(TransactionAttributeType.REQUIRED)
public void submit(PushApplication pushApplication, InternalUnifiedPushMessage message) {
logger.debug("Processing send request with '{}' payload", message.getMessage());
// collections for all the different variants:
final VariantMap variants = new VariantMap();
final List<String> variantIDs = message.getCriteria().getVariants();
// if the criteria payload did specify the "variants" field,
// we look up each of those mentioned variants, by their "variantID":
if (variantIDs != null) {
variantIDs.forEach(variantID -> {
Variant variant = genericVariantService.get().findByVariantID(variantID);
// does the variant exist ?
if (variant != null) {
variants.add(variant);
}
});
} else {
// No specific variants have been requested,
// we get all the variants, from the given PushApplicationEntity:
variants.addAll(pushApplication.getVariants());
}
// TODO: Not sure the transformation should be done here...
// There are likely better places to check if the metadata is way to long
String jsonMessageContent = message.toStrippedJsonString() ;
if (jsonMessageContent != null && jsonMessageContent.length() >= 4500) {
jsonMessageContent = message.toMinimizedJsonString();
}
final FlatPushMessageInformation pushMessageInformation =
metricsService.storeNewRequestFrom(
pushApplication.getPushApplicationID(),
jsonMessageContent,
message.getIpAddress(),
message.getClientIdentifier()
);
// we split the variants per type since each type may have its own configuration (e.g. batch size)
variants.forEach((variantType, variant) -> {
logger.info(String.format("Internal dispatching of push message for one %s variant (by %s)", variantType.getTypeName(), message.getClientIdentifier()));
dispatchVariantMessageEvent.fire(new MessageHolderWithVariants(pushMessageInformation, message, variantType, variant));
});
} | [
"@",
"TransactionAttribute",
"(",
"TransactionAttributeType",
".",
"REQUIRED",
")",
"public",
"void",
"submit",
"(",
"PushApplication",
"pushApplication",
",",
"InternalUnifiedPushMessage",
"message",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Processing send request with ... | Receives a request for sending a {@link UnifiedPushMessage} and queues one message per variant type, both in one transaction.
Once this method returns, message is recorded and will be eventually delivered in the future.
@param pushApplication the push application
@param message the message | [
"Receives",
"a",
"request",
"for",
"sending",
"a",
"{",
"@link",
"UnifiedPushMessage",
"}",
"and",
"queues",
"one",
"message",
"per",
"variant",
"type",
"both",
"in",
"one",
"transaction",
"."
] | train | https://github.com/aerogear/aerogear-unifiedpush-server/blob/c7b798f085449117d84345d8c378b27165cad32b/push-sender/src/main/java/org/jboss/aerogear/unifiedpush/message/NotificationRouter.java#L76-L123 |
rundeck/rundeck | core/src/main/java/com/dtolabs/rundeck/core/common/UpdateUtils.java | UpdateUtils.updateFileFromFile | public static void updateFileFromFile(final File sourceFile, final String destinationFilePath) throws
UpdateException {
if (!sourceFile.exists()) {
throw new UpdateException("Source file does not exist: " + sourceFile);
}
if (!sourceFile.isFile()) {
throw new UpdateException("Not a file: " + sourceFile);
}
if (sourceFile.length() < 1) {
throw new UpdateException("Source file is empty: " + sourceFile);
}
try {
updateFileFromInputStream(new FileInputStream(sourceFile), destinationFilePath);
} catch (IOException e) {
throw new UpdateException("Unable to update file: " + e.getMessage(), e);
}
} | java | public static void updateFileFromFile(final File sourceFile, final String destinationFilePath) throws
UpdateException {
if (!sourceFile.exists()) {
throw new UpdateException("Source file does not exist: " + sourceFile);
}
if (!sourceFile.isFile()) {
throw new UpdateException("Not a file: " + sourceFile);
}
if (sourceFile.length() < 1) {
throw new UpdateException("Source file is empty: " + sourceFile);
}
try {
updateFileFromInputStream(new FileInputStream(sourceFile), destinationFilePath);
} catch (IOException e) {
throw new UpdateException("Unable to update file: " + e.getMessage(), e);
}
} | [
"public",
"static",
"void",
"updateFileFromFile",
"(",
"final",
"File",
"sourceFile",
",",
"final",
"String",
"destinationFilePath",
")",
"throws",
"UpdateException",
"{",
"if",
"(",
"!",
"sourceFile",
".",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"Update... | Get the source File and store it to a destination file path
@param sourceFile source
@param destinationFilePath destination
@throws UpdateException on error | [
"Get",
"the",
"source",
"File",
"and",
"store",
"it",
"to",
"a",
"destination",
"file",
"path"
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/common/UpdateUtils.java#L70-L87 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/MediaApi.java | MediaApi.updateMediaUserData | public ApiSuccessResponse updateMediaUserData(String mediatype, String id, UserDataOperationId userData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = updateMediaUserDataWithHttpInfo(mediatype, id, userData);
return resp.getData();
} | java | public ApiSuccessResponse updateMediaUserData(String mediatype, String id, UserDataOperationId userData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = updateMediaUserDataWithHttpInfo(mediatype, id, userData);
return resp.getData();
} | [
"public",
"ApiSuccessResponse",
"updateMediaUserData",
"(",
"String",
"mediatype",
",",
"String",
"id",
",",
"UserDataOperationId",
"userData",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"ApiSuccessResponse",
">",
"resp",
"=",
"updateMediaUserDataWithHttpInfo... | Update user data for an interaction
Update the interaction with the provided key/value pairs. This replaces any existing key/value pairs with the same keys.
@param mediatype The media channel. (required)
@param id The ID of the interaction. (required)
@param userData The data to update. This is an array of objects with the properties key, type, and value. (required)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Update",
"user",
"data",
"for",
"an",
"interaction",
"Update",
"the",
"interaction",
"with",
"the",
"provided",
"key",
"/",
"value",
"pairs",
".",
"This",
"replaces",
"any",
"existing",
"key",
"/",
"value",
"pairs",
"with",
"the",
"same",
"keys",
"."
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/MediaApi.java#L4483-L4486 |
rwl/CSparseJ | src/main/java/edu/emory/mathcs/csparsej/tdcomplex/DZcs_gaxpy.java | DZcs_gaxpy.cs_gaxpy | public static boolean cs_gaxpy (DZcs A, DZcsa x, DZcsa y)
{
int p, j, n, Ap[], Ai[] ;
DZcsa Ax = new DZcsa() ;
if (!CS_CSC (A) || x == null || y == null) return (false) ; /* check inputs */
n = A.n ; Ap = A.p ; Ai = A.i ; Ax.x = A.x ;
for (j = 0 ; j < n ; j++)
{
for (p = Ap [j] ; p < Ap [j+1] ; p++)
{
y.set(Ai [p], cs_cplus(y.get(Ai [p]), cs_cmult(Ax.get(p), x.get(j)))) ;
}
}
return (true) ;
} | java | public static boolean cs_gaxpy (DZcs A, DZcsa x, DZcsa y)
{
int p, j, n, Ap[], Ai[] ;
DZcsa Ax = new DZcsa() ;
if (!CS_CSC (A) || x == null || y == null) return (false) ; /* check inputs */
n = A.n ; Ap = A.p ; Ai = A.i ; Ax.x = A.x ;
for (j = 0 ; j < n ; j++)
{
for (p = Ap [j] ; p < Ap [j+1] ; p++)
{
y.set(Ai [p], cs_cplus(y.get(Ai [p]), cs_cmult(Ax.get(p), x.get(j)))) ;
}
}
return (true) ;
} | [
"public",
"static",
"boolean",
"cs_gaxpy",
"(",
"DZcs",
"A",
",",
"DZcsa",
"x",
",",
"DZcsa",
"y",
")",
"{",
"int",
"p",
",",
"j",
",",
"n",
",",
"Ap",
"[",
"]",
",",
"Ai",
"[",
"]",
";",
"DZcsa",
"Ax",
"=",
"new",
"DZcsa",
"(",
")",
";",
"... | Sparse matrix times dense column vector, y = A*x+y.
@param A
column-compressed matrix
@param x
size n, vector x
@param y
size m, vector y
@return true if successful, false on error | [
"Sparse",
"matrix",
"times",
"dense",
"column",
"vector",
"y",
"=",
"A",
"*",
"x",
"+",
"y",
"."
] | train | https://github.com/rwl/CSparseJ/blob/6a6f66bccce1558156a961494358952603b0ac84/src/main/java/edu/emory/mathcs/csparsej/tdcomplex/DZcs_gaxpy.java#L54-L68 |
groupon/odo | proxylib/src/main/java/com/groupon/odo/proxylib/PathOverrideService.java | PathOverrideService.removeOverride | public void removeOverride(int groupId, String methodName, String className) {
String statementString = "DELETE FROM " + Constants.DB_TABLE_OVERRIDE + " WHERE " + Constants.OVERRIDE_GROUP_ID + " = ? AND " +
Constants.OVERRIDE_CLASS_NAME + " = ? AND " + Constants.OVERRIDE_METHOD_NAME + " = ?";
try (Connection sqlConnection = sqlService.getConnection()) {
try (PreparedStatement statement = sqlConnection.prepareStatement(statementString)) {
statement.setInt(1, groupId);
statement.setString(2, className);
statement.setString(3, methodName);
statement.executeUpdate();
statement.close();
// TODO: delete from enabled overrides
} catch (SQLException e) {
e.printStackTrace();
}
} catch (SQLException e) {
e.printStackTrace();
}
} | java | public void removeOverride(int groupId, String methodName, String className) {
String statementString = "DELETE FROM " + Constants.DB_TABLE_OVERRIDE + " WHERE " + Constants.OVERRIDE_GROUP_ID + " = ? AND " +
Constants.OVERRIDE_CLASS_NAME + " = ? AND " + Constants.OVERRIDE_METHOD_NAME + " = ?";
try (Connection sqlConnection = sqlService.getConnection()) {
try (PreparedStatement statement = sqlConnection.prepareStatement(statementString)) {
statement.setInt(1, groupId);
statement.setString(2, className);
statement.setString(3, methodName);
statement.executeUpdate();
statement.close();
// TODO: delete from enabled overrides
} catch (SQLException e) {
e.printStackTrace();
}
} catch (SQLException e) {
e.printStackTrace();
}
} | [
"public",
"void",
"removeOverride",
"(",
"int",
"groupId",
",",
"String",
"methodName",
",",
"String",
"className",
")",
"{",
"String",
"statementString",
"=",
"\"DELETE FROM \"",
"+",
"Constants",
".",
"DB_TABLE_OVERRIDE",
"+",
"\" WHERE \"",
"+",
"Constants",
".... | Remove an override from a group by method/classname
@param groupId ID of group
@param methodName name of method
@param className name of class | [
"Remove",
"an",
"override",
"from",
"a",
"group",
"by",
"method",
"/",
"classname"
] | train | https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxylib/src/main/java/com/groupon/odo/proxylib/PathOverrideService.java#L613-L631 |
aws/aws-sdk-java | aws-java-sdk-backup/src/main/java/com/amazonaws/services/backup/model/BackupRule.java | BackupRule.withRecoveryPointTags | public BackupRule withRecoveryPointTags(java.util.Map<String, String> recoveryPointTags) {
setRecoveryPointTags(recoveryPointTags);
return this;
} | java | public BackupRule withRecoveryPointTags(java.util.Map<String, String> recoveryPointTags) {
setRecoveryPointTags(recoveryPointTags);
return this;
} | [
"public",
"BackupRule",
"withRecoveryPointTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"recoveryPointTags",
")",
"{",
"setRecoveryPointTags",
"(",
"recoveryPointTags",
")",
";",
"return",
"this",
";",
"}"
] | <p>
An array of key-value pair strings that are assigned to resources that are associated with this rule when
restored from backup.
</p>
@param recoveryPointTags
An array of key-value pair strings that are assigned to resources that are associated with this rule when
restored from backup.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"An",
"array",
"of",
"key",
"-",
"value",
"pair",
"strings",
"that",
"are",
"assigned",
"to",
"resources",
"that",
"are",
"associated",
"with",
"this",
"rule",
"when",
"restored",
"from",
"backup",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-backup/src/main/java/com/amazonaws/services/backup/model/BackupRule.java#L432-L435 |
jbundle/jbundle | thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/mem/memory/MKeyArea.java | MKeyArea.insertCurrent | public void insertCurrent(FieldTable vectorTable, KeyAreaInfo keyArea, BaseBuffer bufferNew, int iRelPosition) throws DBException
{
m_iIndex += iRelPosition;
m_VectorObjects.insertElementAt(bufferNew, m_iIndex);
m_iIndex = -1; // The index can't be used in caches anymore.
} | java | public void insertCurrent(FieldTable vectorTable, KeyAreaInfo keyArea, BaseBuffer bufferNew, int iRelPosition) throws DBException
{
m_iIndex += iRelPosition;
m_VectorObjects.insertElementAt(bufferNew, m_iIndex);
m_iIndex = -1; // The index can't be used in caches anymore.
} | [
"public",
"void",
"insertCurrent",
"(",
"FieldTable",
"vectorTable",
",",
"KeyAreaInfo",
"keyArea",
",",
"BaseBuffer",
"bufferNew",
",",
"int",
"iRelPosition",
")",
"throws",
"DBException",
"{",
"m_iIndex",
"+=",
"iRelPosition",
";",
"m_VectorObjects",
".",
"insertE... | Insert this record at the current location.
@param table The basetable.
@param keyArea The key area.
@param bufferNew The buffer to add.
@param iRelPosition relative position to add the record.
@exception DBException File exception. | [
"Insert",
"this",
"record",
"at",
"the",
"current",
"location",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/mem/memory/MKeyArea.java#L338-L343 |
geomajas/geomajas-project-server | plugin/layer-openstreetmap/openstreetmap/src/main/java/org/geomajas/layer/osm/TiledRasterLayerServiceState.java | TiledRasterLayerServiceState.postConstruct | public void postConstruct(GeoService geoService, DtoConverterService converterService) throws GeomajasException {
if (null == layerInfo) {
layerInfo = new RasterLayerInfo();
}
layerInfo.setCrs(TiledRasterLayerService.MERCATOR);
crs = geoService.getCrs2(TiledRasterLayerService.MERCATOR);
layerInfo.setTileWidth(tileSize);
layerInfo.setTileHeight(tileSize);
Bbox bbox = new Bbox(-TiledRasterLayerService.HALF_EQUATOR_IN_METERS,
-TiledRasterLayerService.HALF_EQUATOR_IN_METERS, TiledRasterLayerService.EQUATOR_IN_METERS,
TiledRasterLayerService.EQUATOR_IN_METERS);
layerInfo.setMaxExtent(bbox);
maxBounds = converterService.toInternal(bbox);
resolutions = new double[maxZoomLevel + 1];
double powerOfTwo = 1;
for (int zoomLevel = 0; zoomLevel <= maxZoomLevel; zoomLevel++) {
double resolution = (TiledRasterLayerService.EQUATOR_IN_METERS) / (tileSize * powerOfTwo);
resolutions[zoomLevel] = resolution;
powerOfTwo *= 2;
}
} | java | public void postConstruct(GeoService geoService, DtoConverterService converterService) throws GeomajasException {
if (null == layerInfo) {
layerInfo = new RasterLayerInfo();
}
layerInfo.setCrs(TiledRasterLayerService.MERCATOR);
crs = geoService.getCrs2(TiledRasterLayerService.MERCATOR);
layerInfo.setTileWidth(tileSize);
layerInfo.setTileHeight(tileSize);
Bbox bbox = new Bbox(-TiledRasterLayerService.HALF_EQUATOR_IN_METERS,
-TiledRasterLayerService.HALF_EQUATOR_IN_METERS, TiledRasterLayerService.EQUATOR_IN_METERS,
TiledRasterLayerService.EQUATOR_IN_METERS);
layerInfo.setMaxExtent(bbox);
maxBounds = converterService.toInternal(bbox);
resolutions = new double[maxZoomLevel + 1];
double powerOfTwo = 1;
for (int zoomLevel = 0; zoomLevel <= maxZoomLevel; zoomLevel++) {
double resolution = (TiledRasterLayerService.EQUATOR_IN_METERS) / (tileSize * powerOfTwo);
resolutions[zoomLevel] = resolution;
powerOfTwo *= 2;
}
} | [
"public",
"void",
"postConstruct",
"(",
"GeoService",
"geoService",
",",
"DtoConverterService",
"converterService",
")",
"throws",
"GeomajasException",
"{",
"if",
"(",
"null",
"==",
"layerInfo",
")",
"{",
"layerInfo",
"=",
"new",
"RasterLayerInfo",
"(",
")",
";",
... | Finish initialization of state object.
@param geoService geo service
@param converterService converter service
@throws GeomajasException oops | [
"Finish",
"initialization",
"of",
"state",
"object",
"."
] | train | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/plugin/layer-openstreetmap/openstreetmap/src/main/java/org/geomajas/layer/osm/TiledRasterLayerServiceState.java#L203-L224 |
ZieIony/Carbon | carbon/src/main/java/carbon/shadow/ShapeAppearanceModel.java | ShapeAppearanceModel.setTopRightCorner | public void setTopRightCorner(@CornerFamily int cornerFamily, @Dimension int cornerSize) {
setTopRightCorner(MaterialShapeUtils.createCornerTreatment(cornerFamily, cornerSize));
} | java | public void setTopRightCorner(@CornerFamily int cornerFamily, @Dimension int cornerSize) {
setTopRightCorner(MaterialShapeUtils.createCornerTreatment(cornerFamily, cornerSize));
} | [
"public",
"void",
"setTopRightCorner",
"(",
"@",
"CornerFamily",
"int",
"cornerFamily",
",",
"@",
"Dimension",
"int",
"cornerSize",
")",
"{",
"setTopRightCorner",
"(",
"MaterialShapeUtils",
".",
"createCornerTreatment",
"(",
"cornerFamily",
",",
"cornerSize",
")",
"... | Sets the corner treatment for the top-right corner.
@param cornerFamily the family to use to create the corner treatment
@param cornerSize the size to use to create the corner treatment | [
"Sets",
"the",
"corner",
"treatment",
"for",
"the",
"top",
"-",
"right",
"corner",
"."
] | train | https://github.com/ZieIony/Carbon/blob/78b0a432bd49edc7a6a13ce111cab274085d1693/carbon/src/main/java/carbon/shadow/ShapeAppearanceModel.java#L260-L262 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/application/session/ApplicationSession.java | ApplicationSession.setSessionAttributes | public void setSessionAttributes(Map<String, Object> attributes)
{
this.sessionAttributes.putAll(attributes);
propertyChangeSupport.firePropertyChange(SESSION_ATTRIBUTES, null, sessionAttributes);
} | java | public void setSessionAttributes(Map<String, Object> attributes)
{
this.sessionAttributes.putAll(attributes);
propertyChangeSupport.firePropertyChange(SESSION_ATTRIBUTES, null, sessionAttributes);
} | [
"public",
"void",
"setSessionAttributes",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"attributes",
")",
"{",
"this",
".",
"sessionAttributes",
".",
"putAll",
"(",
"attributes",
")",
";",
"propertyChangeSupport",
".",
"firePropertyChange",
"(",
"SESSION_ATTRIBU... | Add the given key/value pairs to the session attributes.
@param attributes
a map of key/value pairs. | [
"Add",
"the",
"given",
"key",
"/",
"value",
"pairs",
"to",
"the",
"session",
"attributes",
"."
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/application/session/ApplicationSession.java#L293-L297 |
logic-ng/LogicNG | src/main/java/org/logicng/datastructures/EncodingResult.java | EncodingResult.resultForCleaneLing | public static EncodingResult resultForCleaneLing(final FormulaFactory f, final CleaneLing cleaneLing) {
return new EncodingResult(f, null, cleaneLing);
} | java | public static EncodingResult resultForCleaneLing(final FormulaFactory f, final CleaneLing cleaneLing) {
return new EncodingResult(f, null, cleaneLing);
} | [
"public",
"static",
"EncodingResult",
"resultForCleaneLing",
"(",
"final",
"FormulaFactory",
"f",
",",
"final",
"CleaneLing",
"cleaneLing",
")",
"{",
"return",
"new",
"EncodingResult",
"(",
"f",
",",
"null",
",",
"cleaneLing",
")",
";",
"}"
] | Constructs a new result which adds the result directly to a given CleaneLing solver.
@param f the formula factory
@param cleaneLing the CleaneLing solver
@return the result | [
"Constructs",
"a",
"new",
"result",
"which",
"adds",
"the",
"result",
"directly",
"to",
"a",
"given",
"CleaneLing",
"solver",
"."
] | train | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/datastructures/EncodingResult.java#L98-L100 |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/http/MediaType.java | MediaType.removeQualityValue | public MediaType removeQualityValue() {
if (!this.parameters.containsKey(PARAM_QUALITY_FACTOR)) {
return this;
}
Map<String, String> params = new LinkedHashMap<String, String>(this.parameters);
params.remove(PARAM_QUALITY_FACTOR);
return new MediaType(this, params);
} | java | public MediaType removeQualityValue() {
if (!this.parameters.containsKey(PARAM_QUALITY_FACTOR)) {
return this;
}
Map<String, String> params = new LinkedHashMap<String, String>(this.parameters);
params.remove(PARAM_QUALITY_FACTOR);
return new MediaType(this, params);
} | [
"public",
"MediaType",
"removeQualityValue",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"parameters",
".",
"containsKey",
"(",
"PARAM_QUALITY_FACTOR",
")",
")",
"{",
"return",
"this",
";",
"}",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"n... | Return a replica of this instance with its quality value removed.
@return the same instance if the media type doesn't contain a quality value, or a new one otherwise | [
"Return",
"a",
"replica",
"of",
"this",
"instance",
"with",
"its",
"quality",
"value",
"removed",
"."
] | train | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/http/MediaType.java#L595-L602 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/variant/css/CssSkinGenerator.java | CssSkinGenerator.getVariants | private Map<String, VariantSet> getVariants(String defaultSkin, Set<String> skinNames, String defaultLocaleName,
Set<String> localeVariants) {
Map<String, VariantSet> skinVariants = new HashMap<>();
if (!skinNames.isEmpty()) {
skinVariants.put(JawrConstant.SKIN_VARIANT_TYPE,
new VariantSet(JawrConstant.SKIN_VARIANT_TYPE, defaultSkin, skinNames));
}
if (!localeVariants.isEmpty()) {
skinVariants.put(JawrConstant.LOCALE_VARIANT_TYPE,
new VariantSet(JawrConstant.LOCALE_VARIANT_TYPE, defaultLocaleName, localeVariants));
}
return skinVariants;
} | java | private Map<String, VariantSet> getVariants(String defaultSkin, Set<String> skinNames, String defaultLocaleName,
Set<String> localeVariants) {
Map<String, VariantSet> skinVariants = new HashMap<>();
if (!skinNames.isEmpty()) {
skinVariants.put(JawrConstant.SKIN_VARIANT_TYPE,
new VariantSet(JawrConstant.SKIN_VARIANT_TYPE, defaultSkin, skinNames));
}
if (!localeVariants.isEmpty()) {
skinVariants.put(JawrConstant.LOCALE_VARIANT_TYPE,
new VariantSet(JawrConstant.LOCALE_VARIANT_TYPE, defaultLocaleName, localeVariants));
}
return skinVariants;
} | [
"private",
"Map",
"<",
"String",
",",
"VariantSet",
">",
"getVariants",
"(",
"String",
"defaultSkin",
",",
"Set",
"<",
"String",
">",
"skinNames",
",",
"String",
"defaultLocaleName",
",",
"Set",
"<",
"String",
">",
"localeVariants",
")",
"{",
"Map",
"<",
"... | Returns the skin variants
@param defaultSkin
the default skin
@param skinNames
the skin names
@param defaultLocaleName
the default locale name
@param localeVariants
the locale variants
@return the skin variants | [
"Returns",
"the",
"skin",
"variants"
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/variant/css/CssSkinGenerator.java#L546-L561 |
Azure/azure-sdk-for-java | streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/FunctionsInner.java | FunctionsInner.retrieveDefaultDefinitionAsync | public Observable<FunctionInner> retrieveDefaultDefinitionAsync(String resourceGroupName, String jobName, String functionName) {
return retrieveDefaultDefinitionWithServiceResponseAsync(resourceGroupName, jobName, functionName).map(new Func1<ServiceResponse<FunctionInner>, FunctionInner>() {
@Override
public FunctionInner call(ServiceResponse<FunctionInner> response) {
return response.body();
}
});
} | java | public Observable<FunctionInner> retrieveDefaultDefinitionAsync(String resourceGroupName, String jobName, String functionName) {
return retrieveDefaultDefinitionWithServiceResponseAsync(resourceGroupName, jobName, functionName).map(new Func1<ServiceResponse<FunctionInner>, FunctionInner>() {
@Override
public FunctionInner call(ServiceResponse<FunctionInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"FunctionInner",
">",
"retrieveDefaultDefinitionAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"jobName",
",",
"String",
"functionName",
")",
"{",
"return",
"retrieveDefaultDefinitionWithServiceResponseAsync",
"(",
"resourceGroupName",... | Retrieves the default definition of a function based on the parameters specified.
@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 jobName The name of the streaming job.
@param functionName The name of the function.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the FunctionInner object | [
"Retrieves",
"the",
"default",
"definition",
"of",
"a",
"function",
"based",
"on",
"the",
"parameters",
"specified",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/FunctionsInner.java#L1327-L1334 |
kiegroup/drools | drools-model/drools-constraint-parser/src/main/javacc-support/org/drools/constraint/parser/GeneratedDrlConstraintParserTokenManagerBase.java | GeneratedDrlConstraintParserTokenManagerBase.createCommentFromToken | static Comment createCommentFromToken(Token token) {
String commentText = token.image;
if (token.kind == JAVADOC_COMMENT) {
return new JavadocComment(tokenRange(token), commentText.substring(3, commentText.length() - 2));
} else if (token.kind == MULTI_LINE_COMMENT) {
return new BlockComment(tokenRange(token), commentText.substring(2, commentText.length() - 2));
} else if (token.kind == SINGLE_LINE_COMMENT) {
// line comments have their end of line character(s) included, and we don't want that.
Range range = new Range(pos(token.beginLine, token.beginColumn), pos(token.endLine, token.endColumn));
while (commentText.endsWith("\r") || commentText.endsWith("\n")) {
commentText = commentText.substring(0, commentText.length() - 1);
}
range = range.withEnd(pos(range.begin.line, range.begin.column + commentText.length()));
LineComment comment = new LineComment(tokenRange(token), commentText.substring(2));
comment.setRange(range);
return comment;
}
throw new AssertionError("Unexpectedly got passed a non-comment token.");
} | java | static Comment createCommentFromToken(Token token) {
String commentText = token.image;
if (token.kind == JAVADOC_COMMENT) {
return new JavadocComment(tokenRange(token), commentText.substring(3, commentText.length() - 2));
} else if (token.kind == MULTI_LINE_COMMENT) {
return new BlockComment(tokenRange(token), commentText.substring(2, commentText.length() - 2));
} else if (token.kind == SINGLE_LINE_COMMENT) {
// line comments have their end of line character(s) included, and we don't want that.
Range range = new Range(pos(token.beginLine, token.beginColumn), pos(token.endLine, token.endColumn));
while (commentText.endsWith("\r") || commentText.endsWith("\n")) {
commentText = commentText.substring(0, commentText.length() - 1);
}
range = range.withEnd(pos(range.begin.line, range.begin.column + commentText.length()));
LineComment comment = new LineComment(tokenRange(token), commentText.substring(2));
comment.setRange(range);
return comment;
}
throw new AssertionError("Unexpectedly got passed a non-comment token.");
} | [
"static",
"Comment",
"createCommentFromToken",
"(",
"Token",
"token",
")",
"{",
"String",
"commentText",
"=",
"token",
".",
"image",
";",
"if",
"(",
"token",
".",
"kind",
"==",
"JAVADOC_COMMENT",
")",
"{",
"return",
"new",
"JavadocComment",
"(",
"tokenRange",
... | Since comments are completely captured in a single token, including their delimiters, deconstruct them here so we
can turn them into nodes later on. | [
"Since",
"comments",
"are",
"completely",
"captured",
"in",
"a",
"single",
"token",
"including",
"their",
"delimiters",
"deconstruct",
"them",
"here",
"so",
"we",
"can",
"turn",
"them",
"into",
"nodes",
"later",
"on",
"."
] | train | https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-model/drools-constraint-parser/src/main/javacc-support/org/drools/constraint/parser/GeneratedDrlConstraintParserTokenManagerBase.java#L58-L76 |
opsmatters/opsmatters-core | src/main/java/com/opsmatters/core/util/FormatUtilities.java | FormatUtilities.getFormattedBytes | static public String getFormattedBytes(long bytes, String units, String format)
{
double num = bytes;
String[] prefix = {"", "K", "M", "G", "T"};
int count = 0;
while(num >= 1024.0)
{
num = num/1024.0;
++count;
}
DecimalFormat f = new DecimalFormat(format);
return f.format(num)+" "+prefix[count]+units;
} | java | static public String getFormattedBytes(long bytes, String units, String format)
{
double num = bytes;
String[] prefix = {"", "K", "M", "G", "T"};
int count = 0;
while(num >= 1024.0)
{
num = num/1024.0;
++count;
}
DecimalFormat f = new DecimalFormat(format);
return f.format(num)+" "+prefix[count]+units;
} | [
"static",
"public",
"String",
"getFormattedBytes",
"(",
"long",
"bytes",
",",
"String",
"units",
",",
"String",
"format",
")",
"{",
"double",
"num",
"=",
"bytes",
";",
"String",
"[",
"]",
"prefix",
"=",
"{",
"\"\"",
",",
"\"K\"",
",",
"\"M\"",
",",
"\"... | Returns the given bytes number formatted as KBytes, MBytes or GBytes as appropriate.
@param bytes The bytes to be converted
@param units The units to be displayed with the converted bytes
@param format The format to use to display the bytes
@return The given bytes number formatted as KBytes, MBytes or GBytes as appropriate | [
"Returns",
"the",
"given",
"bytes",
"number",
"formatted",
"as",
"KBytes",
"MBytes",
"or",
"GBytes",
"as",
"appropriate",
"."
] | train | https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/util/FormatUtilities.java#L69-L83 |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Consumers.java | Consumers.dict | public static <M extends Map<K, V>, K, V> M dict(Iterator<Pair<K, V>> iterator, M map) {
dbc.precondition(map != null, "cannot call dict with a null map");
final Function<Iterator<Pair<K, V>>, M> consumer = new ConsumeIntoMap<>(new ConstantSupplier<M>(map));
return consumer.apply(iterator);
} | java | public static <M extends Map<K, V>, K, V> M dict(Iterator<Pair<K, V>> iterator, M map) {
dbc.precondition(map != null, "cannot call dict with a null map");
final Function<Iterator<Pair<K, V>>, M> consumer = new ConsumeIntoMap<>(new ConstantSupplier<M>(map));
return consumer.apply(iterator);
} | [
"public",
"static",
"<",
"M",
"extends",
"Map",
"<",
"K",
",",
"V",
">",
",",
"K",
",",
"V",
">",
"M",
"dict",
"(",
"Iterator",
"<",
"Pair",
"<",
"K",
",",
"V",
">",
">",
"iterator",
",",
"M",
"map",
")",
"{",
"dbc",
".",
"precondition",
"(",... | Yields all elements of the iterator (in the provided map).
@param <M> the returned map type
@param <K> the map key type
@param <V> the map value type
@param iterator the iterator that will be consumed
@param map the map where the iterator is consumed
@return the map filled with iterator values | [
"Yields",
"all",
"elements",
"of",
"the",
"iterator",
"(",
"in",
"the",
"provided",
"map",
")",
"."
] | train | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Consumers.java#L179-L183 |
jtrfp/javamod | src/main/java/de/quippy/jflac/io/BitOutputStream.java | BitOutputStream.writeRiceSigned | public void writeRiceSigned(int val, int parameter) throws IOException {
int totalBits;
int interestingBits;
int msbs;
int uval;
int pattern;
// fold signed to unsigned
if (val < 0) {
// equivalent to (unsigned)(((--val) < < 1) - 1); but without the overflow problem at MININT
uval = (int) (((-(++val)) << 1) + 1);
} else {
uval = (int) (val << 1);
}
msbs = uval >> parameter;
interestingBits = 1 + parameter;
totalBits = interestingBits + msbs;
pattern = 1 << parameter; /* the unary end bit */
pattern |= (uval & ((1 << parameter) - 1)); /* the binary LSBs */
if (totalBits <= 32) {
writeRawUInt(pattern, totalBits);
} else {
/* write the unary MSBs */
writeZeroes(msbs);
/* write the unary end bit and binary LSBs */
writeRawUInt(pattern, interestingBits);
}
} | java | public void writeRiceSigned(int val, int parameter) throws IOException {
int totalBits;
int interestingBits;
int msbs;
int uval;
int pattern;
// fold signed to unsigned
if (val < 0) {
// equivalent to (unsigned)(((--val) < < 1) - 1); but without the overflow problem at MININT
uval = (int) (((-(++val)) << 1) + 1);
} else {
uval = (int) (val << 1);
}
msbs = uval >> parameter;
interestingBits = 1 + parameter;
totalBits = interestingBits + msbs;
pattern = 1 << parameter; /* the unary end bit */
pattern |= (uval & ((1 << parameter) - 1)); /* the binary LSBs */
if (totalBits <= 32) {
writeRawUInt(pattern, totalBits);
} else {
/* write the unary MSBs */
writeZeroes(msbs);
/* write the unary end bit and binary LSBs */
writeRawUInt(pattern, interestingBits);
}
} | [
"public",
"void",
"writeRiceSigned",
"(",
"int",
"val",
",",
"int",
"parameter",
")",
"throws",
"IOException",
"{",
"int",
"totalBits",
";",
"int",
"interestingBits",
";",
"int",
"msbs",
";",
"int",
"uval",
";",
"int",
"pattern",
";",
"// fold signed to unsign... | /*
DRR FIX # ifdef SYMMETRIC_RICE boolean
write_symmetric_rice_signed(BitBuffer8 * bb, int val, unsigned parameter) {
unsigned total_bits, interesting_bits, msbs; uint32 pattern;
ASSERT(0 != bb); ASSERT(0 != buffer); ASSERT(parameter <= 31); // init
pattern with the unary end bit and the sign bit if (val < 0) { pattern =
3; val = -val; } else pattern = 2;
msbs = val >> parameter; interesting_bits = 2 + parameter; total_bits =
interesting_bits + msbs; pattern < <= parameter; pattern |= (val & ((1 < <
parameter) - 1)); // the binary LSBs
if (total_bits <= 32) { if (!write_raw_uint32(bb, pattern, total_bits))
return false; } else { // write the unary MSBs if (!write_zeroes(bb,
msbs)) return false; // write the unary end bit, the sign bit, and binary
LSBs if (!write_raw_uint32(bb, pattern, interesting_bits)) return false; }
return true; }
boolean write_symmetric_rice_signed_escape(BitBuffer8 * bb, int val,
unsigned parameter) { unsigned total_bits, val_bits; uint32 pattern;
ASSERT(0 != bb); ASSERT(0 != buffer); ASSERT(parameter <= 31);
val_bits = bitmath_silog2(val); total_bits = 2 + parameter + 5 +
val_bits;
if (total_bits <= 32) { pattern = 3; pattern < <= (parameter + 5);
pattern |= val_bits; pattern < <= val_bits; pattern |= (val & ((1 < <
val_bits) - 1)); if (!write_raw_uint32(bb, pattern, total_bits)) return
false; } else { // write the '-0' escape code first if
(!write_raw_uint32(bb, 3 u < < parameter, 2 + parameter)) return false; //
write the length if (!write_raw_uint32(bb, val_bits, 5)) return false; //
write the value if (!write_raw_int32(bb, val, val_bits)) return false; }
return true; } # endif // ifdef SYMMETRIC_RICE | [
"/",
"*",
"DRR",
"FIX",
"#",
"ifdef",
"SYMMETRIC_RICE",
"boolean",
"write_symmetric_rice_signed",
"(",
"BitBuffer8",
"*",
"bb",
"int",
"val",
"unsigned",
"parameter",
")",
"{",
"unsigned",
"total_bits",
"interesting_bits",
"msbs",
";",
"uint32",
"pattern",
";"
] | train | https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/jflac/io/BitOutputStream.java#L451-L478 |
iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/partition/ToolBarData.java | ToolBarData.addDay | public static Date addDay(Date date, int amt) {
return addDateField(date,Calendar.DATE,amt);
} | java | public static Date addDay(Date date, int amt) {
return addDateField(date,Calendar.DATE,amt);
} | [
"public",
"static",
"Date",
"addDay",
"(",
"Date",
"date",
",",
"int",
"amt",
")",
"{",
"return",
"addDateField",
"(",
"date",
",",
"Calendar",
".",
"DATE",
",",
"amt",
")",
";",
"}"
] | Increment a Date object by +/- some days
@param date Date to +/- some days from
@param amt number of days to add/remove
@return new Date object offset by the indicated days | [
"Increment",
"a",
"Date",
"object",
"by",
"+",
"/",
"-",
"some",
"days"
] | train | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/partition/ToolBarData.java#L182-L184 |
banq/jdonframework | JdonAccessory/jdon-jdbc/src/main/java/com/jdon/model/query/PageIteratorSolver.java | PageIteratorSolver.getBlock | public Block getBlock(String sqlquery, Collection queryParams, int startIndex, int count) {
return blockStrategy.getBlock(sqlquery, queryParams, startIndex, count);
} | java | public Block getBlock(String sqlquery, Collection queryParams, int startIndex, int count) {
return blockStrategy.getBlock(sqlquery, queryParams, startIndex, count);
} | [
"public",
"Block",
"getBlock",
"(",
"String",
"sqlquery",
",",
"Collection",
"queryParams",
",",
"int",
"startIndex",
",",
"int",
"count",
")",
"{",
"return",
"blockStrategy",
".",
"getBlock",
"(",
"sqlquery",
",",
"queryParams",
",",
"startIndex",
",",
"count... | get a data block by the sql sentence.
@param sqlqueryAllCount
@param sqlquery
@return if not found, return null; | [
"get",
"a",
"data",
"block",
"by",
"the",
"sql",
"sentence",
"."
] | train | https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-jdbc/src/main/java/com/jdon/model/query/PageIteratorSolver.java#L274-L276 |
pressgang-ccms/PressGangCCMSContentSpecProcessor | src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecParser.java | ContentSpecParser.parseGlobalOptionsLine | protected boolean parseGlobalOptionsLine(final ParserData parserData, final String line, int lineNumber) throws ParsingException {
// Read in the variables from the line
final HashMap<ParserType, String[]> variableMap = getLineVariables(parserData, line, lineNumber, '[', ']', ',', false);
// Check the read in values are valid
if ((variableMap.size() > 1 && variableMap.containsKey(ParserType.NONE)) || (variableMap.size() > 0 && !variableMap.containsKey(
ParserType.NONE))) {
throw new ParsingException(format(ProcessorConstants.ERROR_RELATIONSHIP_BASE_LEVEL_MSG, lineNumber, line));
}
String[] variables = variableMap.get(ParserType.NONE);
// Check that some options were found, if so then parse them
if (variables.length > 0) {
addOptions(parserData, parserData.getCurrentLevel(), variables, 0, line, lineNumber);
} else {
log.warn(format(ProcessorConstants.WARN_EMPTY_BRACKETS_MSG, lineNumber));
}
return true;
} | java | protected boolean parseGlobalOptionsLine(final ParserData parserData, final String line, int lineNumber) throws ParsingException {
// Read in the variables from the line
final HashMap<ParserType, String[]> variableMap = getLineVariables(parserData, line, lineNumber, '[', ']', ',', false);
// Check the read in values are valid
if ((variableMap.size() > 1 && variableMap.containsKey(ParserType.NONE)) || (variableMap.size() > 0 && !variableMap.containsKey(
ParserType.NONE))) {
throw new ParsingException(format(ProcessorConstants.ERROR_RELATIONSHIP_BASE_LEVEL_MSG, lineNumber, line));
}
String[] variables = variableMap.get(ParserType.NONE);
// Check that some options were found, if so then parse them
if (variables.length > 0) {
addOptions(parserData, parserData.getCurrentLevel(), variables, 0, line, lineNumber);
} else {
log.warn(format(ProcessorConstants.WARN_EMPTY_BRACKETS_MSG, lineNumber));
}
return true;
} | [
"protected",
"boolean",
"parseGlobalOptionsLine",
"(",
"final",
"ParserData",
"parserData",
",",
"final",
"String",
"line",
",",
"int",
"lineNumber",
")",
"throws",
"ParsingException",
"{",
"// Read in the variables from the line",
"final",
"HashMap",
"<",
"ParserType",
... | Processes a line that represents the Global Options for the Content Specification.
@param parserData
@param line The line to be processed.
@return True if the line was processed without errors, otherwise false. | [
"Processes",
"a",
"line",
"that",
"represents",
"the",
"Global",
"Options",
"for",
"the",
"Content",
"Specification",
"."
] | train | https://github.com/pressgang-ccms/PressGangCCMSContentSpecProcessor/blob/85ffac047c4ede0f972364ab1f03f7d61a4de5f1/src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecParser.java#L918-L937 |
zalando/logbook | logbook-core/src/main/java/org/zalando/logbook/BodyFilters.java | BodyFilters.replaceFormUrlEncodedProperty | @API(status = EXPERIMENTAL)
public static BodyFilter replaceFormUrlEncodedProperty(final Set<String> properties, final String replacement) {
final Predicate<String> formUrlEncoded = MediaTypeQuery.compile("application/x-www-form-urlencoded");
final QueryFilter delegate = properties.stream()
.map(name -> QueryFilters.replaceQuery(name, replacement))
.reduce(QueryFilter::merge)
.orElseGet(QueryFilter::none);
return (contentType, body) -> formUrlEncoded.test(contentType) ? delegate.filter(body) : body;
} | java | @API(status = EXPERIMENTAL)
public static BodyFilter replaceFormUrlEncodedProperty(final Set<String> properties, final String replacement) {
final Predicate<String> formUrlEncoded = MediaTypeQuery.compile("application/x-www-form-urlencoded");
final QueryFilter delegate = properties.stream()
.map(name -> QueryFilters.replaceQuery(name, replacement))
.reduce(QueryFilter::merge)
.orElseGet(QueryFilter::none);
return (contentType, body) -> formUrlEncoded.test(contentType) ? delegate.filter(body) : body;
} | [
"@",
"API",
"(",
"status",
"=",
"EXPERIMENTAL",
")",
"public",
"static",
"BodyFilter",
"replaceFormUrlEncodedProperty",
"(",
"final",
"Set",
"<",
"String",
">",
"properties",
",",
"final",
"String",
"replacement",
")",
"{",
"final",
"Predicate",
"<",
"String",
... | Creates a {@link BodyFilter} that replaces the properties in the form url encoded body with given replacement.
@param properties query names properties to replace
@param replacement String to replace the properties values
@return BodyFilter generated | [
"Creates",
"a",
"{",
"@link",
"BodyFilter",
"}",
"that",
"replaces",
"the",
"properties",
"in",
"the",
"form",
"url",
"encoded",
"body",
"with",
"given",
"replacement",
"."
] | train | https://github.com/zalando/logbook/blob/1c2fe40a2f6a3d2f60e746ab1da173a3907a21c4/logbook-core/src/main/java/org/zalando/logbook/BodyFilters.java#L43-L53 |
Syncleus/aparapi | src/main/java/com/aparapi/device/OpenCLDevice.java | OpenCLDevice.listDevices | public static List<OpenCLDevice> listDevices(TYPE type) {
final OpenCLPlatform platform = new OpenCLPlatform(0, null, null, null);
final ArrayList<OpenCLDevice> results = new ArrayList<>();
for (final OpenCLPlatform p : platform.getOpenCLPlatforms()) {
for (final OpenCLDevice device : p.getOpenCLDevices()) {
if (type == null || device.getType() == type) {
results.add(device);
}
}
}
return results;
} | java | public static List<OpenCLDevice> listDevices(TYPE type) {
final OpenCLPlatform platform = new OpenCLPlatform(0, null, null, null);
final ArrayList<OpenCLDevice> results = new ArrayList<>();
for (final OpenCLPlatform p : platform.getOpenCLPlatforms()) {
for (final OpenCLDevice device : p.getOpenCLDevices()) {
if (type == null || device.getType() == type) {
results.add(device);
}
}
}
return results;
} | [
"public",
"static",
"List",
"<",
"OpenCLDevice",
">",
"listDevices",
"(",
"TYPE",
"type",
")",
"{",
"final",
"OpenCLPlatform",
"platform",
"=",
"new",
"OpenCLPlatform",
"(",
"0",
",",
"null",
",",
"null",
",",
"null",
")",
";",
"final",
"ArrayList",
"<",
... | List OpenCLDevices of a given TYPE, or all OpenCLDevices if type == null. | [
"List",
"OpenCLDevices",
"of",
"a",
"given",
"TYPE",
"or",
"all",
"OpenCLDevices",
"if",
"type",
"==",
"null",
"."
] | train | https://github.com/Syncleus/aparapi/blob/6d5892c8e69854b3968c541023de37cf4762bd24/src/main/java/com/aparapi/device/OpenCLDevice.java#L513-L526 |
spring-projects/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONArray.java | JSONArray.optInt | public int optInt(int index, int fallback) {
Object object = opt(index);
Integer result = JSON.toInteger(object);
return result != null ? result : fallback;
} | java | public int optInt(int index, int fallback) {
Object object = opt(index);
Integer result = JSON.toInteger(object);
return result != null ? result : fallback;
} | [
"public",
"int",
"optInt",
"(",
"int",
"index",
",",
"int",
"fallback",
")",
"{",
"Object",
"object",
"=",
"opt",
"(",
"index",
")",
";",
"Integer",
"result",
"=",
"JSON",
".",
"toInteger",
"(",
"object",
")",
";",
"return",
"result",
"!=",
"null",
"... | Returns the value at {@code index} if it exists and is an int or can be coerced to
an int. Returns {@code fallback} otherwise.
@param index the index to get the value from
@param fallback the fallback value
@return the value at {@code index} of {@code fallback} | [
"Returns",
"the",
"value",
"at",
"{"
] | train | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONArray.java#L436-L440 |
bazaarvoice/emodb | auth/auth-core/src/main/java/com/bazaarvoice/emodb/auth/permissions/MatchingPermission.java | MatchingPermission.toPart | protected MatchingPart toPart(List<MatchingPart> leadingParts, String part) {
if (ANY_INDICATOR.equals(part)) {
return getAnyPart();
}
// This part is a constant string
return createConstantPart(part);
} | java | protected MatchingPart toPart(List<MatchingPart> leadingParts, String part) {
if (ANY_INDICATOR.equals(part)) {
return getAnyPart();
}
// This part is a constant string
return createConstantPart(part);
} | [
"protected",
"MatchingPart",
"toPart",
"(",
"List",
"<",
"MatchingPart",
">",
"leadingParts",
",",
"String",
"part",
")",
"{",
"if",
"(",
"ANY_INDICATOR",
".",
"equals",
"(",
"part",
")",
")",
"{",
"return",
"getAnyPart",
"(",
")",
";",
"}",
"// This part ... | Converts a String part into the corresponding {@link MatchingPart}. | [
"Converts",
"a",
"String",
"part",
"into",
"the",
"corresponding",
"{"
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/auth/auth-core/src/main/java/com/bazaarvoice/emodb/auth/permissions/MatchingPermission.java#L96-L102 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/io/sstable/CQLSSTableWriter.java | CQLSSTableWriter.addRow | public CQLSSTableWriter addRow(Map<String, Object> values)
throws InvalidRequestException, IOException
{
int size = boundNames.size();
List<ByteBuffer> rawValues = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
ColumnSpecification spec = boundNames.get(i);
Object value = values.get(spec.name.toString());
rawValues.add(value == null ? null : ((AbstractType)spec.type).decompose(value));
}
return rawAddRow(rawValues);
} | java | public CQLSSTableWriter addRow(Map<String, Object> values)
throws InvalidRequestException, IOException
{
int size = boundNames.size();
List<ByteBuffer> rawValues = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
ColumnSpecification spec = boundNames.get(i);
Object value = values.get(spec.name.toString());
rawValues.add(value == null ? null : ((AbstractType)spec.type).decompose(value));
}
return rawAddRow(rawValues);
} | [
"public",
"CQLSSTableWriter",
"addRow",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"values",
")",
"throws",
"InvalidRequestException",
",",
"IOException",
"{",
"int",
"size",
"=",
"boundNames",
".",
"size",
"(",
")",
";",
"List",
"<",
"ByteBuffer",
">",
... | Adds a new row to the writer.
<p>
This is equivalent to the other addRow methods, but takes a map whose
keys are the names of the columns to add instead of taking a list of the
values in the order of the insert statement used during construction of
this write.
<p>
Please note that the column names in the map keys must be in lowercase unless
the declared column name is a
<a href="http://cassandra.apache.org/doc/cql3/CQL.html#identifiers">case-sensitive quoted identifier</a>
(in which case the map key must use the exact case of the column).
@param values a map of colum name to column values representing the new
row to add. Note that if a column is not part of the map, it's value will
be {@code null}. If the map contains keys that does not correspond to one
of the column of the insert statement used when creating this writer, the
the corresponding value is ignored.
@return this writer. | [
"Adds",
"a",
"new",
"row",
"to",
"the",
"writer",
".",
"<p",
">",
"This",
"is",
"equivalent",
"to",
"the",
"other",
"addRow",
"methods",
"but",
"takes",
"a",
"map",
"whose",
"keys",
"are",
"the",
"names",
"of",
"the",
"columns",
"to",
"add",
"instead",... | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/io/sstable/CQLSSTableWriter.java#L166-L177 |
davidmoten/rxjava-jdbc | src/main/java/com/github/davidmoten/rx/RxUtil.java | RxUtil.getAndAddRequest | public static long getAndAddRequest(AtomicLong requested, long n) {
// add n to field but check for overflow
while (true) {
long current = requested.get();
long next = current + n;
// check for overflow
if (next < 0) {
next = Long.MAX_VALUE;
}
if (requested.compareAndSet(current, next)) {
return current;
}
}
} | java | public static long getAndAddRequest(AtomicLong requested, long n) {
// add n to field but check for overflow
while (true) {
long current = requested.get();
long next = current + n;
// check for overflow
if (next < 0) {
next = Long.MAX_VALUE;
}
if (requested.compareAndSet(current, next)) {
return current;
}
}
} | [
"public",
"static",
"long",
"getAndAddRequest",
"(",
"AtomicLong",
"requested",
",",
"long",
"n",
")",
"{",
"// add n to field but check for overflow",
"while",
"(",
"true",
")",
"{",
"long",
"current",
"=",
"requested",
".",
"get",
"(",
")",
";",
"long",
"nex... | Adds {@code n} to {@code requested} and returns the value prior to
addition once the addition is successful (uses CAS semantics). If
overflows then sets {@code requested} field to {@code Long.MAX_VALUE}.
@param requested
atomic field updater for a request count
@param object
contains the field updated by the updater
@param n
the number of requests to add to the requested count
@return requested value just prior to successful addition | [
"Adds",
"{",
"@code",
"n",
"}",
"to",
"{",
"@code",
"requested",
"}",
"and",
"returns",
"the",
"value",
"prior",
"to",
"addition",
"once",
"the",
"addition",
"is",
"successful",
"(",
"uses",
"CAS",
"semantics",
")",
".",
"If",
"overflows",
"then",
"sets"... | train | https://github.com/davidmoten/rxjava-jdbc/blob/81e157d7071a825086bde81107b8694684cdff14/src/main/java/com/github/davidmoten/rx/RxUtil.java#L187-L200 |
alkacon/opencms-core | src/org/opencms/loader/CmsTemplateContextManager.java | CmsTemplateContextManager.readPropertyFromTemplate | public String readPropertyFromTemplate(CmsObject cms, CmsResource res, String propertyName, String fallbackValue) {
try {
CmsProperty templateProp = cms.readPropertyObject(res, CmsPropertyDefinition.PROPERTY_TEMPLATE, true);
String templatePath = templateProp.getValue().trim();
if (hasPropertyPrefix(templatePath)) {
I_CmsTemplateContextProvider provider = getTemplateContextProvider(templatePath);
return provider.readCommonProperty(cms, propertyName, fallbackValue);
} else {
return cms.readPropertyObject(templatePath, propertyName, false).getValue(fallbackValue);
}
} catch (Exception e) {
LOG.error(e);
return fallbackValue;
}
} | java | public String readPropertyFromTemplate(CmsObject cms, CmsResource res, String propertyName, String fallbackValue) {
try {
CmsProperty templateProp = cms.readPropertyObject(res, CmsPropertyDefinition.PROPERTY_TEMPLATE, true);
String templatePath = templateProp.getValue().trim();
if (hasPropertyPrefix(templatePath)) {
I_CmsTemplateContextProvider provider = getTemplateContextProvider(templatePath);
return provider.readCommonProperty(cms, propertyName, fallbackValue);
} else {
return cms.readPropertyObject(templatePath, propertyName, false).getValue(fallbackValue);
}
} catch (Exception e) {
LOG.error(e);
return fallbackValue;
}
} | [
"public",
"String",
"readPropertyFromTemplate",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"res",
",",
"String",
"propertyName",
",",
"String",
"fallbackValue",
")",
"{",
"try",
"{",
"CmsProperty",
"templateProp",
"=",
"cms",
".",
"readPropertyObject",
"(",
"res... | Utility method which either reads a property from the template used for a specific resource, or from the template context provider used for the resource if available.<p>
@param cms the CMS context to use
@param res the resource from whose template or template context provider the property should be read
@param propertyName the property name
@param fallbackValue the fallback value
@return the property value | [
"Utility",
"method",
"which",
"either",
"reads",
"a",
"property",
"from",
"the",
"template",
"used",
"for",
"a",
"specific",
"resource",
"or",
"from",
"the",
"template",
"context",
"provider",
"used",
"for",
"the",
"resource",
"if",
"available",
".",
"<p",
"... | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/loader/CmsTemplateContextManager.java#L330-L345 |
apereo/cas | support/cas-server-support-redis-core/src/main/java/org/apereo/cas/redis/core/RedisObjectFactory.java | RedisObjectFactory.newRedisConnectionFactory | public static RedisConnectionFactory newRedisConnectionFactory(final BaseRedisProperties redis) {
val redisConfiguration = redis.getSentinel() == null
? (RedisConfiguration) getStandaloneConfig(redis)
: getSentinelConfig(redis);
val factory = new LettuceConnectionFactory(redisConfiguration, getRedisPoolConfig(redis));
return factory;
} | java | public static RedisConnectionFactory newRedisConnectionFactory(final BaseRedisProperties redis) {
val redisConfiguration = redis.getSentinel() == null
? (RedisConfiguration) getStandaloneConfig(redis)
: getSentinelConfig(redis);
val factory = new LettuceConnectionFactory(redisConfiguration, getRedisPoolConfig(redis));
return factory;
} | [
"public",
"static",
"RedisConnectionFactory",
"newRedisConnectionFactory",
"(",
"final",
"BaseRedisProperties",
"redis",
")",
"{",
"val",
"redisConfiguration",
"=",
"redis",
".",
"getSentinel",
"(",
")",
"==",
"null",
"?",
"(",
"RedisConfiguration",
")",
"getStandalon... | New redis connection factory.
@param redis the redis
@return the redis connection factory | [
"New",
"redis",
"connection",
"factory",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-redis-core/src/main/java/org/apereo/cas/redis/core/RedisObjectFactory.java#L63-L71 |
enioka/jqm | jqm-all/jqm-client/jqm-api-client-jdbc/src/main/java/com/enioka/jqm/api/JdbcClient.java | JdbcClient.getJobRequest | private JobRequest getJobRequest(int launchId, DbConn cnx)
{
Map<String, String> prms = RuntimeParameter.select_map(cnx, "jiprm_select_by_ji", launchId);
ResultSet rs = cnx.runSelect("history_select_reenqueue_by_id", launchId);
try
{
if (!rs.next())
{
throw new JqmInvalidRequestException("There is no past laucnh iwth ID " + launchId);
}
}
catch (SQLException e1)
{
throw new JqmClientException("Internal JQM API error", e1);
}
JobRequest jd = new JobRequest();
try
{
jd.setApplication(rs.getString(1));
jd.setApplicationName(rs.getString(2));
jd.setEmail(rs.getString(3));
jd.setKeyword1(rs.getString(4));
jd.setKeyword2(rs.getString(5));
jd.setKeyword3(rs.getString(6));
jd.setModule(rs.getString(7));
jd.setParentID(rs.getInt(8));
jd.setSessionID(rs.getString(9));
jd.setUser(rs.getString(10));
for (Map.Entry<String, String> p : prms.entrySet())
{
jd.addParameter(p.getKey(), p.getValue());
}
}
catch (SQLException e)
{
throw new JqmClientException("Could not extract History data for launch " + launchId, e);
}
return jd;
} | java | private JobRequest getJobRequest(int launchId, DbConn cnx)
{
Map<String, String> prms = RuntimeParameter.select_map(cnx, "jiprm_select_by_ji", launchId);
ResultSet rs = cnx.runSelect("history_select_reenqueue_by_id", launchId);
try
{
if (!rs.next())
{
throw new JqmInvalidRequestException("There is no past laucnh iwth ID " + launchId);
}
}
catch (SQLException e1)
{
throw new JqmClientException("Internal JQM API error", e1);
}
JobRequest jd = new JobRequest();
try
{
jd.setApplication(rs.getString(1));
jd.setApplicationName(rs.getString(2));
jd.setEmail(rs.getString(3));
jd.setKeyword1(rs.getString(4));
jd.setKeyword2(rs.getString(5));
jd.setKeyword3(rs.getString(6));
jd.setModule(rs.getString(7));
jd.setParentID(rs.getInt(8));
jd.setSessionID(rs.getString(9));
jd.setUser(rs.getString(10));
for (Map.Entry<String, String> p : prms.entrySet())
{
jd.addParameter(p.getKey(), p.getValue());
}
}
catch (SQLException e)
{
throw new JqmClientException("Could not extract History data for launch " + launchId, e);
}
return jd;
} | [
"private",
"JobRequest",
"getJobRequest",
"(",
"int",
"launchId",
",",
"DbConn",
"cnx",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"prms",
"=",
"RuntimeParameter",
".",
"select_map",
"(",
"cnx",
",",
"\"jiprm_select_by_ji\"",
",",
"launchId",
")",
"... | Internal helper to create a new execution request from an History row.<br>
To be called for a single row only, not for converting multiple History elements.<br>
Does not create a transaction, and no need for an active transaction.
@param launchId
the ID of the launch (was the ID of the JI, now the ID of the History object)
@param cnx
an open DB session
@return a new execution request | [
"Internal",
"helper",
"to",
"create",
"a",
"new",
"execution",
"request",
"from",
"an",
"History",
"row",
".",
"<br",
">",
"To",
"be",
"called",
"for",
"a",
"single",
"row",
"only",
"not",
"for",
"converting",
"multiple",
"History",
"elements",
".",
"<br",... | train | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-client/jqm-api-client-jdbc/src/main/java/com/enioka/jqm/api/JdbcClient.java#L428-L470 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/af_persistant_stat_info.java | af_persistant_stat_info.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
af_persistant_stat_info_responses result = (af_persistant_stat_info_responses) service.get_payload_formatter().string_to_resource(af_persistant_stat_info_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.af_persistant_stat_info_response_array);
}
af_persistant_stat_info[] result_af_persistant_stat_info = new af_persistant_stat_info[result.af_persistant_stat_info_response_array.length];
for(int i = 0; i < result.af_persistant_stat_info_response_array.length; i++)
{
result_af_persistant_stat_info[i] = result.af_persistant_stat_info_response_array[i].af_persistant_stat_info[0];
}
return result_af_persistant_stat_info;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
af_persistant_stat_info_responses result = (af_persistant_stat_info_responses) service.get_payload_formatter().string_to_resource(af_persistant_stat_info_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.af_persistant_stat_info_response_array);
}
af_persistant_stat_info[] result_af_persistant_stat_info = new af_persistant_stat_info[result.af_persistant_stat_info_response_array.length];
for(int i = 0; i < result.af_persistant_stat_info_response_array.length; i++)
{
result_af_persistant_stat_info[i] = result.af_persistant_stat_info_response_array[i].af_persistant_stat_info[0];
}
return result_af_persistant_stat_info;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"af_persistant_stat_info_responses",
"result",
"=",
"(",
"af_persistant_stat_info_responses",
")",
"service",
".... | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/af_persistant_stat_info.java#L262-L279 |
Azure/azure-sdk-for-java | privatedns/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/privatedns/v2018_09_01/implementation/PrivateZonesInner.java | PrivateZonesInner.createOrUpdate | public PrivateZoneInner createOrUpdate(String resourceGroupName, String privateZoneName, PrivateZoneInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, privateZoneName, parameters).toBlocking().last().body();
} | java | public PrivateZoneInner createOrUpdate(String resourceGroupName, String privateZoneName, PrivateZoneInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, privateZoneName, parameters).toBlocking().last().body();
} | [
"public",
"PrivateZoneInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"privateZoneName",
",",
"PrivateZoneInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"privateZoneName",
",",
... | Creates or updates a Private DNS zone. Does not modify Links to virtual networks or DNS records within the zone.
@param resourceGroupName The name of the resource group.
@param privateZoneName The name of the Private DNS zone (without a terminating dot).
@param parameters Parameters supplied to the CreateOrUpdate operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the PrivateZoneInner object if successful. | [
"Creates",
"or",
"updates",
"a",
"Private",
"DNS",
"zone",
".",
"Does",
"not",
"modify",
"Links",
"to",
"virtual",
"networks",
"or",
"DNS",
"records",
"within",
"the",
"zone",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/privatedns/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/privatedns/v2018_09_01/implementation/PrivateZonesInner.java#L125-L127 |
jferard/fastods | fastods/src/main/java/com/github/jferard/fastods/odselement/StylesContainer.java | StylesContainer.writeVisibleDataStyles | public void writeVisibleDataStyles(final XMLUtil util, final Appendable appendable)
throws IOException {
final Iterable<DataStyle> dataStyles = this.dataStylesContainer
.getValues(Dest.STYLES_COMMON_STYLES);
for (final DataStyle dataStyle : dataStyles) {
assert !dataStyle.isHidden() : dataStyle.toString() + " - " + dataStyle.getName() +
TableCellStyle.DEFAULT_CELL_STYLE.toString();
dataStyle.appendXMLContent(util, appendable);
}
} | java | public void writeVisibleDataStyles(final XMLUtil util, final Appendable appendable)
throws IOException {
final Iterable<DataStyle> dataStyles = this.dataStylesContainer
.getValues(Dest.STYLES_COMMON_STYLES);
for (final DataStyle dataStyle : dataStyles) {
assert !dataStyle.isHidden() : dataStyle.toString() + " - " + dataStyle.getName() +
TableCellStyle.DEFAULT_CELL_STYLE.toString();
dataStyle.appendXMLContent(util, appendable);
}
} | [
"public",
"void",
"writeVisibleDataStyles",
"(",
"final",
"XMLUtil",
"util",
",",
"final",
"Appendable",
"appendable",
")",
"throws",
"IOException",
"{",
"final",
"Iterable",
"<",
"DataStyle",
">",
"dataStyles",
"=",
"this",
".",
"dataStylesContainer",
".",
"getVa... | Write data styles to styles.xml/common-styles
@param util an util
@param appendable the destination
@throws IOException if an I/O error occurs | [
"Write",
"data",
"styles",
"to",
"styles",
".",
"xml",
"/",
"common",
"-",
"styles"
] | train | https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/odselement/StylesContainer.java#L462-L472 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/StylesheetHandler.java | StylesheetHandler.processingInstruction | public void processingInstruction(String target, String data)
throws org.xml.sax.SAXException
{
if (!m_shouldProcess)
return;
// Recreating Scott's kluge:
// A xsl:for-each or xsl:apply-templates may have a special
// PI that tells us not to cache the document. This PI
// should really be namespaced.
// String localName = getLocalName(target);
// String ns = m_stylesheet.getNamespaceFromStack(target);
//
// %REVIEW%: We need a better PI architecture
String prefix="",ns="", localName=target;
int colon=target.indexOf(':');
if(colon>=0)
{
ns=getNamespaceForPrefix(prefix=target.substring(0,colon));
localName=target.substring(colon+1);
}
try
{
// A xsl:for-each or xsl:apply-templates may have a special
// PI that tells us not to cache the document. This PI
// should really be namespaced... but since the XML Namespaces
// spec never defined namespaces as applying to PI's, and since
// the testcase we're trying to support is inconsistant in whether
// it binds the prefix, I'm going to make this sloppy for
// testing purposes.
if(
"xalan-doc-cache-off".equals(target) ||
"xalan:doc-cache-off".equals(target) ||
("doc-cache-off".equals(localName) &&
ns.equals("org.apache.xalan.xslt.extensions.Redirect") )
)
{
if(!(m_elems.peek() instanceof ElemForEach))
throw new TransformerException
("xalan:doc-cache-off not allowed here!",
getLocator());
ElemForEach elem = (ElemForEach)m_elems.peek();
elem.m_doc_cache_off = true;
//System.out.println("JJK***** Recognized <? {"+ns+"}"+prefix+":"+localName+" "+data+"?>");
}
}
catch(Exception e)
{
// JJK: Officially, unknown PIs can just be ignored.
// Do we want to issue a warning?
}
flushCharacters();
getCurrentProcessor().processingInstruction(this, target, data);
} | java | public void processingInstruction(String target, String data)
throws org.xml.sax.SAXException
{
if (!m_shouldProcess)
return;
// Recreating Scott's kluge:
// A xsl:for-each or xsl:apply-templates may have a special
// PI that tells us not to cache the document. This PI
// should really be namespaced.
// String localName = getLocalName(target);
// String ns = m_stylesheet.getNamespaceFromStack(target);
//
// %REVIEW%: We need a better PI architecture
String prefix="",ns="", localName=target;
int colon=target.indexOf(':');
if(colon>=0)
{
ns=getNamespaceForPrefix(prefix=target.substring(0,colon));
localName=target.substring(colon+1);
}
try
{
// A xsl:for-each or xsl:apply-templates may have a special
// PI that tells us not to cache the document. This PI
// should really be namespaced... but since the XML Namespaces
// spec never defined namespaces as applying to PI's, and since
// the testcase we're trying to support is inconsistant in whether
// it binds the prefix, I'm going to make this sloppy for
// testing purposes.
if(
"xalan-doc-cache-off".equals(target) ||
"xalan:doc-cache-off".equals(target) ||
("doc-cache-off".equals(localName) &&
ns.equals("org.apache.xalan.xslt.extensions.Redirect") )
)
{
if(!(m_elems.peek() instanceof ElemForEach))
throw new TransformerException
("xalan:doc-cache-off not allowed here!",
getLocator());
ElemForEach elem = (ElemForEach)m_elems.peek();
elem.m_doc_cache_off = true;
//System.out.println("JJK***** Recognized <? {"+ns+"}"+prefix+":"+localName+" "+data+"?>");
}
}
catch(Exception e)
{
// JJK: Officially, unknown PIs can just be ignored.
// Do we want to issue a warning?
}
flushCharacters();
getCurrentProcessor().processingInstruction(this, target, data);
} | [
"public",
"void",
"processingInstruction",
"(",
"String",
"target",
",",
"String",
"data",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
".",
"SAXException",
"{",
"if",
"(",
"!",
"m_shouldProcess",
")",
"return",
";",
"// Recreating Scott's kluge:",
"// A xsl:fo... | Receive notification of a processing instruction.
<p>The Parser will invoke this method once for each processing
instruction found: note that processing instructions may occur
before or after the main document element.</p>
<p>A SAX parser should never report an XML declaration (XML 1.0,
section 2.8) or a text declaration (XML 1.0, section 4.3.1)
using this method.</p>
<p>By default, do nothing. Application writers may override this
method in a subclass to take specific actions for each
processing instruction, such as setting status variables or
invoking other methods.</p>
@param target The processing instruction target.
@param data The processing instruction data, or null if
none is supplied.
@see org.xml.sax.ContentHandler#processingInstruction
@throws org.xml.sax.SAXException Any SAX exception, possibly
wrapping another exception. | [
"Receive",
"notification",
"of",
"a",
"processing",
"instruction",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/StylesheetHandler.java#L754-L813 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ApplicationsImpl.java | ApplicationsImpl.listAsync | public ServiceFuture<List<ApplicationSummary>> listAsync(final ApplicationListOptions applicationListOptions, final ListOperationCallback<ApplicationSummary> serviceCallback) {
return AzureServiceFuture.fromHeaderPageResponse(
listSinglePageAsync(applicationListOptions),
new Func1<String, Observable<ServiceResponseWithHeaders<Page<ApplicationSummary>, ApplicationListHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<ApplicationSummary>, ApplicationListHeaders>> call(String nextPageLink) {
ApplicationListNextOptions applicationListNextOptions = null;
if (applicationListOptions != null) {
applicationListNextOptions = new ApplicationListNextOptions();
applicationListNextOptions.withClientRequestId(applicationListOptions.clientRequestId());
applicationListNextOptions.withReturnClientRequestId(applicationListOptions.returnClientRequestId());
applicationListNextOptions.withOcpDate(applicationListOptions.ocpDate());
}
return listNextSinglePageAsync(nextPageLink, applicationListNextOptions);
}
},
serviceCallback);
} | java | public ServiceFuture<List<ApplicationSummary>> listAsync(final ApplicationListOptions applicationListOptions, final ListOperationCallback<ApplicationSummary> serviceCallback) {
return AzureServiceFuture.fromHeaderPageResponse(
listSinglePageAsync(applicationListOptions),
new Func1<String, Observable<ServiceResponseWithHeaders<Page<ApplicationSummary>, ApplicationListHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<ApplicationSummary>, ApplicationListHeaders>> call(String nextPageLink) {
ApplicationListNextOptions applicationListNextOptions = null;
if (applicationListOptions != null) {
applicationListNextOptions = new ApplicationListNextOptions();
applicationListNextOptions.withClientRequestId(applicationListOptions.clientRequestId());
applicationListNextOptions.withReturnClientRequestId(applicationListOptions.returnClientRequestId());
applicationListNextOptions.withOcpDate(applicationListOptions.ocpDate());
}
return listNextSinglePageAsync(nextPageLink, applicationListNextOptions);
}
},
serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"List",
"<",
"ApplicationSummary",
">",
">",
"listAsync",
"(",
"final",
"ApplicationListOptions",
"applicationListOptions",
",",
"final",
"ListOperationCallback",
"<",
"ApplicationSummary",
">",
"serviceCallback",
")",
"{",
"return",
"Azu... | Lists all of the applications available in the specified account.
This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API.
@param applicationListOptions Additional parameters for the operation
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Lists",
"all",
"of",
"the",
"applications",
"available",
"in",
"the",
"specified",
"account",
".",
"This",
"operation",
"returns",
"only",
"applications",
"and",
"versions",
"that",
"are",
"available",
"for",
"use",
"on",
"compute",
"nodes",
";",
"that",
"is"... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ApplicationsImpl.java#L235-L252 |
pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/writer/SegmentAggregator.java | SegmentAggregator.acknowledgeAlreadyProcessedOperation | private void acknowledgeAlreadyProcessedOperation(SegmentOperation operation) throws DataCorruptionException {
if (operation instanceof MergeSegmentOperation) {
// Only MergeSegmentOperations need special handling. Others, such as StreamSegmentSealOperation, are not
// needed since they're handled in the initialize() method. Ensure that the DataSource is aware of this
// (since after recovery, it may not know that a merge has been properly completed).
MergeSegmentOperation mergeOp = (MergeSegmentOperation) operation;
try {
updateMetadataForTransactionPostMerger(this.dataSource.getStreamSegmentMetadata(mergeOp.getSourceSegmentId()), mergeOp.getStreamSegmentId());
} catch (Throwable ex) {
// Something really weird must have happened if we ended up in here. To prevent any (further) damage, we need
// to stop the Segment Container right away.
throw new DataCorruptionException(String.format("Unable to acknowledge already processed operation '%s'.", operation), ex);
}
}
} | java | private void acknowledgeAlreadyProcessedOperation(SegmentOperation operation) throws DataCorruptionException {
if (operation instanceof MergeSegmentOperation) {
// Only MergeSegmentOperations need special handling. Others, such as StreamSegmentSealOperation, are not
// needed since they're handled in the initialize() method. Ensure that the DataSource is aware of this
// (since after recovery, it may not know that a merge has been properly completed).
MergeSegmentOperation mergeOp = (MergeSegmentOperation) operation;
try {
updateMetadataForTransactionPostMerger(this.dataSource.getStreamSegmentMetadata(mergeOp.getSourceSegmentId()), mergeOp.getStreamSegmentId());
} catch (Throwable ex) {
// Something really weird must have happened if we ended up in here. To prevent any (further) damage, we need
// to stop the Segment Container right away.
throw new DataCorruptionException(String.format("Unable to acknowledge already processed operation '%s'.", operation), ex);
}
}
} | [
"private",
"void",
"acknowledgeAlreadyProcessedOperation",
"(",
"SegmentOperation",
"operation",
")",
"throws",
"DataCorruptionException",
"{",
"if",
"(",
"operation",
"instanceof",
"MergeSegmentOperation",
")",
"{",
"// Only MergeSegmentOperations need special handling. Others, su... | Processes (acks) an operation that has already been processed and would otherwise result in no change to the
underlying Storage.
@param operation The operation to handle. | [
"Processes",
"(",
"acks",
")",
"an",
"operation",
"that",
"has",
"already",
"been",
"processed",
"and",
"would",
"otherwise",
"result",
"in",
"no",
"change",
"to",
"the",
"underlying",
"Storage",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/writer/SegmentAggregator.java#L436-L450 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/util/ArrayUtils.java | ArrayUtils.equalContents | public static boolean equalContents(int[][] xs, int[][] ys) {
if(xs ==null)
return ys == null;
if(ys == null)
return false;
if(xs.length != ys.length)
return false;
for(int i = xs.length-1; i >= 0; i--) {
if(! equalContents(xs[i],ys[i]))
return false;
}
return true;
} | java | public static boolean equalContents(int[][] xs, int[][] ys) {
if(xs ==null)
return ys == null;
if(ys == null)
return false;
if(xs.length != ys.length)
return false;
for(int i = xs.length-1; i >= 0; i--) {
if(! equalContents(xs[i],ys[i]))
return false;
}
return true;
} | [
"public",
"static",
"boolean",
"equalContents",
"(",
"int",
"[",
"]",
"[",
"]",
"xs",
",",
"int",
"[",
"]",
"[",
"]",
"ys",
")",
"{",
"if",
"(",
"xs",
"==",
"null",
")",
"return",
"ys",
"==",
"null",
";",
"if",
"(",
"ys",
"==",
"null",
")",
"... | Tests two int[][] arrays for having equal contents.
@return true iff for each i, <code>equalContents(xs[i],ys[i])</code> is true | [
"Tests",
"two",
"int",
"[]",
"[]",
"arrays",
"for",
"having",
"equal",
"contents",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/ArrayUtils.java#L490-L502 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/PatternMatchingFunctions.java | PatternMatchingFunctions.regexpPosition | public static Expression regexpPosition(Expression expression, String pattern) {
return x("REGEXP_POSITION(" + expression.toString() + ", \"" + pattern + "\")");
} | java | public static Expression regexpPosition(Expression expression, String pattern) {
return x("REGEXP_POSITION(" + expression.toString() + ", \"" + pattern + "\")");
} | [
"public",
"static",
"Expression",
"regexpPosition",
"(",
"Expression",
"expression",
",",
"String",
"pattern",
")",
"{",
"return",
"x",
"(",
"\"REGEXP_POSITION(\"",
"+",
"expression",
".",
"toString",
"(",
")",
"+",
"\", \\\"\"",
"+",
"pattern",
"+",
"\"\\\")\""... | Returned expression results in the first position of the regular expression pattern within the string, or -1. | [
"Returned",
"expression",
"results",
"in",
"the",
"first",
"position",
"of",
"the",
"regular",
"expression",
"pattern",
"within",
"the",
"string",
"or",
"-",
"1",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/PatternMatchingFunctions.java#L70-L72 |
VoltDB/voltdb | src/frontend/org/voltdb/TheHashinator.java | TheHashinator.getHashinator | public static TheHashinator getHashinator(Class<? extends TheHashinator> hashinatorImplementation,
byte config[], boolean cooked) {
return constructHashinator(hashinatorImplementation, config, cooked);
} | java | public static TheHashinator getHashinator(Class<? extends TheHashinator> hashinatorImplementation,
byte config[], boolean cooked) {
return constructHashinator(hashinatorImplementation, config, cooked);
} | [
"public",
"static",
"TheHashinator",
"getHashinator",
"(",
"Class",
"<",
"?",
"extends",
"TheHashinator",
">",
"hashinatorImplementation",
",",
"byte",
"config",
"[",
"]",
",",
"boolean",
"cooked",
")",
"{",
"return",
"constructHashinator",
"(",
"hashinatorImplement... | Get TheHashinator instanced based on known implementation and configuration.
Used by client after asking server what it is running.
@param hashinatorImplementation
@param config
@return | [
"Get",
"TheHashinator",
"instanced",
"based",
"on",
"known",
"implementation",
"and",
"configuration",
".",
"Used",
"by",
"client",
"after",
"asking",
"server",
"what",
"it",
"is",
"running",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/TheHashinator.java#L129-L132 |
aws/aws-sdk-java | aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/StepExecution.java | StepExecution.setOverriddenParameters | public void setOverriddenParameters(java.util.Map<String, java.util.List<String>> overriddenParameters) {
this.overriddenParameters = overriddenParameters;
} | java | public void setOverriddenParameters(java.util.Map<String, java.util.List<String>> overriddenParameters) {
this.overriddenParameters = overriddenParameters;
} | [
"public",
"void",
"setOverriddenParameters",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"java",
".",
"util",
".",
"List",
"<",
"String",
">",
">",
"overriddenParameters",
")",
"{",
"this",
".",
"overriddenParameters",
"=",
"overriddenParameters"... | <p>
A user-specified list of parameters to override when running a step.
</p>
@param overriddenParameters
A user-specified list of parameters to override when running a step. | [
"<p",
">",
"A",
"user",
"-",
"specified",
"list",
"of",
"parameters",
"to",
"override",
"when",
"running",
"a",
"step",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/StepExecution.java#L887-L889 |
netty/netty | handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java | SslContextBuilder.keyManager | public SslContextBuilder keyManager(PrivateKey key, X509Certificate... keyCertChain) {
return keyManager(key, null, keyCertChain);
} | java | public SslContextBuilder keyManager(PrivateKey key, X509Certificate... keyCertChain) {
return keyManager(key, null, keyCertChain);
} | [
"public",
"SslContextBuilder",
"keyManager",
"(",
"PrivateKey",
"key",
",",
"X509Certificate",
"...",
"keyCertChain",
")",
"{",
"return",
"keyManager",
"(",
"key",
",",
"null",
",",
"keyCertChain",
")",
";",
"}"
] | Identifying certificate for this host. {@code keyCertChain} and {@code key} may
be {@code null} for client contexts, which disables mutual authentication.
@param key a PKCS#8 private key
@param keyCertChain an X.509 certificate chain | [
"Identifying",
"certificate",
"for",
"this",
"host",
".",
"{",
"@code",
"keyCertChain",
"}",
"and",
"{",
"@code",
"key",
"}",
"may",
"be",
"{",
"@code",
"null",
"}",
"for",
"client",
"contexts",
"which",
"disables",
"mutual",
"authentication",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java#L246-L248 |
headius/invokebinder | src/main/java/com/headius/invokebinder/Binder.java | Binder.invokeQuiet | public MethodHandle invokeQuiet(MethodHandles.Lookup lookup, Method method) {
try {
return invoke(lookup, method);
} catch (IllegalAccessException iae) {
throw new InvalidTransformException(iae);
}
} | java | public MethodHandle invokeQuiet(MethodHandles.Lookup lookup, Method method) {
try {
return invoke(lookup, method);
} catch (IllegalAccessException iae) {
throw new InvalidTransformException(iae);
}
} | [
"public",
"MethodHandle",
"invokeQuiet",
"(",
"MethodHandles",
".",
"Lookup",
"lookup",
",",
"Method",
"method",
")",
"{",
"try",
"{",
"return",
"invoke",
"(",
"lookup",
",",
"method",
")",
";",
"}",
"catch",
"(",
"IllegalAccessException",
"iae",
")",
"{",
... | Apply the chain of transforms and bind them to a static method specified
using the end signature plus the given class and method. The method will
be retrieved using the given Lookup and must match the end signature
exactly.
If the final handle's type does not exactly match the initial type for
this Binder, an additional cast will be attempted.
This version is "quiet" in that it throws an unchecked InvalidTransformException
if the target method does not exist or is inaccessible.
@param lookup the MethodHandles.Lookup to use to unreflect the method
@param method the Method to unreflect
@return the full handle chain, bound to the given method | [
"Apply",
"the",
"chain",
"of",
"transforms",
"and",
"bind",
"them",
"to",
"a",
"static",
"method",
"specified",
"using",
"the",
"end",
"signature",
"plus",
"the",
"given",
"class",
"and",
"method",
".",
"The",
"method",
"will",
"be",
"retrieved",
"using",
... | train | https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/Binder.java#L1186-L1192 |
akarnokd/ixjava | src/main/java/ix/Ix.java | Ix.subscribe | public final void subscribe(IxConsumer<? super T> onNext, IxConsumer<Throwable> onError, Runnable onCompleted) {
try {
for (T v : this) {
onNext.accept(v);
}
} catch (Throwable ex) {
onError.accept(ex);
return;
}
onCompleted.run();
} | java | public final void subscribe(IxConsumer<? super T> onNext, IxConsumer<Throwable> onError, Runnable onCompleted) {
try {
for (T v : this) {
onNext.accept(v);
}
} catch (Throwable ex) {
onError.accept(ex);
return;
}
onCompleted.run();
} | [
"public",
"final",
"void",
"subscribe",
"(",
"IxConsumer",
"<",
"?",
"super",
"T",
">",
"onNext",
",",
"IxConsumer",
"<",
"Throwable",
">",
"onError",
",",
"Runnable",
"onCompleted",
")",
"{",
"try",
"{",
"for",
"(",
"T",
"v",
":",
"this",
")",
"{",
... | Iterates over this sequence and calls the given onNext action with
each element and calls the onError with any exception thrown by the iteration
or the onNext action; otherwise calls the onCompleted action when the sequence completes
without exception.
@param onNext the consumer to call with each element
@param onError the consumer to call with the exception thrown
@param onCompleted the action called after the sequence has been consumed
@throws NullPointerException if onError or onCompleted is null
@since 1.0 | [
"Iterates",
"over",
"this",
"sequence",
"and",
"calls",
"the",
"given",
"onNext",
"action",
"with",
"each",
"element",
"and",
"calls",
"the",
"onError",
"with",
"any",
"exception",
"thrown",
"by",
"the",
"iteration",
"or",
"the",
"onNext",
"action",
";",
"ot... | train | https://github.com/akarnokd/ixjava/blob/add721bba550c36541faa450e40a975bb65e78d7/src/main/java/ix/Ix.java#L2610-L2620 |
qspin/qtaste | kernel/src/main/java/com/qspin/qtaste/validator/CacheValidator.java | CacheValidator.check | public static void check(LinkedHashMap<String, Object> nameExpectedValues, long timeout) throws QTasteTestFailException {
check(nameExpectedValues, timeout, null);
} | java | public static void check(LinkedHashMap<String, Object> nameExpectedValues, long timeout) throws QTasteTestFailException {
check(nameExpectedValues, timeout, null);
} | [
"public",
"static",
"void",
"check",
"(",
"LinkedHashMap",
"<",
"String",
",",
"Object",
">",
"nameExpectedValues",
",",
"long",
"timeout",
")",
"throws",
"QTasteTestFailException",
"{",
"check",
"(",
"nameExpectedValues",
",",
"timeout",
",",
"null",
")",
";",
... | Note that since nameExpectedValues is a map, it can only contain one expected value per name. | [
"Note",
"that",
"since",
"nameExpectedValues",
"is",
"a",
"map",
"it",
"can",
"only",
"contain",
"one",
"expected",
"value",
"per",
"name",
"."
] | train | https://github.com/qspin/qtaste/blob/ba45d4d86eb29b92f157c6e98536dee2002ddfdc/kernel/src/main/java/com/qspin/qtaste/validator/CacheValidator.java#L59-L61 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/checkouts/DestinationUrl.java | DestinationUrl.addDestinationUrl | public static MozuUrl addDestinationUrl(String checkoutId, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/checkouts/{checkoutId}/destinations?responseFields={responseFields}");
formatter.formatUrl("checkoutId", checkoutId);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl addDestinationUrl(String checkoutId, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/checkouts/{checkoutId}/destinations?responseFields={responseFields}");
formatter.formatUrl("checkoutId", checkoutId);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"addDestinationUrl",
"(",
"String",
"checkoutId",
",",
"String",
"responseFields",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/checkouts/{checkoutId}/destinations?responseFields={responseFields}\"",
")"... | Get Resource Url for AddDestination
@param checkoutId The unique identifier of the checkout.
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"AddDestination"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/checkouts/DestinationUrl.java#L50-L56 |
infinispan/infinispan | core/src/main/java/org/infinispan/interceptors/InvocationStage.java | InvocationStage.thenApply | public Object thenApply(InvocationContext ctx, VisitableCommand command,
InvocationSuccessFunction function) {
return addCallback(ctx, command, function);
} | java | public Object thenApply(InvocationContext ctx, VisitableCommand command,
InvocationSuccessFunction function) {
return addCallback(ctx, command, function);
} | [
"public",
"Object",
"thenApply",
"(",
"InvocationContext",
"ctx",
",",
"VisitableCommand",
"command",
",",
"InvocationSuccessFunction",
"function",
")",
"{",
"return",
"addCallback",
"(",
"ctx",
",",
"command",
",",
"function",
")",
";",
"}"
] | After the current stage completes successfully, invoke {@code function} and return its result.
The result may be either a plain value, or a new {@link InvocationStage}. | [
"After",
"the",
"current",
"stage",
"completes",
"successfully",
"invoke",
"{",
"@code",
"function",
"}",
"and",
"return",
"its",
"result",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/interceptors/InvocationStage.java#L43-L46 |
jcuda/jcusparse | JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java | JCusparse.cusparseSgebsr2gebsc_bufferSize | public static int cusparseSgebsr2gebsc_bufferSize(
cusparseHandle handle,
int mb,
int nb,
int nnzb,
Pointer bsrSortedVal,
Pointer bsrSortedRowPtr,
Pointer bsrSortedColInd,
int rowBlockDim,
int colBlockDim,
int[] pBufferSizeInBytes)
{
return checkResult(cusparseSgebsr2gebsc_bufferSizeNative(handle, mb, nb, nnzb, bsrSortedVal, bsrSortedRowPtr, bsrSortedColInd, rowBlockDim, colBlockDim, pBufferSizeInBytes));
} | java | public static int cusparseSgebsr2gebsc_bufferSize(
cusparseHandle handle,
int mb,
int nb,
int nnzb,
Pointer bsrSortedVal,
Pointer bsrSortedRowPtr,
Pointer bsrSortedColInd,
int rowBlockDim,
int colBlockDim,
int[] pBufferSizeInBytes)
{
return checkResult(cusparseSgebsr2gebsc_bufferSizeNative(handle, mb, nb, nnzb, bsrSortedVal, bsrSortedRowPtr, bsrSortedColInd, rowBlockDim, colBlockDim, pBufferSizeInBytes));
} | [
"public",
"static",
"int",
"cusparseSgebsr2gebsc_bufferSize",
"(",
"cusparseHandle",
"handle",
",",
"int",
"mb",
",",
"int",
"nb",
",",
"int",
"nnzb",
",",
"Pointer",
"bsrSortedVal",
",",
"Pointer",
"bsrSortedRowPtr",
",",
"Pointer",
"bsrSortedColInd",
",",
"int",... | Description: This routine converts a sparse matrix in general block-CSR storage format
to a sparse matrix in general block-CSC storage format. | [
"Description",
":",
"This",
"routine",
"converts",
"a",
"sparse",
"matrix",
"in",
"general",
"block",
"-",
"CSR",
"storage",
"format",
"to",
"a",
"sparse",
"matrix",
"in",
"general",
"block",
"-",
"CSC",
"storage",
"format",
"."
] | train | https://github.com/jcuda/jcusparse/blob/7687a62a4ef6b76cb91cf7da93d4cf5ade96a791/JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java#L12660-L12673 |
jalkanen/speed4j | src/main/java/com/ecyrd/speed4j/StopWatchFactory.java | StopWatchFactory.shutdown | public static synchronized void shutdown()
{
if( c_factories == null ) return; // Nothing to do
for( Iterator<Entry<String, StopWatchFactory>> i = c_factories.entrySet().iterator(); i.hasNext() ; )
{
Map.Entry<String,StopWatchFactory> e = i.next();
StopWatchFactory swf = e.getValue();
swf.internalShutdown();
i.remove();
}
c_factories = null;
} | java | public static synchronized void shutdown()
{
if( c_factories == null ) return; // Nothing to do
for( Iterator<Entry<String, StopWatchFactory>> i = c_factories.entrySet().iterator(); i.hasNext() ; )
{
Map.Entry<String,StopWatchFactory> e = i.next();
StopWatchFactory swf = e.getValue();
swf.internalShutdown();
i.remove();
}
c_factories = null;
} | [
"public",
"static",
"synchronized",
"void",
"shutdown",
"(",
")",
"{",
"if",
"(",
"c_factories",
"==",
"null",
")",
"return",
";",
"// Nothing to do",
"for",
"(",
"Iterator",
"<",
"Entry",
"<",
"String",
",",
"StopWatchFactory",
">",
">",
"i",
"=",
"c_fact... | Shut down all StopWatchFactories. This method is useful
to call to clean up any resources which might be usable. | [
"Shut",
"down",
"all",
"StopWatchFactories",
".",
"This",
"method",
"is",
"useful",
"to",
"call",
"to",
"clean",
"up",
"any",
"resources",
"which",
"might",
"be",
"usable",
"."
] | train | https://github.com/jalkanen/speed4j/blob/1d2db9c9b9def869c25fedb9bbd7cf95c39023bd/src/main/java/com/ecyrd/speed4j/StopWatchFactory.java#L272-L287 |
h2oai/h2o-3 | h2o-genmodel/src/main/java/hex/genmodel/easy/EasyPredictModelWrapper.java | EasyPredictModelWrapper.sortByDescendingClassProbability | public SortedClassProbability[] sortByDescendingClassProbability(BinomialModelPrediction p) {
String[] domainValues = m.getDomainValues(m.getResponseIdx());
double[] classProbabilities = p.classProbabilities;
return sortByDescendingClassProbability(domainValues, classProbabilities);
} | java | public SortedClassProbability[] sortByDescendingClassProbability(BinomialModelPrediction p) {
String[] domainValues = m.getDomainValues(m.getResponseIdx());
double[] classProbabilities = p.classProbabilities;
return sortByDescendingClassProbability(domainValues, classProbabilities);
} | [
"public",
"SortedClassProbability",
"[",
"]",
"sortByDescendingClassProbability",
"(",
"BinomialModelPrediction",
"p",
")",
"{",
"String",
"[",
"]",
"domainValues",
"=",
"m",
".",
"getDomainValues",
"(",
"m",
".",
"getResponseIdx",
"(",
")",
")",
";",
"double",
... | A helper function to return an array of binomial class probabilities for a prediction in sorted order.
The returned array has the most probable class in position 0.
@param p The prediction.
@return An array with sorted class probabilities. | [
"A",
"helper",
"function",
"to",
"return",
"an",
"array",
"of",
"binomial",
"class",
"probabilities",
"for",
"a",
"prediction",
"in",
"sorted",
"order",
".",
"The",
"returned",
"array",
"has",
"the",
"most",
"probable",
"class",
"in",
"position",
"0",
"."
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel/src/main/java/hex/genmodel/easy/EasyPredictModelWrapper.java#L679-L683 |
openengsb/openengsb | components/services/src/main/java/org/openengsb/core/services/internal/security/ldap/EntryFactory.java | EntryFactory.organizationalUnit | public static Entry organizationalUnit(String ou, Dn baseDn) {
Dn dn = LdapUtils.concatDn(SchemaConstants.OU_ATTRIBUTE, ou, baseDn);
Entry entry = new DefaultEntry(dn);
try {
entry.add(SchemaConstants.OBJECT_CLASS_ATTRIBUTE, SchemaConstants.ORGANIZATIONAL_UNIT_OC);
entry.add(SchemaConstants.OU_ATTRIBUTE, ou);
} catch (LdapException e) {
throw new LdapRuntimeException(e);
}
return entry;
} | java | public static Entry organizationalUnit(String ou, Dn baseDn) {
Dn dn = LdapUtils.concatDn(SchemaConstants.OU_ATTRIBUTE, ou, baseDn);
Entry entry = new DefaultEntry(dn);
try {
entry.add(SchemaConstants.OBJECT_CLASS_ATTRIBUTE, SchemaConstants.ORGANIZATIONAL_UNIT_OC);
entry.add(SchemaConstants.OU_ATTRIBUTE, ou);
} catch (LdapException e) {
throw new LdapRuntimeException(e);
}
return entry;
} | [
"public",
"static",
"Entry",
"organizationalUnit",
"(",
"String",
"ou",
",",
"Dn",
"baseDn",
")",
"{",
"Dn",
"dn",
"=",
"LdapUtils",
".",
"concatDn",
"(",
"SchemaConstants",
".",
"OU_ATTRIBUTE",
",",
"ou",
",",
"baseDn",
")",
";",
"Entry",
"entry",
"=",
... | Returns an {@link Entry} whose {@link Dn} is baseDn followed by ou as Rdn. The attribute type of the Rdn is
'organizational unit'. | [
"Returns",
"an",
"{"
] | train | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/services/src/main/java/org/openengsb/core/services/internal/security/ldap/EntryFactory.java#L45-L55 |
mangstadt/biweekly | src/main/java/biweekly/component/VJournal.java | VJournal.setDateStart | public DateStart setDateStart(Date dateStart, boolean hasTime) {
DateStart prop = (dateStart == null) ? null : new DateStart(dateStart, hasTime);
setDateStart(prop);
return prop;
} | java | public DateStart setDateStart(Date dateStart, boolean hasTime) {
DateStart prop = (dateStart == null) ? null : new DateStart(dateStart, hasTime);
setDateStart(prop);
return prop;
} | [
"public",
"DateStart",
"setDateStart",
"(",
"Date",
"dateStart",
",",
"boolean",
"hasTime",
")",
"{",
"DateStart",
"prop",
"=",
"(",
"dateStart",
"==",
"null",
")",
"?",
"null",
":",
"new",
"DateStart",
"(",
"dateStart",
",",
"hasTime",
")",
";",
"setDateS... | Sets the date that the journal entry starts.
@param dateStart the start date or null to remove
@param hasTime true if the date has a time component, false if it is
strictly a date (if false, the given Date object should be created by a
{@link java.util.Calendar Calendar} object that uses the JVM's default
timezone)
@return the property that was created
@see <a href="http://tools.ietf.org/html/rfc5545#page-97">RFC 5545
p.97-8</a>
@see <a href="http://tools.ietf.org/html/rfc2445#page-93">RFC 2445
p.93-4</a> | [
"Sets",
"the",
"date",
"that",
"the",
"journal",
"entry",
"starts",
"."
] | train | https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/component/VJournal.java#L350-L354 |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Searches.java | Searches.findFirst | public static <E> E findFirst(E[] array, Predicate<E> predicate) {
final Iterator<E> filtered = new FilteringIterator<E>(new ArrayIterator<E>(array), predicate);
return new FirstElement<E>().apply(filtered);
} | java | public static <E> E findFirst(E[] array, Predicate<E> predicate) {
final Iterator<E> filtered = new FilteringIterator<E>(new ArrayIterator<E>(array), predicate);
return new FirstElement<E>().apply(filtered);
} | [
"public",
"static",
"<",
"E",
">",
"E",
"findFirst",
"(",
"E",
"[",
"]",
"array",
",",
"Predicate",
"<",
"E",
">",
"predicate",
")",
"{",
"final",
"Iterator",
"<",
"E",
">",
"filtered",
"=",
"new",
"FilteringIterator",
"<",
"E",
">",
"(",
"new",
"A... | Searches the first matching element returning it.
@param <E> the element type parameter
@param array the array to be searched
@param predicate the predicate to be applied to each element
@throws IllegalArgumentException if no element matches
@return the found element | [
"Searches",
"the",
"first",
"matching",
"element",
"returning",
"it",
"."
] | train | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Searches.java#L449-L452 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/dht/BootStrapper.java | BootStrapper.getBootstrapTokens | public static Collection<Token> getBootstrapTokens(final TokenMetadata metadata) throws ConfigurationException
{
Collection<String> initialTokens = DatabaseDescriptor.getInitialTokens();
// if user specified tokens, use those
if (initialTokens.size() > 0)
{
logger.debug("tokens manually specified as {}", initialTokens);
List<Token> tokens = new ArrayList<Token>(initialTokens.size());
for (String tokenString : initialTokens)
{
Token token = StorageService.getPartitioner().getTokenFactory().fromString(tokenString);
if (metadata.getEndpoint(token) != null)
throw new ConfigurationException("Bootstrapping to existing token " + tokenString + " is not allowed (decommission/removenode the old node first).");
tokens.add(token);
}
return tokens;
}
int numTokens = DatabaseDescriptor.getNumTokens();
if (numTokens < 1)
throw new ConfigurationException("num_tokens must be >= 1");
if (numTokens == 1)
logger.warn("Picking random token for a single vnode. You should probably add more vnodes; failing that, you should probably specify the token manually");
return getRandomTokens(metadata, numTokens);
} | java | public static Collection<Token> getBootstrapTokens(final TokenMetadata metadata) throws ConfigurationException
{
Collection<String> initialTokens = DatabaseDescriptor.getInitialTokens();
// if user specified tokens, use those
if (initialTokens.size() > 0)
{
logger.debug("tokens manually specified as {}", initialTokens);
List<Token> tokens = new ArrayList<Token>(initialTokens.size());
for (String tokenString : initialTokens)
{
Token token = StorageService.getPartitioner().getTokenFactory().fromString(tokenString);
if (metadata.getEndpoint(token) != null)
throw new ConfigurationException("Bootstrapping to existing token " + tokenString + " is not allowed (decommission/removenode the old node first).");
tokens.add(token);
}
return tokens;
}
int numTokens = DatabaseDescriptor.getNumTokens();
if (numTokens < 1)
throw new ConfigurationException("num_tokens must be >= 1");
if (numTokens == 1)
logger.warn("Picking random token for a single vnode. You should probably add more vnodes; failing that, you should probably specify the token manually");
return getRandomTokens(metadata, numTokens);
} | [
"public",
"static",
"Collection",
"<",
"Token",
">",
"getBootstrapTokens",
"(",
"final",
"TokenMetadata",
"metadata",
")",
"throws",
"ConfigurationException",
"{",
"Collection",
"<",
"String",
">",
"initialTokens",
"=",
"DatabaseDescriptor",
".",
"getInitialTokens",
"... | if initialtoken was specified, use that (split on comma).
otherwise, if num_tokens == 1, pick a token to assume half the load of the most-loaded node.
else choose num_tokens tokens at random | [
"if",
"initialtoken",
"was",
"specified",
"use",
"that",
"(",
"split",
"on",
"comma",
")",
".",
"otherwise",
"if",
"num_tokens",
"==",
"1",
"pick",
"a",
"token",
"to",
"assume",
"half",
"the",
"load",
"of",
"the",
"most",
"-",
"loaded",
"node",
".",
"e... | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/dht/BootStrapper.java#L95-L121 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/component/ShuttleList.java | ShuttleList.setListLabels | public void setListLabels(String chosenLabel, String sourceLabel) {
if (chosenLabel != null) {
this.chosenLabel.setText(chosenLabel);
this.chosenLabel.setVisible(true);
} else {
this.chosenLabel.setVisible(false);
}
if (sourceLabel != null) {
this.sourceLabel.setText(sourceLabel);
this.sourceLabel.setVisible(true);
} else {
this.sourceLabel.setVisible(false);
}
Dimension d = chosenList.getPreferredSize();
Dimension d1 = this.chosenLabel.getPreferredSize();
Dimension dChosenPanel = chosenPanel.getPreferredSize();
dChosenPanel.width = Math.max(d.width, Math.max(dChosenPanel.width, d1.width));
chosenPanel.setPreferredSize(dChosenPanel);
Dimension dSourceList = sourceList.getPreferredSize();
Dimension dSource = this.sourceLabel.getPreferredSize();
Dimension dSourcePanel = sourcePanel.getPreferredSize();
dSourcePanel.width = Math.max(dSource.width, Math.max(dSourceList.width, dSourcePanel.width));
sourcePanel.setPreferredSize(dSourcePanel);
Dimension fullPanelSize = getPreferredSize();
fullPanelSize.width =
dSourcePanel.width + dChosenPanel.width + (editButton != null ? editButton.getPreferredSize().width : 0)
+ (buttonPanel != null ? buttonPanel.getPreferredSize().width : 0) + 20;
setPreferredSize(fullPanelSize);
} | java | public void setListLabels(String chosenLabel, String sourceLabel) {
if (chosenLabel != null) {
this.chosenLabel.setText(chosenLabel);
this.chosenLabel.setVisible(true);
} else {
this.chosenLabel.setVisible(false);
}
if (sourceLabel != null) {
this.sourceLabel.setText(sourceLabel);
this.sourceLabel.setVisible(true);
} else {
this.sourceLabel.setVisible(false);
}
Dimension d = chosenList.getPreferredSize();
Dimension d1 = this.chosenLabel.getPreferredSize();
Dimension dChosenPanel = chosenPanel.getPreferredSize();
dChosenPanel.width = Math.max(d.width, Math.max(dChosenPanel.width, d1.width));
chosenPanel.setPreferredSize(dChosenPanel);
Dimension dSourceList = sourceList.getPreferredSize();
Dimension dSource = this.sourceLabel.getPreferredSize();
Dimension dSourcePanel = sourcePanel.getPreferredSize();
dSourcePanel.width = Math.max(dSource.width, Math.max(dSourceList.width, dSourcePanel.width));
sourcePanel.setPreferredSize(dSourcePanel);
Dimension fullPanelSize = getPreferredSize();
fullPanelSize.width =
dSourcePanel.width + dChosenPanel.width + (editButton != null ? editButton.getPreferredSize().width : 0)
+ (buttonPanel != null ? buttonPanel.getPreferredSize().width : 0) + 20;
setPreferredSize(fullPanelSize);
} | [
"public",
"void",
"setListLabels",
"(",
"String",
"chosenLabel",
",",
"String",
"sourceLabel",
")",
"{",
"if",
"(",
"chosenLabel",
"!=",
"null",
")",
"{",
"this",
".",
"chosenLabel",
".",
"setText",
"(",
"chosenLabel",
")",
";",
"this",
".",
"chosenLabel",
... | Add labels on top of the 2 lists. If not present, do not show the labels.
@param chosenLabel
@param sourceLabel | [
"Add",
"labels",
"on",
"top",
"of",
"the",
"2",
"lists",
".",
"If",
"not",
"present",
"do",
"not",
"show",
"the",
"labels",
"."
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/component/ShuttleList.java#L221-L254 |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/ServiceReferenceUtils.java | ServiceReferenceUtils.sortByRankingOrder | @SuppressWarnings({ "unchecked", "rawtypes" })
public static void sortByRankingOrder(ServiceReference<?>[] refs) {
if (refs.length > 1) {
ConcurrentServiceReferenceElement[] tmp = new ConcurrentServiceReferenceElement[refs.length];
// Take a snapshot of the service rankings.
for (int i = 0; i < refs.length; i++) {
tmp[i] = new ConcurrentServiceReferenceElement(null, refs[i]);
}
Arrays.sort(tmp);
// Copy the sorted service references.
for (int i = 0; i < refs.length; i++) {
refs[i] = tmp[i].getReference();
}
}
} | java | @SuppressWarnings({ "unchecked", "rawtypes" })
public static void sortByRankingOrder(ServiceReference<?>[] refs) {
if (refs.length > 1) {
ConcurrentServiceReferenceElement[] tmp = new ConcurrentServiceReferenceElement[refs.length];
// Take a snapshot of the service rankings.
for (int i = 0; i < refs.length; i++) {
tmp[i] = new ConcurrentServiceReferenceElement(null, refs[i]);
}
Arrays.sort(tmp);
// Copy the sorted service references.
for (int i = 0; i < refs.length; i++) {
refs[i] = tmp[i].getReference();
}
}
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
"}",
")",
"public",
"static",
"void",
"sortByRankingOrder",
"(",
"ServiceReference",
"<",
"?",
">",
"[",
"]",
"refs",
")",
"{",
"if",
"(",
"refs",
".",
"length",
">",
"1",
")",
"{",... | Sorts an array of service references in reverse order (highest service
ranking first). This method properly handles asynchronous updates to the
service ranking.
@param refs input and output array of service references | [
"Sorts",
"an",
"array",
"of",
"service",
"references",
"in",
"reverse",
"order",
"(",
"highest",
"service",
"ranking",
"first",
")",
".",
"This",
"method",
"properly",
"handles",
"asynchronous",
"updates",
"to",
"the",
"service",
"ranking",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/ServiceReferenceUtils.java#L48-L65 |
stapler/stapler | core/src/main/java/org/kohsuke/stapler/RequestImpl.java | RequestImpl.bindResolve | private Object bindResolve(Object o, JSONObject src) {
if (o instanceof DataBoundResolvable) {
DataBoundResolvable dbr = (DataBoundResolvable) o;
o = dbr.bindResolve(this,src);
}
return o;
} | java | private Object bindResolve(Object o, JSONObject src) {
if (o instanceof DataBoundResolvable) {
DataBoundResolvable dbr = (DataBoundResolvable) o;
o = dbr.bindResolve(this,src);
}
return o;
} | [
"private",
"Object",
"bindResolve",
"(",
"Object",
"o",
",",
"JSONObject",
"src",
")",
"{",
"if",
"(",
"o",
"instanceof",
"DataBoundResolvable",
")",
"{",
"DataBoundResolvable",
"dbr",
"=",
"(",
"DataBoundResolvable",
")",
"o",
";",
"o",
"=",
"dbr",
".",
"... | Calls {@link DataBoundResolvable#bindResolve(StaplerRequest, JSONObject)} if the object has it. | [
"Calls",
"{"
] | train | https://github.com/stapler/stapler/blob/11ad5af185e062fb46e01bf9fbed66f3ebf2a8f7/core/src/main/java/org/kohsuke/stapler/RequestImpl.java#L793-L799 |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/PhotosApi.java | PhotosApi.getRecent | public Photos getRecent(EnumSet<JinxConstants.PhotoExtras> extras, int perPage, int page) throws JinxException {
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.photos.getRecent");
if (!JinxUtils.isNullOrEmpty(extras)) {
params.put("extras", JinxUtils.buildCommaDelimitedList(extras));
}
if (perPage > 0) {
params.put("per_page", Integer.toString(perPage));
}
if (page > 0) {
params.put("page", Integer.toString(page));
}
return jinx.flickrGet(params, Photos.class);
} | java | public Photos getRecent(EnumSet<JinxConstants.PhotoExtras> extras, int perPage, int page) throws JinxException {
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.photos.getRecent");
if (!JinxUtils.isNullOrEmpty(extras)) {
params.put("extras", JinxUtils.buildCommaDelimitedList(extras));
}
if (perPage > 0) {
params.put("per_page", Integer.toString(perPage));
}
if (page > 0) {
params.put("page", Integer.toString(page));
}
return jinx.flickrGet(params, Photos.class);
} | [
"public",
"Photos",
"getRecent",
"(",
"EnumSet",
"<",
"JinxConstants",
".",
"PhotoExtras",
">",
"extras",
",",
"int",
"perPage",
",",
"int",
"page",
")",
"throws",
"JinxException",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"new",
"TreeM... | Returns a list of the latest public photos uploaded to flickr.
<br>
This method does not require authentication.
@param extras Optional. Extra information to fetch for each returned record.
@param perPage Optional. Number of photos to return per page. If this argument is zero, it defaults to 100. The maximum allowed value is 500.
@param page Optional. The page of results to return. If this argument is zero, it defaults to 1.
@return photos object.
@throws JinxException if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.photos.getRecent.html">flickr.photos.getRecent</a> | [
"Returns",
"a",
"list",
"of",
"the",
"latest",
"public",
"photos",
"uploaded",
"to",
"flickr",
".",
"<br",
">",
"This",
"method",
"does",
"not",
"require",
"authentication",
"."
] | train | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/PhotosApi.java#L436-L449 |
Azure/azure-sdk-for-java | datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/StorageAccountsInner.java | StorageAccountsInner.getStorageContainer | public StorageContainerInner getStorageContainer(String resourceGroupName, String accountName, String storageAccountName, String containerName) {
return getStorageContainerWithServiceResponseAsync(resourceGroupName, accountName, storageAccountName, containerName).toBlocking().single().body();
} | java | public StorageContainerInner getStorageContainer(String resourceGroupName, String accountName, String storageAccountName, String containerName) {
return getStorageContainerWithServiceResponseAsync(resourceGroupName, accountName, storageAccountName, containerName).toBlocking().single().body();
} | [
"public",
"StorageContainerInner",
"getStorageContainer",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"storageAccountName",
",",
"String",
"containerName",
")",
"{",
"return",
"getStorageContainerWithServiceResponseAsync",
"(",
"resourceGr... | Gets the specified Azure Storage container associated with the given Data Lake Analytics and Azure Storage accounts.
@param resourceGroupName The name of the Azure resource group.
@param accountName The name of the Data Lake Analytics account.
@param storageAccountName The name of the Azure storage account from which to retrieve the blob container.
@param containerName The name of the Azure storage container to retrieve
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the StorageContainerInner object if successful. | [
"Gets",
"the",
"specified",
"Azure",
"Storage",
"container",
"associated",
"with",
"the",
"given",
"Data",
"Lake",
"Analytics",
"and",
"Azure",
"Storage",
"accounts",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/StorageAccountsInner.java#L1000-L1002 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java | ApiOvhIpLoadbalancing.serviceName_availableRouteActions_GET | public ArrayList<OvhRouteAvailableAction> serviceName_availableRouteActions_GET(String serviceName) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/availableRouteActions";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t7);
} | java | public ArrayList<OvhRouteAvailableAction> serviceName_availableRouteActions_GET(String serviceName) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/availableRouteActions";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t7);
} | [
"public",
"ArrayList",
"<",
"OvhRouteAvailableAction",
">",
"serviceName_availableRouteActions_GET",
"(",
"String",
"serviceName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ipLoadbalancing/{serviceName}/availableRouteActions\"",
";",
"StringBuilder",
"sb",
... | Available route actions
REST: GET /ipLoadbalancing/{serviceName}/availableRouteActions
@param serviceName [required] The internal name of your IP load balancing | [
"Available",
"route",
"actions"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L739-L744 |
Scout24/appmon4j | core/src/main/java/de/is24/util/monitoring/database/MonitoringDataSource.java | MonitoringDataSource.getConnection | private Connection getConnection(Callable<Connection> callable, String monitorSuffix) throws SQLException {
final long now = System.currentTimeMillis();
try {
MonitoringConnection c = new MonitoringConnection(callable.call());
doConnectionMonitoring(now, monitorSuffix);
return c;
// CSOFF: IllegalCatch
// CSOFF: IllegalThrows
} catch (Error e) {
monitorFailedConnectionAttempt();
throw e;
} catch (RuntimeException rE) {
monitorFailedConnectionAttempt();
// Well, this MAY happen, although it shouldn't
throw rE;
// CSON: IllegalCatch
// CSON: IllegalThrows
} catch (SQLException sqlE) {
monitorFailedConnectionAttempt();
// sad but true
throw sqlE;
} catch (Exception e) {
monitorFailedConnectionAttempt();
// This MUST NOT happen - meaning that someone frakked the code of this class
LOGGER.error(
"Unexpected Exception thrown by Callable; please check source code of de.is24.common.database.MonitoringDataSource: " +
e);
throw new RuntimeException(e);
}
} | java | private Connection getConnection(Callable<Connection> callable, String monitorSuffix) throws SQLException {
final long now = System.currentTimeMillis();
try {
MonitoringConnection c = new MonitoringConnection(callable.call());
doConnectionMonitoring(now, monitorSuffix);
return c;
// CSOFF: IllegalCatch
// CSOFF: IllegalThrows
} catch (Error e) {
monitorFailedConnectionAttempt();
throw e;
} catch (RuntimeException rE) {
monitorFailedConnectionAttempt();
// Well, this MAY happen, although it shouldn't
throw rE;
// CSON: IllegalCatch
// CSON: IllegalThrows
} catch (SQLException sqlE) {
monitorFailedConnectionAttempt();
// sad but true
throw sqlE;
} catch (Exception e) {
monitorFailedConnectionAttempt();
// This MUST NOT happen - meaning that someone frakked the code of this class
LOGGER.error(
"Unexpected Exception thrown by Callable; please check source code of de.is24.common.database.MonitoringDataSource: " +
e);
throw new RuntimeException(e);
}
} | [
"private",
"Connection",
"getConnection",
"(",
"Callable",
"<",
"Connection",
">",
"callable",
",",
"String",
"monitorSuffix",
")",
"throws",
"SQLException",
"{",
"final",
"long",
"now",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"try",
"{",
"Moni... | Executes the specified {@link java.util.concurrent.Callable} to fetch a connection.
Monitors occurring exceptions/errors.
@param callable
the <code>Callable</code> that actually fetches a <code>Connection</code>
@param monitorSuffix
the suffix for the monitor name to increase (forwarded to {@link #doConnectionMonitoring(long, String)})
@return a database <code>Connection</code>
@throws java.sql.SQLException
if fetching a <code>Connection</code> fails
@throws RuntimeException | [
"Executes",
"the",
"specified",
"{",
"@link",
"java",
".",
"util",
".",
"concurrent",
".",
"Callable",
"}",
"to",
"fetch",
"a",
"connection",
".",
"Monitors",
"occurring",
"exceptions",
"/",
"errors",
"."
] | train | https://github.com/Scout24/appmon4j/blob/a662e5123805ea455cfd01e1b9ae5d808f83529c/core/src/main/java/de/is24/util/monitoring/database/MonitoringDataSource.java#L216-L250 |
cdk/cdk | base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/matchers/Expr.java | Expr.and | public Expr and(Expr expr) {
if (type == Type.TRUE) {
set(expr);
} else if (expr.type != Type.TRUE) {
if (type.isLogical() && !expr.type.isLogical()) {
if (type == AND)
right.and(expr);
else if (type != NOT)
setLogical(Type.AND, expr, new Expr(this));
else
setLogical(Type.AND, expr, new Expr(this));
} else {
setLogical(Type.AND, new Expr(this), expr);
}
}
return this;
} | java | public Expr and(Expr expr) {
if (type == Type.TRUE) {
set(expr);
} else if (expr.type != Type.TRUE) {
if (type.isLogical() && !expr.type.isLogical()) {
if (type == AND)
right.and(expr);
else if (type != NOT)
setLogical(Type.AND, expr, new Expr(this));
else
setLogical(Type.AND, expr, new Expr(this));
} else {
setLogical(Type.AND, new Expr(this), expr);
}
}
return this;
} | [
"public",
"Expr",
"and",
"(",
"Expr",
"expr",
")",
"{",
"if",
"(",
"type",
"==",
"Type",
".",
"TRUE",
")",
"{",
"set",
"(",
"expr",
")",
";",
"}",
"else",
"if",
"(",
"expr",
".",
"type",
"!=",
"Type",
".",
"TRUE",
")",
"{",
"if",
"(",
"type",... | Utility, combine this expression with another, using conjunction.
The expression will only match if both conditions are met.
@param expr the other expression
@return self for chaining | [
"Utility",
"combine",
"this",
"expression",
"with",
"another",
"using",
"conjunction",
".",
"The",
"expression",
"will",
"only",
"match",
"if",
"both",
"conditions",
"are",
"met",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/matchers/Expr.java#L458-L474 |
Hygieia/Hygieia | collectors/artifact/artifactory/src/main/java/com/capitalone/dashboard/collector/ArtifactoryCollectorTask.java | ArtifactoryCollectorTask.addNewRepos | private void addNewRepos(List<ArtifactoryRepo> repos, List<ArtifactoryRepo> existingRepos, ArtifactoryCollector collector) {
long start = System.currentTimeMillis();
int count = 0;
List<ArtifactoryRepo> newRepos = new ArrayList<>();
for (ArtifactoryRepo repo : repos) {
ArtifactoryRepo existing = null;
if (!CollectionUtils.isEmpty(existingRepos) && (existingRepos.contains(repo))) {
existing = existingRepos.get(existingRepos.indexOf(repo));
}
if (existing == null) {
repo.setCollectorId(collector.getId());
repo.setEnabled(false); // Do not enable for collection. Will be enabled later
repo.setDescription(repo.getRepoName());
newRepos.add(repo);
count++;
}
}
//save all in one shot
if (!CollectionUtils.isEmpty(newRepos)) {
artifactoryRepoRepository.save(newRepos);
}
log("New repos", start, count);
} | java | private void addNewRepos(List<ArtifactoryRepo> repos, List<ArtifactoryRepo> existingRepos, ArtifactoryCollector collector) {
long start = System.currentTimeMillis();
int count = 0;
List<ArtifactoryRepo> newRepos = new ArrayList<>();
for (ArtifactoryRepo repo : repos) {
ArtifactoryRepo existing = null;
if (!CollectionUtils.isEmpty(existingRepos) && (existingRepos.contains(repo))) {
existing = existingRepos.get(existingRepos.indexOf(repo));
}
if (existing == null) {
repo.setCollectorId(collector.getId());
repo.setEnabled(false); // Do not enable for collection. Will be enabled later
repo.setDescription(repo.getRepoName());
newRepos.add(repo);
count++;
}
}
//save all in one shot
if (!CollectionUtils.isEmpty(newRepos)) {
artifactoryRepoRepository.save(newRepos);
}
log("New repos", start, count);
} | [
"private",
"void",
"addNewRepos",
"(",
"List",
"<",
"ArtifactoryRepo",
">",
"repos",
",",
"List",
"<",
"ArtifactoryRepo",
">",
"existingRepos",
",",
"ArtifactoryCollector",
"collector",
")",
"{",
"long",
"start",
"=",
"System",
".",
"currentTimeMillis",
"(",
")"... | Add any new {@link ArtifactoryRepo}s.
@param repos list of {@link ArtifactoryRepo}s
@param existingRepos list of existing {@link ArtifactoryRepo}s
@param collector the {@link ArtifactoryCollector} | [
"Add",
"any",
"new",
"{",
"@link",
"ArtifactoryRepo",
"}",
"s",
"."
] | train | https://github.com/Hygieia/Hygieia/blob/d8b67a590da2744acf59bcd99d9b34ef1bb84890/collectors/artifact/artifactory/src/main/java/com/capitalone/dashboard/collector/ArtifactoryCollectorTask.java#L253-L277 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ListManagementImagesImpl.java | ListManagementImagesImpl.addImage | public Image addImage(String listId, AddImageOptionalParameter addImageOptionalParameter) {
return addImageWithServiceResponseAsync(listId, addImageOptionalParameter).toBlocking().single().body();
} | java | public Image addImage(String listId, AddImageOptionalParameter addImageOptionalParameter) {
return addImageWithServiceResponseAsync(listId, addImageOptionalParameter).toBlocking().single().body();
} | [
"public",
"Image",
"addImage",
"(",
"String",
"listId",
",",
"AddImageOptionalParameter",
"addImageOptionalParameter",
")",
"{",
"return",
"addImageWithServiceResponseAsync",
"(",
"listId",
",",
"addImageOptionalParameter",
")",
".",
"toBlocking",
"(",
")",
".",
"single... | Add an image to the list with list Id equal to list Id passed.
@param listId List Id of the image list.
@param addImageOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@throws APIErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the Image object if successful. | [
"Add",
"an",
"image",
"to",
"the",
"list",
"with",
"list",
"Id",
"equal",
"to",
"list",
"Id",
"passed",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ListManagementImagesImpl.java#L105-L107 |
spotify/helios | helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java | ZooKeeperMasterModel.getJobs | @Override
public Map<JobId, Job> getJobs() {
log.debug("getting jobs");
final String folder = Paths.configJobs();
final ZooKeeperClient client = provider.get("getJobs");
try {
final List<String> ids;
try {
ids = client.getChildren(folder);
} catch (NoNodeException e) {
return Maps.newHashMap();
}
final Map<JobId, Job> descriptors = Maps.newHashMap();
for (final String id : ids) {
final JobId jobId = JobId.fromString(id);
final String path = Paths.configJob(jobId);
try {
final byte[] data = client.getData(path);
final Job descriptor = parse(data, Job.class);
descriptors.put(descriptor.getId(), descriptor);
} catch (NoNodeException e) {
// Ignore, the job was deleted before we had a chance to read it.
log.debug("Ignoring deleted job {}", jobId);
}
}
return descriptors;
} catch (KeeperException | IOException e) {
throw new HeliosRuntimeException("getting jobs failed", e);
}
} | java | @Override
public Map<JobId, Job> getJobs() {
log.debug("getting jobs");
final String folder = Paths.configJobs();
final ZooKeeperClient client = provider.get("getJobs");
try {
final List<String> ids;
try {
ids = client.getChildren(folder);
} catch (NoNodeException e) {
return Maps.newHashMap();
}
final Map<JobId, Job> descriptors = Maps.newHashMap();
for (final String id : ids) {
final JobId jobId = JobId.fromString(id);
final String path = Paths.configJob(jobId);
try {
final byte[] data = client.getData(path);
final Job descriptor = parse(data, Job.class);
descriptors.put(descriptor.getId(), descriptor);
} catch (NoNodeException e) {
// Ignore, the job was deleted before we had a chance to read it.
log.debug("Ignoring deleted job {}", jobId);
}
}
return descriptors;
} catch (KeeperException | IOException e) {
throw new HeliosRuntimeException("getting jobs failed", e);
}
} | [
"@",
"Override",
"public",
"Map",
"<",
"JobId",
",",
"Job",
">",
"getJobs",
"(",
")",
"{",
"log",
".",
"debug",
"(",
"\"getting jobs\"",
")",
";",
"final",
"String",
"folder",
"=",
"Paths",
".",
"configJobs",
"(",
")",
";",
"final",
"ZooKeeperClient",
... | Returns a {@link Map} of {@link JobId} to {@link Job} objects for all of the jobs known. | [
"Returns",
"a",
"{"
] | train | https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java#L1357-L1386 |
Metatavu/edelphi | rest/src/main/java/fi/metatavu/edelphi/permissions/PermissionController.java | PermissionController.hasDelfoiAccess | public boolean hasDelfoiAccess(User user, DelfoiActionName actionName) {
if (isSuperUser(user)) {
return true;
}
DelfoiAction action = delfoiActionDAO.findByActionName(actionName.toString());
if (action == null) {
logger.info(String.format("ActionUtils.hasDelfoiAccess - undefined action: '%s'", actionName));
return false;
}
UserRole userRole = getDelfoiRole(user);
return hasDelfoiAccess(action, userRole);
} | java | public boolean hasDelfoiAccess(User user, DelfoiActionName actionName) {
if (isSuperUser(user)) {
return true;
}
DelfoiAction action = delfoiActionDAO.findByActionName(actionName.toString());
if (action == null) {
logger.info(String.format("ActionUtils.hasDelfoiAccess - undefined action: '%s'", actionName));
return false;
}
UserRole userRole = getDelfoiRole(user);
return hasDelfoiAccess(action, userRole);
} | [
"public",
"boolean",
"hasDelfoiAccess",
"(",
"User",
"user",
",",
"DelfoiActionName",
"actionName",
")",
"{",
"if",
"(",
"isSuperUser",
"(",
"user",
")",
")",
"{",
"return",
"true",
";",
"}",
"DelfoiAction",
"action",
"=",
"delfoiActionDAO",
".",
"findByAction... | Returns whether user has required delfoi action access
@param user user
@param actionName action
@return whether user role required action access | [
"Returns",
"whether",
"user",
"has",
"required",
"delfoi",
"action",
"access"
] | train | https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/rest/src/main/java/fi/metatavu/edelphi/permissions/PermissionController.java#L62-L75 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/BindDataSourceBuilder.java | BindDataSourceBuilder.generateRxInterface | private void generateRxInterface(String daoFactory, RxInterfaceType interfaceType, Class<?> clazz) {
// create interfaces
{
ParameterizedTypeName parameterizedTypeName = ParameterizedTypeName.get(ClassName.get(clazz),
TypeVariableName.get("T"));
String preExecutorName = clazz.getSimpleName().replace("Emitter", "");
String postExecutorName = com.abubusoft.kripton.common.CaseFormat.UPPER_UNDERSCORE
.to(CaseFormat.UPPER_CAMEL, interfaceType.toString());
// @formatter:off
if (interfaceType == RxInterfaceType.BATCH) {
classBuilder
.addType(TypeSpec.interfaceBuilder(preExecutorName + postExecutorName)
.addModifiers(Modifier.PUBLIC).addTypeVariable(TypeVariableName.get("T"))
.addMethod(MethodSpec.methodBuilder("onExecute")
.addParameter(className(daoFactory), "daoFactory")
.addParameter(parameterizedTypeName, "emitter")
.addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT).returns(Void.TYPE).build())
// .addModifiers(Modifier.PUBLIC,
// Modifier.ABSTRACT).returns(TransactionResult.class).build())
.build());
} else {
classBuilder
.addType(TypeSpec.interfaceBuilder(preExecutorName + postExecutorName)
.addModifiers(Modifier.PUBLIC).addTypeVariable(TypeVariableName.get("T"))
.addMethod(MethodSpec.methodBuilder("onExecute")
.addParameter(className(daoFactory), "daoFactory")
.addParameter(parameterizedTypeName, "emitter")
// .addModifiers(Modifier.PUBLIC,
// Modifier.ABSTRACT).returns(Void.TYPE).build())
.addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT)
.returns(TransactionResult.class).build())
.build());
}
// @formatter:on
}
} | java | private void generateRxInterface(String daoFactory, RxInterfaceType interfaceType, Class<?> clazz) {
// create interfaces
{
ParameterizedTypeName parameterizedTypeName = ParameterizedTypeName.get(ClassName.get(clazz),
TypeVariableName.get("T"));
String preExecutorName = clazz.getSimpleName().replace("Emitter", "");
String postExecutorName = com.abubusoft.kripton.common.CaseFormat.UPPER_UNDERSCORE
.to(CaseFormat.UPPER_CAMEL, interfaceType.toString());
// @formatter:off
if (interfaceType == RxInterfaceType.BATCH) {
classBuilder
.addType(TypeSpec.interfaceBuilder(preExecutorName + postExecutorName)
.addModifiers(Modifier.PUBLIC).addTypeVariable(TypeVariableName.get("T"))
.addMethod(MethodSpec.methodBuilder("onExecute")
.addParameter(className(daoFactory), "daoFactory")
.addParameter(parameterizedTypeName, "emitter")
.addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT).returns(Void.TYPE).build())
// .addModifiers(Modifier.PUBLIC,
// Modifier.ABSTRACT).returns(TransactionResult.class).build())
.build());
} else {
classBuilder
.addType(TypeSpec.interfaceBuilder(preExecutorName + postExecutorName)
.addModifiers(Modifier.PUBLIC).addTypeVariable(TypeVariableName.get("T"))
.addMethod(MethodSpec.methodBuilder("onExecute")
.addParameter(className(daoFactory), "daoFactory")
.addParameter(parameterizedTypeName, "emitter")
// .addModifiers(Modifier.PUBLIC,
// Modifier.ABSTRACT).returns(Void.TYPE).build())
.addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT)
.returns(TransactionResult.class).build())
.build());
}
// @formatter:on
}
} | [
"private",
"void",
"generateRxInterface",
"(",
"String",
"daoFactory",
",",
"RxInterfaceType",
"interfaceType",
",",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"// create interfaces",
"{",
"ParameterizedTypeName",
"parameterizedTypeName",
"=",
"ParameterizedTypeName",
"... | Generate rx interface.
@param daoFactory
the dao factory
@param interfaceType
the interface type
@param clazz
the clazz | [
"Generate",
"rx",
"interface",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/BindDataSourceBuilder.java#L1311-L1347 |
openbase/jul | pattern/default/src/main/java/org/openbase/jul/pattern/statemachine/StateRunner.java | StateRunner.getState | private State getState(final Class<? extends State> stateClass) throws NotAvailableException {
if (!stateMap.containsKey(stateClass)) {
try {
final State state;
try {
state = stateClass.getConstructor().newInstance();
} catch (IllegalAccessException | IllegalArgumentException | InstantiationException | NoSuchMethodException | SecurityException | InvocationTargetException ex) {
throw new CouldNotPerformException("Could not create instance of " + stateClass.getName(), ex);
}
stateMap.put(stateClass, state);
return state;
} catch (CouldNotPerformException ex) {
throw new NotAvailableException(stateClass, ex);
}
}
return stateMap.get(stateClass);
} | java | private State getState(final Class<? extends State> stateClass) throws NotAvailableException {
if (!stateMap.containsKey(stateClass)) {
try {
final State state;
try {
state = stateClass.getConstructor().newInstance();
} catch (IllegalAccessException | IllegalArgumentException | InstantiationException | NoSuchMethodException | SecurityException | InvocationTargetException ex) {
throw new CouldNotPerformException("Could not create instance of " + stateClass.getName(), ex);
}
stateMap.put(stateClass, state);
return state;
} catch (CouldNotPerformException ex) {
throw new NotAvailableException(stateClass, ex);
}
}
return stateMap.get(stateClass);
} | [
"private",
"State",
"getState",
"(",
"final",
"Class",
"<",
"?",
"extends",
"State",
">",
"stateClass",
")",
"throws",
"NotAvailableException",
"{",
"if",
"(",
"!",
"stateMap",
".",
"containsKey",
"(",
"stateClass",
")",
")",
"{",
"try",
"{",
"final",
"Sta... | Method loads the state referred by the state class.
Once the state is loaded it will be cached and next time the state is requested the cached instance will be returned out of performance reasons.
@param stateClass the class defining the state to load.
@return an new or cached instance of the state..
@throws NotAvailableException is thrown if the state could not be loaded. | [
"Method",
"loads",
"the",
"state",
"referred",
"by",
"the",
"state",
"class",
"."
] | train | https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/pattern/default/src/main/java/org/openbase/jul/pattern/statemachine/StateRunner.java#L153-L169 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.