summaryrefslogtreecommitdiffstats
path: root/EssentialsGroupManager/src
diff options
context:
space:
mode:
authorElgarL <ElgarL@palmergames.com>2011-11-24 13:26:30 +0000
committerElgarL <ElgarL@palmergames.com>2011-11-24 13:26:30 +0000
commit94983c3ca75317a2c6c7e0c8ca88b4f2a2ad0f4c (patch)
treedb6973db332e7fbc7cf74d0c2454b8cec8a345d2 /EssentialsGroupManager/src
parentfd1c2824ce0a0b5932ac009e706b371fe8a6072d (diff)
downloadEssentials-94983c3ca75317a2c6c7e0c8ca88b4f2a2ad0f4c.tar
Essentials-94983c3ca75317a2c6c7e0c8ca88b4f2a2ad0f4c.tar.gz
Essentials-94983c3ca75317a2c6c7e0c8ca88b4f2a2ad0f4c.tar.lz
Essentials-94983c3ca75317a2c6c7e0c8ca88b4f2a2ad0f4c.tar.xz
Essentials-94983c3ca75317a2c6c7e0c8ca88b4f2a2ad0f4c.zip
Optimize sorting to speedup permission tests.
Diffstat (limited to 'EssentialsGroupManager/src')
-rw-r--r--EssentialsGroupManager/src/Changelog.txt3
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java12
2 files changed, 12 insertions, 3 deletions
diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt
index 580d8bc88..d12f96cda 100644
--- a/EssentialsGroupManager/src/Changelog.txt
+++ b/EssentialsGroupManager/src/Changelog.txt
@@ -75,4 +75,5 @@ v 1.5:
- Fixed a crash on reload due to bukkit not unloading plugins before reloading.
v 1.6:
- Prevent Group.equals tests throwing a NullPointerException for GlobalGroups.
- - Stop throwing errors on an empty users file. \ No newline at end of file
+ - Stop throwing errors on an empty users file.
+ - Optimize sorting to speedup permission tests. \ No newline at end of file
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