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

41
LINES

< > BotCompany Repo | #1021646 // Emojis CRUD

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 911K of libraries. Click here for Pure Java version (12438L/67K).

1  
!7
2  
3  
concept Emoji {
4  
  S unicode;
5  
  S description;
6  
  S keywords; // with plus
7  
  S posNeg; // positive/negative?
8  
}
9  
10  
cmodule EmojisCRUD > DynCRUD<Emoji> {
11  
  start {
12  
    dbIndexing(Emoji, 'unicode);
13  
    dm_registerAs('emojisCRUD);
14  
  }
15  
  
16  
  // API
17  
  
18  
  Emoji addEmoji(S unicode) {
19  
    Emoji e = uniq_sync(Emoji, +unicode);
20  
    if (empty(e.keywords))
21  
      cset(e, keywords := joinWithSpacedPlus(simpleUnicodeEmojiList().get(unicode)));
22  
    ret e;
23  
  }
24  
  
25  
  S getPosNeg(S unicode) {
26  
    ret getString posNeg(conceptWhere(Emoji, +unicode));
27  
  }
28  
  
29  
  S getKeywords(S unicode) {
30  
    ret getString keywords(conceptWhere(Emoji, +unicode));
31  
  }
32  
  
33  
  void setPosNeg(S unicode, S posNeg) {
34  
    cset(addEmoji(unicode), +posNeg);
35  
  }
36  
  
37  
  LPair<S> emojisWithPosNeg() {
38  
    ret map(func(Emoji e) -> PairS { pair(e.unicode, e.posNeg) },
39  
      [Emoji e : list(Emoji) | nempty(e.posNeg)]);
40  
  }
41  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1021646
Snippet name: Emojis CRUD
Eternal ID of this version: #1021646/11
Text MD5: 8af5a368d8736894bc04fb9f8e0f0706
Transpilation MD5: a991ea609dc064fc29e093457a3c00a3
Author: stefan
Category: javax / discord
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-02-24 18:53:50
Source code size: 914 bytes / 41 lines
Pitched / IR pitched: No / No
Views / Downloads: 385 / 16885
Version history: 10 change(s)
Referenced in: [show references]