找出一个最小的position位置
765218
private LogPosition min(LogPosition position1, LogPosition position2) {
        if (position1.getIdentity().equals(position2.getIdentity())) {
            // 首先根据文件进行比较
            if (position1.getPostion().getJournalName().compareTo(position2.getPostion().getJournalName()) < 0) {
                return position2;
            } else if (position1.getPostion().getJournalName().compareTo(position2.getPostion().getJournalName()) > 0) {
                return position1;
            } else {
                // 根据offest进行比较
                if (position1.getPostion().getPosition() < position2.getPostion().getPosition()) {
                    return position2;
                } else {
                    return position1;
                }
            }
        } else {
            // 不同的主备库，根据时间进行比较
            if (position1.getPostion().getTimestamp() < position2.getPostion().getTimestamp()) {
                return position2;
            } else {
                return position1;
            }
        }
    }
1306853
private int skipWhitespace(final int position) {
		int index = sql.length();
		for (int i = position; i < index; ++i) {
			char c = sql.charAt(i);
			if (!Character.isWhitespace(c)) {
				return i;
			}
		}
		return index;
	}
167679
public static int getPosition(Term subTerm, Term term) {
		int startingIndex = -1;
		int j = 0;
		for(int i=0; i<term.getWords().size(); i++) {
			if(term.getWords().get(i).equals(subTerm.getWords().get(j))) {
				j++;
				if(startingIndex == -1) 
					startingIndex = i;
			} else {
				startingIndex = -1;
				j = 0;
			}
			if(j == subTerm.getWords().size())
				return startingIndex;
		}
		return -1;
	}
572206
def lower
      position? ?
          siblings.where(klass.arel_table[klass.ordered_tree.columns.position].gteq(position)) :
          siblings
    end
727496
private void computeFullStartPositionMinimum(int position)
      throws IOException {
    if (ignoreSpans != null && !minFullStartPosition.containsKey(position)) {
      HashSet<Integer> list = baseStartPositionList.get(position);
      HashSet<Integer> newList = new HashSet<>();
      int minimumStartPosition = position;
      while (list != null && !list.isEmpty()) {
        newList.clear();
        for (int startPosition : list) {
          if (minFullStartPosition.containsKey(startPosition)) {
            minimumStartPosition = Math.min(minimumStartPosition,
                minFullStartPosition.get(startPosition));
          } else if (baseStartPositionList.containsKey(startPosition)) {
            newList.addAll(baseStartPositionList.get(startPosition));
          } else {
            if (startPosition < minimumStartPosition) {
              minimumStartPosition = startPosition;
            }
          }
        }
        list.clear();
        list.addAll(newList);
      }
      minFullStartPosition.put(position, minimumStartPosition);
    }
  }
333263
def position(self, x, y, text):
        
        sys.stdout.write("\x1b7\x1b[%d;%df%s\x1b8" % (x, y, text))
        sys.stdout.flush()
341228
function minValueNode(root) {
  var current = root;
  while (current.left) {
    current = current.left;
  }
  return current;
}
619114
static function ltrim_position($content, $position, $br = true)
    {
        $blanks = array("\t", "\0", "\x0B", " ");

        if ($br) {
            $blanks[] = "\r";
            $blanks[] = "\n";
        }

        while (isset($content[$position]) && isset($content[$position + 1])
            && in_array($content[$position], $blanks, true)
        ) {
            $position++;
        }

        return $position;
    }
553673
private long getCurrentPosition() {
        long pos;
        if (!useLoadBuf) {
            return in.position();
        }
        try {
            if (in != null) {
                pos = (channel.position() - in.remaining());
            } else {
                pos = channel.position();
            }
            return pos;
        } catch (Exception e) {
            log.error("Error getCurrentPosition", e);
            return 0;
        }
    }
