repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 218 | func_name stringlengths 5 140 | whole_func_string stringlengths 79 3.99k | language stringclasses 1
value | func_code_string stringlengths 79 3.99k | func_code_tokens listlengths 20 624 | func_documentation_string stringlengths 61 1.96k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 107 339 |
|---|---|---|---|---|---|---|---|---|---|---|
apiman/apiman | manager/api/rest-impl/src/main/java/io/apiman/manager/api/rest/impl/audit/AuditUtils.java | AuditUtils.asString_ApiGatewayBeans | public static String asString_ApiGatewayBeans(Set<ApiGatewayBean> gateways) {
TreeSet<ApiGatewayBean> sortedGateways = new TreeSet<>(new Comparator<ApiGatewayBean>() {
@Override
public int compare(ApiGatewayBean o1, ApiGatewayBean o2) {
return o1.getGatewayId().compareTo(o2.getGatewayId());
}
});
sortedGateways.addAll(gateways);
StringBuilder builder = new StringBuilder();
boolean first = true;
if (gateways != null) {
for (ApiGatewayBean gateway : sortedGateways) {
if (!first) {
builder.append(", "); //$NON-NLS-1$
}
builder.append(gateway.getGatewayId());
first = false;
}
}
return builder.toString();
} | java | public static String asString_ApiGatewayBeans(Set<ApiGatewayBean> gateways) {
TreeSet<ApiGatewayBean> sortedGateways = new TreeSet<>(new Comparator<ApiGatewayBean>() {
@Override
public int compare(ApiGatewayBean o1, ApiGatewayBean o2) {
return o1.getGatewayId().compareTo(o2.getGatewayId());
}
});
sortedGateways.addAll(gateways);
StringBuilder builder = new StringBuilder();
boolean first = true;
if (gateways != null) {
for (ApiGatewayBean gateway : sortedGateways) {
if (!first) {
builder.append(", "); //$NON-NLS-1$
}
builder.append(gateway.getGatewayId());
first = false;
}
}
return builder.toString();
} | [
"public",
"static",
"String",
"asString_ApiGatewayBeans",
"(",
"Set",
"<",
"ApiGatewayBean",
">",
"gateways",
")",
"{",
"TreeSet",
"<",
"ApiGatewayBean",
">",
"sortedGateways",
"=",
"new",
"TreeSet",
"<>",
"(",
"new",
"Comparator",
"<",
"ApiGatewayBean",
">",
"(... | Converts the list of gateways to a string for display/comparison.
@param gateways set of gateways
@return the gateways as a string | [
"Converts",
"the",
"list",
"of",
"gateways",
"to",
"a",
"string",
"for",
"display",
"/",
"comparison",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/rest-impl/src/main/java/io/apiman/manager/api/rest/impl/audit/AuditUtils.java#L837-L858 |
sarl/sarl | main/coreplugins/io.sarl.lang.core/src/io/sarl/lang/scoping/extensions/numbers/comparison/ShortComparisonExtensions.java | ShortComparisonExtensions.operator_equals | @Pure
@Inline(value = "($1 != null && ($1.shortValue() == $2))", constantExpression = true)
public static boolean operator_equals(Short left, long right) {
return left != null ? left.shortValue() == right : false;
} | java | @Pure
@Inline(value = "($1 != null && ($1.shortValue() == $2))", constantExpression = true)
public static boolean operator_equals(Short left, long right) {
return left != null ? left.shortValue() == right : false;
} | [
"@",
"Pure",
"@",
"Inline",
"(",
"value",
"=",
"\"($1 != null && ($1.shortValue() == $2))\"",
",",
"constantExpression",
"=",
"true",
")",
"public",
"static",
"boolean",
"operator_equals",
"(",
"Short",
"left",
",",
"long",
"right",
")",
"{",
"return",
"left",
"... | The binary {@code equals} operator. This is the equivalent to the Java {@code ==} operator.
This function is null-safe.
@param left a number.
@param right a number.
@return {@code left==right} | [
"The",
"binary",
"{",
"@code",
"equals",
"}",
"operator",
".",
"This",
"is",
"the",
"equivalent",
"to",
"the",
"Java",
"{",
"@code",
"==",
"}",
"operator",
".",
"This",
"function",
"is",
"null",
"-",
"safe",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.core/src/io/sarl/lang/scoping/extensions/numbers/comparison/ShortComparisonExtensions.java#L425-L429 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/RemoteExceptionMappingStrategy.java | RemoteExceptionMappingStrategy.mapCSITransactionRolledBackException | @Override
public Exception mapCSITransactionRolledBackException
(EJSDeployedSupport s, CSITransactionRolledbackException ex)
throws CSIException
{
//d180095
// Ensure root is set before doing the mapping.
if (s.rootEx == null)
{
s.rootEx = ExceptionUtil.findRootCause(ex);
}
Exception mappedEx = mapCSIException(s, ex);
// set the stack trace in CORBA exception to the exception stack for
// the root cause of the exception.
mappedEx.setStackTrace(s.rootEx.getStackTrace());
return mappedEx;
} | java | @Override
public Exception mapCSITransactionRolledBackException
(EJSDeployedSupport s, CSITransactionRolledbackException ex)
throws CSIException
{
//d180095
// Ensure root is set before doing the mapping.
if (s.rootEx == null)
{
s.rootEx = ExceptionUtil.findRootCause(ex);
}
Exception mappedEx = mapCSIException(s, ex);
// set the stack trace in CORBA exception to the exception stack for
// the root cause of the exception.
mappedEx.setStackTrace(s.rootEx.getStackTrace());
return mappedEx;
} | [
"@",
"Override",
"public",
"Exception",
"mapCSITransactionRolledBackException",
"(",
"EJSDeployedSupport",
"s",
",",
"CSITransactionRolledbackException",
"ex",
")",
"throws",
"CSIException",
"{",
"//d180095",
"// Ensure root is set before doing the mapping.",
"if",
"(",
"s",
... | This method is used for EJB 2.1 (and earlier) component remote interfaces
as well as EJB 3.0 business remote interfaces that implement java.rmi.Remote.
Generally, the exception mapping for the component and java.rmi.Remote
business interfaces is the same, but for those differences that do exist,
the code should run conditionally based on the wrapper interface type. <p> | [
"This",
"method",
"is",
"used",
"for",
"EJB",
"2",
".",
"1",
"(",
"and",
"earlier",
")",
"component",
"remote",
"interfaces",
"as",
"well",
"as",
"EJB",
"3",
".",
"0",
"business",
"remote",
"interfaces",
"that",
"implement",
"java",
".",
"rmi",
".",
"R... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/RemoteExceptionMappingStrategy.java#L567-L585 |
roboconf/roboconf-platform | core/roboconf-core/src/main/java/net/roboconf/core/model/RecipesValidator.java | RecipesValidator.validateScriptComponent | private static List<ModelError> validateScriptComponent( File applicationFilesDirectory, Component component ) {
List<ModelError> result = new ArrayList<> ();
// There must be a "scripts" directory
File directory = ResourceUtils.findInstanceResourcesDirectory( applicationFilesDirectory, component );
List<File> subDirs = Utils.listAllFiles( directory );
if( !subDirs.isEmpty()) {
File scriptsDir = new File( directory, SCRIPTS_DIR_NAME );
if( ! scriptsDir.exists())
result.add( new ModelError( ErrorCode.REC_SCRIPT_NO_SCRIPTS_DIR, component, component( component )));
}
return result;
} | java | private static List<ModelError> validateScriptComponent( File applicationFilesDirectory, Component component ) {
List<ModelError> result = new ArrayList<> ();
// There must be a "scripts" directory
File directory = ResourceUtils.findInstanceResourcesDirectory( applicationFilesDirectory, component );
List<File> subDirs = Utils.listAllFiles( directory );
if( !subDirs.isEmpty()) {
File scriptsDir = new File( directory, SCRIPTS_DIR_NAME );
if( ! scriptsDir.exists())
result.add( new ModelError( ErrorCode.REC_SCRIPT_NO_SCRIPTS_DIR, component, component( component )));
}
return result;
} | [
"private",
"static",
"List",
"<",
"ModelError",
">",
"validateScriptComponent",
"(",
"File",
"applicationFilesDirectory",
",",
"Component",
"component",
")",
"{",
"List",
"<",
"ModelError",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"// There m... | Validates a component associated with the Puppet installer.
@param applicationFilesDirectory the application's directory
@param component the component
@return a non-null list of errors | [
"Validates",
"a",
"component",
"associated",
"with",
"the",
"Puppet",
"installer",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/model/RecipesValidator.java#L113-L127 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java | ElementsExceptionsFactory.newImmutableObjectException | public static ImmutableObjectException newImmutableObjectException(Throwable cause, String message, Object... args) {
return new ImmutableObjectException(format(message, args), cause);
} | java | public static ImmutableObjectException newImmutableObjectException(Throwable cause, String message, Object... args) {
return new ImmutableObjectException(format(message, args), cause);
} | [
"public",
"static",
"ImmutableObjectException",
"newImmutableObjectException",
"(",
"Throwable",
"cause",
",",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"new",
"ImmutableObjectException",
"(",
"format",
"(",
"message",
",",
"args",
")",
... | Constructs and initializes a new {@link ImmutableObjectException} with the given {@link Throwable cause}
and {@link String message} formatted with the given {@link Object[] arguments}.
@param cause {@link Throwable} identified as the reason this {@link ImmutableObjectException} was thrown.
@param message {@link String} describing the {@link ImmutableObjectException exception}.
@param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}.
@return a new {@link ImmutableObjectException} with the given {@link Throwable cause} and {@link String message}.
@see org.cp.elements.lang.ImmutableObjectException | [
"Constructs",
"and",
"initializes",
"a",
"new",
"{",
"@link",
"ImmutableObjectException",
"}",
"with",
"the",
"given",
"{",
"@link",
"Throwable",
"cause",
"}",
"and",
"{",
"@link",
"String",
"message",
"}",
"formatted",
"with",
"the",
"given",
"{",
"@link",
... | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java#L425-L427 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/transform/TransformerRegistry.java | TransformerRegistry.getDomainRegistration | public TransformersSubRegistration getDomainRegistration(final ModelVersionRange range) {
final PathAddress address = PathAddress.EMPTY_ADDRESS;
return new TransformersSubRegistrationImpl(range, domain, address);
} | java | public TransformersSubRegistration getDomainRegistration(final ModelVersionRange range) {
final PathAddress address = PathAddress.EMPTY_ADDRESS;
return new TransformersSubRegistrationImpl(range, domain, address);
} | [
"public",
"TransformersSubRegistration",
"getDomainRegistration",
"(",
"final",
"ModelVersionRange",
"range",
")",
"{",
"final",
"PathAddress",
"address",
"=",
"PathAddress",
".",
"EMPTY_ADDRESS",
";",
"return",
"new",
"TransformersSubRegistrationImpl",
"(",
"range",
",",... | Get the sub registry for the domain.
@param range the version range
@return the sub registry | [
"Get",
"the",
"sub",
"registry",
"for",
"the",
"domain",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/transform/TransformerRegistry.java#L163-L166 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-datastore/src/main/java/com/google/cloud/datastore/DatastoreHelper.java | DatastoreHelper.fetch | static List<Entity> fetch(Datastore reader, Key[] keys, ReadOption... options) {
return compileEntities(keys, reader.get(Arrays.asList(keys), options));
} | java | static List<Entity> fetch(Datastore reader, Key[] keys, ReadOption... options) {
return compileEntities(keys, reader.get(Arrays.asList(keys), options));
} | [
"static",
"List",
"<",
"Entity",
">",
"fetch",
"(",
"Datastore",
"reader",
",",
"Key",
"[",
"]",
"keys",
",",
"ReadOption",
"...",
"options",
")",
"{",
"return",
"compileEntities",
"(",
"keys",
",",
"reader",
".",
"get",
"(",
"Arrays",
".",
"asList",
"... | Returns a list with a value for each given key (ordered by input). {@code null} values are
returned for nonexistent keys. | [
"Returns",
"a",
"list",
"with",
"a",
"value",
"for",
"each",
"given",
"key",
"(",
"ordered",
"by",
"input",
")",
".",
"{"
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datastore/src/main/java/com/google/cloud/datastore/DatastoreHelper.java#L72-L74 |
tango-controls/JTango | client/src/main/java/fr/soleil/tango/clientapi/util/TypeConversionUtil.java | TypeConversionUtil.castToType | @SuppressWarnings("unchecked")
public static <T> T castToType(final Class<T> type, final Object val) throws DevFailed {
T result;
if (val == null) {
result = null;
} else if (type.isAssignableFrom(val.getClass())) {
result = (T) val;
} else {
LOGGER.debug("converting {} to {}", val.getClass().getCanonicalName(), type.getCanonicalName());
// if input is not an array and we want to convert it to an array.
// Put
// the value in an array
Object array = val;
if (!val.getClass().isArray() && type.isArray()) {
array = Array.newInstance(val.getClass(), 1);
Array.set(array, 0, val);
}
final Transmorph transmorph = new Transmorph(creatConv());
try {
result = transmorph.convert(array, type);
} catch (final ConverterException e) {
LOGGER.error("convertion error", e);
throw DevFailedUtils.newDevFailed(e);
}
}
return result;
} | java | @SuppressWarnings("unchecked")
public static <T> T castToType(final Class<T> type, final Object val) throws DevFailed {
T result;
if (val == null) {
result = null;
} else if (type.isAssignableFrom(val.getClass())) {
result = (T) val;
} else {
LOGGER.debug("converting {} to {}", val.getClass().getCanonicalName(), type.getCanonicalName());
// if input is not an array and we want to convert it to an array.
// Put
// the value in an array
Object array = val;
if (!val.getClass().isArray() && type.isArray()) {
array = Array.newInstance(val.getClass(), 1);
Array.set(array, 0, val);
}
final Transmorph transmorph = new Transmorph(creatConv());
try {
result = transmorph.convert(array, type);
} catch (final ConverterException e) {
LOGGER.error("convertion error", e);
throw DevFailedUtils.newDevFailed(e);
}
}
return result;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"castToType",
"(",
"final",
"Class",
"<",
"T",
">",
"type",
",",
"final",
"Object",
"val",
")",
"throws",
"DevFailed",
"{",
"T",
"result",
";",
"if",
"(",
"val"... | Convert an object to another object.
@see Transmorph
@param <T>
@param type
@param val
@return
@throws DevFailed | [
"Convert",
"an",
"object",
"to",
"another",
"object",
"."
] | train | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/fr/soleil/tango/clientapi/util/TypeConversionUtil.java#L94-L121 |
undertow-io/undertow | core/src/main/java/io/undertow/websockets/core/WebSockets.java | WebSockets.sendClose | public static <T> void sendClose(final CloseMessage closeMessage, final WebSocketChannel wsChannel, final WebSocketCallback<T> callback, T context) {
wsChannel.setCloseCode(closeMessage.getCode());
wsChannel.setCloseReason(closeMessage.getReason());
sendInternal(closeMessage.toByteBuffer(), WebSocketFrameType.CLOSE, wsChannel, callback, context, -1);
} | java | public static <T> void sendClose(final CloseMessage closeMessage, final WebSocketChannel wsChannel, final WebSocketCallback<T> callback, T context) {
wsChannel.setCloseCode(closeMessage.getCode());
wsChannel.setCloseReason(closeMessage.getReason());
sendInternal(closeMessage.toByteBuffer(), WebSocketFrameType.CLOSE, wsChannel, callback, context, -1);
} | [
"public",
"static",
"<",
"T",
">",
"void",
"sendClose",
"(",
"final",
"CloseMessage",
"closeMessage",
",",
"final",
"WebSocketChannel",
"wsChannel",
",",
"final",
"WebSocketCallback",
"<",
"T",
">",
"callback",
",",
"T",
"context",
")",
"{",
"wsChannel",
".",
... | Sends a complete close message, invoking the callback when complete
@param closeMessage The close message
@param wsChannel The web socket channel
@param callback The callback to invoke on completion
@param context The context object that will be passed to the callback on completion | [
"Sends",
"a",
"complete",
"close",
"message",
"invoking",
"the",
"callback",
"when",
"complete"
] | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/websockets/core/WebSockets.java#L853-L857 |
ontop/ontop | mapping/sql/core/src/main/java/it/unibz/inf/ontop/spec/mapping/serializer/TargetQueryRenderer.java | TargetQueryRenderer.getAbbreviatedName | private static String getAbbreviatedName(String uri, PrefixManager pm, boolean insideQuotes) {
return pm.getShortForm(uri, insideQuotes);
} | java | private static String getAbbreviatedName(String uri, PrefixManager pm, boolean insideQuotes) {
return pm.getShortForm(uri, insideQuotes);
} | [
"private",
"static",
"String",
"getAbbreviatedName",
"(",
"String",
"uri",
",",
"PrefixManager",
"pm",
",",
"boolean",
"insideQuotes",
")",
"{",
"return",
"pm",
".",
"getShortForm",
"(",
"uri",
",",
"insideQuotes",
")",
";",
"}"
] | Prints the short form of the predicate (by omitting the complete URI and
replacing it by a prefix name). | [
"Prints",
"the",
"short",
"form",
"of",
"the",
"predicate",
"(",
"by",
"omitting",
"the",
"complete",
"URI",
"and",
"replacing",
"it",
"by",
"a",
"prefix",
"name",
")",
"."
] | train | https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/mapping/sql/core/src/main/java/it/unibz/inf/ontop/spec/mapping/serializer/TargetQueryRenderer.java#L94-L96 |
rhuss/jolokia | agent/core/src/main/java/org/jolokia/discovery/MulticastUtil.java | MulticastUtil.sendQueryAndCollectAnswers | public static List<DiscoveryIncomingMessage> sendQueryAndCollectAnswers(DiscoveryOutgoingMessage pOutMsg, int pTimeout) throws IOException {
return sendQueryAndCollectAnswers(pOutMsg, pTimeout, new QuietLogHandler());
} | java | public static List<DiscoveryIncomingMessage> sendQueryAndCollectAnswers(DiscoveryOutgoingMessage pOutMsg, int pTimeout) throws IOException {
return sendQueryAndCollectAnswers(pOutMsg, pTimeout, new QuietLogHandler());
} | [
"public",
"static",
"List",
"<",
"DiscoveryIncomingMessage",
">",
"sendQueryAndCollectAnswers",
"(",
"DiscoveryOutgoingMessage",
"pOutMsg",
",",
"int",
"pTimeout",
")",
"throws",
"IOException",
"{",
"return",
"sendQueryAndCollectAnswers",
"(",
"pOutMsg",
",",
"pTimeout",
... | Sent out a message to Jolokia's multicast group over all network interfaces supporting multicast request (and no
logging is used)
@param pOutMsg the message to send
@param pTimeout timeout used for how long to wait for discovery messages
@return list of received answers, never null
@throws IOException if something fails during the discovery request | [
"Sent",
"out",
"a",
"message",
"to",
"Jolokia",
"s",
"multicast",
"group",
"over",
"all",
"network",
"interfaces",
"supporting",
"multicast",
"request",
"(",
"and",
"no",
"logging",
"is",
"used",
")"
] | train | https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/discovery/MulticastUtil.java#L54-L56 |
prestodb/presto | presto-spi/src/main/java/com/facebook/presto/spi/type/UnscaledDecimal128Arithmetic.java | UnscaledDecimal128Arithmetic.addUnsignedReturnOverflow | private static long addUnsignedReturnOverflow(Slice left, Slice right, Slice result, boolean resultNegative)
{
// TODO: consider two 7 bytes operations
int l0 = getInt(left, 0);
int l1 = getInt(left, 1);
int l2 = getInt(left, 2);
int l3 = getInt(left, 3);
int r0 = getInt(right, 0);
int r1 = getInt(right, 1);
int r2 = getInt(right, 2);
int r3 = getInt(right, 3);
long intermediateResult;
intermediateResult = (l0 & LONG_MASK) + (r0 & LONG_MASK);
int z0 = (int) intermediateResult;
intermediateResult = (l1 & LONG_MASK) + (r1 & LONG_MASK) + (intermediateResult >>> 32);
int z1 = (int) intermediateResult;
intermediateResult = (l2 & LONG_MASK) + (r2 & LONG_MASK) + (intermediateResult >>> 32);
int z2 = (int) intermediateResult;
intermediateResult = (l3 & LONG_MASK) + (r3 & LONG_MASK) + (intermediateResult >>> 32);
int z3 = (int) intermediateResult & (~SIGN_INT_MASK);
pack(result, z0, z1, z2, z3, resultNegative);
return intermediateResult >> 31;
} | java | private static long addUnsignedReturnOverflow(Slice left, Slice right, Slice result, boolean resultNegative)
{
// TODO: consider two 7 bytes operations
int l0 = getInt(left, 0);
int l1 = getInt(left, 1);
int l2 = getInt(left, 2);
int l3 = getInt(left, 3);
int r0 = getInt(right, 0);
int r1 = getInt(right, 1);
int r2 = getInt(right, 2);
int r3 = getInt(right, 3);
long intermediateResult;
intermediateResult = (l0 & LONG_MASK) + (r0 & LONG_MASK);
int z0 = (int) intermediateResult;
intermediateResult = (l1 & LONG_MASK) + (r1 & LONG_MASK) + (intermediateResult >>> 32);
int z1 = (int) intermediateResult;
intermediateResult = (l2 & LONG_MASK) + (r2 & LONG_MASK) + (intermediateResult >>> 32);
int z2 = (int) intermediateResult;
intermediateResult = (l3 & LONG_MASK) + (r3 & LONG_MASK) + (intermediateResult >>> 32);
int z3 = (int) intermediateResult & (~SIGN_INT_MASK);
pack(result, z0, z1, z2, z3, resultNegative);
return intermediateResult >> 31;
} | [
"private",
"static",
"long",
"addUnsignedReturnOverflow",
"(",
"Slice",
"left",
",",
"Slice",
"right",
",",
"Slice",
"result",
",",
"boolean",
"resultNegative",
")",
"{",
"// TODO: consider two 7 bytes operations",
"int",
"l0",
"=",
"getInt",
"(",
"left",
",",
"0"... | This method ignores signs of the left and right. Returns overflow value. | [
"This",
"method",
"ignores",
"signs",
"of",
"the",
"left",
"and",
"right",
".",
"Returns",
"overflow",
"value",
"."
] | train | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-spi/src/main/java/com/facebook/presto/spi/type/UnscaledDecimal128Arithmetic.java#L371-L404 |
jmapper-framework/jmapper-core | JMapper Framework/src/main/java/com/googlecode/jmapper/api/JMapperAPI.java | JMapperAPI.targetAttribute | public static TargetAttribute targetAttribute(String name, String customGet, String customSet){
return new TargetAttribute(name, customGet, customSet);
} | java | public static TargetAttribute targetAttribute(String name, String customGet, String customSet){
return new TargetAttribute(name, customGet, customSet);
} | [
"public",
"static",
"TargetAttribute",
"targetAttribute",
"(",
"String",
"name",
",",
"String",
"customGet",
",",
"String",
"customSet",
")",
"{",
"return",
"new",
"TargetAttribute",
"(",
"name",
",",
"customGet",
",",
"customSet",
")",
";",
"}"
] | Permits to define a target attribute.
@param name target attribute name
@param customGet custom get method
@param customSet custom set method
@return an instance of TargetAttribute | [
"Permits",
"to",
"define",
"a",
"target",
"attribute",
"."
] | train | https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/api/JMapperAPI.java#L107-L109 |
SnappyDataInc/snappydata | core/src/main/java/io/snappydata/util/com/clearspring/analytics/stream/membership/BloomCalculations.java | BloomCalculations.computeBucketsAndK | public static BloomSpecification computeBucketsAndK(double maxFalsePosProb) {
// Handle the trivial cases
if (maxFalsePosProb >= probs[minBuckets][minK]) {
return new BloomSpecification(2, optKPerBuckets[2]);
}
if (maxFalsePosProb < probs[maxBuckets][maxK]) {
return new BloomSpecification(maxK, maxBuckets);
}
// First find the minimal required number of buckets:
int bucketsPerElement = 2;
int K = optKPerBuckets[2];
while (probs[bucketsPerElement][K] > maxFalsePosProb) {
bucketsPerElement++;
K = optKPerBuckets[bucketsPerElement];
}
// Now that the number of buckets is sufficient, see if we can relax K
// without losing too much precision.
while (probs[bucketsPerElement][K - 1] <= maxFalsePosProb) {
K--;
}
return new BloomSpecification(K, bucketsPerElement);
} | java | public static BloomSpecification computeBucketsAndK(double maxFalsePosProb) {
// Handle the trivial cases
if (maxFalsePosProb >= probs[minBuckets][minK]) {
return new BloomSpecification(2, optKPerBuckets[2]);
}
if (maxFalsePosProb < probs[maxBuckets][maxK]) {
return new BloomSpecification(maxK, maxBuckets);
}
// First find the minimal required number of buckets:
int bucketsPerElement = 2;
int K = optKPerBuckets[2];
while (probs[bucketsPerElement][K] > maxFalsePosProb) {
bucketsPerElement++;
K = optKPerBuckets[bucketsPerElement];
}
// Now that the number of buckets is sufficient, see if we can relax K
// without losing too much precision.
while (probs[bucketsPerElement][K - 1] <= maxFalsePosProb) {
K--;
}
return new BloomSpecification(K, bucketsPerElement);
} | [
"public",
"static",
"BloomSpecification",
"computeBucketsAndK",
"(",
"double",
"maxFalsePosProb",
")",
"{",
"// Handle the trivial cases",
"if",
"(",
"maxFalsePosProb",
">=",
"probs",
"[",
"minBuckets",
"]",
"[",
"minK",
"]",
")",
"{",
"return",
"new",
"BloomSpecifi... | Given a maximum tolerable false positive probability, compute a Bloom
specification which will give less than the specified false positive rate,
but minimize the number of buckets per element and the number of hash
functions used. Because bandwidth (and therefore total bitvector size)
is considered more expensive than computing power, preference is given
to minimizing buckets per element rather than number of hash functions.
@param maxFalsePosProb The maximum tolerable false positive rate.
@return A Bloom Specification which would result in a false positive rate
less than specified by the function call. | [
"Given",
"a",
"maximum",
"tolerable",
"false",
"positive",
"probability",
"compute",
"a",
"Bloom",
"specification",
"which",
"will",
"give",
"less",
"than",
"the",
"specified",
"false",
"positive",
"rate",
"but",
"minimize",
"the",
"number",
"of",
"buckets",
"pe... | train | https://github.com/SnappyDataInc/snappydata/blob/96fe3e37e9f8d407ab68ef9e394083960acad21d/core/src/main/java/io/snappydata/util/com/clearspring/analytics/stream/membership/BloomCalculations.java#L114-L137 |
hawkular/hawkular-commons | hawkular-bus/hawkular-bus-common/src/main/java/org/hawkular/bus/common/AbstractMessage.java | AbstractMessage.fromJSON | public static <T extends BasicMessage> T fromJSON(String json, Class<T> clazz) {
try {
Method buildObjectMapperForDeserializationMethod = findBuildObjectMapperForDeserializationMethod(clazz);
final ObjectMapper mapper = (ObjectMapper) buildObjectMapperForDeserializationMethod.invoke(null);
if (FailOnUnknownProperties.class.isAssignableFrom(clazz)) {
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true);
}
return mapper.readValue(json, clazz);
} catch (Exception e) {
throw new IllegalStateException("JSON message cannot be converted to object of type [" + clazz + "]", e);
}
} | java | public static <T extends BasicMessage> T fromJSON(String json, Class<T> clazz) {
try {
Method buildObjectMapperForDeserializationMethod = findBuildObjectMapperForDeserializationMethod(clazz);
final ObjectMapper mapper = (ObjectMapper) buildObjectMapperForDeserializationMethod.invoke(null);
if (FailOnUnknownProperties.class.isAssignableFrom(clazz)) {
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true);
}
return mapper.readValue(json, clazz);
} catch (Exception e) {
throw new IllegalStateException("JSON message cannot be converted to object of type [" + clazz + "]", e);
}
} | [
"public",
"static",
"<",
"T",
"extends",
"BasicMessage",
">",
"T",
"fromJSON",
"(",
"String",
"json",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"try",
"{",
"Method",
"buildObjectMapperForDeserializationMethod",
"=",
"findBuildObjectMapperForDeserializationMeth... | Convenience static method that converts a JSON string to a particular message object.
@param json the JSON string
@param clazz the class whose instance is represented by the JSON string
@return the message object that was represented by the JSON string | [
"Convenience",
"static",
"method",
"that",
"converts",
"a",
"JSON",
"string",
"to",
"a",
"particular",
"message",
"object",
"."
] | train | https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-bus/hawkular-bus-common/src/main/java/org/hawkular/bus/common/AbstractMessage.java#L66-L79 |
davetcc/tcMenu | tcMenuCodePluginApi/src/main/java/com/thecoderscorner/menu/pluginapi/model/FunctionCallBuilder.java | FunctionCallBuilder.requiresHeader | public FunctionCallBuilder requiresHeader(String headerName, boolean useQuotes) {
headers.add(new HeaderDefinition(headerName, useQuotes, HeaderDefinition.PRIORITY_NORMAL));
return this;
} | java | public FunctionCallBuilder requiresHeader(String headerName, boolean useQuotes) {
headers.add(new HeaderDefinition(headerName, useQuotes, HeaderDefinition.PRIORITY_NORMAL));
return this;
} | [
"public",
"FunctionCallBuilder",
"requiresHeader",
"(",
"String",
"headerName",
",",
"boolean",
"useQuotes",
")",
"{",
"headers",
".",
"add",
"(",
"new",
"HeaderDefinition",
"(",
"headerName",
",",
"useQuotes",
",",
"HeaderDefinition",
".",
"PRIORITY_NORMAL",
")",
... | Add a requirement that a header file needs to be included for this to work
@param headerName the name of the header including .h
@param useQuotes true for quotes, false for triangle brackets.
@return this for chaining | [
"Add",
"a",
"requirement",
"that",
"a",
"header",
"file",
"needs",
"to",
"be",
"included",
"for",
"this",
"to",
"work"
] | train | https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuCodePluginApi/src/main/java/com/thecoderscorner/menu/pluginapi/model/FunctionCallBuilder.java#L65-L68 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatednas/src/main/java/net/minidev/ovh/api/ApiOvhDedicatednas.java | ApiOvhDedicatednas.serviceName_partition_partitionName_GET | public OvhPartition serviceName_partition_partitionName_GET(String serviceName, String partitionName) throws IOException {
String qPath = "/dedicated/nas/{serviceName}/partition/{partitionName}";
StringBuilder sb = path(qPath, serviceName, partitionName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPartition.class);
} | java | public OvhPartition serviceName_partition_partitionName_GET(String serviceName, String partitionName) throws IOException {
String qPath = "/dedicated/nas/{serviceName}/partition/{partitionName}";
StringBuilder sb = path(qPath, serviceName, partitionName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPartition.class);
} | [
"public",
"OvhPartition",
"serviceName_partition_partitionName_GET",
"(",
"String",
"serviceName",
",",
"String",
"partitionName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dedicated/nas/{serviceName}/partition/{partitionName}\"",
";",
"StringBuilder",
"sb"... | Get this object properties
REST: GET /dedicated/nas/{serviceName}/partition/{partitionName}
@param serviceName [required] The internal name of your storage
@param partitionName [required] the given name of partition | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatednas/src/main/java/net/minidev/ovh/api/ApiOvhDedicatednas.java#L194-L199 |
apache/predictionio-sdk-java | client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java | EventClient.unsetUserAsFuture | public FutureAPIResponse unsetUserAsFuture(String uid, List<String> properties)
throws IOException {
return unsetUserAsFuture(uid, properties, new DateTime());
} | java | public FutureAPIResponse unsetUserAsFuture(String uid, List<String> properties)
throws IOException {
return unsetUserAsFuture(uid, properties, new DateTime());
} | [
"public",
"FutureAPIResponse",
"unsetUserAsFuture",
"(",
"String",
"uid",
",",
"List",
"<",
"String",
">",
"properties",
")",
"throws",
"IOException",
"{",
"return",
"unsetUserAsFuture",
"(",
"uid",
",",
"properties",
",",
"new",
"DateTime",
"(",
")",
")",
";"... | Sends an unset user properties request. Same as {@link #unsetUserAsFuture(String, List,
DateTime) unsetUserAsFuture(String, List<String>, DateTime)} except event time is not
specified and recorded as the time when the function is called. | [
"Sends",
"an",
"unset",
"user",
"properties",
"request",
".",
"Same",
"as",
"{"
] | train | https://github.com/apache/predictionio-sdk-java/blob/16052c96b136340c175c3f9c2692e720850df219/client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java#L368-L371 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java | DateUtil.between | public static long between(Date beginDate, Date endDate, DateUnit unit, boolean isAbs) {
return new DateBetween(beginDate, endDate, isAbs).between(unit);
} | java | public static long between(Date beginDate, Date endDate, DateUnit unit, boolean isAbs) {
return new DateBetween(beginDate, endDate, isAbs).between(unit);
} | [
"public",
"static",
"long",
"between",
"(",
"Date",
"beginDate",
",",
"Date",
"endDate",
",",
"DateUnit",
"unit",
",",
"boolean",
"isAbs",
")",
"{",
"return",
"new",
"DateBetween",
"(",
"beginDate",
",",
"endDate",
",",
"isAbs",
")",
".",
"between",
"(",
... | 判断两个日期相差的时长
@param beginDate 起始日期
@param endDate 结束日期
@param unit 相差的单位:相差 天{@link DateUnit#DAY}、小时{@link DateUnit#HOUR} 等
@param isAbs 日期间隔是否只保留绝对值正数
@return 日期差
@since 3.3.1 | [
"判断两个日期相差的时长"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java#L1242-L1244 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CompactCharArray.java | CompactCharArray.setElementAt | @Deprecated
public void setElementAt(char start, char end, char value)
{
int i;
if (isCompact) {
expand();
}
for (i = start; i <= end; ++i) {
values[i] = value;
touchBlock(i >> BLOCKSHIFT, value);
}
} | java | @Deprecated
public void setElementAt(char start, char end, char value)
{
int i;
if (isCompact) {
expand();
}
for (i = start; i <= end; ++i) {
values[i] = value;
touchBlock(i >> BLOCKSHIFT, value);
}
} | [
"@",
"Deprecated",
"public",
"void",
"setElementAt",
"(",
"char",
"start",
",",
"char",
"end",
",",
"char",
"value",
")",
"{",
"int",
"i",
";",
"if",
"(",
"isCompact",
")",
"{",
"expand",
"(",
")",
";",
"}",
"for",
"(",
"i",
"=",
"start",
";",
"i... | Set new values for a range of Unicode character.
@param start the starting offset of the range
@param end the ending offset of the range
@param value the new mapped value
@deprecated This API is ICU internal only.
@hide draft / provisional / internal are hidden on Android | [
"Set",
"new",
"values",
"for",
"a",
"range",
"of",
"Unicode",
"character",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CompactCharArray.java#L170-L181 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/query/OJBSearchFilter.java | OJBSearchFilter.matchValue | public void matchValue(String elementName, String value, int oper)
{
// Delete the old search criteria
criteria = new Criteria();
if (oper != NOT_IN)
{
criteria.addEqualTo(elementName, value);
}
else
{
criteria.addNotEqualTo(elementName, value);
}
} | java | public void matchValue(String elementName, String value, int oper)
{
// Delete the old search criteria
criteria = new Criteria();
if (oper != NOT_IN)
{
criteria.addEqualTo(elementName, value);
}
else
{
criteria.addNotEqualTo(elementName, value);
}
} | [
"public",
"void",
"matchValue",
"(",
"String",
"elementName",
",",
"String",
"value",
",",
"int",
"oper",
")",
"{",
"// Delete the old search criteria\r",
"criteria",
"=",
"new",
"Criteria",
"(",
")",
";",
"if",
"(",
"oper",
"!=",
"NOT_IN",
")",
"{",
"criter... | Change the search filter to one that specifies an element to not
match one single value.
The old search filter is deleted.
@param elementName is the name of the element to be matched
@param value is the value to not be matched
@param oper is the IN or NOT_IN operator to indicate how to matche | [
"Change",
"the",
"search",
"filter",
"to",
"one",
"that",
"specifies",
"an",
"element",
"to",
"not",
"match",
"one",
"single",
"value",
".",
"The",
"old",
"search",
"filter",
"is",
"deleted",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/query/OJBSearchFilter.java#L156-L170 |
jbossws/jbossws-spi | src/main/java/org/jboss/wsf/spi/SPIProvider.java | SPIProvider.getSPI | public <T> T getSPI(Class<T> spiType)
{
return getSPI(spiType, SecurityActions.getContextClassLoader());
} | java | public <T> T getSPI(Class<T> spiType)
{
return getSPI(spiType, SecurityActions.getContextClassLoader());
} | [
"public",
"<",
"T",
">",
"T",
"getSPI",
"(",
"Class",
"<",
"T",
">",
"spiType",
")",
"{",
"return",
"getSPI",
"(",
"spiType",
",",
"SecurityActions",
".",
"getContextClassLoader",
"(",
")",
")",
";",
"}"
] | Gets the specified SPI, using the current thread context classloader
@param <T> type of spi class
@param spiType spi class to retrieve
@return object | [
"Gets",
"the",
"specified",
"SPI",
"using",
"the",
"current",
"thread",
"context",
"classloader"
] | train | https://github.com/jbossws/jbossws-spi/blob/845e66c18679ce3aaf76f849822110b4650a9d78/src/main/java/org/jboss/wsf/spi/SPIProvider.java#L59-L62 |
wso2/transport-http | components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/common/Util.java | Util.getIntProperty | public static int getIntProperty(Map<String, Object> properties, String key, int defaultVal) {
if (properties == null) {
return defaultVal;
}
Object propertyVal = properties.get(key);
if (propertyVal == null) {
return defaultVal;
}
if (!(propertyVal instanceof Integer)) {
throw new IllegalArgumentException("Property : " + key + " must be an integer");
}
return (Integer) propertyVal;
} | java | public static int getIntProperty(Map<String, Object> properties, String key, int defaultVal) {
if (properties == null) {
return defaultVal;
}
Object propertyVal = properties.get(key);
if (propertyVal == null) {
return defaultVal;
}
if (!(propertyVal instanceof Integer)) {
throw new IllegalArgumentException("Property : " + key + " must be an integer");
}
return (Integer) propertyVal;
} | [
"public",
"static",
"int",
"getIntProperty",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
",",
"String",
"key",
",",
"int",
"defaultVal",
")",
"{",
"if",
"(",
"properties",
"==",
"null",
")",
"{",
"return",
"defaultVal",
";",
"}",
"Object... | Get integer type property value from a property map.
<p>
If {@code properties} is null or property value is null, default value is returned
@param properties map of properties
@param key property name
@param defaultVal default value of the property
@return integer value of the property, | [
"Get",
"integer",
"type",
"property",
"value",
"from",
"a",
"property",
"map",
".",
"<p",
">",
"If",
"{",
"@code",
"properties",
"}",
"is",
"null",
"or",
"property",
"value",
"is",
"null",
"default",
"value",
"is",
"returned"
] | train | https://github.com/wso2/transport-http/blob/c51aa715b473db6c1b82a7d7b22f6e65f74df4c9/components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/common/Util.java#L407-L424 |
VoltDB/voltdb | src/frontend/org/voltdb/client/VoltBulkLoader/VoltBulkLoader.java | VoltBulkLoader.setFlushInterval | public synchronized void setFlushInterval(long delay, long seconds) {
if (m_flush != null) {
m_flush.cancel(false);
m_flush = null;
}
if (seconds > 0) {
m_flush = m_ses.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
try {
flush();
} catch (Exception e) {
loaderLog.error("Failed to flush loader buffer, some tuples may not be inserted.", e);
}
}
}, delay, seconds, TimeUnit.SECONDS);
}
} | java | public synchronized void setFlushInterval(long delay, long seconds) {
if (m_flush != null) {
m_flush.cancel(false);
m_flush = null;
}
if (seconds > 0) {
m_flush = m_ses.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
try {
flush();
} catch (Exception e) {
loaderLog.error("Failed to flush loader buffer, some tuples may not be inserted.", e);
}
}
}, delay, seconds, TimeUnit.SECONDS);
}
} | [
"public",
"synchronized",
"void",
"setFlushInterval",
"(",
"long",
"delay",
",",
"long",
"seconds",
")",
"{",
"if",
"(",
"m_flush",
"!=",
"null",
")",
"{",
"m_flush",
".",
"cancel",
"(",
"false",
")",
";",
"m_flush",
"=",
"null",
";",
"}",
"if",
"(",
... | Set periodic flush interval and initial delay in seconds.
@param delay Initial delay in seconds
@param seconds Interval in seconds, passing <code>seconds <= 0</code> value will cancel periodic flush | [
"Set",
"periodic",
"flush",
"interval",
"and",
"initial",
"delay",
"in",
"seconds",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/client/VoltBulkLoader/VoltBulkLoader.java#L275-L292 |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/Application.java | Application.registerTemplateEngine | public void registerTemplateEngine(Class<? extends TemplateEngine> engineClass) {
if (templateEngine != null) {
log.debug("Template engine already registered, ignoring '{}'", engineClass.getName());
return;
}
try {
TemplateEngine engine = engineClass.newInstance();
setTemplateEngine(engine);
} catch (Exception e) {
throw new PippoRuntimeException(e, "Failed to instantiate '{}'", engineClass.getName());
}
} | java | public void registerTemplateEngine(Class<? extends TemplateEngine> engineClass) {
if (templateEngine != null) {
log.debug("Template engine already registered, ignoring '{}'", engineClass.getName());
return;
}
try {
TemplateEngine engine = engineClass.newInstance();
setTemplateEngine(engine);
} catch (Exception e) {
throw new PippoRuntimeException(e, "Failed to instantiate '{}'", engineClass.getName());
}
} | [
"public",
"void",
"registerTemplateEngine",
"(",
"Class",
"<",
"?",
"extends",
"TemplateEngine",
">",
"engineClass",
")",
"{",
"if",
"(",
"templateEngine",
"!=",
"null",
")",
"{",
"log",
".",
"debug",
"(",
"\"Template engine already registered, ignoring '{}'\"",
","... | Registers a template engine if no other engine has been registered.
@param engineClass | [
"Registers",
"a",
"template",
"engine",
"if",
"no",
"other",
"engine",
"has",
"been",
"registered",
"."
] | train | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/Application.java#L181-L193 |
Netflix/spectator | spectator-ext-ipc/src/main/java/com/netflix/spectator/ipc/IpcLogEntry.java | IpcLogEntry.addRequestHeader | public IpcLogEntry addRequestHeader(String name, String value) {
if (clientAsg == null && name.equalsIgnoreCase(NetflixHeader.ASG.headerName())) {
withClientAsg(value);
} else if (clientZone == null && name.equalsIgnoreCase(NetflixHeader.Zone.headerName())) {
withClientZone(value);
} else if (clientNode == null && name.equalsIgnoreCase(NetflixHeader.Node.headerName())) {
withClientNode(value);
} else if (vip == null && name.equalsIgnoreCase(NetflixHeader.Vip.headerName())) {
withVip(value);
} else {
this.requestHeaders.add(new Header(name, value));
}
return this;
} | java | public IpcLogEntry addRequestHeader(String name, String value) {
if (clientAsg == null && name.equalsIgnoreCase(NetflixHeader.ASG.headerName())) {
withClientAsg(value);
} else if (clientZone == null && name.equalsIgnoreCase(NetflixHeader.Zone.headerName())) {
withClientZone(value);
} else if (clientNode == null && name.equalsIgnoreCase(NetflixHeader.Node.headerName())) {
withClientNode(value);
} else if (vip == null && name.equalsIgnoreCase(NetflixHeader.Vip.headerName())) {
withVip(value);
} else {
this.requestHeaders.add(new Header(name, value));
}
return this;
} | [
"public",
"IpcLogEntry",
"addRequestHeader",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"if",
"(",
"clientAsg",
"==",
"null",
"&&",
"name",
".",
"equalsIgnoreCase",
"(",
"NetflixHeader",
".",
"ASG",
".",
"headerName",
"(",
")",
")",
")",
"{",... | Add a request header value. For special headers in {@link NetflixHeader} it will
automatically fill in the more specific fields based on the header values. | [
"Add",
"a",
"request",
"header",
"value",
".",
"For",
"special",
"headers",
"in",
"{"
] | train | https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-ipc/src/main/java/com/netflix/spectator/ipc/IpcLogEntry.java#L503-L516 |
CodeNarc/CodeNarc | src/main/java/org/codenarc/util/AstUtil.java | AstUtil.isMethodCall | public static boolean isMethodCall(Expression expression, String methodObject, String methodName, int numArguments) {
return expression instanceof MethodCallExpression && isMethodCall((MethodCallExpression) expression, methodObject, methodName, numArguments);
} | java | public static boolean isMethodCall(Expression expression, String methodObject, String methodName, int numArguments) {
return expression instanceof MethodCallExpression && isMethodCall((MethodCallExpression) expression, methodObject, methodName, numArguments);
} | [
"public",
"static",
"boolean",
"isMethodCall",
"(",
"Expression",
"expression",
",",
"String",
"methodObject",
",",
"String",
"methodName",
",",
"int",
"numArguments",
")",
"{",
"return",
"expression",
"instanceof",
"MethodCallExpression",
"&&",
"isMethodCall",
"(",
... | Return true only if the expression is a MethodCallExpression representing a method call for the specified
method object (receiver), method name, and with the specified number of arguments.
@param expression - the AST expression
@param methodObject - the name of the method object (receiver)
@param methodName - the name of the method being called
@param numArguments - the number of arguments passed into the method
@return true only if the method call matches the specified criteria | [
"Return",
"true",
"only",
"if",
"the",
"expression",
"is",
"a",
"MethodCallExpression",
"representing",
"a",
"method",
"call",
"for",
"the",
"specified",
"method",
"object",
"(",
"receiver",
")",
"method",
"name",
"and",
"with",
"the",
"specified",
"number",
"... | train | https://github.com/CodeNarc/CodeNarc/blob/9a7cec02cb8cbaf845030f2434309e8968f5d7a7/src/main/java/org/codenarc/util/AstUtil.java#L324-L326 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/cli/CliClient.java | CliClient.subColumnNameAsBytes | private ByteBuffer subColumnNameAsBytes(String superColumn, String columnFamily)
{
CfDef columnFamilyDef = getCfDef(columnFamily);
return subColumnNameAsBytes(superColumn, columnFamilyDef);
} | java | private ByteBuffer subColumnNameAsBytes(String superColumn, String columnFamily)
{
CfDef columnFamilyDef = getCfDef(columnFamily);
return subColumnNameAsBytes(superColumn, columnFamilyDef);
} | [
"private",
"ByteBuffer",
"subColumnNameAsBytes",
"(",
"String",
"superColumn",
",",
"String",
"columnFamily",
")",
"{",
"CfDef",
"columnFamilyDef",
"=",
"getCfDef",
"(",
"columnFamily",
")",
";",
"return",
"subColumnNameAsBytes",
"(",
"superColumn",
",",
"columnFamily... | Converts sub-column name into ByteBuffer according to comparator type
@param superColumn - sub-column name from parser
@param columnFamily - column family name from parser
@return ByteBuffer bytes - into which column name was converted according to comparator type | [
"Converts",
"sub",
"-",
"column",
"name",
"into",
"ByteBuffer",
"according",
"to",
"comparator",
"type"
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/cli/CliClient.java#L2617-L2621 |
codegist/crest | core/src/main/java/org/codegist/crest/util/Pairs.java | Pairs.toPair | public static EncodedPair toPair(String name, String value, Charset charset, boolean encoded) throws UnsupportedEncodingException {
String nameEncoded;
String valueEncoded;
if(encoded){
nameEncoded = name;
valueEncoded = value;
}else{
nameEncoded = encode(name, charset);
valueEncoded = encode(value, charset);
}
return new SimpleEncodedPair(nameEncoded, valueEncoded);
} | java | public static EncodedPair toPair(String name, String value, Charset charset, boolean encoded) throws UnsupportedEncodingException {
String nameEncoded;
String valueEncoded;
if(encoded){
nameEncoded = name;
valueEncoded = value;
}else{
nameEncoded = encode(name, charset);
valueEncoded = encode(value, charset);
}
return new SimpleEncodedPair(nameEncoded, valueEncoded);
} | [
"public",
"static",
"EncodedPair",
"toPair",
"(",
"String",
"name",
",",
"String",
"value",
",",
"Charset",
"charset",
",",
"boolean",
"encoded",
")",
"throws",
"UnsupportedEncodingException",
"{",
"String",
"nameEncoded",
";",
"String",
"valueEncoded",
";",
"if",... | <p>Returns a EncodedPair with the given name/value.</p>
<p>The encoded flag indicates if name/value need to be encoded with the given charset.</p>
@param name name to encode if encoded is set to true
@param value value to encode if encoded is set to true
@param charset charset to use while encoding the name/value if encoded is set to true
@param encoded if true, name/value will be encoded
@return the encoded pair object
@throws UnsupportedEncodingException When the given charset is not supported | [
"<p",
">",
"Returns",
"a",
"EncodedPair",
"with",
"the",
"given",
"name",
"/",
"value",
".",
"<",
"/",
"p",
">",
"<p",
">",
"The",
"encoded",
"flag",
"indicates",
"if",
"name",
"/",
"value",
"need",
"to",
"be",
"encoded",
"with",
"the",
"given",
"cha... | train | https://github.com/codegist/crest/blob/e99ba7728b27d2ddb2c247261350f1b6fa7a6698/core/src/main/java/org/codegist/crest/util/Pairs.java#L81-L92 |
hdbeukel/james-extensions | src/main/java/org/jamesframework/ext/permutation/neigh/SingleSwapNeighbourhood.java | SingleSwapNeighbourhood.getAllMoves | @Override
public List<SingleSwapMove> getAllMoves(PermutationSolution solution) {
// initialize list
List<SingleSwapMove> moves = new ArrayList<>();
int n = solution.size();
for(int i=0; i<n; i++){
for(int j=i+1; j<n; j++){
moves.add(new SingleSwapMove(i, j));
}
}
return moves;
} | java | @Override
public List<SingleSwapMove> getAllMoves(PermutationSolution solution) {
// initialize list
List<SingleSwapMove> moves = new ArrayList<>();
int n = solution.size();
for(int i=0; i<n; i++){
for(int j=i+1; j<n; j++){
moves.add(new SingleSwapMove(i, j));
}
}
return moves;
} | [
"@",
"Override",
"public",
"List",
"<",
"SingleSwapMove",
">",
"getAllMoves",
"(",
"PermutationSolution",
"solution",
")",
"{",
"// initialize list",
"List",
"<",
"SingleSwapMove",
">",
"moves",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"int",
"n",
"=",
... | Create a list of all possible single swap moves. A move is generated
for each pair of distinct positions i,j (i<j) in the given permutation.
@param solution permutation solution to which the move is to be applied
@return list of all possible single swap moves | [
"Create",
"a",
"list",
"of",
"all",
"possible",
"single",
"swap",
"moves",
".",
"A",
"move",
"is",
"generated",
"for",
"each",
"pair",
"of",
"distinct",
"positions",
"i",
"j",
"(",
"i<",
";",
"j",
")",
"in",
"the",
"given",
"permutation",
"."
] | train | https://github.com/hdbeukel/james-extensions/blob/37a43aa6ac4d67575cabc7aed25fd96c91d4c7b2/src/main/java/org/jamesframework/ext/permutation/neigh/SingleSwapNeighbourhood.java#L65-L76 |
database-rider/database-rider | rider-cdi/src/main/java/com/github/database/rider/cdi/DataSetProcessor.java | DataSetProcessor.createConnection | private Connection createConnection() {
try {
EntityTransaction tx = this.em.getTransaction();
if (isHibernatePresentOnClasspath() && em.getDelegate() instanceof Session) {
connection = ((SessionImpl) em.unwrap(Session.class)).connection();
} else {
/**
* see here:http://wiki.eclipse.org/EclipseLink/Examples/JPA/EMAPI#Getting_a_JDBC_Connection_from_an_EntityManager
*/
tx.begin();
connection = em.unwrap(Connection.class);
tx.commit();
}
} catch (Exception e) {
throw new RuntimeException("Could not create database connection", e);
}
return connection;
} | java | private Connection createConnection() {
try {
EntityTransaction tx = this.em.getTransaction();
if (isHibernatePresentOnClasspath() && em.getDelegate() instanceof Session) {
connection = ((SessionImpl) em.unwrap(Session.class)).connection();
} else {
/**
* see here:http://wiki.eclipse.org/EclipseLink/Examples/JPA/EMAPI#Getting_a_JDBC_Connection_from_an_EntityManager
*/
tx.begin();
connection = em.unwrap(Connection.class);
tx.commit();
}
} catch (Exception e) {
throw new RuntimeException("Could not create database connection", e);
}
return connection;
} | [
"private",
"Connection",
"createConnection",
"(",
")",
"{",
"try",
"{",
"EntityTransaction",
"tx",
"=",
"this",
".",
"em",
".",
"getTransaction",
"(",
")",
";",
"if",
"(",
"isHibernatePresentOnClasspath",
"(",
")",
"&&",
"em",
".",
"getDelegate",
"(",
")",
... | unfortunately there is no standard way to get jdbc connection from JPA entity manager
@return JDBC connection | [
"unfortunately",
"there",
"is",
"no",
"standard",
"way",
"to",
"get",
"jdbc",
"connection",
"from",
"JPA",
"entity",
"manager"
] | train | https://github.com/database-rider/database-rider/blob/7545cc31118df9cfef3f89e27223b433a24fb5dd/rider-cdi/src/main/java/com/github/database/rider/cdi/DataSetProcessor.java#L59-L77 |
aws/aws-sdk-java | aws-java-sdk-core/src/main/java/com/amazonaws/auth/profile/internal/BasicProfileConfigLoader.java | BasicProfileConfigLoader.assertParameterNotEmpty | private void assertParameterNotEmpty(String parameterValue, String errorMessage) {
if (StringUtils.isNullOrEmpty(parameterValue)) {
throw new SdkClientException(errorMessage);
}
} | java | private void assertParameterNotEmpty(String parameterValue, String errorMessage) {
if (StringUtils.isNullOrEmpty(parameterValue)) {
throw new SdkClientException(errorMessage);
}
} | [
"private",
"void",
"assertParameterNotEmpty",
"(",
"String",
"parameterValue",
",",
"String",
"errorMessage",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isNullOrEmpty",
"(",
"parameterValue",
")",
")",
"{",
"throw",
"new",
"SdkClientException",
"(",
"errorMessage",
... | <p> Asserts that the specified parameter value is neither <code>empty</code> nor null, and if
it is, throws a <code>SdkClientException</code> with the specified error message. </p>
@param parameterValue The parameter value being checked.
@param errorMessage The error message to include in the SdkClientException if the
specified parameter value is empty. | [
"<p",
">",
"Asserts",
"that",
"the",
"specified",
"parameter",
"value",
"is",
"neither",
"<code",
">",
"empty<",
"/",
"code",
">",
"nor",
"null",
"and",
"if",
"it",
"is",
"throws",
"a",
"<code",
">",
"SdkClientException<",
"/",
"code",
">",
"with",
"the"... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/auth/profile/internal/BasicProfileConfigLoader.java#L118-L122 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/particles/Particle.java | Particle.setVelocity | public void setVelocity(float dirx, float diry, float speed) {
this.velx = dirx * speed;
this.vely = diry * speed;
} | java | public void setVelocity(float dirx, float diry, float speed) {
this.velx = dirx * speed;
this.vely = diry * speed;
} | [
"public",
"void",
"setVelocity",
"(",
"float",
"dirx",
",",
"float",
"diry",
",",
"float",
"speed",
")",
"{",
"this",
".",
"velx",
"=",
"dirx",
"*",
"speed",
";",
"this",
".",
"vely",
"=",
"diry",
"*",
"speed",
";",
"}"
] | Set the velocity of the particle
@param dirx
The x component of the new velocity
@param diry
The y component of the new velocity
@param speed
The speed in the given direction | [
"Set",
"the",
"velocity",
"of",
"the",
"particle"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/particles/Particle.java#L352-L355 |
BioPAX/Paxtools | pattern/src/main/java/org/biopax/paxtools/pattern/PatternBox.java | PatternBox.modifierConv | public static Pattern modifierConv()
{
Pattern p = new Pattern(EntityReference.class, "ER");
p.add(erToPE(), "ER", "SPE");
p.add(linkToComplex(), "SPE", "PE");
p.add(participatesInConv(), "PE", "Conversion");
return p;
} | java | public static Pattern modifierConv()
{
Pattern p = new Pattern(EntityReference.class, "ER");
p.add(erToPE(), "ER", "SPE");
p.add(linkToComplex(), "SPE", "PE");
p.add(participatesInConv(), "PE", "Conversion");
return p;
} | [
"public",
"static",
"Pattern",
"modifierConv",
"(",
")",
"{",
"Pattern",
"p",
"=",
"new",
"Pattern",
"(",
"EntityReference",
".",
"class",
",",
"\"ER\"",
")",
";",
"p",
".",
"add",
"(",
"erToPE",
"(",
")",
",",
"\"ER\"",
",",
"\"SPE\"",
")",
";",
"p"... | Pattern for finding Conversions that an EntityReference is participating.
@return the pattern | [
"Pattern",
"for",
"finding",
"Conversions",
"that",
"an",
"EntityReference",
"is",
"participating",
"."
] | train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/PatternBox.java#L830-L837 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/URIDestinationCreator.java | URIDestinationCreator.createDestinationFromString | public Destination createDestinationFromString(String uri, DestType destType) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "createDestinationFromString", new Object[]{uri, destType});
JmsDestination result = null;
// throw exception if URI begins with illegal string
if (uri.startsWith(JmsDestinationImpl.DEST_PREFIX)) {
throw (JMSException) JmsErrorUtils.newThrowable(
JMSException.class,
"RESERVED_DEST_PREFIX_CWSIA0383",
new Object[] { JmsDestinationImpl.DEST_PREFIX, uri },
tc);
}
// Decide which method should process the URI, determined on its prefix.
if (uri.startsWith(JmsQueueImpl.QUEUE_PREFIX) || uri.startsWith(JmsTopicImpl.TOPIC_PREFIX)) {
result = processURI(uri, QM_ERROR, null);
}
else {
if (destType == DestType.QUEUE) {
JmsQueueImpl q = new JmsQueueImpl();
q.setQueueName(uri);
result = q;
}
else {
// processShortopicForm processes the optional @topicspace element.
result = processShortTopicForm(uri);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "createDestinationFromString", result);
return result;
} | java | public Destination createDestinationFromString(String uri, DestType destType) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "createDestinationFromString", new Object[]{uri, destType});
JmsDestination result = null;
// throw exception if URI begins with illegal string
if (uri.startsWith(JmsDestinationImpl.DEST_PREFIX)) {
throw (JMSException) JmsErrorUtils.newThrowable(
JMSException.class,
"RESERVED_DEST_PREFIX_CWSIA0383",
new Object[] { JmsDestinationImpl.DEST_PREFIX, uri },
tc);
}
// Decide which method should process the URI, determined on its prefix.
if (uri.startsWith(JmsQueueImpl.QUEUE_PREFIX) || uri.startsWith(JmsTopicImpl.TOPIC_PREFIX)) {
result = processURI(uri, QM_ERROR, null);
}
else {
if (destType == DestType.QUEUE) {
JmsQueueImpl q = new JmsQueueImpl();
q.setQueueName(uri);
result = q;
}
else {
// processShortopicForm processes the optional @topicspace element.
result = processShortTopicForm(uri);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "createDestinationFromString", result);
return result;
} | [
"public",
"Destination",
"createDestinationFromString",
"(",
"String",
"uri",
",",
"DestType",
"destType",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"S... | This is the method called from JmsSessionImpl.createQueue()|Topic().
The URI passed is first examined, and then the processing is delegated
to one of the more specific methods.
The only real processing done in this method is to remove any arbitrary
escape characters (see code comment below for more detail).
@param uri The URI from which to create the Destination
@param destType String indicating Topic or Queue
@throws JMSException if problems occure creating Destination from URI
@return Object The fully configured Destination | [
"This",
"is",
"the",
"method",
"called",
"from",
"JmsSessionImpl",
".",
"createQueue",
"()",
"|Topic",
"()",
".",
"The",
"URI",
"passed",
"is",
"first",
"examined",
"and",
"then",
"the",
"processing",
"is",
"delegated",
"to",
"one",
"of",
"the",
"more",
"s... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/URIDestinationCreator.java#L148-L179 |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/main/MainScene.java | MainScene.addChildObjectToCamera | public void addChildObjectToCamera(final Widget child, int camera) {
switch (camera) {
case LEFT_CAMERA:
mLeftCameraRootWidget.addChild(child);
break;
case RIGHT_CAMERA:
mRightCameraRootWidget.addChild(child);
break;
default:
mMainCameraRootWidget.addChild(child);
break;
}
} | java | public void addChildObjectToCamera(final Widget child, int camera) {
switch (camera) {
case LEFT_CAMERA:
mLeftCameraRootWidget.addChild(child);
break;
case RIGHT_CAMERA:
mRightCameraRootWidget.addChild(child);
break;
default:
mMainCameraRootWidget.addChild(child);
break;
}
} | [
"public",
"void",
"addChildObjectToCamera",
"(",
"final",
"Widget",
"child",
",",
"int",
"camera",
")",
"{",
"switch",
"(",
"camera",
")",
"{",
"case",
"LEFT_CAMERA",
":",
"mLeftCameraRootWidget",
".",
"addChild",
"(",
"child",
")",
";",
"break",
";",
"case"... | Adds a scene object to one or both of the left and right cameras.
@param child The {@link Widget} to add.
@param camera {@link #LEFT_CAMERA} or {@link #RIGHT_CAMERA}; these can be
or'd together to add {@code child} to both cameras. | [
"Adds",
"a",
"scene",
"object",
"to",
"one",
"or",
"both",
"of",
"the",
"left",
"and",
"right",
"cameras",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/main/MainScene.java#L376-L388 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTableRowRenderer.java | WTableRowRenderer.getExpandedTreeNodeRenderer | public WComponent getExpandedTreeNodeRenderer(final Class<? extends WComponent> rendererClass) {
if (rendererClass == null) {
return null;
}
// If we already have an additional renderer for this class, return it.
// This is synchronized, as it updates the shared model using locking/unlocking, which is a bit dodgy.
synchronized (expandedRenderers) {
WComponent renderer = expandedRenderers.get(rendererClass);
if (renderer != null) {
return renderer;
}
// Not found, create a new instance of the given class
renderer = new RendererWrapper(this, rendererClass, -1);
expandedRenderers.put(rendererClass, renderer);
setLocked(false);
add(renderer);
setLocked(true);
return renderer;
}
} | java | public WComponent getExpandedTreeNodeRenderer(final Class<? extends WComponent> rendererClass) {
if (rendererClass == null) {
return null;
}
// If we already have an additional renderer for this class, return it.
// This is synchronized, as it updates the shared model using locking/unlocking, which is a bit dodgy.
synchronized (expandedRenderers) {
WComponent renderer = expandedRenderers.get(rendererClass);
if (renderer != null) {
return renderer;
}
// Not found, create a new instance of the given class
renderer = new RendererWrapper(this, rendererClass, -1);
expandedRenderers.put(rendererClass, renderer);
setLocked(false);
add(renderer);
setLocked(true);
return renderer;
}
} | [
"public",
"WComponent",
"getExpandedTreeNodeRenderer",
"(",
"final",
"Class",
"<",
"?",
"extends",
"WComponent",
">",
"rendererClass",
")",
"{",
"if",
"(",
"rendererClass",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"// If we already have an additional rend... | <p>
This is called to lazily add expanded renderers as necessary. To save memory, only one instance of a renderer
class is ever added to the row renderer instance. The RendererWrapper ensures that data binding occurs at the
right time.
</p>
@param rendererClass the renderer class.
@return the expanded renderer for the given row. | [
"<p",
">",
"This",
"is",
"called",
"to",
"lazily",
"add",
"expanded",
"renderers",
"as",
"necessary",
".",
"To",
"save",
"memory",
"only",
"one",
"instance",
"of",
"a",
"renderer",
"class",
"is",
"ever",
"added",
"to",
"the",
"row",
"renderer",
"instance",... | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTableRowRenderer.java#L96-L119 |
arturmkrtchyan/iban4j | src/main/java/org/iban4j/IbanUtil.java | IbanUtil.replaceCheckDigit | static String replaceCheckDigit(final String iban, final String checkDigit) {
return getCountryCode(iban) + checkDigit + getBban(iban);
} | java | static String replaceCheckDigit(final String iban, final String checkDigit) {
return getCountryCode(iban) + checkDigit + getBban(iban);
} | [
"static",
"String",
"replaceCheckDigit",
"(",
"final",
"String",
"iban",
",",
"final",
"String",
"checkDigit",
")",
"{",
"return",
"getCountryCode",
"(",
"iban",
")",
"+",
"checkDigit",
"+",
"getBban",
"(",
"iban",
")",
";",
"}"
] | Returns an iban with replaced check digit.
@param iban The iban
@return The iban without the check digit | [
"Returns",
"an",
"iban",
"with",
"replaced",
"check",
"digit",
"."
] | train | https://github.com/arturmkrtchyan/iban4j/blob/9889e8873c4ba5c34fc61d17594af935d2ca28a3/src/main/java/org/iban4j/IbanUtil.java#L261-L263 |
TimeAndSpaceIO/SmoothieMap | src/main/java/net/openhft/smoothie/SmoothieMap.java | SmoothieMap.computeIfAbsent | @Override
public final V computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction) {
if (mappingFunction == null)
throw new NullPointerException();
long hash;
return segment(segmentIndex(hash = keyHashCode(key)))
.computeIfAbsent(this, hash, key, mappingFunction);
} | java | @Override
public final V computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction) {
if (mappingFunction == null)
throw new NullPointerException();
long hash;
return segment(segmentIndex(hash = keyHashCode(key)))
.computeIfAbsent(this, hash, key, mappingFunction);
} | [
"@",
"Override",
"public",
"final",
"V",
"computeIfAbsent",
"(",
"K",
"key",
",",
"Function",
"<",
"?",
"super",
"K",
",",
"?",
"extends",
"V",
">",
"mappingFunction",
")",
"{",
"if",
"(",
"mappingFunction",
"==",
"null",
")",
"throw",
"new",
"NullPointe... | If the specified key is not already associated with a value (or is mapped to {@code null}),
attempts to compute its value using the given mapping function and enters it into this map
unless {@code null}.
<p>If the function returns {@code null} no mapping is recorded. If the function itself throws
an (unchecked) exception, the exception is rethrown, and no mapping is recorded. The most
common usage is to construct a new object serving as an initial mapped value or memoized
result, as in:
<pre> {@code
map.computeIfAbsent(key, k -> new Value(f(k)));
}</pre>
<p>Or to implement a multi-value map, {@code Map<K,Collection<V>>},
supporting multiple values per key:
<pre> {@code
map.computeIfAbsent(key, k -> new HashSet<V>()).add(v);
}</pre>
@param key key with which the specified value is to be associated
@param mappingFunction the function to compute a value
@return the current (existing or computed) value associated with
the specified key, or null if the computed value is null
@throws NullPointerException if the mappingFunction is null | [
"If",
"the",
"specified",
"key",
"is",
"not",
"already",
"associated",
"with",
"a",
"value",
"(",
"or",
"is",
"mapped",
"to",
"{",
"@code",
"null",
"}",
")",
"attempts",
"to",
"compute",
"its",
"value",
"using",
"the",
"given",
"mapping",
"function",
"an... | train | https://github.com/TimeAndSpaceIO/SmoothieMap/blob/c798f6cae1d377f6913e8821a1fcf5bf45ee0412/src/main/java/net/openhft/smoothie/SmoothieMap.java#L905-L912 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/flow/cdi/FlowBuilderCDIExtension.java | FlowBuilderCDIExtension.findFlowDefinition | <T> void findFlowDefinition(@Observes ProcessProducer<T, Flow> processProducer)
{
if (processProducer.getAnnotatedMember().isAnnotationPresent(FlowDefinition.class))
{
flowProducers.add(processProducer.getProducer());
}
} | java | <T> void findFlowDefinition(@Observes ProcessProducer<T, Flow> processProducer)
{
if (processProducer.getAnnotatedMember().isAnnotationPresent(FlowDefinition.class))
{
flowProducers.add(processProducer.getProducer());
}
} | [
"<",
"T",
">",
"void",
"findFlowDefinition",
"(",
"@",
"Observes",
"ProcessProducer",
"<",
"T",
",",
"Flow",
">",
"processProducer",
")",
"{",
"if",
"(",
"processProducer",
".",
"getAnnotatedMember",
"(",
")",
".",
"isAnnotationPresent",
"(",
"FlowDefinition",
... | Stores any producer method that is annotated with @FlowDefinition. | [
"Stores",
"any",
"producer",
"method",
"that",
"is",
"annotated",
"with"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/flow/cdi/FlowBuilderCDIExtension.java#L72-L78 |
aws/aws-sdk-java | aws-java-sdk-costexplorer/src/main/java/com/amazonaws/services/costexplorer/model/DimensionValuesWithAttributes.java | DimensionValuesWithAttributes.withAttributes | public DimensionValuesWithAttributes withAttributes(java.util.Map<String, String> attributes) {
setAttributes(attributes);
return this;
} | java | public DimensionValuesWithAttributes withAttributes(java.util.Map<String, String> attributes) {
setAttributes(attributes);
return this;
} | [
"public",
"DimensionValuesWithAttributes",
"withAttributes",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"attributes",
")",
"{",
"setAttributes",
"(",
"attributes",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The attribute that applies to a specific <code>Dimension</code>.
</p>
@param attributes
The attribute that applies to a specific <code>Dimension</code>.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"attribute",
"that",
"applies",
"to",
"a",
"specific",
"<code",
">",
"Dimension<",
"/",
"code",
">",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-costexplorer/src/main/java/com/amazonaws/services/costexplorer/model/DimensionValuesWithAttributes.java#L120-L123 |
apache/spark | common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleBlockResolver.java | ExternalShuffleBlockResolver.getSortBasedShuffleBlockData | private ManagedBuffer getSortBasedShuffleBlockData(
ExecutorShuffleInfo executor, int shuffleId, int mapId, int reduceId) {
File indexFile = getFile(executor.localDirs, executor.subDirsPerLocalDir,
"shuffle_" + shuffleId + "_" + mapId + "_0.index");
try {
ShuffleIndexInformation shuffleIndexInformation = shuffleIndexCache.get(indexFile);
ShuffleIndexRecord shuffleIndexRecord = shuffleIndexInformation.getIndex(reduceId);
return new FileSegmentManagedBuffer(
conf,
getFile(executor.localDirs, executor.subDirsPerLocalDir,
"shuffle_" + shuffleId + "_" + mapId + "_0.data"),
shuffleIndexRecord.getOffset(),
shuffleIndexRecord.getLength());
} catch (ExecutionException e) {
throw new RuntimeException("Failed to open file: " + indexFile, e);
}
} | java | private ManagedBuffer getSortBasedShuffleBlockData(
ExecutorShuffleInfo executor, int shuffleId, int mapId, int reduceId) {
File indexFile = getFile(executor.localDirs, executor.subDirsPerLocalDir,
"shuffle_" + shuffleId + "_" + mapId + "_0.index");
try {
ShuffleIndexInformation shuffleIndexInformation = shuffleIndexCache.get(indexFile);
ShuffleIndexRecord shuffleIndexRecord = shuffleIndexInformation.getIndex(reduceId);
return new FileSegmentManagedBuffer(
conf,
getFile(executor.localDirs, executor.subDirsPerLocalDir,
"shuffle_" + shuffleId + "_" + mapId + "_0.data"),
shuffleIndexRecord.getOffset(),
shuffleIndexRecord.getLength());
} catch (ExecutionException e) {
throw new RuntimeException("Failed to open file: " + indexFile, e);
}
} | [
"private",
"ManagedBuffer",
"getSortBasedShuffleBlockData",
"(",
"ExecutorShuffleInfo",
"executor",
",",
"int",
"shuffleId",
",",
"int",
"mapId",
",",
"int",
"reduceId",
")",
"{",
"File",
"indexFile",
"=",
"getFile",
"(",
"executor",
".",
"localDirs",
",",
"execut... | Sort-based shuffle data uses an index called "shuffle_ShuffleId_MapId_0.index" into a data file
called "shuffle_ShuffleId_MapId_0.data". This logic is from IndexShuffleBlockResolver,
and the block id format is from ShuffleDataBlockId and ShuffleIndexBlockId. | [
"Sort",
"-",
"based",
"shuffle",
"data",
"uses",
"an",
"index",
"called",
"shuffle_ShuffleId_MapId_0",
".",
"index",
"into",
"a",
"data",
"file",
"called",
"shuffle_ShuffleId_MapId_0",
".",
"data",
".",
"This",
"logic",
"is",
"from",
"IndexShuffleBlockResolver",
"... | train | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleBlockResolver.java#L282-L299 |
Azure/azure-sdk-for-java | keyvault/resource-manager/v2016_10_01/src/main/java/com/microsoft/azure/management/keyvault/v2016_10_01/implementation/VaultsInner.java | VaultsInner.beginPurgeDeletedAsync | public Observable<Void> beginPurgeDeletedAsync(String vaultName, String location) {
return beginPurgeDeletedWithServiceResponseAsync(vaultName, location).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> beginPurgeDeletedAsync(String vaultName, String location) {
return beginPurgeDeletedWithServiceResponseAsync(vaultName, location).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"beginPurgeDeletedAsync",
"(",
"String",
"vaultName",
",",
"String",
"location",
")",
"{",
"return",
"beginPurgeDeletedWithServiceResponseAsync",
"(",
"vaultName",
",",
"location",
")",
".",
"map",
"(",
"new",
"Func1",
"<"... | Permanently deletes the specified vault. aka Purges the deleted Azure key vault.
@param vaultName The name of the soft-deleted vault.
@param location The location of the soft-deleted vault.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Permanently",
"deletes",
"the",
"specified",
"vault",
".",
"aka",
"Purges",
"the",
"deleted",
"Azure",
"key",
"vault",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/resource-manager/v2016_10_01/src/main/java/com/microsoft/azure/management/keyvault/v2016_10_01/implementation/VaultsInner.java#L1346-L1353 |
javalite/activejdbc | activejdbc/src/main/java/org/javalite/activejdbc/Base.java | Base.find | public static void find(String sql, RowListener listener) {
new DB(DB.DEFAULT_NAME).find(sql, listener);
} | java | public static void find(String sql, RowListener listener) {
new DB(DB.DEFAULT_NAME).find(sql, listener);
} | [
"public",
"static",
"void",
"find",
"(",
"String",
"sql",
",",
"RowListener",
"listener",
")",
"{",
"new",
"DB",
"(",
"DB",
".",
"DEFAULT_NAME",
")",
".",
"find",
"(",
"sql",
",",
"listener",
")",
";",
"}"
] | Executes a raw query and calls instance of <code>RowListener</code> with every row found.
Use this method for very large result sets.
@param sql raw SQL query.
@param listener client listener implementation for processing individual rows. | [
"Executes",
"a",
"raw",
"query",
"and",
"calls",
"instance",
"of",
"<code",
">",
"RowListener<",
"/",
"code",
">",
"with",
"every",
"row",
"found",
".",
"Use",
"this",
"method",
"for",
"very",
"large",
"result",
"sets",
"."
] | train | https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/Base.java#L256-L258 |
shrinkwrap/resolver | maven/impl-maven-archive/src/main/java/org/jboss/shrinkwrap/resolver/impl/maven/archive/packaging/ManifestAsset.java | ManifestAsset.manifestAsString | private static String manifestAsString(Manifest manifest) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
manifest.write(baos);
return baos.toString("UTF-8");
} catch (IOException e) {
throw new IllegalStateException("Unable to write MANIFEST.MF to an archive Asset", e);
} finally {
try {
baos.close();
} catch (IOException e) {
}
}
} | java | private static String manifestAsString(Manifest manifest) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
manifest.write(baos);
return baos.toString("UTF-8");
} catch (IOException e) {
throw new IllegalStateException("Unable to write MANIFEST.MF to an archive Asset", e);
} finally {
try {
baos.close();
} catch (IOException e) {
}
}
} | [
"private",
"static",
"String",
"manifestAsString",
"(",
"Manifest",
"manifest",
")",
"{",
"ByteArrayOutputStream",
"baos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"try",
"{",
"manifest",
".",
"write",
"(",
"baos",
")",
";",
"return",
"baos",
".",
... | Conversion method from Manifest to String.
@param manifest Manifest to be transformed into String
@return String representation of the Manifest | [
"Conversion",
"method",
"from",
"Manifest",
"to",
"String",
"."
] | train | https://github.com/shrinkwrap/resolver/blob/e881a84b8cff5b0a014f2a5ebf612be3eb9db01f/maven/impl-maven-archive/src/main/java/org/jboss/shrinkwrap/resolver/impl/maven/archive/packaging/ManifestAsset.java#L48-L62 |
OpenLiberty/open-liberty | dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/internal/AppliesToProcessor.java | AppliesToProcessor.validateEditions | public static void validateEditions(AppliesToFilterInfo info, String appliesToHeader) throws RepositoryResourceCreationException {
if (info.getRawEditions() != null) {
for (String rawEdition : info.getRawEditions()) {
List<String> mappedEditions = mapRawEditionToHumanReadable(rawEdition);
if (mappedEditions.size() == 1 && mappedEditions.get(0).equals(EDITION_UNKNOWN)) {
throw new RepositoryResourceCreationException("Resource applies to at least one unknown edition: " + rawEdition +
"; appliesTo= " + appliesToHeader, null);
}
}
}
} | java | public static void validateEditions(AppliesToFilterInfo info, String appliesToHeader) throws RepositoryResourceCreationException {
if (info.getRawEditions() != null) {
for (String rawEdition : info.getRawEditions()) {
List<String> mappedEditions = mapRawEditionToHumanReadable(rawEdition);
if (mappedEditions.size() == 1 && mappedEditions.get(0).equals(EDITION_UNKNOWN)) {
throw new RepositoryResourceCreationException("Resource applies to at least one unknown edition: " + rawEdition +
"; appliesTo= " + appliesToHeader, null);
}
}
}
} | [
"public",
"static",
"void",
"validateEditions",
"(",
"AppliesToFilterInfo",
"info",
",",
"String",
"appliesToHeader",
")",
"throws",
"RepositoryResourceCreationException",
"{",
"if",
"(",
"info",
".",
"getRawEditions",
"(",
")",
"!=",
"null",
")",
"{",
"for",
"(",... | Validates the list of rawEditions and throws RepositoryResourceCreationException if any of
them are unknown.
Clients of this class should call this method once the AppliesToFilterInfo object has been
created in order to check whether it is valid. | [
"Validates",
"the",
"list",
"of",
"rawEditions",
"and",
"throws",
"RepositoryResourceCreationException",
"if",
"any",
"of",
"them",
"are",
"unknown",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/internal/AppliesToProcessor.java#L245-L255 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/WorkManagerImpl.java | WorkManagerImpl.scheduleWork | @Override
public void scheduleWork(
Work work,
long startTimeout,
ExecutionContext execContext,
WorkListener workListener) throws WorkException {
try {
beforeRunCheck(work, workListener, startTimeout);
WorkProxy workProxy = new WorkProxy(work, startTimeout, execContext, workListener, bootstrapContext, runningWork, true);
FutureTask<Void> futureTask = new FutureTask<Void>(workProxy);
bootstrapContext.execSvc.executeGlobal(futureTask);
if (futures.add(futureTask) && futures.size() % FUTURE_PURGE_INTERVAL == 0)
purgeFutures();
} catch (WorkException ex) {
throw ex;
} catch (Throwable t) {
WorkRejectedException wrex = new WorkRejectedException(t);
wrex.setErrorCode(WorkException.INTERNAL);
if (workListener != null)
workListener.workRejected(new WorkEvent(work, WorkEvent.WORK_REJECTED, work, wrex));
throw wrex;
}
} | java | @Override
public void scheduleWork(
Work work,
long startTimeout,
ExecutionContext execContext,
WorkListener workListener) throws WorkException {
try {
beforeRunCheck(work, workListener, startTimeout);
WorkProxy workProxy = new WorkProxy(work, startTimeout, execContext, workListener, bootstrapContext, runningWork, true);
FutureTask<Void> futureTask = new FutureTask<Void>(workProxy);
bootstrapContext.execSvc.executeGlobal(futureTask);
if (futures.add(futureTask) && futures.size() % FUTURE_PURGE_INTERVAL == 0)
purgeFutures();
} catch (WorkException ex) {
throw ex;
} catch (Throwable t) {
WorkRejectedException wrex = new WorkRejectedException(t);
wrex.setErrorCode(WorkException.INTERNAL);
if (workListener != null)
workListener.workRejected(new WorkEvent(work, WorkEvent.WORK_REJECTED, work, wrex));
throw wrex;
}
} | [
"@",
"Override",
"public",
"void",
"scheduleWork",
"(",
"Work",
"work",
",",
"long",
"startTimeout",
",",
"ExecutionContext",
"execContext",
",",
"WorkListener",
"workListener",
")",
"throws",
"WorkException",
"{",
"try",
"{",
"beforeRunCheck",
"(",
"work",
",",
... | This method puts the work on a queue that is later processed by the
"scheduler" thread. This allows the method to return to the caller
without having to wait for the thread to start.
@pre providerId != null
@param work
@param startTimeout
@param execContext
@param workListener
@throws WorkException
@exception NullPointerException this method relies on the
RALifeCycleManager to call setThreadPoolName() to set
theScheduler
@see <a
href="http://java.sun.com/j2ee/1.4/docs/api/javax/resource/spi/work/WorkManager.html#scheduleWork(com.ibm.javarx.spi.work.Work, long, com.ibm.javarx.spi.work.ExecutionContext, com.ibm.javarx.spi.work.WorkListener)">
com.ibm.javarx.spi.work.WorkManager.scheduleWork(Work, long, ExecutionContext, WorkListener)</a> | [
"This",
"method",
"puts",
"the",
"work",
"on",
"a",
"queue",
"that",
"is",
"later",
"processed",
"by",
"the",
"scheduler",
"thread",
".",
"This",
"allows",
"the",
"method",
"to",
"return",
"to",
"the",
"caller",
"without",
"having",
"to",
"wait",
"for",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/WorkManagerImpl.java#L236-L262 |
EdwardRaff/JSAT | JSAT/src/jsat/linear/RowColumnOps.java | RowColumnOps.multRow | public static void multRow(Matrix A, int i, double c)
{
multRow(A, i, 0, A.cols(), c);
} | java | public static void multRow(Matrix A, int i, double c)
{
multRow(A, i, 0, A.cols(), c);
} | [
"public",
"static",
"void",
"multRow",
"(",
"Matrix",
"A",
",",
"int",
"i",
",",
"double",
"c",
")",
"{",
"multRow",
"(",
"A",
",",
"i",
",",
"0",
",",
"A",
".",
"cols",
"(",
")",
",",
"c",
")",
";",
"}"
] | Updates the values of row <tt>i</tt> in the given matrix to be A[i,:] = A[i,:] * c
@param A the matrix to perform he update on
@param i the row to update
@param c the constant to multiply each element by | [
"Updates",
"the",
"values",
"of",
"row",
"<tt",
">",
"i<",
"/",
"tt",
">",
"in",
"the",
"given",
"matrix",
"to",
"be",
"A",
"[",
"i",
":",
"]",
"=",
"A",
"[",
"i",
":",
"]",
"*",
"c"
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/RowColumnOps.java#L72-L75 |
intellimate/Izou | src/main/java/org/intellimate/izou/system/sound/SoundManager.java | SoundManager.addIzouSoundLine | public void addIzouSoundLine(AddOnModel addOnModel, IzouSoundLineBaseClass izouSoundLine) {
debug("adding soundLine " + izouSoundLine + " from " + addOnModel);
if (permanentAddOn != null && permanentAddOn.equals(addOnModel)) {
addPermanent(izouSoundLine);
} else {
addNonPermanent(addOnModel, izouSoundLine);
}
izouSoundLine.registerCloseCallback(voit -> closeCallback(addOnModel, izouSoundLine));
izouSoundLine.registerMuteCallback(voit -> muteCallback(addOnModel, izouSoundLine));
} | java | public void addIzouSoundLine(AddOnModel addOnModel, IzouSoundLineBaseClass izouSoundLine) {
debug("adding soundLine " + izouSoundLine + " from " + addOnModel);
if (permanentAddOn != null && permanentAddOn.equals(addOnModel)) {
addPermanent(izouSoundLine);
} else {
addNonPermanent(addOnModel, izouSoundLine);
}
izouSoundLine.registerCloseCallback(voit -> closeCallback(addOnModel, izouSoundLine));
izouSoundLine.registerMuteCallback(voit -> muteCallback(addOnModel, izouSoundLine));
} | [
"public",
"void",
"addIzouSoundLine",
"(",
"AddOnModel",
"addOnModel",
",",
"IzouSoundLineBaseClass",
"izouSoundLine",
")",
"{",
"debug",
"(",
"\"adding soundLine \"",
"+",
"izouSoundLine",
"+",
"\" from \"",
"+",
"addOnModel",
")",
";",
"if",
"(",
"permanentAddOn",
... | adds an IzouSoundLine, will now be tracked by the SoundManager
@param addOnModel the addOnModel where the IzouSoundLine belongs to
@param izouSoundLine the IzouSoundLine to add | [
"adds",
"an",
"IzouSoundLine",
"will",
"now",
"be",
"tracked",
"by",
"the",
"SoundManager"
] | train | https://github.com/intellimate/Izou/blob/40a808b97998e17655c4a78e30ce7326148aed27/src/main/java/org/intellimate/izou/system/sound/SoundManager.java#L117-L126 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/asm/AsmUtils.java | AsmUtils.intInsnEqual | public static boolean intInsnEqual(IntInsnNode node1, IntInsnNode node2)
{
if (node1.operand == -1 || node2.operand == -1)
return true;
return node1.operand == node2.operand;
} | java | public static boolean intInsnEqual(IntInsnNode node1, IntInsnNode node2)
{
if (node1.operand == -1 || node2.operand == -1)
return true;
return node1.operand == node2.operand;
} | [
"public",
"static",
"boolean",
"intInsnEqual",
"(",
"IntInsnNode",
"node1",
",",
"IntInsnNode",
"node2",
")",
"{",
"if",
"(",
"node1",
".",
"operand",
"==",
"-",
"1",
"||",
"node2",
".",
"operand",
"==",
"-",
"1",
")",
"return",
"true",
";",
"return",
... | Checks if two {@link IntInsnNode} are equals.
@param node1 the node1
@param node2 the node2
@return true, if successful | [
"Checks",
"if",
"two",
"{",
"@link",
"IntInsnNode",
"}",
"are",
"equals",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/asm/AsmUtils.java#L261-L267 |
azkaban/azkaban | azkaban-web-server/src/main/java/azkaban/scheduler/QuartzScheduler.java | QuartzScheduler.resumeJobIfPresent | public synchronized boolean resumeJobIfPresent(final String jobName, final String groupName)
throws SchedulerException {
if (ifJobExist(jobName, groupName)) {
this.scheduler.resumeJob(new JobKey(jobName, groupName));
return true;
} else {
return false;
}
} | java | public synchronized boolean resumeJobIfPresent(final String jobName, final String groupName)
throws SchedulerException {
if (ifJobExist(jobName, groupName)) {
this.scheduler.resumeJob(new JobKey(jobName, groupName));
return true;
} else {
return false;
}
} | [
"public",
"synchronized",
"boolean",
"resumeJobIfPresent",
"(",
"final",
"String",
"jobName",
",",
"final",
"String",
"groupName",
")",
"throws",
"SchedulerException",
"{",
"if",
"(",
"ifJobExist",
"(",
"jobName",
",",
"groupName",
")",
")",
"{",
"this",
".",
... | Resume a job.
@param jobName
@param groupName
@return true the job has been resumed, no if the job doesn't exist.
@throws SchedulerException | [
"Resume",
"a",
"job",
"."
] | train | https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-web-server/src/main/java/azkaban/scheduler/QuartzScheduler.java#L135-L143 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java | SerializedFormBuilder.buildMethodInfo | public void buildMethodInfo(XMLNode node, Content methodsContentTree) throws DocletException {
if(configuration.nocomment){
return;
}
buildChildren(node, methodsContentTree);
} | java | public void buildMethodInfo(XMLNode node, Content methodsContentTree) throws DocletException {
if(configuration.nocomment){
return;
}
buildChildren(node, methodsContentTree);
} | [
"public",
"void",
"buildMethodInfo",
"(",
"XMLNode",
"node",
",",
"Content",
"methodsContentTree",
")",
"throws",
"DocletException",
"{",
"if",
"(",
"configuration",
".",
"nocomment",
")",
"{",
"return",
";",
"}",
"buildChildren",
"(",
"node",
",",
"methodsConte... | Build the information for the method.
@param node the XML element that specifies which components to document
@param methodsContentTree content tree to which the documentation will be added
@throws DocletException if there is a problem while building the documentation | [
"Build",
"the",
"information",
"for",
"the",
"method",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java#L343-L348 |
StanKocken/EfficientAdapter | efficientadapter/src/main/java/com/skocken/efficientadapter/lib/viewholder/EfficientViewHolder.java | EfficientViewHolder.setTag | public void setTag(int viewId, int key, Object tag) {
ViewHelper.setTag(mCacheView, viewId, key, tag);
} | java | public void setTag(int viewId, int key, Object tag) {
ViewHelper.setTag(mCacheView, viewId, key, tag);
} | [
"public",
"void",
"setTag",
"(",
"int",
"viewId",
",",
"int",
"key",
",",
"Object",
"tag",
")",
"{",
"ViewHelper",
".",
"setTag",
"(",
"mCacheView",
",",
"viewId",
",",
"key",
",",
"tag",
")",
";",
"}"
] | Equivalent to calling View.setTag
@param viewId The id of the view whose tag should change
@param key The key identifying the tag
@param tag An Object to tag the view with | [
"Equivalent",
"to",
"calling",
"View",
".",
"setTag"
] | train | https://github.com/StanKocken/EfficientAdapter/blob/0bcc3a20182cbce9d7901e1e2a9104251637167d/efficientadapter/src/main/java/com/skocken/efficientadapter/lib/viewholder/EfficientViewHolder.java#L294-L296 |
trajano/caliper | caliper/src/main/java/com/google/caliper/memory/ObjectExplorer.java | ObjectExplorer.exploreObject | public static <T> T exploreObject(Object rootObject, ObjectVisitor<T> visitor) {
return exploreObject(rootObject, visitor, EnumSet.noneOf(Feature.class));
} | java | public static <T> T exploreObject(Object rootObject, ObjectVisitor<T> visitor) {
return exploreObject(rootObject, visitor, EnumSet.noneOf(Feature.class));
} | [
"public",
"static",
"<",
"T",
">",
"T",
"exploreObject",
"(",
"Object",
"rootObject",
",",
"ObjectVisitor",
"<",
"T",
">",
"visitor",
")",
"{",
"return",
"exploreObject",
"(",
"rootObject",
",",
"visitor",
",",
"EnumSet",
".",
"noneOf",
"(",
"Feature",
"."... | Explores an object graph (defined by a root object and whatever is
reachable through it, following non-static fields) while using an
{@link ObjectVisitor} to both control the traversal and return a value.
<p>Equivalent to {@code exploreObject(rootObject, visitor,
EnumSet.noneOf(Feature.class))}.
@param <T> the type of the value obtained (after the traversal) by the
ObjectVisitor
@param rootObject an object to be recursively explored
@param visitor a visitor that is notified for each explored path and
decides whether to continue exploration of that path, and constructs a
return value at the end of the exploration
@return whatever value is returned by the visitor at the end of the
traversal
@see ObjectVisitor | [
"Explores",
"an",
"object",
"graph",
"(",
"defined",
"by",
"a",
"root",
"object",
"and",
"whatever",
"is",
"reachable",
"through",
"it",
"following",
"non",
"-",
"static",
"fields",
")",
"while",
"using",
"an",
"{",
"@link",
"ObjectVisitor",
"}",
"to",
"bo... | train | https://github.com/trajano/caliper/blob/a8bcfd84fa9d7b893b3edfadc3b13240ae5cd658/caliper/src/main/java/com/google/caliper/memory/ObjectExplorer.java#L68-L70 |
aws/aws-sdk-java | aws-java-sdk-code-generator/src/main/java/com/amazonaws/codegen/AddOperations.java | AddOperations.getPayloadShape | public static Shape getPayloadShape(Map<String, Shape> c2jShapes, Shape outputShape) {
if (outputShape.getPayload() == null) {
return null;
}
Member payloadMember = outputShape.getMembers().get(outputShape.getPayload());
return c2jShapes.get(payloadMember.getShape());
} | java | public static Shape getPayloadShape(Map<String, Shape> c2jShapes, Shape outputShape) {
if (outputShape.getPayload() == null) {
return null;
}
Member payloadMember = outputShape.getMembers().get(outputShape.getPayload());
return c2jShapes.get(payloadMember.getShape());
} | [
"public",
"static",
"Shape",
"getPayloadShape",
"(",
"Map",
"<",
"String",
",",
"Shape",
">",
"c2jShapes",
",",
"Shape",
"outputShape",
")",
"{",
"if",
"(",
"outputShape",
".",
"getPayload",
"(",
")",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
... | If there is a member in the output shape that is explicitly marked as the payload (with the
payload trait) this method returns the target shape of that member. Otherwise this method
returns null.
@param c2jShapes
All C2J shapes
@param outputShape
Output shape of operation that may contain a member designated as the payload | [
"If",
"there",
"is",
"a",
"member",
"in",
"the",
"output",
"shape",
"that",
"is",
"explicitly",
"marked",
"as",
"the",
"payload",
"(",
"with",
"the",
"payload",
"trait",
")",
"this",
"method",
"returns",
"the",
"target",
"shape",
"of",
"that",
"member",
... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-code-generator/src/main/java/com/amazonaws/codegen/AddOperations.java#L169-L175 |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/diff/AbsDiff.java | AbsDiff.moveToFollowingNode | private boolean moveToFollowingNode(final INodeReadTrx paramRtx, final ERevision paramRevision)
throws TTIOException {
boolean moved = false;
while (!((ITreeStructData)paramRtx.getNode()).hasRightSibling()
&& ((ITreeStructData)paramRtx.getNode()).hasParent() && paramRtx.getNode().getDataKey() != mRootKey) {
moved = paramRtx.moveTo(paramRtx.getNode().getParentKey());
if (moved) {
switch (paramRevision) {
case NEW:
mDepth.decrementNewDepth();
break;
case OLD:
mDepth.decrementOldDepth();
break;
}
}
}
if (paramRtx.getNode().getDataKey() == mRootKey) {
paramRtx.moveTo(ROOT_NODE);
}
moved = paramRtx.moveTo(((ITreeStructData)paramRtx.getNode()).getRightSiblingKey());
return moved;
} | java | private boolean moveToFollowingNode(final INodeReadTrx paramRtx, final ERevision paramRevision)
throws TTIOException {
boolean moved = false;
while (!((ITreeStructData)paramRtx.getNode()).hasRightSibling()
&& ((ITreeStructData)paramRtx.getNode()).hasParent() && paramRtx.getNode().getDataKey() != mRootKey) {
moved = paramRtx.moveTo(paramRtx.getNode().getParentKey());
if (moved) {
switch (paramRevision) {
case NEW:
mDepth.decrementNewDepth();
break;
case OLD:
mDepth.decrementOldDepth();
break;
}
}
}
if (paramRtx.getNode().getDataKey() == mRootKey) {
paramRtx.moveTo(ROOT_NODE);
}
moved = paramRtx.moveTo(((ITreeStructData)paramRtx.getNode()).getRightSiblingKey());
return moved;
} | [
"private",
"boolean",
"moveToFollowingNode",
"(",
"final",
"INodeReadTrx",
"paramRtx",
",",
"final",
"ERevision",
"paramRevision",
")",
"throws",
"TTIOException",
"{",
"boolean",
"moved",
"=",
"false",
";",
"while",
"(",
"!",
"(",
"(",
"ITreeStructData",
")",
"p... | Move to next following node.
@param paramRtx
the {@link IReadTransaction} to use
@param paramRevision
the {@link ERevision} constant
@return true, if cursor moved, false otherwise
@throws TTIOException | [
"Move",
"to",
"next",
"following",
"node",
"."
] | train | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/diff/AbsDiff.java#L245-L269 |
jcuda/jcufft | JCufftJava/src/main/java/jcuda/jcufft/JCufft.java | JCufft.cufftExecD2Z | public static int cufftExecD2Z(cufftHandle plan, Pointer rIdata, Pointer cOdata)
{
return checkResult(cufftExecD2ZNative(plan, rIdata, cOdata));
} | java | public static int cufftExecD2Z(cufftHandle plan, Pointer rIdata, Pointer cOdata)
{
return checkResult(cufftExecD2ZNative(plan, rIdata, cOdata));
} | [
"public",
"static",
"int",
"cufftExecD2Z",
"(",
"cufftHandle",
"plan",
",",
"Pointer",
"rIdata",
",",
"Pointer",
"cOdata",
")",
"{",
"return",
"checkResult",
"(",
"cufftExecD2ZNative",
"(",
"plan",
",",
"rIdata",
",",
"cOdata",
")",
")",
";",
"}"
] | <pre>
Executes a CUFFT real-to-complex (implicitly forward) transform plan
for double precision values.
cufftResult cufftExecD2Z( cufftHandle plan, cufftDoubleReal *idata, cufftDoubleComplex *odata );
CUFFT uses as input data the GPU memory pointed to by the idata
parameter. This function stores the non-redundant Fourier coefficients
in the odata array. If idata and odata are the same, this method does
an in-place transform (See CUFFT documentation for details on real
data FFTs.)
Input
----
plan The cufftHandle object for the plan to update
idata Pointer to the input data (in GPU memory) to transform
odata Pointer to the output data (in GPU memory)
direction The transform direction: CUFFT_FORWARD or CUFFT_INVERSE
Output
----
odata Contains the complex Fourier coefficients
Return Values
----
CUFFT_SETUP_FAILED CUFFT library failed to initialize.
CUFFT_INVALID_PLAN The plan parameter is not a valid handle.
CUFFT_INVALID_VALUE The idata, odata, and/or direction parameter is not valid.
CUFFT_EXEC_FAILED CUFFT failed to execute the transform on GPU.
CUFFT_SUCCESS CUFFT successfully executed the FFT plan.
JCUFFT_INTERNAL_ERROR If an internal JCufft error occurred
<pre> | [
"<pre",
">",
"Executes",
"a",
"CUFFT",
"real",
"-",
"to",
"-",
"complex",
"(",
"implicitly",
"forward",
")",
"transform",
"plan",
"for",
"double",
"precision",
"values",
"."
] | train | https://github.com/jcuda/jcufft/blob/833c87ffb0864f7ee7270fddef8af57f48939b3a/JCufftJava/src/main/java/jcuda/jcufft/JCufft.java#L1488-L1491 |
geomajas/geomajas-project-client-gwt2 | plugin/tilebasedlayer/impl/src/main/java/org/geomajas/gwt2/plugin/tilebasedlayer/client/TileBasedLayerClient.java | TileBasedLayerClient.createOsmLayer | @Deprecated
public OsmLayer createOsmLayer(String id, TileConfiguration conf, List<String> urls) {
OsmLayer layer = new OsmLayer(id, conf);
layer.addUrls(urls);
return layer;
} | java | @Deprecated
public OsmLayer createOsmLayer(String id, TileConfiguration conf, List<String> urls) {
OsmLayer layer = new OsmLayer(id, conf);
layer.addUrls(urls);
return layer;
} | [
"@",
"Deprecated",
"public",
"OsmLayer",
"createOsmLayer",
"(",
"String",
"id",
",",
"TileConfiguration",
"conf",
",",
"List",
"<",
"String",
">",
"urls",
")",
"{",
"OsmLayer",
"layer",
"=",
"new",
"OsmLayer",
"(",
"id",
",",
"conf",
")",
";",
"layer",
"... | Create a new OSM layer with URLs to OSM tile services.
<p/>
The URLs should have placeholders for the x- and y-coordinate and tile level in the form of {x}, {y}, {z}.
The file extension of the tiles should be part of the URL.
@param id The unique ID of the layer.
@param conf The tile configuration.
@param urls The URL to the tile services.
@return A new OSM layer.
@deprecated use {@link #createOsmLayer(String, int, String...)} | [
"Create",
"a",
"new",
"OSM",
"layer",
"with",
"URLs",
"to",
"OSM",
"tile",
"services",
".",
"<p",
"/",
">",
"The",
"URLs",
"should",
"have",
"placeholders",
"for",
"the",
"x",
"-",
"and",
"y",
"-",
"coordinate",
"and",
"tile",
"level",
"in",
"the",
"... | train | https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/plugin/tilebasedlayer/impl/src/main/java/org/geomajas/gwt2/plugin/tilebasedlayer/client/TileBasedLayerClient.java#L206-L211 |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/ftp/Ftp.java | Ftp.upload | @Override
public boolean upload(String path, File file) {
Assert.notNull(file, "file to upload is null !");
return upload(path, file.getName(), file);
} | java | @Override
public boolean upload(String path, File file) {
Assert.notNull(file, "file to upload is null !");
return upload(path, file.getName(), file);
} | [
"@",
"Override",
"public",
"boolean",
"upload",
"(",
"String",
"path",
",",
"File",
"file",
")",
"{",
"Assert",
".",
"notNull",
"(",
"file",
",",
"\"file to upload is null !\"",
")",
";",
"return",
"upload",
"(",
"path",
",",
"file",
".",
"getName",
"(",
... | 上传文件到指定目录,可选:
<pre>
1. path为null或""上传到当前路径
2. path为相对路径则相对于当前路径的子路径
3. path为绝对路径则上传到此路径
</pre>
@param path 服务端路径,可以为{@code null} 或者相对路径或绝对路径
@param file 文件
@return 是否上传成功 | [
"上传文件到指定目录,可选:"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/ftp/Ftp.java#L362-L366 |
webmetrics/browsermob-proxy | src/main/java/org/browsermob/proxy/jetty/http/HttpFields.java | HttpFields.formatDate | public static String formatDate(Calendar calendar, boolean cookie)
{
StringBuffer buf = new StringBuffer(32);
formatDate(buf,calendar,cookie);
return buf.toString();
} | java | public static String formatDate(Calendar calendar, boolean cookie)
{
StringBuffer buf = new StringBuffer(32);
formatDate(buf,calendar,cookie);
return buf.toString();
} | [
"public",
"static",
"String",
"formatDate",
"(",
"Calendar",
"calendar",
",",
"boolean",
"cookie",
")",
"{",
"StringBuffer",
"buf",
"=",
"new",
"StringBuffer",
"(",
"32",
")",
";",
"formatDate",
"(",
"buf",
",",
"calendar",
",",
"cookie",
")",
";",
"return... | Format HTTP date
"EEE, dd MMM yyyy HH:mm:ss 'GMT'" or
"EEE, dd-MMM-yy HH:mm:ss 'GMT'"for cookies | [
"Format",
"HTTP",
"date",
"EEE",
"dd",
"MMM",
"yyyy",
"HH",
":",
"mm",
":",
"ss",
"GMT",
"or",
"EEE",
"dd",
"-",
"MMM",
"-",
"yy",
"HH",
":",
"mm",
":",
"ss",
"GMT",
"for",
"cookies"
] | train | https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/http/HttpFields.java#L331-L336 |
wellner/jcarafe | jcarafe-core/src/main/java/cern/colt/map/OpenIntObjectHashMap.java | OpenIntObjectHashMap.setUp | protected void setUp(int initialCapacity, double minLoadFactor, double maxLoadFactor) {
int capacity = initialCapacity;
super.setUp(capacity, minLoadFactor, maxLoadFactor);
capacity = nextPrime(capacity);
if (capacity==0) capacity=1; // open addressing needs at least one FREE slot at any time.
this.table = new int[capacity];
this.values = new Object[capacity];
this.state = new byte[capacity];
// memory will be exhausted long before this pathological case happens, anyway.
this.minLoadFactor = minLoadFactor;
if (capacity == PrimeFinder.largestPrime) this.maxLoadFactor = 1.0;
else this.maxLoadFactor = maxLoadFactor;
this.distinct = 0;
this.freeEntries = capacity; // delta
// lowWaterMark will be established upon first expansion.
// establishing it now (upon instance construction) would immediately make the table shrink upon first put(...).
// After all the idea of an "initialCapacity" implies violating lowWaterMarks when an object is young.
// See ensureCapacity(...)
this.lowWaterMark = 0;
this.highWaterMark = chooseHighWaterMark(capacity, this.maxLoadFactor);
} | java | protected void setUp(int initialCapacity, double minLoadFactor, double maxLoadFactor) {
int capacity = initialCapacity;
super.setUp(capacity, minLoadFactor, maxLoadFactor);
capacity = nextPrime(capacity);
if (capacity==0) capacity=1; // open addressing needs at least one FREE slot at any time.
this.table = new int[capacity];
this.values = new Object[capacity];
this.state = new byte[capacity];
// memory will be exhausted long before this pathological case happens, anyway.
this.minLoadFactor = minLoadFactor;
if (capacity == PrimeFinder.largestPrime) this.maxLoadFactor = 1.0;
else this.maxLoadFactor = maxLoadFactor;
this.distinct = 0;
this.freeEntries = capacity; // delta
// lowWaterMark will be established upon first expansion.
// establishing it now (upon instance construction) would immediately make the table shrink upon first put(...).
// After all the idea of an "initialCapacity" implies violating lowWaterMarks when an object is young.
// See ensureCapacity(...)
this.lowWaterMark = 0;
this.highWaterMark = chooseHighWaterMark(capacity, this.maxLoadFactor);
} | [
"protected",
"void",
"setUp",
"(",
"int",
"initialCapacity",
",",
"double",
"minLoadFactor",
",",
"double",
"maxLoadFactor",
")",
"{",
"int",
"capacity",
"=",
"initialCapacity",
";",
"super",
".",
"setUp",
"(",
"capacity",
",",
"minLoadFactor",
",",
"maxLoadFact... | Initializes the receiver.
@param initialCapacity the initial capacity of the receiver.
@param minLoadFactor the minLoadFactor of the receiver.
@param maxLoadFactor the maxLoadFactor of the receiver.
@throws IllegalArgumentException if <tt>initialCapacity < 0 || (minLoadFactor < 0.0 || minLoadFactor >= 1.0) || (maxLoadFactor <= 0.0 || maxLoadFactor >= 1.0) || (minLoadFactor >= maxLoadFactor)</tt>. | [
"Initializes",
"the",
"receiver",
"."
] | train | https://github.com/wellner/jcarafe/blob/ab8b0a83dbf600fe80c27711815c90bd3055b217/jcarafe-core/src/main/java/cern/colt/map/OpenIntObjectHashMap.java#L438-L462 |
jenkinsci/jenkins | core/src/main/java/hudson/model/Descriptor.java | Descriptor.getCheckMethod | public CheckMethod getCheckMethod(String fieldName) {
CheckMethod method = checkMethods.get(fieldName);
if(method==null) {
method = new CheckMethod(this,fieldName);
checkMethods.put(fieldName,method);
}
return method;
} | java | public CheckMethod getCheckMethod(String fieldName) {
CheckMethod method = checkMethods.get(fieldName);
if(method==null) {
method = new CheckMethod(this,fieldName);
checkMethods.put(fieldName,method);
}
return method;
} | [
"public",
"CheckMethod",
"getCheckMethod",
"(",
"String",
"fieldName",
")",
"{",
"CheckMethod",
"method",
"=",
"checkMethods",
".",
"get",
"(",
"fieldName",
")",
";",
"if",
"(",
"method",
"==",
"null",
")",
"{",
"method",
"=",
"new",
"CheckMethod",
"(",
"t... | If the field "xyz" of a {@link Describable} has the corresponding "doCheckXyz" method,
return the model of the check method.
<p>
This method is used to hook up the form validation method to the corresponding HTML input element. | [
"If",
"the",
"field",
"xyz",
"of",
"a",
"{"
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/Descriptor.java#L396-L404 |
alkacon/opencms-core | src/org/opencms/db/CmsSecurityManager.java | CmsSecurityManager.readOwner | public CmsUser readOwner(CmsRequestContext context, CmsProject project) throws CmsException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
CmsUser result = null;
try {
result = m_driverManager.readOwner(dbc, project);
} catch (Exception e) {
dbc.report(
null,
Messages.get().container(Messages.ERR_READ_OWNER_FOR_PROJECT_2, project.getName(), project.getUuid()),
e);
} finally {
dbc.clear();
}
return result;
} | java | public CmsUser readOwner(CmsRequestContext context, CmsProject project) throws CmsException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
CmsUser result = null;
try {
result = m_driverManager.readOwner(dbc, project);
} catch (Exception e) {
dbc.report(
null,
Messages.get().container(Messages.ERR_READ_OWNER_FOR_PROJECT_2, project.getName(), project.getUuid()),
e);
} finally {
dbc.clear();
}
return result;
} | [
"public",
"CmsUser",
"readOwner",
"(",
"CmsRequestContext",
"context",
",",
"CmsProject",
"project",
")",
"throws",
"CmsException",
"{",
"CmsDbContext",
"dbc",
"=",
"m_dbContextFactory",
".",
"getDbContext",
"(",
"context",
")",
";",
"CmsUser",
"result",
"=",
"nul... | Reads the owner of a project from the OpenCms.<p>
@param context the current request context
@param project the project to get the owner from
@return the owner of a resource
@throws CmsException if something goes wrong | [
"Reads",
"the",
"owner",
"of",
"a",
"project",
"from",
"the",
"OpenCms",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L4602-L4617 |
xvik/guice-persist-orient | src/main/java/ru/vyarus/guice/persist/orient/repository/command/core/param/CommandParamsContext.java | CommandParamsContext.addNamedParam | public void addNamedParam(final String name, final ParamInfo paramInfo) {
check(!named.containsKey(name),
"Duplicate parameter %s declaration at position %s", name, paramInfo.position);
named.put(name, paramInfo);
} | java | public void addNamedParam(final String name, final ParamInfo paramInfo) {
check(!named.containsKey(name),
"Duplicate parameter %s declaration at position %s", name, paramInfo.position);
named.put(name, paramInfo);
} | [
"public",
"void",
"addNamedParam",
"(",
"final",
"String",
"name",
",",
"final",
"ParamInfo",
"paramInfo",
")",
"{",
"check",
"(",
"!",
"named",
".",
"containsKey",
"(",
"name",
")",
",",
"\"Duplicate parameter %s declaration at position %s\"",
",",
"name",
",",
... | Register parameter as named.
@param name parameter name
@param paramInfo parameter object | [
"Register",
"parameter",
"as",
"named",
"."
] | train | https://github.com/xvik/guice-persist-orient/blob/5ef06fb4f734360512e9824a3b875c4906c56b5b/src/main/java/ru/vyarus/guice/persist/orient/repository/command/core/param/CommandParamsContext.java#L48-L52 |
biojava/biojava | biojava-core/src/main/java/org/biojava/nbio/core/alignment/matrices/SimpleSubstitutionMatrix.java | SimpleSubstitutionMatrix.getIndexOfCompound | private static <C extends Compound> int getIndexOfCompound(List<C> list, C compound) {
int index = list.indexOf(compound);
if (index == -1) {
for (int i = 0; i < list.size(); i++) {
if (compound.equalsIgnoreCase(list.get(i))) {
index = i;
break;
}
}
}
return index;
} | java | private static <C extends Compound> int getIndexOfCompound(List<C> list, C compound) {
int index = list.indexOf(compound);
if (index == -1) {
for (int i = 0; i < list.size(); i++) {
if (compound.equalsIgnoreCase(list.get(i))) {
index = i;
break;
}
}
}
return index;
} | [
"private",
"static",
"<",
"C",
"extends",
"Compound",
">",
"int",
"getIndexOfCompound",
"(",
"List",
"<",
"C",
">",
"list",
",",
"C",
"compound",
")",
"{",
"int",
"index",
"=",
"list",
".",
"indexOf",
"(",
"compound",
")",
";",
"if",
"(",
"index",
"=... | Returns the index of the first occurrence of the specified element in the list.
If the list does not contain the given compound, the index of the first occurrence
of the element according to case-insensitive equality.
If no such elements exist, -1 is returned.
@param list list of compounds to search
@param compound compound to search for
@return Returns the index of the first match to the specified element in this list, or -1 if there is no such index. | [
"Returns",
"the",
"index",
"of",
"the",
"first",
"occurrence",
"of",
"the",
"specified",
"element",
"in",
"the",
"list",
".",
"If",
"the",
"list",
"does",
"not",
"contain",
"the",
"given",
"compound",
"the",
"index",
"of",
"the",
"first",
"occurrence",
"of... | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/alignment/matrices/SimpleSubstitutionMatrix.java#L229-L240 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/factory/flow/FactoryDenseOpticalFlow.java | FactoryDenseOpticalFlow.hornSchunck | public static <T extends ImageGray<T>,D extends ImageGray<D>>
DenseOpticalFlow<T> hornSchunck( @Nullable ConfigHornSchunck config , Class<T> imageType )
{
if( config == null )
config = new ConfigHornSchunck();
HornSchunck<T,D> alg;
if( imageType == GrayU8.class )
alg = (HornSchunck)new HornSchunck_U8(config.alpha,config.numIterations);
else
if( imageType == GrayF32.class )
alg = (HornSchunck)new HornSchunck_F32(config.alpha,config.numIterations);
else
throw new IllegalArgumentException("Unsupported image type "+imageType);
return new HornSchunck_to_DenseOpticalFlow<>(alg, ImageType.single(imageType));
} | java | public static <T extends ImageGray<T>,D extends ImageGray<D>>
DenseOpticalFlow<T> hornSchunck( @Nullable ConfigHornSchunck config , Class<T> imageType )
{
if( config == null )
config = new ConfigHornSchunck();
HornSchunck<T,D> alg;
if( imageType == GrayU8.class )
alg = (HornSchunck)new HornSchunck_U8(config.alpha,config.numIterations);
else
if( imageType == GrayF32.class )
alg = (HornSchunck)new HornSchunck_F32(config.alpha,config.numIterations);
else
throw new IllegalArgumentException("Unsupported image type "+imageType);
return new HornSchunck_to_DenseOpticalFlow<>(alg, ImageType.single(imageType));
} | [
"public",
"static",
"<",
"T",
"extends",
"ImageGray",
"<",
"T",
">",
",",
"D",
"extends",
"ImageGray",
"<",
"D",
">",
">",
"DenseOpticalFlow",
"<",
"T",
">",
"hornSchunck",
"(",
"@",
"Nullable",
"ConfigHornSchunck",
"config",
",",
"Class",
"<",
"T",
">",... | The original Horn-Schunck algorithm. Only good for very small motions.
@see HornSchunck
@param config Configuration parameters. If null then default is used.
@param imageType Type of input gray scale image
@return dense optical flow | [
"The",
"original",
"Horn",
"-",
"Schunck",
"algorithm",
".",
"Only",
"good",
"for",
"very",
"small",
"motions",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/factory/flow/FactoryDenseOpticalFlow.java#L122-L138 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java | SeaGlassLookAndFeel.definePopups | private void definePopups(UIDefaults d) {
d.put("seaGlassPopupBorder", new ColorUIResource(0xbbbbbb));
d.put("popupMenuInteriorEnabled", Color.WHITE);
// Rossi: Changed color of popup / submenus to get better contrast to bright backgrounds.
// d.put("popupMenuBorderEnabled", new Color(0xdddddd));
d.put("popupMenuBorderEnabled", new Color(0x5b7ea4));
String c = PAINTER_PREFIX + "PopupMenuPainter";
String p = "PopupMenu";
d.put(p + ".contentMargins", new InsetsUIResource(6, 1, 6, 1));
d.put(p + ".opaque", Boolean.TRUE);
d.put(p + ".consumeEventOnClose", Boolean.TRUE);
d.put(p + "[Disabled].backgroundPainter", new LazyPainter(c, PopupMenuPainter.Which.BACKGROUND_DISABLED));
d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, PopupMenuPainter.Which.BACKGROUND_ENABLED));
// Initialize PopupMenuSeparator
c = PAINTER_PREFIX + "SeparatorPainter";
p = "PopupMenuSeparator";
d.put(p + ".contentMargins", new InsetsUIResource(1, 0, 2, 0));
d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, SeparatorPainter.Which.BACKGROUND_ENABLED));
} | java | private void definePopups(UIDefaults d) {
d.put("seaGlassPopupBorder", new ColorUIResource(0xbbbbbb));
d.put("popupMenuInteriorEnabled", Color.WHITE);
// Rossi: Changed color of popup / submenus to get better contrast to bright backgrounds.
// d.put("popupMenuBorderEnabled", new Color(0xdddddd));
d.put("popupMenuBorderEnabled", new Color(0x5b7ea4));
String c = PAINTER_PREFIX + "PopupMenuPainter";
String p = "PopupMenu";
d.put(p + ".contentMargins", new InsetsUIResource(6, 1, 6, 1));
d.put(p + ".opaque", Boolean.TRUE);
d.put(p + ".consumeEventOnClose", Boolean.TRUE);
d.put(p + "[Disabled].backgroundPainter", new LazyPainter(c, PopupMenuPainter.Which.BACKGROUND_DISABLED));
d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, PopupMenuPainter.Which.BACKGROUND_ENABLED));
// Initialize PopupMenuSeparator
c = PAINTER_PREFIX + "SeparatorPainter";
p = "PopupMenuSeparator";
d.put(p + ".contentMargins", new InsetsUIResource(1, 0, 2, 0));
d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, SeparatorPainter.Which.BACKGROUND_ENABLED));
} | [
"private",
"void",
"definePopups",
"(",
"UIDefaults",
"d",
")",
"{",
"d",
".",
"put",
"(",
"\"seaGlassPopupBorder\"",
",",
"new",
"ColorUIResource",
"(",
"0xbbbbbb",
")",
")",
";",
"d",
".",
"put",
"(",
"\"popupMenuInteriorEnabled\"",
",",
"Color",
".",
"WHI... | Initialize the popup settings.
@param d the UI defaults map. | [
"Initialize",
"the",
"popup",
"settings",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L1572-L1594 |
UrielCh/ovh-java-sdk | ovh-java-sdk-caascontainers/src/main/java/net/minidev/ovh/api/ApiOvhCaascontainers.java | ApiOvhCaascontainers.serviceName_frameworks_frameworkId_password_PUT | public void serviceName_frameworks_frameworkId_password_PUT(String serviceName, String frameworkId, OvhPassword body) throws IOException {
String qPath = "/caas/containers/{serviceName}/frameworks/{frameworkId}/password";
StringBuilder sb = path(qPath, serviceName, frameworkId);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void serviceName_frameworks_frameworkId_password_PUT(String serviceName, String frameworkId, OvhPassword body) throws IOException {
String qPath = "/caas/containers/{serviceName}/frameworks/{frameworkId}/password";
StringBuilder sb = path(qPath, serviceName, frameworkId);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"serviceName_frameworks_frameworkId_password_PUT",
"(",
"String",
"serviceName",
",",
"String",
"frameworkId",
",",
"OvhPassword",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/caas/containers/{serviceName}/frameworks/{frameworkId}/pas... | Update the framework access password
REST: PUT /caas/containers/{serviceName}/frameworks/{frameworkId}/password
@param frameworkId [required] framework id
@param serviceName [required] service name
@param body [required] The new framework password
API beta | [
"Update",
"the",
"framework",
"access",
"password"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-caascontainers/src/main/java/net/minidev/ovh/api/ApiOvhCaascontainers.java#L200-L204 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/io/MECommsTrc.java | MECommsTrc.traceMessage | public static void traceMessage(TraceComponent _tc, MessageProcessor localME, SIBUuid8 remoteME, String operation, Object connection, AbstractMessage msg) {
// Trace if either the callers trace is enabled, or our own trace group
if (tc.isDebugEnabled() || _tc.isDebugEnabled()) {
StringBuilder buff = new StringBuilder();
buff.append("MECOMMS");
try {
// Append operation details
buff.append("[");
buff.append((localME!=null)?localME.getMessagingEngineName():"???");
buff.append(operation);
buff.append(remoteME);
buff.append("] ");
// Append the details of the message
try {
msg.getTraceSummaryLine(buff);
} catch (Exception e) {
// No FFDC code needed
// We failed to get the message summary line, just print the message class instead.
// We know this can happen within unit tests, because the MFP getter methods used
// to build the summary line can throw a NullPointerException if the message is not
// fully initialized. However, no circumstances are known for this to happen in
// a 'real' messaging engine.
String safeMsgSummary = (msg != null)?msg.getClass().getName():"null";
buff.append(" SUMMARY TRACE FAILED. Message class=" + safeMsgSummary);
}
// Add details identifying the link/stream/destination at the end of the line.
// As this is on every line, I've tried to limit it as much as possible
buff.append(" [C=");
buff.append((connection!=null)?Integer.toHexString(connection.hashCode()):null);
buff.append(",D=");
buff.append(msg.getGuaranteedTargetDestinationDefinitionUUID());
buff.append(",S=");
buff.append(msg.getGuaranteedStreamUUID());
buff.append("]");
} catch (Exception e) {
// No FFDC code needed
// We encountered an unexpected runtime exception. Try to print a bit of helpful info.
String safeMsgSummary = (msg != null)?msg.getClass().getName():"null";
buff.append(" SUMMARY TRACE FAILED. Message class=" + safeMsgSummary);
}
// Preferentially trace with our trace group, to allow a grep on this class name
if (tc.isDebugEnabled()) {
SibTr.debug(tc, buff.toString());
}
else {
SibTr.debug(_tc, buff.toString());
}
}
} | java | public static void traceMessage(TraceComponent _tc, MessageProcessor localME, SIBUuid8 remoteME, String operation, Object connection, AbstractMessage msg) {
// Trace if either the callers trace is enabled, or our own trace group
if (tc.isDebugEnabled() || _tc.isDebugEnabled()) {
StringBuilder buff = new StringBuilder();
buff.append("MECOMMS");
try {
// Append operation details
buff.append("[");
buff.append((localME!=null)?localME.getMessagingEngineName():"???");
buff.append(operation);
buff.append(remoteME);
buff.append("] ");
// Append the details of the message
try {
msg.getTraceSummaryLine(buff);
} catch (Exception e) {
// No FFDC code needed
// We failed to get the message summary line, just print the message class instead.
// We know this can happen within unit tests, because the MFP getter methods used
// to build the summary line can throw a NullPointerException if the message is not
// fully initialized. However, no circumstances are known for this to happen in
// a 'real' messaging engine.
String safeMsgSummary = (msg != null)?msg.getClass().getName():"null";
buff.append(" SUMMARY TRACE FAILED. Message class=" + safeMsgSummary);
}
// Add details identifying the link/stream/destination at the end of the line.
// As this is on every line, I've tried to limit it as much as possible
buff.append(" [C=");
buff.append((connection!=null)?Integer.toHexString(connection.hashCode()):null);
buff.append(",D=");
buff.append(msg.getGuaranteedTargetDestinationDefinitionUUID());
buff.append(",S=");
buff.append(msg.getGuaranteedStreamUUID());
buff.append("]");
} catch (Exception e) {
// No FFDC code needed
// We encountered an unexpected runtime exception. Try to print a bit of helpful info.
String safeMsgSummary = (msg != null)?msg.getClass().getName():"null";
buff.append(" SUMMARY TRACE FAILED. Message class=" + safeMsgSummary);
}
// Preferentially trace with our trace group, to allow a grep on this class name
if (tc.isDebugEnabled()) {
SibTr.debug(tc, buff.toString());
}
else {
SibTr.debug(_tc, buff.toString());
}
}
} | [
"public",
"static",
"void",
"traceMessage",
"(",
"TraceComponent",
"_tc",
",",
"MessageProcessor",
"localME",
",",
"SIBUuid8",
"remoteME",
",",
"String",
"operation",
",",
"Object",
"connection",
",",
"AbstractMessage",
"msg",
")",
"{",
"// Trace if either the callers... | Minimal trace entry for ME<->ME comms.
Caller should check TraceComponent.isAnyTracingEnabled() before calling.
@param _tc The caller's trace component
@param operation The operation. See constants in this class.
@param targetME The MEUUID of the target ME
@param connection The ME<->ME connection (hashCode will be printed). Can be null to indicate no suitable connection was found.
@param msg The mess1age being sent over the connection | [
"Minimal",
"trace",
"entry",
"for",
"ME<",
"-",
">",
"ME",
"comms",
".",
"Caller",
"should",
"check",
"TraceComponent",
".",
"isAnyTracingEnabled",
"()",
"before",
"calling",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/io/MECommsTrc.java#L49-L107 |
apache/spark | common/network-common/src/main/java/org/apache/spark/network/crypto/AuthEngine.java | AuthEngine.respond | ServerResponse respond(ClientChallenge clientChallenge)
throws GeneralSecurityException {
SecretKeySpec authKey = generateKey(clientChallenge.kdf, clientChallenge.iterations,
clientChallenge.nonce, clientChallenge.keyLength);
initializeForAuth(clientChallenge.cipher, clientChallenge.nonce, authKey);
byte[] challenge = validateChallenge(clientChallenge.nonce, clientChallenge.challenge);
byte[] response = challenge(appId, clientChallenge.nonce, rawResponse(challenge));
byte[] sessionNonce = randomBytes(conf.encryptionKeyLength() / Byte.SIZE);
byte[] inputIv = randomBytes(conf.ivLength());
byte[] outputIv = randomBytes(conf.ivLength());
SecretKeySpec sessionKey = generateKey(clientChallenge.kdf, clientChallenge.iterations,
sessionNonce, clientChallenge.keyLength);
this.sessionCipher = new TransportCipher(cryptoConf, clientChallenge.cipher, sessionKey,
inputIv, outputIv);
// Note the IVs are swapped in the response.
return new ServerResponse(response, encrypt(sessionNonce), encrypt(outputIv), encrypt(inputIv));
} | java | ServerResponse respond(ClientChallenge clientChallenge)
throws GeneralSecurityException {
SecretKeySpec authKey = generateKey(clientChallenge.kdf, clientChallenge.iterations,
clientChallenge.nonce, clientChallenge.keyLength);
initializeForAuth(clientChallenge.cipher, clientChallenge.nonce, authKey);
byte[] challenge = validateChallenge(clientChallenge.nonce, clientChallenge.challenge);
byte[] response = challenge(appId, clientChallenge.nonce, rawResponse(challenge));
byte[] sessionNonce = randomBytes(conf.encryptionKeyLength() / Byte.SIZE);
byte[] inputIv = randomBytes(conf.ivLength());
byte[] outputIv = randomBytes(conf.ivLength());
SecretKeySpec sessionKey = generateKey(clientChallenge.kdf, clientChallenge.iterations,
sessionNonce, clientChallenge.keyLength);
this.sessionCipher = new TransportCipher(cryptoConf, clientChallenge.cipher, sessionKey,
inputIv, outputIv);
// Note the IVs are swapped in the response.
return new ServerResponse(response, encrypt(sessionNonce), encrypt(outputIv), encrypt(inputIv));
} | [
"ServerResponse",
"respond",
"(",
"ClientChallenge",
"clientChallenge",
")",
"throws",
"GeneralSecurityException",
"{",
"SecretKeySpec",
"authKey",
"=",
"generateKey",
"(",
"clientChallenge",
".",
"kdf",
",",
"clientChallenge",
".",
"iterations",
",",
"clientChallenge",
... | Validates the client challenge, and create the encryption backend for the channel from the
parameters sent by the client.
@param clientChallenge The challenge from the client.
@return A response to be sent to the client. | [
"Validates",
"the",
"client",
"challenge",
"and",
"create",
"the",
"encryption",
"backend",
"for",
"the",
"channel",
"from",
"the",
"parameters",
"sent",
"by",
"the",
"client",
"."
] | train | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/crypto/AuthEngine.java#L107-L127 |
Erudika/para | para-server/src/main/java/com/erudika/para/utils/HttpUtils.java | HttpUtils.getCookieValue | public static String getCookieValue(HttpServletRequest req, String name) {
if (StringUtils.isBlank(name) || req == null) {
return null;
}
Cookie[] cookies = req.getCookies();
if (cookies == null) {
return null;
}
//Otherwise, we have to do a linear scan for the cookie.
for (Cookie cookie : cookies) {
if (cookie.getName().equals(name)) {
return cookie.getValue();
}
}
return null;
} | java | public static String getCookieValue(HttpServletRequest req, String name) {
if (StringUtils.isBlank(name) || req == null) {
return null;
}
Cookie[] cookies = req.getCookies();
if (cookies == null) {
return null;
}
//Otherwise, we have to do a linear scan for the cookie.
for (Cookie cookie : cookies) {
if (cookie.getName().equals(name)) {
return cookie.getValue();
}
}
return null;
} | [
"public",
"static",
"String",
"getCookieValue",
"(",
"HttpServletRequest",
"req",
",",
"String",
"name",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"name",
")",
"||",
"req",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Cookie",
"[",... | Reads a cookie.
@param name the name
@param req HTTP request
@return the cookie value | [
"Reads",
"a",
"cookie",
"."
] | train | https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-server/src/main/java/com/erudika/para/utils/HttpUtils.java#L123-L138 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/jazz_license.java | jazz_license.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
jazz_license_responses result = (jazz_license_responses) service.get_payload_formatter().string_to_resource(jazz_license_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.jazz_license_response_array);
}
jazz_license[] result_jazz_license = new jazz_license[result.jazz_license_response_array.length];
for(int i = 0; i < result.jazz_license_response_array.length; i++)
{
result_jazz_license[i] = result.jazz_license_response_array[i].jazz_license[0];
}
return result_jazz_license;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
jazz_license_responses result = (jazz_license_responses) service.get_payload_formatter().string_to_resource(jazz_license_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.jazz_license_response_array);
}
jazz_license[] result_jazz_license = new jazz_license[result.jazz_license_response_array.length];
for(int i = 0; i < result.jazz_license_response_array.length; i++)
{
result_jazz_license[i] = result.jazz_license_response_array[i].jazz_license[0];
}
return result_jazz_license;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"jazz_license_responses",
"result",
"=",
"(",
"jazz_license_responses",
")",
"service",
".",
"get_payload_form... | <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/jazz_license.java#L412-L429 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ComputeNodesImpl.java | ComputeNodesImpl.disableSchedulingAsync | public Observable<Void> disableSchedulingAsync(String poolId, String nodeId, DisableComputeNodeSchedulingOption nodeDisableSchedulingOption, ComputeNodeDisableSchedulingOptions computeNodeDisableSchedulingOptions) {
return disableSchedulingWithServiceResponseAsync(poolId, nodeId, nodeDisableSchedulingOption, computeNodeDisableSchedulingOptions).map(new Func1<ServiceResponseWithHeaders<Void, ComputeNodeDisableSchedulingHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, ComputeNodeDisableSchedulingHeaders> response) {
return response.body();
}
});
} | java | public Observable<Void> disableSchedulingAsync(String poolId, String nodeId, DisableComputeNodeSchedulingOption nodeDisableSchedulingOption, ComputeNodeDisableSchedulingOptions computeNodeDisableSchedulingOptions) {
return disableSchedulingWithServiceResponseAsync(poolId, nodeId, nodeDisableSchedulingOption, computeNodeDisableSchedulingOptions).map(new Func1<ServiceResponseWithHeaders<Void, ComputeNodeDisableSchedulingHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, ComputeNodeDisableSchedulingHeaders> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"disableSchedulingAsync",
"(",
"String",
"poolId",
",",
"String",
"nodeId",
",",
"DisableComputeNodeSchedulingOption",
"nodeDisableSchedulingOption",
",",
"ComputeNodeDisableSchedulingOptions",
"computeNodeDisableSchedulingOptions",
")",
... | Disables task scheduling on the specified compute node.
You can disable task scheduling on a node only if its current scheduling state is enabled.
@param poolId The ID of the pool that contains the compute node.
@param nodeId The ID of the compute node on which you want to disable task scheduling.
@param nodeDisableSchedulingOption What to do with currently running tasks when disabling task scheduling on the compute node. The default value is requeue. Possible values include: 'requeue', 'terminate', 'taskCompletion'
@param computeNodeDisableSchedulingOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponseWithHeaders} object if successful. | [
"Disables",
"task",
"scheduling",
"on",
"the",
"specified",
"compute",
"node",
".",
"You",
"can",
"disable",
"task",
"scheduling",
"on",
"a",
"node",
"only",
"if",
"its",
"current",
"scheduling",
"state",
"is",
"enabled",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ComputeNodesImpl.java#L1630-L1637 |
tvesalainen/util | util/src/main/java/org/vesalainen/nio/FileUtil.java | FileUtil.setTimes | public static final void setTimes(FileTime lastModifiedTime, FileTime lastAccessTime, FileTime createTime, Path... files) throws IOException
{
for (Path file : files)
{
BasicFileAttributeView view = Files.getFileAttributeView(file, BasicFileAttributeView.class);
view.setTimes(lastModifiedTime, lastAccessTime, createTime);
}
} | java | public static final void setTimes(FileTime lastModifiedTime, FileTime lastAccessTime, FileTime createTime, Path... files) throws IOException
{
for (Path file : files)
{
BasicFileAttributeView view = Files.getFileAttributeView(file, BasicFileAttributeView.class);
view.setTimes(lastModifiedTime, lastAccessTime, createTime);
}
} | [
"public",
"static",
"final",
"void",
"setTimes",
"(",
"FileTime",
"lastModifiedTime",
",",
"FileTime",
"lastAccessTime",
",",
"FileTime",
"createTime",
",",
"Path",
"...",
"files",
")",
"throws",
"IOException",
"{",
"for",
"(",
"Path",
"file",
":",
"files",
")... | Set files times. Non null times are changed.
@param lastModifiedTime Can be null
@param lastAccessTime Can be null
@param createTime Can be null
@param files
@throws IOException | [
"Set",
"files",
"times",
".",
"Non",
"null",
"times",
"are",
"changed",
"."
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/FileUtil.java#L245-L252 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/volume/GeometryExtrude.java | GeometryExtrude.extractWalls | public static MultiPolygon extractWalls(Polygon polygon, double height){
GeometryFactory factory = polygon.getFactory();
//We process the exterior ring
final LineString shell = getClockWise(polygon.getExteriorRing());
ArrayList<Polygon> walls = new ArrayList<Polygon>();
for (int i = 1; i < shell.getNumPoints(); i++) {
walls.add(extrudeEdge(shell.getCoordinateN(i - 1), shell.getCoordinateN(i), height, factory));
}
// We create the walls for all holes
int nbOfHoles = polygon.getNumInteriorRing();
for (int i = 0; i < nbOfHoles; i++) {
final LineString hole = getCounterClockWise(polygon.getInteriorRingN(i));
for (int j = 1; j < hole.getNumPoints(); j++) {
walls.add(extrudeEdge(hole.getCoordinateN(j - 1),
hole.getCoordinateN(j), height, factory));
}
}
return polygon.getFactory().createMultiPolygon(walls.toArray(new Polygon[0]));
} | java | public static MultiPolygon extractWalls(Polygon polygon, double height){
GeometryFactory factory = polygon.getFactory();
//We process the exterior ring
final LineString shell = getClockWise(polygon.getExteriorRing());
ArrayList<Polygon> walls = new ArrayList<Polygon>();
for (int i = 1; i < shell.getNumPoints(); i++) {
walls.add(extrudeEdge(shell.getCoordinateN(i - 1), shell.getCoordinateN(i), height, factory));
}
// We create the walls for all holes
int nbOfHoles = polygon.getNumInteriorRing();
for (int i = 0; i < nbOfHoles; i++) {
final LineString hole = getCounterClockWise(polygon.getInteriorRingN(i));
for (int j = 1; j < hole.getNumPoints(); j++) {
walls.add(extrudeEdge(hole.getCoordinateN(j - 1),
hole.getCoordinateN(j), height, factory));
}
}
return polygon.getFactory().createMultiPolygon(walls.toArray(new Polygon[0]));
} | [
"public",
"static",
"MultiPolygon",
"extractWalls",
"(",
"Polygon",
"polygon",
",",
"double",
"height",
")",
"{",
"GeometryFactory",
"factory",
"=",
"polygon",
".",
"getFactory",
"(",
")",
";",
"//We process the exterior ring ",
"final",
"LineString",
"shell",
"=",
... | Extract the walls from a polygon
@param polygon
@param height
@return | [
"Extract",
"the",
"walls",
"from",
"a",
"polygon"
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/volume/GeometryExtrude.java#L121-L141 |
alkacon/opencms-core | src/org/opencms/staticexport/CmsDefaultLinkSubstitutionHandler.java | CmsDefaultLinkSubstitutionHandler.getRootPathForSite | protected String getRootPathForSite(CmsObject cms, String path, String siteRoot, boolean isRootPath) {
if (isRootPath || (siteRoot == null)) {
return CmsStringUtil.joinPaths("/", path);
} else {
return cms.getRequestContext().addSiteRoot(siteRoot, path);
}
} | java | protected String getRootPathForSite(CmsObject cms, String path, String siteRoot, boolean isRootPath) {
if (isRootPath || (siteRoot == null)) {
return CmsStringUtil.joinPaths("/", path);
} else {
return cms.getRequestContext().addSiteRoot(siteRoot, path);
}
} | [
"protected",
"String",
"getRootPathForSite",
"(",
"CmsObject",
"cms",
",",
"String",
"path",
",",
"String",
"siteRoot",
",",
"boolean",
"isRootPath",
")",
"{",
"if",
"(",
"isRootPath",
"||",
"(",
"siteRoot",
"==",
"null",
")",
")",
"{",
"return",
"CmsStringU... | Returns the root path for given site.<p>
This method is required as a hook used in {@link CmsLocalePrefixLinkSubstitutionHandler}.<p>
@param cms the cms context
@param path the path
@param siteRoot the site root, will be null in case of the root site
@param isRootPath in case the path is already a root path
@return the root path | [
"Returns",
"the",
"root",
"path",
"for",
"given",
"site",
".",
"<p",
">",
"This",
"method",
"is",
"required",
"as",
"a",
"hook",
"used",
"in",
"{",
"@link",
"CmsLocalePrefixLinkSubstitutionHandler",
"}",
".",
"<p",
">",
"@param",
"cms",
"the",
"cms",
"cont... | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/staticexport/CmsDefaultLinkSubstitutionHandler.java#L462-L469 |
infinispan/infinispan | jcache/commons/src/main/java/org/infinispan/jcache/RIMBeanServerRegistrationUtility.java | RIMBeanServerRegistrationUtility.calculateObjectName | private static <K, V> ObjectName calculateObjectName(AbstractJCache<K, V> cache, ObjectNameType objectNameType) {
String cacheManagerName = mbeanSafe(cache.getCacheManager().getURI().toString());
String cacheName = mbeanSafe(cache.getName());
try {
return new ObjectName("javax.cache:type=Cache" + objectNameType.objectName
+ ",CacheManager=" + cacheManagerName
+ ",Cache=" + cacheName);
} catch (MalformedObjectNameException e) {
throw new CacheException("Illegal ObjectName for Management Bean. " +
"CacheManager=[" + cacheManagerName + "], Cache=[" + cacheName + "]", e);
}
} | java | private static <K, V> ObjectName calculateObjectName(AbstractJCache<K, V> cache, ObjectNameType objectNameType) {
String cacheManagerName = mbeanSafe(cache.getCacheManager().getURI().toString());
String cacheName = mbeanSafe(cache.getName());
try {
return new ObjectName("javax.cache:type=Cache" + objectNameType.objectName
+ ",CacheManager=" + cacheManagerName
+ ",Cache=" + cacheName);
} catch (MalformedObjectNameException e) {
throw new CacheException("Illegal ObjectName for Management Bean. " +
"CacheManager=[" + cacheManagerName + "], Cache=[" + cacheName + "]", e);
}
} | [
"private",
"static",
"<",
"K",
",",
"V",
">",
"ObjectName",
"calculateObjectName",
"(",
"AbstractJCache",
"<",
"K",
",",
"V",
">",
"cache",
",",
"ObjectNameType",
"objectNameType",
")",
"{",
"String",
"cacheManagerName",
"=",
"mbeanSafe",
"(",
"cache",
".",
... | Creates an object name using the scheme "javax.cache:type=Cache<Statistics|Configuration>,CacheManager=<cacheManagerName>,name=<cacheName>" | [
"Creates",
"an",
"object",
"name",
"using",
"the",
"scheme",
"javax",
".",
"cache",
":",
"type",
"=",
"Cache<",
";",
"Statistics|Configuration>",
";",
"CacheManager",
"=",
"<",
";",
"cacheManagerName>",
";",
"name",
"=",
"<",
";",
"cacheName>",
";"... | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/jcache/commons/src/main/java/org/infinispan/jcache/RIMBeanServerRegistrationUtility.java#L126-L138 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/table/PropertyColumnTableDescription.java | PropertyColumnTableDescription.addPropertyColumn | public PropertyColumn addPropertyColumn(String propertyName, Class<?> propertyType)
{
String[] headerKeys = getMessageResolver().getMessageKeys(this.id, propertyName, MessageConstants.HEADER);
Accessor accessor = ClassUtils.getAccessorForProperty(entityClass, propertyName);
if (propertyType == null)
propertyType = accessor.getPropertyType();
PropertyColumn propertyColumn = new PropertyColumn(propertyName, accessor, propertyType);
if (String.class.isAssignableFrom(propertyColumn.getType()))
propertyColumn.setFilterColumn(true);
propertyColumn.setHeaderKeys(headerKeys);
columns.add(propertyColumn);
return propertyColumn;
} | java | public PropertyColumn addPropertyColumn(String propertyName, Class<?> propertyType)
{
String[] headerKeys = getMessageResolver().getMessageKeys(this.id, propertyName, MessageConstants.HEADER);
Accessor accessor = ClassUtils.getAccessorForProperty(entityClass, propertyName);
if (propertyType == null)
propertyType = accessor.getPropertyType();
PropertyColumn propertyColumn = new PropertyColumn(propertyName, accessor, propertyType);
if (String.class.isAssignableFrom(propertyColumn.getType()))
propertyColumn.setFilterColumn(true);
propertyColumn.setHeaderKeys(headerKeys);
columns.add(propertyColumn);
return propertyColumn;
} | [
"public",
"PropertyColumn",
"addPropertyColumn",
"(",
"String",
"propertyName",
",",
"Class",
"<",
"?",
">",
"propertyType",
")",
"{",
"String",
"[",
"]",
"headerKeys",
"=",
"getMessageResolver",
"(",
")",
".",
"getMessageKeys",
"(",
"this",
".",
"id",
",",
... | Create and add a column for the given property. Property type is passed or determined (when
<code>null</code>) by examining the {@link Accessor} and headerKeys are added based upon the id of
the {@link PropertyColumnTableDescription}, the propertyName and the postfix "HEADER".
@param propertyName
name of the property.
@param propertyType
type of the property. If <code>null</code> a type will be determined by examining the
accessor method. | [
"Create",
"and",
"add",
"a",
"column",
"for",
"the",
"given",
"property",
".",
"Property",
"type",
"is",
"passed",
"or",
"determined",
"(",
"when",
"<code",
">",
"null<",
"/",
"code",
">",
")",
"by",
"examining",
"the",
"{",
"@link",
"Accessor",
"}",
"... | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/table/PropertyColumnTableDescription.java#L185-L197 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.jaas.common/src/com/ibm/ws/security/jaas/common/internal/JAASLoginContextEntryImpl.java | JAASLoginContextEntryImpl.setJaasLoginModuleConfig | @Reference(cardinality = ReferenceCardinality.MULTIPLE)
protected void setJaasLoginModuleConfig(JAASLoginModuleConfig lmc, Map<String, Object> props) {
String pid = (String) props.get(KEY_SERVICE_PID);
loginModuleMap.put(pid, lmc);
} | java | @Reference(cardinality = ReferenceCardinality.MULTIPLE)
protected void setJaasLoginModuleConfig(JAASLoginModuleConfig lmc, Map<String, Object> props) {
String pid = (String) props.get(KEY_SERVICE_PID);
loginModuleMap.put(pid, lmc);
} | [
"@",
"Reference",
"(",
"cardinality",
"=",
"ReferenceCardinality",
".",
"MULTIPLE",
")",
"protected",
"void",
"setJaasLoginModuleConfig",
"(",
"JAASLoginModuleConfig",
"lmc",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"props",
")",
"{",
"String",
"pid",
"=",... | SINCE THIS IS A STATIC REFERENCE DS provides enough synchronization so that we don't need to synchronize on the map. | [
"SINCE",
"THIS",
"IS",
"A",
"STATIC",
"REFERENCE",
"DS",
"provides",
"enough",
"synchronization",
"so",
"that",
"we",
"don",
"t",
"need",
"to",
"synchronize",
"on",
"the",
"map",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jaas.common/src/com/ibm/ws/security/jaas/common/internal/JAASLoginContextEntryImpl.java#L55-L59 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VirtualNetworkTapsInner.java | VirtualNetworkTapsInner.beginCreateOrUpdate | public VirtualNetworkTapInner beginCreateOrUpdate(String resourceGroupName, String tapName, VirtualNetworkTapInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, tapName, parameters).toBlocking().single().body();
} | java | public VirtualNetworkTapInner beginCreateOrUpdate(String resourceGroupName, String tapName, VirtualNetworkTapInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, tapName, parameters).toBlocking().single().body();
} | [
"public",
"VirtualNetworkTapInner",
"beginCreateOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"tapName",
",",
"VirtualNetworkTapInner",
"parameters",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"tapName",
"... | Creates or updates a Virtual Network Tap.
@param resourceGroupName The name of the resource group.
@param tapName The name of the virtual network tap.
@param parameters Parameters supplied to the create or update virtual network tap 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 VirtualNetworkTapInner object if successful. | [
"Creates",
"or",
"updates",
"a",
"Virtual",
"Network",
"Tap",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VirtualNetworkTapsInner.java#L437-L439 |
vatbub/common | view/core/src/main/java/com/github/vatbub/common/view/core/CustomGroup.java | CustomGroup.getRectangleByCoordinatesPreferFront | public Rectangle getRectangleByCoordinatesPreferFront(double x, double y) {
for (int i = this.getChildren().size() - 1; i >= 0; i--) {
Node node = this.getChildren().get(i);
if (node instanceof Rectangle) {
Rectangle rectangle = (Rectangle) node;
if (x >= rectangle.getX() && x <= (rectangle.getX() + rectangle.getWidth()) && y >= rectangle.getY() && y <= (rectangle.getY() + rectangle.getHeight())) {
// region is correct
return rectangle;
}
}
}
// nothing found, return null
return null;
} | java | public Rectangle getRectangleByCoordinatesPreferFront(double x, double y) {
for (int i = this.getChildren().size() - 1; i >= 0; i--) {
Node node = this.getChildren().get(i);
if (node instanceof Rectangle) {
Rectangle rectangle = (Rectangle) node;
if (x >= rectangle.getX() && x <= (rectangle.getX() + rectangle.getWidth()) && y >= rectangle.getY() && y <= (rectangle.getY() + rectangle.getHeight())) {
// region is correct
return rectangle;
}
}
}
// nothing found, return null
return null;
} | [
"public",
"Rectangle",
"getRectangleByCoordinatesPreferFront",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"this",
".",
"getChildren",
"(",
")",
".",
"size",
"(",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
... | Gets the rectangle at the specified coordinates if there is one. The coordinates may even point in the middle of a rectangle to be found. Searches from the foreground to the background which means that rectangles in front of other rectangles will be preferred.
<br>
<b>Only finds Rectangles, no other shapes</b>
@param x The x-coordinate of the point to look for.
@param y The y-coordinate of the point to look for.
@return The rectangle that was found or {@code null} if none was found. | [
"Gets",
"the",
"rectangle",
"at",
"the",
"specified",
"coordinates",
"if",
"there",
"is",
"one",
".",
"The",
"coordinates",
"may",
"even",
"point",
"in",
"the",
"middle",
"of",
"a",
"rectangle",
"to",
"be",
"found",
".",
"Searches",
"from",
"the",
"foregro... | train | https://github.com/vatbub/common/blob/8b9fd2ece0a23d520ce53b66c84cbd094e378443/view/core/src/main/java/com/github/vatbub/common/view/core/CustomGroup.java#L79-L93 |
aws/aws-sdk-java | aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/AmazonS3Client.java | AmazonS3Client.addParameterIfNotNull | private static void addParameterIfNotNull(Request<?> request, String paramName, Integer paramValue) {
if (paramValue != null) {
addParameterIfNotNull(request, paramName, paramValue.toString());
}
} | java | private static void addParameterIfNotNull(Request<?> request, String paramName, Integer paramValue) {
if (paramValue != null) {
addParameterIfNotNull(request, paramName, paramValue.toString());
}
} | [
"private",
"static",
"void",
"addParameterIfNotNull",
"(",
"Request",
"<",
"?",
">",
"request",
",",
"String",
"paramName",
",",
"Integer",
"paramValue",
")",
"{",
"if",
"(",
"paramValue",
"!=",
"null",
")",
"{",
"addParameterIfNotNull",
"(",
"request",
",",
... | Adds the specified parameter to the specified request, if the parameter
value is not null.
@param request
The request to add the parameter to.
@param paramName
The parameter name.
@param paramValue
The parameter value. | [
"Adds",
"the",
"specified",
"parameter",
"to",
"the",
"specified",
"request",
"if",
"the",
"parameter",
"value",
"is",
"not",
"null",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/AmazonS3Client.java#L4454-L4458 |
RestComm/media-core | rtp/src/main/java/org/restcomm/media/core/rtp/crypto/SRTPCipherCTR.java | SRTPCipherCTR.getCipherStream | public void getCipherStream(BlockCipher aesCipher, byte[] out, int length, byte[] iv) {
System.arraycopy(iv, 0, cipherInBlock, 0, 14);
int ctr;
for (ctr = 0; ctr < length / BLKLEN; ctr++) {
// compute the cipher stream
cipherInBlock[14] = (byte) ((ctr & 0xFF00) >> 8);
cipherInBlock[15] = (byte) ((ctr & 0x00FF));
aesCipher.processBlock(cipherInBlock, 0, out, ctr * BLKLEN);
}
// Treat the last bytes:
cipherInBlock[14] = (byte) ((ctr & 0xFF00) >> 8);
cipherInBlock[15] = (byte) ((ctr & 0x00FF));
aesCipher.processBlock(cipherInBlock, 0, tmpCipherBlock, 0);
System.arraycopy(tmpCipherBlock, 0, out, ctr * BLKLEN, length % BLKLEN);
} | java | public void getCipherStream(BlockCipher aesCipher, byte[] out, int length, byte[] iv) {
System.arraycopy(iv, 0, cipherInBlock, 0, 14);
int ctr;
for (ctr = 0; ctr < length / BLKLEN; ctr++) {
// compute the cipher stream
cipherInBlock[14] = (byte) ((ctr & 0xFF00) >> 8);
cipherInBlock[15] = (byte) ((ctr & 0x00FF));
aesCipher.processBlock(cipherInBlock, 0, out, ctr * BLKLEN);
}
// Treat the last bytes:
cipherInBlock[14] = (byte) ((ctr & 0xFF00) >> 8);
cipherInBlock[15] = (byte) ((ctr & 0x00FF));
aesCipher.processBlock(cipherInBlock, 0, tmpCipherBlock, 0);
System.arraycopy(tmpCipherBlock, 0, out, ctr * BLKLEN, length % BLKLEN);
} | [
"public",
"void",
"getCipherStream",
"(",
"BlockCipher",
"aesCipher",
",",
"byte",
"[",
"]",
"out",
",",
"int",
"length",
",",
"byte",
"[",
"]",
"iv",
")",
"{",
"System",
".",
"arraycopy",
"(",
"iv",
",",
"0",
",",
"cipherInBlock",
",",
"0",
",",
"14... | Computes the cipher stream for AES CM mode. See section 4.1.1 in RFC3711
for detailed description.
@param out
byte array holding the output cipher stream
@param length
length of the cipher stream to produce, in bytes
@param iv
initialization vector used to generate this cipher stream | [
"Computes",
"the",
"cipher",
"stream",
"for",
"AES",
"CM",
"mode",
".",
"See",
"section",
"4",
".",
"1",
".",
"1",
"in",
"RFC3711",
"for",
"detailed",
"description",
"."
] | train | https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/rtp/src/main/java/org/restcomm/media/core/rtp/crypto/SRTPCipherCTR.java#L85-L103 |
astrapi69/jaulp-wicket | jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/link/LinkUtils.java | LinkUtils.newExternalLink | public static ExternalLink newExternalLink(final String linkId, final String url,
final String labelId, final String resourceModelKey, final Component component)
{
return newExternalLink(linkId, url, labelId, resourceModelKey, null, component);
} | java | public static ExternalLink newExternalLink(final String linkId, final String url,
final String labelId, final String resourceModelKey, final Component component)
{
return newExternalLink(linkId, url, labelId, resourceModelKey, null, component);
} | [
"public",
"static",
"ExternalLink",
"newExternalLink",
"(",
"final",
"String",
"linkId",
",",
"final",
"String",
"url",
",",
"final",
"String",
"labelId",
",",
"final",
"String",
"resourceModelKey",
",",
"final",
"Component",
"component",
")",
"{",
"return",
"ne... | Creates an external link from the given parameters.
@param linkId
the link id
@param url
the external url
@param labelId
the label id
@param resourceModelKey
the resource model key
@param component
the component
@return the external link | [
"Creates",
"an",
"external",
"link",
"from",
"the",
"given",
"parameters",
"."
] | train | https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/link/LinkUtils.java#L178-L182 |
jhy/jsoup | src/main/java/org/jsoup/Jsoup.java | Jsoup.parseBodyFragment | public static Document parseBodyFragment(String bodyHtml, String baseUri) {
return Parser.parseBodyFragment(bodyHtml, baseUri);
} | java | public static Document parseBodyFragment(String bodyHtml, String baseUri) {
return Parser.parseBodyFragment(bodyHtml, baseUri);
} | [
"public",
"static",
"Document",
"parseBodyFragment",
"(",
"String",
"bodyHtml",
",",
"String",
"baseUri",
")",
"{",
"return",
"Parser",
".",
"parseBodyFragment",
"(",
"bodyHtml",
",",
"baseUri",
")",
";",
"}"
] | Parse a fragment of HTML, with the assumption that it forms the {@code body} of the HTML.
@param bodyHtml body HTML fragment
@param baseUri URL to resolve relative URLs against.
@return sane HTML document
@see Document#body() | [
"Parse",
"a",
"fragment",
"of",
"HTML",
"with",
"the",
"assumption",
"that",
"it",
"forms",
"the",
"{",
"@code",
"body",
"}",
"of",
"the",
"HTML",
"."
] | train | https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/Jsoup.java#L147-L149 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/SortedBugCollection.java | SortedBugCollection.cloneAll | public static void cloneAll(Collection<BugInstance> dest, Collection<BugInstance> source) {
for (BugInstance obj : source) {
dest.add((BugInstance) obj.clone());
}
} | java | public static void cloneAll(Collection<BugInstance> dest, Collection<BugInstance> source) {
for (BugInstance obj : source) {
dest.add((BugInstance) obj.clone());
}
} | [
"public",
"static",
"void",
"cloneAll",
"(",
"Collection",
"<",
"BugInstance",
">",
"dest",
",",
"Collection",
"<",
"BugInstance",
">",
"source",
")",
"{",
"for",
"(",
"BugInstance",
"obj",
":",
"source",
")",
"{",
"dest",
".",
"add",
"(",
"(",
"BugInsta... | Clone all of the BugInstance objects in the source Collection and add
them to the destination Collection.
@param dest
the destination Collection
@param source
the source Collection | [
"Clone",
"all",
"of",
"the",
"BugInstance",
"objects",
"in",
"the",
"source",
"Collection",
"and",
"add",
"them",
"to",
"the",
"destination",
"Collection",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/SortedBugCollection.java#L813-L817 |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/mediasource/dam/impl/DefaultRenditionHandler.java | DefaultRenditionHandler.getVirtualRendition | private RenditionMetadata getVirtualRendition(final Set<RenditionMetadata> candidates, MediaArgs mediaArgs) {
// get from fixed with/height
if (mediaArgs.getFixedWidth() > 0 || mediaArgs.getFixedHeight() > 0) {
long destWidth = mediaArgs.getFixedWidth();
long destHeight = mediaArgs.getFixedHeight();
double destRatio = 0;
if (destWidth > 0 && destHeight > 0) {
destRatio = (double)destWidth / (double)destHeight;
}
return getVirtualRendition(candidates, destWidth, destHeight, destRatio);
}
// or from any media format
return visitMediaFormats(mediaArgs, new MediaFormatVisitor<RenditionMetadata>() {
@Override
public RenditionMetadata visit(MediaFormat mediaFormat) {
int destWidth = (int)mediaFormat.getEffectiveMinWidth();
int destHeight = (int)mediaFormat.getEffectiveMinHeight();
double destRatio = mediaFormat.getRatio();
// try to find matching rendition, otherwise check for next media format
RenditionMetadata rendition = getVirtualRendition(candidates, destWidth, destHeight, destRatio);
if (rendition != null) {
rendition.setMediaFormat(mediaFormat);
}
return rendition;
}
});
} | java | private RenditionMetadata getVirtualRendition(final Set<RenditionMetadata> candidates, MediaArgs mediaArgs) {
// get from fixed with/height
if (mediaArgs.getFixedWidth() > 0 || mediaArgs.getFixedHeight() > 0) {
long destWidth = mediaArgs.getFixedWidth();
long destHeight = mediaArgs.getFixedHeight();
double destRatio = 0;
if (destWidth > 0 && destHeight > 0) {
destRatio = (double)destWidth / (double)destHeight;
}
return getVirtualRendition(candidates, destWidth, destHeight, destRatio);
}
// or from any media format
return visitMediaFormats(mediaArgs, new MediaFormatVisitor<RenditionMetadata>() {
@Override
public RenditionMetadata visit(MediaFormat mediaFormat) {
int destWidth = (int)mediaFormat.getEffectiveMinWidth();
int destHeight = (int)mediaFormat.getEffectiveMinHeight();
double destRatio = mediaFormat.getRatio();
// try to find matching rendition, otherwise check for next media format
RenditionMetadata rendition = getVirtualRendition(candidates, destWidth, destHeight, destRatio);
if (rendition != null) {
rendition.setMediaFormat(mediaFormat);
}
return rendition;
}
});
} | [
"private",
"RenditionMetadata",
"getVirtualRendition",
"(",
"final",
"Set",
"<",
"RenditionMetadata",
">",
"candidates",
",",
"MediaArgs",
"mediaArgs",
")",
"{",
"// get from fixed with/height",
"if",
"(",
"mediaArgs",
".",
"getFixedWidth",
"(",
")",
">",
"0",
"||",... | Check if a rendition is available from which the required format can be downscaled from and returns
a virtual rendition in this case.
@param candidates Candidates
@param mediaArgs Media args
@return Rendition or null | [
"Check",
"if",
"a",
"rendition",
"is",
"available",
"from",
"which",
"the",
"required",
"format",
"can",
"be",
"downscaled",
"from",
"and",
"returns",
"a",
"virtual",
"rendition",
"in",
"this",
"case",
"."
] | train | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/mediasource/dam/impl/DefaultRenditionHandler.java#L348-L376 |
cuba-platform/yarg | core/modules/core/src/com/haulmont/yarg/formatters/impl/xls/AreaDependencyManager.java | AreaDependencyManager.addDependency | public void addDependency(Area main, Area dependent) {
List<Area> set = areasDependency.get(main);
if (set == null) {
set = new ArrayList<Area>();
areasDependency.put(main, set);
}
set.add(dependent);
} | java | public void addDependency(Area main, Area dependent) {
List<Area> set = areasDependency.get(main);
if (set == null) {
set = new ArrayList<Area>();
areasDependency.put(main, set);
}
set.add(dependent);
} | [
"public",
"void",
"addDependency",
"(",
"Area",
"main",
",",
"Area",
"dependent",
")",
"{",
"List",
"<",
"Area",
">",
"set",
"=",
"areasDependency",
".",
"get",
"(",
"main",
")",
";",
"if",
"(",
"set",
"==",
"null",
")",
"{",
"set",
"=",
"new",
"Ar... | Adds area dependency for formula calculations
@param main Main area
@param dependent Dependent area | [
"Adds",
"area",
"dependency",
"for",
"formula",
"calculations"
] | train | https://github.com/cuba-platform/yarg/blob/d157286cbe29448f3e1f445e8c5dd88808351da0/core/modules/core/src/com/haulmont/yarg/formatters/impl/xls/AreaDependencyManager.java#L40-L48 |
apereo/cas | core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/scripting/ScriptingUtils.java | ScriptingUtils.executeGroovyScript | public static <T> T executeGroovyScript(final GroovyObject groovyObject,
final Object[] args, final Class<T> clazz,
final boolean failOnError) {
return executeGroovyScript(groovyObject, "run", args, clazz, failOnError);
} | java | public static <T> T executeGroovyScript(final GroovyObject groovyObject,
final Object[] args, final Class<T> clazz,
final boolean failOnError) {
return executeGroovyScript(groovyObject, "run", args, clazz, failOnError);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"executeGroovyScript",
"(",
"final",
"GroovyObject",
"groovyObject",
",",
"final",
"Object",
"[",
"]",
"args",
",",
"final",
"Class",
"<",
"T",
">",
"clazz",
",",
"final",
"boolean",
"failOnError",
")",
"{",
"return"... | Execute groovy script.
@param <T> the type parameter
@param groovyObject the groovy object
@param args the args
@param clazz the clazz
@param failOnError the fail on error
@return the result | [
"Execute",
"groovy",
"script",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/scripting/ScriptingUtils.java#L151-L155 |
sebastiangraf/perfidix | src/main/java/org/perfidix/Perfidix.java | Perfidix.setUpBenchmark | public static Benchmark setUpBenchmark(final String[] classes, final Benchmark benchmark) throws ClassNotFoundException {
for (final String each : classes) {
benchmark.add(Class.forName(each));
}
return benchmark;
} | java | public static Benchmark setUpBenchmark(final String[] classes, final Benchmark benchmark) throws ClassNotFoundException {
for (final String each : classes) {
benchmark.add(Class.forName(each));
}
return benchmark;
} | [
"public",
"static",
"Benchmark",
"setUpBenchmark",
"(",
"final",
"String",
"[",
"]",
"classes",
",",
"final",
"Benchmark",
"benchmark",
")",
"throws",
"ClassNotFoundException",
"{",
"for",
"(",
"final",
"String",
"each",
":",
"classes",
")",
"{",
"benchmark",
... | Setting up an existing benchmark with the given number of class-files
@param classes to be benched
@param benchmark to be set up
@return the same {@link Benchmark} object with the classes
@throws ClassNotFoundException thrown if class was not found. | [
"Setting",
"up",
"an",
"existing",
"benchmark",
"with",
"the",
"given",
"number",
"of",
"class",
"-",
"files"
] | train | https://github.com/sebastiangraf/perfidix/blob/f13aa793b6a3055215ed4edbb946c1bb5d564886/src/main/java/org/perfidix/Perfidix.java#L86-L91 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/utils/BsfUtils.java | BsfUtils.stringOrDefault | public static String stringOrDefault(String str, String defaultValue) {
if(isStringValued(str)) return str;
return defaultValue;
} | java | public static String stringOrDefault(String str, String defaultValue) {
if(isStringValued(str)) return str;
return defaultValue;
} | [
"public",
"static",
"String",
"stringOrDefault",
"(",
"String",
"str",
",",
"String",
"defaultValue",
")",
"{",
"if",
"(",
"isStringValued",
"(",
"str",
")",
")",
"return",
"str",
";",
"return",
"defaultValue",
";",
"}"
] | Get the string if is not null or empty,
otherwise return the default value
@param str
@param defaultValue
@return | [
"Get",
"the",
"string",
"if",
"is",
"not",
"null",
"or",
"empty",
"otherwise",
"return",
"the",
"default",
"value"
] | train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/utils/BsfUtils.java#L100-L103 |
weld/core | impl/src/main/java/org/jboss/weld/metadata/Selectors.java | Selectors.matchPath | public static boolean matchPath(String pattern, String str, boolean isCaseSensitive) {
String[] patDirs = tokenize(pattern);
return matchPath(patDirs, tokenize(str), isCaseSensitive);
} | java | public static boolean matchPath(String pattern, String str, boolean isCaseSensitive) {
String[] patDirs = tokenize(pattern);
return matchPath(patDirs, tokenize(str), isCaseSensitive);
} | [
"public",
"static",
"boolean",
"matchPath",
"(",
"String",
"pattern",
",",
"String",
"str",
",",
"boolean",
"isCaseSensitive",
")",
"{",
"String",
"[",
"]",
"patDirs",
"=",
"tokenize",
"(",
"pattern",
")",
";",
"return",
"matchPath",
"(",
"patDirs",
",",
"... | Tests whether or not a given path matches a given pattern.
<p/>
If you need to call this method multiple times with the same pattern you
should rather use TokenizedPattern
@param pattern The pattern to match against. Must not be <code>null</code>
.
@param str The path to match, as a String. Must not be <code>null</code>.
@param isCaseSensitive Whether or not matching should be performed case
sensitively.
@return <code>true</code> if the pattern matches against the string, or
<code>false</code> otherwise.
@see TokenizedPattern | [
"Tests",
"whether",
"or",
"not",
"a",
"given",
"path",
"matches",
"a",
"given",
"pattern",
".",
"<p",
"/",
">",
"If",
"you",
"need",
"to",
"call",
"this",
"method",
"multiple",
"times",
"with",
"the",
"same",
"pattern",
"you",
"should",
"rather",
"use",
... | train | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/metadata/Selectors.java#L72-L75 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_ovhPabx_serviceName_PUT | public void billingAccount_ovhPabx_serviceName_PUT(String billingAccount, String serviceName, OvhOvhPabx body) throws IOException {
String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}";
StringBuilder sb = path(qPath, billingAccount, serviceName);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void billingAccount_ovhPabx_serviceName_PUT(String billingAccount, String serviceName, OvhOvhPabx body) throws IOException {
String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}";
StringBuilder sb = path(qPath, billingAccount, serviceName);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"billingAccount_ovhPabx_serviceName_PUT",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"OvhOvhPabx",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/telephony/{billingAccount}/ovhPabx/{serviceName}\"",
";",
"St... | Alter this object properties
REST: PUT /telephony/{billingAccount}/ovhPabx/{serviceName}
@param body [required] New object properties
@param billingAccount [required] The name of your billingAccount
@param serviceName [required] | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L7019-L7023 |
biezhi/anima | src/main/java/org/sql2o/reflection/PojoMetadata.java | PojoMetadata.readAnnotatedColumnName | private String readAnnotatedColumnName(AnnotatedElement classMember, boolean isJpaColumnInClasspath) {
if (isJpaColumnInClasspath) {
Column columnInformation = classMember.getAnnotation(Column.class);
if (columnInformation != null && !columnInformation.name().isEmpty()) {
return columnInformation.name();
}
}
return null;
} | java | private String readAnnotatedColumnName(AnnotatedElement classMember, boolean isJpaColumnInClasspath) {
if (isJpaColumnInClasspath) {
Column columnInformation = classMember.getAnnotation(Column.class);
if (columnInformation != null && !columnInformation.name().isEmpty()) {
return columnInformation.name();
}
}
return null;
} | [
"private",
"String",
"readAnnotatedColumnName",
"(",
"AnnotatedElement",
"classMember",
",",
"boolean",
"isJpaColumnInClasspath",
")",
"{",
"if",
"(",
"isJpaColumnInClasspath",
")",
"{",
"Column",
"columnInformation",
"=",
"classMember",
".",
"getAnnotation",
"(",
"Colu... | Try to read the {@link io.github.biezhi.anima.annotation.Column} annotation and return the name of the column.
Returns null if no {@link io.github.biezhi.anima.annotation.Column} annotation is present or if the name of the column is empty | [
"Try",
"to",
"read",
"the",
"{"
] | train | https://github.com/biezhi/anima/blob/d6655e47ac4c08d9d7f961ac0569062bead8b1ed/src/main/java/org/sql2o/reflection/PojoMetadata.java#L221-L229 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java | ComponentSupport.createFacetUIPanel | private static UIComponent createFacetUIPanel(FaceletContext ctx, UIComponent parent, String facetName)
{
FacesContext facesContext = ctx.getFacesContext();
UIComponent panel = facesContext.getApplication().createComponent(facesContext, UIPanel.COMPONENT_TYPE, null);
// The panel created by this method is special. To be restored properly and do not
// create duplicate ids or any other unwanted conflicts, it requires an unique id.
// This code is usually called when more than one component is added to a facet and
// it is necessary to create a shared container.
// Use FaceletCompositionContext.generateUniqueComponentId() is not possible, because
// <c:if> blocks inside a facet will make component ids unstable. Use UniqueIdVendor
// is feasible but also will be affected by <c:if> blocks inside a facet.
// The only solution that will generate real unique ids is use the parent id and the
// facet name and derive an unique id that cannot be generated by SectionUniqueIdCounter,
// doing the same trick as with metadata: use a double __ and add a prefix (f).
// Note this id will never be printed into the response, because this is just a container.
FaceletCompositionContext mctx = FaceletCompositionContext.getCurrentInstance(ctx);
UniqueIdVendor uniqueIdVendor = mctx.getUniqueIdVendorFromStack();
if (uniqueIdVendor == null)
{
uniqueIdVendor = ComponentSupport.getViewRoot(ctx, parent);
}
if (uniqueIdVendor != null)
{
// UIViewRoot implements UniqueIdVendor, so there is no need to cast to UIViewRoot
// and call createUniqueId(). See ComponentTagHandlerDelegate
int index = facetName.indexOf('.');
String cleanFacetName = facetName;
if (index >= 0)
{
cleanFacetName = facetName.replace('.', '_');
}
panel.setId(uniqueIdVendor.createUniqueId(facesContext,
mctx.getSharedStringBuilder()
.append(parent.getId())
.append("__f_")
.append(cleanFacetName).toString()));
}
panel.getAttributes().put(FACET_CREATED_UIPANEL_MARKER, Boolean.TRUE);
panel.getAttributes().put(ComponentSupport.COMPONENT_ADDED_BY_HANDLER_MARKER, Boolean.TRUE);
return panel;
} | java | private static UIComponent createFacetUIPanel(FaceletContext ctx, UIComponent parent, String facetName)
{
FacesContext facesContext = ctx.getFacesContext();
UIComponent panel = facesContext.getApplication().createComponent(facesContext, UIPanel.COMPONENT_TYPE, null);
// The panel created by this method is special. To be restored properly and do not
// create duplicate ids or any other unwanted conflicts, it requires an unique id.
// This code is usually called when more than one component is added to a facet and
// it is necessary to create a shared container.
// Use FaceletCompositionContext.generateUniqueComponentId() is not possible, because
// <c:if> blocks inside a facet will make component ids unstable. Use UniqueIdVendor
// is feasible but also will be affected by <c:if> blocks inside a facet.
// The only solution that will generate real unique ids is use the parent id and the
// facet name and derive an unique id that cannot be generated by SectionUniqueIdCounter,
// doing the same trick as with metadata: use a double __ and add a prefix (f).
// Note this id will never be printed into the response, because this is just a container.
FaceletCompositionContext mctx = FaceletCompositionContext.getCurrentInstance(ctx);
UniqueIdVendor uniqueIdVendor = mctx.getUniqueIdVendorFromStack();
if (uniqueIdVendor == null)
{
uniqueIdVendor = ComponentSupport.getViewRoot(ctx, parent);
}
if (uniqueIdVendor != null)
{
// UIViewRoot implements UniqueIdVendor, so there is no need to cast to UIViewRoot
// and call createUniqueId(). See ComponentTagHandlerDelegate
int index = facetName.indexOf('.');
String cleanFacetName = facetName;
if (index >= 0)
{
cleanFacetName = facetName.replace('.', '_');
}
panel.setId(uniqueIdVendor.createUniqueId(facesContext,
mctx.getSharedStringBuilder()
.append(parent.getId())
.append("__f_")
.append(cleanFacetName).toString()));
}
panel.getAttributes().put(FACET_CREATED_UIPANEL_MARKER, Boolean.TRUE);
panel.getAttributes().put(ComponentSupport.COMPONENT_ADDED_BY_HANDLER_MARKER, Boolean.TRUE);
return panel;
} | [
"private",
"static",
"UIComponent",
"createFacetUIPanel",
"(",
"FaceletContext",
"ctx",
",",
"UIComponent",
"parent",
",",
"String",
"facetName",
")",
"{",
"FacesContext",
"facesContext",
"=",
"ctx",
".",
"getFacesContext",
"(",
")",
";",
"UIComponent",
"panel",
"... | Create a new UIPanel for the use as a dynamically
created container for multiple children in a facet.
Duplicate in javax.faces.webapp.UIComponentClassicTagBase.
@param facesContext
@return | [
"Create",
"a",
"new",
"UIPanel",
"for",
"the",
"use",
"as",
"a",
"dynamically",
"created",
"container",
"for",
"multiple",
"children",
"in",
"a",
"facet",
".",
"Duplicate",
"in",
"javax",
".",
"faces",
".",
"webapp",
".",
"UIComponentClassicTagBase",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java#L577-L618 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/ServerCommsDiagnosticModule.java | ServerCommsDiagnosticModule.dumpServerConversation | private void dumpServerConversation(IncidentStream is, Conversation conv)
{
if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "dumpServerConversation", new Object[]{is, conv});
final ConversationState convState = (ConversationState) conv.getAttachment();
final List allObjs = convState.getAllObjects();
is.writeLine("Number of associated resources", allObjs.size());
for (final Iterator i2 = allObjs.iterator(); i2.hasNext();)
{
final Object obj = i2.next();
if (obj instanceof SICoreConnection)
{
final SICoreConnection conn = (SICoreConnection) obj;
is.writeLine(" ",
"SICoreConnection@" + Integer.toHexString(obj.hashCode()) + ": " +
"ME Name: " + conn.getMeName() + " [" + conn.getMeUuid() + "] " +
"Version: " + conn.getApiLevelDescription());
}
else
{
is.writeLine(" ", obj);
}
}
if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "dumpServerConversation");
} | java | private void dumpServerConversation(IncidentStream is, Conversation conv)
{
if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "dumpServerConversation", new Object[]{is, conv});
final ConversationState convState = (ConversationState) conv.getAttachment();
final List allObjs = convState.getAllObjects();
is.writeLine("Number of associated resources", allObjs.size());
for (final Iterator i2 = allObjs.iterator(); i2.hasNext();)
{
final Object obj = i2.next();
if (obj instanceof SICoreConnection)
{
final SICoreConnection conn = (SICoreConnection) obj;
is.writeLine(" ",
"SICoreConnection@" + Integer.toHexString(obj.hashCode()) + ": " +
"ME Name: " + conn.getMeName() + " [" + conn.getMeUuid() + "] " +
"Version: " + conn.getApiLevelDescription());
}
else
{
is.writeLine(" ", obj);
}
}
if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "dumpServerConversation");
} | [
"private",
"void",
"dumpServerConversation",
"(",
"IncidentStream",
"is",
",",
"Conversation",
"conv",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
... | Dumps the details of a particular server conversation.
@param is the incident stream to log information to.
@param conv the conversation we want to dump. | [
"Dumps",
"the",
"details",
"of",
"a",
"particular",
"server",
"conversation",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/ServerCommsDiagnosticModule.java#L216-L243 |
pac4j/pac4j | pac4j-core/src/main/java/org/pac4j/core/util/CommonHelper.java | CommonHelper.toNiceString | public static String toNiceString(final Class<?> clazz, final Object... args) {
final StringBuilder sb = new StringBuilder();
sb.append("#");
sb.append(clazz.getSimpleName());
sb.append("# |");
boolean b = true;
for (final Object arg : args) {
if (b) {
sb.append(" ");
sb.append(arg);
sb.append(":");
} else {
sb.append(" ");
sb.append(arg);
sb.append(" |");
}
b = !b;
}
return sb.toString();
} | java | public static String toNiceString(final Class<?> clazz, final Object... args) {
final StringBuilder sb = new StringBuilder();
sb.append("#");
sb.append(clazz.getSimpleName());
sb.append("# |");
boolean b = true;
for (final Object arg : args) {
if (b) {
sb.append(" ");
sb.append(arg);
sb.append(":");
} else {
sb.append(" ");
sb.append(arg);
sb.append(" |");
}
b = !b;
}
return sb.toString();
} | [
"public",
"static",
"String",
"toNiceString",
"(",
"final",
"Class",
"<",
"?",
">",
"clazz",
",",
"final",
"Object",
"...",
"args",
")",
"{",
"final",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"\"#\"",
... | Build a "nice toString" for an object.
@param clazz class
@param args arguments
@return a "nice toString" text | [
"Build",
"a",
"nice",
"toString",
"for",
"an",
"object",
"."
] | train | https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-core/src/main/java/org/pac4j/core/util/CommonHelper.java#L208-L227 |
salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/service/jpa/DefaultJPAService.java | DefaultJPAService.mergeEntity | public <E extends Identifiable> E mergeEntity(EntityManager em, E entity) {
requireArgument(em != null, "The entity manager cannot be null.");
requireArgument(entity != null, "The entity cannot be null.");
E ret = em.merge(entity);
return ret;
} | java | public <E extends Identifiable> E mergeEntity(EntityManager em, E entity) {
requireArgument(em != null, "The entity manager cannot be null.");
requireArgument(entity != null, "The entity cannot be null.");
E ret = em.merge(entity);
return ret;
} | [
"public",
"<",
"E",
"extends",
"Identifiable",
">",
"E",
"mergeEntity",
"(",
"EntityManager",
"em",
",",
"E",
"entity",
")",
"{",
"requireArgument",
"(",
"em",
"!=",
"null",
",",
"\"The entity manager cannot be null.\"",
")",
";",
"requireArgument",
"(",
"entity... | Persists an entity to the database.
@param <E> The entity type.
@param em The entity manager to use. Cannot be null.
@param entity The entity to persist. Cannot be null.
@return The persisted entity having all updates applied. | [
"Persists",
"an",
"entity",
"to",
"the",
"database",
"."
] | train | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/service/jpa/DefaultJPAService.java#L88-L93 |
UrielCh/ovh-java-sdk | ovh-java-sdk-vrack/src/main/java/net/minidev/ovh/api/ApiOvhVrack.java | ApiOvhVrack.serviceName_cloudProject_project_GET | public OvhCloudProject serviceName_cloudProject_project_GET(String serviceName, String project) throws IOException {
String qPath = "/vrack/{serviceName}/cloudProject/{project}";
StringBuilder sb = path(qPath, serviceName, project);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhCloudProject.class);
} | java | public OvhCloudProject serviceName_cloudProject_project_GET(String serviceName, String project) throws IOException {
String qPath = "/vrack/{serviceName}/cloudProject/{project}";
StringBuilder sb = path(qPath, serviceName, project);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhCloudProject.class);
} | [
"public",
"OvhCloudProject",
"serviceName_cloudProject_project_GET",
"(",
"String",
"serviceName",
",",
"String",
"project",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/vrack/{serviceName}/cloudProject/{project}\"",
";",
"StringBuilder",
"sb",
"=",
"path"... | Get this object properties
REST: GET /vrack/{serviceName}/cloudProject/{project}
@param serviceName [required] The internal name of your vrack
@param project [required] publicCloud project | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-vrack/src/main/java/net/minidev/ovh/api/ApiOvhVrack.java#L684-L689 |
samskivert/samskivert | src/main/java/com/samskivert/util/Calendars.java | Calendars.at | public static Builder at (int year, int month, int day)
{
Calendar calendar = Calendar.getInstance();
calendar.set(year, month, day);
return with(calendar).zeroTime();
} | java | public static Builder at (int year, int month, int day)
{
Calendar calendar = Calendar.getInstance();
calendar.set(year, month, day);
return with(calendar).zeroTime();
} | [
"public",
"static",
"Builder",
"at",
"(",
"int",
"year",
",",
"int",
"month",
",",
"int",
"day",
")",
"{",
"Calendar",
"calendar",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"calendar",
".",
"set",
"(",
"year",
",",
"month",
",",
"day",
")",... | Returns a fluent wrapper around a calendar configured to zero milliseconds after midnight on
the specified day in the specified month and year.
@param year a regular year value, like 1900
@param month a 0-based month value, like {@link Calendar#JANUARY}
@param day a regular day of the month value, like 31 | [
"Returns",
"a",
"fluent",
"wrapper",
"around",
"a",
"calendar",
"configured",
"to",
"zero",
"milliseconds",
"after",
"midnight",
"on",
"the",
"specified",
"day",
"in",
"the",
"specified",
"month",
"and",
"year",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/Calendars.java#L199-L204 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.