Files
trueskill/src/FactorGraphs/Variable.php

37 lines
644 B
PHP
Raw Normal View History

<?php
2022-07-05 15:55:47 +02:00
2022-07-05 15:33:34 +02:00
namespace DNW\Skills\FactorGraphs;
2022-07-05 16:21:06 +02:00
class Variable implements \Stringable
{
2023-08-01 12:13:24 +00:00
private string $_name;
2022-07-05 15:55:47 +02:00
2023-08-01 12:13:24 +00:00
private mixed $_value;
2023-08-01 12:13:24 +00:00
public function __construct(string $name, private mixed $_prior)
{
2022-07-05 15:55:47 +02:00
$this->_name = 'Variable['.$name.']';
$this->resetToPrior();
}
2023-08-01 12:13:24 +00:00
public function getValue(): mixed
{
return $this->_value;
}
2023-08-01 12:13:24 +00:00
public function setValue(mixed $value): void
{
$this->_value = $value;
}
public function resetToPrior()
{
$this->_value = $this->_prior;
}
2022-07-05 16:21:06 +02:00
public function __toString(): string
{
return $this->_name;
}
2022-07-05 15:55:47 +02:00
}