aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
diff options
context:
space:
mode:
authoralondria2008-02-10 21:28:41 +0000
committeralondria2008-02-10 21:28:41 +0000
commit758458121eda330b960731d044adeac8a6661a85 (patch)
tree0a7b47afae12983f80ccff03082aa94ed781b0f8 /OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
parent* This updates adds locking capability. Thanks, lbsa71 for pointing out my b... (diff)
downloadopensim-SC-758458121eda330b960731d044adeac8a6661a85.zip
opensim-SC-758458121eda330b960731d044adeac8a6661a85.tar.gz
opensim-SC-758458121eda330b960731d044adeac8a6661a85.tar.bz2
opensim-SC-758458121eda330b960731d044adeac8a6661a85.tar.xz
Implements llListStatistics() and a bunch-o-LSL_Types.list statistical methods. Added LIST_STAT_HARMONIC_MEAN in addition to LL's LIST_STAT_*
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs44
1 files changed, 41 insertions, 3 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
index fee36f0..441d2fd 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
@@ -2134,7 +2134,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2134 string ret = String.Empty; 2134 string ret = String.Empty;
2135 foreach (object o in src.Data) 2135 foreach (object o in src.Data)
2136 { 2136 {
2137 ret = ret + o.ToString() + ","; 2137 ret = ret + o.ToString() + ", ";
2138 } 2138 }
2139 ret = ret.Substring(0, ret.Length - 2); 2139 ret = ret.Substring(0, ret.Length - 2);
2140 return ret; 2140 return ret;
@@ -3376,8 +3376,46 @@ namespace OpenSim.Region.ScriptEngine.Common
3376 public double llListStatistics(int operation, LSL_Types.list src) 3376 public double llListStatistics(int operation, LSL_Types.list src)
3377 { 3377 {
3378 m_host.AddScriptLPS(1); 3378 m_host.AddScriptLPS(1);
3379 NotImplemented("llListStatistics"); 3379 LSL_Types.list nums = LSL_Types.list.ToDoubleList(src);
3380 return 0; 3380 switch (operation)
3381 {
3382 case LSL_BaseClass.LIST_STAT_RANGE:
3383 return nums.Range();
3384 break;
3385 case LSL_BaseClass.LIST_STAT_MIN:
3386 return nums.Min();
3387 break;
3388 case LSL_BaseClass.LIST_STAT_MAX:
3389 return nums.Max();
3390 break;
3391 case LSL_BaseClass.LIST_STAT_MEAN:
3392 return nums.Mean();
3393 break;
3394 case LSL_BaseClass.LIST_STAT_MEDIAN:
3395 return nums.Median();
3396 break;
3397 case LSL_BaseClass.LIST_STAT_NUM_COUNT:
3398 return nums.NumericLength();
3399 break;
3400 case LSL_BaseClass.LIST_STAT_STD_DEV:
3401 return nums.StdDev();
3402 break;
3403 case LSL_BaseClass.LIST_STAT_SUM:
3404 return nums.Sum();
3405 break;
3406 case LSL_BaseClass.LIST_STAT_SUM_SQUARES:
3407 return nums.SumSqrs();
3408 break;
3409 case LSL_BaseClass.LIST_STAT_GEOMETRIC_MEAN:
3410 return nums.GeometricMean();
3411 break;
3412 case LSL_BaseClass.LIST_STAT_HARMONIC_MEAN:
3413 return nums.HarmonicMean();
3414 break;
3415 default:
3416 return 0.0;
3417 break;
3418 }
3381 } 3419 }
3382 3420
3383 public int llGetUnixTime() 3421 public int llGetUnixTime()