Ejemplo n.º 1
0
    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);
    }
Ejemplo n.º 2
0
 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);
 }
Ejemplo n.º 3
0
 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);
 }