Package simtools.data

Examples of simtools.data.DataException


        useCache=false;
    }

    public DataSource getXSource() throws DataException{
        if (xSource==null)
            throw new DataException();
        return xSource;
    }
View Full Code Here


        return xSource;
    }

    public DataSource getYSource() throws DataException{
        if (ySource==null)
            throw new DataException();
        return ySource;
    }
View Full Code Here

        return new Rectangle2D.Double(x,y,w,h);
    }

    protected void computeLocalRangeIndex(double xmin, double xmax) throws DataException{
        if ( xSource==null) {
            throw new DataException();
        }

        // Get curve min and curve max indexes related to current zoom
        double ln2 = Math.log(2);
        localMinIndex =  xSource.getStartIndex();
        localMaxIndex=  xSource.getLastIndex();

        double ds=xSource.getDoubleValue(localMinIndex);  
        double dl=xSource.getDoubleValue(localMaxIndex);

        boolean twoTimes = (localMaxIndex-localMinIndex)>MAXSTEPS;    // get max and min indexes in 2 times

        if (xSource.sortedOrder()==0)
            throw new DataException();

        if(localMaxIndex>localMinIndex){
            // Fisrt compute...
            if (  (( xSource.sortedOrder()==-1 && (ds>xmin)) || ( xSource.sortedOrder()==1 && (ds<xmin))) && twoTimes){
                long mini = localMinIndex;
View Full Code Here

    }

    public void computeYLocalRange(double xmin, double xmax) throws DataException{
        if ( (xSource==null) || (ySource==null)) {
            throw new DataException();
        }
        computeLocalRangeIndex(xmin, xmax);

        //  maxAfter is true if the point found for max position is after xmax
        boolean maxAfter  = xSource.getDoubleValue(localMaxIndex) > xmax;
View Full Code Here

     * @param xmax  last bound of interval in which compute is performed
     * @throws DataException
     */
    public void computeStatistics(double xmin, double xmax) throws DataException{
        if ( (xSource==null) || (ySource==null)) {
            throw new DataException();
        }
        computeLocalRangeIndex(xmin, xmax);

        //  maxAfter is true if the point found for max position is after xmax
        boolean maxAfter  = xSource.getDoubleValue(localMaxIndex) > xmax;
View Full Code Here

     * - Compute magnetized point slope with next point (or previous point if it is the last point)
     */
    public void setCurrentPoint(double pos_x) throws DataException{

        if ( (xSource==null) || (ySource==null))
            throw new DataException();

        double ln2 = Math.log(2);
        long magnetizedPointMin =  xSource.getStartIndex();
        long magnetizedPointMax =  xSource.getLastIndex();

        boolean twoTimes = (magnetizedPointMax-magnetizedPointMin)>MAXSTEPS;  // get max and min indexes in 2 times

        if (xSource.sortedOrder()==0)
            throw new DataException();

        if(magnetizedPointMax>magnetizedPointMin){   
            // Fisrt compute...
            if (twoTimes){
                long mini = magnetizedPointMin;
View Full Code Here

            if (index > _lastIndex) {
                throw new NoSuchIndex(index);
            }
            if (type.equals("time")) {
                if (_t == null) {
                    throw new DataException();
                }
                return new Double(_t[(int) index % _size]);
            } else if (type.equals("time2")) {
                if (_t2 == null) {
                    throw new DataException();
                }
                return new Double(_t2[(int) index % _size]);
            } else {
                throw new DataException();
            }
        }
View Full Code Here

            if (type.equals("time")) {
                return _t[(int) index % _size];
            } else if (type.equals("time2")) {
                return _t2[(int) index % _size];
            } else {
                throw new DataException();
            }
        }
View Full Code Here

                    if (upperBoundindex <= lastIndex){  // it is possible to interpolate

                        //assert that lowerBoundindex <= index <= upperBoundindex
                        if (!( (lowerBoundindex <= index) &&  (index <= upperBoundindex))){
                            throw new DataException("Incorrect interpolation: index= "  + index + " bounds = "  + lowerBoundindex + "; " + upperBoundindex);
                        }

                        double ponderation = (double)(index - lowerBoundindex)/ (upperBoundindex - lowerBoundindex);

                        double lowerBoundValue = source.getDoubleValue(i);
View Full Code Here

         * Interpolate source values in order to fit with collection time reference.
         * _values _min, _max are updated.
         */
        public void updateDirectBuffer() throws DataException, OutOfMemoryError {
            if (mergedTimeBuffer==null) {
                throw new DataException("Collection time buffer is null, canot create direct buffer for data source " + DataInfo.getId(this));
            }
           
            final ByteBuffer bb=ByteBuffer.allocateDirect(8*mergedTimeBuffer.capacity());
            _values = bb.asDoubleBuffer();

            long trIndex = timeRef.getStartIndex();

            for(long ctIndex=mergedTimeDs.getStartIndex();ctIndex<=mergedTimeDs.getLastIndex();ctIndex++){

                double ctValue = mergedTimeDs.getDoubleValue(ctIndex);

                // Find trIndex 
                while (!(  (trIndex==timeRef.getLastIndex())                                     // last bound
                        || ( (getTimeDoubleValue(trIndex) <= ctValue) && (ctValue < getTimeDoubleValue(trIndex+1)))    // between two values
                        || (getTimeDoubleValue(trIndex) >= ctValue)                              // fisrt
                ))
                    trIndex++;

                if (getTimeDoubleValue(trIndex) > ctValue)  {
                    throw new DataException("Cannot interpolate data source " + DataInfo.getId(this) + " . Its time interval does not match with time reference");
                }
                // Find value
                double interpolatedValue  = source.getDoubleValue(trIndex);

                if ((interpolationOrder==1) && trIndex<timeRef.getLastIndex()){
View Full Code Here

TOP

Related Classes of simtools.data.DataException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.