Пример #1
0
        public override void doAction(SVRow r)
        {
            string goal_str = r.row[field.address()];
            double goal_dbl = Convert.ToDouble(goal_str);

            total += goal_dbl;
        }
Пример #2
0
        }//Constructor

        // Process one row of the SnapView
        public override void doAction(SVRow r)
        {
            // Input the target element of the row string
            // If it exists in the Set, don't add it. Otherwise add it.

            // Get the Field address:
            int addr = field.address();

            // Add value at address to the index
            set.Add(r.row[addr]);
        }
Пример #3
0
        public void fillSnapViewTable(SnapView sv)
        {
            // LINQ query to return a list of rows
            var rowList = from row in xdoc.Descendants(config.xmlRootName).Descendants(config.xmlRowName)
                          select new
            {
                fieldList = row.Descendants()
            };

            // Loop over the rows
            foreach (var row in rowList)
            {
                // Have to iterate over row twice: once to find its size, so
                // the array can be created; second to fill the array.
                // This is because IEnumerable<T> doesn't provide a way of knowing
                // the number of elements in the collection without iterating over them all.

                int arr_size = 0;

                foreach (var field in row.fieldList)
                {
                    arr_size++;
                }//foreach

                // Create the string array
                string[] row_array = new string[arr_size];

                int arr_idx = 0;

                Console.WriteLine("Another row");
                // Loop over the fields in the row
                foreach (var field in row.fieldList)
                {
                    Console.WriteLine("  Another field: ");
                    Console.WriteLine(field.Value.ToString());

                    // Add string to array

                    row_array[arr_idx] = field.Value.ToString();
                    arr_idx++;
                }//foreach loop over fields in a row

                // Add row to the SnapView datastructure
                SVRow svr = new SVRow();
                svr.row = row_array;
                sv.addRow(svr);
            }//foreach loop over rows
        }
Пример #4
0
 public override void doAction(SVRow r)
 {
     // This class is incomplete (and unused at the moment) - doesn't have calculation code yet (hence the unused private data members)
 }
Пример #5
0
        // Every Filter must be able to be "done" by the containing
        // snapview. Derived classes have the actual implementation.
        // Parameter is a "row" of the snapView.

        //abstract public bool try_filter(SVRow r);
        public override void doAction(SVRow r)
        {
            // Throw an exception as this doesn't do anything
        }
Пример #6
0
 // Interface to the doAction method
 public void doAction(SVRow r)
 {
     action.doAction(r);
 }
Пример #7
0
 public override void doAction(SVRow r)
 {
     decision = kBehaviour.keepIf(r.row[field.address()], new SingleCutVal(minimum));
 }
Пример #8
0
 public override void doAction(SVRow r)
 {
     decision = kBehaviour.keepIf(r.row[field.address()], new SingleCutVal(HA_arr[(int)value]));
 }
Пример #9
0
        // name is Read-only (setter is private)
        //public string name { get; private set; }

        // Every action must be able to be "done" by the containing
        // snapview. Derived classes have the actual implementation.
        // Parameter is a "row" of the snapView.

        //public abstract void doAction(string[] r);

        public abstract void doAction(SVRow r);
Пример #10
0
        }//Constructor

        // Uses polymorphism and strategy pattern to call the right
        // filter behaviour
        //public override bool try_filter(SVRow r)
        //{
        //    return kBehaviour.keepIf(r.row[field.address()], val);
        //}

        public override void doAction(SVRow r)
        {
            // This we know this is a single cut val filter because all Equals filters are
            decision = kBehaviour.keepIf(r.row[field.address()], new SingleCutVal(val));
        }