org.geotools.temporal.reference.DefaultOrdinalEra 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 java.util.Date;
import org.geotools.util.Utilities;
import org.opengis.temporal.OrdinalEra;
import org.opengis.util.InternationalString;
/** @author Mehdi Sidhoum (Geomatys) */
public class DefaultOrdinalEra implements OrdinalEra {
/** This is a string that identifies the ordinal era within the TM_OrdinalReferenceSystem. */
private InternationalString name;
/** This is the temporal position at which the ordinal era began, if it is known. */
private Date beginning;
/** This is the temporal position at which the ordinal era ended. */
private Date end;
private DefaultOrdinalEra group;
public DefaultOrdinalEra(InternationalString name, Date beginning, Date end) {
if (!beginning.before(end))
throw new IllegalArgumentException(
"The beginning date of the OrdinalEra must be less than (i.e. earlier than) the end date of this OrdinalEra.");
this.name = name;
this.beginning = beginning;
this.end = end;
}
public DefaultOrdinalEra(
InternationalString name,
Date beginning,
Date end,
Collection composition) {
this.name = name;
this.beginning = beginning;
this.end = end;
for (OrdinalEra ordinalEra : composition) {
((DefaultOrdinalEra) ordinalEra).setGroup(this);
}
}
public InternationalString getName() {
return name;
}
public Date getBeginning() {
return beginning;
}
public Date getEnd() {
return end;
}
public Collection getComposition() {
return null;
}
public void setName(InternationalString name) {
this.name = name;
}
public void setBeginning(Date beginning) {
this.beginning = beginning;
}
public void setEnd(Date end) {
this.end = end;
}
public DefaultOrdinalEra getGroup() {
return group;
}
public void setGroup(DefaultOrdinalEra group) {
this.group = group;
}
@Override
public boolean equals(final Object object) {
if (object instanceof DefaultOrdinalEra) {
final DefaultOrdinalEra that = (DefaultOrdinalEra) object;
return Utilities.equals(this.beginning, that.beginning)
&& Utilities.equals(this.end, that.end)
&& Utilities.equals(this.group, that.group)
&& Utilities.equals(this.name, that.name);
}
return false;
}
@Override
public int hashCode() {
int hash = 5;
hash = 37 * hash + (this.beginning != null ? this.beginning.hashCode() : 0);
hash = 37 * hash + (this.end != null ? this.end.hashCode() : 0);
hash = 37 * hash + (this.group != null ? this.group.hashCode() : 0);
hash = 37 * hash + (this.name != null ? this.name.hashCode() : 0);
return hash;
}
@Override
public String toString() {
StringBuilder s = new StringBuilder("OrdinalEra:").append('\n');
if (name != null) {
s.append("name:").append(name).append('\n');
}
if (beginning != null) {
s.append("beginning:").append(beginning).append('\n');
}
if (end != null) {
s.append("end:").append(end).append('\n');
}
if (group != null) {
s.append("group:").append(group).append('\n');
}
return s.toString();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy