/*
Copyright (C) 2008 Daniel Kong
This source code is release under the BSD License.
This file is part of JQuantLib, a free-software/open-source library
for financial quantitative analysts and developers - http://jquantlib.org/
JQuantLib is free software: you can redistribute it and/or modify it
under the terms of the JQuantLib license. You should have received a
copy of the license along with this program; if not, please email
. The license is also available online at
.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the license for more details.
JQuantLib is based on QuantLib. http://quantlib.org/
When applicable, the original copyright notice follows this notice.
*/
package org.jquantlib.cashflow;
import java.util.ArrayList;
import java.util.List;
import org.jquantlib.QL;
import org.jquantlib.time.Date;
import org.jquantlib.util.PolymorphicVisitor;
import org.jquantlib.util.Visitor;
/**
* Predetermined cash flow
*
* This cash flow pays a predetermined amount at a given date.
*
* @author Daniel Kong
*/
@SuppressWarnings("PMD.AbstractNaming")
public abstract class Dividend extends CashFlow {
protected Date date;
public Dividend (final Date date) {
super();
this.date = date;
}
//
// overrides Event
//
@Override
public Date date() {
return date;
}
//
// public abstract methods
//
public abstract double amount(final double underlying);
//
// public static methods
//
public static List extends Dividend> DividendVector(final List dividendDates, final List dividends) {
QL.require(dividendDates.size() == dividends.size() , "size mismatch between dividend dates and amounts"); // TODO: message
final List items = new ArrayList(dividendDates.size());
for (int i=0; i v = (pv!=null) ? pv.visitor(this.getClass()) : null;
if (v != null) {
v.visit(this);
} else {
super.accept(pv);
}
}
}
Ads help maintain this website.