Returns Paragraph number under ViewCursor
Returns a negative value if it fails
777916
int getViewCursorParagraph() {
    try {
      if (xVCursor == null) {
        return -4;
      }
      XText xDocumentText = xVCursor.getText();
      if (xDocumentText == null) {
        return -3;
      }
      XTextCursor xModelCursor = xDocumentText.createTextCursorByRange(xVCursor.getStart());
      if (xModelCursor == null) {
        return -2;
      }
      XParagraphCursor xParagraphCursor = UnoRuntime.queryInterface(
          XParagraphCursor.class, xModelCursor);
      if (xParagraphCursor == null) {
        return -1;
      }
      int pos = 0;
      while (xParagraphCursor.gotoPreviousParagraph(false)) pos++;
      return pos;
    } catch (Throwable t) {
      MessageHandler.printException(t);     // all Exceptions thrown by UnoRuntime.queryInterface are caught
      return -5;             // Return negative value as method failed
    }
  }
1365891
def get_line_number_next_to_cursor_with_string_within(self, s):
        
        line_number, _ = self.get_cursor_position()
        text_buffer = self.text_view.get_buffer()
        line_iter = text_buffer.get_iter_at_line(line_number)

        # find closest before line with string within
        before_line_number = None
        while line_iter.backward_line():
            if s in self.get_text_of_line(line_iter):
                before_line_number = line_iter.get_line()
                break

        # find closest after line with string within
        after_line_number = None
        while line_iter.forward_line():
            if s in self.get_text_of_line(line_iter):
                after_line_number = line_iter.get_line()
                break

        # take closest one to current position
        if after_line_number is not None and before_line_number is None:
            return after_line_number, after_line_number - line_number
        elif before_line_number is not None and after_line_number is None:
            return before_line_number, line_number - before_line_number
        elif after_line_number is not None and before_line_number is not None:
            after_distance = after_line_number - line_number
            before_distance = line_number - before_line_number
            if after_distance < before_distance:
                return after_line_number, after_distance
            else:
                return before_line_number, before_distance
        else:
            return None, None
703433
public int getLineNumber() {
		if ((m_lineNumber == -1) && (getName() != null)) {
			if (isG())
				m_lineNumber = 2;
			else if (isF())
				m_lineNumber = 4;
			else if (isC())
				m_lineNumber = 3;
			else if (isPerc())
				m_lineNumber = 3;
		}
		return m_lineNumber;
	}
674907
def get_line_at(self, coordinates):
        """"""
        cursor = self.cursorForPosition(coordinates)
        cursor.select(QTextCursor.BlockUnderCursor)
        return to_text_string(cursor.selectedText()).replace(u'\u2029', '')
1069269
private Integer toNumber(final Object src) {

		if (src instanceof Number) {

			return ((Number)src).intValue();
		}

		if (src instanceof String) {

			try {

				return Integer.valueOf(src.toString());

			} catch (NumberFormatException nfex) {
				logger.warn("Error in slice(): Cannot parse number {}.", src);
			}
		}

		return null;
	}
803230
int getItemViewType(T content) {
    Class prototypeClass = getPrototypeClass(content);
    validatePrototypeClass(prototypeClass);
    return getItemViewType(prototypeClass);
  }
666366
@Override
    public int getColumnIndexOrThrow(String columnName) throws IllegalArgumentException {
        int result = getColumnIndex(columnName);
        if (result == -1) {
            throw new IllegalArgumentException("CursorList is not backed by columns.");
        }
        return result;
    }
156463
private int getStartOfParagraph(int nPara, int checkedPara) {
    if (allParas != null && nPara >= 0 && nPara < allParas.size()) {
      int startPos;
      if (numParasToCheck < 1) {
        startPos = 0;
      } else {
        startPos = checkedPara - numParasToCheck;
        if(textIsChanged && doResetCheck) {
          startPos -= numParasToCheck;
        }
        if (startPos < 0) startPos = 0;
      }
      int pos = 0;
      for (int i = startPos; i < nPara; i++) {
        pos += allParas.get(i).length() + 1;
      }
      return pos;
    }
    return -1;
  }
651494
private Number parseInt(String text,
                            int maxDigits,
                            ParsePosition pos,
                            boolean allowNegative,
                            NumberFormat fmt) {
        Number number;
        int oldPos = pos.getIndex();
        if (allowNegative) {
            number = fmt.parse(text, pos);
        } else {
            // Invalidate negative numbers
            if (fmt instanceof DecimalFormat) {
                String oldPrefix = ((DecimalFormat)fmt).getNegativePrefix();
                ((DecimalFormat)fmt).setNegativePrefix(SUPPRESS_NEGATIVE_PREFIX);
                number = fmt.parse(text, pos);
                ((DecimalFormat)fmt).setNegativePrefix(oldPrefix);
            } else {
                boolean dateNumberFormat = (fmt instanceof DateNumberFormat);
                if (dateNumberFormat) {
                    ((DateNumberFormat)fmt).setParsePositiveOnly(true);
                }
                number = fmt.parse(text, pos);
                if (dateNumberFormat) {
                    ((DateNumberFormat)fmt).setParsePositiveOnly(false);
                }
            }
        }
        if (maxDigits > 0) {
            // adjust the result to fit into
            // the maxDigits and move the position back
            int nDigits = pos.getIndex() - oldPos;
            if (nDigits > maxDigits) {
                double val = number.doubleValue();
                nDigits -= maxDigits;
                while (nDigits > 0) {
                    val /= 10;
                    nDigits--;
                }
                pos.setIndex(oldPos + maxDigits);
                number = Integer.valueOf((int)val);
            }
        }
        return number;
    }
