code
stringlengths 73
34.1k
| label
stringclasses 1
value |
---|---|
public boolean checkResponseForException() {
if (!finished && rsp != null) {
Exception e;
if ((e = rsp.getException()) != null) {
setError(e.getMessage());
setFinished();
return true;
}
}
return false;
} | 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;
} | 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;
} | 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;
}
} | 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;
} | 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;
}
} | 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;
}
} | 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);
} | 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);
} | 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;
} | java |
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, String name) throws Exception{
vpnformssoaction obj = new vpnformssoaction();
obj.set_name(name);
vpnformssoaction response = (vpnformssoaction) obj.get_resource(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;
} | 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");
} | 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;
} | java |
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, 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 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_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_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_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_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_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_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 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, 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{
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 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 unset(nitro_service client, nsparam resource, String[] args) throws Exception{
nsparam unsetresource = new nsparam();
return unsetresource.unset_resource(client,args);
} | java |
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 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 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 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 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 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 |
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 |
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 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 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 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 unset(nitro_service client, systemparameter resource, String[] args) throws Exception{
systemparameter unsetresource = new systemparameter();
return unsetresource.unset_resource(client,args);
} | java |
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 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 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, 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 Arguments set(final int index,
final Fixed f) {
this.argumentRefs.add(f);
this.pointer.get(index)
.setF(f.getRaw());
return this;
} | 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));
}
} | 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);
} | java |
public Resource<?> getObject(final int id) {
return ObjectCache.from(WaylandServerCore.INSTANCE()
.wl_client_get_object(this.pointer,
id));
} | 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;
} | 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"
);
}
} | 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);
}
} | java |
public void destroy() {
WaylandClientCore.INSTANCE()
.wl_proxy_destroy(this.pointer);
ObjectCache.remove(this.pointer);
this.jObjectPointer.close();
} | 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);
}
} | 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);
} | 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;
} | 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());
}
}
} | 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);
}
}
} | java |
private String formatWithStatementLocation(String format, StatementInfo statementInfo, Object... args) {
return format(format, args) + format(" [%s:%s]", statementInfo.getSourceFileName(), statementInfo.getLineNumber());
} | java |
private void addVariablesToBuffer(final java.util.List<VariableAndValue> usedVariables, final ListBuffer listBuffer) {
for (VariableAndValue variableAndValue : usedVariables) {
listBuffer.add(variableAndValue.getValue());
}
} | 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()]);
} | java |
public static LoggingFraction createDefaultLoggingFraction(Level level) {
return new LoggingFraction()
.defaultColorFormatter()
.consoleHandler(level, COLOR_PATTERN)
.rootLogger(level, CONSOLE);
} | java |
public LoggingFraction formatter(String name, String pattern) {
patternFormatter(new PatternFormatter(name).pattern(pattern));
return this;
} | java |
public LoggingFraction consoleHandler(Level level, String formatter) {
consoleHandler(new ConsoleHandler(CONSOLE)
.level(level)
.namedFormatter(formatter));
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;
} | 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;
} | java |
public LoggingFraction rootLogger(Level level, String... handlers) {
rootLogger(new RootLogger().level(level)
.handlers(handlers));
return this;
} | 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);
}
} | 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);
}
} | 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();
} | java |
public BatchFraction defaultJobRepository(final String name, final DatasourcesFraction datasource) {
jdbcJobRepository(name, datasource);
return defaultJobRepository(name);
} | java |
public BatchFraction jdbcJobRepository(final String name, final DatasourcesFraction datasource) {
return jdbcJobRepository(new JDBCJobRepository<>(name).dataSource(datasource.getKey()));
} | java |
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 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 |
@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 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 logstashStructuredLogging1Calls() {
loggerLogstash.info("Event with double and boolean", keyValue("varDouble", 1.2), keyValue("varBoolean", false));
} | 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();
} | 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");
}
} | 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);");
} | 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);
} | 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 + ";");
} | 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());
} | java |
private String hash(String string) {
final String sha1Hex = DigestUtils.sha1Hex(string);
return StringUtils.substring(sha1Hex, 0, 8);
} | java |
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 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 static boolean objectIsMutable(Object object) {
if (object == null) {
return false;
}
Class<?> clazz = object.getClass();
return Collection.class.isAssignableFrom(clazz);
} | 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;
} | java |
public Container iface(String name, String expression) {
this.interfaces.add(new Interface(name, expression));
return this;
} | 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);
}
} | 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;
}
};
} | java |
public Set<Explanation<OWLAxiom>> getExplanations(OWLAxiom entailment) throws ExplanationException {
return getExplanations(entailment, Integer.MAX_VALUE);
} | 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);
}
} | 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());
}
} | java |
private Object initiateByConstructor(Class<?> targetClass, List<Object> objects) throws Exception {
Constructor<?> constr = targetClass.getConstructor(getClassList(objects));
return constr.newInstance(objects.toArray());
} | 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;
} | 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);
} | 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);
}
}
} | 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;
} | 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);}
} | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.