Examples of Comparison


Examples of org.apache.hadoop.hbase.client.idx.exp.Comparison

    String qualifer3 = "qualifier3";
    byte[] value3 = Bytes.toBytes("value3");
    Comparison.Operator operator3 = Comparison.Operator.LT;

    Expression expression1 = new Or(
        new Comparison(columnName1, qualifer1, operator1, value1),
        new And(
            new Comparison(columnName2, qualifer2, operator2, value2),
            new Comparison(columnName3, qualifer3, operator3, value3)
        )
    );

    Expression expression2 = Expression
        .or(
View Full Code Here

Examples of org.apache.jackrabbit.core.query.jsr283.qom.Comparison

    public void testComparison() throws RepositoryException {
        PropertyValue op1 = qomFactory.propertyValue(propertyName1);
        BindVariableValue op2 = qomFactory.bindVariable(VARIABLE_NAME);
        for (Iterator it = OPERATORS.iterator(); it.hasNext(); ) {
            int operator = ((Integer) it.next()).intValue();
            Comparison comp = qomFactory.comparison(op1, operator, op2);
            assertTrue("Not a PropertyValue operand", comp.getOperand1() instanceof PropertyValue);
            assertTrue("Not a BindVariableValue operand", comp.getOperand2() instanceof BindVariableValue);
            assertEquals("Wrong operator", operator, comp.getOperator());
        }
    }
View Full Code Here

Examples of org.apache.jackrabbit.spi.commons.query.jsr283.qom.Comparison

    public void testComparison() throws RepositoryException {
        PropertyValue op1 = qomFactory.propertyValue(propertyName1);
        BindVariableValue op2 = qomFactory.bindVariable(VARIABLE_NAME);
        for (Iterator it = OPERATORS.iterator(); it.hasNext(); ) {
            int operator = ((Integer) it.next()).intValue();
            Comparison comp = qomFactory.comparison(op1, operator, op2);
            assertTrue("Not a PropertyValue operand", comp.getOperand1() instanceof PropertyValue);
            assertTrue("Not a BindVariableValue operand", comp.getOperand2() instanceof BindVariableValue);
            assertEquals("Wrong operator", operator, comp.getOperator());
        }
    }
View Full Code Here

Examples of org.crank.crud.criteria.Comparison

  }

  @Test
  public void test() {
    paginatableDataSource.group().add(
        new Comparison("firstName", Operator.LIKE, "J%"));
    //int count =
      paginatableDataSource.getCount();
//    AssertJUnit.assertEquals(2, count);
//    AssertJUnit.assertEquals(2, paginatableDataSource.list(0, 10).size());
//    Employee employee = (Employee) paginatableDataSource.list(0, 3).get(0);
View Full Code Here

Examples of org.crank.crud.criteria.Comparison

      employeeDao.persist(employee);
    }
    employeeDao.flushAndClear();
    paginatableDataSource.group().clear();
    paginatableDataSource.group().add(
        new Comparison("firstName", Operator.LIKE, "FOO%"));
    int count = paginatableDataSource.getCount();
    AssertJUnit.assertEquals(100, count);
  }
View Full Code Here

Examples of org.crank.crud.criteria.Comparison


    public void testWhereClause () {
        Group group = new Group();
        group.eq("lastName", "Jones").eq("firstName", "Tom");
        Comparison comparison = Comparison.eq("middleName", "Milhouse");
        comparison.setCaseSensitive(false);
        group.add(comparison);
        String whereClause = CriteriaUtils.constuctWhereClause(group);
        assertEquals(" WHERE  o.lastName = :lastName  AND  o.firstName = :firstName  " +
                "AND  UPPER(  o.middleName )  =  UPPER( :middleName  ) ", whereClause);
View Full Code Here

Examples of org.crank.crud.criteria.Comparison

    if (group.size() > 0) {
      builder.append(" WHERE ");
      /* If the current iteration is a comparison, use it. */
      for (Criterion criterion : group) {
        if (criterion instanceof Comparison) {
          Comparison comparison = (Comparison) criterion;
          if (comparison.getName().equals("taskCount")) {
            continue;
          }
          builder.append(comparison.getName());
          builder.append(" " + comparison.getOperator().getOperator());
          builder.append(" ? ");
          builder.append("AND ");
        }
      }
      return builder.toString().substring(0,builder.length()-4);
View Full Code Here

Examples of org.crank.crud.criteria.Comparison

   */
  protected Object[] extractValues() {
    List <Object> values = new ArrayList<Object>();
    for (Criterion criterion : group) {
      if (criterion instanceof Comparison) {
        Comparison comparison = (Comparison) criterion;
        if (comparison.getOperator() == Operator.LIKE || comparison.getOperator() == Operator.LIKE_START) {
          String sValue = (String) comparison.getValue();
          values.add(sValue + "%");
        } else {
          values.add(comparison.getValue());
        }
      }
    }
    return values.toArray(new Object[values.size()]);
  }
View Full Code Here

Examples of org.crank.crud.criteria.Comparison

    }
    for (Criterion criterion : group) {
      if (criterion instanceof Group) {
        addGroupParams(query, (Group) criterion, names);
      } else {
        Comparison comparison = (Comparison) criterion;
       
        if (comparison.isObjectIdentity()) {
          continue;
        }
       
        String name = CriteriaUtils.ditchDot(comparison.getName());

        name = CriteriaUtils.ensureUnique(names, name);

        if (comparison.getValue() != null) {
          final String sOperator = comparison.getOperator()
              .getOperator();
          if (!"like".equalsIgnoreCase(sOperator)) {
            if (comparison instanceof Between) {
              Between between = (Between) comparison;
              query.setParameter(name + "_1", comparison
                  .getValue());
              query
                  .setParameter(name + "_2", between
                      .getValue2());
            } else if (comparison instanceof VerifiedBetween) {
              VerifiedBetween between = (VerifiedBetween) comparison;
              query.setParameter(name + "_1", comparison
                  .getValue());
              query
                  .setParameter(name + "_2", between
                      .getValue2());
            } else {
              query.setParameter(name, comparison.getValue());
            }

          } else {
            Operator operator = comparison.getOperator();
            StringBuilder value = new StringBuilder(50);
            if (operator == Operator.LIKE) {
              value.append(comparison.getValue());
            } else if (operator == Operator.LIKE_CONTAINS) {
              value.append("%").append(comparison.getValue())
                  .append("%");
            } else if (operator == Operator.LIKE_END) {
              value.append("%").append(comparison.getValue());
            } else if (operator == Operator.LIKE_START) {
              value.append(comparison.getValue()).append("%");
            }
            if (logger.isDebugEnabled()) {
              logger.debug("parameters");
              logger
                  .debug("value name = "
                      + comparison.getName());
              logger.debug("value value = " + value);
            }
            query.setParameter(name, value.toString());
          }
        }
View Full Code Here

Examples of org.dynalang.dynalink.linker.ConversionComparator.Comparison

     * @return one of Comparison constants that establish which - if any - of the target types is preferable for the
     * conversion.
     */
    public Comparison compareConversion(Class<?> sourceType, Class<?> targetType1, Class<?> targetType2) {
        for(ConversionComparator comparator: comparators) {
            final Comparison result = comparator.compareConversion(sourceType, targetType1, targetType2);
            if(result != Comparison.INDETERMINATE) {
                return result;
            }
        }
        if(TypeUtilities.isMethodInvocationConvertible(sourceType, targetType1)) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.