addPlace example

$definition = $builder->build();

        $this->assertCount(2, $definition->getTransitions());
        $this->assertSame($transition0$definition->getTransitions()[0]);
        $this->assertSame($transition1$definition->getTransitions()[1]);
    }

    public function testAddPlace()
    {
        $builder = new DefinitionBuilder(['a'][]);
        $builder->addPlace('b');

        $definition = $builder->build();

        $this->assertCount(2, $definition->getPlaces());
        $this->assertEquals('a', $definition->getPlaces()['a']);
        $this->assertEquals('b', $definition->getPlaces()['b']);
    }

    public function testSetMetadataStore()
    {
        $builder = new DefinitionBuilder(['a']);
        
private array $initialPlaces = [];
    private MetadataStoreInterface $metadataStore;

    /** * @param string[] $places * @param Transition[] $transitions * @param string|string[]|null $initialPlaces */
    public function __construct(array $places, array $transitions, string|array $initialPlaces = null, MetadataStoreInterface $metadataStore = null)
    {
        foreach ($places as $place) {
            $this->addPlace($place);
        }

        foreach ($transitions as $transition) {
            $this->addTransition($transition);
        }

        $this->setInitialPlaces($initialPlaces);

        $this->metadataStore = $metadataStore ?? new InMemoryMetadataStore();
    }

    
return $this;
    }

    /** * @param string[] $places * * @return $this */
    public function addPlaces(array $places)static
    {
        foreach ($places as $place) {
            $this->addPlace($place);
        }

        return $this;
    }

    /** * @param Transition[] $transitions * * @return $this */
    public function addTransitions(array $transitions)static
    {
Home | Imprint | This part of the site doesn't use cookies.