data.java

来自「数据挖掘算法的实现」· Java 代码 · 共 32 行

JAVA
32
字号
import java.util.StringTokenizer;

public class Data 
{
     public double data [] = new double[37];
     public String type = null;
     
     public  Data(float a[],int n,String s)     
     {
    	 for(int i = 0;i < n;i++)
    		 this.data[i] = a[i];
    	 type = s;
     }
     public Data(String s)
     {
    	 String tempbuffer = new String(); 
         StringTokenizer analyse = new StringTokenizer(s,",");
         int n = analyse.countTokens();//n = 10
 		for(int k = 0;k < n-1;k++)
 		{
 			tempbuffer = analyse.nextToken();
 			this.data[k] = Float.parseFloat(tempbuffer);
 		}
 		tempbuffer = analyse.nextToken();
 		this.type = tempbuffer;	
     }
     public Data()
     {
    	 
     }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?