org.jfin.date.accrual
Class AccrualSchedule<T extends AccrualPeriod,U extends Payment>
- java.lang.Object
-
- org.jfin.date.accrual.AccrualSchedule<T,U>
-
public class AccrualSchedule<T extends AccrualPeriod,U extends Payment> extends java.lang.ObjectUsed to manage and manipulate an AccrualSchedule and a NotionalSchedule
-
-
Constructor Summary
Constructors Constructor and Description AccrualSchedule(U paymentPrototype)Base constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidadd(int i, T t)Inserts an accrual period at an indexbooleanadd(T accrualPeriod)Adds the accrual period to the schedulebooleanaddAll(java.util.Collection<? extends T> ts)Adds all of the provided accrual periods to the schedulebooleanaddAll(int i, java.util.Collection<? extends T> ts)Adds all of the provided accrual periods to the schedule at a specific pointvoidclear()Clears all accrual periods from the schedulebooleancontains(java.lang.Object o)Returns true if this schedule contains the period obooleancontainsAll(java.util.Collection<?> objects)Determines whether or not this schedule contains all of the accrual periods in a collection.Tget(int i)Gets the accrual period at an indexjava.util.List<T>getAccrualPeriods()Gets the accrual periodsjava.util.CalendargetEndCalendar()Get the end date as a calendar for the periodsjava.util.List<U>getNettedPayments(NotionalSchedule notionalSchedule)Returns a netted list of payments for a given notional schedulejava.util.List<U>getPayments(NotionalSchedule notionalSchedule)Gets a list of payments for a given notional schedulejava.util.CalendargetStartCalendar()Get the start date as a calendar for the periodsintindexOf(java.lang.Object o)Get the index of a particular accrual periodbooleanisEmpty()Returns true if this schedule contains no accrual periods, otherwise falsejava.util.Iterator<T>iterator()Returns an iterator of the accrual periods contained in this scheduleintlastIndexOf(java.lang.Object o)Get the last index of a particular accrual periodjava.util.List<U>netPayments(java.util.List<U> payments)Nets a list of payments togetherTremove(int i)Remove an accrual period at an indexbooleanremove(java.lang.Object o)Removes the accrual period provided from the schedulebooleanremoveAll(java.util.Collection<?> objects)Removes a collection of accrual periods from the schedulebooleanretainAll(java.util.Collection<?> objects)Removes all but a collection of accrual periods from the scheduleTset(int i, T t)Sets the accrual period at an indexvoidsetAccrualPeriods(java.util.List<T> accrualPeriods)Sets the accrual periodsintsize()Gets the size of the schedule (i.e.java.util.List<T>subList(int i, int i1)Takes a sub list of the accrual periods in a schedule between two indices
-
-
-
Constructor Detail
-
AccrualSchedule
public AccrualSchedule(U paymentPrototype)
Base constructor- Parameters:
paymentPrototype- A prototype of the payment
-
-
Method Detail
-
getNettedPayments
public java.util.List<U> getNettedPayments(NotionalSchedule notionalSchedule) throws java.lang.Exception
Returns a netted list of payments for a given notional schedule- Parameters:
notionalSchedule- The notional schedule- Returns:
- A netted list of payments
- Throws:
java.lang.Exception- If there is a problem calculating the netted payments
-
netPayments
public java.util.List<U> netPayments(java.util.List<U> payments)
Nets a list of payments together- Parameters:
payments- The payments to net together- Returns:
- The payments netted together
-
getPayments
public java.util.List<U> getPayments(NotionalSchedule notionalSchedule) throws java.lang.Exception
Gets a list of payments for a given notional schedule- Parameters:
notionalSchedule- The notional schedule- Returns:
- A list of payments
- Throws:
java.lang.Exception- If there is a problem calculating the payments
-
getStartCalendar
public java.util.Calendar getStartCalendar() throws AccrualExceptionGet the start date as a calendar for the periods- Returns:
- The start calendar
- Throws:
AccrualException- If there is a problem calculating the start calendar
-
getEndCalendar
public java.util.Calendar getEndCalendar() throws AccrualExceptionGet the end date as a calendar for the periods- Returns:
- The end calendar
- Throws:
AccrualException- If there is a problem calculating the start calendar
-
getAccrualPeriods
public java.util.List<T> getAccrualPeriods()
Gets the accrual periods- Returns:
- The accrual periods
-
setAccrualPeriods
public void setAccrualPeriods(java.util.List<T> accrualPeriods)
Sets the accrual periods- Parameters:
accrualPeriods- The accrual periods
-
size
public int size()
Gets the size of the schedule (i.e. the number of accrual periods it contains)- Returns:
- The number of accrual periods
-
isEmpty
public boolean isEmpty()
Returns true if this schedule contains no accrual periods, otherwise false- Returns:
- Whether the schedule is empty
-
contains
public boolean contains(java.lang.Object o)
Returns true if this schedule contains the period o- Parameters:
o- The period to check for- Returns:
- True if the period is in this schedule, otherwise false
-
iterator
public java.util.Iterator<T> iterator()
Returns an iterator of the accrual periods contained in this schedule- Returns:
- An iterator of the accrual periods
-
add
public boolean add(T accrualPeriod)
Adds the accrual period to the schedule- Parameters:
accrualPeriod-- Returns:
- True
-
remove
public boolean remove(java.lang.Object o)
Removes the accrual period provided from the schedule- Parameters:
o- The accrual period to remove- Returns:
- True if the object was removed, otherwise false
-
containsAll
public boolean containsAll(java.util.Collection<?> objects)
Determines whether or not this schedule contains all of the accrual periods in a collection.- Parameters:
objects- The collection of accrual periods to check for- Returns:
- True if this schedule contains all of the accrual periods, otherwise false
-
addAll
public boolean addAll(java.util.Collection<? extends T> ts)
Adds all of the provided accrual periods to the schedule- Parameters:
ts- The accrual periods to add- Returns:
- True
-
addAll
public boolean addAll(int i, java.util.Collection<? extends T> ts)Adds all of the provided accrual periods to the schedule at a specific point- Parameters:
i- Where to insert the accrual periodsts- The accrual periods to add- Returns:
- True
-
removeAll
public boolean removeAll(java.util.Collection<?> objects)
Removes a collection of accrual periods from the schedule- Parameters:
objects- The accrual periods to remove- Returns:
- True
-
retainAll
public boolean retainAll(java.util.Collection<?> objects)
Removes all but a collection of accrual periods from the schedule- Parameters:
objects- The accrual periods to retain- Returns:
- true
-
clear
public void clear()
Clears all accrual periods from the schedule
-
get
public T get(int i)
Gets the accrual period at an index- Parameters:
i- The index- Returns:
- The accrual period at index i
-
set
public T set(int i, T t)
Sets the accrual period at an index- Parameters:
i- The indext- The accrual period- Returns:
- The accrual period set
-
add
public void add(int i, T t)Inserts an accrual period at an index- Parameters:
i- The indext- The accrual period
-
remove
public T remove(int i)
Remove an accrual period at an index- Parameters:
i- The index- Returns:
- The accrual period removed
-
indexOf
public int indexOf(java.lang.Object o)
Get the index of a particular accrual period- Parameters:
o- The accrual period- Returns:
- The index of the accrual period in the schedule, or -1 if the schedule does not contain the given period
-
lastIndexOf
public int lastIndexOf(java.lang.Object o)
Get the last index of a particular accrual period- Parameters:
o- The accrual period- Returns:
- The last index of the accrual period in the schedule, or -1 if the schedule does not contain the given period
-
subList
public java.util.List<T> subList(int i, int i1)
Takes a sub list of the accrual periods in a schedule between two indices- Parameters:
i- The start indexi1- The end index- Returns:
- The sub list of accrual periods
-
-
DataMelt 3.0 © DataMelt by jWork.ORG