Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

13
LINES

< > BotCompany Repo | #1030746 // replaceConceptAndUpdateRefs - replace a concept with a new one, keeping its ID and updating all references

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (15653L/101K).

static <A extends Concept> A replaceConceptAndUpdateRefs(Concept a, A b) {
  assertTrue("object to replace with must be unlisted", isUnlisted(b));
  Concepts cc = a.concepts();
  assertTrue("object to replace must be listed", cc != null);
  L<Concept.Ref> refs = allBackRefObjects(a);
  b.id = a.id;
  deleteConcept(a);
  cc.register_phase2(b);
  cset(a, meta_migratedTo := b); // for objects that may have had direct pointers
  for (Concept.Ref ref : refs)
    ref.set(b);
  ret b;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1030746
Snippet name: replaceConceptAndUpdateRefs - replace a concept with a new one, keeping its ID and updating all references
Eternal ID of this version: #1030746/10
Text MD5: b0553b44229194f95842f47532307d8e
Transpilation MD5: e00668d109a9059eb1f3d409d6b06dc0
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-21 23:47:57
Source code size: 496 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 178 / 273
Version history: 9 change(s)
Referenced in: [show references]