Ejemplo n.º 1
0
 public override void Add(HqlCalc calc)
 {
     if (calc is HqlCount)
     {
         count += ((HqlCount)calc).count;
     }
     else
     {
         throw new ArgumentException("Unable to add type HqlCalc to HqlCount");
     }
 }
Ejemplo n.º 2
0
 public override void Add(HqlCalc calc)
 {
     if (calc is HqlSum)
     {
         Add(((HqlSum)calc).sum);
     }
     else
     {
         throw new ArgumentException("Unable to add type HqlCalc to HqlCount");
     }
 }
Ejemplo n.º 3
0
 public override void Add(HqlCalc calc)
 {
     if (calc is HqlMin)
     {
         Add(((HqlMin)calc).min);
     }
     else
     {
         throw new ArgumentException("Unable to add type HqlCalc to HqlMin");
     }
 }
Ejemplo n.º 4
0
        ///////////////////////
        // Private

        private void Init(HqlFieldGroup group1, HqlFieldGroup group2, HqlFieldGroup group3)
        {
            _valuesSet = false;

            int countGroup1 = (group1 == null) ? 0 : group1.Count;
            int countGroup2 = (group2 == null) ? 0 : group2.Count;
            int countGroup3 = (group3 == null) ? 0 : group3.Count;

            HqlField[] fields1 = (group1 == null) ? null : group1.Fields;
            HqlField[] fields2 = (group2 == null) ? null : group2.Fields;
            HqlField[] fields3 = (group3 == null) ? null : group3.Fields;

            _calc    = new HqlCalc[countGroup1 + countGroup2 + countGroup3];
            _grouped = new object[countGroup1 + countGroup2 + countGroup3];

            int start = 0;

            for (int i = 0; i < countGroup1; ++i)
            {
                HqlField f = fields1[i];
                if (f.HasFunction)
                {
                    _calc[i + start] = f.Func.CreateCalcObject();
                }
            }
            start += countGroup1;

            for (int i = 0; i < countGroup2; ++i)
            {
                HqlField f = fields2[i];
                if (f.HasFunction)
                {
                    _calc[i + start] = f.Func.CreateCalcObject();
                }
            }
            start += countGroup2;

            for (int i = 0; i < countGroup3; ++i)
            {
                HqlField f = fields3[i];
                if (f.HasFunction)
                {
                    _calc[i + start] = f.Func.CreateCalcObject();
                }
            }
            //start += countGroup3;
        }
Ejemplo n.º 5
0
        public object GetValue(int n)
        {
            object o = this[n];

            if (o is HqlCalc)
            {
                HqlCalc c = (HqlCalc)o;
                return(c.GetValue());
            }
            else if (o is string)
            {
                string s = (string)o;
                return(s);
            }

            throw new Exception(String.Format("Unknown GetValue type of |{0}|", o.GetType().ToString()));
        }
Ejemplo n.º 6
0
 public override void Add(HqlCalc calc)
 {
     if (calc is HqlAvg)
     {
         HqlAvg c = (HqlAvg)calc;
         if (c.sum.HasValue)
         {
             if (!sum.HasValue)
             {
                 sum = 0.0M;
             }
             sum   += c.sum;
             count += c.count;
         }
     }
     else
     {
         throw new ArgumentException("Unable to add type HqlCalc to HqlAvg");
     }
 }
Ejemplo n.º 7
0
 public override void Add(HqlCalc calc)
 {
     throw new ArgumentException("Unable to add to HqlStdev");
 }
Ejemplo n.º 8
0
 abstract public void Add(HqlCalc calc);