1 /* |
1 /* |
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
41 int max = contexts.length; |
41 int max = contexts.length; |
42 idPos++; |
42 idPos++; |
43 if (idPos >= max) { |
43 if (idPos >= max) { |
44 LocationContext newContexts[] = new LocationContext[max * 2]; |
44 LocationContext newContexts[] = new LocationContext[max * 2]; |
45 System.arraycopy(contexts, 0, newContexts, 0, max); |
45 System.arraycopy(contexts, 0, newContexts, 0, max); |
46 max *= 2; |
|
47 contexts = newContexts; |
46 contexts = newContexts; |
48 } |
47 } |
49 currentContext = contexts[idPos]; |
48 currentContext = contexts[idPos]; |
50 if (currentContext == null) { |
49 if (currentContext == null) { |
51 contexts[idPos] = currentContext = new LocationContext(); |
50 contexts[idPos] = currentContext = new LocationContext(); |
52 } |
51 } |
53 if (idPos > 0) { |
|
54 currentContext.setParent(contexts[idPos - 1]); |
|
55 } |
|
56 |
|
57 } |
52 } |
58 |
53 |
59 public void pop() { |
54 public void pop() { |
60 idPos--; |
55 idPos--; |
61 if (idPos >= 0) { |
56 if (idPos >= 0) { |
62 currentContext = contexts[idPos]; |
57 currentContext = contexts[idPos]; |
63 } |
58 } |
64 } |
59 } |
65 |
60 |
66 public void reset() { |
61 public final void reset() { |
67 contexts = new LocationContext[32]; |
62 contexts = new LocationContext[32]; |
68 idPos = 0; |
63 idPos = 0; |
69 contexts[idPos] = currentContext = new LocationContext(); |
64 contexts[idPos] = currentContext = new LocationContext(); |
70 } |
65 } |
71 |
66 |