Computes the data to pass into the data join from component invocation arguments.
357293
function dataArray(data, context) {
  data = Array.isArray(data) ? data : [data];
  return context ? data.map(d => Object.assign(Object.create(context), d)) : data;
}
163921
def _compute(self):
        
        r = self
        for func, args, kwargs in self._todo:
            r = func(self)(*args, **kwargs)
        return r
959823
protected function calculateComponents(&$total, array &$data, array &$components)
    {
        foreach (array('shipping', 'payment') as $type) {
            if (isset($data['order'][$type]) && isset($data[$type . '_methods'][$data['order'][$type]]['price'])) {
                $price = $data[$type . '_methods'][$data['order'][$type]]['price'];
                $components[$type] = array('price' => $price);
                $total += $components[$type]['price'];
            }
        }
    }
239551
function performJoining (sourceData, joinSet, joinArgs) {
        var length = joinSet.length,
            i,
            rightKeyAccessors = [];

        joinArgs.rightKeyPropertyPaths.forEach(function (keyValue) {
            rightKeyAccessors.push(getKeyValueAccessorFromKey(keyValue));
        });

        for (i = 0; i < length; i += 1) {
            var rightRecord = joinSet[i],
                currentBin = joinArgs.keyHashBin;

            if (isNullOrUndefined(rightRecord)) {
                continue;//move onto the next, can't join on records that don't exist
            }

            //for each entry in the join set add it to the source document at the correct index
            rightKeyAccessors.forEach(function (accessor) {
                currentBin = currentBin[accessor(rightRecord)];
            });

            currentBin.forEach(function (sourceDataIndex) {
                var theObject = sourceData[sourceDataIndex][joinArgs.newKey];

                if (isNullOrUndefined(theObject)) {//Handle adding multiple matches to the same sub document
                    sourceData[sourceDataIndex][joinArgs.newKey] = rightRecord;
                } else if (Array.isArray(theObject)) {
                    theObject.push(rightRecord);
                } else {
                    sourceData[sourceDataIndex][joinArgs.newKey] = [theObject, rightRecord];
                }
            });
        }
    }
222088
def process(ctx, dataset, kwargs):
    ""

    kwargs = parse_kwargs(kwargs)
    data(dataset, **ctx.obj).process(**kwargs)
489835
private Multimap<String, PropertyDto> loadComponentSettings(DbSession dbSession, Optional<String> key, ComponentDto component) {
    List<String> componentUuids = DOT_SPLITTER.splitToList(component.moduleUuidPath());
    List<ComponentDto> componentDtos = dbClient.componentDao().selectByUuids(dbSession, componentUuids);
    Set<Long> componentIds = componentDtos.stream().map(ComponentDto::getId).collect(Collectors.toSet());
    Map<Long, String> uuidsById = componentDtos.stream().collect(Collectors.toMap(ComponentDto::getId, ComponentDto::uuid));
    List<PropertyDto> properties = key.isPresent() ? dbClient.propertiesDao().selectPropertiesByKeysAndComponentIds(dbSession, Collections.singleton(key.get()), componentIds)
      : dbClient.propertiesDao().selectPropertiesByComponentIds(dbSession, componentIds);

    Multimap<String, PropertyDto> propertyDtosByUuid = TreeMultimap.create(Ordering.explicit(componentUuids), Ordering.arbitrary());
    for (PropertyDto propertyDto : properties) {
      Long componentId = propertyDto.getResourceId();
      String componentUuid = uuidsById.get(componentId);
      propertyDtosByUuid.put(componentUuid, propertyDto);
    }
    return propertyDtosByUuid;
  }
450167
public void getDataSinks(List<SinkPlanNode> sinks) {
		final PlanNode in1 = this.input1.getSource();
		final PlanNode in2 = this.input2.getSource();
		
		if (in1 instanceof SinkPlanNode) {
			sinks.add((SinkPlanNode) in1);
		} else if (in1 instanceof SinkJoinerPlanNode) {
			((SinkJoinerPlanNode) in1).getDataSinks(sinks);
		} else {
			throw new CompilerException("Illegal child node for a sink joiner utility node: Neither Sink nor Sink Joiner");
		}
		
		if (in2 instanceof SinkPlanNode) {
			sinks.add((SinkPlanNode) in2);
		} else if (in2 instanceof SinkJoinerPlanNode) {
			((SinkJoinerPlanNode) in2).getDataSinks(sinks);
		} else {
			throw new CompilerException("Illegal child node for a sink joiner utility node: Neither Sink nor Sink Joiner");
		}
	}
168113
@Override
  public void aggregate()
  {
    final IndexedInts keys = keySelector.getRow();
    for (int i = 0; i < valueSelectors.length; i++) {
      values[i] = valueSelectors[i].getDouble();
    }
    synchronized (this) {
      for (int i = 0, keysSize = keys.size(); i < keysSize; i++) {
        final String key = keySelector.lookupName(keys.get(i));
        sketch.update(key, values);
      }
    }
  }
