Source code for orbit.lattice.AccActionsContainer
import sys
import os
from ..utils import orbitFinalize
from ..utils import NamedObject
[docs]class AccActionsContainer(NamedObject):
"""
Class. Container for accelerator actions.
"""
ENTRANCE = 0
BODY = 1
EXIT = 2
BEFORE = 0
AFTER = 1
def __init__(self, name="no name container"):
"""
Constructor. Creates empty accelerator actions container.
"""
NamedObject.__init__(self, name)
# Array with entrance, body, and exit actions.
self.__actionsArr = ([], [], [])
[docs] def addAction(self, action, place):
"""
Method. Appends an action at the entrance, body, or exit
of an accelerator node.
"""
self.__actionsArr[place].append(action)
[docs] def removeAction(self, action, place):
"""
Method. Removes an action from the entrance, body, or exit
of an accelerator node.
"""
self.__actionsArr[place].remove(action)
[docs] def getActions(self, place):
"""
Method. Returns a list of the actions at the entrance, body,
or exit of an accelerator node.
"""
return self.__actionsArr[place]