mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-13 20:44:08 +00:00
Extracted ScopeInfo to its own class
This commit is contained in:
1 parent
be50fdeda5
commit
d45f09c27c
2 files changed
+26
-21
No files matched your search
@@ -97,27 +97,6 @@ public class RenameRefactorHandler {
|
||||
int getViewportWidth(); // For determining if clicks are in rename box
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope information for a variable
|
||||
*/
|
||||
public static class ScopeInfo {
|
||||
public final int startOffset;
|
||||
public final int endOffset;
|
||||
public final boolean isGlobal;
|
||||
public final String scopeType; // "global", "method", "block"
|
||||
|
||||
public ScopeInfo(int start, int end, boolean isGlobal, String type) {
|
||||
this.startOffset = start;
|
||||
this.endOffset = end;
|
||||
this.isGlobal = isGlobal;
|
||||
this.scopeType = type;
|
||||
}
|
||||
|
||||
public boolean containsPosition(int pos) {
|
||||
return pos >= startOffset && pos < endOffset;
|
||||
}
|
||||
}
|
||||
|
||||
public void setCallback(RenameCallback callback) {
|
||||
this.callback = callback;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package noppes.npcs.client.gui.util.script;
|
||||
|
||||
/**
|
||||
* Scope information for a variable
|
||||
*/
|
||||
public class ScopeInfo {
|
||||
public final int startOffset;
|
||||
public final int endOffset;
|
||||
public final boolean isGlobal;
|
||||
public final String scopeType; // "global", "method", "block"
|
||||
|
||||
public ScopeInfo(int start, int end, boolean isGlobal, String type) {
|
||||
this.startOffset = start;
|
||||
this.endOffset = end;
|
||||
this.isGlobal = isGlobal;
|
||||
this.scopeType = type;
|
||||
}
|
||||
|
||||
public boolean containsPosition(int pos) {
|
||||
return pos >= startOffset && pos < endOffset;
|
||||
}
|
||||
|
||||
public boolean isWithin(ScopeInfo other) {
|
||||
return this.startOffset >= other.startOffset && this.endOffset <= other.endOffset;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user