Package org.jquantlib.lang.exceptions

Examples of org.jquantlib.lang.exceptions.LibraryException


    // protected constructors
    //

    static private Interpolator constructInterpolator(final Class<?> klass) {
        if (klass==null)
            throw new LibraryException("null interpolator"); // TODO: message
        if (!Interpolator.class.isAssignableFrom(klass))
            throw new LibraryException(ReflectConstants.WRONG_ARGUMENT_TYPE);

        try {
            return (Interpolator) klass.newInstance();
        } catch (final Exception e) {
            throw new LibraryException("cannot create Interpolator", e); // TODO: message
        }
    }
View Full Code Here


        super(dc);
        QL.validateExperimentalMode();

        this.classI = new TypeTokenTree(this.getClass()).getElement(0);
        if (classI != interpolator.getClass())
            throw new LibraryException(ReflectConstants.WRONG_ARGUMENT_TYPE);
        this.interpolator = interpolator;
    }
View Full Code Here

        super(settlementDays, cal, dc);
        QL.validateExperimentalMode();

        this.classI = new TypeTokenTree(this.getClass()).getElement(0);
        if (classI != interpolator.getClass())
            throw new LibraryException(ReflectConstants.WRONG_ARGUMENT_TYPE);
        this.interpolator = interpolator;
    }
View Full Code Here

        super (dates[0], calendar, dc);
        QL.validateExperimentalMode();

        this.classI = new TypeTokenTree(this.getClass()).getElement(0);
        if (classI != interpolator.getClass())
            throw new LibraryException(ReflectConstants.WRONG_ARGUMENT_TYPE);

        QL.require (dates.length != 0, " Dates cannot be empty"); // TODO: message
        QL.require (discounts.length != 0, "Discounts cannot be empty"); // TODO: message
        QL.require (dates.length == data.length, "Dates must be the same size as Discounts"); // TODO: message
        QL.require (data[0] == 1.0, "Initial discount factor must be 1.0"); // TODO: message
View Full Code Here

    public void accept(final TypedVisitor<TermStructure> v) {
        final Visitor<TermStructure> v1 = (v!=null) ? v.getVisitor(this.getClass()) : null;
        if (v1 != null) {
            v1.visit(this);
        } else
            throw new LibraryException("not a local-volatility term structure visitor"); // QA:[RG]::verified // TODO: message
    }
View Full Code Here

    public IterativeBootstrap(final Class<?> klass) {
        QL.validateExperimentalMode();

        if (klass==null) {
            throw new LibraryException("null PiecewiseCurve"); // TODO: message
        }
        if (!PiecewiseCurve.class.isAssignableFrom(klass)) {
            throw new LibraryException(ReflectConstants.WRONG_ARGUMENT_TYPE);
        }
        this.classB = klass;

        this.validCurve = false;
        this.ts = null;
View Full Code Here

    public void setup(final PiecewiseCurve ts) {

        QL.ensure (ts != null, "TermStructure cannot be null");
        if (!classB.isAssignableFrom(ts.getClass())) {
            throw new LibraryException(ReflectConstants.WRONG_ARGUMENT_TYPE);
        }

        this.ts            = ts;
        this.interpolator  = ts.interpolator();
        this.interpolation = ts.interpolation();
View Full Code Here

                    try {
                        ts.setInterpolation(interpolator.interpolate (new Array(times, i+1), new Array(data)));
                    } catch (final Exception e) {
                        // no chance to fix it in a later iteration
                        if (ts.interpolator().global()) {
                            throw new LibraryException("no chance to fix it in a later iteration");
                        }

                        // otherwise, if the target interpolation is not usable yet
                        ts.setInterpolation(new Linear().interpolate (new Array(times, i+1), new Array(data)));
                    }
View Full Code Here

                d1.dec();
            }
            if (c == BusinessDayConvention.ModifiedPreceding && d1.month() != d.month())
                return adjust(d, BusinessDayConvention.Following);
        } else
            throw new LibraryException(UKNOWN_BUSINESS_DAY_CONVENTION);
        return d1;
    }
View Full Code Here

        try {
            final Array y2 = x2.clone().transform(f);
            System.out.println(y2);
            throw new NotThrown();
        } catch (final NotThrown ex) {
            throw new LibraryException("failed to throw exception when trying to extrapolate");
        } catch (final Exception ex) {
            // as expected, we are OK.
            System.out.println(ex);
        }
View Full Code Here

TOP

Related Classes of org.jquantlib.lang.exceptions.LibraryException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.