当前位置: 首页>>代码示例>>Java>>正文


Java CheckForSigned类代码示例

本文整理汇总了Java中javax.annotation.CheckForSigned的典型用法代码示例。如果您正苦于以下问题:Java CheckForSigned类的具体用法?Java CheckForSigned怎么用?Java CheckForSigned使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CheckForSigned类属于javax.annotation包,在下文中一共展示了CheckForSigned类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: _getReadIndex

import javax.annotation.CheckForSigned; //导入依赖的package包/类
/**
 * Find key position in the map.
 *
 * @param key
 *        Key to look for
 * @return Key position or -1 if not found
 */
@CheckForSigned
private int _getReadIndex (final int key)
{
  int idx = MapHelper.phiMix (key) & m_nMask;
  if (m_aKeys[idx] == key)
  {
    // we check FREE prior to this call
    return idx;
  }
  if (m_aKeys[idx] == FREE_KEY)
  {
    // end of chain already
    return -1;
  }
  final int startIdx = idx;
  while ((idx = _getNextIndex (idx)) != startIdx)
  {
    if (m_aKeys[idx] == FREE_KEY)
      return -1;
    if (m_aKeys[idx] == key)
      return idx;
  }
  return -1;
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:32,代码来源:IntDoubleMap.java

示例2: _getPutIndex

import javax.annotation.CheckForSigned; //导入依赖的package包/类
/**
 * Find an index of a cell which should be updated by 'put' operation. It can
 * be: 1) a cell with a given key 2) first free cell in the chain
 *
 * @param key
 *        Key to look for
 * @return Index of a cell to be updated by a 'put' operation
 */
@CheckForSigned
private int _getPutIndex (final int key)
{
  final int readIdx = _getReadIndex (key);
  if (readIdx >= 0)
    return readIdx;
  // key not found, find insertion point
  final int startIdx = MapHelper.phiMix (key) & m_nMask;
  if (m_aKeys[startIdx] == FREE_KEY)
    return startIdx;
  int idx = startIdx;
  while (m_aKeys[idx] != FREE_KEY)
  {
    idx = _getNextIndex (idx);
    if (idx == startIdx)
      return -1;
  }
  return idx;
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:28,代码来源:IntDoubleMap.java

示例3: getIndex

import javax.annotation.CheckForSigned; //导入依赖的package包/类
@CheckForSigned
public static int getIndex (@Nonnull final int [] aCodepointSet, final int nValue)
{
  int nStart = 0;
  int nEnd = aCodepointSet.length;
  while (nEnd - nStart > 8)
  {
    final int i = (nEnd + nStart) >>> 1;
    nStart = aCodepointSet[i] <= nValue ? i : nStart;
    nEnd = aCodepointSet[i] > nValue ? i : nEnd;
  }
  while (nStart < nEnd)
  {
    if (nValue < aCodepointSet[nStart])
      break;
    nStart++;
  }
  return nStart == nEnd ? -1 : nStart - 1;
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:20,代码来源:CodepointHelper.java

示例4: read

import javax.annotation.CheckForSigned; //导入依赖的package包/类
/**
 * Reads characters into a portion of an array.
 *
 * @param aBuf
 *        Destination buffer
 * @param nOfs
 *        Offset at which to start writing characters
 * @param nLen
 *        Maximum number of characters to read
 * @return The number of characters read, or -1 if the end of the stream has
 *         been reached
 * @exception IOException
 *            If an I/O error occurs
 */
@Override
@CheckForSigned
public int read (@Nonnull final char [] aBuf,
                 @Nonnegative final int nOfs,
                 @Nonnegative final int nLen) throws IOException
{
  _ensureOpen ();
  ValueEnforcer.isArrayOfsLen (aBuf, nOfs, nLen);

  if (nLen == 0)
    return 0;
  if (m_nNext >= m_nLength)
    return -1;
  final int nChars = Math.min (m_nLength - m_nNext, nLen);
  System.arraycopy (m_aChars, m_nNext, aBuf, nOfs, nChars);
  m_nNext += nChars;
  return nChars;
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:33,代码来源:NonBlockingStringReader.java

示例5: getIndex

import javax.annotation.CheckForSigned; //导入依赖的package包/类
@CheckForSigned
public int getIndex (final String uri, final String localName)
{
  for (int n = m_nLength; n-- > 0;)
    if (localName.equals (m_aLocalNames[n]) && uri.equals (m_aUris[n]))
      return n;
  return -1;
}
 
开发者ID:phax,项目名称:ph-stx,代码行数:9,代码来源:MutableAttributesImpl.java

示例6: _fromWire

import javax.annotation.CheckForSigned; //导入依赖的package包/类
@Override
protected void _fromWire(@Nonnull ByteBuf in, @CheckForSigned int length)
        throws MessageValidationException {
    super._fromWire(in, length);
    setConnectionId(in.readLong());
    int actionId = in.readInt();
    if (actionId != getActionId())
        throw new MessageValidationException("Packet contained bad ActionId: " + this);
    setTransactionId(in.readInt());
}
 
开发者ID:letroll,项目名称:TtorrentAndroid,代码行数:11,代码来源:UDPTrackerMessage.java

示例7: getPort

import javax.annotation.CheckForSigned; //导入依赖的package包/类
@CheckForSigned
public int getPort() {
    SocketAddress sa = getAddress();
    if (!(sa instanceof InetSocketAddress))
        return -1;
    InetSocketAddress isa = (InetSocketAddress) sa;
    return isa.getPort();
}
 
开发者ID:letroll,项目名称:TtorrentAndroid,代码行数:9,代码来源:Peer.java

示例8: readCharStart

import javax.annotation.CheckForSigned; //导入依赖的package包/类
@CheckForSigned
private int readCharStart() throws IOException {
    for (;;) {
        int c = reader.read();
        if (Character.isWhitespace(c))
            continue;
        return c;
    }
}
 
开发者ID:shevek,项目名称:lisp,代码行数:10,代码来源:LispParser.java

示例9: readCharNext

import javax.annotation.CheckForSigned; //导入依赖的package包/类
@CheckForSigned
private int readCharNext() throws IOException {
    for (;;) {
        int c = reader.read();
        if (Character.isWhitespace(c))
            return -1;
        if (c == '(' || c == ')' || c == '.') {
            reader.unread(c);
            return -1;
        }
        return c;
    }
}
 
开发者ID:shevek,项目名称:lisp,代码行数:14,代码来源:LispParser.java

示例10: getAverage

import javax.annotation.CheckForSigned; //导入依赖的package包/类
@CheckForSigned
public final long getAverage ()
{
  return m_aRWLock.readLocked ( () -> {
    if (m_nInvocationCount == 0)
      return CGlobal.ILLEGAL_ULONG;
    return m_aSum.divide (BigInteger.valueOf (m_nInvocationCount)).longValue ();
  });
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:10,代码来源:AbstractStatisticsHandlerNumeric.java

示例11: getInvocationCount

import javax.annotation.CheckForSigned; //导入依赖的package包/类
@CheckForSigned
public final int getInvocationCount (@Nullable final String sKey)
{
  return m_aRWLock.readLocked ( () -> {
    final Value aValue = m_aMap.get (sKey);
    return aValue == null ? CGlobal.ILLEGAL_UINT : aValue.getInvocationCount ();
  });
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:9,代码来源:AbstractStatisticsHandlerKeyedNumeric.java

示例12: getMin

import javax.annotation.CheckForSigned; //导入依赖的package包/类
@CheckForSigned
public final long getMin (@Nullable final String sKey)
{
  return m_aRWLock.readLocked ( () -> {
    final Value aValue = m_aMap.get (sKey);
    return aValue == null ? CGlobal.ILLEGAL_ULONG : aValue.getMin ();
  });
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:9,代码来源:AbstractStatisticsHandlerKeyedNumeric.java

示例13: getAverage

import javax.annotation.CheckForSigned; //导入依赖的package包/类
@CheckForSigned
public final long getAverage (@Nullable final String sKey)
{
  return m_aRWLock.readLocked ( () -> {
    final Value aValue = m_aMap.get (sKey);
    return aValue == null ? CGlobal.ILLEGAL_ULONG : aValue.getAverage ();
  });
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:9,代码来源:AbstractStatisticsHandlerKeyedNumeric.java

示例14: getMax

import javax.annotation.CheckForSigned; //导入依赖的package包/类
@CheckForSigned
public long getMax (@Nullable final String sKey)
{
  return m_aRWLock.readLocked ( () -> {
    final Value aValue = m_aMap.get (sKey);
    return aValue == null ? CGlobal.ILLEGAL_ULONG : aValue.getMax ();
  });
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:9,代码来源:AbstractStatisticsHandlerKeyedNumeric.java

示例15: getCount

import javax.annotation.CheckForSigned; //导入依赖的package包/类
@CheckForSigned
public long getCount (@Nullable final String sKey)
{
  return m_aRWLock.readLocked ( () -> {
    final Value aCount = m_aMap.get (sKey);
    return aCount == null ? CGlobal.ILLEGAL_ULONG : aCount.getCount ();
  });
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:9,代码来源:StatisticsHandlerKeyedCounter.java


注:本文中的javax.annotation.CheckForSigned类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。