public OperationOutputFactory(Factory parent, Fields selfFields) { _parent = parent; _fieldIndex = new HashMap(parent.getFieldIndex()); int myIndex = parent.numDelegates(); for (int i = 0; i < selfFields.size(); i++) { String field = selfFields.get(i); _fieldIndex.put(field, new ValuePointer(myIndex, i, field)); } List<String> myOrder = new ArrayList<String>(parent.getOutputFields()); Set<String> parentFieldsSet = new HashSet<String>(myOrder); for (String f : selfFields) { if (parentFieldsSet.contains(f)) { throw new IllegalArgumentException( "Additive operations cannot add fields with same name as already exists. " + "Tried adding " + selfFields + " to " + parent.getOutputFields()); } myOrder.add(f); } _index = ValuePointer.buildIndex(new Fields(myOrder), _fieldIndex); }
public FreshOutputFactory(Fields selfFields) { _fieldIndex = new HashMap<String, ValuePointer>(); for (int i = 0; i < selfFields.size(); i++) { String field = selfFields.get(i); _fieldIndex.put(field, new ValuePointer(0, i, field)); } _index = ValuePointer.buildIndex(selfFields, _fieldIndex); }
public ProjectionFactory(Factory parent, Fields projectFields) { _parent = parent; if (projectFields == null) projectFields = new Fields(); Map<String, ValuePointer> parentFieldIndex = parent.getFieldIndex(); _fieldIndex = new HashMap<String, ValuePointer>(); for (String f : projectFields) { _fieldIndex.put(f, parentFieldIndex.get(f)); } _index = ValuePointer.buildIndex(projectFields, _fieldIndex); }