this.identifier = identifier;
this.contextName = contextName;
}
public Object execute(Context context) {
Context targetCtx;
if ( this.contextName == null ) {
targetCtx = context;
} else {
targetCtx = context.getContextManager().getContext( this.contextName );
}
GetDefaultValue sim = (GetDefaultValue) context.get( "simulator" );
Object o = sim.getObject();
// for FactHandle's we store the handle on a map and the actual object as
if ( o instanceof FactHandle ) {
Map<String, FactHandle> handles = (Map<String, FactHandle>) targetCtx.get( "h" );
if ( handles == null ) {
handles = new HashMap<String, FactHandle>();
targetCtx.set( "h",
handles );
}
handles.put( identifier,
(FactHandle) o );
o = ((InternalFactHandle) o).getObject();
}
targetCtx.set( identifier,
o );
return o;
}