final static int MAX_CHAIN_HITS = 8192; // Should be less than WINDOW_SIZE
173875
static void greedy(Cookie cookie, LongestMatchCache lmc, byte[] input, int from, int to, LzStore store) {
        Hash h = cookie.h;
        h.init(input, Math.max(from - 0x8000, 0), from, to);
        int prevLength = 0;
        int prevMatch = 0;
        char[] dummySubLen = cookie.c259a;
        boolean matchAvailable = false;

        for (int i = from; i < to; i++) {
            h.updateHash(input, i, to);
            findLongestMatch(cookie, lmc, from, h, input, i, to, 258, dummySubLen);
            int len = cookie.lenVal;
            int dist = cookie.distVal;
            int lengthScore = dist > 1024 ? len - 1 : len;
            int prevLengthScore = prevMatch > 1024 ? prevLength - 1 : prevLength;

            if (matchAvailable) {
                matchAvailable = false;
                if (lengthScore > prevLengthScore + 1) {
                    store.append((char) (input[i - 1] & 0xFF), (char) 0);
                    if (lengthScore >= 3 && len < 258) {
                        matchAvailable = true;
                        prevLength = len;
                        prevMatch = dist;
                        continue;
                    }
                } else {
                    store.append((char) prevLength, (char) prevMatch);
                    for (int j = 2; j < prevLength; j++) {
                        i++;
                        h.updateHash(input, i, to);
                    }
                    continue;
                }
            } else if (lengthScore >= 3 && len < 258) {
                matchAvailable = true;
                prevLength = len;
                prevMatch = dist;
                continue;
            }

            if (lengthScore >= 3) {
                store.append((char) len, (char) dist);
            } else {
                len = 1;
                store.append((char) (input[i] & 0xFF), (char) 0);
            }
            for (int j = 1; j < len; j++) {
                i++;
                h.updateHash(input, i, to);
            }
        }
    }
1247232
private int getMinErrorRateWindowSize() {

		int numSamples = this.stm.numInstances();
		if (numSamples < 2 * this.minSTMSizeOption.getValue()) {
			return numSamples;
		} else {
			List<Integer> numSamplesRange = new ArrayList<>();
			numSamplesRange.add(numSamples);
			while (numSamplesRange.get(numSamplesRange.size() - 1) >= 2 * this.minSTMSizeOption.getValue())
				numSamplesRange.add(numSamplesRange.get(numSamplesRange.size() - 1) / 2);

			Iterator it = this.predictionHistories.keySet().iterator();
			while (it.hasNext()) {
				Integer key = (Integer) it.next();
				if (!numSamplesRange.contains(numSamples - key)) {
					it.remove();
				}
			}
			List<Double> errorRates = new ArrayList<>();
			for (Integer numSamplesIt : numSamplesRange) {
				int idx = numSamples - numSamplesIt;
				List<Integer> predHistory;
				if (this.predictionHistories.containsKey(idx)) {
					predHistory = this.getIncrementalTestTrainPredHistory(this.stm, idx, this.predictionHistories.get(idx));
				} else {
					predHistory = this.getTestTrainPredHistory(this.stm, idx);
				}
				this.predictionHistories.put(idx, predHistory);
				errorRates.add(this.getHistoryErrorRate(predHistory));
			}
			int minErrorRateIdx = errorRates.indexOf(Collections.min(errorRates));
			int windowSize = numSamplesRange.get(minErrorRateIdx);
			if (windowSize < numSamples) {
				this.adaptHistories(minErrorRateIdx);
			}
			return windowSize;
		}
	}
178284
@CheckResult @Override public boolean shareTraces(String fullTraces) {
    try {
      shareTracesInternal(fullTraces);
      return true;
    } catch (RuntimeException exception1) { // Likely cause is a TransactionTooLargeException on API levels 15+.
      try {
        /*
         * Limit trace size to between 100kB and 400kB, since Unicode characters can be 1-4 bytes each.
         */
        int fullTracesLength = fullTraces.length();
        String truncatedTraces = fullTraces.substring(Math.max(0, fullTracesLength - 100000), fullTracesLength);
        shareTracesInternal(truncatedTraces);
        return true;
      } catch (RuntimeException exception2) { // Likely cause is a TransactionTooLargeException on API levels 15+.
        return false;
      }
    }
  }
456193
@Override
  public void visitMaxs(int maxStack, int maxLocals) {
    if (localScopes != null) {
      for (VariableScope scope : localScopes) {
        super.visitLocalVariable(
            "xxxxx$" + scope.index, scope.desc, null, scope.start, scope.end, scope.index);
      }
    }
    super.visitMaxs(maxStack, maxLocals);
  }
