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


Java Predicate类代码示例

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


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

示例1: run

import prefuse.data.expression.Predicate; //导入依赖的package包/类
@Override
public void run( Graph graph )
{
    // add the GRAPH to the visualization
    m_vis.add( GRAPH, graph );

    // hide edges
    Predicate edgesPredicate = (Predicate) ExpressionParser.parse( "ingroup('graph.edges') AND [" + USES_EDGES + "]==false", true );
    m_vis.setVisible( GRAPH_EDGES, edgesPredicate, false );

    m_vis.setInteractive( GRAPH_EDGES, null, false );

    // make node interactive
    m_vis.setInteractive( GRAPH_NODES, null, true );

    // add LABELS to the visualization
    Predicate labelP = (Predicate) ExpressionParser.parse( "VISIBLE()" );
    m_vis.addDecorators( LABELS, GRAPH_NODES, labelP, LABEL_SCHEMA );

    run();
}
 
开发者ID:apache,项目名称:polygene-java,代码行数:22,代码来源:StackedGraphDisplay.java

示例2: XorExpression

import prefuse.data.expression.Predicate; //导入依赖的package包/类
static final public Expression XorExpression() throws ParseException {
Expression l, r;
  l = AndExpression();
  label_2:
  while (true) {
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case XOR:
      ;
      break;
    default:
      jj_la1[2] = jj_gen;
      break label_2;
    }
    jj_consume_token(XOR);
    r = AndExpression();
    if ( l instanceof XorPredicate ) {
        ((XorPredicate)l).add((Predicate)r);
    } else {
        l = new XorPredicate((Predicate)l,(Predicate)r);
    }
  }
     {if (true) return l;}
  throw new Error("Missing return statement in function");
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:25,代码来源:ExpressionParser.java

示例3: tuples

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

示例4: getAndIterator

