src/jdk/nashorn/internal/objects/GenericPropertyDescriptor.java

Print this page




 132             this.configurable = JSType.toBoolean(sobj.get(CONFIGURABLE));
 133         } else {
 134             delete(CONFIGURABLE, false);
 135         }
 136 
 137         if (sobj.has(ENUMERABLE)) {
 138             this.enumerable = JSType.toBoolean(sobj.get(ENUMERABLE));
 139         } else {
 140             delete(ENUMERABLE, false);
 141         }
 142 
 143         return this;
 144     }
 145 
 146     @Override
 147     public int type() {
 148         return GENERIC;
 149     }
 150 
 151     @Override

















 152     public boolean equals(final Object obj) {
 153         if (this == obj) {
 154             return true;
 155         }
 156         if (!(obj instanceof GenericPropertyDescriptor)) {
 157             return false;
 158         }
 159 
 160         final GenericPropertyDescriptor other = (GenericPropertyDescriptor)obj;
 161         return ScriptRuntime.sameValue(configurable, other.configurable) &&
 162                ScriptRuntime.sameValue(enumerable, other.enumerable);
 163     }
 164 
 165     @Override
 166     public int hashCode() {
 167         int hash = 7;
 168         hash = 97 * hash + Objects.hashCode(this.configurable);
 169         hash = 97 * hash + Objects.hashCode(this.enumerable);
 170         return hash;
 171     }


 132             this.configurable = JSType.toBoolean(sobj.get(CONFIGURABLE));
 133         } else {
 134             delete(CONFIGURABLE, false);
 135         }
 136 
 137         if (sobj.has(ENUMERABLE)) {
 138             this.enumerable = JSType.toBoolean(sobj.get(ENUMERABLE));
 139         } else {
 140             delete(ENUMERABLE, false);
 141         }
 142 
 143         return this;
 144     }
 145 
 146     @Override
 147     public int type() {
 148         return GENERIC;
 149     }
 150 
 151     @Override
 152     public boolean hasAndEquals(final PropertyDescriptor other) {
 153         if (has(CONFIGURABLE) && other.has(CONFIGURABLE)) {
 154             if (isConfigurable() != other.isConfigurable()) {
 155                 return false;
 156             }
 157         }
 158 
 159         if (has(ENUMERABLE) && other.has(ENUMERABLE)) {
 160             if (isEnumerable() != other.isEnumerable()) {
 161                 return false;
 162             }
 163         }
 164 
 165         return true;
 166     }
 167 
 168     @Override
 169     public boolean equals(final Object obj) {
 170         if (this == obj) {
 171             return true;
 172         }
 173         if (!(obj instanceof GenericPropertyDescriptor)) {
 174             return false;
 175         }
 176 
 177         final GenericPropertyDescriptor other = (GenericPropertyDescriptor)obj;
 178         return ScriptRuntime.sameValue(configurable, other.configurable) &&
 179                ScriptRuntime.sameValue(enumerable, other.enumerable);
 180     }
 181 
 182     @Override
 183     public int hashCode() {
 184         int hash = 7;
 185         hash = 97 * hash + Objects.hashCode(this.configurable);
 186         hash = 97 * hash + Objects.hashCode(this.enumerable);
 187         return hash;
 188     }