亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? tsread.java

?? java的小波分析程序
?? JAVA
字號:

package dataInput;

import java.io.*;
import double_vec.*;

/**
<p>
  class tsRead

<p>
  Read a time series file.  The format of the file is
</p>
<pre>
  <i>date</i>  <i>double-value</i>
</pre>
<p>
  This class was written with daily financial time series
  in mind.  It needs to be modified to handle intra-day
  time series or any other time series that has a time
  stamp as well.
</p>
<p>
  The class is used by instantiating the constructor
  with the file name for the time series.  For example:
</p>
<pre>
  tsRead ts = new tsRead( <i>time_series</i> );
</pre>
<p>
  The tsRead class reads the time series into a double_vec
  object.
</p>
<p>
  Once data is read into the object (e.g., the object is
  constructed) the data is referenced by getting it
  as an array (double[]) via the getArray function.
</p>
<p>
  Getting the data as an array is inefficient, since the
  data must be copied into the array first.  This course
  is followed for two reasons:
</p>
  <ol>
  <li>
  <p>
  The size of the input data is not known in advance, so
  a growable data structure, like double_vec is used.
  </p>
  </li>

  <li>
  <p>
  Although the double_vec data structure works well for
  storing the input data, it is awkward when it comes to
  numeric computation, since the only way to reference
  elements is via the elementAt() function.  Compared
  to the [] operator, this tends to obscure numeric
  algorithms making the code more difficult to understand.
  This is a real drawback for the wavelet algorithms, which
  are already complex enough.
  </p>
  </li>
</ol>
<p>
  So the input data is referenced via an array, even though
  we must pay the cost of copying.  Although operator overloading
  can create its own problems, this is a case where operator
  overloading would be useful, since in C++ double_vec could
  have been used directly.
</p>
  
<h4>
   Copyright and Use
</h4>

<p>
   You may use this source code without limitation and without
   fee as long as you include:
</p>
<blockquote>
     This software was written and is copyrighted by Ian Kaplan, Bear
     Products International, www.bearcave.com, 2001.
</blockquote>
<p>
   This software is provided "as is", without any warrenty or
   claim as to its usefulness.  Anyone who uses this source code
   uses it at their own risk.  Nor is any support provided by
   Ian Kaplan and Bear Products International.
<p>
   Please send any bug fixes or suggested source changes to:
<pre>
     iank@bearcave.com
</pre>


  */
public class tsRead {
  /**
    class badData : an exception for bad
    data in the file.

   */
  private class badDataError extends Exception {
    public badDataError() { super(); }
    public badDataError( String m ) { super(m); }
  } // badData

  PushbackInputStream pushStream;
  private double_vec timeSeries;
  private boolean fileOpen = false;


  /**

    skip_spaces

    Skip white space characters.  As with all the code in this class,
    it is assumed that characters are 8-bits.  Return true if EOF is
    reached.  Otherwise return false.

    The function will read until a non-white character or end of
    file is reached.  The non-white space character is pushed back
    into the input stream.

   */
  private boolean skip_spaces()
  {
    int ch = 0;

    try {
      while (Character.isWhitespace( (char)(ch = pushStream.read()) ))
	/* nada */;

      if (ch > 0) {
	try {
	  pushStream.unread( ch );
	}
	catch (Exception e) {
	  System.out.println("skip_spaces: push back error - " +
			     e.getMessage() );
	}
      }
    }
    catch (Exception e) {
      System.out.println("skip_spaces: read error - " + e.getMessage() );
    }
    return (ch == 0);
  } // skip_spaces

  /**
   *

<p>
    read_date
<p>
    Currently dates are skipped.  The time series
    code assumes that dates are continuous and there
    are no holes in the data.
<p>
    For consistency sake there is some checking done.
    The code assumes that dates are composed of numbers
    or '/' characters.
<p>
    When this class is called it is assumed that the
    first character in the stream is a number.  The
    function reads numbers or '/' characters until 
    the end of line is reached or there is a space.
<p>
    The format for a date is
<pre>
       (number)+ '/' (number)+ / (number)+
</pre>
   */
  private boolean read_date()
       throws badDataError
  {
    int ch = 0;
    boolean foundDigit = false;
    boolean rslt = false;
    badDataError err = new badDataError( "Bad date format" );

    try {
      for (int i = 0; i < 3; i++) {
	foundDigit = false;
	while (Character.isDigit( (char)(ch = pushStream.read()) )) {
	  foundDigit = true;
	}
	
	if (ch < 0) {
	  rslt = true;  // we've reached EOF
	  break;
	}
	
	if (! foundDigit ) throw err;
	
	if (i < 2)
	  if ((char)ch != '/') throw err;
      } // for
    }
    catch (Exception e) {
      System.out.println("read_date: read error - " + e.getMessage() );
    }

    if (foundDigit) {
      // push the character after the date back into the
      // input stream.
      try {
	pushStream.unread( ch );
      }
      catch (Exception e) {
	System.out.println("read_date: push back error - " +
			   e.getMessage() );
      }
    }

    return rslt;
  } // read_date



