// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package com.philips.lighting.model; public class PHLightState { private static final int BRIGHTNESS_MAX = 254; private static final int BRIGHTNESS_MIN = 0; private static final int CT_MAX = 500; private static final int CT_MIN = 153; private static final int HUE_MAX = 65535; private static final int HUE_MIN = 0; private static final int SATURATION_MAX = 254; private static final int SATURATION_MIN = 0; private static final int TRANSITION_TIME_MAX = 65535; private static final int TRANSITION_TIME_MIN = 0; public static final int VALUE_NOT_SET = -55; private static final float XY_MAX = 1F; private static final float XY_MIN = 0F; private PHLight.PHLightAlertMode alert; private int brightness; private PHLight.PHLightColorMode colormode; private int ct; private PHLight.PHLightEffectMode effect; private int hue; private Boolean on; private int saturation; private int transitionTime; private float x; private float y; public PHLightState() { brightness = -55; hue = -55; saturation = -55; ct = -55; transitionTime = -55; x = -55F; y = -55F; } public PHLightState(PHLightState phlightstate) { brightness = -55; hue = -55; saturation = -55; ct = -55; transitionTime = -55; x = -55F; y = -55F; if (phlightstate == null) { throw new IllegalArgumentException("Input parameter can't be null"); } else { alert = phlightstate.alert; brightness = phlightstate.brightness; colormode = phlightstate.colormode; ct = phlightstate.ct; effect = phlightstate.effect; hue = phlightstate.hue; on = phlightstate.on; saturation = phlightstate.saturation; transitionTime = phlightstate.transitionTime; x = phlightstate.x; y = phlightstate.y; return; } } public boolean equals(Object obj) { if (this != obj) { if (obj == null) { return false; } if (!(obj instanceof PHLightState)) { return false; } obj = (PHLightState)obj; if (alert != ((PHLightState) (obj)).alert) { return false; } if (brightness != ((PHLightState) (obj)).brightness) { return false; } if (colormode != ((PHLightState) (obj)).colormode) { return false; } if (ct != ((PHLightState) (obj)).ct) { return false; } if (effect != ((PHLightState) (obj)).effect) { return false; } if (hue != ((PHLightState) (obj)).hue) { return false; } if (on == null) { if (((PHLightState) (obj)).on != null) { return false; } } else if (!on.equals(((PHLightState) (obj)).on)) { return false; } if (saturation != ((PHLightState) (obj)).saturation) { return false; } if (transitionTime != ((PHLightState) (obj)).transitionTime) { return false; } if (Float.floatToIntBits(x) != Float.floatToIntBits(((PHLightState) (obj)).x)) { return false; } if (Float.floatToIntBits(y) != Float.floatToIntBits(((PHLightState) (obj)).y)) { return false; } } return true; } public PHLight.PHLightAlertMode getAlertMode() { return alert; } public int getBrightness() { return brightness; } public PHLight.PHLightColorMode getColorMode() { return colormode; } public int getCt() { return ct; } public PHLight.PHLightEffectMode getEffectMode() { return effect; } public int getHue() { return hue; } public int getSaturation() { return saturation; } public int getTransitionTime() { return transitionTime; } public float getX() { return x; } public float getY() { return y; } public int hashCode() { int l = 0; int i; int j; int k; int i1; int j1; int k1; if (alert == null) { i = 0; } else { i = alert.hashCode(); } i1 = brightness; if (colormode == null) { j = 0; } else { j = colormode.hashCode(); } j1 = ct; if (effect == null) { k = 0; } else { k = effect.hashCode(); } k1 = hue; if (on != null) { l = on.hashCode(); } return ((((((((((i + 31) * 31 + i1) * 31 + j) * 31 + j1) * 31 + k) * 31 + k1) * 31 + l) * 31 + saturation) * 31 + transitionTime) * 31 + Float.floatToIntBits(x)) * 31 + Float.floatToIntBits(y); } public Boolean isOn() { return on; } public void setAlertMode(PHLight.PHLightAlertMode phlightalertmode) { alert = phlightalertmode; } public void setBrightness(int i) { brightness = i; } public void setColorMode(PHLight.PHLightColorMode phlightcolormode) { colormode = phlightcolormode; } public void setCt(int i) { ct = i; } public void setEffectMode(PHLight.PHLightEffectMode phlighteffectmode) { effect = phlighteffectmode; } public void setHue(int i) { hue = i; } public void setOn(Boolean boolean1) { on = boolean1; } public void setSaturation(int i) { saturation = i; } public void setTransitionTime(int i) { transitionTime = i; } public void setX(float f) { x = f; } public void setY(float f) { y = f; } public String validateState() { if (brightness != -55 && (brightness < 0 || brightness > 254)) { return "brightness should be a value between 0 and 254"; } if (hue != -55 && (hue < 0 || hue > 65535)) { return "hue should be a value between 0 and 65535"; } if (saturation != -55 && (saturation < 0 || saturation > 254)) { return "saturation should be a value between 0 and 254"; } if (ct != -55 && (ct < 153 || ct > 500)) { return "color temperature should be a value between 153 and 500"; } if (x != -55F && y == -55F || x == -55F && y != -55F) { return "x and y need both to be set"; } if (x != -55F && y != -55F) { if (x < 0.0F || x > 1.0F) { return "x should be a value between 0.0 and1.0"; } if (y < 0.0F || y > 1.0F) { return "y should be a value betwee n0.0 and1.0"; } } if (alert != null && (alert.ordinal() < PHLight.PHLightAlertMode.ALERT_UNKNOWN.ordinal() || alert.ordinal() > PHLight.PHLightAlertMode.ALERT_LSELECT.ordinal())) { return "alert mode is invalid"; } if (effect != null && (effect.ordinal() < PHLight.PHLightEffectMode.EFFECT_UNKNOWN.ordinal() || effect.ordinal() > PHLight.PHLightEffectMode.EFFECT_COLORLOOP.ordinal())) { return "effect mode is invalid"; } if (transitionTime != -55 && (transitionTime < 0 || transitionTime > 65535)) { return "transition time should be a value between0 and65535"; } else { return null; } } }