private PointListConnections readAMPTSConnections(File connFile) throws IOException { final BufferedReader br = new BufferedReader(new FileReader(connFile)); final PointListConnections plc = new PointListConnections(); String line; while ((line = br.readLine()) != null) { if (!line.trim().startsWith("indices")) continue; final String[] data = line.trim().replace("indices(", "").replace(")", "").split(","); final boolean isOpen = (br.readLine().contains("open_boundary")); int prev = Integer.parseInt(data[0]); for (int i = 1; i < data.length; i++) { final int next = Integer.parseInt(data[i]); plc.addConnection(prev, next); prev = next; } if (!isOpen) { plc.addConnection(Integer.parseInt(data[data.length - 1]), Integer.parseInt(data[0])); } } br.close(); return plc; }
private PointListConnections readAMPTSConnections(File connFile) throws IOException { final BufferedReader br = new BufferedReader(new FileReader(connFile)); final PointListConnections plc = new PointListConnections(); String line; while ((line = br.readLine()) != null) { if (!line.trim().startsWith("indices")) continue; final String[] data = line.trim().replace("indices(", "").replace(")", "").split(","); final boolean isOpen = (br.readLine().contains("open_boundary")); int prev = Integer.parseInt(data[0]); for (int i = 1; i < data.length; i++) { final int next = Integer.parseInt(data[i]); plc.addConnection(prev, next); prev = next; } if (!isOpen) { plc.addConnection(Integer.parseInt(data[data.length - 1]), Integer.parseInt(data[0])); } } br.close(); return plc; }
void readConnections() throws IOException { connections = new PointListConnections(); final FileObject firstASF = this.getFileObject(0); BufferedReader br = null; try { br = new BufferedReader(new InputStreamReader(firstASF.getContent().getInputStream())); String line; while ((line = br.readLine()) != null) { if (!line.startsWith("#")) { final String[] parts = line.split("\\s+"); if (parts.length < 7) continue; final int from = Integer.parseInt(parts[4].trim()); final int to = Integer.parseInt(parts[6].trim()); connections.addConnection(from, to); } } } finally { if (br != null) { try { br.close(); } catch (final IOException e) { // ignore } ; } } } }
this.connections = new PointListConnections();
void readConnections() throws IOException { connections = new PointListConnections(); final FileObject firstASF = this.getFileObject(0); BufferedReader br = null; try { br = new BufferedReader(new InputStreamReader(firstASF.getContent().getInputStream())); String line; while ((line = br.readLine()) != null) { if (!line.startsWith("#")) { final String[] parts = line.split("\\s+"); if (parts.length < 7) continue; final int from = Integer.parseInt(parts[4].trim()); final int to = Integer.parseInt(parts[6].trim()); connections.addConnection(from, to); } } } finally { if (br != null) { try { br.close(); } catch (final IOException e) { // ignore } ; } } } }
this.connections = new PointListConnections();
static PointListConnections loadConnections() { final PointListConnections plc = new PointListConnections(); plc.addConnection(0, 1); plc.addConnection(1, 2); plc.addConnection(1, 4); plc.addConnection(1, 9); plc.addConnection(4, 3); plc.addConnection(9, 10); plc.addConnection(0, 5); plc.addConnection(0, 8); plc.addConnection(5, 6); plc.addConnection(8, 7); return plc; }
static PointListConnections loadConnections() { final PointListConnections plc = new PointListConnections(); plc.addConnection(0, 1); plc.addConnection(1, 2); plc.addConnection(1, 4); plc.addConnection(1, 9); plc.addConnection(4, 3); plc.addConnection(9, 10); plc.addConnection(0, 5); plc.addConnection(0, 8); plc.addConnection(5, 6); plc.addConnection(8, 7); return plc; }
public static void main(String[] args) { final List<IndependentPair<PointList, FImage>> data = generateData(10); final PointListConnections connections = new PointListConnections(); connections.addConnection(0, 1); connections.addConnection(1, 2);
public static void main(String[] args) { final List<IndependentPair<PointList, FImage>> data = generateData(10); final PointListConnections connections = new PointListConnections(); connections.addConnection(0, 1); connections.addConnection(1, 2);