本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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");
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}