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