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


Java ExpressionParser类代码示例

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


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

示例1: run

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

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

示例3: addColumn

import prefuse.data.expression.parser.ExpressionParser; //导入依赖的package包/类
/**
 * Adds the value to all contained TupleSets that return a true value for
 * {@link TupleSet#isAddColumnSupported()}.
 * @see prefuse.data.tuple.TupleSet#addColumn(java.lang.String, java.lang.String)
 */
public void addColumn(String name, String expr) {
    Expression ex = ExpressionParser.parse(expr);
    Throwable t = ExpressionParser.getError();
    if ( t != null ) {
        throw new RuntimeException(t);
    } else {
        addColumn(name, ex);
    }
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:15,代码来源:CompositeTupleSet.java

示例4: setNewMetadataColorAction

import prefuse.data.expression.parser.ExpressionParser; //导入依赖的package包/类
public void setNewMetadataColorAction(HashMap<String, Color> map,
		Color iColor, Color mColor) {
	this.stopActions();
	ActionList fill = new ActionList();
	ColorAction fc1 = new ColorAction("graph.nodes", mPredicateIdentifier,
			VisualItem.FILLCOLOR, ColorLib.color(iColor));
	ColorAction fc2 = new ColorAction("graph.nodes", mPredicateMetadata,
			VisualItem.FILLCOLOR, ColorLib.color(mColor));
	fill.add(fc1);
	fill.add(fc2);
	if (map != null && map.size() > 0) {
		ArrayList<String> arr = new ArrayList<String>();
		arr.addAll(map.keySet());

		int[] palette = new int[arr.size()];
		int i = 0;
		for (String key : arr) {
			Color c = map.get(key);
			palette[i] = ColorLib.color(c);
			Predicate predicate = ExpressionParser
					.predicate("publisher = '" + key + "'");
			ColorAction fillColor = new ColorAction("graph.nodes",
					predicate, VisualItem.FILLCOLOR, palette[i]);
			fill.add(fillColor);
			i++;
		}
	}
	mVis.putAction("fill", fill);
	this.DEFAULT_IDENTIFIER_COLOR = iColor;
	this.DEFAULT_METADATA_COLOR = mColor;
	this.startActions();
}
 
开发者ID:trustathsh,项目名称:irongui,代码行数:33,代码来源:GraphPanel.java

示例5: StackedGraphDisplay

import prefuse.data.expression.parser.ExpressionParser; //导入依赖的package包/类
StackedGraphDisplay()
{
    super( new Visualization() );

    setBackground( ColorLib.getColor( 0, 51, 88 ) );

    LabelRenderer labelRenderer = new LabelRenderer( NAME_LABEL );
    labelRenderer.setVerticalAlignment( Constants.BOTTOM );
    labelRenderer.setHorizontalAlignment( Constants.LEFT );

    EdgeRenderer usesRenderer = new EdgeRenderer( Constants.EDGE_TYPE_CURVE, Constants.EDGE_ARROW_FORWARD );
    usesRenderer.setHorizontalAlignment1( Constants.CENTER );
    usesRenderer.setHorizontalAlignment2( Constants.CENTER );
    usesRenderer.setVerticalAlignment1( Constants.BOTTOM );
    usesRenderer.setVerticalAlignment2( Constants.TOP );

    Predicate usesPredicate = (Predicate) ExpressionParser.parse( "ingroup('graph.edges') AND [" + USES_EDGES + "]==true", true );

    // set up the renderers - one for nodes and one for LABELS
    DefaultRendererFactory rf = new DefaultRendererFactory();
    rf.add( new InGroupPredicate( GRAPH_NODES ), new NodeRenderer() );
    rf.add( new InGroupPredicate( LABELS ), labelRenderer );
    rf.add( usesPredicate, usesRenderer );
    m_vis.setRendererFactory( rf );

    // border colors
    ColorAction borderColor = new BorderColorAction( GRAPH_NODES );
    ColorAction fillColor = new FillColorAction( GRAPH_NODES );

    // uses edge colors
    ItemAction usesColor = new ColorAction( GRAPH_EDGES, usesPredicate, VisualItem.STROKECOLOR, ColorLib.rgb( 50, 50, 50 ) );
    ItemAction usesArrow = new ColorAction( GRAPH_EDGES, usesPredicate, VisualItem.FILLCOLOR, ColorLib.rgb( 50, 50, 50 ) );

    // color settings
    ActionList colors = new ActionList();
    colors.add( fillColor );
    colors.add( borderColor );
    colors.add( usesColor );
    colors.add( usesArrow );
    m_vis.putAction( COLORS_ACTION, colors );

    ActionList autoPan = new ActionList();
    autoPan.add( colors );
    autoPan.add( new AutoPanAction() );
    autoPan.add( new RepaintAction() );
    m_vis.putAction( AUTO_PAN_ACTION, autoPan );

    // create the layout action list
    stackedLayout = new StackedLayout( GRAPH );
    ActionList layout = new ActionList();
    layout.add( stackedLayout );
    layout.add( new LabelLayout( LABELS ) );
    layout.add( autoPan );
    m_vis.putAction( LAYOUT_ACTION, layout );

    // initialize our display
    Dimension size = new Dimension( 400, 400 );
    setSize( size );
    setPreferredSize( size );
    setItemSorter( new ExtendedTreeDepthItemSorter( true ) );
    addControlListener( new HoverControl() );
    addControlListener( new FocusControl( 1, COLORS_ACTION ) );
    addControlListener( new WheelMouseControl() );
    addControlListener( new PanControl( true ) );
    addControlListener( new ItemSelectionControl() );

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

示例6: items

import prefuse.data.expression.parser.ExpressionParser; //导入依赖的package包/类
/**
 * Get an iterator over all items in the given group which match the given
 * filter expression.
 * @param group the visual data group to iterate over
 * @param expr an expression string that should parse to a Predicate
 * indicating which items should be included in the iteration. The input
 * string will be parsed using the
 * {@link prefuse.data.expression.parser.ExpressionParser} class. If a
 * parse error occurs, an empty iterator is returned.
 * @return a filtered iterator over VisualItems
 */
public Iterator<VisualItem> items(String group, String expr) {
    Expression e = ExpressionParser.parse(expr);
    if ( !(e instanceof Predicate) || ExpressionParser.getError()!=null )
        return Collections.<VisualItem>emptyList().iterator() ;
    return items(group, (Predicate)e);
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:18,代码来源:Visualization.java

示例7: addColumn

import prefuse.data.expression.parser.ExpressionParser; //导入依赖的package包/类
/**
 * Add a derived column to this table, using an Expression instance to
 * dynamically calculate the column data values.
 * @param name the data field name for the column
 * @param expr a String expression in the prefuse expression language, to
 * be parsed into an {@link prefuse.data.expression.Expression} instance.
 * The string is parsed by the
 * {@link prefuse.data.expression.parser.ExpressionParser}. If an error
 * occurs during parsing, an exception will be thrown. 
 * @see prefuse.data.tuple.TupleSet#addColumn(java.lang.String, java.lang.String)
 * @throws IllegalArgumentException if a column of that name already exists
 */
public void addColumn(String name, String expr) {
    Expression ex = ExpressionParser.parse(expr);
    Throwable t = ExpressionParser.getError();
    if ( t != null ) {
        throw new RuntimeException(t);
    } else {
        addColumn(name, ex);
    }
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:22,代码来源:Table.java

示例8: PDisplay

import prefuse.data.expression.parser.ExpressionParser; //导入依赖的package包/类
/**
 * Creates a new Display associated with the given Visualization that draws all VisualItems in the visualization that pass the given Predicate. The predicate string will be parsed by the
 * {@link prefuse.data.expression.parser.ExpressionParser} to get a {@link prefuse.data.expression.Predicate} instance.
 * 
 * @param visualization
 *            the {@link Visualization} backing this Display
 * @param predicate
 *            a predicate expression in the prefuse expression language. This expression will be parsed; if the parsing fails or does not result in a Predicate instance, an exception will result.
 */
public PDisplay(Context context, Visualization visualization, String predicate)
{
	this(context, visualization, (Predicate) ExpressionParser.parse(predicate, true));
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:14,代码来源:PDisplay.java

示例9: setPredicate

import prefuse.data.expression.parser.ExpressionParser; //导入依赖的package包/类
/**
 * Sets the filtering Predicate used to control what items are drawn by this Display.
 * 
 * @param expr
 *            the filtering predicate to use. The predicate string will be parsed by the {@link prefuse.data.expression.parser.ExpressionParser}. 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);
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:13,代码来源:PDisplay.java

示例10: add

import prefuse.data.expression.parser.ExpressionParser; //导入依赖的package包/类
/**
 * Adds a new mapping to this RendererFactory. If an input item to
 * {@link #getRenderer(VisualItem)} matches the predicate, then the
 * corresponding Renderer will be returned. Predicates are evaluated in the
 * order in which they are added, so if an item matches multiple
 * predicates, the Renderer for the earliest match will be returned.
 * @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);
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:15,代码来源:DefaultRendererFactory.java

示例11: add

import prefuse.data.expression.parser.ExpressionParser; //导入依赖的package包/类
/**
 * Add a shape mapping rule to this ShapeAction. VisualItems that match
 * the provided expression will be assigned the given shape value (assuming
 * they do not match an earlier rule). The provided expression String will
 * be parsed to generate the needed rule Predicate.
 * @param expr the expression String, should parse to a Predicate. 
 * @param shape the shape value
 * @throws RuntimeException if the expression does not parse correctly or
 * does not result in a Predicate instance.
 */
public void add(String expr, int shape) {
    Predicate p = (Predicate)ExpressionParser.parse(expr);
    add(p, shape);       
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:15,代码来源:ShapeAction.java

示例12: add

import prefuse.data.expression.parser.ExpressionParser; //导入依赖的package包/类
/**
 * Add a size mapping rule to this SizeAction. VisualItems that match
 * the provided expression will be assigned the given size value (assuming
 * they do not match an earlier rule). The provided expression String will
 * be parsed to generate the needed rule Predicate.
 * @param expr the expression String, should parse to a Predicate. 
 * @param size the size value
 * @throws RuntimeException if the expression does not parse correctly or
 * does not result in a Predicate instance.
 */
public void add(String expr, double size) {
    Predicate p = (Predicate)ExpressionParser.parse(expr);
    add(p, size);       
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:15,代码来源:SizeAction.java

示例13: add

import prefuse.data.expression.parser.ExpressionParser; //导入依赖的package包/类
/**
 * Add a font mapping rule to this FontAction. VisualItems that match
 * the provided expression will be assigned the given font value (assuming
 * they do not match an earlier rule). The provided expression String will
 * be parsed to generate the needed rule Predicate.
 * @param expr the expression String, should parse to a Predicate. 
 * @param font the font
 * @throws RuntimeException if the expression does not parse correctly or
 * does not result in a Predicate instance.
 */
public void add(String expr, Font font) {
    Predicate p = (Predicate)ExpressionParser.parse(expr);
    super.add(p, font);       
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:15,代码来源:FontAction.java

示例14: add

import prefuse.data.expression.parser.ExpressionParser; //导入依赖的package包/类
/**
 * Add a color mapping rule to this ColorAction. VisualItems that match
 * the provided expression will be assigned the given color value (assuming
 * they do not match an earlier rule). The provided expression String will
 * be parsed to generate the needed rule Predicate.
 * @param expr the expression String, should parse to a Predicate. 
 * @param color the color value
 * @throws RuntimeException if the expression does not parse correctly or
 * does not result in a Predicate instance.
 */
public void add(String expr, int color) {
    Predicate p = (Predicate)ExpressionParser.parse(expr);
    add(p, color);      
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:15,代码来源:ColorAction.java

示例15: add

import prefuse.data.expression.parser.ExpressionParser; //导入依赖的package包/类
/**
 * Add a mapping rule to this StrokeAction. VisualItems that match
 * the provided expression will be assigned the given BasicStroke value
 * (assuming they do not match an earlier rule). The provided expression
 * String will be parsed to generate the needed rule Predicate.
 * @param expr the expression String, should parse to a Predicate. 
 * @param stroke the BasicStroke
 * @throws RuntimeException if the expression does not parse correctly or
 * does not result in a Predicate instance.
 */
public void add(String expr, BasicStroke stroke) {
    Predicate p = (Predicate)ExpressionParser.parse(expr);
    add(p, stroke);       
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:15,代码来源:StrokeAction.java


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