当前位置: 首页>>代码示例>>Java>>正文


Java Schema类代码示例

本文整理汇总了Java中prefuse.data.Schema的典型用法代码示例。如果您正苦于以下问题:Java Schema类的具体用法?Java Schema怎么用?Java Schema使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Schema类属于prefuse.data包,在下文中一共展示了Schema类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getComparator

import prefuse.data.Schema; //导入依赖的package包/类
/**
 * Generates a Comparator to be used for sorting tuples drawn from
 * the given tuple set.
 * @param ts the TupleSet whose Tuples are to be sorted
 * @return a Comparator instance for sorting tuples from the given
 * set using the sorting criteria given in this specification
 */
public Comparator<Tuple> getComparator(TupleSet ts) {
    // get the schema, so we can lookup column value types        
    Schema s = null;
    if ( ts instanceof Table ) {
        // for Tables, we can get this directly
    	s = ((Table)ts).getSchema();
    } else {
    	// if non-table tuple set is empty, we punt
    	if ( ts.getTupleCount() == 0 )
    		return new NullComparator<Tuple>();
    	// otherwise, use the schema of the first tuple in the set
        s = ((Tuple)ts.tuples().next()).getSchema();
    }
    // create the comparator
    CompositeComparator<Tuple> cc = new CompositeComparator<Tuple>(m_fields.length);
    for ( int i=0; i<m_fields.length; ++i ) {
        cc.add(new TupleComparator(m_fields[i], s.getColumnType(m_fields[i]), m_ascend[i]));
    }
    return cc;
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:28,代码来源:Sort.java

示例2: getSchema

import prefuse.data.Schema; //导入依赖的package包/类
/**
    * Given the metadata for a SQL result set and a data value handler for that
    * result set, returns a corresponding schema for a prefuse table.
    * @param metadata the SQL result set metadata
    * @param handler the data value handler
    * @return the schema determined by the metadata and handler
    * @throws SQLException if an error occurs accessing the metadata
    */
   @SuppressWarnings("rawtypes")
public Schema getSchema(ResultSetMetaData metadata, SQLDataHandler handler)
       throws SQLException
   {
       int ncols = metadata.getColumnCount();
       Schema schema = new Schema(ncols);
       
       // determine the table schema
       for ( int i=1; i<=ncols; ++i ) {
           String name = metadata.getColumnName(i);
           int sqlType = metadata.getColumnType(i);
           Class type = handler.getDataType(name, sqlType);
           if ( type != null )
               schema.addColumn(name, type);
       }
       
       return schema;
   }
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:27,代码来源:DatabaseDataSource.java

示例3: getMinimalVisualSchema

import prefuse.data.Schema; //导入依赖的package包/类
/**
 * Get the minimal Schema needed for a unique VisualItem. Can be useful
 * for derived groups that inherit other visual properties from a
 * another visual data group.
 * @return the minimal VisualItem data Schema
 */
public static Schema getMinimalVisualSchema() {
    Schema s = new Schema();
    
    // booleans
    s.addColumn(VisualItem.VALIDATED, boolean.class, Boolean.FALSE);
    s.addColumn(VisualItem.VISIBLE, boolean.class, Boolean.TRUE);
    s.addColumn(VisualItem.STARTVISIBLE, boolean.class, Boolean.FALSE);
    s.addColumn(VisualItem.ENDVISIBLE, boolean.class, Boolean.TRUE);
    s.addColumn(VisualItem.INTERACTIVE, boolean.class, Boolean.TRUE);
    
    // bounding box
    s.addColumn(VisualItem.BOUNDS, Rectangle2D.class, new Rectangle2D.Double());
    
    return s;
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:22,代码来源:PrefuseLib.java

示例4: getAxisLabelSchema

import prefuse.data.Schema; //导入依赖的package包/类
/**
 * Get the VisualItem Schema used for axis tick marks and labels. Extends
 * the VisualItem Schema with an additional end-point coordinate, a
 * String label field, and numeric value field for storing the value
 * which the axis label corresponds to.
 * @return the Schema for axis tick marks and labels. 
 */
public static Schema getAxisLabelSchema() {
    Schema s = getVisualItemSchema();

    s.setDefault(VisualItem.STARTVISIBLE, Boolean.FALSE);
    
    Integer defColor = Integer.valueOf(ColorLib.gray(230));
    s.setInterpolatedDefault(VisualItem.STROKECOLOR, defColor);
    
    defColor = Integer.valueOf(ColorLib.gray(150));
    s.setInterpolatedDefault(VisualItem.TEXTCOLOR, defColor);

    Double nan = Double.valueOf(Double.NaN);
    s.addInterpolatedColumn(VisualItem.X2, double.class);
    s.addInterpolatedColumn(VisualItem.Y2, double.class);
    
    s.addColumn(VisualItem.LABEL, String.class);
    s.addColumn(VisualItem.VALUE, double.class, nan);
    
    return s;
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:28,代码来源:PrefuseLib.java

示例5: GranularityAggregationTree

import prefuse.data.Schema; //导入依赖的package包/类
public GranularityAggregationTree(Schema dataColumnSchema, int levelCount) throws TemporalDataException {
    // TODO handle int columns (canGetDouble but not canSetDouble) -> add as double columns
    // TODO handle boolean, Object columns -> exclude?

    super(dataColumnSchema);
    
    super.getNodeTable().addColumn(ParentChildNode.DEPTH, Integer.TYPE);
    additionalNonDataColums = new String[] {ParentChildNode.DEPTH};
    
    minValues = new double[dataColumnSchema.getColumnCount()][levelCount];
    maxValues = new double[dataColumnSchema.getColumnCount()][levelCount];
    int l=0;
    for(int k : getDataColumnIndices()) {
        if (getNodeTable().canGetDouble(k)) {
            for(int j=0; j<levelCount; j++) {
                minValues[l][j] = Double.MAX_VALUE;
                maxValues[l][j] = Double.MIN_VALUE;
            }
        }
        l++;
    }
    
    getNodeTable().addTableListener(new GranularityAggregationTreeListener());
}
 
开发者ID:ieg-vienna,项目名称:TimeBench,代码行数:25,代码来源:GranularityAggregationTree.java

示例6: getTable

import prefuse.data.Schema; //导入依赖的package包/类
/**
 * Create a new table for representing line segments.
 */
protected VisualTable getTable() {
    TupleSet ts = m_vis.getGroup(m_group);
    if ( ts == null ) {
        Schema lineSchema = PrefuseLib.getVisualItemSchema();
        lineSchema.addColumn(VisualItem.X2, double.class);
        lineSchema.addColumn(VisualItem.Y2, double.class);
        lineSchema.addColumn("v1", VisualItem.class);
        lineSchema.addColumn("v2", VisualItem.class);
        
        VisualTable vt = m_vis.addTable(m_group, lineSchema);
        return vt;
    } else if ( ts instanceof VisualTable ) {
        // empty table
        ts.clear();
        return (VisualTable)ts;
    } else {
        throw new IllegalStateException(
            "Group already exists, not being used for line segments");
    }
}
 
开发者ID:ieg-vienna,项目名称:ieg-prefuse,代码行数:24,代码来源:LinePlotAction.java

示例7: addGraph

import prefuse.data.Schema; //导入依赖的package包/类
/**
 * Adds a graph to this visualization, using the given data group
 * name. A visual abstraction of the data will be created and registered
 * with the visualization. An exception will be thrown if the group name
 * is already in use.
 * @param group the data group name for the visualized graph. The nodes
 * and edges will be available in the "group.nodes" and "group.edges"
 * subgroups.
 * @param graph the graph to visualize
 * @param filter a filter Predicate determining which data Tuples in the
 * input graph are visualized
 * @param nodeSchema the data schema to use for the visual node table
 * @param edgeSchema the data schema to use for the visual edge table
 */
public synchronized VisualGraph addGraph(String group, Graph graph,
        Predicate filter, Schema nodeSchema, Schema edgeSchema)
{
    checkGroupExists(group); // check before adding sub-tables
    String ngroup = PrefuseLib.getGroupName(group, Graph.NODES); 
    String egroup = PrefuseLib.getGroupName(group, Graph.EDGES);

    VisualTable nt, et;
    nt = addTable(ngroup, graph.getNodeTable(), filter, nodeSchema);
    et = addTable(egroup, graph.getEdgeTable(), filter, edgeSchema);
    
    VisualGraph vg = new VisualGraph(nt, et, 
            graph.isDirected(), graph.getNodeKeyField(),
            graph.getEdgeSourceField(), graph.getEdgeTargetField());
    vg.setVisualization(this);
    vg.setGroup(group);
 
    addDataGroup(group, vg, graph);
    
    TupleManager ntm = new TupleManager(nt, vg, TableNodeItem.class);
    TupleManager etm = new TupleManager(et, vg, TableEdgeItem.class);
    nt.setTupleManager(ntm);
    et.setTupleManager(etm);
    vg.setTupleManagers(ntm, etm);
    
    return vg;
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:42,代码来源:Visualization.java

示例8: addTree

import prefuse.data.Schema; //导入依赖的package包/类
/**
 * Adds a tree to this visualization, using the given data group
 * name. A visual abstraction of the data will be created and registered
 * with the visualization. An exception will be thrown if the group name
 * is already in use.
 * @param group the data group name for the visualized tree. The nodes
 * and edges will be available in the "group.nodes" and "group.edges"
 * subgroups.
 * @param tree the tree to visualize
 * @param filter a filter Predicate determining which data Tuples in the
 * input graph are visualized
 * @param nodeSchema the data schema to use for the visual node table
 * @param edgeSchema the data schema to use for the visual edge table
 */
public synchronized VisualTree addTree(String group, Tree tree,
        Predicate filter, Schema nodeSchema, Schema edgeSchema)
{
    checkGroupExists(group); // check before adding sub-tables
    String ngroup = PrefuseLib.getGroupName(group, Graph.NODES); 
    String egroup = PrefuseLib.getGroupName(group, Graph.EDGES);
    
    VisualTable nt, et;
    nt = addTable(ngroup, tree.getNodeTable(), filter, nodeSchema);
    et = addTable(egroup, tree.getEdgeTable(), filter, edgeSchema);

    VisualTree vt = new VisualTree(nt, et, tree.getNodeKeyField(),
            tree.getEdgeSourceField(), tree.getEdgeTargetField());
    vt.setVisualization(this);
    vt.setGroup(group);
    
    addDataGroup(group, vt, tree);
    
    TupleManager ntm = new TupleManager(nt, vt, TableNodeItem.class);
    TupleManager etm = new TupleManager(et, vt, TableEdgeItem.class);
    nt.setTupleManager(ntm);
    et.setTupleManager(etm);
    vt.setTupleManagers(ntm, etm);
    
    return vt;
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:41,代码来源:Visualization.java

示例9: AggregateTable

import prefuse.data.Schema; //导入依赖的package包/类
/**
 * Create a new AggregateTable.
 * @param vis the Visualization associated with the table
 * @param group the data group the table contents belongs to
 * @param schema the Schema to use for this table
 */
public AggregateTable(Visualization vis, String group, Schema schema) {
    super(vis, group, schema, TableAggregateItem.class);
    m_aggregated = AGGREGATED_SCHEMA.instantiate();
    m_aggregated.index(AGGREGATE);
    m_aggregated.index(MEMBER_HASH);
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:13,代码来源:AggregateTable.java

示例10: VisualTable

import prefuse.data.Schema; //导入依赖的package包/类
/**
    * Create a new VisualTable without a parent table.
    * @param vis the Visualization associated with this table
    * @param group the data group of this table
    * @param schema the data schema to use for the table's local columns
    * @param tupleType the type of Tuple instances to use
    */
   @SuppressWarnings("rawtypes")
public VisualTable(Visualization vis, String group, Schema schema,
           Class tupleType)
   {
       super(tupleType);
       init(vis, group, schema);
   }
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:15,代码来源:VisualTable.java

示例11: init

import prefuse.data.Schema; //导入依赖的package包/类
/**
 * Initialize this VisualTable
 * @param vis the Visualization associated with this table
 * @param group the data group of this table
 * @param schema the data schema to use for the table's local columns
 */
protected void init(Visualization vis, String group, Schema schema) {
    setVisualization(vis);
    setGroup(group);
    addColumns(schema);
    if ( canGetBoolean(VisualItem.VISIBLE) )
        index(VisualItem.VISIBLE);
    if ( canGetBoolean(VisualItem.STARTVISIBLE) )
        index(VisualItem.STARTVISIBLE);
    if ( canGetBoolean(VisualItem.VALIDATED) )
        index(VisualItem.VALIDATED);
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:18,代码来源:VisualTable.java

示例12: addColumns

import prefuse.data.Schema; //导入依赖的package包/类
/**
 * @see prefuse.data.tuple.TupleSet#addColumns(prefuse.data.Schema)
 */
public void addColumns(Schema schema) {
    if ( isAddColumnSupported() ) {
        for ( int i=0; i<schema.getColumnCount(); ++i ) {
            try {
                addColumn(schema.getColumnName(i), 
                          schema.getColumnType(i),
                          schema.getDefault(i));
            } catch ( IllegalArgumentException iae ) {}
        }
    } else {
        throw new UnsupportedOperationException();
    }
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:17,代码来源:AbstractTupleSet.java

示例13: getType

import prefuse.data.Schema; //导入依赖的package包/类
/**
    * @see prefuse.data.expression.Expression#getType(prefuse.data.Schema)
    */
   @SuppressWarnings({ "unchecked", "rawtypes" })
public Class getType(Schema s) {
       Class type1 = m_then.getType(s);
       Class type2 = m_else.getType(s);
       return TypeLib.getSharedType(type1, type2);
   }
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:10,代码来源:IfExpression.java

示例14: getType

import prefuse.data.Schema; //导入依赖的package包/类
/**
 * @see prefuse.data.expression.Expression#getType(prefuse.data.Schema)
 */
public Class getType(Schema s) {
    if ( m_type == null ) {
        Class lType = m_left.getType(s);
        Class rType = m_right.getType(s);
    
        // determine this class's type
        m_type = TypeLib.getNumericType(lType, rType);
    }
    return m_type;
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:14,代码来源:ArithmeticExpression.java

示例15: printSchema

import prefuse.data.Schema; //导入依赖的package包/类
/**
     * Print a table schema to a GraphML file
     * @param xml the XMLWriter to write to
     * @param group the data group (node or edge) for the schema
     * @param s the schema
     */
    private void printSchema(XMLWriter xml, String group, Schema s,
                             String[] ignore)
    {
        String[] attr = new String[] {Tokens.ID, Tokens.FOR,
                Tokens.ATTRNAME, Tokens.ATTRTYPE };
        String[] vals = new String[4];

OUTER:
        for ( int i=0; i<s.getColumnCount(); ++i ) {
            vals[0] = s.getColumnName(i);
            
            for ( int j=0; ignore!=null && j<ignore.length; ++j ) {
                if ( vals[0].equals(ignore[j]) )
                    continue OUTER;
            }
            
            vals[1] = group;
            vals[2] = vals[0];
            vals[3] = (String)TYPES.get(s.getColumnType(i));
            Object dflt = s.getDefault(i);
            
            if ( dflt == null ) {
                xml.tag(Tokens.KEY, attr, vals, 4);
            } else {
                xml.start(Tokens.KEY, attr, vals, 4);
                xml.contentTag(Tokens.DEFAULT, dflt.toString());
                xml.end();
            }
        }
    }
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:37,代码来源:GraphMLWriter.java


注:本文中的prefuse.data.Schema类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。