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


Java Compare.GreaterOrEqual方法代码示例

本文整理汇总了Java中com.vaadin.data.util.filter.Compare.GreaterOrEqual方法的典型用法代码示例。如果您正苦于以下问题:Java Compare.GreaterOrEqual方法的具体用法?Java Compare.GreaterOrEqual怎么用?Java Compare.GreaterOrEqual使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.vaadin.data.util.filter.Compare的用法示例。


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

示例1: numberCompare

import com.vaadin.data.util.filter.Compare; //导入方法依赖的package包/类
protected Container.Filter numberCompare(Object propertyId, Class<?> numberType, String pattern) {
    Matcher matcher = numberComparePattern.matcher(pattern);
    if (!matcher.find()) return null;

    String op = matcher.group(1);

    Number numberValue = parseNumericValue(matcher.group(2), numberType);

    switch (op) {
        case ">": return new Compare.Greater(propertyId, numberValue);
        case ">=": return new Compare.GreaterOrEqual(propertyId, numberValue);
        case "<": return new Compare.Less(propertyId, numberValue);
        case "<=": return new Compare.LessOrEqual(propertyId, numberValue);
    }

    return null;
}
 
开发者ID:tyl,项目名称:field-binder,代码行数:18,代码来源:DefaultFilterFactory.java

示例2: numericRange

import com.vaadin.data.util.filter.Compare; //导入方法依赖的package包/类
protected Container.Filter numericRange(Object propertyId, Class<?> numberClass, String pattern) {
    Matcher matcher = numericRangePattern.matcher(pattern);
    if (!matcher.find()) return null;
    String left = matcher.group(1);
    String right = matcher.group(2);

    if (fpPattern.matcher(left).matches() && fpPattern.matcher(right).matches()) {

        Number i = parseNumericValue(left, numberClass);
        Number j = parseNumericValue(right, numberClass);

        if (i.doubleValue() > j.doubleValue()) {
            throw new Validator.InvalidValueException(
                    String.format("The given range '%s' is invalid", pattern));
        }

        return new And(
                new Compare.GreaterOrEqual(propertyId, i),
                new Compare.LessOrEqual(propertyId, j)
        );
    }

    return null;
}
 
开发者ID:tyl,项目名称:field-binder,代码行数:25,代码来源:DefaultFilterFactory.java

示例3: filterForCompareDate

import com.vaadin.data.util.filter.Compare; //导入方法依赖的package包/类
protected Container.Filter filterForCompareDate(Object propertyId, String pattern) {
    Matcher matcher = comparePattern.matcher(pattern);
    if (!matcher.find())
        return null;
    String op = matcher.group(1);
    String rest = matcher.group(2);

    Date value = leftRange(rest);

    switch (op) {
        case ">": return new Compare.Greater(propertyId, value);
        case ">=": return new Compare.GreaterOrEqual(propertyId, value);
        case "<": return new Compare.Less(propertyId, value);
        case "<=": return new Compare.LessOrEqual(propertyId, value);
    }

    return null;

}
 
开发者ID:tyl,项目名称:field-binder,代码行数:20,代码来源:DefaultFilterFactory.java

示例4: testDate_dd_mm

import com.vaadin.data.util.filter.Compare; //导入方法依赖的package包/类
@Test
public void testDate_dd_mm() {

    DateTime today = DateTime.now();
    int year = today.getYear();

    Container.Filter expected = new And(
            new Compare.GreaterOrEqual(DATE_PROPID, new DateTime(year, 1, 1, 0, 0, 0).toDate()),
            new Compare.LessOrEqual(DATE_PROPID, new DateTime(year, 1, 1, 23, 59, 59, 999).toDate()));

    Container.Filter filter = filterFactory.createFilter(Date.class, DATE_PROPID, "01-01");


    log.info(filterToString(expected));
    log.info(filterToString(filter));
    assertEquals(expected, filter);
}
 
开发者ID:tyl,项目名称:field-binder,代码行数:18,代码来源:TestDefaultFilterFactory.java

示例5: testDate_dd_mm_Range