  /**
     read_double
<p>
     Read the character string for a floating point
     value and convert it into a double.  The
     format for a double is
<pre>
       [+|-] (digit)+ '.' (digit)+
</pre>
<p>
     The function is passed a reference to an array of
     doubles.  It returns dv[0] with the value (Java has
     not pass by reference except via objects).
     
     If the function reaches EOF, it return false, otherwise
     true.

   */
  private boolean read_double( double[] dv )
       throws badDataError
  {
    final int DBL_SIGN  = 1; // + | - 
    final int DBL_INT   = 2; // the part that is > 1 => (digit)+
    final int DBL_FRAQ  = 3; // fraction after '.' => (digit)+
    final int DBL_DONE  = 4; // finished parsing double
    int state = DBL_SIGN;

    String s = new String();
    boolean rslt = false;
    char ch = 0;
    
    dv[0] = 0.0;

    try {
      while (state != DBL_DONE) {
	ch = (char)(pushStream.read());

	if (ch > 0xff) { // EOF, since we're not supporting wide chars
	  rslt = true;
	  state = DBL_DONE;
	}

	switch (state) {

        case DBL_SIGN:
	  if (ch == '+' || ch == '-' || ch == '.' || Character.isDigit( ch )) {
	    s = s + ch;
	    if (ch == '.')
	      state = DBL_FRAQ;
	    else
	      state = DBL_INT;
	  }
	  else {
	    badDataError err = new badDataError();
	    throw err;
	  }
	  break;

        case DBL_INT:
	  if (Character.isDigit( ch ) || ch == '.') {
	    s = s + ch;

	    if (ch == '.')
	      state = DBL_FRAQ;
	  }
	  else {
	    state = DBL_DONE;
	  }
	  break;

        case DBL_FRAQ:
	  if (Character.isDigit( ch )) {
	    s = s + ch;
	  }
	  else {
	    state = DBL_DONE;
	  }
	  break;
	  
	} // switch
	
      } // while
    } // try
    catch (Exception e) {
      System.out.println("read_double: error reading file - " +
			 e.getMessage() );
    }

    // push the last character back into the input stream
    try {
      pushStream.unread( ch );
    }
    catch (Exception e) {
      System.out.println("read_double: push back error - " +
			 e.getMessage() );
    }

    if (s.length() > 0) {  // convert string to double
      Double dblObj = new Double( s );
      dv[0] = dblObj.doubleValue();
    }

    return rslt;
  }  // read_double



  /**
    <p>
    time_series_read

    <p>
    Read a time series file into a double_vec object

   */
  private void time_series_read()
  {
    timeSeries = new double_vec();
    boolean end_of_file = false;
    double dv[] = new double[1];

    try {
      while (! end_of_file ) {
	end_of_file = skip_spaces();
	if (! end_of_file) {

	  end_of_file = read_date();
	  if (! end_of_file) {

	    end_of_file = skip_spaces();
	    if (! end_of_file) {

	      end_of_file = read_double( dv );
	      if (! end_of_file) {
		timeSeries.append( dv[0] );
	      } // read_double
	    } // skip_spaces
	  } // read_date
	} // skip_spaces
      } // while
    }
    catch (Exception e) {
      if (e instanceof badDataError) {
	System.out.println("bad data: " + e.getMessage() );
      }
    }
  } // time_series_read


