Revision c715128d
Added by Leszek Koltunski about 4 years ago
src/main/java/org/distorted/patterns/RubikPattern.java | ||
---|---|---|
36 | 36 |
|
37 | 37 |
private int[] numCategories = new int[NUM_CUBES]; |
38 | 38 |
private int[] currentCategory = new int[NUM_CUBES]; |
39 |
private int[] currentScrollPos= new int[NUM_CUBES]; |
|
40 |
|
|
39 | 41 |
private Vector<Category>[] mCategories; |
40 | 42 |
private static RubikPattern mThis; |
41 | 43 |
|
... | ... | |
138 | 140 |
|
139 | 141 |
///////////////////////////////////////////////////////////// |
140 | 142 |
|
141 |
int[][] getMoves(int pattern)
|
|
143 |
int[][] reInitialize(int pattern)
|
|
142 | 144 |
{ |
143 | 145 |
if( pattern>=0 && pattern<numPatterns ) |
144 | 146 |
{ |
145 | 147 |
Pattern p = patterns.elementAt(pattern); |
146 |
if( p!=null ) return p.getMoves();
|
|
148 |
if( p!=null ) return p.reInitialize();
|
|
147 | 149 |
} |
148 | 150 |
|
149 | 151 |
return null; |
... | ... | |
314 | 316 |
|
315 | 317 |
///////////////////////////////////////////////////////////// |
316 | 318 |
|
317 |
int[][] getMoves()
|
|
319 |
int[][] reInitialize()
|
|
318 | 320 |
{ |
319 | 321 |
if( !mInitialized ) |
320 | 322 |
{ |
... | ... | |
323 | 325 |
moveStr = null; |
324 | 326 |
} |
325 | 327 |
|
328 |
mCanRotate = true; |
|
326 | 329 |
curMove = numMove; |
327 | 330 |
return moves; |
328 | 331 |
} |
... | ... | |
415 | 418 |
|
416 | 419 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
417 | 420 |
|
418 |
public void rememberCategory(int size,int num)
|
|
421 |
public void rememberState(int size,int num, int scrollPos)
|
|
419 | 422 |
{ |
420 | 423 |
if( size>=0 && size<NUM_CUBES ) |
421 | 424 |
{ |
422 | 425 |
currentCategory[size] = num; |
426 |
currentScrollPos[size]= scrollPos; |
|
423 | 427 |
} |
424 | 428 |
} |
425 | 429 |
|
... | ... | |
430 | 434 |
return size>=0 && size<NUM_CUBES ? currentCategory[size] : 0; |
431 | 435 |
} |
432 | 436 |
|
437 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
438 |
|
|
439 |
public int recallScrollPos(int size) |
|
440 |
{ |
|
441 |
return size>=0 && size<NUM_CUBES ? currentScrollPos[size] : 0; |
|
442 |
} |
|
443 |
|
|
433 | 444 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
434 | 445 |
|
435 | 446 |
public String getPatternName(int size, int cat, int pat) |
... | ... | |
506 | 517 |
|
507 | 518 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
508 | 519 |
|
509 |
public int[][] getMoves(int size, int cat, int pat)
|
|
520 |
public int[][] reInitialize(int size, int cat, int pat)
|
|
510 | 521 |
{ |
511 | 522 |
if( size>=0 && size<NUM_CUBES && cat>=0 && cat< numCategories[size] ) |
512 | 523 |
{ |
513 | 524 |
Category c = mCategories[size].elementAt(cat); |
514 |
if( c!=null ) return c.getMoves(pat);
|
|
525 |
if( c!=null ) return c.reInitialize(pat);
|
|
515 | 526 |
} |
516 | 527 |
|
517 | 528 |
return null; |
Also available in: Unified diff
Pretty Patterns Dialog: remember the positions of scrollbars.