Convert from the Spring Credhub service data structure to the Spring Cloud
Connectors data structure.

@param interpolatedData the Spring CredHub data structure
@return the equivalent Spring Cloud Connectors data structure
769357
private CloudFoundryRawServiceData credHubToConnectors(
			ServicesData interpolatedData) {
		CloudFoundryRawServiceData rawServicesData = new CloudFoundryRawServiceData();
		rawServicesData.putAll(interpolatedData);
		return rawServicesData;
	}
137208
public static LofDataSet mergeDataSet(LofDataSet baseDataSet, LofDataSet targetDataSet, int max)
    {
        Collection<LofPoint> basePointList = baseDataSet.getDataMap().values();
        Collection<LofPoint> targetPointList = targetDataSet.getDataMap().values();

        // LOFの対象点を時刻でソートしたリストを生成する。
        List<LofPoint> mergedList = new ArrayList<>();
        mergedList.addAll(basePointList);
        mergedList.addAll(targetPointList);
        Collections.sort(mergedList, new LofPointComparator());

        // ソート後、新しい方から扱うため順番を逆にする。
        Collections.reverse(mergedList);

        // 新しいデータから順にマージ後のモデルに反映する。
        // 但し、お互いに非同期でマージが行われるため同様のIDを持つデータが複数存在するケースがある。
        // そのため、IDを比較してそれまでに取得していないデータの追加のみを行う。
        Set<String> registeredId = new HashSet<>();
        int addedCount = 0;
        LofDataSet resultDataSet = new LofDataSet();

        for (LofPoint targetPoint : mergedList)
        {
            if (registeredId.contains(targetPoint.getDataId()) == true)
            {
                continue;
            }

            registeredId.add(targetPoint.getDataId());
            resultDataSet.addData(targetPoint);
            addedCount++;

            if (addedCount >= max)
            {
                break;
            }
        }

        return resultDataSet;
    }
553082
@Override
    public void persistJoinTable(JoinTableData joinTableData)
    {
        String joinTableName = joinTableData.getJoinTableName();
        String joinColumnName = joinTableData.getJoinColumnName();
        String invJoinColumnName = joinTableData.getInverseJoinColumnName();
        Map<Object, Set<Object>> joinTableRecords = joinTableData.getJoinTableRecords();

        for (Object key : joinTableRecords.keySet())
        {
            Set<Object> values = joinTableRecords.get(key);
            Object joinColumnValue = key;

            for (Object childId : values)
            {
                Map<String, Object> obj = new HashMap<String, Object>();
                String id = joinTableName + "#" + joinColumnValue.toString() + "#" + childId;
                obj.put("_id", id);
                obj.put(joinColumnName, joinColumnValue);
                obj.put(invJoinColumnName, childId);
                JsonObject object = gson.toJsonTree(obj).getAsJsonObject();
                HttpResponse response = null;
                try
                {
                    URI uri = new URI(CouchDBConstants.PROTOCOL, null, httpHost.getHostName(), httpHost.getPort(),
                            CouchDBConstants.URL_SEPARATOR + joinTableData.getSchemaName().toLowerCase()
                                    + CouchDBConstants.URL_SEPARATOR + id, null, null);

                    HttpPut put = new HttpPut(uri);
                    StringEntity stringEntity = null;
                    stringEntity = new StringEntity(object.toString(), Constants.CHARSET_UTF8);
                    stringEntity.setContentType("application/json");
                    put.setEntity(stringEntity);

                    response = httpClient.execute(httpHost, put, CouchDBUtils.getContext(httpHost));
                }
                catch (Exception e)
                {
                    log.error("Error while persisting joinTable data, coused by {}.", e);
                    throw new KunderaException(e);
                }
                finally
                {
                    closeContent(response);
                }
            }
        }
    }
886688
public void persistJoinTable(JoinTableData joinTableData)
    {
        Mutator mutator = clientFactory.getMutator(pool);

        String joinTableName = joinTableData.getJoinTableName();
        String invJoinColumnName = joinTableData.getInverseJoinColumnName();
        Map<Object, Set<Object>> joinTableRecords = joinTableData.getJoinTableRecords();
        EntityMetadata entityMetadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata,
                joinTableData.getEntityClass());

        if (isCql3Enabled(entityMetadata))
        {
            Cassandra.Client conn = null;
            Object pooledConnection = null;
            pooledConnection = getConnection();
            conn = (org.apache.cassandra.thrift.Cassandra.Client) getConnection(pooledConnection);
            persistJoinTableByCql(joinTableData, conn);
        }
        else
        {
            for (Object key : joinTableRecords.keySet())
            {
                Set<Object> values = joinTableRecords.get(key);

                List<Column> columns = new ArrayList<Column>();

                Class columnType = null;
                for (Object value : values)
                {
                    Column column = new Column();
                    column.setName(PropertyAccessorFactory.STRING.toBytes(invJoinColumnName
                            + Constants.JOIN_COLUMN_NAME_SEPARATOR + value.toString()));
                    column.setValue(PropertyAccessorHelper.getBytes(value));
                    column.setTimestamp(generator.getTimestamp());
                    columnType = value.getClass();
                    columns.add(column);
                }

                createIndexesOnColumns(entityMetadata, joinTableName, columns, columnType);

                mutator.writeColumns(joinTableName, Bytes.fromByteArray(PropertyAccessorHelper.getBytes(key)),
                        Arrays.asList(columns.toArray(new Column[0])));
            }
        }
        if (log.isInfoEnabled())
        {
            log.info(" Persisted data with join table column family {}", joinTableData.getJoinTableName());
        }
        mutator.execute(getConsistencyLevel());
    }