  private boolean openStream( String name )
  {
    boolean rslt = false;

    try {
      FileInputStream fStream;

      fStream = new FileInputStream( name );
      // Allocating the FileInputStream opens the file.
      // If the open fails, either because access is not
      // allowed or because it does not exist, 
      // an exception will be thrown.  If this happens we
      // will not proceed to the next line.
      pushStream = new PushbackInputStream( fStream );
      rslt = true;
    }
    catch (Exception e ) {
      if (e instanceof FileNotFoundException) {
        System.out.println("could not open file " + name );
      }
      else if (e instanceof SecurityException) {
        System.out.println("not allowed to open file " + name );
      }
      else {
        System.out.println(e.toString() + "unexpected exception" );
      }
    }
    return rslt;
  } // openStream


  /**
    setSize
<p>
    Set the size of the double_vec.  This
    function is useful if the size needs to
    be set to the nearest power of two less
    than or equal to the data size before getting
    the data as an array.  The wavelet algorithms
    do no work on arrays whose length is not 
    a power of two.
    
   */
  public void setSize( int size )
  {
    if (timeSeries != null) {
      timeSeries.set_size( size );
    }
  }  // setSize


  /**
    getSize

    Return the size of the double_vec.
   */
  public int getSize() {
    int size = 0;

    if (timeSeries != null) {
      size = timeSeries.length();
    }
    return size;
  } // getSize


  /**
    getArray
<p>
    Return the data in a double[] object.
   */
  public double[] getArray() {
    double[] dblArray = null;

    if (timeSeries != null) {
      int len = timeSeries.length();
      
      if (len > 0) {
	dblArray = new double[len];
	for (int i = 0; i < len; i++) {
	  dblArray[i] = timeSeries.elementAt( i );
	} // for
      }
    }

    return dblArray;
  } // getArray