573089
@SuppressWarnings("unused")
	public static int[] cs_maxtrans(DZcs A, int seed)		/*[jmatch [0..m-1]; imatch [0..n-1]]*/
	{
		int i, j, k, n, m, p, n2 = 0, m2 = 0, Ap[], jimatch[], w[], cheap[], js[], is[],
			ps[], Ai[], Cp[], jmatch[], imatch[], q[] ;
		DZcs C ;
		if (!CS_CSC(A)) return (null) ;				/* check inputs */
		n = A.n ; m = A.m ; Ap = A.p ; Ai = A.i ;
		w = jimatch = new int [m+n] ;				/* allocate result */
		if (jimatch == null) return (null) ;
		for (k = 0, j = 0 ; j < n ; j++)			/* count nonempty rows and columns */
		{
			if (Ap [j] < Ap [j+1]) n2++ ;
			for (p = Ap [j] ; p < Ap [j+1] ; p++)
			{
				w [Ai [p]] = 1 ;
				if (j == Ai [p]) k++ ;			/* count entries already on diagonal */
			}
		}
		if (k == Math.min(m, n))				/* quick return if diagonal zero-free */
		{
			jmatch = jimatch ;
			imatch = jimatch ;
			int imatch_offset = m ;
			for (i = 0 ; i < k ; i++) jmatch [i] = i ;
			for (      ; i < m ; i++) jmatch [i] = -1 ;
			for (j = 0 ; j < k ; j++) imatch [imatch_offset + j] = j ;
			for (      ; j < n ; j++) imatch [imatch_offset + j] = -1 ;
			return (cs_idone (jimatch, null, null, true)) ;
		}
		for (i = 0 ; i < m ; i++) m2 += w [i] ;
		C = (m2 < n2) ? cs_transpose(A, false) : A;		/* transpose if needed */
		if (C == null) return (cs_idone (jimatch, (m2 < n2) ? C : null, null, false)) ;
		n = C.n ; m = C.m ; Cp = C.p ;
		jmatch = jimatch ;
		imatch = jimatch ;
		int jmatch_offset = 0 ;
		int imatch_offset = 0 ;
		if (m2 < n2)
		{
			jmatch_offset = n ;
		}
		else
		{
			imatch_offset = m ;
		}
		w = new int [5*n] ;					/* get workspace */
		if (w == null) return (cs_idone (jimatch, (m2 < n2) ? C : null, w, false)) ;
		cheap = w ;
		int cheap_offset = n ;
		js = w ;
		int js_offset = 2*n ;
		is = w ;
		int is_offset = 3*n ;
		ps = w ;
		int ps_offset = 4*n ;
		for (j = 0 ; j < n ; j++) cheap [cheap_offset + j] = Cp [j] ;	/* for cheap assignment */
		for (j = 0 ; j < n ; j++) w [j] = -1 ;				/* all columns unflagged */
		for (i = 0 ; i < m ; i++) jmatch [jmatch_offset + i] = -1 ;	/* nothing matched yet */
		q = cs_randperm (n, seed) ;					/* q = random permutation */
		for (k = 0 ; k < n ; k++)				/* augment, starting at column q[k] */
		{
			cs_augment(q != null ? q[k] : k, C, jmatch, jmatch_offset, cheap, cheap_offset, w, 0,
				js, js_offset, is, is_offset, ps, ps_offset) ;
		}
		q = null ;
		for (j = 0 ; j < n ; j++) imatch [imatch_offset + j] = -1 ;	/* find row match */
		for (i = 0 ; i < m ; i++)
			if (jmatch[jmatch_offset + i] >= 0)
				imatch [imatch_offset + jmatch [jmatch_offset + i]] = i ;
		return (cs_idone (jimatch, (m2 < n2) ? C : null, w, true)) ;
	}
623110
@Override
    public ScanResult scan(int maxDist) {
	int penalty = Timing.getInstance().SCAN_BASE + Timing.getInstance().SCAN_PER_DIST * (maxDist - 1);
	log.trace("[scan] Waiting {} cycles to scan {} fields", penalty, maxDist);
	turnsControl.waitTurns(penalty, "Scan");

	return robot.scan(maxDist);
    }
1187272
int refreshAndGetMax() {
		int max = 0;

		for (InputChannel channel : inputGate.getInputChannels().values()) {
			if (channel instanceof RemoteInputChannel) {
				RemoteInputChannel rc = (RemoteInputChannel) channel;

				int size = rc.unsynchronizedGetNumberOfQueuedBuffers();
				max = Math.max(max, size);
			}
		}

		return max;
	}
783883
public PactDslJsonArray maxArrayLike(Integer size, PactDslJsonRootValue value, int numberExamples) {
    if (numberExamples > size) {
      throw new IllegalArgumentException(String.format("Number of example %d is more than the maximum size of %d",
        numberExamples, size));
    }
    matchers.addRule(rootPath + appendArrayIndex(1), matchMax(size));
    PactDslJsonArray parent = new PactDslJsonArray(rootPath, "", this, true);
    parent.setNumberExamples(numberExamples);
    parent.putObject(value);
    return (PactDslJsonArray) parent.closeArray();
  }
