XGTRBAC
Class PeriodicTimeExpr.StartTimeExpr

java.lang.Object
  extended by XGTRBAC.PeriodicTimeExpr.StartTimeExpr
Enclosing class:
PeriodicTimeExpr

public class PeriodicTimeExpr.StartTimeExpr
extends java.lang.Object

An inner "StartTimeExpr" class *


Field Summary
private  java.util.LinkedList DaySet
           
private  java.util.LinkedList MonthSet
           
private  java.lang.String PTExprId
           
private  java.util.LinkedList WeekSet
           
private  java.lang.String Year
           
 
Constructor Summary
PeriodicTimeExpr.StartTimeExpr()
          Creates a new instance of StartTimeExpr
 
Method Summary
 int addDay(java.lang.String day_id)
          Adds a new day to the DaySet
 int addMonth(java.lang.String month_id)
          Adds a new month to the MonthSet
 int addWeek(java.lang.String week_id)
          Adds a new week to the WeekSet
 boolean checkCalDuration(int cal_period, int this_period, DurationExpr d_expr, int cal_type)
          Evaluates if current calendar is included in calendar+duration
 boolean checkStartTime(Policy policy, java.util.GregorianCalendar calendar, java.lang.String d_expr_id)
          Evaluates the start time expression with respect to current time
 boolean evaluateDay(int cal_year, int cal_month, int this_month, int cal_week, int this_week, int cal_day, DurationExpr d_expr, int i)
          Checks if the periodic time constraint is satisfied at the given day
 boolean evaluateMonth(int cal_year, int cal_month, int cal_week, int cal_day, DurationExpr d_expr, int i)
          Checks if the periodic time constraint is satisfied at the given month
 boolean evaluateWeek(int cal_year, int cal_month, int this_month, int cal_week, int cal_day, DurationExpr d_expr, int i)
          Checks if the periodic time constraint is satisfied at the given week
 boolean evaluateYear(int cal_year)
          Checks if the periodic time constraint is satisfied at the given year
 java.lang.String getDay(int index)
          Returns the day
 int getDayCount()
          Returns the number of days in day set
 java.lang.String getMonth(int index)
          Returns the month
 int getMonthCount()
          Returns the number of months in month set
 int getPeriod(int year, int month, int week, int day)
          Returns the period in days from the start of the year given a month, week, and day
 java.lang.String getPTExprId()
          Returns the id reference of the periodic time for this start time expression
 java.lang.String getWeek(int index)
          Returns the week
 int getWeekCount()
          Returns the number of weeks in week set
 java.lang.String getYear()
          Returns the year of the start time expression
 void setPTExprId(java.lang.String pt_expr_id)
          Sets the id reference of the periodic time for this start time expression
 void setYear(java.lang.String year)
          Sets the year of the start time expression
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PTExprId

private java.lang.String PTExprId

Year

private java.lang.String Year

MonthSet

private java.util.LinkedList MonthSet

WeekSet

private java.util.LinkedList WeekSet

DaySet

private java.util.LinkedList DaySet
Constructor Detail

PeriodicTimeExpr.StartTimeExpr

public PeriodicTimeExpr.StartTimeExpr()
Creates a new instance of StartTimeExpr

Method Detail

getPTExprId

public java.lang.String getPTExprId()
Returns the id reference of the periodic time for this start time expression

Returns:
The periodic time id reference as String

setPTExprId

public void setPTExprId(java.lang.String pt_expr_id)
Sets the id reference of the periodic time for this start time expression

Parameters:
pt_expr_id - The periodic time id reference supplied as String

setYear

public void setYear(java.lang.String year)
Sets the year of the start time expression

Parameters:
year - The year supplied as String

getYear

public java.lang.String getYear()
Returns the year of the start time expression

Returns:
The year as String

getMonthCount

public int getMonthCount()
Returns the number of months in month set

Returns:
The month count as int

getWeekCount

public int getWeekCount()
Returns the number of weeks in week set

Returns:
The week count as int

getDayCount

public int getDayCount()
Returns the number of days in day set

Returns:
The day count as int

getMonth

public java.lang.String getMonth(int index)
Returns the month

Parameters:
index - The integer index of the month in the MonthSet
Returns:
The id of the month as String

getWeek

public java.lang.String getWeek(int index)
Returns the week

