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

41
LINES

< > BotCompany Repo | #1008615 // Test automatic field index for concepts [WORKS]

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (7473L/49K/166K).

!7

set flag ConceptFieldIndex_debug.

concept CC {
  S a, b;
}

p {
  CC cc = cnew(CC, a := "hello", b := "world");
  ConceptFieldIndex<CC, S> index = new(mainConcepts, CC, "a");
  assertEquals("world", index.get("hello").b);
  assertNull(index.get("Hello"));
  
  cset(cc, a := "yo");
  assertNull(index.get("hello"));
  assertEquals("world", index.get("yo").b);
  print("testing findConceptWhere");
  assertEquals(cc, findConceptWhere(CC, a := "yo"));
  assertNull(findConceptWhere(CC, a := "x"));
  
  print("testing delete");
  cc.delete();
  assertNull(index.get("yo"));
  
  cc = cnew(CC, a := "another", b := "test");
  assertEquals("test", index.get("another").b);
  
  // Test null values
  
  print("testing null");
  cc = cnew(CC, a := null, b := "nullie");
  assertEquals(cc, index.get(null));
  
  print("testing not null anymore");
  cset(cc, a := "x");
  assertEquals(cc, index.get("x"));
  assertNull(index.get(null));

  print("OK");
}

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: #1008615
Snippet name: Test automatic field index for concepts [WORKS]
Eternal ID of this version: #1008615/21
Text MD5: 4b4a08c882449b25434082410c1c76ab
Transpilation MD5: 3849863d7aa4100bdc2962d6e770558e
Author: stefan
Category: javax / concepts
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-05-25 20:29:12
Source code size: 993 bytes / 41 lines
Pitched / IR pitched: No / No
Views / Downloads: 443 / 582
Version history: 20 change(s)
Referenced in: [show references]