AVL tree/Managed C++: Difference between revisions

Content added Content deleted
No edit summary
Line 162: Line 162:
generic<typename T>
generic<typename T>
Cloner<T>^ Cloner<T>::Invisible::get() { return gcnew DefaultNoCloner<T>(); }
Cloner<T>^ Cloner<T>::Invisible::get() { return gcnew DefaultNoCloner<T>(); }

public ref struct OutOfKeyOrderException : public Exception
public ref struct OutOfKeyOrderException : public Exception
{
{
Line 168: Line 169:
OutOfKeyOrderException() : Exception(message)
OutOfKeyOrderException() : Exception(message)
{
{
HelpLink = gcnew String("mail@BenedictBede.com");
HelpLink = gcnew String("Benedict@NNcNannara.net");
Source = gcnew String("StandardGenericLibrary Collections Subsystem");
Source = gcnew String("Calculus Subsystem");
}
}
};
};
Line 179: Line 180:
TreeInvalidParentException() : Exception(message)
TreeInvalidParentException() : Exception(message)
{
{
HelpLink = gcnew String("mail@BenedictBede.com");
HelpLink = gcnew String("Benedict@NNcNannara.net");
Source = gcnew String("StandardGenericLibrary Collections Subsystem");
Source = gcnew String("Calculus Subsystem");
}
}
};
};
Line 190: Line 191:
TreeOutOfBalanceException() : Exception(message)
TreeOutOfBalanceException() : Exception(message)
{
{
HelpLink = gcnew String("mail@BenedictBede.com");
HelpLink = gcnew String("Benedict@NNcNannara.net");
Source = gcnew String("StandardGenericLibrary Collections Subsystem");
Source = gcnew String("Calculus Subsystem");
}
}
};
};
Line 201: Line 202:
InvalidEmptyTreeException() : Exception(message)
InvalidEmptyTreeException() : Exception(message)
{
{
HelpLink = gcnew String("mail@BenedictBede.com");
HelpLink = gcnew String("Benedict@NNcNannara.net");
Source = gcnew String("StandardGenericLibrary Collections Subsystem");
Source = gcnew String("Calculus Subsystem");
}
}
};
};
Line 213: Line 214:
InvalidEndItemException() : Exception(message)
InvalidEndItemException() : Exception(message)
{
{
HelpLink = gcnew String("mail@BenedictBede.com");
HelpLink = gcnew String("Benedict@NNcNannara.net");
Source = gcnew String("StandardGenericLibrary Collections Subsystem");
Source = gcnew String("Calculus Subsystem");
}
}
};
};
Line 224: Line 225:
EntryAlreadyExistsException() : Exception(message)
EntryAlreadyExistsException() : Exception(message)
{
{
HelpLink = gcnew String("mail@BenedictBede.com");
HelpLink = gcnew String("Benedict@NNcNannara.net");
Source = gcnew String("StandardGenericLibrary Collections Subsystem");
Source = gcnew String("Calculus Subsystem");
}
}
};
};
Line 235: Line 236:
DifferentKeysException() : Exception(message)
DifferentKeysException() : Exception(message)
{
{
HelpLink = gcnew String("mail@BenedictBede.com");
HelpLink = gcnew String("Benedict@NNcNannara.net");
Source = gcnew String("StandardGenericLibrary Collections Subsystem");
Source = gcnew String("Calculus Subsystem");
}
}
};
};
Line 246: Line 247:
AddSubTreeFailedException() : Exception(message)
AddSubTreeFailedException() : Exception(message)
{
{
HelpLink = gcnew String("mail@BenedictBede.com");
HelpLink = gcnew String("Benedict@NNcNannara.net");
Source = gcnew String("StandardGenericLibrary Collections Subsystem");
Source = gcnew String("Calculus Subsystem");
}
}
};
};
Line 257: Line 258:
IsEndItemException() : Exception(message)
IsEndItemException() : Exception(message)
{
{
HelpLink = gcnew String("mail@BenedictBede.com");
HelpLink = gcnew String("Benedict@NNcNannara.net");
Source = gcnew String("ISharp Collections Subsystem");
Source = gcnew String("Calculus Subsystem");
}
}
};
};
Line 268: Line 269:
EntryNotFoundException() : Exception(message)
EntryNotFoundException() : Exception(message)
{
{
HelpLink = gcnew String("mail@BenedictBede.com");
HelpLink = gcnew String("Benedict@NNcNannara.net");
Source = gcnew String("StandardGenericLibrary Collections Subsystem");
Source = gcnew String("Calculus Subsystem");
}
}
};
};
Line 279: Line 280:
InvalidSetOperationException() : Exception(message)
InvalidSetOperationException() : Exception(message)
{
{
HelpLink = gcnew String("mail@BenedictBede.com");
HelpLink = gcnew String("Benedict@NNcNannara.net");
Source = gcnew String("StandardGenericLibrary Collections Subsystem");
Source = gcnew String("Calculus Subsystem");
}
}
};
};
Line 1,013: Line 1,014:
Header = gcnew Node();
Header = gcnew Node();
TComparer = System::Collections::Generic::Comparer<T>::Default;
TComparer = System::Collections::Generic::Comparer<T>::Default;
TCloner = ISharp::Cloner<T>::Default;
TCloner = Calculus::Cloner<T>::Default;
THasher = ISharp::Hasher<T>::Default;
THasher = Calculus::Hasher<T>::Default;
}
}


