首页 > 其他 > 详细

程序员的量化交易之路(18)--Cointrader之Event实体(6)

时间:2015-06-03 23:33:49      阅读:475      评论:0      收藏:0      [点我收藏+]

转载需注明:

事件,是Esper的重要概念。这里我们定义个事件类,它是Temporal实体的派生类。

仅仅是对Temporal简单的包装。其代码如下:


package org.cryptocoinpartners.schema;

import org.joda.time.Instant;

import javax.persistence.MappedSuperclass;


/**
 * Subclasses of Event may be posted to Context
 *
 * @author Tim Olson
 */
//是一个基类,在数据库中不创建表格。
@MappedSuperclass
public abstract class Event extends Temporal {


    /**
     * If the Event's time has not been set when it is being published, it will be set to the current time of the
     * publishing Context
     */
    public void publishedAt(Instant instant) {
        if( getTime() == null )
            setTime(instant);
    }


    /** Most events should use this constructor to provide the time of the original happening, not the time of
     *  object creation */
    protected Event(Instant time) {
        super(time);
    }


    protected Event() {}


}


程序员的量化交易之路(18)--Cointrader之Event实体(6)

原文:http://blog.csdn.net/minimicall/article/details/46352029

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!