diff options
author | ElgarL <ElgarL@palmergames.com> | 2011-11-24 13:26:30 +0000 |
---|---|---|
committer | ElgarL <ElgarL@palmergames.com> | 2011-11-24 13:26:30 +0000 |
commit | 8bcca0526b5f4e4f42c2579f8b2fc73916f63082 (patch) | |
tree | 1dd6d3476a1167ddad3fc1ee51d1cb9aeba406fa /EssentialsGroupManager/src/org/anjocaido/groupmanager | |
parent | 0c1d9d4e2143484462adcfec655633e8f9f5f3ac (diff) | |
download | Essentials-8bcca0526b5f4e4f42c2579f8b2fc73916f63082.tar Essentials-8bcca0526b5f4e4f42c2579f8b2fc73916f63082.tar.gz Essentials-8bcca0526b5f4e4f42c2579f8b2fc73916f63082.tar.lz Essentials-8bcca0526b5f4e4f42c2579f8b2fc73916f63082.tar.xz Essentials-8bcca0526b5f4e4f42c2579f8b2fc73916f63082.zip |
Optimize sorting to speedup permission tests.
Diffstat (limited to 'EssentialsGroupManager/src/org/anjocaido/groupmanager')
-rw-r--r-- | EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java index 924da3616..25546a0ea 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java @@ -18,7 +18,7 @@ public abstract class DataUnit { private WorldDataHolder dataSource; private String name; - private boolean changed; + private boolean changed, sorted = false; private ArrayList<String> permissions = new ArrayList<String>(); public DataUnit(WorldDataHolder dataSource, String name) { @@ -91,6 +91,7 @@ public abstract class DataUnit { // for(StackTraceElement st: Thread.currentThread().getStackTrace()){ // GroupManager.logger.finest(st.toString()); // } + sorted = false; changed = true; } @@ -135,8 +136,15 @@ public abstract class DataUnit { public ArrayList<String> getPermissionList() { return new ArrayList<String>(permissions); } + + public boolean isSorted() { + return this.sorted; + } public void sortPermissions() { - Collections.sort(permissions, StringPermissionComparator.getInstance()); + if (!isSorted()) { + Collections.sort(permissions, StringPermissionComparator.getInstance()); + sorted = true; + } } }
\ No newline at end of file |