Class semper.transfer.Container
All Packages Class Hierarchy This Package Previous Next Index
Class semper.transfer.Container
java.lang.Object
|
+----semper.transfer.Operation
|
+----semper.transfer.Container
- public class Container
- extends Operation
- implements Streamable
This class provides the functionality to build containers and to get and set some internal data.
Also the container can be written to a stream and read from a stream.
As a special feature the whole container can be converted into a string, which is then the
data of the node content of the root.
With this feature it is possible to hide the structure of the container.
-
Container()
- Constructor without arguments makes just the root of the container.
-
Container(String, int, Security)
- Constructor with container ID, send descriptor and Security attributes
as arguments.
-
Abort()
- Aborts a transfer operation if possible.
-
addChild(Node)
- Adds a node as a child into the container tree.
-
concatenate(Container, Container, String, Security)
- Concatenates two containers.
-
getContainerID()
- Gets the Container ID.
-
getLeaves()
- Gets all the leaves of the container
-
getLeaves(Node, Vector)
- Adds all the leaves of the specified subtree to the passed Vector
-
getRoot()
- Gets the root the container.
-
getRootID()
- Gets the node ID of the root.
-
getSendDescr()
- Returns the send descriptor of the container.
-
GetStatus()
- Returns the status of a transfer operation.
-
makeContainerPrimitive(String)
- Converts a string into a primitive Container (i.e.
-
makeFromStringToContainer()
- Converts a streamed Container into a "expanded" container.
-
makeFromStringToContainer(Node)
- The method that makes the work of getting a container from a string.
-
makeStringPrimitive(Node)
- Converts a primitive Container (only root and leaves) into a String.
-
makeToString(Node, Vector)
- Converts a subtree into a String.
-
makeToString(Vector)
- Converts a Container into a String.
-
myStreamSize()
- Gives the stream size of the container.
-
myStreamSize(Node)
- Gives the size of a subtree of the container.
-
print()
- Prints information about each node within the Container
-
readObject(StreamInputInterface)
- Reads a container from a data stream.
-
Resume()
- Resumes the status of an interrupted transfer operation.
-
sanity_check(Node)
- checks the structure of the container.
-
setContainerID(String)
- Sets the ContainerID of all nodes to the same value.
-
setContentDescr(String)
- Inserts the content description into the root.
-
setNodeAttributes(Security)
- Sets the root's Node security attributes.
-
setNodeContent(TransferData)
- Inserts the content into the root.
-
setNodeType(String)
- Inserts the node type to the root.
-
setRoot(Node)
- This method is used internally to change a containers content.
-
setSendDescr(int)
- Sets the send descriptor of the container.
-
setSubConAttributes(Security)
- Sets the root's subcontainer security attributes.
-
writeObject(StreamOutputInterface)
- Writes the container into a stream.
Container
public Container(String ContainerID,
int SendDescr,
Security SubConAttributes)
- Constructor with container ID, send descriptor and Security attributes
as arguments.
- Parameters:
- ContainerId - Container Identification
- SendDescr - describes the content (used by commlayer)
- SubConAttributes - attributes of the node and subtree
Container
public Container()
- Constructor without arguments makes just the root of the container.
All attributes are false, the container ID is null.
Resume
public void Resume()
- Resumes the status of an interrupted transfer operation.
- Overrides:
- Resume in class Operation
Abort
public void Abort()
- Aborts a transfer operation if possible.
- Overrides:
- Abort in class Operation
GetStatus
public void GetStatus()
- Returns the status of a transfer operation.
- Overrides:
- GetStatus in class Operation
setContainerID
public void setContainerID(String ContainerID)
- Sets the ContainerID of all nodes to the same value.
- Parameters:
- ContainerId - Container Identification
getContainerID
public String getContainerID()
- Gets the Container ID.
- Returns:
- the ContainerId
getRootID
public String getRootID()
- Gets the node ID of the root.
- Returns:
- the node ID of the root.
addChild
public void addChild(Node Child)
- Adds a node as a child into the container tree.
This method can be used to build containers. You can add as much children as you like.
- Parameters:
- Child - the Node to be added
concatenate
public void concatenate(Container Cont1,
Container Cont2,
String ContainerID,
Security SubConAttributes)
- Concatenates two containers. The tree structures are assembled into a new container by
inserting a new node as root that has the two former
root nodes as sons. This function also
inserts security attributes valid for the new container. The
security attributes of the former containers are mantained.
- Parameters:
- Cont1 - Container to be concatenated
- Cont2 - Container to be concatenated
- ContainerID - Container Identification
- SubConAttributes - the security attributes valid for the new container.
sanity_check
public boolean sanity_check(Node root)
- checks the structure of the container.
- Parameters:
- root - Root node.
- Returns:
- true if the structur of the container is alright.
getRoot
public Node getRoot()
- Gets the root the container.
- Returns:
- a reference to the root
getSendDescr
public int getSendDescr()
- Returns the send descriptor of the container.
- Returns:
- a description of the content of the container.
setSendDescr
public void setSendDescr(int SendDescr)
- Sets the send descriptor of the container.
- Parameters:
- SendDescr - a description of the content of the container.
setNodeType
public void setNodeType(String NodeType)
- Inserts the node type to the root.
- Parameters:
- NodeType - specifies the node type (i.e statement)
setNodeContent
public void setNodeContent(TransferData NodeContent)
- Inserts the content into the root.
- Parameters:
- NodeContent - Content data to be provided for a node.
setContentDescr
public void setContentDescr(String ContentDescr)
- Inserts the content description into the root.
- Parameters:
- ContentDescr - Content Description.
setNodeAttributes
public void setNodeAttributes(Security Attribute_list)
- Sets the root's Node security attributes.
- Parameters:
- Attribute_list - Security attributes.
setSubConAttributes
public void setSubConAttributes(Security Attribute_list)
- Sets the root's subcontainer security attributes.
- Parameters:
- Attribute_list - Security Attributes.
writeObject
public void writeObject(StreamOutputInterface s) throws StreamIOException
- Writes the container into a stream.
- Parameters:
- stream - the stream of data the object state is recorded in
- Throws: StreamIOException
- If a subobject does not implement the Streamable interface.
readObject
public void readObject(StreamInputInterface s) throws StreamIOException
- Reads a container from a data stream.
- Parameters:
- stream - the stream of data the object state is retrieved from
- Throws: StreamIOException
- If a class is not present or the input
data is corrupt
myStreamSize
public int myStreamSize() throws StreamIOException
- Gives the stream size of the container.
- Returns:
- the size of the stream
- Throws: StreamIOException
- if method can't get the streamsize of container
myStreamSize
public int myStreamSize(Node node) throws StreamIOException
- Gives the size of a subtree of the container.
- Parameters:
- node - the root of the subtree
- Returns:
- the size of the stream of the subtree
makeStringPrimitive
protected String makeStringPrimitive(Node node) throws StreamIOException
- Converts a primitive Container (only root and leaves) into a String.
- Returns:
- the size of the stream
makeToString
public boolean makeToString(Vector options) throws StreamIOException
- Converts a Container into a String.
This function is based on the protected function -makeStringPrimitive-,
which converts a conatainer that exist only of root and leaves into a string.
The return value is boolean. It is true if the container was converted and false
if not. A container can only be converted one time. A second try to convert it
returns false.
makeToString
protected void makeToString(Node node,
Vector options) throws StreamIOException
- Converts a subtree into a String.
This function is based on the protected function -makeStringPrimitive-,
which converts a conatainer that exist only of root and leaves into a string.
The return value is boolean. It is true if the subtree was converted and false
if not. A subtree can only be converted one time. A second try to convert it
returns false.
- Parameters:
- node - the root of the subtree
makeContainerPrimitive
protected Node makeContainerPrimitive(String string) throws StreamIOException
- Converts a string into a primitive Container (i.e. only root and leaves).
- Parameters:
- string - the String which representate the Container
- Returns:
- the root of the tree
makeFromStringToContainer
public boolean makeFromStringToContainer() throws StreamIOException
- Converts a streamed Container into a "expanded" container.
- Returns:
- false if this container was not made to a string before
makeFromStringToContainer
protected Node makeFromStringToContainer(Node node) throws StreamIOException
- The method that makes the work of getting a container from a string.
- Returns:
- the root of the tree
setRoot
protected void setRoot(Node new_root)
- This method is used internally to change a containers content.
- Parameters:
- new_root - the node which becomes the new root
getLeaves
public Vector getLeaves()
- Gets all the leaves of the container
- Returns:
- the leaves as a Vector
getLeaves
protected void getLeaves(Node node,
Vector leaves)
- Adds all the leaves of the specified subtree to the passed Vector
- Parameters:
- node - the root of the subtree
- leaves - the Vector to which the found leaves are added
print
public void print()
- Prints information about each node within the Container
All Packages Class Hierarchy This Package Previous Next Index