Search in sources :

Example 1 with ListData

use of net.sourceforge.processdash.data.ListData in project processdash by dtuma.

the class Setunion method call.

/** Perform a procedure call.
     *
     * This method <b>must</b> be thread-safe.
     */
public Object call(java.util.List arguments, ExpressionContext context) {
    ListData result = new ListData();
    Iterator i = new HashSet(collapseLists(arguments, 0)).iterator();
    while (i.hasNext()) result.add(i.next());
    return result;
}
Also used : Iterator(java.util.Iterator) ListData(net.sourceforge.processdash.data.ListData) HashSet(java.util.HashSet)

Example 2 with ListData

use of net.sourceforge.processdash.data.ListData in project processdash by dtuma.

the class Sort method call.

/** Perform a procedure call.
     *
     * This method <b>must</b> be thread-safe.
     */
public Object call(List arguments, ExpressionContext context) {
    String name = asString(getArg(arguments, 0));
    if (name == null)
        return null;
    List pairs = new ArrayList();
    Iterator i = collapseLists(arguments, 1).iterator();
    String path, dataName;
    while (i.hasNext()) {
        path = asStringVal(i.next());
        if (path == null)
            continue;
        dataName = DataRepository.createDataName(path, name);
        pairs.add(new Pair(path, context.get(dataName)));
    }
    Object[] pairArray = pairs.toArray();
    Arrays.sort(pairArray);
    ListData result = new ListData();
    for (int j = 0; j < pairArray.length; j++) result.add(((Pair) pairArray[j]).prefix);
    result.setImmutable();
    return result;
}
Also used : ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) List(java.util.List) ArrayList(java.util.ArrayList) ListData(net.sourceforge.processdash.data.ListData)

Example 3 with ListData

use of net.sourceforge.processdash.data.ListData in project processdash by dtuma.

the class Sublist method call.

/** Perform a procedure call.
     *
     * This method <b>must</b> be thread-safe.
     */
public Object call(List arguments, ExpressionContext context) {
    int start = (int) asDouble(getArg(arguments, 0));
    int end = (int) asDouble(getArg(arguments, 1));
    List args = collapseLists(arguments, 2);
    if (start < 0)
        start = 0;
    if (end < 0 || end > args.size())
        end = args.size();
    ListData result = new ListData();
    if (start < end) {
        Iterator i = args.subList(start, end).iterator();
        while (i.hasNext()) result.add(i.next());
    }
    return result;
}
Also used : Iterator(java.util.Iterator) List(java.util.List) ListData(net.sourceforge.processdash.data.ListData)

Example 4 with ListData

use of net.sourceforge.processdash.data.ListData in project processdash by dtuma.

the class Indivautolabelsdeferred method call.

/**
     * Arguments: one string, providing the name of another data element
     * (relative to this one) that contains the actual results of the
     * Indivautolabels calculation.
     */
@Override
public Object call(List arguments, ExpressionContext context) {
    String name = asString(getArg(arguments, 0));
    String targetDataName = context.resolveName(name);
    ListData result = new ListData();
    for (String label : Indivautolabels.AUTO_LABEL_NAMES) {
        result.add(TaskLabeler.LABEL_PREFIX + label);
        result.add(TaskLabeler.LABEL_HIDDEN_MARKER);
        result.add(DEFERRED_DATA_MARKER);
        result.add(DEFERRED_TOKEN_PREFIX + targetDataName);
    }
    return result;
}
Also used : ListData(net.sourceforge.processdash.data.ListData)

Example 5 with ListData

use of net.sourceforge.processdash.data.ListData in project processdash by dtuma.

the class Intersects method call.

public Object call(List arguments, ExpressionContext context) {
    if (arguments.size() == 0)
        return getResult(Collections.EMPTY_SET);
    Iterator i = arguments.iterator();
    Set intersection;
    ListData firstItem = asList((SimpleData) i.next());
    if (firstItem == null)
        intersection = Collections.EMPTY_SET;
    else
        intersection = new HashSet(firstItem.asList());
    while (!intersection.isEmpty() && i.hasNext()) {
        ListData nextItem = asList((SimpleData) i.next());
        if (nextItem == null)
            intersection = Collections.EMPTY_SET;
        else
            intersection.retainAll(nextItem.asList());
    }
    return getResult(intersection);
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) Iterator(java.util.Iterator) ListData(net.sourceforge.processdash.data.ListData) HashSet(java.util.HashSet)

Aggregations

ListData (net.sourceforge.processdash.data.ListData)129 SimpleData (net.sourceforge.processdash.data.SimpleData)20 ArrayList (java.util.ArrayList)18 List (java.util.List)16 Iterator (java.util.Iterator)15 StringData (net.sourceforge.processdash.data.StringData)15 EVTaskListData (net.sourceforge.processdash.ev.EVTaskListData)9 Map (java.util.Map)8 HashSet (java.util.HashSet)7 DashHierarchy (net.sourceforge.processdash.hier.DashHierarchy)6 IOException (java.io.IOException)5 HashMap (java.util.HashMap)5 LinkedList (java.util.LinkedList)5 DoubleData (net.sourceforge.processdash.data.DoubleData)5 PropertyKey (net.sourceforge.processdash.hier.PropertyKey)5 LocalizedString (net.sourceforge.processdash.util.LocalizedString)5 NodeList (org.w3c.dom.NodeList)5 Date (java.util.Date)4 EVTaskList (net.sourceforge.processdash.ev.EVTaskList)4 Element (org.w3c.dom.Element)4