77907
@Override
    public void compute() {
        if (!Double.isNaN(getValue())) {
            // since the data cannot change, avoid re-doing the calculations
            return;
        }
        iniCompute();

        Map<U, List<Pair<I, Double>>> data = processDataAsRankedTestRelevance();
        userMAPAtCutoff = new HashMap<Integer, Map<U, Double>>();

        int nUsers = 0;
        for (Entry<U, List<Pair<I, Double>>> e : data.entrySet()) {
            U user = e.getKey();
            List<Pair<I, Double>> sortedList = e.getValue();
            // number of relevant items for this user
            double uRel = getNumberOfRelevantItems(user);
            double uMAP = 0.0;
            double uPrecision = 0.0;
            int rank = 0;
            for (Pair<I, Double> pair : sortedList) {
                double rel = pair.getSecond();
                rank++;
                double itemPrecision = computeBinaryPrecision(rel);
                uPrecision += itemPrecision;
                if (itemPrecision > 0) {
                    uMAP += uPrecision / rank;
                }
                // compute at a particular cutoff
                for (int at : getCutoffs()) {
                    if (rank == at) {
                        Map<U, Double> m = userMAPAtCutoff.get(at);
                        if (m == null) {
                            m = new HashMap<U, Double>();
                            userMAPAtCutoff.put(at, m);
                        }
                        m.put(user, uMAP / uRel);
                    }
                }
            }
            // normalize by number of relevant items
            uMAP /= uRel;
            // assign the MAP of the whole list to those cutoffs larger than the list's size
            for (int at : getCutoffs()) {
                if (rank <= at) {
                    Map<U, Double> m = userMAPAtCutoff.get(at);
                    if (m == null) {
                        m = new HashMap<U, Double>();
                        userMAPAtCutoff.put(at, m);
                    }
                    m.put(user, uMAP);
                }
            }
            if (!Double.isNaN(uMAP)) {
                setValue(getValue() + uMAP);
                getMetricPerUser().put(user, uMAP);
                nUsers++;
            }
        }
        setValue(getValue() / nUsers);
    }
795032
def execute(self, input_data):
        '''  '''

        # Aggregate the output from all the memory workers, clearly this could be kewler
        output = input_data['view_memory']
        output['tables'] = {}
        for data in [input_data[key] for key in ViewMemoryDeep.dependencies]:
            for name,table in data['tables'].iteritems():
                output['tables'].update({name: table})
        return output
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);
	}
1194230
protected double computeNNForRealData(final KNNQuery<NumberVector> knnQuery, Relation<NumberVector> relation, final int dim) {
    double w = 0.;
    ModifiableDBIDs dataSampleIds = DBIDUtil.randomSample(relation.getDBIDs(), sampleSize, random);
    for(DBIDIter iter = dataSampleIds.iter(); iter.valid(); iter.advance()) {
      final double kdist = knnQuery.getKNNForDBID(iter, k + 1).getKNNDistance();
      w += MathUtil.powi(kdist, dim);
    }
    return w;
  }
1185997
protected void recalculateData() {
        Node currentChild = this.getChild();
        if (currentChild != null) {
            ClusKernel currentData = this.getData();
            currentData.clear();
            Entry[] entries = currentChild.getEntries();
            for (int i = 0; i < entries.length; i++) {
                currentData.add(entries[i].getData());
            }
        } else {
            this.clear();
        }
    }
196264
final public void MapData() throws ParseException {
                          /*@bgen(jjtree) MapData */
  AstMapData jjtn000 = new AstMapData(JJTMAPDATA);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
    try {
      jj_consume_token(START_SET_OR_MAP);
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case START_SET_OR_MAP:
      case INTEGER_LITERAL:
      case FLOATING_POINT_LITERAL:
      case STRING_LITERAL:
      case TRUE:
      case FALSE:
      case NULL:
      case LPAREN:
      case LBRACK:
      case NOT0:
      case NOT1:
      case EMPTY:
      case MINUS:
      case IDENTIFIER:
        MapEntry();
        label_18:
        while (true) {
          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
          case COMMA:
            ;
            break;
          default:
            jj_la1[46] = jj_gen;
            break label_18;
          }
          jj_consume_token(COMMA);
          MapEntry();
        }
        break;
      default:
        jj_la1[47] = jj_gen;
        ;
      }
      jj_consume_token(RBRACE);
    } catch (Throwable jjte000) {
      if (jjtc000) {
        jjtree.clearNodeScope(jjtn000);
        jjtc000 = false;
      } else {
        jjtree.popNode();
      }
      if (jjte000 instanceof RuntimeException) {
        {if (true) throw (RuntimeException)jjte000;}
      }
      if (jjte000 instanceof ParseException) {
        {if (true) throw (ParseException)jjte000;}
      }
      {if (true) throw (Error)jjte000;}
    } finally {
      if (jjtc000) {
        jjtree.closeNodeScope(jjtn000, true);
      }
    }
  }
1055101
public void declareInternalData(int maxRows, int maxCols) {
        this.maxRows = maxRows;
        this.maxCols = maxCols;

        U_tran = new DMatrixRMaj(maxRows,maxRows);
        Qm = new DMatrixRMaj(maxRows,maxRows);

        r_row = new double[ maxCols ];
    }
625659
private static void processNewTraceComponents() {
        if (allTraceComponentsLock.tryLock()) {
            try {
                TraceComponent tc = newTracecomponents.poll();
                while (tc != null) {
                    allTraceComponents.add(tc);
                    tc = newTracecomponents.poll();
                }
            } finally {
                allTraceComponentsLock.unlock();
            }
        }
    }
1171813
void computeColumnSpans() {
        for (int index = 0; index < _generatedMappings().size(); ++index) {
            ParsedMapping mapping = _generatedMappings().get(index);

            // Mappings do not contain a field for the last generated columnt. We
            // can come up with an optimistic estimate, however, by assuming that
            // mappings are contiguous (i.e. given two consecutive mappings, the
            // first mapping ends where the second one starts).
            if (index + 1 < _generatedMappings().size()) {
                ParsedMapping nextMapping = _generatedMappings().get(index + 1);

                if (mapping.generatedLine == nextMapping.generatedLine) {
                    mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1;
                    continue;
                }
            }

            // The last mapping for each line spans the entire line.
            mapping.lastGeneratedColumn = Integer.MAX_VALUE;
        }
    }