/**
* Copyright (C) 2011 - present by OpenGamma Inc. and the OpenGamma group of companies
*
* Please see distribution for license.
*/
package com.opengamma.analytics.financial.model.interestrate.curve;
import java.util.Map;
import org.joda.beans.BeanBuilder;
import org.joda.beans.BeanDefinition;
import org.joda.beans.JodaBeanUtils;
import org.joda.beans.MetaProperty;
import org.joda.beans.impl.direct.DirectBeanBuilder;
import org.joda.beans.impl.direct.DirectMetaPropertyMap;
import com.opengamma.analytics.math.curve.FunctionalDoublesCurve;
/**
* Class describing a monthly seasonal adjustment curve.
* The curve is piecewise constant on intervals defined by a set of times.
* Those times should be calculated using first of month dates and the
* act/act day counter (the one used for derivatives file).
*/
@BeanDefinition
public final class SeasonalCurve extends FunctionalDoublesCurve {
/**
* Constructor for Joda-Beans.
*/
protected SeasonalCurve() {
}
/**
* Construct a seasonal curve from a reference time and the monthly factors.
*
* @param steps the steps, not null
* @param monthlyFactors the monthly seasonal factors from one month to the next.
* The size of the array is 11 (the 12th factor is deduced from the 11 other.
* @param isAdditive as the cumulative yearly adjustment is 1). The factors represent
* the multiplicative factor from one month to the next. The reference time represent
* the initial month for which there is no adjustment.
*/
public SeasonalCurve(double[] steps, double[] monthlyFactors, boolean isAdditive) {
super(new SeasonalMonthlyFunction(steps, monthlyFactors, isAdditive));
}
//------------------------- AUTOGENERATED START -------------------------
///CLOVER:OFF
/**
* The meta-bean for {@code SeasonalCurve}.
* @return the meta-bean, not null
*/
public static SeasonalCurve.Meta meta() {
return SeasonalCurve.Meta.INSTANCE;
}
static {
JodaBeanUtils.registerMetaBean(SeasonalCurve.Meta.INSTANCE);
}
@Override
public SeasonalCurve.Meta metaBean() {
return SeasonalCurve.Meta.INSTANCE;
}
//-----------------------------------------------------------------------
@Override
public SeasonalCurve clone() {
return JodaBeanUtils.cloneAlways(this);
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj != null && obj.getClass() == this.getClass()) {
return super.equals(obj);
}
return false;
}
@Override
public int hashCode() {
int hash = 7;
return hash ^ super.hashCode();
}
@Override
public String toString() {
StringBuilder buf = new StringBuilder(32);
buf.append("SeasonalCurve{");
int len = buf.length();
toString(buf);
if (buf.length() > len) {
buf.setLength(buf.length() - 2);
}
buf.append('}');
return buf.toString();
}
@Override
protected void toString(StringBuilder buf) {
super.toString(buf);
}
//-----------------------------------------------------------------------
/**
* The meta-bean for {@code SeasonalCurve}.
*/
public static final class Meta extends FunctionalDoublesCurve.Meta {
/**
* The singleton instance of the meta-bean.
*/
static final Meta INSTANCE = new Meta();
/**
* The meta-properties.
*/
private final Map<String, MetaProperty<?>> _metaPropertyMap$ = new DirectMetaPropertyMap(
this, (DirectMetaPropertyMap) super.metaPropertyMap());
/**
* Restricted constructor.
*/
private Meta() {
}
@Override
public BeanBuilder<? extends SeasonalCurve> builder() {
return new DirectBeanBuilder<SeasonalCurve>(new SeasonalCurve());
}
@Override
public Class<? extends SeasonalCurve> beanType() {
return SeasonalCurve.class;
}
@Override
public Map<String, MetaProperty<?>> metaPropertyMap() {
return _metaPropertyMap$;
}
//-----------------------------------------------------------------------
}
///CLOVER:ON
//-------------------------- AUTOGENERATED END --------------------------
}