723073
protected final int getLineNumber(final String lineNumber) {
        if (StringUtils.isNotBlank(lineNumber)) {
            try {
                return Integer.parseInt(lineNumber);
            }
            catch (NumberFormatException exception) {
                // ignore and return 0
            }
        }
        return 0;
    }
677949
public static int getLineNumber(String text, int posChar) {

	int len = Math.min(posChar, text.length());
	int result = 1;

	for (int i = 0; i < len; i++) {

	    if (text.charAt(i) == '\n') result++;
	}

	return result;
    }
1090552
function getLineNumber() {
  var lines = this.source
    .slice(0, this.source.indexOf(this.entry) + this.entry.length)
    .match(/\n/g)
    .slice(1);

  // Offset by 2 because the first line number is before a line break and the
  // last line doesn't include a line break.
  return lines.length + 2;
}
628506
def end_of_paragraph(self, count=1, after=False):
        
        def match_func(text):
            return not text or text.isspace()

        line_index = self.find_next_matching_line(match_func=match_func, count=count)

        if line_index:
            add = 0 if after else 1
            return max(0, self.get_cursor_down_position(count=line_index) - add)
        else:
            return len(self.text_after_cursor)
14767
private Expression negatePlusMinusOp(Data data) throws TemplateException {
	// And Operation
	Position line = data.srcCode.getPosition();
	if (data.srcCode.forwardIfCurrent('-')) {
	    // pre increment
	    if (data.srcCode.forwardIfCurrent('-')) {
		comments(data);
		Expression expr = clip(data);
		return data.factory.opUnary((Variable) expr, data.factory.DOUBLE_ONE(), Factory.OP_UNARY_PRE, Factory.OP_UNARY_MINUS, line, data.srcCode.getPosition());

		// ExprDouble res = OpDouble.toExprDouble(expr, LitDouble.toExprDouble(1D),OpDouble.MINUS);
		// return new OpVariable((Variable)expr,res,data.cfml.getPosition());

	    }
	    comments(data);
	    return data.factory.opNegateNumber(clip(data), Factory.OP_NEG_NBR_MINUS, line, data.srcCode.getPosition());

	}
	else if (data.srcCode.forwardIfCurrent('+')) {
	    if (data.srcCode.forwardIfCurrent('+')) {
		comments(data);
		Expression expr = clip(data);

		return data.factory.opUnary((Variable) expr, data.factory.DOUBLE_ONE(), Factory.OP_UNARY_PRE, Factory.OP_UNARY_PLUS, line, data.srcCode.getPosition());
	    }
	    comments(data);
	    return data.factory.toExprDouble(clip(data));// OpNegateNumber.toExprDouble(clip(),OpNegateNumber.PLUS,line);
	}
	return clip(data);
    }
1257648
def _get_numbering(document, numid, ilvl):
    

    try:
        abs_num = document.numbering[numid]
        return document.abstruct_numbering[abs_num][ilvl]['numFmt']
    except:
        return 'bullet'
750976
public static int getNumberOfMatches(String regex, TextView view, Set<TextView> uniqueTextViews){
		if(view == null) {
			return uniqueTextViews.size();
		}
		
		Pattern pattern = null;
		try{
			pattern = Pattern.compile(regex);
		}catch(PatternSyntaxException e){
			pattern = Pattern.compile(regex, Pattern.LITERAL);
		}
		
		Matcher matcher = pattern.matcher(view.getText().toString());
		
		if (matcher.find()){
			uniqueTextViews.add(view);
		}
		
		if (view.getError() != null){
			matcher = pattern.matcher(view.getError().toString());
			if (matcher.find()){
				uniqueTextViews.add(view);
			}
		}	
		if (view.getText().toString().equals("") && view.getHint() != null){
			matcher = pattern.matcher(view.getHint().toString());
			if (matcher.find()){
				uniqueTextViews.add(view);
			}
		}	
		return uniqueTextViews.size();		
	}
201484
public Number getNumber ()
    {
        String valstr = getText().length() == 0 ? "0" : getText();
        return _allowFloatingPoint ? (Number)(new Double(valstr)) : (Number)(new Long(valstr));
    }