/** * Convert an object to a map of field name/value pairs. * * @param object The object to convert * @param fields The field values to restore from * @return True if all fields in the object were present in the field set */ private boolean restoreObjectFromFieldMap(Object object, final Map<String, Object> fields) { final Object result = object; final BooleanWrapper allFound = new BooleanWrapper(); allFound.value = true; reflectionProvider.visitSerializableFields( result, new ReflectionProvider.Visitor() { @SuppressWarnings("rawtypes") public void visit(String fieldName, Class type, Class definedIn, Object value) { Object toLoad = fields.get(fieldName); if (toLoad != null) { reflectionProvider.writeField(result, fieldName, fields.get(fieldName), definedIn); } else { allFound.value = false; } } }); return allFound.value; }
public static Stella_Object accessStellaHashTableSlotValue( StellaHashTable self, Symbol slotname, Stella_Object value, boolean setvalueP) { if (slotname == Stella.SYM_STELLA_SIZE) { if (setvalueP) { self.size = ((IntegerWrapper) (value)).wrapperValue; } else { value = IntegerWrapper.wrapInteger(self.size); } } else if (slotname == Stella.SYM_STELLA_INITIAL_SIZE) { if (setvalueP) { self.initialSize = ((IntegerWrapper) (value)).wrapperValue; } else { value = IntegerWrapper.wrapInteger(self.initialSize); } } else if (slotname == Stella.SYM_STELLA_FREE_ELEMENTS) { if (setvalueP) { self.freeElements = ((IntegerWrapper) (value)).wrapperValue; } else { value = IntegerWrapper.wrapInteger(self.freeElements); } } else if (slotname == Stella.SYM_STELLA_EQUAL_TESTp) { if (setvalueP) { self.equalTestP = BooleanWrapper.coerceWrappedBooleanToBoolean(((BooleanWrapper) (value))); } else { value = (self.equalTestP ? Stella.TRUE_WRAPPER : Stella.FALSE_WRAPPER); } } else { { OutputStringStream stream000 = OutputStringStream.newOutputStringStream(); stream000.nativeStream.print("`" + slotname + "' is not a valid case option"); throw ((StellaException) (StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace())); } } return (value); }
public static Stella_Object accessVizInfoSlotValue( VizInfo self, Symbol slotname, Stella_Object value, boolean setvalueP) { if (slotname == OntosaurusUtil.SYM_STELLA_STREAM) { if (setvalueP) { self.stream = ((OutputStream) (value)); } else { value = self.stream; } } else if (slotname == OntosaurusUtil.SYM_ONTOSAURUS_ALLOWED_OBJECTS) { if (setvalueP) { self.allowedObjects = ((HashSet) (value)); } else { value = self.allowedObjects; } } else if (slotname == OntosaurusUtil.SYM_ONTOSAURUS_SHOW_RELATIONSp) { if (setvalueP) { self.showRelationsP = BooleanWrapper.coerceWrappedBooleanToBoolean(((BooleanWrapper) (value))); } else { value = (self.showRelationsP ? Stella.TRUE_WRAPPER : Stella.FALSE_WRAPPER); } } else if (slotname == OntosaurusUtil.SYM_ONTOSAURUS_SHOW_ATTRIBUTESp) { if (setvalueP) { self.showAttributesP = BooleanWrapper.coerceWrappedBooleanToBoolean(((BooleanWrapper) (value))); } else { value = (self.showAttributesP ? Stella.TRUE_WRAPPER : Stella.FALSE_WRAPPER); } } else if (slotname == OntosaurusUtil.SYM_ONTOSAURUS_SHOW_RULESp) { if (setvalueP) { self.showRulesP = BooleanWrapper.coerceWrappedBooleanToBoolean(((BooleanWrapper) (value))); } else { value = (self.showRulesP ? Stella.TRUE_WRAPPER : Stella.FALSE_WRAPPER); } } else if (slotname == OntosaurusUtil.SYM_ONTOSAURUS_ADD_TOPp) { if (setvalueP) { self.addTopP = BooleanWrapper.coerceWrappedBooleanToBoolean(((BooleanWrapper) (value))); } else { value = (self.addTopP ? Stella.TRUE_WRAPPER : Stella.FALSE_WRAPPER); } } else if (slotname == OntosaurusUtil.SYM_ONTOSAURUS_NODE_COLOR) { if (setvalueP) { self.nodeColor = ((StringWrapper) (value)).wrapperValue; } else { value = StringWrapper.wrapString(self.nodeColor); } } else if (slotname == OntosaurusUtil.SYM_ONTOSAURUS_RELATION_COLOR) { if (setvalueP) { self.relationColor = ((StringWrapper) (value)).wrapperValue; } else { value = StringWrapper.wrapString(self.relationColor); } } else if (slotname == OntosaurusUtil.SYM_ONTOSAURUS_RELATION_STYLE) { if (setvalueP) { self.relationStyle = ((StringWrapper) (value)).wrapperValue; } else { value = StringWrapper.wrapString(self.relationStyle); } } else if (slotname == OntosaurusUtil.SYM_ONTOSAURUS_FONT_SIZE) { if (setvalueP) { self.fontSize = ((IntegerWrapper) (value)).wrapperValue; } else { value = IntegerWrapper.wrapInteger(self.fontSize); } } else { { OutputStringStream stream000 = OutputStringStream.newOutputStringStream(); stream000.nativeStream.print("`" + slotname + "' is not a valid case option"); throw ((StellaException) (StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace())); } } return (value); }
public static Stella_Object accessPartialMatchFrameSlotValue( PartialMatchFrame self, Symbol slotname, Stella_Object value, boolean setvalueP) { if (slotname == Logic.SYM_LOGIC_KIND) { if (setvalueP) { self.kind = ((Keyword) (value)); } else { value = self.kind; } } else if (slotname == Logic.SYM_LOGIC_CONTROL_FRAME) { if (setvalueP) { self.controlFrame = ((ControlFrame) (value)); } else { value = self.controlFrame; } } else if (slotname == Logic.SYM_LOGIC_PARENT) { if (setvalueP) { self.parent = ((PartialMatchFrame) (value)); } else { value = self.parent; } } else if (slotname == Logic.SYM_LOGIC_CHILD) { if (setvalueP) { self.child = ((PartialMatchFrame) (value)); } else { value = self.child; } } else if (slotname == Logic.SYM_LOGIC_POSITIVE_SCORE) { if (setvalueP) { self.positiveScore = ((FloatWrapper) (value)).wrapperValue; } else { value = FloatWrapper.wrapFloat(self.positiveScore); } } else if (slotname == Logic.SYM_LOGIC_NEGATIVE_SCORE) { if (setvalueP) { self.negativeScore = ((FloatWrapper) (value)).wrapperValue; } else { value = FloatWrapper.wrapFloat(self.negativeScore); } } else if (slotname == Logic.SYM_LOGIC_DYNAMIC_CUTOFF) { if (setvalueP) { self.dynamicCutoff = ((FloatWrapper) (value)).wrapperValue; } else { value = FloatWrapper.wrapFloat(self.dynamicCutoff); } } else if (slotname == Logic.SYM_LOGIC_ARGUMENT_SCORES) { if (setvalueP) { self.argumentScores = ((Cons) (value)); } else { value = self.argumentScores; } } else if (slotname == Logic.SYM_LOGIC_ARGUMENT_WEIGHTS) { if (setvalueP) { self.argumentWeights = ((Cons) (value)); } else { value = self.argumentWeights; } } else if (slotname == Logic.SYM_LOGIC_UNBOUND_VARS) { if (setvalueP) { self.unboundVars = ((Cons) (value)); } else { value = self.unboundVars; } } else if (slotname == Logic.SYM_LOGIC_SUCCESSp) { if (setvalueP) { self.successP = BooleanWrapper.coerceWrappedBooleanToBoolean(((BooleanWrapper) (value))); } else { value = (self.successP ? Stella.TRUE_WRAPPER : Stella.FALSE_WRAPPER); } } else { { OutputStringStream stream000 = OutputStringStream.newOutputStringStream(); stream000.nativeStream.print("`" + slotname + "' is not a valid case option"); throw ((StellaException) (StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace())); } } return (value); }