TsPeriod implements Serializable, Cloneable, IPeriod,
        Comparable<TsPeriod> { public Date middle() { int ifreq = m_freq.intValue(); int c = 12 / ifreq; int y = getYear(), p = getPosition(); return new Date(CalendarUtil.getInstance().calcMiddleInMillis(c, y, p)); } TsPeriod(final TsFrequency frequency);  TsPeriod(final TsFrequency frequency, final Date date);  TsPeriod(final TsFrequency frequency, final Day day);   TsPeriod(final TsFrequency frequency, final int id);  TsPeriod(final TsFrequency frequency, final int year,
            final int position);  TsPeriod(final TsFrequency frequency, final TsPeriod p); static String formatPeriod(TsFrequency freq, int pos); static String formatShortPeriod(TsFrequency freq, int pos); static TsPeriod year(int y); @Override TsPeriod clone(); @Override int compareTo(final TsPeriod other); @Override boolean contains(final Date dt); boolean contains(final Day day); @Override boolean equals(Object obj); boolean equals(TsPeriod other); @Override Day firstday(); TsFrequency getFrequency(); TsPeriod lastPeriod(TsFrequency freq); TsPeriod firstPeriod(TsFrequency freq); String getPeriodString(); int getPosition(); int getYear(); @Override int hashCode(); int id(); boolean isAfter(final Date date); boolean isAfter(final Day day); boolean isAfter(final TsPeriod rp); boolean isBefore(final Date date); boolean isBefore(final Day day); boolean isBefore(final TsPeriod rp); boolean isInside(final TsPeriod p); boolean isNotAfter(final TsPeriod rp); boolean isNotBefore(final TsPeriod rp); @Override Day lastday(); Date middle(); TsPeriod minus(int nperiods); int minus(final TsPeriod p); void move(final int nperiods); TsPeriod plus(int nperiods); final void set(final Date date); final void set(final Day day); final void set(int year, final int position); @Override String toString();  }
@Test public void testMiddle() { Calendar cal = Calendar.getInstance(); cal.setTime(period_2001_03.middle()); assertEquals(2001, cal.get(Calendar.YEAR)); assertEquals(Calendar.MARCH, cal.get(Calendar.MONTH)); assertEquals(16, cal.get(Calendar.DAY_OF_MONTH)); assertEquals(0, cal.get(Calendar.HOUR_OF_DAY)); assertEquals(0, cal.get(Calendar.MINUTE)); assertEquals(0, cal.get(Calendar.SECOND)); assertEquals(0, cal.get(Calendar.MILLISECOND)); cal.setTime(period_2001_03.plus(1).middle()); assertEquals(2001, cal.get(Calendar.YEAR)); assertEquals(Calendar.APRIL, cal.get(Calendar.MONTH)); assertEquals(15, cal.get(Calendar.DAY_OF_MONTH)); assertEquals(0, cal.get(Calendar.HOUR_OF_DAY)); assertEquals(0, cal.get(Calendar.MINUTE)); assertEquals(0, cal.get(Calendar.SECOND)); assertEquals(0, cal.get(Calendar.MILLISECOND)); }