#include <GiaNeighborCandidateList.h>
Public Member Functions | |
uint | getSize () |
Get size of candidate list. | |
void | add (const NodeHandle &node) |
Add an node to candidate list. | |
void | remove (uint position) |
Removes node from position. | |
void | remove (const NodeHandle &node) |
Removes node. | |
bool | contains (const NodeHandle &node) |
Check if candidate list contains node. | |
const NodeHandle & | getRandomCandidate () |
const NodeHandle & | get (uint position) |
Get node from position. | |
void | clear () |
Clear candidate list. | |
Protected Attributes | |
std::set< NodeHandle > | candidates |
contains all neighbor candidates |
void GiaNeighborCandidateList::add | ( | const NodeHandle & | node | ) |
Add an node to candidate list.
node | Node to add to candidate list |
00037 { 00038 assert(!(node.isUnspecified())); 00039 candidates.insert( node ); 00040 }
void GiaNeighborCandidateList::clear | ( | ) |
bool GiaNeighborCandidateList::contains | ( | const NodeHandle & | node | ) |
Check if candidate list contains node.
node |
00057 { 00058 if(node.key.isUnspecified()) 00059 return false; 00060 00061 std::set<NodeHandle>::iterator it = candidates.find(node); 00062 00063 if(it != candidates.end() && it->key == node.key) 00064 return true; 00065 else 00066 return false; 00067 }
const NodeHandle & GiaNeighborCandidateList::get | ( | uint | position | ) |
Get node from position.
position |
00071 { 00072 if ( position >= candidates.size() ) 00073 return NodeHandle::UNSPECIFIED_NODE; 00074 else { 00075 std::set<NodeHandle>::iterator it = candidates.begin(); 00076 for (uint i=0; i<position; i++) { 00077 it++; 00078 } 00079 return *it; 00080 } 00081 }
const NodeHandle & GiaNeighborCandidateList::getRandomCandidate | ( | ) |
uint GiaNeighborCandidateList::getSize | ( | ) |
Get size of candidate list.
00032 { 00033 return candidates.size(); 00034 }
void GiaNeighborCandidateList::remove | ( | const NodeHandle & | node | ) |
Removes node.
node | Node to remove from candidate list |
00052 { 00053 candidates.erase(node); 00054 }
void GiaNeighborCandidateList::remove | ( | uint | position | ) |
Removes node from position.
position |
00043 { 00044 std::set<NodeHandle>::iterator it = candidates.begin(); 00045 for (uint i=0; i<position; i++) { 00046 it++; 00047 } 00048 candidates.erase( it ); 00049 }
std::set<NodeHandle> GiaNeighborCandidateList::candidates [protected] |
contains all neighbor candidates