ohymosj
クラス OhTimePoint

java.lang.Object
  拡張ohymosj.OhTimePoint
すべての実装インタフェース:
java.lang.Cloneable, java.lang.Comparable

public class OhTimePoint
extends java.lang.Object
implements java.lang.Cloneable, java.lang.Comparable

年と経過時間[sec]とで表されるシミュレーション時刻を表すクラスです。

バージョン:
$Revision: 1.7 $ $Date: 2004/02/10 16:45:15 $
作成者:
shiiba

フィールドの概要
protected  long _oneYearInSec
           
protected  long _tsec
           対象とする年の年始からの経過時間[sec]です。
protected  int _year
           年です。
static int DAY
          The index of the element of the calendar array which contains the datum of day.
static int HOUR
          The index of the element of the calendar array which contains the datum of hour.
protected static int[] lDay
           
static int MINUTE
          The index of the element of the calendar array which contains the datum of munute.
static int MONTH
          The index of the element of the calendar array which contains the datum of month.
protected static int[] nDay
           
static OhTimePoint OhTimePointMax
           現実的にこれ以上最新の時刻はないと思われる時刻です。
static OhTimePoint OhTimePointMin
           現実的にこれ以上昔の時刻はないと思われる時刻です。
static int SECOND
          The index of the element of the calendar array which contains the datum of second.
static int YEAR
          The index of the element of the calendar array which contains the datum of year.
 
コンストラクタの概要
OhTimePoint()
          Creates a new default OhTimePoint instance.
OhTimePoint(int aYear, int aMonth, int aDay, int aHour, int aMin, int aSec)
          Creates a new OhTimePoint instance.
OhTimePoint(int aYear, long aTsec)
          Creates a new OhTimePoint instance.
OhTimePoint(OhTimePoint tp)
          Creates a new OhTimePoint instance from another OhTimePoint instance.
 
メソッドの概要
 OhTimePoint add(long timeSec)
          Adds the specified amount of seconds to the current object and returns the updated object.
 java.lang.Object clone()
          Returns a deep copy of the current object
 int compareTo(java.lang.Object arg)
          Compares the current OhTimePoint object to another object 'arg' and returns the result.
 void copy(OhTimePoint tp)
          Copies fields from those of OhTimePoint tp.
 boolean equals(java.lang.Object arg)
          Tests if the specified Object is an instance of OhTimePoint and if it equals this OhTimePoint.
 long getOneYearInSec()
          Gets the number of seconds contained in the year of the time expressed by this OhTimePoint object
 long getTsec()
          Gets the time from the beginning of the year of the time expressed by this OhTimePoint object
 int getYear()
          Gets the year
static boolean isLeapYear(int aYear)
          Tests if the year 'aYear' is a leap year or not.
 OhTimePoint setTsec(long aTsec)
          Set this OhTimePoint time at the time point when 'aTsec' seconds have elapsed from the beginning of the year.
 OhTimePoint setYear(int aYear)
          Sets the time of this OhTimePoint object to the beginning of the year aYear.
 long subtract(OhTimePoint aT)
           aT との差[sec]を返します。
 int[] toCalendarArray()
          Converts the current OhTimePoint object to the Calendar array.
 java.lang.String toCalendarString()
          Returns the CalendaString.
 java.lang.String toString()
          Returns "" + _year + " " + _tsec.
 
クラス java.lang.Object から継承したメソッド
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

フィールドの詳細

_year

protected int _year
年です。


_tsec

protected long _tsec
対象とする年の年始からの経過時間[sec]です。


_oneYearInSec

protected long _oneYearInSec

nDay

protected static int[] nDay

lDay

protected static int[] lDay

YEAR

public static final int YEAR
The index of the element of the calendar array which contains the datum of year. The calendar array is obtained by toCalendarArray()

関連項目:
定数フィールド値

MONTH

public static final int MONTH
The index of the element of the calendar array which contains the datum of month. The calendar array is obtained by toCalendarArray()

関連項目:
定数フィールド値

DAY

public static final int DAY
The index of the element of the calendar array which contains the datum of day. The calendar array is obtained by toCalendarArray()

関連項目:
定数フィールド値

HOUR

public static final int HOUR
The index of the element of the calendar array which contains the datum of hour. The calendar array is obtained by toCalendarArray()

関連項目:
定数フィールド値

MINUTE

public static final int MINUTE
The index of the element of the calendar array which contains the datum of munute. The calendar array is obtained by toCalendarArray()

関連項目:
定数フィールド値

SECOND

public static final int SECOND
The index of the element of the calendar array which contains the datum of second. The calendar array is obtained by toCalendarArray()

