Create and return a new {@link AggGroupSet} that belongs to this AggregateResult.

@return  A new {@link AggGroupSet} that belongs to this AggregateResult.
336698
public AggGroupSet addGroupSet() {
        AggGroupSet aggGroupSet = new AggGroupSet();
        if (m_groupSetList == null) {
            m_groupSetList = new ArrayList<AggGroupSet>();
        }
        m_groupSetList.add(aggGroupSet);
        return aggGroupSet;
    }
823010
protected CmsGroup internalCreateGroup(ResultSet res) throws SQLException {

        String ou = CmsOrganizationalUnit.removeLeadingSeparator(
            res.getString(m_sqlManager.readQuery("C_GROUPS_GROUP_OU_0")));
        String description = res.getString(m_sqlManager.readQuery("C_GROUPS_GROUP_DESCRIPTION_0"));
        return new CmsGroup(
            new CmsUUID(res.getString(m_sqlManager.readQuery("C_GROUPS_GROUP_ID_0"))),
            new CmsUUID(res.getString(m_sqlManager.readQuery("C_GROUPS_PARENT_GROUP_ID_0"))),
            ou + res.getString(m_sqlManager.readQuery("C_GROUPS_GROUP_NAME_0")),
            description,
            res.getInt(m_sqlManager.readQuery("C_GROUPS_GROUP_FLAGS_0")));
    }
57555
@NonNull
  public static <E> ImmutableSet<E> appendSet(@NonNull ImmutableSet<E> set, @NonNull E newValue) {
    return ImmutableSet.<E>builder().addAll(set).add(newValue).build();
  }
184570
@Override
	public DataSet<Tuple2<VertexKey, VertexValue>> createResult() {
		if (this.initialVertices == null) {
			throw new IllegalStateException("The input data set has not been set.");
		}
		
		// prepare some type information
		TypeInformation<Tuple2<VertexKey, VertexValue>> vertexTypes = initialVertices.getType();
		TypeInformation<VertexKey> keyType = ((TupleTypeInfo<?>) initialVertices.getType()).getTypeAt(0);
		TypeInformation<Tuple2<VertexKey, Message>> messageTypeInfo = new TupleTypeInfo<Tuple2<VertexKey,Message>>(keyType, messageType);		
		
		// set up the iteration operator
		final String name = (this.name != null) ? this.name :
			"Vertex-centric iteration (" + updateFunction + " | " + messagingFunction + ")";
		final int[] zeroKeyPos = new int[] {0};
	
		final DeltaIteration<Tuple2<VertexKey, VertexValue>, Tuple2<VertexKey, VertexValue>> iteration =
			this.initialVertices.iterateDelta(this.initialVertices, this.maximumNumberOfIterations, zeroKeyPos);
		iteration.name(name);
		iteration.parallelism(parallelism);
		
		// register all aggregators
		for (Map.Entry<String, Class<? extends Aggregator<?>>> entry : this.aggregators.entrySet()) {
			iteration.registerAggregator(entry.getKey(), entry.getValue());
		}
		
		// build the messaging function (co group)
		CoGroupOperator<?, ?, Tuple2<VertexKey, Message>> messages;
		if (edgesWithoutValue != null) {
			MessagingUdfNoEdgeValues<VertexKey, VertexValue, Message> messenger = new MessagingUdfNoEdgeValues<VertexKey, VertexValue, Message>(messagingFunction, messageTypeInfo);
			messages = this.edgesWithoutValue.coGroup(iteration.getWorkset()).where(0).equalTo(0).with(messenger);
		}
		else {
			MessagingUdfWithEdgeValues<VertexKey, VertexValue, Message, EdgeValue> messenger = new MessagingUdfWithEdgeValues<VertexKey, VertexValue, Message, EdgeValue>(messagingFunction, messageTypeInfo);
			messages = this.edgesWithValue.coGroup(iteration.getWorkset()).where(0).equalTo(0).with(messenger);
		}
		
		// configure coGroup message function with name and broadcast variables
		messages = messages.name("Messaging");
		for (Tuple2<String, DataSet<?>> e : this.bcVarsMessaging) {
			messages = messages.withBroadcastSet(e.f1, e.f0);
		}
		
		VertexUpdateUdf<VertexKey, VertexValue, Message> updateUdf = new VertexUpdateUdf<VertexKey, VertexValue, Message>(updateFunction, vertexTypes);
		
		// build the update function (co group)
		CoGroupOperator<?, ?, Tuple2<VertexKey, VertexValue>> updates =
				messages.coGroup(iteration.getSolutionSet()).where(0).equalTo(0).with(updateUdf);
		
		// configure coGroup update function with name and broadcast variables
		updates = updates.name("Vertex State Updates");
		for (Tuple2<String, DataSet<?>> e : this.bcVarsUpdate) {
			updates = updates.withBroadcastSet(e.f1, e.f0);
		}

		// let the operator know that we preserve the key field
		updates.withConstantSetFirst("0").withConstantSetSecond("0");
		
		return iteration.closeWith(updates, updates);
		
	}