import com.vaadin.data.util.filter.Compare; //导入方法依赖的package包/类
@Test
public void testDate_dd_mm_Range() {

    DateTime today = DateTime.now();
    int year = today.getYear();

    Container.Filter expected = new And(
            new Compare.GreaterOrEqual(DATE_PROPID, new DateTime(year, 1, 1, 0, 0, 0).toDate()),
            new Compare.LessOrEqual(DATE_PROPID, new DateTime(year, 1, 31, 23, 59, 59, 999).toDate()));

    Container.Filter filter = filterFactory.createFilter(Date.class, DATE_PROPID, "01-01..31-01");


    log.info(filterToString(expected));
    log.info(filterToString(filter));
    assertEquals(expected, filter);
}
 
开发者ID:tyl,项目名称:field-binder,代码行数:18,代码来源:TestDefaultFilterFactory.java

示例6: testDate_dd

import com.vaadin.data.util.filter.Compare; //导入方法依赖的package包/类
@Test
public void testDate_dd() {

    DateTime today = DateTime.now();
    int year = today.getYear(), month = today.getMonthOfYear();

    Container.Filter expected = new And(
            new Compare.GreaterOrEqual(DATE_PROPID, new DateTime(year, month, 1, 0, 0, 0).toDate()),
            new Compare.LessOrEqual(DATE_PROPID, new DateTime(year, month, 1, 23, 59, 59, 999).toDate()));

    Container.Filter filter = filterFactory.createFilter(Date.class, DATE_PROPID, "01");


    log.info(filterToString(expected));
    log.info(filterToString(filter));
    assertEquals(expected, filter);
}
 
开发者ID:tyl,项目名称:field-binder,代码行数:18,代码来源:TestDefaultFilterFactory.java

示例7: testDate_dd_Range

import com.vaadin.data.util.filter.Compare; //导入方法依赖的package包/类
@Test
public void testDate_dd_Range() {

    DateTime today = DateTime.now();
    int year = today.getYear(), month = today.getMonthOfYear();
    int maxDay = today.dayOfMonth().getMaximumValue();

    Container.Filter expected = new And(
            new Compare.GreaterOrEqual(DATE_PROPID, new DateTime(year, month, 1, 0, 0, 0).toDate()),
            new Compare.LessOrEqual(DATE_PROPID, new DateTime(year, month, maxDay, 23, 59, 59, 999).toDate()));

    Container.Filter filter = filterFactory.createFilter(Date.class, DATE_PROPID, "01.." + maxDay);


    log.info(filterToString(expected));
    log.info(filterToString(filter));
    assertEquals(expected, filter);
}
 
开发者ID:tyl,项目名称:field-binder,代码行数:19,代码来源:TestDefaultFilterFactory.java

示例8: filterToString

import com.vaadin.data.util.filter.Compare; //导入方法依赖的package包/类
public String filterToString(Container.Filter filter) {
    if (filter instanceof Compare.LessOrEqual) {
        return String.format("%s <= %s", ((Compare.LessOrEqual) filter).getPropertyId(), ((Compare.LessOrEqual) filter).getValue());
    } else
    if (filter instanceof Compare.GreaterOrEqual) {
        return String.format("%s >= %s", ((Compare.GreaterOrEqual) filter).getPropertyId(), ((Compare.GreaterOrEqual) filter).getValue());
    } else
    if (filter instanceof And) {
        StringBuffer sb = new StringBuffer();
        Collection<Container.Filter> coll = ((And) filter).getFilters();
        for (Container.Filter f: coll) {
            sb.append(filterToString(f));
            sb.append(", ");
        }
        return sb.toString();
    }

    throw new UnsupportedOperationException("unsupported filter");
}
 
开发者ID:tyl,项目名称:field-binder,代码行数:20,代码来源:TestDefaultFilterFactory.java

示例9: testIntRange

import com.vaadin.data.util.filter.Compare; //导入方法依赖的package包/类
@Test
public void testIntRange() {
    Container.Filter expected = new And(
            new Compare.GreaterOrEqual(INT_PROPID, 10),
            new Compare.LessOrEqual(INT_PROPID, 100));

    Container.Filter filter = filterFactory.createFilter(int.class, INT_PROPID, "10..100");
    log.info(filterToString(expected));
    log.info(filterToString(filter));
    assertEquals(expected, filter);
}
 
开发者ID:tyl,项目名称:field-binder,代码行数:12,代码来源:TestDefaultFilterFactory.java

示例10: testDoubleRange

