Get the upstream node based on the max tca value.

@param tcaIter the tca map.
@param hacklengthIter the optional hacklength map, if available
it is used in cases with multiple equal in coming tcas.
@return the upstream node.
184981
public FlowNode getUpstreamTcaBased( RandomIter tcaIter, RandomIter hacklengthIter ) {
        Direction[] orderedDirs = Direction.getOrderedDirs();
        double maxTca = Double.NEGATIVE_INFINITY;
        double maxHacklength = Double.NEGATIVE_INFINITY;
        int maxCol = 0;
        int maxRow = 0;
        boolean gotOne = false;
        for( Direction direction : orderedDirs ) {
            int newCol = 0;
            int newRow = 0;
            switch( direction ) {
            case E:
                if (eFlow == Direction.E.getEnteringFlow()) {
                    newCol = col + direction.col;
                    newRow = row + direction.row;
                    gotOne = true;
                }
                break;
            case N:
                if (nFlow == Direction.N.getEnteringFlow()) {
                    newCol = col + direction.col;
                    newRow = row + direction.row;
                    gotOne = true;
                }
                break;
            case W:
                if (wFlow == Direction.W.getEnteringFlow()) {
                    newCol = col + direction.col;
                    newRow = row + direction.row;
                    gotOne = true;
                }
                break;
            case S:
                if (sFlow == Direction.S.getEnteringFlow()) {
                    newCol = col + direction.col;
                    newRow = row + direction.row;
                    gotOne = true;
                }
                break;
            case EN:
                if (enFlow == Direction.EN.getEnteringFlow()) {
                    newCol = col + direction.col;
                    newRow = row + direction.row;
                    gotOne = true;
                }
                break;
            case NW:
                if (nwFlow == Direction.NW.getEnteringFlow()) {
                    newCol = col + direction.col;
                    newRow = row + direction.row;
                    gotOne = true;
                }
                break;
            case WS:
                if (wsFlow == Direction.WS.getEnteringFlow()) {
                    newCol = col + direction.col;
                    newRow = row + direction.row;
                    gotOne = true;
                }
                break;
            case SE:
                if (seFlow == Direction.SE.getEnteringFlow()) {
                    newCol = col + direction.col;
                    newRow = row + direction.row;
                    gotOne = true;
                }
                break;
            default:
                throw new IllegalArgumentException();
            }
            if (isInRaster(newCol, newRow)) {
                int flowValue = gridIter.getSample(newCol, newRow, 0);
                if (HMConstants.isNovalue(flowValue)) {
                    continue;
                }
                int tcaValue = tcaIter.getSample(newCol, newRow, 0);
                double hacklengthValue = 0.0;
                if (hacklengthIter != null)
                    hacklengthValue = tcaIter.getSampleDouble(newCol, newRow, 0);
                if (NumericsUtilities.dEq(tcaValue, maxTca) && hacklengthIter != null) {
                    /*
                     * if there are two equal tca values around
                     * and info about hacklength is available, 
                     * use that one to choose
                     */
                    if (hacklengthValue > maxHacklength) {
                        // this has larger hacklength, use this one as max tca
                        maxTca = tcaValue;
                        maxCol = newCol;
                        maxRow = newRow;
                        maxHacklength = hacklengthValue;
                    }
                } else if (tcaValue > maxTca) {
                    maxTca = tcaValue;
                    maxCol = newCol;
                    maxRow = newRow;
                    maxHacklength = hacklengthValue;
                }
            }
        }
        if (!gotOne) {
            return null;
        }
        FlowNode node = new FlowNode(gridIter, cols, rows, maxCol, maxRow);
        return node;
    }
632828
public DTMAxisIterator cloneIterator()
  {

    try
    {
      final DTMAxisIteratorBase clone = (DTMAxisIteratorBase) super.clone();

      clone._isRestartable = false;

      // return clone.reset();
      return clone;
    }
    catch (CloneNotSupportedException e)
    {
      throw new org.apache.xml.utils.WrappedRuntimeException(e);
    }
  }
491212
protected Iterator<RepositoryLogRecord> getNewIterator(int offset, int length) {
		OnePidRecordListImpl logResult = getLogResult();
		OnePidRecordListImpl traceResult = getTraceResult();
		if (logResult == null && traceResult == null) {
			return EMPTY_ITERATOR;
		} else if (traceResult == null) {
			return logResult.getNewIterator(offset, length);
		} else if (logResult == null) {
			return traceResult.getNewIterator(offset, length);
		} else {
			MergedServerInstanceLogRecordIterator result = new MergedServerInstanceLogRecordIterator(logResult, traceResult);
			result.setRange(offset, length);
			return result;
		}
	}
