private void convertFile(DataInputStream ins, FileWriter fout, FeatureCategory type) { BinaryStructureReader bsr = new BinaryStructureReader(ins); PrintWriter pwout; try { pwout = new PrintWriter(fout); } catch (Exception ioex) { ioex.printStackTrace(); return; } try { while (true) { // Read in data int nlabels = bsr.readInt(); bsr.blockBegin(); ArrayList<String> labels = new ArrayList<String>(); for (int i = 0; i < nlabels; i++) { String label = bsr.readString(); labels.add(label); } bsr.blockEnd(); int npoints = bsr.readInt(); ArrayList<double[]> points = new ArrayList<double[]>(); bsr.blockBegin(); for (int i = 0; i < npoints; i++) { points.add(bsr.readDoubles()); } bsr.blockEnd(); ArrayList<Double> features = Features.getFeatures(type, points); String featureString = FEUtil.featuresToString(features); boolean hasLabel = false; for (int i = 0; i < labels.size(); i++) { String featureSymbol = SoarSymbols.getSymbol(type, labels.get(i).toLowerCase()); if (featureSymbol != null) { featureString += String.format(" {%s}\n", featureSymbol); hasLabel = true; break; } } if (hasLabel) { pwout.print(featureString); pwout.flush(); } } } catch (Exception ex) { } }
public Buffer getBuffer(String name) { Buffer b = bufferMap.get(name); if (b == null) { b = new Buffer(name); synchronized (buffers) { bufferMap.put(name, b); buffers.add(b); Collections.sort(buffers); } } return b; }
public synchronized void addFront(VisObject vo) { front.add(vo); }
public synchronized void addBack(VisObject vo) { back.add(vo); }