use crate::node::NodeId;
use crate::random_walk::RandomWalk;
pub struct PosWalk {
walk: RandomWalk,
pos: usize,
}
#[allow(dead_code)]
impl PosWalk {
pub fn new(walk: RandomWalk, pos: usize) -> Self {
PosWalk { walk, pos }
}
pub fn get_walk(&self) -> &RandomWalk {
&self.walk
}
pub fn get_walk_mut(&mut self) -> &mut RandomWalk {
&mut self.walk
}
pub fn get_pos(&self) -> usize {
self.pos
}
pub fn set_pos(&mut self, pos: usize) {
self.pos = pos;
}
pub fn set_walk(&mut self, walk: RandomWalk) {
self.walk = walk;
}
pub fn get_current_node(&self) -> NodeId {
assert!(
self.pos < self.walk.len(),
"Current position is out of bounds."
);
*self.walk.get_nodes().get(self.pos).unwrap()
}
}