Ejemplo n.º 1
0
 public RCArray <RCSymbolScalar> Write(RCCube source)
 {
     _source = source;
     // This controls the value E will take if it is not provided by source.
     if (_target.Axis.Event != null && _target.Axis.Event.Count > 0)
     {
         _e = _target.Axis.Event[_target.Axis.Event.Count - 1] + 1;
     }
     else
     {
         _e = _target.Count;
     }
     _source.VisitCellsForward(this, 0, _source.Count);
     return(new RCArray <RCSymbolScalar> (_result));
 }
Ejemplo n.º 2
0
 public RCCube Read()
 {
     if (_spec.Forward)
     {
         int startRow = _spec.Start;
         if (_source.Axis.Global != null && _source.Axis.Count > 0)
         {
             // Max prevents the row from going negative if the section has been cleared.
             startRow -= (int)_initg;
             startRow  = Math.Max(startRow, 0);
         }
         _source.VisitCellsForward(this, startRow, _end);
         _acceptedLines = _inLines;
     }
     else
     {
         _source.VisitCellsBackward(this, _spec.Start, _end);
         _target.ReverseInPlace();
         _inLines.ReverseInPlace();
         _acceptedLines = _inLines;
     }
     _acceptedSymbols = new RCArray <RCSymbolScalar> (_inSymbols.Keys);
     return(_target);
 }
Ejemplo n.º 3
0
        public void Format(RCCube source)
        {
            if (source.Count == 0)
            {
                if (_args.Syntax == "RCL")
                {
                    _builder.Append("[]");
                }
                return;
            }
            _names     = new List <string> ();
            _columns   = new List <List <string> > ();
            _max       = new List <int> ();
            _leftAlign = new List <bool> ();
            int  tcols    = 0;
            bool useGRows = false;

            if (source.Axis.Has("G") && _args.Showt)
            {
                _names.Add("G");
                _columns.Add(new List <string> ());
                _max.Add(MIN_WIDTH);
                _leftAlign.Add(false);
                ++tcols;
                useGRows = true;
            }
            if (source.Axis.Has("E") && _args.Showt)
            {
                _names.Add("E");
                _columns.Add(new List <string> ());
                _max.Add(MIN_WIDTH);
                _leftAlign.Add(false);
                ++tcols;
            }
            if (source.Axis.Has("T") && _args.Showt)
            {
                _names.Add("T");
                _columns.Add(new List <string> ());
                _max.Add(MIN_WIDTH);
                _leftAlign.Add(false);
                ++tcols;
            }
            if (source.Axis.Has("S"))
            {
                _names.Add("S");
                _columns.Add(new List <string> ());
                _max.Add(MIN_WIDTH);
                _leftAlign.Add(true);
                ++tcols;
            }
            for (int i = 0; i < source.Cols; ++i)
            {
                string name = source.ColumnAt(i);
                char   type = source.GetTypeCode(name);
                _names.Add(source.NameAt(i));
                _columns.Add(new List <string> ());
                _max.Add(MIN_WIDTH);
                _leftAlign.Add(type == 'y' || type == 's');
            }
            // Populate _columns and _max.
            if (_args.CanonicalCubes)
            {
                source.VisitCellsCanonical(this, 0, source.Axis.Count);
            }
            else
            {
                source.VisitCellsForward(this, 0, source.Axis.Count);
            }
            if (_args.Syntax == "RCL")
            {
                FormatRC(tcols);
            }
            else if (_args.Syntax == "HTML")
            {
                FormatHtml(tcols, useGRows);
            }
            else if (_args.Syntax == "CSV")
            {
                FormatCsv(tcols, useGRows, CSV_ESCAPE_CHARS, true);
            }
            else if (_args.Syntax == "LOG")
            {
                FormatCsv(tcols, useGRows, LOG_ESCAPE_CHARS, false);
            }
            else
            {
                throw new Exception("Unknown syntax for format:" + _args.Syntax);
            }
        }
Ejemplo n.º 4
0
 public RCCube Where()
 {
     _source.VisitCellsForward(this, 0, _source.Count);
     return(_target);
 }
Ejemplo n.º 5
0
 public RCBlock Write()
 {
     _source.VisitCellsForward(this, 0, _source.Count);
     return(_target);
 }