// @Override
        public MutableTable buildTable()
        {
            int tableObservations = getObservationCount();

            // sort column names by copying them to a TreeSet
            HashSet <String> columnNames = new HashSet <String>(_columnBuilders.Keys);  // new TreeSet<String>(_columnBuilders.keySet());

            MutableTable table        = new MutableTable(_tableName);
            int          columnNumber = 0;

            foreach (String columnName in columnNames)
            {
                InferentialColumnBuilder columnBuilder = (InferentialColumnBuilder)getColumnBuilder(columnName);
                MutableColumn            column        = columnBuilder.build();
                column.setTable(table);
                column.setColumnNumber(columnNumber);

                int columnObservations = columnBuilder.getObservationCount();
                if (tableObservations > columnObservations)
                {
                    // there may be nulls - some records does not even contain the
                    // column
                    column.setNullable(true);
                }

                table.addColumn(column);

                columnNumber++;
            }

            return(table);
        }
예제 #2
0
        // @Override
        public MutableColumn build()
        {
            MutableColumn column = new MutableColumn(_name);

            column.setType(detectType());
            if (_nulls)
            {
                column.setNullable(true);
            }
            return(column);
        }