Clover coverage report - Maven Clover report
Coverage timestamp: Thu Aug 24 2006 01:18:17 PDT
file stats: LOC: 154   Methods: 23
NCLOC: 96   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
JspCalendar.java 0% 0% 0% 0%
coverage
 1    /*
 2    * Copyright 2004 The Apache Software Foundation
 3    *
 4    * Licensed under the Apache License, Version 2.0 (the "License");
 5    * you may not use this file except in compliance with the License.
 6    * You may obtain a copy of the License at
 7    *
 8    * http://www.apache.org/licenses/LICENSE-2.0
 9    *
 10    * Unless required by applicable law or agreed to in writing, software
 11    * distributed under the License is distributed on an "AS IS" BASIS,
 12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13    * See the License for the specific language governing permissions and
 14    * limitations under the License.
 15    */
 16   
 17    package cal;
 18   
 19    import java.text.DateFormat;
 20    import java.util.*;
 21   
 22    public class JspCalendar {
 23    Calendar calendar = null;
 24    Date currentDate;
 25   
 26  0 public JspCalendar() {
 27  0 calendar = Calendar.getInstance();
 28  0 Date trialTime = new Date();
 29  0 calendar.setTime(trialTime);
 30    }
 31   
 32   
 33  0 public int getYear() {
 34  0 return calendar.get(Calendar.YEAR);
 35    }
 36   
 37  0 public String getMonth() {
 38  0 int m = getMonthInt();
 39  0 String[] months = new String [] { "January", "February", "March",
 40    "April", "May", "June",
 41    "July", "August", "September",
 42    "October", "November", "December" };
 43  0 if (m > 12)
 44  0 return "Unknown to Man";
 45   
 46  0 return months[m - 1];
 47   
 48    }
 49   
 50  0 public String getDay() {
 51  0 int x = getDayOfWeek();
 52  0 String[] days = new String[] {"Sunday", "Monday", "Tuesday", "Wednesday",
 53    "Thursday", "Friday", "Saturday"};
 54   
 55  0 if (x > 7)
 56  0 return "Unknown to Man";
 57   
 58  0 return days[x - 1];
 59   
 60    }
 61   
 62  0 public int getMonthInt() {
 63  0 return 1 + calendar.get(Calendar.MONTH);
 64    }
 65   
 66  0 public String getDate() {
 67  0 return getMonthInt() + "/" + getDayOfMonth() + "/" + getYear();
 68    }
 69   
 70  0 public String getCurrentDate() {
 71  0 Date dt = new Date ();
 72  0 calendar.setTime (dt);
 73  0 return getMonthInt() + "/" + getDayOfMonth() + "/" + getYear();
 74   
 75    }
 76   
 77  0 public String getNextDate() {
 78  0 calendar.set (Calendar.DAY_OF_MONTH, getDayOfMonth() + 1);
 79  0 return getDate ();
 80    }
 81   
 82  0 public String getPrevDate() {
 83  0 calendar.set (Calendar.DAY_OF_MONTH, getDayOfMonth() - 1);
 84  0 return getDate ();
 85    }
 86   
 87  0 public String getTime() {
 88  0 return getHour() + ":" + getMinute() + ":" + getSecond();
 89    }
 90   
 91  0 public int getDayOfMonth() {
 92  0 return calendar.get(Calendar.DAY_OF_MONTH);
 93    }
 94   
 95  0 public int getDayOfYear() {
 96  0 return calendar.get(Calendar.DAY_OF_YEAR);
 97    }
 98   
 99  0 public int getWeekOfYear() {
 100  0 return calendar.get(Calendar.WEEK_OF_YEAR);
 101    }
 102   
 103  0 public int getWeekOfMonth() {
 104  0 return calendar.get(Calendar.WEEK_OF_MONTH);
 105    }
 106   
 107  0 public int getDayOfWeek() {
 108  0 return calendar.get(Calendar.DAY_OF_WEEK);
 109    }
 110   
 111  0 public int getHour() {
 112  0 return calendar.get(Calendar.HOUR_OF_DAY);
 113    }
 114   
 115  0 public int getMinute() {
 116  0 return calendar.get(Calendar.MINUTE);
 117    }
 118   
 119   
 120  0 public int getSecond() {
 121  0 return calendar.get(Calendar.SECOND);
 122    }
 123   
 124   
 125  0 public int getEra() {
 126  0 return calendar.get(Calendar.ERA);
 127    }
 128   
 129  0 public String getUSTimeZone() {
 130  0 String[] zones = new String[] {"Hawaii", "Alaskan", "Pacific",
 131    "Mountain", "Central", "Eastern"};
 132   
 133  0 return zones[10 + getZoneOffset()];
 134    }
 135   
 136  0 public int getZoneOffset() {
 137  0 return calendar.get(Calendar.ZONE_OFFSET)/(60*60*1000);
 138    }
 139   
 140   
 141  0 public int getDSTOffset() {
 142  0 return calendar.get(Calendar.DST_OFFSET)/(60*60*1000);
 143    }
 144   
 145   
 146  0 public int getAMPM() {
 147  0 return calendar.get(Calendar.AM_PM);
 148    }
 149    }
 150   
 151   
 152   
 153   
 154