Documentation
¶
Overview ¶
Package factory implements the Factory and Abstract Factory design pattern. The interface ParticleFactory declares the abstract factory interface, while FundamentalParticleFactory and CompositeParticleFactory are the specific implementations of this abstract factory, which allows us to produce a simple models that represent untitled fundamental and composite particles of physical world.
Index ¶
Constants ¶
const ( MaxCharge = 1 MinCharge = -1 )
The limits of the charge for the fundamental particles
const ( Boson uint16 = iota Fermion Composite )
Particles classes enum constants
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CompositeParticleFactory ¶
type CompositeParticleFactory struct{}
CompositeParticleFactory is a simple implementation of a specific factory to create the composite particle. There is no distinguish of a specific particle types here (mesons, baryons, hadrons etc.)
type FundamentalParticleFactory ¶
type FundamentalParticleFactory struct{}
FundamentalParticleFactory is the specific factory implementation
type Particle ¶
type Particle struct {
Spin float32
Mass float32
Charge int16
// contains filtered or unexported fields
}
Particle is the general struct that represents particle model
func (*Particle) AddCharge ¶
AddCharge is the general interface for the charge assignment of the particle (with validations)
func (*Particle) AddMass ¶
AddMass is the general interface for the mass reassignment of the particle