use of net.sourceforge.processdash.data.ImmutableDoubleData in project processdash by dtuma.
the class Indexof method call.
/**
* Perform a procedure call.
*
* This method <b>must</b> be thread-safe.
*/
public Object call(List arguments, ExpressionContext context) {
SimpleData item = getArg(arguments, 0);
List args = collapseLists(arguments, 1);
for (int i = 0; i < args.size(); i++) {
if (eq(item, asSimpleData(args.get(i))))
return new ImmutableDoubleData(i, false, true);
}
return NOT_FOUND;
}
use of net.sourceforge.processdash.data.ImmutableDoubleData in project processdash by dtuma.
the class DataImporterXMLv1 method initNumberMap.
private static Map initNumberMap() {
HashMap result = new HashMap();
for (int i = 0; i < 100; i++) {
ImmutableDoubleData num = new ImmutableDoubleData(i, false, true);
result.put(Integer.toString(i), num);
result.put(Integer.toString(i) + ".0", num);
}
return Collections.unmodifiableMap(result);
}
use of net.sourceforge.processdash.data.ImmutableDoubleData in project processdash by dtuma.
the class ExpandCollapseHierarchy method writeHeader.
protected void writeHeader() {
ImmutableDoubleData expand = ImmutableDoubleData.TRUE;
String elem = getParameter("expand");
if (elem == null) {
expand = ImmutableDoubleData.FALSE;
elem = getParameter("collapse");
}
if (elem != null)
getDataRepository().userPutValue(elem, expand);
String referer = (String) env.get("HTTP_REFERER");
// if there is a hash fragment on the referer url, remove it.
int pos = referer.lastIndexOf('#');
if (pos != -1)
referer = referer.substring(0, pos);
String dest;
pos = referer.lastIndexOf("expRel=");
if (pos != -1 && referer.indexOf('&', pos) == -1)
dest = referer.substring(0, pos) + "expRel=" + uniqueNumber++;
else
dest = referer + (referer.indexOf('?') == -1 ? "?" : "&") + "expRel=" + uniqueNumber++;
out.print("Location: " + dest + "#exp_" + elem.hashCode() + "\r\n\r\n");
}
use of net.sourceforge.processdash.data.ImmutableDoubleData in project processdash by dtuma.
the class Dblookupprojects method call.
/**
* Perform a procedure call.
*
* This method <b>must</b> be thread-safe.
*/
public Object call(List arguments, ExpressionContext context) {
// retrieve the list of IDs that we wish to look up, and the name of
// the data element we are looking them up for
List projectIDs = collapseLists(arguments, 0);
String listenerName = asStringVal(context.get(SubscribingExpressionContext.LISTENERVAR_NAME));
try {
ProjectLocator loc = getDbObject(context, ProjectLocator.class);
if (loc == null)
return null;
ListData result = new ListData();
for (Iterator i = projectIDs.iterator(); i.hasNext(); ) {
Integer key = null;
String oneProjectId = asStringVal(i.next());
if (oneProjectId != null)
key = loc.getKeyForProject(oneProjectId, listenerName);
if (key == null)
key = -999;
result.add(new ImmutableDoubleData(key, false, true));
}
return result;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
Aggregations