Package prefuse.data.expression

Examples of prefuse.data.expression.ColumnExpression


   
    /**
     * Create a comparison predicate fof the given data value
     */
    private ComparisonPredicate getComparison(Object o) {
        Expression left = new ColumnExpression(m_field);
        Expression right = Literal.getLiteral(o, m_type);
        return new ComparisonPredicate(ComparisonPredicate.EQ, left, right);
    }
View Full Code Here


  static final public Expression Identifier() throws ParseException {
  String s; Function f=null; Expression e;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case QUOTED:
      s = Quoted();
                 {if (true) return new ColumnExpression(s);}
      break;
    case IDENTIFIER:
      s = Name();
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case LPAREN:
        jj_consume_token(LPAREN);
                 f = FunctionTable.createFunction(s);
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case TRUE:
        case FALSE:
        case NULL:
        case IF:
        case NOT:
        case INT:
        case LONG:
        case DOUBLE:
        case FLOAT:
        case STRING:
        case QUOTED:
        case IDENTIFIER:
        case LPAREN:
        case ADD:
        case SUB:
          e = Expression();
                         f.addParameter(e);
          label_8:
          while (true) {
            switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
            case 43:
              ;
              break;
            default:
              jj_la1[16] = jj_gen;
              break label_8;
            }
            jj_consume_token(43);
            e = Expression();
                              f.addParameter(e);
          }
          break;
        default:
          jj_la1[17] = jj_gen;
          ;
        }
        jj_consume_token(RPAREN);
        break;
      default:
        jj_la1[18] = jj_gen;
        ;
      }
      {if (true) return f==null ? new ColumnExpression(s) : (Expression)f;}
      break;
    default:
      jj_la1[19] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
View Full Code Here

        Object max = DataLib.max(m_tuples, m_field).get(m_field);
       
        // set up predicate
        Literal left = Literal.getLiteral(min, m_type);
        Literal right = Literal.getLiteral(max, m_type);
        ColumnExpression ce = new ColumnExpression(m_field);
        RangePredicate rp = new RangePredicate(ce, left, right);
        setPredicate(rp);
    }
View Full Code Here

       
        // not equals operations aren't handled by the index
        if ( operation == ComparisonPredicate.NEQ )
            return null;
       
        ColumnExpression col;
        Expression lit;
       
        // make sure columns are of the right type
        if (l instanceof ColumnExpression &&
                !ExpressionAnalyzer.hasDependency(r))
        {
            col = (ColumnExpression)l;
            lit = r;
        } else if (r instanceof ColumnExpression &&
                !ExpressionAnalyzer.hasDependency(l))
        {
            col = (ColumnExpression)r;
            lit = l;
        } else {
            return null;
        }
       
        // if table has index of the right type, use it
        Comparator cmp = cp.getComparator();
        Index index = t.getIndex(col.getColumnName());
       
        if ( index == null || !cmp.equals(index.getComparator()) )
            return null;
       
        Class ltype = lit.getClass();
View Full Code Here

            }
        }       
    }
   
    protected static IntIterator getRangeIterator(Table t, RangePredicate rp) {
        ColumnExpression col;
        Expression l, r;
       
        // make sure columns are of the right type
        if ( !(rp.getMiddleExpression() instanceof ColumnExpression) ||
                ExpressionAnalyzer.hasDependency(rp.getLeftExpression()) ||
                ExpressionAnalyzer.hasDependency(rp.getRightExpression()) )
        {
            return null;
        }
       
        // assign variables
        col = (ColumnExpression)rp.getMiddleExpression();
        l = rp.getLeftExpression();
        r = rp.getRightExpression();
       
        // if table has index of the right type, use it
        Comparator cmp = rp.getComparator();
        Index index = t.getIndex(col.getColumnName());
       
        if ( index == null || !cmp.equals(index.getComparator()) )
            return null;
       
        int operation = rp.getOperation();
        Class ltype = t.getColumnType(col.getColumnName());
       
        // TODO safety check literal types
       
        // get the index type
        int indexType;
View Full Code Here

        // index the double column
        t.index(HEADERS[4]);
       
        // where id > 0 && dub > 1 && dub < 20
        ColumnExpression id = new ColumnExpression(HEADERS[0]);
        ColumnExpression dub = new ColumnExpression(HEADERS[4]);
        NumericLiteral x0 = new NumericLiteral(0);
        NumericLiteral xlo = new NumericLiteral(lo);
        NumericLiteral xhi1 = new NumericLiteral(hi-1.0);
        NumericLiteral xhi2 = new NumericLiteral(1.0f);
        Expression xhi = new ArithmeticExpression(
View Full Code Here

    }
   
    public void testDerivedColumn() {
        String AVG = "average";
       
        Expression fc = new ColumnExpression(HEADERS[3]);
        Expression dc = new ColumnExpression(HEADERS[4]);
        Expression l2 = new NumericLiteral(2);
       
        Expression add = new ArithmeticExpression(
                ArithmeticExpression.ADD, fc, dc);
        Expression avg = new ArithmeticExpression(
View Full Code Here

TOP

Related Classes of prefuse.data.expression.ColumnExpression

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.