Package com.opengamma.engine.value

Examples of com.opengamma.engine.value.ValueProperties.copy()


      constraints.with(HistoricalTimeSeriesFunctionUtils.INCLUDE_START_PROPERTY, HistoricalTimeSeriesFunctionUtils.YES_VALUE);
    }
    values = desiredValueConstraints.getValues(HistoricalTimeSeriesFunctionUtils.END_DATE_PROPERTY);
    if ((values == null) || values.isEmpty()) {
      if (constraints == null) {
        constraints = desiredValueConstraints.copy();
      }
      constraints.with(HistoricalTimeSeriesFunctionUtils.END_DATE_PROPERTY, "");
    }
    values = desiredValueConstraints.getValues(HistoricalTimeSeriesFunctionUtils.INCLUDE_END_PROPERTY);
    if ((values == null) || (values.size() != 1)) {
View Full Code Here


      constraints.with(HistoricalTimeSeriesFunctionUtils.END_DATE_PROPERTY, "");
    }
    values = desiredValueConstraints.getValues(HistoricalTimeSeriesFunctionUtils.INCLUDE_END_PROPERTY);
    if ((values == null) || (values.size() != 1)) {
      if (constraints == null) {
        constraints = desiredValueConstraints.copy();
      }
      constraints.with(HistoricalTimeSeriesFunctionUtils.INCLUDE_END_PROPERTY, HistoricalTimeSeriesFunctionUtils.YES_VALUE);
    }
    return Collections.emptySet();
    //    if (constraints == null) {
