SNAP Library , Developer Reference
2013-01-07 14:03:36
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
#include <shash.h>
Public Types | |
typedef THashSetKeyI< TKey > | TIter |
Public Member Functions | |
THashSet () | |
THashSet (const THashSet &Set) | |
THashSet (const int &ExpectVals, const bool &_AutoSizeP=false) | |
THashSet (const TVec< TKey > &KeyV) | |
THashSet (TSIn &SIn) | |
void | Load (TSIn &SIn) |
void | Save (TSOut &SOut) const |
void | LoadXml (const PXmlTok &XmlTok, const TStr &Nm="") |
void | SaveXml (TSOut &SOut, const TStr &Nm) |
THashSet & | operator= (const THashSet &Set) |
bool | operator== (const THashSet &Set) const |
const TKey & | operator[] (const int &KeyId) const |
TKey & | operator[] (const int &KeyId) |
::TSize | GetMemUsed () const |
TIter | BegI () const |
TIter | EndI () const |
TIter | GetI (const TKey &Key) const |
void | Gen (const int &ExpectVals) |
void | Clr (const bool &DoDel=true, const int &NoDelLim=-1) |
bool | Empty () const |
int | Len () const |
int | GetPorts () const |
bool | IsAutoSize () const |
int | GetMxKeyIds () const |
int | GetReservedKeyIds () const |
bool | IsKeyIdEqKeyN () const |
int | AddKey (const TKey &Key) |
void | AddKeyV (const TVec< TKey > &KeyV) |
void | DelKey (const TKey &Key) |
void | DelIfKey (const TKey &Key) |
void | DelKeyId (const int &KeyId) |
void | DelKeyIdV (const TIntV &KeyIdV) |
void | MarkDelKey (const TKey &Key) |
void | MarkDelKeyId (const int &KeyId) |
const TKey & | GetKey (const int &KeyId) const |
int | GetKeyId (const TKey &Key) const |
int | GetRndKeyId (TRnd &Rnd) const |
bool | IsKey (const TKey &Key) const |
bool | IsKey (const TKey &Key, int &KeyId) const |
bool | IsKeyId (const int &KeyId) const |
int | FFirstKeyId () const |
bool | FNextKeyId (int &KeyId) const |
void | GetKeyV (TVec< TKey > &KeyV) const |
void | Swap (THashSet &Set) |
void | Defrag () |
void | Pack () |
Static Public Member Functions | |
static THashSet< TKey > | GetSet (const TKey &Key1) |
static THashSet< TKey > | GetSet (const TKey &Key1, const TKey &Key2) |
static THashSet< TKey > | GetSet (const TKey &Key1, const TKey &Key2, const TKey &Key3) |
static THashSet< TKey > | GetSet (const TKey &Key1, const TKey &Key2, const TKey &Key3, const TKey &Key4) |
static THashSet< TKey > | GetSet (const TKey &Key1, const TKey &Key2, const TKey &Key3, const TKey &Key4, const TKey &Key5) |
static THashSet< TKey > | GetSet (const TKey &Key1, const TKey &Key2, const TKey &Key3, const TKey &Key4, const TKey &Key5, const TKey &Key6) |
static THashSet< TKey > | GetSet (const TKey &Key1, const TKey &Key2, const TKey &Key3, const TKey &Key4, const TKey &Key5, const TKey &Key6, const TKey &Key7) |
static THashSet< TKey > | GetSet (const TKey &Key1, const TKey &Key2, const TKey &Key3, const TKey &Key4, const TKey &Key5, const TKey &Key6, const TKey &Key7, const TKey &Key8) |
static THashSet< TKey > | GetSet (const TKey &Key1, const TKey &Key2, const TKey &Key3, const TKey &Key4, const TKey &Key5, const TKey &Key6, const TKey &Key7, const TKey &Key8, const TKey &Key9) |
Private Types | |
typedef THashSetKey< TKey > | TSetKey |
Private Member Functions | |
TSetKey & | GetSetKey (const int &KeyId) |
const TSetKey & | GetSetKey (const int &KeyId) const |
uint | GetNextPrime (const uint &Val) const |
void | Resize () |
Private Attributes | |
TIntV | PortV |
TVec< TSetKey > | KeyV |
TBool | AutoSizeP |
TInt | FFreeKeyId |
TInt | FreeKeys |
typedef THashSetKeyI<TKey> THashSet< TKey, THashFunc >::TIter |
typedef THashSetKey<TKey> THashSet< TKey, THashFunc >::TSetKey [private] |
THashSet< TKey, THashFunc >::THashSet | ( | const int & | ExpectVals, |
const bool & | _AutoSizeP = false |
||
) |
Definition at line 1210 of file shash.h.
References THashSet< TKey, THashFunc >::PortV, and TVec< TVal >::PutAll().
: PortV(GetNextPrime(ExpectVals/2+1)), KeyV(ExpectVals, 0), AutoSizeP(_AutoSizeP), FFreeKeyId(-1), FreeKeys(0) { PortV.PutAll(TInt(-1)); }
THashSet< TKey, THashFunc >::THashSet | ( | const TVec< TKey > & | KeyV | ) | [explicit] |
Definition at line 1217 of file shash.h.
References THashSet< TKey, THashFunc >::AddKey(), TVec< TVal >::Len(), THashSet< TKey, THashFunc >::PortV, and TVec< TVal >::PutAll().
: PortV(GetNextPrime(_KeyV.Len()/2+1)), KeyV(_KeyV.Len(), 0), AutoSizeP(false), FFreeKeyId(-1), FreeKeys(0) { PortV.PutAll(TInt(-1)); for (int i = 0; i < _KeyV.Len(); i++) { AddKey(_KeyV[i]); } }
Definition at line 1247 of file shash.h.
Referenced by TLocClustStat::BagOfWhiskers(), TUndirFFire::BurnGeoFire(), TNetConstraint< PGraph >::CalcConstraints(), TSnap::CntEdgesToSet(), TSnap::CntUniqDirEdges(), TSnap::CntUniqUndirEdges(), TSnap::ConvertGraph(), TSnap::TSnapDetail::TGetSubGraph< PGraph, false >::Do(), TSnap::TSnapDetail::TConvertSubGraph< POutGraph, PInGraph, IsMultiGraph >::Do(), TSnap::TSnapDetail::TConvertSubGraph< POutGraph, PInGraph, false >::Do(), TArtPointVisitor::FinishNode(), TBiConVisitor::FinishNode(), TSnap::GenConfModel(), TSnap::GenPrefAttach(), TSnap::GenRewire(), TSnap::GenSmallWorld(), TSnap::Get1CnCom(), TSnap::Get1CnComSzCnt(), TTimeNENet::Get1stEdgeNet(), TSnap::GetCmnNbrs(), TLocClust::GetCutStat(), TSnap::GetEdgeBridges(), TSnap::GetEdgesInOut(), TLocClustStat::TCutInfo::GetFracDegOut(), TCliqueOverlap::GetIntersection(), TCliqueOverlap::GetMaximalCliques(), TSnap::GetModularity(), TCliqueOverlap::GetNbrs(), TSnap::GetNodeTriads(), TTimeNENet::GetPrefAttach(), TCliqueOverlap::GetRelativeComplement(), THashSet< TInt >::GetSet(), TSnap::GetSubGraph(), TBigNet< TNodeData, IsDir >::GetSubGraph(), TSnap::GetTriadEdges(), TSnap::GetTriads(), TNodeEdgeNet< TNodeData, TEdgeData >::GetUniqEdges(), TSnap::GetWccs(), TSnap::GetWccSzCnt(), TSnap::LoadDyNet(), TSnap::LoadDyNetGraphV(), THashSet< TInt >::LoadXml(), TLocClustStat::PlotNCPScatter(), TGnuPlot::PlotValMomH(), TAGM::RndConnectInsideCommunity(), TLocClustStat::Run(), TTimeNENet::SaveEdgeTm(), TSnap::SaveMatlabSparseMtx(), TGStatVec::SaveTxt(), TGraphKey::TakeGraph(), and THashSet< TKey, THashFunc >::THashSet().
{ if ((KeyV.Len()>2*PortV.Len())||PortV.Empty()) {Resize(); } int PortN=abs(THashFunc::GetPrimHashCd(Key)%PortV.Len()); int HashCd=abs(THashFunc::GetSecHashCd(Key)); int PrevKeyId=-1; int KeyId=PortV[PortN]; while ((KeyId!=-1) && !((KeyV[KeyId].HashCd==HashCd) && (KeyV[KeyId].Key==Key))) { PrevKeyId=KeyId; KeyId=KeyV[KeyId].Next; } if (KeyId==-1) { if (FFreeKeyId==-1) { KeyId=KeyV.Add(TSetKey(-1, HashCd, Key)); } else { KeyId=FFreeKeyId; FFreeKeyId=KeyV[FFreeKeyId].Next; FreeKeys--; KeyV[KeyId].Next = -1; KeyV[KeyId].HashCd = HashCd; KeyV[KeyId].Key = Key; } if (PrevKeyId==-1) { PortV[PortN]=KeyId; } else { KeyV[PrevKeyId].Next=KeyId; } } return KeyId; }
void THashSet< TKey, THashFunc >::AddKeyV | ( | const TVec< TKey > & | KeyV | ) |
Definition at line 1277 of file shash.h.
References TVec< TVal >::Len().
Referenced by TCliqueOverlap::GetCPMCommunities().
TIter THashSet< TKey, THashFunc >::BegI | ( | ) | const [inline] |
Definition at line 1098 of file shash.h.
Referenced by TCliqueOverlap::GetIntersection(), TCliqueOverlap::GetNodeIdWithMaxDeg(), TCliqueOverlap::GetRelativeComplement(), TCliqueOverlap::Intersection(), and TCliqueOverlap::MaxNbrsInCANDNodeId().
{ if (Len()>0) { if (IsKeyIdEqKeyN()) { return TIter(KeyV.BegI(), KeyV.EndI()); } int FKeyId=-1; FNextKeyId(FKeyId); return TIter(KeyV.BegI()+FKeyId, KeyV.EndI()); } return TIter(KeyV.EndI(), KeyV.EndI()); }
void THashSet< TKey, THashFunc >::Clr | ( | const bool & | DoDel = true , |
const int & | NoDelLim = -1 |
||
) |
Definition at line 1236 of file shash.h.
Referenced by TUndirFFire::BurnGeoFire(), TSnap::CntUniqDirEdges(), TSnap::CntUniqUndirEdges(), TCliqueOverlap::Expand(), TBiConVisitor::FinishNode(), TSnap::GenPrefAttach(), TCliqueOverlap::GetCPMCommunities(), TTimeNENet::GetPrefAttach(), TSnap::GetTriadEdges(), TSnap::GetTriads(), TSnap::GetWccs(), and TLocClustStat::Run().
{ if (DoDel) { PortV.Clr(); KeyV.Clr(); } else { PortV.PutAll(TInt(-1)); KeyV.Clr(DoDel, NoDelLim); } FFreeKeyId=TInt(-1); FreeKeys=TInt(0); }
Definition at line 1359 of file shash.h.
References IAssert.
Referenced by TSnap::TSnapDetail::TGetSubGraph< PGraph, false >::Do(), and THashSet< TInt >::SaveXml().
{ if (!IsKeyIdEqKeyN()) { THashSet<TKey> Set(PortV.Len()); int KeyId=FFirstKeyId(); TKey Key; while (FNextKeyId(KeyId)) { GetKey(KeyId, Key); Set.AddKey(Key); } Pack(); operator=(Set); IAssert(IsKeyIdEqKeyN()); } }
Definition at line 1282 of file shash.h.
References IAssert, and IAssertR.
Referenced by THashSet< TInt >::DelKeyId(), and TCliqueOverlap::Expand().
{ IAssert(!PortV.Empty()); int PortN=abs(THashFunc::GetPrimHashCd(Key)%PortV.Len()); int HashCd=abs(THashFunc::GetSecHashCd(Key)); int PrevKeyId=-1; int KeyId=PortV[PortN]; while ((KeyId!=-1) && !((KeyV[KeyId].HashCd==HashCd) && (KeyV[KeyId].Key==Key))) { PrevKeyId=KeyId; KeyId=KeyV[KeyId].Next; } IAssertR(KeyId!=-1, Key.GetStr()); if (PrevKeyId==-1) {PortV[PortN]=KeyV[KeyId].Next; } else {KeyV[PrevKeyId].Next=KeyV[KeyId].Next; } KeyV[KeyId].Next=FFreeKeyId; FFreeKeyId=KeyId; FreeKeys++; KeyV[KeyId].HashCd=TInt(-1); KeyV[KeyId].Key=TKey(); }
void THashSet< TKey, THashFunc >::DelKeyId | ( | const int & | KeyId | ) | [inline] |
Definition at line 1127 of file shash.h.
Referenced by THashSet< TInt >::DelIfKey(), THashSet< TInt >::DelKeyIdV(), and TSnap::GenRewire().
bool THashSet< TKey, THashFunc >::Empty | ( | ) | const [inline] |
Definition at line 1113 of file shash.h.
Referenced by TSnap::GetNodeTriads(), and TLocClustStat::Run().
{return Len()==0; }
TIter THashSet< TKey, THashFunc >::EndI | ( | ) | const [inline] |
Definition at line 1105 of file shash.h.
Referenced by TCliqueOverlap::GetIntersection(), TCliqueOverlap::GetNodeIdWithMaxDeg(), TCliqueOverlap::GetRelativeComplement(), TCliqueOverlap::Intersection(), and TCliqueOverlap::MaxNbrsInCANDNodeId().
int THashSet< TKey, THashFunc >::FFirstKeyId | ( | ) | const [inline] |
bool THashSet< TKey, THashFunc >::FNextKeyId | ( | int & | KeyId | ) | const |
void THashSet< TKey, THashFunc >::Gen | ( | const int & | ExpectVals | ) | [inline] |
Definition at line 1108 of file shash.h.
Referenced by TBigNet< TNodeData, IsDir >::GetSubGraph(), TSnap::GetWccs(), and TTimeNENet::SaveEdgeTm().
{ PortV.Gen(GetNextPrime(ExpectVals/2)); KeyV.Gen(ExpectVals, 0); FFreeKeyId=-1; FreeKeys=0; PortV.PutAll(TInt(-1)); }
const TKey& THashSet< TKey, THashFunc >::GetKey | ( | const int & | KeyId | ) | const [inline] |
Definition at line 1134 of file shash.h.
Referenced by THashSet< TInt >::DelKeyId(), TSnap::GetNodeTriads(), TSnap::GetTriads(), and THashSet< TInt >::MarkDelKeyId().
int THashSet< TKey, THashFunc >::GetKeyId | ( | const TKey & | Key | ) | const |
Definition at line 1321 of file shash.h.
Referenced by THashSet< TInt >::GetI(), TBigNet< TNodeData, IsDir >::GetSubGraph(), THashSet< TInt >::IsKey(), TSnap::LoadDyNet(), TSnap::LoadDyNetGraphV(), TTimeNENet::SaveEdgeTm(), and TGraphKey::TakeGraph().
{ if (PortV.Empty()) {return -1; } int PortN=abs(THashFunc::GetPrimHashCd(Key)%PortV.Len()); int HashCd=abs(THashFunc::GetSecHashCd(Key)); int KeyId=PortV[PortN]; while ((KeyId!=-1) && !((KeyV[KeyId].HashCd==HashCd) && (KeyV[KeyId].Key==Key))) { KeyId=KeyV[KeyId].Next; } return KeyId; }
void THashSet< TKey, THashFunc >::GetKeyV | ( | TVec< TKey > & | KeyV | ) | const |
Definition at line 1340 of file shash.h.
References TVec< TVal >::Add(), and TVec< TVal >::Clr().
Referenced by TBiConVisitor::FinishNode(), TCliqueOverlap::GetCPMCommunities(), TSnap::GetEdgeBridges(), TLocClustStat::PlotNCPScatter(), and TGStatVec::SaveTxt().
{ KeyV.Clr(); int KeyId=FFirstKeyId(); while (FNextKeyId(KeyId)) { KeyV.Add(GetKey(KeyId)); } }
::TSize THashSet< TKey, THashFunc >::GetMemUsed | ( | ) | const [inline] |
Definition at line 1095 of file shash.h.
{ return PortV.GetMemUsed() + KeyV.GetMemUsed() + sizeof(bool) + 2*sizeof(int); }
int THashSet< TKey, THashFunc >::GetMxKeyIds | ( | ) | const [inline] |
uint THashSet< TKey, THashFunc >::GetNextPrime | ( | const uint & | Val | ) | const [private] |
Definition at line 1177 of file shash.h.
References THash< TInt, TInt >::HashPrimes, and THash< TInt, TInt >::HashPrimeT.
Referenced by THashSet< TInt >::Gen().
{ uint* f=(uint*)TIntH::HashPrimeT, *m, *l=(uint*)TIntH::HashPrimeT + (int)TIntH::HashPrimes; int h, len = (int)TIntH::HashPrimes; while (len > 0) { h = len >> 1; m = f + h; if (*m < Val) { f = m; f++; len = len - h - 1; } else len = h; } return f == l ? *(l - 1) : *f; }
int THashSet< TKey, THashFunc >::GetReservedKeyIds | ( | ) | const [inline] |
int THashSet< TKey, THashFunc >::GetRndKeyId | ( | TRnd & | Rnd | ) | const [inline] |
Definition at line 1137 of file shash.h.
Referenced by TSnap::GenRewire().
{ IAssert(IsKeyIdEqKeyN()); IAssert(Len()>0); return Rnd.GetUniDevInt(Len()); }
static THashSet<TKey> THashSet< TKey, THashFunc >::GetSet | ( | const TKey & | Key1 | ) | [inline, static] |
Definition at line 1155 of file shash.h.
{ THashSet<TKey> Set(1); Set.AddKey(Key1); return Set;}
static THashSet<TKey> THashSet< TKey, THashFunc >::GetSet | ( | const TKey & | Key1, |
const TKey & | Key2 | ||
) | [inline, static] |
Definition at line 1157 of file shash.h.
{ THashSet<TKey> Set(2); Set.AddKey(Key1); Set.AddKey(Key2); return Set;}
static THashSet<TKey> THashSet< TKey, THashFunc >::GetSet | ( | const TKey & | Key1, |
const TKey & | Key2, | ||
const TKey & | Key3 | ||
) | [inline, static] |
Definition at line 1159 of file shash.h.
{ THashSet<TKey> Set(3); Set.AddKey(Key1); Set.AddKey(Key2); Set.AddKey(Key3); return Set;}
static THashSet<TKey> THashSet< TKey, THashFunc >::GetSet | ( | const TKey & | Key1, |
const TKey & | Key2, | ||
const TKey & | Key3, | ||
const TKey & | Key4 | ||
) | [inline, static] |
Definition at line 1161 of file shash.h.
{ THashSet<TKey> Set(4); Set.AddKey(Key1); Set.AddKey(Key2); Set.AddKey(Key3); Set.AddKey(Key4); return Set;}
static THashSet<TKey> THashSet< TKey, THashFunc >::GetSet | ( | const TKey & | Key1, |
const TKey & | Key2, | ||
const TKey & | Key3, | ||
const TKey & | Key4, | ||
const TKey & | Key5 | ||
) | [inline, static] |
Definition at line 1163 of file shash.h.
{ THashSet<TKey> Set(5); Set.AddKey(Key1); Set.AddKey(Key2); Set.AddKey(Key3); Set.AddKey(Key4); Set.AddKey(Key5); return Set;}
static THashSet<TKey> THashSet< TKey, THashFunc >::GetSet | ( | const TKey & | Key1, |
const TKey & | Key2, | ||
const TKey & | Key3, | ||
const TKey & | Key4, | ||
const TKey & | Key5, | ||
const TKey & | Key6 | ||
) | [inline, static] |
Definition at line 1165 of file shash.h.
{ THashSet<TKey> Set(6); Set.AddKey(Key1); Set.AddKey(Key2); Set.AddKey(Key3); Set.AddKey(Key4); Set.AddKey(Key5); Set.AddKey(Key6); return Set;}
static THashSet<TKey> THashSet< TKey, THashFunc >::GetSet | ( | const TKey & | Key1, |
const TKey & | Key2, | ||
const TKey & | Key3, | ||
const TKey & | Key4, | ||
const TKey & | Key5, | ||
const TKey & | Key6, | ||
const TKey & | Key7 | ||
) | [inline, static] |
Definition at line 1167 of file shash.h.
{ THashSet<TKey> Set(7); Set.AddKey(Key1); Set.AddKey(Key2); Set.AddKey(Key3); Set.AddKey(Key4); Set.AddKey(Key5); Set.AddKey(Key6); Set.AddKey(Key7); return Set;}
static THashSet<TKey> THashSet< TKey, THashFunc >::GetSet | ( | const TKey & | Key1, |
const TKey & | Key2, | ||
const TKey & | Key3, | ||
const TKey & | Key4, | ||
const TKey & | Key5, | ||
const TKey & | Key6, | ||
const TKey & | Key7, | ||
const TKey & | Key8 | ||
) | [inline, static] |
Definition at line 1169 of file shash.h.
{ THashSet<TKey> Set(8); Set.AddKey(Key1); Set.AddKey(Key2); Set.AddKey(Key3); Set.AddKey(Key4); Set.AddKey(Key5); Set.AddKey(Key6); Set.AddKey(Key7); Set.AddKey(Key8); return Set;}
static THashSet<TKey> THashSet< TKey, THashFunc >::GetSet | ( | const TKey & | Key1, |
const TKey & | Key2, | ||
const TKey & | Key3, | ||
const TKey & | Key4, | ||
const TKey & | Key5, | ||
const TKey & | Key6, | ||
const TKey & | Key7, | ||
const TKey & | Key8, | ||
const TKey & | Key9 | ||
) | [inline, static] |
Definition at line 1171 of file shash.h.
{ THashSet<TKey> Set(9); Set.AddKey(Key1); Set.AddKey(Key2); Set.AddKey(Key3); Set.AddKey(Key4); Set.AddKey(Key5); Set.AddKey(Key6); Set.AddKey(Key7); Set.AddKey(Key8); Set.AddKey(Key9); return Set;}
TSetKey& THashSet< TKey, THashFunc >::GetSetKey | ( | const int & | KeyId | ) | [inline, private] |
Definition at line 1050 of file shash.h.
Referenced by THashSet< TInt >::GetKey(), and THashSet< TInt >::operator[]().
bool THashSet< TKey, THashFunc >::IsAutoSize | ( | ) | const [inline] |
bool THashSet< TKey, THashFunc >::IsKey | ( | const TKey & | Key | ) | const [inline] |
Definition at line 1141 of file shash.h.
Referenced by TLocClustStat::BagOfWhiskers(), TUndirFFire::BurnGeoFire(), TNetConstraint< PGraph >::CalcConstraints(), TSnap::CntEdgesToSet(), THashSet< TInt >::DelIfKey(), TLocClustStat::FindBestCut(), TSnap::GenConfModel(), TSnap::GenRewire(), TSnap::GenSmallWorld(), TTimeNENet::Get1stEdgeNet(), TLocClust::GetCutStat(), TCliqueOverlap::GetIntersection(), TSnap::GetNodeTriads(), TCliqueOverlap::GetRelativeComplement(), TSnap::GetTriadEdges(), TCliqueOverlap::Intersection(), TCliqueOverlap::MaxNbrsInCANDNodeId(), THashSet< TKey, THashFunc >::operator==(), TAGM::RndConnectInsideCommunity(), and TLocClustStat::Run().
{return GetKeyId(Key)!=-1; }
bool THashSet< TKey, THashFunc >::IsKeyIdEqKeyN | ( | ) | const [inline] |
Definition at line 1119 of file shash.h.
Referenced by THashSet< TInt >::BegI(), and THashSet< TInt >::GetRndKeyId().
{return FreeKeys==0; }
int THashSet< TKey, THashFunc >::Len | ( | ) | const [inline] |
Definition at line 1114 of file shash.h.
Referenced by TLocClustStat::BagOfWhiskers(), THashSet< TInt >::BegI(), TUndirFFire::BurnGeoFire(), TSnap::CntUniqDirEdges(), TSnap::CntUniqUndirEdges(), TSnap::TSnapDetail::TGetSubGraph< PGraph, false >::Do(), THashSet< TInt >::Empty(), TCliqueOverlap::Expand(), TSnap::GenPrefAttach(), TSnap::GenRewire(), TSnap::GenSmallWorld(), TLocClust::GetCutStat(), TCliqueOverlap::GetIntersection(), TUndirFFire::GetNBurned(), TSnap::GetNodeTriads(), TTimeNENet::GetPrefAttach(), THashSet< TInt >::GetRndKeyId(), TSnap::GetTriads(), TNodeEdgeNet< TNodeData, TEdgeData >::GetUniqEdges(), TCliqueOverlap::Intersection(), THashSet< TKey, THashFunc >::operator==(), TGnuPlot::PlotValMomH(), TNetInfBs::SavePajek(), and TLocClustStat::SaveTxtInfo().
void THashSet< TKey, THashFunc >::MarkDelKey | ( | const TKey & | Key | ) |
Definition at line 1302 of file shash.h.
References IAssert, and IAssertR.
Referenced by THashSet< TInt >::MarkDelKeyId().
{ IAssert(!PortV.Empty()); int PortN=abs(THashFunc::GetPrimHashCd(Key)%PortV.Len()); int HashCd=abs(THashFunc::GetSecHashCd(Key)); int PrevKeyId=-1; int KeyId=PortV[PortN]; while ((KeyId!=-1) && !((KeyV[KeyId].HashCd==HashCd) && (KeyV[KeyId].Key==Key))) { PrevKeyId=KeyId; KeyId=KeyV[KeyId].Next; } IAssertR(KeyId!=-1, Key.GetStr()); if (PrevKeyId==-1) {PortV[PortN]=KeyV[KeyId].Next; } else {KeyV[PrevKeyId].Next=KeyV[KeyId].Next; } KeyV[KeyId].Next=FFreeKeyId; FFreeKeyId=KeyId; FreeKeys++; KeyV[KeyId].HashCd=TInt(-1); }
void THashSet< TKey, THashFunc >::MarkDelKeyId | ( | const int & | KeyId | ) | [inline] |
Definition at line 1132 of file shash.h.
{MarkDelKey(GetKey(KeyId)); }
bool THashSet< TKey, THashFunc >::operator== | ( | const THashSet< TKey, THashFunc > & | Set | ) | const |
Definition at line 1227 of file shash.h.
References THashSet< TKey, THashFunc >::IsKey(), and THashSet< TKey, THashFunc >::Len().
{ if (Len() != Set.Len()) { return false; } for (int k = FFirstKeyId(); FNextKeyId(k); k++) { if (! Set.IsKey(GetKey(k))) { return false; } } return true; }
const TKey& THashSet< TKey, THashFunc >::operator[] | ( | const int & | KeyId | ) | const [inline] |
TKey& THashSet< TKey, THashFunc >::operator[] | ( | const int & | KeyId | ) | [inline] |
Definition at line 1189 of file shash.h.
References THashSetKey< TKey >::HashCd, THashSetKey< TKey >::Key, and THashSetKey< TKey >::Next.
{ // resize & initialize port vector if (PortV.Len()==0) {PortV.Gen(17); } else if (AutoSizeP&&(KeyV.Len()>2*PortV.Len())) { PortV.Gen(GetNextPrime(PortV.Len()+1)); } else { return; } PortV.PutAll(TInt(-1)); // reSet keys for (int KeyId=0; KeyId<KeyV.Len(); KeyId++) { TSetKey& SetKey=KeyV[KeyId]; if (SetKey.HashCd!=-1) { int PortN=abs(THashFunc::GetPrimHashCd(SetKey.Key)%PortV.Len()); SetKey.Next=PortV[PortN]; PortV[PortN]=KeyId; } } }
void THashSet< TKey, THashFunc >::Swap | ( | THashSet< TKey, THashFunc > & | Set | ) |
Definition at line 1348 of file shash.h.
References THashSet< TKey, THashFunc >::AutoSizeP, THashSet< TKey, THashFunc >::FFreeKeyId, THashSet< TKey, THashFunc >::FreeKeys, THashSet< TKey, THashFunc >::KeyV, THashSet< TKey, THashFunc >::PortV, and Swap().
{ if (this!=&Set) { PortV.Swap(Set.PortV); KeyV.Swap(Set.KeyV); ::Swap(AutoSizeP, Set.AutoSizeP); ::Swap(FFreeKeyId, Set.FFreeKeyId); ::Swap(FreeKeys, Set.FreeKeys); } }
TBool THashSet< TKey, THashFunc >::AutoSizeP [private] |
Definition at line 1047 of file shash.h.
Referenced by THashSet< TInt >::IsAutoSize(), THashSet< TInt >::Load(), THashSet< TInt >::LoadXml(), THashSet< TInt >::operator=(), THashSet< TInt >::Save(), THashSet< TInt >::SaveXml(), and THashSet< TKey, THashFunc >::Swap().
TInt THashSet< TKey, THashFunc >::FFreeKeyId [private] |
Definition at line 1048 of file shash.h.
Referenced by THashSet< TInt >::Gen(), THashSet< TInt >::Load(), THashSet< TInt >::operator=(), THashSet< TInt >::Save(), and THashSet< TKey, THashFunc >::Swap().
TInt THashSet< TKey, THashFunc >::FreeKeys [private] |
Definition at line 1048 of file shash.h.
Referenced by THashSet< TInt >::Gen(), THashSet< TInt >::IsKeyIdEqKeyN(), THashSet< TInt >::Len(), THashSet< TInt >::Load(), THashSet< TInt >::operator=(), THashSet< TInt >::Save(), and THashSet< TKey, THashFunc >::Swap().
TVec<TSetKey> THashSet< TKey, THashFunc >::KeyV [private] |
Definition at line 1046 of file shash.h.
Referenced by THashSet< TInt >::BegI(), THashSet< TInt >::EndI(), THashSet< TInt >::Gen(), THashSet< TInt >::GetI(), THashSet< TInt >::GetMemUsed(), THashSet< TInt >::GetMxKeyIds(), THashSet< TInt >::GetReservedKeyIds(), THashSet< TInt >::GetSetKey(), THashSet< TInt >::IsKeyId(), THashSet< TInt >::Len(), THashSet< TInt >::Load(), THashSet< TInt >::LoadXml(), THashSet< TInt >::operator=(), THashSet< TInt >::Pack(), THashSet< TInt >::Save(), THashSet< TInt >::SaveXml(), and THashSet< TKey, THashFunc >::Swap().
TIntV THashSet< TKey, THashFunc >::PortV [private] |
Definition at line 1045 of file shash.h.
Referenced by THashSet< TInt >::Gen(), THashSet< TInt >::GetMemUsed(), THashSet< TInt >::GetPorts(), THashSet< TInt >::Load(), THashSet< TInt >::operator=(), THashSet< TInt >::Save(), THashSet< TKey, THashFunc >::Swap(), and THashSet< TKey, THashFunc >::THashSet().