関連項目:
定数フィールド値

OhTimePointMin

public static OhTimePoint OhTimePointMin
現実的にこれ以上昔の時刻はないと思われる時刻です。

  • _year : -1
  • _tsec : 0

をもって定義しています。


OhTimePointMax

public static OhTimePoint OhTimePointMax
現実的にこれ以上最新の時刻はないと思われる時刻です。

  • _year : 10000
  • _tsec : 0

をもって定義しています。

コンストラクタの詳細

OhTimePoint

public OhTimePoint()
Creates a new default OhTimePoint instance. The default time is the beginning of the year 0.


OhTimePoint

public OhTimePoint(int aYear,
                   long aTsec)
Creates a new OhTimePoint instance.

パラメータ:
aYear - an int value.
aTsec - a long value. Time from the beginning of the year.

OhTimePoint

public OhTimePoint(int aYear,
                   int aMonth,
                   int aDay,
                   int aHour,
                   int aMin,
                   int aSec)
Creates a new OhTimePoint instance.

パラメータ:
aYear - an int value. year ex. 2003
aMonth - an int value. month from 1 to 12. 1 for January
aDay - an int value. day 1 for the first day of the month
aHour - an int value. hour from 0 to 23
aMin - an int value. min from 0 to 59
aSec - an int value. second from 0 to 59

OhTimePoint

public OhTimePoint(OhTimePoint tp)
Creates a new OhTimePoint instance from another OhTimePoint instance.

パラメータ:
tp - an OhTimePoint value
メソッドの詳細

clone

public java.lang.Object clone()
Returns a deep copy of the current object

戻り値:
an Object value

copy

public void copy(OhTimePoint tp)
Copies fields from those of OhTimePoint tp.

パラメータ:
tp - an Object value

equals

public boolean equals(java.lang.Object arg)
Tests if the specified Object is an instance of OhTimePoint and if it equals this OhTimePoint.

パラメータ:
arg - an Object value
戻り値:
a boolean value

getYear

public int getYear()
Gets the year

戻り値:
an int value

getTsec

public long getTsec()
Gets the time from the beginning of the year of the time expressed by this OhTimePoint object

戻り値:
a long value

getOneYearInSec

public long getOneYearInSec()
Gets the number of seconds contained in the year of the time expressed by this OhTimePoint object

戻り値:
a long value

isLeapYear

public static boolean isLeapYear(int aYear)
Tests if the year 'aYear' is a leap year or not.

パラメータ:
aYear - an int value
戻り値:
a boolean value

toCalendarArray

public int[] toCalendarArray()
Converts the current OhTimePoint object to the Calendar array. When cal is the returned array, cal[OhTimePoint.YEAR], cal[OhTimePoint.MONTH], cal[OhTimePoint.DAY], cal[OhTimePoint.HOUR], cal[OhTimePoint.MINUTE], cal[OhTimePoint.SECOND] contain year, month, hour, minute and second data.

戻り値:
an int[] value

setYear

public OhTimePoint setYear(int aYear)
Sets the time of this OhTimePoint object to the beginning of the year aYear.

パラメータ:
aYear - an int value
戻り値:
an OhTimePoint value

setTsec

public OhTimePoint setTsec(long aTsec)
Set this OhTimePoint time at the time point when 'aTsec' seconds have elapsed from the beginning of the year.

パラメータ:
aTsec - a long value
戻り値:
an OhTimePoint value

compareTo

public int compareTo(java.lang.Object arg)
Compares the current OhTimePoint object to another object 'arg' and returns the result. The returend value is 1, 0, -1

定義:
インタフェース java.lang.Comparable 内の compareTo
パラメータ:
arg - an Object value
戻り値:
an int value. the value 0 if this OhTimePoint object expresses the same time as the argument OhTimePoint object; the value -1 0 if this OhTimePoint object expresses earlier time than the argument OhTimePoint object; the value 1 if this OhTimePoint object expresses later time than the argument OhTimePoint object.

add

public OhTimePoint add(long timeSec)
Adds the specified amount of seconds to the current object and returns the updated object.

パラメータ:
timeSec - a long value.
戻り値:
an OhTimePoint value

subtract

public long subtract(OhTimePoint aT)
aT との差[sec]を返します。

パラメータ:
aT - an OhTimePoint value
戻り値:
a long value

toString

public java.lang.String toString()
Returns "" + _year + " " + _tsec.

戻り値:
a String value

toCalendarString

public java.lang.String toCalendarString()
Returns the CalendaString. For example, this method returns "20030101010101" for 2003 January 1st, 01:01:01.

戻り値:
a String value