Package org.drools.smf

Examples of org.drools.smf.Configuration


        return null;
    }

    public Object end( String uri, String localName ) throws SAXException
    {
        Configuration config = this.ruleSetReader.endConfiguration( );
        SemanticModule module = this.ruleSetReader.lookupSemanticModule( uri,
                                                                    localName );

        DurationFactory factory = module.getDurationFactory( localName );
        Duration duration;
View Full Code Here


    }

    public Object end(String uri,
                      String localName) throws SAXException
    {
        Configuration config = this.ruleSetReader.endConfiguration( );
        SemanticModule module = this.ruleSetReader.lookupSemanticModule( uri,
                                                                         localName );

        ConditionFactory factory = module.getConditionFactory( localName );
        Condition[] conditions;
View Full Code Here

    }

    public Object end(String uri,
                      String localName) throws SAXException
    {
        Configuration config = this.ruleSetReader.endConfiguration( );

        SemanticModule module = this.ruleSetReader.lookupSemanticModule( uri,
                                                                         localName );

        ObjectTypeFactory factory = module.getObjectTypeFactory( localName );
View Full Code Here

    public Consequence newConsequence(Rule rule,
                                      RuleBaseContext context,
                                      Configuration config) throws FactoryException
    {

        Configuration childConfig = null;
        Configuration[] configurations = config.getChildren( );
        Consequence consequence = null;
        for ( int i = 0; i < configurations.length; i++ )
        {
            childConfig = configurations[i];
            if ( childConfig.getName( ).equals( "room" ) )
            {
                consequence = processRoom( rule,
                                           childConfig );
            }
        }
View Full Code Here

    }

    private Consequence processRoom(Rule rule,
                                    Configuration config) throws FactoryException
    {
        Configuration childConfig = null;
        final String room = config.getAttribute( "name" );

        Consequence consequence = null;
        Configuration[] configurations = config.getChildren( );
        for ( int i = 0; i < configurations.length; i++ )
        {
            childConfig = configurations[i];
            if ( childConfig.getName( ).equals( "heating" ) )
            {
                final Declaration heatingDeclaration = getDeclaration( rule,
                                                                       Heating.class,
                                                                       "heating" );

                if ( childConfig.getText( ).equals( "on" ) )
                {
                    consequence = new Consequence( )
                    {
                        public void invoke(Tuple tuple) throws ConsequenceException
                        {
                            Heating heating = (Heating) tuple.get( heatingDeclaration );
                            heating.heatingOn( room );
                        }
                    };
                }
                else if ( childConfig.getText( ).equals( "off" ) )
                {
                    consequence = new Consequence( )
                    {
                        public void invoke(Tuple tuple) throws ConsequenceException
                        {
View Full Code Here

{
    public Condition[] newCondition(Rule rule,
                                    RuleBaseContext context,
                                    Configuration config) throws FactoryException
    {
        Configuration childConfig = null;
        Configuration[] configurations = config.getChildren( );
        List conditions = new ArrayList( );
        for ( int i = 0; i < configurations.length; i++ )
        {
            childConfig = configurations[i];
            if ( childConfig.getName( ).equals( "room" ) )
            {
                conditions.add( processRoom( rule,
                                             childConfig ) );
            }
        }
View Full Code Here

    }

    private Condition processRoom(Rule rule,
                                  Configuration config) throws FactoryException
    {
        Configuration childConfig = null;
        final String roomName = config.getAttribute( "name" );
        final Declaration roomDeclaration = getDeclaration( rule,
                                                            Room.class,
                                                            roomName );
        Condition condition = null;
        Configuration[] configurations = config.getChildren( );
        for ( int i = 0; i < configurations.length; i++ )
        {
            childConfig = configurations[i];
            if ( childConfig.getName( ).equals( "temperature" ) )
            {
                final Declaration[] declarations = new Declaration[]{roomDeclaration};

                childConfig = childConfig.getChildren( )[0];
                final int kelvin = getKelvin( childConfig.getAttribute( "scale" ),
                                              childConfig.getText( ) );

                if ( childConfig.getName( ).equals( "less-than" ) )
                {
                    condition = new Condition( )
                    {
                        public Declaration[] getRequiredTupleMembers()
                        {
                            return declarations;
                        }

                        public boolean isAllowed(Tuple tuple) throws ConditionException
                        {
                            Room room = (Room) tuple.get( roomDeclaration );
                            if (!roomName.equals(room.getName()))
                            {
                                return false;
                            }
                            if ( room.getTemperature( ) < kelvin )
                            {
                                return true;
                            }
                            else
                            {
                                return false;
                            }
                        }
                    };
                }
                else if ( childConfig.getName( ).equals( "greater-than" ) )
                {
                    condition = new Condition( )
                    {
                        public Declaration[] getRequiredTupleMembers()
                        {
View Full Code Here

        SemanticModule module = ruleSetReader.lookupSemanticModule( uri,
                                                                    localName );

        ImportEntryFactory factory = module.getImportEntryFactory( localName );

        Configuration config = ruleSetReader.endConfiguration( );
        ImportEntry importEntry;
        Importer importer = ruleSetReader.getRuleSet().getImporter();
        try
        {
            importEntry = factory.newImportEntry( this.ruleSetReader.getRuleSet( ),
View Full Code Here

    public Consequence newConsequence(Rule rule,
                                      RuleBaseContext context,
                                      Configuration config) throws FactoryException
    {

        Configuration childConfig = null;
        Configuration[] configurations = config.getChildren();
        Consequence consequence = null;
        final String cellName = config.getAttribute( "cellName" );
        final Declaration cellDeclaration = getDeclaration( rule,
                                                            Cell.class,
                                                            cellName );
        for ( int i = 0; i < configurations.length; i++ )
        {
            childConfig = configurations[i];

            if ( childConfig.getName().equals( "giveBirthToCell" ) )
            {
                consequence = new GiveBirthConsequence( cellDeclaration );
            } else if ( childConfig.getName().equals( "killCell" ) )
            {
                consequence = new KillCellConsequence( cellDeclaration );
            }
        }
View Full Code Here

        final Declaration cellDeclaration = getDeclaration( rule,
                                                            Cell.class,
                                                            cellName );
        for ( int i = 0; i < configurations.length; i++ )
        {
            Configuration childConfig1 = null;
            childConfig1 = configurations[i];


                    if ( childConfig1.getName().equals( "cellIsAlive" ) )
                    {
                        conditions.add( new IsCellAliveCondition( cellDeclaration ) );
                    } else if ( childConfig1.getName().equals( "cellIsDead" ) )
                    {
                        conditions.add( new IsCellDeadCondition( cellDeclaration ) );
                    } else if ( childConfig1.getName().equals( "cellIsOverCrowded" ) )
                    {
                        conditions.add( new OvercrowdedCondition( cellDeclaration) );
                    } else if ( childConfig1.getName().equals( "cellIsLonely" ) )
                    {
                        conditions.add( new LonelyCondition( cellDeclaration ) );
                    } else if ( childConfig1.getName().equals( "cellIsRipeForBirth" ) )
                    {
                        conditions.add( new RipeForBirthCondition( cellDeclaration) );
                    }
        }
View Full Code Here

TOP

Related Classes of org.drools.smf.Configuration

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.