public boolean def(RName name, IRObject value, boolean protect) throws RulesException {
RName entityname = name.getEntityName();
for (int i = entitystkptr - 1; i >= 0; i--) {
IREntity e = entitystk[i];
if (!e.isReadOnly() && (entityname == null || e.getName().equals(entityname))) {
REntityEntry entry = e.getEntry(name);
if (entry != null && (!protect || entry.writable)) {
if (testState(TRACE)) {
out.printdata("def",
"id", e.getID(),
"entity", e.getName().stringValue(),
"name", name.stringValue(),
value.postFix());
}
e.put(null, name, value);
return true;
}
}
}
return false;