/* ========================
* JSynoptic : a free Synoptic editor
* ========================
*
* Project Info: http://jsynoptic.sourceforge.net/index.html
*
* This program is free software; you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Foundation;
* either version 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this
* program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*
* (C) Copyright 2001-2005, by :
* Corporate:
* EADS Astrium SAS
* EADS CRC
* Individual:
* Claude Cazenave
*
* $Id: TimeStampedEmptyDataSource.java,v 1.7 2007/09/04 14:50:58 ogor Exp $
*
* Changes
* -------
* 21 avr. 2006 : Initial public release (CC);
*
*/
package simtools.data.async;
import java.io.IOException;
import simtools.data.DataException;
import simtools.data.EmptyDataSource;
import simtools.data.NoSuchIndex;
import simtools.data.UnsupportedOperation;
/**
* This dataSource can be used for temporary data source, which contains no
* information but have to be created.
*
* @author zxpletran007
*
*/
public class TimeStampedEmptyDataSource extends TimeStampedDataSource implements EmptyDataSource {
String dsId, dscId;
Object dsOptionalInformation;
public TimeStampedEmptyDataSource(String dsId, String dscId, Object dsOptionalInformation) throws IOException,
TimeStampedDataSourceCollection.InvalidFormatException {
super(dsId, dsId, null);
setTime(new TimeSourceEmpty());
setMin(new Double(0));
setMax(new Double(0));
this.dsId = dsId;
this.dscId = dscId;
this.dsOptionalInformation = dsOptionalInformation;
}
/*
* (non-Javadoc)
*
* @see simtools.data.EmptyDataSource#getDataSourceId()
*/
public String getDataSourceId() {
return dsId;
}
/*
* (non-Javadoc)
*
* @see simtools.data.EmptyDataSource#getDataSourceCollectionId()
*/
public String getDataSourceCollectionId() {
return dscId;
}
/*
* (non-Javadoc)
*
* @see simtools.data.EmptyDataSource#getDataSourceOptionalInformation()
*/
public Object getDataSourceOptionalInformation() {
return dsOptionalInformation;
}
/*
* (non-Javadoc)
*
* @see simtools.data.async.TimeStampedDataSource#getValue(long)
*/
public Object getValue(long index) throws DataException {
throw new NoSuchIndex(index);
}
/*
* (non-Javadoc)
*
* @see simtools.data.async.TimeStampedDataSource#getDoubleValue(long)
*/
public double getDoubleValue(long index) throws DataException {
throw new NoSuchIndex(index);
}
/*
* (non-Javadoc)
*
* @see simtools.data.async.TimeStampedDataSource#isValid()
*/
public boolean isValid() {
return false;
}
/*
* (non-Javadoc)
*
* @see simtools.data.async.TimeStampedDataSource#getEnd()
*/
public double getEnd() {
return 0.0;
}
/*
* (non-Javadoc)
*
* @see simtools.data.async.TimeStampedDataSource#getStart()
*/
public double getStart() {
return 0.0;
}
/*
* (non-Javadoc)
*
* @see simtools.data.async.TimeStampedDataSource#getLastIndex()
*/
public long getLastIndex() throws UnsupportedOperation {
return 0;
}
/*
* (non-Javadoc)
*
* @see simtools.data.async.TimeStampedDataSource#getStartIndex()
*/
public long getStartIndex() throws UnsupportedOperation {
return 0;
}
/*
* (non-Javadoc)
*
* @see simtools.data.async.TimeStampedDataSource#computeMinMax()
*/
protected void computeMinMax() throws UnsupportedOperation {
}
/*
* (non-Javadoc)
*
* @see simtools.data.DataSource#computeMin()
*/
public Object computeMin() throws UnsupportedOperation {
return new Double(0.0);
}
/*
* (non-Javadoc)
*
* @see simtools.data.DataSource#computeMax()
*/
public Object computeMax() throws UnsupportedOperation {
return new Double(0.0);
}
/*
* (non-Javadoc)
*
* @see simtools.data.DataSource#computeStartIndex()
*/
public long computeStartIndex() throws UnsupportedOperation {
return 0;
}
/*
* (non-Javadoc)
*
* @see simtools.data.DataSource#computeLastIndex()
*/
public long computeLastIndex() throws UnsupportedOperation {
return 0;
}
public class TimeSourceEmpty extends TimeSource {
/*
* (non-Javadoc)
*
* @see simtools.data.async.TimeStampedDataSource.TimeSource#getValue(long)
*/
public Object getValue(long index) throws DataException {
throw new NoSuchIndex(index);
}
/*
* (non-Javadoc)
*
* @see simtools.data.async.TimeStampedDataSource.TimeSource#getDoubleValue(long)
*/
public double getDoubleValue(long index) throws DataException {
throw new NoSuchIndex(index);
}
}
}