當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。