489411
@Override
	public DataSet<Vertex<K, VV>> createResult() {
		if (vertexDataSet == null) {
			throw new IllegalStateException("The input data set has not been set.");
		}

		// Prepare type information
		TypeInformation<K> keyType = ((TupleTypeInfo<?>) vertexDataSet.getType()).getTypeAt(0);
		TypeInformation<M> messageType = TypeExtractor.createTypeInfo(gather, GatherFunction.class, gather.getClass(), 2);
		TypeInformation<Tuple2<K, M>> innerType = new TupleTypeInfo<>(keyType, messageType);
		TypeInformation<Vertex<K, VV>> outputType = vertexDataSet.getType();

		// check whether the numVertices option is set and, if so, compute the total number of vertices
		// and set it within the gather, sum and apply functions

		DataSet<LongValue> numberOfVertices = null;
		if (this.configuration != null && this.configuration.isOptNumVertices()) {
			try {
				numberOfVertices = GraphUtils.count(this.vertexDataSet);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}

		// Prepare UDFs
		GatherUdf<K, VV, EV, M> gatherUdf = new GatherUdf<>(gather, innerType);
		SumUdf<K, VV, EV, M> sumUdf = new SumUdf<>(sum, innerType);
		ApplyUdf<K, VV, EV, M> applyUdf = new ApplyUdf<>(apply, outputType);

		final int[] zeroKeyPos = new int[] {0};
		final DeltaIteration<Vertex<K, VV>, Vertex<K, VV>> iteration =
				vertexDataSet.iterateDelta(vertexDataSet, maximumNumberOfIterations, zeroKeyPos);

		// set up the iteration operator
		if (this.configuration != null) {

			iteration.name(this.configuration.getName(
					"Gather-sum-apply iteration (" + gather + " | " + sum + " | " + apply + ")"));
			iteration.parallelism(this.configuration.getParallelism());
			iteration.setSolutionSetUnManaged(this.configuration.isSolutionSetUnmanagedMemory());

			// register all aggregators
			for (Map.Entry<String, Aggregator<?>> entry : this.configuration.getAggregators().entrySet()) {
				iteration.registerAggregator(entry.getKey(), entry.getValue());
			}
		}
		else {
			// no configuration provided; set default name
			iteration.name("Gather-sum-apply iteration (" + gather + " | " + sum + " | " + apply + ")");
		}

		// Prepare the neighbors
		if (this.configuration != null) {
			direction = this.configuration.getDirection();
		}
		DataSet<Tuple2<K, Neighbor<VV, EV>>> neighbors;
		switch(direction) {
			case OUT:
				neighbors = iteration
				.getWorkset().join(edgeDataSet)
				.where(0).equalTo(0).with(new ProjectKeyWithNeighborOUT<>());
				break;
			case IN:
				neighbors = iteration
				.getWorkset().join(edgeDataSet)
				.where(0).equalTo(1).with(new ProjectKeyWithNeighborIN<>());
				break;
			case ALL:
				neighbors =  iteration
						.getWorkset().join(edgeDataSet)
						.where(0).equalTo(0).with(new ProjectKeyWithNeighborOUT<>()).union(iteration
								.getWorkset().join(edgeDataSet)
								.where(0).equalTo(1).with(new ProjectKeyWithNeighborIN<>()));
				break;
			default:
				neighbors = iteration
						.getWorkset().join(edgeDataSet)
						.where(0).equalTo(0).with(new ProjectKeyWithNeighborOUT<>());
				break;
		}

		// Gather, sum and apply
		MapOperator<Tuple2<K, Neighbor<VV, EV>>, Tuple2<K, M>> gatherMapOperator = neighbors.map(gatherUdf);

		// configure map gather function with name and broadcast variables
		gatherMapOperator = gatherMapOperator.name("Gather");

		if (this.configuration != null) {
			for (Tuple2<String, DataSet<?>> e : this.configuration.getGatherBcastVars()) {
				gatherMapOperator = gatherMapOperator.withBroadcastSet(e.f1, e.f0);
			}
			if (this.configuration.isOptNumVertices()) {
				gatherMapOperator = gatherMapOperator.withBroadcastSet(numberOfVertices, "number of vertices");
			}
		}
		DataSet<Tuple2<K, M>> gatheredSet = gatherMapOperator;

		ReduceOperator<Tuple2<K, M>> sumReduceOperator = gatheredSet.groupBy(0).reduce(sumUdf);

		// configure reduce sum function with name and broadcast variables
		sumReduceOperator = sumReduceOperator.name("Sum");

		if (this.configuration != null) {
			for (Tuple2<String, DataSet<?>> e : this.configuration.getSumBcastVars()) {
				sumReduceOperator = sumReduceOperator.withBroadcastSet(e.f1, e.f0);
			}
			if (this.configuration.isOptNumVertices()) {
				sumReduceOperator = sumReduceOperator.withBroadcastSet(numberOfVertices, "number of vertices");
			}
		}
		DataSet<Tuple2<K, M>> summedSet = sumReduceOperator;

		JoinOperator<?, ?, Vertex<K, VV>> appliedSet = summedSet
				.join(iteration.getSolutionSet())
				.where(0)
				.equalTo(0)
				.with(applyUdf);

		// configure join apply function with name and broadcast variables
		appliedSet = appliedSet.name("Apply");

		if (this.configuration != null) {
			for (Tuple2<String, DataSet<?>> e : this.configuration.getApplyBcastVars()) {
				appliedSet = appliedSet.withBroadcastSet(e.f1, e.f0);
			}
			if (this.configuration.isOptNumVertices()) {
				appliedSet = appliedSet.withBroadcastSet(numberOfVertices, "number of vertices");
			}
		}

		// let the operator know that we preserve the key field
		appliedSet.withForwardedFieldsFirst("0").withForwardedFieldsSecond("0");

		return iteration.closeWith(appliedSet, appliedSet);
	}
40838
private IntervalCategoryDataset createDataset() {
		TaskSeries ts = null;
		TaskSeriesCollection collection = new TaskSeriesCollection();
		if ( solver.getVariables().length == 0) {
			return collection;
		}

		ts = new TaskSeries("All");

		for (int i = 0; i < solver.getVariables().length ; i++) {
						
			String label = solver.getVariables()[i].getComponent(); //dn.getNodes().elementAt(i).getLabel();
			
			if ( this.selectedVariables == null || this.selectedVariables.contains( label ) ) {
			
				SymbolicTimeline tl1 = new SymbolicTimeline(solver,label);
	
				for (int j = 0 ; j < tl1.getPulses().length-1 ; j++  ) {
					
					if ( tl1.getValues()[j] != null ) {
						long startTime = tl1.getPulses()[j].longValue();
						long endTime =   startTime + tl1.getDurations()[j].longValue();					
						
						Date startTask = new Date(startTime);
						Date endTask = new Date(endTime);
						Task task;
						
						String value = tl1.getValues()[j].toString().replace("[", "").replace("]", "");
						if ( value.equals("true") )
							task = new Task(label, startTask, endTask);
						else
							task = new Task(label + " := " + value, startTask, endTask);
								
					
						ts.add(task);	
					}
				}
			}
		}
		
		collection.add(ts);

		return collection;
	}
1072386
protected <A extends AggregateRoot<?>> A createFromFactory(Class<A> aggregateClass, Object... parameters) {
        checkNotNull(aggregateClass);
        checkNotNull(parameters);

        Factory<A> factory = domainRegistry.getFactory(aggregateClass);

        // Find the method in the factory which match the signature determined with the previously
        // extracted parameters
        Method factoryMethod;
        boolean useDefaultFactory = false;
        try {
            factoryMethod = MethodMatcher.findMatchingMethod(factory.getClass(), aggregateClass, parameters);
            if (factoryMethod == null) {
                useDefaultFactory = true;
            }
        } catch (Exception e) {
            throw BusinessException.wrap(e, BusinessErrorCode.UNABLE_TO_FIND_FACTORY_METHOD)
                    .put("aggregateClass", aggregateClass.getName())
                    .put("parameters", Arrays.toString(parameters));
        }

        // Invoke the factory to create the aggregate root
        try {
            if (useDefaultFactory) {
                return factory.create(parameters);
            } else {
                if (parameters.length == 0) {
                    return ReflectUtils.invoke(factoryMethod, factory);
                } else {
                    return ReflectUtils.invoke(factoryMethod, factory, parameters);
                }
            }
        } catch (Exception e) {
            throw BusinessException.wrap(e, BusinessErrorCode.UNABLE_TO_INVOKE_FACTORY_METHOD)
                    .put("aggregateClass", aggregateClass.getName())
                    .put("factoryClass", factory.getClass()
                            .getName())
                    .put("factoryMethod", Optional.ofNullable(factoryMethod)
                            .map(Method::getName)
                            .orElse("create"))
                    .put("parameters", Arrays.toString(parameters));
        }
    }
1101918
protected final Set<AggregatedGroupMapping> collectAllGroupsFromParams(
            Set<K> keys, AggregatedGroupMapping[] aggregatedGroupMappings) {
        final Builder<AggregatedGroupMapping> groupsBuilder =
                ImmutableSet.<AggregatedGroupMapping>builder();
        // Add all groups from the keyset
        for (K aggregationKey : keys) {
            groupsBuilder.add(aggregationKey.getAggregatedGroup());
        }
        // Add groups from parameters
        groupsBuilder.add(aggregatedGroupMappings);
        return groupsBuilder.build();
    }
49211
protected JSKeyGroup createConsumerKeyGroup(JSConsumerSet consumerSet)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "createConsumerKeyGroup", consumerSet);

    JSKeyGroup ckg = new RemoteQPConsumerKeyGroup(this);

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "createConsumerKeyGroup", ckg);

    return ckg;
  }
