1 | "class BankAccount(object):" => "python" |
2 | "def __init__(self, initial_balance=0):" => "python" |
3 | "self.balance = initial_balance" => "python" |
4 | "def deposit(self, amount):" => "python" |
5 | "self.balance += amount" => "python" |
6 | "def withdraw(self, amount):" => "python" |
7 | "self.balance -= amount" => "python" |
8 | "def overdrawn(self):" => "python" |
9 | "return self.balance < 0" => "python" |
10 | "my_account = BankAccount(15)" => "python" |
11 | "my_account.withdraw(5)" => "python" |
12 | "print my_account.balance" => "python" |
13 | "// Logic: Checks every 10 seconds and clears full cache when" => "javax" |
14 | "// anything changed in the DB. So it's as good as traffic-free" => "javax" |
15 | "// when the DB is not changing." => "javax" |
16 | "!747" => "javax" |
17 | "!named thread" => "javax" |
18 | "m {" => "javax" |
19 | "static int updateInterval = 10000;" => "javax" |
20 | "static long lastVersionCount;" => "javax" |
21 | "static new Map<S, S> titles;" => "javax" |
22 | "p {" => "javax" |
23 | "startBot(\"Version Count Bot\", \"#1001745\");" => "javax" |
24 | "makeAndroid3(\"Snippet Title Bot.\");" => "javax" |
25 | "updateLoop();" => "javax" |
26 | "}" => "javax" |
27 | "static void update() {" => "javax" |
28 | "new Matches m;" => "javax" |
29 | "if (match3(\"version count: *\", sendToLocalBot_cached(\"Version Count Bot\", \... => "javax" |
30 | "long count = parseLong(m.get(0));" => "javax" |
31 | "if (count != lastVersionCount) {" => "javax" |
32 | "lastVersionCount = count;" => "javax" |
33 | "clear();" => "javax" |
34 | "}" => "javax" |
35 | "}" => "javax" |
36 | "}" => "javax" |
37 | "static synchronized S answer(S s) {" => "javax" |
38 | "new Matches m;" => "javax" |
39 | "if (match3(\"what is the title of snippet *\", s, m)) {" => "javax" |
40 | "S snippetID = formatSnippetID(m.unq(0));" => "javax" |
41 | "S title = titles.get(snippetID);" => "javax" |
42 | "if (title == null) {" => "javax" |
43 | "title = getSnippetTitle(snippetID);" => "javax" |
44 | "if (title == null) ret \"null\";" => "javax" |
45 | "titles.put(snippetID, title);" => "javax" |
46 | "}" => "javax" |
47 | "ret format(\"The title of snippet * is *.\", snippetID, title);" => "javax" |
48 | "}" => "javax" |
49 | "if (match3(\"clear snippet title cache\", s, m)) {" => "javax" |
50 | "clear();" => "javax" |
51 | "ret \"OK.\";" => "javax" |
52 | "}" => "javax" |
53 | "if (match3(\"get snippet title cache size\", s, m)) {" => "javax" |
54 | "ret \"Cache entries: \" + titles.size();" => "javax" |
55 | "}" => "javax" |
56 | "ret null;" => "javax" |
57 | "}" => "javax" |
58 | "static synchronized void clear() {" => "javax" |
59 | "titles.clear();" => "javax" |
60 | "}" => "javax" |
61 | "}" => "javax" |
Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1002006 |
Snippet name: | Examples JavaX/Python (output of #1002005) |
Eternal ID of this version: | #1002006/1 |
Text MD5: | 783bed0a36fd65abf147bd26d1ee2989 |
Author: | stefan |
Category: | python/javax |
Type: | Document |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-12-13 16:02:21 |
Source code size: | 2398 bytes / 61 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 621 / 149 |
Referenced in: | [show references] |