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/br_broker/br_broker.java | br_broker.force_reboot | public static br_broker force_reboot(nitro_service client, br_broker resource) throws Exception
{
return ((br_broker[]) resource.perform_operation(client, "force_reboot"))[0];
} | java | public static br_broker force_reboot(nitro_service client, br_broker resource) throws Exception
{
return ((br_broker[]) resource.perform_operation(client, "force_reboot"))[0];
} | [
"public",
"static",
"br_broker",
"force_reboot",
"(",
"nitro_service",
"client",
",",
"br_broker",
"resource",
")",
"throws",
"Exception",
"{",
"return",
"(",
"(",
"br_broker",
"[",
"]",
")",
"resource",
".",
"perform_operation",
"(",
"client",
",",
"\"force_reb... | Use this operation to force reboot Unified Repeater Instance. | [
"Use",
"this",
"operation",
"to",
"force",
"reboot",
"Unified",
"Repeater",
"Instance",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/br_broker/br_broker.java#L411-L414 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/br_broker/br_broker.java | br_broker.force_stop | public static br_broker force_stop(nitro_service client, br_broker resource) throws Exception
{
return ((br_broker[]) resource.perform_operation(client, "force_stop"))[0];
} | java | public static br_broker force_stop(nitro_service client, br_broker resource) throws Exception
{
return ((br_broker[]) resource.perform_operation(client, "force_stop"))[0];
} | [
"public",
"static",
"br_broker",
"force_stop",
"(",
"nitro_service",
"client",
",",
"br_broker",
"resource",
")",
"throws",
"Exception",
"{",
"return",
"(",
"(",
"br_broker",
"[",
"]",
")",
"resource",
".",
"perform_operation",
"(",
"client",
",",
"\"force_stop\... | Use this operation to force stop Unified Repeater Instance. | [
"Use",
"this",
"operation",
"to",
"force",
"stop",
"Unified",
"Repeater",
"Instance",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/br_broker/br_broker.java#L533-L536 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/br_broker/br_broker.java | br_broker.start | public static br_broker start(nitro_service client, br_broker resource) throws Exception
{
return ((br_broker[]) resource.perform_operation(client, "start"))[0];
} | java | public static br_broker start(nitro_service client, br_broker resource) throws Exception
{
return ((br_broker[]) resource.perform_operation(client, "start"))[0];
} | [
"public",
"static",
"br_broker",
"start",
"(",
"nitro_service",
"client",
",",
"br_broker",
"resource",
")",
"throws",
"Exception",
"{",
"return",
"(",
"(",
"br_broker",
"[",
"]",
")",
"resource",
".",
"perform_operation",
"(",
"client",
",",
"\"start\"",
")",... | Use this operation to start Unified Repeater Instance. | [
"Use",
"this",
"operation",
"to",
"start",
"Unified",
"Repeater",
"Instance",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/br_broker/br_broker.java#L564-L567 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/support/CommitVisitor.java | CommitVisitor.visit | @Override
public void visit(Visitable visitable) {
if (isCommitable(visitable)) {
ObjectUtils.setField(visitable, "lastModifiedBy", ((Auditable) visitable).getModifiedBy());
ObjectUtils.setField(visitable, "lastModifiedOn", ((Auditable) visitable).getModifiedOn());
ObjectUtils.setField(visitable, "lastModifiedWith", ((Auditable) visitable).getModifiedWith());
}
} | java | @Override
public void visit(Visitable visitable) {
if (isCommitable(visitable)) {
ObjectUtils.setField(visitable, "lastModifiedBy", ((Auditable) visitable).getModifiedBy());
ObjectUtils.setField(visitable, "lastModifiedOn", ((Auditable) visitable).getModifiedOn());
ObjectUtils.setField(visitable, "lastModifiedWith", ((Auditable) visitable).getModifiedWith());
}
} | [
"@",
"Override",
"public",
"void",
"visit",
"(",
"Visitable",
"visitable",
")",
"{",
"if",
"(",
"isCommitable",
"(",
"visitable",
")",
")",
"{",
"ObjectUtils",
".",
"setField",
"(",
"visitable",
",",
"\"lastModifiedBy\"",
",",
"(",
"(",
"Auditable",
")",
"... | Visits all objects in an application domain object graph hierarchy targeting objects to be 'committed'.
@param visitable the object visited by this Visitor.
@see org.cp.elements.lang.Visitable
@see #isCommitable(Object) | [
"Visits",
"all",
"objects",
"in",
"an",
"application",
"domain",
"object",
"graph",
"hierarchy",
"targeting",
"objects",
"to",
"be",
"committed",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/support/CommitVisitor.java#L65-L72 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/support/CommitVisitor.java | CommitVisitor.isCommitable | protected boolean isCommitable(Object visitable) {
return (visitable instanceof Auditable && (target == null || identity(visitable) == identity(target)));
} | java | protected boolean isCommitable(Object visitable) {
return (visitable instanceof Auditable && (target == null || identity(visitable) == identity(target)));
} | [
"protected",
"boolean",
"isCommitable",
"(",
"Object",
"visitable",
")",
"{",
"return",
"(",
"visitable",
"instanceof",
"Auditable",
"&&",
"(",
"target",
"==",
"null",
"||",
"identity",
"(",
"visitable",
")",
"==",
"identity",
"(",
"target",
")",
")",
")",
... | Determines whether the specified visitable object is commit-able. The object is commit-able if the object
is Auditable and this Visitor is not targeting a specific object in the application domain object graph
hierarchy.
@param visitable the visited object being evaluated for commit-ability.
@return a boolean value indicating whether the targeted object can be committed.
@see org.cp.elements.lang.Auditable | [
"Determines",
"whether",
"the",
"specified",
"visitable",
"object",
"is",
"commit",
"-",
"able",
".",
"The",
"object",
"is",
"commit",
"-",
"able",
"if",
"the",
"object",
"is",
"Auditable",
"and",
"this",
"Visitor",
"is",
"not",
"targeting",
"a",
"specific",... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/support/CommitVisitor.java#L83-L85 | train |
talenguyen/PrettySharedPreferences | prettysharedpreferences/src/main/java/com/tale/prettysharedpreferences/PrettySharedPreferences.java | PrettySharedPreferences.apply | @TargetApi(Build.VERSION_CODES.GINGERBREAD)
public void apply() {
if (editing == null) {
return;
}
try {
editing.apply();
} catch (Exception ex) {
editing.commit(); // Fallback in case low api lever.
}
editing = null;
} | java | @TargetApi(Build.VERSION_CODES.GINGERBREAD)
public void apply() {
if (editing == null) {
return;
}
try {
editing.apply();
} catch (Exception ex) {
editing.commit(); // Fallback in case low api lever.
}
editing = null;
} | [
"@",
"TargetApi",
"(",
"Build",
".",
"VERSION_CODES",
".",
"GINGERBREAD",
")",
"public",
"void",
"apply",
"(",
")",
"{",
"if",
"(",
"editing",
"==",
"null",
")",
"{",
"return",
";",
"}",
"try",
"{",
"editing",
".",
"apply",
"(",
")",
";",
"}",
"cat... | Call to apply changes.
@see android.content.SharedPreferences.Editor#apply() | [
"Call",
"to",
"apply",
"changes",
"."
] | b97edf86c8fa65be2165f2cd790545c78c971c22 | https://github.com/talenguyen/PrettySharedPreferences/blob/b97edf86c8fa65be2165f2cd790545c78c971c22/prettysharedpreferences/src/main/java/com/tale/prettysharedpreferences/PrettySharedPreferences.java#L168-L179 | train |
talenguyen/PrettySharedPreferences | prettysharedpreferences/src/main/java/com/tale/prettysharedpreferences/PrettySharedPreferences.java | PrettySharedPreferences.commit | public boolean commit() {
if (editing == null) {
return false;
}
final boolean result = editing.commit();
editing = null;
return result;
} | java | public boolean commit() {
if (editing == null) {
return false;
}
final boolean result = editing.commit();
editing = null;
return result;
} | [
"public",
"boolean",
"commit",
"(",
")",
"{",
"if",
"(",
"editing",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"final",
"boolean",
"result",
"=",
"editing",
".",
"commit",
"(",
")",
";",
"editing",
"=",
"null",
";",
"return",
"result",
";",... | Call to commit changes.
@see android.content.SharedPreferences.Editor#commit() | [
"Call",
"to",
"commit",
"changes",
"."
] | b97edf86c8fa65be2165f2cd790545c78c971c22 | https://github.com/talenguyen/PrettySharedPreferences/blob/b97edf86c8fa65be2165f2cd790545c78c971c22/prettysharedpreferences/src/main/java/com/tale/prettysharedpreferences/PrettySharedPreferences.java#L185-L192 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/sdxtools_image.java | sdxtools_image.get_filtered | public static sdxtools_image[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception
{
sdxtools_image obj = new sdxtools_image();
options option = new options();
option.set_filter(filter);
sdxtools_image[] response = (sdxtools_image[]) obj.getfiltered(service, option);
return response;
} | java | public static sdxtools_image[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception
{
sdxtools_image obj = new sdxtools_image();
options option = new options();
option.set_filter(filter);
sdxtools_image[] response = (sdxtools_image[]) obj.getfiltered(service, option);
return response;
} | [
"public",
"static",
"sdxtools_image",
"[",
"]",
"get_filtered",
"(",
"nitro_service",
"service",
",",
"filtervalue",
"[",
"]",
"filter",
")",
"throws",
"Exception",
"{",
"sdxtools_image",
"obj",
"=",
"new",
"sdxtools_image",
"(",
")",
";",
"options",
"option",
... | Use this API to fetch filtered set of sdxtools_image resources.
set the filter parameter values in filtervalue object. | [
"Use",
"this",
"API",
"to",
"fetch",
"filtered",
"set",
"of",
"sdxtools_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/sdxtools_image.java#L180-L187 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/factory/ObjectFactoryReferenceHolder.java | ObjectFactoryReferenceHolder.set | public static synchronized void set(final ObjectFactory objectFactory) {
Assert.state(objectFactoryReference == null, "The ObjectFactory reference is already set to ({0})",
objectFactoryReference);
objectFactoryReference = objectFactory;
} | java | public static synchronized void set(final ObjectFactory objectFactory) {
Assert.state(objectFactoryReference == null, "The ObjectFactory reference is already set to ({0})",
objectFactoryReference);
objectFactoryReference = objectFactory;
} | [
"public",
"static",
"synchronized",
"void",
"set",
"(",
"final",
"ObjectFactory",
"objectFactory",
")",
"{",
"Assert",
".",
"state",
"(",
"objectFactoryReference",
"==",
"null",
",",
"\"The ObjectFactory reference is already set to ({0})\"",
",",
"objectFactoryReference",
... | Sets a reference to the ObjectFactory used by the application in this holder.
@param objectFactory the ObjectFactory reference to hold in this reference holder.
@throws IllegalStateException if the reference holder already holds a reference to an ObjectFactory.
@see #compareAndSet(ObjectFactory, ObjectFactory) | [
"Sets",
"a",
"reference",
"to",
"the",
"ObjectFactory",
"used",
"by",
"the",
"application",
"in",
"this",
"holder",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/factory/ObjectFactoryReferenceHolder.java#L63-L67 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_ns_runningconfig.java | ns_ns_runningconfig.get | public static ns_ns_runningconfig get(nitro_service client, ns_ns_runningconfig resource) throws Exception
{
resource.validate("get");
return ((ns_ns_runningconfig[]) resource.get_resources(client))[0];
} | java | public static ns_ns_runningconfig get(nitro_service client, ns_ns_runningconfig resource) throws Exception
{
resource.validate("get");
return ((ns_ns_runningconfig[]) resource.get_resources(client))[0];
} | [
"public",
"static",
"ns_ns_runningconfig",
"get",
"(",
"nitro_service",
"client",
",",
"ns_ns_runningconfig",
"resource",
")",
"throws",
"Exception",
"{",
"resource",
".",
"validate",
"(",
"\"get\"",
")",
";",
"return",
"(",
"(",
"ns_ns_runningconfig",
"[",
"]",
... | Use this operation to get running configuration from NetScaler Instance. | [
"Use",
"this",
"operation",
"to",
"get",
"running",
"configuration",
"from",
"NetScaler",
"Instance",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_ns_runningconfig.java#L107-L111 | train |
victims/victims-lib-java | src/main/java/com/redhat/victims/database/VictimsSQL.java | VictimsSQL.setUp | protected void setUp() throws SQLException {
Connection connection = getConnection();
try {
if (!isSetUp(connection)) {
Statement stmt = connection.createStatement();
stmt.execute(Query.CREATE_TABLE_RECORDS);
stmt.execute(Query.CREATE_TABLE_FILEHASHES);
stmt.execute(Query.CREATE_TABLE_META);
stmt.execute(Query.CREATE_TABLE_CVES);
stmt.close();
}
} finally {
connection.close();
}
} | java | protected void setUp() throws SQLException {
Connection connection = getConnection();
try {
if (!isSetUp(connection)) {
Statement stmt = connection.createStatement();
stmt.execute(Query.CREATE_TABLE_RECORDS);
stmt.execute(Query.CREATE_TABLE_FILEHASHES);
stmt.execute(Query.CREATE_TABLE_META);
stmt.execute(Query.CREATE_TABLE_CVES);
stmt.close();
}
} finally {
connection.close();
}
} | [
"protected",
"void",
"setUp",
"(",
")",
"throws",
"SQLException",
"{",
"Connection",
"connection",
"=",
"getConnection",
"(",
")",
";",
"try",
"{",
"if",
"(",
"!",
"isSetUp",
"(",
"connection",
")",
")",
"{",
"Statement",
"stmt",
"=",
"connection",
".",
... | Initializes a database by created required tables.
@throws SQLException | [
"Initializes",
"a",
"database",
"by",
"created",
"required",
"tables",
"."
] | ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b | https://github.com/victims/victims-lib-java/blob/ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b/src/main/java/com/redhat/victims/database/VictimsSQL.java#L75-L89 | train |
victims/victims-lib-java | src/main/java/com/redhat/victims/database/VictimsSQL.java | VictimsSQL.statement | protected PreparedStatement statement(Connection connection, String query)
throws SQLException {
return connection.prepareStatement(query);
} | java | protected PreparedStatement statement(Connection connection, String query)
throws SQLException {
return connection.prepareStatement(query);
} | [
"protected",
"PreparedStatement",
"statement",
"(",
"Connection",
"connection",
",",
"String",
"query",
")",
"throws",
"SQLException",
"{",
"return",
"connection",
".",
"prepareStatement",
"(",
"query",
")",
";",
"}"
] | Wrapper to create a prepared statement.
@param connection
@param query
@return
@throws SQLException | [
"Wrapper",
"to",
"create",
"a",
"prepared",
"statement",
"."
] | ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b | https://github.com/victims/victims-lib-java/blob/ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b/src/main/java/com/redhat/victims/database/VictimsSQL.java#L114-L117 | train |
victims/victims-lib-java | src/main/java/com/redhat/victims/database/VictimsSQL.java | VictimsSQL.setObjects | protected PreparedStatement setObjects(Connection connection, String query,
Object... objects) throws SQLException {
PreparedStatement ps = statement(connection, query);
setObjects(ps, objects);
return ps;
} | java | protected PreparedStatement setObjects(Connection connection, String query,
Object... objects) throws SQLException {
PreparedStatement ps = statement(connection, query);
setObjects(ps, objects);
return ps;
} | [
"protected",
"PreparedStatement",
"setObjects",
"(",
"Connection",
"connection",
",",
"String",
"query",
",",
"Object",
"...",
"objects",
")",
"throws",
"SQLException",
"{",
"PreparedStatement",
"ps",
"=",
"statement",
"(",
"connection",
",",
"query",
")",
";",
... | Give a query and list of objects to set, a prepared statement is created,
cached and returned with the objects set in the order they are provided.
@param query
@param objects
@return
@throws SQLException | [
"Give",
"a",
"query",
"and",
"list",
"of",
"objects",
"to",
"set",
"a",
"prepared",
"statement",
"is",
"created",
"cached",
"and",
"returned",
"with",
"the",
"objects",
"set",
"in",
"the",
"order",
"they",
"are",
"provided",
"."
] | ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b | https://github.com/victims/victims-lib-java/blob/ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b/src/main/java/com/redhat/victims/database/VictimsSQL.java#L128-L133 | train |
victims/victims-lib-java | src/main/java/com/redhat/victims/database/VictimsSQL.java | VictimsSQL.selectRecordId | protected int selectRecordId(String hash) throws SQLException {
int id = -1;
Connection connection = getConnection();
try {
PreparedStatement ps = setObjects(connection, Query.GET_RECORD_ID,
hash);
ResultSet rs = ps.executeQuery();
try {
while (rs.next()) {
id = rs.getInt("id");
break;
}
} finally {
rs.close();
ps.close();
}
} finally {
connection.close();
}
return id;
} | java | protected int selectRecordId(String hash) throws SQLException {
int id = -1;
Connection connection = getConnection();
try {
PreparedStatement ps = setObjects(connection, Query.GET_RECORD_ID,
hash);
ResultSet rs = ps.executeQuery();
try {
while (rs.next()) {
id = rs.getInt("id");
break;
}
} finally {
rs.close();
ps.close();
}
} finally {
connection.close();
}
return id;
} | [
"protected",
"int",
"selectRecordId",
"(",
"String",
"hash",
")",
"throws",
"SQLException",
"{",
"int",
"id",
"=",
"-",
"1",
";",
"Connection",
"connection",
"=",
"getConnection",
"(",
")",
";",
"try",
"{",
"PreparedStatement",
"ps",
"=",
"setObjects",
"(",
... | Given a hash get the first occurance's record id.
@param hash
@return
@throws SQLException | [
"Given",
"a",
"hash",
"get",
"the",
"first",
"occurance",
"s",
"record",
"id",
"."
] | ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b | https://github.com/victims/victims-lib-java/blob/ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b/src/main/java/com/redhat/victims/database/VictimsSQL.java#L201-L221 | train |
victims/victims-lib-java | src/main/java/com/redhat/victims/database/VictimsSQL.java | VictimsSQL.insertRecord | protected int insertRecord(Connection connection, String hash)
throws SQLException {
int id = -1;
PreparedStatement ps = setObjects(connection, Query.INSERT_RECORD, hash);
ps.execute();
ResultSet rs = ps.getGeneratedKeys();
try {
while (rs.next()) {
id = rs.getInt(1);
break;
}
} finally {
rs.close();
ps.close();
}
return id;
} | java | protected int insertRecord(Connection connection, String hash)
throws SQLException {
int id = -1;
PreparedStatement ps = setObjects(connection, Query.INSERT_RECORD, hash);
ps.execute();
ResultSet rs = ps.getGeneratedKeys();
try {
while (rs.next()) {
id = rs.getInt(1);
break;
}
} finally {
rs.close();
ps.close();
}
return id;
} | [
"protected",
"int",
"insertRecord",
"(",
"Connection",
"connection",
",",
"String",
"hash",
")",
"throws",
"SQLException",
"{",
"int",
"id",
"=",
"-",
"1",
";",
"PreparedStatement",
"ps",
"=",
"setObjects",
"(",
"connection",
",",
"Query",
".",
"INSERT_RECORD"... | Insert a new record with the given hash and return the record id.
@param hash
@return A record id if it was created correctly, else return -1.
@throws SQLException | [
"Insert",
"a",
"new",
"record",
"with",
"the",
"given",
"hash",
"and",
"return",
"the",
"record",
"id",
"."
] | ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b | https://github.com/victims/victims-lib-java/blob/ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b/src/main/java/com/redhat/victims/database/VictimsSQL.java#L230-L247 | train |
victims/victims-lib-java | src/main/java/com/redhat/victims/database/VictimsSQL.java | VictimsSQL.deleteRecord | protected void deleteRecord(Connection connection, String hash)
throws SQLException {
int id = selectRecordId(hash);
if (id > 0) {
String[] queries = new String[] { Query.DELETE_FILEHASHES,
Query.DELETE_METAS, Query.DELETE_CVES,
Query.DELETE_RECORD_ID };
for (String query : queries) {
PreparedStatement ps = setObjects(connection, query, id);
ps.execute();
ps.close();
}
}
} | java | protected void deleteRecord(Connection connection, String hash)
throws SQLException {
int id = selectRecordId(hash);
if (id > 0) {
String[] queries = new String[] { Query.DELETE_FILEHASHES,
Query.DELETE_METAS, Query.DELETE_CVES,
Query.DELETE_RECORD_ID };
for (String query : queries) {
PreparedStatement ps = setObjects(connection, query, id);
ps.execute();
ps.close();
}
}
} | [
"protected",
"void",
"deleteRecord",
"(",
"Connection",
"connection",
",",
"String",
"hash",
")",
"throws",
"SQLException",
"{",
"int",
"id",
"=",
"selectRecordId",
"(",
"hash",
")",
";",
"if",
"(",
"id",
">",
"0",
")",
"{",
"String",
"[",
"]",
"queries"... | Remove records matching a given hash. This will cascade to all
references.
@param hash
@throws SQLException | [
"Remove",
"records",
"matching",
"a",
"given",
"hash",
".",
"This",
"will",
"cascade",
"to",
"all",
"references",
"."
] | ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b | https://github.com/victims/victims-lib-java/blob/ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b/src/main/java/com/redhat/victims/database/VictimsSQL.java#L256-L269 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/service/support/AbstractCacheableService.java | AbstractCacheableService.withCaching | protected VALUE withCaching(KEY key, Supplier<VALUE> cacheLoader) {
return getCache()
.map(CachingTemplate::with)
.<VALUE>map(template -> template.withCaching(key, () -> {
setCacheMiss();
return cacheLoader.get();
}))
.orElseGet(cacheLoader);
} | java | protected VALUE withCaching(KEY key, Supplier<VALUE> cacheLoader) {
return getCache()
.map(CachingTemplate::with)
.<VALUE>map(template -> template.withCaching(key, () -> {
setCacheMiss();
return cacheLoader.get();
}))
.orElseGet(cacheLoader);
} | [
"protected",
"VALUE",
"withCaching",
"(",
"KEY",
"key",
",",
"Supplier",
"<",
"VALUE",
">",
"cacheLoader",
")",
"{",
"return",
"getCache",
"(",
")",
".",
"map",
"(",
"CachingTemplate",
"::",
"with",
")",
".",
"<",
"VALUE",
">",
"map",
"(",
"template",
... | Enables an application service method to optionally apply and use caching to carry out its function.
@param key {@link KEY key} used to look up an existing {@link VALUE value} in the {@link Cache}.
@param cacheLoader {@link Supplier} used to compute/execute the application serivce method function
if the {@link Cache} does not contain an already computed {@link VALUE value} or caching is not enabled.
@return the cached or computed {@link VALUE value}.
@see org.cp.elements.data.caching.support.CachingTemplate#withCaching(Comparable, Supplier)
@see org.cp.elements.data.caching.Cache
@see java.util.function.Supplier
@see #isCachingEnabled()
@see #getCache() | [
"Enables",
"an",
"application",
"service",
"method",
"to",
"optionally",
"apply",
"and",
"use",
"caching",
"to",
"carry",
"out",
"its",
"function",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/service/support/AbstractCacheableService.java#L122-L133 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_websensevpx_image.java | xen_websensevpx_image.get_filtered | public static xen_websensevpx_image[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception
{
xen_websensevpx_image obj = new xen_websensevpx_image();
options option = new options();
option.set_filter(filter);
xen_websensevpx_image[] response = (xen_websensevpx_image[]) obj.getfiltered(service, option);
return response;
} | java | public static xen_websensevpx_image[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception
{
xen_websensevpx_image obj = new xen_websensevpx_image();
options option = new options();
option.set_filter(filter);
xen_websensevpx_image[] response = (xen_websensevpx_image[]) obj.getfiltered(service, option);
return response;
} | [
"public",
"static",
"xen_websensevpx_image",
"[",
"]",
"get_filtered",
"(",
"nitro_service",
"service",
",",
"filtervalue",
"[",
"]",
"filter",
")",
"throws",
"Exception",
"{",
"xen_websensevpx_image",
"obj",
"=",
"new",
"xen_websensevpx_image",
"(",
")",
";",
"op... | Use this API to fetch filtered set of xen_websensevpx_image resources.
set the filter parameter values in filtervalue object. | [
"Use",
"this",
"API",
"to",
"fetch",
"filtered",
"set",
"of",
"xen_websensevpx_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/xen/xen_websensevpx_image.java#L179-L186 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/support/OrderedComparator.java | OrderedComparator.compare | @Override
public int compare(final Ordered ordered1, final Ordered ordered2) {
return (ordered1.getIndex() < ordered2.getIndex() ? -1 : (ordered1.getIndex() > ordered2.getIndex() ? 1 : 0));
} | java | @Override
public int compare(final Ordered ordered1, final Ordered ordered2) {
return (ordered1.getIndex() < ordered2.getIndex() ? -1 : (ordered1.getIndex() > ordered2.getIndex() ? 1 : 0));
} | [
"@",
"Override",
"public",
"int",
"compare",
"(",
"final",
"Ordered",
"ordered1",
",",
"final",
"Ordered",
"ordered2",
")",
"{",
"return",
"(",
"ordered1",
".",
"getIndex",
"(",
")",
"<",
"ordered2",
".",
"getIndex",
"(",
")",
"?",
"-",
"1",
":",
"(",
... | Compares two Ordered objects to determine their relative order by index.
@param ordered1 the first Ordered object in the order comparison.
@param ordered2 the second Ordered object in the order comparison.
@return an integer value indicating one Ordered object's order relative to another Ordered object. | [
"Compares",
"two",
"Ordered",
"objects",
"to",
"determine",
"their",
"relative",
"order",
"by",
"index",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/support/OrderedComparator.java#L41-L44 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/RunnableUtils.java | RunnableUtils.safeSleep | private static boolean safeSleep(long milliseconds) {
boolean interrupted = false;
long timeout = (System.currentTimeMillis() + milliseconds);
while (System.currentTimeMillis() < timeout) {
try {
Thread.sleep(milliseconds);
}
catch (InterruptedException cause) {
interrupted = true;
}
finally {
milliseconds = Math.min(timeout - System.currentTimeMillis(), 0);
}
}
if (interrupted) {
Thread.currentThread().interrupt();
}
return !Thread.currentThread().isInterrupted();
} | java | private static boolean safeSleep(long milliseconds) {
boolean interrupted = false;
long timeout = (System.currentTimeMillis() + milliseconds);
while (System.currentTimeMillis() < timeout) {
try {
Thread.sleep(milliseconds);
}
catch (InterruptedException cause) {
interrupted = true;
}
finally {
milliseconds = Math.min(timeout - System.currentTimeMillis(), 0);
}
}
if (interrupted) {
Thread.currentThread().interrupt();
}
return !Thread.currentThread().isInterrupted();
} | [
"private",
"static",
"boolean",
"safeSleep",
"(",
"long",
"milliseconds",
")",
"{",
"boolean",
"interrupted",
"=",
"false",
";",
"long",
"timeout",
"=",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
"+",
"milliseconds",
")",
";",
"while",
"(",
"System",... | Safely sleeps for the given amount of milliseconds.
If the {@link Thread#currentThread() current Thread} is {@link Thread#isInterrupted() interrupted} while
{@link Thread#sleep(long, int) sleeping}, then the {@link Thread#currentThread() current Thread} will continue
to {@link Thread#sleep(long, int) sleep} until the given number of milliseconds have expired and the interrupt bit
will be set on return.
@param milliseconds the number of milliseconds that the {@link Thread#currentThread() current Thread} will sleep.
@return {@literal true} if the {@link Thread#currentThread() current Thread} was able to
{@link Thread#sleep(long, int)} for the given number of milliseconds uninterrupted.
@see java.lang.Thread#sleep(long, int) | [
"Safely",
"sleeps",
"for",
"the",
"given",
"amount",
"of",
"milliseconds",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/RunnableUtils.java#L207-L230 | train |
loadimpact/loadimpact-sdk-java | src/main/java/com/loadimpact/eval/Threshold.java | Threshold.accumulate | public void accumulate(List<? extends StandardMetricResult> metricValues) {
if (metricValues == null || metricValues.isEmpty()) return;
for (StandardMetricResult v : metricValues) {
if (lastOffset < v.offset) values.put(v.value.intValue());
}
lastOffset = ListUtils.last(metricValues).offset;
} | java | public void accumulate(List<? extends StandardMetricResult> metricValues) {
if (metricValues == null || metricValues.isEmpty()) return;
for (StandardMetricResult v : metricValues) {
if (lastOffset < v.offset) values.put(v.value.intValue());
}
lastOffset = ListUtils.last(metricValues).offset;
} | [
"public",
"void",
"accumulate",
"(",
"List",
"<",
"?",
"extends",
"StandardMetricResult",
">",
"metricValues",
")",
"{",
"if",
"(",
"metricValues",
"==",
"null",
"||",
"metricValues",
".",
"isEmpty",
"(",
")",
")",
"return",
";",
"for",
"(",
"StandardMetricR... | Adds a metric value to the metric value queue.
@param metricValues
bunch of values | [
"Adds",
"a",
"metric",
"value",
"to",
"the",
"metric",
"value",
"queue",
"."
] | 49af80b768c5453266414108b0d30a0fc01b8cef | https://github.com/loadimpact/loadimpact-sdk-java/blob/49af80b768c5453266414108b0d30a0fc01b8cef/src/main/java/com/loadimpact/eval/Threshold.java#L88-L94 | train |
loadimpact/loadimpact-sdk-java | src/main/java/com/loadimpact/eval/Threshold.java | Threshold.isExceeded | public boolean isExceeded() {
lastAggregatedValue = getAggregatedValue();
lastExceededValue = false;
switch (operator) {
case lessThan:
lastExceededValue = (lastAggregatedValue < thresholdValue);
break;
case greaterThan: lastExceededValue = (lastAggregatedValue > thresholdValue);
break;
}
return lastExceededValue;
} | java | public boolean isExceeded() {
lastAggregatedValue = getAggregatedValue();
lastExceededValue = false;
switch (operator) {
case lessThan:
lastExceededValue = (lastAggregatedValue < thresholdValue);
break;
case greaterThan: lastExceededValue = (lastAggregatedValue > thresholdValue);
break;
}
return lastExceededValue;
} | [
"public",
"boolean",
"isExceeded",
"(",
")",
"{",
"lastAggregatedValue",
"=",
"getAggregatedValue",
"(",
")",
";",
"lastExceededValue",
"=",
"false",
";",
"switch",
"(",
"operator",
")",
"{",
"case",
"lessThan",
":",
"lastExceededValue",
"=",
"(",
"lastAggregate... | Returns true of this threshold has been exceeded.
@return true if exceeded | [
"Returns",
"true",
"of",
"this",
"threshold",
"has",
"been",
"exceeded",
"."
] | 49af80b768c5453266414108b0d30a0fc01b8cef | https://github.com/loadimpact/loadimpact-sdk-java/blob/49af80b768c5453266414108b0d30a0fc01b8cef/src/main/java/com/loadimpact/eval/Threshold.java#L101-L112 | train |
loadimpact/loadimpact-sdk-java | src/main/java/com/loadimpact/eval/Threshold.java | Threshold.getReason | public String getReason() {
if (lastExceededValue) {
return String.format("Metric '%s' has aggregated-value=%d %s %d as threshold", metric.name(), lastAggregatedValue, operator.symbol, thresholdValue);
} else {
return String.format("Metric %s: aggregated-value=%d", metric.name(), lastAggregatedValue);
}
} | java | public String getReason() {
if (lastExceededValue) {
return String.format("Metric '%s' has aggregated-value=%d %s %d as threshold", metric.name(), lastAggregatedValue, operator.symbol, thresholdValue);
} else {
return String.format("Metric %s: aggregated-value=%d", metric.name(), lastAggregatedValue);
}
} | [
"public",
"String",
"getReason",
"(",
")",
"{",
"if",
"(",
"lastExceededValue",
")",
"{",
"return",
"String",
".",
"format",
"(",
"\"Metric '%s' has aggregated-value=%d %s %d as threshold\"",
",",
"metric",
".",
"name",
"(",
")",
",",
"lastAggregatedValue",
",",
"... | Returns summary intended for logging.
@return a summary | [
"Returns",
"summary",
"intended",
"for",
"logging",
"."
] | 49af80b768c5453266414108b0d30a0fc01b8cef | https://github.com/loadimpact/loadimpact-sdk-java/blob/49af80b768c5453266414108b0d30a0fc01b8cef/src/main/java/com/loadimpact/eval/Threshold.java#L132-L138 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_ssl_certkey_policy.java | ns_ssl_certkey_policy.get | public static ns_ssl_certkey_policy get(nitro_service client) throws Exception
{
ns_ssl_certkey_policy resource = new ns_ssl_certkey_policy();
resource.validate("get");
return ((ns_ssl_certkey_policy[]) resource.get_resources(client))[0];
} | java | public static ns_ssl_certkey_policy get(nitro_service client) throws Exception
{
ns_ssl_certkey_policy resource = new ns_ssl_certkey_policy();
resource.validate("get");
return ((ns_ssl_certkey_policy[]) resource.get_resources(client))[0];
} | [
"public",
"static",
"ns_ssl_certkey_policy",
"get",
"(",
"nitro_service",
"client",
")",
"throws",
"Exception",
"{",
"ns_ssl_certkey_policy",
"resource",
"=",
"new",
"ns_ssl_certkey_policy",
"(",
")",
";",
"resource",
".",
"validate",
"(",
"\"get\"",
")",
";",
"re... | Use this operation to get the polling frequency of the NetScaler SSL certificates. | [
"Use",
"this",
"operation",
"to",
"get",
"the",
"polling",
"frequency",
"of",
"the",
"NetScaler",
"SSL",
"certificates",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_ssl_certkey_policy.java#L114-L119 | train |
KyoriPowered/lunar | src/main/java/net/kyori/lunar/exception/Exceptions.java | Exceptions.rethrowConsumer | public static <T, E extends Throwable> @NonNull Consumer<T> rethrowConsumer(final @NonNull ThrowingConsumer<T, E> consumer) {
return consumer;
} | java | public static <T, E extends Throwable> @NonNull Consumer<T> rethrowConsumer(final @NonNull ThrowingConsumer<T, E> consumer) {
return consumer;
} | [
"public",
"static",
"<",
"T",
",",
"E",
"extends",
"Throwable",
">",
"@",
"NonNull",
"Consumer",
"<",
"T",
">",
"rethrowConsumer",
"(",
"final",
"@",
"NonNull",
"ThrowingConsumer",
"<",
"T",
",",
"E",
">",
"consumer",
")",
"{",
"return",
"consumer",
";",... | Returns the same throwing consumer.
@param consumer the consumer
@param <T> the input type
@param <E> the exception type
@return the consumer | [
"Returns",
"the",
"same",
"throwing",
"consumer",
"."
] | 6856747d9034a2fe0c8d0a8a0150986797732b5c | https://github.com/KyoriPowered/lunar/blob/6856747d9034a2fe0c8d0a8a0150986797732b5c/src/main/java/net/kyori/lunar/exception/Exceptions.java#L59-L61 | train |
KyoriPowered/lunar | src/main/java/net/kyori/lunar/exception/Exceptions.java | Exceptions.rethrowBiConsumer | public static <T, U, E extends Throwable> @NonNull BiConsumer<T, U> rethrowBiConsumer(final @NonNull ThrowingBiConsumer<T, U, E> consumer) {
return consumer;
} | java | public static <T, U, E extends Throwable> @NonNull BiConsumer<T, U> rethrowBiConsumer(final @NonNull ThrowingBiConsumer<T, U, E> consumer) {
return consumer;
} | [
"public",
"static",
"<",
"T",
",",
"U",
",",
"E",
"extends",
"Throwable",
">",
"@",
"NonNull",
"BiConsumer",
"<",
"T",
",",
"U",
">",
"rethrowBiConsumer",
"(",
"final",
"@",
"NonNull",
"ThrowingBiConsumer",
"<",
"T",
",",
"U",
",",
"E",
">",
"consumer"... | Returns the same throwing bi-consumer.
@param consumer the bi-consumer
@param <T> the first input type
@param <U> the second input type
@param <E> the exception type
@return the bi-consumer | [
"Returns",
"the",
"same",
"throwing",
"bi",
"-",
"consumer",
"."
] | 6856747d9034a2fe0c8d0a8a0150986797732b5c | https://github.com/KyoriPowered/lunar/blob/6856747d9034a2fe0c8d0a8a0150986797732b5c/src/main/java/net/kyori/lunar/exception/Exceptions.java#L90-L92 | train |
KyoriPowered/lunar | src/main/java/net/kyori/lunar/exception/Exceptions.java | Exceptions.rethrowFunction | public static <T, R, E extends Throwable> @NonNull Function<T, R> rethrowFunction(final @NonNull ThrowingFunction<T, R, E> function) {
return function;
} | java | public static <T, R, E extends Throwable> @NonNull Function<T, R> rethrowFunction(final @NonNull ThrowingFunction<T, R, E> function) {
return function;
} | [
"public",
"static",
"<",
"T",
",",
"R",
",",
"E",
"extends",
"Throwable",
">",
"@",
"NonNull",
"Function",
"<",
"T",
",",
"R",
">",
"rethrowFunction",
"(",
"final",
"@",
"NonNull",
"ThrowingFunction",
"<",
"T",
",",
"R",
",",
"E",
">",
"function",
")... | Returns the same throwing function.
@param function the function
@param <T> the input type
@param <R> the output type
@param <E> the exception type
@return the function | [
"Returns",
"the",
"same",
"throwing",
"function",
"."
] | 6856747d9034a2fe0c8d0a8a0150986797732b5c | https://github.com/KyoriPowered/lunar/blob/6856747d9034a2fe0c8d0a8a0150986797732b5c/src/main/java/net/kyori/lunar/exception/Exceptions.java#L122-L124 | train |
KyoriPowered/lunar | src/main/java/net/kyori/lunar/exception/Exceptions.java | Exceptions.rethrowBiFunction | public static <T, U, R, E extends Throwable> @NonNull BiFunction<T, U, R> rethrowBiFunction(final @NonNull ThrowingBiFunction<T, U, R, E> function) {
return function;
} | java | public static <T, U, R, E extends Throwable> @NonNull BiFunction<T, U, R> rethrowBiFunction(final @NonNull ThrowingBiFunction<T, U, R, E> function) {
return function;
} | [
"public",
"static",
"<",
"T",
",",
"U",
",",
"R",
",",
"E",
"extends",
"Throwable",
">",
"@",
"NonNull",
"BiFunction",
"<",
"T",
",",
"U",
",",
"R",
">",
"rethrowBiFunction",
"(",
"final",
"@",
"NonNull",
"ThrowingBiFunction",
"<",
"T",
",",
"U",
","... | Returns the same throwing bi-function.
@param function the bi-function
@param <T> the first input type
@param <U> the second input type
@param <R> the output type
@param <E> the exception type
@return the bi-function | [
"Returns",
"the",
"same",
"throwing",
"bi",
"-",
"function",
"."
] | 6856747d9034a2fe0c8d0a8a0150986797732b5c | https://github.com/KyoriPowered/lunar/blob/6856747d9034a2fe0c8d0a8a0150986797732b5c/src/main/java/net/kyori/lunar/exception/Exceptions.java#L155-L157 | train |
KyoriPowered/lunar | src/main/java/net/kyori/lunar/exception/Exceptions.java | Exceptions.rethrowPredicate | public static <T, E extends Throwable> @NonNull Predicate<T> rethrowPredicate(final @NonNull ThrowingPredicate<T, E> predicate) {
return predicate;
} | java | public static <T, E extends Throwable> @NonNull Predicate<T> rethrowPredicate(final @NonNull ThrowingPredicate<T, E> predicate) {
return predicate;
} | [
"public",
"static",
"<",
"T",
",",
"E",
"extends",
"Throwable",
">",
"@",
"NonNull",
"Predicate",
"<",
"T",
">",
"rethrowPredicate",
"(",
"final",
"@",
"NonNull",
"ThrowingPredicate",
"<",
"T",
",",
"E",
">",
"predicate",
")",
"{",
"return",
"predicate",
... | Returns the same throwing predicate.
@param predicate the predicate
@param <T> the input type
@param <E> the exception type
@return the predicate | [
"Returns",
"the",
"same",
"throwing",
"predicate",
"."
] | 6856747d9034a2fe0c8d0a8a0150986797732b5c | https://github.com/KyoriPowered/lunar/blob/6856747d9034a2fe0c8d0a8a0150986797732b5c/src/main/java/net/kyori/lunar/exception/Exceptions.java#L187-L189 | train |
KyoriPowered/lunar | src/main/java/net/kyori/lunar/exception/Exceptions.java | Exceptions.rethrowRunnable | public static <E extends Throwable> @NonNull Runnable rethrowRunnable(final @NonNull ThrowingRunnable<E> runnable) {
return runnable;
} | java | public static <E extends Throwable> @NonNull Runnable rethrowRunnable(final @NonNull ThrowingRunnable<E> runnable) {
return runnable;
} | [
"public",
"static",
"<",
"E",
"extends",
"Throwable",
">",
"@",
"NonNull",
"Runnable",
"rethrowRunnable",
"(",
"final",
"@",
"NonNull",
"ThrowingRunnable",
"<",
"E",
">",
"runnable",
")",
"{",
"return",
"runnable",
";",
"}"
] | Runs a throwable and, sneakily, re-throws any exceptions it encounters.
@param runnable the runnable
@param <E> the exception type
@return the runnable | [
"Runs",
"a",
"throwable",
"and",
"sneakily",
"re",
"-",
"throws",
"any",
"exceptions",
"it",
"encounters",
"."
] | 6856747d9034a2fe0c8d0a8a0150986797732b5c | https://github.com/KyoriPowered/lunar/blob/6856747d9034a2fe0c8d0a8a0150986797732b5c/src/main/java/net/kyori/lunar/exception/Exceptions.java#L216-L218 | train |
KyoriPowered/lunar | src/main/java/net/kyori/lunar/exception/Exceptions.java | Exceptions.rethrowSupplier | public static <T, E extends Throwable> @NonNull Supplier<T> rethrowSupplier(final @NonNull ThrowingSupplier<T, E> supplier) {
return supplier;
} | java | public static <T, E extends Throwable> @NonNull Supplier<T> rethrowSupplier(final @NonNull ThrowingSupplier<T, E> supplier) {
return supplier;
} | [
"public",
"static",
"<",
"T",
",",
"E",
"extends",
"Throwable",
">",
"@",
"NonNull",
"Supplier",
"<",
"T",
">",
"rethrowSupplier",
"(",
"final",
"@",
"NonNull",
"ThrowingSupplier",
"<",
"T",
",",
"E",
">",
"supplier",
")",
"{",
"return",
"supplier",
";",... | Returns the same throwing supplier.
@param supplier the supplier
@param <T> the output type
@param <E> the exception type
@return the supplier | [
"Returns",
"the",
"same",
"throwing",
"supplier",
"."
] | 6856747d9034a2fe0c8d0a8a0150986797732b5c | https://github.com/KyoriPowered/lunar/blob/6856747d9034a2fe0c8d0a8a0150986797732b5c/src/main/java/net/kyori/lunar/exception/Exceptions.java#L228-L230 | train |
KyoriPowered/lunar | src/main/java/net/kyori/lunar/exception/Exceptions.java | Exceptions.rethrow | public static <E extends Throwable> @NonNull RuntimeException rethrow(final @NonNull Throwable exception) throws E {
throw (E) exception;
} | java | public static <E extends Throwable> @NonNull RuntimeException rethrow(final @NonNull Throwable exception) throws E {
throw (E) exception;
} | [
"public",
"static",
"<",
"E",
"extends",
"Throwable",
">",
"@",
"NonNull",
"RuntimeException",
"rethrow",
"(",
"final",
"@",
"NonNull",
"Throwable",
"exception",
")",
"throws",
"E",
"{",
"throw",
"(",
"E",
")",
"exception",
";",
"}"
] | Re-throws an exception, sneakily.
@param exception the exception
@param <E> the exception type
@return nothing
@throws E the exception | [
"Re",
"-",
"throws",
"an",
"exception",
"sneakily",
"."
] | 6856747d9034a2fe0c8d0a8a0150986797732b5c | https://github.com/KyoriPowered/lunar/blob/6856747d9034a2fe0c8d0a8a0150986797732b5c/src/main/java/net/kyori/lunar/exception/Exceptions.java#L270-L272 | train |
KyoriPowered/lunar | src/main/java/net/kyori/lunar/exception/Exceptions.java | Exceptions.unwrap | public static @NonNull Throwable unwrap(final @NonNull Throwable throwable) {
if(throwable instanceof InvocationTargetException) {
final /* @Nullable */ Throwable cause = throwable.getCause();
if(cause != null) {
return cause;
}
}
return throwable;
} | java | public static @NonNull Throwable unwrap(final @NonNull Throwable throwable) {
if(throwable instanceof InvocationTargetException) {
final /* @Nullable */ Throwable cause = throwable.getCause();
if(cause != null) {
return cause;
}
}
return throwable;
} | [
"public",
"static",
"@",
"NonNull",
"Throwable",
"unwrap",
"(",
"final",
"@",
"NonNull",
"Throwable",
"throwable",
")",
"{",
"if",
"(",
"throwable",
"instanceof",
"InvocationTargetException",
")",
"{",
"final",
"/* @Nullable */",
"Throwable",
"cause",
"=",
"throwa... | Unwraps a throwable.
@param throwable the throwable
@return the unwrapped throwable, or the original throwable | [
"Unwraps",
"a",
"throwable",
"."
] | 6856747d9034a2fe0c8d0a8a0150986797732b5c | https://github.com/KyoriPowered/lunar/blob/6856747d9034a2fe0c8d0a8a0150986797732b5c/src/main/java/net/kyori/lunar/exception/Exceptions.java#L295-L303 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_ns_savedconfig.java | ns_ns_savedconfig.get | public static ns_ns_savedconfig get(nitro_service client, ns_ns_savedconfig resource) throws Exception
{
resource.validate("get");
return ((ns_ns_savedconfig[]) resource.get_resources(client))[0];
} | java | public static ns_ns_savedconfig get(nitro_service client, ns_ns_savedconfig resource) throws Exception
{
resource.validate("get");
return ((ns_ns_savedconfig[]) resource.get_resources(client))[0];
} | [
"public",
"static",
"ns_ns_savedconfig",
"get",
"(",
"nitro_service",
"client",
",",
"ns_ns_savedconfig",
"resource",
")",
"throws",
"Exception",
"{",
"resource",
".",
"validate",
"(",
"\"get\"",
")",
";",
"return",
"(",
"(",
"ns_ns_savedconfig",
"[",
"]",
")",
... | Use this operation to get saved configuration from NetScaler Instance. | [
"Use",
"this",
"operation",
"to",
"get",
"saved",
"configuration",
"from",
"NetScaler",
"Instance",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_ns_savedconfig.java#L95-L99 | train |
victims/victims-lib-java | src/main/java/com/redhat/victims/VictimsResultCache.java | VictimsResultCache.create | protected void create(File cache) throws VictimsException {
try {
FileUtils.forceMkdir(cache);
} catch (IOException e) {
throw new VictimsException("Could not create an on disk cache", e);
}
} | java | protected void create(File cache) throws VictimsException {
try {
FileUtils.forceMkdir(cache);
} catch (IOException e) {
throw new VictimsException("Could not create an on disk cache", e);
}
} | [
"protected",
"void",
"create",
"(",
"File",
"cache",
")",
"throws",
"VictimsException",
"{",
"try",
"{",
"FileUtils",
".",
"forceMkdir",
"(",
"cache",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"VictimsException",
"(",
"\"Co... | Create the parent caching directory.
@param cache
@throws VictimsException | [
"Create",
"the",
"parent",
"caching",
"directory",
"."
] | ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b | https://github.com/victims/victims-lib-java/blob/ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b/src/main/java/com/redhat/victims/VictimsResultCache.java#L56-L62 | train |
victims/victims-lib-java | src/main/java/com/redhat/victims/VictimsResultCache.java | VictimsResultCache.purge | public void purge() throws VictimsException {
try {
File cache = new File(location);
if (cache.exists()) {
FileUtils.deleteDirectory(cache);
}
create(cache);
} catch (IOException e) {
throw new VictimsException("Could not purge on disk cache.", e);
}
} | java | public void purge() throws VictimsException {
try {
File cache = new File(location);
if (cache.exists()) {
FileUtils.deleteDirectory(cache);
}
create(cache);
} catch (IOException e) {
throw new VictimsException("Could not purge on disk cache.", e);
}
} | [
"public",
"void",
"purge",
"(",
")",
"throws",
"VictimsException",
"{",
"try",
"{",
"File",
"cache",
"=",
"new",
"File",
"(",
"location",
")",
";",
"if",
"(",
"cache",
".",
"exists",
"(",
")",
")",
"{",
"FileUtils",
".",
"deleteDirectory",
"(",
"cache"... | Purge the cache. The cache directory is removed and re-recreated.
@throws VictimsException | [
"Purge",
"the",
"cache",
".",
"The",
"cache",
"directory",
"is",
"removed",
"and",
"re",
"-",
"recreated",
"."
] | ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b | https://github.com/victims/victims-lib-java/blob/ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b/src/main/java/com/redhat/victims/VictimsResultCache.java#L69-L79 | train |
victims/victims-lib-java | src/main/java/com/redhat/victims/VictimsResultCache.java | VictimsResultCache.hash | protected String hash(String key) throws VictimsException {
try {
MessageDigest mda = MessageDigest
.getInstance(MessageDigestAlgorithms.SHA_256);
return Hex.encodeHexString(mda.digest(key.getBytes()));
} catch (NoSuchAlgorithmException e) {
throw new VictimsException(String.format("Could not hash key: %s",
key), e);
}
} | java | protected String hash(String key) throws VictimsException {
try {
MessageDigest mda = MessageDigest
.getInstance(MessageDigestAlgorithms.SHA_256);
return Hex.encodeHexString(mda.digest(key.getBytes()));
} catch (NoSuchAlgorithmException e) {
throw new VictimsException(String.format("Could not hash key: %s",
key), e);
}
} | [
"protected",
"String",
"hash",
"(",
"String",
"key",
")",
"throws",
"VictimsException",
"{",
"try",
"{",
"MessageDigest",
"mda",
"=",
"MessageDigest",
".",
"getInstance",
"(",
"MessageDigestAlgorithms",
".",
"SHA_256",
")",
";",
"return",
"Hex",
".",
"encodeHexS... | The hashing function used by the Cache.
@param key
@return
@throws VictimsException | [
"The",
"hashing",
"function",
"used",
"by",
"the",
"Cache",
"."
] | ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b | https://github.com/victims/victims-lib-java/blob/ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b/src/main/java/com/redhat/victims/VictimsResultCache.java#L101-L110 | train |
victims/victims-lib-java | src/main/java/com/redhat/victims/VictimsResultCache.java | VictimsResultCache.exists | public boolean exists(String key) {
try {
key = hash(key);
return FileUtils.getFile(location, key).exists();
} catch (VictimsException e) {
return false;
}
} | java | public boolean exists(String key) {
try {
key = hash(key);
return FileUtils.getFile(location, key).exists();
} catch (VictimsException e) {
return false;
}
} | [
"public",
"boolean",
"exists",
"(",
"String",
"key",
")",
"{",
"try",
"{",
"key",
"=",
"hash",
"(",
"key",
")",
";",
"return",
"FileUtils",
".",
"getFile",
"(",
"location",
",",
"key",
")",
".",
"exists",
"(",
")",
";",
"}",
"catch",
"(",
"VictimsE... | Test if the given key is cached.
@param key
@return | [
"Test",
"if",
"the",
"given",
"key",
"is",
"cached",
"."
] | ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b | https://github.com/victims/victims-lib-java/blob/ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b/src/main/java/com/redhat/victims/VictimsResultCache.java#L118-L125 | train |
victims/victims-lib-java | src/main/java/com/redhat/victims/VictimsResultCache.java | VictimsResultCache.delete | public void delete(String key) throws VictimsException {
key = hash(key);
try {
FileUtils.forceDelete(FileUtils.getFile(location, key));
} catch (IOException e) {
throw new VictimsException(String.format(
"Could not delete the cached entry from disk: %s", key), e);
}
} | java | public void delete(String key) throws VictimsException {
key = hash(key);
try {
FileUtils.forceDelete(FileUtils.getFile(location, key));
} catch (IOException e) {
throw new VictimsException(String.format(
"Could not delete the cached entry from disk: %s", key), e);
}
} | [
"public",
"void",
"delete",
"(",
"String",
"key",
")",
"throws",
"VictimsException",
"{",
"key",
"=",
"hash",
"(",
"key",
")",
";",
"try",
"{",
"FileUtils",
".",
"forceDelete",
"(",
"FileUtils",
".",
"getFile",
"(",
"location",
",",
"key",
")",
")",
";... | Delete the cache entry for a given key.
@param key
@throws VictimsException | [
"Delete",
"the",
"cache",
"entry",
"for",
"a",
"given",
"key",
"."
] | ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b | https://github.com/victims/victims-lib-java/blob/ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b/src/main/java/com/redhat/victims/VictimsResultCache.java#L133-L141 | train |
victims/victims-lib-java | src/main/java/com/redhat/victims/VictimsResultCache.java | VictimsResultCache.add | public void add(String key, Collection<String> cves)
throws VictimsException {
key = hash(key);
if (exists(key)) {
delete(key);
}
String result = "";
if (cves != null) {
result = StringUtils.join(cves, ",");
}
try {
FileOutputStream fos = new FileOutputStream(FileUtils.getFile(
location, key));
try {
fos.write(result.getBytes());
} finally {
fos.close();
}
} catch (IOException e) {
throw new VictimsException(String.format(
"Could not add disk entry for key: %s", key), e);
}
} | java | public void add(String key, Collection<String> cves)
throws VictimsException {
key = hash(key);
if (exists(key)) {
delete(key);
}
String result = "";
if (cves != null) {
result = StringUtils.join(cves, ",");
}
try {
FileOutputStream fos = new FileOutputStream(FileUtils.getFile(
location, key));
try {
fos.write(result.getBytes());
} finally {
fos.close();
}
} catch (IOException e) {
throw new VictimsException(String.format(
"Could not add disk entry for key: %s", key), e);
}
} | [
"public",
"void",
"add",
"(",
"String",
"key",
",",
"Collection",
"<",
"String",
">",
"cves",
")",
"throws",
"VictimsException",
"{",
"key",
"=",
"hash",
"(",
"key",
")",
";",
"if",
"(",
"exists",
"(",
"key",
")",
")",
"{",
"delete",
"(",
"key",
")... | Add a new cache entry.
@param key
@param cves
A {@link Collection} of CVE Strings. If null an empty string
is used.
@throws VictimsException | [
"Add",
"a",
"new",
"cache",
"entry",
"."
] | ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b | https://github.com/victims/victims-lib-java/blob/ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b/src/main/java/com/redhat/victims/VictimsResultCache.java#L152-L178 | train |
victims/victims-lib-java | src/main/java/com/redhat/victims/VictimsResultCache.java | VictimsResultCache.get | public HashSet<String> get(String key) throws VictimsException {
key = hash(key);
try {
HashSet<String> cves = new HashSet<String>();
String result = FileUtils.readFileToString(
FileUtils.getFile(location, key)).trim();
for (String cve : StringUtils.split(result, ",")) {
cves.add(cve);
}
return cves;
} catch (IOException e) {
throw new VictimsException(String.format(
"Could not read contents of entry with key: %s", key), e);
}
} | java | public HashSet<String> get(String key) throws VictimsException {
key = hash(key);
try {
HashSet<String> cves = new HashSet<String>();
String result = FileUtils.readFileToString(
FileUtils.getFile(location, key)).trim();
for (String cve : StringUtils.split(result, ",")) {
cves.add(cve);
}
return cves;
} catch (IOException e) {
throw new VictimsException(String.format(
"Could not read contents of entry with key: %s", key), e);
}
} | [
"public",
"HashSet",
"<",
"String",
">",
"get",
"(",
"String",
"key",
")",
"throws",
"VictimsException",
"{",
"key",
"=",
"hash",
"(",
"key",
")",
";",
"try",
"{",
"HashSet",
"<",
"String",
">",
"cves",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",... | Get the CVEs mapped by a key
@param key
@return {@link Collection} of CVE strings
@throws VictimsException | [
"Get",
"the",
"CVEs",
"mapped",
"by",
"a",
"key"
] | ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b | https://github.com/victims/victims-lib-java/blob/ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b/src/main/java/com/redhat/victims/VictimsResultCache.java#L187-L201 | train |
hedyn/wsonrpc | wsonrpc-client/src/main/java/net/apexes/wsonrpc/client/support/websocket/Base64.java | Base64.decode | public final static byte[] decode(byte[] sArr) {
// Check special case
int sLen = sArr.length;
// Count illegal characters (including '\r', '\n') to know what size the returned array will be,
// so we don't have to reallocate & copy it later.
int sepCnt = 0; // Number of separator characters. (Actually illegal characters, but that's a bonus...)
for (int i = 0; i < sLen; i++) // If input is "pure" (I.e. no line separators or illegal chars) base64 this loop can be commented out.
{
if (IA[sArr[i] & 0xff] < 0) {
sepCnt++;
}
}
// Check so that legal chars (including '=') are evenly divideable by 4 as specified in RFC 2045.
if ((sLen - sepCnt) % 4 != 0) {
return null;
}
int pad = 0;
for (int i = sLen; i > 1 && IA[sArr[--i] & 0xff] <= 0; ) {
if (sArr[i] == '=') {
pad++;
}
}
int len = ((sLen - sepCnt) * 6 >> 3) - pad;
byte[] dArr = new byte[len]; // Preallocate byte[] of exact length
for (int s = 0, d = 0; d < len; ) {
// Assemble three bytes into an int from four "valid" characters.
int i = 0;
for (int j = 0; j < 4; j++) { // j only increased if a valid char was found.
int c = IA[sArr[s++] & 0xff];
if (c >= 0) {
i |= c << (18 - j * 6);
} else {
j--;
}
}
// Add the bytes
dArr[d++] = (byte) (i >> 16);
if (d < len) {
dArr[d++] = (byte) (i >> 8);
if (d < len) {
dArr[d++] = (byte) i;
}
}
}
return dArr;
} | java | public final static byte[] decode(byte[] sArr) {
// Check special case
int sLen = sArr.length;
// Count illegal characters (including '\r', '\n') to know what size the returned array will be,
// so we don't have to reallocate & copy it later.
int sepCnt = 0; // Number of separator characters. (Actually illegal characters, but that's a bonus...)
for (int i = 0; i < sLen; i++) // If input is "pure" (I.e. no line separators or illegal chars) base64 this loop can be commented out.
{
if (IA[sArr[i] & 0xff] < 0) {
sepCnt++;
}
}
// Check so that legal chars (including '=') are evenly divideable by 4 as specified in RFC 2045.
if ((sLen - sepCnt) % 4 != 0) {
return null;
}
int pad = 0;
for (int i = sLen; i > 1 && IA[sArr[--i] & 0xff] <= 0; ) {
if (sArr[i] == '=') {
pad++;
}
}
int len = ((sLen - sepCnt) * 6 >> 3) - pad;
byte[] dArr = new byte[len]; // Preallocate byte[] of exact length
for (int s = 0, d = 0; d < len; ) {
// Assemble three bytes into an int from four "valid" characters.
int i = 0;
for (int j = 0; j < 4; j++) { // j only increased if a valid char was found.
int c = IA[sArr[s++] & 0xff];
if (c >= 0) {
i |= c << (18 - j * 6);
} else {
j--;
}
}
// Add the bytes
dArr[d++] = (byte) (i >> 16);
if (d < len) {
dArr[d++] = (byte) (i >> 8);
if (d < len) {
dArr[d++] = (byte) i;
}
}
}
return dArr;
} | [
"public",
"final",
"static",
"byte",
"[",
"]",
"decode",
"(",
"byte",
"[",
"]",
"sArr",
")",
"{",
"// Check special case",
"int",
"sLen",
"=",
"sArr",
".",
"length",
";",
"// Count illegal characters (including '\\r', '\\n') to know what size the returned array will be,",... | Decodes a BASE64 encoded byte array. All illegal characters will be ignored and can handle both arrays with
and without line separators.
@param sArr The source array. Length 0 will return an empty array. <code>null</code> will throw an exception.
@return The decoded array of bytes. May be of length 0. Will be <code>null</code> if the legal characters
(including '=') isn't divideable by 4. (I.e. definitely corrupted). | [
"Decodes",
"a",
"BASE64",
"encoded",
"byte",
"array",
".",
"All",
"illegal",
"characters",
"will",
"be",
"ignored",
"and",
"can",
"handle",
"both",
"arrays",
"with",
"and",
"without",
"line",
"separators",
"."
] | decbaad4cb8145590bab039d5cfe12437ada0d0a | https://github.com/hedyn/wsonrpc/blob/decbaad4cb8145590bab039d5cfe12437ada0d0a/wsonrpc-client/src/main/java/net/apexes/wsonrpc/client/support/websocket/Base64.java#L347-L400 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/util/sort/support/SelectionSort.java | SelectionSort.sort | @Override
public <E> List<E> sort(final List<E> elements) {
for (int index = 0, size = elements.size(), length = (size - 1); index < length; index++) {
int minIndex = index;
for (int j = (index + 1); j < size; j++) {
if (getOrderBy().compare(elements.get(j), elements.get(minIndex)) < 0) {
minIndex = j;
}
}
if (minIndex != index) {
swap(elements, minIndex, index);
}
}
return elements;
} | java | @Override
public <E> List<E> sort(final List<E> elements) {
for (int index = 0, size = elements.size(), length = (size - 1); index < length; index++) {
int minIndex = index;
for (int j = (index + 1); j < size; j++) {
if (getOrderBy().compare(elements.get(j), elements.get(minIndex)) < 0) {
minIndex = j;
}
}
if (minIndex != index) {
swap(elements, minIndex, index);
}
}
return elements;
} | [
"@",
"Override",
"public",
"<",
"E",
">",
"List",
"<",
"E",
">",
"sort",
"(",
"final",
"List",
"<",
"E",
">",
"elements",
")",
"{",
"for",
"(",
"int",
"index",
"=",
"0",
",",
"size",
"=",
"elements",
".",
"size",
"(",
")",
",",
"length",
"=",
... | Uses the Selection 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",
"Selection",
"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",
"Comparabl... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/sort/support/SelectionSort.java#L46-L63 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/backup_policy.java | backup_policy.get | public static backup_policy get(nitro_service client, backup_policy resource) throws Exception
{
resource.validate("get");
return ((backup_policy[]) resource.get_resources(client))[0];
} | java | public static backup_policy get(nitro_service client, backup_policy resource) throws Exception
{
resource.validate("get");
return ((backup_policy[]) resource.get_resources(client))[0];
} | [
"public",
"static",
"backup_policy",
"get",
"(",
"nitro_service",
"client",
",",
"backup_policy",
"resource",
")",
"throws",
"Exception",
"{",
"resource",
".",
"validate",
"(",
"\"get\"",
")",
";",
"return",
"(",
"(",
"backup_policy",
"[",
"]",
")",
"resource"... | Use this operation to get backup policy to view the number of previous backups to retain. | [
"Use",
"this",
"operation",
"to",
"get",
"backup",
"policy",
"to",
"view",
"the",
"number",
"of",
"previous",
"backups",
"to",
"retain",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/backup_policy.java#L104-L108 | train |
robovm/robovm-jfx78-compat | src/main/java/sun/reflect/Reflection.java | Reflection.registerFieldsToFilter | public static synchronized void registerFieldsToFilter(Class<?> containingClass,
String ... fieldNames) {
fieldFilterMap =
registerFilter(fieldFilterMap, containingClass, fieldNames);
} | java | public static synchronized void registerFieldsToFilter(Class<?> containingClass,
String ... fieldNames) {
fieldFilterMap =
registerFilter(fieldFilterMap, containingClass, fieldNames);
} | [
"public",
"static",
"synchronized",
"void",
"registerFieldsToFilter",
"(",
"Class",
"<",
"?",
">",
"containingClass",
",",
"String",
"...",
"fieldNames",
")",
"{",
"fieldFilterMap",
"=",
"registerFilter",
"(",
"fieldFilterMap",
",",
"containingClass",
",",
"fieldNam... | fieldNames must contain only interned Strings | [
"fieldNames",
"must",
"contain",
"only",
"interned",
"Strings"
] | 5c1fd20488d19a10c3d69d4ca8b22957254d3811 | https://github.com/robovm/robovm-jfx78-compat/blob/5c1fd20488d19a10c3d69d4ca8b22957254d3811/src/main/java/sun/reflect/Reflection.java#L244-L248 | train |
robovm/robovm-jfx78-compat | src/main/java/sun/reflect/Reflection.java | Reflection.registerMethodsToFilter | public static synchronized void registerMethodsToFilter(Class<?> containingClass,
String ... methodNames) {
methodFilterMap =
registerFilter(methodFilterMap, containingClass, methodNames);
} | java | public static synchronized void registerMethodsToFilter(Class<?> containingClass,
String ... methodNames) {
methodFilterMap =
registerFilter(methodFilterMap, containingClass, methodNames);
} | [
"public",
"static",
"synchronized",
"void",
"registerMethodsToFilter",
"(",
"Class",
"<",
"?",
">",
"containingClass",
",",
"String",
"...",
"methodNames",
")",
"{",
"methodFilterMap",
"=",
"registerFilter",
"(",
"methodFilterMap",
",",
"containingClass",
",",
"meth... | methodNames must contain only interned Strings | [
"methodNames",
"must",
"contain",
"only",
"interned",
"Strings"
] | 5c1fd20488d19a10c3d69d4ca8b22957254d3811 | https://github.com/robovm/robovm-jfx78-compat/blob/5c1fd20488d19a10c3d69d4ca8b22957254d3811/src/main/java/sun/reflect/Reflection.java#L251-L255 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/DateTimeUtils.java | DateTimeUtils.create | public static Calendar create(long timeInMilliseconds) {
Calendar dateTime = Calendar.getInstance();
dateTime.clear();
dateTime.setTimeInMillis(timeInMilliseconds);
return dateTime;
} | java | public static Calendar create(long timeInMilliseconds) {
Calendar dateTime = Calendar.getInstance();
dateTime.clear();
dateTime.setTimeInMillis(timeInMilliseconds);
return dateTime;
} | [
"public",
"static",
"Calendar",
"create",
"(",
"long",
"timeInMilliseconds",
")",
"{",
"Calendar",
"dateTime",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"dateTime",
".",
"clear",
"(",
")",
";",
"dateTime",
".",
"setTimeInMillis",
"(",
"timeInMillisec... | Creates a Calendar instance with a date and time set to the time in milliseconds.
@param timeInMilliseconds a long value indicating the number of milliseconds since the EPOCH.
@return a Calendar instance initialized with the specified date/time in milliseconds.
@see java.util.Calendar | [
"Creates",
"a",
"Calendar",
"instance",
"with",
"a",
"date",
"and",
"time",
"set",
"to",
"the",
"time",
"in",
"milliseconds",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/DateTimeUtils.java#L86-L91 | train |
ChannelFinder/javaCFClient | src/main/java/gov/bnl/channelfinder/api/ChannelQuery.java | ChannelQuery.execute | public void execute(ChannelQueryListener listener) {
addChannelQueryListener(listener);
// Make a local copy to avoid synchronization
Result localResult = result;
// If the query was executed, just call the listener
if (localResult != null) {
listener.queryExecuted(localResult);
} else {
execute();
}
} | java | public void execute(ChannelQueryListener listener) {
addChannelQueryListener(listener);
// Make a local copy to avoid synchronization
Result localResult = result;
// If the query was executed, just call the listener
if (localResult != null) {
listener.queryExecuted(localResult);
} else {
execute();
}
} | [
"public",
"void",
"execute",
"(",
"ChannelQueryListener",
"listener",
")",
"{",
"addChannelQueryListener",
"(",
"listener",
")",
";",
"// Make a local copy to avoid synchronization",
"Result",
"localResult",
"=",
"result",
";",
"// If the query was executed, just call the liste... | Executes the query and calls the listener with the result.
If the query was already executed, the listener is called
immediately with the result.
@param listener - channel query listener | [
"Executes",
"the",
"query",
"and",
"calls",
"the",
"listener",
"with",
"the",
"result",
".",
"If",
"the",
"query",
"was",
"already",
"executed",
"the",
"listener",
"is",
"called",
"immediately",
"with",
"the",
"result",
"."
] | 000fce53ad2b8f8c38ef24fec5b5ec65e383ac9d | https://github.com/ChannelFinder/javaCFClient/blob/000fce53ad2b8f8c38ef24fec5b5ec65e383ac9d/src/main/java/gov/bnl/channelfinder/api/ChannelQuery.java#L205-L218 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/current_timezone.java | current_timezone.get | public static current_timezone get(nitro_service client) throws Exception
{
current_timezone resource = new current_timezone();
resource.validate("get");
return ((current_timezone[]) resource.get_resources(client))[0];
} | java | public static current_timezone get(nitro_service client) throws Exception
{
current_timezone resource = new current_timezone();
resource.validate("get");
return ((current_timezone[]) resource.get_resources(client))[0];
} | [
"public",
"static",
"current_timezone",
"get",
"(",
"nitro_service",
"client",
")",
"throws",
"Exception",
"{",
"current_timezone",
"resource",
"=",
"new",
"current_timezone",
"(",
")",
";",
"resource",
".",
"validate",
"(",
"\"get\"",
")",
";",
"return",
"(",
... | Use this operation to get the current time zone. | [
"Use",
"this",
"operation",
"to",
"get",
"the",
"current",
"time",
"zone",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/current_timezone.java#L83-L88 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/mps_network_config.java | mps_network_config.get | public static mps_network_config get(nitro_service client) throws Exception
{
mps_network_config resource = new mps_network_config();
resource.validate("get");
return ((mps_network_config[]) resource.get_resources(client))[0];
} | java | public static mps_network_config get(nitro_service client) throws Exception
{
mps_network_config resource = new mps_network_config();
resource.validate("get");
return ((mps_network_config[]) resource.get_resources(client))[0];
} | [
"public",
"static",
"mps_network_config",
"get",
"(",
"nitro_service",
"client",
")",
"throws",
"Exception",
"{",
"mps_network_config",
"resource",
"=",
"new",
"mps_network_config",
"(",
")",
";",
"resource",
".",
"validate",
"(",
"\"get\"",
")",
";",
"return",
... | Use this operation to get MPS network configuration. | [
"Use",
"this",
"operation",
"to",
"get",
"MPS",
"network",
"configuration",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/mps_network_config.java#L125-L130 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/support/ClearIdentityVisitor.java | ClearIdentityVisitor.visit | @Override
@SuppressWarnings("unchecked")
public void visit(final Visitable visitable) {
if (visitable instanceof Identifiable) {
((Identifiable) visitable).setId(null);
}
} | java | @Override
@SuppressWarnings("unchecked")
public void visit(final Visitable visitable) {
if (visitable instanceof Identifiable) {
((Identifiable) visitable).setId(null);
}
} | [
"@",
"Override",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"void",
"visit",
"(",
"final",
"Visitable",
"visitable",
")",
"{",
"if",
"(",
"visitable",
"instanceof",
"Identifiable",
")",
"{",
"(",
"(",
"Identifiable",
")",
"visitable",
")",
... | Visits any Visitable object implementing the Identifiable interface, clearing the Identifiable objects identifier.
@param visitable the Visitable object visited by this Visitor.
@see org.cp.elements.lang.Identifiable#setId(Comparable)
@see org.cp.elements.lang.Visitable | [
"Visits",
"any",
"Visitable",
"object",
"implementing",
"the",
"Identifiable",
"interface",
"clearing",
"the",
"Identifiable",
"objects",
"identifier",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/support/ClearIdentityVisitor.java#L43-L49 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/support/OrderableComparator.java | OrderableComparator.compare | @Override
public int compare(final Orderable<T> orderable1, final Orderable<T> orderable2) {
return orderable1.getOrder().compareTo(orderable2.getOrder());
} | java | @Override
public int compare(final Orderable<T> orderable1, final Orderable<T> orderable2) {
return orderable1.getOrder().compareTo(orderable2.getOrder());
} | [
"@",
"Override",
"public",
"int",
"compare",
"(",
"final",
"Orderable",
"<",
"T",
">",
"orderable1",
",",
"final",
"Orderable",
"<",
"T",
">",
"orderable2",
")",
"{",
"return",
"orderable1",
".",
"getOrder",
"(",
")",
".",
"compareTo",
"(",
"orderable2",
... | Compares two Orderable objects to determine their relative order by their order property.
@param orderable1 the first Orderable object in the order comparison.
@param orderable2 the second Orderable object in the order comparison.
@return an integer value indicating one Orderable object's order relative to another Orderable object. | [
"Compares",
"two",
"Orderable",
"objects",
"to",
"determine",
"their",
"relative",
"order",
"by",
"their",
"order",
"property",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/support/OrderableComparator.java#L42-L45 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_supplemental_pack.java | xen_supplemental_pack.install | public static xen_supplemental_pack install(nitro_service client, xen_supplemental_pack resource) throws Exception
{
return ((xen_supplemental_pack[]) resource.perform_operation(client, "install"))[0];
} | java | public static xen_supplemental_pack install(nitro_service client, xen_supplemental_pack resource) throws Exception
{
return ((xen_supplemental_pack[]) resource.perform_operation(client, "install"))[0];
} | [
"public",
"static",
"xen_supplemental_pack",
"install",
"(",
"nitro_service",
"client",
",",
"xen_supplemental_pack",
"resource",
")",
"throws",
"Exception",
"{",
"return",
"(",
"(",
"xen_supplemental_pack",
"[",
"]",
")",
"resource",
".",
"perform_operation",
"(",
... | Use this operation to install new xen supplemental pack. | [
"Use",
"this",
"operation",
"to",
"install",
"new",
"xen",
"supplemental",
"pack",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_supplemental_pack.java#L124-L127 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/jazz_license.java | jazz_license.get | public static jazz_license get(nitro_service client) throws Exception
{
jazz_license resource = new jazz_license();
resource.validate("get");
return ((jazz_license[]) resource.get_resources(client))[0];
} | java | public static jazz_license get(nitro_service client) throws Exception
{
jazz_license resource = new jazz_license();
resource.validate("get");
return ((jazz_license[]) resource.get_resources(client))[0];
} | [
"public",
"static",
"jazz_license",
"get",
"(",
"nitro_service",
"client",
")",
"throws",
"Exception",
"{",
"jazz_license",
"resource",
"=",
"new",
"jazz_license",
"(",
")",
";",
"resource",
".",
"validate",
"(",
"\"get\"",
")",
";",
"return",
"(",
"(",
"jaz... | Use this operation to get license information. | [
"Use",
"this",
"operation",
"to",
"get",
"license",
"information",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/jazz_license.java#L303-L308 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_hotfix.java | xen_hotfix.apply | public static xen_hotfix apply(nitro_service client, xen_hotfix resource) throws Exception
{
return ((xen_hotfix[]) resource.perform_operation(client, "apply"))[0];
} | java | public static xen_hotfix apply(nitro_service client, xen_hotfix resource) throws Exception
{
return ((xen_hotfix[]) resource.perform_operation(client, "apply"))[0];
} | [
"public",
"static",
"xen_hotfix",
"apply",
"(",
"nitro_service",
"client",
",",
"xen_hotfix",
"resource",
")",
"throws",
"Exception",
"{",
"return",
"(",
"(",
"xen_hotfix",
"[",
"]",
")",
"resource",
".",
"perform_operation",
"(",
"client",
",",
"\"apply\"",
"... | Use this operation to apply new xen hotfixes. | [
"Use",
"this",
"operation",
"to",
"apply",
"new",
"xen",
"hotfixes",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_hotfix.java#L136-L139 | train |
loadimpact/loadimpact-sdk-java | src/main/java/com/loadimpact/util/StringUtils.java | StringUtils.toInitialCase | public static String toInitialCase(String s) {
if (isBlank(s)) return s;
if (s.length() == 1) return s.toUpperCase();
return s.substring(0, 1).toUpperCase() + s.substring(1);
} | java | public static String toInitialCase(String s) {
if (isBlank(s)) return s;
if (s.length() == 1) return s.toUpperCase();
return s.substring(0, 1).toUpperCase() + s.substring(1);
} | [
"public",
"static",
"String",
"toInitialCase",
"(",
"String",
"s",
")",
"{",
"if",
"(",
"isBlank",
"(",
"s",
")",
")",
"return",
"s",
";",
"if",
"(",
"s",
".",
"length",
"(",
")",
"==",
"1",
")",
"return",
"s",
".",
"toUpperCase",
"(",
")",
";",
... | Makes the initial letter upper-case.
@param s the string
@return first letter is now in upper-case | [
"Makes",
"the",
"initial",
"letter",
"upper",
"-",
"case",
"."
] | 49af80b768c5453266414108b0d30a0fc01b8cef | https://github.com/loadimpact/loadimpact-sdk-java/blob/49af80b768c5453266414108b0d30a0fc01b8cef/src/main/java/com/loadimpact/util/StringUtils.java#L32-L36 | train |
loadimpact/loadimpact-sdk-java | src/main/java/com/loadimpact/util/StringUtils.java | StringUtils.replicate | public static String replicate(String s, int times) {
if (s==null) return null;
if (times <= 0 || s.length() == 0) return "";
StringBuilder b = new StringBuilder(s.length() * times);
for (int k = 1; k <= times; ++k) b.append(s);
return b.toString();
} | java | public static String replicate(String s, int times) {
if (s==null) return null;
if (times <= 0 || s.length() == 0) return "";
StringBuilder b = new StringBuilder(s.length() * times);
for (int k = 1; k <= times; ++k) b.append(s);
return b.toString();
} | [
"public",
"static",
"String",
"replicate",
"(",
"String",
"s",
",",
"int",
"times",
")",
"{",
"if",
"(",
"s",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"times",
"<=",
"0",
"||",
"s",
".",
"length",
"(",
")",
"==",
"0",
")",
"return",
... | Replicates a string.
@param s the string to replicate
@param times number of times
@return combined string | [
"Replicates",
"a",
"string",
"."
] | 49af80b768c5453266414108b0d30a0fc01b8cef | https://github.com/loadimpact/loadimpact-sdk-java/blob/49af80b768c5453266414108b0d30a0fc01b8cef/src/main/java/com/loadimpact/util/StringUtils.java#L66-L73 | train |
loadimpact/loadimpact-sdk-java | src/main/java/com/loadimpact/util/StringUtils.java | StringUtils.md5 | public static String md5(String s) {
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
byte[] digest = md5.digest(s.getBytes(Charset.forName("UTF-8")));
StringBuilder buf = new StringBuilder(2 * digest.length);
for (byte oneByte : digest) {
buf.append(Integer.toHexString((oneByte & 0xFF) | 0x100).substring(1, 3));
}
return buf.toString();
} catch (NoSuchAlgorithmException ignore) { }
return s;
} | java | public static String md5(String s) {
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
byte[] digest = md5.digest(s.getBytes(Charset.forName("UTF-8")));
StringBuilder buf = new StringBuilder(2 * digest.length);
for (byte oneByte : digest) {
buf.append(Integer.toHexString((oneByte & 0xFF) | 0x100).substring(1, 3));
}
return buf.toString();
} catch (NoSuchAlgorithmException ignore) { }
return s;
} | [
"public",
"static",
"String",
"md5",
"(",
"String",
"s",
")",
"{",
"try",
"{",
"MessageDigest",
"md5",
"=",
"MessageDigest",
".",
"getInstance",
"(",
"\"MD5\"",
")",
";",
"byte",
"[",
"]",
"digest",
"=",
"md5",
".",
"digest",
"(",
"s",
".",
"getBytes",... | Computes a MD5 fingerprint of a text-string and returns as a HEX encoded string.
@param s string to process
@return HEX encoded MD5 fingerprint | [
"Computes",
"a",
"MD5",
"fingerprint",
"of",
"a",
"text",
"-",
"string",
"and",
"returns",
"as",
"a",
"HEX",
"encoded",
"string",
"."
] | 49af80b768c5453266414108b0d30a0fc01b8cef | https://github.com/loadimpact/loadimpact-sdk-java/blob/49af80b768c5453266414108b0d30a0fc01b8cef/src/main/java/com/loadimpact/util/StringUtils.java#L80-L91 | train |
loadimpact/loadimpact-sdk-java | src/main/java/com/loadimpact/util/StringUtils.java | StringUtils.percentageBar | public static String percentageBar(double percentage) {
final char dot = '.';
final char mark = '#';
final int slots = 40;
StringBuilder bar = new StringBuilder(replicate(String.valueOf(dot), slots));
int numSlots = (int) (slots * percentage / 100.0);
for (int k = 0; k < numSlots; ++k) bar.setCharAt(k, mark);
return String.format("[%s] %3.0f%%", bar, percentage);
} | java | public static String percentageBar(double percentage) {
final char dot = '.';
final char mark = '#';
final int slots = 40;
StringBuilder bar = new StringBuilder(replicate(String.valueOf(dot), slots));
int numSlots = (int) (slots * percentage / 100.0);
for (int k = 0; k < numSlots; ++k) bar.setCharAt(k, mark);
return String.format("[%s] %3.0f%%", bar, percentage);
} | [
"public",
"static",
"String",
"percentageBar",
"(",
"double",
"percentage",
")",
"{",
"final",
"char",
"dot",
"=",
"'",
"'",
";",
"final",
"char",
"mark",
"=",
"'",
"'",
";",
"final",
"int",
"slots",
"=",
"40",
";",
"StringBuilder",
"bar",
"=",
"new",
... | Creates a percentage ASCII bar.
@param percentage value in [0, 100]
@return "[###......] nn%" | [
"Creates",
"a",
"percentage",
"ASCII",
"bar",
"."
] | 49af80b768c5453266414108b0d30a0fc01b8cef | https://github.com/loadimpact/loadimpact-sdk-java/blob/49af80b768c5453266414108b0d30a0fc01b8cef/src/main/java/com/loadimpact/util/StringUtils.java#L98-L108 | train |
jsilland/piezo | src/main/java/io/soliton/protobuf/ChannelInitializers.java | ChannelInitializers.httpServer | public static final ChannelInitializer<Channel> httpServer(
final SimpleChannelInboundHandler<HttpRequest> handler) {
Preconditions.checkArgument(handler.isSharable());
return new ChannelInitializer<Channel>() {
@Override
protected void initChannel(Channel channel) throws Exception {
ChannelPipeline pipeline = channel.pipeline();
pipeline.addLast("httpCodec", new HttpServerCodec());
pipeline.addLast("aggregator", new HttpObjectAggregator(10 * 1024 * 1024));
pipeline.addLast("httpServerHandler", handler);
}
};
} | java | public static final ChannelInitializer<Channel> httpServer(
final SimpleChannelInboundHandler<HttpRequest> handler) {
Preconditions.checkArgument(handler.isSharable());
return new ChannelInitializer<Channel>() {
@Override
protected void initChannel(Channel channel) throws Exception {
ChannelPipeline pipeline = channel.pipeline();
pipeline.addLast("httpCodec", new HttpServerCodec());
pipeline.addLast("aggregator", new HttpObjectAggregator(10 * 1024 * 1024));
pipeline.addLast("httpServerHandler", handler);
}
};
} | [
"public",
"static",
"final",
"ChannelInitializer",
"<",
"Channel",
">",
"httpServer",
"(",
"final",
"SimpleChannelInboundHandler",
"<",
"HttpRequest",
">",
"handler",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"handler",
".",
"isSharable",
"(",
")",
")"... | Returns a new chanel initializer suited to decode and process HTTP
requests.
@param handler the handler implementing the application logic | [
"Returns",
"a",
"new",
"chanel",
"initializer",
"suited",
"to",
"decode",
"and",
"process",
"HTTP",
"requests",
"."
] | 9a340f1460d25e07ec475dd24128b838667c959b | https://github.com/jsilland/piezo/blob/9a340f1460d25e07ec475dd24128b838667c959b/src/main/java/io/soliton/protobuf/ChannelInitializers.java#L82-L95 | train |
jsilland/piezo | src/main/java/io/soliton/protobuf/ChannelInitializers.java | ChannelInitializers.httpClient | public static final ChannelInitializer<Channel> httpClient(
final SimpleChannelInboundHandler<HttpResponse> handler) {
return new ChannelInitializer<Channel>() {
@Override
protected void initChannel(Channel channel) throws Exception {
ChannelPipeline pipeline = channel.pipeline();
pipeline.addLast("httpCodec", new HttpClientCodec());
pipeline.addLast("aggregator", new HttpObjectAggregator(10 * 1024 * 1024));
pipeline.addLast("httpClientHandler", handler);
}
};
} | java | public static final ChannelInitializer<Channel> httpClient(
final SimpleChannelInboundHandler<HttpResponse> handler) {
return new ChannelInitializer<Channel>() {
@Override
protected void initChannel(Channel channel) throws Exception {
ChannelPipeline pipeline = channel.pipeline();
pipeline.addLast("httpCodec", new HttpClientCodec());
pipeline.addLast("aggregator", new HttpObjectAggregator(10 * 1024 * 1024));
pipeline.addLast("httpClientHandler", handler);
}
};
} | [
"public",
"static",
"final",
"ChannelInitializer",
"<",
"Channel",
">",
"httpClient",
"(",
"final",
"SimpleChannelInboundHandler",
"<",
"HttpResponse",
">",
"handler",
")",
"{",
"return",
"new",
"ChannelInitializer",
"<",
"Channel",
">",
"(",
")",
"{",
"@",
"Ove... | Returns a channel initializer suited to decode and process HTTP responses.
@param handler the handler implementing the application logic | [
"Returns",
"a",
"channel",
"initializer",
"suited",
"to",
"decode",
"and",
"process",
"HTTP",
"responses",
"."
] | 9a340f1460d25e07ec475dd24128b838667c959b | https://github.com/jsilland/piezo/blob/9a340f1460d25e07ec475dd24128b838667c959b/src/main/java/io/soliton/protobuf/ChannelInitializers.java#L129-L141 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/concurrent/ThreadUtils.java | ThreadUtils.isBlocked | @NullSafe
public static boolean isBlocked(Thread thread) {
return (thread != null && Thread.State.BLOCKED.equals(thread.getState()));
} | java | @NullSafe
public static boolean isBlocked(Thread thread) {
return (thread != null && Thread.State.BLOCKED.equals(thread.getState()));
} | [
"@",
"NullSafe",
"public",
"static",
"boolean",
"isBlocked",
"(",
"Thread",
"thread",
")",
"{",
"return",
"(",
"thread",
"!=",
"null",
"&&",
"Thread",
".",
"State",
".",
"BLOCKED",
".",
"equals",
"(",
"thread",
".",
"getState",
"(",
")",
")",
")",
";",... | Determines whether the specified Thread is in a blocked state. A Thread may be currently blocked waiting on a lock
or performing some IO operation.
@param thread the Thread to evaluate.
@return a boolean valued indicating whether he specified Thread is blocked.
@see java.lang.Thread#getState()
@see java.lang.Thread.State#BLOCKED | [
"Determines",
"whether",
"the",
"specified",
"Thread",
"is",
"in",
"a",
"blocked",
"state",
".",
"A",
"Thread",
"may",
"be",
"currently",
"blocked",
"waiting",
"on",
"a",
"lock",
"or",
"performing",
"some",
"IO",
"operation",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/concurrent/ThreadUtils.java#L65-L68 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/concurrent/ThreadUtils.java | ThreadUtils.isNew | @NullSafe
public static boolean isNew(Thread thread) {
return (thread != null && Thread.State.NEW.equals(thread.getState()));
} | java | @NullSafe
public static boolean isNew(Thread thread) {
return (thread != null && Thread.State.NEW.equals(thread.getState()));
} | [
"@",
"NullSafe",
"public",
"static",
"boolean",
"isNew",
"(",
"Thread",
"thread",
")",
"{",
"return",
"(",
"thread",
"!=",
"null",
"&&",
"Thread",
".",
"State",
".",
"NEW",
".",
"equals",
"(",
"thread",
".",
"getState",
"(",
")",
")",
")",
";",
"}"
] | Determines whether the specified Thread is a new Thread. A "new" Thread is any Thread that has not been
started yet.
@param thread the Thread to evaluate.
@return a boolean value indicating whether the Thread is new.
@see java.lang.Thread#getState()
@see java.lang.Thread.State#NEW | [
"Determines",
"whether",
"the",
"specified",
"Thread",
"is",
"a",
"new",
"Thread",
".",
"A",
"new",
"Thread",
"is",
"any",
"Thread",
"that",
"has",
"not",
"been",
"started",
"yet",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/concurrent/ThreadUtils.java#L120-L123 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/concurrent/ThreadUtils.java | ThreadUtils.isTimedWaiting | @NullSafe
public static boolean isTimedWaiting(Thread thread) {
return (thread != null && Thread.State.TIMED_WAITING.equals(thread.getState()));
} | java | @NullSafe
public static boolean isTimedWaiting(Thread thread) {
return (thread != null && Thread.State.TIMED_WAITING.equals(thread.getState()));
} | [
"@",
"NullSafe",
"public",
"static",
"boolean",
"isTimedWaiting",
"(",
"Thread",
"thread",
")",
"{",
"return",
"(",
"thread",
"!=",
"null",
"&&",
"Thread",
".",
"State",
".",
"TIMED_WAITING",
".",
"equals",
"(",
"thread",
".",
"getState",
"(",
")",
")",
... | Determines whether the specified Thread is currently in a timed wait.
@param thread the Thread to evaluate.
@return a boolean value indicating whether the Thread is currently in a timed wait.
@see java.lang.Thread#getState()
@see java.lang.Thread.State#TIMED_WAITING | [
"Determines",
"whether",
"the",
"specified",
"Thread",
"is",
"currently",
"in",
"a",
"timed",
"wait",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/concurrent/ThreadUtils.java#L160-L163 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/concurrent/ThreadUtils.java | ThreadUtils.isWaiting | @NullSafe
public static boolean isWaiting(Thread thread) {
return (thread != null && Thread.State.WAITING.equals(thread.getState()));
} | java | @NullSafe
public static boolean isWaiting(Thread thread) {
return (thread != null && Thread.State.WAITING.equals(thread.getState()));
} | [
"@",
"NullSafe",
"public",
"static",
"boolean",
"isWaiting",
"(",
"Thread",
"thread",
")",
"{",
"return",
"(",
"thread",
"!=",
"null",
"&&",
"Thread",
".",
"State",
".",
"WAITING",
".",
"equals",
"(",
"thread",
".",
"getState",
"(",
")",
")",
")",
";",... | Determines whether the specified Thread is currently in a wait.
@param thread the Thread to evaluate.
@return a boolean value indicating whether the Thread is currently in a wait.
@see java.lang.Thread#getState()
@see java.lang.Thread.State#WAITING | [
"Determines",
"whether",
"the",
"specified",
"Thread",
"is",
"currently",
"in",
"a",
"wait",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/concurrent/ThreadUtils.java#L173-L176 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/concurrent/ThreadUtils.java | ThreadUtils.getContextClassLoader | @NullSafe
public static ClassLoader getContextClassLoader(Thread thread) {
return (thread != null ? thread.getContextClassLoader() : ThreadUtils.class.getClassLoader());
} | java | @NullSafe
public static ClassLoader getContextClassLoader(Thread thread) {
return (thread != null ? thread.getContextClassLoader() : ThreadUtils.class.getClassLoader());
} | [
"@",
"NullSafe",
"public",
"static",
"ClassLoader",
"getContextClassLoader",
"(",
"Thread",
"thread",
")",
"{",
"return",
"(",
"thread",
"!=",
"null",
"?",
"thread",
".",
"getContextClassLoader",
"(",
")",
":",
"ThreadUtils",
".",
"class",
".",
"getClassLoader",... | A null-safe method for getting the Thread's context ClassLoader.
@param thread the Thread from which the context ClassLoader is returned.
@return the context ClassLoader of the specified Thread or the ThreadUtils class ClassLoader if the Thread is null.
@see java.lang.Thread#getContextClassLoader()
@see java.lang.ClassLoader | [
"A",
"null",
"-",
"safe",
"method",
"for",
"getting",
"the",
"Thread",
"s",
"context",
"ClassLoader",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/concurrent/ThreadUtils.java#L186-L189 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/concurrent/ThreadUtils.java | ThreadUtils.getName | @NullSafe
public static String getName(Thread thread) {
return (thread != null ? thread.getName() : null);
} | java | @NullSafe
public static String getName(Thread thread) {
return (thread != null ? thread.getName() : null);
} | [
"@",
"NullSafe",
"public",
"static",
"String",
"getName",
"(",
"Thread",
"thread",
")",
"{",
"return",
"(",
"thread",
"!=",
"null",
"?",
"thread",
".",
"getName",
"(",
")",
":",
"null",
")",
";",
"}"
] | A null-safe method for getting the Thread's name.
@param thread the Thread from which the name is returned.
@return a String indicating the name of the specified Thread or null if the Thread is null.
@see java.lang.Thread#getName() | [
"A",
"null",
"-",
"safe",
"method",
"for",
"getting",
"the",
"Thread",
"s",
"name",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/concurrent/ThreadUtils.java#L210-L213 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/concurrent/ThreadUtils.java | ThreadUtils.getStackTrace | @NullSafe
public static StackTraceElement[] getStackTrace(Thread thread) {
return (thread != null ? thread.getStackTrace() : new StackTraceElement[0]);
} | java | @NullSafe
public static StackTraceElement[] getStackTrace(Thread thread) {
return (thread != null ? thread.getStackTrace() : new StackTraceElement[0]);
} | [
"@",
"NullSafe",
"public",
"static",
"StackTraceElement",
"[",
"]",
"getStackTrace",
"(",
"Thread",
"thread",
")",
"{",
"return",
"(",
"thread",
"!=",
"null",
"?",
"thread",
".",
"getStackTrace",
"(",
")",
":",
"new",
"StackTraceElement",
"[",
"0",
"]",
")... | A null-safe method for getting a snapshot of the Thread's current stack trace.
@param thread the Thread from which the stack trace is returned.
@return an array of StackTraceElements indicating the stack trace of the specified Thread,
or an empty StackTraceElement array if the Thread is null.
@see java.lang.Thread#getStackTrace()
@see java.lang.StackTraceElement | [
"A",
"null",
"-",
"safe",
"method",
"for",
"getting",
"a",
"snapshot",
"of",
"the",
"Thread",
"s",
"current",
"stack",
"trace",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/concurrent/ThreadUtils.java#L236-L239 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/concurrent/ThreadUtils.java | ThreadUtils.getState | @NullSafe
public static Thread.State getState(Thread thread) {
return (thread != null ? thread.getState() : null);
} | java | @NullSafe
public static Thread.State getState(Thread thread) {
return (thread != null ? thread.getState() : null);
} | [
"@",
"NullSafe",
"public",
"static",
"Thread",
".",
"State",
"getState",
"(",
"Thread",
"thread",
")",
"{",
"return",
"(",
"thread",
"!=",
"null",
"?",
"thread",
".",
"getState",
"(",
")",
":",
"null",
")",
";",
"}"
] | A null-safe method for getting the Thread's current state.
@param thread the Thread from which the state is returned.
@return the State of the specified Thread or null if the Thread is null.
@see java.lang.Thread#getState()
@see java.lang.Thread.State | [
"A",
"null",
"-",
"safe",
"method",
"for",
"getting",
"the",
"Thread",
"s",
"current",
"state",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/concurrent/ThreadUtils.java#L249-L252 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/concurrent/ThreadUtils.java | ThreadUtils.getThreadGroup | @NullSafe
public static ThreadGroup getThreadGroup(Thread thread) {
return (thread != null ? thread.getThreadGroup() : null);
} | java | @NullSafe
public static ThreadGroup getThreadGroup(Thread thread) {
return (thread != null ? thread.getThreadGroup() : null);
} | [
"@",
"NullSafe",
"public",
"static",
"ThreadGroup",
"getThreadGroup",
"(",
"Thread",
"thread",
")",
"{",
"return",
"(",
"thread",
"!=",
"null",
"?",
"thread",
".",
"getThreadGroup",
"(",
")",
":",
"null",
")",
";",
"}"
] | A null-safe method for getting the Thread's ThreadGroup.
@param thread the Thread from which the ThreadGroup is returned.
@return the ThreadGroup of the specified Thread or null if the Thread is null.
@see java.lang.Thread#getThreadGroup()
@see java.lang.ThreadGroup | [
"A",
"null",
"-",
"safe",
"method",
"for",
"getting",
"the",
"Thread",
"s",
"ThreadGroup",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/concurrent/ThreadUtils.java#L262-L265 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/concurrent/ThreadUtils.java | ThreadUtils.interrupt | @NullSafe
public static void interrupt(Thread thread) {
Optional.ofNullable(thread).ifPresent(Thread::interrupt);
} | java | @NullSafe
public static void interrupt(Thread thread) {
Optional.ofNullable(thread).ifPresent(Thread::interrupt);
} | [
"@",
"NullSafe",
"public",
"static",
"void",
"interrupt",
"(",
"Thread",
"thread",
")",
"{",
"Optional",
".",
"ofNullable",
"(",
"thread",
")",
".",
"ifPresent",
"(",
"Thread",
"::",
"interrupt",
")",
";",
"}"
] | Null-safe operation to interrupt the specified Thread.
@param thread the Thread to interrupt.
@see java.lang.Thread#interrupt() | [
"Null",
"-",
"safe",
"operation",
"to",
"interrupt",
"the",
"specified",
"Thread",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/concurrent/ThreadUtils.java#L287-L290 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/concurrent/ThreadUtils.java | ThreadUtils.join | @NullSafe
public static boolean join(Thread thread, long milliseconds, int nanoseconds) {
try {
if (thread != null) {
thread.join(milliseconds, nanoseconds);
return true;
}
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
return false;
} | java | @NullSafe
public static boolean join(Thread thread, long milliseconds, int nanoseconds) {
try {
if (thread != null) {
thread.join(milliseconds, nanoseconds);
return true;
}
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
return false;
} | [
"@",
"NullSafe",
"public",
"static",
"boolean",
"join",
"(",
"Thread",
"thread",
",",
"long",
"milliseconds",
",",
"int",
"nanoseconds",
")",
"{",
"try",
"{",
"if",
"(",
"thread",
"!=",
"null",
")",
"{",
"thread",
".",
"join",
"(",
"milliseconds",
",",
... | Causes the current Thread to join with the specified Thread. If the current Thread is interrupted while waiting
for the specified Thread, then the current Threads interrupt bit will be set and this method will return false.
Otherwise, the current Thread will wait on the specified Thread until it dies, or until the time period has expired
and then the method will return true.
@param thread the Thread that the current Thread (caller) will join.
@param milliseconds the number of milliseconds the current Thread will wait during the join operation. If the
number of milliseconds specified is 0, then the current Thread will wait until the specified Thread dies, or the
current Thread is interrupted.
@param nanoseconds the number of nanoseconds in addition to the milliseconds the current Thread will wait during
the join operation.
@return a boolean condition indicating if the current Thread successfully joined the specified Thread without being
interrupted.
@see java.lang.Thread#join(long, int)
@see java.lang.Thread#interrupt() | [
"Causes",
"the",
"current",
"Thread",
"to",
"join",
"with",
"the",
"specified",
"Thread",
".",
"If",
"the",
"current",
"Thread",
"is",
"interrupted",
"while",
"waiting",
"for",
"the",
"specified",
"Thread",
"then",
"the",
"current",
"Threads",
"interrupt",
"bi... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/concurrent/ThreadUtils.java#L309-L322 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/concurrent/ThreadUtils.java | ThreadUtils.sleep | public static boolean sleep(long milliseconds, int nanoseconds) {
try {
Thread.sleep(milliseconds, nanoseconds);
return true;
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
return false;
}
} | java | public static boolean sleep(long milliseconds, int nanoseconds) {
try {
Thread.sleep(milliseconds, nanoseconds);
return true;
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
return false;
}
} | [
"public",
"static",
"boolean",
"sleep",
"(",
"long",
"milliseconds",
",",
"int",
"nanoseconds",
")",
"{",
"try",
"{",
"Thread",
".",
"sleep",
"(",
"milliseconds",
",",
"nanoseconds",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"InterruptedException",... | Causes the current Thread to sleep for the specified number of milliseconds and nanoseconds. If the current Thread
is interrupted, the sleep is aborted, however, the interrupt bit is reset and this method returns false.
@param milliseconds the number of milliseconds to cause the current Thread to sleep (sleep). If the number
of milliseconds is 0, then the current Thread will sleep (sleep) until interrupted.
@param nanoseconds the number of nanoseconds in addition to the milliseconds to cause the current Thread to sleep
(sleep).
@return a boolean value if the sleep operation was successful without interruption.
@see java.lang.Thread#sleep(long)
@see java.lang.Thread#interrupt() | [
"Causes",
"the",
"current",
"Thread",
"to",
"sleep",
"for",
"the",
"specified",
"number",
"of",
"milliseconds",
"and",
"nanoseconds",
".",
"If",
"the",
"current",
"Thread",
"is",
"interrupted",
"the",
"sleep",
"is",
"aborted",
"however",
"the",
"interrupt",
"b... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/concurrent/ThreadUtils.java#L336-L345 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/tools/net/EchoServer.java | EchoServer.runEchoService | protected void runEchoService(ServerSocket serverSocket) {
if (isRunning(serverSocket)) {
echoService = newExecutorService();
echoService.submit(() -> {
try {
while (isRunning(serverSocket)) {
Socket echoClient = serverSocket.accept();
getLogger().info(() -> String.format("EchoClient connected from [%s]",
echoClient.getRemoteSocketAddress()));
echoService.submit(() -> {
sendResponse(echoClient, receiveMessage(echoClient));
close(echoClient);
});
}
}
catch (IOException cause) {
if (isRunning(serverSocket)) {
getLogger().warning(() -> String.format("An IO error occurred while listening for EchoClients:%n%s",
ThrowableUtils.getStackTrace(cause)));
}
}
});
getLogger().info(() -> String.format("EchoServer running on port [%d]", getPort()));
}
} | java | protected void runEchoService(ServerSocket serverSocket) {
if (isRunning(serverSocket)) {
echoService = newExecutorService();
echoService.submit(() -> {
try {
while (isRunning(serverSocket)) {
Socket echoClient = serverSocket.accept();
getLogger().info(() -> String.format("EchoClient connected from [%s]",
echoClient.getRemoteSocketAddress()));
echoService.submit(() -> {
sendResponse(echoClient, receiveMessage(echoClient));
close(echoClient);
});
}
}
catch (IOException cause) {
if (isRunning(serverSocket)) {
getLogger().warning(() -> String.format("An IO error occurred while listening for EchoClients:%n%s",
ThrowableUtils.getStackTrace(cause)));
}
}
});
getLogger().info(() -> String.format("EchoServer running on port [%d]", getPort()));
}
} | [
"protected",
"void",
"runEchoService",
"(",
"ServerSocket",
"serverSocket",
")",
"{",
"if",
"(",
"isRunning",
"(",
"serverSocket",
")",
")",
"{",
"echoService",
"=",
"newExecutorService",
"(",
")",
";",
"echoService",
".",
"submit",
"(",
"(",
")",
"->",
"{",... | Starts the 'echo service'.
@param serverSocket {@link ServerSocket} used by this {@link EchoServer} to accept {@link EchoClient} connections.
@see java.net.ServerSocket | [
"Starts",
"the",
"echo",
"service",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/tools/net/EchoServer.java#L212-L241 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/tools/net/EchoServer.java | EchoServer.stopEchoService | protected boolean stopEchoService() {
return Optional.ofNullable(getEchoService()).map(localEchoService -> {
localEchoService.shutdown();
try {
if (!localEchoService.awaitTermination(30, TimeUnit.SECONDS)) {
localEchoService.shutdownNow();
if (!localEchoService.awaitTermination(30, TimeUnit.SECONDS)) {
getLogger().warning("Failed to shutdown EchoService");
}
}
}
catch (InterruptedException ignore) {
Thread.currentThread().interrupt();
}
return localEchoService.isShutdown();
}).orElse(false);
} | java | protected boolean stopEchoService() {
return Optional.ofNullable(getEchoService()).map(localEchoService -> {
localEchoService.shutdown();
try {
if (!localEchoService.awaitTermination(30, TimeUnit.SECONDS)) {
localEchoService.shutdownNow();
if (!localEchoService.awaitTermination(30, TimeUnit.SECONDS)) {
getLogger().warning("Failed to shutdown EchoService");
}
}
}
catch (InterruptedException ignore) {
Thread.currentThread().interrupt();
}
return localEchoService.isShutdown();
}).orElse(false);
} | [
"protected",
"boolean",
"stopEchoService",
"(",
")",
"{",
"return",
"Optional",
".",
"ofNullable",
"(",
"getEchoService",
"(",
")",
")",
".",
"map",
"(",
"localEchoService",
"->",
"{",
"localEchoService",
".",
"shutdown",
"(",
")",
";",
"try",
"{",
"if",
"... | Stops the Echo Service, taking it offline and out-of-service.
@return a boolean value indicating whether the Echo Service has been shutdown successfully.
@see #getEchoService() | [
"Stops",
"the",
"Echo",
"Service",
"taking",
"it",
"offline",
"and",
"out",
"-",
"of",
"-",
"service",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/tools/net/EchoServer.java#L337-L358 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns.java | ns.reboot | public static ns reboot(nitro_service client, ns resource) throws Exception
{
return ((ns[]) resource.perform_operation(client, "reboot"))[0];
} | java | public static ns reboot(nitro_service client, ns resource) throws Exception
{
return ((ns[]) resource.perform_operation(client, "reboot"))[0];
} | [
"public",
"static",
"ns",
"reboot",
"(",
"nitro_service",
"client",
",",
"ns",
"resource",
")",
"throws",
"Exception",
"{",
"return",
"(",
"(",
"ns",
"[",
"]",
")",
"resource",
".",
"perform_operation",
"(",
"client",
",",
"\"reboot\"",
")",
")",
"[",
"0... | Use this operation to reboot NetScaler Instance. | [
"Use",
"this",
"operation",
"to",
"reboot",
"NetScaler",
"Instance",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns.java#L669-L672 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns.java | ns.stop | public static ns stop(nitro_service client, ns resource) throws Exception
{
return ((ns[]) resource.perform_operation(client, "stop"))[0];
} | java | public static ns stop(nitro_service client, ns resource) throws Exception
{
return ((ns[]) resource.perform_operation(client, "stop"))[0];
} | [
"public",
"static",
"ns",
"stop",
"(",
"nitro_service",
"client",
",",
"ns",
"resource",
")",
"throws",
"Exception",
"{",
"return",
"(",
"(",
"ns",
"[",
"]",
")",
"resource",
".",
"perform_operation",
"(",
"client",
",",
"\"stop\"",
")",
")",
"[",
"0",
... | Use this operation to stop NetScaler Instance. | [
"Use",
"this",
"operation",
"to",
"stop",
"NetScaler",
"Instance",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns.java#L700-L703 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns.java | ns.force_reboot | public static ns force_reboot(nitro_service client, ns resource) throws Exception
{
return ((ns[]) resource.perform_operation(client, "force_reboot"))[0];
} | java | public static ns force_reboot(nitro_service client, ns resource) throws Exception
{
return ((ns[]) resource.perform_operation(client, "force_reboot"))[0];
} | [
"public",
"static",
"ns",
"force_reboot",
"(",
"nitro_service",
"client",
",",
"ns",
"resource",
")",
"throws",
"Exception",
"{",
"return",
"(",
"(",
"ns",
"[",
"]",
")",
"resource",
".",
"perform_operation",
"(",
"client",
",",
"\"force_reboot\"",
")",
")",... | Use this operation to force reboot NetScaler Instance. | [
"Use",
"this",
"operation",
"to",
"force",
"reboot",
"NetScaler",
"Instance",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns.java#L763-L766 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns.java | ns.force_stop | public static ns force_stop(nitro_service client, ns resource) throws Exception
{
return ((ns[]) resource.perform_operation(client, "force_stop"))[0];
} | java | public static ns force_stop(nitro_service client, ns resource) throws Exception
{
return ((ns[]) resource.perform_operation(client, "force_stop"))[0];
} | [
"public",
"static",
"ns",
"force_stop",
"(",
"nitro_service",
"client",
",",
"ns",
"resource",
")",
"throws",
"Exception",
"{",
"return",
"(",
"(",
"ns",
"[",
"]",
")",
"resource",
".",
"perform_operation",
"(",
"client",
",",
"\"force_stop\"",
")",
")",
"... | Use this operation to force stop NetScaler Instance. | [
"Use",
"this",
"operation",
"to",
"force",
"stop",
"NetScaler",
"Instance",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns.java#L885-L888 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns.java | ns.start | public static ns start(nitro_service client, ns resource) throws Exception
{
return ((ns[]) resource.perform_operation(client, "start"))[0];
} | java | public static ns start(nitro_service client, ns resource) throws Exception
{
return ((ns[]) resource.perform_operation(client, "start"))[0];
} | [
"public",
"static",
"ns",
"start",
"(",
"nitro_service",
"client",
",",
"ns",
"resource",
")",
"throws",
"Exception",
"{",
"return",
"(",
"(",
"ns",
"[",
"]",
")",
"resource",
".",
"perform_operation",
"(",
"client",
",",
"\"start\"",
")",
")",
"[",
"0",... | Use this operation to start NetScaler Instance. | [
"Use",
"this",
"operation",
"to",
"start",
"NetScaler",
"Instance",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns.java#L916-L919 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns.java | ns.get_filtered | public static ns[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception
{
ns obj = new ns();
options option = new options();
option.set_filter(filter);
ns[] response = (ns[]) obj.getfiltered(service, option);
return response;
} | java | public static ns[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception
{
ns obj = new ns();
options option = new options();
option.set_filter(filter);
ns[] response = (ns[]) obj.getfiltered(service, option);
return response;
} | [
"public",
"static",
"ns",
"[",
"]",
"get_filtered",
"(",
"nitro_service",
"service",
",",
"filtervalue",
"[",
"]",
"filter",
")",
"throws",
"Exception",
"{",
"ns",
"obj",
"=",
"new",
"ns",
"(",
")",
";",
"options",
"option",
"=",
"new",
"options",
"(",
... | Use this API to fetch filtered set of ns resources.
set the filter parameter values in filtervalue object. | [
"Use",
"this",
"API",
"to",
"fetch",
"filtered",
"set",
"of",
"ns",
"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.java#L955-L962 | train |
loadimpact/loadimpact-sdk-java | src/main/java/com/loadimpact/eval/BoundedDroppingQueue.java | BoundedDroppingQueue.put | public void put(ElementType x) {
if (full()) {
getIdx = (getIdx + 1) % elements.length;
} else {
size++;
}
elements[putIdx] = x;
putIdx = (putIdx + 1) % elements.length;
} | java | public void put(ElementType x) {
if (full()) {
getIdx = (getIdx + 1) % elements.length;
} else {
size++;
}
elements[putIdx] = x;
putIdx = (putIdx + 1) % elements.length;
} | [
"public",
"void",
"put",
"(",
"ElementType",
"x",
")",
"{",
"if",
"(",
"full",
"(",
")",
")",
"{",
"getIdx",
"=",
"(",
"getIdx",
"+",
"1",
")",
"%",
"elements",
".",
"length",
";",
"}",
"else",
"{",
"size",
"++",
";",
"}",
"elements",
"[",
"put... | Inserts an element and overwrites old one when full.
@param x element to insert | [
"Inserts",
"an",
"element",
"and",
"overwrites",
"old",
"one",
"when",
"full",
"."
] | 49af80b768c5453266414108b0d30a0fc01b8cef | https://github.com/loadimpact/loadimpact-sdk-java/blob/49af80b768c5453266414108b0d30a0fc01b8cef/src/main/java/com/loadimpact/eval/BoundedDroppingQueue.java#L40-L49 | train |
loadimpact/loadimpact-sdk-java | src/main/java/com/loadimpact/eval/BoundedDroppingQueue.java | BoundedDroppingQueue.get | public ElementType get() {
if (empty()) throw new IllegalArgumentException("Empty queue");
ElementType x = (ElementType) elements[getIdx];
getIdx = (getIdx + 1) % elements.length;
size--;
return x;
} | java | public ElementType get() {
if (empty()) throw new IllegalArgumentException("Empty queue");
ElementType x = (ElementType) elements[getIdx];
getIdx = (getIdx + 1) % elements.length;
size--;
return x;
} | [
"public",
"ElementType",
"get",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Empty queue\"",
")",
";",
"ElementType",
"x",
"=",
"(",
"ElementType",
")",
"elements",
"[",
"getIdx",
"]",
";",
"getIdx",... | Removes the 'first' element.
@return first element in the queue
@throws IllegalArgumentException if empty | [
"Removes",
"the",
"first",
"element",
"."
] | 49af80b768c5453266414108b0d30a0fc01b8cef | https://github.com/loadimpact/loadimpact-sdk-java/blob/49af80b768c5453266414108b0d30a0fc01b8cef/src/main/java/com/loadimpact/eval/BoundedDroppingQueue.java#L56-L63 | train |
loadimpact/loadimpact-sdk-java | src/main/java/com/loadimpact/eval/BoundedDroppingQueue.java | BoundedDroppingQueue.iterator | public Iterator<ElementType> iterator() {
return new Iterator<ElementType>() {
int idx = getIdx;
int N = size;
public boolean hasNext() {
return N > 0;
}
public ElementType next() {
ElementType x = (ElementType) elements[idx];
idx = (idx + 1) % elements.length;
N--;
return x;
}
public void remove() {
throw new UnsupportedOperationException("remove");
}
};
} | java | public Iterator<ElementType> iterator() {
return new Iterator<ElementType>() {
int idx = getIdx;
int N = size;
public boolean hasNext() {
return N > 0;
}
public ElementType next() {
ElementType x = (ElementType) elements[idx];
idx = (idx + 1) % elements.length;
N--;
return x;
}
public void remove() {
throw new UnsupportedOperationException("remove");
}
};
} | [
"public",
"Iterator",
"<",
"ElementType",
">",
"iterator",
"(",
")",
"{",
"return",
"new",
"Iterator",
"<",
"ElementType",
">",
"(",
")",
"{",
"int",
"idx",
"=",
"getIdx",
";",
"int",
"N",
"=",
"size",
";",
"public",
"boolean",
"hasNext",
"(",
")",
"... | Returns an iterator intended usage in a foreach loop
@return an iterator that iterates over all elements in the queue | [
"Returns",
"an",
"iterator",
"intended",
"usage",
"in",
"a",
"foreach",
"loop"
] | 49af80b768c5453266414108b0d30a0fc01b8cef | https://github.com/loadimpact/loadimpact-sdk-java/blob/49af80b768c5453266414108b0d30a0fc01b8cef/src/main/java/com/loadimpact/eval/BoundedDroppingQueue.java#L93-L113 | train |
loadimpact/loadimpact-sdk-java | src/main/java/com/loadimpact/eval/BoundedDroppingQueue.java | BoundedDroppingQueue.toList | public List<ElementType> toList() {
List<ElementType> result = new ArrayList<ElementType>(size());
for (ElementType e : this) result.add(e);
return result;
} | java | public List<ElementType> toList() {
List<ElementType> result = new ArrayList<ElementType>(size());
for (ElementType e : this) result.add(e);
return result;
} | [
"public",
"List",
"<",
"ElementType",
">",
"toList",
"(",
")",
"{",
"List",
"<",
"ElementType",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"ElementType",
">",
"(",
"size",
"(",
")",
")",
";",
"for",
"(",
"ElementType",
"e",
":",
"this",
")",
"resul... | Returns a new list with all the elements in order
@return a list | [
"Returns",
"a",
"new",
"list",
"with",
"all",
"the",
"elements",
"in",
"order"
] | 49af80b768c5453266414108b0d30a0fc01b8cef | https://github.com/loadimpact/loadimpact-sdk-java/blob/49af80b768c5453266414108b0d30a0fc01b8cef/src/main/java/com/loadimpact/eval/BoundedDroppingQueue.java#L119-L123 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/util/PropertiesAdapter.java | PropertiesAdapter.defaultIfNotSet | protected <T> T defaultIfNotSet(String propertyName, T defaultValue, Class<T> type) {
return (isSet(propertyName) ? convert(propertyName, type) : defaultValue);
} | java | protected <T> T defaultIfNotSet(String propertyName, T defaultValue, Class<T> type) {
return (isSet(propertyName) ? convert(propertyName, type) : defaultValue);
} | [
"protected",
"<",
"T",
">",
"T",
"defaultIfNotSet",
"(",
"String",
"propertyName",
",",
"T",
"defaultValue",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"return",
"(",
"isSet",
"(",
"propertyName",
")",
"?",
"convert",
"(",
"propertyName",
",",
"type"... | Defaults of the value for the named property if the property does not exist.
@param <T> {@link Class} type of the return value.
@param propertyName the name of the property to get.
@param defaultValue the default value to return if the named property does not exist.
@param type the desired {@link Class} type of the named property value.
@return the value of the named property as a instance of the specified {@link Class} type
or return the default value if the named property does not exist.
@see java.lang.Class
@see #isSet(String)
@see #convert(String, Class) | [
"Defaults",
"of",
"the",
"value",
"for",
"the",
"named",
"property",
"if",
"the",
"property",
"does",
"not",
"exist",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/PropertiesAdapter.java#L170-L172 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/util/PropertiesAdapter.java | PropertiesAdapter.filter | public PropertiesAdapter filter(Filter<String> filter) {
Properties properties = new Properties();
for (String propertyName : this) {
if (filter.accept(propertyName)) {
properties.setProperty(propertyName, get(propertyName));
}
}
return from(properties);
} | java | public PropertiesAdapter filter(Filter<String> filter) {
Properties properties = new Properties();
for (String propertyName : this) {
if (filter.accept(propertyName)) {
properties.setProperty(propertyName, get(propertyName));
}
}
return from(properties);
} | [
"public",
"PropertiesAdapter",
"filter",
"(",
"Filter",
"<",
"String",
">",
"filter",
")",
"{",
"Properties",
"properties",
"=",
"new",
"Properties",
"(",
")",
";",
"for",
"(",
"String",
"propertyName",
":",
"this",
")",
"{",
"if",
"(",
"filter",
".",
"a... | Filters the properties from this adapter by name.
@param filter the {@link Filter} used to filter the properties of this adapter.
@return a newly constructed instance of the {@link PropertiesAdapter} containing only the filtered properties.
@see org.cp.elements.lang.Filter
@see java.util.Properties
@see #from(Properties) | [
"Filters",
"the",
"properties",
"from",
"this",
"adapter",
"by",
"name",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/PropertiesAdapter.java#L196-L206 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/mail_profile.java | mail_profile.get | public static mail_profile get(nitro_service client, mail_profile resource) throws Exception
{
resource.validate("get");
return ((mail_profile[]) resource.get_resources(client))[0];
} | java | public static mail_profile get(nitro_service client, mail_profile resource) throws Exception
{
resource.validate("get");
return ((mail_profile[]) resource.get_resources(client))[0];
} | [
"public",
"static",
"mail_profile",
"get",
"(",
"nitro_service",
"client",
",",
"mail_profile",
"resource",
")",
"throws",
"Exception",
"{",
"resource",
".",
"validate",
"(",
"\"get\"",
")",
";",
"return",
"(",
"(",
"mail_profile",
"[",
"]",
")",
"resource",
... | Use this operation to get mail profile.. | [
"Use",
"this",
"operation",
"to",
"get",
"mail",
"profile",
".."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/mail_profile.java#L264-L268 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/concurrent/TimeUnitComparator.java | TimeUnitComparator.compare | @Override
public int compare(final TimeUnit timeUnitOne, final TimeUnit timeUnitTwo) {
return Integer.valueOf(String.valueOf(TIME_UNIT_VALUE.get(timeUnitOne))).compareTo(
TIME_UNIT_VALUE.get(timeUnitTwo));
} | java | @Override
public int compare(final TimeUnit timeUnitOne, final TimeUnit timeUnitTwo) {
return Integer.valueOf(String.valueOf(TIME_UNIT_VALUE.get(timeUnitOne))).compareTo(
TIME_UNIT_VALUE.get(timeUnitTwo));
} | [
"@",
"Override",
"public",
"int",
"compare",
"(",
"final",
"TimeUnit",
"timeUnitOne",
",",
"final",
"TimeUnit",
"timeUnitTwo",
")",
"{",
"return",
"Integer",
".",
"valueOf",
"(",
"String",
".",
"valueOf",
"(",
"TIME_UNIT_VALUE",
".",
"get",
"(",
"timeUnitOne",... | Compares 2 TimeUnit values for order.
@param timeUnitOne the first TimeUnit operand in the relational comparison.
@param timeUnitTwo the second TimeUnit operand in the relational comparison
@return an integer value indicating the relative order of TimeUnit 1 to TimeUnit 2 returning a negative value
if TimeUnit 1 is less than TimeUnit 2, a positive value if Time Unit 1 is greater than TimeUnit 2 or 0
if the 2 TimUnit objects are equal.
@see java.util.Comparator#compare(Object, Object)
@see java.util.concurrent.TimeUnit | [
"Compares",
"2",
"TimeUnit",
"values",
"for",
"order",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/concurrent/TimeUnitComparator.java#L63-L67 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/reflect/ReflectionUtils.java | ReflectionUtils.getArgumentTypes | @NullSafe
public static Class[] getArgumentTypes(Object... arguments) {
Class[] argumentTypes = null;
if (arguments != null) {
argumentTypes = new Class[arguments.length];
for (int index = 0; index < arguments.length; index++) {
argumentTypes[index] = getClass(arguments[index]);
}
}
return argumentTypes;
} | java | @NullSafe
public static Class[] getArgumentTypes(Object... arguments) {
Class[] argumentTypes = null;
if (arguments != null) {
argumentTypes = new Class[arguments.length];
for (int index = 0; index < arguments.length; index++) {
argumentTypes[index] = getClass(arguments[index]);
}
}
return argumentTypes;
} | [
"@",
"NullSafe",
"public",
"static",
"Class",
"[",
"]",
"getArgumentTypes",
"(",
"Object",
"...",
"arguments",
")",
"{",
"Class",
"[",
"]",
"argumentTypes",
"=",
"null",
";",
"if",
"(",
"arguments",
"!=",
"null",
")",
"{",
"argumentTypes",
"=",
"new",
"C... | Determines the class types for all the given arguments.
@param arguments the array of (object) arguments from which to determine their class types.
@return an array of class types for each object in the array of arguments, or null if the given array is null.
This method is careful to guard against null elements given a non-null array of arguments.
@see org.cp.elements.lang.ClassUtils#getClass(Object) | [
"Determines",
"the",
"class",
"types",
"for",
"all",
"the",
"given",
"arguments",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/reflect/ReflectionUtils.java#L69-L82 | train |
Waxolunist/bittwiddling | src/main/java/com/vcollaborate/bitwise/BinaryUtils.java | BinaryUtils.nextPermutation | public static final long nextPermutation(long val) {
long tmp = val | (val - 1);
return (tmp + 1) | (((-tmp & -~tmp) - 1) >> (Long.numberOfTrailingZeros(val) + 1));
} | java | public static final long nextPermutation(long val) {
long tmp = val | (val - 1);
return (tmp + 1) | (((-tmp & -~tmp) - 1) >> (Long.numberOfTrailingZeros(val) + 1));
} | [
"public",
"static",
"final",
"long",
"nextPermutation",
"(",
"long",
"val",
")",
"{",
"long",
"tmp",
"=",
"val",
"|",
"(",
"val",
"-",
"1",
")",
";",
"return",
"(",
"tmp",
"+",
"1",
")",
"|",
"(",
"(",
"(",
"-",
"tmp",
"&",
"-",
"~",
"tmp",
"... | Compute the lexicographically next bit permutation.
Suppose we have a pattern of N bits set to 1 in an integer and we want the next permutation of
N 1 bits in a lexicographical sense. For example, if N is 3 and the bit pattern is 00010011,
the next patterns would be 00010101, 00010110, 00011001,00011010, 00011100, 00100011, and so
forth. | [
"Compute",
"the",
"lexicographically",
"next",
"bit",
"permutation",
"."
] | 2c36342add73aab1223292d12fcff453aa3c07cd | https://github.com/Waxolunist/bittwiddling/blob/2c36342add73aab1223292d12fcff453aa3c07cd/src/main/java/com/vcollaborate/bitwise/BinaryUtils.java#L69-L72 | train |
Waxolunist/bittwiddling | src/main/java/com/vcollaborate/bitwise/BinaryUtils.java | BinaryUtils.getBitsSet | public static final int[] getBitsSet(final long val) {
long tmp = val;
int[] retVal = new int[Long.bitCount(val)];
for (int i = 0; i < retVal.length; i++) {
retVal[i] = Long.numberOfTrailingZeros(tmp);
tmp = tmp ^ Long.lowestOneBit(tmp);
}
return retVal;
} | java | public static final int[] getBitsSet(final long val) {
long tmp = val;
int[] retVal = new int[Long.bitCount(val)];
for (int i = 0; i < retVal.length; i++) {
retVal[i] = Long.numberOfTrailingZeros(tmp);
tmp = tmp ^ Long.lowestOneBit(tmp);
}
return retVal;
} | [
"public",
"static",
"final",
"int",
"[",
"]",
"getBitsSet",
"(",
"final",
"long",
"val",
")",
"{",
"long",
"tmp",
"=",
"val",
";",
"int",
"[",
"]",
"retVal",
"=",
"new",
"int",
"[",
"Long",
".",
"bitCount",
"(",
"val",
")",
"]",
";",
"for",
"(",
... | Returns the number of bits set. | [
"Returns",
"the",
"number",
"of",
"bits",
"set",
"."
] | 2c36342add73aab1223292d12fcff453aa3c07cd | https://github.com/Waxolunist/bittwiddling/blob/2c36342add73aab1223292d12fcff453aa3c07cd/src/main/java/com/vcollaborate/bitwise/BinaryUtils.java#L115-L123 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/util/sort/support/MergeSort.java | MergeSort.sort | @Override
@SuppressWarnings("unchecked")
public <E> E[] sort(final E... elements) {
return (E[]) sort(new SortableArrayList(elements)).toArray(
(E[]) Array.newInstance(elements.getClass().getComponentType(), elements.length));
} | java | @Override
@SuppressWarnings("unchecked")
public <E> E[] sort(final E... elements) {
return (E[]) sort(new SortableArrayList(elements)).toArray(
(E[]) Array.newInstance(elements.getClass().getComponentType(), elements.length));
} | [
"@",
"Override",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"E",
">",
"E",
"[",
"]",
"sort",
"(",
"final",
"E",
"...",
"elements",
")",
"{",
"return",
"(",
"E",
"[",
"]",
")",
"sort",
"(",
"new",
"SortableArrayList",
"(",
"ele... | Uses the 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 #sort(java.util.List)
@see org.cp.elements.util.sort.AbstractSorter.SortableArrayList | [
"Uses",
"the",
"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",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/sort/support/MergeSort.java#L49-L54 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/util/sort/support/MergeSort.java | MergeSort.sort | @Override
public <E> List<E> sort(final List<E> elements) {
if (elements.size() > 1) {
int size = elements.size();
int count = ((size / 2) + (size % 2));
List<E> leftElements = sort(elements.subList(0, count));
List<E> rightElements = sort(elements.subList(count, size));
return merge(leftElements, rightElements);
}
return elements;
} | java | @Override
public <E> List<E> sort(final List<E> elements) {
if (elements.size() > 1) {
int size = elements.size();
int count = ((size / 2) + (size % 2));
List<E> leftElements = sort(elements.subList(0, count));
List<E> rightElements = sort(elements.subList(count, size));
return merge(leftElements, rightElements);
}
return elements;
} | [
"@",
"Override",
"public",
"<",
"E",
">",
"List",
"<",
"E",
">",
"sort",
"(",
"final",
"List",
"<",
"E",
">",
"elements",
")",
"{",
"if",
"(",
"elements",
".",
"size",
"(",
")",
">",
"1",
")",
"{",
"int",
"size",
"=",
"elements",
".",
"size",
... | Uses the 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 java.util.List | [
"Uses",
"the",
"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",
... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/sort/support/MergeSort.java#L65-L78 | train |
victims/victims-lib-java | src/main/java/com/redhat/victims/fingerprint/Metadata.java | Metadata.fromPomProperties | public static Metadata fromPomProperties(InputStream is) {
Metadata metadata = new Metadata();
BufferedReader input = new BufferedReader(new InputStreamReader(is));
try {
String line;
while ((line = input.readLine()) != null) {
if (line.startsWith("#"))
continue;
String[] property = line.trim().split("=");
if (property.length == 2)
metadata.put(property[0], property[1]);
}
} catch (IOException e) {
// Problems? Too bad!
}
return metadata;
} | java | public static Metadata fromPomProperties(InputStream is) {
Metadata metadata = new Metadata();
BufferedReader input = new BufferedReader(new InputStreamReader(is));
try {
String line;
while ((line = input.readLine()) != null) {
if (line.startsWith("#"))
continue;
String[] property = line.trim().split("=");
if (property.length == 2)
metadata.put(property[0], property[1]);
}
} catch (IOException e) {
// Problems? Too bad!
}
return metadata;
} | [
"public",
"static",
"Metadata",
"fromPomProperties",
"(",
"InputStream",
"is",
")",
"{",
"Metadata",
"metadata",
"=",
"new",
"Metadata",
"(",
")",
";",
"BufferedReader",
"input",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"is",
")",
")... | Attempts to parse a pom.xml file.
@param is
An input stream containing the extracted POM file. | [
"Attempts",
"to",
"parse",
"a",
"pom",
".",
"xml",
"file",
"."
] | ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b | https://github.com/victims/victims-lib-java/blob/ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b/src/main/java/com/redhat/victims/fingerprint/Metadata.java#L46-L62 | train |
victims/victims-lib-java | src/main/java/com/redhat/victims/fingerprint/Metadata.java | Metadata.fromManifest | public static Metadata fromManifest(InputStream is) {
try {
Manifest mf = new Manifest(is);
return fromManifest(mf);
} catch (IOException e) {
// Problems? Too bad!
}
return new Metadata();
} | java | public static Metadata fromManifest(InputStream is) {
try {
Manifest mf = new Manifest(is);
return fromManifest(mf);
} catch (IOException e) {
// Problems? Too bad!
}
return new Metadata();
} | [
"public",
"static",
"Metadata",
"fromManifest",
"(",
"InputStream",
"is",
")",
"{",
"try",
"{",
"Manifest",
"mf",
"=",
"new",
"Manifest",
"(",
"is",
")",
";",
"return",
"fromManifest",
"(",
"mf",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{... | Attempts to parse a MANIFEST.MF file from an input stream.
@param is
An input stream containing the extracted manifest file.
@return HashMap of the type {atribute name : attribute value}. | [
"Attempts",
"to",
"parse",
"a",
"MANIFEST",
".",
"MF",
"file",
"from",
"an",
"input",
"stream",
"."
] | ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b | https://github.com/victims/victims-lib-java/blob/ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b/src/main/java/com/redhat/victims/fingerprint/Metadata.java#L72-L81 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/af_persistant_stat_info.java | af_persistant_stat_info.get_filtered | public static af_persistant_stat_info[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception
{
af_persistant_stat_info obj = new af_persistant_stat_info();
options option = new options();
option.set_filter(filter);
af_persistant_stat_info[] response = (af_persistant_stat_info[]) obj.getfiltered(service, option);
return response;
} | java | public static af_persistant_stat_info[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception
{
af_persistant_stat_info obj = new af_persistant_stat_info();
options option = new options();
option.set_filter(filter);
af_persistant_stat_info[] response = (af_persistant_stat_info[]) obj.getfiltered(service, option);
return response;
} | [
"public",
"static",
"af_persistant_stat_info",
"[",
"]",
"get_filtered",
"(",
"nitro_service",
"service",
",",
"filtervalue",
"[",
"]",
"filter",
")",
"throws",
"Exception",
"{",
"af_persistant_stat_info",
"obj",
"=",
"new",
"af_persistant_stat_info",
"(",
")",
";",... | Use this API to fetch filtered set of af_persistant_stat_info resources.
set the filter parameter values in filtervalue object. | [
"Use",
"this",
"API",
"to",
"fetch",
"filtered",
"set",
"of",
"af_persistant_stat_info",
"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/af_persistant_stat_info.java#L177-L184 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/data/caching/support/CachingTemplate.java | CachingTemplate.withCaching | @SuppressWarnings("unchecked")
public <T extends VALUE> T withCaching(KEY key, Supplier<VALUE> cacheableOperation) {
Assert.notNull(key, "Key is required");
Assert.notNull(cacheableOperation, "Supplier is required");
ReadWriteLock lock = getLock();
return (T) Optional.ofNullable(read(lock, key)).orElseGet(() ->
Optional.ofNullable(cacheableOperation.get())
.map(value -> write(lock, key, value))
.orElse(null));
} | java | @SuppressWarnings("unchecked")
public <T extends VALUE> T withCaching(KEY key, Supplier<VALUE> cacheableOperation) {
Assert.notNull(key, "Key is required");
Assert.notNull(cacheableOperation, "Supplier is required");
ReadWriteLock lock = getLock();
return (T) Optional.ofNullable(read(lock, key)).orElseGet(() ->
Optional.ofNullable(cacheableOperation.get())
.map(value -> write(lock, key, value))
.orElse(null));
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
"extends",
"VALUE",
">",
"T",
"withCaching",
"(",
"KEY",
"key",
",",
"Supplier",
"<",
"VALUE",
">",
"cacheableOperation",
")",
"{",
"Assert",
".",
"notNull",
"(",
"key",
",",
"\"Key is... | Implementation of the look-aside cache pattern.
This caching data access operation first attempts to locate an entry in the {@link Cache}
with the given {@link KEY key}, returning the {@link VALUE value} of the entry if present.
If an entry with the given {@link KEY key} is not present in the {@link Cache} then the supplied
{@link Supplier cacheable operation} is invoked to compute or load a {@link VALUE value}
and put into the {@link Cache} as an entry mapped by the given {@link KEY key}; this operation
completes by returning the {@link VALUE result} of the {@link Supplier cacheable operation}.
@param <T> {@link Class type} of the return {@link VALUE value}.
@param key {@link KEY key} used to identify the {@link Cache} entry containing the {@link VALUE} to lookup.
@param cacheableOperation {@link Supplier} used to compute or load a {@link VALUE value}
for given {@link KEY key} if the cacheable data access operation initially results in a cache miss.
@return the cached {@link VALUE value} for the given {@link KEY key} in the {@link Cache} if present,
or returns the {@link VALUE value} supplied by invoking the {@link Supplier cacheable operation}.
@throws IllegalArgumentException if either the {@link KEY key} or the {@link Supplier} are {@literal null}.
@see java.util.function.Supplier
@see #getCache()
@see #getLock() | [
"Implementation",
"of",
"the",
"look",
"-",
"aside",
"cache",
"pattern",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/data/caching/support/CachingTemplate.java#L265-L277 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/syslog_server.java | syslog_server.get_filtered | public static syslog_server[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception
{
syslog_server obj = new syslog_server();
options option = new options();
option.set_filter(filter);
syslog_server[] response = (syslog_server[]) obj.getfiltered(service, option);
return response;
} | java | public static syslog_server[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception
{
syslog_server obj = new syslog_server();
options option = new options();
option.set_filter(filter);
syslog_server[] response = (syslog_server[]) obj.getfiltered(service, option);
return response;
} | [
"public",
"static",
"syslog_server",
"[",
"]",
"get_filtered",
"(",
"nitro_service",
"service",
",",
"filtervalue",
"[",
"]",
"filter",
")",
"throws",
"Exception",
"{",
"syslog_server",
"obj",
"=",
"new",
"syslog_server",
"(",
")",
";",
"options",
"option",
"=... | Use this API to fetch filtered set of syslog_server resources.
set the filter parameter values in filtervalue object. | [
"Use",
"this",
"API",
"to",
"fetch",
"filtered",
"set",
"of",
"syslog_server",
"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/syslog_server.java#L469-L476 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/base/Json.java | Json.string_to_resource | public Object string_to_resource(Class<?> responseClass, String response)
{
try
{
Gson gson = new Gson();
return gson.fromJson(response, responseClass);
}catch(Exception e)
{
System.out.println(e.getMessage());
}
return null;
} | java | public Object string_to_resource(Class<?> responseClass, String response)
{
try
{
Gson gson = new Gson();
return gson.fromJson(response, responseClass);
}catch(Exception e)
{
System.out.println(e.getMessage());
}
return null;
} | [
"public",
"Object",
"string_to_resource",
"(",
"Class",
"<",
"?",
">",
"responseClass",
",",
"String",
"response",
")",
"{",
"try",
"{",
"Gson",
"gson",
"=",
"new",
"Gson",
"(",
")",
";",
"return",
"gson",
".",
"fromJson",
"(",
"response",
",",
"response... | Converts Json string to NetScaler SDX resource.
@param responseClass Type of the class to which the string has to be converted to.
@param response input string.
@return returns API resource object. | [
"Converts",
"Json",
"string",
"to",
"NetScaler",
"SDX",
"resource",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/base/Json.java#L44-L56 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.