package leigh.mecha.nodegraph;

import leigh.eo.EOLoop;

import java.io.Serializable;

public class RowCountNode extends Node {
    public static final String ROWS_KEY = "rows";
    public static final String COUNT_KEY = "count";

    public RowCountNode(String id) {
        super(id);
        addOutput(COUNT_KEY, new UselessAttribute() {
            public Serializable getSingleValue(ProcessorState state) throws Exception {
                EOLoop l = getInputObjects(ROWS_KEY, state);
                return l == null ? 0 : l.size();
            }
        });
    }
}