1219865
private Method getAccessorMethod(TypeToken<?> type) {
    Class<?> rawType = type.getRawType();
    if (rawType.isPrimitive()) {
      return getMethod(rawType,
                       String.format("get%c%s",
                                     Character.toUpperCase(rawType.getName().charAt(0)),
                                     rawType.getName().substring(1)),
                       Object.class);
    } else {
      return getMethod(Object.class, "get", Object.class);
    }
  }
153285
public TreeRange get(Token t)
    {
        return getHelper(root, fullRange.left, fullRange.right, (byte)0, t);
    }
1327386
public static Ticker adaptTicker(CryptonitTicker cryptonitTicker, CurrencyPair currencyPair) {

    BigDecimal open = cryptonitTicker.getOpen();
    BigDecimal last = cryptonitTicker.getLast();
    BigDecimal bid = cryptonitTicker.getBid();
    BigDecimal ask = cryptonitTicker.getAsk();
    BigDecimal high = cryptonitTicker.getHigh();
    BigDecimal low = cryptonitTicker.getLow();
    BigDecimal vwap = cryptonitTicker.getVwap();
    BigDecimal volume = cryptonitTicker.getVolume();
    Date timestamp = new Date(cryptonitTicker.getTimestamp() * 1000L);

    return new Ticker.Builder()
        .currencyPair(currencyPair)
        .open(open)
        .last(last)
        .bid(bid)
        .ask(ask)
        .high(high)
        .low(low)
        .vwap(vwap)
        .volume(volume)
        .timestamp(timestamp)
        .build();
  }
168957
public HashMap<String, String> getAccessTokenSet(String verifier) {
		try {
            mOAuthProvider.retrieveAccessToken(mOAuthConsumer, verifier);
        }
        catch (OAuthException e) {
            e.printStackTrace();
        }
		
		return setTokenWithSecret(mOAuthConsumer.getToken(), mOAuthConsumer.getTokenSecret()); 
	}
1278840
public static Ticker adaptTicker(CexIOTicker ticker) {
    if (ticker.getPair() == null) {
      throw new IllegalArgumentException("Missing currency pair in ticker: " + ticker);
    }
    return adaptTicker(ticker, adaptCurrencyPair(ticker.getPair()));
  }
1340860
public SIMPIterator getPubSubOutboundTransmitIterator()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "getPubSubOutboundTransmitIterator");
    
    //at the moment there should be just one stream set in the manager:
    //therefore this method is misleading. For the moment it will remain
    //deprecated.
    
    SIMPIterator iterator = null;
    //there are only outbound transmitters if the PSOH is not null
    if(_outputHandler!=null)
    {
      InternalOutputStreamManager streamManager = _outputHandler.getInternalOutputStreamManager();
      iterator =
        new BasicSIMPIterator(streamManager.getStreamSetControlIterator(this)); 
    }

    if(iterator==null)
    {
      //return an empty iterator
      iterator =
              new BasicSIMPIterator(new ArrayList().iterator()); 
    }
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "getPubSubOutboundTransmitIterator", iterator);
    return iterator;
  }
1150647
def get_angle_addr(value):
    
    angle_addr = AngleAddr()
    if value[0] in CFWS_LEADER:
        token, value = get_cfws(value)
        angle_addr.append(token)
    if not value or value[0] != '<':
        raise errors.HeaderParseError(
            "expected angle-addr but found '{}'".format(value))
    angle_addr.append(ValueTerminal('<', 'angle-addr-start'))
    value = value[1:]
    # Although it is not legal per RFC5322, SMTP uses '<>' in certain
    # circumstances.
    if value[0] == '>':
        angle_addr.append(ValueTerminal('>', 'angle-addr-end'))
        angle_addr.defects.append(errors.InvalidHeaderDefect(
            "null addr-spec in angle-addr"))
        value = value[1:]
        return angle_addr, value
    try:
        token, value = get_addr_spec(value)
    except errors.HeaderParseError:
        try:
            token, value = get_obs_route(value)
            angle_addr.defects.append(errors.ObsoleteHeaderDefect(
                "obsolete route specification in angle-addr"))
        except errors.HeaderParseError:
            raise errors.HeaderParseError(
                "expected addr-spec or obs-route but found '{}'".format(value))
        angle_addr.append(token)
        token, value = get_addr_spec(value)
    angle_addr.append(token)
    if value and value[0] == '>':
        value = value[1:]
    else:
        angle_addr.defects.append(errors.InvalidHeaderDefect(
            "missing trailing '>' on angle-addr"))
    angle_addr.append(ValueTerminal('>', 'angle-addr-end'))
    if value and value[0] in CFWS_LEADER:
        token, value = get_cfws(value)
        angle_addr.append(token)
    return angle_addr, value