Parameters:
index - The integer index of the week in the WeekSet
Returns:
The id of the week as String

getDay

public java.lang.String getDay(int index)
Returns the day

Parameters:
index - The integer index of the day in the DaySet
Returns:
The id of the day as String

addMonth

public int addMonth(java.lang.String month_id)
Adds a new month to the MonthSet

Parameters:
month_id - The id of month supplied as String
Returns:
Integer representing state of the operation

addWeek

public int addWeek(java.lang.String week_id)
Adds a new week to the WeekSet

Parameters:
week_id - The id of week supplied as String
Returns:
Integer representing state of the operation

addDay

public int addDay(java.lang.String day_id)
Adds a new day to the DaySet

Parameters:
day_id - The id of day supplied as String
Returns:
Integer representing state of the operation

checkStartTime

public boolean checkStartTime(Policy policy,
                              java.util.GregorianCalendar calendar,
                              java.lang.String d_expr_id)
Evaluates the start time expression with respect to current time

Parameters:
policy - The reference to policy object supplied as Policy
calendar - The interval to compare with supplied as GregorianCalendar
d_expr_id - The reference id of the duration expression supplied as String
Returns:
A boolean indicating whether the evaluation is successful

evaluateYear

public boolean evaluateYear(int cal_year)
Checks if the periodic time constraint is satisfied at the given year

Parameters:
cal_year - The year calendar supplied as int
Returns:
A boolean indicating whether the evaluation is successful

evaluateMonth

public boolean evaluateMonth(int cal_year,
                             int cal_month,
                             int cal_week,
                             int cal_day,
                             DurationExpr d_expr,
                             int i)
Checks if the periodic time constraint is satisfied at the given month

Parameters:
cal_year - The year calendar to compare with supplied as int
cal_month - The month calendar to compare with supplied as int
cal_week - The week calendar supplied as int
cal_day - The day calendar supplied as int
d_expr - The reference to the duration expression supplied as DurationExpr
i - An integer index of the month being comapred in the MonnthSet
Returns:
A boolean indicating whether the evaluation is successful

evaluateWeek

public boolean evaluateWeek(int cal_year,
                            int cal_month,
                            int this_month,
                            int cal_week,
                            int cal_day,
                            DurationExpr d_expr,
                            int i)
Checks if the periodic time constraint is satisfied at the given week

Parameters:
cal_year - The year calendar supplied as int
cal_month - The month calendar supplied as int
this_month - The month calendar to compare with supplied as int
cal_week - The week calendar to compare with supplied as int
cal_day - The day calendar supplied as int
d_expr - The reference to the duration expression supplied as DurationExpr
i - An integer index of the week being comapred in the WeekSet
Returns:
A boolean indicating whether the evaluation is successful

evaluateDay

public boolean evaluateDay(int cal_year,
                           int cal_month,
                           int this_month,
                           int cal_week,
                           int this_week,
                           int cal_day,
                           DurationExpr d_expr,
                           int i)
Checks if the periodic time constraint is satisfied at the given day

Parameters:
cal_year - The year calendar supplied as int
cal_month - The month calendar supplied as int
this_month - The month calendar to compare with supplied as int
cal_week - The week calendar to compare with supplied as int
this_week - The week calendar to compare with supplied as int
cal_day - The day calendar supplied as int
d_expr - The reference to the duration expression supplied as DurationExpr
i - An integer index of the week being comapred in the WeekSet
Returns:
A boolean indicating whether the evaluation is successful

getPeriod

public int getPeriod(int year,
                     int month,
                     int week,
                     int day)
Returns the period in days from the start of the year given a month, week, and day

Parameters:
year - The year calendar supplied as int
month - The month calendar supplied as int
week - The week calendar supplied as int
day - The day calendar supplied as int
Returns:
An integer representing the number of days

checkCalDuration

public boolean checkCalDuration(int cal_period,
                                int this_period,
                                DurationExpr d_expr,
                                int cal_type)
Evaluates if current calendar is included in calendar+duration

Parameters:
cal_period - The period in days of the calendar to compare with supplied as int
this_period - The pereiod in days of the calendar being compared supplied as int
d_expr - The reference to the duration expression supplied as DurationExpr
cal_type - The type of the supplied calendar:0 is months, 1 is weeks, 2 is days
Returns:
A boolean indicating whether the evaluation is successful