@Override public boolean equals(@Nullable Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof PointType)) { return false; } PointType other = (PointType) obj; if (!getLatitude().equals(other.getLatitude()) || !getLongitude().equals(other.getLongitude()) || !getAltitude().equals(other.getAltitude())) { return false; } return true; }
@Override public <T extends State> @Nullable T as(@Nullable Class<T> target) { if (target == OnOffType.class) { return target.cast(equals(ZERO) ? OnOffType.OFF : OnOffType.ON); } else if (target == PercentType.class) { return target.cast(new PercentType(toBigDecimal().multiply(BigDecimal.valueOf(100)))); } else if (target == UpDownType.class) { if (equals(ZERO)) { return target.cast(UpDownType.UP); } else if (toBigDecimal().compareTo(BigDecimal.valueOf(1)) == 0) { return target.cast(UpDownType.DOWN); } else { return null; } } else if (target == OpenClosedType.class) { if (equals(ZERO)) { return target.cast(OpenClosedType.CLOSED); } else if (toBigDecimal().compareTo(BigDecimal.valueOf(1)) == 0) { return target.cast(OpenClosedType.OPEN); } else { return null; } } else if (target == HSBType.class) { return target.cast(new HSBType(DecimalType.ZERO, PercentType.ZERO, new PercentType(this.toBigDecimal().multiply(BigDecimal.valueOf(100))))); } else { return defaultConversion(target); } }
@Override public boolean equals(@Nullable Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof HSBType)) { return false; } HSBType other = (HSBType) obj; if (!getHue().equals(other.getHue()) || !getSaturation().equals(other.getSaturation()) || !getBrightness().equals(other.getBrightness())) { return false; } return true; }
@Override public boolean equals(@Nullable Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof PointType)) { return false; } PointType other = (PointType) obj; if (!getLatitude().equals(other.getLatitude()) || !getLongitude().equals(other.getLongitude()) || !getAltitude().equals(other.getAltitude())) { return false; } return true; }
@Override public <T extends State> @Nullable T as(@Nullable Class<T> target) { if (target == OnOffType.class) { return target.cast(equals(ZERO) ? OnOffType.OFF : OnOffType.ON); } else if (target == PercentType.class) { return target.cast(new PercentType(toBigDecimal().multiply(BigDecimal.valueOf(100)))); } else if (target == UpDownType.class) { if (equals(ZERO)) { return target.cast(UpDownType.UP); } else if (toBigDecimal().compareTo(BigDecimal.valueOf(1)) == 0) { return target.cast(UpDownType.DOWN); } else { return null; } } else if (target == OpenClosedType.class) { if (equals(ZERO)) { return target.cast(OpenClosedType.CLOSED); } else if (toBigDecimal().compareTo(BigDecimal.valueOf(1)) == 0) { return target.cast(OpenClosedType.OPEN); } else { return null; } } else if (target == HSBType.class) { return target.cast(new HSBType(DecimalType.ZERO, PercentType.ZERO, new PercentType(this.toBigDecimal().multiply(BigDecimal.valueOf(100))))); } else { return defaultConversion(target); } }
@Override public boolean equals(@Nullable Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof HSBType)) { return false; } HSBType other = (HSBType) obj; if (!getHue().equals(other.getHue()) || !getSaturation().equals(other.getSaturation()) || !getBrightness().equals(other.getBrightness())) { return false; } return true; }