<commit_before>/**
 * Copyright (C) 2009 - 2010 by OpenGamma Inc.
 *
 * Please see distribution for license.
 */
package com.opengamma.engine.view;

import java.io.Serializable;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.fudgemsg.FudgeFieldContainer;
import org.fudgemsg.FudgeMessageFactory;
import org.fudgemsg.MutableFudgeFieldContainer;

import com.opengamma.engine.ComputationTargetType;
import com.opengamma.engine.depgraph.DependencyGraph;
import com.opengamma.engine.depgraph.DependencyNode;
import com.opengamma.engine.value.ValueSpecification;
import com.opengamma.util.ArgumentChecker;

/**
 * Encapsulates view-level configuration to describe the types of values required in the calculation results. This
 * configuration could lead to fewer calculations taking place by allowing the dependency graphs to be trimmed,
 * although values will still be calculated if they are required as inputs for other calculations.
 * <p>
 * This configuration acts as a filter on the outputs that have been requested through
 * {@link ViewCalculationConfiguration}. In a sense, it is a view-view.
 */
public class ResultModelDefinition implements Serializable {
  
  private static final String AGGREGATE_POSITION_OUTPUT_MODE_FIELD = "aggregatePositionOutputMode";
  private static final String POSITION_OUTPUT_MODE_FIELD = "positionOutputMode";
  private static final String SECURITY_OUTPUT_MODE_FIELD = "securityOutputMode";
  private static final String PRIMITIVE_OUTPUT_MODE_FIELD = "primitiveOutputMode";
  
  private ResultOutputMode _aggregatePositionOutputMode = ResultOutputMode.TERMINAL_OUTPUTS;
  private ResultOutputMode _positionOutputMode = ResultOutputMode.TERMINAL_OUTPUTS;
  private ResultOutputMode _securityOutputMode = ResultOutputMode.TERMINAL_OUTPUTS;
  private ResultOutputMode _primitiveOutputMode = ResultOutputMode.TERMINAL_OUTPUTS;

  /**<commit_msg>[ENG-75] Adding a few alternative constructors<commit_after>/**
 * Copyright (C) 2009 - 2010 by OpenGamma Inc.
 *
 * Please see distribution for license.
 */
package com.opengamma.engine.view;

import java.io.Serializable;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.fudgemsg.FudgeFieldContainer;
import org.fudgemsg.FudgeMessageFactory;
import org.fudgemsg.MutableFudgeFieldContainer;

import com.opengamma.engine.ComputationTargetType;
import com.opengamma.engine.depgraph.DependencyGraph;
import com.opengamma.engine.depgraph.DependencyNode;
import com.opengamma.engine.value.ValueSpecification;
import com.opengamma.util.ArgumentChecker;

/**
 * Encapsulates view-level configuration to describe the types of values required in the calculation results. This
 * configuration could lead to fewer calculations taking place by allowing the dependency graphs to be trimmed,
 * although values will still be calculated if they are required as inputs for other calculations.
 * <p>
 * This configuration acts as a filter on the outputs that have been requested through
 * {@link ViewCalculationConfiguration}. In a sense, it is a view-view.
 */
public class ResultModelDefinition implements Serializable {
  
  private static final String AGGREGATE_POSITION_OUTPUT_MODE_FIELD = "aggregatePositionOutputMode";
  private static final String POSITION_OUTPUT_MODE_FIELD = "positionOutputMode";
  private static final String SECURITY_OUTPUT_MODE_FIELD = "securityOutputMode";
  private static final String PRIMITIVE_OUTPUT_MODE_FIELD = "primitiveOutputMode";
  
  private ResultOutputMode _aggregatePositionOutputMode;
  private ResultOutputMode _positionOutputMode;
  private ResultOutputMode _securityOutputMode;
  private ResultOutputMode _primitiveOutputMode;

  /**
   * Constructs an instance using the default output mode for each computation target type.
   */
  public ResultModelDefinition() {
    this(ResultOutputMode.TERMINAL_OUTPUTS);
  }
  
  /**
   * Constructs an instance using the specified output mode for every computation target type.
   *  
   * @param defaultMode  the default result output mode
   */
  public ResultModelDefinition(ResultOutputMode defaultMode) {
    this(defaultMode, defaultMode, defaultMode, defaultMode);
  }
  
  /**
   * Constructs an instance using the specified output modes for each computation target type.
   * 
   * @param primitiveOutputMode  the result output mode for primitive targets
   * @param securityOutputMode  the result output mode for security targets
   * @param positionOutputMode  the result output mode for position targets
   * @param aggregatePositionOutputMode  the result output mode for aggregate position targets
   */
  public ResultModelDefinition(ResultOutputMode primitiveOutputMode, ResultOutputMode securityOutputMode, ResultOutputMode positionOutputMode, ResultOutputMode aggregatePositionOutputMode) {
    _primitiveOutputMode = primitiveOutputMode;
    _securityOutputMode = securityOutputMode;
    _positionOutputMode = positionOutputMode;
    _aggregatePositionOutputMode = aggregatePositionOutputMode;
  }
  
  /**
{'fraction_non_alphanumeric': 0.06090110729285987, 'fraction_numerical': 0.003436426116838488, 'mean_word_length': 5.589937106918239, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7246449', 'n_tokens_mistral': 1367, 'n_tokens_neox': 1334, 'n_words': 419}