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).

1  
!7
2  
3  
set flag ConceptFieldIndex_debug.
4  
5  
concept CC {
6  
  S a, b;
7  
}
8  
9  
p {
10  
  CC cc = cnew(CC, a := "hello", b := "world");
11  
  ConceptFieldIndex<CC, S> index = new(mainConcepts, CC, "a");
12  
  assertEquals("world", index.get("hello").b);
13  
  assertNull(index.get("Hello"));
14  
  
15  
  cset(cc, a := "yo");
16  
  assertNull(index.get("hello"));
17  
  assertEquals("world", index.get("yo").b);
18  
  print("testing findConceptWhere");
19  
  assertEquals(cc, findConceptWhere(CC, a := "yo"));
20  
  assertNull(findConceptWhere(CC, a := "x"));
21  
  
22  
  print("testing delete");
23  
  cc.delete();
24  
  assertNull(index.get("yo"));
25  
  
26  
  cc = cnew(CC, a := "another", b := "test");
27  
  assertEquals("test", index.get("another").b);
28  
  
29  
  // Test null values
30  
  
31  
  print("testing null");
32  
  cc = cnew(CC, a := null, b := "nullie");
33  
  assertEquals(cc, index.get(null));
34  
  
35  
  print("testing not null anymore");
36  
  cset(cc, a := "x");
37  
  assertEquals(cc, index.get("x"));
38  
  assertNull(index.get(null));
39  
40  
  print("OK");
41  
}

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: 448 / 589
Version history: 20 change(s)
Referenced in: [show references]