observer

package
v0.0.0-...-c864ae1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2023 License: BSD-2-Clause, BSD-3-Clause, MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContainedEventNotifier

type ContainedEventNotifier struct {
	// contains filtered or unexported fields
}

ContainedEventNotifier offers a struct implementing the EventNotifierContainer interface.

func (*ContainedEventNotifier) EventNotifier

func (cen *ContainedEventNotifier) EventNotifier() EventNotifier

func (*ContainedEventNotifier) SetEventNotifier

func (cen *ContainedEventNotifier) SetEventNotifier(notifier EventNotifier) error

type Event

type Event struct {
	EventType EventType
	attributes.ContainedAttributes
}

func NewEvent

func NewEvent(eventType EventType) *Event

func (*Event) HasNote

func (e *Event) HasNote() bool

func (*Event) Id

func (e *Event) Id() string

func (*Event) JoiningAttributes

func (e *Event) JoiningAttributes(newAttributes attributes.Attributes) *Event

func (*Event) Note

func (e *Event) Note() string

func (*Event) ReplaceNote

func (e *Event) ReplaceNote(text string) *Event

func (*Event) ReplacingAttribute

func (e *Event) ReplacingAttribute(name string, value interface{}) *Event

func (*Event) Source

func (e *Event) Source() interface{}

func (*Event) WithAttribute

func (e *Event) WithAttribute(name string, value interface{}) *Event

func (*Event) WithId

func (e *Event) WithId(id string) *Event

func (*Event) WithNote

func (e *Event) WithNote(text string) *Event

func (*Event) WithSource

func (e *Event) WithSource(source interface{}) *Event

type EventNotifier

type EventNotifier interface {
	HasObservers() bool
	AddObserver(observer Observer) error
	AddObserverAsFirst(observer Observer) error
	Observers() []Observer
	NotifyObserversOfEvent(event Event)
}

type EventNotifierContainer

type EventNotifierContainer interface {
	EventNotifier() EventNotifier
	SetEventNotifier(notifier EventNotifier) error
}

EventNotifierContainer defines an interface embedding an EventNotifier

type EventType

type EventType int
const (
	InvalidEvent EventType = iota
	StartedAnnealing
	StartedIteration
	Explorer
	Model
	ManagementAction
	DecisionVariable
	FinishedIteration
	FinishedAnnealing
	Note
)

func (EventType) IsAnnealingIterationState

func (eventType EventType) IsAnnealingIterationState() bool

func (EventType) IsAnnealingState

func (eventType EventType) IsAnnealingState() bool

func (EventType) IsModelState

func (eventType EventType) IsModelState() bool

func (EventType) String

func (eventType EventType) String() string

type Observer

type Observer interface {
	ObserveEvent(event Event)
}

type SynchronousAnnealingEventNotifier

type SynchronousAnnealingEventNotifier struct {
	// contains filtered or unexported fields
}

func (*SynchronousAnnealingEventNotifier) AddObserver

func (notifier *SynchronousAnnealingEventNotifier) AddObserver(newObserver Observer) error

func (*SynchronousAnnealingEventNotifier) AddObserverAsFirst

func (notifier *SynchronousAnnealingEventNotifier) AddObserverAsFirst(newObserver Observer) error

func (*SynchronousAnnealingEventNotifier) HasObservers

func (notifier *SynchronousAnnealingEventNotifier) HasObservers() bool

func (*SynchronousAnnealingEventNotifier) NotifyObserversOfEvent

func (notifier *SynchronousAnnealingEventNotifier) NotifyObserversOfEvent(event Event)

func (*SynchronousAnnealingEventNotifier) Observers

func (notifier *SynchronousAnnealingEventNotifier) Observers() []Observer

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL