示例#1
0
 public ValueSpecification(string valueName, ComputationTargetSpecification targetSpecification, ValueProperties properties)
 {
     ArgumentChecker.NotNull(valueName, "valueName");
     ArgumentChecker.NotNull(targetSpecification, "targetSpecification");
     ArgumentChecker.NotNull(properties, "properties");
     _valueName           = string.Intern(valueName); //Should be a small static set
     _targetSpecification = targetSpecification;
     _properties          = properties;
 }
示例#2
0
        public static ValueRequirement FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer)
        {
            ValueProperties constraints = deserializer.FromField<ValueProperties>(ffc.GetByName("constraints")) ?? ValueProperties.Create();

            var computationTargetType = ffc.GetValue<string>("computationTargetType");
            var computationTargetIdentifier = GetUniqueIdentifier(ffc, deserializer, "computationTargetIdentifier");
            var targetSpec = new ComputationTargetSpecification(EnumBuilder<ComputationTargetType>.Parse(computationTargetType), computationTargetIdentifier);
            var valueName = ffc.GetValue<string>("valueName");

            return new ValueRequirement(valueName, targetSpec, constraints);
        }
示例#3
0
        public static ValueRequirement FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer)
        {
            ValueProperties constraints = deserializer.FromField <ValueProperties>(ffc.GetByName("constraints")) ?? ValueProperties.Create();

            var computationTargetType       = ffc.GetValue <string>("computationTargetType");
            var computationTargetIdentifier = GetUniqueIdentifier(ffc, deserializer, "computationTargetIdentifier");
            var targetSpec = new ComputationTargetSpecification(EnumBuilder <ComputationTargetType> .Parse(computationTargetType), computationTargetIdentifier);
            var valueName  = ffc.GetValue <string>("valueName");

            return(new ValueRequirement(valueName, targetSpec, constraints));
        }
示例#4
0
 public bool TryGetAllValues(ComputationTargetSpecification target, out ISet<ComputedValue> values)
 {
     return _mapAll.TryGetValue(target, out values);
 }
示例#5
0
 public ValueRequirement(string valueName, ComputationTargetSpecification targetSpecification, ValueProperties constraints)
 {
     _valueName = string.Intern(valueName); //Should be small static set
     _constraints = constraints;
     _targetSpecification = targetSpecification;
 }
示例#6
0
 public ValueRequirement(string valueName, ComputationTargetSpecification targetSpecification)
     : this(valueName, targetSpecification, ValueProperties.Create())
 {
 }
 public bool TryGetAllValues(ComputationTargetSpecification target, out ISet <ComputedValue> values)
 {
     return(_mapAll.TryGetValue(target, out values));
 }
示例#8
0
        public override T DeserializeImpl(IFudgeFieldContainer msg, IFudgeDeserializer deserializer)
        {
            UniqueId viewProcessId = GetUniqueId(msg, "viewProcessId");
            UniqueId viewCycleId   = GetUniqueId(msg, "viewCycleId");

            var      inputDataTimestamp  = GetToDateTimeOffsetWithDefault(msg, "valuationTime");
            var      resultTimestamp     = GetToDateTimeOffsetWithDefault(msg, "calculationTime");
            TimeSpan calculationDuration = DurationBuilder.Build(msg.GetMessage("calculationDuration")).GetValueOrDefault(); //TODO strict once PLAT-1683
            var      configurationMap    = new Dictionary <string, ViewCalculationResultModel>();
            var      keys   = new Queue <string>();
            var      values = new Queue <ViewCalculationResultModel>();

            foreach (var field in msg.GetMessage("results"))
            {
                switch (field.Ordinal)
                {
                case 1:
                    string key = field.GetString();
                    if (!values.Any())
                    {
                        keys.Enqueue(key);
                    }
                    else
                    {
                        configurationMap.Add(key, values.Dequeue());
                    }
                    break;

                case 2:
                    var mapAll = new Dictionary <ComputationTargetSpecification, ISet <ComputedValue> >();

                    foreach (var f in (IFudgeFieldContainer)field.Value)
                    {
                        var v = deserializer.FromField <ComputedValue>(f);

                        ComputationTargetSpecification target = v.Specification.TargetSpecification;

                        if (!mapAll.ContainsKey(target))
                        {
                            mapAll.Add(target, new HashSet <ComputedValue>());
                        }
                        mapAll[target].Add(v);
                    }

                    var value = new ViewCalculationResultModel(mapAll);

                    if (!keys.Any())
                    {
                        values.Enqueue(value);
                    }
                    else
                    {
                        configurationMap.Add(keys.Dequeue(), value);
                    }
                    break;

                default:
                    throw new ArgumentException();
                }
            }

            return(BuildObject(msg, deserializer, configurationMap, viewProcessId, viewCycleId, inputDataTimestamp, resultTimestamp, calculationDuration));
        }
示例#9
0
 public ValueRequirement(string valueName, ComputationTargetSpecification targetSpecification, ValueProperties constraints)
 {
     _valueName           = string.Intern(valueName); //Should be small static set
     _constraints         = constraints;
     _targetSpecification = targetSpecification;
 }
示例#10
0
 public ValueRequirement(string valueName, ComputationTargetSpecification targetSpecification) : this(valueName, targetSpecification, ValueProperties.Create())
 {
 }