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


Java DecimalType.ZERO属性代码示例

本文整理汇总了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);
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:18,代码来源:OneWireDecimalTypeMultiplyModifier.java

示例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);
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:18,代码来源:OneWireDecimalTypeMultiplyModifier.java

示例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);
		}
	}
}
 
开发者ID:Neulinet,项目名称:Zoo,代码行数:33,代码来源:ColorItem.java

示例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);
	}
}
 
开发者ID:Neulinet,项目名称:Zoo,代码行数:13,代码来源:ContactItem.java

示例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);
	}
}
 
开发者ID:Neulinet,项目名称:Zoo,代码行数:10,代码来源:SwitchItem.java

示例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;
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:13,代码来源:BatteryDecimalTypeConverter.java

示例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);
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:14,代码来源:DmxColorItemTest.java

示例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;
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:11,代码来源:SatelBindingConfig.java

示例9: convert

/**
 * {@inheritDoc}
 */
@Override
protected DecimalType convert(Integer value) {
	return value != 0x00 ? ONE : DecimalType.ZERO;
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:7,代码来源:BinaryDecimalTypeConverter.java


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