// returns number of changes static int cset_compareByStruct(Concept c, O... values) ctex { int changes = 0; values = expandParams(c.getClass(), values); warnIfOddCount(values); for (int i = 0; i+1 < l(values); i += 2) { S field = (S) values[i]; O value = values[i+1]; 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) { // TODO: keep ref if it exists mapPut2(c.fieldValues, field, value instanceof Concept ? c.new Ref((Concept) value) : value); c.change(); } else if (isSubtypeOf(f.getType(), Concept.Ref.class)) { ((Concept.Ref) f.get(c)).set((Concept) derefRef(value)); c.change(); ++changes; } else { O old = f.get(c); if (!structEq(value, old)) { f.set(c, value); if ((f.getModifiers() & java.lang.reflect.Modifier.TRANSIENT) == 0) c.change(); ++changes; } } } ret changes; }
Began life as a copy of #1009257
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1011826 |
Snippet name: | cset_compareByStruct - cset with structEq() instead of eq() |
Eternal ID of this version: | #1011826/2 |
Text MD5: | 3ed8d5e33327a8263ac52a3b24d47c26 |
Author: | stefan |
Category: | javax / concepts |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-11-06 01:02:05 |
Source code size: | 1231 bytes / 33 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 409 / 424 |
Version history: | 1 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |