001 /**
002 * Copyright 2007 Mike Kroutikov.
003 *
004 * This program is free software; you can redistribute it and/or modify
005 * it under the terms of the Lesser GNU General Public License as
006 * published by the Free Software Foundation; either version 3 of
007 * the License, or (at your option) any later version.
008 *
009 * This program is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
012 * Lesser GNU General Public License for more details.
013 *
014 * You should have received a copy of the Lesser GNU General Public License
015 * along with this program. If not, see <http://www.gnu.org/licenses/>.
016 */
017
018 package org.otfeed.command;
019
020 import java.util.Date;
021
022 import org.otfeed.event.IDataDelegate;
023 import org.otfeed.event.OTSplit;
024 import org.otfeed.protocol.ICommand;
025
026 /**
027 * Request for the stock split information.
028 * <p/>
029 * Generates {@link OTSplit split} events.
030 */
031 public final class SplitsCommand
032 extends ExchangeAndSymbolHolder implements ICommand {
033
034 /**
035 * Creates new splits command, initializing all its
036 * properties.
037 *
038 * @param exchangeCode exchange code.
039 * @param symbolCode symbol code.
040 * @param startDate start date.
041 * @param endDate end date.
042 * @param dataDelegate delegate.
043 */
044 public SplitsCommand(String exchangeCode,
045 String symbolCode,
046 Date startDate,
047 Date endDate,
048 IDataDelegate<OTSplit> dataDelegate) {
049 setExchangeCode(exchangeCode);
050 setSymbolCode(symbolCode);
051 setStartDate(startDate);
052 setEndDate(endDate);
053 setDataDelegate(dataDelegate);
054 }
055
056 /**
057 * Default constructor. All properties must be set
058 * explicitly before using this command object.
059 *
060 */
061 public SplitsCommand() {
062 this(null, null, null, null, null);
063 }
064
065 private Date startDate;
066
067 /**
068 * Start date/time for the split info.
069 *
070 * @return Start date/time.
071 */
072 public Date getStartDate() {
073 return startDate;
074 }
075
076 /**
077 * Sets start date/time.
078 *
079 * @param val Start date/time.
080 */
081 public void setStartDate(Date val) {
082 startDate = val;
083 }
084
085 private Date endDate;
086
087 /**
088 * End date/time for the split info.
089 *
090 * @return End date/time.
091 */
092 public Date getEndDate() {
093 return endDate;
094 }
095
096 /**
097 * Sets end date/time.
098 *
099 * @param val end date/time.
100 */
101 public void setEndDate(Date val) {
102 endDate = val;
103 }
104
105 private IDataDelegate<OTSplit> dataDelegate;
106
107 /**
108 * Delegate to receive {@link OTSplit} events.
109 * This parameter is mandatory.
110 *
111 * @return delegate.
112 */
113 public IDataDelegate<OTSplit> getDataDelegate() {
114 return dataDelegate;
115 }
116
117 /**
118 * Sets delegate.
119 *
120 * @param dataDelegate delegate.
121 */
122 public void setDataDelegate(IDataDelegate<OTSplit> dataDelegate) {
123 this.dataDelegate = dataDelegate;
124 }
125 }