1.1 --- a/modules/lib.math/src/org/aiotrade/lib/math/timeseries/DefaultTSer.scala Tue Nov 03 22:15:38 2009 +0800
1.2 +++ b/modules/lib.math/src/org/aiotrade/lib/math/timeseries/DefaultTSer.scala Tue Nov 03 22:41:34 2009 +0800
1.3 @@ -33,6 +33,7 @@
1.4 import java.awt.Color
1.5 import java.util.Calendar
1.6 import org.aiotrade.lib.util.collection.ArrayList
1.7 +import java.util.logging.Logger
1.8 import org.aiotrade.lib.math.timeseries.computable.SpotComputable
1.9 import org.aiotrade.lib.math.timeseries.plottable.Plot
1.10
1.11 @@ -57,7 +58,13 @@
1.12 *
1.13 * @author Caoyuan Deng
1.14 */
1.15 +object DefaultTSer {
1.16 + val logger = Logger.getLogger(classOf[DefaultTSer].getName)
1.17 +}
1.18 +
1.19 class DefaultTSer(freq: TFreq) extends AbstractTSer(freq) {
1.20 + import DefaultTSer._
1.21 +
1.22 private val INIT_CAPACITY = 400
1.23 /**
1.24 * we implement occurred timestamps and items in density mode instead of spare
1.25 @@ -269,7 +276,7 @@
1.26 logCurrSize - tsLogCheckedSize
1.27 } else logCurrSize
1.28
1.29 - print("Log check: cursor=" + checkingCursor + ", insertSize=" + insertSize + ", begIdx=" + begIdx1 + ", currentSize=" + items.size + " - " + shortDescription + "(" + freq + ")")
1.30 + logger.info(shortDescription + "(" + freq + ")" + " Log check: cursor=" + checkingCursor + ", insertSize=" + insertSize + ", begIdx=" + begIdx1 + ", currentSize=" + items.size)
1.31 val newItems = new Array[TItem](insertSize)
1.32 var i = 0
1.33 while (i < insertSize) {
1.34 @@ -279,7 +286,7 @@
1.35 i += 1
1.36 }
1.37 items.insertAll(begIdx1, newItems)
1.38 - println(" => newSize=" + items.size)
1.39 + logger.info(shortDescription + "(" + freq + ") => newSize=" + items.size)
1.40
1.41 case TStampsLog.APPEND =>
1.42 val begIdx = items.size
1.43 @@ -288,7 +295,7 @@
1.44 logCurrSize - tsLogCheckedSize
1.45 } else logCurrSize
1.46
1.47 - print("Log check: cursor=" + checkingCursor + ", appendSize=" + appendSize + ", begIdx=" + begIdx + ", currentSize=" + items.size + " - " + shortDescription + "(" + freq + ")")
1.48 + logger.info(shortDescription + "(" + freq + ")" + " Log check: cursor=" + checkingCursor + ", appendSize=" + appendSize + ", begIdx=" + begIdx + ", currentSize=" + items.size)
1.49 val newItems = new Array[TItem](appendSize)
1.50 var i = 0
1.51 while (i < appendSize) {
1.52 @@ -298,7 +305,7 @@
1.53 i += 1
1.54 }
1.55 items ++= newItems
1.56 - println(" => newSize=" + items.size)
1.57 + logger.info(shortDescription + "(" + freq + ") => newSize=" + items.size)
1.58
1.59 case x => assert(false, "Unknown log type: " + x)
1.60 }
1.61 @@ -619,52 +626,6 @@
1.62
1.63 def size: Int = values.size
1.64 }
1.65 -
1.66 - /*-
1.67 - /**
1.68 - * @deprecated
1.69 - * This method inject declared Var(s) of current instance into vars, sub-
1.70 - * class should also call it in the constructor (except no-arg constructor)
1.71 - * after all Var(s) have got the proper value(s) to return a useful
1.72 - * instance.
1.73 - *
1.74 - * We define it as a final to keep this contract.
1.75 - */
1.76 - @ReferenceOnly
1.77 - @Deprecated
1.78 - protected def injectVarsIntoSer: Unit = {
1.79 - val fields = this.getClass.getDeclaredFields
1.80 -
1.81 - AccessibleObject.setAccessible(fields, true)
1.82 -
1.83 - for (field <- fields) {
1.84 - var value:Any = null
1.85 -
1.86 - try {
1.87 - value = field.get(this)
1.88 - } catch {
1.89 - case ex:IllegalArgumentException => ex.printStackTrace
1.90 - case ex:IllegalAccessException => ex.printStackTrace
1.91 - }
1.92 -
1.93 - if (value != null && value.isInstanceOf[Var[_]]) {
1.94 - addVar(value.asInstanceOf[Var[_]])
1.95 - }
1.96 - }
1.97 - }
1.98 - */
1.99 - /*-
1.100 - abstract public class BaseHibernateEntityDao<T> extends HibernateDaoSupport {
1.101 - private Class<T> entityClass;
1.102 - public BaseHibernateEntityDao() {
1.103 - entityClass =(Class<T>) ((ParameterizedType) getClass()
1.104 - .getGenericSuperclass()).getActualTypeArguments()[0];
1.105 - }
1.106 - public T get(Serializable id) {
1.107 - T o = (T) getHibernateTemplate().get(entityClass, id);
1.108 - }
1.109 - }
1.110 - */
1.111 }
1.112
1.113