469689
static final Map<String, Object> previousAndCurrentToDelta(List<Map<String, Object>> data) {
        if (data.size() == 2) {
            Map<String, Object> previous = data.get(0);
            Map<String, Object> current = data.get(1);
            return previousAndCurrentToDelta(previous, current);
        } else {
            throw new IllegalArgumentException("Must be list of 2 items");
        }

    }
92401
public static double width_interpolate( double[][] data, double x, int nx, int ny ) {

        int rows = data.length;
        double xuno = 0, xdue = 0, yuno = 0, ydue = 0, y = 0;

        // if 0, interpolate between 0 and the first value of data
        if (x >= 0 && x < data[0][nx]) {
            xuno = 0;
            xdue = data[0][nx];
            yuno = 0;
            ydue = data[0][ny];
            y = ((ydue - yuno) / (xdue - xuno)) * (x - xuno) + yuno;
        }

        // if it is less than 0 and bigger than the maximum, throw error
        if (x > data[(rows - 1)][nx] || x < 0) {
            throw new RuntimeException(MessageFormat.format(
                    "Error in the interpolation algorithm: entering with x = {0} (min = 0.0 max = {1}", x, data[(rows - 1)][nx]));
        }

        /* trovo i valori limite entro i quali effettuo l'interpolazione lineare */
        for( int i = 0; i < rows - 1; i++ ) {

            if (x > data[i][nx] && x <= data[(i + 1)][nx]) {
                xuno = data[i][nx];
                xdue = data[(i + 1)][nx];
                yuno = data[i][ny];
                ydue = data[(i + 1)][ny];
                y = ((ydue - yuno) / (xdue - xuno)) * (x - xuno) + yuno;

            }
        }

        return y;
    }
377164
@Override
    protected LofDataSet mergeState(LofDataSet baseDataSet, LofDataSet targetDataSet,
            Map<String, Object> mergeConfig)
    {
        int kn = Integer.parseInt(mergeConfig.get(LofConfKey.KN).toString());
        int maxDataCount = Integer.parseInt(mergeConfig.get(LofConfKey.MAX_DATA_COUNT).toString());

        // 学習データの保持する対象点を新しい方から最大保持数個だけ取得
        LofDataSet mergedDataSet = LofCalculator.mergeDataSet(baseDataSet, targetDataSet,
                maxDataCount);

        // 中間データ保持設定が存在しない場合は中間データの生成は行わない。
        if (mergeConfig.containsKey(LofConfKey.HAS_INTERMEDIATE) == false)
        {
            return mergedDataSet;
        }

        // 中間データ保持設定が存在し、かつ「true」の場合のみ中間データの生成を行う。
        if (Boolean.getBoolean(mergeConfig.get(LofConfKey.HAS_INTERMEDIATE).toString()) == true)
        {
            LofCalculator.initDataSet(kn, mergedDataSet);
        }

        return mergedDataSet;
    }
1203649
@Deprecated
    public static JavaRDD<DataSet> fromContinuousLabeledPoint(JavaSparkContext sc, JavaRDD<LabeledPoint> data) {

        return data.map(new Function<LabeledPoint, DataSet>() {
            @Override
            public DataSet call(LabeledPoint lp) {
                return convertToDataset(lp);
            }
        });
    }
905301
public static <T> Collection<T> convertAllBeanDataToObjects(Collection<? extends BeanData> data) {
        return Collections2.transform(data, new BeanDataToObjectFunction<T>());
    }
695360
public static InternalNode<?> createInternalNode(InternalNode<?> n, Class<?> clsDataType) throws MIDDException {
        return createInternalNode(n.getID(), n.getState(), clsDataType);
    }
