@Test public void testRead() throws IOException { ScoreReader sc = new ScoreReader(basePath + "old/alarm-10000.scores", 1); sc.readScores(); for (int i = 0; i < sc.n_var; i++) { System.out.println(i); System.out.println(sc.m_scores[i]); } }
public ParentSet[][] readScores() throws IOException { if (completed) { return new ParentSet[0][]; } int i, j = 0, k = 0; String[] ln = null, aux = null; m_scores = new ParentSet[n_var][]; String l = rl(); while (l != null && (l.startsWith("#") || l.equals(""))) { l = rl(); } for (i = 0; i < n_var; i++) { try { ln = l.split(" "); k++; } catch (Exception e) { e.printStackTrace(); log.severe( String.format( "Problem while reading variable: %s. Var %d, ln: %s (line number: %d)", filename, i, Arrays.toString(ln), k)); logExp(log, e); return new ParentSet[0][]; } int v = Integer.parseInt(ln[0]); if (v != i) { pf("WHAAAAAAAT?! v: %d, thread: %d, line number: %d \n", v, i, k); } int n = Integer.parseInt(ln[1]); List<ParentSet> t = new ArrayList<ParentSet>(); try { for (j = 0; j < n; j++) { aux = rd_scores.readLine().split(" "); k++; if (Integer.valueOf(aux[1]) <= max_size) { t.add(new ParentSet(aux)); } } } catch (Exception e) { log.severe( String.format( "Problem while reading parent set: %s. Var %d, parent set %d. aux: %s", filename, i, j, Arrays.toString(aux))); logExp(log, e); return new ParentSet[0][]; } Collections.sort(t); m_scores[i] = t.toArray(new ParentSet[t.size()]); l = rl(); } completed = true; return m_scores; }
ScoreReader implements Closeable { public ParentSet[][] readScores() throws IOException { if (completed) { return new ParentSet[0][]; } int i, j = 0, k = 0; String[] ln = null, aux = null; m_scores = new ParentSet[n_var][]; String l = rl(); while (l != null && (l.startsWith("#") || l.equals(""))) { l = rl(); } for (i = 0; i < n_var; i++) { try { ln = l.split(" "); k++; } catch (Exception e) { e.printStackTrace(); log.severe( String.format( "Problem while reading variable: %s. Var %d, ln: %s (line number: %d)", filename, i, Arrays.toString(ln), k)); logExp(log, e); return new ParentSet[0][]; } int v = Integer.parseInt(ln[0]); if (v != i) { pf("WHAAAAAAAT?! v: %d, thread: %d, line number: %d \n", v, i, k); } int n = Integer.parseInt(ln[1]); List<ParentSet> t = new ArrayList<ParentSet>(); try { for (j = 0; j < n; j++) { aux = rd_scores.readLine().split(" "); k++; if (Integer.valueOf(aux[1]) <= max_size) { t.add(new ParentSet(aux)); } } } catch (Exception e) { log.severe( String.format( "Problem while reading parent set: %s. Var %d, parent set %d. aux: %s", filename, i, j, Arrays.toString(aux))); logExp(log, e); return new ParentSet[0][]; } Collections.sort(t); m_scores[i] = t.toArray(new ParentSet[t.size()]); l = rl(); } completed = true; return m_scores; } }
ScoreReader implements Closeable { public ParentSet[][] readScores() throws IOException { if (completed) { return new ParentSet[0][]; } int i, j = 0, k = 0; String[] ln = null, aux = null; m_scores = new ParentSet[n_var][]; String l = rl(); while (l != null && (l.startsWith("#") || l.equals(""))) { l = rl(); } for (i = 0; i < n_var; i++) { try { ln = l.split(" "); k++; } catch (Exception e) { e.printStackTrace(); log.severe( String.format( "Problem while reading variable: %s. Var %d, ln: %s (line number: %d)", filename, i, Arrays.toString(ln), k)); logExp(log, e); return new ParentSet[0][]; } int v = Integer.parseInt(ln[0]); if (v != i) { pf("WHAAAAAAAT?! v: %d, thread: %d, line number: %d \n", v, i, k); } int n = Integer.parseInt(ln[1]); List<ParentSet> t = new ArrayList<ParentSet>(); try { for (j = 0; j < n; j++) { aux = rd_scores.readLine().split(" "); k++; if (Integer.valueOf(aux[1]) <= max_size) { t.add(new ParentSet(aux)); } } } catch (Exception e) { log.severe( String.format( "Problem while reading parent set: %s. Var %d, parent set %d. aux: %s", filename, i, j, Arrays.toString(aux))); logExp(log, e); return new ParentSet[0][]; } Collections.sort(t); m_scores[i] = t.toArray(new ParentSet[t.size()]); l = rl(); } completed = true; return m_scores; } ScoreReader(String s, int max_size);  ScoreReader(String s); }
ScoreReader implements Closeable { public ParentSet[][] readScores() throws IOException { if (completed) { return new ParentSet[0][]; } int i, j = 0, k = 0; String[] ln = null, aux = null; m_scores = new ParentSet[n_var][]; String l = rl(); while (l != null && (l.startsWith("#") || l.equals(""))) { l = rl(); } for (i = 0; i < n_var; i++) { try { ln = l.split(" "); k++; } catch (Exception e) { e.printStackTrace(); log.severe( String.format( "Problem while reading variable: %s. Var %d, ln: %s (line number: %d)", filename, i, Arrays.toString(ln), k)); logExp(log, e); return new ParentSet[0][]; } int v = Integer.parseInt(ln[0]); if (v != i) { pf("WHAAAAAAAT?! v: %d, thread: %d, line number: %d \n", v, i, k); } int n = Integer.parseInt(ln[1]); List<ParentSet> t = new ArrayList<ParentSet>(); try { for (j = 0; j < n; j++) { aux = rd_scores.readLine().split(" "); k++; if (Integer.valueOf(aux[1]) <= max_size) { t.add(new ParentSet(aux)); } } } catch (Exception e) { log.severe( String.format( "Problem while reading parent set: %s. Var %d, parent set %d. aux: %s", filename, i, j, Arrays.toString(aux))); logExp(log, e); return new ParentSet[0][]; } Collections.sort(t); m_scores[i] = t.toArray(new ParentSet[t.size()]); l = rl(); } completed = true; return m_scores; } ScoreReader(String s, int max_size);  ScoreReader(String s); void close(); ParentSet[][] readScores(); }
ScoreReader implements Closeable { public ParentSet[][] readScores() throws IOException { if (completed) { return new ParentSet[0][]; } int i, j = 0, k = 0; String[] ln = null, aux = null; m_scores = new ParentSet[n_var][]; String l = rl(); while (l != null && (l.startsWith("#") || l.equals(""))) { l = rl(); } for (i = 0; i < n_var; i++) { try { ln = l.split(" "); k++; } catch (Exception e) { e.printStackTrace(); log.severe( String.format( "Problem while reading variable: %s. Var %d, ln: %s (line number: %d)", filename, i, Arrays.toString(ln), k)); logExp(log, e); return new ParentSet[0][]; } int v = Integer.parseInt(ln[0]); if (v != i) { pf("WHAAAAAAAT?! v: %d, thread: %d, line number: %d \n", v, i, k); } int n = Integer.parseInt(ln[1]); List<ParentSet> t = new ArrayList<ParentSet>(); try { for (j = 0; j < n; j++) { aux = rd_scores.readLine().split(" "); k++; if (Integer.valueOf(aux[1]) <= max_size) { t.add(new ParentSet(aux)); } } } catch (Exception e) { log.severe( String.format( "Problem while reading parent set: %s. Var %d, parent set %d. aux: %s", filename, i, j, Arrays.toString(aux))); logExp(log, e); return new ParentSet[0][]; } Collections.sort(t); m_scores[i] = t.toArray(new ParentSet[t.size()]); l = rl(); } completed = true; return m_scores; } ScoreReader(String s, int max_size);  ScoreReader(String s); void close(); ParentSet[][] readScores(); public String filename; public int n_var; public ParentSet[][] m_scores; public boolean completed; public int max_size; }