class Chemystal::MoleculeSoup

Overview

A Molecule Soup is a Hash from the molecules name to a deque of molecules having that same name

The use of a deque is to have FIFO, such that no old molecules are left floating around in the soup

Defined in:

chemystal/chemical_machine/molecule_soup.cr

Instance Method Summary

Instance Method Detail

def add_molecule(molecule : Molecule) #

Adds a molecule to the soup


[View source]
def get_molecules_with_name(name : String) : Deque(Molecule) #

Gets all molecules with the name


[View source]
def has_molecule_with_name(name : String) : Bool #

Checks if at least one molecule with the name is in the soup


[View source]
def use_molecule_with_name(name : String) : Molecule | Nil #

Consumes one molecule withe the name, returning it and removing it from the soup


[View source]