update.java

来自「一个用java编写的从底层开始设计的小型数据库管理系统」· Java 代码 · 共 51 行

JAVA
51
字号
package executionengine;import compiler.Attribute;import compiler.Caculate;import dataitem.DataItem;import recordmanagement.Tuple;public class Update implements Operation {	private Attribute[] attributeList;	private Object[] dataList;	private Operation belowOpr = null;		public Update(Attribute[] att, Object[] obj, Operation opr){		attributeList = att;		dataList = obj;		belowOpr = opr;	}	public void open() {		belowOpr.open();	}		public boolean hasNext() {		return belowOpr.hasNext();	}		public Tuple getNext() {		Tuple tempTuple = belowOpr.getNext();		for(int i = 0; i< dataList.length; i++){			if(dataList[i] instanceof DataItem){				tempTuple.setItem(attributeList[i].attIndex, (DataItem)dataList[i]);			}else{				DataItem tempItem = ((Caculate)dataList[i]).getResult(tempTuple);				tempTuple.setItem(attributeList[i].attIndex, tempItem);			}		}		return tempTuple;	}	public void close() {	}	public Attribute[] getAttributeList() {				return belowOpr.getAttributeList();	}	 } 

⌨️ 快捷键说明

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