changeset 53:3a3362f78d48

small cleanup.
author casties
date Thu, 03 Nov 2016 20:12:36 +0100
parents 5b2a97d417d5
children 7f9033d44a87
files src/main/java/org/mpi/openmind/cache/WrapperService.java
diffstat 1 files changed, 33 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/org/mpi/openmind/cache/WrapperService.java	Thu Nov 03 20:12:11 2016 +0100
+++ b/src/main/java/org/mpi/openmind/cache/WrapperService.java	Thu Nov 03 20:12:36 2016 +0100
@@ -188,24 +188,40 @@
 		return count;
 	}
 
-	public List<Entity> getEntityByDefSubList(String def, int fromIndex,
-			int toIndex) {
-		List<Entity> list = new ArrayList<Entity>();
-		List<Entity> all = getEntitiesByDef(def);
-		if (all != null && all.size() >= toIndex) {
-			
-			long start = System.currentTimeMillis();
-			Collections.sort(list, new EntitySortByNormalizedOwnValue());
-			long diff = System.currentTimeMillis() - start;
-			logger.info("Sorting entities time[ms] " + diff);
-			
-			for (Entity ent : all.subList(fromIndex, toIndex)) {
-				list.add(ent);
-			}
-		}
-		return list;
-	}
+    /**
+     * Returns a List of Entities of the given definition (object_class).
+     * 
+     * All Entities are sorted by normalized own-value first. Then the
+     * part between fromIndex and toIndex is returned.
+     * 
+     * @param def
+     * @param fromIndex
+     * @param toIndex
+     * @return
+     */
+    public List<Entity> getEntityByDefSubList(String def, int fromIndex, int toIndex) {
+        List<Entity> list = new ArrayList<Entity>();
+        List<Entity> all = getEntitiesByDef(def);
+        if (all != null && all.size() >= toIndex) {
 
+            long start = System.currentTimeMillis();
+            Collections.sort(list, new EntitySortByNormalizedOwnValue());
+            long diff = System.currentTimeMillis() - start;
+            logger.debug("Sorting entities time[ms] " + diff);
+
+            for (Entity ent : all.subList(fromIndex, toIndex)) {
+                list.add(ent);
+            }
+        }
+        return list;
+    }
+
+	/**
+	 * Returns a List of all Entities of the given definition (object_class).
+	 * 
+	 * @param def
+	 * @return
+	 */
 	public List<Entity> getEntitiesByDef(String def) {
 		List<Entity> list = this.cache.loadEntitiesByDef(def);
 		return list;