Search in sources :

Example 1 with ImmutableDoubleData

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;
}
Also used : SimpleData(net.sourceforge.processdash.data.SimpleData) List(java.util.List) ImmutableDoubleData(net.sourceforge.processdash.data.ImmutableDoubleData)

Example 2 with ImmutableDoubleData

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);
}
Also used : HashMap(java.util.HashMap) ImmutableDoubleData(net.sourceforge.processdash.data.ImmutableDoubleData)

Example 3 with ImmutableDoubleData

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");
}
Also used : ImmutableDoubleData(net.sourceforge.processdash.data.ImmutableDoubleData)

Example 4 with ImmutableDoubleData

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;
    }
}
Also used : ProjectLocator(net.sourceforge.processdash.tool.db.ProjectLocator) Iterator(java.util.Iterator) List(java.util.List) ImmutableDoubleData(net.sourceforge.processdash.data.ImmutableDoubleData) ListData(net.sourceforge.processdash.data.ListData)

Aggregations

ImmutableDoubleData (net.sourceforge.processdash.data.ImmutableDoubleData)4 List (java.util.List)2 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 ListData (net.sourceforge.processdash.data.ListData)1 SimpleData (net.sourceforge.processdash.data.SimpleData)1 ProjectLocator (net.sourceforge.processdash.tool.db.ProjectLocator)1