740211
int refreshAndGetMax() {
		int max = 0;

		for (ResultSubpartition part : partition.getAllPartitions()) {
			int size = part.unsynchronizedGetNumberOfQueuedBuffers();
			max = Math.max(max, size);
		}

		return max;
	}
156875
def _get_max_name_len(instances):
    """"""
    # FIXME: ec2.instanceCollection doesn't have __len__
    for i in instances:
        return max([len(get_tag_value(i.tags, 'Name')) for i in instances])
    return 0
237327
function SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0)
	{
		if ($secs2cache > 0) {// we do not cache rowcount, so we have to load entire recordset
			$rs = ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache);
			return $rs;
		}

		$nrows = (integer) $nrows;
		$offset = (integer) $offset;

		$cnt = ($nrows >= 0) ? $nrows : 999999999;
		if ($offset > 0 && $cnt) $cnt += $offset;

		$this->Execute("set rowcount $cnt");
		$rs = ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,0);
		$this->Execute("set rowcount 0");

		return $rs;
	}
1116579
private long findMaxTransaction()
      throws IOException {
    for (EditLogFile elf : getLogFiles(0)) {
      if (elf.isInProgress()) {
        maxSeenTransaction = Math.max(elf.getFirstTxId(), maxSeenTransaction);
      }
      maxSeenTransaction = Math.max(elf.getLastTxId(), maxSeenTransaction);
    }
    return maxSeenTransaction;
  }
659273
function TransactionBuilder (network, maximumFeeRate) {
  this.prevTxMap = {}
  this.network = network || networks.bitcoin

  // WARNING: This is __NOT__ to be relied on, its just another potential safety mechanism (safety in-depth)
  this.maximumFeeRate = maximumFeeRate || 2500

  this.inputs = []
  this.tx = new Transaction(this.network)
}
866847
@Override
	public int getMaximumNumberOfSubtasks() {
		if (!(this.format instanceof FileOutputFormat<?>)) {
			return -1;
		}
		
		final FileOutputFormat<?> fileOutputFormat = (FileOutputFormat<?>) this.format;
		
		// ----------------- This code applies only to file inputs ------------------
		
		final Path path = fileOutputFormat.getOutputFilePath();
		final WriteMode writeMode = fileOutputFormat.getWriteMode();
		final OutputDirectoryMode outDirMode = fileOutputFormat.getOutputDirectoryMode();

		// Prepare output path and determine max DOP		
		try {
			
			int dop = getTaskConfiguration().getInteger(DEGREE_OF_PARALLELISM_KEY, -1);
			final FileSystem fs = path.getFileSystem();
			
			if(dop == 1 && outDirMode == OutputDirectoryMode.PARONLY) {
				// output is not written in parallel and should be written to a single file.
				
				if(fs.isDistributedFS()) {
					// prepare distributed output path
					if(!fs.initOutPathDistFS(path, writeMode, false)) {
						// output preparation failed! Cancel task.
						throw new IOException("Output path could not be initialized.");
					}
				}
				
				return 1;
				
			} else {
				// output should be written to a directory
				
				if(fs.isDistributedFS()) {
					// only distributed file systems can be initialized at start-up time.
					if(!fs.initOutPathDistFS(path, writeMode, true)) {
						throw new IOException("Output directory could not be created.");
					}
				}
				
				return -1;
				
			}
		}
		catch (IOException e) {
			LOG.error("Could not access the file system to detemine the status of the output.", e);
			throw new RuntimeException("I/O Error while accessing file", e);
		}
	}
651656
public void setMaximumBatchUpdateSize(int size) {
    if (!batchUpdateSupport) {
      throw new InvalidOperationException("Batch updates not allowed by database driver.");
    }
    if (! isEnabled(DB.Option.BATCH_UPDATES)) {
      throw new InvalidOperationException(DB.Option.BATCH_UPDATES + " option is not enabled.");
    }
    if (size < 1) {
      throw new InvalidOperationException("Invalid batch update size: " + size);
    }
    maxBatchUpdateSize = size;
  }
104207
private int rangeLimit(int size, int min, int max) {
        if (size < min) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Config: " + size + " too small");
            }
            return min;
        } else if (size > max) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Config: " + size + " too large");
            }
            return max;
        }
        return size;
    }
565086
private int findRunLimit(int index, int limit, byte[] validSet) {
        --index;
        loop:
            while (++index < limit) {
                byte t = resultTypes[index];
                for (int i = 0; i < validSet.length; ++i) {
                    if (t == validSet[i]) {
                        continue loop;
                    }
                }
                // didn't find a match in validSet
                return index;
            }
            return limit;
    }