Project

General

Profile

« Previous | Next » 

Revision 3103c3c8

Added by Leszek Koltunski about 1 year ago

Move opening local files to the OSInterface

View differences:

src/main/java/org/distorted/objectlib/tablebases/TablebasesPruning.java
9 9

  
10 10
package org.distorted.objectlib.tablebases;
11 11

  
12
import android.content.res.Resources;
12
import org.distorted.objectlib.helpers.OperatingSystemInterface;
13 13

  
14 14
import java.io.ByteArrayOutputStream;
15 15
import java.io.IOException;
......
34 34

  
35 35
///////////////////////////////////////////////////////////////////////////////////////////////////
36 36

  
37
  private PruningTable createPruningTable(Resources res, int id)
37
  private PruningTable createPruningTable(OperatingSystemInterface os, int id)
38 38
    {
39
    InputStream stream = res.openRawResource(id);
39
    InputStream stream = os.openLocalFile(id);
40 40
    ByteArrayOutputStream buffer = new ByteArrayOutputStream();
41 41

  
42 42
    int nRead;
......
71 71

  
72 72
///////////////////////////////////////////////////////////////////////////////////////////////////
73 73

  
74
  public TablebasesPruning(Resources res, int[] midIDs, int[] highIDs)
74
  public TablebasesPruning(OperatingSystemInterface os, int[] midIDs, int[] highIDs)
75 75
    {
76 76
    super();
77 77

  
......
83 83
    mGodsNumber = getGodsNumber();
84 84
    mInitialized = true;
85 85

  
86
    for(int i=0; i<mid ; i++) mMidTables[i] = createPruningTable(res,midIDs[i] );
87
    for(int i=0; i<high; i++) mHighTables[i]= createPruningTable(res,highIDs[i]);
86
    for(int i=0; i<mid ; i++) mMidTables[i] = createPruningTable(os,midIDs[i] );
87
    for(int i=0; i<high; i++) mHighTables[i]= createPruningTable(os,highIDs[i]);
88 88

  
89 89
    computeLowHigh();
90 90
    }

Also available in: Unified diff