/* ====================================================================
Licensed to the Apache Software Foundation (ASF) Under one or more
contributor license agreements. See the NOTICE file distributed with
this work for Additional information regarding copyright ownership.
The ASF licenses this file to You Under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed Under the License is distributed on an "AS Is" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations Under the License.
==================================================================== */
namespace HH.WMS.Utils.NPOI.HSSF.UserModel
{
using System;
using System.Text;
using System.Collections;
/**
* Instances of this class keep track of multiple dependent cell evaluations due
* to recursive calls to
*/
private class CellEvaluationFrame
{
private HSSFWorkbook _workbook;
private HSSFSheet _sheet;
private int _srcRowNum;
private int _srcColNum;
public CellEvaluationFrame(HSSFWorkbook workbook, HSSFSheet sheet, int srcRowNum, int srcColNum)
{
if (workbook == null)
{
throw new ArgumentException("workbook must not be null");
}
if (sheet == null)
{
throw new ArgumentException("sheet must not be null");
}
_workbook = workbook;
_sheet = sheet;
_srcRowNum = srcRowNum;
_srcColNum = srcColNum;
}
public override bool Equals(Object obj)
{
CellEvaluationFrame other = (CellEvaluationFrame)obj;
if (_workbook != other._workbook)
{
return false;
}
if (_sheet != other._sheet)
{
return false;
}
if (_srcRowNum != other._srcRowNum)
{
return false;
}
if (_srcColNum != other._srcColNum)
{
return false;
}
return true;
}
public override int GetHashCode ()
{
return _workbook.GetHashCode () ^ _sheet.GetHashCode () ^
_srcRowNum ^ _srcColNum;
}
/**
* @return human Readable string for debug purposes
*/
public String FormatAsString()
{
return "R=" + _srcRowNum + " C=" + _srcColNum + " ShIx=" + _workbook.GetSheetIndex(_sheet);
}
public override String ToString()
{
StringBuilder sb = new StringBuilder(64);
sb.Append(GetType().Name).Append(" [");
sb.Append(FormatAsString());
sb.Append("]");
return sb.ToString();
}
}
private IList _evaluationFrames;
public EvaluationCycleDetector()
{
_evaluationFrames = new ArrayList();
}
/**
* Notifies this evaluation tracker that evaluation of the specified cell Is
* about to start.
*
* In the case of a
*
* In the case of a
* @return