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


Java DecimalType.valueOf方法代码示例

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


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

示例1: createState

import org.openhab.core.library.types.DecimalType; //导入方法依赖的package包/类
/**
 * Returns a {@link State} which is inherited from the {@link Item}s
 * accepted DataTypes. The call is delegated to the  {@link TypeParser}. If
 * <code>item</code> is <code>null</code> the {@link StringType} is used.
 *  
 * @param itemType
 * @param transformedResponse
 * 
 * @return a {@link State} which type is inherited by the {@link TypeParser}
 * or a {@link StringType} if <code>item</code> is <code>null</code> 
 */
private State createState(Class<? extends Item> itemType, String transformedResponse) {
	try {
		if (itemType.isAssignableFrom(NumberItem.class)) {
			return DecimalType.valueOf(transformedResponse);
		} else if (itemType.isAssignableFrom(ContactItem.class)) {
			return OpenClosedType.valueOf(transformedResponse);
		} else if (itemType.isAssignableFrom(SwitchItem.class)) {
			return OnOffType.valueOf(transformedResponse);
		} else if (itemType.isAssignableFrom(RollershutterItem.class)) {
			return PercentType.valueOf(transformedResponse);
		} else if (itemType.isAssignableFrom(DateTimeItem.class)) {
			return DateTimeType.valueOf(transformedResponse);
		} else {
			return StringType.valueOf(transformedResponse);
		}
	} catch (Exception e) {
		logger.debug("Couldn't create state of type '{}' for value '{}'", itemType, transformedResponse);
		return StringType.valueOf(transformedResponse);
	}
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:32,代码来源:HttpBinding.java

示例2: createState

import org.openhab.core.library.types.DecimalType; //导入方法依赖的package包/类
private State createState(Class<? extends Item> itemType,
		String transformedResponse) {
	try {
		if (itemType.isAssignableFrom(NumberItem.class)) {
			return DecimalType.valueOf(transformedResponse);
		} else if (itemType.isAssignableFrom(SwitchItem.class)) {
			return OnOffType.valueOf(transformedResponse);
		} else if (itemType.isAssignableFrom(DimmerItem.class)) {
			return PercentType.valueOf(transformedResponse);
		} else {
			return StringType.valueOf(transformedResponse);
		}
	} catch (Exception e) {
		logger.debug("Couldn't create state of type '{}' for value '{}'",
				itemType, transformedResponse);
		return StringType.valueOf(transformedResponse);
	}
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:19,代码来源:Enigma2Binding.java

示例3: createState

import org.openhab.core.library.types.DecimalType; //导入方法依赖的package包/类
/**
 * Returns a {@link State} which is inherited from the {@link Item}s
 * accepted DataTypes. The call is delegated to the {@link TypeParser}. If
 * <code>item</code> is <code>null</code> the {@link StringType} is used.
 * 
 * @param itemType
 * @param transformedResponse
 * 
 * @return a {@link State} which type is inherited by the {@link TypeParser}
 *         or a {@link StringType} if <code>item</code> is <code>null</code>
 */
private State createState(Class<? extends Item> itemType,
		String transformedResponse) {
	try {
		if (itemType.isAssignableFrom(NumberItem.class)) {
			return DecimalType.valueOf(transformedResponse);
		} else if (itemType.isAssignableFrom(ContactItem.class)) {
			return OpenClosedType.valueOf(transformedResponse);
		} else if (itemType.isAssignableFrom(SwitchItem.class)) {
			return OnOffType.valueOf(transformedResponse);
		} else if (itemType.isAssignableFrom(RollershutterItem.class)) {
			return PercentType.valueOf(transformedResponse);
		} else {
			return StringType.valueOf(transformedResponse);
		}
	} catch (Exception e) {
		logger.debug("Couldn't create state of type '{}' for value '{}'",
				itemType, transformedResponse);
		return StringType.valueOf(transformedResponse);
	}
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:32,代码来源:OWServerBinding.java

示例4: createState

import org.openhab.core.library.types.DecimalType; //导入方法依赖的package包/类
/**
 * Returns a {@link State} which is inherited from the {@link Item}s
 * accepted DataTypes. The call is delegated to the  {@link TypeParser}. If
 * <code>item</code> is <code>null</code> the {@link StringType} is used.
 *  
 * @param itemType
 * @param transformedResponse
 * 
 * @return a {@link State} which type is inherited by the {@link TypeParser}
 * or a {@link StringType} if <code>item</code> is <code>null</code> 
 */
private State createState(Class<? extends Item> itemType, String transformedResponse) {
	try {
		if (itemType.isAssignableFrom(NumberItem.class)) {
			return DecimalType.valueOf(transformedResponse);
		} else if (itemType.isAssignableFrom(ContactItem.class)) {
			return OpenClosedType.valueOf(transformedResponse);
		} else if (itemType.isAssignableFrom(SwitchItem.class)) {
			return OnOffType.valueOf(transformedResponse);
		} else if (itemType.isAssignableFrom(RollershutterItem.class)) {
			return PercentType.valueOf(transformedResponse);
		} else {
			return StringType.valueOf(transformedResponse);
		}
	} catch (Exception e) {
		logger.debug("Couldn't create state of type '{}' for value '{}'", itemType, transformedResponse);
		return StringType.valueOf(transformedResponse);
	}
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:30,代码来源:ExecBinding.java

示例5: getOHState

import org.openhab.core.library.types.DecimalType; //导入方法依赖的package包/类
@Override
public State getOHState() {
	String sOHState = StateTraslator.statesSoulissToOH(this.getNote(),
			this.getType(), (short) this.getState());
	if (sOHState == null) {
		if (!Float.isNaN(this.getState())) {
			return DecimalType.valueOf(Float.toString(this.getState()));
		} else
			return null;
	} else
		return DecimalType.valueOf(sOHState);
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:13,代码来源:SoulissT51.java

示例6: getOHStateMeasuredValue

import org.openhab.core.library.types.DecimalType; //导入方法依赖的package包/类
public State getOHStateMeasuredValue() {
	String sOHState = StateTraslator.statesSoulissToOH(this.getsItemTypeMeasuredValue(),
			this.getType(), (short) this.getState());
	if (sOHState == null) {
		if (!Float.isNaN(this.getState())) {
			if (this.getTemperatureMeasuredValue() != null)
				return DecimalType.valueOf(Float.toString(this
						.getTemperatureMeasuredValue()));
			else
				return null;
		} else
			return null;
	} else
		return DecimalType.valueOf(sOHState);
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:16,代码来源:SoulissT31.java

示例7: getOHStateSetpointValue

import org.openhab.core.library.types.DecimalType; //导入方法依赖的package包/类
public State getOHStateSetpointValue() {
	String sOHState = StateTraslator.statesSoulissToOH(this.getsItemTypeSetpointValue(),
			this.getType(), (short) this.getState());
	if (sOHState == null) {
		if (!Float.isNaN(this.getState())) {
			if (this.getSetpointValue() != null)
				return DecimalType.valueOf(Float.toString(this
						.getSetpointValue()));
			else
				return null;
		} else
			return null;
	} else
		return DecimalType.valueOf(sOHState);
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:16,代码来源:SoulissT31.java

示例8: getOHState

import org.openhab.core.library.types.DecimalType; //导入方法依赖的package包/类
/**
 * Returns the souliss' typical state as numerical value
 */
@Override
public State getOHState() {
	String sOHState = StateTraslator.statesSoulissToOH(this.getNote(),
			this.getType(), (short) this.getState());
	if (sOHState == null)
		return DecimalType.valueOf(Float.toString(this.getState()));
	else
		return DecimalType.valueOf(sOHState);
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:13,代码来源:SoulissTServiceNODE_HEALTY.java

示例9: getTemperature

import org.openhab.core.library.types.DecimalType; //导入方法依赖的package包/类
/**
 * Returns the current room temperature
 * @param itemType
 * @return
 */
public State getTemperature(Class<? extends Item> itemType) {
	if (itemType == StringItem.class)
		return StringType.valueOf(Double.toString(dcbRoomTemperature));

	// Default to DecimalType
	return DecimalType.valueOf(Double.toString(dcbRoomTemperature));
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:13,代码来源:HeatmiserThermostat.java

示例10: getFrostTemperature

import org.openhab.core.library.types.DecimalType; //导入方法依赖的package包/类
/**
 * Returns the current frost temperature
 * @param itemType
 * @return
 */
public State getFrostTemperature(Class<? extends Item> itemType) {
	if (itemType == StringItem.class)
		return StringType.valueOf(Double.toString(dcbFrostTemperature));

	// Default to DecimalType
	return DecimalType.valueOf(Double.toString(dcbFrostTemperature));
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:13,代码来源:HeatmiserThermostat.java

示例11: getFloorTemperature

import org.openhab.core.library.types.DecimalType; //导入方法依赖的package包/类
/**
 * Returns the current floor temperature
 * @param itemType
 * @return
 */
public State getFloorTemperature(Class<? extends Item> itemType) {
	if (itemType == StringItem.class)
		return StringType.valueOf(Double.toString(dcbFloorTemperature));

	// Default to DecimalType
	return DecimalType.valueOf(Double.toString(dcbFloorTemperature));
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:13,代码来源:HeatmiserThermostat.java

示例12: getOnOffState

import org.openhab.core.library.types.DecimalType; //导入方法依赖的package包/类
/**
 * Returns the current heating state
 * @param itemType
 * @return
 */
public State getOnOffState(Class<? extends Item> itemType) {
	if (itemType == StringItem.class)
		return dcbState == 1 ? StringType.valueOf("ON") : StringType
				.valueOf("OFF");
	if (itemType == SwitchItem.class)
		return dcbState == 1 ? OnOffType.ON : OnOffType.OFF;

	// Default to DecimalType
	return DecimalType.valueOf(Integer.toString(dcbState));
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:16,代码来源:HeatmiserThermostat.java

示例13: getWaterState

import org.openhab.core.library.types.DecimalType; //导入方法依赖的package包/类
public State getWaterState(Class<? extends Item> itemType) {
	if (itemType == StringItem.class)
		return dcbWaterState == 1 ? StringType.valueOf("ON") : StringType
				.valueOf("OFF");
	if (itemType == SwitchItem.class)
		return dcbWaterState == 1 ? OnOffType.ON : OnOffType.OFF;

	// Default to DecimalType
	return DecimalType.valueOf(Integer.toString(dcbWaterState));
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:11,代码来源:HeatmiserThermostat.java

示例14: getSetTemperature

import org.openhab.core.library.types.DecimalType; //导入方法依赖的package包/类
public State getSetTemperature(Class<? extends Item> itemType) {
	if (itemType == StringItem.class)
		return StringType.valueOf(Double.toString(dcbSetTemperature));

	// Default to DecimalType
	return DecimalType.valueOf(Double.toString(dcbSetTemperature));
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:8,代码来源:HeatmiserThermostat.java

示例15: getHeatState

import org.openhab.core.library.types.DecimalType; //导入方法依赖的package包/类
public State getHeatState(Class<? extends Item> itemType) {
	if (itemType == StringItem.class)
		return dcbHeatState == 1 ? StringType.valueOf("ON") : StringType
				.valueOf("OFF");
	if (itemType == SwitchItem.class)
		return dcbHeatState == 1 ? OnOffType.ON : OnOffType.OFF;

	// Default to DecimalType
	return DecimalType.valueOf(Integer.toString(dcbHeatState));
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:11,代码来源:HeatmiserThermostat.java


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