OrdinalPeriod.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/datatype/OrdinalPeriod.cpp
22 
23  \brief A class to represent ordinal time period.
24 */
25 
26 // TerraLib
27 #include "OrdinalPeriod.h"
28 
30 
31 {
32 }
33 
35  : m_initialInstant(it),
36  m_finalInstant(ft)
37 {
38 }
39 
41 {
43 }
44 
46 {
48 }
49 
51 {
52  const te::dt::OrdinalPeriod* t = dynamic_cast<const te::dt::OrdinalPeriod*>(&rhs);
53  return (m_initialInstant == t->m_initialInstant &&
55 }
56 
58 {
59  const te::dt::OrdinalPeriod* t = dynamic_cast<const te::dt::OrdinalPeriod*>(&rhs);
60  return (m_initialInstant != t->m_initialInstant ||
62 }
63 
65 {
66  const te::dt::OrdinalPeriod* t = dynamic_cast<const te::dt::OrdinalPeriod*>(&rhs);
67  return m_finalInstant < t->m_initialInstant;
68 }
69 
71 {
72  const te::dt::OrdinalPeriod* t = dynamic_cast<const te::dt::OrdinalPeriod*>(&rhs);
73  return m_initialInstant > t->m_finalInstant;
74 }
75 
77 {
78  return new OrdinalPeriod(*this);
79 }
80 
81 std::string te::dt::OrdinalPeriod::toString() const
82 {
83  return std::string(m_initialInstant.toString() + "-" + m_finalInstant.toString());
84 }
85 
A class to represent ordinal time period.
Definition: OrdinalPeriod.h:55
std::string toString() const
It returns the time period in a textual format (initialTimeInstant-finalTimeinstant) ...
OrdinalInstant m_finalInstant
The final time instant information.
std::string toString() const
It returns the time instant in a textual format.
A class to represent ordinal time period.
DateTimeInstant * getInitialInstant() const
It gets the initial date time instant.
bool operator>(const DateTime &rhs) const
Operator >
A base class for values that can be retrieved from the data access module.
Definition: AbstractData.h:57
AbstractData * clone() const
It returns a clone of this object.
DateTimeInstant * getFinalInstant() const
It gets the final date time instant.
A class to represent ordinal time instant.
bool operator<(const DateTime &rhs) const
Operator <.
OrdinalInstant m_initialInstant
The initial time instant information.
OrdinalPeriod()
Empty constructor.
bool operator==(const DateTime &rhs) const
Operator ==.
An abstract class to represent an instant of date and time.
bool operator!=(const DateTime &rhs) const
Operator !=.