コード例 #1
0
 // get axis by name
 public int getAxisIndex(string name)
 {
     for (int i = 0; i < this.Dimension; i++)
     {
         BlauSpaceAxis axis = (BlauSpaceAxis)_indexedAxes[i];
         if (axis.Name.Equals(name))
         {
             return(i);
         }
     }
     throw new Exception("BlauSpace does not contain axis: " + name);
 }
コード例 #2
0
 // test axis presence, by name
 public bool hasAxis(string name)
 {
     for (int i = 0; i < this.Dimension; i++)
     {
         BlauSpaceAxis axis = (BlauSpaceAxis)_indexedAxes[i];
         if (axis.Name.Equals(name))
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #3
0
        // blauspace comparator specific
        public int CompareTo(BlauSpace bs)
        {
            int c1 = (this.Dimension < bs.Dimension) ? -1 : ((this.Dimension == bs.Dimension) ? 0 : +1);

            if (c1 != 0)
            {
                return(c1);
            }

            BlauSpaceAxisComparer cmp = new BlauSpaceAxisComparer();

            if (_indexedAxes == null)
            {
                throw new ArgumentException("_indexedAxes is null");
            }
            if (bs._indexedAxes == null)
            {
                throw new ArgumentException("bs._indexedAxes is null");
            }

            SortedDictionary <BlauSpaceAxis, BlauSpaceAxis> thisAxes = new SortedDictionary <BlauSpaceAxis, BlauSpaceAxis>(cmp);

            foreach (int x in _indexedAxes.Keys)
            {
                thisAxes.Add((BlauSpaceAxis)_indexedAxes[x], (BlauSpaceAxis)_indexedAxes[x]);
            }
            SortedDictionary <BlauSpaceAxis, BlauSpaceAxis> bsAxes = new SortedDictionary <BlauSpaceAxis, BlauSpaceAxis>(cmp);

            foreach (int x in bs._indexedAxes.Keys)
            {
                bsAxes.Add((BlauSpaceAxis)bs._indexedAxes[x], (BlauSpaceAxis)bs._indexedAxes[x]);
            }

            IEnumerator <BlauSpaceAxis> thisAxesEnum = thisAxes.Keys.GetEnumerator();
            IEnumerator <BlauSpaceAxis> bsAxesEnum   = bsAxes.Keys.GetEnumerator();

            while (thisAxesEnum.MoveNext())
            {
                BlauSpaceAxis x1 = thisAxesEnum.Current;

                bsAxesEnum.MoveNext();
                BlauSpaceAxis x2 = bsAxesEnum.Current;
                int           c2 = cmp.Compare(x1, x2);
                if (c2 != 0)
                {
                    return(c2);
                }
            }
            return(0);
        }
コード例 #4
0
        // private constructor
        private BlauSpace(int dimension, string [] names, double [] min, double [] max)
        {
            /*
             * if ((dimension != names.Length) ||
             *  (dimension != min.Length) ||
             *  (dimension != max.Length)) {
             *      throw new Exception("BlauSpace ctor received an inconsistent dimensional description ");
             * }
             */

            _dimension   = dimension;
            _indexedAxes = new Hashtable();

            for (int i = 0; i < dimension; i++)
            {
                BlauSpaceAxis axis_i = new BlauSpaceAxis(names[i], min[i], max[i]);
                _indexedAxes.Add(i, axis_i);
            }

            _hashedName = this.ToString();
        }