public Specification(BasicSpecification basicSpecification) { if (basicSpecification == null) { throw new ArgumentNullException("basicSpecification"); } this.basicSpecification = basicSpecification; this.position = GetDefaultPosition(basicSpecification); }
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()); }
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; }
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(); } }