#include "StdAfx.h" #include "T2TempPluginComparator.h" #include "T2TenantDef.h" #include "T2ToolDef.h" #include "T2ToolDefList.h" T2ToolDefList::T2ToolDefList(int inCategory) : LArray(sizeof(T2TemplatePlugin *)) { mCategory = inCategory; SetComparator(T2TempPluginComparator::GetComparator()); mOwnsComparator = false; SetKeepSorted(true); mCurrentItem = 1; mCurrentVariant = 0; } /*virtual*/ T2ToolDefList::~T2ToolDefList() { } void T2ToolDefList::AllClear() { RemoveItemsAt(mItemCount, 1); } void T2ToolDefList::Regist(T2ToolDef* inToolDef) { InsertItemsAt(1, mItemCount + 1, &inToolDef); } void T2ToolDefList::Add(T2ToolDef* inToolDef) { if (!inToolDef) return; LArrayIterator iterator(*this); T2ToolDef *theToolDef; BOOL done = false; int n = 1; while (!done && iterator.Next(&theToolDef)) { if (theToolDef->GetToolNo() < inToolDef->GetToolNo()) { InsertItemsAt(1, n, &inToolDef); done = true; } n++; } if (!done) InsertItemsAt(1, n, &inToolDef); } unsigned int T2ToolDefList::GetItemCount() { return GetCount(); } T2ToolDef* T2ToolDefList::GetItemAt(int inIndex) { T2ToolDef *theToolDef; if (FetchItemAt(inIndex, &theToolDef)) return theToolDef; else return NULL; } T2TenantDef* T2ToolDefList::FindFloor() { T2ToolDef *theTool; LArrayIterator iterator(*this); while (iterator.Next(&theTool)) { if (theTool->IsTenant() && ((T2TenantDef *) theTool)->IsFloor()) return (T2TenantDef *) theTool; } return NULL; } T2TenantDef* T2ToolDefList::FindTenantDef(int inToolType) { T2ToolDef *theTool; LArrayIterator iterator(*this); while (iterator.Next(&theTool)) { if (theTool->IsTenant() && theTool->GetToolType() == inToolType) return (T2TenantDef *) theTool; } return NULL; } T2MoverDef* T2ToolDefList::FindMoverDef(int inToolType) { T2ToolDef *theTool; LArrayIterator iterator(*this); while (iterator.Next(&theTool)) { if (theTool->IsMover() && theTool->GetToolType() == inToolType) return (T2MoverDef *) theTool; } return NULL; }