本文整理汇总了Java中org.openhab.core.persistence.FilterCriteria.Operator类的典型用法代码示例。如果您正苦于以下问题:Java Operator类的具体用法?Java Operator怎么用?Java Operator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Operator类属于org.openhab.core.persistence.FilterCriteria包,在下文中一共展示了Operator类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertOperator
import org.openhab.core.persistence.FilterCriteria.Operator; //导入依赖的package包/类
private String convertOperator(Operator operator) {
switch (operator) {
case EQ:
return "$eq";
case GT:
return "$gt";
case GTE:
return "$gte";
case LT:
return "$lt";
case LTE:
return "$lte";
case NEQ:
return "$neq";
default:
return null;
}
}
示例2: operatorAsString
import org.openhab.core.persistence.FilterCriteria.Operator; //导入依赖的package包/类
/**
* Convert op to string suitable for dynamodb filter expression
*
* @param op
* @return string representation corresponding to the given the Operator
*/
private static String operatorAsString(Operator op) {
switch (op) {
case EQ:
return "=";
case NEQ:
return "<>";
case LT:
return "<";
case LTE:
return "<=";
case GT:
return ">";
case GTE:
return ">=";
default:
throw new IllegalStateException("Unknown operator " + op);
}
}
示例3: convertOperator
import org.openhab.core.persistence.FilterCriteria.Operator; //导入依赖的package包/类
private String convertOperator(Operator operator) {
switch (operator) {
case EQ:
return "$eq";
case GT:
return "$gt";
case GTE:
return "$gte";
case LT:
return "$lt";
case LTE:
return "$lte";
case NEQ:
return "$neq";
default:
return null;
}
}
示例4: testQueryUsingNameAndStartAndEndWithNEQOperator
import org.openhab.core.persistence.FilterCriteria.Operator; //导入依赖的package包/类
@Test
public void testQueryUsingNameAndStartAndEndWithNEQOperator() {
FilterCriteria criteria = new FilterCriteria();
criteria.setOperator(Operator.NEQ);
criteria.setState(getSecondItemState());
criteria.setItemName(getItemName());
criteria.setBeginDate(beforeStore);
criteria.setEndDate(afterStore2);
Iterable<HistoricItem> iterable = BaseIntegrationTest.service.query(criteria);
Iterator<HistoricItem> iterator = iterable.iterator();
HistoricItem actual1 = iterator.next();
assertFalse(iterator.hasNext());
assertStateEquals(getFirstItemState(), actual1.getState());
assertTrue(actual1.getTimestamp().before(afterStore1));
assertTrue(actual1.getTimestamp().after(beforeStore));
}
示例5: testQueryUsingNameAndStartAndEndWithEQOperator
import org.openhab.core.persistence.FilterCriteria.Operator; //导入依赖的package包/类
@Test
public void testQueryUsingNameAndStartAndEndWithEQOperator() {
FilterCriteria criteria = new FilterCriteria();
criteria.setOperator(Operator.EQ);
criteria.setState(getFirstItemState());
criteria.setItemName(getItemName());
criteria.setBeginDate(beforeStore);
criteria.setEndDate(afterStore2);
Iterable<HistoricItem> iterable = BaseIntegrationTest.service.query(criteria);
Iterator<HistoricItem> iterator = iterable.iterator();
HistoricItem actual1 = iterator.next();
assertFalse(iterator.hasNext());
assertStateEquals(getFirstItemState(), actual1.getState());
assertTrue(actual1.getTimestamp().before(afterStore1));
assertTrue(actual1.getTimestamp().after(beforeStore));
}
示例6: testQueryUsingNameAndStartAndEndWithLTOperator
import org.openhab.core.persistence.FilterCriteria.Operator; //导入依赖的package包/类
@Test
public void testQueryUsingNameAndStartAndEndWithLTOperator() {
FilterCriteria criteria = new FilterCriteria();
criteria.setOperator(Operator.LT);
criteria.setState(getSecondItemState());
criteria.setItemName(getItemName());
criteria.setBeginDate(beforeStore);
criteria.setEndDate(afterStore2);
Iterable<HistoricItem> iterable = BaseIntegrationTest.service.query(criteria);
Iterator<HistoricItem> iterator = iterable.iterator();
HistoricItem actual1 = iterator.next();
assertFalse(iterator.hasNext());
assertStateEquals(getFirstItemState(), actual1.getState());
assertTrue(actual1.getTimestamp().before(afterStore1));
assertTrue(actual1.getTimestamp().after(beforeStore));
}
示例7: testQueryUsingNameAndStartAndEndWithLTEOperator
import org.openhab.core.persistence.FilterCriteria.Operator; //导入依赖的package包/类
@Test
public void testQueryUsingNameAndStartAndEndWithLTEOperator() {
FilterCriteria criteria = new FilterCriteria();
criteria.setOperator(Operator.LTE);
criteria.setState(getFirstItemState());
criteria.setItemName(getItemName());
criteria.setBeginDate(beforeStore);
criteria.setEndDate(afterStore2);
Iterable<HistoricItem> iterable = BaseIntegrationTest.service.query(criteria);
Iterator<HistoricItem> iterator = iterable.iterator();
HistoricItem actual1 = iterator.next();
assertFalse(iterator.hasNext());
assertStateEquals(getFirstItemState(), actual1.getState());
assertTrue(actual1.getTimestamp().before(afterStore1));
assertTrue(actual1.getTimestamp().after(beforeStore));
}
示例8: testQueryUsingNameAndStartAndEndWithGTOperator
import org.openhab.core.persistence.FilterCriteria.Operator; //导入依赖的package包/类
@Test
public void testQueryUsingNameAndStartAndEndWithGTOperator() {
// Skip for subclasses which have null "state between"
Assume.assumeTrue(getQueryItemStateBetween() != null);
FilterCriteria criteria = new FilterCriteria();
criteria.setOperator(Operator.GT);
criteria.setState(getQueryItemStateBetween());
criteria.setItemName(getItemName());
criteria.setBeginDate(beforeStore);
criteria.setEndDate(afterStore2);
Iterable<HistoricItem> iterable = BaseIntegrationTest.service.query(criteria);
Iterator<HistoricItem> iterator = iterable.iterator();
HistoricItem actual1 = iterator.next();
assertFalse(iterator.hasNext());
assertStateEquals(getSecondItemState(), actual1.getState());
assertTrue(actual1.getTimestamp().before(afterStore2));
assertTrue(actual1.getTimestamp().after(afterStore1));
}
示例9: testQueryUsingNameAndStartAndEndWithGTEOperator
import org.openhab.core.persistence.FilterCriteria.Operator; //导入依赖的package包/类
@Test
public void testQueryUsingNameAndStartAndEndWithGTEOperator() {
FilterCriteria criteria = new FilterCriteria();
criteria.setOperator(Operator.GTE);
criteria.setState(getSecondItemState());
criteria.setItemName(getItemName());
criteria.setBeginDate(beforeStore);
criteria.setEndDate(afterStore2);
Iterable<HistoricItem> iterable = BaseIntegrationTest.service.query(criteria);
Iterator<HistoricItem> iterator = iterable.iterator();
HistoricItem actual1 = iterator.next();
assertFalse(iterator.hasNext());
assertStateEquals(getSecondItemState(), actual1.getState());
assertTrue(actual1.getTimestamp().before(afterStore2));
assertTrue(actual1.getTimestamp().after(afterStore1));
}
示例10: testQueryUsingNameAndStartAndEndWithLTOperatorNoMatch
import org.openhab.core.persistence.FilterCriteria.Operator; //导入依赖的package包/类
@Test
public void testQueryUsingNameAndStartAndEndWithLTOperatorNoMatch() {
FilterCriteria criteria = new FilterCriteria();
criteria.setOperator(Operator.LT);
criteria.setState(getFirstItemState());
criteria.setItemName(getItemName());
criteria.setBeginDate(beforeStore);
criteria.setEndDate(afterStore2);
Iterable<HistoricItem> iterable = BaseIntegrationTest.service.query(criteria);
Iterator<HistoricItem> iterator = iterable.iterator();
assertFalse(iterator.hasNext());
}
示例11: testQueryUsingNameAndStartAndEndWithGTOperatorNoMatch
import org.openhab.core.persistence.FilterCriteria.Operator; //导入依赖的package包/类
@Test
public void testQueryUsingNameAndStartAndEndWithGTOperatorNoMatch() {
FilterCriteria criteria = new FilterCriteria();
criteria.setOperator(Operator.GT);
criteria.setState(getSecondItemState());
criteria.setItemName(getItemName());
criteria.setBeginDate(beforeStore);
criteria.setEndDate(afterStore2);
Iterable<HistoricItem> iterable = BaseIntegrationTest.service.query(criteria);
Iterator<HistoricItem> iterator = iterable.iterator();
assertFalse(iterator.hasNext());
}
示例12: mapOperator
import org.openhab.core.persistence.FilterCriteria.Operator; //导入依赖的package包/类
private Operator mapOperator(FilterCriteria.Operator operator) {
if(operator==null) return null;
return org.openhab.core.persistence.FilterCriteria.Operator.valueOf(operator.toString());
}