  /**
   <p>
    <tt>tsRead</tt> constructor

   <p>
    The <tt>tsRead</tt> constructor is passed a file
    (or file name path) name.  If the open succeeds
    the time series will be read into the object.
    The time series is read into a double_vec object
    which is returned by the getDoubleVec() function.

   */
  public tsRead( String file_name )
  {
    if (openStream( file_name )) {
      time_series_read();
    }
  } // tsRead

} // tsRead

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美国产精品一区| 久久亚洲欧美国产精品乐播| 国产精品成人一区二区三区夜夜夜| 久久99这里只有精品| 欧美一级片在线观看| 欧美aaa在线| 精品国产百合女同互慰| 久久99精品国产| 国产精品午夜久久| 色伊人久久综合中文字幕| 亚洲一区二区精品久久av| 69久久99精品久久久久婷婷| 奇米精品一区二区三区在线观看 | 亚洲一区在线视频| 欧美老年两性高潮| 韩国v欧美v日本v亚洲v| 亚洲日本韩国一区| 欧美老年两性高潮| 国产不卡在线视频| 亚洲一区在线免费观看| 日韩亚洲欧美成人一区| 成人在线一区二区三区| 亚洲综合激情另类小说区| 日韩免费观看2025年上映的电影| 高清不卡一区二区| 亚洲成a人片在线不卡一二三区| 日韩免费一区二区三区在线播放| 成人动漫一区二区三区| 三级不卡在线观看| 国产精品三级久久久久三级| 欧美日韩成人在线一区| 成人一区二区三区视频在线观看| 亚洲一区二区三区四区不卡| 久久久久久一二三区| 欧美三级日本三级少妇99| 国产99精品视频| 日日夜夜精品视频天天综合网| 国产色产综合色产在线视频| 欧美日韩在线精品一区二区三区激情| 国产精品亚洲人在线观看| 亚洲大片一区二区三区| 国产精品二三区| 精品国产乱码久久久久久老虎| 色综合久久久久综合体桃花网| 激情五月婷婷综合| 亚洲午夜日本在线观看| 国产精品无遮挡| 久久综合色天天久久综合图片| 欧美视频在线一区| 93久久精品日日躁夜夜躁欧美| 狠狠色伊人亚洲综合成人| 午夜电影网亚洲视频| 亚洲色图视频网站| 国产日韩精品一区| 亚洲精品在线三区| 欧美精品粉嫩高潮一区二区| 99久久99久久精品国产片果冻 | 亚洲一级电影视频| 国产精品污www在线观看| 精品国产免费人成在线观看| 欧美性猛交xxxxxx富婆| 91日韩在线专区| 成人性视频免费网站| 国产一区二区日韩精品| 麻豆免费看一区二区三区| 香蕉久久一区二区不卡无毒影院| 亚洲欧美一区二区三区国产精品 | 欧美一区二区三区婷婷月色| 欧美色老头old∨ideo| 欧亚一区二区三区| 色综合久久天天综合网| 97se狠狠狠综合亚洲狠狠| 波多野结衣精品在线| 粉嫩aⅴ一区二区三区四区 | 成人av资源下载| 成人动漫视频在线| 99视频精品全部免费在线| eeuss鲁片一区二区三区在线观看 eeuss鲁片一区二区三区在线看 | 精品一区二区三区久久| 五月天激情综合网| 日韩成人伦理电影在线观看| 日本不卡中文字幕| 蜜桃一区二区三区在线观看| 美女mm1313爽爽久久久蜜臀| 激情图片小说一区| 国产乱码精品一品二品| 丰满岳乱妇一区二区三区| 国产99久久久国产精品免费看 | 成人av电影观看| 972aa.com艺术欧美| 91麻豆精品久久久久蜜臀| 色偷偷88欧美精品久久久| 在线观看www91| 欧美日韩精品欧美日韩精品一| 3d成人h动漫网站入口| 日韩欧美国产不卡| 久久精品一区蜜桃臀影院| 欧美国产日本韩| 一区二区在线电影| 日韩av网站免费在线| 九九久久精品视频| 大尺度一区二区| 欧美视频一区二区三区| 日韩欧美在线一区二区三区| 久久久久久综合| 亚洲黄色免费网站| 日本在线不卡视频一二三区| 国产成人精品aa毛片| 在线免费精品视频| 精品国产一区二区国模嫣然| 亚洲欧洲国产专区| 婷婷久久综合九色国产成人| 国产一区二区三区免费| 99re这里都是精品| 91精品国产免费| 国产精品美女久久久久久| 夜夜嗨av一区二区三区四季av| 蜜桃精品视频在线| 91视频免费播放| 欧美一区二区三区在线| 中文字幕制服丝袜成人av| 丝袜美腿亚洲综合| 懂色中文一区二区在线播放| 欧美探花视频资源| 国产日韩欧美精品电影三级在线| 洋洋av久久久久久久一区| 国产在线视频精品一区| 欧美日韩久久久久久| 国产精品午夜电影| 美国毛片一区二区| 欧美综合天天夜夜久久| 国产亚洲婷婷免费| 日本不卡123| 欧洲中文字幕精品| 国产目拍亚洲精品99久久精品| 视频在线在亚洲| 91久久精品网| 欧美国产成人精品| 极品美女销魂一区二区三区| 日本黄色一区二区| 国产精品国产精品国产专区不蜜 | 亚洲精品中文在线观看| 国产福利一区二区| 欧美成人国产一区二区| 亚洲国产成人高清精品| 波多野结衣中文一区| 久久久久久久综合日本| 精一区二区三区| 欧美系列日韩一区| 中文字幕在线播放不卡一区| 国产一二三精品| 欧美一区二区在线免费观看| 亚洲成人福利片| 在线欧美日韩国产| 亚洲最大色网站| 色狠狠综合天天综合综合| 国产精品久久久久久久久免费桃花| 国产一区福利在线| 26uuu精品一区二区| 欧美aaa在线| 日韩网站在线看片你懂的| 亚洲成人av资源| 欧美熟乱第一页| 亚洲成人自拍偷拍| 欧美精品免费视频| 日韩成人免费看| 日韩欧美一区二区视频| 免费观看一级欧美片| 欧美一个色资源| 激情综合色综合久久综合| 日韩一区二区免费视频| 免费成人美女在线观看.| 日韩片之四级片| 韩国女主播一区二区三区| 欧美精品一区二区三区高清aⅴ| 久久99国产精品久久99| 久久久久久久久岛国免费| 国产**成人网毛片九色| 中文幕一区二区三区久久蜜桃| 成人av网站免费观看| **欧美大码日韩| 欧美性一区二区| 婷婷久久综合九色国产成人| 日韩女优av电影在线观看| 国产米奇在线777精品观看| 国产亚洲女人久久久久毛片| 成人福利视频在线看| 一区二区在线电影| 欧美精品 国产精品| 精品无人码麻豆乱码1区2区 | jiyouzz国产精品久久| 国产精品伦理一区二区| 色综合咪咪久久| 免费观看成人鲁鲁鲁鲁鲁视频| 久久这里都是精品| 99re这里只有精品6| 五月激情综合婷婷| 国产欧美视频在线观看| 91久久国产综合久久| 欧美aaa在线|