public Object getValueAt(int row, int column) { if (row >= getRowCount()) return null; if (column >= getProperties().length) return null; List values = getPropertyValues()[column]; if (row >= values.size()) return null; return values.get(row); }
public void parseXMLProperties(NodeList nodes) throws Exception { boolean update = getProperties().length > 0; List<DataProperty> result = _parseXMLProperties(nodes, update); if (!update) { setPropertySize(result.size()); for (int i = 0; i < result.size(); i++) { DataProperty p = result.get(i); addProperty(p, i); } } }
public int sizeOf() { int nrows = getRowCount(); if (nrows == 0) return 0; SizeEstimations sizeEstimator = SizeEstimations.lookup(); int ncells = nrows * getProperties().length; int result = ncells * 4; DataProperty[] props = getProperties(); for (int i = 0; i < props.length; i++) { Object firstRowValue = getValueAt(0, i); if (firstRowValue instanceof String) { for (int j = 0; j < nrows; j++) { String stringValue = (String) getValueAt(j, i); result += sizeEstimator.sizeOfString(stringValue); } } else { int singleValueSize = sizeEstimator.sizeOf(firstRowValue); result += nrows * singleValueSize; } } return result; }
public void formatXMLProperties(PrintWriter out, int indent) throws Exception { printIndent(out, indent++); out.println("<dataproperties>"); DataProperty[] properties = getProperties(); for (DataProperty property : properties) { printIndent(out, indent++); out.println("<dataproperty id=\"" + StringEscapeUtils.escapeXml(property.getPropertyId()) + "\">"); printIndent(out, indent); Domain domain = property.getDomain(); String convertedFromNumeric = ""; if (domain instanceof LabelDomain && ((LabelDomain)domain).isConvertedFromNumeric()) convertedFromNumeric = " convertedFromNumeric=\"true\" "; out.println("<domain" + convertedFromNumeric + ">" + StringEscapeUtils.escapeXml(property.getDomain().getClass().getName()) + "</domain>"); Map<Locale,String> names = property.getNameI18nMap(); if (names != null) { for (Locale locale : names.keySet()) { printIndent(out, indent); out.println("<name language=\"" + locale + "\">" + StringEscapeUtils.escapeXml(names.get(locale)) + "</name>"); } } printIndent(out, --indent); out.println("</dataproperty>"); } printIndent(out, --indent); out.println("</dataproperties>"); }
protected DataSet _filterInMemory(DataFilter filter) throws Exception { if (getRowCount() == 0 || getProperties().length == 0 || filter == null) return null; String[] filterPropertyIds = filter.getPropertyIds(); if (filterPropertyIds.length == 0) return null;