1058563
public CreateClusterRequest withInstanceGroup(InstanceGroupConfig instanceGroup) {
        if (this.instanceGroups == null) {
            this.instanceGroups = new ArrayList<InstanceGroupConfig>();
        }
        this.instanceGroups.add(instanceGroup);
        return this;
    }
1115253
@VisibleForTesting
  static MutableAggregation createMutableAggregation(
      Aggregation aggregation, final Measure measure) {
    return aggregation.match(
        new Function<Sum, MutableAggregation>() {
          @Override
          public MutableAggregation apply(Sum arg) {
            return measure.match(
                CreateMutableSumDouble.INSTANCE,
                CreateMutableSumLong.INSTANCE,
                Functions.<MutableAggregation>throwAssertionError());
          }
        },
        CreateMutableCount.INSTANCE,
        CreateMutableDistribution.INSTANCE,
        new Function<LastValue, MutableAggregation>() {
          @Override
          public MutableAggregation apply(LastValue arg) {
            return measure.match(
                CreateMutableLastValueDouble.INSTANCE,
                CreateMutableLastValueLong.INSTANCE,
                Functions.<MutableAggregation>throwAssertionError());
          }
        },
        AggregationDefaultFunction.INSTANCE);
  }
411481
@NonNull
  public static CreateAggregateStart createAggregate(
      @Nullable CqlIdentifier keyspace, @NonNull CqlIdentifier aggregateName) {
    return new DefaultCreateAggregate(keyspace, aggregateName);
  }
