repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1 value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1 value |
|---|---|---|---|---|---|---|---|---|---|---|---|
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/sdx_network_config.java | sdx_network_config.get | public static sdx_network_config get(nitro_service client) throws Exception
{
sdx_network_config resource = new sdx_network_config();
resource.validate("get");
return ((sdx_network_config[]) resource.get_resources(client))[0];
} | java | public static sdx_network_config get(nitro_service client) throws Exception
{
sdx_network_config resource = new sdx_network_config();
resource.validate("get");
return ((sdx_network_config[]) resource.get_resources(client))[0];
} | [
"public",
"static",
"sdx_network_config",
"get",
"(",
"nitro_service",
"client",
")",
"throws",
"Exception",
"{",
"sdx_network_config",
"resource",
"=",
"new",
"sdx_network_config",
"(",
")",
";",
"resource",
".",
"validate",
"(",
"\"get\"",
")",
";",
"return",
... | Use this operation to get SDX network configuration. | [
"Use",
"this",
"operation",
"to",
"get",
"SDX",
"network",
"configuration",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/sdx_network_config.java#L188-L193 | train |
victims/victims-lib-java | src/main/java/com/redhat/victims/database/VictimsSqlDB.java | VictimsSqlDB.getVulnerabilities | protected HashSet<String> getVulnerabilities(int recordId)
throws SQLException {
HashSet<String> cves = new HashSet<String>();
Connection connection = getConnection();
try {
PreparedStatement ps = setObjects(connection, Query.FIND_CVES,
recordId);
ResultSet matches = ps.executeQuery();
while (matches.next()) {
cves.add(matches.getString(1));
}
matches.close();
} finally {
connection.close();
}
return cves;
} | java | protected HashSet<String> getVulnerabilities(int recordId)
throws SQLException {
HashSet<String> cves = new HashSet<String>();
Connection connection = getConnection();
try {
PreparedStatement ps = setObjects(connection, Query.FIND_CVES,
recordId);
ResultSet matches = ps.executeQuery();
while (matches.next()) {
cves.add(matches.getString(1));
}
matches.close();
} finally {
connection.close();
}
return cves;
} | [
"protected",
"HashSet",
"<",
"String",
">",
"getVulnerabilities",
"(",
"int",
"recordId",
")",
"throws",
"SQLException",
"{",
"HashSet",
"<",
"String",
">",
"cves",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"Connection",
"connection",
"=",
... | Returns CVEs that are ascociated with a given record id.
@param recordId
@return
@throws SQLException | [
"Returns",
"CVEs",
"that",
"are",
"ascociated",
"with",
"a",
"given",
"record",
"id",
"."
] | ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b | https://github.com/victims/victims-lib-java/blob/ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b/src/main/java/com/redhat/victims/database/VictimsSqlDB.java#L247-L263 | train |
victims/victims-lib-java | src/main/java/com/redhat/victims/database/VictimsSqlDB.java | VictimsSqlDB.getEmbeddedRecords | protected HashSet<Integer> getEmbeddedRecords(Set<String> hashes)
throws SQLException {
HashSet<Integer> results = new HashSet<Integer>();
Connection connection = getConnection();
PreparedStatement ps = setObjects(connection,
Query.FILEHASH_EMBEDDED_MATCH, (Object) hashes.toArray());
try {
ResultSet resultSet = ps.executeQuery();
while (resultSet.next()) {
results.add(resultSet.getInt("record"));
}
resultSet.close();
} finally {
connection.close();
}
return results;
} | java | protected HashSet<Integer> getEmbeddedRecords(Set<String> hashes)
throws SQLException {
HashSet<Integer> results = new HashSet<Integer>();
Connection connection = getConnection();
PreparedStatement ps = setObjects(connection,
Query.FILEHASH_EMBEDDED_MATCH, (Object) hashes.toArray());
try {
ResultSet resultSet = ps.executeQuery();
while (resultSet.next()) {
results.add(resultSet.getInt("record"));
}
resultSet.close();
} finally {
connection.close();
}
return results;
} | [
"protected",
"HashSet",
"<",
"Integer",
">",
"getEmbeddedRecords",
"(",
"Set",
"<",
"String",
">",
"hashes",
")",
"throws",
"SQLException",
"{",
"HashSet",
"<",
"Integer",
">",
"results",
"=",
"new",
"HashSet",
"<",
"Integer",
">",
"(",
")",
";",
"Connecti... | Fetch record id's from the local database that is composed entirely of
hashes in the set of hashes provided.
@param hashes
@return A set record ids
@throws SQLException | [
"Fetch",
"record",
"id",
"s",
"from",
"the",
"local",
"database",
"that",
"is",
"composed",
"entirely",
"of",
"hashes",
"in",
"the",
"set",
"of",
"hashes",
"provided",
"."
] | ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b | https://github.com/victims/victims-lib-java/blob/ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b/src/main/java/com/redhat/victims/database/VictimsSqlDB.java#L320-L336 | train |
hedyn/wsonrpc | wsonrpc-client/src/main/java/net/apexes/wsonrpc/client/support/websocket/WebSocketClient.java | WebSocketClient.connect | public synchronized void connect() {
if (state != State.NONE) {
eventHandler.onError(new WebSocketException("connect() already called"));
close();
return;
}
getIntializer().setName(getInnerThread(), THREAD_BASE_NAME + "Reader-" + clientId);
state = State.CONNECTING;
getInnerThread().start();
} | java | public synchronized void connect() {
if (state != State.NONE) {
eventHandler.onError(new WebSocketException("connect() already called"));
close();
return;
}
getIntializer().setName(getInnerThread(), THREAD_BASE_NAME + "Reader-" + clientId);
state = State.CONNECTING;
getInnerThread().start();
} | [
"public",
"synchronized",
"void",
"connect",
"(",
")",
"{",
"if",
"(",
"state",
"!=",
"State",
".",
"NONE",
")",
"{",
"eventHandler",
".",
"onError",
"(",
"new",
"WebSocketException",
"(",
"\"connect() already called\"",
")",
")",
";",
"close",
"(",
")",
"... | Start up the socket. This is non-blocking, it will fire up the threads used by the library and then trigger the
onOpen handler once the connection is established. | [
"Start",
"up",
"the",
"socket",
".",
"This",
"is",
"non",
"-",
"blocking",
"it",
"will",
"fire",
"up",
"the",
"threads",
"used",
"by",
"the",
"library",
"and",
"then",
"trigger",
"the",
"onOpen",
"handler",
"once",
"the",
"connection",
"is",
"established",... | decbaad4cb8145590bab039d5cfe12437ada0d0a | https://github.com/hedyn/wsonrpc/blob/decbaad4cb8145590bab039d5cfe12437ada0d0a/wsonrpc-client/src/main/java/net/apexes/wsonrpc/client/support/websocket/WebSocketClient.java#L136-L145 | train |
hedyn/wsonrpc | wsonrpc-client/src/main/java/net/apexes/wsonrpc/client/support/websocket/WebSocketClient.java | WebSocketClient.close | public synchronized void close() {
switch (state) {
case NONE:
state = State.DISCONNECTED;
return;
case CONNECTING:
// don't wait for an established connection, just close the tcp socket
closeSocket();
return;
case CONNECTED:
// This method also shuts down the writer
// the socket will be closed once the ack for the close was received
sendCloseHandshake(true);
return;
case DISCONNECTING:
return; // no-op;
case DISCONNECTED:
return; // No-op
}
} | java | public synchronized void close() {
switch (state) {
case NONE:
state = State.DISCONNECTED;
return;
case CONNECTING:
// don't wait for an established connection, just close the tcp socket
closeSocket();
return;
case CONNECTED:
// This method also shuts down the writer
// the socket will be closed once the ack for the close was received
sendCloseHandshake(true);
return;
case DISCONNECTING:
return; // no-op;
case DISCONNECTED:
return; // No-op
}
} | [
"public",
"synchronized",
"void",
"close",
"(",
")",
"{",
"switch",
"(",
"state",
")",
"{",
"case",
"NONE",
":",
"state",
"=",
"State",
".",
"DISCONNECTED",
";",
"return",
";",
"case",
"CONNECTING",
":",
"// don't wait for an established connection, just close the... | Close down the socket. Will trigger the onClose handler if the socket has not been previously closed. | [
"Close",
"down",
"the",
"socket",
".",
"Will",
"trigger",
"the",
"onClose",
"handler",
"if",
"the",
"socket",
"has",
"not",
"been",
"previously",
"closed",
"."
] | decbaad4cb8145590bab039d5cfe12437ada0d0a | https://github.com/hedyn/wsonrpc/blob/decbaad4cb8145590bab039d5cfe12437ada0d0a/wsonrpc-client/src/main/java/net/apexes/wsonrpc/client/support/websocket/WebSocketClient.java#L198-L217 | train |
hedyn/wsonrpc | wsonrpc-client/src/main/java/net/apexes/wsonrpc/client/support/websocket/WebSocketClient.java | WebSocketClient.blockClose | public void blockClose() throws InterruptedException {
// If the thread is new, it will never run, since we closed the connection before we actually connected
if (writer.getInnerThread().getState() != Thread.State.NEW) {
writer.getInnerThread().join();
}
getInnerThread().join();
} | java | public void blockClose() throws InterruptedException {
// If the thread is new, it will never run, since we closed the connection before we actually connected
if (writer.getInnerThread().getState() != Thread.State.NEW) {
writer.getInnerThread().join();
}
getInnerThread().join();
} | [
"public",
"void",
"blockClose",
"(",
")",
"throws",
"InterruptedException",
"{",
"// If the thread is new, it will never run, since we closed the connection before we actually connected\r",
"if",
"(",
"writer",
".",
"getInnerThread",
"(",
")",
".",
"getState",
"(",
")",
"!=",... | Blocks until both threads exit. The actual close must be triggered separately. This is just a convenience
method to make sure everything shuts down, if desired.
@throws InterruptedException | [
"Blocks",
"until",
"both",
"threads",
"exit",
".",
"The",
"actual",
"close",
"must",
"be",
"triggered",
"separately",
".",
"This",
"is",
"just",
"a",
"convenience",
"method",
"to",
"make",
"sure",
"everything",
"shuts",
"down",
"if",
"desired",
"."
] | decbaad4cb8145590bab039d5cfe12437ada0d0a | https://github.com/hedyn/wsonrpc/blob/decbaad4cb8145590bab039d5cfe12437ada0d0a/wsonrpc-client/src/main/java/net/apexes/wsonrpc/client/support/websocket/WebSocketClient.java#L305-L311 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_image.java | ns_image.get_filtered | public static ns_image[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception
{
ns_image obj = new ns_image();
options option = new options();
option.set_filter(filter);
ns_image[] response = (ns_image[]) obj.getfiltered(service, option);
return response;
} | java | public static ns_image[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception
{
ns_image obj = new ns_image();
options option = new options();
option.set_filter(filter);
ns_image[] response = (ns_image[]) obj.getfiltered(service, option);
return response;
} | [
"public",
"static",
"ns_image",
"[",
"]",
"get_filtered",
"(",
"nitro_service",
"service",
",",
"filtervalue",
"[",
"]",
"filter",
")",
"throws",
"Exception",
"{",
"ns_image",
"obj",
"=",
"new",
"ns_image",
"(",
")",
";",
"options",
"option",
"=",
"new",
"... | Use this API to fetch filtered set of ns_image resources.
set the filter parameter values in filtervalue object. | [
"Use",
"this",
"API",
"to",
"fetch",
"filtered",
"set",
"of",
"ns_image",
"resources",
".",
"set",
"the",
"filter",
"parameter",
"values",
"in",
"filtervalue",
"object",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_image.java#L180-L187 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_health_resource.java | xen_health_resource.get_filtered | public static xen_health_resource[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception
{
xen_health_resource obj = new xen_health_resource();
options option = new options();
option.set_filter(filter);
xen_health_resource[] response = (xen_health_resource[]) obj.getfiltered(service, option);
return response;
} | java | public static xen_health_resource[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception
{
xen_health_resource obj = new xen_health_resource();
options option = new options();
option.set_filter(filter);
xen_health_resource[] response = (xen_health_resource[]) obj.getfiltered(service, option);
return response;
} | [
"public",
"static",
"xen_health_resource",
"[",
"]",
"get_filtered",
"(",
"nitro_service",
"service",
",",
"filtervalue",
"[",
"]",
"filter",
")",
"throws",
"Exception",
"{",
"xen_health_resource",
"obj",
"=",
"new",
"xen_health_resource",
"(",
")",
";",
"options"... | Use this API to fetch filtered set of xen_health_resource resources.
set the filter parameter values in filtervalue object. | [
"Use",
"this",
"API",
"to",
"fetch",
"filtered",
"set",
"of",
"xen_health_resource",
"resources",
".",
"set",
"the",
"filter",
"parameter",
"values",
"in",
"filtervalue",
"object",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_health_resource.java#L228-L235 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/context/configure/AbstractConfiguration.java | AbstractConfiguration.convert | protected <T> T convert(final String value, final Class<T> type) {
Assert.notNull(type, "The Class type to convert the String value to cannot be null!");
if (getConversionService().canConvert(String.class, type)) {
return getConversionService().convert(value, type);
}
throw new ConversionException(String.format("Cannot convert String value (%1$s) into a value of type (%2$s)!",
value, type.getName()));
} | java | protected <T> T convert(final String value, final Class<T> type) {
Assert.notNull(type, "The Class type to convert the String value to cannot be null!");
if (getConversionService().canConvert(String.class, type)) {
return getConversionService().convert(value, type);
}
throw new ConversionException(String.format("Cannot convert String value (%1$s) into a value of type (%2$s)!",
value, type.getName()));
} | [
"protected",
"<",
"T",
">",
"T",
"convert",
"(",
"final",
"String",
"value",
",",
"final",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"Assert",
".",
"notNull",
"(",
"type",
",",
"\"The Class type to convert the String value to cannot be null!\"",
")",
";",
"if"... | Converts the configuration setting property value into a value of the specified type.
@param <T> the type of object the String property value is converted into.
@param value the String property value to convert.
@param type the Class type to convert the String property value into.
@return the String property value into a value of type T.
@throws NullPointerException if the specified conversion Class type is null.
@throws ConversionException if the String property value cannot be converted into an object of type T.
@see #getConversionService()
@see org.cp.elements.data.conversion.ConversionService | [
"Converts",
"the",
"configuration",
"setting",
"property",
"value",
"into",
"a",
"value",
"of",
"the",
"specified",
"type",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/context/configure/AbstractConfiguration.java#L116-L125 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/context/configure/AbstractConfiguration.java | AbstractConfiguration.defaultIfUnset | protected String defaultIfUnset(final String value, final String defaultValue) {
return (StringUtils.hasText(value) ? value : defaultValue);
} | java | protected String defaultIfUnset(final String value, final String defaultValue) {
return (StringUtils.hasText(value) ? value : defaultValue);
} | [
"protected",
"String",
"defaultIfUnset",
"(",
"final",
"String",
"value",
",",
"final",
"String",
"defaultValue",
")",
"{",
"return",
"(",
"StringUtils",
".",
"hasText",
"(",
"value",
")",
"?",
"value",
":",
"defaultValue",
")",
";",
"}"
] | Returns value if not blank otherwise returns default value.
@param value the String to evaluate for value (containing text).
@param defaultValue the String value to return if the 'value' is blank.
@return value if it has text otherwise returns the default value.
@see org.cp.elements.lang.StringUtils#hasText(String) | [
"Returns",
"value",
"if",
"not",
"blank",
"otherwise",
"returns",
"default",
"value",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/context/configure/AbstractConfiguration.java#L135-L137 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/context/configure/AbstractConfiguration.java | AbstractConfiguration.isPresent | public boolean isPresent(final String propertyName) {
for (String configurationPropertyName : this) {
if (configurationPropertyName.equals(propertyName)) {
return true;
}
}
return false;
} | java | public boolean isPresent(final String propertyName) {
for (String configurationPropertyName : this) {
if (configurationPropertyName.equals(propertyName)) {
return true;
}
}
return false;
} | [
"public",
"boolean",
"isPresent",
"(",
"final",
"String",
"propertyName",
")",
"{",
"for",
"(",
"String",
"configurationPropertyName",
":",
"this",
")",
"{",
"if",
"(",
"configurationPropertyName",
".",
"equals",
"(",
"propertyName",
")",
")",
"{",
"return",
"... | Determines whether the configuration property identified by name is present in the configuration settings, which
means the configuration property was declared but not necessarily defined.
@param propertyName a String value indicating the name of the configuration property.
@return a boolean value indicating if the property identified by name is present (declared) in the configuration
settings.
@see #isSet(String) | [
"Determines",
"whether",
"the",
"configuration",
"property",
"identified",
"by",
"name",
"is",
"present",
"in",
"the",
"configuration",
"settings",
"which",
"means",
"the",
"configuration",
"property",
"was",
"declared",
"but",
"not",
"necessarily",
"defined",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/context/configure/AbstractConfiguration.java#L148-L156 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/context/configure/AbstractConfiguration.java | AbstractConfiguration.getPropertyValue | public String getPropertyValue(final String propertyName, final boolean required) {
String propertyValue = doGetPropertyValue(propertyName);
if (StringUtils.isBlank(propertyValue) && getParent() != null) {
propertyValue = getParent().getPropertyValue(propertyName, required);
}
if (StringUtils.isBlank(propertyValue) && required) {
throw new ConfigurationException(String.format("The property (%1$s) is required!", propertyName));
}
return defaultIfUnset(propertyValue, null);
} | java | public String getPropertyValue(final String propertyName, final boolean required) {
String propertyValue = doGetPropertyValue(propertyName);
if (StringUtils.isBlank(propertyValue) && getParent() != null) {
propertyValue = getParent().getPropertyValue(propertyName, required);
}
if (StringUtils.isBlank(propertyValue) && required) {
throw new ConfigurationException(String.format("The property (%1$s) is required!", propertyName));
}
return defaultIfUnset(propertyValue, null);
} | [
"public",
"String",
"getPropertyValue",
"(",
"final",
"String",
"propertyName",
",",
"final",
"boolean",
"required",
")",
"{",
"String",
"propertyValue",
"=",
"doGetPropertyValue",
"(",
"propertyName",
")",
";",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"pr... | Gets the value of the configuration property identified by name. The required parameter can be used to indicate
the property is not required and that a ConfigurationException should not be thrown if the property is undeclared
or undefined.
@param propertyName a String value indicating the name of the configuration property.
@param required used to indicate whether the configuration property is required to be declared and defined.
@return the value of the configuration property identified by name.
@throws ConfigurationException if and only if the property is required and the property is either undeclared
or undefined. | [
"Gets",
"the",
"value",
"of",
"the",
"configuration",
"property",
"identified",
"by",
"name",
".",
"The",
"required",
"parameter",
"can",
"be",
"used",
"to",
"indicate",
"the",
"property",
"is",
"not",
"required",
"and",
"that",
"a",
"ConfigurationException",
... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/context/configure/AbstractConfiguration.java#L194-L206 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/context/configure/AbstractConfiguration.java | AbstractConfiguration.getPropertyValue | public String getPropertyValue(final String propertyName, final String defaultPropertyValue) {
return defaultIfUnset(getPropertyValue(propertyName, NOT_REQUIRED), defaultPropertyValue);
} | java | public String getPropertyValue(final String propertyName, final String defaultPropertyValue) {
return defaultIfUnset(getPropertyValue(propertyName, NOT_REQUIRED), defaultPropertyValue);
} | [
"public",
"String",
"getPropertyValue",
"(",
"final",
"String",
"propertyName",
",",
"final",
"String",
"defaultPropertyValue",
")",
"{",
"return",
"defaultIfUnset",
"(",
"getPropertyValue",
"(",
"propertyName",
",",
"NOT_REQUIRED",
")",
",",
"defaultPropertyValue",
"... | Gets the value of the configuration property identified by name. The defaultPropertyValue parameter effectively
overrides the required attribute indicating that the property is not required to be declared or defined.
@param propertyName a String value indicating the name of the configuration property.
@param defaultPropertyValue the default value for the configuration property when the property is undeclared or
undefined.
@return the value of the configuration property identified by name, or the default property value if the property
was undeclared or undefined. | [
"Gets",
"the",
"value",
"of",
"the",
"configuration",
"property",
"identified",
"by",
"name",
".",
"The",
"defaultPropertyValue",
"parameter",
"effectively",
"overrides",
"the",
"required",
"attribute",
"indicating",
"that",
"the",
"property",
"is",
"not",
"required... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/context/configure/AbstractConfiguration.java#L218-L220 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/context/configure/AbstractConfiguration.java | AbstractConfiguration.getPropertyValueAs | public <T> T getPropertyValueAs(final String propertyName, final Class<T> type) {
return convert(getPropertyValue(propertyName, DEFAULT_REQUIRED), type);
} | java | public <T> T getPropertyValueAs(final String propertyName, final Class<T> type) {
return convert(getPropertyValue(propertyName, DEFAULT_REQUIRED), type);
} | [
"public",
"<",
"T",
">",
"T",
"getPropertyValueAs",
"(",
"final",
"String",
"propertyName",
",",
"final",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"return",
"convert",
"(",
"getPropertyValue",
"(",
"propertyName",
",",
"DEFAULT_REQUIRED",
")",
",",
"type",
... | Gets the value of the configuration property identified by name as a value of the specified Class type.
The property is required to be declared and defined otherwise a ConfigurationException is thrown.
@param propertyName a String value indicating the name of the configuration property.
@param type the expected Class type of the configuration property value.
@return the value of the configuration property identified by name.
@throws ConfigurationException if the property value was undeclared or is undefined. | [
"Gets",
"the",
"value",
"of",
"the",
"configuration",
"property",
"identified",
"by",
"name",
"as",
"a",
"value",
"of",
"the",
"specified",
"Class",
"type",
".",
"The",
"property",
"is",
"required",
"to",
"be",
"declared",
"and",
"defined",
"otherwise",
"a",... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/context/configure/AbstractConfiguration.java#L231-L233 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/context/configure/AbstractConfiguration.java | AbstractConfiguration.getPropertyValueAs | public <T> T getPropertyValueAs(final String propertyName, final boolean required, final Class<T> type) {
try {
return convert(getPropertyValue(propertyName, required), type);
}
catch (ConversionException e) {
if (required) {
throw new ConfigurationException(String.format(
"Failed to get the value of configuration setting property (%1$s) as type (%2$s)!", propertyName,
ClassUtils.getName(type)), e);
}
return null;
}
} | java | public <T> T getPropertyValueAs(final String propertyName, final boolean required, final Class<T> type) {
try {
return convert(getPropertyValue(propertyName, required), type);
}
catch (ConversionException e) {
if (required) {
throw new ConfigurationException(String.format(
"Failed to get the value of configuration setting property (%1$s) as type (%2$s)!", propertyName,
ClassUtils.getName(type)), e);
}
return null;
}
} | [
"public",
"<",
"T",
">",
"T",
"getPropertyValueAs",
"(",
"final",
"String",
"propertyName",
",",
"final",
"boolean",
"required",
",",
"final",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"try",
"{",
"return",
"convert",
"(",
"getPropertyValue",
"(",
"propert... | Gets the value of the configuration property identified by name as a value of the specified Class type.
The required parameter can be used to indicate the property is not required and that a ConfigurationException
should not be thrown if the property is undeclared or undefined.
@param propertyName a String value indicating the name of the configuration property.
@param required used to indicate whether the configuration property is required to be declared and defined.
@param type the expected Class type of the configuration property value.
@return the value of the configuration property identified by name.
@throws ConfigurationException if and only if the property is required and the property is either undeclared
or undefined. | [
"Gets",
"the",
"value",
"of",
"the",
"configuration",
"property",
"identified",
"by",
"name",
"as",
"a",
"value",
"of",
"the",
"specified",
"Class",
"type",
".",
"The",
"required",
"parameter",
"can",
"be",
"used",
"to",
"indicate",
"the",
"property",
"is",
... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/context/configure/AbstractConfiguration.java#L247-L260 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/context/configure/AbstractConfiguration.java | AbstractConfiguration.getPropertyValueAs | @SuppressWarnings("unchecked")
public <T> T getPropertyValueAs(final String propertyName, final T defaultPropertyValue, final Class<T> type) {
try {
return ObjectUtils.defaultIfNull(convert(getPropertyValue(propertyName, NOT_REQUIRED), type),
defaultPropertyValue);
}
catch (ConversionException ignore) {
return defaultPropertyValue;
}
} | java | @SuppressWarnings("unchecked")
public <T> T getPropertyValueAs(final String propertyName, final T defaultPropertyValue, final Class<T> type) {
try {
return ObjectUtils.defaultIfNull(convert(getPropertyValue(propertyName, NOT_REQUIRED), type),
defaultPropertyValue);
}
catch (ConversionException ignore) {
return defaultPropertyValue;
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"T",
"getPropertyValueAs",
"(",
"final",
"String",
"propertyName",
",",
"final",
"T",
"defaultPropertyValue",
",",
"final",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"try",
"{",
"... | Gets the value of the configuration property identified by name as a value of the specified Class type.
The defaultPropertyValue parameter effectively overrides the required attribute indicating that the property
is not required to be declared or defined.
@param propertyName a String value indicating the name of the configuration property.
@param defaultPropertyValue the default value for the configuration property when the property is undeclared or
undefined.
@param type the expected Class type of the configuration property value.
@return the value of the configuration property identified by name, or the default property value if the property
was undeclared or undefined. | [
"Gets",
"the",
"value",
"of",
"the",
"configuration",
"property",
"identified",
"by",
"name",
"as",
"a",
"value",
"of",
"the",
"specified",
"Class",
"type",
".",
"The",
"defaultPropertyValue",
"parameter",
"effectively",
"overrides",
"the",
"required",
"attribute"... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/context/configure/AbstractConfiguration.java#L274-L283 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/util/sort/SorterFactory.java | SorterFactory.createSorter | @SuppressWarnings("unchecked")
public static <T extends Sorter> T createSorter(final SortType type) {
switch (ObjectUtils.defaultIfNull(type, SortType.UNKONWN)) {
case BUBBLE_SORT:
return (T) new BubbleSort();
case COMB_SORT:
return (T) new CombSort();
case HEAP_SORT:
return (T) new HeapSort();
case INSERTION_SORT:
return (T) new InsertionSort();
case MERGE_SORT:
return (T) new MergeSort();
case QUICK_SORT:
return (T) new QuickSort();
case SELECTION_SORT:
return (T) new SelectionSort();
case SHELL_SORT:
return (T) new ShellSort();
default:
throw new IllegalArgumentException(String.format("The SortType (%1$s) is not supported by the %2$s!", type,
SorterFactory.class.getSimpleName()));
}
} | java | @SuppressWarnings("unchecked")
public static <T extends Sorter> T createSorter(final SortType type) {
switch (ObjectUtils.defaultIfNull(type, SortType.UNKONWN)) {
case BUBBLE_SORT:
return (T) new BubbleSort();
case COMB_SORT:
return (T) new CombSort();
case HEAP_SORT:
return (T) new HeapSort();
case INSERTION_SORT:
return (T) new InsertionSort();
case MERGE_SORT:
return (T) new MergeSort();
case QUICK_SORT:
return (T) new QuickSort();
case SELECTION_SORT:
return (T) new SelectionSort();
case SHELL_SORT:
return (T) new ShellSort();
default:
throw new IllegalArgumentException(String.format("The SortType (%1$s) is not supported by the %2$s!", type,
SorterFactory.class.getSimpleName()));
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
"extends",
"Sorter",
">",
"T",
"createSorter",
"(",
"final",
"SortType",
"type",
")",
"{",
"switch",
"(",
"ObjectUtils",
".",
"defaultIfNull",
"(",
"type",
",",
"SortType",
"."... | Creates an instance of the Sorter interface implementing the sorting algorithm based on the SortType.
@param <T> the Class type of the actual Sorter implementation based on the SortType.
@param type the type of sorting algorithm Sorter implementation to create.
@return a Sorter implementation subclass that implements the sorting algorithm based on the SortType.
@see org.cp.elements.util.sort.Sorter
@see org.cp.elements.util.sort.SortType | [
"Creates",
"an",
"instance",
"of",
"the",
"Sorter",
"interface",
"implementing",
"the",
"sorting",
"algorithm",
"based",
"on",
"the",
"SortType",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/sort/SorterFactory.java#L57-L80 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/util/sort/SorterFactory.java | SorterFactory.createSorterElseDefault | public static <T extends Sorter> T createSorterElseDefault(final SortType type, final T defaultSorter) {
try {
return createSorter(type);
}
catch (IllegalArgumentException ignore) {
return defaultSorter;
}
} | java | public static <T extends Sorter> T createSorterElseDefault(final SortType type, final T defaultSorter) {
try {
return createSorter(type);
}
catch (IllegalArgumentException ignore) {
return defaultSorter;
}
} | [
"public",
"static",
"<",
"T",
"extends",
"Sorter",
">",
"T",
"createSorterElseDefault",
"(",
"final",
"SortType",
"type",
",",
"final",
"T",
"defaultSorter",
")",
"{",
"try",
"{",
"return",
"createSorter",
"(",
"type",
")",
";",
"}",
"catch",
"(",
"Illegal... | Creates an instance of the Sorter interface implementing the sorting algorithm based on the SortType,
otherwise returns the provided default Sorter implementation if a Sorter based on the specified SortType
is not available.
@param <T> the Class type of the actual Sorter implementation based on the SortType.
@param type the type of sorting algorithm Sorter implementation to create.
@param defaultSorter the default Sorter implementation to use if a Sorter based on the specified SortType
is not available.
@return a Sorter implementation subclass that implements the sorting algorithm based on the SortType,
or the provided default Sorter implementation if the Sorter based on the SortType is not available.
@see #createSorter(SortType)
@see org.cp.elements.util.sort.Sorter
@see org.cp.elements.util.sort.SortType | [
"Creates",
"an",
"instance",
"of",
"the",
"Sorter",
"interface",
"implementing",
"the",
"sorting",
"algorithm",
"based",
"on",
"the",
"SortType",
"otherwise",
"returns",
"the",
"provided",
"default",
"Sorter",
"implementation",
"if",
"a",
"Sorter",
"based",
"on",
... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/sort/SorterFactory.java#L97-L104 | train |
ExpediaDotCom/haystack-logback-metrics-appender | src/main/java/com/expedia/www/haystack/metrics/appenders/logback/EmitToGraphiteLogbackAppender.java | EmitToGraphiteLogbackAppender.start | @Override
public void start() {
super.start();
// If disabled we do not create a publisher to graphite but error counts are still collected.
if(enabled) {
metricPublishing.start(new GraphiteConfigImpl(host, port, pollintervalseconds, queuesize, sendasrate));
}
this.startUpMetric = factory.createStartUpMetric(metricObjects, subsystem, new Timer());
startUpMetric.start();
} | java | @Override
public void start() {
super.start();
// If disabled we do not create a publisher to graphite but error counts are still collected.
if(enabled) {
metricPublishing.start(new GraphiteConfigImpl(host, port, pollintervalseconds, queuesize, sendasrate));
}
this.startUpMetric = factory.createStartUpMetric(metricObjects, subsystem, new Timer());
startUpMetric.start();
} | [
"@",
"Override",
"public",
"void",
"start",
"(",
")",
"{",
"super",
".",
"start",
"(",
")",
";",
"// If disabled we do not create a publisher to graphite but error counts are still collected.",
"if",
"(",
"enabled",
")",
"{",
"metricPublishing",
".",
"start",
"(",
"ne... | Starts the appender by starting a background thread to poll the error counters and publish them to Graphite.
Multiple instances of this EmitToGraphiteLogbackAppender will only start one background thread.
This method also starts the heartbeat metric background thread. | [
"Starts",
"the",
"appender",
"by",
"starting",
"a",
"background",
"thread",
"to",
"poll",
"the",
"error",
"counters",
"and",
"publish",
"them",
"to",
"Graphite",
".",
"Multiple",
"instances",
"of",
"this",
"EmitToGraphiteLogbackAppender",
"will",
"only",
"start",
... | 90f303d1fdc59a982b7dbe2d877e8e7e055cd53c | https://github.com/ExpediaDotCom/haystack-logback-metrics-appender/blob/90f303d1fdc59a982b7dbe2d877e8e7e055cd53c/src/main/java/com/expedia/www/haystack/metrics/appenders/logback/EmitToGraphiteLogbackAppender.java#L107-L116 | train |
ExpediaDotCom/haystack-logback-metrics-appender | src/main/java/com/expedia/www/haystack/metrics/appenders/logback/EmitToGraphiteLogbackAppender.java | EmitToGraphiteLogbackAppender.stop | @Override
public void stop() {
if(enabled) {
metricPublishing.stop();
}
if(startUpMetric != null) {
startUpMetric.stop();
}
super.stop();
} | java | @Override
public void stop() {
if(enabled) {
metricPublishing.stop();
}
if(startUpMetric != null) {
startUpMetric.stop();
}
super.stop();
} | [
"@",
"Override",
"public",
"void",
"stop",
"(",
")",
"{",
"if",
"(",
"enabled",
")",
"{",
"metricPublishing",
".",
"stop",
"(",
")",
";",
"}",
"if",
"(",
"startUpMetric",
"!=",
"null",
")",
"{",
"startUpMetric",
".",
"stop",
"(",
")",
";",
"}",
"su... | Stops the appender, shutting down the background polling thread to ensure that the connection to the metrics
database is closed. This method also stops the heartbeat method background thread. | [
"Stops",
"the",
"appender",
"shutting",
"down",
"the",
"background",
"polling",
"thread",
"to",
"ensure",
"that",
"the",
"connection",
"to",
"the",
"metrics",
"database",
"is",
"closed",
".",
"This",
"method",
"also",
"stops",
"the",
"heartbeat",
"method",
"ba... | 90f303d1fdc59a982b7dbe2d877e8e7e055cd53c | https://github.com/ExpediaDotCom/haystack-logback-metrics-appender/blob/90f303d1fdc59a982b7dbe2d877e8e7e055cd53c/src/main/java/com/expedia/www/haystack/metrics/appenders/logback/EmitToGraphiteLogbackAppender.java#L122-L131 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/beans/AbstractBean.java | AbstractBean.getFieldName | protected String getFieldName(String propertyName) {
return ObjectUtils.defaultIfNull(propertyNameToFieldNameMapping.get(propertyName), propertyName);
} | java | protected String getFieldName(String propertyName) {
return ObjectUtils.defaultIfNull(propertyNameToFieldNameMapping.get(propertyName), propertyName);
} | [
"protected",
"String",
"getFieldName",
"(",
"String",
"propertyName",
")",
"{",
"return",
"ObjectUtils",
".",
"defaultIfNull",
"(",
"propertyNameToFieldNameMapping",
".",
"get",
"(",
"propertyName",
")",
",",
"propertyName",
")",
";",
"}"
] | Gets the name of the field mapped to the given property. If no such mapping exists, then the given property name
is returned.
@param propertyName a String value specifying the name of the property to retrieve the corresponding field name.
@return a String value indicating the field name corresponding to the specified property. | [
"Gets",
"the",
"name",
"of",
"the",
"field",
"mapped",
"to",
"the",
"given",
"property",
".",
"If",
"no",
"such",
"mapping",
"exists",
"then",
"the",
"given",
"property",
"name",
"is",
"returned",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/beans/AbstractBean.java#L200-L202 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/beans/AbstractBean.java | AbstractBean.setModifiedBy | @SuppressWarnings("unchecked")
public void setModifiedBy(USER modifiedBy) {
processChange("modifiedBy", this.modifiedBy, modifiedBy);
this.lastModifiedBy = ObjectUtils.defaultIfNull(this.lastModifiedBy, this.modifiedBy);
} | java | @SuppressWarnings("unchecked")
public void setModifiedBy(USER modifiedBy) {
processChange("modifiedBy", this.modifiedBy, modifiedBy);
this.lastModifiedBy = ObjectUtils.defaultIfNull(this.lastModifiedBy, this.modifiedBy);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"void",
"setModifiedBy",
"(",
"USER",
"modifiedBy",
")",
"{",
"processChange",
"(",
"\"modifiedBy\"",
",",
"this",
".",
"modifiedBy",
",",
"modifiedBy",
")",
";",
"this",
".",
"lastModifiedBy",
"=",
... | Sets the user who is responsible for modifying this object.
@param modifiedBy an object denoting the user who modified this object.
@see org.cp.elements.lang.Auditable | [
"Sets",
"the",
"user",
"who",
"is",
"responsible",
"for",
"modifying",
"this",
"object",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/beans/AbstractBean.java#L294-L298 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/beans/AbstractBean.java | AbstractBean.changeState | void changeState(String propertyName, Object newValue) {
try {
ObjectUtils.setField(this, getFieldName(propertyName), newValue);
}
catch (IllegalArgumentException e) {
throw new PropertyNotFoundException(String.format(
"The property (%1$s) corresponding to field (%2$s) was not found in this Bean (%3$s)!",
propertyName, getFieldName(propertyName), getClass().getName()), e);
}
} | java | void changeState(String propertyName, Object newValue) {
try {
ObjectUtils.setField(this, getFieldName(propertyName), newValue);
}
catch (IllegalArgumentException e) {
throw new PropertyNotFoundException(String.format(
"The property (%1$s) corresponding to field (%2$s) was not found in this Bean (%3$s)!",
propertyName, getFieldName(propertyName), getClass().getName()), e);
}
} | [
"void",
"changeState",
"(",
"String",
"propertyName",
",",
"Object",
"newValue",
")",
"{",
"try",
"{",
"ObjectUtils",
".",
"setField",
"(",
"this",
",",
"getFieldName",
"(",
"propertyName",
")",
",",
"newValue",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentE... | Changes the value of the given property, referenced by name, to the new Object value, effectively modifying
the internal state of this Bean. This method uses the Java reflective APIs to set the field corresponding
to the specified property.
@param propertyName a String value specifying the name of the property (internally, the field) to set to
the new Object value.
@param newValue an Object containing the new value for the given property (internally, the field).
@throws PropertyNotFoundException if property referenced by name is not a property of this Bean. This Exception
occurs when the field for the corresponding property does not exist.
@see #getFieldName(String) | [
"Changes",
"the",
"value",
"of",
"the",
"given",
"property",
"referenced",
"by",
"name",
"to",
"the",
"new",
"Object",
"value",
"effectively",
"modifying",
"the",
"internal",
"state",
"of",
"this",
"Bean",
".",
"This",
"method",
"uses",
"the",
"Java",
"refle... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/beans/AbstractBean.java#L444-L453 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/beans/AbstractBean.java | AbstractBean.compareTo | @SuppressWarnings("all")
public int compareTo(Bean<ID, USER, PROCESS> obj) {
Assert.isInstanceOf(obj, getClass(), new ClassCastException(String.format(
"The Bean being compared with this Bean must be an instance of %1$s!", getClass().getName())));
return ComparatorUtils.compareIgnoreNull(getId(), obj.getId());
} | java | @SuppressWarnings("all")
public int compareTo(Bean<ID, USER, PROCESS> obj) {
Assert.isInstanceOf(obj, getClass(), new ClassCastException(String.format(
"The Bean being compared with this Bean must be an instance of %1$s!", getClass().getName())));
return ComparatorUtils.compareIgnoreNull(getId(), obj.getId());
} | [
"@",
"SuppressWarnings",
"(",
"\"all\"",
")",
"public",
"int",
"compareTo",
"(",
"Bean",
"<",
"ID",
",",
"USER",
",",
"PROCESS",
">",
"obj",
")",
"{",
"Assert",
".",
"isInstanceOf",
"(",
"obj",
",",
"getClass",
"(",
")",
",",
"new",
"ClassCastException",... | Compares the specified Bean with this Bean to determine order. The default implementation is to
order by identifier, where null identifiers are ordered before non-null identifiers.
@param obj the Bean being compared with this Bean.
@return an integer value indicating the relative ordering of the specified Bean with this Bean.
A negative value implies this Bean logically occurs before the specified Bean. A zero value indicates
the specified Bean and this Bean are comparatively equal, and a positive value indicates this Bean logically
occurs after the specified Bean.
@throws IllegalArgumentException if the specified Bean is not an instance of this Bean class.
@see java.lang.Comparable#compareTo(Object) | [
"Compares",
"the",
"specified",
"Bean",
"with",
"this",
"Bean",
"to",
"determine",
"order",
".",
"The",
"default",
"implementation",
"is",
"to",
"order",
"by",
"identifier",
"where",
"null",
"identifiers",
"are",
"ordered",
"before",
"non",
"-",
"null",
"ident... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/beans/AbstractBean.java#L467-L472 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/beans/AbstractBean.java | AbstractBean.newPropertyChangeEvent | protected PropertyChangeEvent newPropertyChangeEvent(String propertyName, Object oldValue, Object newValue) {
if (isEventDispatchEnabled()) {
if (vetoableChangeSupport.hasListeners(propertyName) || propertyChangeSupport.hasListeners(propertyName)) {
return new PropertyChangeEvent(this, propertyName, oldValue, newValue);
}
}
return this.propertyChangeEvent;
} | java | protected PropertyChangeEvent newPropertyChangeEvent(String propertyName, Object oldValue, Object newValue) {
if (isEventDispatchEnabled()) {
if (vetoableChangeSupport.hasListeners(propertyName) || propertyChangeSupport.hasListeners(propertyName)) {
return new PropertyChangeEvent(this, propertyName, oldValue, newValue);
}
}
return this.propertyChangeEvent;
} | [
"protected",
"PropertyChangeEvent",
"newPropertyChangeEvent",
"(",
"String",
"propertyName",
",",
"Object",
"oldValue",
",",
"Object",
"newValue",
")",
"{",
"if",
"(",
"isEventDispatchEnabled",
"(",
")",
")",
"{",
"if",
"(",
"vetoableChangeSupport",
".",
"hasListene... | Creates a new instance of the PropertyChangeEvent initialized with this Bean as the source as well as the
name of the property that is changing along with the property's old and new values. A PropertyChangeEvent
will be created only if event dispatching to registered listeners is enabled and there are either
PropertyChangeListeners or VetoableChangeListeners registered on this Bean.
@param propertyName a String value specifying the name of the property on this Bean that is being changed.
@param oldValue an Object containing the old value of the specified property.
@param newValue an Object containing the new value for the specified property.
@return a PropertyChangeEvent for this Bean specifying the name of the property changing along with the
property's old and new value.
@see java.beans.PropertyChangeEvent | [
"Creates",
"a",
"new",
"instance",
"of",
"the",
"PropertyChangeEvent",
"initialized",
"with",
"this",
"Bean",
"as",
"the",
"source",
"as",
"well",
"as",
"the",
"name",
"of",
"the",
"property",
"that",
"is",
"changing",
"along",
"with",
"the",
"property",
"s"... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/beans/AbstractBean.java#L487-L495 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/beans/AbstractBean.java | AbstractBean.firePropertyChange | protected void firePropertyChange(PropertyChangeEvent event) {
if (isEventDispatchEnabled()) {
Assert.notNull(event, "The PropertyChangeEvent cannot be null!");
if (propertyChangeSupport.hasListeners(event.getPropertyName())) {
propertyChangeSupport.firePropertyChange(event);
}
}
} | java | protected void firePropertyChange(PropertyChangeEvent event) {
if (isEventDispatchEnabled()) {
Assert.notNull(event, "The PropertyChangeEvent cannot be null!");
if (propertyChangeSupport.hasListeners(event.getPropertyName())) {
propertyChangeSupport.firePropertyChange(event);
}
}
} | [
"protected",
"void",
"firePropertyChange",
"(",
"PropertyChangeEvent",
"event",
")",
"{",
"if",
"(",
"isEventDispatchEnabled",
"(",
")",
")",
"{",
"Assert",
".",
"notNull",
"(",
"event",
",",
"\"The PropertyChangeEvent cannot be null!\"",
")",
";",
"if",
"(",
"pro... | Notifies all PropertyChangeListeners of a property change event occurring on this Bean.
@param event the PropertyChangeEvent indicating the property who's value is changing.
@throws NullPointerException if the PropertyChangeEvent is null.
@see java.beans.PropertyChangeEvent
@see java.beans.PropertyChangeListener
@see java.beans.PropertyChangeSupport#firePropertyChange(java.beans.PropertyChangeEvent)
@see java.beans.PropertyChangeSupport#hasListeners(String) | [
"Notifies",
"all",
"PropertyChangeListeners",
"of",
"a",
"property",
"change",
"event",
"occurring",
"on",
"this",
"Bean",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/beans/AbstractBean.java#L548-L555 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/beans/AbstractBean.java | AbstractBean.fireVetoableChange | protected void fireVetoableChange(PropertyChangeEvent event) throws PropertyVetoException {
if (isEventDispatchEnabled()) {
Assert.notNull(event, "The PropertyChangeEvent cannot be null!");
if (vetoableChangeSupport.hasListeners(event.getPropertyName())) {
vetoableChangeSupport.fireVetoableChange(event);
}
}
} | java | protected void fireVetoableChange(PropertyChangeEvent event) throws PropertyVetoException {
if (isEventDispatchEnabled()) {
Assert.notNull(event, "The PropertyChangeEvent cannot be null!");
if (vetoableChangeSupport.hasListeners(event.getPropertyName())) {
vetoableChangeSupport.fireVetoableChange(event);
}
}
} | [
"protected",
"void",
"fireVetoableChange",
"(",
"PropertyChangeEvent",
"event",
")",
"throws",
"PropertyVetoException",
"{",
"if",
"(",
"isEventDispatchEnabled",
"(",
")",
")",
"{",
"Assert",
".",
"notNull",
"(",
"event",
",",
"\"The PropertyChangeEvent cannot be null!\... | Notifies all VetoableChangeListeners of a property change event occurring on this Bean. The change to
the property may potentially be vetoed by one of the VetoableChangeListeners listening to property changes
on this Bean, resulting in preventing the value of the property to change.
@param event the PropertyChangeEvent indicating the property who's value is changing.
@throws NullPointerException if the PropertyChangeEvent is null.
@throws PropertyVetoException if the property change is vetoed by a VetoableChangeListener listening to
property changes on this Bean.
@see java.beans.PropertyChangeEvent
@see java.beans.VetoableChangeListener
@see java.beans.VetoableChangeSupport#fireVetoableChange(java.beans.PropertyChangeEvent)
@see java.beans.VetoableChangeSupport#hasListeners(String) | [
"Notifies",
"all",
"VetoableChangeListeners",
"of",
"a",
"property",
"change",
"event",
"occurring",
"on",
"this",
"Bean",
".",
"The",
"change",
"to",
"the",
"property",
"may",
"potentially",
"be",
"vetoed",
"by",
"one",
"of",
"the",
"VetoableChangeListeners",
"... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/beans/AbstractBean.java#L571-L578 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/beans/AbstractBean.java | AbstractBean.mapPropertyNameToFieldName | protected boolean mapPropertyNameToFieldName(final String propertyName, final String fieldName) {
// TODO add possible validation for the property name and field name of this Bean class.
propertyNameToFieldNameMapping.put(propertyName, fieldName);
return propertyNameToFieldNameMapping.containsKey(propertyName);
} | java | protected boolean mapPropertyNameToFieldName(final String propertyName, final String fieldName) {
// TODO add possible validation for the property name and field name of this Bean class.
propertyNameToFieldNameMapping.put(propertyName, fieldName);
return propertyNameToFieldNameMapping.containsKey(propertyName);
} | [
"protected",
"boolean",
"mapPropertyNameToFieldName",
"(",
"final",
"String",
"propertyName",
",",
"final",
"String",
"fieldName",
")",
"{",
"// TODO add possible validation for the property name and field name of this Bean class.",
"propertyNameToFieldNameMapping",
".",
"put",
"("... | Creates a mapping from the specified property on this Bean class to one of the Bean object's fields.
@param propertyName a String value specifying the name of a property on this Bean class.
@param fieldName a String value specifying the name of the Bean object's field.
@return a boolean value indicating whether the mapping between the property and field was successfully
created. | [
"Creates",
"a",
"mapping",
"from",
"the",
"specified",
"property",
"on",
"this",
"Bean",
"class",
"to",
"one",
"of",
"the",
"Bean",
"object",
"s",
"fields",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/beans/AbstractBean.java#L602-L606 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/beans/AbstractBean.java | AbstractBean.mapPropertyNameToParameterizedStateChangeCallback | protected boolean mapPropertyNameToParameterizedStateChangeCallback(String propertyName,
ParameterizedStateChangeCallback callback) {
propertyNameToParameterizedStateChangeCallbackMapping.put(propertyName, callback);
return propertyNameToParameterizedStateChangeCallbackMapping.containsKey(propertyName);
} | java | protected boolean mapPropertyNameToParameterizedStateChangeCallback(String propertyName,
ParameterizedStateChangeCallback callback) {
propertyNameToParameterizedStateChangeCallbackMapping.put(propertyName, callback);
return propertyNameToParameterizedStateChangeCallbackMapping.containsKey(propertyName);
} | [
"protected",
"boolean",
"mapPropertyNameToParameterizedStateChangeCallback",
"(",
"String",
"propertyName",
",",
"ParameterizedStateChangeCallback",
"callback",
")",
"{",
"propertyNameToParameterizedStateChangeCallbackMapping",
".",
"put",
"(",
"propertyName",
",",
"callback",
")... | Creates a mapping from the specified property on this Bean to the specified ParameterizedStateChangeCallback
for affecting state transitions and changes.
@param propertyName a String value specifying the name of the property on this Bean class.
@param callback a ParameterizedStateChangeCallback affecting the state change/transition.
@return a boolean indicating that the mapping was added successfully. | [
"Creates",
"a",
"mapping",
"from",
"the",
"specified",
"property",
"on",
"this",
"Bean",
"to",
"the",
"specified",
"ParameterizedStateChangeCallback",
"for",
"affecting",
"state",
"transitions",
"and",
"changes",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/beans/AbstractBean.java#L616-L621 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/snmp_manager.java | snmp_manager.get_filtered | public static snmp_manager[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception
{
snmp_manager obj = new snmp_manager();
options option = new options();
option.set_filter(filter);
snmp_manager[] response = (snmp_manager[]) obj.getfiltered(service, option);
return response;
} | java | public static snmp_manager[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception
{
snmp_manager obj = new snmp_manager();
options option = new options();
option.set_filter(filter);
snmp_manager[] response = (snmp_manager[]) obj.getfiltered(service, option);
return response;
} | [
"public",
"static",
"snmp_manager",
"[",
"]",
"get_filtered",
"(",
"nitro_service",
"service",
",",
"filtervalue",
"[",
"]",
"filter",
")",
"throws",
"Exception",
"{",
"snmp_manager",
"obj",
"=",
"new",
"snmp_manager",
"(",
")",
";",
"options",
"option",
"=",
... | Use this API to fetch filtered set of snmp_manager resources.
set the filter parameter values in filtervalue object. | [
"Use",
"this",
"API",
"to",
"fetch",
"filtered",
"set",
"of",
"snmp_manager",
"resources",
".",
"set",
"the",
"filter",
"parameter",
"values",
"in",
"filtervalue",
"object",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/snmp_manager.java#L241-L248 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/sms_server.java | sms_server.count | public static long count(nitro_service service) throws Exception
{
sms_server obj = new sms_server();
options option = new options();
option.set_count(true);
sms_server[] response = (sms_server[])obj.get_resources(service, option);
if (response != null && response.length > 0)
return response[0].__count;
return 0;
} | java | public static long count(nitro_service service) throws Exception
{
sms_server obj = new sms_server();
options option = new options();
option.set_count(true);
sms_server[] response = (sms_server[])obj.get_resources(service, option);
if (response != null && response.length > 0)
return response[0].__count;
return 0;
} | [
"public",
"static",
"long",
"count",
"(",
"nitro_service",
"service",
")",
"throws",
"Exception",
"{",
"sms_server",
"obj",
"=",
"new",
"sms_server",
"(",
")",
";",
"options",
"option",
"=",
"new",
"options",
"(",
")",
";",
"option",
".",
"set_count",
"(",... | Use this API to count the sms_server resources configured on NetScaler SDX. | [
"Use",
"this",
"API",
"to",
"count",
"the",
"sms_server",
"resources",
"configured",
"on",
"NetScaler",
"SDX",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/sms_server.java#L610-L619 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/service/options.java | options.set_filter | public void set_filter(filtervalue[] filter)
{
String str = null;
for (int i = 0; i < filter.length; i++)
{
if (str != null)
str = str + ",";
if (str == null)
str = filter[i].get_name() + ":" + nitro_util.encode(filter[i].get_value());
else
str = str + filter[i].get_name() + ":" + nitro_util.encode(filter[i].get_value());;
}
this.filter = str;
} | java | public void set_filter(filtervalue[] filter)
{
String str = null;
for (int i = 0; i < filter.length; i++)
{
if (str != null)
str = str + ",";
if (str == null)
str = filter[i].get_name() + ":" + nitro_util.encode(filter[i].get_value());
else
str = str + filter[i].get_name() + ":" + nitro_util.encode(filter[i].get_value());;
}
this.filter = str;
} | [
"public",
"void",
"set_filter",
"(",
"filtervalue",
"[",
"]",
"filter",
")",
"{",
"String",
"str",
"=",
"null",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"filter",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"str",
"!=",
"nu... | sets filter field.
@param filter set this with the filter string to perform filtered get operation.
Set the filter parameters in filtervalue object which is then converted to json string. | [
"sets",
"filter",
"field",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/service/options.java#L163-L176 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/task_device_log.java | task_device_log.get | public static task_device_log get(nitro_service client, task_device_log resource) throws Exception
{
resource.validate("get");
return ((task_device_log[]) resource.get_resources(client))[0];
} | java | public static task_device_log get(nitro_service client, task_device_log resource) throws Exception
{
resource.validate("get");
return ((task_device_log[]) resource.get_resources(client))[0];
} | [
"public",
"static",
"task_device_log",
"get",
"(",
"nitro_service",
"client",
",",
"task_device_log",
"resource",
")",
"throws",
"Exception",
"{",
"resource",
".",
"validate",
"(",
"\"get\"",
")",
";",
"return",
"(",
"(",
"task_device_log",
"[",
"]",
")",
"res... | Use this operation to get task log for each device. | [
"Use",
"this",
"operation",
"to",
"get",
"task",
"log",
"for",
"each",
"device",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/task_device_log.java#L155-L159 | train |
eliwan/jfaker | mockito/src/main/java/be/eliwan/jfaker/mockito/FakerMock.java | FakerMock.withFields | public static <T> T withFields(Class<T> clazz, Object... keysAndValues) {
return Mockito.mock(clazz, new FakerAnswer(keysAndValues));
} | java | public static <T> T withFields(Class<T> clazz, Object... keysAndValues) {
return Mockito.mock(clazz, new FakerAnswer(keysAndValues));
} | [
"public",
"static",
"<",
"T",
">",
"T",
"withFields",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"Object",
"...",
"keysAndValues",
")",
"{",
"return",
"Mockito",
".",
"mock",
"(",
"clazz",
",",
"new",
"FakerAnswer",
"(",
"keysAndValues",
")",
")",
";",... | Create a mock object with given field values.
@param <T> return type
@param clazz mock ype
@param keysAndValues keys and values for the object.
@return mock object | [
"Create",
"a",
"mock",
"object",
"with",
"given",
"field",
"values",
"."
] | e99cce7dadb5cd2c21f7ab64cf27c4fd1c08dae0 | https://github.com/eliwan/jfaker/blob/e99cce7dadb5cd2c21f7ab64cf27c4fd1c08dae0/mockito/src/main/java/be/eliwan/jfaker/mockito/FakerMock.java#L30-L32 | train |
ChannelFinder/javaCFClient | src/main/java/gov/bnl/channelfinder/api/ChannelFinderClientImpl.java | ChannelFinderClientImpl.getAllProperties | public Collection<String> getAllProperties() {
return wrappedSubmit(new Callable<Collection<String>>() {
@Override
public Collection<String> call() throws Exception {
Collection<String> allProperties = new HashSet<String>();
ObjectMapper mapper = new ObjectMapper();
List<XmlProperty> xmlproperties = new ArrayList<XmlProperty>();
try {xmlproperties = mapper.readValue(
service.path(resourceProperties)
.accept(MediaType.APPLICATION_JSON)
.get(String.class)
,new TypeReference<List<XmlProperty>>(){});
} catch (JsonParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JsonMappingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ClientHandlerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
for (XmlProperty xmlproperty : xmlproperties) {
allProperties.add(xmlproperty.getName());
}
return allProperties;
}
});
} | java | public Collection<String> getAllProperties() {
return wrappedSubmit(new Callable<Collection<String>>() {
@Override
public Collection<String> call() throws Exception {
Collection<String> allProperties = new HashSet<String>();
ObjectMapper mapper = new ObjectMapper();
List<XmlProperty> xmlproperties = new ArrayList<XmlProperty>();
try {xmlproperties = mapper.readValue(
service.path(resourceProperties)
.accept(MediaType.APPLICATION_JSON)
.get(String.class)
,new TypeReference<List<XmlProperty>>(){});
} catch (JsonParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JsonMappingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ClientHandlerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
for (XmlProperty xmlproperty : xmlproperties) {
allProperties.add(xmlproperty.getName());
}
return allProperties;
}
});
} | [
"public",
"Collection",
"<",
"String",
">",
"getAllProperties",
"(",
")",
"{",
"return",
"wrappedSubmit",
"(",
"new",
"Callable",
"<",
"Collection",
"<",
"String",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Collection",
"<",
"String",
">",
"call"... | Get a list of names of all the properties currently present on the
channelfinder service.
@return list of names of all existing {@link Property}s. | [
"Get",
"a",
"list",
"of",
"names",
"of",
"all",
"the",
"properties",
"currently",
"present",
"on",
"the",
"channelfinder",
"service",
"."
] | 000fce53ad2b8f8c38ef24fec5b5ec65e383ac9d | https://github.com/ChannelFinder/javaCFClient/blob/000fce53ad2b8f8c38ef24fec5b5ec65e383ac9d/src/main/java/gov/bnl/channelfinder/api/ChannelFinderClientImpl.java#L295-L326 | train |
ChannelFinder/javaCFClient | src/main/java/gov/bnl/channelfinder/api/ChannelFinderClientImpl.java | ChannelFinderClientImpl.getAllTags | public Collection<String> getAllTags() {
return wrappedSubmit(new Callable<Collection<String>>() {
@Override
public Collection<String> call() throws Exception {
Collection<String> allTags = new HashSet<String>();
ObjectMapper mapper = new ObjectMapper();
List<XmlTag> xmltags = new ArrayList<XmlTag>();
try {xmltags = mapper.readValue(
service.path(resourceTags)
.accept(MediaType.APPLICATION_JSON)
.get(String.class)
,new TypeReference<List<XmlTag>>(){});
} catch (JsonParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JsonMappingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ClientHandlerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
for (XmlTag xmltag : xmltags) {
allTags.add(xmltag.getName());
}
return allTags;
}
});
} | java | public Collection<String> getAllTags() {
return wrappedSubmit(new Callable<Collection<String>>() {
@Override
public Collection<String> call() throws Exception {
Collection<String> allTags = new HashSet<String>();
ObjectMapper mapper = new ObjectMapper();
List<XmlTag> xmltags = new ArrayList<XmlTag>();
try {xmltags = mapper.readValue(
service.path(resourceTags)
.accept(MediaType.APPLICATION_JSON)
.get(String.class)
,new TypeReference<List<XmlTag>>(){});
} catch (JsonParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JsonMappingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ClientHandlerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
for (XmlTag xmltag : xmltags) {
allTags.add(xmltag.getName());
}
return allTags;
}
});
} | [
"public",
"Collection",
"<",
"String",
">",
"getAllTags",
"(",
")",
"{",
"return",
"wrappedSubmit",
"(",
"new",
"Callable",
"<",
"Collection",
"<",
"String",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Collection",
"<",
"String",
">",
"call",
"(... | Get a list of names of all the tags currently present on the
channelfinder service.
@return a list of names of all the existing {@link Tag}s. | [
"Get",
"a",
"list",
"of",
"names",
"of",
"all",
"the",
"tags",
"currently",
"present",
"on",
"the",
"channelfinder",
"service",
"."
] | 000fce53ad2b8f8c38ef24fec5b5ec65e383ac9d | https://github.com/ChannelFinder/javaCFClient/blob/000fce53ad2b8f8c38ef24fec5b5ec65e383ac9d/src/main/java/gov/bnl/channelfinder/api/ChannelFinderClientImpl.java#L334-L366 | train |
ChannelFinder/javaCFClient | src/main/java/gov/bnl/channelfinder/api/ChannelFinderClientImpl.java | ChannelFinderClientImpl.set | public void set(Collection<Builder> channels) throws ChannelFinderException {
wrappedSubmit(new SetChannels(ChannelUtil.toCollectionXmlChannels(channels)));
} | java | public void set(Collection<Builder> channels) throws ChannelFinderException {
wrappedSubmit(new SetChannels(ChannelUtil.toCollectionXmlChannels(channels)));
} | [
"public",
"void",
"set",
"(",
"Collection",
"<",
"Builder",
">",
"channels",
")",
"throws",
"ChannelFinderException",
"{",
"wrappedSubmit",
"(",
"new",
"SetChannels",
"(",
"ChannelUtil",
".",
"toCollectionXmlChannels",
"(",
"channels",
")",
")",
")",
";",
"}"
] | Destructively set a set of channels, if any channels already exists it is
replaced.
@param channels
set of channels to be added
@throws ChannelFinderException - channelfinder exception | [
"Destructively",
"set",
"a",
"set",
"of",
"channels",
"if",
"any",
"channels",
"already",
"exists",
"it",
"is",
"replaced",
"."
] | 000fce53ad2b8f8c38ef24fec5b5ec65e383ac9d | https://github.com/ChannelFinder/javaCFClient/blob/000fce53ad2b8f8c38ef24fec5b5ec65e383ac9d/src/main/java/gov/bnl/channelfinder/api/ChannelFinderClientImpl.java#L476-L478 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/BooleanUtils.java | BooleanUtils.and | @SuppressWarnings("all")
@NullSafe
public static boolean and(Boolean... values) {
boolean result = (values != null); // innocent until proven guilty
if (result) {
for (Boolean value : values) {
result &= valueOf(value);
if (!result) { // short-circuit if we find a false value
break;
}
}
}
return result;
} | java | @SuppressWarnings("all")
@NullSafe
public static boolean and(Boolean... values) {
boolean result = (values != null); // innocent until proven guilty
if (result) {
for (Boolean value : values) {
result &= valueOf(value);
if (!result) { // short-circuit if we find a false value
break;
}
}
}
return result;
} | [
"@",
"SuppressWarnings",
"(",
"\"all\"",
")",
"@",
"NullSafe",
"public",
"static",
"boolean",
"and",
"(",
"Boolean",
"...",
"values",
")",
"{",
"boolean",
"result",
"=",
"(",
"values",
"!=",
"null",
")",
";",
"// innocent until proven guilty",
"if",
"(",
"re... | Performs a logical AND on all the Boolean values and returns true if an only if all Boolean values evaluate
to true, as determined by the BooleanUtils.valueOf method on the Boolean wrapper object. If the Boolean array
is null, then the result of the AND operation is false.
@param values the array of Boolean values evaluated with the logical AND operator.
@return a boolean value of true if the Boolean array is not null and all Boolean wrapper object evaluate to true.
@see #valueOf(Boolean) | [
"Performs",
"a",
"logical",
"AND",
"on",
"all",
"the",
"Boolean",
"values",
"and",
"returns",
"true",
"if",
"an",
"only",
"if",
"all",
"Boolean",
"values",
"evaluate",
"to",
"true",
"as",
"determined",
"by",
"the",
"BooleanUtils",
".",
"valueOf",
"method",
... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/BooleanUtils.java#L44-L59 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/BooleanUtils.java | BooleanUtils.or | @SuppressWarnings("all")
@NullSafe
public static boolean or(Boolean... values) {
boolean result = false; // guilty until proven innocent
for (Boolean value : nullSafeArray(values, Boolean.class)) {
result |= valueOf(value);
if (result) { // short-circuit if we find a true value
break;
}
}
return result;
} | java | @SuppressWarnings("all")
@NullSafe
public static boolean or(Boolean... values) {
boolean result = false; // guilty until proven innocent
for (Boolean value : nullSafeArray(values, Boolean.class)) {
result |= valueOf(value);
if (result) { // short-circuit if we find a true value
break;
}
}
return result;
} | [
"@",
"SuppressWarnings",
"(",
"\"all\"",
")",
"@",
"NullSafe",
"public",
"static",
"boolean",
"or",
"(",
"Boolean",
"...",
"values",
")",
"{",
"boolean",
"result",
"=",
"false",
";",
"// guilty until proven innocent",
"for",
"(",
"Boolean",
"value",
":",
"null... | Performs a logical OR on all the Boolean values and returns true if just one Boolean value evaluates
to true, as determined by the BooleanUtils.valueOf method on the Boolean wrapper object. If the Boolean array
is null, the result of the OR operation is false.
@param values the array of Boolean values evaluated with the logical OR operator.
@return a boolean value of true if the Boolean array is not null and any of the Boolean values is true.
@see #valueOf(Boolean) | [
"Performs",
"a",
"logical",
"OR",
"on",
"all",
"the",
"Boolean",
"values",
"and",
"returns",
"true",
"if",
"just",
"one",
"Boolean",
"value",
"evaluates",
"to",
"true",
"as",
"determined",
"by",
"the",
"BooleanUtils",
".",
"valueOf",
"method",
"on",
"the",
... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/BooleanUtils.java#L84-L97 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/BooleanUtils.java | BooleanUtils.xor | @NullSafe
public static boolean xor(Boolean... values) {
boolean result = false; // guilty until proven innocent.
for (Boolean value : nullSafeArray(values, Boolean.class)) {
boolean primitiveValue = valueOf(value);
if (result && primitiveValue) {
return false; // short-circuit if we find more than 1 true value
}
result |= primitiveValue;
}
return result;
} | java | @NullSafe
public static boolean xor(Boolean... values) {
boolean result = false; // guilty until proven innocent.
for (Boolean value : nullSafeArray(values, Boolean.class)) {
boolean primitiveValue = valueOf(value);
if (result && primitiveValue) {
return false; // short-circuit if we find more than 1 true value
}
result |= primitiveValue;
}
return result;
} | [
"@",
"NullSafe",
"public",
"static",
"boolean",
"xor",
"(",
"Boolean",
"...",
"values",
")",
"{",
"boolean",
"result",
"=",
"false",
";",
"// guilty until proven innocent.",
"for",
"(",
"Boolean",
"value",
":",
"nullSafeArray",
"(",
"values",
",",
"Boolean",
"... | Performs a logical exclusive OR on the array of Boolean values and returns true if and only if the Boolean array
is not null and 1 and only 1 Boolean wrapper object evaluates to true, as determined by the BooleanUtils.valueof
method.
@param values the array of Boolean values evaluated with the logical exclusive OR operator.
@return a boolean value of true if and only if the Boolean array is not null and 1 and only 1 of the Boolean
wrapper objects evaluates to true.
@see #valueOf(Boolean) | [
"Performs",
"a",
"logical",
"exclusive",
"OR",
"on",
"the",
"array",
"of",
"Boolean",
"values",
"and",
"returns",
"true",
"if",
"and",
"only",
"if",
"the",
"Boolean",
"array",
"is",
"not",
"null",
"and",
"1",
"and",
"only",
"1",
"Boolean",
"wrapper",
"ob... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/BooleanUtils.java#L163-L178 | train |
rholder/moar-concurrent | src/main/java/com/github/rholder/moar/concurrent/StrategicQueues.java | StrategicQueues.newStrategicLinkedBlockingQueue | public static <V> StrategicBlockingQueue<V> newStrategicLinkedBlockingQueue(QueueingStrategy<V> queueingStrategy) {
return new StrategicBlockingQueue<V>(new LinkedBlockingQueue<V>(), queueingStrategy);
} | java | public static <V> StrategicBlockingQueue<V> newStrategicLinkedBlockingQueue(QueueingStrategy<V> queueingStrategy) {
return new StrategicBlockingQueue<V>(new LinkedBlockingQueue<V>(), queueingStrategy);
} | [
"public",
"static",
"<",
"V",
">",
"StrategicBlockingQueue",
"<",
"V",
">",
"newStrategicLinkedBlockingQueue",
"(",
"QueueingStrategy",
"<",
"V",
">",
"queueingStrategy",
")",
"{",
"return",
"new",
"StrategicBlockingQueue",
"<",
"V",
">",
"(",
"new",
"LinkedBlocki... | Return a StrategicBlockingQueue backed by a LinkedBlockingQueue using
the given QueueingStrategy.
@param queueingStrategy the QueueingStrategy to use
@param <V> the type of elements held in this collection | [
"Return",
"a",
"StrategicBlockingQueue",
"backed",
"by",
"a",
"LinkedBlockingQueue",
"using",
"the",
"given",
"QueueingStrategy",
"."
] | c28facbf02e628cc37266c051c23d4a7654b4eba | https://github.com/rholder/moar-concurrent/blob/c28facbf02e628cc37266c051c23d4a7654b4eba/src/main/java/com/github/rholder/moar/concurrent/StrategicQueues.java#L37-L39 | train |
rholder/moar-concurrent | src/main/java/com/github/rholder/moar/concurrent/StrategicQueues.java | StrategicQueues.newStrategicArrayBlockingQueue | public static <V> StrategicBlockingQueue<V> newStrategicArrayBlockingQueue(int capacity, QueueingStrategy<V> queueingStrategy) {
return new StrategicBlockingQueue<V>(new ArrayBlockingQueue<V>(capacity), queueingStrategy);
} | java | public static <V> StrategicBlockingQueue<V> newStrategicArrayBlockingQueue(int capacity, QueueingStrategy<V> queueingStrategy) {
return new StrategicBlockingQueue<V>(new ArrayBlockingQueue<V>(capacity), queueingStrategy);
} | [
"public",
"static",
"<",
"V",
">",
"StrategicBlockingQueue",
"<",
"V",
">",
"newStrategicArrayBlockingQueue",
"(",
"int",
"capacity",
",",
"QueueingStrategy",
"<",
"V",
">",
"queueingStrategy",
")",
"{",
"return",
"new",
"StrategicBlockingQueue",
"<",
"V",
">",
... | Return a StrategicBlockingQueue backed by an ArrayBlockingQueue of the
given capacity using the given QueueingStrategy.
@param capacity the capacity of the ArrayBlockingQueue
@param queueingStrategy the QueueingStrategy to use
@param <V> the type of elements held in this collection | [
"Return",
"a",
"StrategicBlockingQueue",
"backed",
"by",
"an",
"ArrayBlockingQueue",
"of",
"the",
"given",
"capacity",
"using",
"the",
"given",
"QueueingStrategy",
"."
] | c28facbf02e628cc37266c051c23d4a7654b4eba | https://github.com/rholder/moar-concurrent/blob/c28facbf02e628cc37266c051c23d4a7654b4eba/src/main/java/com/github/rholder/moar/concurrent/StrategicQueues.java#L49-L51 | train |
rholder/moar-concurrent | src/main/java/com/github/rholder/moar/concurrent/StrategicQueues.java | StrategicQueues.newStrategicBlockingQueue | public static <V> StrategicBlockingQueue<V> newStrategicBlockingQueue(BlockingQueue<V> blockingQueue, QueueingStrategy<V> queueingStrategy) {
return new StrategicBlockingQueue<V>(blockingQueue, queueingStrategy);
} | java | public static <V> StrategicBlockingQueue<V> newStrategicBlockingQueue(BlockingQueue<V> blockingQueue, QueueingStrategy<V> queueingStrategy) {
return new StrategicBlockingQueue<V>(blockingQueue, queueingStrategy);
} | [
"public",
"static",
"<",
"V",
">",
"StrategicBlockingQueue",
"<",
"V",
">",
"newStrategicBlockingQueue",
"(",
"BlockingQueue",
"<",
"V",
">",
"blockingQueue",
",",
"QueueingStrategy",
"<",
"V",
">",
"queueingStrategy",
")",
"{",
"return",
"new",
"StrategicBlocking... | Return a StrategicBlockingQueue backed by the given BlockingQueue using
the given QueueingStrategy.
@param blockingQueue the BlockingQueue to back the returned instance
@param queueingStrategy the QueueingStrategy to use
@param <V> the type of elements held in this collection | [
"Return",
"a",
"StrategicBlockingQueue",
"backed",
"by",
"the",
"given",
"BlockingQueue",
"using",
"the",
"given",
"QueueingStrategy",
"."
] | c28facbf02e628cc37266c051c23d4a7654b4eba | https://github.com/rholder/moar-concurrent/blob/c28facbf02e628cc37266c051c23d4a7654b4eba/src/main/java/com/github/rholder/moar/concurrent/StrategicQueues.java#L61-L63 | train |
dejv78/javafx-commons | jfx-controls/src/main/java/dejv/jfx/controls/radialmenu1/internal/RadialMenuItem.java | RadialMenuItem.show | public void show() {
if (isVisible()) {
return;
}
resetToInitialState();
setVisible(true);
final Timeline phaseOne = new Timeline();
phaseOne.getKeyFrames().addAll(
new KeyFrame(Duration.ZERO, new KeyValue(transformRadius, fromRadius), new KeyValue(transformOpacity, 0)),
new KeyFrame(new Duration(120), new KeyValue(transformRadius, parentSection.getNominalRadius()), new KeyValue(transformOpacity, 1))
);
final Timeline phaseTwo = new Timeline();
phaseTwo.getKeyFrames().addAll(
new KeyFrame(Duration.ZERO, new KeyValue(transformAngle, parentSection.getAngularAxisDeg())),
new KeyFrame(new Duration(80), new KeyValue(transformAngle, angle))
);
phaseOne.setOnFinished(event -> phaseTwo.play());
phaseTwo.setOnFinished(event -> setMouseTransparent(false));
phaseOne.play();
} | java | public void show() {
if (isVisible()) {
return;
}
resetToInitialState();
setVisible(true);
final Timeline phaseOne = new Timeline();
phaseOne.getKeyFrames().addAll(
new KeyFrame(Duration.ZERO, new KeyValue(transformRadius, fromRadius), new KeyValue(transformOpacity, 0)),
new KeyFrame(new Duration(120), new KeyValue(transformRadius, parentSection.getNominalRadius()), new KeyValue(transformOpacity, 1))
);
final Timeline phaseTwo = new Timeline();
phaseTwo.getKeyFrames().addAll(
new KeyFrame(Duration.ZERO, new KeyValue(transformAngle, parentSection.getAngularAxisDeg())),
new KeyFrame(new Duration(80), new KeyValue(transformAngle, angle))
);
phaseOne.setOnFinished(event -> phaseTwo.play());
phaseTwo.setOnFinished(event -> setMouseTransparent(false));
phaseOne.play();
} | [
"public",
"void",
"show",
"(",
")",
"{",
"if",
"(",
"isVisible",
"(",
")",
")",
"{",
"return",
";",
"}",
"resetToInitialState",
"(",
")",
";",
"setVisible",
"(",
"true",
")",
";",
"final",
"Timeline",
"phaseOne",
"=",
"new",
"Timeline",
"(",
")",
";"... | Trainsit the button to "Visible" state. | [
"Trainsit",
"the",
"button",
"to",
"Visible",
"state",
"."
] | ea846eeeb4ed43a7628a40931a3e6f27d513592f | https://github.com/dejv78/javafx-commons/blob/ea846eeeb4ed43a7628a40931a3e6f27d513592f/jfx-controls/src/main/java/dejv/jfx/controls/radialmenu1/internal/RadialMenuItem.java#L126-L152 | train |
dejv78/javafx-commons | jfx-controls/src/main/java/dejv/jfx/controls/radialmenu1/internal/RadialMenuItem.java | RadialMenuItem.setupMenuButton | public static void setupMenuButton(ButtonBase button, RadialMenuParams params, Node graphic, String tooltip, boolean addStyle) {
button.minWidthProperty().bind(params.buttonSizeProperty());
button.minHeightProperty().bind(params.buttonSizeProperty());
button.prefWidthProperty().bind(params.buttonSizeProperty());
button.prefHeightProperty().bind(params.buttonSizeProperty());
button.maxWidthProperty().bind(params.buttonSizeProperty());
button.maxHeightProperty().bind(params.buttonSizeProperty());
if (addStyle) {
button.getStylesheets().addAll(params.getStyleSheets());
}
button.setId(params.getStyleId());
button.getStyleClass().addAll(params.getStyleClasses());
button.setGraphic(graphic);
button.setTooltip(new Tooltip(tooltip));
} | java | public static void setupMenuButton(ButtonBase button, RadialMenuParams params, Node graphic, String tooltip, boolean addStyle) {
button.minWidthProperty().bind(params.buttonSizeProperty());
button.minHeightProperty().bind(params.buttonSizeProperty());
button.prefWidthProperty().bind(params.buttonSizeProperty());
button.prefHeightProperty().bind(params.buttonSizeProperty());
button.maxWidthProperty().bind(params.buttonSizeProperty());
button.maxHeightProperty().bind(params.buttonSizeProperty());
if (addStyle) {
button.getStylesheets().addAll(params.getStyleSheets());
}
button.setId(params.getStyleId());
button.getStyleClass().addAll(params.getStyleClasses());
button.setGraphic(graphic);
button.setTooltip(new Tooltip(tooltip));
} | [
"public",
"static",
"void",
"setupMenuButton",
"(",
"ButtonBase",
"button",
",",
"RadialMenuParams",
"params",
",",
"Node",
"graphic",
",",
"String",
"tooltip",
",",
"boolean",
"addStyle",
")",
"{",
"button",
".",
"minWidthProperty",
"(",
")",
".",
"bind",
"("... | Setup the round button.
@param button Button to setup
@param params Customization parameters
@param graphic Graphics contents
@param tooltip Tooltip text | [
"Setup",
"the",
"round",
"button",
"."
] | ea846eeeb4ed43a7628a40931a3e6f27d513592f | https://github.com/dejv78/javafx-commons/blob/ea846eeeb4ed43a7628a40931a3e6f27d513592f/jfx-controls/src/main/java/dejv/jfx/controls/radialmenu1/internal/RadialMenuItem.java#L176-L192 | train |
KyoriPowered/lunar | src/main/java/net/kyori/lunar/concurrent/MoreFutures.java | MoreFutures.immediateFailedFuture | public static <T> @NonNull CompletableFuture<T> immediateFailedFuture(final @NonNull Throwable ex) {
final CompletableFuture<T> future = new CompletableFuture<>();
future.completeExceptionally(ex);
return future;
} | java | public static <T> @NonNull CompletableFuture<T> immediateFailedFuture(final @NonNull Throwable ex) {
final CompletableFuture<T> future = new CompletableFuture<>();
future.completeExceptionally(ex);
return future;
} | [
"public",
"static",
"<",
"T",
">",
"@",
"NonNull",
"CompletableFuture",
"<",
"T",
">",
"immediateFailedFuture",
"(",
"final",
"@",
"NonNull",
"Throwable",
"ex",
")",
"{",
"final",
"CompletableFuture",
"<",
"T",
">",
"future",
"=",
"new",
"CompletableFuture",
... | Returns a completable future that is exceptionally completed with the provided exception.
@param ex the throwable
@param <T> the type
@return an exceptionally completed completable future | [
"Returns",
"a",
"completable",
"future",
"that",
"is",
"exceptionally",
"completed",
"with",
"the",
"provided",
"exception",
"."
] | 6856747d9034a2fe0c8d0a8a0150986797732b5c | https://github.com/KyoriPowered/lunar/blob/6856747d9034a2fe0c8d0a8a0150986797732b5c/src/main/java/net/kyori/lunar/concurrent/MoreFutures.java#L56-L60 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/ping.java | ping.get | public static ping get(nitro_service client, ping resource) throws Exception
{
resource.validate("get");
return ((ping[]) resource.get_resources(client))[0];
} | java | public static ping get(nitro_service client, ping resource) throws Exception
{
resource.validate("get");
return ((ping[]) resource.get_resources(client))[0];
} | [
"public",
"static",
"ping",
"get",
"(",
"nitro_service",
"client",
",",
"ping",
"resource",
")",
"throws",
"Exception",
"{",
"resource",
".",
"validate",
"(",
"\"get\"",
")",
";",
"return",
"(",
"(",
"ping",
"[",
"]",
")",
"resource",
".",
"get_resources",... | Use this operation to get the status of ping on a given device. | [
"Use",
"this",
"operation",
"to",
"get",
"the",
"status",
"of",
"ping",
"on",
"a",
"given",
"device",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/ping.java#L95-L99 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/inventory.java | inventory.get | public static inventory get(nitro_service client, inventory resource) throws Exception
{
resource.validate("get");
return ((inventory[]) resource.get_resources(client))[0];
} | java | public static inventory get(nitro_service client, inventory resource) throws Exception
{
resource.validate("get");
return ((inventory[]) resource.get_resources(client))[0];
} | [
"public",
"static",
"inventory",
"get",
"(",
"nitro_service",
"client",
",",
"inventory",
"resource",
")",
"throws",
"Exception",
"{",
"resource",
".",
"validate",
"(",
"\"get\"",
")",
";",
"return",
"(",
"(",
"inventory",
"[",
"]",
")",
"resource",
".",
"... | Use this operation to start inventory of a given device. All devices if device IP Address is not specified.. | [
"Use",
"this",
"operation",
"to",
"start",
"inventory",
"of",
"a",
"given",
"device",
".",
"All",
"devices",
"if",
"device",
"IP",
"Address",
"is",
"not",
"specified",
".."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/inventory.java#L107-L111 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/inventory.java | inventory.get_filtered | public static inventory[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception
{
inventory obj = new inventory();
options option = new options();
option.set_filter(filter);
inventory[] response = (inventory[]) obj.getfiltered(service, option);
return response;
} | java | public static inventory[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception
{
inventory obj = new inventory();
options option = new options();
option.set_filter(filter);
inventory[] response = (inventory[]) obj.getfiltered(service, option);
return response;
} | [
"public",
"static",
"inventory",
"[",
"]",
"get_filtered",
"(",
"nitro_service",
"service",
",",
"filtervalue",
"[",
"]",
"filter",
")",
"throws",
"Exception",
"{",
"inventory",
"obj",
"=",
"new",
"inventory",
"(",
")",
";",
"options",
"option",
"=",
"new",
... | Use this API to fetch filtered set of inventory resources.
set the filter parameter values in filtervalue object. | [
"Use",
"this",
"API",
"to",
"fetch",
"filtered",
"set",
"of",
"inventory",
"resources",
".",
"set",
"the",
"filter",
"parameter",
"values",
"in",
"filtervalue",
"object",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/inventory.java#L130-L137 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/biz/rules/AbstractRule.java | AbstractRule.setId | public final void setId(final ID id) {
Assert.notNull(id, "The identifier for Rule ({0}) cannot be null!", getClass().getName());
this.id = id;
} | java | public final void setId(final ID id) {
Assert.notNull(id, "The identifier for Rule ({0}) cannot be null!", getClass().getName());
this.id = id;
} | [
"public",
"final",
"void",
"setId",
"(",
"final",
"ID",
"id",
")",
"{",
"Assert",
".",
"notNull",
"(",
"id",
",",
"\"The identifier for Rule ({0}) cannot be null!\"",
",",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"this",
".",
"id",
"=",
... | Sets the identifier for this Rule.
@param id a value of type T assigned as this object's unique identifier.
@see org.cp.elements.lang.Identifiable#setId(Comparable)
@throws NullPointerException if the identifier for this Rule is null. | [
"Sets",
"the",
"identifier",
"for",
"this",
"Rule",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/biz/rules/AbstractRule.java#L60-L63 | train |
victims/victims-lib-java | src/main/java/com/redhat/victims/VictimsScanner.java | VictimsScanner.scan | public static void scan(String source, OutputStream os) throws IOException {
scanSource(source, new StringOutputStream(os));
} | java | public static void scan(String source, OutputStream os) throws IOException {
scanSource(source, new StringOutputStream(os));
} | [
"public",
"static",
"void",
"scan",
"(",
"String",
"source",
",",
"OutputStream",
"os",
")",
"throws",
"IOException",
"{",
"scanSource",
"(",
"source",
",",
"new",
"StringOutputStream",
"(",
"os",
")",
")",
";",
"}"
] | Iteratively finds all jar files if source is a directory and scans them
or if a file , scan it. The string values of the resulting records will
be written to the specified output stream. Embedded jars are a record on
their own.
@param source
@param os
@throws IOException | [
"Iteratively",
"finds",
"all",
"jar",
"files",
"if",
"source",
"is",
"a",
"directory",
"and",
"scans",
"them",
"or",
"if",
"a",
"file",
"scan",
"it",
".",
"The",
"string",
"values",
"of",
"the",
"resulting",
"records",
"will",
"be",
"written",
"to",
"the... | ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b | https://github.com/victims/victims-lib-java/blob/ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b/src/main/java/com/redhat/victims/VictimsScanner.java#L134-L136 | train |
victims/victims-lib-java | src/main/java/com/redhat/victims/VictimsScanner.java | VictimsScanner.getRecords | public static ArrayList<VictimsRecord> getRecords(String source)
throws IOException {
ArrayList<VictimsRecord> records = new ArrayList<VictimsRecord>();
scan(source, records);
return records;
} | java | public static ArrayList<VictimsRecord> getRecords(String source)
throws IOException {
ArrayList<VictimsRecord> records = new ArrayList<VictimsRecord>();
scan(source, records);
return records;
} | [
"public",
"static",
"ArrayList",
"<",
"VictimsRecord",
">",
"getRecords",
"(",
"String",
"source",
")",
"throws",
"IOException",
"{",
"ArrayList",
"<",
"VictimsRecord",
">",
"records",
"=",
"new",
"ArrayList",
"<",
"VictimsRecord",
">",
"(",
")",
";",
"scan",
... | Iteratively finds all jar files if source is a directory and scans them
or if a file , scan it.
@param source
@return An {@link ArrayList} of {@link VictimsRecord}s derrived from the
source. Embedded jars are a record on their own.
@throws IOException | [
"Iteratively",
"finds",
"all",
"jar",
"files",
"if",
"source",
"is",
"a",
"directory",
"and",
"scans",
"them",
"or",
"if",
"a",
"file",
"scan",
"it",
"."
] | ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b | https://github.com/victims/victims-lib-java/blob/ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b/src/main/java/com/redhat/victims/VictimsScanner.java#L162-L168 | train |
uaihebert/uaiMockServer | src/main/java/com/uaihebert/uaimockserver/validator/body/XmlUnitWrapper.java | XmlUnitWrapper.isIdentical | public static boolean isIdentical(final String expected, final String actual) {
final Diff diff = createDiffResult(expected, actual, false);
return diff.identical();
} | java | public static boolean isIdentical(final String expected, final String actual) {
final Diff diff = createDiffResult(expected, actual, false);
return diff.identical();
} | [
"public",
"static",
"boolean",
"isIdentical",
"(",
"final",
"String",
"expected",
",",
"final",
"String",
"actual",
")",
"{",
"final",
"Diff",
"diff",
"=",
"createDiffResult",
"(",
"expected",
",",
"actual",
",",
"false",
")",
";",
"return",
"diff",
".",
"... | This method will compare both XMLs and validate its attribute order.
@param expected what are we expecting
@param actual what we receive
@return if they have same value and child order | [
"This",
"method",
"will",
"compare",
"both",
"XMLs",
"and",
"validate",
"its",
"attribute",
"order",
"."
] | 8b0090d4018c2f430cfbbb3ae249347652802f2b | https://github.com/uaihebert/uaiMockServer/blob/8b0090d4018c2f430cfbbb3ae249347652802f2b/src/main/java/com/uaihebert/uaimockserver/validator/body/XmlUnitWrapper.java#L33-L37 | train |
uaihebert/uaiMockServer | src/main/java/com/uaihebert/uaimockserver/validator/body/XmlUnitWrapper.java | XmlUnitWrapper.isSimilar | public static boolean isSimilar(final String expected, final String actual) {
final Diff diff = createDiffResult(expected, actual, true);
return diff.similar();
} | java | public static boolean isSimilar(final String expected, final String actual) {
final Diff diff = createDiffResult(expected, actual, true);
return diff.similar();
} | [
"public",
"static",
"boolean",
"isSimilar",
"(",
"final",
"String",
"expected",
",",
"final",
"String",
"actual",
")",
"{",
"final",
"Diff",
"diff",
"=",
"createDiffResult",
"(",
"expected",
",",
"actual",
",",
"true",
")",
";",
"return",
"diff",
".",
"sim... | This method will compare both XMLs and WILL NOT validate its attribute order.
@param expected what are we expecting
@param actual what we receive
@return if they have same value | [
"This",
"method",
"will",
"compare",
"both",
"XMLs",
"and",
"WILL",
"NOT",
"validate",
"its",
"attribute",
"order",
"."
] | 8b0090d4018c2f430cfbbb3ae249347652802f2b | https://github.com/uaihebert/uaiMockServer/blob/8b0090d4018c2f430cfbbb3ae249347652802f2b/src/main/java/com/uaihebert/uaimockserver/validator/body/XmlUnitWrapper.java#L46-L50 | train |
KyoriPowered/lunar | src/main/java/net/kyori/lunar/graph/CyclePresentException.java | CyclePresentException.components | @SuppressWarnings("unchecked")
public <T> @NonNull Collection<Collection<T>> components() {
return (Collection<Collection<T>>) this.components;
} | java | @SuppressWarnings("unchecked")
public <T> @NonNull Collection<Collection<T>> components() {
return (Collection<Collection<T>>) this.components;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"@",
"NonNull",
"Collection",
"<",
"Collection",
"<",
"T",
">",
">",
"components",
"(",
")",
"{",
"return",
"(",
"Collection",
"<",
"Collection",
"<",
"T",
">",
">",
")",
"thi... | Accesses the strongly connected components.
<p>Only those components with two or more nodes blocks the process
of topological sorting.</p>
@param <T> the node type restored
@return the strongly connected components | [
"Accesses",
"the",
"strongly",
"connected",
"components",
"."
] | 6856747d9034a2fe0c8d0a8a0150986797732b5c | https://github.com/KyoriPowered/lunar/blob/6856747d9034a2fe0c8d0a8a0150986797732b5c/src/main/java/net/kyori/lunar/graph/CyclePresentException.java#L70-L73 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/mps_doc_image.java | mps_doc_image.get_filtered | public static mps_doc_image[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception
{
mps_doc_image obj = new mps_doc_image();
options option = new options();
option.set_filter(filter);
mps_doc_image[] response = (mps_doc_image[]) obj.getfiltered(service, option);
return response;
} | java | public static mps_doc_image[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception
{
mps_doc_image obj = new mps_doc_image();
options option = new options();
option.set_filter(filter);
mps_doc_image[] response = (mps_doc_image[]) obj.getfiltered(service, option);
return response;
} | [
"public",
"static",
"mps_doc_image",
"[",
"]",
"get_filtered",
"(",
"nitro_service",
"service",
",",
"filtervalue",
"[",
"]",
"filter",
")",
"throws",
"Exception",
"{",
"mps_doc_image",
"obj",
"=",
"new",
"mps_doc_image",
"(",
")",
";",
"options",
"option",
"=... | Use this API to fetch filtered set of mps_doc_image resources.
set the filter parameter values in filtervalue object. | [
"Use",
"this",
"API",
"to",
"fetch",
"filtered",
"set",
"of",
"mps_doc_image",
"resources",
".",
"set",
"the",
"filter",
"parameter",
"values",
"in",
"filtervalue",
"object",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/mps_doc_image.java#L180-L187 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/factory/provider/PrototypeObjectFactory.java | PrototypeObjectFactory.configure | @SuppressWarnings("unchecked")
protected <T> T configure(final T object) {
if (object instanceof Configurable && isConfigurationAvailable()) {
((Configurable) object).configure(getConfiguration());
}
return object;
} | java | @SuppressWarnings("unchecked")
protected <T> T configure(final T object) {
if (object instanceof Configurable && isConfigurationAvailable()) {
((Configurable) object).configure(getConfiguration());
}
return object;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"<",
"T",
">",
"T",
"configure",
"(",
"final",
"T",
"object",
")",
"{",
"if",
"(",
"object",
"instanceof",
"Configurable",
"&&",
"isConfigurationAvailable",
"(",
")",
")",
"{",
"(",
"(",
"Con... | Configures the object with an available Configuration if the object implements Configurable.
@param <T> the Class type of the created object.
@param object the object/bean to configure.
@return the object after configuration.
@see #getConfiguration()
@see #isConfigurationAvailable()
@see org.cp.elements.lang.Configurable#configure(Object) | [
"Configures",
"the",
"object",
"with",
"an",
"available",
"Configuration",
"if",
"the",
"object",
"implements",
"Configurable",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/factory/provider/PrototypeObjectFactory.java#L79-L86 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/factory/provider/PrototypeObjectFactory.java | PrototypeObjectFactory.initialize | protected <T> T initialize(final T object, final Map<?, ?> parameters) {
if (object instanceof ParameterizedInitable) {
((ParameterizedInitable) object).init(parameters);
return object;
}
else {
return initialize(object, parameters.values());
}
} | java | protected <T> T initialize(final T object, final Map<?, ?> parameters) {
if (object instanceof ParameterizedInitable) {
((ParameterizedInitable) object).init(parameters);
return object;
}
else {
return initialize(object, parameters.values());
}
} | [
"protected",
"<",
"T",
">",
"T",
"initialize",
"(",
"final",
"T",
"object",
",",
"final",
"Map",
"<",
"?",
",",
"?",
">",
"parameters",
")",
"{",
"if",
"(",
"object",
"instanceof",
"ParameterizedInitable",
")",
"{",
"(",
"(",
"ParameterizedInitable",
")"... | Initializes the object with the specified Map of named parameters providing the object implements the
ParameterizedInitable interface, otherwise delegates to the initialize method accepting an array of arguments
by passing the values of the Map as the argument array.
@param <T> the Class type of the created object.
@param object the object/bean to initialize.
@param parameters a Map of named parameters to initialize the object/bean.
@return the object after initialization.
@see #initialize(Object, Object...)
@see org.cp.elements.lang.ParameterizedInitable#init(java.util.Map) | [
"Initializes",
"the",
"object",
"with",
"the",
"specified",
"Map",
"of",
"named",
"parameters",
"providing",
"the",
"object",
"implements",
"the",
"ParameterizedInitable",
"interface",
"otherwise",
"delegates",
"to",
"the",
"initialize",
"method",
"accepting",
"an",
... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/factory/provider/PrototypeObjectFactory.java#L100-L108 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/factory/provider/PrototypeObjectFactory.java | PrototypeObjectFactory.initialize | protected <T> T initialize(final T object, final Object... args) {
if (object instanceof ParameterizedInitable) {
((ParameterizedInitable) object).init(args);
}
else if (object instanceof Initable) {
((Initable) object).init();
}
return object;
} | java | protected <T> T initialize(final T object, final Object... args) {
if (object instanceof ParameterizedInitable) {
((ParameterizedInitable) object).init(args);
}
else if (object instanceof Initable) {
((Initable) object).init();
}
return object;
} | [
"protected",
"<",
"T",
">",
"T",
"initialize",
"(",
"final",
"T",
"object",
",",
"final",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"object",
"instanceof",
"ParameterizedInitable",
")",
"{",
"(",
"(",
"ParameterizedInitable",
")",
"object",
")",
".",
... | Initializes the object with the specified array of arguments providing the object implements the
ParameterizedInitable interface, or calls the no argument init method if the object implements the Initable
interface, and finally, does nothing if the object is not Initable.
@param <T> the Class type of the created object.
@param object the object/bean to initialize.
@param args the array of Object arguments used to initialize the object/bean.
@return the object after initialization.
@see #initialize(Object, java.util.Map)
@see org.cp.elements.lang.Initable#init()
@see org.cp.elements.lang.ParameterizedInitable#init(Object...) | [
"Initializes",
"the",
"object",
"with",
"the",
"specified",
"array",
"of",
"arguments",
"providing",
"the",
"object",
"implements",
"the",
"ParameterizedInitable",
"interface",
"or",
"calls",
"the",
"no",
"argument",
"init",
"method",
"if",
"the",
"object",
"imple... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/factory/provider/PrototypeObjectFactory.java#L123-L132 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/br/br_device_profile.java | br_device_profile.get_filtered | public static br_device_profile[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception
{
br_device_profile obj = new br_device_profile();
options option = new options();
option.set_filter(filter);
br_device_profile[] response = (br_device_profile[]) obj.getfiltered(service, option);
return response;
} | java | public static br_device_profile[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception
{
br_device_profile obj = new br_device_profile();
options option = new options();
option.set_filter(filter);
br_device_profile[] response = (br_device_profile[]) obj.getfiltered(service, option);
return response;
} | [
"public",
"static",
"br_device_profile",
"[",
"]",
"get_filtered",
"(",
"nitro_service",
"service",
",",
"filtervalue",
"[",
"]",
"filter",
")",
"throws",
"Exception",
"{",
"br_device_profile",
"obj",
"=",
"new",
"br_device_profile",
"(",
")",
";",
"options",
"o... | Use this API to fetch filtered set of br_device_profile resources.
set the filter parameter values in filtervalue object. | [
"Use",
"this",
"API",
"to",
"fetch",
"filtered",
"set",
"of",
"br_device_profile",
"resources",
".",
"set",
"the",
"filter",
"parameter",
"values",
"in",
"filtervalue",
"object",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/br/br_device_profile.java#L152-L159 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/xen/hostcpu.java | hostcpu.get | public static hostcpu get(nitro_service client, hostcpu resource) throws Exception
{
resource.validate("get");
return ((hostcpu[]) resource.get_resources(client))[0];
} | java | public static hostcpu get(nitro_service client, hostcpu resource) throws Exception
{
resource.validate("get");
return ((hostcpu[]) resource.get_resources(client))[0];
} | [
"public",
"static",
"hostcpu",
"get",
"(",
"nitro_service",
"client",
",",
"hostcpu",
"resource",
")",
"throws",
"Exception",
"{",
"resource",
".",
"validate",
"(",
"\"get\"",
")",
";",
"return",
"(",
"(",
"hostcpu",
"[",
"]",
")",
"resource",
".",
"get_re... | Use this operation to get CPU Cores. | [
"Use",
"this",
"operation",
"to",
"get",
"CPU",
"Cores",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/xen/hostcpu.java#L226-L230 | train |
victims/victims-lib-java | src/main/java/com/redhat/victims/VictimsConfig.java | VictimsConfig.getPropertyValue | private static String getPropertyValue(String key) {
String env = System.getProperty(key);
if (env == null) {
if (DEFAULT_PROPS.containsKey(key)) {
return DEFAULT_PROPS.get(key);
} else {
return null;
}
}
return env;
} | java | private static String getPropertyValue(String key) {
String env = System.getProperty(key);
if (env == null) {
if (DEFAULT_PROPS.containsKey(key)) {
return DEFAULT_PROPS.get(key);
} else {
return null;
}
}
return env;
} | [
"private",
"static",
"String",
"getPropertyValue",
"(",
"String",
"key",
")",
"{",
"String",
"env",
"=",
"System",
".",
"getProperty",
"(",
"key",
")",
";",
"if",
"(",
"env",
"==",
"null",
")",
"{",
"if",
"(",
"DEFAULT_PROPS",
".",
"containsKey",
"(",
... | Return a configured value, or the default.
@param key
@return If configured, return the system property value, else return a
default. If a default is also not available, returns
<code>null</code> if no default is configured. | [
"Return",
"a",
"configured",
"value",
"or",
"the",
"default",
"."
] | ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b | https://github.com/victims/victims-lib-java/blob/ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b/src/main/java/com/redhat/victims/VictimsConfig.java#L73-L83 | train |
victims/victims-lib-java | src/main/java/com/redhat/victims/VictimsConfig.java | VictimsConfig.serviceURI | public static String serviceURI() throws VictimsException {
URL merged;
try {
merged = new URL(new URL(uri()), entry());
return merged.toString();
} catch (MalformedURLException e) {
throw new VictimsException(
"Invalid configuration for service URI.", e);
}
} | java | public static String serviceURI() throws VictimsException {
URL merged;
try {
merged = new URL(new URL(uri()), entry());
return merged.toString();
} catch (MalformedURLException e) {
throw new VictimsException(
"Invalid configuration for service URI.", e);
}
} | [
"public",
"static",
"String",
"serviceURI",
"(",
")",
"throws",
"VictimsException",
"{",
"URL",
"merged",
";",
"try",
"{",
"merged",
"=",
"new",
"URL",
"(",
"new",
"URL",
"(",
"uri",
"(",
")",
")",
",",
"entry",
"(",
")",
")",
";",
"return",
"merged"... | Get a complete webservice uri by merging base and entry point.
@return
@throws VictimsException | [
"Get",
"a",
"complete",
"webservice",
"uri",
"by",
"merging",
"base",
"and",
"entry",
"point",
"."
] | ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b | https://github.com/victims/victims-lib-java/blob/ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b/src/main/java/com/redhat/victims/VictimsConfig.java#L118-L127 | train |
victims/victims-lib-java | src/main/java/com/redhat/victims/VictimsConfig.java | VictimsConfig.home | public static File home() throws VictimsException {
File directory = new File(getPropertyValue(Key.HOME));
if (!directory.exists()) {
try {
FileUtils.forceMkdir(directory);
} catch (IOException e) {
throw new VictimsException("Could not create home directory.",
e);
}
}
return directory;
} | java | public static File home() throws VictimsException {
File directory = new File(getPropertyValue(Key.HOME));
if (!directory.exists()) {
try {
FileUtils.forceMkdir(directory);
} catch (IOException e) {
throw new VictimsException("Could not create home directory.",
e);
}
}
return directory;
} | [
"public",
"static",
"File",
"home",
"(",
")",
"throws",
"VictimsException",
"{",
"File",
"directory",
"=",
"new",
"File",
"(",
"getPropertyValue",
"(",
"Key",
".",
"HOME",
")",
")",
";",
"if",
"(",
"!",
"directory",
".",
"exists",
"(",
")",
")",
"{",
... | Get the configured cache directory. If the directory does not exist, it
will be created.
@return
@throws VictimsException | [
"Get",
"the",
"configured",
"cache",
"directory",
".",
"If",
"the",
"directory",
"does",
"not",
"exist",
"it",
"will",
"be",
"created",
"."
] | ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b | https://github.com/victims/victims-lib-java/blob/ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b/src/main/java/com/redhat/victims/VictimsConfig.java#L136-L147 | train |
victims/victims-lib-java | src/main/java/com/redhat/victims/VictimsConfig.java | VictimsConfig.algorithms | public static ArrayList<Algorithms> algorithms() {
ArrayList<Algorithms> algorithms = new ArrayList<Algorithms>();
for (String alg : getPropertyValue(Key.ALGORITHMS).split(",")) {
alg = alg.trim();
try {
algorithms.add(Algorithms.valueOf(alg));
} catch (Exception e) {
// skip
}
}
if (!algorithms.contains(getDefaultAlgorithm())) {
algorithms.add(getDefaultAlgorithm());
}
return algorithms;
} | java | public static ArrayList<Algorithms> algorithms() {
ArrayList<Algorithms> algorithms = new ArrayList<Algorithms>();
for (String alg : getPropertyValue(Key.ALGORITHMS).split(",")) {
alg = alg.trim();
try {
algorithms.add(Algorithms.valueOf(alg));
} catch (Exception e) {
// skip
}
}
if (!algorithms.contains(getDefaultAlgorithm())) {
algorithms.add(getDefaultAlgorithm());
}
return algorithms;
} | [
"public",
"static",
"ArrayList",
"<",
"Algorithms",
">",
"algorithms",
"(",
")",
"{",
"ArrayList",
"<",
"Algorithms",
">",
"algorithms",
"=",
"new",
"ArrayList",
"<",
"Algorithms",
">",
"(",
")",
";",
"for",
"(",
"String",
"alg",
":",
"getPropertyValue",
"... | Returns a list of valid algorithms to be used when fingerprinting. If not
specified, or if all values are illegal, all available algorithms are
used.
@return | [
"Returns",
"a",
"list",
"of",
"valid",
"algorithms",
"to",
"be",
"used",
"when",
"fingerprinting",
".",
"If",
"not",
"specified",
"or",
"if",
"all",
"values",
"are",
"illegal",
"all",
"available",
"algorithms",
"are",
"used",
"."
] | ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b | https://github.com/victims/victims-lib-java/blob/ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b/src/main/java/com/redhat/victims/VictimsConfig.java#L156-L172 | train |
victims/victims-lib-java | src/main/java/com/redhat/victims/VictimsConfig.java | VictimsConfig.dbUrl | public static String dbUrl() {
String dbUrl = getPropertyValue(Key.DB_URL);
if (dbUrl == null) {
if (VictimsDB.Driver.exists(dbDriver())) {
return VictimsDB.defaultURL(dbDriver());
}
return VictimsDB.defaultURL();
}
return dbUrl;
} | java | public static String dbUrl() {
String dbUrl = getPropertyValue(Key.DB_URL);
if (dbUrl == null) {
if (VictimsDB.Driver.exists(dbDriver())) {
return VictimsDB.defaultURL(dbDriver());
}
return VictimsDB.defaultURL();
}
return dbUrl;
} | [
"public",
"static",
"String",
"dbUrl",
"(",
")",
"{",
"String",
"dbUrl",
"=",
"getPropertyValue",
"(",
"Key",
".",
"DB_URL",
")",
";",
"if",
"(",
"dbUrl",
"==",
"null",
")",
"{",
"if",
"(",
"VictimsDB",
".",
"Driver",
".",
"exists",
"(",
"dbDriver",
... | Get the db connection URL.
@return | [
"Get",
"the",
"db",
"connection",
"URL",
"."
] | ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b | https://github.com/victims/victims-lib-java/blob/ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b/src/main/java/com/redhat/victims/VictimsConfig.java#L188-L197 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/util/MapUtils.java | MapUtils.transform | public static <K, V> Map<K, V> transform(Map<K, V> map, Transformer<V> transformer) {
Assert.notNull(map, "Map is required");
Assert.notNull(transformer, "Transformer is required");
return map.entrySet().stream().collect(Collectors.toMap(Map.Entry::<K>getKey,
(entry) -> transformer.transform(entry.getValue())));
} | java | public static <K, V> Map<K, V> transform(Map<K, V> map, Transformer<V> transformer) {
Assert.notNull(map, "Map is required");
Assert.notNull(transformer, "Transformer is required");
return map.entrySet().stream().collect(Collectors.toMap(Map.Entry::<K>getKey,
(entry) -> transformer.transform(entry.getValue())));
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"Map",
"<",
"K",
",",
"V",
">",
"transform",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"map",
",",
"Transformer",
"<",
"V",
">",
"transformer",
")",
"{",
"Assert",
".",
"notNull",
"(",
"map",
",",
"\"Map ... | Transforms the values of the given Map with the specified Transformer.
@param <K> Class type of the key.
@param <V> Class type of the value.
@param map {@link Map} to transform.
@param transformer {@link Transformer} used to transform the {@link Map}'s values.
@return a new {@link Map} from the given {@link Map} transformed by the {@link Transformer}.
@throws IllegalArgumentException if either the {@link Map} or {@link Transformer} are null.
@see org.cp.elements.lang.Transformer
@see java.util.Map | [
"Transforms",
"the",
"values",
"of",
"the",
"given",
"Map",
"with",
"the",
"specified",
"Transformer",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/MapUtils.java#L347-L354 | train |
loadimpact/loadimpact-sdk-java | src/main/java/com/loadimpact/util/DateUtils.java | DateUtils.toIso8601 | public static String toIso8601(Date date) {
if (date == null) return null;
return ISODateTimeFormat.dateTimeNoMillis().withZoneUTC().print(date.getTime());
} | java | public static String toIso8601(Date date) {
if (date == null) return null;
return ISODateTimeFormat.dateTimeNoMillis().withZoneUTC().print(date.getTime());
} | [
"public",
"static",
"String",
"toIso8601",
"(",
"Date",
"date",
")",
"{",
"if",
"(",
"date",
"==",
"null",
")",
"return",
"null",
";",
"return",
"ISODateTimeFormat",
".",
"dateTimeNoMillis",
"(",
")",
".",
"withZoneUTC",
"(",
")",
".",
"print",
"(",
"dat... | Returns a ISO8601 string of the given date.
@param date the date
@return ISO8601 formatted date (UTC) | [
"Returns",
"a",
"ISO8601",
"string",
"of",
"the",
"given",
"date",
"."
] | 49af80b768c5453266414108b0d30a0fc01b8cef | https://github.com/loadimpact/loadimpact-sdk-java/blob/49af80b768c5453266414108b0d30a0fc01b8cef/src/main/java/com/loadimpact/util/DateUtils.java#L29-L32 | train |
robovm/robovm-jfx78-compat | src/main/java/sun/misc/Cleaner.java | Cleaner.clean | public void clean() {
if (!remove(this))
return;
try {
thunk.run();
} catch (final Throwable x) {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
public Void run() {
if (System.err != null)
new Error("Cleaner terminated abnormally", x)
.printStackTrace();
System.exit(1);
return null;
}});
}
} | java | public void clean() {
if (!remove(this))
return;
try {
thunk.run();
} catch (final Throwable x) {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
public Void run() {
if (System.err != null)
new Error("Cleaner terminated abnormally", x)
.printStackTrace();
System.exit(1);
return null;
}});
}
} | [
"public",
"void",
"clean",
"(",
")",
"{",
"if",
"(",
"!",
"remove",
"(",
"this",
")",
")",
"return",
";",
"try",
"{",
"thunk",
".",
"run",
"(",
")",
";",
"}",
"catch",
"(",
"final",
"Throwable",
"x",
")",
"{",
"AccessController",
".",
"doPrivileged... | Runs this cleaner, if it has not been run before. | [
"Runs",
"this",
"cleaner",
"if",
"it",
"has",
"not",
"been",
"run",
"before",
"."
] | 5c1fd20488d19a10c3d69d4ca8b22957254d3811 | https://github.com/robovm/robovm-jfx78-compat/blob/5c1fd20488d19a10c3d69d4ca8b22957254d3811/src/main/java/sun/misc/Cleaner.java#L138-L153 | train |
jsilland/piezo | src/main/java/io/soliton/protobuf/json/JsonRpcServerHandler.java | JsonRpcServerHandler.shouldPrettyPrint | private boolean shouldPrettyPrint(HttpRequest request) {
QueryStringDecoder decoder = new QueryStringDecoder(request.getUri(), Charsets.UTF_8, true, 2);
Map<String, List<String>> parameters = decoder.parameters();
if (parameters.containsKey(PP_PARAMETER)) {
return parseBoolean(parameters.get(PP_PARAMETER).get(0));
} else if (parameters.containsKey(PRETTY_PRINT_PARAMETER)) {
return parseBoolean(parameters.get(PRETTY_PRINT_PARAMETER).get(0));
}
return true;
} | java | private boolean shouldPrettyPrint(HttpRequest request) {
QueryStringDecoder decoder = new QueryStringDecoder(request.getUri(), Charsets.UTF_8, true, 2);
Map<String, List<String>> parameters = decoder.parameters();
if (parameters.containsKey(PP_PARAMETER)) {
return parseBoolean(parameters.get(PP_PARAMETER).get(0));
} else if (parameters.containsKey(PRETTY_PRINT_PARAMETER)) {
return parseBoolean(parameters.get(PRETTY_PRINT_PARAMETER).get(0));
}
return true;
} | [
"private",
"boolean",
"shouldPrettyPrint",
"(",
"HttpRequest",
"request",
")",
"{",
"QueryStringDecoder",
"decoder",
"=",
"new",
"QueryStringDecoder",
"(",
"request",
".",
"getUri",
"(",
")",
",",
"Charsets",
".",
"UTF_8",
",",
"true",
",",
"2",
")",
";",
"M... | Determines whether the response to the request should be pretty-printed.
@param request the HTTP request.
@return {@code true} if the response should be pretty-printed. | [
"Determines",
"whether",
"the",
"response",
"to",
"the",
"request",
"should",
"be",
"pretty",
"-",
"printed",
"."
] | 9a340f1460d25e07ec475dd24128b838667c959b | https://github.com/jsilland/piezo/blob/9a340f1460d25e07ec475dd24128b838667c959b/src/main/java/io/soliton/protobuf/json/JsonRpcServerHandler.java#L179-L188 | train |
victims/victims-lib-java | src/main/java/com/redhat/victims/fingerprint/ClassFile.java | ClassFile.constantValue | public static String constantValue(int index, ConstantPool cp) {
Constant type = cp.getConstant(index);
if (type != null) {
switch (type.getTag()) {
case Constants.CONSTANT_Class:
ConstantClass cls = (ConstantClass) type;
return constantValue(cls.getNameIndex(), cp);
case Constants.CONSTANT_Double:
ConstantDouble dbl = (ConstantDouble) type;
return String.valueOf(dbl.getBytes());
case Constants.CONSTANT_Fieldref:
ConstantFieldref fieldRef = (ConstantFieldref) type;
return constantValue(fieldRef.getClassIndex(), cp) + " "
+ constantValue(fieldRef.getNameAndTypeIndex(), cp);
case Constants.CONSTANT_Float:
ConstantFloat flt = (ConstantFloat) type;
return String.valueOf(flt.getBytes());
case Constants.CONSTANT_Integer:
ConstantInteger integer = (ConstantInteger) type;
return String.valueOf(integer.getBytes());
case Constants.CONSTANT_InterfaceMethodref:
ConstantInterfaceMethodref intRef = (ConstantInterfaceMethodref) type;
return constantValue(intRef.getClassIndex(), cp) + " "
+ constantValue(intRef.getNameAndTypeIndex(), cp);
case Constants.CONSTANT_Long:
ConstantLong lng = (ConstantLong) type;
return String.valueOf(lng.getBytes());
case Constants.CONSTANT_Methodref:
ConstantMethodref methRef = (ConstantMethodref) type;
return constantValue(methRef.getClassIndex(), cp) + " "
+ constantValue(methRef.getNameAndTypeIndex(), cp);
case Constants.CONSTANT_NameAndType:
ConstantNameAndType nameType = (ConstantNameAndType) type;
return nameType.getName(cp) + " " + nameType.getSignature(cp);
case Constants.CONSTANT_String:
ConstantString str = (ConstantString) type;
return str.getBytes(cp);
case Constants.CONSTANT_Utf8:
ConstantUtf8 utf8 = (ConstantUtf8) type;
return utf8.getBytes();
}
}
return "";
} | java | public static String constantValue(int index, ConstantPool cp) {
Constant type = cp.getConstant(index);
if (type != null) {
switch (type.getTag()) {
case Constants.CONSTANT_Class:
ConstantClass cls = (ConstantClass) type;
return constantValue(cls.getNameIndex(), cp);
case Constants.CONSTANT_Double:
ConstantDouble dbl = (ConstantDouble) type;
return String.valueOf(dbl.getBytes());
case Constants.CONSTANT_Fieldref:
ConstantFieldref fieldRef = (ConstantFieldref) type;
return constantValue(fieldRef.getClassIndex(), cp) + " "
+ constantValue(fieldRef.getNameAndTypeIndex(), cp);
case Constants.CONSTANT_Float:
ConstantFloat flt = (ConstantFloat) type;
return String.valueOf(flt.getBytes());
case Constants.CONSTANT_Integer:
ConstantInteger integer = (ConstantInteger) type;
return String.valueOf(integer.getBytes());
case Constants.CONSTANT_InterfaceMethodref:
ConstantInterfaceMethodref intRef = (ConstantInterfaceMethodref) type;
return constantValue(intRef.getClassIndex(), cp) + " "
+ constantValue(intRef.getNameAndTypeIndex(), cp);
case Constants.CONSTANT_Long:
ConstantLong lng = (ConstantLong) type;
return String.valueOf(lng.getBytes());
case Constants.CONSTANT_Methodref:
ConstantMethodref methRef = (ConstantMethodref) type;
return constantValue(methRef.getClassIndex(), cp) + " "
+ constantValue(methRef.getNameAndTypeIndex(), cp);
case Constants.CONSTANT_NameAndType:
ConstantNameAndType nameType = (ConstantNameAndType) type;
return nameType.getName(cp) + " " + nameType.getSignature(cp);
case Constants.CONSTANT_String:
ConstantString str = (ConstantString) type;
return str.getBytes(cp);
case Constants.CONSTANT_Utf8:
ConstantUtf8 utf8 = (ConstantUtf8) type;
return utf8.getBytes();
}
}
return "";
} | [
"public",
"static",
"String",
"constantValue",
"(",
"int",
"index",
",",
"ConstantPool",
"cp",
")",
"{",
"Constant",
"type",
"=",
"cp",
".",
"getConstant",
"(",
"index",
")",
";",
"if",
"(",
"type",
"!=",
"null",
")",
"{",
"switch",
"(",
"type",
".",
... | Resolves a constants value from the constant pool to the lowest form it
can be represented by. E.g. String, Integer, Float, etc.
@author gcmurphy
@param index
@param cp
@return | [
"Resolves",
"a",
"constants",
"value",
"from",
"the",
"constant",
"pool",
"to",
"the",
"lowest",
"form",
"it",
"can",
"be",
"represented",
"by",
".",
"E",
".",
"g",
".",
"String",
"Integer",
"Float",
"etc",
"."
] | ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b | https://github.com/victims/victims-lib-java/blob/ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b/src/main/java/com/redhat/victims/fingerprint/ClassFile.java#L76-L129 | train |
victims/victims-lib-java | src/main/java/com/redhat/victims/fingerprint/ClassFile.java | ClassFile.normalize | public static byte[] normalize(byte[] bytes, String fileName)
throws IOException {
ByteArrayInputStream is = new ByteArrayInputStream(bytes);
ClassParser parser = new ClassParser(is, fileName);
StringBuffer buf = new StringBuffer();
JavaClass klass = parser.parse();
ConstantPool cpool = klass.getConstantPool();
// source file
buf.append(klass.getSourceFileName());
// access flags
buf.append(String.valueOf(klass.getAccessFlags()));
// this class
buf.append(constantValue(klass.getClassNameIndex(), cpool));
// super class (extends)
buf.append(constantValue(klass.getSuperclassNameIndex(), cpool));
// interfaces (implements)
for (int index : klass.getInterfaceIndices()) {
// implemented interface name
buf.append(constantValue(index, cpool));
}
// fields
for (Field f : klass.getFields()) {
// access flags
buf.append(String.valueOf(f.getAccessFlags()));
// name
buf.append(constantValue(f.getNameIndex(), cpool));
// signature
buf.append(constantValue(f.getSignatureIndex(), cpool));
// value
if (f.getConstantValue() != null) {
int index = f.getConstantValue().getConstantValueIndex();
buf.append(constantValue(index, klass.getConstantPool()));
}
}
// methods
for (Method m : klass.getMethods()) {
// access flags
buf.append(String.valueOf(m.getAccessFlags()));
// name
buf.append(constantValue(m.getNameIndex(), cpool));
// signature
buf.append(constantValue(m.getSignatureIndex(), cpool));
// code
Code code = m.getCode();
if (code != null) {
ByteSequence bytecode = new ByteSequence(code.getCode());
buf.append(formatBytecode(bytecode, cpool));
}
}
return buf.toString().getBytes(VictimsConfig.charset());
} | java | public static byte[] normalize(byte[] bytes, String fileName)
throws IOException {
ByteArrayInputStream is = new ByteArrayInputStream(bytes);
ClassParser parser = new ClassParser(is, fileName);
StringBuffer buf = new StringBuffer();
JavaClass klass = parser.parse();
ConstantPool cpool = klass.getConstantPool();
// source file
buf.append(klass.getSourceFileName());
// access flags
buf.append(String.valueOf(klass.getAccessFlags()));
// this class
buf.append(constantValue(klass.getClassNameIndex(), cpool));
// super class (extends)
buf.append(constantValue(klass.getSuperclassNameIndex(), cpool));
// interfaces (implements)
for (int index : klass.getInterfaceIndices()) {
// implemented interface name
buf.append(constantValue(index, cpool));
}
// fields
for (Field f : klass.getFields()) {
// access flags
buf.append(String.valueOf(f.getAccessFlags()));
// name
buf.append(constantValue(f.getNameIndex(), cpool));
// signature
buf.append(constantValue(f.getSignatureIndex(), cpool));
// value
if (f.getConstantValue() != null) {
int index = f.getConstantValue().getConstantValueIndex();
buf.append(constantValue(index, klass.getConstantPool()));
}
}
// methods
for (Method m : klass.getMethods()) {
// access flags
buf.append(String.valueOf(m.getAccessFlags()));
// name
buf.append(constantValue(m.getNameIndex(), cpool));
// signature
buf.append(constantValue(m.getSignatureIndex(), cpool));
// code
Code code = m.getCode();
if (code != null) {
ByteSequence bytecode = new ByteSequence(code.getCode());
buf.append(formatBytecode(bytecode, cpool));
}
}
return buf.toString().getBytes(VictimsConfig.charset());
} | [
"public",
"static",
"byte",
"[",
"]",
"normalize",
"(",
"byte",
"[",
"]",
"bytes",
",",
"String",
"fileName",
")",
"throws",
"IOException",
"{",
"ByteArrayInputStream",
"is",
"=",
"new",
"ByteArrayInputStream",
"(",
"bytes",
")",
";",
"ClassParser",
"parser",
... | The driving function that normalizes given byte code.
@param bytes
The input class as a byte array.
@param fileName
The name of the file.
@return The normalized bytecode as a byte array.
@throws IOException | [
"The",
"driving",
"function",
"that",
"normalizes",
"given",
"byte",
"code",
"."
] | ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b | https://github.com/victims/victims-lib-java/blob/ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b/src/main/java/com/redhat/victims/fingerprint/ClassFile.java#L342-L392 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/RelationalOperator.java | RelationalOperator.equalTo | public static <T extends Comparable<T>> RelationalOperator<T> equalTo(T value) {
return new EqualToOperator<>(value);
} | java | public static <T extends Comparable<T>> RelationalOperator<T> equalTo(T value) {
return new EqualToOperator<>(value);
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"T",
">",
">",
"RelationalOperator",
"<",
"T",
">",
"equalTo",
"(",
"T",
"value",
")",
"{",
"return",
"new",
"EqualToOperator",
"<>",
"(",
"value",
")",
";",
"}"
] | Gets the RelationalOperator performing equality comparisons to determine whether all provided values are equal to
the given expected value.
@param value the expected object value of the equality comparison.
@param <T> the expected Class type for the object used in the equality comparison.
@return a RelationalOperator for the equality comparison. | [
"Gets",
"the",
"RelationalOperator",
"performing",
"equality",
"comparisons",
"to",
"determine",
"whether",
"all",
"provided",
"values",
"are",
"equal",
"to",
"the",
"given",
"expected",
"value",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/RelationalOperator.java#L39-L41 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/RelationalOperator.java | RelationalOperator.greaterThan | public static <T extends Comparable<T>> RelationalOperator<T> greaterThan(T lowerBound) {
return new GreaterThanOperator<>(lowerBound);
} | java | public static <T extends Comparable<T>> RelationalOperator<T> greaterThan(T lowerBound) {
return new GreaterThanOperator<>(lowerBound);
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"T",
">",
">",
"RelationalOperator",
"<",
"T",
">",
"greaterThan",
"(",
"T",
"lowerBound",
")",
"{",
"return",
"new",
"GreaterThanOperator",
"<>",
"(",
"lowerBound",
")",
";",
"}"
] | Gets the RelationalOperator performing greater than comparisons to determine whether all provided values
are greater than the given lower bound value.
@param lowerBound the Comparable lower bounded value.
@param <T> the expected Class type for the object used in the greater than comparison.
@return a RelationalOperator for the greater than comparison. | [
"Gets",
"the",
"RelationalOperator",
"performing",
"greater",
"than",
"comparisons",
"to",
"determine",
"whether",
"all",
"provided",
"values",
"are",
"greater",
"than",
"the",
"given",
"lower",
"bound",
"value",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/RelationalOperator.java#L51-L53 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/RelationalOperator.java | RelationalOperator.greaterThanAndLessThan | public static <T extends Comparable<T>> RelationalOperator<T> greaterThanAndLessThan(T lowerBound, T upperBound) {
return ComposableRelationalOperator.compose(greaterThan(lowerBound), LogicalOperator.AND, lessThan(upperBound));
} | java | public static <T extends Comparable<T>> RelationalOperator<T> greaterThanAndLessThan(T lowerBound, T upperBound) {
return ComposableRelationalOperator.compose(greaterThan(lowerBound), LogicalOperator.AND, lessThan(upperBound));
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"T",
">",
">",
"RelationalOperator",
"<",
"T",
">",
"greaterThanAndLessThan",
"(",
"T",
"lowerBound",
",",
"T",
"upperBound",
")",
"{",
"return",
"ComposableRelationalOperator",
".",
"compose",
"(",
"... | Gets the RelationalOperator performing greater than and less than comparisons to determine whether all provided
values are greater than some lower bound value and also less than some upper bound value.
@param lowerBound the Comparable lower bounded value.
@param upperBound the Comparable upper bounded value.
@param <T> the expected Class type for the object used in the greater than and less than comparison.
@return a RelationalOperator for the greater than and less than comparison. | [
"Gets",
"the",
"RelationalOperator",
"performing",
"greater",
"than",
"and",
"less",
"than",
"comparisons",
"to",
"determine",
"whether",
"all",
"provided",
"values",
"are",
"greater",
"than",
"some",
"lower",
"bound",
"value",
"and",
"also",
"less",
"than",
"so... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/RelationalOperator.java#L64-L66 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/RelationalOperator.java | RelationalOperator.greaterThanAndLessThanEqualTo | public static <T extends Comparable<T>> RelationalOperator<T> greaterThanAndLessThanEqualTo(T lowerBound, T upperBound) {
return ComposableRelationalOperator.compose(greaterThan(lowerBound), LogicalOperator.AND, lessThanEqualTo(upperBound));
} | java | public static <T extends Comparable<T>> RelationalOperator<T> greaterThanAndLessThanEqualTo(T lowerBound, T upperBound) {
return ComposableRelationalOperator.compose(greaterThan(lowerBound), LogicalOperator.AND, lessThanEqualTo(upperBound));
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"T",
">",
">",
"RelationalOperator",
"<",
"T",
">",
"greaterThanAndLessThanEqualTo",
"(",
"T",
"lowerBound",
",",
"T",
"upperBound",
")",
"{",
"return",
"ComposableRelationalOperator",
".",
"compose",
"... | Gets the RelationalOperator performing greater than and less than equal to comparisons to determine whether all
provided values are greater than some lower bound value and also less than equal to some upper bound value.
@param lowerBound the Comparable lower bounded value.
@param upperBound the Comparable upper bounded value.
@param <T> the expected Class type for the object used in the greater than and less than equal to comparison.
@return a RelationalOperator for the greater than and less than equal to comparison. | [
"Gets",
"the",
"RelationalOperator",
"performing",
"greater",
"than",
"and",
"less",
"than",
"equal",
"to",
"comparisons",
"to",
"determine",
"whether",
"all",
"provided",
"values",
"are",
"greater",
"than",
"some",
"lower",
"bound",
"value",
"and",
"also",
"les... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/RelationalOperator.java#L77-L79 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/RelationalOperator.java | RelationalOperator.greaterThanEqualTo | public static <T extends Comparable<T>> RelationalOperator<T> greaterThanEqualTo(T lowerBound) {
return new GreaterThanEqualToOperator<>(lowerBound);
} | java | public static <T extends Comparable<T>> RelationalOperator<T> greaterThanEqualTo(T lowerBound) {
return new GreaterThanEqualToOperator<>(lowerBound);
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"T",
">",
">",
"RelationalOperator",
"<",
"T",
">",
"greaterThanEqualTo",
"(",
"T",
"lowerBound",
")",
"{",
"return",
"new",
"GreaterThanEqualToOperator",
"<>",
"(",
"lowerBound",
")",
";",
"}"
] | Gets the RelationalOperator performing greater than equal to comparisons to determine whether all provided values
are greater than equal to the given lower bound value.
@param lowerBound the Comparable lower bounded value.
@param <T> the expected Class type for the object used in the greater than equal to comparison.
@return a RelationalOperator for the greater than equal to comparison. | [
"Gets",
"the",
"RelationalOperator",
"performing",
"greater",
"than",
"equal",
"to",
"comparisons",
"to",
"determine",
"whether",
"all",
"provided",
"values",
"are",
"greater",
"than",
"equal",
"to",
"the",
"given",
"lower",
"bound",
"value",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/RelationalOperator.java#L89-L91 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/RelationalOperator.java | RelationalOperator.greaterThanEqualToAndLessThan | public static <T extends Comparable<T>> RelationalOperator<T> greaterThanEqualToAndLessThan(T lowerBound, T upperBound) {
return ComposableRelationalOperator.compose(greaterThanEqualTo(lowerBound), LogicalOperator.AND, lessThan(upperBound));
} | java | public static <T extends Comparable<T>> RelationalOperator<T> greaterThanEqualToAndLessThan(T lowerBound, T upperBound) {
return ComposableRelationalOperator.compose(greaterThanEqualTo(lowerBound), LogicalOperator.AND, lessThan(upperBound));
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"T",
">",
">",
"RelationalOperator",
"<",
"T",
">",
"greaterThanEqualToAndLessThan",
"(",
"T",
"lowerBound",
",",
"T",
"upperBound",
")",
"{",
"return",
"ComposableRelationalOperator",
".",
"compose",
"... | Gets the RelationalOperator performing greater than equal to and less than comparisons to determine whether all
provided values are greater than equal to some lower bound value and also less than some upper bound value.
@param lowerBound the Comparable lower bounded value.
@param upperBound the Comparable upper bounded value.
@param <T> the expected Class type for the object used in the greater than equal to and less than comparison.
@return a RelationalOperator for the greater than equal to and less than comparison. | [
"Gets",
"the",
"RelationalOperator",
"performing",
"greater",
"than",
"equal",
"to",
"and",
"less",
"than",
"comparisons",
"to",
"determine",
"whether",
"all",
"provided",
"values",
"are",
"greater",
"than",
"equal",
"to",
"some",
"lower",
"bound",
"value",
"and... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/RelationalOperator.java#L102-L104 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/RelationalOperator.java | RelationalOperator.greaterThanEqualToAndLessThanEqualTo | public static <T extends Comparable<T>> RelationalOperator<T> greaterThanEqualToAndLessThanEqualTo(T lowerBound, T upperBound) {
return ComposableRelationalOperator.compose(greaterThanEqualTo(lowerBound), LogicalOperator.AND, lessThanEqualTo(upperBound));
} | java | public static <T extends Comparable<T>> RelationalOperator<T> greaterThanEqualToAndLessThanEqualTo(T lowerBound, T upperBound) {
return ComposableRelationalOperator.compose(greaterThanEqualTo(lowerBound), LogicalOperator.AND, lessThanEqualTo(upperBound));
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"T",
">",
">",
"RelationalOperator",
"<",
"T",
">",
"greaterThanEqualToAndLessThanEqualTo",
"(",
"T",
"lowerBound",
",",
"T",
"upperBound",
")",
"{",
"return",
"ComposableRelationalOperator",
".",
"compos... | Gets the RelationalOperator performing greater than equal to and less than equal to comparisons to determine
whether all provided values are greater than equal to some lower bound value and also less than equal to some
upper bound value.
@param lowerBound the Comparable lower bounded value.
@param upperBound the Comparable upper bounded value.
@param <T> the expected Class type for the object used in the greater than equal to and less than equal to
comparison.
@return a RelationalOperator for the greater than equal to and less than equal to comparison. | [
"Gets",
"the",
"RelationalOperator",
"performing",
"greater",
"than",
"equal",
"to",
"and",
"less",
"than",
"equal",
"to",
"comparisons",
"to",
"determine",
"whether",
"all",
"provided",
"values",
"are",
"greater",
"than",
"equal",
"to",
"some",
"lower",
"bound"... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/RelationalOperator.java#L117-L119 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/RelationalOperator.java | RelationalOperator.lessThan | public static <T extends Comparable<T>> RelationalOperator<T> lessThan(T lowerBound) {
return new LessThanOperator<>(lowerBound);
} | java | public static <T extends Comparable<T>> RelationalOperator<T> lessThan(T lowerBound) {
return new LessThanOperator<>(lowerBound);
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"T",
">",
">",
"RelationalOperator",
"<",
"T",
">",
"lessThan",
"(",
"T",
"lowerBound",
")",
"{",
"return",
"new",
"LessThanOperator",
"<>",
"(",
"lowerBound",
")",
";",
"}"
] | Gets the RelationalOperator performing less than comparisons to determine whether all provided values are less than
the given upper bound value.
@param lowerBound the Comparable upper bounded value.
@param <T> the expected Class type for the object used in the less than comparison.
@return a RelationalOperator for the less than comparison. | [
"Gets",
"the",
"RelationalOperator",
"performing",
"less",
"than",
"comparisons",
"to",
"determine",
"whether",
"all",
"provided",
"values",
"are",
"less",
"than",
"the",
"given",
"upper",
"bound",
"value",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/RelationalOperator.java#L129-L131 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/RelationalOperator.java | RelationalOperator.lessThanOrGreaterThan | public static <T extends Comparable<T>> RelationalOperator<T> lessThanOrGreaterThan(T lowerBound, T upperBound) {
return ComposableRelationalOperator.compose(lessThan(lowerBound), LogicalOperator.OR, greaterThan(upperBound));
} | java | public static <T extends Comparable<T>> RelationalOperator<T> lessThanOrGreaterThan(T lowerBound, T upperBound) {
return ComposableRelationalOperator.compose(lessThan(lowerBound), LogicalOperator.OR, greaterThan(upperBound));
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"T",
">",
">",
"RelationalOperator",
"<",
"T",
">",
"lessThanOrGreaterThan",
"(",
"T",
"lowerBound",
",",
"T",
"upperBound",
")",
"{",
"return",
"ComposableRelationalOperator",
".",
"compose",
"(",
"l... | Gets the RelationalOperator performing less than or greater than comparisons to determine whether all provided
values are less than some upper bound value or possibly greater than some lower bound value.
@param lowerBound the Comparable upper bounded value.
@param upperBound the Comparable lower bounded value.
@param <T> the expected Class type for the object used in the less than or greater than comparison.
@return a RelationalOperator for the less than or greater than comparison. | [
"Gets",
"the",
"RelationalOperator",
"performing",
"less",
"than",
"or",
"greater",
"than",
"comparisons",
"to",
"determine",
"whether",
"all",
"provided",
"values",
"are",
"less",
"than",
"some",
"upper",
"bound",
"value",
"or",
"possibly",
"greater",
"than",
"... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/RelationalOperator.java#L142-L144 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/RelationalOperator.java | RelationalOperator.lessThanOrGreaterThanEqualTo | public static <T extends Comparable<T>> RelationalOperator<T> lessThanOrGreaterThanEqualTo(T lowerBound, T upperBound) {
return ComposableRelationalOperator.compose(lessThan(lowerBound), LogicalOperator.OR, greaterThanEqualTo(upperBound));
} | java | public static <T extends Comparable<T>> RelationalOperator<T> lessThanOrGreaterThanEqualTo(T lowerBound, T upperBound) {
return ComposableRelationalOperator.compose(lessThan(lowerBound), LogicalOperator.OR, greaterThanEqualTo(upperBound));
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"T",
">",
">",
"RelationalOperator",
"<",
"T",
">",
"lessThanOrGreaterThanEqualTo",
"(",
"T",
"lowerBound",
",",
"T",
"upperBound",
")",
"{",
"return",
"ComposableRelationalOperator",
".",
"compose",
"(... | Gets the RelationalOperator performing less than or greater than equal to comparisons to determine whether all
provided values are less than some upper bound value or possibly greater than equal to some lower bound value.
@param lowerBound the Comparable lower upper bounded value.
@param upperBound the Comparable upper lower bounded value.
@param <T> the expected Class type for the object used in the less than or greater than equal to comparison.
@return a RelationalOperator for the less than or greater than equal to comparison. | [
"Gets",
"the",
"RelationalOperator",
"performing",
"less",
"than",
"or",
"greater",
"than",
"equal",
"to",
"comparisons",
"to",
"determine",
"whether",
"all",
"provided",
"values",
"are",
"less",
"than",
"some",
"upper",
"bound",
"value",
"or",
"possibly",
"grea... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/RelationalOperator.java#L155-L157 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/RelationalOperator.java | RelationalOperator.lessThanEqualTo | public static <T extends Comparable<T>> RelationalOperator<T> lessThanEqualTo(T lowerBound) {
return new LessThanEqualToOperator<>(lowerBound);
} | java | public static <T extends Comparable<T>> RelationalOperator<T> lessThanEqualTo(T lowerBound) {
return new LessThanEqualToOperator<>(lowerBound);
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"T",
">",
">",
"RelationalOperator",
"<",
"T",
">",
"lessThanEqualTo",
"(",
"T",
"lowerBound",
")",
"{",
"return",
"new",
"LessThanEqualToOperator",
"<>",
"(",
"lowerBound",
")",
";",
"}"
] | Gets the RelationalOperator performing less than equal to comparisons to determine whether all provided values
are less than equal to the given upper bound value.
@param lowerBound the Comparable upper bounded value.
@param <T> the expected Class type for the object used in the less than equal to comparison.
@return a RelationalOperator for the less than equal to comparison. | [
"Gets",
"the",
"RelationalOperator",
"performing",
"less",
"than",
"equal",
"to",
"comparisons",
"to",
"determine",
"whether",
"all",
"provided",
"values",
"are",
"less",
"than",
"equal",
"to",
"the",
"given",
"upper",
"bound",
"value",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/RelationalOperator.java#L167-L169 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/RelationalOperator.java | RelationalOperator.lessThanEqualToOrGreaterThan | public static <T extends Comparable<T>> RelationalOperator<T> lessThanEqualToOrGreaterThan(T lowerBound, T upperBound) {
return ComposableRelationalOperator.compose(lessThanEqualTo(lowerBound), LogicalOperator.OR, greaterThan(upperBound));
} | java | public static <T extends Comparable<T>> RelationalOperator<T> lessThanEqualToOrGreaterThan(T lowerBound, T upperBound) {
return ComposableRelationalOperator.compose(lessThanEqualTo(lowerBound), LogicalOperator.OR, greaterThan(upperBound));
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"T",
">",
">",
"RelationalOperator",
"<",
"T",
">",
"lessThanEqualToOrGreaterThan",
"(",
"T",
"lowerBound",
",",
"T",
"upperBound",
")",
"{",
"return",
"ComposableRelationalOperator",
".",
"compose",
"(... | Gets the RelationalOperator performing less than equal to or greater than comparisons to determine whether all
provided values are less than equal to some upper bound value or possibly greater than some lower bound value.
@param lowerBound the Comparable upper bounded value.
@param upperBound the Comparable lower bounded value.
@param <T> the expected Class type for the object used in the less than equal to or greater than comparison.
@return a RelationalOperator for the less than equal to or greater than comparison. | [
"Gets",
"the",
"RelationalOperator",
"performing",
"less",
"than",
"equal",
"to",
"or",
"greater",
"than",
"comparisons",
"to",
"determine",
"whether",
"all",
"provided",
"values",
"are",
"less",
"than",
"equal",
"to",
"some",
"upper",
"bound",
"value",
"or",
... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/RelationalOperator.java#L180-L182 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/RelationalOperator.java | RelationalOperator.lessThanEqualToOrGreaterThanEqualTo | public static <T extends Comparable<T>> RelationalOperator<T> lessThanEqualToOrGreaterThanEqualTo(T lowerBound, T upperBound) {
return ComposableRelationalOperator.compose(lessThanEqualTo(lowerBound), LogicalOperator.OR, greaterThanEqualTo(upperBound));
} | java | public static <T extends Comparable<T>> RelationalOperator<T> lessThanEqualToOrGreaterThanEqualTo(T lowerBound, T upperBound) {
return ComposableRelationalOperator.compose(lessThanEqualTo(lowerBound), LogicalOperator.OR, greaterThanEqualTo(upperBound));
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"T",
">",
">",
"RelationalOperator",
"<",
"T",
">",
"lessThanEqualToOrGreaterThanEqualTo",
"(",
"T",
"lowerBound",
",",
"T",
"upperBound",
")",
"{",
"return",
"ComposableRelationalOperator",
".",
"compose... | Gets the RelationalOperator performing less than equal to or greater than equal to comparisons to determine whether
all provided values are less than equal to some upper bound value or possibly greater than equal to some lower
bound value.
@param lowerBound the Comparable upper bounded value.
@param upperBound the Comparable lower bounded value.
@param <T> the expected Class type for the object used in the less than equal to or greater than equal to
comparison.
@return a RelationalOperator for the less than equal to or greater than equal to comparison. | [
"Gets",
"the",
"RelationalOperator",
"performing",
"less",
"than",
"equal",
"to",
"or",
"greater",
"than",
"equal",
"to",
"comparisons",
"to",
"determine",
"whether",
"all",
"provided",
"values",
"are",
"less",
"than",
"equal",
"to",
"some",
"upper",
"bound",
... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/RelationalOperator.java#L195-L197 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/util/sort/support/BubbleSort.java | BubbleSort.sort | @Override
public <E> List<E> sort(final List<E> elements) {
int position = elements.size();
do {
int lastSwapPosition = 0;
for (int index = 1; index < position; index++) {
if (getOrderBy().compare(elements.get(index - 1), elements.get(index)) > 0) {
swap(elements, index - 1, index);
lastSwapPosition = index;
}
}
position = lastSwapPosition;
}
while (position != 0);
return elements;
} | java | @Override
public <E> List<E> sort(final List<E> elements) {
int position = elements.size();
do {
int lastSwapPosition = 0;
for (int index = 1; index < position; index++) {
if (getOrderBy().compare(elements.get(index - 1), elements.get(index)) > 0) {
swap(elements, index - 1, index);
lastSwapPosition = index;
}
}
position = lastSwapPosition;
}
while (position != 0);
return elements;
} | [
"@",
"Override",
"public",
"<",
"E",
">",
"List",
"<",
"E",
">",
"sort",
"(",
"final",
"List",
"<",
"E",
">",
"elements",
")",
"{",
"int",
"position",
"=",
"elements",
".",
"size",
"(",
")",
";",
"do",
"{",
"int",
"lastSwapPosition",
"=",
"0",
";... | Uses the Bubble Sort algorithm to sort a List of elements as defined by the Comparator, or as determined
by the elements in the collection if the elements are Comparable.
@param <E> the type of elements in the List.
@param elements the List of elements to sort.
@return the collection of elements sorted.
@see java.util.List | [
"Uses",
"the",
"Bubble",
"Sort",
"algorithm",
"to",
"sort",
"a",
"List",
"of",
"elements",
"as",
"defined",
"by",
"the",
"Comparator",
"or",
"as",
"determined",
"by",
"the",
"elements",
"in",
"the",
"collection",
"if",
"the",
"elements",
"are",
"Comparable",... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/sort/support/BubbleSort.java#L46-L65 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/util/search/support/LinearSearch.java | LinearSearch.search | @Override
public <E> E search(final Collection<E> collection) {
for (E element : collection) {
if (getMatcher().isMatch(element)) {
return element;
}
}
return null;
} | java | @Override
public <E> E search(final Collection<E> collection) {
for (E element : collection) {
if (getMatcher().isMatch(element)) {
return element;
}
}
return null;
} | [
"@",
"Override",
"public",
"<",
"E",
">",
"E",
"search",
"(",
"final",
"Collection",
"<",
"E",
">",
"collection",
")",
"{",
"for",
"(",
"E",
"element",
":",
"collection",
")",
"{",
"if",
"(",
"getMatcher",
"(",
")",
".",
"isMatch",
"(",
"element",
... | Searches the Collection of elements in order to find the element or elements matching the criteria defined
by the Matcher.
@param <E> the Class type of elements in the Collection.
@param collection the Collection of elements to search.
@return the element in the Collection matching the search criteria defined by the Matcher.
@see #getMatcher() | [
"Searches",
"the",
"Collection",
"of",
"elements",
"in",
"order",
"to",
"find",
"the",
"element",
"or",
"elements",
"matching",
"the",
"criteria",
"defined",
"by",
"the",
"Matcher",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/search/support/LinearSearch.java#L43-L52 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ObjectUtils.java | ObjectUtils.areAllNull | @NullSafe
@SuppressWarnings("all")
public static boolean areAllNull(Object... values) {
for (Object value : nullSafeArray(values)) {
if (value != null) {
return false;
}
}
return true;
} | java | @NullSafe
@SuppressWarnings("all")
public static boolean areAllNull(Object... values) {
for (Object value : nullSafeArray(values)) {
if (value != null) {
return false;
}
}
return true;
} | [
"@",
"NullSafe",
"@",
"SuppressWarnings",
"(",
"\"all\"",
")",
"public",
"static",
"boolean",
"areAllNull",
"(",
"Object",
"...",
"values",
")",
"{",
"for",
"(",
"Object",
"value",
":",
"nullSafeArray",
"(",
"values",
")",
")",
"{",
"if",
"(",
"value",
"... | Null-safe method to determine if all the values in the array are null.
@param values an array of values being evaluated for null.
@return true if and only if the array is null, empty or all elements in the array are null.
@see #areAnyNull(Object...) | [
"Null",
"-",
"safe",
"method",
"to",
"determine",
"if",
"all",
"the",
"values",
"in",
"the",
"array",
"are",
"null",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ObjectUtils.java#L53-L64 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ObjectUtils.java | ObjectUtils.areAnyNull | @NullSafe
public static boolean areAnyNull(Object... values) {
for (Object value : nullSafeArray(values)) {
if (value == null) {
return true;
}
}
return false;
} | java | @NullSafe
public static boolean areAnyNull(Object... values) {
for (Object value : nullSafeArray(values)) {
if (value == null) {
return true;
}
}
return false;
} | [
"@",
"NullSafe",
"public",
"static",
"boolean",
"areAnyNull",
"(",
"Object",
"...",
"values",
")",
"{",
"for",
"(",
"Object",
"value",
":",
"nullSafeArray",
"(",
"values",
")",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"true",
";"... | Null-safe method to determine if any of the values in the array are null.
@param values an array of values being evaluated for null
@return true if and only if the array is not null, not empty and contains 1 null element.
@see #areAllNull(Object...) | [
"Null",
"-",
"safe",
"method",
"to",
"determine",
"if",
"any",
"of",
"the",
"values",
"in",
"the",
"array",
"are",
"null",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ObjectUtils.java#L73-L83 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ObjectUtils.java | ObjectUtils.defaultIfNull | @NullSafe
@SuppressWarnings({ "unchecked", "varargs" })
public static <T> T defaultIfNull(T... values) {
for (T value : nullSafeArray(values)) {
if (value != null) {
return value;
}
}
return null;
} | java | @NullSafe
@SuppressWarnings({ "unchecked", "varargs" })
public static <T> T defaultIfNull(T... values) {
for (T value : nullSafeArray(values)) {
if (value != null) {
return value;
}
}
return null;
} | [
"@",
"NullSafe",
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"varargs\"",
"}",
")",
"public",
"static",
"<",
"T",
">",
"T",
"defaultIfNull",
"(",
"T",
"...",
"values",
")",
"{",
"for",
"(",
"T",
"value",
":",
"nullSafeArray",
"(",
"values"... | Gets the first non-null value in the array of values.
@param values an array of Object values from which the first non-null Object value in the array is returned.
@param <T> the Class type of values in the array.
@return the first non-null value in the array of Object values. | [
"Gets",
"the",
"first",
"non",
"-",
"null",
"value",
"in",
"the",
"array",
"of",
"values",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ObjectUtils.java#L129-L140 | train |
dejv78/javafx-commons | jfx-controls/src/main/java/dejv/jfx/controls/radialmenu1/internal/RadialMenuSection.java | RadialMenuSection.add | public static RadialMenuSection add(ContextRadialMenu owner, RadialPane pane, Menu menu, RadialMenuSection parentSection, Double angularAxisDeg) {
final RadialMenuSection section = new RadialMenuSection(owner, pane, menu, parentSection, angularAxisDeg);
pane.addSection(menu, section);
return section;
} | java | public static RadialMenuSection add(ContextRadialMenu owner, RadialPane pane, Menu menu, RadialMenuSection parentSection, Double angularAxisDeg) {
final RadialMenuSection section = new RadialMenuSection(owner, pane, menu, parentSection, angularAxisDeg);
pane.addSection(menu, section);
return section;
} | [
"public",
"static",
"RadialMenuSection",
"add",
"(",
"ContextRadialMenu",
"owner",
",",
"RadialPane",
"pane",
",",
"Menu",
"menu",
",",
"RadialMenuSection",
"parentSection",
",",
"Double",
"angularAxisDeg",
")",
"{",
"final",
"RadialMenuSection",
"section",
"=",
"ne... | Create new RadialMenuSection
@param owner Radial Menu the new section should belong to
@param pane Radial Pane on which to add the items
@param menu Menu to represent
@param parentSection Parent RadialMenuSection (can be null)
@param angularAxisDeg Explicit angular axis (can be null)
@return New RadialMenuSection | [
"Create",
"new",
"RadialMenuSection"
] | ea846eeeb4ed43a7628a40931a3e6f27d513592f | https://github.com/dejv78/javafx-commons/blob/ea846eeeb4ed43a7628a40931a3e6f27d513592f/jfx-controls/src/main/java/dejv/jfx/controls/radialmenu1/internal/RadialMenuSection.java#L63-L70 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/mps_ssl_certkey.java | mps_ssl_certkey.get_filtered | public static mps_ssl_certkey[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception
{
mps_ssl_certkey obj = new mps_ssl_certkey();
options option = new options();
option.set_filter(filter);
mps_ssl_certkey[] response = (mps_ssl_certkey[]) obj.getfiltered(service, option);
return response;
} | java | public static mps_ssl_certkey[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception
{
mps_ssl_certkey obj = new mps_ssl_certkey();
options option = new options();
option.set_filter(filter);
mps_ssl_certkey[] response = (mps_ssl_certkey[]) obj.getfiltered(service, option);
return response;
} | [
"public",
"static",
"mps_ssl_certkey",
"[",
"]",
"get_filtered",
"(",
"nitro_service",
"service",
",",
"filtervalue",
"[",
"]",
"filter",
")",
"throws",
"Exception",
"{",
"mps_ssl_certkey",
"obj",
"=",
"new",
"mps_ssl_certkey",
"(",
")",
";",
"options",
"option"... | Use this API to fetch filtered set of mps_ssl_certkey resources.
set the filter parameter values in filtervalue object. | [
"Use",
"this",
"API",
"to",
"fetch",
"filtered",
"set",
"of",
"mps_ssl_certkey",
"resources",
".",
"set",
"the",
"filter",
"parameter",
"values",
"in",
"filtervalue",
"object",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/mps_ssl_certkey.java#L357-L364 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/util/sort/support/JavaMergeSort.java | JavaMergeSort.sort | @Override
@SuppressWarnings({ "unchecked", "varargs" })
public <E> E[] sort(final E... elements) {
Arrays.sort(elements, getOrderBy());
return elements;
} | java | @Override
@SuppressWarnings({ "unchecked", "varargs" })
public <E> E[] sort(final E... elements) {
Arrays.sort(elements, getOrderBy());
return elements;
} | [
"@",
"Override",
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"varargs\"",
"}",
")",
"public",
"<",
"E",
">",
"E",
"[",
"]",
"sort",
"(",
"final",
"E",
"...",
"elements",
")",
"{",
"Arrays",
".",
"sort",
"(",
"elements",
",",
"getOrderBy"... | Uses Java's modified Merge Sort to sort an array of elements as defined by the Comparator, or as determined
by the elements in the array if the elements are Comparable.
@param <E> the type of elements in the array.
@param elements the array of elements to sort.
@return the array of elements sorted.
@see #getOrderBy()
@see java.util.Arrays#sort(Object[], java.util.Comparator) | [
"Uses",
"Java",
"s",
"modified",
"Merge",
"Sort",
"to",
"sort",
"an",
"array",
"of",
"elements",
"as",
"defined",
"by",
"the",
"Comparator",
"or",
"as",
"determined",
"by",
"the",
"elements",
"in",
"the",
"array",
"if",
"the",
"elements",
"are",
"Comparabl... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/sort/support/JavaMergeSort.java#L47-L52 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/util/sort/support/JavaMergeSort.java | JavaMergeSort.sort | @Override
public <E> List<E> sort(final List<E> elements) {
Collections.sort(elements, getOrderBy());
return elements;
} | java | @Override
public <E> List<E> sort(final List<E> elements) {
Collections.sort(elements, getOrderBy());
return elements;
} | [
"@",
"Override",
"public",
"<",
"E",
">",
"List",
"<",
"E",
">",
"sort",
"(",
"final",
"List",
"<",
"E",
">",
"elements",
")",
"{",
"Collections",
".",
"sort",
"(",
"elements",
",",
"getOrderBy",
"(",
")",
")",
";",
"return",
"elements",
";",
"}"
] | Uses Java's modified Merge Sort algorithm to sort a List of elements as defined by the Comparator, or as determined
by the elements in the collection if the elements are Comparable.
@param <E> the type of elements in the List.
@param elements the List of elements to sort.
@return the collection of elements sorted.
@see #getOrderBy()
@see java.util.Collections#sort(java.util.List, java.util.Comparator)
@see java.util.List | [
"Uses",
"Java",
"s",
"modified",
"Merge",
"Sort",
"algorithm",
"to",
"sort",
"a",
"List",
"of",
"elements",
"as",
"defined",
"by",
"the",
"Comparator",
"or",
"as",
"determined",
"by",
"the",
"elements",
"in",
"the",
"collection",
"if",
"the",
"elements",
"... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/sort/support/JavaMergeSort.java#L65-L69 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_conf_download_policy.java | ns_conf_download_policy.get | public static ns_conf_download_policy get(nitro_service client) throws Exception
{
ns_conf_download_policy resource = new ns_conf_download_policy();
resource.validate("get");
return ((ns_conf_download_policy[]) resource.get_resources(client))[0];
} | java | public static ns_conf_download_policy get(nitro_service client) throws Exception
{
ns_conf_download_policy resource = new ns_conf_download_policy();
resource.validate("get");
return ((ns_conf_download_policy[]) resource.get_resources(client))[0];
} | [
"public",
"static",
"ns_conf_download_policy",
"get",
"(",
"nitro_service",
"client",
")",
"throws",
"Exception",
"{",
"ns_conf_download_policy",
"resource",
"=",
"new",
"ns_conf_download_policy",
"(",
")",
";",
"resource",
".",
"validate",
"(",
"\"get\"",
")",
";",... | Use this operation to get the polling frequency of the Netscaler configuration file. | [
"Use",
"this",
"operation",
"to",
"get",
"the",
"polling",
"frequency",
"of",
"the",
"Netscaler",
"configuration",
"file",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_conf_download_policy.java#L114-L119 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/util/search/AbstractSearcher.java | AbstractSearcher.getMatcher | @Override
@SuppressWarnings("unchecked")
public <E> Matcher<E> getMatcher() {
Matcher<E> localMatcher = (Matcher<E>) MatcherHolder.get();
Assert.state(localMatcher != null || matcher != null,
"A reference to a Matcher used by this Searcher ({0}) for searching and matching elements in the collection was not properly configured!",
getClass().getName());
return ObjectUtils.defaultIfNull(localMatcher, matcher);
} | java | @Override
@SuppressWarnings("unchecked")
public <E> Matcher<E> getMatcher() {
Matcher<E> localMatcher = (Matcher<E>) MatcherHolder.get();
Assert.state(localMatcher != null || matcher != null,
"A reference to a Matcher used by this Searcher ({0}) for searching and matching elements in the collection was not properly configured!",
getClass().getName());
return ObjectUtils.defaultIfNull(localMatcher, matcher);
} | [
"@",
"Override",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"E",
">",
"Matcher",
"<",
"E",
">",
"getMatcher",
"(",
")",
"{",
"Matcher",
"<",
"E",
">",
"localMatcher",
"=",
"(",
"Matcher",
"<",
"E",
">",
")",
"MatcherHolder",
"."... | Gets the Matcher used to match and find the desired element or elements in the collection.
@param <E> the Class type of elements in the collection.
@return the Matcher used to match and find the desired element or elements in the collection during
the search operation.
@throws IllegalStateException if the Matcher used by this Searcher was not configured.
@see #setMatcher(Matcher)
@see org.cp.elements.util.search.Matcher | [
"Gets",
"the",
"Matcher",
"used",
"to",
"match",
"and",
"find",
"the",
"desired",
"element",
"or",
"elements",
"in",
"the",
"collection",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/search/AbstractSearcher.java#L85-L95 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/util/search/AbstractSearcher.java | AbstractSearcher.setMatcher | public void setMatcher(final Matcher matcher) {
Assert.notNull(matcher, "The Matcher used to match elements in the collection during the search operation by this Searcher ({0}) cannot be null!",
getClass().getName());
this.matcher = matcher;
} | java | public void setMatcher(final Matcher matcher) {
Assert.notNull(matcher, "The Matcher used to match elements in the collection during the search operation by this Searcher ({0}) cannot be null!",
getClass().getName());
this.matcher = matcher;
} | [
"public",
"void",
"setMatcher",
"(",
"final",
"Matcher",
"matcher",
")",
"{",
"Assert",
".",
"notNull",
"(",
"matcher",
",",
"\"The Matcher used to match elements in the collection during the search operation by this Searcher ({0}) cannot be null!\"",
",",
"getClass",
"(",
")",... | Sets the Matcher used to match and find the desired element or elements in the collection.
@param matcher the Matcher used to match and find the desired element or elements in the collection during
the search operation.
@throws NullPointerException if the Matcher reference to be used by this Searcher is null.
@see #getMatcher()
@see org.cp.elements.util.search.Matcher | [
"Sets",
"the",
"Matcher",
"used",
"to",
"match",
"and",
"find",
"the",
"desired",
"element",
"or",
"elements",
"in",
"the",
"collection",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/search/AbstractSearcher.java#L106-L110 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/util/search/AbstractSearcher.java | AbstractSearcher.search | @Override
@SuppressWarnings({ "unchecked", "varargs" })
public <E> E search(final E... array) {
return search(Arrays.asList(array));
} | java | @Override
@SuppressWarnings({ "unchecked", "varargs" })
public <E> E search(final E... array) {
return search(Arrays.asList(array));
} | [
"@",
"Override",
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"varargs\"",
"}",
")",
"public",
"<",
"E",
">",
"E",
"search",
"(",
"final",
"E",
"...",
"array",
")",
"{",
"return",
"search",
"(",
"Arrays",
".",
"asList",
"(",
"array",
")",... | Searches the array of elements in order to find the element or elements matching the criteria defined
by the Matcher.
@param <E> the Class type of elements in the array.
@param array the array of elements to search.
@return the element in the array matching the search criteria defined by the Matcher.
@see #search(java.util.Collection)
@see java.util.Arrays#asList(Object[]) | [
"Searches",
"the",
"array",
"of",
"elements",
"in",
"order",
"to",
"find",
"the",
"element",
"or",
"elements",
"matching",
"the",
"criteria",
"defined",
"by",
"the",
"Matcher",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/search/AbstractSearcher.java#L122-L126 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/util/search/AbstractSearcher.java | AbstractSearcher.search | @Override
public <E> E search(final Searchable<E> searchable) {
try {
return search(configureMatcher(searchable).asList());
}
finally {
MatcherHolder.unset();
}
} | java | @Override
public <E> E search(final Searchable<E> searchable) {
try {
return search(configureMatcher(searchable).asList());
}
finally {
MatcherHolder.unset();
}
} | [
"@",
"Override",
"public",
"<",
"E",
">",
"E",
"search",
"(",
"final",
"Searchable",
"<",
"E",
">",
"searchable",
")",
"{",
"try",
"{",
"return",
"search",
"(",
"configureMatcher",
"(",
"searchable",
")",
".",
"asList",
"(",
")",
")",
";",
"}",
"fina... | Searches the Searchable object in order to find the element or elements matching the criteria defined
by the Matcher.
@param <E> the Class type of elements to search in the Searchable object.
@param searchable the Searchable object to search.
@return the element in the Searchable object matching the search criteria defined by the Matcher.
@see #configureMatcher(Searchable)
@see #search(java.util.Collection)
@see org.cp.elements.util.search.Searchable#asList() | [
"Searches",
"the",
"Searchable",
"object",
"in",
"order",
"to",
"find",
"the",
"element",
"or",
"elements",
"matching",
"the",
"criteria",
"defined",
"by",
"the",
"Matcher",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/search/AbstractSearcher.java#L139-L147 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/util/search/AbstractSearcher.java | AbstractSearcher.searchForAll | @SuppressWarnings({ "unchecked", "varargs" })
public <E> Iterable<E> searchForAll(final E... array) {
return searchForAll(Arrays.asList(array));
} | java | @SuppressWarnings({ "unchecked", "varargs" })
public <E> Iterable<E> searchForAll(final E... array) {
return searchForAll(Arrays.asList(array));
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"varargs\"",
"}",
")",
"public",
"<",
"E",
">",
"Iterable",
"<",
"E",
">",
"searchForAll",
"(",
"final",
"E",
"...",
"array",
")",
"{",
"return",
"searchForAll",
"(",
"Arrays",
".",
"asList",
"("... | Searches an array of elements finding all elements in the array matching the criteria defined by the Matcher.
@param <E> the Class type of elements in the array.
@param array the array of elements to search.
@return an Iterable object containing all elements in the array that match the criteria defined by the Matcher.
@throws NullPointerException if the array is null!
@see #searchForAll(java.util.Collection)
@see java.lang.Iterable
@see java.util.Arrays#asList(Object[]) | [
"Searches",
"an",
"array",
"of",
"elements",
"finding",
"all",
"elements",
"in",
"the",
"array",
"matching",
"the",
"criteria",
"defined",
"by",
"the",
"Matcher",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/search/AbstractSearcher.java#L184-L187 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.