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

!7

concept Emoji {
  S unicode;
  S description;
  S keywords; // with plus
  S posNeg; // positive/negative?
}

cmodule EmojisCRUD > DynCRUD<Emoji> {
  start {
    dbIndexing(Emoji, 'unicode);
    dm_registerAs('emojisCRUD);
  }
  
  // API
  
  Emoji addEmoji(S unicode) {
    Emoji e = uniq_sync(Emoji, +unicode);
    if (empty(e.keywords))
      cset(e, keywords := joinWithSpacedPlus(simpleUnicodeEmojiList().get(unicode)));
    ret e;
  }
  
  S getPosNeg(S unicode) {
    ret getString posNeg(conceptWhere(Emoji, +unicode));
  }
  
  S getKeywords(S unicode) {
    ret getString keywords(conceptWhere(Emoji, +unicode));
  }
  
  void setPosNeg(S unicode, S posNeg) {
    cset(addEmoji(unicode), +posNeg);
  }
  
  LPair<S> emojisWithPosNeg() {
    ret map(func(Emoji e) -> PairS { pair(e.unicode, e.posNeg) },
      [Emoji e : list(Emoji) | nempty(e.posNeg)]);
  }
}

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: 386 / 16885
Version history: 10 change(s)
Referenced in: #1021704 - dm_posNegStringForEmoji
#1021707 - dm_setPosNegStringForEmoji
#1021708 - dm_keywordsForEmoji