Documentation ¶
Index ¶
Constants ¶
const ReqChanSize = 5
Request channel buffer size.
Variables ¶
var AllMolecules molecules
The only instance of `molecules`.
Functions ¶
This section is empty.
Types ¶
type AtomBuilder ¶
type AtomBuilder struct {
// contains filtered or unexported fields
}
AtomBuilder builds an atom, in typical builder fashion, one property at a time.
This type is public. This is the only way to create a new atom from outside this package. The created and constructed atom can NOT be extracted or used directly. The only way to make use of it is to send it to a molecule for inclusion in it.
An instance of builder can create and build any number of atoms.
func (*AtomBuilder) Charge ¶
func (ab *AtomBuilder) Charge(ch int) *AtomBuilder
Charge sets the residual charge on this atom.
func (*AtomBuilder) Coordinates ¶
func (ab *AtomBuilder) Coordinates(x, y, z float32) *AtomBuilder
Coordinates sets the given coordinates as the X-, Y- and Z-coordinates of this atom.
func (*AtomBuilder) New ¶
func (ab *AtomBuilder) New(sym string, iId int) (*AtomBuilder, error)
New creates a new atom instance in this builder.
func (*AtomBuilder) Valence ¶
func (ab *AtomBuilder) Valence(v int) *AtomBuilder
Valence sets the current valence configuration of this atom.
type Attribute ¶
Attribute represents a (key, value) pair that annotates this molecule.
A given molecule can have zero or more such attributes.
type BondBuilder ¶
type BondBuilder struct {
// contains filtered or unexported fields
}
BondBuilder builds a bond, in typical builder fashion, one property at a time.
This type is public. This is the only way to create a new bond from outside this package. The created and constructed bond can NOT be extracted or used directly. The only way to make use of it is to send it to a molecule for inclusion in it.
An instance of builder can create and build any number of bonds.
func (*BondBuilder) Atoms ¶
func (bb *BondBuilder) Atoms(aiid1, aiid2 int) (*BondBuilder, error)
Atoms sets the input IDs of the two atoms being bound together by this bond.
func (*BondBuilder) BondStereo ¶
func (bb *BondBuilder) BondStereo(bStereo cmn.BondStereo) *BondBuilder
BondStereo sets the stereo type of this bond.
func (*BondBuilder) BondType ¶
func (bb *BondBuilder) BondType(bType cmn.BondType) (*BondBuilder, error)
BondType sets the bond order of this bond.
func (*BondBuilder) New ¶
func (bb *BondBuilder) New(id int) (*BondBuilder, error)
New creates a new bond instance in this builder.
type InMessage ¶
type InMessage struct { Request RequestType Cookie uint64 OutChannel chan OutMessage Payload interface{} }
InMessage is a message sent to a molecule by an external agent.
An in-message comprises a request, an optional cookie value and a dynamic payload. The meaning of the cookie depends on the request, but usually represents a request ID. Similarly, the actual contents of the payload depend on the request.
Each request also includes the channel over which the result message has to be transmitted. This enables the molecules to operate in a stateless manner, as far as the communication is concerned.
Thus, it is highly imperative that other agents that correspond with a molecule be aware of what requests molecules understand, and what payloads are to be delivered as part of the message.
type Molecule ¶
type Molecule struct {
// contains filtered or unexported fields
}
Molecule represents a chemical molecule.
It holds information concerning its atom, bonds, rings, etc. Note that a molecule is expected to be a single connected component.
func (*Molecule) NewAtomBuilder ¶
func (m *Molecule) NewAtomBuilder() *AtomBuilder
NewAtomBuilder answers a new atom builder.
func (*Molecule) NewBondBuilder ¶
func (m *Molecule) NewBondBuilder() *BondBuilder
NewBondBuilder answers a new bond builder.
type OutMessage ¶
type OutMessage struct { Status StatusType Cookie uint64 Payload interface{} }
OutMessage is a message sent by a molecule in response to an in-message.
An out-message comprises a status (result code), an optional cookie value and a dynamic payload. The meaning of the cookie depends on the request, but usually is the same as the corresponding request ID. Similarly, the actual contents of the payload depend on the request.
Thus, it is highly imperative that other agents that correspond with a molecule be aware of what responses molecules send, and what payloads are delivered as part of the message.
type RequestType ¶
type RequestType uint8
RequestType enumerates the requests understood by a molecule.
const ( ReqExit RequestType = iota ReqAddAtom ReqAddBond ReqSetAtomAttribute ReqAddTag )
Constants representing the requests understood by a molecule.
type StatusType ¶
type StatusType uint16
StatusType enumerates the response statuses sent by a molecule.
const ( StSuccess StatusType = iota StNotFound StAlreadyExists StIncorrectParameter )
Constants representing the outcome status of a request processed by a molecule.