Package org.jquantlib.lang.reflect

Examples of org.jquantlib.lang.reflect.TypeTokenTree


    //
    // public constructors
    //

    public BinomialConvertibleEngine(final GeneralizedBlackScholesProcess process, final int timeSteps) {
        this.clazz = (Class<T>)new TypeTokenTree(this.getClass()).getElement(0);
        QL.require(timeSteps>0, "timeSteps must be positive"); // TODO: message
        this.timeSteps_ = timeSteps;
        this.a = arguments;
        this.r = results;
        this.process_ = process;
View Full Code Here


                        paymentDayCounter, start, end, refStart, refEnd));
            }
            else if (Detail.noOption(caps, floors, i)) {

                // get the generic type
                final Class<?> fctklass = new TypeTokenTree(this.getClass()).getElement(1);

                // construct a new instance using reflection. first get the
                // constructor ...
                FloatingCouponType frc;
                try {
                    frc = (FloatingCouponType) fctklass.getConstructor(
                            Date.class, // paymentdate
                            double.class, // nominal
                            Date.class, // start date
                            Date.class, // enddate
                            int.class, // fixing days
                            index.getClass(), // ii
                            double.class, // gearing
                            double.class, // spread
                            Date.class, // refperiodstart
                            Date.class, // refperiodend
                            DayCounter.class,// daycounter
                            boolean.class) // inarrears
                            // then create a new instance
                            .newInstance(
                                    paymentDate,
                                    Detail.get(nominals, i, 1.0),
                                    start,
                                    end,
                                    (int) Detail.get(fixingDays, i, index
                                            .fixingDays()), index,
                                            Detail.get(gearings, i, 1.0),
                                            Detail.get(spreads, i, 0.0), refStart,
                                            refEnd, paymentDayCounter, isInArrears);
                } catch (final Exception e) {
                    throw new LibraryException(
                    "Couldn't construct new instance from generic type"); // QA:[RG]::verified
                    // //
                    // TODO:
                    // message
                }

                // append coupon cashflow
                add(frc);
            }
            else {
                final Class<?> cfcklass = new TypeTokenTree(this.getClass()).getElement(2);
                CappedFlooredCouponType cfctc;
                try {
                    final CappedFlooredIborCoupon cpn = new CappedFlooredIborCoupon(
                            paymentDate,
                            Detail.get(nominals,i, 1.0),
View Full Code Here

            final int gridPoints,
            final boolean timeDependent) {

        try {
            // instantiate 1st generic parameter : a base FD engine
            final Class<Base> fdBaseClass = (Class<Base>) new TypeTokenTree(this.getClass()).getElement(0);
            final Constructor<Base> baseConstructor = fdBaseClass.getConstructor(GeneralizedBlackScholesProcess.class, int.class, int.class, boolean.class);
            baseInstance = baseConstructor.newInstance(process, timeSteps, gridPoints, timeDependent);

            // instantiate 2nd generic parameter : a pricing engine ( SEE COMMENTS on field engineClass )
            engineClass = (Class<Engine>) new TypeTokenTree(this.getClass()).getElement(1);

        } catch (final Exception e) {
            throw new LibraryException(e);
        }
        process.addObserver(this);
View Full Code Here

TOP

Related Classes of org.jquantlib.lang.reflect.TypeTokenTree

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.