Package prefuse.data.expression

Examples of prefuse.data.expression.IfExpression


     * @param p the Predicate condition
     * @param val the associated Object value
     */
    public void add(Predicate p, Object val) {
        if ( m_tail == null ) {
            m_tail = new IfExpression(p, new ObjectLiteral(val), m_head);
            m_head = m_tail;
        } else {
            IfExpression ie = new IfExpression(p, new ObjectLiteral(val),
                                               m_tail.getElseExpression());
            m_tail.setElseExpression(ie);
            m_tail = ie;
        }
    }
View Full Code Here


     * @return true if a rule was successfully removed, false otherwise
     */
    public boolean remove(Predicate p) {
        if ( p == null ) return false;
       
        IfExpression prev = null;
        Expression expr = m_head;
        while ( expr instanceof IfExpression ) {
            IfExpression ifex = (IfExpression)expr;
            Predicate test = (Predicate)ifex.getTestPredicate();
            if ( p.equals(test) ) {
                Expression elseex = ifex.getElseExpression();
                ifex.setElseExpression(new ObjectLiteral(null));
                if ( prev != null ) {
                    prev.setElseExpression(elseex);
                    if ( ifex == m_tail )
                        m_tail = prev;
                } else {
                    m_head = elseex;
                    if ( ifex == m_tail )
                        m_tail = null;
                }
                return true;
            } else {
                prev = ifex;
                expr = ifex.getElseExpression();
            }
        }
        return false;
    }
View Full Code Here

    t = Expression();
    jj_consume_token(ELSE);
    e = Expression();
      if ( !(p instanceof Predicate) )
          {if (true) throw new ParseException("IF-statement test must be a predicate");}
      {if (true) return new IfExpression((Predicate)p, t, e);}
    throw new Error("Missing return statement in function");
  }
View Full Code Here

TOP

Related Classes of prefuse.data.expression.IfExpression

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.