diff --git a/HashNode.h b/HashNode.h index 6a49583..d9a696c 100644 --- a/HashNode.h +++ b/HashNode.h @@ -1,10 +1,42 @@ #ifndef INC_08_TEAM_PROJECT_HASHNODE_H #define INC_08_TEAM_PROJECT_HASHNODE_H -template -class HashNode { +template +class HashNode +{ +private: + T item; + int occupied; // 1 -> occupied, 0 -> empty from start, -1 -> empty after removal + int numCollisions; +public: + // constructors + HashNode() + { + occupied = 0; + numCollisions = 0; + } + HashNode(T anItem) + { + item = anItem; + occupied = 1; + numCollisions = 0; + } + HashNode(T anItem, int ocp, int nCol) + { + item = anItem; + occupied = ocp; + numCollisions = nCol; + } + // setters + void setItem(const T &anItem) { item = anItem; } + void setOccupied(int ocp) { occupied = ocp; } + void setNumCollisions(int nCol) { numCollisions = nCol; } + + // getters + T getItem() const { return item; } + int getOccupied() const { return occupied; } + int getNumCollisions() const { return numCollisions; } }; - -#endif //INC_08_TEAM_PROJECT_HASHNODE_H +#endif // INC_08_TEAM_PROJECT_HASHNODE_H