- Main Page
- Classes
- Files

- File List

# C:/Users/Andreas Schiffler/Desktop/SVN/NewGamePhysics/NewGamePhysics/Physics/AdvancedEntropyCollector.cs

    00001 ﻿//-----------------------------------------------------------------------------
    00002 // AdvancedEntropyCollector.cs
    00003 // (A. Schiffler, 2009)
    00004 //-----------------------------------------------------------------------------
    00005
    00006 namespace NewGamePhysics.Physics
    00007 {
    00008     using System;
    00009     using System.IO;
    00010     using System.Collections.Generic;
    00011     using System.Text;
    00012
    00013     using NewGamePhysics.Utilities;
    00014     using NewGamePhysics.Mathematics;
    00015
    00027     public class AdvancedEntropyCollector
    00028     {
    00032         private List<double> valuePool;
    00033
    00037         private ValueUnbiaser unbiaser;
    00038
    00042         public AdvancedEntropyCollector()
    00043         {
    00044             // Initialize value collector
    00045             this.valuePool = new List<double>();
    00046
    00047             // Create unbiaser using partitioning algorithm
    00048             this.unbiaser = new ValueUnbiaser(ValueUnbiasAlgorithm.Partition);
    00049
    00050         }
    00051
    00055         public int ValuePoolSize
    00056         {
    00057             get { return this.valuePool.Count; }
    00058         }
    00059
    00063         public void Reset()
    00064         {
    00065             // Clear value pool
    00066             valuePool.Clear();
    00067         }
    00068
    00073         public void AddValue(double value)
    00074         {
    00075             valuePool.Add(value);
    00076         }
    00077
    00084         public override string ToString()
    00085         {
    00086             if (this.valuePool.Count > 2)
    00087             {
    00088                 return this.unbiaser.Extract(this.valuePool.ToArray());
    00089             }
    00090             else
    00091             {
    00092                 return string.Empty;
    00093             }
    00094
    00095         }
    00096
    00097     }
    00098 }