Changeset 2063
- Timestamp:
- Oct 17, 2011, 1:14:03 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/dbnp/visualization/VisualizeController.groovy
r2061 r2063 984 984 def listSize = listOfValues.size(); 985 985 986 def objReturn = null; 987 986 988 if( listSize > 0 ) { 987 989 def listHalf = (int) Math.abs(listSize/2); 988 990 if(listSize%2==0) { 989 991 // If the list is of an even size, take the mean of the middle two value's 990 return ["value": (listOfValues.get(listHalf)+listOfValues.get(listHalf-1))/2];992 objReturn = (listOfValues.get(listHalf)+listOfValues.get(listHalf-1))/2; 991 993 } else { 992 994 // If the list is of an odd size, take the middle value 993 return ["value": listOfValues.get(listHalf-1)]; 994 } 995 } else 996 return ["value": null]; 995 objReturn = listOfValues.get(listHalf); 996 } 997 } 998 999 return ["value": objReturn]; 997 1000 } 998 1001
Note: See TracChangeset
for help on using the changeset viewer.