# stack.rb: the data stack # copyright (c) 2009 by Vincent Fourmond # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details (in the COPYING file). require 'ctioga2/utils' require 'ctioga2/data/datacolumn' require 'ctioga2/data/backends/backends' require 'ctioga2/data/backends/factory' # This module contains all the classes used by ctioga module CTioga2 module Data # A series of commands that can be used as "filters", as they act # upon the last Dataset pushed unto the stack. module Filters FiltersGroup = CmdGroup.new('filter', "Filters", "The commands in this group act upon the last dataset pushed unto the data stack: they can be viewed as filters.", 101) SortOperation = Cmd.new("sort-last", nil, "--sort-last", [], {}) do |plotmaker, opts| plotmaker.data_stack.last.sort! end SortOperation.describe("Sorts the last dataset according to X values", < :avg, /stddev/i => :stddev, } AVGDupMode = CmdType.new('average-mode', {:type => :re_list, :list => AVGDupModeRE}, < CmdArg.new('average-mode')}) do |plotmaker, opts| mode = opts['mode'] || :avg plotmaker.data_stack.last.average_duplicates!(mode) end AverageDupOperation.describe("Average successive elements with identical X values", <