1178076
private function position($pos, $oldWidth, $oldHeight, $waterWidth, $waterHeight, $isText = false, $fontSize = 14)
    {
        if ( is_array($pos) )
        {
            return [
                'x' => $pos[0],
                'y' => $pos[1]
            ];
        }

        if ($pos === self::POS_TOP_LEFT)
        {
            $posX = 0;
            $posY = ($isText) ? $waterHeight : 0;
        }
        elseif ($pos === self::POS_TOP_CENTER)
        {
            $posX = ($oldWidth - $waterWidth) / 2;
            $posY = ($isText) ? $waterHeight : 0;
        }
        elseif ($pos === self::POS_TOP_RIGHT)
        {
            $posX = $oldWidth - $waterWidth;
            $posY = ($isText) ? $waterHeight : 0;
        }
        elseif ($pos === self::POS_CENTER_LEFT)
        {
            $posX = 0;
            $posY = ($isText) ? (($oldHeight - $waterHeight) / 2) + $fontSize : ($oldHeight - $waterHeight) / 2;
        }
        elseif ($pos === self::POS_CENTER_CENTER)
        {
            $posX = ($oldWidth - $waterWidth) / 2;
            $posY = ($isText) ? (($oldHeight - $waterHeight) / 2) + $fontSize : ($oldHeight - $waterHeight) / 2;
        }
        elseif ($pos === self::POS_CENTER_RIGHT)
        {
            $posX = $oldWidth - $waterWidth;
            $posY = ($isText) ? (($oldHeight - $waterHeight) / 2) + $fontSize : ($oldHeight - $waterHeight) / 2;
        }
        elseif ($pos === self::POS_BOTTOM_LEFT)
        {
            $posX = 0;
            $posY = ($isText) ? ($oldHeight - $waterHeight) + $fontSize : $oldHeight - $waterHeight;
        }
        elseif ($pos === self::POS_BOTTOM_CENTER)
        {
            $posX = ($oldWidth - $waterWidth) / 2;
            $posY = ($isText) ? ($oldHeight - $waterHeight) + $fontSize : $oldHeight - $waterHeight;
        }
        elseif ($pos === self::POS_BOTTOM_RIGHT)
        {
            $posX = $oldWidth - $waterWidth;
            $posY = ($isText) ? ($oldHeight - $waterHeight) + $fontSize : $oldHeight - $waterHeight;
        }
        else
        {
            $posX = rand(0, ($oldWidth  - $waterWidth));
            $posY = rand(0, ($oldHeight - $waterHeight));
        }

        return [
            "x" => $posX,
            "y" => $posY
        ];
    }
534837
def close_positions_order(self):
        

        order_list = []
        time = '{} 15:00:00'.format(self.date)
        if self.running_environment == RUNNING_ENVIRONMENT.TZERO:
            for code, amount in self.hold_available.iteritems():
                order = False
                if amount < 0:
                    # 先卖出的单子 买平
                    order = self.send_order(
                        code=code,
                        price=0,
                        amount=abs(amount),
                        time=time,
                        towards=ORDER_DIRECTION.BUY,
                        order_model=ORDER_MODEL.CLOSE,
                        amount_model=AMOUNT_MODEL.BY_AMOUNT,
                    )
                elif amount > 0:
                    # 先买入的单子, 卖平
                    order = self.send_order(
                        code=code,
                        price=0,
                        amount=abs(amount),
                        time=time,
                        towards=ORDER_DIRECTION.SELL,
                        order_model=ORDER_MODEL.CLOSE,
                        amount_model=AMOUNT_MODEL.BY_AMOUNT
                    )
                if order:
                    order_list.append(order)
            return order_list
        else:
            raise RuntimeError(
                'QAACCOUNT with {} environments cannot use this methods'.format(
                    self.running_environment
                )
            )
1349741
def position(self):
        """"""
        now_playing = self._setstate.nowPlayingInfo
        if now_playing.HasField('elapsedTime'):
            return int(now_playing.elapsedTime)

        return None
532708
function short(nodes, context, recur, wrap) {
    context.write(WRAPPERS[wrap].left);
    context.indentIn();
    context.write('\n');

    for (var i = 0; i < nodes.length; i++) {
        context.write(context.getIndent());
        recur(nodes[i]);

        if (nodes[i + 1]) {
            context.write(',\n');}}



    context.indentOut();
    context.write('\n', context.getIndent(), WRAPPERS[wrap].right);}
1134203
def positionIf(pred, seq):
    
    for i,e in enumerate(seq):
        if pred(e):
            return i
    return -1
627257
def positions(self, reverse=False):
        """"""
        def Posgen(reverse):
            if reverse:
                lastrootsib = self.last_sibling_position(self.root)
                current = self.last_decendant(lastrootsib)
                while current is not None:
                    yield current
                    current = self.prev_position(current)
            else:
                current = self.root
                while current is not None:
                    yield current
                    current = self.next_position(current)
        return Posgen(reverse)
4460
public int getMinStartPosition(int docId, int position) throws IOException {
    if (ignoreSpans != null && docId == currentDocId) {
      if (position < minimumPosition) {
        throw new IOException(
            "Unexpected position, should be >= " + minimumPosition + "!");
      } else {
        computeFullStartPositionMinimum(position);
        if (minFullStartPosition.containsKey(position)) {
          return minFullStartPosition.get(position);
        } else {
          return 0;
        }
      }
    } else {
      return 0;
    }
  }
283201
def word(self, position):
        '''
        
        '''
        if 0 <= position < len(self.wordlist):
            return self.wordlist[position]
        else:
            log.warn('position "{}" is not in sentence of length "{}"!'.format(position, len(self.wordlist)))
            raise IndexError()