MCPcopy Create free account
hub / github.com/MeigenChou/DCTimer-Android / image

Method image

app/src/main/java/scrambler/Clock.java:169–198  ·  view source on GitHub ↗
(String scramble)

Source from the content-addressed store, hash-verified

167 }
168
169 public int[] image(String scramble) {
170 String[] s = scramble.split(" ");
171 pegs = new int[] {1, 1, 1, 1};
172 int[] positCopy = new int[18];
173 for (int i=0; i<s.length; i++) {
174 if (s[i].length() > 0) {
175 if (s[i].equals("UR")) pegs[1] = 0;
176 else if (s[i].equals("DR")) pegs[3] = 0;
177 else if (s[i].equals("DL")) pegs[2] = 0;
178 else if (s[i].equals("UL")) pegs[0] = 0;
179 else if (s[i].equals("y2")) {
180 for (int j = 0; j < 9; j++) {
181 posit[j] = positCopy[j + 9];
182 posit[j + 9] = positCopy[j];
183 }
184 System.arraycopy(posit, 0, positCopy, 0, 18);
185 } else {
186 int x = indexOf(s[i]);
187 if (x >= 0) {
188 int turn = getTurn(s[i]);
189 for (int j = 0; j < 18; j++) {
190 positCopy[j] += turn * moves[x][j];
191 }
192 }
193 }
194 }
195 }
196 System.arraycopy(positCopy, 0, posit, 0, 18);
197 return posit;
198 }
199
200 private int indexOf(String s) {
201 for (int i=0; i<turns.length; i++) {

Callers

nothing calls this directly

Calls 4

indexOfMethod · 0.95
getTurnMethod · 0.95
lengthMethod · 0.80
equalsMethod · 0.45

Tested by

no test coverage detected