Matches the original getVerticalDropLocation(Element, int, int, double) method.<p>
540200
private static VerticalDropLocation internalGetVerticalDropLocation(Element element,
        int offsetHeight, int clientY, double topBottomRatio) {

        // Event coordinates are relative to the viewport, element absolute
        // position is relative to the document. Make element position relative
        // to viewport by adjusting for viewport scrolling. See #6021
        int elementTop = element.getAbsoluteTop() - Window.getScrollTop();
        int fromTop = clientY - elementTop;

        float percentageFromTop = (fromTop / (float) offsetHeight);
        if (percentageFromTop < topBottomRatio) {
            return VerticalDropLocation.TOP;
        } else if (percentageFromTop > 1 - topBottomRatio) {
            return VerticalDropLocation.BOTTOM;
        } else {
            return VerticalDropLocation.MIDDLE;
        }
    }
704050
public String getOrElse(int i, String def)
    {
        if (i >= 0 && i < values.size())
        {
            return values.get(i);
        }
        return def;
    }
1016065
public Integer getPosition(String parameterName) {
        Integer position = null;

        for (int i = 0; i < this.sqlParameterNames.size(); i++) {
            if (this.sqlParameterNames.get(i).equals(parameterName) == true) {
                position = i;
                break;
            }
        }

        return position;
    }
341322
public static String get(ExecutableElement method) {
    StringBuilder result = new StringBuilder();
    AnnotationMirror qualifier = getQualifier(method.getAnnotationMirrors());
    if (qualifier != null) {
      qualifierToString(qualifier, result);
    }
    typeToString(method.getReturnType(), result, '$');
    return result.toString();
  }
507199
private int lowestNonNullIndex(int iTargetPosition)
    {
        Object bookmark = null;
        int iBookmarkIndex = iTargetPosition;
        while (bookmark == null)
        {
            int iArrayIndex = m_gridList.listToArrayIndex(iBookmarkIndex);
            iBookmarkIndex =  m_gridList.arrayToListIndex(iArrayIndex);   // Lowest valid bookmark
            bookmark = m_gridList.elementAt(iBookmarkIndex);
            if (bookmark == null)
            {
                if (iBookmarkIndex == 0)
                    return -1;  // None found
                iBookmarkIndex--;
                if (m_gridBuffer != null)
                    bookmark = m_gridBuffer.elementAt(iBookmarkIndex);  // Check to see if it's in this list
            }
        }
        return iBookmarkIndex;  // Valid bookmark, return it.
    }
1137500
protected static Integer getOriginalPosition(String[] ori) {

        if (ori != null && ori.length == 4) {
            return Integer.parseInt(ori[0]);
        }

        return null;
    }
882168
@Override
    public C setLocation(final Point2D p)
    {
        setX(p.getX());

        setY(p.getY());

        return cast();
    }
693962
T getValueAtPosition(final int pos) {
    if (itemsSeen_ == 0) {
      throw new SketchesArgumentException("Requested element from empty reservoir.");
    } else if ((pos < 0) || (pos >= getNumSamples())) {
      throw new SketchesArgumentException("Requested position must be between 0 and "
              + getNumSamples() + ", " + "inclusive. Received: " + pos);
    }

    return data_.get(pos);
  }
650112
def locationFromElement(self, element):
        
        elementLocation = None
        for locationElement in element.findall('.location'):
            elementLocation = self.readLocationElement(locationElement)
            break
        return elementLocation
1244351
protected static StackTraceElement asStackTraceElement(LocationInfo location) {
        String fileName = (LocationInfo.NA.equals(location.getFileName())) ? null : location.getFileName();
        int line = (LocationInfo.NA.equals(location.getLineNumber())) ? -1 : Integer.parseInt(location.getLineNumber());
        return new StackTraceElement(location.getClassName(), location.getMethodName(), fileName, line);
    }
473470
private String getReplicaMethodDelegationCode(Class<?> clazz, CtMethod ctMethod, String classOrInstanceToDelegateTo)
            throws NotFoundException {
        StringBuilder builder = new StringBuilder();
        builder.append("{java.lang.reflect.Method originalMethod = ");
        builder.append(clazz.getName());
        builder.append(".class.getDeclaredMethod(\"");
        builder.append(ctMethod.getName());
        builder.append("\", ");
        final String parametersAsString = getParametersAsString(getParameterTypes(ctMethod));
        if ("".equals(parametersAsString)) {
            builder.append("null");
        } else {
            builder.append(parametersAsString);
        }
        builder.append(");\n");
        builder.append("originalMethod.setAccessible(true);\n");
        final CtClass returnType = ctMethod.getReturnType();
        final boolean isVoid = returnType.equals(CtClass.voidType);
        if (!isVoid) {
            builder.append("return (");
            builder.append(returnType.getName());
            builder.append(") ");
        }
        builder.append("originalMethod.invoke(");
        if (Modifier.isStatic(ctMethod.getModifiers()) || classOrInstanceToDelegateTo == null) {
            builder.append(clazz.getName());
            builder.append(".class");
        } else {
            builder.append(classOrInstanceToDelegateTo);
        }
        builder.append(", $args);}");
        return builder.toString();
    }
558729
function(element) {
    var r = { x: element.offsetLeft, y: element.offsetTop };
    if (element.offsetParent) {
      var tmp = getAbsolutePosition(element.offsetParent);
      r.x += tmp.x;
      r.y += tmp.y;
    }
    return r;
  }
896131
public int getEndPosition(Tree node) {
    JCCompilationUnit compilationUnit = (JCCompilationUnit) getPath().getCompilationUnit();
    if (compilationUnit.endPositions == null) {
      return -1;
    }
    return ((JCTree) node).getEndPosition(compilationUnit.endPositions);
  }
390308
public int getPrevOpcode(int offset) {
        if (offset < 0) {
            throw new IllegalArgumentException("offset (" + offset + ") must be nonnegative");
        }
        if (offset >= prevOpcode.length || offset > sizePrevOpcodeBuffer) {
            return Const.NOP;
        }
        int pos = currentPosInPrevOpcodeBuffer - offset;
        if (pos < 0) {
            pos += prevOpcode.length;
        }
        return prevOpcode[pos];
    }
484942
@VisibleForTesting
    public int findPositionOf(ByteBuffer context, CounterId id)
    {
        int headerLength = headerLength(context);
        int offset = context.position() + headerLength;

        int left = 0;
        int right = (context.remaining() - headerLength) / STEP_LENGTH - 1;

        while (right >= left)
        {
            int middle = (left + right) / 2;
            int cmp = compareId(context, offset + middle * STEP_LENGTH, id.bytes(), id.bytes().position());

            if (cmp == -1)
                left = middle + 1;
            else if (cmp == 0)
                return offset + middle * STEP_LENGTH;
            else
                right = middle - 1;
        }

        return -1; // position not found
    }
887061
public static int getLineAtPosition( JTextComponent editor, int position )
  {
    if( position <= 0 )
    {
      return 1;
    }

    String s = editor.getText();
    if( position > s.length() )
    {
      position = s.length();
    }

    try
    {
      return GosuStringUtil.countMatches( editor.getText( 0, position ), "\n" ) + 1;
    }
    catch( BadLocationException e )
    {
      throw new RuntimeException( e );
    }
  }
313253
public Integer getStyleCodeAtPosition( int iPosition )
  {
    if( _locations == null || _locations.isEmpty() )
    {
      return null;
    }
    IParseTree l;
    try
    {
      l = IParseTree.Search.getDeepestLocation( _locations, iPosition - _locationsOffset, true );
    }
    catch( Throwable t )
    {
      // Ok, what we are guarding against here is primarly a InnerClassNotFoundException. These can happen here in the UI
      // Thread when the intellisense thread is midway though parsing. The UI thread gets an old parsedelement which has
      // an old anonymous gosu class type in it and fails to load due the how anonymous class names are encoded with
      // offsets into the enclosing class file.
      return null;
    }
    if( l == null )
    {
      return null;
    }
    if( !l.contains( iPosition - _locationsOffset ) )
    {
      return null;
    }

    IParsedElement parsedElem = l.getParsedElement();

    try
    {
      return getStyleCodeForParsedElement( iPosition, parsedElem );
    }
    catch( Throwable t )
    {
      // Ok, what we are guarding against here is primarly a InnerClassNotFoundException. These can happen here in the UI
      // Thread when the intellisense thread is midway though parsing. The UI thread gets an old parsedelement which has
      // an old anonymous gosu class type in it and fails to load due the how anonymous class names are encoded with
      // offsets into the enclosing class file. 
      return null;
    }
  }