Project

General

Profile

« Previous | Next » 

Revision a36b9dca

Added by Leszek Koltunski over 2 years ago

Defer initialization of statics in RubikNetwork till we actually need them.

View differences:

src/main/java/org/distorted/network/RubikNetwork.java
96 96
    "%f8", "%f9", "%fa", "%fb", "%fc", "%fd", "%fe", "%ff"
97 97
    };
98 98

  
99
  private static final int mTotal = ObjectList.getTotal();
100
  private static final String[][][] mCountry = new String[mTotal][MAX_LEVEL][MAX_PLACES];
101
  private static final String[][][] mName    = new String[mTotal][MAX_LEVEL][MAX_PLACES];
102
  private static final  float[][][] mTime    = new  float[mTotal][MAX_LEVEL][MAX_PLACES];
103
  private static final int[][] mPlaces = new int[mTotal][MAX_LEVEL];
99
  private static int mTotal = 0;
100
  private static String[][][] mCountry;
101
  private static String[][][] mName;
102
  private static float[][][] mTime;
103
  private static int[][] mPlaces;
104 104

  
105 105
  private static RubikNetwork mThis;
106 106
  private static String mScores = "";
......
109 109
  private static Receiver mReceiver;
110 110
  private static String mVersion;
111 111

  
112
///////////////////////////////////////////////////////////////////////////////////////////////////
113

  
114
  private static void initializeStatics()
115
    {
116
    if( mTotal==0      ) mTotal   = ObjectList.getTotal();
117
    if( mCountry==null ) mCountry = new String[mTotal][MAX_LEVEL][MAX_PLACES];
118
    if( mName==null    ) mName    = new String[mTotal][MAX_LEVEL][MAX_PLACES];
119
    if( mTime==null    ) mTime    = new  float[mTotal][MAX_LEVEL][MAX_PLACES];
120
    if( mPlaces==null  ) mPlaces  = new int[mTotal][MAX_LEVEL];
121
    }
122

  
112 123
///////////////////////////////////////////////////////////////////////////////////////////////////
113 124

  
114 125
  private static String computeHash(String stringToHash, byte[] salt)
......
512 523
    {
513 524
    boolean receiveValues=true;
514 525

  
526
    initializeStatics();
527

  
515 528
    try
516 529
      {
517 530
      if( mMode==DOWNLOAD && gottaDownload() )

Also available in: Unified diff