774991
function getQualifier(oAnnotationNode) {
	return oAnnotationNode.getAttribute("Qualifier")
		|| oAnnotationNode.parentNode.nodeName === "Annotations"
			&& oAnnotationNode.parentNode.getAttribute("Qualifier");
}
838999
public static Validator getExperimentalValidator() {
        return CascadingValidator.create(
                ParenthesesValidator.INSTANCE,
                ConfigurableValidator.create(ValidatorConfiguration.createExperimental()));
    }
221432
function getOrCreateNodeInjectorForNode(node) {
    var nodeInjector = node.nodeInjector;
    var parent = getParentLNode(node);
    var parentInjector = parent && parent.nodeInjector;
    if (nodeInjector != parentInjector) {
        return nodeInjector;
    }
    return node.nodeInjector = {
        parent: parentInjector,
        node: node,
        bf0: 0,
        bf1: 0,
        bf2: 0,
        bf3: 0,
        bf4: 0,
        bf5: 0,
        bf6: 0,
        bf7: 0,
        cbf0: parentInjector == null ? 0 : parentInjector.cbf0 | parentInjector.bf0,
        cbf1: parentInjector == null ? 0 : parentInjector.cbf1 | parentInjector.bf1,
        cbf2: parentInjector == null ? 0 : parentInjector.cbf2 | parentInjector.bf2,
        cbf3: parentInjector == null ? 0 : parentInjector.cbf3 | parentInjector.bf3,
        cbf4: parentInjector == null ? 0 : parentInjector.cbf4 | parentInjector.bf4,
        cbf5: parentInjector == null ? 0 : parentInjector.cbf5 | parentInjector.bf5,
        cbf6: parentInjector == null ? 0 : parentInjector.cbf6 | parentInjector.bf6,
        cbf7: parentInjector == null ? 0 : parentInjector.cbf7 | parentInjector.bf7,
        templateRef: null,
        viewContainerRef: null,
        elementRef: null,
        changeDetectorRef: null,
    };
}
939424
private void getNextToken(StreamTokenizer tokenizer) throws IOException, ParseException {
        if (tokenizer.nextToken() == StreamTokenizer.TT_EOL) {
            throw new ParseException("premature end of line", tokenizer.lineno());
        }
        if (tokenizer.ttype == StreamTokenizer.TT_EOF) {
            throw new ParseException(PREMATURE_END_OF_FILE, tokenizer.lineno());
        } else if ((tokenizer.ttype == '\'') || (tokenizer.ttype == '"')) {
            tokenizer.ttype = StreamTokenizer.TT_WORD;
        } else if ((tokenizer.ttype == StreamTokenizer.TT_WORD) && (tokenizer.sval.equals("?"))) {
            tokenizer.ttype = '?';
        }
    }
491988
public IHillSlope getUpstreamElementAtPfafstetter( PfafstetterNumber pNum ) {
        // am I the one
        if (pfafstetterNumber.compareTo(pNum) == 0) {
            return this;
        }
        // // perhaps my upstream elements
        // for( UpstreamElement upstreamElement : upstreamElements ) {
        // if (upstreamElement.getPfafstetterNumber().compare(
        // upstreamElement.getPfafstetterNumber(), pNum) == 0) {
        // return upstreamElement;
        // }
        // }
        // digg further
        IHillSlope theChosen = null;
        for( IHillSlope upstreamElement : upstreamElements ) {
            theChosen = upstreamElement.getUpstreamElementAtPfafstetter(pNum);
            if (theChosen != null) {
                break;
            }
        }
        return theChosen;
    }
359862
@Override
    public StructValidator getSimpleValidator()
    {
        /* Can we create a simple validator? Yes, if the sub-specs are
         * all simple (leaves == element tokens with no arity modifier)
         */
        ContentSpec[] specs = mContentSpecs;
        int i = 0;
        int len = specs.length;

        for (; i < len; ++i) {
            if (!specs[i].isLeaf()) {
                break;
            }
        }

        if (i == len) { // all leaves, kewl
            PrefixedName[] set = new PrefixedName[len];
            for (i = 0; i < len; ++i) {
                TokenContentSpec ss = (TokenContentSpec) specs[i];
                set[i] = ss.getName();
            }
            return new Validator(mArity, set);
        }

        // Nope, need a DFA:
        return null;
    }
870192
def get_upstream(self, type_):
        '''
        '''

        if isinstance(self, type_):
            return self
        elif self.upstream and isinstance(self.upstream, type_):
            return self.upstream
        elif self.upstream:
            return self.upstream.get_upstream(type_)
        else:
            return None