// @Override
 public Row convert(Document document, DataSetHeader header)
 {
     Debug.Assert(header.size() == 1);
     Object[] values = new Object[1];
     values[0] = document.getValues();
     return(new DefaultRow(header, values));
 }
        // @Override
        public Row getSubSelection(DataSetHeader header)
        {
            int size = header.size();

            Object[] values = new Object[size];
            Style[]  styles = new Style[size];
            for (int i = 0; i < size; i++)
            {
                SelectItem selectItem = header.getSelectItem(i);

                if (selectItem.getSubQuerySelectItem() != null)
                {
                    values[i] = getValue(selectItem.getSubQuerySelectItem());
                    styles[i] = getStyle(selectItem.getSubQuerySelectItem());
                    if (values[i] == null)
                    {
                        values[i] = getValue(selectItem);
                        styles[i] = getStyle(selectItem);
                    }
                }
                else
                {
                    values[i] = getValue(selectItem);
                    styles[i] = getStyle(selectItem);
                }
            }
            return(new DefaultRow(header, values, styles));
        }
Exemplo n.º 3
0
        //@Override
        public override Row getRow()
        {
            if (_document == null)
            {
                return(null);
            }
            DataSetHeader header = getHeader();

            return(_converter.convert(_document, header));
        }
 // @Override
 public Row convert(amm_data.Document document, DataSetHeader header)
 {
     Object[] values = new Object[header.size()];
     for (int i = 0; i < values.Length; i++)
     {
         String columnName = header.getSelectItem(i).getColumn().getName();
         values[i] = get(document, columnName);
     }
     return(new DefaultRow(header, values));
 }
        } // constructor

        /**
         * Constructor appropriate for dataset implementations that wrap other
         * datasets, such as the {@link MaxRowsDataSet}, {@link FilteredDataSet} and
         * more.
         *
         * @param dataSet
         */
        public AbstractDataSet(DataSet dataSet)
        {
            if (dataSet is AbstractDataSet)
            {
                _header = ((AbstractDataSet)dataSet).getHeader();
            }
            else
            {
                _header = new CachingDataSetHeader(NArrays.AsList <SelectItem>(dataSet.getSelectItems()));
            }
        } // constructor
Exemplo n.º 6
0
        /**
         * Constructs a row.
         *
         * @param header
         * @param values
         * @param styles
         */
        public DefaultRow(DataSetHeader header, Object[] values, Style[] styles)
        {
            if (header == null)
            {
                throw new ArgumentException("DataSet header cannot be null");
            }
            if (values == null)
            {
                throw new ArgumentException("Values cannot be null");
            }
            if (header.size() != values.Length)
            {
                throw new ArgumentException("Header size and values length must be equal. " + header.size()
                                            + " select items present in header and encountered these values: "
                                            + values.ToString());
            }
            if (styles != null)
            {
                if (values.Length != styles.Length)
                {
                    throw new ArgumentException("Values length and styles length must be equal. " + values.Length
                                                + " values present and encountered these styles: " + styles.ToString());
                }
                bool entirelyNoStyle = true;
                for (int i = 0; i < styles.Length; i++)
                {
                    if (styles[i] == null)
                    {
                        throw new ArgumentException("Elements in the style array cannot be null");
                    }
                    if (entirelyNoStyle && !StyleConstants.NO_STYLE.Equals(styles[i]))
                    {
                        entirelyNoStyle = false;
                    }
                }

                if (entirelyNoStyle)
                {
                    // no need to reference any styles
                    styles = null;
                }
            }
            _header = header;
            _values = values;
            _styles = styles;
        }
        } // constructor

        public AbstractDataSet(DataSetHeader header)
        {
            _header = header;
        } // constructor
 /**
  * @deprecated use one of the other constructors, to provide header
  *             information.
  */
 // @Deprecated
 public AbstractDataSet()
 {
     Debug.WriteLine("new AbstractDataSet");
     _header = null;
 } // constructor
Exemplo n.º 9
0
 public DocumentSourceDataSet(DataSetHeader header, DocumentSource documentSource, DocumentConverter converter) : base(header)
 {
     _document_source = documentSource;
     _converter       = converter;
 } // constructor
Exemplo n.º 10
0
        } // constructor

        public InMemoryDataSet(DataSetHeader header, List <Row> rows) :  base(header)
        {
            _rows = rows;
        } // constructor
Exemplo n.º 11
0
        } // constructor

        public InMemoryDataSet(DataSetHeader header, params Row[] rows) :  base(header)
        {
            _rows = NArrays.AsList(rows);
        } // constructor
Exemplo n.º 12
0
 public EmptyDataSet(DataSetHeader header) : base(header)
 {
 }
        } // next()

        //  @Override
        public override Row getRow()
        {
            DataSetHeader header = getHeader();

            return(_dataSet.getRow().getSubSelection(header));
        } // getRow()
Exemplo n.º 14
0
 /**
  * Constructs a row.
  *
  * @param header
  * @param values
  */
 public DefaultRow(DataSetHeader header, Object[] values) : this(header, values, null)
 {
 } // constructor