- 既知のすべてのサブインタフェース:
DocSourcePositions
public interface SourcePositions
CompilationUnit内のTreeの部分を取得するためのメソッドを提供します。 位置はCompilationUnitの開始点からの単純な文字オフセットとして定義されます。最初の文字は、オフセット0になります。
- 導入されたバージョン:
- 1.6
-
メソッドのサマリー
修飾子と型メソッド説明longgetEndPosition(CompilationUnitTree file, Tree tree) ファイル内のツリーの終了位置を返します。longgetStartPosition(CompilationUnitTree file, Tree tree) ファイル内のツリーの開始位置を返します。
-
メソッドの詳細
-
getStartPosition
long getStartPosition(CompilationUnitTree file, Tree tree) ファイル内のツリーの開始位置を返します。 ファイル内にツリーが見つからない場合、または開始位置が使用できない場合は、Diagnostic.NOPOSを返します。 返される位置は、このツリーの開始点である必要があります。つまり、このツリーのサブツリーでは、次の状態を保持する必要があります。getStartPosition(file, tree) <= getStartPosition(file, subtree)またはgetStartPosition(file, tree) == NOPOSまたはgetStartPosition(file, subtree) == NOPOS- パラメータ:
file- ツリーが検索されるCompilationUnittree- 位置のシーク対象となるツリー- 戻り値:
- ツリーの開始位置
-
getEndPosition
long getEndPosition(CompilationUnitTree file, Tree tree) ファイル内のツリーの終了位置を返します。 ファイル内にツリーが見つからない場合、または終了位置が使用できない場合は、Diagnostic.NOPOSを返します。 返される位置は、このツリーの終了点である必要があります。つまり、このツリーのサブツリーでは、次の状態を保持する必要があります。
さらに、次の状態が保持されます。getEndPosition(file, tree) >= getEndPosition(file, subtree)またはgetEndPosition(file, tree) == NOPOSまたはgetEndPosition(file, subtree) == NOPOSgetStartPosition(file, tree) <= getEndPosition(file, tree)またはgetStartPosition(file, tree) == NOPOSまたはgetEndPosition(file, tree) == NOPOS- パラメータ:
file- ツリーが検索されるCompilationUnittree- 位置のシーク対象となるツリー- 戻り値:
- ツリーの終了位置
-