490672
protected function convertChangeData($changeData)
    {
        $type = $changeData['type'];

        if (!isset($this->typeMap[$type])) {
            return new Error(sprintf('Could not convert change type %s, it is unknown to the system', $type));
        }

        $changeClass = $this->typeMap[$type];
        $changeClassInstance = $this->objectManager->get($changeClass);
        $changeClassInstance->injectPersistenceManager($this->persistenceManager);

        $subjectContextPath = $changeData['subject'];
        $subject = $this->nodeService->getNodeFromContextPath($subjectContextPath);

        if ($subject instanceof Error) {
            return $subject;
        }

        $changeClassInstance->setSubject($subject);

        if (isset($changeData['reference']) && method_exists($changeClassInstance, 'setReference')) {
            $referenceContextPath = $changeData['reference'];
            $reference = $this->nodeService->getNodeFromContextPath($referenceContextPath);

            if ($reference instanceof Error) {
                return $reference;
            }

            $changeClassInstance->setReference($reference);
        }

        if (isset($changeData['payload'])) {
            foreach ($changeData['payload'] as $propertyName => $value) {
                if (!in_array($propertyName, $this->disallowedPayloadProperties)) {
                    $methodParameters = $this->reflectionService->getMethodParameters($changeClass, ObjectAccess::buildSetterMethodName($propertyName));
                    $methodParameter = current($methodParameters);
                    $targetType = $methodParameter['type'];

                    // Fixme: The type conversion runs depending on the target node property type inside Property::class
                    // This is why we are not allowed to modify the value in any way.
                    // Without this condition the object was parsed to a string leading to fatal errors when changing images
                    // in the UI.
                    if ($propertyName !== 'value' && $targetType !== Property::class) {
                        $value = $this->propertyMapper->convert($value, $targetType);
                    }

                    ObjectAccess::setProperty($changeClassInstance, $propertyName, $value);
                }
            }
        }

        return $changeClassInstance;
    }
1065993
@SuppressWarnings("unchecked")
    public FlatDataList toFlatDataList() {
        Collection<Object> values = internalData.values();
        List<Object> list;
        if (values instanceof List<?>) {
            list = (List<Object>)values;
        }
        else {
            list = new ArrayList(values);
        }
        return new FlatDataList(list);
    }
208210
@Override
  public Converter<Schema, JdbcEntrySchema, GenericRecord, JdbcEntryData> init(WorkUnitState workUnit) {
    String avroToJdbcFieldsPairJsonStr = workUnit.getProp(ConfigurationKeys.CONVERTER_AVRO_JDBC_ENTRY_FIELDS_PAIRS);
    if (!StringUtils.isEmpty(avroToJdbcFieldsPairJsonStr)) {
      if (!this.avroToJdbcColPairs.isPresent()) {
        ImmutableMap.Builder<String, String> avroToJdbcBuilder = ImmutableMap.builder();
        ImmutableMap.Builder<String, String> jdbcToAvroBuilder = ImmutableMap.builder();

        JsonObject json = new JsonParser().parse(avroToJdbcFieldsPairJsonStr).getAsJsonObject();
        for (Map.Entry<String, JsonElement> entry : json.entrySet()) {
          if (!entry.getValue().isJsonPrimitive()) {
            throw new IllegalArgumentException("Json value should be a primitive String. "
                + ConfigurationKeys.CONVERTER_AVRO_JDBC_ENTRY_FIELDS_PAIRS + " : " + avroToJdbcFieldsPairJsonStr);
          }
          avroToJdbcBuilder.put(entry.getKey(), entry.getValue().getAsString());
          jdbcToAvroBuilder.put(entry.getValue().getAsString(), entry.getKey());
        }
        this.avroToJdbcColPairs = Optional.of((Map<String, String>) avroToJdbcBuilder.build());
      }
    }
    return this;
  }
774454
public static EntityKey fromData(
			EntityKeyMetadata entityKeyMetadata,
			GridType identifierGridType,
			final Serializable id,
			SharedSessionContractImplementor session) {
		Object[] values = LogicalPhysicalConverterHelper.getColumnsValuesFromObjectValue(
				id,
				identifierGridType,
				entityKeyMetadata.getColumnNames(),
				session
		);
		return new EntityKey( entityKeyMetadata, values );
	}
1207883
public static Map<String, String> flattenDataContext(final Map<String, Map<String, String>> dataContext) {
        final Map<String, String> res = new HashMap<String, String>();
        if(null!=dataContext){
            for (final Map.Entry<String, Map<String, String>> entry : dataContext.entrySet()) {

                final String p = entry.getKey() + ".";
                final Map<String, String> map = entry.getValue();
                if(null!=map){
                    for (final Map.Entry<String, String> entry2 : map.entrySet()) {
                        if(null!=map.get(entry2.getKey())){
                            res.put(p + entry2.getKey(), entry2.getValue());
                        }
                    }
                }
            }
        }
        return res;
    }
1311820
function mergeData(sourceData) {
          var map = {};
          $.each(data, function(i, datum) {
            map[datum.value] = datum;
          });
          $.each(sourceData, function(i, sourceDatum) {
            $.extend(sourceDatum, map[sourceDatum.value]);
          });
          return sourceData;
        }
883986
public static Map<String, String> jfAppTransByMap(Map<String, String> reqData) {
		return SDKUtil.convertResultStringToMap(jfAppTrans(reqData));
	}