Line 1,022: Line 1,023:
Header = gcnew Node();
Header = gcnew Node();
TComparer = TCompare;
TComparer = TCompare;
TCloner = ISharp::Cloner<T>::Default;
TCloner = Calculus::Cloner<T>::Default;
THasher = ISharp::Hasher<T>::Default;
THasher = Calculus::Hasher<T>::Default;
}
}


Line 1,041: Line 1,042:
Header = gcnew Node();
Header = gcnew Node();
TComparer = System::Collections::Generic::Comparer<T>::Default;
TComparer = System::Collections::Generic::Comparer<T>::Default;
TCloner = ISharp::Cloner<T>::Default;
TCloner = Calculus::Cloner<T>::Default;
THasher = ISharp::Hasher<T>::Default;
THasher = Calculus::Hasher<T>::Default;


for each (T t in Collection) Add(TCloner->Clone(t));
for each (T t in Collection) Add(TCloner->Clone(t));
Line 1,052: Line 1,053:
Header = gcnew Node();
Header = gcnew Node();
TComparer = System::Collections::Generic::Comparer<T>::Default;
TComparer = System::Collections::Generic::Comparer<T>::Default;
TCloner = ISharp::Cloner<T>::Default;
TCloner = Calculus::Cloner<T>::Default;
THasher = ISharp::Hasher<T>::Default;
THasher = Calculus::Hasher<T>::Default;


for each (T t in Collection) Add(TCloner->Clone(t));
for each (T t in Collection) Add(TCloner->Clone(t));
Line 1,064: Line 1,065:
Header = gcnew Node();
Header = gcnew Node();
TComparer = TCompare;
TComparer = TCompare;
TCloner = ISharp::Cloner<T>::Default;
TCloner = Calculus::Cloner<T>::Default;
THasher = ISharp::Hasher<T>::Default;
THasher = Calculus::Hasher<T>::Default;
for each (T t in Collection) Add(TCloner->Clone(t));
for each (T t in Collection) Add(TCloner->Clone(t));
Line 1,086: Line 1,087:
Nodes=0;
Nodes=0;
System::Collections::Generic::IComparer<T>^ TCompare = (System::Collections::Generic::IComparer<T>^)si->GetValue("TComparer", System::Collections::Generic::IComparer<T>::typeid);
System::Collections::Generic::IComparer<T>^ TCompare = (System::Collections::Generic::IComparer<T>^)si->GetValue("TComparer", System::Collections::Generic::IComparer<T>::typeid);
ISharp::ICloner<T>^ TClone = (ISharp::ICloner<T>^)si->GetValue("TCloner", ICloner<T>::typeid);
Calculus::ICloner<T>^ TClone = (Calculus::ICloner<T>^)si->GetValue("TCloner", ICloner<T>::typeid);
ISharp::IHasher<T>^ THasher = (ISharp::IHasher<T>^)si->GetValue("THasher", IHasher<T>::typeid);
Calculus::IHasher<T>^ THasher = (Calculus::IHasher<T>^)si->GetValue("THasher", IHasher<T>::typeid);


Header = gcnew Node();
Header = gcnew Node();
Line 1,393: Line 1,394:
virtual void GetObjectData(SerializationInfo^ si, StreamingContext sc)
virtual void GetObjectData(SerializationInfo^ si, StreamingContext sc)
{
{
si->SetType(ISharp::Set<T>::typeid);
si->SetType(Calculus::Set<T>::typeid);


Type^ type = T::typeid;
Type^ type = T::typeid;
Line 2,012: Line 2,013:
{
{
System::Collections::Generic::IComparer<T>^ TComparer = R->TComparer;
System::Collections::Generic::IComparer<T>^ TComparer = R->TComparer;
ISharp::ICloner<T>^ TCloner = R->TCloner;
Calculus::ICloner<T>^ TCloner = R->TCloner;


SetEntry<T> first1 = A->Begin;
SetEntry<T> first1 = A->Begin;
Line 2,244: Line 2,245:
}
}


using namespace ISharp;
using namespace Calculus;


int main(array<System::String ^> ^args)
int main(array<System::String ^> ^args)