import com.vaadin.data.util.filter.Compare; //导入方法依赖的package包/类
@Test
public void testDoubleRange() {
    Container.Filter expected = new And(
            new Compare.GreaterOrEqual(INT_PROPID, 10.1),
            new Compare.LessOrEqual(INT_PROPID, 100.2));

    Container.Filter filter = filterFactory.createFilter(double.class, INT_PROPID, "10.1..100.2");
    log.info(filterToString(expected));
    log.info(filterToString(filter));
    assertEquals(expected, filter);
}
 
开发者ID:tyl,项目名称:field-binder,代码行数:12,代码来源:TestDefaultFilterFactory.java

示例11: testDateYear

import com.vaadin.data.util.filter.Compare; //导入方法依赖的package包/类
@Test
public void testDateYear() {
    Container.Filter expected = new And(
            new Compare.GreaterOrEqual(DATE_PROPID, new DateTime(2014, 1, 1, 0, 0, 0).toDate()),
            new Compare.LessOrEqual(DATE_PROPID, new DateTime(2014, 12, 31, 23, 59, 59, 999).toDate()));

    Container.Filter filter = filterFactory.createFilter(Date.class, DATE_PROPID, "2014");
    log.info(filterToString(expected));
    log.info(filterToString(filter));
    assertEquals(expected, filter);
}
 
开发者ID:tyl,项目名称:field-binder,代码行数:12,代码来源:TestDefaultFilterFactory.java

示例12: testDateYearRange

import com.vaadin.data.util.filter.Compare; //导入方法依赖的package包/类
@Test
public void testDateYearRange() {
    Container.Filter expected = new And(
            new Compare.GreaterOrEqual(DATE_PROPID, new DateTime(2010, 1, 1, 0, 0, 0).toDate()),
            new Compare.LessOrEqual(DATE_PROPID, new DateTime(2015, 12, 31, 23, 59, 59, 999).toDate()));
    Container.Filter filter = filterFactory.createFilter(Date.class, DATE_PROPID, "2010..2015");

    assertEquals(expected, filter);
}
 
开发者ID:tyl,项目名称:field-binder,代码行数:10,代码来源:TestDefaultFilterFactory.java

示例13: testDateMonth

import com.vaadin.data.util.filter.Compare; //导入方法依赖的package包/类
@Test
public void testDateMonth() {
    Container.Filter expected = new And(
            new Compare.GreaterOrEqual(DATE_PROPID, new DateTime(2010, 1, 1, 0, 0, 0).toDate()),
            new Compare.LessOrEqual(DATE_PROPID, new DateTime(2010, 1, 31, 23, 59, 59, 999).toDate()));

    Container.Filter filter = filterFactory.createFilter(Date.class, DATE_PROPID, "01-2010");


    log.info(filterToString(expected));
    log.info(filterToString(filter));
    assertEquals(expected, filter);

}
 
开发者ID:tyl,项目名称:field-binder,代码行数:15,代码来源:TestDefaultFilterFactory.java

示例14: testDateMonthRange

import com.vaadin.data.util.filter.Compare; //导入方法依赖的package包/类
@Test
public void testDateMonthRange() {
    Container.Filter expected = new And(
            new Compare.GreaterOrEqual(DATE_PROPID, new DateTime(2010, 1, 1, 0, 0, 0).toDate()),
            new Compare.LessOrEqual(DATE_PROPID, new DateTime(2015, 10, 31, 23, 59, 59, 999).toDate()));

    Container.Filter filter = filterFactory.createFilter(Date.class, DATE_PROPID, "01-2010..10-2015");


    log.info(filterToString(expected));
    log.info(filterToString(filter));
    assertEquals(expected, filter);

}
 
开发者ID:tyl,项目名称:field-binder,代码行数:15,代码来源:TestDefaultFilterFactory.java

示例15: testDate_dd_mm_yyyy

import com.vaadin.data.util.filter.Compare; //导入方法依赖的package包/类
@Test
public void testDate_dd_mm_yyyy() {

    Container.Filter expected = new And(
            new Compare.GreaterOrEqual(DATE_PROPID, new DateTime(2010, 1, 1, 0, 0, 0).toDate()),
            new Compare.LessOrEqual(DATE_PROPID, new DateTime(2010, 1, 1, 23, 59, 59, 999).toDate()));

    Container.Filter filter = filterFactory.createFilter(Date.class, DATE_PROPID, "01-01-2010");


    log.info(filterToString(expected));
    log.info(filterToString(filter));
    assertEquals(expected, filter);
}
 
开发者ID:tyl,项目名称:field-binder,代码行数:15,代码来源:TestDefaultFilterFactory.java


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