/** * Indicates if a given value is correct. * @param rowId row index * @param col column index * @return true if the coordinates are valid */ public boolean isValueValid(int rowId, int col) { return isValidRow(rowId) && (col < schema.getColumnCount()); }
@Override public int numValues() { return tuple.getSchema().getColumnCount(); }
@Override public int getColumnCount() { return table.getSchema().getColumnCount(); }
/** * Returns the number of columns in the model. * A JTable uses this method to determine how many columns it should create * and display by default. * @return the number of columns in the model */ public int getColumnCount() { return this.table.getSchema().getColumnCount(); }
@Override public int getColumnCount() { return table.getSchema().getColumnCount(); }
@Override public int getColumnCount() { return tuple.getSchema().getColumnCount(); }
@Override public String toString() { StringBuffer text = new StringBuffer(); for (int i = 0; i < tuple.getSchema().getColumnCount(); i++) { if (i > 0) text.append(","); text.append(tuple.get(i)); } return text.toString(); }
@Override public double[] toDoubleArray() { for (int i = tuple.getSchema().getColumnCount() - 1; i >= 0; i--) { m_AttValues[i] = this.value(i); } return m_AttValues; }
/** * Constructor. * @param tuple an obvious tuple */ public ObviousWekaInstance(Tuple tuple, Instances instances) { this.tuple = tuple; this.instances = instances; this.m_Dataset = this.instances; this.m_Weight = 1.0; this.m_AttValues = new double[tuple.getSchema().getColumnCount()]; this.m_AttValues = toDoubleArray(); }
/** * Constructor that used Obvious Schema to wrap Prefuse Tables. * @param schema original obvious schema for the table */ public PrefuseObviousTable(Schema schema) { this.table = new prefuse.data.Table(0, schema.getColumnCount()); this.listener = new ArrayList<TableListener>(); for (int i = 0; i < schema.getColumnCount(); i++) { this.table.addColumn(schema.getColumnName(i), schema.getColumnType(i), schema.getColumnDefault(i)); } }
@Override public Node addNode() { Object[] values = new Object[nodeSchema.getColumnCount()]; for (int i = 0; i < nodeSchema.getColumnCount(); i++) { values[i] = nodeSchema.getColumnDefault(i); } NodeImpl node = new NodeImpl(nodeSchema, values); network.addNode(node); return new WrapToPrefNode(network, node, getNodeCount()); }
@Override public int addEdge(int s, int t) { obvious.data.Node source = getObviousNode(s); obvious.data.Node target = getObviousNode(t); Object[] values = new Object[nodeSchema.getColumnCount()]; for (int i = 0; i < edgeSchema.getColumnCount(); i++) { values[i] = edgeSchema.getColumnDefault(i); } EdgeImpl edge = new EdgeImpl(edgeSchema, values); network.addEdge(edge, source, target, Graph.EdgeType.DIRECTED); return getEdgeCount(); }
@Override public void replaceMissingValues(double[] arg0) { for (int i = 0; i < tuple.getSchema().getColumnCount(); i++) { if (isMissing(i)) { tuple.set(i, arg0[i]); } } }
@Override public boolean checkForAttributeType(int attType) { for (int i = 0; i < table.getSchema().getColumnCount(); i++) { if (attribute(i).type() == attType) { return true; } } return false; }
@Override public Tuple addTuple(Tuple arg0) { Object[] values = new Object[table.getSchema().getColumnCount()]; obvious.data.Tuple obviousTuple = new TupleImpl(table.getSchema(), values); int r = table.addRow(obviousTuple); return this.getTuple(r); }
protected Instances createInstances() { FastVector attributes = new FastVector(); for (int i = 0; i < schema.getColumnCount(); i++) { Attribute attribute = createAttribute(schema.getColumnName(i), schema.getColumnType(i)); attributes.addElement(attribute); } return new Instances("test", attributes, 1); }
/** * Creates attributes vector from an obvious table. * @return vector from attributes */ protected FastVector createAttributes() { FastVector attributes = new FastVector(); for (int i = 0; i < table.getSchema().getColumnCount(); i++) { attributes.addElement(createAttribute(table.getSchema().getColumnName(i), table.getSchema().getColumnType(i))); } return attributes; }
@Override public Schema getSchema() { int colCount = table.getSchema().getColumnCount(); String[] names = new String[colCount]; Class<?>[] classes = new Class[colCount]; Object[] values = new Object[colCount]; for (int i = 0; i < colCount; i++) { names[i] = table.getSchema().getColumnName(i); classes[i] = table.getSchema().getColumnType(i); values[i] = table.getSchema().getColumnDefault(i); } return new Schema(names, classes, values); }
/** * Constructor. * @param inTable wrapped obvious table */ public WrapToPrefTable(Table inTable) { this.table = inTable; for (int i = 0; i < table.getSchema().getColumnCount(); i++) { addColumn(table.getSchema().getColumnName(i), table.getSchema().getColumnType(i), table.getSchema().getColumnDefault(i)); } m_rows = new WrapToPrefRowManager(this); }
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)); } }