本文整理汇总了Java中org.openhab.core.library.types.DecimalType.ZERO属性的典型用法代码示例。如果您正苦于以下问题:Java DecimalType.ZERO属性的具体用法?Java DecimalType.ZERO怎么用?Java DecimalType.ZERO使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.openhab.core.library.types.DecimalType
的用法示例。
在下文中一共展示了DecimalType.ZERO属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: modifyDecimalType4Read
@Override
public DecimalType modifyDecimalType4Read(DecimalType pvModifyValue) {
if (pvModifyValue == null) {
return null;
}
BigDecimal lvResult = pvModifyValue.toBigDecimal();
if (pvModifyValue.equals(BigDecimal.ZERO)) {
return DecimalType.ZERO;
} else if (lvResult.equals(BigDecimal.ZERO)) {
return DecimalType.ZERO;
} else {
lvResult = lvResult.multiply(ivAdjustValue);
}
return new DecimalType(lvResult);
}
示例2: modifyDecimalType4Write
@Override
public DecimalType modifyDecimalType4Write(DecimalType pvModifyValue) {
if (pvModifyValue == null) {
return null;
}
BigDecimal lvResult = pvModifyValue.toBigDecimal();
if (pvModifyValue.equals(BigDecimal.ZERO)) {
return DecimalType.ZERO;
} else if (lvResult.equals(BigDecimal.ZERO)) {
return DecimalType.ZERO;
} else {
lvResult = lvResult.divide(ivAdjustValue);
}
return new DecimalType(lvResult);
}
示例3: setState
/**
* {@inheritDoc}
*/
@Override
public void setState(State state) {
State currentState = this.state;
if(currentState instanceof HSBType) {
DecimalType hue = ((HSBType) currentState).getHue();
PercentType saturation = ((HSBType) currentState).getSaturation();
// we map ON/OFF values to dark/bright, so that the hue and saturation values are not changed
if(state==OnOffType.OFF) {
super.setState(new HSBType(hue, saturation, PercentType.ZERO));
} else if(state==OnOffType.ON) {
super.setState(new HSBType(hue, saturation, PercentType.HUNDRED));
} else if(state instanceof PercentType && !(state instanceof HSBType)) {
super.setState(new HSBType(hue, saturation, (PercentType) state));
} else {
super.setState(state);
}
} else {
// we map ON/OFF values to black/white and percentage values to grey scale
if(state==OnOffType.OFF) {
super.setState(HSBType.BLACK);
} else if(state==OnOffType.ON) {
super.setState(HSBType.WHITE);
} else if(state instanceof PercentType && !(state instanceof HSBType)) {
super.setState(new HSBType(DecimalType.ZERO, PercentType.ZERO, (PercentType) state));
} else {
super.setState(state);
}
}
}
示例4: getStateAs
/**
* {@inheritDoc}
*/
@Override
public State getStateAs(Class<? extends State> typeClass) {
if(typeClass==DecimalType.class) {
return state==OpenClosedType.OPEN ? new DecimalType(1) : DecimalType.ZERO;
} else if(typeClass==PercentType.class) {
return state==OpenClosedType.OPEN ? PercentType.HUNDRED : PercentType.ZERO;
} else {
return super.getStateAs(typeClass);
}
}
示例5: getStateAs
@Override
public State getStateAs(Class<? extends State> typeClass) {
if(typeClass==DecimalType.class) {
return state==OnOffType.ON ? new DecimalType(1) : DecimalType.ZERO;
} else if(typeClass==PercentType.class) {
return state==OnOffType.ON ? PercentType.HUNDRED : PercentType.ZERO;
} else {
return super.getStateAs(typeClass);
}
}
示例6: convert
/**
* {@inheritDoc}
*/
@Override
protected DecimalType convert(Integer value) {
// 0xFF is low battery warning
if (value <= 0 || value == 0xFF)
return DecimalType.ZERO;
else if (value > 0 && value < 100)
return new DecimalType(value);
else
return HUNDRED;
}
示例7: canBeSetWithHsbCommand
@Test
public void canBeSetWithHsbCommand() throws BindingConfigParseException {
DmxItem item = getValidInstance();
DmxService service = Mockito.mock(DmxService.class);
HSBType hsb = new HSBType(DecimalType.ZERO, PercentType.HUNDRED,
PercentType.HUNDRED);
item.processCommand(service, hsb);
Mockito.verify(service).setChannelValue(3, 255);
Mockito.verify(service).setChannelValue(4, 0);
Mockito.verify(service).setChannelValue(5, 0);
}
示例8: booleanToState
protected State booleanToState(Item item, boolean value) {
if (item instanceof ContactItem) {
return value ? OpenClosedType.OPEN : OpenClosedType.CLOSED;
} else if (item instanceof SwitchItem) {
return value ? OnOffType.ON : OnOffType.OFF;
} else if (item instanceof NumberItem) {
return value ? DECIMAL_ONE : DecimalType.ZERO;
}
return null;
}
示例9: convert
/**
* {@inheritDoc}
*/
@Override
protected DecimalType convert(Integer value) {
return value != 0x00 ? ONE : DecimalType.ZERO;
}