Package org.drools.examples.broker.model

Examples of org.drools.examples.broker.model.StockTick


    }

    @SuppressWarnings("unchecked")
    public void receive(Event<?> event) {
        try {
            StockTick tick = ((Event<StockTick>) event).getObject();
            Company company = this.companies.getCompany( tick.getSymbol() );
            this.tickStream.insert( tick );
            this.session.getAgenda().getAgendaGroup( "evaluation" ).setFocus();
            this.session.fireAllRules();
            window.updateCompany( company.getSymbol() );
            window.updateTick( tick );
View Full Code Here


    }

    @SuppressWarnings("unchecked")
    public void receive(Event<?> event) {
        try {
            StockTick tick = ((Event<StockTick>) event).getObject();
            Company company = this.companies.getCompany( tick.getSymbol() );
            this.tickStream.insert( tick );
            this.session.getAgenda().getAgendaGroup( "evaluation" ).setFocus();
            this.session.fireAllRules();
            window.updateCompany( company.getSymbol() );
            window.updateTick( tick );
View Full Code Here

    }

    @SuppressWarnings("unchecked")
    public void receive(Event<?> event) {
        try {
            StockTick tick = ((Event<StockTick>) event).getObject();
            Company company = this.companies.getCompany( tick.getSymbol() );
            this.tickStream.insert( tick );
            this.session.getAgenda().getAgendaGroup( "evaluation" ).setFocus();
            this.session.fireAllRules();
            window.updateCompany( company.getSymbol() );
            window.updateTick( tick );
View Full Code Here

        if (line == null) {
            System.out.println("End of file");
            return null;
        }
        Object[] results = format.parse(line);
        StockTick tick = new StockTick( (String)results[1],
                                        ((Number)results[2]).doubleValue(),
                                        ((Number)results[0]).longValue()+baseTimestamp );
        return tick;
    }
View Full Code Here

    }

    public boolean hasNext() {
        if( in != null ) {
            try {
                StockTick tick = load();
                if (tick == null) {
                    return false;
                }
                next = new EventImpl<StockTick>( tick.getTimestamp(), tick );
                return true;
            } catch ( Exception e ) {
                // nothing to do, return false
                e.printStackTrace();
                return false;
View Full Code Here

    }

    @SuppressWarnings("unchecked")
    public void receive(Event<?> event) {
        try {
            StockTick tick = ((Event<StockTick>) event).getObject();
            Company company = this.companies.getCompany( tick.getSymbol() );
            this.tickStream.insert( tick );
            this.session.getAgenda().getAgendaGroup( "evaluation" ).setFocus();
            this.session.fireAllRules();
            window.updateCompany( company.getSymbol() );
            window.updateTick( tick );
View Full Code Here

        if (line == null) {
            System.out.println("End of file");
            return null;
        }
        Object[] results = format.parse(line);
        StockTick tick = new StockTick( (String)results[1],
                                        ((Number)results[2]).doubleValue(),
                                        ((Number)results[0]).longValue()+baseTimestamp );
        return tick;
    }
View Full Code Here

    }

    public boolean hasNext() {
        if( in != null ) {
            try {
                StockTick tick = load();
                if (tick == null) {
                    return false;
                }
                next = new EventImpl<StockTick>( tick.getTimestamp(), tick );
                return true;
            } catch ( Exception e ) {
                // nothing to do, return false
                e.printStackTrace();
                return false;
View Full Code Here

        System.out.print("Generating data for 20 min...");

        // initializing starting prices
        for( Company company : companies ) {
            company.setCurrentPrice( nextStartingPrice( startingPrices ) );
            StockTick tick = new StockTick( company.getSymbol(),
                                            company.getCurrentPrice(),
                                            0 );
            persister.save( tick );
        }
       
       
        for( long offset = 0; offset < timespam; offset += nextStep( interval ) ) {
            int company = symbols.nextInt( companies.length );
            double price = companies[company].getCurrentPrice() * (1 + nextPriceChange( priceChanges ));
            StockTick tick = new StockTick(companies[company].getSymbol(),
                                           price,
                                           offset );
            persister.save( tick );
            companies[company].setCurrentPrice( price );
        }
View Full Code Here

    }

    @SuppressWarnings("unchecked")
    public void receive(Event<?> event) {
        try {
            StockTick tick = ((Event<StockTick>) event).getObject();
            Company company = this.companies.getCompany( tick.getSymbol() );
            this.tickStream.insert( tick );
            this.session.getAgenda().getAgendaGroup( "evaluation" ).setFocus();
            this.session.fireAllRules();
            window.updateCompany( company.getSymbol() );
            window.updateTick( tick );
View Full Code Here

TOP

Related Classes of org.drools.examples.broker.model.StockTick

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.