com.ftlabs.fisa
Class DiscreteCallSchedule

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet<E>
          extended by java.util.TreeSet<Redemption>
              extended by com.ftlabs.fisa.DiscreteCallSchedule
All Implemented Interfaces:
CallSchedule, java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<Redemption>, java.util.Collection<Redemption>, java.util.NavigableSet<Redemption>, java.util.Set<Redemption>, java.util.SortedSet<Redemption>

public class DiscreteCallSchedule
extends java.util.TreeSet<Redemption>
implements CallSchedule

An implementation of CallSchedule for discrete calls. Calls can be added via the constructor, or using the add method. Calls are stored in call date order.

See Also:
Serialized Form

Constructor Summary
DiscreteCallSchedule()
          Create a new DiscreteCallSchedule without any calls.
DiscreteCallSchedule(Redemption... redemptions)
          Create a new DiscreteCallSchedule that is populated with the provided Redemptions.
 
Method Summary
 boolean add(FISADate date, double value)
          Create and add a new Redemption to this schedule using the provided date and value.
 boolean add(Redemption redemption)
          Add a call to this CallSchedule.
 Redemption getNextCall()
          Get the next call.
 Redemption getNextParCall()
          Get the next par call.
 Redemption getNextPremiumCall()
          Get the next premium call.
 
Methods inherited from class java.util.TreeSet
addAll, ceiling, clear, clone, comparator, contains, descendingIterator, descendingSet, first, floor, headSet, headSet, higher, isEmpty, iterator, last, lower, pollFirst, pollLast, remove, size, subSet, subSet, tailSet, tailSet
 
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
containsAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.SortedSet
comparator, first, headSet, last, subSet, tailSet
 
Methods inherited from interface java.util.Set
addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 

Constructor Detail

DiscreteCallSchedule

public DiscreteCallSchedule()
Create a new DiscreteCallSchedule without any calls. addCall must be used to add calls.


DiscreteCallSchedule

public DiscreteCallSchedule(Redemption... redemptions)
Create a new DiscreteCallSchedule that is populated with the provided Redemptions.

Method Detail

add

public boolean add(FISADate date,
                   double value)
Create and add a new Redemption to this schedule using the provided date and value.

Parameters:
date - the call date.
value - the call rate.
Returns:
true if this CallSchedule did not already contain the specified Redemption.

add

public boolean add(Redemption redemption)
Add a call to this CallSchedule.

Specified by:
add in interface java.util.Collection<Redemption>
Specified by:
add in interface java.util.Set<Redemption>
Overrides:
add in class java.util.TreeSet<Redemption>
Parameters:
redemption - a Redemption to be added to this CallSchedule.
Returns:
true if this CallSchedule did not already contain the specified Redemption.

getNextCall

public Redemption getNextCall()
Get the next call. This could be either a premium call or a par call.

Specified by:
getNextCall in interface CallSchedule
Returns:
the next call.

getNextPremiumCall

public Redemption getNextPremiumCall()
Get the next premium call.

Specified by:
getNextPremiumCall in interface CallSchedule
Returns:
the next premium call.

getNextParCall

public Redemption getNextParCall()
Get the next par call.

Specified by:
getNextParCall in interface CallSchedule
Returns:
the next par call.