示例#1
0
        public Specification(BasicSpecification basicSpecification)
        {
            if (basicSpecification == null)
            {
                throw new ArgumentNullException("basicSpecification");
            }

            this.basicSpecification = basicSpecification;
            this.position           = GetDefaultPosition(basicSpecification);
        }
示例#2
0
 static IEnumerable <double> GetDefaultPosition(BasicSpecification basicSpecification)
 {
     return
         ((
              from segmentIndex in Enumerable.Range(0, basicSpecification.SegmentCount)
              from parameterIndex in Enumerable.Range(0, basicSpecification.SegmentTemplate.ParameterDimension)
              select 1.0
              )
          .ToArray());
 }
示例#3
0
        public Specification(BasicSpecification basicSpecification, IEnumerable <double> position)
        {
            if (basicSpecification == null)
            {
                throw new ArgumentNullException("basicSpecification");
            }
            if (position == null)
            {
                throw new ArgumentNullException("position");
            }
            if (position.Count() != basicSpecification.SegmentCount * basicSpecification.SegmentTemplate.ParameterDimension)
            {
                throw new ArgumentException("Parameter 'position' does not fit the given basic specification.");
            }

            this.basicSpecification = basicSpecification;
            this.position           = position;
        }
示例#4
0
        public Specification(XElement source)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            this.basicSpecification = new BasicSpecification(source.Element("basic_specification").Elements().Single());
            if (source.Element("position") == null)
            {
                this.position = GetDefaultPosition(basicSpecification);
            }
            else
            {
                this.position =
                    (
                        from element in source.Element("position").Elements("parameter")
                        select(double) element
                    )
                    .ToArray();
            }
        }