private TuplesWithNameTable updateTuplesByCond(Condition cond, ArrayList<AttrAssign> attrAssignList, ArrayList<Integer> PrimaryKeyList, TuplesWithNameTable tuples){
		Hashtable<String, Integer> nameTable = tuples.getNameTable();
		//Tuple list will be modified directly
		ArrayList< ArrayList<Value> > tupleList = tuples.getTupleList();
			

		//Check primary key list
		//NOT FINISHED!

		ArrayList<Value> firstTuple = tupleList.get(0);

		//Check update values type
		for(AttrAssign attrAssign : attrAssignList){
			Value updatingValue = attrAssign.getValue();
			String valueName = attrAssign.getAttrName();
			Integer valuePos = nameTable.get(valueName);
			
			Value currentValue = firstTuple.get(valuePos.intValue());
			if(currentValue.getType() != updatingValue.getType()){
				throw new Error("UPDATE: Updating Value " + valueName + " has invalid type");
			}
		}
		
		int updatedValueNum = 0;
		//If no update condition, update all values
		if(cond == null){
			for(ArrayList<Value> tuple : tupleList){
				for(AttrAssign attrAssign : attrAssignList){
					String attrName = attrAssign.getAttrName();
					Integer attrPos = nameTable.get(attrName);

					tuple.set(attrPos.intValue(), attrAssign.getValue());
					
				}
				updatedValueNum++; //Update tuple num
			}
		}else{
			//Evaluate condition and update tuples that satisfies the condition
			Exp exp = cond.getExp();
			Object ret;

			for(ArrayList<Value> tuple : tupleList){
				ret = exp.accept(this, nameTable, tuple);
				
				if(ret instanceof Boolean){
					if( ((Boolean) ret).booleanValue() == true ){
						for(AttrAssign attrAssign : attrAssignList){
							String attrName = attrAssign.getAttrName();
							Value updatedValue = attrAssign.getValue();
							
							int namePos = nameTable.get(attrName).intValue();
							tuple.set(namePos, updatedValue);
							
						}
						updatedValueNum++; //Update tuple num
					}
				}
			}
			
		}

		TuplesWithNameTable tupleTable = new TuplesWithNameTable(nameTable, tupleList);
		tupleTable.setUpdatedTuplesNum(updatedValueNum);

		return tupleTable;

	}