com.baidu.rigel.biplatform.ma.report.model.TimerAreaLogicModel.java Source code

Java tutorial

Introduction

Here is the source code for com.baidu.rigel.biplatform.ma.report.model.TimerAreaLogicModel.java

Source

/**
 * Copyright (c) 2014 Baidu, Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.baidu.rigel.biplatform.ma.report.model;

import java.io.Serializable;
import java.util.LinkedHashMap;

import com.google.common.collect.Maps;

/**
 * 
 * 
 *  ??
 *  ????
 *  
 *
 * @author david.wang
 * @version 1.0.0.1
 */
public class TimerAreaLogicModel extends LogicModel {

    /**
     * serialized id
     */
    private static final long serialVersionUID = 2692928208926779246L;

    /**
     * value?
     */
    private LinkedHashMap<Item, TimeRange> timeDimensions;

    /**
     * 
     * 
     * TimerAreaLogicModel
     */
    public TimerAreaLogicModel() {
        this.timeDimensions = Maps.newLinkedHashMap();
    }

    /**
     * @return the timeDimensions
     */
    public LinkedHashMap<Item, TimeRange> getTimeDimensions() {
        return timeDimensions;
    }

    /**
     * @param timeDimensions the timeDimensions to set
     */
    public void setTimeDimensions(LinkedHashMap<Item, TimeRange> timeDimensions) {
        this.timeDimensions = timeDimensions;
    }

    /**
     * 
     * @param item
     */
    public void removeTimeDimension(Item item) {
        this.timeDimensions.remove(item);
    }

    /**
     * 
     * @param item
     * @param defaultValue
     */
    public void addTimeDimension(Item item, TimeRange defaultValue) {
        this.timeDimensions.put(item, defaultValue);
    }

    /**
     * ??
     *
     * @author david.wang
     * @version 1.0.0.1
     */
    public static enum TimeUnit {

        /**
         * 
         */
        Y,

        /**
         * 
         */
        Q,

        /**
         * 
         */
        M,

        /**
         * 
         */
        W,

        /**
         * 
         */
        D;
    }

    /**
     * 
     * 
     *
     * @author david.wang
     * @version 1.0.0.1
     */
    public static class TimeRange implements Serializable {

        /**
         * TimerAreaLogicModel.java -- long
         * description:
         */
        private static final long serialVersionUID = -7645009802244976383L;

        /**
         * 
         */
        public final String begin;

        /**
         * 
         */
        public final String end;

        /**
         * ??
         */
        public final String pattern;

        /**
         * ??
         */
        public final TimeUnit timeUnit;

        /**
         * 
         * @param begin 
         * @param end 
         * @param pattern ?
         * @param timeUnit ??
         * TimeRange
         */
        public TimeRange(String begin, String end, String pattern, TimeUnit timeUnit) {
            super();
            this.begin = begin;
            this.end = end;
            this.pattern = pattern;
            this.timeUnit = timeUnit;
        }

    }
}