1 | // for stuff like #1000349 |
2 | |
3 | static class LFixedPositions extends LearnerImpl { |
4 | static boolean debug; |
5 | Map<Integer, String> map = new TreeMap<Integer, String>(); |
6 | |
7 | public void processInOut(Object _in, Object _out) { |
8 | // Only looks at out... funny, eh? |
9 | |
10 | String out = cast _out; |
11 | for (int i = 0; i < out.length(); i++) { |
12 | String s = map.get(i); |
13 | String c = out.substring(i, i+1); |
14 | if (s == null) |
15 | map.put(i, c); |
16 | else if (s.equals("")) { |
17 | } else if (!s.equals(c)) |
18 | map.put(i, ""); // TILT |
19 | } |
20 | |
21 | for (int i : map.keySet()) |
22 | if (i >= out.length()) |
23 | map.put(i, ""); |
24 | } |
25 | |
26 | public Object processIn(Object _in) { |
27 | String in = cast _in; |
28 | new List<String> l; |
29 | for (int i = 0; i < in.length(); i++) |
30 | l.add(in.substring(i, i+1)); |
31 | for (int i : map.keySet()) { |
32 | String s = map.get(i); |
33 | if (!s.equals("")) { |
34 | while (i >= l.size()) |
35 | l.add(" "); |
36 | l.set(i, s); |
37 | } |
38 | } |
39 | return join("", l); |
40 | } |
41 | } |
Began life as a copy of #1000481
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1000485 |
Snippet name: | LFixedPositions |
Eternal ID of this version: | #1000485/1 |
Text MD5: | e076c3c0cc2ee0fb596b6b3a745451da |
Author: | stefan |
Category: | |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-08-09 02:51:14 |
Source code size: | 1057 bytes / 41 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 667 / 1588 |
Referenced in: | [show references] |