goodsrecord.java

来自「一个简单的商品采集系统」· Java 代码 · 共 48 行

JAVA
48
字号
//The definition of each record.//Here I give each record default 10 attributes import java.io.*;//Authough the private variables are instances and the Objects have implemented //the 'Serializable' it also need to do again here.public class GoodsRecord implements Serializable {		private GoodsField[] gfield;	private int count;	private final int DEFAULT_COUNT = 10;		public GoodsRecord ()	{		count = DEFAULT_COUNT;		GoodsField dgfield[] = new GoodsField[ count ];		for ( int i = 0; i < count; i++ )		   dgfield = null;		setGoodsRecord( dgfield );	}		public GoodsRecord ( GoodsField gf[] )	{		count = gf.length;		setGoodsRecord( gf );	}		public void setGoodsRecord ( GoodsField gf[] )	{		gfield = new GoodsField[ count ];//here waste so much time!!!!!Forget the initialize!		for( int i = 0; i < count; i++ )		   gfield[ i ] = gf[ i ];	}		public GoodsField[] getGoodsRecord ()	{		return gfield;	}		public String toString ()	{		String re = "";		for ( int i = 0; i < count; i++ )		   re += gfield[ i ];		return re;	}}

⌨️ 快捷键说明

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