final StringBuilder result = new StringBuilder();
final Tuple tuple = activation.getTuple();
final Map<?, ?> declarations = activation.getSubRule().getOuterDeclarations();
for ( Iterator<?> it = declarations.values().iterator(); it.hasNext(); ) {
final Declaration declaration = (Declaration) it.next();
final InternalFactHandle handle = tuple.get( declaration );
if ( handle != null ) {
if ( handle.getId() == -1 ) {
// This handle is now invalid, probably due to an fact retraction
continue;
}
final Object value = declaration.getValue( (InternalWorkingMemory) workingMemory, handle.getObject() );
result.append( declaration.getIdentifier() );
result.append( "=" );
if ( value == null ) {
// this should never occur
result.append( "null" );
} else {
result.append( value );
result.append( "(" );
result.append( handle.getId() );
result.append( ")" );
}
}
if ( it.hasNext() ) {
result.append( "; " );