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


Java TupleSet类代码示例

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


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

示例1: mousePressed

import prefuse.data.tuple.TupleSet; //导入依赖的package包/类
public void mousePressed(MouseEvent e) {
	if (!SwingUtilities.isLeftMouseButton(e))
		return;
	Display d = (Display) e.getComponent();
	Visualization vis = d.getVisualization();
	TupleSet focus = vis.getFocusGroup(SELECTED);
	if (!e.isShiftDown()) {
		focus.clear();
	}
	float[] bandRect = (float[]) rubberBand.get(VisualItem.POLYGON);
	bandRect[0] = bandRect[1] = bandRect[2] = bandRect[3] =
	bandRect[4] = bandRect[5] = bandRect[6] = bandRect[7] = 0;
	d.setHighQuality(false);
	screenPoint.setLocation(e.getX(), e.getY());
	d.getAbsoluteCoordinate(screenPoint, absPoint);
	downX1 = (int) absPoint.getX();
	downY1 = (int) absPoint.getY();
	rubberBand.setVisible(true);
}
 
开发者ID:codydunne,项目名称:netgrok,代码行数:20,代码来源:GraphEditor.java

示例2: run

import prefuse.data.tuple.TupleSet; //导入依赖的package包/类
@Override
public void run(double frac) {
	// TODO Auto-generated method stub
       Rectangle2D b = getLayoutBounds();
       double bx = b.getMinX(), by = b.getMinY();
       double w = b.getWidth(), h = b.getHeight();
       
       TupleSet ts = m_vis.getGroup(m_group);
       
       Iterator<?> iter = ts.tuples();
       // layout grid contents
       while ( iter.hasNext() ) {
           VisualItem item = (VisualItem)iter.next();
           item.setVisible(true);
           int i = getIndex(item);
           double radius = Math.sqrt((double)i) * 25.0;
           double angle = Math.sqrt((double)i) * Math.PI;
           double x = bx + w/2 + (radius * Math.sin(angle));
           double y = by + h/2 + (radius * Math.cos(angle));
           setX(item,null,x);
           setY(item,null,y);
       }

}
 
开发者ID:codydunne,项目名称:netgrok,代码行数:25,代码来源:SimpleSpiralLayout.java

示例3: getComparator

import prefuse.data.tuple.TupleSet; //导入依赖的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

示例4: tuples

import prefuse.data.tuple.TupleSet; //导入依赖的package包/类
/**
 * Get a filtered iterator over the tuples in the given set,
 * filtered by the given predicate.
 * @param ts the TupleSet to iterate over
 * @param p the filter predicate
 * @return a filtered iterator over the tuples
 */
