01: package javaparser;
02:
03: import javaparser.javacc_gen.Token;
04:
05: /** essential structure for the completion:
06: variables are valid within bloks (and subclasses)
07:
08: bloks limits scope of variables
09: 1) types: classes, interfaces, enums, annotations, (but be careful, protected, package scope and public are seen outside)
10: 2) methods, constructors
11: 3) static initializers TODO
12: 4) for loop, try statement (not while)
13: 5) raw blocs, just defined in the source
14: */
15: public class Blok {
16: public Token startBrace;
17: public Token endBrace;
18:
19: public Blok() {
20: }
21:
22: public boolean isInBlok(int line, int col) {
23: if (startBrace == null)
24: return false;
25: if (endBrace == null)
26: return false;
27:
28: if (line < startBrace.beginLine)
29: return false;
30: if (line > endBrace.endLine)
31: return false;
32: if (line == startBrace.beginLine
33: && col < startBrace.beginColumn)
34: return false;
35: if (line == endBrace.endLine && col > endBrace.endColumn)
36: return false;
37:
38: return true;
39: }
40:
41: }
|