Package prefuse.data.expression

Examples of prefuse.data.expression.Predicate


     * 'prefuse.data.CascadedTable.CascadedTable(Table,RowFilter)'
     */
    public void testCascadedTableTableRowFilter() {
        final float thresh = 5.0f;
       
        Predicate p = new AbstractPredicate() {
            public boolean getBoolean(Tuple t) {
                return t.getFloat(HEADERS[3]) < thresh;
            }
        };
       
View Full Code Here


     * @param predicate a String in the prefuse expression language. This
     *  String will be parsed to create a corresponding Predicate instance.
     * @param r the Renderer to return if an item matches the Predicate
     */
    public void add(String predicate, Renderer r) {
        Predicate p = (Predicate)ExpressionParser.parse(predicate);
        add(p, r);
    }
View Full Code Here

     * If the parse fails or does not result in a
     * {@link prefuse.data.expression.Predicate} instance, an exception will
     * be thrown.
     */
    public void setPredicate(String expr) {
        Predicate p = (Predicate)ExpressionParser.parse(expr, true);
        setPredicate(p);
    }
View Full Code Here

     * Test method for 'edu.berkeley.guir.prefuse.data.VisualItemTable.VisualItemTable(Table, RowFilter)'
     */
    public void testVisualItemTableTableRowFilter() {
        final float thresh = 5.0f;
       
        Predicate p = new AbstractPredicate() {
            public boolean getBoolean(Tuple t) {
                return t.getFloat(HEADERS[3]) < thresh;
            }
        };
       
View Full Code Here

    /*
     * Test method for 'prefuse.util.PredicateChain.add(Predicate, Object)'
     */
    public void testAdd() {
        Predicate p = (Predicate)ExpressionParser.parse("id=2");
        m_chain.add(p, new Integer(4));
        assertEquals(new Integer(4), m_chain.get(m_table.getTuple(1)));
    }
View Full Code Here

        assertFalse(m_chain.remove(p3));
    }

    public void testRemove2() {
        PredicateChain pc = new PredicateChain();
        Predicate p1 = (Predicate) ExpressionParser.parse("_fixed");
        Predicate p2 = (Predicate) ExpressionParser.parse("_highlight");
        pc.add(p1, new Integer(1));
        pc.add(p2, new Integer(2));
        assertTrue(pc.remove(p2));
    }
View Full Code Here

        // add the tree to the visualization
        VisualTree vt = m_vis.addTree(tree, t);
        m_vis.setVisible(treeEdges, null, false);
       
        // ensure that only leaf nodes are interactive
        Predicate noLeaf = (Predicate)ExpressionParser.parse("childcount()>0");
        m_vis.setInteractive(treeNodes, noLeaf, false);

        // add labels to the visualization
        // first create a filter to show labels only at top-level nodes
        Predicate labelP = (Predicate)ExpressionParser.parse("treedepth()=1");
        // now create the labels as decorators of the nodes
        m_vis.addDecorators(labels, treeNodes, labelP, LABEL_SCHEMA);
       
        // set up the renderers - one for nodes and one for labels
        DefaultRendererFactory rf = new DefaultRendererFactory();
View Full Code Here

        ColorAction nodeStroke = new ColorAction(Constants.TREE_NODES,
                                                 VisualItem.STROKECOLOR);
        nodeStroke.setDefaultColor(ColorManager.BORDER_COLOR_RGB);
        nodeStroke.add("_hover", ColorManager.BORDER_COLOR_RGB);

        Predicate noServiceItemFilter =
            ExpressionParser.predicate("state=="+Constants.ACTIVE_NO_SERVICE_ITEM);
        //nodeStroke.add(noServiceItemFilter,
        //               ColorManager.NO_SERVICE_ITEM_BORDER_COLOR_RGB);

        ColorAction nodeFill = new ColorAction(Constants.TREE_NODES,
                                               VisualItem.FILLCOLOR);
        nodeFill.add("_hover", ColorManager.HOVER_COLOR_RGB);

        /* Color predicates */
        nodeFill.add(rootFilter, ColorManager.ROOT_COLOR_RGB);
        //Predicate okayFilter =
        //    ExpressionParser.predicate(Constants.STATE+"=="+Constants.ACTIVE+" || " +
        //                               Constants.STATE+"=="+Constants.ACTIVE_NO_SERVICE_ITEM);
        Predicate okayFilter =
            ExpressionParser.predicate(Constants.STATE+"=="+Constants.ACTIVE);
        nodeFill.add(okayFilter,
                     ColorLib.color(colorManager.getOkayColor()));

        Predicate emptyFilter =
            ExpressionParser.predicate(Constants.STATE+"=="+Constants.EMPTY);
        nodeFill.add(emptyFilter, ColorManager.EMPTY_COLOR_RGB);

        Predicate ambiguousFilter =
            ExpressionParser.predicate(Constants.STATE+"=="+Constants.WARNING);
        nodeFill.add(ambiguousFilter,
                     ColorLib.color(colorManager.getWarningColor()));
        nodeFill.add(noServiceItemFilter,
                     ColorLib.color(colorManager.getWarningColor()));       
        Predicate failureFilter =
            ExpressionParser.predicate(Constants.STATE+"=="+Constants.FAILED);
        nodeFill.add(failureFilter,
                     ColorLib.color(colorManager.getFailureColor()));

        colorManager.setColorAction(nodeFill);
View Full Code Here

TOP

Related Classes of prefuse.data.expression.Predicate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.