// returns true if change sbool _csetField(Concept c, S field, O value) ctex { Field f = setOpt_findField(c.getClass(), field); //print("cset: " + c.id + " " + field + " " + struct(value) + " " + f); if (value instanceof RC) value = c._concepts.getConcept((RC) value); value = deref(value); if (value instanceof S && l((S) value) >= concepts_internStringsLongerThan) value = intern((S) value); if (f == null) { // dynamic field (undeclared) assertIdentifier(field); O val2 = value instanceof Concept ? c.new Ref((Concept) value) : value; O oldVal = mapGet(c.fieldValues, field); if (oldVal instanceof Concept.Ref && val2 instanceof Concept.Ref) // change existing reference ((Concept.Ref) oldVal).set(((Concept.Ref) val2)!); else if (val2 == null) { // unindex & drop reference, drop dynamic field if (oldVal != null) { if (oldVal cast Concept.Ref) oldVal.unindexAndDrop(); syncMapRemove(c.fieldValues, field); } } else // create new reference c.fieldValues = syncMapPut2_createLinkedHashMap(c.fieldValues, field, val2); c.change(); } else if (isSubtypeOf(f.getType(), Concept.Ref.class)) { // Concept.Ref magic ((Concept.Ref) f.get(c)).set((Concept) derefRef(value)); c.change(); true; } else if (isSubtypeOf(f.getType(), Concept.RefL.class)) { // Concept.RefL magic ((Concept.RefL) f.get(c)).replaceWithList(lmap derefRef((L) value)); c.change(); true; } else { O old = f.get(c); if (neq(value, old)) { f.set(c, value); if (!isTransient(f)) c.change(); true; } } false; }
Began life as a copy of #1026007
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
Snippet ID: | #1030900 |
Snippet name: | _csetField [backup] |
Eternal ID of this version: | #1030900/1 |
Text MD5: | 9f5806ce71e5a7216c7a72ef24098251 |
Author: | stefan |
Category: | javax / concepts |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-04-07 23:40:39 |
Source code size: | 1707 bytes / 47 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 192 / 224 |
Referenced in: | [show references] |