本文整理匯總了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}