Revision 464a5f12
Added by Leszek Koltunski 12 months ago
src/main/java/org/distorted/objectlib/json/JsonReader.java | ||
---|---|---|
523 | 523 |
|
524 | 524 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
525 | 525 |
|
526 |
private void parseScrambling7orMore(JSONObject object) throws JSONException |
|
526 |
private void parseScrambling7to10(JSONObject object) throws JSONException |
|
527 |
{ |
|
528 |
JSONArray jsonAlgorithms = object.getJSONArray("algorithms"); |
|
529 |
int numAlgs = jsonAlgorithms.length(); |
|
530 |
mAlgorithms = new int[numAlgs][]; |
|
531 |
|
|
532 |
for(int i=0; i<numAlgs; i++) |
|
533 |
{ |
|
534 |
JSONArray jsonAlg = jsonAlgorithms.getJSONArray(i); |
|
535 |
int numEntries = jsonAlg.length(); |
|
536 |
mAlgorithms[i] = new int[numEntries]; |
|
537 |
for(int j=0; j<numEntries; j++) mAlgorithms[i][j] = (1<<jsonAlg.getInt(j)); |
|
538 |
} |
|
539 |
|
|
540 |
JSONArray jsonEdges = object.getJSONArray("edges"); |
|
541 |
int numEdges = jsonEdges.length(); |
|
542 |
mEdges = new int[numEdges][]; |
|
543 |
|
|
544 |
for(int i=0; i<numEdges; i++) |
|
545 |
{ |
|
546 |
JSONArray jsonEdge = jsonEdges.getJSONArray(i); |
|
547 |
int numEntries = jsonEdge.length(); |
|
548 |
mEdges[i] = new int[numEntries]; |
|
549 |
for(int j=0; j<numEntries; j++) mEdges[i][j] = jsonEdge.getInt(j); |
|
550 |
} |
|
551 |
} |
|
552 |
|
|
553 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
554 |
|
|
555 |
private void parseScrambling11orMore(JSONObject object) throws JSONException |
|
527 | 556 |
{ |
528 | 557 |
JSONArray jsonAlgorithms = object.getJSONArray("algorithms"); |
529 | 558 |
int numAlgs = jsonAlgorithms.length(); |
... | ... | |
558 | 587 |
|
559 | 588 |
if( mScrambleType==0 ) |
560 | 589 |
{ |
561 |
if( major==6 ) parseScrambling6(object); |
|
562 |
else parseScrambling7orMore(object); |
|
590 |
if( major==6 ) parseScrambling6(object); |
|
591 |
else if( major<=10 ) parseScrambling7to10(object); |
|
592 |
else parseScrambling11orMore(object); |
|
563 | 593 |
} |
564 | 594 |
} |
565 | 595 |
|
Also available in: Unified diff
Correctly read JSONs with the previous 'scrambling algorithms' whch were not yet in 'bitmap' form.