⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 position.java

📁 java编译器gjc源码 java编译环境
💻 JAVA
字号:
/**
 * @(#)Position.java	1.10 03/01/23
 *
 * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
package com.sun.tools.javac.v8.util;

/**
 * A class that encodes and decodes source code positions. Source code
 *  positions are internally represented as integers that contain
 *  both column and line number information.
 */
public class Position {

    public Position() {
        super();
    }

    /**
      * Source file positions are integers in the format:
      *  line-number << LINESHIFT + column-number
      *  NOPOS represents an undefined position.
      */
    public static final int LINESHIFT = 10;
    public static final int COLUMNMASK = (1 << LINESHIFT) - 1;
    public static final int NOPOS = 0;
    public static final int FIRSTPOS = (1 << LINESHIFT) + 1;
    public static final int MAXPOS = Integer.MAX_VALUE;

    /**
     * The line number of the given position.
     */
    public static int line(int pos) {
        return pos >>> LINESHIFT;
    }

    /**
      * The column number of the given position.
      */
    public static int column(int pos) {
        return pos & COLUMNMASK;
    }

    /**
      * Form a position from a line number and a column number.
      */
    public static int make(int line, int col) {
        return (line << LINESHIFT) + col;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -