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

61
LINES

< > BotCompany Repo | #1002006 // Examples JavaX/Python (output of #1002005)

Document

"class BankAccount(object):" => "python"
"def __init__(self, initial_balance=0):" => "python"
"self.balance = initial_balance" => "python"
"def deposit(self, amount):" => "python"
"self.balance += amount" => "python"
"def withdraw(self, amount):" => "python"
"self.balance -= amount" => "python"
"def overdrawn(self):" => "python"
"return self.balance < 0" => "python"
"my_account = BankAccount(15)" => "python"
"my_account.withdraw(5)" => "python"
"print my_account.balance" => "python"
"// Logic: Checks every 10 seconds and clears full cache when" => "javax"
"// anything changed in the DB. So it's as good as traffic-free" => "javax"
"// when the DB is not changing." => "javax"
"!747" => "javax"
"!named thread" => "javax"
"m {" => "javax"
"static int updateInterval = 10000;" => "javax"
"static long lastVersionCount;" => "javax"
"static new Map<S, S> titles;" => "javax"
"p {" => "javax"
"startBot(\"Version Count Bot\", \"#1001745\");" => "javax"
"makeAndroid3(\"Snippet Title Bot.\");" => "javax"
"updateLoop();" => "javax"
"}" => "javax"
"static void update() {" => "javax"
"new Matches m;" => "javax"
"if (match3(\"version count: *\", sendToLocalBot_cached(\"Version Count Bot\", \... => "javax"
"long count = parseLong(m.get(0));" => "javax"
"if (count != lastVersionCount) {" => "javax"
"lastVersionCount = count;" => "javax"
"clear();" => "javax"
"}" => "javax"
"}" => "javax"
"}" => "javax"
"static synchronized S answer(S s) {" => "javax"
"new Matches m;" => "javax"
"if (match3(\"what is the title of snippet *\", s, m)) {" => "javax"
"S snippetID = formatSnippetID(m.unq(0));" => "javax"
"S title = titles.get(snippetID);" => "javax"
"if (title == null) {" => "javax"
"title = getSnippetTitle(snippetID);" => "javax"
"if (title == null) ret \"null\";" => "javax"
"titles.put(snippetID, title);" => "javax"
"}" => "javax"
"ret format(\"The title of snippet * is *.\", snippetID, title);" => "javax"
"}" => "javax"
"if (match3(\"clear snippet title cache\", s, m)) {" => "javax"
"clear();" => "javax"
"ret \"OK.\";" => "javax"
"}" => "javax"
"if (match3(\"get snippet title cache size\", s, m)) {" => "javax"
"ret \"Cache entries: \" + titles.size();" => "javax"
"}" => "javax"
"ret null;" => "javax"
"}" => "javax"
"static synchronized void clear() {" => "javax"
"titles.clear();" => "javax"
"}" => "javax"
"}" => "javax"

download  show line numbers   

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: 512 / 120
Referenced in: [show references]