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

18
LINES

< > BotCompany Repo | #1016083 // Java Calculator [Dyn Module]

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

Libraryless. Click here for Pure Java version (16471L/117K).

1  
!7
2  
3  
sclass JavaCalculator extends DynBigNumber {
4  
  S input;
5  
  
6  
  void update {
7  
    S s = dm_getInterestingString();
8  
    if (regexpMatches("[0-9\\.\\-+*/() \t]+", s) && setField(input := s)) {
9  
      setValue("Calculating...");
10  
      try {
11  
        setValue(javaEval(s));
12  
      } catch e {
13  
        setValue("ERROR");
14  
        _handleException(e);
15  
      }
16  
    }
17  
  }
18  
}

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: #1016083
Snippet name: Java Calculator [Dyn Module]
Eternal ID of this version: #1016083/3
Text MD5: a598fb3fed84b7bb383df390592cfef8
Transpilation MD5: 680a48f7463a9ae12baf3e0c9d90186d
Author: stefan
Category: javax / stefan's os
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-06-08 18:41:04
Source code size: 379 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 291 / 549
Version history: 2 change(s)
Referenced in: [show references]