import prefuse.data.expression.Predicate; //导入依赖的package包/类
protected static IntIterator getAndIterator(Table t, AndPredicate ap) {
    // possible TODO: add scoring to select best optimized iterator
    // for now just work from the end backwards and take the first
    // optimized iterator we find
    IntIterator rows = null;
    Predicate clause = null;
    for ( int i=ap.size(); --i >= 0; ) {
        clause = ap.get(i);
        if ( (rows=getOptimizedIterator(t,clause)) != null )
            break;
    }
    
    // exit if we didn't optimize
    if ( rows == null ) return null;
    
    // if only one clause, no extras needed
    if ( ap.size() == 1 ) return rows;
    
    // otherwise get optimized source, run through other clauses
    return new FilterRowIterator(rows, t, ap.getSubPredicate(clause));
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:22,代码来源:FilterIteratorFactory.java

示例5: GridMinusCircle

import prefuse.data.expression.Predicate; //导入依赖的package包/类
public GridMinusCircle(double circle_r, String m_group, String filter)
{
	super(m_group);
	this.line_spacing = 10;
	this.circle_r = circle_r;
	this.find_circle_center = true;
	filter = filter + " and visible() and isnode()";
	this.m_filter = (Predicate)ExpressionParser.parse(filter);
}
 
开发者ID:codydunne,项目名称:netgrok,代码行数:10,代码来源:GridMinusCircle.java

示例6: setFilterPredicate

import prefuse.data.expression.Predicate; //导入依赖的package包/类
public void setFilterPredicate(Predicate p)
{
	ip_graph_lock.lock();
	filter_predicate = p;
	updateFilterColumn();
	ip_graph_lock.unlock();
}
 
开发者ID:codydunne,项目名称:netgrok,代码行数:8,代码来源:Data.java

示例7: add

import prefuse.data.expression.Predicate; //导入依赖的package包/类
/**
 * Add a data set 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 data
 * @param data the data to visualize
 * @param filter a filter Predicate determining which data Tuples in the
 * input data set are visualized
 * @return a visual abstraction of the input data, a VisualTupleSet
 * instance
 */
public synchronized VisualTupleSet add(
        String group, TupleSet data, Predicate filter)
{
    if ( data instanceof Table ) {
        return addTable(group, (Table)data, filter);
    } else if ( data instanceof Tree ) {
        return addTree(group, (Tree)data, filter);
    } else if ( data instanceof Graph ) {
        return addGraph(group, (Graph)data, filter);
    } else {
        throw new IllegalArgumentException("Unsupported TupleSet type.");
    }
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:26,代码来源:Visualization.java

示例8: addGraph

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

示例9: addTree

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

示例10: items

import prefuse.data.expression.Predicate; //导入依赖的package包/类
/**
    * Get an iterator over all items in the given group which match the given
    * Predicate filter.
    * @param group the visual data group to iterate over
    * @param filter a Predicate indicating which items should be included in
    * the iteration.
    * @return a filtered iterator over VisualItems
    */
   @SuppressWarnings("unchecked")
public Iterator<VisualItem> items(String group, Predicate filter) {
       if ( ALL_ITEMS.equals(group) )
           return items(filter);

       TupleSet t = getGroup(group);
       return (Iterator<VisualItem>) ( t==null ? Collections.<VisualItem>emptyList().iterator() 
                        : t.tuples(filter) );
   }
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:18,代码来源:Visualization.java

示例11: setVisible

import prefuse.data.expression.Predicate; //导入依赖的package包/类
/**
 * Sets the visbility status for all items in a given data group matching
 * a given filter predicate.
 * @param group the visual data group name
 * @param p the filter predicate determining which items to modify
 * @param value the visibility value to set
 */
public void setVisible(String group, Predicate p, boolean value) {
    Iterator<VisualItem> items = items(group, p);
    while ( items.hasNext() ) {
        VisualItem item = items.next();
        item.setVisible(value);
    }
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:15,代码来源:Visualization.java

示例12: setInteractive

import prefuse.data.expression.Predicate; //导入依赖的package包/类
/**
 * Sets the interactivity status for all items in a given data group
 * matching a given filter predicate.
 * @param group the visual data group name
 * @param p the filter predicate determining which items to modify
 * @param value the interactivity value to set
 */
public void setInteractive(String group, Predicate p, boolean value) {
    Iterator<VisualItem> items = items(group, p);
    while ( items.hasNext() ) {
        VisualItem item = items.next();
        item.setInteractive(value);
    }
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:15,代码来源:Visualization.java

示例13: PDisplay

import prefuse.data.expression.Predicate; //导入依赖的package包/类
/**
 * Creates a new Display associated with the given Visualization that draws all VisualItems in the visualization that pass the given Predicate.
 * 
 * @param visualization
 *            the {@link Visualization} backing this Display
 * @param predicate
 *            the filtering {@link prefuse.data.expression.Predicate}
 */
public PDisplay(Context context, Visualization visualization, Predicate predicate)
{
	super(context);
	// setDoubleBuffered(false);
	setBackgroundColor(android.graphics.Color.WHITE);

	// initialize text editor
	m_editing = false;
	m_editor = new EditText(context);
	m_editor.setVisibility(View.GONE);

	// register input event capturer TODO for Dritan: implement Event

	// Sets up interactions
	mScaleGestureDetector = new ScaleGestureDetector(context, mScaleGestureListener);
	mGestureDetector = new GestureDetectorCompat(context, mGestureListener);

	// invalidate the display when the filter changes
	m_predicate.addExpressionListener(new UpdateListener()
	{
		public void update(Object src)
		{
			damageReport();
		}
	});

	setVisualization(visualization);
	setPredicate(predicate);
	setSize(400, 400); // set a default size
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:39,代码来源:PDisplay.java

示例14: getPredicate

import prefuse.data.expression.Predicate; //导入依赖的package包/类
/**
 * Returns the filtering Predicate used to control what items are drawn by this display.
 * 
 * @return the filtering {@link prefuse.data.expression.Predicate}
 */
public Predicate getPredicate()
{
	if (m_predicate.size() == 1)
	{
		return BooleanLiteral.TRUE;
	} else
	{
		return m_predicate.get(0);
	}
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:16,代码来源:PDisplay.java

示例15: setPredicate

import prefuse.data.expression.Predicate; //导入依赖的package包/类
/**
 * Sets the filtering Predicate used to control what items are drawn by this Display.
 * 
 * @param p
 *            the filtering {@link prefuse.data.expression.Predicate} to use
 */
public synchronized void setPredicate(Predicate p)
{
	if (p == null)
	{
		m_predicate.set(VisiblePredicate.TRUE);
	} else
	{
		m_predicate.set(new Predicate[]
		{ p, VisiblePredicate.TRUE });
	}
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:18,代码来源:PDisplay.java


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