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;
}
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;
}
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;
}
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;
}
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);
}
Aggregations