code
stringlengths
73
34.1k
label
stringclasses
1 value
void mapIn(String in, Object comp, String comp_in) { if (comp == ca.getComponent()) { throw new ComponentException("cannot connect 'In' with itself for " + in); } ComponentAccess ac_dest = lookup(comp); FieldAccess destAccess = (FieldAccess) ac_dest.input(comp_in); ch...
java
void mapInVal(Object val, Object to, String to_in) { if (val == null) { throw new ComponentException("Null value for " + name(to, to_in)); } if (to == ca.getComponent()) { throw new ComponentException("field and component ar ethe same for mapping :" + to_in); } ...
java
void mapInField(Object from, String from_field, Object to, String to_in) { if (to == ca.getComponent()) { throw new ComponentException("wrong connect:" + from_field); } ComponentAccess ca_to = lookup(to); Access to_access = ca_to.input(to_in); checkFA(to_access, to, t...
java
void mapOutField(Object from, String from_out, Object to, String to_field) { if (from == ca.getComponent()) { throw new ComponentException("wrong connect:" + to_field); } ComponentAccess ca_from = lookup(from); Access from_access = ca_from.output(from_out); checkFA(fr...
java
void connect(Object from, String from_out, Object to, String to_in) { // add them to the set of commands if (from == to) { throw new ComponentException("src == dest."); } if (to_in == null || from_out == null) { throw new ComponentException("Some field arguments a...
java
void feedback(Object from, String from_out, Object to, String to_in) { // add them to the set of commands if (from == to) { throw new ComponentException("src == dest."); } if (to_in == null || from_out == null) { throw new ComponentException("Some field arguments ...
java
void callAnnotated(Class<? extends Annotation> ann, boolean lazy) { for (ComponentAccess p : oMap.values()) { p.callAnnotatedMethod(ann, lazy); } }
java
public double addPoint( double x, double y ) { pts.add(new Coordinate(x, y)); return selection = pts.size() - 1; }
java
public void setPoint( double x, double y ) { if (selection >= 0) { Coordinate coordinate = new Coordinate(x, y); pts.set(selection, coordinate); } }
java
public static Object sim( String file, String ll, String cmd ) throws Exception { String f = CLI.readFile(file); Object o = CLI.createSim(f, false, ll); return CLI.invoke(o, cmd); }
java
public static void groovy( String file, String ll, String cmd ) throws Exception { String f = CLI.readFile(file); Object o = CLI.createSim(f, true, ll); }
java
public static String readFile( String name ) throws IOException { StringBuilder b = new StringBuilder(); BufferedReader r = new BufferedReader(new FileReader(name)); String line; while( (line = r.readLine()) != null ) { b.append(line).append('\n'); } r.close()...
java
public static Object createSim( String script, boolean groovy, String ll ) throws Exception { setOMSProperties(); Level.parse(ll); // may throw IAE String prefix = groovy ? "" : "import static oms3.SimConst.*\n" + "def __sb__ = new oms3.SimBuilder(logging:'" + ll + "')\n" + "__sb...
java
private Object getPropertyTypeValue(Class propertyType, Object value) { if (propertyType.equals(String.class)) { return value.toString(); } else if (propertyType.equals(Boolean.class) || propertyType.equals(Boolean.TYPE)) { Boolean arg = null; if (value instanceof Boo...
java
public static <T, K, V> Map<K, V> toMap( Stream<T> stream, Function<T, K> keySupplier, Function<T, V> valueSupplier ) { return stream.collect(Collectors.toMap(keySupplier, valueSupplier)); }
java
public static <T, K, R> Map<R, List<T>> toMapGroupBy( Stream<T> stream, Function<T, R> groupingFunction ) { return stream.collect(Collectors.groupingBy(groupingFunction)); // to get a set: Collectors.groupingBy(groupingFunction, Collectors.toSet()) }
java
public static <T> Map<Boolean, List<T>> toMapPartition( Stream<T> stream, Predicate<T> predicate ) { return stream.collect(Collectors.partitioningBy(predicate)); }
java
public static <T> T findAny( Stream<T> stream, Predicate<T> predicate ) { Optional<T> element = stream.filter(predicate).findAny(); return element.orElse(null); }
java
public void createSpatialTable( String tableName, int tableSrid, String geometryFieldData, String[] fieldData ) throws Exception { createSpatialTable(tableName, tableSrid, geometryFieldData, fieldData, null, false); }
java
public void createSpatialIndex( String tableName, String geomColumnName ) throws Exception { if (geomColumnName == null) { geomColumnName = "the_geom"; } String realColumnName = getProperColumnNameCase(tableName, geomColumnName); String realTableName = getProperTableNameCase(...
java
public void insertGeometry( String tableName, Geometry geometry, String epsg ) throws Exception { String epsgStr = "4326"; if (epsg == null) { epsgStr = epsg; } GeometryColumn gc = getGeometryColumnsForTable(tableName); String sql = "INSERT INTO " + tableName + " (" ...
java
public boolean isTableSpatial( String tableName ) throws Exception { GeometryColumn geometryColumns = getGeometryColumnsForTable(tableName); return geometryColumns != null; }
java
public List<Geometry> getGeometriesIn( String tableName, Envelope envelope, String... prePostWhere ) throws Exception { List<Geometry> geoms = new ArrayList<Geometry>(); List<String> wheres = new ArrayList<>(); String pre = ""; String post = ""; String where = ""; if (pre...
java
public List<Geometry> getGeometriesIn( String tableName, Geometry intersectionGeometry, String... prePostWhere ) throws Exception { List<Geometry> geoms = new ArrayList<Geometry>(); List<String> wheres = new ArrayList<>(); String pre = ""; String post = ""; String wh...
java
public static boolean fEq( float a, float b, float epsilon ) { if (isNaN(a) && isNaN(b)) { return true; } float diffAbs = abs(a - b); return a == b ? true : diffAbs < epsilon ? true : diffAbs / Math.max(abs(a), abs(b)) < epsilon; }
java
public static double logGamma( double x ) { double ret; if (Double.isNaN(x) || (x <= 0.0)) { ret = Double.NaN; } else { double g = 607.0 / 128.0; double sum = 0.0; for( int i = LANCZOS.length - 1; i > 0; --i ) { sum = sum + (LANCZ...
java
public static List<int[]> getNegativeRanges( double[] x ) { int firstNegative = -1; int lastNegative = -1; List<int[]> rangeList = new ArrayList<int[]>(); for( int i = 0; i < x.length; i++ ) { double xValue = x[i]; if (firstNegative == -1 && xValue < 0) { ...
java
public static double[] range2Bins( double min, double max, int binsNum ) { double delta = (max - min) / binsNum; double[] bins = new double[binsNum + 1]; int count = 0; double running = min; for( int i = 0; i < binsNum; i++ ) { bins[count] = running; runni...
java
public static double[] range2Bins( double min, double max, double step, boolean doLastEqual ) { double intervalsDouble = (max - min) / step; int intervals = (int) intervalsDouble; double rest = intervalsDouble - intervals; if (rest > D_TOLERANCE) { intervals++; } ...
java
private void verifyInput() { if (inData == null || inStations == null) { throw new NullPointerException(msg.message("kriging.stationproblem")); } if (pMode < 0 || pMode > 1) { throw new IllegalArgumentException(msg.message("kriging.defaultMode")); } if (d...
java
private LinkedHashMap<Integer, Coordinate> getCoordinate( int nStaz, SimpleFeatureCollection collection, String idField ) throws Exception { LinkedHashMap<Integer, Coordinate> id2CoordinatesMap = new LinkedHashMap<Integer, Coordinate>(); FeatureIterator<SimpleFeature> iterator = collection.f...
java
private double variogram( double c0, double a, double sill, double rx, double ry, double rz ) { if (isNovalue(rz)) { rz = 0; } double value = 0; double h2 = Math.sqrt(rx * rx + rz * rz + ry * ry); if (pSemivariogramType == 0) { value = c0 + sill * (1 - Mat...
java
public static void figureOutConnect(PrintStream w, Object... comps) { // add all the components via Proxy. List<ComponentAccess> l = new ArrayList<ComponentAccess>(); for (Object c : comps) { l.add(new ComponentAccess(c)); } // find all out slots for (Compone...
java
public static List<Class<?>> getComponentClasses(URL jar) throws IOException { JarInputStream jarFile = new JarInputStream(jar.openStream()); URLClassLoader cl = new URLClassLoader(new URL[]{jar}, Thread.currentThread().getContextClassLoader()); List<Class<?>> idx = new ArrayList<Class<?>>(); ...
java
public static URL getDocumentation(Class<?> comp, Locale loc) { Documentation doc = (Documentation) comp.getAnnotation(Documentation.class); if (doc != null) { String v = doc.value(); try { // try full URL first (external reference) URL url = new U...
java
public static String getDescription(Class<?> comp, Locale loc) { Description descr = (Description) comp.getAnnotation(Description.class); if (descr != null) { String lang = loc.getLanguage(); Method[] m = descr.getClass().getMethods(); for (Method method : m) { // ...
java
public static Object[] stringListToArray(List<String> list) { Object[] params = null; if (list != null) { params = list.toArray(new String[list.size()]); } return params; }
java
public static boolean notMatches(String value, String prefix, String middle, String postfix) { return !matches(value, prefix, middle, postfix); }
java
public static boolean matches(String value, String prefix, String middle, String postfix) { String pattern = prefix + middle + postfix; boolean result = value.matches(pattern); return result; }
java
public static boolean matchesWithoutPrefixes(String value1, String prefix1, String value2, String prefix2) { if (!value1.startsWith(prefix1)) { return false; } value1 = value1.substring(prefix1.length()); if (!value2.startsWith(prefix2)) { return false; } value2 = value2.substring(prefix2.lengt...
java
public static ValidationMessage shiftReferenceLocation(Entry entry, long newSequenceLength) { Collection<Reference> references = entry.getReferences(); for (Reference reference : references) { for (Location rlocation : reference.getLocations().getLocations()) { { rlocation.setEndPosition(newSequenceL...
java
@SuppressWarnings("nls") public void dumpChart( File chartFile, boolean autoRange, boolean withLegend, int imageWidth, int imageHeight ) throws IOException { JFreeChart chart = ChartFactory.createXYLineChart(title, xLabel, yLabel, collection, PlotOrientation.VERTICAL, withLegend, ...
java
public RuleWrapper getFirstRule() { if (featureTypeStylesWrapperList.size() > 0) { FeatureTypeStyleWrapper featureTypeStyleWrapper = featureTypeStylesWrapperList.get(0); List<RuleWrapper> rulesWrapperList = featureTypeStyleWrapper.getRulesWrapperList(); if (rulesWrapperList.s...
java
public boolean isSimpleType() { if (// fieldType.equals(Double.class.getCanonicalName()) || // fieldType.equals(Float.class.getCanonicalName()) || // fieldType.equals(Integer.class.getCanonicalName()) || // fieldType.equals(double.class.getCanonicalName())...
java
private Long[] checkLocation(Location location) { Long[] positions = new Long[2]; if (location.isComplement()) { positions[0] = location.getEndPosition(); positions[1] = location.getBeginPosition(); } else { positions[0] = location.getBeginPosition(); positions[1] = location.getEndPosition(); } re...
java
@Deprecated @Override public String getSequence(Long beginPosition, Long endPosition) { if (beginPosition == null || endPosition == null || (beginPosition > endPosition) || beginPosition < 1 || endPosition >getLength()) { return null; } int length = (int) (endPosition.longValue() - beginPosi...
java
String convertCase(String str) { if (str == null) { return null; } return sensitive ? str : str.toLowerCase(); }
java
private void set(Matrix m) { this.nRows = 1; this.nCols = m.nCols; this.values = m.values; }
java
public RowVector getRow(int r) throws MatrixException { if ((r < 0) || (r >= nRows)) { throw new MatrixException(MatrixException.INVALID_INDEX); } RowVector rv = new RowVector(nCols); for (int c = 0; c < nCols; ++c) { rv.values[0][c] = this.values[r][c]; ...
java
public ColumnVector getColumn(int c) throws MatrixException { if ((c < 0) || (c >= nCols)) { throw new MatrixException(MatrixException.INVALID_INDEX); } ColumnVector cv = new ColumnVector(nRows); for (int r = 0; r < nRows; ++r) { cv.values[r][0] = this.values...
java
protected void set(double values[][]) { this.nRows = values.length; this.nCols = values[0].length; this.values = values; for (int r = 1; r < nRows; ++r) { nCols = Math.min(nCols, values[r].length); } }
java
public void setRow(RowVector rv, int r) throws MatrixException { if ((r < 0) || (r >= nRows)) { throw new MatrixException(MatrixException.INVALID_INDEX); } if (nCols != rv.nCols) { throw new MatrixException( MatrixException.INVALID_DIME...
java
public void setColumn(ColumnVector cv, int c) throws MatrixException { if ((c < 0) || (c >= nCols)) { throw new MatrixException(MatrixException.INVALID_INDEX); } if (nRows != cv.nRows) { throw new MatrixException( MatrixExceptio...
java
public Matrix transpose() { double tv[][] = new double[nCols][nRows]; // transposed values // Set the values of the transpose. for (int r = 0; r < nRows; ++r) { for (int c = 0; c < nCols; ++c) { tv[c][r] = values[r][c]; } } return ne...
java
public Matrix add(Matrix m) throws MatrixException { // Validate m's size. if ((nRows != m.nRows) && (nCols != m.nCols)) { throw new MatrixException( MatrixException.INVALID_DIMENSIONS); } double sv[][] = new double[nRows][nCols]; // sum v...
java
public Matrix subtract(Matrix m) throws MatrixException { // Validate m's size. if ((nRows != m.nRows) && (nCols != m.nCols)) { throw new MatrixException( MatrixException.INVALID_DIMENSIONS); } double dv[][] = new double[nRows][nCols]; // ...
java
public Matrix multiply(double k) { double pv[][] = new double[nRows][nCols]; // product values // Compute values of the product. for (int r = 0; r < nRows; ++r) { for (int c = 0; c < nCols; ++c) { pv[r][c] = k*values[r][c]; } } return...
java
public Matrix multiply(Matrix m) throws MatrixException { // Validate m's dimensions. if (nCols != m.nRows) { throw new MatrixException( MatrixException.INVALID_DIMENSIONS); } double pv[][] = new double[nRows][m.nCols]; // product values ...
java
public static void printInfo( String filePath ) throws Exception { LasInfo lasInfo = new LasInfo(); lasInfo.inLas = filePath; lasInfo.process(); }
java
private double internalPipeVerify( int k, double[] cDelays, double[][] net, double[][] timeDischarge, double[][] timeFillDegree, int tp ) { int num; double localdelay, olddelay, qMax, B, known, theta, u; double[][] qPartial; qPartial = new double[timeDischarge.length][timeD...
java
private void calculateDelays( int k, double[] cDelays, double[][] net ) { double t; int ind, r = 1; for( int j = 0; j < net.length; ++j ) { t = 0; r = 1; ind = (int) net[j][0]; /* * Area k is not included in delays *...
java
private double getHydrograph( int k, double[][] Qpartial, double localdelay, double delay, int tp ) { double Qmax = 0; double tmin = rainData[0][0]; /* [min] */ int j = 0; double t = tmin; double Q; double rain; int maxRain = 0; if (tMax == tpMaxCali...
java
@Override public void geoSewer() throws Exception { if (!foundMaxrainTime) { evaluateDischarge(lastTimeDischarge, lastTimeFillDegree, tpMaxCalibration); } else { /* * start to evaluate the discharge from 15 minutes,evaluate the nearsted value to 15 minutes. ...
java
private double scanNetwork( int k, int l, double[] one, double[][] net ) { int ind; /* * t Ritardo accumulato dall'onda prima di raggiungere il tratto si sta * dimensionando. */ double t; /* * Distanza percorsa dall'acqua dall'area dove e' caduta per ...
java
public void readDwgBlockV15(int[] data, int offset) throws Exception { int bitPos = offset; bitPos = readObjectHeaderV15(data, bitPos); Vector v = DwgUtil.getTextString(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); String text = (String)v.get(1); name = text; bitPos = readObjectTailV15(data, bit...
java
public void setRepeatTimerDelay(int delay) { if (delay <= 0) { String message = Logging.getMessage("generic.ArgumentOutOfRange", delay); Logging.logger().severe(message); throw new IllegalArgumentException(message); } this.repeatTimer.setDelay(dela...
java
public void setPitchIncrement(double value) { if (value < 0) { String message = Logging.getMessage("generic.ArgumentOutOfRange", value); Logging.logger().severe(message); throw new IllegalArgumentException(message); } this.pitchStep = value; }
java
public void setFovIncrement(double value) { if (value < 1) { String message = Logging.getMessage("generic.ArgumentOutOfRange", value); Logging.logger().severe(message); throw new IllegalArgumentException(message); } this.fovStep = value; }
java
public void setVeIncrement(double value) { if (value < 0) { String message = Logging.getMessage("generic.ArgumentOutOfRange", value); Logging.logger().severe(message); throw new IllegalArgumentException(message); } this.veStep = value; }
java
protected Vec4 computeSurfacePoint(OrbitView view, Angle heading, Angle pitch) { Globe globe = wwd.getModel().getGlobe(); // Compute transform to be applied to north pointing Y so that it would point in the view direction // Move coordinate system to view center point Matrix transfor...
java
public static void enableProxy( String url, String port, String user, String pwd, String nonProxyHosts ) { _url = url; _port = port; _user = user; _pwd = pwd; System.setProperty("http.proxyHost", url); System.setProperty("https.proxyHost", url); if (port != null ...
java
public static void disableProxy() { System.clearProperty("http.proxyHost"); System.clearProperty("http.proxyPort"); System.clearProperty("http.proxyUserName"); System.clearProperty("http.proxyUser"); System.clearProperty("http.proxyPassword"); System.clearProperty("https....
java
public static String loadNativeLibrary( String nativeLibPath, String libName ) { try { String name = "las_c"; if (libName == null) libName = name; if (nativeLibPath != null) { NativeLibrary.addSearchPath(libName, nativeLibPath); } ...
java
public static void createTables(Connection connection) throws Exception { StringBuilder sB = new StringBuilder(); sB.append("CREATE TABLE "); sB.append(TABLE_LOG); sB.append(" ("); sB.append(COLUMN_ID); sB.append(" INTEGER PRIMARY KEY AUTOINCREMENT, "); sB.append(...
java
public static String convert( long x, int n, String d ) { if (x == 0) { return "0"; } String r = ""; int m = 1 << n; m--; while( x != 0 ) { r = d.charAt((int) (x & m)) + r; x = x >>> n; } return r; }
java
public static String sprintf( String s, Object[] params ) { if ((s == null) || (params == null)) { return s; } StringBuffer result = new StringBuffer(""); String[] ss = split(s); int p = 0; for( int i = 0; i < ss.length; i++ ) { char c = ss[i].char...
java
public void setLowerAndUpperBounds(double lower, double upper) { if (data == null) { return; } this.originalLowerBound = lower; this.originalUpperBound = upper; if (originalLowerBound < min) { offset = Math.abs(originalLowerBound) + 10; } else { ...
java
private boolean checkLocations(long length, CompoundLocation<Location> locations) { for(Location location : locations.getLocations()){ if(location instanceof RemoteLocation) continue; if(location.getIntBeginPosition() == null || location.getIntBeginPosition() ...
java
public static SimpleFeatureSource readFeatureSource( String path ) throws Exception { File shapeFile = new File(path); FileDataStore store = FileDataStoreFinder.getDataStore(shapeFile); SimpleFeatureSource featureSource = store.getFeatureSource(); return featureSource; }
java
public static GEOMTYPE getGeometryType( SimpleFeatureCollection featureCollection ) { GeometryDescriptor geometryDescriptor = featureCollection.getSchema().getGeometryDescriptor(); if (EGeometryType.isPolygon(geometryDescriptor)) { return GEOMTYPE.POLYGON; } else if (EGeometryType.is...
java
public static void insertBeforeCompass( WorldWindow wwd, Layer layer ) { // Insert the layer into the layer list just before the compass. int compassPosition = 0; LayerList layers = wwd.getModel().getLayers(); for( Layer l : layers ) { if (l instanceof CompassLayer) ...
java
public void readDwgVertex2DV15(int[] data, int offset) throws Exception { //System.out.println("readDwgVertex2D executing ..."); int bitPos = offset; bitPos = readObjectHeaderV15(data, bitPos); Vector v = DwgUtil.getRawChar(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); int flags = ((Integer)v.get(...
java
public static double runoffCoefficientError(double[] obs, double[] sim, double[] precip) { sameArrayLen(sim, obs, precip); double mean_pred = Stats.mean(sim); double mean_val = Stats.mean(obs); double mean_ppt = Stats.mean(precip); double error = Math.abs((mean_pred / mean_ppt) ...
java
public double[] update( double w, double c1, double rand1, double c2, double rand2, double[] globalBest ) { for( int i = 0; i < locations.length; i++ ) { particleVelocities[i] = w * particleVelocities[i] + // c1 * rand1 * (particleLocalBests[i] - locations[i]) + // ...
java
public void setParticleLocalBeststoCurrent() { for( int i = 0; i < locations.length; i++ ) { particleLocalBests[i] = locations[i]; } }
java
public static File getLastFile() { Preferences preferences = Preferences.userRoot().node(GuiBridgeHandler.PREFS_NODE_NAME); String userHome = System.getProperty("user.home"); String lastPath = preferences.get(LAST_PATH, userHome); File file = new File(lastPath); if (!file.exists...
java
public static void setLastPath( String lastPath ) { File file = new File(lastPath); if (!file.isDirectory()) { lastPath = file.getParentFile().getAbsolutePath(); } Preferences preferences = Preferences.userRoot().node(GuiBridgeHandler.PREFS_NODE_NAME); preferences.put...
java
public static void setPreference( String preferenceKey, String value ) { if (preferencesDb != null) { preferencesDb.setPreference(preferenceKey, value); return; } Preferences preferences = Preferences.userRoot().node(GuiBridgeHandler.PREFS_NODE_NAME); if (value !...
java
@SuppressWarnings({"unchecked", "rawtypes"}) public static String[] showMultiInputDialog( Component parentComponent, String title, String[] labels, String[] defaultValues, HashMap<String, String[]> fields2ValuesMap ) { Component[] valuesFields = new Component[labels.length]; JPanel panel...
java
public static void colorButton( JButton button, Color color, Integer size ) { if (size == null) size = 15; BufferedImage bi = new BufferedImage(size, size, BufferedImage.TYPE_INT_RGB); Graphics2D gr = (Graphics2D) bi.getGraphics(); gr.setColor(color); gr.fillRect(0, 0...
java
public static void setFileBrowsingOnWidgets( JTextField pathTextField, JButton browseButton, String[] allowedExtensions, Runnable postRunnable ) { FileFilter filter = null; if (allowedExtensions != null) { filter = new FileFilter(){ @Override publ...
java
public static void setFolderBrowsingOnWidgets( JTextField pathTextField, JButton browseButton ) { browseButton.addActionListener(e -> { File lastFile = GuiUtilities.getLastFile(); File[] res = showOpenFolderDialog(browseButton, "Select folder", false, lastFile); if (res != nu...
java
private static double[] calculateParameters( final double[][] elevationValues ) { int rows = elevationValues.length; int cols = elevationValues[0].length; int pointsNum = rows * cols; final double[][] xyMatrix = new double[pointsNum][6]; final double[] valueArray = new double[po...
java
public Object column(int col) throws jsqlite.Exception { switch (column_type(col)) { case Constants.SQLITE_INTEGER: return new Long(column_long(col)); case Constants.SQLITE_FLOAT: return new Double(column_double(col)); case Constants.SQLITE_BLOB: return column_bytes(col); case Constants.SQLITE3_TEXT...
java
protected void processGrid( int cols, int rows, boolean ignoreBorder, Calculator calculator ) throws Exception { ExecutionPlanner planner = createDefaultPlanner(); planner.setNumberOfTasks(rows * cols); int startC = 0; int startR = 0; int endC = cols; int endR = rows; ...
java
@Override public int compare( SimpleFeature f1, SimpleFeature f2 ) { int linkid1 = (Integer) f1.getAttribute(LINKID); int linkid2 = (Integer) f2.getAttribute(LINKID); if (linkid1 < linkid2) { return -1; } else if (linkid1 > linkid2) { return 1; } else...
java
public static Color colorFromRbgString( String rbgString ) { String[] split = rbgString.split(","); if (split.length < 3 || split.length > 4) { throw new IllegalArgumentException("Color string has to be of type r,g,b."); } int r = (int) Double.parseDouble(split[0].trim()); ...
java
public static Color fromHex( String hex ) { if (hex.startsWith("#")) { hex = hex.substring(1); } int length = hex.length(); int total = 6; if (length < total) { // we have a shortened version String token = hex; int tokenLength = to...
java
public int getFlowAt( Direction direction ) { switch( direction ) { case E: return eFlow; case W: return wFlow; case N: return nFlow; case S: return sFlow; case EN: return enFlow; case NW: ret...
java
public FlowNode goDownstream() { if (isValid) { Direction direction = Direction.forFlow(flow); if (direction != null) { FlowNode nextNode = new FlowNode(gridIter, cols, rows, col + direction.col, row + direction.row); if (nextNode.isValid) { ...
java