org.geotools.temporal.reference.DefaultCalendarEra Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gt-main Show documentation
Show all versions of gt-main Show documentation
The main module contains the GeoTools public interfaces that are used by
other GeoTools modules (and GeoTools applications). Where possible we make
use industry standard terms as provided by OGC and ISO standards.
The formal GeoTools public api consists of gt-metadata, jts and the gt-main module.
The main module contains the default implementations that are available provided
to other GeoTools modules using our factory system. Factories are obtained from
an appropriate FactoryFinder, giving applications a chance configure the factory
used using the Factory Hints facilities.
FilterFactory ff = CommonFactoryFinder.getFilterFactory();
Expression expr = ff.add( expression1, expression2 );
If you find yourself using implementation specific classes chances are you doing it wrong:
Expression expr = new AddImpl( expression1, expressiom2 );
The newest version!
/*
* GeoTools - The Open Source Java GIS Toolkit
* http://geotools.org
*
* (C) 2008, Open Source Geospatial Foundation (OSGeo)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*/
package org.geotools.temporal.reference;
import java.util.Collection;
import org.geotools.util.Utilities;
import org.opengis.temporal.Calendar;
import org.opengis.temporal.CalendarDate;
import org.opengis.temporal.CalendarEra;
import org.opengis.temporal.JulianDate;
import org.opengis.temporal.Period;
import org.opengis.util.InternationalString;
/** @author Mehdi Sidhoum (Geomatys) */
public class DefaultCalendarEra implements CalendarEra {
/** identify the calendar era within this calendar. */
private InternationalString name;
/**
* provide the name or description of a mythical or historic event which fixes the position of
* the base scale of the calendar era.
*/
private InternationalString referenceEvent;
/**
* provide the date of the reference referenceEvent expressed as a date in the given calendar.
* In most calendars, this date is the origin (i.e the first day) of the scale, but this is not
* always true.
*/
private CalendarDate referenceDate;
/** provide the Julian date that corresponds to the reference date. */
private JulianDate julianReference;
/**
* identify the TM_Period for which the calendar era was used as a basis for dating, the
* datatype for TM_Period.begin and Tm_Period.end shall be JulianDate.
*/
private Period epochOfUse;
public DefaultCalendarEra(
InternationalString name,
InternationalString referenceEvent,
CalendarDate referenceDate,
JulianDate julianReference,
Period epochOfUse) {
this.name = name;
this.referenceDate = referenceDate;
this.referenceEvent = referenceEvent;
this.julianReference = julianReference;
this.epochOfUse = epochOfUse;
}
public InternationalString getName() {
return name;
}
public InternationalString getReferenceEvent() {
return referenceEvent;
}
public CalendarDate getReferenceDate() {
return referenceDate;
}
public JulianDate getJulianReference() {
return julianReference;
}
public Period getEpochOfUse() {
return epochOfUse;
}
public void setName(InternationalString name) {
this.name = name;
}
public void setReferenceEvent(InternationalString referenceEvent) {
this.referenceEvent = referenceEvent;
}
public void setReferenceDate(CalendarDate referenceDate) {
this.referenceDate = referenceDate;
}
public void setJulianReference(JulianDate julianReference) {
this.julianReference = julianReference;
}
public void setEpochOfUse(Period epochOfUse) {
this.epochOfUse = epochOfUse;
}
public Collection getDatingSystem() {
return null;
}
@Override
public boolean equals(final Object object) {
if (object instanceof DefaultCalendarEra) {
final DefaultCalendarEra that = (DefaultCalendarEra) object;
return Utilities.equals(this.epochOfUse, that.epochOfUse)
&& Utilities.equals(this.julianReference, that.julianReference)
&& Utilities.equals(this.name, that.name)
&& Utilities.equals(this.referenceDate, that.referenceDate)
&& Utilities.equals(this.referenceEvent, that.referenceEvent);
}
return false;
}
@Override
public int hashCode() {
int hash = 5;
hash = 37 * hash + (this.epochOfUse != null ? this.epochOfUse.hashCode() : 0);
hash = 37 * hash + (this.julianReference != null ? this.julianReference.hashCode() : 0);
hash = 37 * hash + (this.name != null ? this.name.hashCode() : 0);
hash = 37 * hash + (this.referenceDate != null ? this.referenceDate.hashCode() : 0);
hash = 37 * hash + (this.referenceEvent != null ? this.referenceEvent.hashCode() : 0);
return hash;
}
@Override
public String toString() {
StringBuilder s = new StringBuilder("CalendarEra:").append('\n');
if (name != null) {
s.append("name:").append(name).append('\n');
}
if (epochOfUse != null) {
s.append("epochOfUse:").append(epochOfUse).append('\n');
}
if (referenceEvent != null) {
s.append("referenceEvent:").append(referenceEvent).append('\n');
}
if (referenceDate != null) {
s.append("referenceDate:").append(referenceDate).append('\n');
}
if (julianReference != null) {
s.append("julianReference:").append(julianReference).append('\n');
}
return s.toString();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy