当前位置: 首页>>代码示例>>Java>>正文


Java KieSession.getFactHandle方法代码示例

本文整理汇总了Java中org.kie.api.runtime.KieSession.getFactHandle方法的典型用法代码示例。如果您正苦于以下问题:Java KieSession.getFactHandle方法的具体用法?Java KieSession.getFactHandle怎么用?Java KieSession.getFactHandle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.kie.api.runtime.KieSession的用法示例。


在下文中一共展示了KieSession.getFactHandle方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import org.kie.api.runtime.KieSession; //导入方法依赖的package包/类
@Override
public Void execute( Context ctx ) {
    KieSession session = ( KieSession ) ctx.getData().get( "session" );
    GameMessageService messageService = ( GameMessageService ) ctx.getData().get( "messageService" );
    FactHandle roomInFH = session.getFactHandle( roomIn );
    roomIn.getPeopleInTheRoom().remove( getPlayer().getName() );
    session.update( roomInFH, roomIn );
    QueryResults queryResults = session.getQueryResults( "getRoomByName", door.getLeadsTo() );
    Iterator<QueryResultsRow> iterator = queryResults.iterator();
    Room roomTo = null;
    while ( iterator.hasNext() ) {
        roomTo = ( Room ) iterator.next().get( "$r" );
        break;
    }
    if ( roomTo != null ) {
        FactHandle roomToFH = session.getFactHandle( roomTo );
        roomTo.getPeopleInTheRoom().add( getPlayer().getName() );
        session.update( roomToFH, roomTo );
        session.insert( messageService.newGameMessage( getPlayer().getName(), "Player moved from  " + roomIn.getName() + " to " + roomTo.getName() ) );
    } else {
        session.insert( messageService.newGameMessage( getPlayer().getName(), "ERROR: Door cannot be used because the room:   " + door.getLeadsTo() + " was not found. " ) );
    }
    return null;
}
 
开发者ID:Salaboy,项目名称:drools-game-engine,代码行数:25,代码来源:UseDoorCommand.java

示例2: execute

import org.kie.api.runtime.KieSession; //导入方法依赖的package包/类
@Override
public Void execute( Context ctx ) {
    KieSession session = ( KieSession ) ctx.getData().get( "session" );
    GameMessageService messageService = ( GameMessageService ) ctx.getData().get( "messageService" );
    FactHandle playerFH = session.getFactHandle( getPlayer());
    getPlayer().getInventory().getItems().add( flag );
    session.update( playerFH, getPlayer() );
    session.insert( messageService.newGameMessage( getPlayer().getName(), "Picked the Flag" ) );
    return null;
}
 
开发者ID:Salaboy,项目名称:drools-game-engine,代码行数:11,代码来源:PickFlagCommand.java

示例3: execute

import org.kie.api.runtime.KieSession; //导入方法依赖的package包/类
@Override
public Void execute( Context ctx ) {
    KieSession session = ( KieSession ) ctx.getData().get( "session" );
    GameMessageService messageService = ( GameMessageService ) ctx.getData().get( "messageService" );
    FactHandle zoneFH = session.getFactHandle( zone );
    zone.addPlayer( getPlayer().getName() );
    session.update( zoneFH, zone );
    session.insert( messageService.newGameMessage( getPlayer().getName(), "You entered the Zone: " + zone.getName() ) );
    return null;
}
 
开发者ID:Salaboy,项目名称:drools-game-engine,代码行数:11,代码来源:EnterZoneCommand.java

示例4: execute

import org.kie.api.runtime.KieSession; //导入方法依赖的package包/类
@Override
public Void execute( Context ctx ) {
    KieSession session = ( KieSession ) ctx.getData().get( "session" );
    GameMessageService messageService = ( GameMessageService ) ctx.getData().get( "messageService" );
    FactHandle zoneFH = session.getFactHandle( zone );
    zone.removePlayer( getPlayer().getName() );
    session.update( zoneFH, zone );
    session.insert( messageService.newGameMessage( getPlayer().getName(), "You Exited the Zone: " + zone.getName() ) );
    return null;
}
 
开发者ID:Salaboy,项目名称:drools-game-engine,代码行数:11,代码来源:ExitZoneCommand.java

示例5: execute

import org.kie.api.runtime.KieSession; //导入方法依赖的package包/类
@Override
public Void execute( Context ctx ) {
    KieSession session = ( KieSession ) ctx.getData().get( "session" );
    GameMessageService messageService = ( GameMessageService ) ctx.getData().get( "messageService" );

    FactHandle containerFH = session.getFactHandle( container );
    container.setOpen( true );
    session.update( containerFH, container );
    session.insert( messageService.newGameMessage( getPlayer().getName(), "Container Opened: " + container.getName() ) );
    return null;
}
 
开发者ID:Salaboy,项目名称:drools-game-engine,代码行数:12,代码来源:OpenContainerCommand.java

示例6: execute

import org.kie.api.runtime.KieSession; //导入方法依赖的package包/类
@Override
public Void execute( Context ctx ) {
    KieSession session = ( KieSession ) ctx.getData().get( "session" );
    GameMessageService messageService = ( GameMessageService ) ctx.getData().get( "messageService" );
    

    FactHandle lightSwitchFH = session.getFactHandle( lightSwitch );
    lightSwitch.setOn( false );
    session.update( lightSwitchFH, lightSwitch );
    session.insert( messageService.newGameMessage( getPlayer().getName(), "Lights Turned Off" ) );
    return null;
}
 
开发者ID:Salaboy,项目名称:drools-game-engine,代码行数:13,代码来源:TurnOffTheLightsCommand.java

示例7: execute

import org.kie.api.runtime.KieSession; //导入方法依赖的package包/类
@Override
public Void execute( Context ctx ) {
    KieSession session = ( KieSession ) ctx.getData().get( "session" );
    GameMessageService messageService = ( GameMessageService ) ctx.getData().get( "messageService" );
    FactHandle lightSwitchFH = session.getFactHandle( lightSwitch );
    lightSwitch.setOn( true );
    session.update( lightSwitchFH, lightSwitch );
    session.insert( messageService.newGameMessage( getPlayer().getName(), "Lights Turned On" ) );
    return null;
}
 
开发者ID:Salaboy,项目名称:drools-game-engine,代码行数:11,代码来源:TurnOnTheLightsCommand.java

示例8: execute

import org.kie.api.runtime.KieSession; //导入方法依赖的package包/类
@Override
public Void execute( Context ctx ) {
    KieSession session = ( KieSession ) ctx.getData().get( "session" );
    GameMessageService messageService = ( GameMessageService ) ctx.getData().get( "messageService" );
    FactHandle playerFH = session.getFactHandle( getPlayer() );
    getPlayer().getInventory().getItems().add( pickableItem.getPickable() );
    FactHandle containerFH = session.getFactHandle( container );
    container.getItems().remove( pickableItem.getPickable() );
    session.update( playerFH, getPlayer() );
    session.update( containerFH, container );
    session.insert( messageService.newGameMessage( getPlayer().getName(), "Item Picked! " + pickableItem ) );
    return null;
}
 
开发者ID:Salaboy,项目名称:drools-game-engine,代码行数:14,代码来源:PickItemCommand.java

示例9: execute

import org.kie.api.runtime.KieSession; //导入方法依赖的package包/类
@Override
public Void execute( Context ctx ) {
    KieSession session = ( KieSession ) ctx.getData().get( "session" );
    GameMessageService messageService = ( GameMessageService ) ctx.getData().get( "messageService" );
    FactHandle checkpointFH = session.getFactHandle(checkpoint );
    checkpoint.addPlayer( getPlayer().getName() );
    session.update(checkpointFH, checkpoint );
    session.insert(messageService.newGameMessage(getPlayer().getName(), "You entered the checkpoint: " + checkpoint.getId() ) );
    return null;
}
 
开发者ID:Salaboy,项目名称:drools-game-engine,代码行数:11,代码来源:EnterCheckpointCommand.java

示例10: execute

import org.kie.api.runtime.KieSession; //导入方法依赖的package包/类
@Override
public Void execute( Context ctx ) {
    KieSession session = ( KieSession ) ctx.getData().get( "session" );
    GameMessageService messageService = ( GameMessageService ) ctx.getData().get( "messageService" );
    FactHandle scoreZoneFH = session.getFactHandle(checkpoint );
    checkpoint.removePlayer( getPlayer().getName() );
    session.update(scoreZoneFH, checkpoint );
    session.insert(messageService.newGameMessage(getPlayer().getName(), "You left the checkpoint: " + checkpoint.getId() ) );
    return null;
}
 
开发者ID:Salaboy,项目名称:drools-game-engine,代码行数:11,代码来源:LeaveCheckpointCommand.java


注:本文中的org.kie.api.runtime.KieSession.getFactHandle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。