@Override public void remove() { it.remove(); } }
@Override public int nextRow() { currentRow = it.nextInt(); return currentRow; }
@Override public boolean hasNext() { return it.hasNext(); }
@Override public Object next() { return it.next(); }
public ObviousWekaInstances(Table table, String name, FastVector attInfo, int cap) { super(name, attInfo, cap); this.table = table; IntIterator iter = this.table.rowIterator(); while(iter.hasNext()) { m_Instances.addElement(new ObviousWekaInstance( new TupleImpl(table, iter.nextInt()), this)); } for (int i = 0; i < table.getSchema().getColumnCount(); i++) { m_Attributes.addElement(attribute(i)); } }
@Override public Attribute attribute(int index) { if (index >= table.getSchema().getColumnCount()) { return null; } FastVector fastVect = new FastVector(); Class<?> c = table.getSchema().getColumnType(index); IntIterator iter = table.rowIterator(); while (iter.hasNext()) { int row = iter.nextInt(); if (!fastVect.contains(table.getValue(row, index))) { fastVect.addElement(table.getValue(row, index)); } } if (ObviousWekaUtils.isNumeric(c)) { return new Attribute(table.getSchema().getColumnName(index)); } else if (ObviousWekaUtils.isString(c)) { return new Attribute(table.getSchema().getColumnName(index), fastVect); } else if (ObviousWekaUtils.isDate(c)) { return new Attribute(table.getSchema().getColumnName(index), "yyyy-MM-dd", null); } return new Attribute(table.getSchema().getColumnName(index)); }