589626
@Override
    public Set<Map.Entry<K, V>> entrySet() {
        return new AbstractSet<Map.Entry<K, V>>() {
            @Override
            public Iterator<Map.Entry<K, V>> iterator() {
                return new ObjIterator<Map.Entry<K, V>>() {
                    private final Iterator<Map.Entry<K, V>> keyValueEntryIter = keyMap.entrySet().iterator();

                    @Override
                    public boolean hasNext() {
                        return keyValueEntryIter.hasNext();
                    }

                    @Override
                    public Map.Entry<K, V> next() {
                        final Map.Entry<K, V> entry = keyValueEntryIter.next();

                        return new Map.Entry<K, V>() {
                            @Override
                            public K getKey() {
                                return entry.getKey();
                            }

                            @Override
                            public V getValue() {
                                return entry.getValue();
                            }

                            @Override
                            public V setValue(V value) {
                                //    if (N.equals(entry.getValue(), value)) {
                                //        return entry.getValue();
                                //    }
                                //
                                //    //    if (valueMap.containsKey(value)) {
                                //    //        throw new IllegalStateException("Value: " + N.toString(value) + " already existed.");
                                //    //    }
                                //
                                //    valueMap.remove(entry.getValue());
                                //    valueMap.put(value, entry.getKey());
                                //    return entry.setValue(value);

                                throw new UnsupportedOperationException();
                            }
                        };
                    }
                };
            }

            @Override
            public int size() {
                return keyMap.size();
            }
        };
    }
365112
public FastReportBuilder addGroups(int numgroups) {
		groupCount = numgroups;
		for (int i = 0; i < groupCount; i++) {
			GroupBuilder gb = new GroupBuilder();
			PropertyColumn col = (PropertyColumn) report.getColumns().get(i);
			gb.setCriteriaColumn(col);
			report.getColumnsGroups().add(gb.build());
		}
		return this;
	}
889194
public GroupsType<ConstraintType<T>> getOrCreateGroups()
   {
      Node node = childNode.getOrCreate("groups");
      GroupsType<ConstraintType<T>> groups = new GroupsTypeImpl<ConstraintType<T>>(this, "groups", childNode, node);
      return groups;
   }
161188
public static <T> HashSet<T> newHashSet(boolean isSorted, Collection<T> collection) {
		return isSorted ? new LinkedHashSet<T>(collection) : new HashSet<T>(collection);
	}
54980
public static <T, C extends Collection<T>> Reducer<T, C> getAggregatingReducer(
      Supplier<C> supplier) {
    return new AggregatingReducer<T, C>(supplier);
  }