@Override public boolean equals(final Object o) { if (o == null) { return false; } if (!(o instanceof VolatilitySurfaceDefinition)) { return false; } final VolatilitySurfaceDefinition<?, ?> other = (VolatilitySurfaceDefinition<?, ?>) o; return other.getTarget().equals(getTarget()) && other.getName().equals(getName()) && Arrays.equals(other.getXs(), getXs()) && Arrays.equals(other.getYs(), getYs()); }
@Override public void init(final FunctionCompilationContext context) { _definition = ConfigDBVolatilitySurfaceDefinitionSource.init(context, this) .getDefinition(_definitionName, _instrumentType); if (_definition == null) { throw new OpenGammaRuntimeException( "Couldn't find Volatility Surface Definition for " + _instrumentType + " called " + _definitionName); } final ValueProperties surfaceProperties = ValueProperties.builder() .with(ValuePropertyNames.SURFACE, _definitionName) .with(InstrumentTypeProperties.PROPERTY_SURFACE_INSTRUMENT_TYPE, _instrumentType) .withAny( EquityVarianceSwapStaticReplicationFunction .STRIKE_PARAMETERIZATION_METHOD /*, VarianceSwapStaticReplication.StrikeParameterization.STRIKE.toString()*/) .get(); final ComputationTargetSpecification targetSpec = ComputationTargetSpecification.of(_definition.getTarget().getUniqueId()); _requirement = new ValueRequirement( ValueRequirementNames.STANDARD_VOLATILITY_SURFACE_DATA, targetSpec, surfaceProperties); _result = new ValueSpecification( ValueRequirementNames.INTERPOLATED_VOLATILITY_SURFACE, targetSpec, createValueProperties() .with(ValuePropertyNames.SURFACE, _definitionName) .with(InstrumentTypeProperties.PROPERTY_SURFACE_INSTRUMENT_TYPE, _instrumentType) .withAny( EquityVarianceSwapStaticReplicationFunction .STRIKE_PARAMETERIZATION_METHOD /*, VarianceSwapStaticReplication.StrikeParameterization.STRIKE.toString()*/) .get()); _results = Collections.singleton(_result); }
@Override public boolean canApplyTo( final FunctionCompilationContext context, final ComputationTarget target) { return ObjectUtils.equals(target.getUniqueId(), _definition.getTarget().getUniqueId()); }