本文整理汇总了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;
}