View Full Code Here

      return null;
    }
    final Set<ValueSpecification> results = Sets.newHashSetWithExpectedSize(underlyingResults.size());
    for (final ValueSpecification underlyingResult : underlyingResults) {
      final ValueProperties underlyingProperties = underlyingResult.getProperties();
      final ValueProperties.Builder properties = underlyingProperties.copy();
      if (underlyingProperties.getProperties().isEmpty()) {
        // Got the infinite or nearly infinite property set
        properties.withAny(ValuePropertyNames.AGGREGATION);
        results.add(new ValueSpecification(underlyingResult.getValueName(), underlyingResult.getTargetSpecification(), properties.get()));
      } else {
View Full Code Here

      desiredValue = new ValueRequirement(desiredValue.getValueName(), desiredValue.getTargetReference(), ValueProperties.with(ValuePropertyNames.AGGREGATION, getAggregationStyleFull())
          .withOptional(ValuePropertyNames.AGGREGATION).get());
    } else if (constraints.getProperties().isEmpty()) {
      // Infinite/near-infinite constraints - make aggregation style optional
      if (!constraints.isOptional(ValuePropertyNames.AGGREGATION)) {
        desiredValue = new ValueRequirement(desiredValue.getValueName(), desiredValue.getTargetReference(), constraints.copy().withOptional(ValuePropertyNames.AGGREGATION).get());
      }
    } else {
      final Set<String> aggregationStyle = constraints.getValues(ValuePropertyNames.AGGREGATION);
      final String full = getAggregationStyleFull();
      if ((aggregationStyle == null) || aggregationStyle.isEmpty()) {
View Full Code Here

    } else {
      final Set<String> aggregationStyle = constraints.getValues(ValuePropertyNames.AGGREGATION);
      final String full = getAggregationStyleFull();
      if ((aggregationStyle == null) || aggregationStyle.isEmpty()) {
        // No constraint or wild-card - assume FULL and make it optional for the inputs
        desiredValue = new ValueRequirement(desiredValue.getValueName(), desiredValue.getTargetReference(), constraints.copy().withoutAny(ValuePropertyNames.AGGREGATION)
            .withOptional(ValuePropertyNames.AGGREGATION).with(ValuePropertyNames.AGGREGATION, full).get());
      } else if (aggregationStyle.contains(full)) {
        // Constraint allows FULL - make it optional for the inputs
        if ((aggregationStyle.size() != 1) || !constraints.isOptional(ValuePropertyNames.AGGREGATION)) {
          desiredValue = new ValueRequirement(desiredValue.getValueName(), desiredValue.getTargetReference(), constraints.copy().withoutAny(ValuePropertyNames.AGGREGATION)
View Full Code Here

        desiredValue = new ValueRequirement(desiredValue.getValueName(), desiredValue.getTargetReference(), constraints.copy().withoutAny(ValuePropertyNames.AGGREGATION)
            .withOptional(ValuePropertyNames.AGGREGATION).with(ValuePropertyNames.AGGREGATION, full).get());
      } else if (aggregationStyle.contains(full)) {
        // Constraint allows FULL - make it optional for the inputs
        if ((aggregationStyle.size() != 1) || !constraints.isOptional(ValuePropertyNames.AGGREGATION)) {
          desiredValue = new ValueRequirement(desiredValue.getValueName(), desiredValue.getTargetReference(), constraints.copy().withoutAny(ValuePropertyNames.AGGREGATION)
              .withOptional(ValuePropertyNames.AGGREGATION).with(ValuePropertyNames.AGGREGATION, full).get());
        }
      } else {
        final String missing = getAggregationStyleMissing();
        if (aggregationStyle.contains(missing)) {
View Full Code Here

      } else {
        final String missing = getAggregationStyleMissing();
        if (aggregationStyle.contains(missing)) {
          // Constraint allows MISSING - make it optional for the inputs
          if ((aggregationStyle.size() != 1) || !constraints.isOptional(ValuePropertyNames.AGGREGATION)) {
            desiredValue = new ValueRequirement(desiredValue.getValueName(), desiredValue.getTargetReference(), constraints.copy().withoutAny(ValuePropertyNames.AGGREGATION)
                .withOptional(ValuePropertyNames.AGGREGATION).with(ValuePropertyNames.AGGREGATION, missing).get());
          }
        } else {
          // Unsupported aggregation style
          return null;
View Full Code Here

    for (final ValueSpecification underlyingResult : underlyingResults) {
      final ValueProperties properties = underlyingResult.getProperties();
      if ((properties.getProperties() != null) && properties.getProperties().isEmpty()) {
        results.add(underlyingResult);
      } else {
        final ValueProperties.Builder builder = properties.copy();
        if (resultFull) {
          builder.withoutAny(ValuePropertyNames.AGGREGATION).with(ValuePropertyNames.AGGREGATION, getAggregationStyleFull());
          results.add(new ValueSpecification(underlyingResult.getValueName(), underlyingResult.getTargetSpecification(), builder.get()));
        }
        if (resultMissing) {
View Full Code Here

    }
    if (common == null) {
      // Can't have been any inputs ... ?
      return null;
    }
    common = common.copy().withoutAny(ValuePropertyNames.FUNCTION).with(ValuePropertyNames.FUNCTION, getUniqueId()).get();
    return Collections.singleton(new ValueSpecification(_requirementName, target.toSpecification(), common));
  }

  @Override
  public Set<ComputedValue> execute(final FunctionExecutionContext executionContext, final FunctionInputs inputs, final ComputationTarget target, final Set<ValueRequirement> desiredValues) {
View Full Code Here

    Object scaledValue = null;
    for (ComputedValue value : inputs.getAllValues()) {
      common = SumUtils.addProperties(common, value.getSpecification().getProperties());
      scaledValue = SumUtils.addValue(scaledValue, value.getValue(), _requirementName);
    }
    common = common.copy().withoutAny(ValuePropertyNames.FUNCTION).with(ValuePropertyNames.FUNCTION, getUniqueId()).get();
    final ValueSpecification specification = new ValueSpecification(_requirementName, target.toSpecification(), common);
    return Sets.newHashSet(new ComputedValue(specification, scaledValue));
  }

}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.