本文整理汇总了Java中prefuse.data.expression.parser.ExpressionParser.parse方法的典型用法代码示例。如果您正苦于以下问题:Java ExpressionParser.parse方法的具体用法?Java ExpressionParser.parse怎么用?Java ExpressionParser.parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类prefuse.data.expression.parser.ExpressionParser
的用法示例。
在下文中一共展示了ExpressionParser.parse方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例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);
}
示例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);
}
}
示例4: 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 );
}
示例5: 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);
}
示例6: 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);
}
}
示例7: 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));
}
示例8: 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);
}
示例9: 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);
}
示例10: 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);
}
示例11: 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);
}
示例12: 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);
}
示例13: 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);
}
示例14: 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);
}