use crate::enneatype::Enneatype;
#[derive(Debug, Clone)]
pub struct Pivot
{
extroverted: Enneatype,
homeostatis: Enneatype,
introverted: Enneatype
}
impl Pivot
{
pub fn new(edge: Enneatype) -> Self
{
use Enneatype::*;
let (extroverted, introverted) = match edge
{
Recovery => (Disorganization, Rejection), Association => (Action, Rejection), Repression => (Rest, Paranoia), Rejection => (Association, Recovery), Catatonia => (Action, Disorganization), Paranoia => (Repression, Rest), Disorganization => (Catatonia, Recovery), Action => (Catatonia, Association), Rest => (Paranoia, Repression) };
Pivot {
extroverted,
homeostatis: edge,
introverted
}
}
pub fn homeostatis(&self) -> Enneatype
{
self.homeostatis
}
pub fn extroverted(&self) -> Enneatype
{
self.extroverted
}
pub fn introverted(&self) -> Enneatype
{
self.introverted
}
pub fn is_adjacent_to(&self, edge: Enneatype) -> bool
{
self.extroverted == edge || self.introverted == edge
}
pub fn lines(self) -> [[Enneatype; 2]; 2]
{
let Self {
extroverted,
homeostatis,
introverted
} = self;
[[extroverted, homeostatis], [homeostatis, introverted]]
}
}