public static Iterator<Tuple> tuples(TupleSet ts, Predicate p) {
    // no predicate means no filtering
    if ( p == null )
        return ts.tuples();
    
    // attempt to generate an optimized query plan
    Iterator<Tuple> iter = null;
    if ( ts instanceof Table ) {
        Table t = (Table)ts;
        IntIterator ii = getOptimizedIterator(t,p);
        if ( ii != null )
            iter = t.tuples(ii);
    }
    
    // optimization fails, scan the entire table
    if ( iter == null ) {
        iter = new FilterIterator(ts.tuples(), p);
    }
    
    return iter;
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:29,代码来源:FilterIteratorFactory.java

示例5: inferType

import prefuse.data.tuple.TupleSet; //导入依赖的package包/类
/**
 * Infer the data field type across all tuples in a TupleSet.
 * @param tuples the TupleSet to analyze
 * @param field the data field to type check
 * @return the inferred data type
 * @throws IllegalArgumentException if incompatible types are used
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
public static Class inferType(TupleSet tuples, String field) {
    if ( tuples instanceof Table ) {
        return ((Table)tuples).getColumnType(field);
    } else {
        Class type = null, type2 = null;
        Iterator iter = tuples.tuples();
        while ( iter.hasNext() ) {
            Tuple t = (Tuple)iter.next();
            if ( type == null ) {
                type = t.getColumnType(field);
            } else if ( !type.equals(type2=t.getColumnType(field)) ) {
                if ( type2.isAssignableFrom(type) ) {
                    type = type2;
                } else if ( !type.isAssignableFrom(type2) ) {
                    throw new IllegalArgumentException(
                       "The data field ["+field+"] does not have " +
                       "a consistent type across provided Tuples");    
                }
            }
        }
        return type;
    }
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:32,代码来源:DataLib.java

示例6: getDistribution

import prefuse.data.tuple.TupleSet; //导入依赖的package包/类
/**
 * Computes the distribution (either min/max or quantile values) used to
 * help assign colors to data values.
 */
protected double[] getDistribution() {
    TupleSet ts = m_vis.getGroup(m_group);

    if ( m_type == Constants.NUMERICAL ) {
        m_omap = null;
        if ( m_scale == Constants.QUANTILE_SCALE && m_bins > 0 ) {
            double[] values =
                    DataLib.toDoubleArray(ts.tuples(), m_dataField);
            return MathLib.quantiles(m_bins, values);
        } else {
            double[] dist = new double[2];
            dist[0] = DataLib.min(ts, m_dataField).getDouble(m_dataField);
            dist[1] = DataLib.max(ts, m_dataField).getDouble(m_dataField);
            return dist;
        }
    } else {
        if ( m_olist == null ) 
            m_omap = DataLib.ordinalMap(ts, m_dataField);
        return new double[] { 0, m_omap.size()-1 };
    }
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:26,代码来源:DataColorAction.java

示例7: getDataType

import prefuse.data.tuple.TupleSet; //导入依赖的package包/类
/**
 * Retrieve the data type.
 */
protected int getDataType(TupleSet ts) {
    if ( m_type == Constants.UNKNOWN ) {
        boolean numbers = true;
        if ( ts instanceof Table ) {
            numbers = ((Table)ts).canGetDouble(m_field);
        } else {
            for ( Iterator it = ts.tuples(); it.hasNext(); ) {
                if ( !((Tuple)it.next()).canGetDouble(m_field) ) {
                    numbers = false;
                    break;
                }
            }
        }
        if ( numbers ) {
            return Constants.NUMERICAL;
        } else {
            return Constants.ORDINAL;
        }
    } else {
        return m_type;
    }
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:26,代码来源:AxisLayout.java

示例8: ordinalLayout

import prefuse.data.tuple.TupleSet; //导入依赖的package包/类
/**
 * Compute an ordinal axis layout.
 */
protected void ordinalLayout(TupleSet ts) {
    if ( !m_modelSet) {
        Object[] array = DataLib.ordinalArray(ts, m_field);
        
        if ( m_model == null ) {
            m_model = new ObjectRangeModel(array);
        } else {
            ((ObjectRangeModel)m_model).setValueRange(array);
        }
    }
    
    ObjectRangeModel model = (ObjectRangeModel)m_model;
    int start = model.getValue();
    int end = start + model.getExtent();
    double total = (double)(end-start);
    
    Iterator<VisualItem> iter = m_vis.items(m_group, m_filter);
    while ( iter.hasNext() ) {
        VisualItem item = iter.next();
        int order = model.getIndex(item.get(m_field)) - start;
        set(item, (total > 0.0) ? order/total : 0.5);
    }
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:27,代码来源:AxisLayout.java

示例9: run

import prefuse.data.tuple.TupleSet; //导入依赖的package包/类
public void run(double frac) {
	TupleSet focus = m_vis.getGroup(Visualization.FOCUS_ITEMS);
	if (focus == null || focus.getTupleCount() == 0)
		return;

	Graph g = (Graph) m_vis.getGroup(m_group);
	Node f = null;
	Iterator tuples = focus.tuples();
	while (tuples.hasNext()
			&& !g.containsTuple(f = (Node) tuples.next())) {
		f = null;
	}
	if (f == null)
		return;
	g.getSpanningTree(f);
}
 
开发者ID:jdepend,项目名称:cooper,代码行数:17,代码来源:GraphJDepend.java

示例10: ordinalLayout

import prefuse.data.tuple.TupleSet; //导入依赖的package包/类
protected void ordinalLayout(TupleSet ts) {

            if (!m_modelSet) {
                Object[] array = DataLib.ordinalArray(ts, super.getDataField());

                if (m_model == null) {
                    m_model = new ObjectRangeModel(array);
                } else {
                    ((ObjectRangeModel) m_model).setValueRange(array);
                }
            }

            ObjectRangeModel model = (ObjectRangeModel) m_model;
            int start = model.getValue();
            int end = start + model.getExtent();
            double total = (double) (end - start);

            @SuppressWarnings("rawtypes")
            Iterator iter = m_vis.items(m_group, m_filter);
            while (iter.hasNext()) {
                VisualItem item = (VisualItem) iter.next();
                int order = model.getIndex(item.get(super.getDataField()))
                        - start;
                set(item, (total > 0.0) ? 1 - order / total : 0.5);
            }
        }
 
开发者ID:ieg-vienna,项目名称:TimeBench,代码行数:27,代码来源:GanttDemo.java

示例11: run

import prefuse.data.tuple.TupleSet; //导入依赖的package包/类
@Override
public void run(double frac) {
       TupleSet ts = m_vis.getGroup(m_group);
       
       if(!(ts instanceof VisualGraph))
       	throw new UnsupportedOperationException();
       
       setMinMax();
       
       switch ( getDataType(((VisualGraph)ts).getNodes()) ) {
       case Constants.NUMERICAL:
           numericalLayout((VisualGraph)ts);
           break;
       default:
           ordinalLayout((VisualGraph)ts);
       }
}
 
开发者ID:ieg-vienna,项目名称:ieg-prefuse,代码行数:18,代码来源:TreeRangeAxisLayout.java

示例12: getTable

import prefuse.data.tuple.TupleSet; //导入依赖的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

示例13: setSelectedValue

import prefuse.data.tuple.TupleSet; //导入依赖的package包/类
/**
 * select the specified object
 *
 * @param object the object to select eg: Descriptor
 */
@Override
public void setSelectedValue( Object object )
{
    if( object == null )
    {
        return;
    }

    VisualItem item = null;

    Iterator iter = m_vis.items( GRAPH_NODES );
    while( iter.hasNext() )
    {
        VisualItem tItem = (VisualItem) iter.next();
        Object tObj = tItem.get( USER_OBJECT );
        if( tObj.equals( object ) )
        {
            item = tItem;
            break;
        }
    }

    if( item != null )
    {
        TupleSet ts = m_vis.getFocusGroup( Visualization.FOCUS_ITEMS );
        ts.setTuple( item );
        m_vis.run( FILTER_ACTION );
    }
}
 
开发者ID:apache,项目名称:polygene-java,代码行数:35,代码来源:TreeGraphDisplay.java

示例14: run

import prefuse.data.tuple.TupleSet; //导入依赖的package包/类
public void run(double frac) {
    TupleSet ts = m_vis.getFocusGroup(Visualization.FOCUS_ITEMS);
    if ( ts.getTupleCount() == 0 )
        return;
    
    if ( this.start ) {
    	this.start = false;
        int xbias=0, ybias=0;
        switch ( m_orientation ) {
        case Constants.ORIENT_LEFT_RIGHT:
            xbias = m_bias;
            break;
        case Constants.ORIENT_RIGHT_LEFT:
            xbias = -m_bias;
            break;
        case Constants.ORIENT_TOP_BOTTOM:
            ybias = m_bias;
            break;
        case Constants.ORIENT_BOTTOM_TOP:
            ybias = -m_bias;
            break;
        }

        VisualItem vi = (VisualItem)ts.tuples().next();
        m_cur.setLocation(getWidth()/2, getHeight()/2);
        getAbsoluteCoordinate(m_cur, m_start);
        m_end.setLocation(vi.getX()+xbias, vi.getY()+ybias);
    } else {
        m_cur.setLocation(m_start.getX() + frac*(m_end.getX()-m_start.getX()),
                          m_start.getY() + frac*(m_end.getY()-m_start.getY()));
        panToAbs(m_cur);
    }
}
 
开发者ID:luox12,项目名称:onecmdb,代码行数:34,代码来源:CommonTreeView.java

示例15: setFocus

import prefuse.data.tuple.TupleSet; //导入依赖的package包/类
public void setFocus(Node n) {
	 TupleSet ts = m_vis.getFocusGroup(Visualization.FOCUS_ITEMS);
	 ts.clear();
	 VisualItem item = m_vis.getVisualItem(nodes, n);

	 if (item != null) {
    	 ts.setTuple(item);
     }
}
 
开发者ID:luox12,项目名称:onecmdb,代码行数:10,代码来源:GraphView.java


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