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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
meertensinstituut/mtas | src/main/java/mtas/solr/handler/util/MtasSolrStatus.java | MtasSolrStatus.checkResponseForException | public boolean checkResponseForException() {
if (!finished && rsp != null) {
Exception e;
if ((e = rsp.getException()) != null) {
setError(e.getMessage());
setFinished();
return true;
}
}
return false;
} | java | public boolean checkResponseForException() {
if (!finished && rsp != null) {
Exception e;
if ((e = rsp.getException()) != null) {
setError(e.getMessage());
setFinished();
return true;
}
}
return false;
} | [
"public",
"boolean",
"checkResponseForException",
"(",
")",
"{",
"if",
"(",
"!",
"finished",
"&&",
"rsp",
"!=",
"null",
")",
"{",
"Exception",
"e",
";",
"if",
"(",
"(",
"e",
"=",
"rsp",
".",
"getException",
"(",
")",
")",
"!=",
"null",
")",
"{",
"setError",
"(",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"setFinished",
"(",
")",
";",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] | Check response on exception.
@return true, if successful | [
"Check",
"response",
"on",
"exception",
"."
] | f02ae730848616bd88b553efa7f9eddc32818e64 | https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/solr/handler/util/MtasSolrStatus.java#L434-L444 | train |
meertensinstituut/mtas | src/main/java/mtas/solr/handler/util/MtasSolrStatus.java | MtasSolrStatus.createOutput | private SimpleOrderedMap<Object> createOutput(boolean detailed) {
// checkResponseOnException();
SimpleOrderedMap<Object> output = new SimpleOrderedMap<>();
updateShardInfo();
output.add(NAME_KEY, key);
output.add(NAME_REQUEST, request);
if (errorStatus) {
output.add(NAME_ERROR, errorMessage);
}
if (abortStatus) {
output.add(NAME_ABORT, abortMessage);
}
output.add(NAME_FINISHED, finished);
if (totalTime != null) {
output.add(NAME_TIME_TOTAL, totalTime);
}
output.add(NAME_TIME_START, (new Date(startTime)).toString());
output.add(NAME_SHARDREQUEST, shardRequest);
if (shardNumberTotal > 0) {
if (detailed) {
output.add(NAME_STATUS_DISTRIBUTED, createShardsOutput());
} else {
output.add(NAME_STATUS_DISTRIBUTED, true);
}
} else if (detailed) {
output.add(NAME_STATUS_DISTRIBUTED, false);
}
if (status.numberSegmentsTotal != null) {
output.add(NAME_STATUS_SEGMENT_NUMBER_TOTAL, status.numberSegmentsTotal);
output.add(NAME_STATUS_SEGMENT_NUMBER_FINISHED, status.numberSegmentsFinished);
if (!status.subNumberSegmentsFinished.isEmpty()) {
output.add(NAME_STATUS_SEGMENT_SUB_NUMBER_FINISHED, status.subNumberSegmentsFinished);
output.add(NAME_STATUS_SEGMENT_SUB_NUMBER_TOTAL, status.subNumberSegmentsTotal);
output.add(NAME_STATUS_SEGMENT_SUB_NUMBER_FINISHED_TOTAL, status.subNumberSegmentsFinishedTotal);
}
}
if (status.numberDocumentsTotal != null) {
output.add(NAME_STATUS_DOCUMENT_NUMBER_TOTAL, status.numberDocumentsTotal);
output.add(NAME_STATUS_DOCUMENT_NUMBER_FOUND, status.numberDocumentsFound);
output.add(NAME_STATUS_DOCUMENT_NUMBER_FINISHED, status.numberDocumentsFinished);
if (!status.subNumberDocumentsFinished.isEmpty()) {
output.add(NAME_STATUS_DOCUMENT_SUB_NUMBER_FINISHED, status.subNumberDocumentsFinished);
output.add(NAME_STATUS_DOCUMENT_SUB_NUMBER_TOTAL, status.subNumberDocumentsTotal);
output.add(NAME_STATUS_DOCUMENT_SUB_NUMBER_FINISHED_TOTAL, status.subNumberDocumentsFinishedTotal);
}
}
return output;
} | java | private SimpleOrderedMap<Object> createOutput(boolean detailed) {
// checkResponseOnException();
SimpleOrderedMap<Object> output = new SimpleOrderedMap<>();
updateShardInfo();
output.add(NAME_KEY, key);
output.add(NAME_REQUEST, request);
if (errorStatus) {
output.add(NAME_ERROR, errorMessage);
}
if (abortStatus) {
output.add(NAME_ABORT, abortMessage);
}
output.add(NAME_FINISHED, finished);
if (totalTime != null) {
output.add(NAME_TIME_TOTAL, totalTime);
}
output.add(NAME_TIME_START, (new Date(startTime)).toString());
output.add(NAME_SHARDREQUEST, shardRequest);
if (shardNumberTotal > 0) {
if (detailed) {
output.add(NAME_STATUS_DISTRIBUTED, createShardsOutput());
} else {
output.add(NAME_STATUS_DISTRIBUTED, true);
}
} else if (detailed) {
output.add(NAME_STATUS_DISTRIBUTED, false);
}
if (status.numberSegmentsTotal != null) {
output.add(NAME_STATUS_SEGMENT_NUMBER_TOTAL, status.numberSegmentsTotal);
output.add(NAME_STATUS_SEGMENT_NUMBER_FINISHED, status.numberSegmentsFinished);
if (!status.subNumberSegmentsFinished.isEmpty()) {
output.add(NAME_STATUS_SEGMENT_SUB_NUMBER_FINISHED, status.subNumberSegmentsFinished);
output.add(NAME_STATUS_SEGMENT_SUB_NUMBER_TOTAL, status.subNumberSegmentsTotal);
output.add(NAME_STATUS_SEGMENT_SUB_NUMBER_FINISHED_TOTAL, status.subNumberSegmentsFinishedTotal);
}
}
if (status.numberDocumentsTotal != null) {
output.add(NAME_STATUS_DOCUMENT_NUMBER_TOTAL, status.numberDocumentsTotal);
output.add(NAME_STATUS_DOCUMENT_NUMBER_FOUND, status.numberDocumentsFound);
output.add(NAME_STATUS_DOCUMENT_NUMBER_FINISHED, status.numberDocumentsFinished);
if (!status.subNumberDocumentsFinished.isEmpty()) {
output.add(NAME_STATUS_DOCUMENT_SUB_NUMBER_FINISHED, status.subNumberDocumentsFinished);
output.add(NAME_STATUS_DOCUMENT_SUB_NUMBER_TOTAL, status.subNumberDocumentsTotal);
output.add(NAME_STATUS_DOCUMENT_SUB_NUMBER_FINISHED_TOTAL, status.subNumberDocumentsFinishedTotal);
}
}
return output;
} | [
"private",
"SimpleOrderedMap",
"<",
"Object",
">",
"createOutput",
"(",
"boolean",
"detailed",
")",
"{",
"// checkResponseOnException();",
"SimpleOrderedMap",
"<",
"Object",
">",
"output",
"=",
"new",
"SimpleOrderedMap",
"<>",
"(",
")",
";",
"updateShardInfo",
"(",
")",
";",
"output",
".",
"add",
"(",
"NAME_KEY",
",",
"key",
")",
";",
"output",
".",
"add",
"(",
"NAME_REQUEST",
",",
"request",
")",
";",
"if",
"(",
"errorStatus",
")",
"{",
"output",
".",
"add",
"(",
"NAME_ERROR",
",",
"errorMessage",
")",
";",
"}",
"if",
"(",
"abortStatus",
")",
"{",
"output",
".",
"add",
"(",
"NAME_ABORT",
",",
"abortMessage",
")",
";",
"}",
"output",
".",
"add",
"(",
"NAME_FINISHED",
",",
"finished",
")",
";",
"if",
"(",
"totalTime",
"!=",
"null",
")",
"{",
"output",
".",
"add",
"(",
"NAME_TIME_TOTAL",
",",
"totalTime",
")",
";",
"}",
"output",
".",
"add",
"(",
"NAME_TIME_START",
",",
"(",
"new",
"Date",
"(",
"startTime",
")",
")",
".",
"toString",
"(",
")",
")",
";",
"output",
".",
"add",
"(",
"NAME_SHARDREQUEST",
",",
"shardRequest",
")",
";",
"if",
"(",
"shardNumberTotal",
">",
"0",
")",
"{",
"if",
"(",
"detailed",
")",
"{",
"output",
".",
"add",
"(",
"NAME_STATUS_DISTRIBUTED",
",",
"createShardsOutput",
"(",
")",
")",
";",
"}",
"else",
"{",
"output",
".",
"add",
"(",
"NAME_STATUS_DISTRIBUTED",
",",
"true",
")",
";",
"}",
"}",
"else",
"if",
"(",
"detailed",
")",
"{",
"output",
".",
"add",
"(",
"NAME_STATUS_DISTRIBUTED",
",",
"false",
")",
";",
"}",
"if",
"(",
"status",
".",
"numberSegmentsTotal",
"!=",
"null",
")",
"{",
"output",
".",
"add",
"(",
"NAME_STATUS_SEGMENT_NUMBER_TOTAL",
",",
"status",
".",
"numberSegmentsTotal",
")",
";",
"output",
".",
"add",
"(",
"NAME_STATUS_SEGMENT_NUMBER_FINISHED",
",",
"status",
".",
"numberSegmentsFinished",
")",
";",
"if",
"(",
"!",
"status",
".",
"subNumberSegmentsFinished",
".",
"isEmpty",
"(",
")",
")",
"{",
"output",
".",
"add",
"(",
"NAME_STATUS_SEGMENT_SUB_NUMBER_FINISHED",
",",
"status",
".",
"subNumberSegmentsFinished",
")",
";",
"output",
".",
"add",
"(",
"NAME_STATUS_SEGMENT_SUB_NUMBER_TOTAL",
",",
"status",
".",
"subNumberSegmentsTotal",
")",
";",
"output",
".",
"add",
"(",
"NAME_STATUS_SEGMENT_SUB_NUMBER_FINISHED_TOTAL",
",",
"status",
".",
"subNumberSegmentsFinishedTotal",
")",
";",
"}",
"}",
"if",
"(",
"status",
".",
"numberDocumentsTotal",
"!=",
"null",
")",
"{",
"output",
".",
"add",
"(",
"NAME_STATUS_DOCUMENT_NUMBER_TOTAL",
",",
"status",
".",
"numberDocumentsTotal",
")",
";",
"output",
".",
"add",
"(",
"NAME_STATUS_DOCUMENT_NUMBER_FOUND",
",",
"status",
".",
"numberDocumentsFound",
")",
";",
"output",
".",
"add",
"(",
"NAME_STATUS_DOCUMENT_NUMBER_FINISHED",
",",
"status",
".",
"numberDocumentsFinished",
")",
";",
"if",
"(",
"!",
"status",
".",
"subNumberDocumentsFinished",
".",
"isEmpty",
"(",
")",
")",
"{",
"output",
".",
"add",
"(",
"NAME_STATUS_DOCUMENT_SUB_NUMBER_FINISHED",
",",
"status",
".",
"subNumberDocumentsFinished",
")",
";",
"output",
".",
"add",
"(",
"NAME_STATUS_DOCUMENT_SUB_NUMBER_TOTAL",
",",
"status",
".",
"subNumberDocumentsTotal",
")",
";",
"output",
".",
"add",
"(",
"NAME_STATUS_DOCUMENT_SUB_NUMBER_FINISHED_TOTAL",
",",
"status",
".",
"subNumberDocumentsFinishedTotal",
")",
";",
"}",
"}",
"return",
"output",
";",
"}"
] | Creates the output.
@param detailed the detailed
@return the simple ordered map | [
"Creates",
"the",
"output",
"."
] | f02ae730848616bd88b553efa7f9eddc32818e64 | https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/solr/handler/util/MtasSolrStatus.java#L470-L517 | train |
meertensinstituut/mtas | src/main/java/mtas/solr/handler/util/MtasSolrStatus.java | MtasSolrStatus.createShardsOutput | private final SimpleOrderedMap<Object> createShardsOutput() {
SimpleOrderedMap<Object> output = new SimpleOrderedMap<>();
if (shardStageStatus != null && !shardStageStatus.isEmpty()) {
List<SimpleOrderedMap<Object>> list = new ArrayList<>();
for (StageStatus stageStatus : shardStageStatus.values()) {
list.add(stageStatus.createOutput());
}
output.add(NAME_STATUS_STAGES, list);
}
if (shards != null && !shards.isEmpty()) {
List<SimpleOrderedMap<Object>> list = new ArrayList<>();
for (ShardStatus shardStatus : shards.values()) {
list.add(shardStatus.createOutput());
}
output.add(NAME_STATUS_SHARDS, list);
}
return output;
} | java | private final SimpleOrderedMap<Object> createShardsOutput() {
SimpleOrderedMap<Object> output = new SimpleOrderedMap<>();
if (shardStageStatus != null && !shardStageStatus.isEmpty()) {
List<SimpleOrderedMap<Object>> list = new ArrayList<>();
for (StageStatus stageStatus : shardStageStatus.values()) {
list.add(stageStatus.createOutput());
}
output.add(NAME_STATUS_STAGES, list);
}
if (shards != null && !shards.isEmpty()) {
List<SimpleOrderedMap<Object>> list = new ArrayList<>();
for (ShardStatus shardStatus : shards.values()) {
list.add(shardStatus.createOutput());
}
output.add(NAME_STATUS_SHARDS, list);
}
return output;
} | [
"private",
"final",
"SimpleOrderedMap",
"<",
"Object",
">",
"createShardsOutput",
"(",
")",
"{",
"SimpleOrderedMap",
"<",
"Object",
">",
"output",
"=",
"new",
"SimpleOrderedMap",
"<>",
"(",
")",
";",
"if",
"(",
"shardStageStatus",
"!=",
"null",
"&&",
"!",
"shardStageStatus",
".",
"isEmpty",
"(",
")",
")",
"{",
"List",
"<",
"SimpleOrderedMap",
"<",
"Object",
">>",
"list",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"StageStatus",
"stageStatus",
":",
"shardStageStatus",
".",
"values",
"(",
")",
")",
"{",
"list",
".",
"add",
"(",
"stageStatus",
".",
"createOutput",
"(",
")",
")",
";",
"}",
"output",
".",
"add",
"(",
"NAME_STATUS_STAGES",
",",
"list",
")",
";",
"}",
"if",
"(",
"shards",
"!=",
"null",
"&&",
"!",
"shards",
".",
"isEmpty",
"(",
")",
")",
"{",
"List",
"<",
"SimpleOrderedMap",
"<",
"Object",
">>",
"list",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"ShardStatus",
"shardStatus",
":",
"shards",
".",
"values",
"(",
")",
")",
"{",
"list",
".",
"add",
"(",
"shardStatus",
".",
"createOutput",
"(",
")",
")",
";",
"}",
"output",
".",
"add",
"(",
"NAME_STATUS_SHARDS",
",",
"list",
")",
";",
"}",
"return",
"output",
";",
"}"
] | Creates the shards output.
@return the simple ordered map | [
"Creates",
"the",
"shards",
"output",
"."
] | f02ae730848616bd88b553efa7f9eddc32818e64 | https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/solr/handler/util/MtasSolrStatus.java#L524-L541 | train |
meertensinstituut/mtas | src/main/java/mtas/solr/handler/util/MtasSolrStatus.java | MtasSolrStatus.getInteger | private final Integer getInteger(NamedList<Object> response, String... args) {
Object objectItem = response.findRecursive(args);
if (objectItem != null && objectItem instanceof Integer) {
return (Integer) objectItem;
} else {
return null;
}
} | java | private final Integer getInteger(NamedList<Object> response, String... args) {
Object objectItem = response.findRecursive(args);
if (objectItem != null && objectItem instanceof Integer) {
return (Integer) objectItem;
} else {
return null;
}
} | [
"private",
"final",
"Integer",
"getInteger",
"(",
"NamedList",
"<",
"Object",
">",
"response",
",",
"String",
"...",
"args",
")",
"{",
"Object",
"objectItem",
"=",
"response",
".",
"findRecursive",
"(",
"args",
")",
";",
"if",
"(",
"objectItem",
"!=",
"null",
"&&",
"objectItem",
"instanceof",
"Integer",
")",
"{",
"return",
"(",
"Integer",
")",
"objectItem",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}"
] | Gets the integer.
@param response
the response
@param args
the args
@return the integer | [
"Gets",
"the",
"integer",
"."
] | f02ae730848616bd88b553efa7f9eddc32818e64 | https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/solr/handler/util/MtasSolrStatus.java#L552-L559 | train |
meertensinstituut/mtas | src/main/java/mtas/solr/handler/util/MtasSolrStatus.java | MtasSolrStatus.getIntegerMap | private final Map<String, Integer> getIntegerMap(NamedList<Object> response, String... args) {
Object objectItem = response.findRecursive(args);
Map<String, Integer> result = null;
if (objectItem != null && objectItem instanceof Map) {
result = (Map) objectItem;
}
return result;
} | java | private final Map<String, Integer> getIntegerMap(NamedList<Object> response, String... args) {
Object objectItem = response.findRecursive(args);
Map<String, Integer> result = null;
if (objectItem != null && objectItem instanceof Map) {
result = (Map) objectItem;
}
return result;
} | [
"private",
"final",
"Map",
"<",
"String",
",",
"Integer",
">",
"getIntegerMap",
"(",
"NamedList",
"<",
"Object",
">",
"response",
",",
"String",
"...",
"args",
")",
"{",
"Object",
"objectItem",
"=",
"response",
".",
"findRecursive",
"(",
"args",
")",
";",
"Map",
"<",
"String",
",",
"Integer",
">",
"result",
"=",
"null",
";",
"if",
"(",
"objectItem",
"!=",
"null",
"&&",
"objectItem",
"instanceof",
"Map",
")",
"{",
"result",
"=",
"(",
"Map",
")",
"objectItem",
";",
"}",
"return",
"result",
";",
"}"
] | Gets the integer map.
@param response
the response
@param args
the args
@return the integer map | [
"Gets",
"the",
"integer",
"map",
"."
] | f02ae730848616bd88b553efa7f9eddc32818e64 | https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/solr/handler/util/MtasSolrStatus.java#L570-L577 | train |
meertensinstituut/mtas | src/main/java/mtas/solr/handler/util/MtasSolrStatus.java | MtasSolrStatus.getLong | private final Long getLong(NamedList<Object> response, String... args) {
Object objectItem = response.findRecursive(args);
if (objectItem != null && objectItem instanceof Long) {
return (Long) objectItem;
} else {
return null;
}
} | java | private final Long getLong(NamedList<Object> response, String... args) {
Object objectItem = response.findRecursive(args);
if (objectItem != null && objectItem instanceof Long) {
return (Long) objectItem;
} else {
return null;
}
} | [
"private",
"final",
"Long",
"getLong",
"(",
"NamedList",
"<",
"Object",
">",
"response",
",",
"String",
"...",
"args",
")",
"{",
"Object",
"objectItem",
"=",
"response",
".",
"findRecursive",
"(",
"args",
")",
";",
"if",
"(",
"objectItem",
"!=",
"null",
"&&",
"objectItem",
"instanceof",
"Long",
")",
"{",
"return",
"(",
"Long",
")",
"objectItem",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}"
] | Gets the long.
@param response
the response
@param args
the args
@return the long | [
"Gets",
"the",
"long",
"."
] | f02ae730848616bd88b553efa7f9eddc32818e64 | https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/solr/handler/util/MtasSolrStatus.java#L588-L595 | train |
meertensinstituut/mtas | src/main/java/mtas/solr/handler/util/MtasSolrStatus.java | MtasSolrStatus.getLongMap | private final Map<String, Long> getLongMap(NamedList<Object> response, String... args) {
Object objectItem = response.findRecursive(args);
if (objectItem != null && objectItem instanceof Map) {
return (Map) objectItem;
} else {
return null;
}
} | java | private final Map<String, Long> getLongMap(NamedList<Object> response, String... args) {
Object objectItem = response.findRecursive(args);
if (objectItem != null && objectItem instanceof Map) {
return (Map) objectItem;
} else {
return null;
}
} | [
"private",
"final",
"Map",
"<",
"String",
",",
"Long",
">",
"getLongMap",
"(",
"NamedList",
"<",
"Object",
">",
"response",
",",
"String",
"...",
"args",
")",
"{",
"Object",
"objectItem",
"=",
"response",
".",
"findRecursive",
"(",
"args",
")",
";",
"if",
"(",
"objectItem",
"!=",
"null",
"&&",
"objectItem",
"instanceof",
"Map",
")",
"{",
"return",
"(",
"Map",
")",
"objectItem",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}"
] | Gets the long map.
@param response
the response
@param args
the args
@return the long map | [
"Gets",
"the",
"long",
"map",
"."
] | f02ae730848616bd88b553efa7f9eddc32818e64 | https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/solr/handler/util/MtasSolrStatus.java#L606-L613 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnformssoaction.java | vpnformssoaction.add | public static base_response add(nitro_service client, vpnformssoaction resource) throws Exception {
vpnformssoaction addresource = new vpnformssoaction();
addresource.name = resource.name;
addresource.actionurl = resource.actionurl;
addresource.userfield = resource.userfield;
addresource.passwdfield = resource.passwdfield;
addresource.ssosuccessrule = resource.ssosuccessrule;
addresource.namevaluepair = resource.namevaluepair;
addresource.responsesize = resource.responsesize;
addresource.nvtype = resource.nvtype;
addresource.submitmethod = resource.submitmethod;
return addresource.add_resource(client);
} | java | public static base_response add(nitro_service client, vpnformssoaction resource) throws Exception {
vpnformssoaction addresource = new vpnformssoaction();
addresource.name = resource.name;
addresource.actionurl = resource.actionurl;
addresource.userfield = resource.userfield;
addresource.passwdfield = resource.passwdfield;
addresource.ssosuccessrule = resource.ssosuccessrule;
addresource.namevaluepair = resource.namevaluepair;
addresource.responsesize = resource.responsesize;
addresource.nvtype = resource.nvtype;
addresource.submitmethod = resource.submitmethod;
return addresource.add_resource(client);
} | [
"public",
"static",
"base_response",
"add",
"(",
"nitro_service",
"client",
",",
"vpnformssoaction",
"resource",
")",
"throws",
"Exception",
"{",
"vpnformssoaction",
"addresource",
"=",
"new",
"vpnformssoaction",
"(",
")",
";",
"addresource",
".",
"name",
"=",
"resource",
".",
"name",
";",
"addresource",
".",
"actionurl",
"=",
"resource",
".",
"actionurl",
";",
"addresource",
".",
"userfield",
"=",
"resource",
".",
"userfield",
";",
"addresource",
".",
"passwdfield",
"=",
"resource",
".",
"passwdfield",
";",
"addresource",
".",
"ssosuccessrule",
"=",
"resource",
".",
"ssosuccessrule",
";",
"addresource",
".",
"namevaluepair",
"=",
"resource",
".",
"namevaluepair",
";",
"addresource",
".",
"responsesize",
"=",
"resource",
".",
"responsesize",
";",
"addresource",
".",
"nvtype",
"=",
"resource",
".",
"nvtype",
";",
"addresource",
".",
"submitmethod",
"=",
"resource",
".",
"submitmethod",
";",
"return",
"addresource",
".",
"add_resource",
"(",
"client",
")",
";",
"}"
] | Use this API to add vpnformssoaction. | [
"Use",
"this",
"API",
"to",
"add",
"vpnformssoaction",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnformssoaction.java#L258-L270 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnformssoaction.java | vpnformssoaction.update | public static base_response update(nitro_service client, vpnformssoaction resource) throws Exception {
vpnformssoaction updateresource = new vpnformssoaction();
updateresource.name = resource.name;
updateresource.actionurl = resource.actionurl;
updateresource.userfield = resource.userfield;
updateresource.passwdfield = resource.passwdfield;
updateresource.ssosuccessrule = resource.ssosuccessrule;
updateresource.responsesize = resource.responsesize;
updateresource.namevaluepair = resource.namevaluepair;
updateresource.nvtype = resource.nvtype;
updateresource.submitmethod = resource.submitmethod;
return updateresource.update_resource(client);
} | java | public static base_response update(nitro_service client, vpnformssoaction resource) throws Exception {
vpnformssoaction updateresource = new vpnformssoaction();
updateresource.name = resource.name;
updateresource.actionurl = resource.actionurl;
updateresource.userfield = resource.userfield;
updateresource.passwdfield = resource.passwdfield;
updateresource.ssosuccessrule = resource.ssosuccessrule;
updateresource.responsesize = resource.responsesize;
updateresource.namevaluepair = resource.namevaluepair;
updateresource.nvtype = resource.nvtype;
updateresource.submitmethod = resource.submitmethod;
return updateresource.update_resource(client);
} | [
"public",
"static",
"base_response",
"update",
"(",
"nitro_service",
"client",
",",
"vpnformssoaction",
"resource",
")",
"throws",
"Exception",
"{",
"vpnformssoaction",
"updateresource",
"=",
"new",
"vpnformssoaction",
"(",
")",
";",
"updateresource",
".",
"name",
"=",
"resource",
".",
"name",
";",
"updateresource",
".",
"actionurl",
"=",
"resource",
".",
"actionurl",
";",
"updateresource",
".",
"userfield",
"=",
"resource",
".",
"userfield",
";",
"updateresource",
".",
"passwdfield",
"=",
"resource",
".",
"passwdfield",
";",
"updateresource",
".",
"ssosuccessrule",
"=",
"resource",
".",
"ssosuccessrule",
";",
"updateresource",
".",
"responsesize",
"=",
"resource",
".",
"responsesize",
";",
"updateresource",
".",
"namevaluepair",
"=",
"resource",
".",
"namevaluepair",
";",
"updateresource",
".",
"nvtype",
"=",
"resource",
".",
"nvtype",
";",
"updateresource",
".",
"submitmethod",
"=",
"resource",
".",
"submitmethod",
";",
"return",
"updateresource",
".",
"update_resource",
"(",
"client",
")",
";",
"}"
] | Use this API to update vpnformssoaction. | [
"Use",
"this",
"API",
"to",
"update",
"vpnformssoaction",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnformssoaction.java#L349-L361 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnformssoaction.java | vpnformssoaction.update | public static base_responses update(nitro_service client, vpnformssoaction resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
vpnformssoaction updateresources[] = new vpnformssoaction[resources.length];
for (int i=0;i<resources.length;i++){
updateresources[i] = new vpnformssoaction();
updateresources[i].name = resources[i].name;
updateresources[i].actionurl = resources[i].actionurl;
updateresources[i].userfield = resources[i].userfield;
updateresources[i].passwdfield = resources[i].passwdfield;
updateresources[i].ssosuccessrule = resources[i].ssosuccessrule;
updateresources[i].responsesize = resources[i].responsesize;
updateresources[i].namevaluepair = resources[i].namevaluepair;
updateresources[i].nvtype = resources[i].nvtype;
updateresources[i].submitmethod = resources[i].submitmethod;
}
result = update_bulk_request(client, updateresources);
}
return result;
} | java | public static base_responses update(nitro_service client, vpnformssoaction resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
vpnformssoaction updateresources[] = new vpnformssoaction[resources.length];
for (int i=0;i<resources.length;i++){
updateresources[i] = new vpnformssoaction();
updateresources[i].name = resources[i].name;
updateresources[i].actionurl = resources[i].actionurl;
updateresources[i].userfield = resources[i].userfield;
updateresources[i].passwdfield = resources[i].passwdfield;
updateresources[i].ssosuccessrule = resources[i].ssosuccessrule;
updateresources[i].responsesize = resources[i].responsesize;
updateresources[i].namevaluepair = resources[i].namevaluepair;
updateresources[i].nvtype = resources[i].nvtype;
updateresources[i].submitmethod = resources[i].submitmethod;
}
result = update_bulk_request(client, updateresources);
}
return result;
} | [
"public",
"static",
"base_responses",
"update",
"(",
"nitro_service",
"client",
",",
"vpnformssoaction",
"resources",
"[",
"]",
")",
"throws",
"Exception",
"{",
"base_responses",
"result",
"=",
"null",
";",
"if",
"(",
"resources",
"!=",
"null",
"&&",
"resources",
".",
"length",
">",
"0",
")",
"{",
"vpnformssoaction",
"updateresources",
"[",
"]",
"=",
"new",
"vpnformssoaction",
"[",
"resources",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"resources",
".",
"length",
";",
"i",
"++",
")",
"{",
"updateresources",
"[",
"i",
"]",
"=",
"new",
"vpnformssoaction",
"(",
")",
";",
"updateresources",
"[",
"i",
"]",
".",
"name",
"=",
"resources",
"[",
"i",
"]",
".",
"name",
";",
"updateresources",
"[",
"i",
"]",
".",
"actionurl",
"=",
"resources",
"[",
"i",
"]",
".",
"actionurl",
";",
"updateresources",
"[",
"i",
"]",
".",
"userfield",
"=",
"resources",
"[",
"i",
"]",
".",
"userfield",
";",
"updateresources",
"[",
"i",
"]",
".",
"passwdfield",
"=",
"resources",
"[",
"i",
"]",
".",
"passwdfield",
";",
"updateresources",
"[",
"i",
"]",
".",
"ssosuccessrule",
"=",
"resources",
"[",
"i",
"]",
".",
"ssosuccessrule",
";",
"updateresources",
"[",
"i",
"]",
".",
"responsesize",
"=",
"resources",
"[",
"i",
"]",
".",
"responsesize",
";",
"updateresources",
"[",
"i",
"]",
".",
"namevaluepair",
"=",
"resources",
"[",
"i",
"]",
".",
"namevaluepair",
";",
"updateresources",
"[",
"i",
"]",
".",
"nvtype",
"=",
"resources",
"[",
"i",
"]",
".",
"nvtype",
";",
"updateresources",
"[",
"i",
"]",
".",
"submitmethod",
"=",
"resources",
"[",
"i",
"]",
".",
"submitmethod",
";",
"}",
"result",
"=",
"update_bulk_request",
"(",
"client",
",",
"updateresources",
")",
";",
"}",
"return",
"result",
";",
"}"
] | Use this API to update vpnformssoaction resources. | [
"Use",
"this",
"API",
"to",
"update",
"vpnformssoaction",
"resources",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnformssoaction.java#L366-L385 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnformssoaction.java | vpnformssoaction.get | public static vpnformssoaction[] get(nitro_service service) throws Exception{
vpnformssoaction obj = new vpnformssoaction();
vpnformssoaction[] response = (vpnformssoaction[])obj.get_resources(service);
return response;
} | java | public static vpnformssoaction[] get(nitro_service service) throws Exception{
vpnformssoaction obj = new vpnformssoaction();
vpnformssoaction[] response = (vpnformssoaction[])obj.get_resources(service);
return response;
} | [
"public",
"static",
"vpnformssoaction",
"[",
"]",
"get",
"(",
"nitro_service",
"service",
")",
"throws",
"Exception",
"{",
"vpnformssoaction",
"obj",
"=",
"new",
"vpnformssoaction",
"(",
")",
";",
"vpnformssoaction",
"[",
"]",
"response",
"=",
"(",
"vpnformssoaction",
"[",
"]",
")",
"obj",
".",
"get_resources",
"(",
"service",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch all the vpnformssoaction resources that are configured on netscaler. | [
"Use",
"this",
"API",
"to",
"fetch",
"all",
"the",
"vpnformssoaction",
"resources",
"that",
"are",
"configured",
"on",
"netscaler",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnformssoaction.java#L434-L438 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnformssoaction.java | vpnformssoaction.get | public static vpnformssoaction get(nitro_service service, String name) throws Exception{
vpnformssoaction obj = new vpnformssoaction();
obj.set_name(name);
vpnformssoaction response = (vpnformssoaction) obj.get_resource(service);
return response;
} | java | public static vpnformssoaction get(nitro_service service, String name) throws Exception{
vpnformssoaction obj = new vpnformssoaction();
obj.set_name(name);
vpnformssoaction response = (vpnformssoaction) obj.get_resource(service);
return response;
} | [
"public",
"static",
"vpnformssoaction",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"vpnformssoaction",
"obj",
"=",
"new",
"vpnformssoaction",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
")",
";",
"vpnformssoaction",
"response",
"=",
"(",
"vpnformssoaction",
")",
"obj",
".",
"get_resource",
"(",
"service",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch vpnformssoaction resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"vpnformssoaction",
"resource",
"of",
"given",
"name",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnformssoaction.java#L450-L455 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/dns/dnsview_dnspolicy_binding.java | dnsview_dnspolicy_binding.get | public static dnsview_dnspolicy_binding[] get(nitro_service service, String viewname) throws Exception{
dnsview_dnspolicy_binding obj = new dnsview_dnspolicy_binding();
obj.set_viewname(viewname);
dnsview_dnspolicy_binding response[] = (dnsview_dnspolicy_binding[]) obj.get_resources(service);
return response;
} | java | public static dnsview_dnspolicy_binding[] get(nitro_service service, String viewname) throws Exception{
dnsview_dnspolicy_binding obj = new dnsview_dnspolicy_binding();
obj.set_viewname(viewname);
dnsview_dnspolicy_binding response[] = (dnsview_dnspolicy_binding[]) obj.get_resources(service);
return response;
} | [
"public",
"static",
"dnsview_dnspolicy_binding",
"[",
"]",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"viewname",
")",
"throws",
"Exception",
"{",
"dnsview_dnspolicy_binding",
"obj",
"=",
"new",
"dnsview_dnspolicy_binding",
"(",
")",
";",
"obj",
".",
"set_viewname",
"(",
"viewname",
")",
";",
"dnsview_dnspolicy_binding",
"response",
"[",
"]",
"=",
"(",
"dnsview_dnspolicy_binding",
"[",
"]",
")",
"obj",
".",
"get_resources",
"(",
"service",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch dnsview_dnspolicy_binding resources of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"dnsview_dnspolicy_binding",
"resources",
"of",
"given",
"name",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/dns/dnsview_dnspolicy_binding.java#L112-L117 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaasession.java | aaasession.kill | public static base_response kill(nitro_service client, aaasession resource) throws Exception {
aaasession killresource = new aaasession();
killresource.username = resource.username;
killresource.groupname = resource.groupname;
killresource.iip = resource.iip;
killresource.netmask = resource.netmask;
killresource.all = resource.all;
return killresource.perform_operation(client,"kill");
} | java | public static base_response kill(nitro_service client, aaasession resource) throws Exception {
aaasession killresource = new aaasession();
killresource.username = resource.username;
killresource.groupname = resource.groupname;
killresource.iip = resource.iip;
killresource.netmask = resource.netmask;
killresource.all = resource.all;
return killresource.perform_operation(client,"kill");
} | [
"public",
"static",
"base_response",
"kill",
"(",
"nitro_service",
"client",
",",
"aaasession",
"resource",
")",
"throws",
"Exception",
"{",
"aaasession",
"killresource",
"=",
"new",
"aaasession",
"(",
")",
";",
"killresource",
".",
"username",
"=",
"resource",
".",
"username",
";",
"killresource",
".",
"groupname",
"=",
"resource",
".",
"groupname",
";",
"killresource",
".",
"iip",
"=",
"resource",
".",
"iip",
";",
"killresource",
".",
"netmask",
"=",
"resource",
".",
"netmask",
";",
"killresource",
".",
"all",
"=",
"resource",
".",
"all",
";",
"return",
"killresource",
".",
"perform_operation",
"(",
"client",
",",
"\"kill\"",
")",
";",
"}"
] | Use this API to kill aaasession. | [
"Use",
"this",
"API",
"to",
"kill",
"aaasession",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaasession.java#L281-L289 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaasession.java | aaasession.kill | public static base_responses kill(nitro_service client, aaasession resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
aaasession killresources[] = new aaasession[resources.length];
for (int i=0;i<resources.length;i++){
killresources[i] = new aaasession();
killresources[i].username = resources[i].username;
killresources[i].groupname = resources[i].groupname;
killresources[i].iip = resources[i].iip;
killresources[i].netmask = resources[i].netmask;
killresources[i].all = resources[i].all;
}
result = perform_operation_bulk_request(client, killresources,"kill");
}
return result;
} | java | public static base_responses kill(nitro_service client, aaasession resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
aaasession killresources[] = new aaasession[resources.length];
for (int i=0;i<resources.length;i++){
killresources[i] = new aaasession();
killresources[i].username = resources[i].username;
killresources[i].groupname = resources[i].groupname;
killresources[i].iip = resources[i].iip;
killresources[i].netmask = resources[i].netmask;
killresources[i].all = resources[i].all;
}
result = perform_operation_bulk_request(client, killresources,"kill");
}
return result;
} | [
"public",
"static",
"base_responses",
"kill",
"(",
"nitro_service",
"client",
",",
"aaasession",
"resources",
"[",
"]",
")",
"throws",
"Exception",
"{",
"base_responses",
"result",
"=",
"null",
";",
"if",
"(",
"resources",
"!=",
"null",
"&&",
"resources",
".",
"length",
">",
"0",
")",
"{",
"aaasession",
"killresources",
"[",
"]",
"=",
"new",
"aaasession",
"[",
"resources",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"resources",
".",
"length",
";",
"i",
"++",
")",
"{",
"killresources",
"[",
"i",
"]",
"=",
"new",
"aaasession",
"(",
")",
";",
"killresources",
"[",
"i",
"]",
".",
"username",
"=",
"resources",
"[",
"i",
"]",
".",
"username",
";",
"killresources",
"[",
"i",
"]",
".",
"groupname",
"=",
"resources",
"[",
"i",
"]",
".",
"groupname",
";",
"killresources",
"[",
"i",
"]",
".",
"iip",
"=",
"resources",
"[",
"i",
"]",
".",
"iip",
";",
"killresources",
"[",
"i",
"]",
".",
"netmask",
"=",
"resources",
"[",
"i",
"]",
".",
"netmask",
";",
"killresources",
"[",
"i",
"]",
".",
"all",
"=",
"resources",
"[",
"i",
"]",
".",
"all",
";",
"}",
"result",
"=",
"perform_operation_bulk_request",
"(",
"client",
",",
"killresources",
",",
"\"kill\"",
")",
";",
"}",
"return",
"result",
";",
"}"
] | Use this API to kill aaasession resources. | [
"Use",
"this",
"API",
"to",
"kill",
"aaasession",
"resources",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaasession.java#L294-L309 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaasession.java | aaasession.get | public static aaasession[] get(nitro_service service) throws Exception{
aaasession obj = new aaasession();
aaasession[] response = (aaasession[])obj.get_resources(service);
return response;
} | java | public static aaasession[] get(nitro_service service) throws Exception{
aaasession obj = new aaasession();
aaasession[] response = (aaasession[])obj.get_resources(service);
return response;
} | [
"public",
"static",
"aaasession",
"[",
"]",
"get",
"(",
"nitro_service",
"service",
")",
"throws",
"Exception",
"{",
"aaasession",
"obj",
"=",
"new",
"aaasession",
"(",
")",
";",
"aaasession",
"[",
"]",
"response",
"=",
"(",
"aaasession",
"[",
"]",
")",
"obj",
".",
"get_resources",
"(",
"service",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch all the aaasession resources that are configured on netscaler. | [
"Use",
"this",
"API",
"to",
"fetch",
"all",
"the",
"aaasession",
"resources",
"that",
"are",
"configured",
"on",
"netscaler",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaasession.java#L314-L318 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaasession.java | aaasession.get | public static aaasession[] get(nitro_service service, aaasession_args args) throws Exception{
aaasession obj = new aaasession();
options option = new options();
option.set_args(nitro_util.object_to_string_withoutquotes(args));
aaasession[] response = (aaasession[])obj.get_resources(service, option);
return response;
} | java | public static aaasession[] get(nitro_service service, aaasession_args args) throws Exception{
aaasession obj = new aaasession();
options option = new options();
option.set_args(nitro_util.object_to_string_withoutquotes(args));
aaasession[] response = (aaasession[])obj.get_resources(service, option);
return response;
} | [
"public",
"static",
"aaasession",
"[",
"]",
"get",
"(",
"nitro_service",
"service",
",",
"aaasession_args",
"args",
")",
"throws",
"Exception",
"{",
"aaasession",
"obj",
"=",
"new",
"aaasession",
"(",
")",
";",
"options",
"option",
"=",
"new",
"options",
"(",
")",
";",
"option",
".",
"set_args",
"(",
"nitro_util",
".",
"object_to_string_withoutquotes",
"(",
"args",
")",
")",
";",
"aaasession",
"[",
"]",
"response",
"=",
"(",
"aaasession",
"[",
"]",
")",
"obj",
".",
"get_resources",
"(",
"service",
",",
"option",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch all the aaasession resources that are configured on netscaler.
This uses aaasession_args which is a way to provide additional arguments while fetching the resources. | [
"Use",
"this",
"API",
"to",
"fetch",
"all",
"the",
"aaasession",
"resources",
"that",
"are",
"configured",
"on",
"netscaler",
".",
"This",
"uses",
"aaasession_args",
"which",
"is",
"a",
"way",
"to",
"provide",
"additional",
"arguments",
"while",
"fetching",
"the",
"resources",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaasession.java#L331-L337 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaakcdaccount.java | aaakcdaccount.add | public static base_response add(nitro_service client, aaakcdaccount resource) throws Exception {
aaakcdaccount addresource = new aaakcdaccount();
addresource.kcdaccount = resource.kcdaccount;
addresource.keytab = resource.keytab;
addresource.realmstr = resource.realmstr;
addresource.delegateduser = resource.delegateduser;
addresource.kcdpassword = resource.kcdpassword;
addresource.usercert = resource.usercert;
addresource.cacert = resource.cacert;
return addresource.add_resource(client);
} | java | public static base_response add(nitro_service client, aaakcdaccount resource) throws Exception {
aaakcdaccount addresource = new aaakcdaccount();
addresource.kcdaccount = resource.kcdaccount;
addresource.keytab = resource.keytab;
addresource.realmstr = resource.realmstr;
addresource.delegateduser = resource.delegateduser;
addresource.kcdpassword = resource.kcdpassword;
addresource.usercert = resource.usercert;
addresource.cacert = resource.cacert;
return addresource.add_resource(client);
} | [
"public",
"static",
"base_response",
"add",
"(",
"nitro_service",
"client",
",",
"aaakcdaccount",
"resource",
")",
"throws",
"Exception",
"{",
"aaakcdaccount",
"addresource",
"=",
"new",
"aaakcdaccount",
"(",
")",
";",
"addresource",
".",
"kcdaccount",
"=",
"resource",
".",
"kcdaccount",
";",
"addresource",
".",
"keytab",
"=",
"resource",
".",
"keytab",
";",
"addresource",
".",
"realmstr",
"=",
"resource",
".",
"realmstr",
";",
"addresource",
".",
"delegateduser",
"=",
"resource",
".",
"delegateduser",
";",
"addresource",
".",
"kcdpassword",
"=",
"resource",
".",
"kcdpassword",
";",
"addresource",
".",
"usercert",
"=",
"resource",
".",
"usercert",
";",
"addresource",
".",
"cacert",
"=",
"resource",
".",
"cacert",
";",
"return",
"addresource",
".",
"add_resource",
"(",
"client",
")",
";",
"}"
] | Use this API to add aaakcdaccount. | [
"Use",
"this",
"API",
"to",
"add",
"aaakcdaccount",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaakcdaccount.java#L230-L240 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaakcdaccount.java | aaakcdaccount.add | public static base_responses add(nitro_service client, aaakcdaccount resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
aaakcdaccount addresources[] = new aaakcdaccount[resources.length];
for (int i=0;i<resources.length;i++){
addresources[i] = new aaakcdaccount();
addresources[i].kcdaccount = resources[i].kcdaccount;
addresources[i].keytab = resources[i].keytab;
addresources[i].realmstr = resources[i].realmstr;
addresources[i].delegateduser = resources[i].delegateduser;
addresources[i].kcdpassword = resources[i].kcdpassword;
addresources[i].usercert = resources[i].usercert;
addresources[i].cacert = resources[i].cacert;
}
result = add_bulk_request(client, addresources);
}
return result;
} | java | public static base_responses add(nitro_service client, aaakcdaccount resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
aaakcdaccount addresources[] = new aaakcdaccount[resources.length];
for (int i=0;i<resources.length;i++){
addresources[i] = new aaakcdaccount();
addresources[i].kcdaccount = resources[i].kcdaccount;
addresources[i].keytab = resources[i].keytab;
addresources[i].realmstr = resources[i].realmstr;
addresources[i].delegateduser = resources[i].delegateduser;
addresources[i].kcdpassword = resources[i].kcdpassword;
addresources[i].usercert = resources[i].usercert;
addresources[i].cacert = resources[i].cacert;
}
result = add_bulk_request(client, addresources);
}
return result;
} | [
"public",
"static",
"base_responses",
"add",
"(",
"nitro_service",
"client",
",",
"aaakcdaccount",
"resources",
"[",
"]",
")",
"throws",
"Exception",
"{",
"base_responses",
"result",
"=",
"null",
";",
"if",
"(",
"resources",
"!=",
"null",
"&&",
"resources",
".",
"length",
">",
"0",
")",
"{",
"aaakcdaccount",
"addresources",
"[",
"]",
"=",
"new",
"aaakcdaccount",
"[",
"resources",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"resources",
".",
"length",
";",
"i",
"++",
")",
"{",
"addresources",
"[",
"i",
"]",
"=",
"new",
"aaakcdaccount",
"(",
")",
";",
"addresources",
"[",
"i",
"]",
".",
"kcdaccount",
"=",
"resources",
"[",
"i",
"]",
".",
"kcdaccount",
";",
"addresources",
"[",
"i",
"]",
".",
"keytab",
"=",
"resources",
"[",
"i",
"]",
".",
"keytab",
";",
"addresources",
"[",
"i",
"]",
".",
"realmstr",
"=",
"resources",
"[",
"i",
"]",
".",
"realmstr",
";",
"addresources",
"[",
"i",
"]",
".",
"delegateduser",
"=",
"resources",
"[",
"i",
"]",
".",
"delegateduser",
";",
"addresources",
"[",
"i",
"]",
".",
"kcdpassword",
"=",
"resources",
"[",
"i",
"]",
".",
"kcdpassword",
";",
"addresources",
"[",
"i",
"]",
".",
"usercert",
"=",
"resources",
"[",
"i",
"]",
".",
"usercert",
";",
"addresources",
"[",
"i",
"]",
".",
"cacert",
"=",
"resources",
"[",
"i",
"]",
".",
"cacert",
";",
"}",
"result",
"=",
"add_bulk_request",
"(",
"client",
",",
"addresources",
")",
";",
"}",
"return",
"result",
";",
"}"
] | Use this API to add aaakcdaccount resources. | [
"Use",
"this",
"API",
"to",
"add",
"aaakcdaccount",
"resources",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaakcdaccount.java#L245-L262 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaakcdaccount.java | aaakcdaccount.delete | public static base_response delete(nitro_service client, String kcdaccount) throws Exception {
aaakcdaccount deleteresource = new aaakcdaccount();
deleteresource.kcdaccount = kcdaccount;
return deleteresource.delete_resource(client);
} | java | public static base_response delete(nitro_service client, String kcdaccount) throws Exception {
aaakcdaccount deleteresource = new aaakcdaccount();
deleteresource.kcdaccount = kcdaccount;
return deleteresource.delete_resource(client);
} | [
"public",
"static",
"base_response",
"delete",
"(",
"nitro_service",
"client",
",",
"String",
"kcdaccount",
")",
"throws",
"Exception",
"{",
"aaakcdaccount",
"deleteresource",
"=",
"new",
"aaakcdaccount",
"(",
")",
";",
"deleteresource",
".",
"kcdaccount",
"=",
"kcdaccount",
";",
"return",
"deleteresource",
".",
"delete_resource",
"(",
"client",
")",
";",
"}"
] | Use this API to delete aaakcdaccount of given name. | [
"Use",
"this",
"API",
"to",
"delete",
"aaakcdaccount",
"of",
"given",
"name",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaakcdaccount.java#L267-L271 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaakcdaccount.java | aaakcdaccount.delete | public static base_responses delete(nitro_service client, String kcdaccount[]) throws Exception {
base_responses result = null;
if (kcdaccount != null && kcdaccount.length > 0) {
aaakcdaccount deleteresources[] = new aaakcdaccount[kcdaccount.length];
for (int i=0;i<kcdaccount.length;i++){
deleteresources[i] = new aaakcdaccount();
deleteresources[i].kcdaccount = kcdaccount[i];
}
result = delete_bulk_request(client, deleteresources);
}
return result;
} | java | public static base_responses delete(nitro_service client, String kcdaccount[]) throws Exception {
base_responses result = null;
if (kcdaccount != null && kcdaccount.length > 0) {
aaakcdaccount deleteresources[] = new aaakcdaccount[kcdaccount.length];
for (int i=0;i<kcdaccount.length;i++){
deleteresources[i] = new aaakcdaccount();
deleteresources[i].kcdaccount = kcdaccount[i];
}
result = delete_bulk_request(client, deleteresources);
}
return result;
} | [
"public",
"static",
"base_responses",
"delete",
"(",
"nitro_service",
"client",
",",
"String",
"kcdaccount",
"[",
"]",
")",
"throws",
"Exception",
"{",
"base_responses",
"result",
"=",
"null",
";",
"if",
"(",
"kcdaccount",
"!=",
"null",
"&&",
"kcdaccount",
".",
"length",
">",
"0",
")",
"{",
"aaakcdaccount",
"deleteresources",
"[",
"]",
"=",
"new",
"aaakcdaccount",
"[",
"kcdaccount",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"kcdaccount",
".",
"length",
";",
"i",
"++",
")",
"{",
"deleteresources",
"[",
"i",
"]",
"=",
"new",
"aaakcdaccount",
"(",
")",
";",
"deleteresources",
"[",
"i",
"]",
".",
"kcdaccount",
"=",
"kcdaccount",
"[",
"i",
"]",
";",
"}",
"result",
"=",
"delete_bulk_request",
"(",
"client",
",",
"deleteresources",
")",
";",
"}",
"return",
"result",
";",
"}"
] | Use this API to delete aaakcdaccount resources of given names. | [
"Use",
"this",
"API",
"to",
"delete",
"aaakcdaccount",
"resources",
"of",
"given",
"names",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaakcdaccount.java#L285-L296 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaakcdaccount.java | aaakcdaccount.update | public static base_response update(nitro_service client, aaakcdaccount resource) throws Exception {
aaakcdaccount updateresource = new aaakcdaccount();
updateresource.kcdaccount = resource.kcdaccount;
updateresource.keytab = resource.keytab;
updateresource.realmstr = resource.realmstr;
updateresource.delegateduser = resource.delegateduser;
updateresource.kcdpassword = resource.kcdpassword;
updateresource.usercert = resource.usercert;
updateresource.cacert = resource.cacert;
return updateresource.update_resource(client);
} | java | public static base_response update(nitro_service client, aaakcdaccount resource) throws Exception {
aaakcdaccount updateresource = new aaakcdaccount();
updateresource.kcdaccount = resource.kcdaccount;
updateresource.keytab = resource.keytab;
updateresource.realmstr = resource.realmstr;
updateresource.delegateduser = resource.delegateduser;
updateresource.kcdpassword = resource.kcdpassword;
updateresource.usercert = resource.usercert;
updateresource.cacert = resource.cacert;
return updateresource.update_resource(client);
} | [
"public",
"static",
"base_response",
"update",
"(",
"nitro_service",
"client",
",",
"aaakcdaccount",
"resource",
")",
"throws",
"Exception",
"{",
"aaakcdaccount",
"updateresource",
"=",
"new",
"aaakcdaccount",
"(",
")",
";",
"updateresource",
".",
"kcdaccount",
"=",
"resource",
".",
"kcdaccount",
";",
"updateresource",
".",
"keytab",
"=",
"resource",
".",
"keytab",
";",
"updateresource",
".",
"realmstr",
"=",
"resource",
".",
"realmstr",
";",
"updateresource",
".",
"delegateduser",
"=",
"resource",
".",
"delegateduser",
";",
"updateresource",
".",
"kcdpassword",
"=",
"resource",
".",
"kcdpassword",
";",
"updateresource",
".",
"usercert",
"=",
"resource",
".",
"usercert",
";",
"updateresource",
".",
"cacert",
"=",
"resource",
".",
"cacert",
";",
"return",
"updateresource",
".",
"update_resource",
"(",
"client",
")",
";",
"}"
] | Use this API to update aaakcdaccount. | [
"Use",
"this",
"API",
"to",
"update",
"aaakcdaccount",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaakcdaccount.java#L317-L327 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaakcdaccount.java | aaakcdaccount.update | public static base_responses update(nitro_service client, aaakcdaccount resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
aaakcdaccount updateresources[] = new aaakcdaccount[resources.length];
for (int i=0;i<resources.length;i++){
updateresources[i] = new aaakcdaccount();
updateresources[i].kcdaccount = resources[i].kcdaccount;
updateresources[i].keytab = resources[i].keytab;
updateresources[i].realmstr = resources[i].realmstr;
updateresources[i].delegateduser = resources[i].delegateduser;
updateresources[i].kcdpassword = resources[i].kcdpassword;
updateresources[i].usercert = resources[i].usercert;
updateresources[i].cacert = resources[i].cacert;
}
result = update_bulk_request(client, updateresources);
}
return result;
} | java | public static base_responses update(nitro_service client, aaakcdaccount resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
aaakcdaccount updateresources[] = new aaakcdaccount[resources.length];
for (int i=0;i<resources.length;i++){
updateresources[i] = new aaakcdaccount();
updateresources[i].kcdaccount = resources[i].kcdaccount;
updateresources[i].keytab = resources[i].keytab;
updateresources[i].realmstr = resources[i].realmstr;
updateresources[i].delegateduser = resources[i].delegateduser;
updateresources[i].kcdpassword = resources[i].kcdpassword;
updateresources[i].usercert = resources[i].usercert;
updateresources[i].cacert = resources[i].cacert;
}
result = update_bulk_request(client, updateresources);
}
return result;
} | [
"public",
"static",
"base_responses",
"update",
"(",
"nitro_service",
"client",
",",
"aaakcdaccount",
"resources",
"[",
"]",
")",
"throws",
"Exception",
"{",
"base_responses",
"result",
"=",
"null",
";",
"if",
"(",
"resources",
"!=",
"null",
"&&",
"resources",
".",
"length",
">",
"0",
")",
"{",
"aaakcdaccount",
"updateresources",
"[",
"]",
"=",
"new",
"aaakcdaccount",
"[",
"resources",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"resources",
".",
"length",
";",
"i",
"++",
")",
"{",
"updateresources",
"[",
"i",
"]",
"=",
"new",
"aaakcdaccount",
"(",
")",
";",
"updateresources",
"[",
"i",
"]",
".",
"kcdaccount",
"=",
"resources",
"[",
"i",
"]",
".",
"kcdaccount",
";",
"updateresources",
"[",
"i",
"]",
".",
"keytab",
"=",
"resources",
"[",
"i",
"]",
".",
"keytab",
";",
"updateresources",
"[",
"i",
"]",
".",
"realmstr",
"=",
"resources",
"[",
"i",
"]",
".",
"realmstr",
";",
"updateresources",
"[",
"i",
"]",
".",
"delegateduser",
"=",
"resources",
"[",
"i",
"]",
".",
"delegateduser",
";",
"updateresources",
"[",
"i",
"]",
".",
"kcdpassword",
"=",
"resources",
"[",
"i",
"]",
".",
"kcdpassword",
";",
"updateresources",
"[",
"i",
"]",
".",
"usercert",
"=",
"resources",
"[",
"i",
"]",
".",
"usercert",
";",
"updateresources",
"[",
"i",
"]",
".",
"cacert",
"=",
"resources",
"[",
"i",
"]",
".",
"cacert",
";",
"}",
"result",
"=",
"update_bulk_request",
"(",
"client",
",",
"updateresources",
")",
";",
"}",
"return",
"result",
";",
"}"
] | Use this API to update aaakcdaccount resources. | [
"Use",
"this",
"API",
"to",
"update",
"aaakcdaccount",
"resources",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaakcdaccount.java#L332-L349 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaakcdaccount.java | aaakcdaccount.unset | public static base_response unset(nitro_service client, aaakcdaccount resource, String[] args) throws Exception{
aaakcdaccount unsetresource = new aaakcdaccount();
unsetresource.kcdaccount = resource.kcdaccount;
unsetresource.keytab = resource.keytab;
unsetresource.usercert = resource.usercert;
unsetresource.cacert = resource.cacert;
return unsetresource.unset_resource(client,args);
} | java | public static base_response unset(nitro_service client, aaakcdaccount resource, String[] args) throws Exception{
aaakcdaccount unsetresource = new aaakcdaccount();
unsetresource.kcdaccount = resource.kcdaccount;
unsetresource.keytab = resource.keytab;
unsetresource.usercert = resource.usercert;
unsetresource.cacert = resource.cacert;
return unsetresource.unset_resource(client,args);
} | [
"public",
"static",
"base_response",
"unset",
"(",
"nitro_service",
"client",
",",
"aaakcdaccount",
"resource",
",",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"aaakcdaccount",
"unsetresource",
"=",
"new",
"aaakcdaccount",
"(",
")",
";",
"unsetresource",
".",
"kcdaccount",
"=",
"resource",
".",
"kcdaccount",
";",
"unsetresource",
".",
"keytab",
"=",
"resource",
".",
"keytab",
";",
"unsetresource",
".",
"usercert",
"=",
"resource",
".",
"usercert",
";",
"unsetresource",
".",
"cacert",
"=",
"resource",
".",
"cacert",
";",
"return",
"unsetresource",
".",
"unset_resource",
"(",
"client",
",",
"args",
")",
";",
"}"
] | Use this API to unset the properties of aaakcdaccount resource.
Properties that need to be unset are specified in args array. | [
"Use",
"this",
"API",
"to",
"unset",
"the",
"properties",
"of",
"aaakcdaccount",
"resource",
".",
"Properties",
"that",
"need",
"to",
"be",
"unset",
"are",
"specified",
"in",
"args",
"array",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaakcdaccount.java#L355-L362 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaakcdaccount.java | aaakcdaccount.get | public static aaakcdaccount[] get(nitro_service service) throws Exception{
aaakcdaccount obj = new aaakcdaccount();
aaakcdaccount[] response = (aaakcdaccount[])obj.get_resources(service);
return response;
} | java | public static aaakcdaccount[] get(nitro_service service) throws Exception{
aaakcdaccount obj = new aaakcdaccount();
aaakcdaccount[] response = (aaakcdaccount[])obj.get_resources(service);
return response;
} | [
"public",
"static",
"aaakcdaccount",
"[",
"]",
"get",
"(",
"nitro_service",
"service",
")",
"throws",
"Exception",
"{",
"aaakcdaccount",
"obj",
"=",
"new",
"aaakcdaccount",
"(",
")",
";",
"aaakcdaccount",
"[",
"]",
"response",
"=",
"(",
"aaakcdaccount",
"[",
"]",
")",
"obj",
".",
"get_resources",
"(",
"service",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch all the aaakcdaccount resources that are configured on netscaler. | [
"Use",
"this",
"API",
"to",
"fetch",
"all",
"the",
"aaakcdaccount",
"resources",
"that",
"are",
"configured",
"on",
"netscaler",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaakcdaccount.java#L404-L408 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaakcdaccount.java | aaakcdaccount.get | public static aaakcdaccount get(nitro_service service, String kcdaccount) throws Exception{
aaakcdaccount obj = new aaakcdaccount();
obj.set_kcdaccount(kcdaccount);
aaakcdaccount response = (aaakcdaccount) obj.get_resource(service);
return response;
} | java | public static aaakcdaccount get(nitro_service service, String kcdaccount) throws Exception{
aaakcdaccount obj = new aaakcdaccount();
obj.set_kcdaccount(kcdaccount);
aaakcdaccount response = (aaakcdaccount) obj.get_resource(service);
return response;
} | [
"public",
"static",
"aaakcdaccount",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"kcdaccount",
")",
"throws",
"Exception",
"{",
"aaakcdaccount",
"obj",
"=",
"new",
"aaakcdaccount",
"(",
")",
";",
"obj",
".",
"set_kcdaccount",
"(",
"kcdaccount",
")",
";",
"aaakcdaccount",
"response",
"=",
"(",
"aaakcdaccount",
")",
"obj",
".",
"get_resource",
"(",
"service",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch aaakcdaccount resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"aaakcdaccount",
"resource",
"of",
"given",
"name",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaakcdaccount.java#L420-L425 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaakcdaccount.java | aaakcdaccount.get | public static aaakcdaccount[] get(nitro_service service, String kcdaccount[]) throws Exception{
if (kcdaccount !=null && kcdaccount.length>0) {
aaakcdaccount response[] = new aaakcdaccount[kcdaccount.length];
aaakcdaccount obj[] = new aaakcdaccount[kcdaccount.length];
for (int i=0;i<kcdaccount.length;i++) {
obj[i] = new aaakcdaccount();
obj[i].set_kcdaccount(kcdaccount[i]);
response[i] = (aaakcdaccount) obj[i].get_resource(service);
}
return response;
}
return null;
} | java | public static aaakcdaccount[] get(nitro_service service, String kcdaccount[]) throws Exception{
if (kcdaccount !=null && kcdaccount.length>0) {
aaakcdaccount response[] = new aaakcdaccount[kcdaccount.length];
aaakcdaccount obj[] = new aaakcdaccount[kcdaccount.length];
for (int i=0;i<kcdaccount.length;i++) {
obj[i] = new aaakcdaccount();
obj[i].set_kcdaccount(kcdaccount[i]);
response[i] = (aaakcdaccount) obj[i].get_resource(service);
}
return response;
}
return null;
} | [
"public",
"static",
"aaakcdaccount",
"[",
"]",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"kcdaccount",
"[",
"]",
")",
"throws",
"Exception",
"{",
"if",
"(",
"kcdaccount",
"!=",
"null",
"&&",
"kcdaccount",
".",
"length",
">",
"0",
")",
"{",
"aaakcdaccount",
"response",
"[",
"]",
"=",
"new",
"aaakcdaccount",
"[",
"kcdaccount",
".",
"length",
"]",
";",
"aaakcdaccount",
"obj",
"[",
"]",
"=",
"new",
"aaakcdaccount",
"[",
"kcdaccount",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"kcdaccount",
".",
"length",
";",
"i",
"++",
")",
"{",
"obj",
"[",
"i",
"]",
"=",
"new",
"aaakcdaccount",
"(",
")",
";",
"obj",
"[",
"i",
"]",
".",
"set_kcdaccount",
"(",
"kcdaccount",
"[",
"i",
"]",
")",
";",
"response",
"[",
"i",
"]",
"=",
"(",
"aaakcdaccount",
")",
"obj",
"[",
"i",
"]",
".",
"get_resource",
"(",
"service",
")",
";",
"}",
"return",
"response",
";",
"}",
"return",
"null",
";",
"}"
] | Use this API to fetch aaakcdaccount resources of given names . | [
"Use",
"this",
"API",
"to",
"fetch",
"aaakcdaccount",
"resources",
"of",
"given",
"names",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaakcdaccount.java#L430-L442 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsparam.java | nsparam.update | public static base_response update(nitro_service client, nsparam resource) throws Exception {
nsparam updateresource = new nsparam();
updateresource.httpport = resource.httpport;
updateresource.maxconn = resource.maxconn;
updateresource.maxreq = resource.maxreq;
updateresource.cip = resource.cip;
updateresource.cipheader = resource.cipheader;
updateresource.cookieversion = resource.cookieversion;
updateresource.securecookie = resource.securecookie;
updateresource.pmtumin = resource.pmtumin;
updateresource.pmtutimeout = resource.pmtutimeout;
updateresource.ftpportrange = resource.ftpportrange;
updateresource.crportrange = resource.crportrange;
updateresource.timezone = resource.timezone;
updateresource.grantquotamaxclient = resource.grantquotamaxclient;
updateresource.exclusivequotamaxclient = resource.exclusivequotamaxclient;
updateresource.grantquotaspillover = resource.grantquotaspillover;
updateresource.exclusivequotaspillover = resource.exclusivequotaspillover;
updateresource.useproxyport = resource.useproxyport;
updateresource.internaluserlogin = resource.internaluserlogin;
updateresource.aftpallowrandomsourceport = resource.aftpallowrandomsourceport;
updateresource.icaports = resource.icaports;
return updateresource.update_resource(client);
} | java | public static base_response update(nitro_service client, nsparam resource) throws Exception {
nsparam updateresource = new nsparam();
updateresource.httpport = resource.httpport;
updateresource.maxconn = resource.maxconn;
updateresource.maxreq = resource.maxreq;
updateresource.cip = resource.cip;
updateresource.cipheader = resource.cipheader;
updateresource.cookieversion = resource.cookieversion;
updateresource.securecookie = resource.securecookie;
updateresource.pmtumin = resource.pmtumin;
updateresource.pmtutimeout = resource.pmtutimeout;
updateresource.ftpportrange = resource.ftpportrange;
updateresource.crportrange = resource.crportrange;
updateresource.timezone = resource.timezone;
updateresource.grantquotamaxclient = resource.grantquotamaxclient;
updateresource.exclusivequotamaxclient = resource.exclusivequotamaxclient;
updateresource.grantquotaspillover = resource.grantquotaspillover;
updateresource.exclusivequotaspillover = resource.exclusivequotaspillover;
updateresource.useproxyport = resource.useproxyport;
updateresource.internaluserlogin = resource.internaluserlogin;
updateresource.aftpallowrandomsourceport = resource.aftpallowrandomsourceport;
updateresource.icaports = resource.icaports;
return updateresource.update_resource(client);
} | [
"public",
"static",
"base_response",
"update",
"(",
"nitro_service",
"client",
",",
"nsparam",
"resource",
")",
"throws",
"Exception",
"{",
"nsparam",
"updateresource",
"=",
"new",
"nsparam",
"(",
")",
";",
"updateresource",
".",
"httpport",
"=",
"resource",
".",
"httpport",
";",
"updateresource",
".",
"maxconn",
"=",
"resource",
".",
"maxconn",
";",
"updateresource",
".",
"maxreq",
"=",
"resource",
".",
"maxreq",
";",
"updateresource",
".",
"cip",
"=",
"resource",
".",
"cip",
";",
"updateresource",
".",
"cipheader",
"=",
"resource",
".",
"cipheader",
";",
"updateresource",
".",
"cookieversion",
"=",
"resource",
".",
"cookieversion",
";",
"updateresource",
".",
"securecookie",
"=",
"resource",
".",
"securecookie",
";",
"updateresource",
".",
"pmtumin",
"=",
"resource",
".",
"pmtumin",
";",
"updateresource",
".",
"pmtutimeout",
"=",
"resource",
".",
"pmtutimeout",
";",
"updateresource",
".",
"ftpportrange",
"=",
"resource",
".",
"ftpportrange",
";",
"updateresource",
".",
"crportrange",
"=",
"resource",
".",
"crportrange",
";",
"updateresource",
".",
"timezone",
"=",
"resource",
".",
"timezone",
";",
"updateresource",
".",
"grantquotamaxclient",
"=",
"resource",
".",
"grantquotamaxclient",
";",
"updateresource",
".",
"exclusivequotamaxclient",
"=",
"resource",
".",
"exclusivequotamaxclient",
";",
"updateresource",
".",
"grantquotaspillover",
"=",
"resource",
".",
"grantquotaspillover",
";",
"updateresource",
".",
"exclusivequotaspillover",
"=",
"resource",
".",
"exclusivequotaspillover",
";",
"updateresource",
".",
"useproxyport",
"=",
"resource",
".",
"useproxyport",
";",
"updateresource",
".",
"internaluserlogin",
"=",
"resource",
".",
"internaluserlogin",
";",
"updateresource",
".",
"aftpallowrandomsourceport",
"=",
"resource",
".",
"aftpallowrandomsourceport",
";",
"updateresource",
".",
"icaports",
"=",
"resource",
".",
"icaports",
";",
"return",
"updateresource",
".",
"update_resource",
"(",
"client",
")",
";",
"}"
] | Use this API to update nsparam. | [
"Use",
"this",
"API",
"to",
"update",
"nsparam",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsparam.java#L533-L556 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsparam.java | nsparam.unset | public static base_response unset(nitro_service client, nsparam resource, String[] args) throws Exception{
nsparam unsetresource = new nsparam();
return unsetresource.unset_resource(client,args);
} | java | public static base_response unset(nitro_service client, nsparam resource, String[] args) throws Exception{
nsparam unsetresource = new nsparam();
return unsetresource.unset_resource(client,args);
} | [
"public",
"static",
"base_response",
"unset",
"(",
"nitro_service",
"client",
",",
"nsparam",
"resource",
",",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"nsparam",
"unsetresource",
"=",
"new",
"nsparam",
"(",
")",
";",
"return",
"unsetresource",
".",
"unset_resource",
"(",
"client",
",",
"args",
")",
";",
"}"
] | Use this API to unset the properties of nsparam resource.
Properties that need to be unset are specified in args array. | [
"Use",
"this",
"API",
"to",
"unset",
"the",
"properties",
"of",
"nsparam",
"resource",
".",
"Properties",
"that",
"need",
"to",
"be",
"unset",
"are",
"specified",
"in",
"args",
"array",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsparam.java#L562-L565 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsparam.java | nsparam.get | public static nsparam get(nitro_service service) throws Exception{
nsparam obj = new nsparam();
nsparam[] response = (nsparam[])obj.get_resources(service);
return response[0];
} | java | public static nsparam get(nitro_service service) throws Exception{
nsparam obj = new nsparam();
nsparam[] response = (nsparam[])obj.get_resources(service);
return response[0];
} | [
"public",
"static",
"nsparam",
"get",
"(",
"nitro_service",
"service",
")",
"throws",
"Exception",
"{",
"nsparam",
"obj",
"=",
"new",
"nsparam",
"(",
")",
";",
"nsparam",
"[",
"]",
"response",
"=",
"(",
"nsparam",
"[",
"]",
")",
"obj",
".",
"get_resources",
"(",
"service",
")",
";",
"return",
"response",
"[",
"0",
"]",
";",
"}"
] | Use this API to fetch all the nsparam resources that are configured on netscaler. | [
"Use",
"this",
"API",
"to",
"fetch",
"all",
"the",
"nsparam",
"resources",
"that",
"are",
"configured",
"on",
"netscaler",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsparam.java#L570-L574 | train |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/pipeline/ChunkAnnotationUtils.java | ChunkAnnotationUtils.checkOffsets | public static boolean checkOffsets(CoreMap docAnnotation)
{
boolean okay = true;
String docText = docAnnotation.get(CoreAnnotations.TextAnnotation.class);
String docId = docAnnotation.get(CoreAnnotations.DocIDAnnotation.class);
List<CoreLabel> docTokens = docAnnotation.get(CoreAnnotations.TokensAnnotation.class);
List<CoreMap> sentences = docAnnotation.get(CoreAnnotations.SentencesAnnotation.class);
for (CoreMap sentence:sentences) {
String sentText = sentence.get(CoreAnnotations.TextAnnotation.class);
List<CoreLabel> sentTokens = sentence.get(CoreAnnotations.TokensAnnotation.class);
int sentBeginChar = sentence.get(CoreAnnotations.CharacterOffsetBeginAnnotation.class);
int sentEndChar = sentence.get(CoreAnnotations.CharacterOffsetEndAnnotation.class);
int sentBeginToken = sentence.get(CoreAnnotations.TokenBeginAnnotation.class);
int sentEndToken = sentence.get(CoreAnnotations.TokenEndAnnotation.class);
String docTextSpan = docText.substring(sentBeginChar, sentEndChar);
List<CoreLabel> docTokenSpan = new ArrayList<CoreLabel>(docTokens.subList(sentBeginToken, sentEndToken));
logger.finer("Checking Document " + docId + " span (" + sentBeginChar + "," + sentEndChar + ") ");
if (!docTextSpan.equals(sentText) ) {
okay = false;
logger.finer("WARNING: Document " + docId + " span does not match sentence");
logger.finer("DocSpanText: " + docTextSpan);
logger.finer("SentenceText: " + sentText);
}
String sentTokenStr = getTokenText(sentTokens, CoreAnnotations.TextAnnotation.class);
String docTokenStr = getTokenText(docTokenSpan, CoreAnnotations.TextAnnotation.class);
if (!docTokenStr.equals(sentTokenStr) ) {
okay = false;
logger.finer("WARNING: Document " + docId + " tokens does not match sentence");
logger.finer("DocSpanTokens: " + docTokenStr);
logger.finer("SentenceTokens: " + sentTokenStr);
}
}
return okay;
} | java | public static boolean checkOffsets(CoreMap docAnnotation)
{
boolean okay = true;
String docText = docAnnotation.get(CoreAnnotations.TextAnnotation.class);
String docId = docAnnotation.get(CoreAnnotations.DocIDAnnotation.class);
List<CoreLabel> docTokens = docAnnotation.get(CoreAnnotations.TokensAnnotation.class);
List<CoreMap> sentences = docAnnotation.get(CoreAnnotations.SentencesAnnotation.class);
for (CoreMap sentence:sentences) {
String sentText = sentence.get(CoreAnnotations.TextAnnotation.class);
List<CoreLabel> sentTokens = sentence.get(CoreAnnotations.TokensAnnotation.class);
int sentBeginChar = sentence.get(CoreAnnotations.CharacterOffsetBeginAnnotation.class);
int sentEndChar = sentence.get(CoreAnnotations.CharacterOffsetEndAnnotation.class);
int sentBeginToken = sentence.get(CoreAnnotations.TokenBeginAnnotation.class);
int sentEndToken = sentence.get(CoreAnnotations.TokenEndAnnotation.class);
String docTextSpan = docText.substring(sentBeginChar, sentEndChar);
List<CoreLabel> docTokenSpan = new ArrayList<CoreLabel>(docTokens.subList(sentBeginToken, sentEndToken));
logger.finer("Checking Document " + docId + " span (" + sentBeginChar + "," + sentEndChar + ") ");
if (!docTextSpan.equals(sentText) ) {
okay = false;
logger.finer("WARNING: Document " + docId + " span does not match sentence");
logger.finer("DocSpanText: " + docTextSpan);
logger.finer("SentenceText: " + sentText);
}
String sentTokenStr = getTokenText(sentTokens, CoreAnnotations.TextAnnotation.class);
String docTokenStr = getTokenText(docTokenSpan, CoreAnnotations.TextAnnotation.class);
if (!docTokenStr.equals(sentTokenStr) ) {
okay = false;
logger.finer("WARNING: Document " + docId + " tokens does not match sentence");
logger.finer("DocSpanTokens: " + docTokenStr);
logger.finer("SentenceTokens: " + sentTokenStr);
}
}
return okay;
} | [
"public",
"static",
"boolean",
"checkOffsets",
"(",
"CoreMap",
"docAnnotation",
")",
"{",
"boolean",
"okay",
"=",
"true",
";",
"String",
"docText",
"=",
"docAnnotation",
".",
"get",
"(",
"CoreAnnotations",
".",
"TextAnnotation",
".",
"class",
")",
";",
"String",
"docId",
"=",
"docAnnotation",
".",
"get",
"(",
"CoreAnnotations",
".",
"DocIDAnnotation",
".",
"class",
")",
";",
"List",
"<",
"CoreLabel",
">",
"docTokens",
"=",
"docAnnotation",
".",
"get",
"(",
"CoreAnnotations",
".",
"TokensAnnotation",
".",
"class",
")",
";",
"List",
"<",
"CoreMap",
">",
"sentences",
"=",
"docAnnotation",
".",
"get",
"(",
"CoreAnnotations",
".",
"SentencesAnnotation",
".",
"class",
")",
";",
"for",
"(",
"CoreMap",
"sentence",
":",
"sentences",
")",
"{",
"String",
"sentText",
"=",
"sentence",
".",
"get",
"(",
"CoreAnnotations",
".",
"TextAnnotation",
".",
"class",
")",
";",
"List",
"<",
"CoreLabel",
">",
"sentTokens",
"=",
"sentence",
".",
"get",
"(",
"CoreAnnotations",
".",
"TokensAnnotation",
".",
"class",
")",
";",
"int",
"sentBeginChar",
"=",
"sentence",
".",
"get",
"(",
"CoreAnnotations",
".",
"CharacterOffsetBeginAnnotation",
".",
"class",
")",
";",
"int",
"sentEndChar",
"=",
"sentence",
".",
"get",
"(",
"CoreAnnotations",
".",
"CharacterOffsetEndAnnotation",
".",
"class",
")",
";",
"int",
"sentBeginToken",
"=",
"sentence",
".",
"get",
"(",
"CoreAnnotations",
".",
"TokenBeginAnnotation",
".",
"class",
")",
";",
"int",
"sentEndToken",
"=",
"sentence",
".",
"get",
"(",
"CoreAnnotations",
".",
"TokenEndAnnotation",
".",
"class",
")",
";",
"String",
"docTextSpan",
"=",
"docText",
".",
"substring",
"(",
"sentBeginChar",
",",
"sentEndChar",
")",
";",
"List",
"<",
"CoreLabel",
">",
"docTokenSpan",
"=",
"new",
"ArrayList",
"<",
"CoreLabel",
">",
"(",
"docTokens",
".",
"subList",
"(",
"sentBeginToken",
",",
"sentEndToken",
")",
")",
";",
"logger",
".",
"finer",
"(",
"\"Checking Document \"",
"+",
"docId",
"+",
"\" span (\"",
"+",
"sentBeginChar",
"+",
"\",\"",
"+",
"sentEndChar",
"+",
"\") \"",
")",
";",
"if",
"(",
"!",
"docTextSpan",
".",
"equals",
"(",
"sentText",
")",
")",
"{",
"okay",
"=",
"false",
";",
"logger",
".",
"finer",
"(",
"\"WARNING: Document \"",
"+",
"docId",
"+",
"\" span does not match sentence\"",
")",
";",
"logger",
".",
"finer",
"(",
"\"DocSpanText: \"",
"+",
"docTextSpan",
")",
";",
"logger",
".",
"finer",
"(",
"\"SentenceText: \"",
"+",
"sentText",
")",
";",
"}",
"String",
"sentTokenStr",
"=",
"getTokenText",
"(",
"sentTokens",
",",
"CoreAnnotations",
".",
"TextAnnotation",
".",
"class",
")",
";",
"String",
"docTokenStr",
"=",
"getTokenText",
"(",
"docTokenSpan",
",",
"CoreAnnotations",
".",
"TextAnnotation",
".",
"class",
")",
";",
"if",
"(",
"!",
"docTokenStr",
".",
"equals",
"(",
"sentTokenStr",
")",
")",
"{",
"okay",
"=",
"false",
";",
"logger",
".",
"finer",
"(",
"\"WARNING: Document \"",
"+",
"docId",
"+",
"\" tokens does not match sentence\"",
")",
";",
"logger",
".",
"finer",
"(",
"\"DocSpanTokens: \"",
"+",
"docTokenStr",
")",
";",
"logger",
".",
"finer",
"(",
"\"SentenceTokens: \"",
"+",
"sentTokenStr",
")",
";",
"}",
"}",
"return",
"okay",
";",
"}"
] | Checks if offsets of doc and sentence matches
@param docAnnotation
@return true if the offsets match, false otherwise | [
"Checks",
"if",
"offsets",
"of",
"doc",
"and",
"sentence",
"matches"
] | b3d44bab9ec07ace0d13612c448a6b7298c1f681 | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/pipeline/ChunkAnnotationUtils.java#L34-L67 | train |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/pipeline/ChunkAnnotationUtils.java | ChunkAnnotationUtils.copyUnsetAnnotations | public static void copyUnsetAnnotations(CoreMap src, CoreMap dest) {
Set<Class<?>> otherKeys = src.keySet();
for (Class key : otherKeys) {
if (!dest.has(key)) {
dest.set(key, src.get(key));
}
}
} | java | public static void copyUnsetAnnotations(CoreMap src, CoreMap dest) {
Set<Class<?>> otherKeys = src.keySet();
for (Class key : otherKeys) {
if (!dest.has(key)) {
dest.set(key, src.get(key));
}
}
} | [
"public",
"static",
"void",
"copyUnsetAnnotations",
"(",
"CoreMap",
"src",
",",
"CoreMap",
"dest",
")",
"{",
"Set",
"<",
"Class",
"<",
"?",
">",
">",
"otherKeys",
"=",
"src",
".",
"keySet",
"(",
")",
";",
"for",
"(",
"Class",
"key",
":",
"otherKeys",
")",
"{",
"if",
"(",
"!",
"dest",
".",
"has",
"(",
"key",
")",
")",
"{",
"dest",
".",
"set",
"(",
"key",
",",
"src",
".",
"get",
"(",
"key",
")",
")",
";",
"}",
"}",
"}"
] | Copies annotation over to this coremap if not already set | [
"Copies",
"annotation",
"over",
"to",
"this",
"coremap",
"if",
"not",
"already",
"set"
] | b3d44bab9ec07ace0d13612c448a6b7298c1f681 | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/pipeline/ChunkAnnotationUtils.java#L107-L114 | train |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/pipeline/ChunkAnnotationUtils.java | ChunkAnnotationUtils.getChunkOffsetsUsingCharOffsets | public static Interval<Integer> getChunkOffsetsUsingCharOffsets(List<? extends CoreMap> chunkList,
int charStart, int charEnd)
{
int chunkStart = 0;
int chunkEnd = chunkList.size();
// Find first chunk with start > charStart
for (int i = 0; i < chunkList.size(); i++) {
int start = chunkList.get(i).get(CoreAnnotations.CharacterOffsetBeginAnnotation.class);
if (start > charStart) {
break;
}
chunkStart = i;
}
// Find first chunk with start >= charEnd
for (int i = chunkStart; i < chunkList.size(); i++) {
int start = chunkList.get(i).get(CoreAnnotations.CharacterOffsetBeginAnnotation.class);
if (start >= charEnd) {
chunkEnd = i;
break;
}
}
return Interval.toInterval(chunkStart, chunkEnd, Interval.INTERVAL_OPEN_END);
} | java | public static Interval<Integer> getChunkOffsetsUsingCharOffsets(List<? extends CoreMap> chunkList,
int charStart, int charEnd)
{
int chunkStart = 0;
int chunkEnd = chunkList.size();
// Find first chunk with start > charStart
for (int i = 0; i < chunkList.size(); i++) {
int start = chunkList.get(i).get(CoreAnnotations.CharacterOffsetBeginAnnotation.class);
if (start > charStart) {
break;
}
chunkStart = i;
}
// Find first chunk with start >= charEnd
for (int i = chunkStart; i < chunkList.size(); i++) {
int start = chunkList.get(i).get(CoreAnnotations.CharacterOffsetBeginAnnotation.class);
if (start >= charEnd) {
chunkEnd = i;
break;
}
}
return Interval.toInterval(chunkStart, chunkEnd, Interval.INTERVAL_OPEN_END);
} | [
"public",
"static",
"Interval",
"<",
"Integer",
">",
"getChunkOffsetsUsingCharOffsets",
"(",
"List",
"<",
"?",
"extends",
"CoreMap",
">",
"chunkList",
",",
"int",
"charStart",
",",
"int",
"charEnd",
")",
"{",
"int",
"chunkStart",
"=",
"0",
";",
"int",
"chunkEnd",
"=",
"chunkList",
".",
"size",
"(",
")",
";",
"// Find first chunk with start > charStart\r",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"chunkList",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"int",
"start",
"=",
"chunkList",
".",
"get",
"(",
"i",
")",
".",
"get",
"(",
"CoreAnnotations",
".",
"CharacterOffsetBeginAnnotation",
".",
"class",
")",
";",
"if",
"(",
"start",
">",
"charStart",
")",
"{",
"break",
";",
"}",
"chunkStart",
"=",
"i",
";",
"}",
"// Find first chunk with start >= charEnd\r",
"for",
"(",
"int",
"i",
"=",
"chunkStart",
";",
"i",
"<",
"chunkList",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"int",
"start",
"=",
"chunkList",
".",
"get",
"(",
"i",
")",
".",
"get",
"(",
"CoreAnnotations",
".",
"CharacterOffsetBeginAnnotation",
".",
"class",
")",
";",
"if",
"(",
"start",
">=",
"charEnd",
")",
"{",
"chunkEnd",
"=",
"i",
";",
"break",
";",
"}",
"}",
"return",
"Interval",
".",
"toInterval",
"(",
"chunkStart",
",",
"chunkEnd",
",",
"Interval",
".",
"INTERVAL_OPEN_END",
")",
";",
"}"
] | Return chunk offsets
@param chunkList - List of chunks
@param charStart - character begin offset
@param charEnd - character end offset
@return chunk offsets | [
"Return",
"chunk",
"offsets"
] | b3d44bab9ec07ace0d13612c448a6b7298c1f681 | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/pipeline/ChunkAnnotationUtils.java#L252-L274 | train |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/pipeline/ChunkAnnotationUtils.java | ChunkAnnotationUtils.annotateChunkText | public static void annotateChunkText(CoreMap chunk, CoreMap origAnnotation)
{
String annoText = origAnnotation.get(CoreAnnotations.TextAnnotation.class);
Integer annoBeginCharOffset = origAnnotation.get(CoreAnnotations.CharacterOffsetBeginAnnotation.class);
if (annoBeginCharOffset == null) { annoBeginCharOffset = 0; }
int chunkBeginCharOffset = chunk.get(CoreAnnotations.CharacterOffsetBeginAnnotation.class) - annoBeginCharOffset;
int chunkEndCharOffset = chunk.get(CoreAnnotations.CharacterOffsetEndAnnotation.class) - annoBeginCharOffset;
if (chunkBeginCharOffset < 0) {
logger.fine("Adjusting begin char offset from " + chunkBeginCharOffset + " to 0");
logger.fine("Chunk begin offset: " + chunk.get(CoreAnnotations.CharacterOffsetBeginAnnotation.class) +
", Source text begin offset " + annoBeginCharOffset);
chunkBeginCharOffset = 0;
}
if (chunkBeginCharOffset > annoText.length()) {
logger.fine("Adjusting begin char offset from " + chunkBeginCharOffset + " to " + annoText.length());
logger.fine("Chunk begin offset: " + chunk.get(CoreAnnotations.CharacterOffsetBeginAnnotation.class) +
", Source text begin offset " + annoBeginCharOffset);
chunkBeginCharOffset = annoText.length();
}
if (chunkEndCharOffset < 0) {
logger.fine("Adjusting end char offset from " + chunkEndCharOffset + " to 0");
logger.fine("Chunk end offset: " + chunk.get(CoreAnnotations.CharacterOffsetEndAnnotation.class) +
", Source text begin offset " + annoBeginCharOffset);
chunkEndCharOffset = 0;
}
if (chunkEndCharOffset > annoText.length()) {
logger.fine("Adjusting end char offset from " + chunkEndCharOffset + " to " + annoText.length());
logger.fine("Chunk end offset: " + chunk.get(CoreAnnotations.CharacterOffsetEndAnnotation.class) +
", Source text begin offset " + annoBeginCharOffset);
chunkEndCharOffset = annoText.length();
}
if (chunkEndCharOffset < chunkBeginCharOffset) {
logger.fine("Adjusting end char offset from " + chunkEndCharOffset + " to " + chunkBeginCharOffset);
logger.fine("Chunk end offset: " + chunk.get(CoreAnnotations.CharacterOffsetEndAnnotation.class) +
", Source text begin offset " + annoBeginCharOffset);
chunkEndCharOffset = chunkBeginCharOffset;
}
String chunkText = annoText.substring(chunkBeginCharOffset, chunkEndCharOffset);
chunk.set(CoreAnnotations.TextAnnotation.class, chunkText);
} | java | public static void annotateChunkText(CoreMap chunk, CoreMap origAnnotation)
{
String annoText = origAnnotation.get(CoreAnnotations.TextAnnotation.class);
Integer annoBeginCharOffset = origAnnotation.get(CoreAnnotations.CharacterOffsetBeginAnnotation.class);
if (annoBeginCharOffset == null) { annoBeginCharOffset = 0; }
int chunkBeginCharOffset = chunk.get(CoreAnnotations.CharacterOffsetBeginAnnotation.class) - annoBeginCharOffset;
int chunkEndCharOffset = chunk.get(CoreAnnotations.CharacterOffsetEndAnnotation.class) - annoBeginCharOffset;
if (chunkBeginCharOffset < 0) {
logger.fine("Adjusting begin char offset from " + chunkBeginCharOffset + " to 0");
logger.fine("Chunk begin offset: " + chunk.get(CoreAnnotations.CharacterOffsetBeginAnnotation.class) +
", Source text begin offset " + annoBeginCharOffset);
chunkBeginCharOffset = 0;
}
if (chunkBeginCharOffset > annoText.length()) {
logger.fine("Adjusting begin char offset from " + chunkBeginCharOffset + " to " + annoText.length());
logger.fine("Chunk begin offset: " + chunk.get(CoreAnnotations.CharacterOffsetBeginAnnotation.class) +
", Source text begin offset " + annoBeginCharOffset);
chunkBeginCharOffset = annoText.length();
}
if (chunkEndCharOffset < 0) {
logger.fine("Adjusting end char offset from " + chunkEndCharOffset + " to 0");
logger.fine("Chunk end offset: " + chunk.get(CoreAnnotations.CharacterOffsetEndAnnotation.class) +
", Source text begin offset " + annoBeginCharOffset);
chunkEndCharOffset = 0;
}
if (chunkEndCharOffset > annoText.length()) {
logger.fine("Adjusting end char offset from " + chunkEndCharOffset + " to " + annoText.length());
logger.fine("Chunk end offset: " + chunk.get(CoreAnnotations.CharacterOffsetEndAnnotation.class) +
", Source text begin offset " + annoBeginCharOffset);
chunkEndCharOffset = annoText.length();
}
if (chunkEndCharOffset < chunkBeginCharOffset) {
logger.fine("Adjusting end char offset from " + chunkEndCharOffset + " to " + chunkBeginCharOffset);
logger.fine("Chunk end offset: " + chunk.get(CoreAnnotations.CharacterOffsetEndAnnotation.class) +
", Source text begin offset " + annoBeginCharOffset);
chunkEndCharOffset = chunkBeginCharOffset;
}
String chunkText = annoText.substring(chunkBeginCharOffset, chunkEndCharOffset);
chunk.set(CoreAnnotations.TextAnnotation.class, chunkText);
} | [
"public",
"static",
"void",
"annotateChunkText",
"(",
"CoreMap",
"chunk",
",",
"CoreMap",
"origAnnotation",
")",
"{",
"String",
"annoText",
"=",
"origAnnotation",
".",
"get",
"(",
"CoreAnnotations",
".",
"TextAnnotation",
".",
"class",
")",
";",
"Integer",
"annoBeginCharOffset",
"=",
"origAnnotation",
".",
"get",
"(",
"CoreAnnotations",
".",
"CharacterOffsetBeginAnnotation",
".",
"class",
")",
";",
"if",
"(",
"annoBeginCharOffset",
"==",
"null",
")",
"{",
"annoBeginCharOffset",
"=",
"0",
";",
"}",
"int",
"chunkBeginCharOffset",
"=",
"chunk",
".",
"get",
"(",
"CoreAnnotations",
".",
"CharacterOffsetBeginAnnotation",
".",
"class",
")",
"-",
"annoBeginCharOffset",
";",
"int",
"chunkEndCharOffset",
"=",
"chunk",
".",
"get",
"(",
"CoreAnnotations",
".",
"CharacterOffsetEndAnnotation",
".",
"class",
")",
"-",
"annoBeginCharOffset",
";",
"if",
"(",
"chunkBeginCharOffset",
"<",
"0",
")",
"{",
"logger",
".",
"fine",
"(",
"\"Adjusting begin char offset from \"",
"+",
"chunkBeginCharOffset",
"+",
"\" to 0\"",
")",
";",
"logger",
".",
"fine",
"(",
"\"Chunk begin offset: \"",
"+",
"chunk",
".",
"get",
"(",
"CoreAnnotations",
".",
"CharacterOffsetBeginAnnotation",
".",
"class",
")",
"+",
"\", Source text begin offset \"",
"+",
"annoBeginCharOffset",
")",
";",
"chunkBeginCharOffset",
"=",
"0",
";",
"}",
"if",
"(",
"chunkBeginCharOffset",
">",
"annoText",
".",
"length",
"(",
")",
")",
"{",
"logger",
".",
"fine",
"(",
"\"Adjusting begin char offset from \"",
"+",
"chunkBeginCharOffset",
"+",
"\" to \"",
"+",
"annoText",
".",
"length",
"(",
")",
")",
";",
"logger",
".",
"fine",
"(",
"\"Chunk begin offset: \"",
"+",
"chunk",
".",
"get",
"(",
"CoreAnnotations",
".",
"CharacterOffsetBeginAnnotation",
".",
"class",
")",
"+",
"\", Source text begin offset \"",
"+",
"annoBeginCharOffset",
")",
";",
"chunkBeginCharOffset",
"=",
"annoText",
".",
"length",
"(",
")",
";",
"}",
"if",
"(",
"chunkEndCharOffset",
"<",
"0",
")",
"{",
"logger",
".",
"fine",
"(",
"\"Adjusting end char offset from \"",
"+",
"chunkEndCharOffset",
"+",
"\" to 0\"",
")",
";",
"logger",
".",
"fine",
"(",
"\"Chunk end offset: \"",
"+",
"chunk",
".",
"get",
"(",
"CoreAnnotations",
".",
"CharacterOffsetEndAnnotation",
".",
"class",
")",
"+",
"\", Source text begin offset \"",
"+",
"annoBeginCharOffset",
")",
";",
"chunkEndCharOffset",
"=",
"0",
";",
"}",
"if",
"(",
"chunkEndCharOffset",
">",
"annoText",
".",
"length",
"(",
")",
")",
"{",
"logger",
".",
"fine",
"(",
"\"Adjusting end char offset from \"",
"+",
"chunkEndCharOffset",
"+",
"\" to \"",
"+",
"annoText",
".",
"length",
"(",
")",
")",
";",
"logger",
".",
"fine",
"(",
"\"Chunk end offset: \"",
"+",
"chunk",
".",
"get",
"(",
"CoreAnnotations",
".",
"CharacterOffsetEndAnnotation",
".",
"class",
")",
"+",
"\", Source text begin offset \"",
"+",
"annoBeginCharOffset",
")",
";",
"chunkEndCharOffset",
"=",
"annoText",
".",
"length",
"(",
")",
";",
"}",
"if",
"(",
"chunkEndCharOffset",
"<",
"chunkBeginCharOffset",
")",
"{",
"logger",
".",
"fine",
"(",
"\"Adjusting end char offset from \"",
"+",
"chunkEndCharOffset",
"+",
"\" to \"",
"+",
"chunkBeginCharOffset",
")",
";",
"logger",
".",
"fine",
"(",
"\"Chunk end offset: \"",
"+",
"chunk",
".",
"get",
"(",
"CoreAnnotations",
".",
"CharacterOffsetEndAnnotation",
".",
"class",
")",
"+",
"\", Source text begin offset \"",
"+",
"annoBeginCharOffset",
")",
";",
"chunkEndCharOffset",
"=",
"chunkBeginCharOffset",
";",
"}",
"String",
"chunkText",
"=",
"annoText",
".",
"substring",
"(",
"chunkBeginCharOffset",
",",
"chunkEndCharOffset",
")",
";",
"chunk",
".",
"set",
"(",
"CoreAnnotations",
".",
"TextAnnotation",
".",
"class",
",",
"chunkText",
")",
";",
"}"
] | Annotates a CoreMap representing a chunk with text information
TextAnnotation - String extracted from the origAnnotation using character offset information for this chunk
@param chunk - CoreMap to be annotated
@param origAnnotation - Annotation from which to extract the text for this chunk | [
"Annotates",
"a",
"CoreMap",
"representing",
"a",
"chunk",
"with",
"text",
"information",
"TextAnnotation",
"-",
"String",
"extracted",
"from",
"the",
"origAnnotation",
"using",
"character",
"offset",
"information",
"for",
"this",
"chunk"
] | b3d44bab9ec07ace0d13612c448a6b7298c1f681 | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/pipeline/ChunkAnnotationUtils.java#L536-L575 | train |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/pipeline/ChunkAnnotationUtils.java | ChunkAnnotationUtils.annotateChunkTokens | public static void annotateChunkTokens(CoreMap chunk, Class tokenChunkKey, Class tokenLabelKey)
{
List<CoreLabel> chunkTokens = chunk.get(CoreAnnotations.TokensAnnotation.class);
if (tokenLabelKey != null) {
String text = chunk.get(CoreAnnotations.TextAnnotation.class);
for (CoreLabel t: chunkTokens) {
t.set(tokenLabelKey, text);
}
}
if (tokenChunkKey != null) {
for (CoreLabel t: chunkTokens) {
t.set(tokenChunkKey, chunk);
}
}
} | java | public static void annotateChunkTokens(CoreMap chunk, Class tokenChunkKey, Class tokenLabelKey)
{
List<CoreLabel> chunkTokens = chunk.get(CoreAnnotations.TokensAnnotation.class);
if (tokenLabelKey != null) {
String text = chunk.get(CoreAnnotations.TextAnnotation.class);
for (CoreLabel t: chunkTokens) {
t.set(tokenLabelKey, text);
}
}
if (tokenChunkKey != null) {
for (CoreLabel t: chunkTokens) {
t.set(tokenChunkKey, chunk);
}
}
} | [
"public",
"static",
"void",
"annotateChunkTokens",
"(",
"CoreMap",
"chunk",
",",
"Class",
"tokenChunkKey",
",",
"Class",
"tokenLabelKey",
")",
"{",
"List",
"<",
"CoreLabel",
">",
"chunkTokens",
"=",
"chunk",
".",
"get",
"(",
"CoreAnnotations",
".",
"TokensAnnotation",
".",
"class",
")",
";",
"if",
"(",
"tokenLabelKey",
"!=",
"null",
")",
"{",
"String",
"text",
"=",
"chunk",
".",
"get",
"(",
"CoreAnnotations",
".",
"TextAnnotation",
".",
"class",
")",
";",
"for",
"(",
"CoreLabel",
"t",
":",
"chunkTokens",
")",
"{",
"t",
".",
"set",
"(",
"tokenLabelKey",
",",
"text",
")",
";",
"}",
"}",
"if",
"(",
"tokenChunkKey",
"!=",
"null",
")",
"{",
"for",
"(",
"CoreLabel",
"t",
":",
"chunkTokens",
")",
"{",
"t",
".",
"set",
"(",
"tokenChunkKey",
",",
"chunk",
")",
";",
"}",
"}",
"}"
] | Annotates tokens in chunk
@param chunk - CoreMap representing chunk (should have TextAnnotation and TokensAnnotation)
@param tokenChunkKey - If not null, each token is annotated with the chunk using this key
@param tokenLabelKey - If not null, each token is annotated with the text associated with the chunk using this key | [
"Annotates",
"tokens",
"in",
"chunk"
] | b3d44bab9ec07ace0d13612c448a6b7298c1f681 | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/pipeline/ChunkAnnotationUtils.java#L583-L597 | train |
meertensinstituut/mtas | src/main/java/mtas/codec/util/collector/MtasDataItem.java | MtasDataItem.computeComparableValue | private void computeComparableValue() {
recomputeComparableSortValue = false;
try {
int type = getCompareValueType();
switch (type) {
case 0:
comparableSortValue = getCompareValue0();
break;
case 1:
comparableSortValue = getCompareValue1();
break;
case 2:
comparableSortValue = getCompareValue2();
break;
default:
comparableSortValue = null;
break;
}
} catch (IOException e) {
log.debug(e);
comparableSortValue = null;
}
} | java | private void computeComparableValue() {
recomputeComparableSortValue = false;
try {
int type = getCompareValueType();
switch (type) {
case 0:
comparableSortValue = getCompareValue0();
break;
case 1:
comparableSortValue = getCompareValue1();
break;
case 2:
comparableSortValue = getCompareValue2();
break;
default:
comparableSortValue = null;
break;
}
} catch (IOException e) {
log.debug(e);
comparableSortValue = null;
}
} | [
"private",
"void",
"computeComparableValue",
"(",
")",
"{",
"recomputeComparableSortValue",
"=",
"false",
";",
"try",
"{",
"int",
"type",
"=",
"getCompareValueType",
"(",
")",
";",
"switch",
"(",
"type",
")",
"{",
"case",
"0",
":",
"comparableSortValue",
"=",
"getCompareValue0",
"(",
")",
";",
"break",
";",
"case",
"1",
":",
"comparableSortValue",
"=",
"getCompareValue1",
"(",
")",
";",
"break",
";",
"case",
"2",
":",
"comparableSortValue",
"=",
"getCompareValue2",
"(",
")",
";",
"break",
";",
"default",
":",
"comparableSortValue",
"=",
"null",
";",
"break",
";",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"log",
".",
"debug",
"(",
"e",
")",
";",
"comparableSortValue",
"=",
"null",
";",
"}",
"}"
] | Compute comparable value. | [
"Compute",
"comparable",
"value",
"."
] | f02ae730848616bd88b553efa7f9eddc32818e64 | https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/collector/MtasDataItem.java#L134-L156 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/basic/service_scpolicy_binding.java | service_scpolicy_binding.get | public static service_scpolicy_binding[] get(nitro_service service, String name) throws Exception{
service_scpolicy_binding obj = new service_scpolicy_binding();
obj.set_name(name);
service_scpolicy_binding response[] = (service_scpolicy_binding[]) obj.get_resources(service);
return response;
} | java | public static service_scpolicy_binding[] get(nitro_service service, String name) throws Exception{
service_scpolicy_binding obj = new service_scpolicy_binding();
obj.set_name(name);
service_scpolicy_binding response[] = (service_scpolicy_binding[]) obj.get_resources(service);
return response;
} | [
"public",
"static",
"service_scpolicy_binding",
"[",
"]",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"service_scpolicy_binding",
"obj",
"=",
"new",
"service_scpolicy_binding",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
")",
";",
"service_scpolicy_binding",
"response",
"[",
"]",
"=",
"(",
"service_scpolicy_binding",
"[",
"]",
")",
"obj",
".",
"get_resources",
"(",
"service",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch service_scpolicy_binding resources of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"service_scpolicy_binding",
"resources",
"of",
"given",
"name",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/basic/service_scpolicy_binding.java#L154-L159 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/appfw/appfwpolicy_appfwglobal_binding.java | appfwpolicy_appfwglobal_binding.get | public static appfwpolicy_appfwglobal_binding[] get(nitro_service service, String name) throws Exception{
appfwpolicy_appfwglobal_binding obj = new appfwpolicy_appfwglobal_binding();
obj.set_name(name);
appfwpolicy_appfwglobal_binding response[] = (appfwpolicy_appfwglobal_binding[]) obj.get_resources(service);
return response;
} | java | public static appfwpolicy_appfwglobal_binding[] get(nitro_service service, String name) throws Exception{
appfwpolicy_appfwglobal_binding obj = new appfwpolicy_appfwglobal_binding();
obj.set_name(name);
appfwpolicy_appfwglobal_binding response[] = (appfwpolicy_appfwglobal_binding[]) obj.get_resources(service);
return response;
} | [
"public",
"static",
"appfwpolicy_appfwglobal_binding",
"[",
"]",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"appfwpolicy_appfwglobal_binding",
"obj",
"=",
"new",
"appfwpolicy_appfwglobal_binding",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
")",
";",
"appfwpolicy_appfwglobal_binding",
"response",
"[",
"]",
"=",
"(",
"appfwpolicy_appfwglobal_binding",
"[",
"]",
")",
"obj",
".",
"get_resources",
"(",
"service",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch appfwpolicy_appfwglobal_binding resources of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"appfwpolicy_appfwglobal_binding",
"resources",
"of",
"given",
"name",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/appfw/appfwpolicy_appfwglobal_binding.java#L162-L167 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/transform/transformpolicy_lbvserver_binding.java | transformpolicy_lbvserver_binding.get | public static transformpolicy_lbvserver_binding[] get(nitro_service service, String name) throws Exception{
transformpolicy_lbvserver_binding obj = new transformpolicy_lbvserver_binding();
obj.set_name(name);
transformpolicy_lbvserver_binding response[] = (transformpolicy_lbvserver_binding[]) obj.get_resources(service);
return response;
} | java | public static transformpolicy_lbvserver_binding[] get(nitro_service service, String name) throws Exception{
transformpolicy_lbvserver_binding obj = new transformpolicy_lbvserver_binding();
obj.set_name(name);
transformpolicy_lbvserver_binding response[] = (transformpolicy_lbvserver_binding[]) obj.get_resources(service);
return response;
} | [
"public",
"static",
"transformpolicy_lbvserver_binding",
"[",
"]",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"transformpolicy_lbvserver_binding",
"obj",
"=",
"new",
"transformpolicy_lbvserver_binding",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
")",
";",
"transformpolicy_lbvserver_binding",
"response",
"[",
"]",
"=",
"(",
"transformpolicy_lbvserver_binding",
"[",
"]",
")",
"obj",
".",
"get_resources",
"(",
"service",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch transformpolicy_lbvserver_binding resources of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"transformpolicy_lbvserver_binding",
"resources",
"of",
"given",
"name",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/transform/transformpolicy_lbvserver_binding.java#L162-L167 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/system/systemparameter.java | systemparameter.update | public static base_response update(nitro_service client, systemparameter resource) throws Exception {
systemparameter updateresource = new systemparameter();
updateresource.rbaonresponse = resource.rbaonresponse;
updateresource.promptstring = resource.promptstring;
updateresource.natpcbforceflushlimit = resource.natpcbforceflushlimit;
updateresource.natpcbrstontimeout = resource.natpcbrstontimeout;
updateresource.timeout = resource.timeout;
return updateresource.update_resource(client);
} | java | public static base_response update(nitro_service client, systemparameter resource) throws Exception {
systemparameter updateresource = new systemparameter();
updateresource.rbaonresponse = resource.rbaonresponse;
updateresource.promptstring = resource.promptstring;
updateresource.natpcbforceflushlimit = resource.natpcbforceflushlimit;
updateresource.natpcbrstontimeout = resource.natpcbrstontimeout;
updateresource.timeout = resource.timeout;
return updateresource.update_resource(client);
} | [
"public",
"static",
"base_response",
"update",
"(",
"nitro_service",
"client",
",",
"systemparameter",
"resource",
")",
"throws",
"Exception",
"{",
"systemparameter",
"updateresource",
"=",
"new",
"systemparameter",
"(",
")",
";",
"updateresource",
".",
"rbaonresponse",
"=",
"resource",
".",
"rbaonresponse",
";",
"updateresource",
".",
"promptstring",
"=",
"resource",
".",
"promptstring",
";",
"updateresource",
".",
"natpcbforceflushlimit",
"=",
"resource",
".",
"natpcbforceflushlimit",
";",
"updateresource",
".",
"natpcbrstontimeout",
"=",
"resource",
".",
"natpcbrstontimeout",
";",
"updateresource",
".",
"timeout",
"=",
"resource",
".",
"timeout",
";",
"return",
"updateresource",
".",
"update_resource",
"(",
"client",
")",
";",
"}"
] | Use this API to update systemparameter. | [
"Use",
"this",
"API",
"to",
"update",
"systemparameter",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/system/systemparameter.java#L204-L212 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/system/systemparameter.java | systemparameter.unset | public static base_response unset(nitro_service client, systemparameter resource, String[] args) throws Exception{
systemparameter unsetresource = new systemparameter();
return unsetresource.unset_resource(client,args);
} | java | public static base_response unset(nitro_service client, systemparameter resource, String[] args) throws Exception{
systemparameter unsetresource = new systemparameter();
return unsetresource.unset_resource(client,args);
} | [
"public",
"static",
"base_response",
"unset",
"(",
"nitro_service",
"client",
",",
"systemparameter",
"resource",
",",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"systemparameter",
"unsetresource",
"=",
"new",
"systemparameter",
"(",
")",
";",
"return",
"unsetresource",
".",
"unset_resource",
"(",
"client",
",",
"args",
")",
";",
"}"
] | Use this API to unset the properties of systemparameter resource.
Properties that need to be unset are specified in args array. | [
"Use",
"this",
"API",
"to",
"unset",
"the",
"properties",
"of",
"systemparameter",
"resource",
".",
"Properties",
"that",
"need",
"to",
"be",
"unset",
"are",
"specified",
"in",
"args",
"array",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/system/systemparameter.java#L218-L221 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/system/systemparameter.java | systemparameter.get | public static systemparameter get(nitro_service service) throws Exception{
systemparameter obj = new systemparameter();
systemparameter[] response = (systemparameter[])obj.get_resources(service);
return response[0];
} | java | public static systemparameter get(nitro_service service) throws Exception{
systemparameter obj = new systemparameter();
systemparameter[] response = (systemparameter[])obj.get_resources(service);
return response[0];
} | [
"public",
"static",
"systemparameter",
"get",
"(",
"nitro_service",
"service",
")",
"throws",
"Exception",
"{",
"systemparameter",
"obj",
"=",
"new",
"systemparameter",
"(",
")",
";",
"systemparameter",
"[",
"]",
"response",
"=",
"(",
"systemparameter",
"[",
"]",
")",
"obj",
".",
"get_resources",
"(",
"service",
")",
";",
"return",
"response",
"[",
"0",
"]",
";",
"}"
] | Use this API to fetch all the systemparameter resources that are configured on netscaler. | [
"Use",
"this",
"API",
"to",
"fetch",
"all",
"the",
"systemparameter",
"resources",
"that",
"are",
"configured",
"on",
"netscaler",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/system/systemparameter.java#L226-L230 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/audit/auditnslogpolicy_appfwglobal_binding.java | auditnslogpolicy_appfwglobal_binding.get | public static auditnslogpolicy_appfwglobal_binding[] get(nitro_service service, String name) throws Exception{
auditnslogpolicy_appfwglobal_binding obj = new auditnslogpolicy_appfwglobal_binding();
obj.set_name(name);
auditnslogpolicy_appfwglobal_binding response[] = (auditnslogpolicy_appfwglobal_binding[]) obj.get_resources(service);
return response;
} | java | public static auditnslogpolicy_appfwglobal_binding[] get(nitro_service service, String name) throws Exception{
auditnslogpolicy_appfwglobal_binding obj = new auditnslogpolicy_appfwglobal_binding();
obj.set_name(name);
auditnslogpolicy_appfwglobal_binding response[] = (auditnslogpolicy_appfwglobal_binding[]) obj.get_resources(service);
return response;
} | [
"public",
"static",
"auditnslogpolicy_appfwglobal_binding",
"[",
"]",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"auditnslogpolicy_appfwglobal_binding",
"obj",
"=",
"new",
"auditnslogpolicy_appfwglobal_binding",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
")",
";",
"auditnslogpolicy_appfwglobal_binding",
"response",
"[",
"]",
"=",
"(",
"auditnslogpolicy_appfwglobal_binding",
"[",
"]",
")",
"obj",
".",
"get_resources",
"(",
"service",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch auditnslogpolicy_appfwglobal_binding resources of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"auditnslogpolicy_appfwglobal_binding",
"resources",
"of",
"given",
"name",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/audit/auditnslogpolicy_appfwglobal_binding.java#L132-L137 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/stat/cluster/clusterinstance_stats.java | clusterinstance_stats.get | public static clusterinstance_stats[] get(nitro_service service) throws Exception{
clusterinstance_stats obj = new clusterinstance_stats();
clusterinstance_stats[] response = (clusterinstance_stats[])obj.stat_resources(service);
return response;
} | java | public static clusterinstance_stats[] get(nitro_service service) throws Exception{
clusterinstance_stats obj = new clusterinstance_stats();
clusterinstance_stats[] response = (clusterinstance_stats[])obj.stat_resources(service);
return response;
} | [
"public",
"static",
"clusterinstance_stats",
"[",
"]",
"get",
"(",
"nitro_service",
"service",
")",
"throws",
"Exception",
"{",
"clusterinstance_stats",
"obj",
"=",
"new",
"clusterinstance_stats",
"(",
")",
";",
"clusterinstance_stats",
"[",
"]",
"response",
"=",
"(",
"clusterinstance_stats",
"[",
"]",
")",
"obj",
".",
"stat_resources",
"(",
"service",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch the statistics of all clusterinstance_stats resources that are configured on netscaler. | [
"Use",
"this",
"API",
"to",
"fetch",
"the",
"statistics",
"of",
"all",
"clusterinstance_stats",
"resources",
"that",
"are",
"configured",
"on",
"netscaler",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/cluster/clusterinstance_stats.java#L223-L227 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/stat/cluster/clusterinstance_stats.java | clusterinstance_stats.get | public static clusterinstance_stats get(nitro_service service, Long clid) throws Exception{
clusterinstance_stats obj = new clusterinstance_stats();
obj.set_clid(clid);
clusterinstance_stats response = (clusterinstance_stats) obj.stat_resource(service);
return response;
} | java | public static clusterinstance_stats get(nitro_service service, Long clid) throws Exception{
clusterinstance_stats obj = new clusterinstance_stats();
obj.set_clid(clid);
clusterinstance_stats response = (clusterinstance_stats) obj.stat_resource(service);
return response;
} | [
"public",
"static",
"clusterinstance_stats",
"get",
"(",
"nitro_service",
"service",
",",
"Long",
"clid",
")",
"throws",
"Exception",
"{",
"clusterinstance_stats",
"obj",
"=",
"new",
"clusterinstance_stats",
"(",
")",
";",
"obj",
".",
"set_clid",
"(",
"clid",
")",
";",
"clusterinstance_stats",
"response",
"=",
"(",
"clusterinstance_stats",
")",
"obj",
".",
"stat_resource",
"(",
"service",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch statistics of clusterinstance_stats resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"statistics",
"of",
"clusterinstance_stats",
"resource",
"of",
"given",
"name",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/cluster/clusterinstance_stats.java#L241-L246 | train |
udevbe/wayland-java-bindings | stubs-shared/src/main/java/org/freedesktop/wayland/util/Arguments.java | Arguments.set | public Arguments set(final int index,
final Fixed f) {
this.argumentRefs.add(f);
this.pointer.get(index)
.setF(f.getRaw());
return this;
} | java | public Arguments set(final int index,
final Fixed f) {
this.argumentRefs.add(f);
this.pointer.get(index)
.setF(f.getRaw());
return this;
} | [
"public",
"Arguments",
"set",
"(",
"final",
"int",
"index",
",",
"final",
"Fixed",
"f",
")",
"{",
"this",
".",
"argumentRefs",
".",
"add",
"(",
"f",
")",
";",
"this",
".",
"pointer",
".",
"get",
"(",
"index",
")",
".",
"setF",
"(",
"f",
".",
"getRaw",
"(",
")",
")",
";",
"return",
"this",
";",
"}"
] | wl_fixed_t f; fixed point
@param index
@param f
@return | [
"wl_fixed_t",
"f",
";",
"fixed",
"point"
] | c0551e74cd0597f3e81e2f976b255ee492160e5e | https://github.com/udevbe/wayland-java-bindings/blob/c0551e74cd0597f3e81e2f976b255ee492160e5e/stubs-shared/src/main/java/org/freedesktop/wayland/util/Arguments.java#L130-L136 | train |
udevbe/wayland-java-bindings | stubs-shared/src/main/java/org/freedesktop/wayland/util/ObjectCache.java | ObjectCache.store | public static void store(final long pointer,
final Object object) {
final Object oldValue = MAPPED_OBJECTS.put(pointer,
object);
if (oldValue != null) {
//put it back!
MAPPED_OBJECTS.put(pointer,
oldValue);
throw new IllegalStateException(String.format("Can not re-map existing pointer.\n" +
"Pointer=%s\n" +
"old value=%s" +
"\nnew value=%s",
pointer,
oldValue,
object));
}
} | java | public static void store(final long pointer,
final Object object) {
final Object oldValue = MAPPED_OBJECTS.put(pointer,
object);
if (oldValue != null) {
//put it back!
MAPPED_OBJECTS.put(pointer,
oldValue);
throw new IllegalStateException(String.format("Can not re-map existing pointer.\n" +
"Pointer=%s\n" +
"old value=%s" +
"\nnew value=%s",
pointer,
oldValue,
object));
}
} | [
"public",
"static",
"void",
"store",
"(",
"final",
"long",
"pointer",
",",
"final",
"Object",
"object",
")",
"{",
"final",
"Object",
"oldValue",
"=",
"MAPPED_OBJECTS",
".",
"put",
"(",
"pointer",
",",
"object",
")",
";",
"if",
"(",
"oldValue",
"!=",
"null",
")",
"{",
"//put it back!",
"MAPPED_OBJECTS",
".",
"put",
"(",
"pointer",
",",
"oldValue",
")",
";",
"throw",
"new",
"IllegalStateException",
"(",
"String",
".",
"format",
"(",
"\"Can not re-map existing pointer.\\n\"",
"+",
"\"Pointer=%s\\n\"",
"+",
"\"old value=%s\"",
"+",
"\"\\nnew value=%s\"",
",",
"pointer",
",",
"oldValue",
",",
"object",
")",
")",
";",
"}",
"}"
] | Maps a native pointer to a POJO. This method should be used to easily store a POJO with a native context.
@param pointer The pointer of the associated object.
@param object The object to cache. | [
"Maps",
"a",
"native",
"pointer",
"to",
"a",
"POJO",
".",
"This",
"method",
"should",
"be",
"used",
"to",
"easily",
"store",
"a",
"POJO",
"with",
"a",
"native",
"context",
"."
] | c0551e74cd0597f3e81e2f976b255ee492160e5e | https://github.com/udevbe/wayland-java-bindings/blob/c0551e74cd0597f3e81e2f976b255ee492160e5e/stubs-shared/src/main/java/org/freedesktop/wayland/util/ObjectCache.java#L50-L66 | train |
wildfly-swarm-archive/ARCHIVE-wildfly-swarm | container/runtime/src/main/java/org/wildfly/swarm/container/runtime/AbstractParserFactory.java | AbstractParserFactory.mapParserNamespaces | public static Optional<Map<QName, XMLElementReader<List<ModelNode>>>> mapParserNamespaces(AbstractParserFactory factory) {
Map<QName, XMLElementReader<List<ModelNode>>> result =
factory.create().entrySet()
.stream()
.collect(Collectors.toMap(
e -> new QName(e.getKey().getNamespaceURI(), SUBSYSTEM),
e -> e.getValue()
));
return Optional.of(result);
} | java | public static Optional<Map<QName, XMLElementReader<List<ModelNode>>>> mapParserNamespaces(AbstractParserFactory factory) {
Map<QName, XMLElementReader<List<ModelNode>>> result =
factory.create().entrySet()
.stream()
.collect(Collectors.toMap(
e -> new QName(e.getKey().getNamespaceURI(), SUBSYSTEM),
e -> e.getValue()
));
return Optional.of(result);
} | [
"public",
"static",
"Optional",
"<",
"Map",
"<",
"QName",
",",
"XMLElementReader",
"<",
"List",
"<",
"ModelNode",
">",
">",
">",
">",
"mapParserNamespaces",
"(",
"AbstractParserFactory",
"factory",
")",
"{",
"Map",
"<",
"QName",
",",
"XMLElementReader",
"<",
"List",
"<",
"ModelNode",
">",
">",
">",
"result",
"=",
"factory",
".",
"create",
"(",
")",
".",
"entrySet",
"(",
")",
".",
"stream",
"(",
")",
".",
"collect",
"(",
"Collectors",
".",
"toMap",
"(",
"e",
"->",
"new",
"QName",
"(",
"e",
".",
"getKey",
"(",
")",
".",
"getNamespaceURI",
"(",
")",
",",
"SUBSYSTEM",
")",
",",
"e",
"->",
"e",
".",
"getValue",
"(",
")",
")",
")",
";",
"return",
"Optional",
".",
"of",
"(",
"result",
")",
";",
"}"
] | Parsers retain the namespace, but the local part becomes 'subsystem'
@param factory the factory producing the parsers
@return | [
"Parsers",
"retain",
"the",
"namespace",
"but",
"the",
"local",
"part",
"becomes",
"subsystem"
] | 28ef71bcfa743a7267666e0ed2919c37b356c09b | https://github.com/wildfly-swarm-archive/ARCHIVE-wildfly-swarm/blob/28ef71bcfa743a7267666e0ed2919c37b356c09b/container/runtime/src/main/java/org/wildfly/swarm/container/runtime/AbstractParserFactory.java#L47-L57 | train |
udevbe/wayland-java-bindings | stubs-server/src/main/java/org/freedesktop/wayland/server/Client.java | Client.getObject | public Resource<?> getObject(final int id) {
return ObjectCache.from(WaylandServerCore.INSTANCE()
.wl_client_get_object(this.pointer,
id));
} | java | public Resource<?> getObject(final int id) {
return ObjectCache.from(WaylandServerCore.INSTANCE()
.wl_client_get_object(this.pointer,
id));
} | [
"public",
"Resource",
"<",
"?",
">",
"getObject",
"(",
"final",
"int",
"id",
")",
"{",
"return",
"ObjectCache",
".",
"from",
"(",
"WaylandServerCore",
".",
"INSTANCE",
"(",
")",
".",
"wl_client_get_object",
"(",
"this",
".",
"pointer",
",",
"id",
")",
")",
";",
"}"
] | Look up an object in the client name space. This looks up an object in the client object name space by its
object ID.
@param id The object id
@return The object or null if there is not object for the given ID | [
"Look",
"up",
"an",
"object",
"in",
"the",
"client",
"name",
"space",
".",
"This",
"looks",
"up",
"an",
"object",
"in",
"the",
"client",
"object",
"name",
"space",
"by",
"its",
"object",
"ID",
"."
] | c0551e74cd0597f3e81e2f976b255ee492160e5e | https://github.com/udevbe/wayland-java-bindings/blob/c0551e74cd0597f3e81e2f976b255ee492160e5e/stubs-server/src/main/java/org/freedesktop/wayland/server/Client.java#L115-L119 | train |
ragunathjawahar/adapter-kit | library/src/com/mobsandgeeks/adapters/SimpleSectionAdapter.java | SimpleSectionAdapter.getIndexForPosition | public int getIndexForPosition(int position) {
int nSections = 0;
Set<Entry<String, Integer>> entrySet = mSections.entrySet();
for(Entry<String, Integer> entry : entrySet) {
if(entry.getValue() < position) {
nSections++;
}
}
return position - nSections;
} | java | public int getIndexForPosition(int position) {
int nSections = 0;
Set<Entry<String, Integer>> entrySet = mSections.entrySet();
for(Entry<String, Integer> entry : entrySet) {
if(entry.getValue() < position) {
nSections++;
}
}
return position - nSections;
} | [
"public",
"int",
"getIndexForPosition",
"(",
"int",
"position",
")",
"{",
"int",
"nSections",
"=",
"0",
";",
"Set",
"<",
"Entry",
"<",
"String",
",",
"Integer",
">",
">",
"entrySet",
"=",
"mSections",
".",
"entrySet",
"(",
")",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
"Integer",
">",
"entry",
":",
"entrySet",
")",
"{",
"if",
"(",
"entry",
".",
"getValue",
"(",
")",
"<",
"position",
")",
"{",
"nSections",
"++",
";",
"}",
"}",
"return",
"position",
"-",
"nSections",
";",
"}"
] | Returns the actual index of the object in the data source linked to the this list item.
@param position List item position in the {@link ListView}.
@return Index of the item in the wrapped list adapter's data source. | [
"Returns",
"the",
"actual",
"index",
"of",
"the",
"object",
"in",
"the",
"data",
"source",
"linked",
"to",
"the",
"this",
"list",
"item",
"."
] | e5c13458c7f6dcc1c61410f9cfb55cd24bd31ca2 | https://github.com/ragunathjawahar/adapter-kit/blob/e5c13458c7f6dcc1c61410f9cfb55cd24bd31ca2/library/src/com/mobsandgeeks/adapters/SimpleSectionAdapter.java#L182-L193 | train |
structlogging/structlogger | structlogger/src/main/java/com/github/structlogging/processor/LogInvocationProcessor.java | LogInvocationProcessor.init | @Override
public void init(ProcessingEnvironment processingEnv) {
super.init(processingEnv);
trees = Trees.instance(processingEnv);
messager = processingEnv.getMessager();
types = processingEnv.getTypeUtils();
elements = processingEnv.getElementUtils();
try {
logInvocationScanner = new LogInvocationScanner(
processingEnv
);
} catch (IOException e) {
messager.printMessage(
Diagnostic.Kind.ERROR,
"IOException caught"
);
initFailed = true;
} catch (PackageNameException e) {
messager.printMessage(
Diagnostic.Kind.ERROR,
"generatedEventsPackage compiler argument is not valid, either it contains java keyword or subpackage or class name starts with number"
);
initFailed = true;
}
final String schemasRoot = processingEnv.getOptions().get("schemasRoot");
if (schemasRoot != null) {
try {
new URI(schemasRoot); //check that schemasRoot is valid path
} catch (URISyntaxException e) {
initFailed = true;
messager.printMessage(
Diagnostic.Kind.ERROR,
format("Provided schemasRoot compiler argument value [%s] is not valid path", schemasRoot)
);
}
// Used for generating json schemas by {@link SchemaGenerator}
SchemaGenerator schemaGenerator = new SchemaGenerator(generatedClassesInfo, schemasRoot);
JavacTask.instance(processingEnv).addTaskListener(schemaGenerator);
}
else {
messager.printMessage(
Diagnostic.Kind.MANDATORY_WARNING,
"schemasRoot compiler argument is not set, no schemas will be created"
);
}
} | java | @Override
public void init(ProcessingEnvironment processingEnv) {
super.init(processingEnv);
trees = Trees.instance(processingEnv);
messager = processingEnv.getMessager();
types = processingEnv.getTypeUtils();
elements = processingEnv.getElementUtils();
try {
logInvocationScanner = new LogInvocationScanner(
processingEnv
);
} catch (IOException e) {
messager.printMessage(
Diagnostic.Kind.ERROR,
"IOException caught"
);
initFailed = true;
} catch (PackageNameException e) {
messager.printMessage(
Diagnostic.Kind.ERROR,
"generatedEventsPackage compiler argument is not valid, either it contains java keyword or subpackage or class name starts with number"
);
initFailed = true;
}
final String schemasRoot = processingEnv.getOptions().get("schemasRoot");
if (schemasRoot != null) {
try {
new URI(schemasRoot); //check that schemasRoot is valid path
} catch (URISyntaxException e) {
initFailed = true;
messager.printMessage(
Diagnostic.Kind.ERROR,
format("Provided schemasRoot compiler argument value [%s] is not valid path", schemasRoot)
);
}
// Used for generating json schemas by {@link SchemaGenerator}
SchemaGenerator schemaGenerator = new SchemaGenerator(generatedClassesInfo, schemasRoot);
JavacTask.instance(processingEnv).addTaskListener(schemaGenerator);
}
else {
messager.printMessage(
Diagnostic.Kind.MANDATORY_WARNING,
"schemasRoot compiler argument is not set, no schemas will be created"
);
}
} | [
"@",
"Override",
"public",
"void",
"init",
"(",
"ProcessingEnvironment",
"processingEnv",
")",
"{",
"super",
".",
"init",
"(",
"processingEnv",
")",
";",
"trees",
"=",
"Trees",
".",
"instance",
"(",
"processingEnv",
")",
";",
"messager",
"=",
"processingEnv",
".",
"getMessager",
"(",
")",
";",
"types",
"=",
"processingEnv",
".",
"getTypeUtils",
"(",
")",
";",
"elements",
"=",
"processingEnv",
".",
"getElementUtils",
"(",
")",
";",
"try",
"{",
"logInvocationScanner",
"=",
"new",
"LogInvocationScanner",
"(",
"processingEnv",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"messager",
".",
"printMessage",
"(",
"Diagnostic",
".",
"Kind",
".",
"ERROR",
",",
"\"IOException caught\"",
")",
";",
"initFailed",
"=",
"true",
";",
"}",
"catch",
"(",
"PackageNameException",
"e",
")",
"{",
"messager",
".",
"printMessage",
"(",
"Diagnostic",
".",
"Kind",
".",
"ERROR",
",",
"\"generatedEventsPackage compiler argument is not valid, either it contains java keyword or subpackage or class name starts with number\"",
")",
";",
"initFailed",
"=",
"true",
";",
"}",
"final",
"String",
"schemasRoot",
"=",
"processingEnv",
".",
"getOptions",
"(",
")",
".",
"get",
"(",
"\"schemasRoot\"",
")",
";",
"if",
"(",
"schemasRoot",
"!=",
"null",
")",
"{",
"try",
"{",
"new",
"URI",
"(",
"schemasRoot",
")",
";",
"//check that schemasRoot is valid path",
"}",
"catch",
"(",
"URISyntaxException",
"e",
")",
"{",
"initFailed",
"=",
"true",
";",
"messager",
".",
"printMessage",
"(",
"Diagnostic",
".",
"Kind",
".",
"ERROR",
",",
"format",
"(",
"\"Provided schemasRoot compiler argument value [%s] is not valid path\"",
",",
"schemasRoot",
")",
")",
";",
"}",
"// Used for generating json schemas by {@link SchemaGenerator}",
"SchemaGenerator",
"schemaGenerator",
"=",
"new",
"SchemaGenerator",
"(",
"generatedClassesInfo",
",",
"schemasRoot",
")",
";",
"JavacTask",
".",
"instance",
"(",
"processingEnv",
")",
".",
"addTaskListener",
"(",
"schemaGenerator",
")",
";",
"}",
"else",
"{",
"messager",
".",
"printMessage",
"(",
"Diagnostic",
".",
"Kind",
".",
"MANDATORY_WARNING",
",",
"\"schemasRoot compiler argument is not set, no schemas will be created\"",
")",
";",
"}",
"}"
] | flag that init method has errors | [
"flag",
"that",
"init",
"method",
"has",
"errors"
] | 1fcca4e962ef53cbdb94bd72cb556de7f5f9469f | https://github.com/structlogging/structlogger/blob/1fcca4e962ef53cbdb94bd72cb556de7f5f9469f/structlogger/src/main/java/com/github/structlogging/processor/LogInvocationProcessor.java#L109-L158 | train |
udevbe/wayland-java-bindings | stubs-client/src/main/java/org/freedesktop/wayland/client/Proxy.java | Proxy.marshalConstructor | private <J, T extends Proxy<J>> T marshalConstructor(final int opcode,
final J implementation,
final int version,
final Class<T> newProxyCls,
final long argsPointer) {
try {
final long wlProxy = WaylandClientCore.INSTANCE()
.wl_proxy_marshal_array_constructor(this.pointer,
opcode,
argsPointer,
InterfaceMeta.get(newProxyCls).pointer.address);
return marshalProxy(wlProxy,
implementation,
version,
newProxyCls);
}
catch (final NoSuchMethodException |
IllegalAccessException |
InstantiationException |
InvocationTargetException e) {
throw new RuntimeException("Uh oh, this is a bug!",
e);
}
} | java | private <J, T extends Proxy<J>> T marshalConstructor(final int opcode,
final J implementation,
final int version,
final Class<T> newProxyCls,
final long argsPointer) {
try {
final long wlProxy = WaylandClientCore.INSTANCE()
.wl_proxy_marshal_array_constructor(this.pointer,
opcode,
argsPointer,
InterfaceMeta.get(newProxyCls).pointer.address);
return marshalProxy(wlProxy,
implementation,
version,
newProxyCls);
}
catch (final NoSuchMethodException |
IllegalAccessException |
InstantiationException |
InvocationTargetException e) {
throw new RuntimeException("Uh oh, this is a bug!",
e);
}
} | [
"private",
"<",
"J",
",",
"T",
"extends",
"Proxy",
"<",
"J",
">",
">",
"T",
"marshalConstructor",
"(",
"final",
"int",
"opcode",
",",
"final",
"J",
"implementation",
",",
"final",
"int",
"version",
",",
"final",
"Class",
"<",
"T",
">",
"newProxyCls",
",",
"final",
"long",
"argsPointer",
")",
"{",
"try",
"{",
"final",
"long",
"wlProxy",
"=",
"WaylandClientCore",
".",
"INSTANCE",
"(",
")",
".",
"wl_proxy_marshal_array_constructor",
"(",
"this",
".",
"pointer",
",",
"opcode",
",",
"argsPointer",
",",
"InterfaceMeta",
".",
"get",
"(",
"newProxyCls",
")",
".",
"pointer",
".",
"address",
")",
";",
"return",
"marshalProxy",
"(",
"wlProxy",
",",
"implementation",
",",
"version",
",",
"newProxyCls",
")",
";",
"}",
"catch",
"(",
"final",
"NoSuchMethodException",
"|",
"IllegalAccessException",
"|",
"InstantiationException",
"|",
"InvocationTargetException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Uh oh, this is a bug!\"",
",",
"e",
")",
";",
"}",
"}"
] | called from generated proxies | [
"called",
"from",
"generated",
"proxies"
] | c0551e74cd0597f3e81e2f976b255ee492160e5e | https://github.com/udevbe/wayland-java-bindings/blob/c0551e74cd0597f3e81e2f976b255ee492160e5e/stubs-client/src/main/java/org/freedesktop/wayland/client/Proxy.java#L164-L187 | train |
udevbe/wayland-java-bindings | stubs-client/src/main/java/org/freedesktop/wayland/client/Proxy.java | Proxy.destroy | public void destroy() {
WaylandClientCore.INSTANCE()
.wl_proxy_destroy(this.pointer);
ObjectCache.remove(this.pointer);
this.jObjectPointer.close();
} | java | public void destroy() {
WaylandClientCore.INSTANCE()
.wl_proxy_destroy(this.pointer);
ObjectCache.remove(this.pointer);
this.jObjectPointer.close();
} | [
"public",
"void",
"destroy",
"(",
")",
"{",
"WaylandClientCore",
".",
"INSTANCE",
"(",
")",
".",
"wl_proxy_destroy",
"(",
"this",
".",
"pointer",
")",
";",
"ObjectCache",
".",
"remove",
"(",
"this",
".",
"pointer",
")",
";",
"this",
".",
"jObjectPointer",
".",
"close",
"(",
")",
";",
"}"
] | Destroy a proxy object | [
"Destroy",
"a",
"proxy",
"object"
] | c0551e74cd0597f3e81e2f976b255ee492160e5e | https://github.com/udevbe/wayland-java-bindings/blob/c0551e74cd0597f3e81e2f976b255ee492160e5e/stubs-client/src/main/java/org/freedesktop/wayland/client/Proxy.java#L294-L299 | train |
wildfly-swarm-archive/ARCHIVE-wildfly-swarm | container/api/src/main/java/org/wildfly/swarm/ContainerOnlySwarm.java | ContainerOnlySwarm.main | public static void main(String... args) throws Exception {
if (System.getProperty("boot.module.loader") == null) {
System.setProperty("boot.module.loader", "org.wildfly.swarm.bootstrap.modules.BootModuleLoader");
}
Module bootstrap = Module.getBootModuleLoader().loadModule(ModuleIdentifier.create("swarm.application"));
ServiceLoader<ContainerFactory> factory = bootstrap.loadService(ContainerFactory.class);
Iterator<ContainerFactory> factoryIter = factory.iterator();
if (!factoryIter.hasNext()) {
simpleMain(args);
} else {
factoryMain(factoryIter.next(), args);
}
} | java | public static void main(String... args) throws Exception {
if (System.getProperty("boot.module.loader") == null) {
System.setProperty("boot.module.loader", "org.wildfly.swarm.bootstrap.modules.BootModuleLoader");
}
Module bootstrap = Module.getBootModuleLoader().loadModule(ModuleIdentifier.create("swarm.application"));
ServiceLoader<ContainerFactory> factory = bootstrap.loadService(ContainerFactory.class);
Iterator<ContainerFactory> factoryIter = factory.iterator();
if (!factoryIter.hasNext()) {
simpleMain(args);
} else {
factoryMain(factoryIter.next(), args);
}
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"...",
"args",
")",
"throws",
"Exception",
"{",
"if",
"(",
"System",
".",
"getProperty",
"(",
"\"boot.module.loader\"",
")",
"==",
"null",
")",
"{",
"System",
".",
"setProperty",
"(",
"\"boot.module.loader\"",
",",
"\"org.wildfly.swarm.bootstrap.modules.BootModuleLoader\"",
")",
";",
"}",
"Module",
"bootstrap",
"=",
"Module",
".",
"getBootModuleLoader",
"(",
")",
".",
"loadModule",
"(",
"ModuleIdentifier",
".",
"create",
"(",
"\"swarm.application\"",
")",
")",
";",
"ServiceLoader",
"<",
"ContainerFactory",
">",
"factory",
"=",
"bootstrap",
".",
"loadService",
"(",
"ContainerFactory",
".",
"class",
")",
";",
"Iterator",
"<",
"ContainerFactory",
">",
"factoryIter",
"=",
"factory",
".",
"iterator",
"(",
")",
";",
"if",
"(",
"!",
"factoryIter",
".",
"hasNext",
"(",
")",
")",
"{",
"simpleMain",
"(",
"args",
")",
";",
"}",
"else",
"{",
"factoryMain",
"(",
"factoryIter",
".",
"next",
"(",
")",
",",
"args",
")",
";",
"}",
"}"
] | Main entry-point.
@param args Ignored.
@throws Exception if an error occurs. | [
"Main",
"entry",
"-",
"point",
"."
] | 28ef71bcfa743a7267666e0ed2919c37b356c09b | https://github.com/wildfly-swarm-archive/ARCHIVE-wildfly-swarm/blob/28ef71bcfa743a7267666e0ed2919c37b356c09b/container/api/src/main/java/org/wildfly/swarm/ContainerOnlySwarm.java#L41-L55 | train |
ragunathjawahar/adapter-kit | library/src/com/mobsandgeeks/adapters/InstantAdapterCore.java | InstantAdapterCore.bindToView | public final void bindToView(final ViewGroup parent, final View view,
final T instance, final int position) {
SparseArray<Holder> holders = (SparseArray<Holder>) view.getTag(mLayoutResourceId);
updateAnnotatedViews(holders, view, instance, position);
executeViewHandlers(holders, parent, view, instance, position);
} | java | public final void bindToView(final ViewGroup parent, final View view,
final T instance, final int position) {
SparseArray<Holder> holders = (SparseArray<Holder>) view.getTag(mLayoutResourceId);
updateAnnotatedViews(holders, view, instance, position);
executeViewHandlers(holders, parent, view, instance, position);
} | [
"public",
"final",
"void",
"bindToView",
"(",
"final",
"ViewGroup",
"parent",
",",
"final",
"View",
"view",
",",
"final",
"T",
"instance",
",",
"final",
"int",
"position",
")",
"{",
"SparseArray",
"<",
"Holder",
">",
"holders",
"=",
"(",
"SparseArray",
"<",
"Holder",
">",
")",
"view",
".",
"getTag",
"(",
"mLayoutResourceId",
")",
";",
"updateAnnotatedViews",
"(",
"holders",
",",
"view",
",",
"instance",
",",
"position",
")",
";",
"executeViewHandlers",
"(",
"holders",
",",
"parent",
",",
"view",
",",
"instance",
",",
"position",
")",
";",
"}"
] | Method binds a POJO to the inflated View.
@param parent The {@link View}'s parent, usually an {@link AdapterView} such as a
{@link ListView}.
@param view The associated view.
@param instance Instance backed by the adapter at the given position.
@param position The list item's position. | [
"Method",
"binds",
"a",
"POJO",
"to",
"the",
"inflated",
"View",
"."
] | e5c13458c7f6dcc1c61410f9cfb55cd24bd31ca2 | https://github.com/ragunathjawahar/adapter-kit/blob/e5c13458c7f6dcc1c61410f9cfb55cd24bd31ca2/library/src/com/mobsandgeeks/adapters/InstantAdapterCore.java#L116-L121 | train |
ragunathjawahar/adapter-kit | library/src/com/mobsandgeeks/adapters/InstantAdapterCore.java | InstantAdapterCore.createNewView | public final View createNewView(final Context context, final ViewGroup parent) {
View view = mLayoutInflater.inflate(mLayoutResourceId, parent, false);
SparseArray<Holder> holders = new SparseArray<Holder>();
int size = mViewIdsAndMetaCache.size();
for (int i = 0; i < size; i++) {
int viewId = mViewIdsAndMetaCache.keyAt(i);
Meta meta = mViewIdsAndMetaCache.get(viewId);
View viewFromLayout = view.findViewById(viewId);
if (viewFromLayout == null) {
String message = String.format("Cannot find View, check the 'viewId' " +
"attribute on method %s.%s()",
mDataType.getName(), meta.method.getName());
throw new IllegalStateException(message);
}
holders.append(viewId, new Holder(viewFromLayout, meta));
mAnnotatedViewIds.add(viewId);
}
view.setTag(mLayoutResourceId, holders);
return view;
} | java | public final View createNewView(final Context context, final ViewGroup parent) {
View view = mLayoutInflater.inflate(mLayoutResourceId, parent, false);
SparseArray<Holder> holders = new SparseArray<Holder>();
int size = mViewIdsAndMetaCache.size();
for (int i = 0; i < size; i++) {
int viewId = mViewIdsAndMetaCache.keyAt(i);
Meta meta = mViewIdsAndMetaCache.get(viewId);
View viewFromLayout = view.findViewById(viewId);
if (viewFromLayout == null) {
String message = String.format("Cannot find View, check the 'viewId' " +
"attribute on method %s.%s()",
mDataType.getName(), meta.method.getName());
throw new IllegalStateException(message);
}
holders.append(viewId, new Holder(viewFromLayout, meta));
mAnnotatedViewIds.add(viewId);
}
view.setTag(mLayoutResourceId, holders);
return view;
} | [
"public",
"final",
"View",
"createNewView",
"(",
"final",
"Context",
"context",
",",
"final",
"ViewGroup",
"parent",
")",
"{",
"View",
"view",
"=",
"mLayoutInflater",
".",
"inflate",
"(",
"mLayoutResourceId",
",",
"parent",
",",
"false",
")",
";",
"SparseArray",
"<",
"Holder",
">",
"holders",
"=",
"new",
"SparseArray",
"<",
"Holder",
">",
"(",
")",
";",
"int",
"size",
"=",
"mViewIdsAndMetaCache",
".",
"size",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"{",
"int",
"viewId",
"=",
"mViewIdsAndMetaCache",
".",
"keyAt",
"(",
"i",
")",
";",
"Meta",
"meta",
"=",
"mViewIdsAndMetaCache",
".",
"get",
"(",
"viewId",
")",
";",
"View",
"viewFromLayout",
"=",
"view",
".",
"findViewById",
"(",
"viewId",
")",
";",
"if",
"(",
"viewFromLayout",
"==",
"null",
")",
"{",
"String",
"message",
"=",
"String",
".",
"format",
"(",
"\"Cannot find View, check the 'viewId' \"",
"+",
"\"attribute on method %s.%s()\"",
",",
"mDataType",
".",
"getName",
"(",
")",
",",
"meta",
".",
"method",
".",
"getName",
"(",
")",
")",
";",
"throw",
"new",
"IllegalStateException",
"(",
"message",
")",
";",
"}",
"holders",
".",
"append",
"(",
"viewId",
",",
"new",
"Holder",
"(",
"viewFromLayout",
",",
"meta",
")",
")",
";",
"mAnnotatedViewIds",
".",
"add",
"(",
"viewId",
")",
";",
"}",
"view",
".",
"setTag",
"(",
"mLayoutResourceId",
",",
"holders",
")",
";",
"return",
"view",
";",
"}"
] | Create a new view by inflating the associated XML layout.
@param context The {@link Context} to use.
@param parent The inflated view's parent.
@return The {@link View} that was inflated from the layout. | [
"Create",
"a",
"new",
"view",
"by",
"inflating",
"the",
"associated",
"XML",
"layout",
"."
] | e5c13458c7f6dcc1c61410f9cfb55cd24bd31ca2 | https://github.com/ragunathjawahar/adapter-kit/blob/e5c13458c7f6dcc1c61410f9cfb55cd24bd31ca2/library/src/com/mobsandgeeks/adapters/InstantAdapterCore.java#L130-L151 | train |
wildfly-swarm-archive/ARCHIVE-wildfly-swarm | container/runtime/src/main/java/org/wildfly/swarm/container/runtime/RuntimeServer.java | RuntimeServer.visitFractions | private <T> void visitFractions(Container container, T context, FractionProcessor<T> fn) {
OUTER:
for (ServerConfiguration eachConfig : this.configList) {
boolean found = false;
INNER:
for (Fraction eachFraction : container.fractions()) {
if (eachConfig.getType().isAssignableFrom(eachFraction.getClass())) {
found = true;
fn.accept(context, eachConfig, eachFraction);
break INNER;
}
}
if (!found && !eachConfig.isIgnorable()) {
System.err.println("*** unable to find fraction for: " + eachConfig.getType());
}
}
} | java | private <T> void visitFractions(Container container, T context, FractionProcessor<T> fn) {
OUTER:
for (ServerConfiguration eachConfig : this.configList) {
boolean found = false;
INNER:
for (Fraction eachFraction : container.fractions()) {
if (eachConfig.getType().isAssignableFrom(eachFraction.getClass())) {
found = true;
fn.accept(context, eachConfig, eachFraction);
break INNER;
}
}
if (!found && !eachConfig.isIgnorable()) {
System.err.println("*** unable to find fraction for: " + eachConfig.getType());
}
}
} | [
"private",
"<",
"T",
">",
"void",
"visitFractions",
"(",
"Container",
"container",
",",
"T",
"context",
",",
"FractionProcessor",
"<",
"T",
">",
"fn",
")",
"{",
"OUTER",
":",
"for",
"(",
"ServerConfiguration",
"eachConfig",
":",
"this",
".",
"configList",
")",
"{",
"boolean",
"found",
"=",
"false",
";",
"INNER",
":",
"for",
"(",
"Fraction",
"eachFraction",
":",
"container",
".",
"fractions",
"(",
")",
")",
"{",
"if",
"(",
"eachConfig",
".",
"getType",
"(",
")",
".",
"isAssignableFrom",
"(",
"eachFraction",
".",
"getClass",
"(",
")",
")",
")",
"{",
"found",
"=",
"true",
";",
"fn",
".",
"accept",
"(",
"context",
",",
"eachConfig",
",",
"eachFraction",
")",
";",
"break",
"INNER",
";",
"}",
"}",
"if",
"(",
"!",
"found",
"&&",
"!",
"eachConfig",
".",
"isIgnorable",
"(",
")",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"*** unable to find fraction for: \"",
"+",
"eachConfig",
".",
"getType",
"(",
")",
")",
";",
"}",
"}",
"}"
] | Wraps common iteration pattern over fraction and server configurations
@param container
@param context processing context (i.e. accumulator)
@param fn a {@link org.wildfly.swarm.container.runtime.RuntimeServer.FractionProcessor} instance | [
"Wraps",
"common",
"iteration",
"pattern",
"over",
"fraction",
"and",
"server",
"configurations"
] | 28ef71bcfa743a7267666e0ed2919c37b356c09b | https://github.com/wildfly-swarm-archive/ARCHIVE-wildfly-swarm/blob/28ef71bcfa743a7267666e0ed2919c37b356c09b/container/runtime/src/main/java/org/wildfly/swarm/container/runtime/RuntimeServer.java#L577-L594 | train |
structlogging/structlogger | structlogger/src/main/java/com/github/structlogging/processor/LogInvocationScanner.java | LogInvocationScanner.handle | private void handle(final JCTree.JCFieldAccess fieldAccess,
final Stack<MethodAndParameter> stack,
final MethodInvocationTree node,
final StatementInfo statementInfo,
final ScannerParams scannerParams) {
if (fieldAccess.getExpression().getKind().equals( Tree.Kind.MEMBER_SELECT)) {
//to handle when structlogger field is referenced through this.field and ClassName.field
final MemberSelectTree expression = (MemberSelectTree) fieldAccess.getExpression();
final Name name = expression.getIdentifier();
if (scannerParams.getFields().containsKey(name)) {
handleStructLogExpression(stack, node, name, statementInfo, scannerParams);
}
}
else if (fieldAccess.getExpression().getKind().equals( Tree.Kind.IDENTIFIER)) {
// to handle when structlogger field is referenced directly
final JCTree.JCIdent ident = (JCTree.JCIdent) fieldAccess.getExpression();
final Name name = ident.getName();
if (scannerParams.getFields().containsKey(name)) {
handleStructLogExpression(stack, node, name, statementInfo, scannerParams);
}
}
} | java | private void handle(final JCTree.JCFieldAccess fieldAccess,
final Stack<MethodAndParameter> stack,
final MethodInvocationTree node,
final StatementInfo statementInfo,
final ScannerParams scannerParams) {
if (fieldAccess.getExpression().getKind().equals( Tree.Kind.MEMBER_SELECT)) {
//to handle when structlogger field is referenced through this.field and ClassName.field
final MemberSelectTree expression = (MemberSelectTree) fieldAccess.getExpression();
final Name name = expression.getIdentifier();
if (scannerParams.getFields().containsKey(name)) {
handleStructLogExpression(stack, node, name, statementInfo, scannerParams);
}
}
else if (fieldAccess.getExpression().getKind().equals( Tree.Kind.IDENTIFIER)) {
// to handle when structlogger field is referenced directly
final JCTree.JCIdent ident = (JCTree.JCIdent) fieldAccess.getExpression();
final Name name = ident.getName();
if (scannerParams.getFields().containsKey(name)) {
handleStructLogExpression(stack, node, name, statementInfo, scannerParams);
}
}
} | [
"private",
"void",
"handle",
"(",
"final",
"JCTree",
".",
"JCFieldAccess",
"fieldAccess",
",",
"final",
"Stack",
"<",
"MethodAndParameter",
">",
"stack",
",",
"final",
"MethodInvocationTree",
"node",
",",
"final",
"StatementInfo",
"statementInfo",
",",
"final",
"ScannerParams",
"scannerParams",
")",
"{",
"if",
"(",
"fieldAccess",
".",
"getExpression",
"(",
")",
".",
"getKind",
"(",
")",
".",
"equals",
"(",
"Tree",
".",
"Kind",
".",
"MEMBER_SELECT",
")",
")",
"{",
"//to handle when structlogger field is referenced through this.field and ClassName.field",
"final",
"MemberSelectTree",
"expression",
"=",
"(",
"MemberSelectTree",
")",
"fieldAccess",
".",
"getExpression",
"(",
")",
";",
"final",
"Name",
"name",
"=",
"expression",
".",
"getIdentifier",
"(",
")",
";",
"if",
"(",
"scannerParams",
".",
"getFields",
"(",
")",
".",
"containsKey",
"(",
"name",
")",
")",
"{",
"handleStructLogExpression",
"(",
"stack",
",",
"node",
",",
"name",
",",
"statementInfo",
",",
"scannerParams",
")",
";",
"}",
"}",
"else",
"if",
"(",
"fieldAccess",
".",
"getExpression",
"(",
")",
".",
"getKind",
"(",
")",
".",
"equals",
"(",
"Tree",
".",
"Kind",
".",
"IDENTIFIER",
")",
")",
"{",
"// to handle when structlogger field is referenced directly",
"final",
"JCTree",
".",
"JCIdent",
"ident",
"=",
"(",
"JCTree",
".",
"JCIdent",
")",
"fieldAccess",
".",
"getExpression",
"(",
")",
";",
"final",
"Name",
"name",
"=",
"ident",
".",
"getName",
"(",
")",
";",
"if",
"(",
"scannerParams",
".",
"getFields",
"(",
")",
".",
"containsKey",
"(",
"name",
")",
")",
"{",
"handleStructLogExpression",
"(",
"stack",
",",
"node",
",",
"name",
",",
"statementInfo",
",",
"scannerParams",
")",
";",
"}",
"}",
"}"
] | checks whether fieldAccess node's expression is MEMBER_SELECT or IDENTIFIER
and if so then checks that accessed field name corresponds with some declared structlogger field
and if it does correspond, then whole statement is handled as structlogger expression
@param fieldAccess to be analyzed
@param stack filled with previous method calls
@param node AST node
@param statementInfo info about analyzed statement
@param scannerParams params passed from processor | [
"checks",
"whether",
"fieldAccess",
"node",
"s",
"expression",
"is",
"MEMBER_SELECT",
"or",
"IDENTIFIER",
"and",
"if",
"so",
"then",
"checks",
"that",
"accessed",
"field",
"name",
"corresponds",
"with",
"some",
"declared",
"structlogger",
"field",
"and",
"if",
"it",
"does",
"correspond",
"then",
"whole",
"statement",
"is",
"handled",
"as",
"structlogger",
"expression"
] | 1fcca4e962ef53cbdb94bd72cb556de7f5f9469f | https://github.com/structlogging/structlogger/blob/1fcca4e962ef53cbdb94bd72cb556de7f5f9469f/structlogger/src/main/java/com/github/structlogging/processor/LogInvocationScanner.java#L154-L175 | train |
structlogging/structlogger | structlogger/src/main/java/com/github/structlogging/processor/LogInvocationScanner.java | LogInvocationScanner.formatWithStatementLocation | private String formatWithStatementLocation(String format, StatementInfo statementInfo, Object... args) {
return format(format, args) + format(" [%s:%s]", statementInfo.getSourceFileName(), statementInfo.getLineNumber());
} | java | private String formatWithStatementLocation(String format, StatementInfo statementInfo, Object... args) {
return format(format, args) + format(" [%s:%s]", statementInfo.getSourceFileName(), statementInfo.getLineNumber());
} | [
"private",
"String",
"formatWithStatementLocation",
"(",
"String",
"format",
",",
"StatementInfo",
"statementInfo",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"format",
"(",
"format",
",",
"args",
")",
"+",
"format",
"(",
"\" [%s:%s]\"",
",",
"statementInfo",
".",
"getSourceFileName",
"(",
")",
",",
"statementInfo",
".",
"getLineNumber",
"(",
")",
")",
";",
"}"
] | System.format with string representing statement location added at the end | [
"System",
".",
"format",
"with",
"string",
"representing",
"statement",
"location",
"added",
"at",
"the",
"end"
] | 1fcca4e962ef53cbdb94bd72cb556de7f5f9469f | https://github.com/structlogging/structlogger/blob/1fcca4e962ef53cbdb94bd72cb556de7f5f9469f/structlogger/src/main/java/com/github/structlogging/processor/LogInvocationScanner.java#L357-L359 | train |
structlogging/structlogger | structlogger/src/main/java/com/github/structlogging/processor/LogInvocationScanner.java | LogInvocationScanner.addVariablesToBuffer | private void addVariablesToBuffer(final java.util.List<VariableAndValue> usedVariables, final ListBuffer listBuffer) {
for (VariableAndValue variableAndValue : usedVariables) {
listBuffer.add(variableAndValue.getValue());
}
} | java | private void addVariablesToBuffer(final java.util.List<VariableAndValue> usedVariables, final ListBuffer listBuffer) {
for (VariableAndValue variableAndValue : usedVariables) {
listBuffer.add(variableAndValue.getValue());
}
} | [
"private",
"void",
"addVariablesToBuffer",
"(",
"final",
"java",
".",
"util",
".",
"List",
"<",
"VariableAndValue",
">",
"usedVariables",
",",
"final",
"ListBuffer",
"listBuffer",
")",
"{",
"for",
"(",
"VariableAndValue",
"variableAndValue",
":",
"usedVariables",
")",
"{",
"listBuffer",
".",
"add",
"(",
"variableAndValue",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}"
] | all used variables are added to listbuffer | [
"all",
"used",
"variables",
"are",
"added",
"to",
"listbuffer"
] | 1fcca4e962ef53cbdb94bd72cb556de7f5f9469f | https://github.com/structlogging/structlogger/blob/1fcca4e962ef53cbdb94bd72cb556de7f5f9469f/structlogger/src/main/java/com/github/structlogging/processor/LogInvocationScanner.java#L495-L499 | train |
tomitribe/crest | tomitribe-crest-cli/src/main/java/org/tomitribe/crest/cli/impl/CommandParser.java | CommandParser.toArgs | public Command[] toArgs(final String line) {
if (line == null || line.isEmpty()) {
throw new IllegalArgumentException("Empty command.");
}
final List<Command> commands = new ArrayList<>();
final List<String> result = new ArrayList<>();
final StringBuilder current = new StringBuilder();
char waitChar = ' ';
boolean copyNextChar = false;
boolean inEscaped = false;
for (final char c : line.toCharArray()) {
if (copyNextChar) {
current.append(c);
copyNextChar = false;
} else if (waitChar == c) {
if (current.length() > 0) {
result.add(current.toString());
current.setLength(0);
}
waitChar = ' ';
inEscaped = false;
} else {
switch (c) {
case '"':
case '\'':
if (!inEscaped) {
waitChar = c;
inEscaped = true;
break;
} else {
current.append(c);
}
break;
case '\\':
copyNextChar = true;
break;
case '|':
flush(commands, result, current);
break;
default:
current.append(c);
}
}
}
if (waitChar != ' ') {
throw new IllegalStateException("Missing closing " + Character.toString(waitChar));
}
flush(commands, result, current);
return commands.toArray(new Command[commands.size()]);
} | java | public Command[] toArgs(final String line) {
if (line == null || line.isEmpty()) {
throw new IllegalArgumentException("Empty command.");
}
final List<Command> commands = new ArrayList<>();
final List<String> result = new ArrayList<>();
final StringBuilder current = new StringBuilder();
char waitChar = ' ';
boolean copyNextChar = false;
boolean inEscaped = false;
for (final char c : line.toCharArray()) {
if (copyNextChar) {
current.append(c);
copyNextChar = false;
} else if (waitChar == c) {
if (current.length() > 0) {
result.add(current.toString());
current.setLength(0);
}
waitChar = ' ';
inEscaped = false;
} else {
switch (c) {
case '"':
case '\'':
if (!inEscaped) {
waitChar = c;
inEscaped = true;
break;
} else {
current.append(c);
}
break;
case '\\':
copyNextChar = true;
break;
case '|':
flush(commands, result, current);
break;
default:
current.append(c);
}
}
}
if (waitChar != ' ') {
throw new IllegalStateException("Missing closing " + Character.toString(waitChar));
}
flush(commands, result, current);
return commands.toArray(new Command[commands.size()]);
} | [
"public",
"Command",
"[",
"]",
"toArgs",
"(",
"final",
"String",
"line",
")",
"{",
"if",
"(",
"line",
"==",
"null",
"||",
"line",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Empty command.\"",
")",
";",
"}",
"final",
"List",
"<",
"Command",
">",
"commands",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"final",
"List",
"<",
"String",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"final",
"StringBuilder",
"current",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"char",
"waitChar",
"=",
"'",
"'",
";",
"boolean",
"copyNextChar",
"=",
"false",
";",
"boolean",
"inEscaped",
"=",
"false",
";",
"for",
"(",
"final",
"char",
"c",
":",
"line",
".",
"toCharArray",
"(",
")",
")",
"{",
"if",
"(",
"copyNextChar",
")",
"{",
"current",
".",
"append",
"(",
"c",
")",
";",
"copyNextChar",
"=",
"false",
";",
"}",
"else",
"if",
"(",
"waitChar",
"==",
"c",
")",
"{",
"if",
"(",
"current",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"result",
".",
"add",
"(",
"current",
".",
"toString",
"(",
")",
")",
";",
"current",
".",
"setLength",
"(",
"0",
")",
";",
"}",
"waitChar",
"=",
"'",
"'",
";",
"inEscaped",
"=",
"false",
";",
"}",
"else",
"{",
"switch",
"(",
"c",
")",
"{",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"if",
"(",
"!",
"inEscaped",
")",
"{",
"waitChar",
"=",
"c",
";",
"inEscaped",
"=",
"true",
";",
"break",
";",
"}",
"else",
"{",
"current",
".",
"append",
"(",
"c",
")",
";",
"}",
"break",
";",
"case",
"'",
"'",
":",
"copyNextChar",
"=",
"true",
";",
"break",
";",
"case",
"'",
"'",
":",
"flush",
"(",
"commands",
",",
"result",
",",
"current",
")",
";",
"break",
";",
"default",
":",
"current",
".",
"append",
"(",
"c",
")",
";",
"}",
"}",
"}",
"if",
"(",
"waitChar",
"!=",
"'",
"'",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Missing closing \"",
"+",
"Character",
".",
"toString",
"(",
"waitChar",
")",
")",
";",
"}",
"flush",
"(",
"commands",
",",
"result",
",",
"current",
")",
";",
"return",
"commands",
".",
"toArray",
"(",
"new",
"Command",
"[",
"commands",
".",
"size",
"(",
")",
"]",
")",
";",
"}"
] | designed as a class in case we add config | [
"designed",
"as",
"a",
"class",
"in",
"case",
"we",
"add",
"config"
] | c8d37d15e937c235df3dfaa33fbac15ee5a367a7 | https://github.com/tomitribe/crest/blob/c8d37d15e937c235df3dfaa33fbac15ee5a367a7/tomitribe-crest-cli/src/main/java/org/tomitribe/crest/cli/impl/CommandParser.java#L23-L79 | train |
wildfly-swarm-archive/ARCHIVE-wildfly-swarm | logging/api/src/main/java/org/wildfly/swarm/logging/LoggingFraction.java | LoggingFraction.createDefaultLoggingFraction | public static LoggingFraction createDefaultLoggingFraction(Level level) {
return new LoggingFraction()
.defaultColorFormatter()
.consoleHandler(level, COLOR_PATTERN)
.rootLogger(level, CONSOLE);
} | java | public static LoggingFraction createDefaultLoggingFraction(Level level) {
return new LoggingFraction()
.defaultColorFormatter()
.consoleHandler(level, COLOR_PATTERN)
.rootLogger(level, CONSOLE);
} | [
"public",
"static",
"LoggingFraction",
"createDefaultLoggingFraction",
"(",
"Level",
"level",
")",
"{",
"return",
"new",
"LoggingFraction",
"(",
")",
".",
"defaultColorFormatter",
"(",
")",
".",
"consoleHandler",
"(",
"level",
",",
"COLOR_PATTERN",
")",
".",
"rootLogger",
"(",
"level",
",",
"CONSOLE",
")",
";",
"}"
] | Create a default logging fraction for the specified level.
@return The fully-configured fraction. | [
"Create",
"a",
"default",
"logging",
"fraction",
"for",
"the",
"specified",
"level",
"."
] | 28ef71bcfa743a7267666e0ed2919c37b356c09b | https://github.com/wildfly-swarm-archive/ARCHIVE-wildfly-swarm/blob/28ef71bcfa743a7267666e0ed2919c37b356c09b/logging/api/src/main/java/org/wildfly/swarm/logging/LoggingFraction.java#L92-L97 | train |
wildfly-swarm-archive/ARCHIVE-wildfly-swarm | logging/api/src/main/java/org/wildfly/swarm/logging/LoggingFraction.java | LoggingFraction.formatter | public LoggingFraction formatter(String name, String pattern) {
patternFormatter(new PatternFormatter(name).pattern(pattern));
return this;
} | java | public LoggingFraction formatter(String name, String pattern) {
patternFormatter(new PatternFormatter(name).pattern(pattern));
return this;
} | [
"public",
"LoggingFraction",
"formatter",
"(",
"String",
"name",
",",
"String",
"pattern",
")",
"{",
"patternFormatter",
"(",
"new",
"PatternFormatter",
"(",
"name",
")",
".",
"pattern",
"(",
"pattern",
")",
")",
";",
"return",
"this",
";",
"}"
] | Add a new PatternFormatter to this Logger
@param name the name of the formatter
@param pattern the pattern string
@return This fraction. | [
"Add",
"a",
"new",
"PatternFormatter",
"to",
"this",
"Logger"
] | 28ef71bcfa743a7267666e0ed2919c37b356c09b | https://github.com/wildfly-swarm-archive/ARCHIVE-wildfly-swarm/blob/28ef71bcfa743a7267666e0ed2919c37b356c09b/logging/api/src/main/java/org/wildfly/swarm/logging/LoggingFraction.java#L127-L130 | train |
wildfly-swarm-archive/ARCHIVE-wildfly-swarm | logging/api/src/main/java/org/wildfly/swarm/logging/LoggingFraction.java | LoggingFraction.consoleHandler | public LoggingFraction consoleHandler(Level level, String formatter) {
consoleHandler(new ConsoleHandler(CONSOLE)
.level(level)
.namedFormatter(formatter));
return this;
} | java | public LoggingFraction consoleHandler(Level level, String formatter) {
consoleHandler(new ConsoleHandler(CONSOLE)
.level(level)
.namedFormatter(formatter));
return this;
} | [
"public",
"LoggingFraction",
"consoleHandler",
"(",
"Level",
"level",
",",
"String",
"formatter",
")",
"{",
"consoleHandler",
"(",
"new",
"ConsoleHandler",
"(",
"CONSOLE",
")",
".",
"level",
"(",
"level",
")",
".",
"namedFormatter",
"(",
"formatter",
")",
")",
";",
"return",
"this",
";",
"}"
] | Add a ConsoleHandler to the list of handlers for this logger.
@param level The logging level
@param formatter A pattern string for the console's formatter
@return This fraction | [
"Add",
"a",
"ConsoleHandler",
"to",
"the",
"list",
"of",
"handlers",
"for",
"this",
"logger",
"."
] | 28ef71bcfa743a7267666e0ed2919c37b356c09b | https://github.com/wildfly-swarm-archive/ARCHIVE-wildfly-swarm/blob/28ef71bcfa743a7267666e0ed2919c37b356c09b/logging/api/src/main/java/org/wildfly/swarm/logging/LoggingFraction.java#L194-L199 | train |
wildfly-swarm-archive/ARCHIVE-wildfly-swarm | logging/api/src/main/java/org/wildfly/swarm/logging/LoggingFraction.java | LoggingFraction.fileHandler | public LoggingFraction fileHandler(String name, String path, Level level, String formatter) {
Map<Object, Object> fileProperties = new HashMap<>();
fileProperties.put("path", path);
fileProperties.put("relative-to", "jboss.server.log.dir");
fileHandler(new FileHandler(name)
.level(level)
.formatter(formatter)
.file(fileProperties));
return this;
} | java | public LoggingFraction fileHandler(String name, String path, Level level, String formatter) {
Map<Object, Object> fileProperties = new HashMap<>();
fileProperties.put("path", path);
fileProperties.put("relative-to", "jboss.server.log.dir");
fileHandler(new FileHandler(name)
.level(level)
.formatter(formatter)
.file(fileProperties));
return this;
} | [
"public",
"LoggingFraction",
"fileHandler",
"(",
"String",
"name",
",",
"String",
"path",
",",
"Level",
"level",
",",
"String",
"formatter",
")",
"{",
"Map",
"<",
"Object",
",",
"Object",
">",
"fileProperties",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"fileProperties",
".",
"put",
"(",
"\"path\"",
",",
"path",
")",
";",
"fileProperties",
".",
"put",
"(",
"\"relative-to\"",
",",
"\"jboss.server.log.dir\"",
")",
";",
"fileHandler",
"(",
"new",
"FileHandler",
"(",
"name",
")",
".",
"level",
"(",
"level",
")",
".",
"formatter",
"(",
"formatter",
")",
".",
"file",
"(",
"fileProperties",
")",
")",
";",
"return",
"this",
";",
"}"
] | Add a FileHandler to the list of handlers for this logger
@param name The name of the handler
@param path The log file path
@param level The logging level
@param formatter The pattern string for the formatter
@return This fraction | [
"Add",
"a",
"FileHandler",
"to",
"the",
"list",
"of",
"handlers",
"for",
"this",
"logger"
] | 28ef71bcfa743a7267666e0ed2919c37b356c09b | https://github.com/wildfly-swarm-archive/ARCHIVE-wildfly-swarm/blob/28ef71bcfa743a7267666e0ed2919c37b356c09b/logging/api/src/main/java/org/wildfly/swarm/logging/LoggingFraction.java#L219-L228 | train |
wildfly-swarm-archive/ARCHIVE-wildfly-swarm | logging/api/src/main/java/org/wildfly/swarm/logging/LoggingFraction.java | LoggingFraction.customHandler | public LoggingFraction customHandler(String name, String module, String className, Properties properties, String formatter) {
Map<Object, Object> handlerProperties = new HashMap<>();
final Enumeration<?> names = properties.propertyNames();
while (names.hasMoreElements()) {
final String nextElement = (String) names.nextElement();
handlerProperties.put(nextElement, properties.getProperty(nextElement));
}
customHandler(new CustomHandler(name)
.module(module)
.attributeClass(className)
.formatter(formatter)
.properties(handlerProperties));
return this;
} | java | public LoggingFraction customHandler(String name, String module, String className, Properties properties, String formatter) {
Map<Object, Object> handlerProperties = new HashMap<>();
final Enumeration<?> names = properties.propertyNames();
while (names.hasMoreElements()) {
final String nextElement = (String) names.nextElement();
handlerProperties.put(nextElement, properties.getProperty(nextElement));
}
customHandler(new CustomHandler(name)
.module(module)
.attributeClass(className)
.formatter(formatter)
.properties(handlerProperties));
return this;
} | [
"public",
"LoggingFraction",
"customHandler",
"(",
"String",
"name",
",",
"String",
"module",
",",
"String",
"className",
",",
"Properties",
"properties",
",",
"String",
"formatter",
")",
"{",
"Map",
"<",
"Object",
",",
"Object",
">",
"handlerProperties",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"final",
"Enumeration",
"<",
"?",
">",
"names",
"=",
"properties",
".",
"propertyNames",
"(",
")",
";",
"while",
"(",
"names",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"final",
"String",
"nextElement",
"=",
"(",
"String",
")",
"names",
".",
"nextElement",
"(",
")",
";",
"handlerProperties",
".",
"put",
"(",
"nextElement",
",",
"properties",
".",
"getProperty",
"(",
"nextElement",
")",
")",
";",
"}",
"customHandler",
"(",
"new",
"CustomHandler",
"(",
"name",
")",
".",
"module",
"(",
"module",
")",
".",
"attributeClass",
"(",
"className",
")",
".",
"formatter",
"(",
"formatter",
")",
".",
"properties",
"(",
"handlerProperties",
")",
")",
";",
"return",
"this",
";",
"}"
] | Add a CustomHandler to this logger
@param name the name of the handler
@param module the module that the handler uses
@param className the handler class name
@param properties properties for the handler
@param formatter a pattern string for the formatter
@return this fraction | [
"Add",
"a",
"CustomHandler",
"to",
"this",
"logger"
] | 28ef71bcfa743a7267666e0ed2919c37b356c09b | https://github.com/wildfly-swarm-archive/ARCHIVE-wildfly-swarm/blob/28ef71bcfa743a7267666e0ed2919c37b356c09b/logging/api/src/main/java/org/wildfly/swarm/logging/LoggingFraction.java#L249-L263 | train |
wildfly-swarm-archive/ARCHIVE-wildfly-swarm | logging/api/src/main/java/org/wildfly/swarm/logging/LoggingFraction.java | LoggingFraction.rootLogger | public LoggingFraction rootLogger(Level level, String... handlers) {
rootLogger(new RootLogger().level(level)
.handlers(handlers));
return this;
} | java | public LoggingFraction rootLogger(Level level, String... handlers) {
rootLogger(new RootLogger().level(level)
.handlers(handlers));
return this;
} | [
"public",
"LoggingFraction",
"rootLogger",
"(",
"Level",
"level",
",",
"String",
"...",
"handlers",
")",
"{",
"rootLogger",
"(",
"new",
"RootLogger",
"(",
")",
".",
"level",
"(",
"level",
")",
".",
"handlers",
"(",
"handlers",
")",
")",
";",
"return",
"this",
";",
"}"
] | Add a root logger to this fraction
@param level the log level
@param handlers a list of handlers
@return this fraction | [
"Add",
"a",
"root",
"logger",
"to",
"this",
"fraction"
] | 28ef71bcfa743a7267666e0ed2919c37b356c09b | https://github.com/wildfly-swarm-archive/ARCHIVE-wildfly-swarm/blob/28ef71bcfa743a7267666e0ed2919c37b356c09b/logging/api/src/main/java/org/wildfly/swarm/logging/LoggingFraction.java#L303-L307 | train |
jeppetto/jeppetto | jeppetto-dao-mongo/src/main/java/org/iternine/jeppetto/dao/mongodb/MongoDBQueryModelDAO.java | MongoDBQueryModelDAO.buildIdCondition | private Condition buildIdCondition(Object argument) {
if (argument instanceof String && ObjectId.isValid((String) argument)) {
return new Condition(ID_FIELD, new ObjectId((String) argument));
} else if (Iterable.class.isAssignableFrom(argument.getClass())) {
List<Object> objectIds = new ArrayList<Object>();
//noinspection ConstantConditions
for (Object argumentItem : (Iterable) argument) {
if (argumentItem instanceof String && ObjectId.isValid((String) argumentItem)) {
objectIds.add(new ObjectId((String) argumentItem));
} else if (argumentItem instanceof ObjectId) {
objectIds.add( argumentItem);
}
}
return new Condition(ID_FIELD, new BasicDBObject("$in", objectIds));
} else {
return new Condition(ID_FIELD, argument);
}
} | java | private Condition buildIdCondition(Object argument) {
if (argument instanceof String && ObjectId.isValid((String) argument)) {
return new Condition(ID_FIELD, new ObjectId((String) argument));
} else if (Iterable.class.isAssignableFrom(argument.getClass())) {
List<Object> objectIds = new ArrayList<Object>();
//noinspection ConstantConditions
for (Object argumentItem : (Iterable) argument) {
if (argumentItem instanceof String && ObjectId.isValid((String) argumentItem)) {
objectIds.add(new ObjectId((String) argumentItem));
} else if (argumentItem instanceof ObjectId) {
objectIds.add( argumentItem);
}
}
return new Condition(ID_FIELD, new BasicDBObject("$in", objectIds));
} else {
return new Condition(ID_FIELD, argument);
}
} | [
"private",
"Condition",
"buildIdCondition",
"(",
"Object",
"argument",
")",
"{",
"if",
"(",
"argument",
"instanceof",
"String",
"&&",
"ObjectId",
".",
"isValid",
"(",
"(",
"String",
")",
"argument",
")",
")",
"{",
"return",
"new",
"Condition",
"(",
"ID_FIELD",
",",
"new",
"ObjectId",
"(",
"(",
"String",
")",
"argument",
")",
")",
";",
"}",
"else",
"if",
"(",
"Iterable",
".",
"class",
".",
"isAssignableFrom",
"(",
"argument",
".",
"getClass",
"(",
")",
")",
")",
"{",
"List",
"<",
"Object",
">",
"objectIds",
"=",
"new",
"ArrayList",
"<",
"Object",
">",
"(",
")",
";",
"//noinspection ConstantConditions",
"for",
"(",
"Object",
"argumentItem",
":",
"(",
"Iterable",
")",
"argument",
")",
"{",
"if",
"(",
"argumentItem",
"instanceof",
"String",
"&&",
"ObjectId",
".",
"isValid",
"(",
"(",
"String",
")",
"argumentItem",
")",
")",
"{",
"objectIds",
".",
"add",
"(",
"new",
"ObjectId",
"(",
"(",
"String",
")",
"argumentItem",
")",
")",
";",
"}",
"else",
"if",
"(",
"argumentItem",
"instanceof",
"ObjectId",
")",
"{",
"objectIds",
".",
"add",
"(",
"argumentItem",
")",
";",
"}",
"}",
"return",
"new",
"Condition",
"(",
"ID_FIELD",
",",
"new",
"BasicDBObject",
"(",
"\"$in\"",
",",
"objectIds",
")",
")",
";",
"}",
"else",
"{",
"return",
"new",
"Condition",
"(",
"ID_FIELD",
",",
"argument",
")",
";",
"}",
"}"
] | Special case for 'id' queries as it maps to _id within MongoDB. | [
"Special",
"case",
"for",
"id",
"queries",
"as",
"it",
"maps",
"to",
"_id",
"within",
"MongoDB",
"."
] | bd2796dcf53376052f590e727931990a2902a933 | https://github.com/jeppetto/jeppetto/blob/bd2796dcf53376052f590e727931990a2902a933/jeppetto-dao-mongo/src/main/java/org/iternine/jeppetto/dao/mongodb/MongoDBQueryModelDAO.java#L1041-L1060 | train |
structlogging/structlogger | structlogger/src/main/java/com/github/structlogging/slf4j/Slf4jLoggingCallback.java | Slf4jLoggingCallback.audit | @Override
public void audit(final LoggingEvent e) {
try {
logger.info(MarkerFactory.getMarker(AUDIT), serialize(e));
} catch (Exception ex) {
throw new RuntimeException("unable to serialize event", ex);
}
} | java | @Override
public void audit(final LoggingEvent e) {
try {
logger.info(MarkerFactory.getMarker(AUDIT), serialize(e));
} catch (Exception ex) {
throw new RuntimeException("unable to serialize event", ex);
}
} | [
"@",
"Override",
"public",
"void",
"audit",
"(",
"final",
"LoggingEvent",
"e",
")",
"{",
"try",
"{",
"logger",
".",
"info",
"(",
"MarkerFactory",
".",
"getMarker",
"(",
"AUDIT",
")",
",",
"serialize",
"(",
"e",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"unable to serialize event\"",
",",
"ex",
")",
";",
"}",
"}"
] | This implementation uses INFO level of slf4j and marks these logged messages with AUDIT marker | [
"This",
"implementation",
"uses",
"INFO",
"level",
"of",
"slf4j",
"and",
"marks",
"these",
"logged",
"messages",
"with",
"AUDIT",
"marker"
] | 1fcca4e962ef53cbdb94bd72cb556de7f5f9469f | https://github.com/structlogging/structlogger/blob/1fcca4e962ef53cbdb94bd72cb556de7f5f9469f/structlogger/src/main/java/com/github/structlogging/slf4j/Slf4jLoggingCallback.java#L99-L106 | train |
tomitribe/crest | tomitribe-crest/src/main/java/org/tomitribe/crest/cmds/CmdMethod.java | CmdMethod.getUsage | @Override
public String getUsage() {
String commandName = name;
Class<?> declaringClass = method.getDeclaringClass();
Map<String, Cmd> commands = Commands.get(declaringClass);
if (commands.size() == 1 && commands.values().iterator().next() instanceof CmdGroup) {
final CmdGroup cmdGroup = (CmdGroup) commands.values().iterator().next();
commandName = cmdGroup.getName() + " " + name;
}
final String usage = usage();
if (usage != null) {
if (!usage.startsWith(commandName)) {
return commandName + " " + usage;
} else {
return usage;
}
}
final List<Object> args = new ArrayList<>();
for (final Param parameter : spec.arguments) {
boolean skip = Environment.class.isAssignableFrom(parameter.getType());
for (final Annotation a : parameter.getAnnotations()) {
final CrestAnnotation crestAnnotation = a.annotationType().getAnnotation(CrestAnnotation.class);
if (crestAnnotation != null) {
skip = crestAnnotation.skipUsage();
break;
}
}
if (!skip) {
skip = parameter.getAnnotation(NotAService.class) == null &&
Environment.ENVIRONMENT_THREAD_LOCAL.get().findService(parameter.getType()) != null;
}
if (skip) {
continue;
}
args.add(parameter.getDisplayType().replace("[]", "..."));
}
return String.format("%s %s %s", commandName, args.size() == method.getParameterTypes().length ? "" : "[options]",
Join.join(" ", args)).trim();
} | java | @Override
public String getUsage() {
String commandName = name;
Class<?> declaringClass = method.getDeclaringClass();
Map<String, Cmd> commands = Commands.get(declaringClass);
if (commands.size() == 1 && commands.values().iterator().next() instanceof CmdGroup) {
final CmdGroup cmdGroup = (CmdGroup) commands.values().iterator().next();
commandName = cmdGroup.getName() + " " + name;
}
final String usage = usage();
if (usage != null) {
if (!usage.startsWith(commandName)) {
return commandName + " " + usage;
} else {
return usage;
}
}
final List<Object> args = new ArrayList<>();
for (final Param parameter : spec.arguments) {
boolean skip = Environment.class.isAssignableFrom(parameter.getType());
for (final Annotation a : parameter.getAnnotations()) {
final CrestAnnotation crestAnnotation = a.annotationType().getAnnotation(CrestAnnotation.class);
if (crestAnnotation != null) {
skip = crestAnnotation.skipUsage();
break;
}
}
if (!skip) {
skip = parameter.getAnnotation(NotAService.class) == null &&
Environment.ENVIRONMENT_THREAD_LOCAL.get().findService(parameter.getType()) != null;
}
if (skip) {
continue;
}
args.add(parameter.getDisplayType().replace("[]", "..."));
}
return String.format("%s %s %s", commandName, args.size() == method.getParameterTypes().length ? "" : "[options]",
Join.join(" ", args)).trim();
} | [
"@",
"Override",
"public",
"String",
"getUsage",
"(",
")",
"{",
"String",
"commandName",
"=",
"name",
";",
"Class",
"<",
"?",
">",
"declaringClass",
"=",
"method",
".",
"getDeclaringClass",
"(",
")",
";",
"Map",
"<",
"String",
",",
"Cmd",
">",
"commands",
"=",
"Commands",
".",
"get",
"(",
"declaringClass",
")",
";",
"if",
"(",
"commands",
".",
"size",
"(",
")",
"==",
"1",
"&&",
"commands",
".",
"values",
"(",
")",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
"instanceof",
"CmdGroup",
")",
"{",
"final",
"CmdGroup",
"cmdGroup",
"=",
"(",
"CmdGroup",
")",
"commands",
".",
"values",
"(",
")",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
";",
"commandName",
"=",
"cmdGroup",
".",
"getName",
"(",
")",
"+",
"\" \"",
"+",
"name",
";",
"}",
"final",
"String",
"usage",
"=",
"usage",
"(",
")",
";",
"if",
"(",
"usage",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"usage",
".",
"startsWith",
"(",
"commandName",
")",
")",
"{",
"return",
"commandName",
"+",
"\" \"",
"+",
"usage",
";",
"}",
"else",
"{",
"return",
"usage",
";",
"}",
"}",
"final",
"List",
"<",
"Object",
">",
"args",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"final",
"Param",
"parameter",
":",
"spec",
".",
"arguments",
")",
"{",
"boolean",
"skip",
"=",
"Environment",
".",
"class",
".",
"isAssignableFrom",
"(",
"parameter",
".",
"getType",
"(",
")",
")",
";",
"for",
"(",
"final",
"Annotation",
"a",
":",
"parameter",
".",
"getAnnotations",
"(",
")",
")",
"{",
"final",
"CrestAnnotation",
"crestAnnotation",
"=",
"a",
".",
"annotationType",
"(",
")",
".",
"getAnnotation",
"(",
"CrestAnnotation",
".",
"class",
")",
";",
"if",
"(",
"crestAnnotation",
"!=",
"null",
")",
"{",
"skip",
"=",
"crestAnnotation",
".",
"skipUsage",
"(",
")",
";",
"break",
";",
"}",
"}",
"if",
"(",
"!",
"skip",
")",
"{",
"skip",
"=",
"parameter",
".",
"getAnnotation",
"(",
"NotAService",
".",
"class",
")",
"==",
"null",
"&&",
"Environment",
".",
"ENVIRONMENT_THREAD_LOCAL",
".",
"get",
"(",
")",
".",
"findService",
"(",
"parameter",
".",
"getType",
"(",
")",
")",
"!=",
"null",
";",
"}",
"if",
"(",
"skip",
")",
"{",
"continue",
";",
"}",
"args",
".",
"add",
"(",
"parameter",
".",
"getDisplayType",
"(",
")",
".",
"replace",
"(",
"\"[]\"",
",",
"\"...\"",
")",
")",
";",
"}",
"return",
"String",
".",
"format",
"(",
"\"%s %s %s\"",
",",
"commandName",
",",
"args",
".",
"size",
"(",
")",
"==",
"method",
".",
"getParameterTypes",
"(",
")",
".",
"length",
"?",
"\"\"",
":",
"\"[options]\"",
",",
"Join",
".",
"join",
"(",
"\" \"",
",",
"args",
")",
")",
".",
"trim",
"(",
")",
";",
"}"
] | Returns a single line description of the command | [
"Returns",
"a",
"single",
"line",
"description",
"of",
"the",
"command"
] | c8d37d15e937c235df3dfaa33fbac15ee5a367a7 | https://github.com/tomitribe/crest/blob/c8d37d15e937c235df3dfaa33fbac15ee5a367a7/tomitribe-crest/src/main/java/org/tomitribe/crest/cmds/CmdMethod.java#L294-L339 | train |
wildfly-swarm-archive/ARCHIVE-wildfly-swarm | batch-jberet/api/src/main/java/org/wildfly/swarm/batch/jberet/BatchFraction.java | BatchFraction.defaultJobRepository | public BatchFraction defaultJobRepository(final String name, final DatasourcesFraction datasource) {
jdbcJobRepository(name, datasource);
return defaultJobRepository(name);
} | java | public BatchFraction defaultJobRepository(final String name, final DatasourcesFraction datasource) {
jdbcJobRepository(name, datasource);
return defaultJobRepository(name);
} | [
"public",
"BatchFraction",
"defaultJobRepository",
"(",
"final",
"String",
"name",
",",
"final",
"DatasourcesFraction",
"datasource",
")",
"{",
"jdbcJobRepository",
"(",
"name",
",",
"datasource",
")",
";",
"return",
"defaultJobRepository",
"(",
"name",
")",
";",
"}"
] | Adds a new JDBC job repository and sets it as the default job repository.
@param name the name for the JDBC job repository
@param datasource the datasource to use to connect to the database
@return this fraction | [
"Adds",
"a",
"new",
"JDBC",
"job",
"repository",
"and",
"sets",
"it",
"as",
"the",
"default",
"job",
"repository",
"."
] | 28ef71bcfa743a7267666e0ed2919c37b356c09b | https://github.com/wildfly-swarm-archive/ARCHIVE-wildfly-swarm/blob/28ef71bcfa743a7267666e0ed2919c37b356c09b/batch-jberet/api/src/main/java/org/wildfly/swarm/batch/jberet/BatchFraction.java#L108-L111 | train |
wildfly-swarm-archive/ARCHIVE-wildfly-swarm | batch-jberet/api/src/main/java/org/wildfly/swarm/batch/jberet/BatchFraction.java | BatchFraction.jdbcJobRepository | public BatchFraction jdbcJobRepository(final String name, final DatasourcesFraction datasource) {
return jdbcJobRepository(new JDBCJobRepository<>(name).dataSource(datasource.getKey()));
} | java | public BatchFraction jdbcJobRepository(final String name, final DatasourcesFraction datasource) {
return jdbcJobRepository(new JDBCJobRepository<>(name).dataSource(datasource.getKey()));
} | [
"public",
"BatchFraction",
"jdbcJobRepository",
"(",
"final",
"String",
"name",
",",
"final",
"DatasourcesFraction",
"datasource",
")",
"{",
"return",
"jdbcJobRepository",
"(",
"new",
"JDBCJobRepository",
"<>",
"(",
"name",
")",
".",
"dataSource",
"(",
"datasource",
".",
"getKey",
"(",
")",
")",
")",
";",
"}"
] | Creates a new JDBC job repository.
@param name the name for the job repository
@param datasource the datasource to use to connect to the database
@return this fraction | [
"Creates",
"a",
"new",
"JDBC",
"job",
"repository",
"."
] | 28ef71bcfa743a7267666e0ed2919c37b356c09b | https://github.com/wildfly-swarm-archive/ARCHIVE-wildfly-swarm/blob/28ef71bcfa743a7267666e0ed2919c37b356c09b/batch-jberet/api/src/main/java/org/wildfly/swarm/batch/jberet/BatchFraction.java#L130-L132 | train |
wildfly-swarm-archive/ARCHIVE-wildfly-swarm | batch-jberet/api/src/main/java/org/wildfly/swarm/batch/jberet/BatchFraction.java | BatchFraction.defaultThreadPool | public BatchFraction defaultThreadPool(final String name, final int maxThreads, final int keepAliveTime, final TimeUnit keepAliveUnits) {
threadPool(name, maxThreads, keepAliveTime, keepAliveUnits);
return defaultThreadPool(name);
} | java | public BatchFraction defaultThreadPool(final String name, final int maxThreads, final int keepAliveTime, final TimeUnit keepAliveUnits) {
threadPool(name, maxThreads, keepAliveTime, keepAliveUnits);
return defaultThreadPool(name);
} | [
"public",
"BatchFraction",
"defaultThreadPool",
"(",
"final",
"String",
"name",
",",
"final",
"int",
"maxThreads",
",",
"final",
"int",
"keepAliveTime",
",",
"final",
"TimeUnit",
"keepAliveUnits",
")",
"{",
"threadPool",
"(",
"name",
",",
"maxThreads",
",",
"keepAliveTime",
",",
"keepAliveUnits",
")",
";",
"return",
"defaultThreadPool",
"(",
"name",
")",
";",
"}"
] | Creates a new thread-pool and sets the created thread-pool as the default thread-pool for batch jobs.
@param name the maximum number of threads to set the pool to
@param keepAliveTime the time to keep threads alive
@param keepAliveUnits the time unit for the keep alive time
@return this fraction | [
"Creates",
"a",
"new",
"thread",
"-",
"pool",
"and",
"sets",
"the",
"created",
"thread",
"-",
"pool",
"as",
"the",
"default",
"thread",
"-",
"pool",
"for",
"batch",
"jobs",
"."
] | 28ef71bcfa743a7267666e0ed2919c37b356c09b | https://github.com/wildfly-swarm-archive/ARCHIVE-wildfly-swarm/blob/28ef71bcfa743a7267666e0ed2919c37b356c09b/batch-jberet/api/src/main/java/org/wildfly/swarm/batch/jberet/BatchFraction.java#L155-L158 | train |
wildfly-swarm-archive/ARCHIVE-wildfly-swarm | batch-jberet/api/src/main/java/org/wildfly/swarm/batch/jberet/BatchFraction.java | BatchFraction.threadPool | public BatchFraction threadPool(final String name, final int maxThreads, final int keepAliveTime, final TimeUnit keepAliveUnits) {
final ThreadPool<?> threadPool = new ThreadPool<>(name);
threadPool.maxThreads(maxThreads)
.keepaliveTime("time", Integer.toBinaryString(keepAliveTime))
.keepaliveTime("unit", keepAliveUnits.name().toLowerCase(Locale.ROOT));
return threadPool(threadPool);
} | java | public BatchFraction threadPool(final String name, final int maxThreads, final int keepAliveTime, final TimeUnit keepAliveUnits) {
final ThreadPool<?> threadPool = new ThreadPool<>(name);
threadPool.maxThreads(maxThreads)
.keepaliveTime("time", Integer.toBinaryString(keepAliveTime))
.keepaliveTime("unit", keepAliveUnits.name().toLowerCase(Locale.ROOT));
return threadPool(threadPool);
} | [
"public",
"BatchFraction",
"threadPool",
"(",
"final",
"String",
"name",
",",
"final",
"int",
"maxThreads",
",",
"final",
"int",
"keepAliveTime",
",",
"final",
"TimeUnit",
"keepAliveUnits",
")",
"{",
"final",
"ThreadPool",
"<",
"?",
">",
"threadPool",
"=",
"new",
"ThreadPool",
"<>",
"(",
"name",
")",
";",
"threadPool",
".",
"maxThreads",
"(",
"maxThreads",
")",
".",
"keepaliveTime",
"(",
"\"time\"",
",",
"Integer",
".",
"toBinaryString",
"(",
"keepAliveTime",
")",
")",
".",
"keepaliveTime",
"(",
"\"unit\"",
",",
"keepAliveUnits",
".",
"name",
"(",
")",
".",
"toLowerCase",
"(",
"Locale",
".",
"ROOT",
")",
")",
";",
"return",
"threadPool",
"(",
"threadPool",
")",
";",
"}"
] | Creates a new thread-pool that can be used for batch jobs.
@param name the maximum number of threads to set the pool to
@param keepAliveTime the time to keep threads alive
@param keepAliveUnits the time unit for the keep alive time
@return this fraction | [
"Creates",
"a",
"new",
"thread",
"-",
"pool",
"that",
"can",
"be",
"used",
"for",
"batch",
"jobs",
"."
] | 28ef71bcfa743a7267666e0ed2919c37b356c09b | https://github.com/wildfly-swarm-archive/ARCHIVE-wildfly-swarm/blob/28ef71bcfa743a7267666e0ed2919c37b356c09b/batch-jberet/api/src/main/java/org/wildfly/swarm/batch/jberet/BatchFraction.java#L179-L185 | train |
structlogging/structlogger | structlogger-benchmark/src/main/java/com/github/structlogging/Slf4jToFileBenchmark.java | Slf4jToFileBenchmark.structLoggerLogging1Call | @Warmup(iterations = 5)
@Measurement(iterations = 5)
@Benchmark
public void structLoggerLogging1Call() {
structLoggerNoMessageParametrization.info("Event with double and boolean")
.varDouble(1.2)
.varBoolean(false)
.log();
} | java | @Warmup(iterations = 5)
@Measurement(iterations = 5)
@Benchmark
public void structLoggerLogging1Call() {
structLoggerNoMessageParametrization.info("Event with double and boolean")
.varDouble(1.2)
.varBoolean(false)
.log();
} | [
"@",
"Warmup",
"(",
"iterations",
"=",
"5",
")",
"@",
"Measurement",
"(",
"iterations",
"=",
"5",
")",
"@",
"Benchmark",
"public",
"void",
"structLoggerLogging1Call",
"(",
")",
"{",
"structLoggerNoMessageParametrization",
".",
"info",
"(",
"\"Event with double and boolean\"",
")",
".",
"varDouble",
"(",
"1.2",
")",
".",
"varBoolean",
"(",
"false",
")",
".",
"log",
"(",
")",
";",
"}"
] | structured logging with no message parametrization | [
"structured",
"logging",
"with",
"no",
"message",
"parametrization"
] | 1fcca4e962ef53cbdb94bd72cb556de7f5f9469f | https://github.com/structlogging/structlogger/blob/1fcca4e962ef53cbdb94bd72cb556de7f5f9469f/structlogger-benchmark/src/main/java/com/github/structlogging/Slf4jToFileBenchmark.java#L161-L169 | train |
structlogging/structlogger | structlogger-benchmark/src/main/java/com/github/structlogging/Slf4jToFileBenchmark.java | Slf4jToFileBenchmark.logstashStructuredParametrizedMessageLogging1Call | @Warmup(iterations = 5)
@Measurement(iterations = 5)
@Benchmark
public void logstashStructuredParametrizedMessageLogging1Call() {
loggerLogstashParametrizedMessage.info("Event with double={} and boolean={}", value("varDouble", 1.2), value("varBoolean", false));
} | java | @Warmup(iterations = 5)
@Measurement(iterations = 5)
@Benchmark
public void logstashStructuredParametrizedMessageLogging1Call() {
loggerLogstashParametrizedMessage.info("Event with double={} and boolean={}", value("varDouble", 1.2), value("varBoolean", false));
} | [
"@",
"Warmup",
"(",
"iterations",
"=",
"5",
")",
"@",
"Measurement",
"(",
"iterations",
"=",
"5",
")",
"@",
"Benchmark",
"public",
"void",
"logstashStructuredParametrizedMessageLogging1Call",
"(",
")",
"{",
"loggerLogstashParametrizedMessage",
".",
"info",
"(",
"\"Event with double={} and boolean={}\"",
",",
"value",
"(",
"\"varDouble\"",
",",
"1.2",
")",
",",
"value",
"(",
"\"varBoolean\"",
",",
"false",
")",
")",
";",
"}"
] | structured logging with parametrization with logstash | [
"structured",
"logging",
"with",
"parametrization",
"with",
"logstash"
] | 1fcca4e962ef53cbdb94bd72cb556de7f5f9469f | https://github.com/structlogging/structlogger/blob/1fcca4e962ef53cbdb94bd72cb556de7f5f9469f/structlogger-benchmark/src/main/java/com/github/structlogging/Slf4jToFileBenchmark.java#L326-L331 | train |
structlogging/structlogger | structlogger-benchmark/src/main/java/com/github/structlogging/Slf4jToFileBenchmark.java | Slf4jToFileBenchmark.logstashStructuredLogging1Calls | @Warmup(iterations = 5)
@Measurement(iterations = 5)
@Benchmark
public void logstashStructuredLogging1Calls() {
loggerLogstash.info("Event with double and boolean", keyValue("varDouble", 1.2), keyValue("varBoolean", false));
} | java | @Warmup(iterations = 5)
@Measurement(iterations = 5)
@Benchmark
public void logstashStructuredLogging1Calls() {
loggerLogstash.info("Event with double and boolean", keyValue("varDouble", 1.2), keyValue("varBoolean", false));
} | [
"@",
"Warmup",
"(",
"iterations",
"=",
"5",
")",
"@",
"Measurement",
"(",
"iterations",
"=",
"5",
")",
"@",
"Benchmark",
"public",
"void",
"logstashStructuredLogging1Calls",
"(",
")",
"{",
"loggerLogstash",
".",
"info",
"(",
"\"Event with double and boolean\"",
",",
"keyValue",
"(",
"\"varDouble\"",
",",
"1.2",
")",
",",
"keyValue",
"(",
"\"varBoolean\"",
",",
"false",
")",
")",
";",
"}"
] | structured logging without parametrization with logstash | [
"structured",
"logging",
"without",
"parametrization",
"with",
"logstash"
] | 1fcca4e962ef53cbdb94bd72cb556de7f5f9469f | https://github.com/structlogging/structlogger/blob/1fcca4e962ef53cbdb94bd72cb556de7f5f9469f/structlogger-benchmark/src/main/java/com/github/structlogging/Slf4jToFileBenchmark.java#L405-L410 | train |
structlogging/structlogger | structlogger/src/main/java/com/github/structlogging/processor/service/POJOService.java | POJOService.createPojo | public JavaFile createPojo(final String name,
final JCTree.JCLiteral literal,
final List<VariableAndValue> usedVariables) throws PackageNameException {
String eventName;
String packageName;
if (name != null) {
//get event name and package name from qualified name
final String[] split = name.split("\\.");
eventName = split[split.length-1];
checkStringIsValidName(eventName);
final StringBuffer stringBuffer = new StringBuffer();
for (int i = 0; i < split.length - 1; i++) {
if (i != 0) {
stringBuffer.append(".");
}
stringBuffer.append(split[i]);
checkStringIsValidName(split[i]);
}
packageName = stringBuffer.toString();
//check that packageName does not contain java keyword
}
else {
eventName = "Event" + hash(literal.getValue().toString());
packageName = generatedEventsPackage;
}
final TypeSpec.Builder classBuilder = TypeSpec.classBuilder(eventName)
.addModifiers(Modifier.PUBLIC)
.superclass(TypeName.get(LoggingEvent.class));
final MethodSpec.Builder constructorBuilder = MethodSpec.constructorBuilder().addModifiers(Modifier.PUBLIC);
addCommonLoggingEventFieldsToConstructor(constructorBuilder);
for (VariableAndValue variableAndValue : usedVariables) {
addPojoField(classBuilder, constructorBuilder, variableAndValue.getVariable().getName().toString(), TypeName.get(variableAndValue.getVariable().getType()));
}
final TypeSpec build = classBuilder.addMethod(constructorBuilder.build()).build();
return JavaFile.builder(packageName, build).build();
} | java | public JavaFile createPojo(final String name,
final JCTree.JCLiteral literal,
final List<VariableAndValue> usedVariables) throws PackageNameException {
String eventName;
String packageName;
if (name != null) {
//get event name and package name from qualified name
final String[] split = name.split("\\.");
eventName = split[split.length-1];
checkStringIsValidName(eventName);
final StringBuffer stringBuffer = new StringBuffer();
for (int i = 0; i < split.length - 1; i++) {
if (i != 0) {
stringBuffer.append(".");
}
stringBuffer.append(split[i]);
checkStringIsValidName(split[i]);
}
packageName = stringBuffer.toString();
//check that packageName does not contain java keyword
}
else {
eventName = "Event" + hash(literal.getValue().toString());
packageName = generatedEventsPackage;
}
final TypeSpec.Builder classBuilder = TypeSpec.classBuilder(eventName)
.addModifiers(Modifier.PUBLIC)
.superclass(TypeName.get(LoggingEvent.class));
final MethodSpec.Builder constructorBuilder = MethodSpec.constructorBuilder().addModifiers(Modifier.PUBLIC);
addCommonLoggingEventFieldsToConstructor(constructorBuilder);
for (VariableAndValue variableAndValue : usedVariables) {
addPojoField(classBuilder, constructorBuilder, variableAndValue.getVariable().getName().toString(), TypeName.get(variableAndValue.getVariable().getType()));
}
final TypeSpec build = classBuilder.addMethod(constructorBuilder.build()).build();
return JavaFile.builder(packageName, build).build();
} | [
"public",
"JavaFile",
"createPojo",
"(",
"final",
"String",
"name",
",",
"final",
"JCTree",
".",
"JCLiteral",
"literal",
",",
"final",
"List",
"<",
"VariableAndValue",
">",
"usedVariables",
")",
"throws",
"PackageNameException",
"{",
"String",
"eventName",
";",
"String",
"packageName",
";",
"if",
"(",
"name",
"!=",
"null",
")",
"{",
"//get event name and package name from qualified name",
"final",
"String",
"[",
"]",
"split",
"=",
"name",
".",
"split",
"(",
"\"\\\\.\"",
")",
";",
"eventName",
"=",
"split",
"[",
"split",
".",
"length",
"-",
"1",
"]",
";",
"checkStringIsValidName",
"(",
"eventName",
")",
";",
"final",
"StringBuffer",
"stringBuffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"split",
".",
"length",
"-",
"1",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
"!=",
"0",
")",
"{",
"stringBuffer",
".",
"append",
"(",
"\".\"",
")",
";",
"}",
"stringBuffer",
".",
"append",
"(",
"split",
"[",
"i",
"]",
")",
";",
"checkStringIsValidName",
"(",
"split",
"[",
"i",
"]",
")",
";",
"}",
"packageName",
"=",
"stringBuffer",
".",
"toString",
"(",
")",
";",
"//check that packageName does not contain java keyword",
"}",
"else",
"{",
"eventName",
"=",
"\"Event\"",
"+",
"hash",
"(",
"literal",
".",
"getValue",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"packageName",
"=",
"generatedEventsPackage",
";",
"}",
"final",
"TypeSpec",
".",
"Builder",
"classBuilder",
"=",
"TypeSpec",
".",
"classBuilder",
"(",
"eventName",
")",
".",
"addModifiers",
"(",
"Modifier",
".",
"PUBLIC",
")",
".",
"superclass",
"(",
"TypeName",
".",
"get",
"(",
"LoggingEvent",
".",
"class",
")",
")",
";",
"final",
"MethodSpec",
".",
"Builder",
"constructorBuilder",
"=",
"MethodSpec",
".",
"constructorBuilder",
"(",
")",
".",
"addModifiers",
"(",
"Modifier",
".",
"PUBLIC",
")",
";",
"addCommonLoggingEventFieldsToConstructor",
"(",
"constructorBuilder",
")",
";",
"for",
"(",
"VariableAndValue",
"variableAndValue",
":",
"usedVariables",
")",
"{",
"addPojoField",
"(",
"classBuilder",
",",
"constructorBuilder",
",",
"variableAndValue",
".",
"getVariable",
"(",
")",
".",
"getName",
"(",
")",
".",
"toString",
"(",
")",
",",
"TypeName",
".",
"get",
"(",
"variableAndValue",
".",
"getVariable",
"(",
")",
".",
"getType",
"(",
")",
")",
")",
";",
"}",
"final",
"TypeSpec",
"build",
"=",
"classBuilder",
".",
"addMethod",
"(",
"constructorBuilder",
".",
"build",
"(",
")",
")",
".",
"build",
"(",
")",
";",
"return",
"JavaFile",
".",
"builder",
"(",
"packageName",
",",
"build",
")",
".",
"build",
"(",
")",
";",
"}"
] | Create JavaFile representing POJO based on String literal and usedVariables of log statement
@param name name of POJO to be generated, if null, event is generated based on log literal (hash of it)
@param literal String literal used in structured log statement
@param usedVariables list of logging variables used by structured log statement
@return JavaFile representing Structured log Event (this JavaFile is not yet written, @see POJOService.writeJavaFile)
@throws PackageNameException when event name is not correct | [
"Create",
"JavaFile",
"representing",
"POJO",
"based",
"on",
"String",
"literal",
"and",
"usedVariables",
"of",
"log",
"statement"
] | 1fcca4e962ef53cbdb94bd72cb556de7f5f9469f | https://github.com/structlogging/structlogger/blob/1fcca4e962ef53cbdb94bd72cb556de7f5f9469f/structlogger/src/main/java/com/github/structlogging/processor/service/POJOService.java#L88-L130 | train |
structlogging/structlogger | structlogger/src/main/java/com/github/structlogging/processor/service/POJOService.java | POJOService.checkStringIsValidName | private void checkStringIsValidName(final String s) throws PackageNameException {
final boolean packageContainsJavaKeyword = javaKeywords.stream().anyMatch(s::equals);
if (packageContainsJavaKeyword || s.matches("\\d.*")) {
throw new PackageNameException("string is not valid");
}
} | java | private void checkStringIsValidName(final String s) throws PackageNameException {
final boolean packageContainsJavaKeyword = javaKeywords.stream().anyMatch(s::equals);
if (packageContainsJavaKeyword || s.matches("\\d.*")) {
throw new PackageNameException("string is not valid");
}
} | [
"private",
"void",
"checkStringIsValidName",
"(",
"final",
"String",
"s",
")",
"throws",
"PackageNameException",
"{",
"final",
"boolean",
"packageContainsJavaKeyword",
"=",
"javaKeywords",
".",
"stream",
"(",
")",
".",
"anyMatch",
"(",
"s",
"::",
"equals",
")",
";",
"if",
"(",
"packageContainsJavaKeyword",
"||",
"s",
".",
"matches",
"(",
"\"\\\\d.*\"",
")",
")",
"{",
"throw",
"new",
"PackageNameException",
"(",
"\"string is not valid\"",
")",
";",
"}",
"}"
] | Checks that string is not java keyword and is qualified java name
@param s to be checked
@throws PackageNameException thrown when string passed is java keyword | [
"Checks",
"that",
"string",
"is",
"not",
"java",
"keyword",
"and",
"is",
"qualified",
"java",
"name"
] | 1fcca4e962ef53cbdb94bd72cb556de7f5f9469f | https://github.com/structlogging/structlogger/blob/1fcca4e962ef53cbdb94bd72cb556de7f5f9469f/structlogger/src/main/java/com/github/structlogging/processor/service/POJOService.java#L137-L142 | train |
structlogging/structlogger | structlogger/src/main/java/com/github/structlogging/processor/service/POJOService.java | POJOService.addCommonLoggingEventFieldsToConstructor | private void addCommonLoggingEventFieldsToConstructor(final MethodSpec.Builder constructorBuilder) {
constructorBuilder.addParameter(TypeName.get(String.class), "message", Modifier.FINAL);
constructorBuilder.addParameter(TypeName.get(String.class), "sourceFile", Modifier.FINAL);
constructorBuilder.addParameter(TypeName.LONG, "lineNumber", Modifier.FINAL);
constructorBuilder.addParameter(TypeName.get(String.class), "type", Modifier.FINAL);
constructorBuilder.addParameter(TypeName.LONG, "sid", Modifier.FINAL);
constructorBuilder.addParameter(TypeName.get(String.class), "logLevel", Modifier.FINAL);
constructorBuilder.addParameter(TypeName.LONG, "timestamp", Modifier.FINAL);
constructorBuilder.addCode("super(message,sourceFile,lineNumber,type,sid,logLevel,timestamp);");
} | java | private void addCommonLoggingEventFieldsToConstructor(final MethodSpec.Builder constructorBuilder) {
constructorBuilder.addParameter(TypeName.get(String.class), "message", Modifier.FINAL);
constructorBuilder.addParameter(TypeName.get(String.class), "sourceFile", Modifier.FINAL);
constructorBuilder.addParameter(TypeName.LONG, "lineNumber", Modifier.FINAL);
constructorBuilder.addParameter(TypeName.get(String.class), "type", Modifier.FINAL);
constructorBuilder.addParameter(TypeName.LONG, "sid", Modifier.FINAL);
constructorBuilder.addParameter(TypeName.get(String.class), "logLevel", Modifier.FINAL);
constructorBuilder.addParameter(TypeName.LONG, "timestamp", Modifier.FINAL);
constructorBuilder.addCode("super(message,sourceFile,lineNumber,type,sid,logLevel,timestamp);");
} | [
"private",
"void",
"addCommonLoggingEventFieldsToConstructor",
"(",
"final",
"MethodSpec",
".",
"Builder",
"constructorBuilder",
")",
"{",
"constructorBuilder",
".",
"addParameter",
"(",
"TypeName",
".",
"get",
"(",
"String",
".",
"class",
")",
",",
"\"message\"",
",",
"Modifier",
".",
"FINAL",
")",
";",
"constructorBuilder",
".",
"addParameter",
"(",
"TypeName",
".",
"get",
"(",
"String",
".",
"class",
")",
",",
"\"sourceFile\"",
",",
"Modifier",
".",
"FINAL",
")",
";",
"constructorBuilder",
".",
"addParameter",
"(",
"TypeName",
".",
"LONG",
",",
"\"lineNumber\"",
",",
"Modifier",
".",
"FINAL",
")",
";",
"constructorBuilder",
".",
"addParameter",
"(",
"TypeName",
".",
"get",
"(",
"String",
".",
"class",
")",
",",
"\"type\"",
",",
"Modifier",
".",
"FINAL",
")",
";",
"constructorBuilder",
".",
"addParameter",
"(",
"TypeName",
".",
"LONG",
",",
"\"sid\"",
",",
"Modifier",
".",
"FINAL",
")",
";",
"constructorBuilder",
".",
"addParameter",
"(",
"TypeName",
".",
"get",
"(",
"String",
".",
"class",
")",
",",
"\"logLevel\"",
",",
"Modifier",
".",
"FINAL",
")",
";",
"constructorBuilder",
".",
"addParameter",
"(",
"TypeName",
".",
"LONG",
",",
"\"timestamp\"",
",",
"Modifier",
".",
"FINAL",
")",
";",
"constructorBuilder",
".",
"addCode",
"(",
"\"super(message,sourceFile,lineNumber,type,sid,logLevel,timestamp);\"",
")",
";",
"}"
] | add common attributes to constructor
@param constructorBuilder to be modified | [
"add",
"common",
"attributes",
"to",
"constructor"
] | 1fcca4e962ef53cbdb94bd72cb556de7f5f9469f | https://github.com/structlogging/structlogger/blob/1fcca4e962ef53cbdb94bd72cb556de7f5f9469f/structlogger/src/main/java/com/github/structlogging/processor/service/POJOService.java#L148-L157 | train |
structlogging/structlogger | structlogger/src/main/java/com/github/structlogging/processor/service/POJOService.java | POJOService.addPojoField | private void addPojoField(final TypeSpec.Builder classBuilder,
final MethodSpec.Builder constructorBuilder,
final String fieldName,
final TypeName fieldClass) {
classBuilder.addField(fieldClass, fieldName, Modifier.PRIVATE, Modifier.FINAL);
addGetter(classBuilder, fieldName, fieldClass);
addConstructorParameter(constructorBuilder, fieldName, fieldClass);
} | java | private void addPojoField(final TypeSpec.Builder classBuilder,
final MethodSpec.Builder constructorBuilder,
final String fieldName,
final TypeName fieldClass) {
classBuilder.addField(fieldClass, fieldName, Modifier.PRIVATE, Modifier.FINAL);
addGetter(classBuilder, fieldName, fieldClass);
addConstructorParameter(constructorBuilder, fieldName, fieldClass);
} | [
"private",
"void",
"addPojoField",
"(",
"final",
"TypeSpec",
".",
"Builder",
"classBuilder",
",",
"final",
"MethodSpec",
".",
"Builder",
"constructorBuilder",
",",
"final",
"String",
"fieldName",
",",
"final",
"TypeName",
"fieldClass",
")",
"{",
"classBuilder",
".",
"addField",
"(",
"fieldClass",
",",
"fieldName",
",",
"Modifier",
".",
"PRIVATE",
",",
"Modifier",
".",
"FINAL",
")",
";",
"addGetter",
"(",
"classBuilder",
",",
"fieldName",
",",
"fieldClass",
")",
";",
"addConstructorParameter",
"(",
"constructorBuilder",
",",
"fieldName",
",",
"fieldClass",
")",
";",
"}"
] | adds field to POJO, adds getter and adds parameter to constructor
@param classBuilder class to modify
@param constructorBuilder constructor to modify
@param fieldName field name to add
@param fieldClass class of field to be added | [
"adds",
"field",
"to",
"POJO",
"adds",
"getter",
"and",
"adds",
"parameter",
"to",
"constructor"
] | 1fcca4e962ef53cbdb94bd72cb556de7f5f9469f | https://github.com/structlogging/structlogger/blob/1fcca4e962ef53cbdb94bd72cb556de7f5f9469f/structlogger/src/main/java/com/github/structlogging/processor/service/POJOService.java#L177-L184 | train |
structlogging/structlogger | structlogger/src/main/java/com/github/structlogging/processor/service/POJOService.java | POJOService.addConstructorParameter | private void addConstructorParameter(final MethodSpec.Builder constructorBuilder, final String attributeName, final TypeName type) {
constructorBuilder.addParameter(type, attributeName, Modifier.FINAL);
constructorBuilder.addCode("this." + attributeName + "=" + attributeName + ";");
} | java | private void addConstructorParameter(final MethodSpec.Builder constructorBuilder, final String attributeName, final TypeName type) {
constructorBuilder.addParameter(type, attributeName, Modifier.FINAL);
constructorBuilder.addCode("this." + attributeName + "=" + attributeName + ";");
} | [
"private",
"void",
"addConstructorParameter",
"(",
"final",
"MethodSpec",
".",
"Builder",
"constructorBuilder",
",",
"final",
"String",
"attributeName",
",",
"final",
"TypeName",
"type",
")",
"{",
"constructorBuilder",
".",
"addParameter",
"(",
"type",
",",
"attributeName",
",",
"Modifier",
".",
"FINAL",
")",
";",
"constructorBuilder",
".",
"addCode",
"(",
"\"this.\"",
"+",
"attributeName",
"+",
"\"=\"",
"+",
"attributeName",
"+",
"\";\"",
")",
";",
"}"
] | adds attribute to constructor
@param constructorBuilder constructor to modify
@param attributeName name of attribute to be added
@param type type of attribute to be added | [
"adds",
"attribute",
"to",
"constructor"
] | 1fcca4e962ef53cbdb94bd72cb556de7f5f9469f | https://github.com/structlogging/structlogger/blob/1fcca4e962ef53cbdb94bd72cb556de7f5f9469f/structlogger/src/main/java/com/github/structlogging/processor/service/POJOService.java#L192-L195 | train |
structlogging/structlogger | structlogger/src/main/java/com/github/structlogging/processor/service/POJOService.java | POJOService.addGetter | private void addGetter(final TypeSpec.Builder classBuilder, final String attributeName, final TypeName type) {
final String getterMethodName = "get" + attributeName.substring(0, 1).toUpperCase() + attributeName.substring(1);
final MethodSpec.Builder getterBuilder = MethodSpec.methodBuilder(getterMethodName);
getterBuilder.returns(type);
getterBuilder.addModifiers(Modifier.PUBLIC);
getterBuilder.addCode("return this." + attributeName + ";");
classBuilder.addMethod(getterBuilder.build());
} | java | private void addGetter(final TypeSpec.Builder classBuilder, final String attributeName, final TypeName type) {
final String getterMethodName = "get" + attributeName.substring(0, 1).toUpperCase() + attributeName.substring(1);
final MethodSpec.Builder getterBuilder = MethodSpec.methodBuilder(getterMethodName);
getterBuilder.returns(type);
getterBuilder.addModifiers(Modifier.PUBLIC);
getterBuilder.addCode("return this." + attributeName + ";");
classBuilder.addMethod(getterBuilder.build());
} | [
"private",
"void",
"addGetter",
"(",
"final",
"TypeSpec",
".",
"Builder",
"classBuilder",
",",
"final",
"String",
"attributeName",
",",
"final",
"TypeName",
"type",
")",
"{",
"final",
"String",
"getterMethodName",
"=",
"\"get\"",
"+",
"attributeName",
".",
"substring",
"(",
"0",
",",
"1",
")",
".",
"toUpperCase",
"(",
")",
"+",
"attributeName",
".",
"substring",
"(",
"1",
")",
";",
"final",
"MethodSpec",
".",
"Builder",
"getterBuilder",
"=",
"MethodSpec",
".",
"methodBuilder",
"(",
"getterMethodName",
")",
";",
"getterBuilder",
".",
"returns",
"(",
"type",
")",
";",
"getterBuilder",
".",
"addModifiers",
"(",
"Modifier",
".",
"PUBLIC",
")",
";",
"getterBuilder",
".",
"addCode",
"(",
"\"return this.\"",
"+",
"attributeName",
"+",
"\";\"",
")",
";",
"classBuilder",
".",
"addMethod",
"(",
"getterBuilder",
".",
"build",
"(",
")",
")",
";",
"}"
] | adds getter for field to class
@param classBuilder class to modify
@param attributeName name of attribute to be referenced
@param type type of attribue to be referenced | [
"adds",
"getter",
"for",
"field",
"to",
"class"
] | 1fcca4e962ef53cbdb94bd72cb556de7f5f9469f | https://github.com/structlogging/structlogger/blob/1fcca4e962ef53cbdb94bd72cb556de7f5f9469f/structlogger/src/main/java/com/github/structlogging/processor/service/POJOService.java#L203-L211 | train |
structlogging/structlogger | structlogger/src/main/java/com/github/structlogging/processor/service/POJOService.java | POJOService.hash | private String hash(String string) {
final String sha1Hex = DigestUtils.sha1Hex(string);
return StringUtils.substring(sha1Hex, 0, 8);
} | java | private String hash(String string) {
final String sha1Hex = DigestUtils.sha1Hex(string);
return StringUtils.substring(sha1Hex, 0, 8);
} | [
"private",
"String",
"hash",
"(",
"String",
"string",
")",
"{",
"final",
"String",
"sha1Hex",
"=",
"DigestUtils",
".",
"sha1Hex",
"(",
"string",
")",
";",
"return",
"StringUtils",
".",
"substring",
"(",
"sha1Hex",
",",
"0",
",",
"8",
")",
";",
"}"
] | hash String with stable hash function
@param string to be hashed
@return hashed string | [
"hash",
"String",
"with",
"stable",
"hash",
"function"
] | 1fcca4e962ef53cbdb94bd72cb556de7f5f9469f | https://github.com/structlogging/structlogger/blob/1fcca4e962ef53cbdb94bd72cb556de7f5f9469f/structlogger/src/main/java/com/github/structlogging/processor/service/POJOService.java#L218-L221 | train |
jeppetto/jeppetto | jeppetto-enhance/src/main/java/org/iternine/jeppetto/enhance/Enhancer.java | Enhancer.newInstance | public T newInstance() {
try {
return getEnhancedClass().newInstance();
} catch (Exception e) {
logger.error("Could not instantiate enhanced object.", e);
throw ExceptionUtil.propagate(e);
}
} | java | public T newInstance() {
try {
return getEnhancedClass().newInstance();
} catch (Exception e) {
logger.error("Could not instantiate enhanced object.", e);
throw ExceptionUtil.propagate(e);
}
} | [
"public",
"T",
"newInstance",
"(",
")",
"{",
"try",
"{",
"return",
"getEnhancedClass",
"(",
")",
".",
"newInstance",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"logger",
".",
"error",
"(",
"\"Could not instantiate enhanced object.\"",
",",
"e",
")",
";",
"throw",
"ExceptionUtil",
".",
"propagate",
"(",
"e",
")",
";",
"}",
"}"
] | Creates a new object that is enhanced.
@return new object | [
"Creates",
"a",
"new",
"object",
"that",
"is",
"enhanced",
"."
] | bd2796dcf53376052f590e727931990a2902a933 | https://github.com/jeppetto/jeppetto/blob/bd2796dcf53376052f590e727931990a2902a933/jeppetto-enhance/src/main/java/org/iternine/jeppetto/enhance/Enhancer.java#L95-L103 | train |
jeppetto/jeppetto | jeppetto-enhance/src/main/java/org/iternine/jeppetto/enhance/Enhancer.java | Enhancer.enhance | public T enhance(T t) {
if (!needsEnhancement(t)) {
return t;
}
try {
return getEnhancedClass().getConstructor(baseClass).newInstance(t);
} catch (Exception e) {
throw new RuntimeException(String.format("Could not enhance object %s (%s)", t, t.getClass()), e);
}
} | java | public T enhance(T t) {
if (!needsEnhancement(t)) {
return t;
}
try {
return getEnhancedClass().getConstructor(baseClass).newInstance(t);
} catch (Exception e) {
throw new RuntimeException(String.format("Could not enhance object %s (%s)", t, t.getClass()), e);
}
} | [
"public",
"T",
"enhance",
"(",
"T",
"t",
")",
"{",
"if",
"(",
"!",
"needsEnhancement",
"(",
"t",
")",
")",
"{",
"return",
"t",
";",
"}",
"try",
"{",
"return",
"getEnhancedClass",
"(",
")",
".",
"getConstructor",
"(",
"baseClass",
")",
".",
"newInstance",
"(",
"t",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"String",
".",
"format",
"(",
"\"Could not enhance object %s (%s)\"",
",",
"t",
",",
"t",
".",
"getClass",
"(",
")",
")",
",",
"e",
")",
";",
"}",
"}"
] | Enhances the given object.
@param t object to enhance
@return enhanced object | [
"Enhances",
"the",
"given",
"object",
"."
] | bd2796dcf53376052f590e727931990a2902a933 | https://github.com/jeppetto/jeppetto/blob/bd2796dcf53376052f590e727931990a2902a933/jeppetto-enhance/src/main/java/org/iternine/jeppetto/enhance/Enhancer.java#L113-L123 | train |
jeppetto/jeppetto | jeppetto-dao-mongo/src/main/java/org/iternine/jeppetto/dao/mongodb/enhance/DBObjectUtil.java | DBObjectUtil.objectIsMutable | public static boolean objectIsMutable(Object object) {
if (object == null) {
return false;
}
Class<?> clazz = object.getClass();
return Collection.class.isAssignableFrom(clazz);
} | java | public static boolean objectIsMutable(Object object) {
if (object == null) {
return false;
}
Class<?> clazz = object.getClass();
return Collection.class.isAssignableFrom(clazz);
} | [
"public",
"static",
"boolean",
"objectIsMutable",
"(",
"Object",
"object",
")",
"{",
"if",
"(",
"object",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"Class",
"<",
"?",
">",
"clazz",
"=",
"object",
".",
"getClass",
"(",
")",
";",
"return",
"Collection",
".",
"class",
".",
"isAssignableFrom",
"(",
"clazz",
")",
";",
"}"
] | Returns true if the given object is a "mutable" type that needs to be enhanced
as DirtyableDBObject to prevent lost changes. Array types are ok because the default
isDirty method will detect changes there.
@param object object to check
@return true if mutable, false otherwise | [
"Returns",
"true",
"if",
"the",
"given",
"object",
"is",
"a",
"mutable",
"type",
"that",
"needs",
"to",
"be",
"enhanced",
"as",
"DirtyableDBObject",
"to",
"prevent",
"lost",
"changes",
".",
"Array",
"types",
"are",
"ok",
"because",
"the",
"default",
"isDirty",
"method",
"will",
"detect",
"changes",
"there",
"."
] | bd2796dcf53376052f590e727931990a2902a933 | https://github.com/jeppetto/jeppetto/blob/bd2796dcf53376052f590e727931990a2902a933/jeppetto-dao-mongo/src/main/java/org/iternine/jeppetto/dao/mongodb/enhance/DBObjectUtil.java#L93-L101 | train |
wildfly-swarm-archive/ARCHIVE-wildfly-swarm | container/api/src/main/java/org/wildfly/swarm/container/Container.java | Container.fraction | public Container fraction(Fraction fraction) {
if (fraction != null) {
this.fractions.put(fractionRoot(fraction.getClass()), fraction);
this.fractionsBySimpleName.put(fraction.simpleName(), fraction);
fraction.initialize(new InitContext());
}
return this;
} | java | public Container fraction(Fraction fraction) {
if (fraction != null) {
this.fractions.put(fractionRoot(fraction.getClass()), fraction);
this.fractionsBySimpleName.put(fraction.simpleName(), fraction);
fraction.initialize(new InitContext());
}
return this;
} | [
"public",
"Container",
"fraction",
"(",
"Fraction",
"fraction",
")",
"{",
"if",
"(",
"fraction",
"!=",
"null",
")",
"{",
"this",
".",
"fractions",
".",
"put",
"(",
"fractionRoot",
"(",
"fraction",
".",
"getClass",
"(",
")",
")",
",",
"fraction",
")",
";",
"this",
".",
"fractionsBySimpleName",
".",
"put",
"(",
"fraction",
".",
"simpleName",
"(",
")",
",",
"fraction",
")",
";",
"fraction",
".",
"initialize",
"(",
"new",
"InitContext",
"(",
")",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Add a fraction to the container.
@param fraction The fraction to add.
@return The container. | [
"Add",
"a",
"fraction",
"to",
"the",
"container",
"."
] | 28ef71bcfa743a7267666e0ed2919c37b356c09b | https://github.com/wildfly-swarm-archive/ARCHIVE-wildfly-swarm/blob/28ef71bcfa743a7267666e0ed2919c37b356c09b/container/api/src/main/java/org/wildfly/swarm/container/Container.java#L253-L260 | train |
wildfly-swarm-archive/ARCHIVE-wildfly-swarm | container/api/src/main/java/org/wildfly/swarm/container/Container.java | Container.iface | public Container iface(String name, String expression) {
this.interfaces.add(new Interface(name, expression));
return this;
} | java | public Container iface(String name, String expression) {
this.interfaces.add(new Interface(name, expression));
return this;
} | [
"public",
"Container",
"iface",
"(",
"String",
"name",
",",
"String",
"expression",
")",
"{",
"this",
".",
"interfaces",
".",
"add",
"(",
"new",
"Interface",
"(",
"name",
",",
"expression",
")",
")",
";",
"return",
"this",
";",
"}"
] | Configure a network interface.
@param name The name of the interface.
@param expression The expression to define the interface.
@return The container. | [
"Configure",
"a",
"network",
"interface",
"."
] | 28ef71bcfa743a7267666e0ed2919c37b356c09b | https://github.com/wildfly-swarm-archive/ARCHIVE-wildfly-swarm/blob/28ef71bcfa743a7267666e0ed2919c37b356c09b/container/api/src/main/java/org/wildfly/swarm/container/Container.java#L316-L319 | train |
wildfly-swarm-archive/ARCHIVE-wildfly-swarm | container/api/src/main/java/org/wildfly/swarm/container/Container.java | Container.createDefaultDeployment | public Archive createDefaultDeployment() {
try {
Iterator<DefaultDeploymentFactory> providerIter = Module.getBootModuleLoader()
.loadModule(ModuleIdentifier.create("swarm.application"))
.loadService(DefaultDeploymentFactory.class)
.iterator();
if (!providerIter.hasNext()) {
providerIter = ServiceLoader.load(DefaultDeploymentFactory.class, ClassLoader.getSystemClassLoader())
.iterator();
}
final Map<String, DefaultDeploymentFactory> factories = new HashMap<>();
while (providerIter.hasNext()) {
final DefaultDeploymentFactory factory = providerIter.next();
final DefaultDeploymentFactory current = factories.get(factory.getType());
if (current == null) {
factories.put(factory.getType(), factory);
} else {
// if this one is high priority than the previously-seen
// factory, replace it.
if (factory.getPriority() > current.getPriority()) {
factories.put(factory.getType(), factory);
}
}
}
final DefaultDeploymentFactory factory = factories.get(determineDeploymentType());
return factory != null ? factory.create() : ShrinkWrap.create(JARArchive.class);
} catch (Exception e) {
throw new RuntimeException(e);
}
} | java | public Archive createDefaultDeployment() {
try {
Iterator<DefaultDeploymentFactory> providerIter = Module.getBootModuleLoader()
.loadModule(ModuleIdentifier.create("swarm.application"))
.loadService(DefaultDeploymentFactory.class)
.iterator();
if (!providerIter.hasNext()) {
providerIter = ServiceLoader.load(DefaultDeploymentFactory.class, ClassLoader.getSystemClassLoader())
.iterator();
}
final Map<String, DefaultDeploymentFactory> factories = new HashMap<>();
while (providerIter.hasNext()) {
final DefaultDeploymentFactory factory = providerIter.next();
final DefaultDeploymentFactory current = factories.get(factory.getType());
if (current == null) {
factories.put(factory.getType(), factory);
} else {
// if this one is high priority than the previously-seen
// factory, replace it.
if (factory.getPriority() > current.getPriority()) {
factories.put(factory.getType(), factory);
}
}
}
final DefaultDeploymentFactory factory = factories.get(determineDeploymentType());
return factory != null ? factory.create() : ShrinkWrap.create(JARArchive.class);
} catch (Exception e) {
throw new RuntimeException(e);
}
} | [
"public",
"Archive",
"createDefaultDeployment",
"(",
")",
"{",
"try",
"{",
"Iterator",
"<",
"DefaultDeploymentFactory",
">",
"providerIter",
"=",
"Module",
".",
"getBootModuleLoader",
"(",
")",
".",
"loadModule",
"(",
"ModuleIdentifier",
".",
"create",
"(",
"\"swarm.application\"",
")",
")",
".",
"loadService",
"(",
"DefaultDeploymentFactory",
".",
"class",
")",
".",
"iterator",
"(",
")",
";",
"if",
"(",
"!",
"providerIter",
".",
"hasNext",
"(",
")",
")",
"{",
"providerIter",
"=",
"ServiceLoader",
".",
"load",
"(",
"DefaultDeploymentFactory",
".",
"class",
",",
"ClassLoader",
".",
"getSystemClassLoader",
"(",
")",
")",
".",
"iterator",
"(",
")",
";",
"}",
"final",
"Map",
"<",
"String",
",",
"DefaultDeploymentFactory",
">",
"factories",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"while",
"(",
"providerIter",
".",
"hasNext",
"(",
")",
")",
"{",
"final",
"DefaultDeploymentFactory",
"factory",
"=",
"providerIter",
".",
"next",
"(",
")",
";",
"final",
"DefaultDeploymentFactory",
"current",
"=",
"factories",
".",
"get",
"(",
"factory",
".",
"getType",
"(",
")",
")",
";",
"if",
"(",
"current",
"==",
"null",
")",
"{",
"factories",
".",
"put",
"(",
"factory",
".",
"getType",
"(",
")",
",",
"factory",
")",
";",
"}",
"else",
"{",
"// if this one is high priority than the previously-seen",
"// factory, replace it.",
"if",
"(",
"factory",
".",
"getPriority",
"(",
")",
">",
"current",
".",
"getPriority",
"(",
")",
")",
"{",
"factories",
".",
"put",
"(",
"factory",
".",
"getType",
"(",
")",
",",
"factory",
")",
";",
"}",
"}",
"}",
"final",
"DefaultDeploymentFactory",
"factory",
"=",
"factories",
".",
"get",
"(",
"determineDeploymentType",
"(",
")",
")",
";",
"return",
"factory",
"!=",
"null",
"?",
"factory",
".",
"create",
"(",
")",
":",
"ShrinkWrap",
".",
"create",
"(",
"JARArchive",
".",
"class",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}"
] | Provides access to the default ShrinkWrap deployment.
@return the default deployment | [
"Provides",
"access",
"to",
"the",
"default",
"ShrinkWrap",
"deployment",
"."
] | 28ef71bcfa743a7267666e0ed2919c37b356c09b | https://github.com/wildfly-swarm-archive/ARCHIVE-wildfly-swarm/blob/28ef71bcfa743a7267666e0ed2919c37b356c09b/container/api/src/main/java/org/wildfly/swarm/container/Container.java#L509-L543 | train |
tomitribe/crest | tomitribe-crest-cli/src/main/java/org/tomitribe/crest/cli/api/CrestCli.java | CrestCli.createMainEnvironment | protected CliEnvironment createMainEnvironment(final AtomicReference<InputReader> dynamicInputReaderRef,
final AtomicReference<History> dynamicHistoryAtomicReference) {
final Map<String, ?> data = new HashMap<String, Object>();
return new CliEnv() {
@Override
public History history() {
return dynamicHistoryAtomicReference.get();
}
@Override
public InputReader reader() {
return dynamicInputReaderRef.get();
}
@Override
public Map<String, ?> userData() {
return data;
}
};
} | java | protected CliEnvironment createMainEnvironment(final AtomicReference<InputReader> dynamicInputReaderRef,
final AtomicReference<History> dynamicHistoryAtomicReference) {
final Map<String, ?> data = new HashMap<String, Object>();
return new CliEnv() {
@Override
public History history() {
return dynamicHistoryAtomicReference.get();
}
@Override
public InputReader reader() {
return dynamicInputReaderRef.get();
}
@Override
public Map<String, ?> userData() {
return data;
}
};
} | [
"protected",
"CliEnvironment",
"createMainEnvironment",
"(",
"final",
"AtomicReference",
"<",
"InputReader",
">",
"dynamicInputReaderRef",
",",
"final",
"AtomicReference",
"<",
"History",
">",
"dynamicHistoryAtomicReference",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"?",
">",
"data",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"return",
"new",
"CliEnv",
"(",
")",
"{",
"@",
"Override",
"public",
"History",
"history",
"(",
")",
"{",
"return",
"dynamicHistoryAtomicReference",
".",
"get",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"InputReader",
"reader",
"(",
")",
"{",
"return",
"dynamicInputReaderRef",
".",
"get",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"Map",
"<",
"String",
",",
"?",
">",
"userData",
"(",
")",
"{",
"return",
"data",
";",
"}",
"}",
";",
"}"
] | java 8 would have use Supplier which is cleaner | [
"java",
"8",
"would",
"have",
"use",
"Supplier",
"which",
"is",
"cleaner"
] | c8d37d15e937c235df3dfaa33fbac15ee5a367a7 | https://github.com/tomitribe/crest/blob/c8d37d15e937c235df3dfaa33fbac15ee5a367a7/tomitribe-crest-cli/src/main/java/org/tomitribe/crest/cli/api/CrestCli.java#L406-L425 | train |
matthewhorridge/owlexplanation | src/main/java/org/semanticweb/owl/explanation/impl/laconic/LaconicExplanationGeneratorBasedOnOPlus.java | LaconicExplanationGeneratorBasedOnOPlus.getExplanations | public Set<Explanation<OWLAxiom>> getExplanations(OWLAxiom entailment) throws ExplanationException {
return getExplanations(entailment, Integer.MAX_VALUE);
} | java | public Set<Explanation<OWLAxiom>> getExplanations(OWLAxiom entailment) throws ExplanationException {
return getExplanations(entailment, Integer.MAX_VALUE);
} | [
"public",
"Set",
"<",
"Explanation",
"<",
"OWLAxiom",
">",
">",
"getExplanations",
"(",
"OWLAxiom",
"entailment",
")",
"throws",
"ExplanationException",
"{",
"return",
"getExplanations",
"(",
"entailment",
",",
"Integer",
".",
"MAX_VALUE",
")",
";",
"}"
] | Gets explanations for an entailment. All explanations for the entailment will be returned.
@param entailment The entailment for which explanations will be generated.
@return A set containing all of the explanations. The set will be empty if the entailment does not hold.
@throws org.semanticweb.owl.explanation.api.ExplanationException
if there was a problem generating the explanation. | [
"Gets",
"explanations",
"for",
"an",
"entailment",
".",
"All",
"explanations",
"for",
"the",
"entailment",
"will",
"be",
"returned",
"."
] | 439c5ca67835f5e421adde725e4e8a3bcd760ac8 | https://github.com/matthewhorridge/owlexplanation/blob/439c5ca67835f5e421adde725e4e8a3bcd760ac8/src/main/java/org/semanticweb/owl/explanation/impl/laconic/LaconicExplanationGeneratorBasedOnOPlus.java#L47-L49 | train |
openengsb/openengsb | components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/operation/InstantiateOperation.java | InstantiateOperation.tryInitiatingObject | private Object tryInitiatingObject(String targetType, String initMethodName, List<Object> fieldObjects)
throws TransformationOperationException {
Class<?> targetClass = loadClassByName(targetType);
try {
if (initMethodName == null) {
return initiateByConstructor(targetClass, fieldObjects);
} else {
return initiateByMethodName(targetClass, initMethodName, fieldObjects);
}
} catch (Exception e) {
String message = "Unable to create the desired object. The instantiate operation will be ignored.";
message = String.format(message, targetType);
getLogger().error(message);
throw new TransformationOperationException(message, e);
}
} | java | private Object tryInitiatingObject(String targetType, String initMethodName, List<Object> fieldObjects)
throws TransformationOperationException {
Class<?> targetClass = loadClassByName(targetType);
try {
if (initMethodName == null) {
return initiateByConstructor(targetClass, fieldObjects);
} else {
return initiateByMethodName(targetClass, initMethodName, fieldObjects);
}
} catch (Exception e) {
String message = "Unable to create the desired object. The instantiate operation will be ignored.";
message = String.format(message, targetType);
getLogger().error(message);
throw new TransformationOperationException(message, e);
}
} | [
"private",
"Object",
"tryInitiatingObject",
"(",
"String",
"targetType",
",",
"String",
"initMethodName",
",",
"List",
"<",
"Object",
">",
"fieldObjects",
")",
"throws",
"TransformationOperationException",
"{",
"Class",
"<",
"?",
">",
"targetClass",
"=",
"loadClassByName",
"(",
"targetType",
")",
";",
"try",
"{",
"if",
"(",
"initMethodName",
"==",
"null",
")",
"{",
"return",
"initiateByConstructor",
"(",
"targetClass",
",",
"fieldObjects",
")",
";",
"}",
"else",
"{",
"return",
"initiateByMethodName",
"(",
"targetClass",
",",
"initMethodName",
",",
"fieldObjects",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"String",
"message",
"=",
"\"Unable to create the desired object. The instantiate operation will be ignored.\"",
";",
"message",
"=",
"String",
".",
"format",
"(",
"message",
",",
"targetType",
")",
";",
"getLogger",
"(",
")",
".",
"error",
"(",
"message",
")",
";",
"throw",
"new",
"TransformationOperationException",
"(",
"message",
",",
"e",
")",
";",
"}",
"}"
] | Try to perform the actual initiating of the target class object. Returns the target class object or throws a
TransformationOperationException if something went wrong. | [
"Try",
"to",
"perform",
"the",
"actual",
"initiating",
"of",
"the",
"target",
"class",
"object",
".",
"Returns",
"the",
"target",
"class",
"object",
"or",
"throws",
"a",
"TransformationOperationException",
"if",
"something",
"went",
"wrong",
"."
] | d39058000707f617cd405629f9bc7f17da7b414a | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/operation/InstantiateOperation.java#L82-L97 | train |
openengsb/openengsb | components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/operation/InstantiateOperation.java | InstantiateOperation.initiateByMethodName | private Object initiateByMethodName(Class<?> targetClass, String initMethodName, List<Object> objects)
throws Exception {
Method method = targetClass.getMethod(initMethodName, getClassList(objects));
if (Modifier.isStatic(method.getModifiers())) {
return method.invoke(null, objects.toArray());
} else {
return method.invoke(targetClass.newInstance(), objects.toArray());
}
} | java | private Object initiateByMethodName(Class<?> targetClass, String initMethodName, List<Object> objects)
throws Exception {
Method method = targetClass.getMethod(initMethodName, getClassList(objects));
if (Modifier.isStatic(method.getModifiers())) {
return method.invoke(null, objects.toArray());
} else {
return method.invoke(targetClass.newInstance(), objects.toArray());
}
} | [
"private",
"Object",
"initiateByMethodName",
"(",
"Class",
"<",
"?",
">",
"targetClass",
",",
"String",
"initMethodName",
",",
"List",
"<",
"Object",
">",
"objects",
")",
"throws",
"Exception",
"{",
"Method",
"method",
"=",
"targetClass",
".",
"getMethod",
"(",
"initMethodName",
",",
"getClassList",
"(",
"objects",
")",
")",
";",
"if",
"(",
"Modifier",
".",
"isStatic",
"(",
"method",
".",
"getModifiers",
"(",
")",
")",
")",
"{",
"return",
"method",
".",
"invoke",
"(",
"null",
",",
"objects",
".",
"toArray",
"(",
")",
")",
";",
"}",
"else",
"{",
"return",
"method",
".",
"invoke",
"(",
"targetClass",
".",
"newInstance",
"(",
")",
",",
"objects",
".",
"toArray",
"(",
")",
")",
";",
"}",
"}"
] | Tries to initiate an object of the target class through the given init method name with the given object as
parameter. | [
"Tries",
"to",
"initiate",
"an",
"object",
"of",
"the",
"target",
"class",
"through",
"the",
"given",
"init",
"method",
"name",
"with",
"the",
"given",
"object",
"as",
"parameter",
"."
] | d39058000707f617cd405629f9bc7f17da7b414a | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/operation/InstantiateOperation.java#L103-L111 | train |
openengsb/openengsb | components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/operation/InstantiateOperation.java | InstantiateOperation.initiateByConstructor | private Object initiateByConstructor(Class<?> targetClass, List<Object> objects) throws Exception {
Constructor<?> constr = targetClass.getConstructor(getClassList(objects));
return constr.newInstance(objects.toArray());
} | java | private Object initiateByConstructor(Class<?> targetClass, List<Object> objects) throws Exception {
Constructor<?> constr = targetClass.getConstructor(getClassList(objects));
return constr.newInstance(objects.toArray());
} | [
"private",
"Object",
"initiateByConstructor",
"(",
"Class",
"<",
"?",
">",
"targetClass",
",",
"List",
"<",
"Object",
">",
"objects",
")",
"throws",
"Exception",
"{",
"Constructor",
"<",
"?",
">",
"constr",
"=",
"targetClass",
".",
"getConstructor",
"(",
"getClassList",
"(",
"objects",
")",
")",
";",
"return",
"constr",
".",
"newInstance",
"(",
"objects",
".",
"toArray",
"(",
")",
")",
";",
"}"
] | Tries to initiate an object of the target class through a constructor with the given object as parameter. | [
"Tries",
"to",
"initiate",
"an",
"object",
"of",
"the",
"target",
"class",
"through",
"a",
"constructor",
"with",
"the",
"given",
"object",
"as",
"parameter",
"."
] | d39058000707f617cd405629f9bc7f17da7b414a | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/operation/InstantiateOperation.java#L116-L119 | train |
openengsb/openengsb | components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/operation/InstantiateOperation.java | InstantiateOperation.getClassList | private Class<?>[] getClassList(List<Object> objects) {
Class<?>[] classes = new Class<?>[objects.size()];
for (int i = 0; i < objects.size(); i++) {
classes[i] = objects.get(i).getClass();
}
return classes;
} | java | private Class<?>[] getClassList(List<Object> objects) {
Class<?>[] classes = new Class<?>[objects.size()];
for (int i = 0; i < objects.size(); i++) {
classes[i] = objects.get(i).getClass();
}
return classes;
} | [
"private",
"Class",
"<",
"?",
">",
"[",
"]",
"getClassList",
"(",
"List",
"<",
"Object",
">",
"objects",
")",
"{",
"Class",
"<",
"?",
">",
"[",
"]",
"classes",
"=",
"new",
"Class",
"<",
"?",
">",
"[",
"objects",
".",
"size",
"(",
")",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"objects",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"classes",
"[",
"i",
"]",
"=",
"objects",
".",
"get",
"(",
"i",
")",
".",
"getClass",
"(",
")",
";",
"}",
"return",
"classes",
";",
"}"
] | Returns a list containing the classes of the elements in the given object list as array. | [
"Returns",
"a",
"list",
"containing",
"the",
"classes",
"of",
"the",
"elements",
"in",
"the",
"given",
"object",
"list",
"as",
"array",
"."
] | d39058000707f617cd405629f9bc7f17da7b414a | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/operation/InstantiateOperation.java#L124-L130 | train |
openengsb/openengsb | components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/operation/InstantiateOperation.java | InstantiateOperation.loadClassByName | private Class<?> loadClassByName(String className) throws TransformationOperationException {
Exception e;
if (className.contains(";")) {
try {
String[] parts = className.split(";");
ModelDescription description = new ModelDescription();
description.setModelClassName(parts[0]);
if (parts.length > 1) {
description.setVersionString(new Version(parts[1]).toString());
}
return modelRegistry.loadModel(description);
} catch (Exception ex) {
e = ex;
}
} else {
try {
return this.getClass().getClassLoader().loadClass(className);
} catch (Exception ex) {
e = ex;
}
}
String message = "The class %s can't be found. The instantiate operation will be ignored.";
message = String.format(message, className);
getLogger().error(message);
throw new TransformationOperationException(message, e);
} | java | private Class<?> loadClassByName(String className) throws TransformationOperationException {
Exception e;
if (className.contains(";")) {
try {
String[] parts = className.split(";");
ModelDescription description = new ModelDescription();
description.setModelClassName(parts[0]);
if (parts.length > 1) {
description.setVersionString(new Version(parts[1]).toString());
}
return modelRegistry.loadModel(description);
} catch (Exception ex) {
e = ex;
}
} else {
try {
return this.getClass().getClassLoader().loadClass(className);
} catch (Exception ex) {
e = ex;
}
}
String message = "The class %s can't be found. The instantiate operation will be ignored.";
message = String.format(message, className);
getLogger().error(message);
throw new TransformationOperationException(message, e);
} | [
"private",
"Class",
"<",
"?",
">",
"loadClassByName",
"(",
"String",
"className",
")",
"throws",
"TransformationOperationException",
"{",
"Exception",
"e",
";",
"if",
"(",
"className",
".",
"contains",
"(",
"\";\"",
")",
")",
"{",
"try",
"{",
"String",
"[",
"]",
"parts",
"=",
"className",
".",
"split",
"(",
"\";\"",
")",
";",
"ModelDescription",
"description",
"=",
"new",
"ModelDescription",
"(",
")",
";",
"description",
".",
"setModelClassName",
"(",
"parts",
"[",
"0",
"]",
")",
";",
"if",
"(",
"parts",
".",
"length",
">",
"1",
")",
"{",
"description",
".",
"setVersionString",
"(",
"new",
"Version",
"(",
"parts",
"[",
"1",
"]",
")",
".",
"toString",
"(",
")",
")",
";",
"}",
"return",
"modelRegistry",
".",
"loadModel",
"(",
"description",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"e",
"=",
"ex",
";",
"}",
"}",
"else",
"{",
"try",
"{",
"return",
"this",
".",
"getClass",
"(",
")",
".",
"getClassLoader",
"(",
")",
".",
"loadClass",
"(",
"className",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"e",
"=",
"ex",
";",
"}",
"}",
"String",
"message",
"=",
"\"The class %s can't be found. The instantiate operation will be ignored.\"",
";",
"message",
"=",
"String",
".",
"format",
"(",
"message",
",",
"className",
")",
";",
"getLogger",
"(",
")",
".",
"error",
"(",
"message",
")",
";",
"throw",
"new",
"TransformationOperationException",
"(",
"message",
",",
"e",
")",
";",
"}"
] | Tries to load the class with the given name. Throws a TransformationOperationException if this is not possible. | [
"Tries",
"to",
"load",
"the",
"class",
"with",
"the",
"given",
"name",
".",
"Throws",
"a",
"TransformationOperationException",
"if",
"this",
"is",
"not",
"possible",
"."
] | d39058000707f617cd405629f9bc7f17da7b414a | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/operation/InstantiateOperation.java#L135-L160 | train |
aseovic/coherence-tools | core/src/main/java/com/seovic/core/objects/DynamicObject.java | DynamicObject.update | public void update(Object target) {
if (target == null) {
throw new IllegalArgumentException(
"Target to update cannot be null");
}
BeanWrapper bw = new BeanWrapperImpl(target);
bw.registerCustomEditor(Date.class, new CustomDateEditor(new SimpleDateFormat("yyyy-MM-dd"), true));
for (Map.Entry<String, Object> property : m_properties.entrySet()) {
String propertyName = property.getKey();
Object value = property.getValue();
if (value instanceof Map) {
PropertyDescriptor pd = bw.getPropertyDescriptor(propertyName);
if (!Map.class.isAssignableFrom(pd.getPropertyType()) || pd.getWriteMethod() == null) {
value = new DynamicObject((Map<String, Object>) value);
}
}
if (value instanceof DynamicObject) {
((DynamicObject) value).update(bw.getPropertyValue(propertyName));
}
else {
bw.setPropertyValue(propertyName, value);
}
}
} | java | public void update(Object target) {
if (target == null) {
throw new IllegalArgumentException(
"Target to update cannot be null");
}
BeanWrapper bw = new BeanWrapperImpl(target);
bw.registerCustomEditor(Date.class, new CustomDateEditor(new SimpleDateFormat("yyyy-MM-dd"), true));
for (Map.Entry<String, Object> property : m_properties.entrySet()) {
String propertyName = property.getKey();
Object value = property.getValue();
if (value instanceof Map) {
PropertyDescriptor pd = bw.getPropertyDescriptor(propertyName);
if (!Map.class.isAssignableFrom(pd.getPropertyType()) || pd.getWriteMethod() == null) {
value = new DynamicObject((Map<String, Object>) value);
}
}
if (value instanceof DynamicObject) {
((DynamicObject) value).update(bw.getPropertyValue(propertyName));
}
else {
bw.setPropertyValue(propertyName, value);
}
}
} | [
"public",
"void",
"update",
"(",
"Object",
"target",
")",
"{",
"if",
"(",
"target",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Target to update cannot be null\"",
")",
";",
"}",
"BeanWrapper",
"bw",
"=",
"new",
"BeanWrapperImpl",
"(",
"target",
")",
";",
"bw",
".",
"registerCustomEditor",
"(",
"Date",
".",
"class",
",",
"new",
"CustomDateEditor",
"(",
"new",
"SimpleDateFormat",
"(",
"\"yyyy-MM-dd\"",
")",
",",
"true",
")",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"Object",
">",
"property",
":",
"m_properties",
".",
"entrySet",
"(",
")",
")",
"{",
"String",
"propertyName",
"=",
"property",
".",
"getKey",
"(",
")",
";",
"Object",
"value",
"=",
"property",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"value",
"instanceof",
"Map",
")",
"{",
"PropertyDescriptor",
"pd",
"=",
"bw",
".",
"getPropertyDescriptor",
"(",
"propertyName",
")",
";",
"if",
"(",
"!",
"Map",
".",
"class",
".",
"isAssignableFrom",
"(",
"pd",
".",
"getPropertyType",
"(",
")",
")",
"||",
"pd",
".",
"getWriteMethod",
"(",
")",
"==",
"null",
")",
"{",
"value",
"=",
"new",
"DynamicObject",
"(",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
")",
"value",
")",
";",
"}",
"}",
"if",
"(",
"value",
"instanceof",
"DynamicObject",
")",
"{",
"(",
"(",
"DynamicObject",
")",
"value",
")",
".",
"update",
"(",
"bw",
".",
"getPropertyValue",
"(",
"propertyName",
")",
")",
";",
"}",
"else",
"{",
"bw",
".",
"setPropertyValue",
"(",
"propertyName",
",",
"value",
")",
";",
"}",
"}",
"}"
] | Update specified target from this object.
@param target target object to update | [
"Update",
"specified",
"target",
"from",
"this",
"object",
"."
] | 561a1d7e572ad98657fcd26beb1164891b0cd6fe | https://github.com/aseovic/coherence-tools/blob/561a1d7e572ad98657fcd26beb1164891b0cd6fe/core/src/main/java/com/seovic/core/objects/DynamicObject.java#L462-L488 | train |
FedericoPecora/meta-csp-framework | src/main/java/org/metacsp/utility/UI/PlotActivityNetworkGantt.java | PlotActivityNetworkGantt.createDataset | private IntervalCategoryDataset createDataset() {
TaskSeries ts = null;
TaskSeriesCollection collection = new TaskSeriesCollection();
if ( solver.getVariables().length == 0) {
return collection;
}
ts = new TaskSeries("All");
for (int i = 0; i < solver.getVariables().length ; i++) {
String label = solver.getVariables()[i].getComponent(); //dn.getNodes().elementAt(i).getLabel();
if ( this.selectedVariables == null || this.selectedVariables.contains( label ) ) {
SymbolicTimeline tl1 = new SymbolicTimeline(solver,label);
for (int j = 0 ; j < tl1.getPulses().length-1 ; j++ ) {
if ( tl1.getValues()[j] != null ) {
long startTime = tl1.getPulses()[j].longValue();
long endTime = startTime + tl1.getDurations()[j].longValue();
Date startTask = new Date(startTime);
Date endTask = new Date(endTime);
Task task;
String value = tl1.getValues()[j].toString().replace("[", "").replace("]", "");
if ( value.equals("true") )
task = new Task(label, startTask, endTask);
else
task = new Task(label + " := " + value, startTask, endTask);
ts.add(task);
}
}
}
}
collection.add(ts);
return collection;
} | java | private IntervalCategoryDataset createDataset() {
TaskSeries ts = null;
TaskSeriesCollection collection = new TaskSeriesCollection();
if ( solver.getVariables().length == 0) {
return collection;
}
ts = new TaskSeries("All");
for (int i = 0; i < solver.getVariables().length ; i++) {
String label = solver.getVariables()[i].getComponent(); //dn.getNodes().elementAt(i).getLabel();
if ( this.selectedVariables == null || this.selectedVariables.contains( label ) ) {
SymbolicTimeline tl1 = new SymbolicTimeline(solver,label);
for (int j = 0 ; j < tl1.getPulses().length-1 ; j++ ) {
if ( tl1.getValues()[j] != null ) {
long startTime = tl1.getPulses()[j].longValue();
long endTime = startTime + tl1.getDurations()[j].longValue();
Date startTask = new Date(startTime);
Date endTask = new Date(endTime);
Task task;
String value = tl1.getValues()[j].toString().replace("[", "").replace("]", "");
if ( value.equals("true") )
task = new Task(label, startTask, endTask);
else
task = new Task(label + " := " + value, startTask, endTask);
ts.add(task);
}
}
}
}
collection.add(ts);
return collection;
} | [
"private",
"IntervalCategoryDataset",
"createDataset",
"(",
")",
"{",
"TaskSeries",
"ts",
"=",
"null",
";",
"TaskSeriesCollection",
"collection",
"=",
"new",
"TaskSeriesCollection",
"(",
")",
";",
"if",
"(",
"solver",
".",
"getVariables",
"(",
")",
".",
"length",
"==",
"0",
")",
"{",
"return",
"collection",
";",
"}",
"ts",
"=",
"new",
"TaskSeries",
"(",
"\"All\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"solver",
".",
"getVariables",
"(",
")",
".",
"length",
";",
"i",
"++",
")",
"{",
"String",
"label",
"=",
"solver",
".",
"getVariables",
"(",
")",
"[",
"i",
"]",
".",
"getComponent",
"(",
")",
";",
"//dn.getNodes().elementAt(i).getLabel();\r",
"if",
"(",
"this",
".",
"selectedVariables",
"==",
"null",
"||",
"this",
".",
"selectedVariables",
".",
"contains",
"(",
"label",
")",
")",
"{",
"SymbolicTimeline",
"tl1",
"=",
"new",
"SymbolicTimeline",
"(",
"solver",
",",
"label",
")",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"tl1",
".",
"getPulses",
"(",
")",
".",
"length",
"-",
"1",
";",
"j",
"++",
")",
"{",
"if",
"(",
"tl1",
".",
"getValues",
"(",
")",
"[",
"j",
"]",
"!=",
"null",
")",
"{",
"long",
"startTime",
"=",
"tl1",
".",
"getPulses",
"(",
")",
"[",
"j",
"]",
".",
"longValue",
"(",
")",
";",
"long",
"endTime",
"=",
"startTime",
"+",
"tl1",
".",
"getDurations",
"(",
")",
"[",
"j",
"]",
".",
"longValue",
"(",
")",
";",
"Date",
"startTask",
"=",
"new",
"Date",
"(",
"startTime",
")",
";",
"Date",
"endTask",
"=",
"new",
"Date",
"(",
"endTime",
")",
";",
"Task",
"task",
";",
"String",
"value",
"=",
"tl1",
".",
"getValues",
"(",
")",
"[",
"j",
"]",
".",
"toString",
"(",
")",
".",
"replace",
"(",
"\"[\"",
",",
"\"\"",
")",
".",
"replace",
"(",
"\"]\"",
",",
"\"\"",
")",
";",
"if",
"(",
"value",
".",
"equals",
"(",
"\"true\"",
")",
")",
"task",
"=",
"new",
"Task",
"(",
"label",
",",
"startTask",
",",
"endTask",
")",
";",
"else",
"task",
"=",
"new",
"Task",
"(",
"label",
"+",
"\" := \"",
"+",
"value",
",",
"startTask",
",",
"endTask",
")",
";",
"ts",
".",
"add",
"(",
"task",
")",
";",
"}",
"}",
"}",
"}",
"collection",
".",
"add",
"(",
"ts",
")",
";",
"return",
"collection",
";",
"}"
] | Creates a sample data set for a Gantt chart.
@return The data set. | [
"Creates",
"a",
"sample",
"data",
"set",
"for",
"a",
"Gantt",
"chart",
"."
] | 42aaef2e2b76d0f738427f0dd9653c4f62b40517 | https://github.com/FedericoPecora/meta-csp-framework/blob/42aaef2e2b76d0f738427f0dd9653c4f62b40517/src/main/java/org/metacsp/utility/UI/PlotActivityNetworkGantt.java#L105-L148 | train |
FedericoPecora/meta-csp-framework | src/main/java/org/metacsp/utility/logging/LinePainter.java | LinePainter.paint | public void paint(Graphics g, int p0, int p1, Shape bounds, JTextComponent c)
{
try
{
Rectangle r = c.modelToView(c.getCaretPosition());
g.setColor( color );
g.fillRect(0, r.y, c.getWidth(), r.height);
if (lastView == null)
lastView = r;
}
catch(BadLocationException ble) {System.out.println(ble);}
} | java | public void paint(Graphics g, int p0, int p1, Shape bounds, JTextComponent c)
{
try
{
Rectangle r = c.modelToView(c.getCaretPosition());
g.setColor( color );
g.fillRect(0, r.y, c.getWidth(), r.height);
if (lastView == null)
lastView = r;
}
catch(BadLocationException ble) {System.out.println(ble);}
} | [
"public",
"void",
"paint",
"(",
"Graphics",
"g",
",",
"int",
"p0",
",",
"int",
"p1",
",",
"Shape",
"bounds",
",",
"JTextComponent",
"c",
")",
"{",
"try",
"{",
"Rectangle",
"r",
"=",
"c",
".",
"modelToView",
"(",
"c",
".",
"getCaretPosition",
"(",
")",
")",
";",
"g",
".",
"setColor",
"(",
"color",
")",
";",
"g",
".",
"fillRect",
"(",
"0",
",",
"r",
".",
"y",
",",
"c",
".",
"getWidth",
"(",
")",
",",
"r",
".",
"height",
")",
";",
"if",
"(",
"lastView",
"==",
"null",
")",
"lastView",
"=",
"r",
";",
"}",
"catch",
"(",
"BadLocationException",
"ble",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"ble",
")",
";",
"}",
"}"
] | Paint the background highlight | [
"Paint",
"the",
"background",
"highlight"
] | 42aaef2e2b76d0f738427f0dd9653c4f62b40517 | https://github.com/FedericoPecora/meta-csp-framework/blob/42aaef2e2b76d0f738427f0dd9653c4f62b40517/src/main/java/org/metacsp/utility/logging/LinePainter.java#L94-L106 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.