001// --------------------------------------------------------------------------------
002// Copyright 2002-2026 Echo Three, LLC
003//
004// Licensed under the Apache License, Version 2.0 (the "License");
005// you may not use this file except in compliance with the License.
006// You may obtain a copy of the License at
007//
008//     http://www.apache.org/licenses/LICENSE-2.0
009//
010// Unless required by applicable law or agreed to in writing, software
011// distributed under the License is distributed on an "AS IS" BASIS,
012// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013// See the License for the specific language governing permissions and
014// limitations under the License.
015// --------------------------------------------------------------------------------
016// Generated File -- DO NOT EDIT BY HAND
017// --------------------------------------------------------------------------------
018
019/**
020 * EntityGeoPointDefaultValue.java
021 */
022
023package com.echothree.model.data.core.server.value;
024
025import com.echothree.model.data.core.common.pk.EntityGeoPointDefaultPK;
026
027import com.echothree.model.data.core.server.factory.EntityGeoPointDefaultFactory;
028
029import com.echothree.model.data.core.common.pk.EntityAttributePK;
030
031import com.echothree.util.common.exception.PersistenceCloneException;
032import com.echothree.util.common.exception.PersistenceNotNullException;
033
034import com.echothree.util.server.persistence.BaseValue;
035
036import java.io.Serializable;
037
038import javax.annotation.Nonnull;
039import javax.annotation.Nullable;
040
041public class EntityGeoPointDefaultValue
042        extends BaseValue<EntityGeoPointDefaultPK>
043        implements Cloneable, Serializable {
044    
045    private EntityAttributePK entityAttributePK;
046    private boolean entityAttributePKHasBeenModified = false;
047    private Integer latitude;
048    private boolean latitudeHasBeenModified = false;
049    private Integer longitude;
050    private boolean longitudeHasBeenModified = false;
051    private Long elevation;
052    private boolean elevationHasBeenModified = false;
053    private Long altitude;
054    private boolean altitudeHasBeenModified = false;
055    private Long fromTime;
056    private boolean fromTimeHasBeenModified = false;
057    private Long thruTime;
058    private boolean thruTimeHasBeenModified = false;
059    
060    private transient Integer _hashCode = null;
061    private transient String _stringValue = null;
062    
063    private void constructFields(EntityAttributePK entityAttributePK, Integer latitude, Integer longitude, Long elevation, Long altitude, Long fromTime, Long thruTime)
064            throws PersistenceNotNullException {
065        checkForNull(entityAttributePK);
066        this.entityAttributePK = entityAttributePK;
067        checkForNull(latitude);
068        this.latitude = latitude;
069        checkForNull(longitude);
070        this.longitude = longitude;
071        this.elevation = elevation;
072        this.altitude = altitude;
073        checkForNull(fromTime);
074        this.fromTime = fromTime;
075        checkForNull(thruTime);
076        this.thruTime = thruTime;
077    }
078    
079    /** Creates a new instance of EntityGeoPointDefaultValue */
080    public EntityGeoPointDefaultValue(EntityGeoPointDefaultPK entityGeoPointDefaultPK, EntityAttributePK entityAttributePK, Integer latitude, Integer longitude, Long elevation, Long altitude, Long fromTime, Long thruTime)
081            throws PersistenceNotNullException {
082        super(entityGeoPointDefaultPK);
083        constructFields(entityAttributePK, latitude, longitude, elevation, altitude, fromTime, thruTime);
084    }
085    
086    /** Creates a new instance of EntityGeoPointDefaultValue */
087    public EntityGeoPointDefaultValue(EntityAttributePK entityAttributePK, Integer latitude, Integer longitude, Long elevation, Long altitude, Long fromTime, Long thruTime)
088            throws PersistenceNotNullException {
089        super();
090        constructFields(entityAttributePK, latitude, longitude, elevation, altitude, fromTime, thruTime);
091    }
092    
093    @Override
094    @Nonnull
095    public EntityGeoPointDefaultFactory getBaseFactoryInstance() {
096        return EntityGeoPointDefaultFactory.getInstance();
097    }
098    
099    @Override
100    @Nonnull
101    public EntityGeoPointDefaultValue clone() {
102        Object result;
103        
104        try {
105            result = super.clone();
106        } catch (CloneNotSupportedException cnse) {
107            // This shouldn't happen, fail when it does.
108            throw new PersistenceCloneException(cnse);
109        }
110        
111        return (EntityGeoPointDefaultValue)result;
112    }
113    
114    @Override
115    @Nonnull
116    public EntityGeoPointDefaultPK getPrimaryKey() {
117        if(_primaryKey == null) {
118            _primaryKey = new EntityGeoPointDefaultPK(entityId);
119        }
120        
121        return _primaryKey;
122    }
123    
124    private void clearHashAndString() {
125        _hashCode = null;
126        _stringValue = null;
127    }
128    
129    @Override
130    public int hashCode() {
131        if(_hashCode == null) {
132            int hashCode = 17;
133            
134            hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0);
135            
136            hashCode = 37 * hashCode + ((entityAttributePK != null) ? entityAttributePK.hashCode() : 0);
137            hashCode = 37 * hashCode + ((latitude != null) ? latitude.hashCode() : 0);
138            hashCode = 37 * hashCode + ((longitude != null) ? longitude.hashCode() : 0);
139            hashCode = 37 * hashCode + ((elevation != null) ? elevation.hashCode() : 0);
140            hashCode = 37 * hashCode + ((altitude != null) ? altitude.hashCode() : 0);
141            hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0);
142            hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0);
143            
144            _hashCode = hashCode;
145        }
146        
147        return _hashCode;
148    }
149    
150    @Override
151    @Nonnull
152    public String toString() {
153        if(_stringValue == null) {
154            _stringValue = "{" + 
155                    "entityId=" + getEntityId() +
156                    ", entityAttributePK=" + getEntityAttributePK() +
157                    ", latitude=" + getLatitude() +
158                    ", longitude=" + getLongitude() +
159                    ", elevation=" + getElevation() +
160                    ", altitude=" + getAltitude() +
161                    ", fromTime=" + getFromTime() +
162                    ", thruTime=" + getThruTime() +
163                    "}";
164        }
165        return _stringValue;
166    }
167    
168    @Override
169    public boolean equals(Object other) {
170        if(this == other)
171            return true;
172        
173        if(!hasIdentity())
174            return false;
175        
176        if(other instanceof  EntityGeoPointDefaultValue that) {
177            if(!that.hasIdentity())
178                return false;
179            
180            Long thisEntityId = getEntityId();
181            Long thatEntityId = that.getEntityId();
182            
183            boolean objectsEqual = thisEntityId.equals(thatEntityId);
184            if(objectsEqual)
185                objectsEqual = isIdentical(that);
186            
187            return objectsEqual;
188        } else {
189            return false;
190        }
191    }
192    
193    public boolean isIdentical(Object other) {
194        if(other instanceof EntityGeoPointDefaultValue that) {
195            boolean objectsEqual = true;
196            
197            
198            if(objectsEqual) {
199                EntityAttributePK thisEntityAttributePK = getEntityAttributePK();
200                EntityAttributePK thatEntityAttributePK = that.getEntityAttributePK();
201                
202                if(thisEntityAttributePK == null) {
203                    objectsEqual = objectsEqual && (thatEntityAttributePK == null);
204                } else {
205                    objectsEqual = objectsEqual && thisEntityAttributePK.equals(thatEntityAttributePK);
206                }
207            }
208            
209            if(objectsEqual) {
210                Integer thisLatitude = getLatitude();
211                Integer thatLatitude = that.getLatitude();
212                
213                if(thisLatitude == null) {
214                    objectsEqual = objectsEqual && (thatLatitude == null);
215                } else {
216                    objectsEqual = objectsEqual && thisLatitude.equals(thatLatitude);
217                }
218            }
219            
220            if(objectsEqual) {
221                Integer thisLongitude = getLongitude();
222                Integer thatLongitude = that.getLongitude();
223                
224                if(thisLongitude == null) {
225                    objectsEqual = objectsEqual && (thatLongitude == null);
226                } else {
227                    objectsEqual = objectsEqual && thisLongitude.equals(thatLongitude);
228                }
229            }
230            
231            if(objectsEqual) {
232                Long thisElevation = getElevation();
233                Long thatElevation = that.getElevation();
234                
235                if(thisElevation == null) {
236                    objectsEqual = objectsEqual && (thatElevation == null);
237                } else {
238                    objectsEqual = objectsEqual && thisElevation.equals(thatElevation);
239                }
240            }
241            
242            if(objectsEqual) {
243                Long thisAltitude = getAltitude();
244                Long thatAltitude = that.getAltitude();
245                
246                if(thisAltitude == null) {
247                    objectsEqual = objectsEqual && (thatAltitude == null);
248                } else {
249                    objectsEqual = objectsEqual && thisAltitude.equals(thatAltitude);
250                }
251            }
252            
253            if(objectsEqual) {
254                Long thisFromTime = getFromTime();
255                Long thatFromTime = that.getFromTime();
256                
257                if(thisFromTime == null) {
258                    objectsEqual = objectsEqual && (thatFromTime == null);
259                } else {
260                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
261                }
262            }
263            
264            if(objectsEqual) {
265                Long thisThruTime = getThruTime();
266                Long thatThruTime = that.getThruTime();
267                
268                if(thisThruTime == null) {
269                    objectsEqual = objectsEqual && (thatThruTime == null);
270                } else {
271                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
272                }
273            }
274            
275            return objectsEqual;
276        } else {
277            return false;
278        }
279    }
280    
281    @Override
282    public boolean hasBeenModified() {
283        return entityAttributePKHasBeenModified || latitudeHasBeenModified || longitudeHasBeenModified || elevationHasBeenModified || altitudeHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
284    }
285    
286    @Override
287    public void clearHasBeenModified() {
288        entityAttributePKHasBeenModified = false;
289        latitudeHasBeenModified = false;
290        longitudeHasBeenModified = false;
291        elevationHasBeenModified = false;
292        altitudeHasBeenModified = false;
293        fromTimeHasBeenModified = false;
294        thruTimeHasBeenModified = false;
295    }
296    
297    @Nonnull
298    public EntityAttributePK getEntityAttributePK() {
299        return entityAttributePK;
300    }
301    
302    public void setEntityAttributePK(@Nonnull EntityAttributePK entityAttributePK)
303            throws PersistenceNotNullException {
304        checkForNull(entityAttributePK);
305        
306        boolean update = true;
307        
308        if(this.entityAttributePK != null) {
309            if(this.entityAttributePK.equals(entityAttributePK)) {
310                update = false;
311            }
312        } else if(entityAttributePK == null) {
313            update = false;
314        }
315        
316        if(update) {
317            this.entityAttributePK = entityAttributePK;
318            entityAttributePKHasBeenModified = true;
319            clearHashAndString();
320        }
321    }
322    
323    public boolean getEntityAttributePKHasBeenModified() {
324        return entityAttributePKHasBeenModified;
325    }
326    
327    @Nonnull
328    public Integer getLatitude() {
329        return latitude;
330    }
331    
332    public void setLatitude(@Nonnull Integer latitude)
333            throws PersistenceNotNullException {
334        checkForNull(latitude);
335        
336        boolean update = true;
337        
338        if(this.latitude != null) {
339            if(this.latitude.equals(latitude)) {
340                update = false;
341            }
342        } else if(latitude == null) {
343            update = false;
344        }
345        
346        if(update) {
347            this.latitude = latitude;
348            latitudeHasBeenModified = true;
349            clearHashAndString();
350        }
351    }
352    
353    public boolean getLatitudeHasBeenModified() {
354        return latitudeHasBeenModified;
355    }
356    
357    @Nonnull
358    public Integer getLongitude() {
359        return longitude;
360    }
361    
362    public void setLongitude(@Nonnull Integer longitude)
363            throws PersistenceNotNullException {
364        checkForNull(longitude);
365        
366        boolean update = true;
367        
368        if(this.longitude != null) {
369            if(this.longitude.equals(longitude)) {
370                update = false;
371            }
372        } else if(longitude == null) {
373            update = false;
374        }
375        
376        if(update) {
377            this.longitude = longitude;
378            longitudeHasBeenModified = true;
379            clearHashAndString();
380        }
381    }
382    
383    public boolean getLongitudeHasBeenModified() {
384        return longitudeHasBeenModified;
385    }
386    
387    @Nullable
388    public Long getElevation() {
389        return elevation;
390    }
391    
392    public void setElevation(@Nullable Long elevation) {
393        boolean update = true;
394        
395        if(this.elevation != null) {
396            if(this.elevation.equals(elevation)) {
397                update = false;
398            }
399        } else if(elevation == null) {
400            update = false;
401        }
402        
403        if(update) {
404            this.elevation = elevation;
405            elevationHasBeenModified = true;
406            clearHashAndString();
407        }
408    }
409    
410    public boolean getElevationHasBeenModified() {
411        return elevationHasBeenModified;
412    }
413    
414    @Nullable
415    public Long getAltitude() {
416        return altitude;
417    }
418    
419    public void setAltitude(@Nullable Long altitude) {
420        boolean update = true;
421        
422        if(this.altitude != null) {
423            if(this.altitude.equals(altitude)) {
424                update = false;
425            }
426        } else if(altitude == null) {
427            update = false;
428        }
429        
430        if(update) {
431            this.altitude = altitude;
432            altitudeHasBeenModified = true;
433            clearHashAndString();
434        }
435    }
436    
437    public boolean getAltitudeHasBeenModified() {
438        return altitudeHasBeenModified;
439    }
440    
441    @Nonnull
442    public Long getFromTime() {
443        return fromTime;
444    }
445    
446    public void setFromTime(@Nonnull Long fromTime)
447            throws PersistenceNotNullException {
448        checkForNull(fromTime);
449        
450        boolean update = true;
451        
452        if(this.fromTime != null) {
453            if(this.fromTime.equals(fromTime)) {
454                update = false;
455            }
456        } else if(fromTime == null) {
457            update = false;
458        }
459        
460        if(update) {
461            this.fromTime = fromTime;
462            fromTimeHasBeenModified = true;
463            clearHashAndString();
464        }
465    }
466    
467    public boolean getFromTimeHasBeenModified() {
468        return fromTimeHasBeenModified;
469    }
470    
471    @Nonnull
472    public Long getThruTime() {
473        return thruTime;
474    }
475    
476    public void setThruTime(@Nonnull Long thruTime)
477            throws PersistenceNotNullException {
478        checkForNull(thruTime);
479        
480        boolean update = true;
481        
482        if(this.thruTime != null) {
483            if(this.thruTime.equals(thruTime)) {
484                update = false;
485            }
486        } else if(thruTime == null) {
487            update = false;
488        }
489        
490        if(update) {
491            this.thruTime = thruTime;
492            thruTimeHasBeenModified = true;
493            clearHashAndString();
494        }
495    }
496    
497    public boolean getThruTimeHasBeenModified() {
498        return thruTimeHasBeenModified;
499    }
500    
501}