com.foxsmart.csu.config
Class Commands

java.lang.Object
  extended by com.foxsmart.csu.config.Commands

public class Commands
extends java.lang.Object

The Commands class is a list of Command objects.


Constructor Summary
Commands()
          Default constructor that creates an empty list of commands.
Commands(Commands commands)
          Constructs a list of commands based on the passed in list of commands.
 
Method Summary
 void add(Command command)
          Adds a command to the list of commands.
 void add(int index, Command command)
          Adds a command at a specified position
 void addAll(Commands commands)
          Appends all the passed in commands to the end of the list.
 void addAll(int index, Commands commands)
          Inserts all the commands at the specified offset.
 void clear()
          Clears out all the commands.
 boolean equals(java.lang.Object commands)
          Determines if two commands are equal (i.e.
 Command get(int index)
          Gets the command at the specified position.
 java.lang.String getConfiglet()
          Generates and returns a configlet for the commands.
 boolean isEmpty()
          Determines if the list of commands is empty (i.e.
 java.util.Iterator iterator()
          Returns an iterator to iterate through each of the commands.
 void orderDeferredCommands()
          Re-orders the commands by placing any "deferred" commands at the end.
 Command remove(int index)
          Removes the command at the specified position.
 Command set(int index, Command command)
          Sets the command at the specified offset.
 int size()
          Returns the number of commands.
 java.lang.String toString()
          Generates the configlet representation for the commands.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Commands

public Commands()
Default constructor that creates an empty list of commands.


Commands

public Commands(Commands commands)
Constructs a list of commands based on the passed in list of commands.

Parameters:
commands - A list of commands.
Method Detail

add

public void add(Command command)
Adds a command to the list of commands.

Parameters:
command - The command to add.

add

public void add(int index,
                Command command)
Adds a command at a specified position

Parameters:
index - The index where the command will be added
command - The command to add.

addAll

public void addAll(Commands commands)
Appends all the passed in commands to the end of the list.

Parameters:
commands - The list of commands to add

addAll

public void addAll(int index,
                   Commands commands)
Inserts all the commands at the specified offset.

Parameters:
index - The index where the commands will be added
commands - The list of commands to add

clear

public void clear()
Clears out all the commands.


get

public Command get(int index)
Gets the command at the specified position.

Parameters:
index - The index for the command to get.
Returns:
The command at the specified position.
Throws:
java.lang.IndexOutOfBoundsException - if the offset doesn't exist.

remove

public Command remove(int index)
Removes the command at the specified position.

Parameters:
index - The index for the command to remove.
Returns:
The command at the position where the command was deleted.
Throws:
java.lang.IndexOutOfBoundsException - if the offset doesn't exist.

set

public Command set(int index,
                   Command command)
Sets the command at the specified offset.

Parameters:
index - The index where the commands will be added
command - The command to set.
Returns:
The command that used to be at the offset specified.
Throws:
java.lang.IndexOutOfBoundsException - if the offset doesn't exist.

getConfiglet

public java.lang.String getConfiglet()
Generates and returns a configlet for the commands. If no commands exist or all commands are empty, the empty string is returned.

Returns:
The cofiglet.

toString

public java.lang.String toString()
Generates the configlet representation for the commands. This is the same as the getConfiglet() method.

Overrides:
toString in class java.lang.Object
Returns:
The configlet.

equals

public boolean equals(java.lang.Object commands)
Determines if two commands are equal (i.e. their generated IOS statements are the same).

Overrides:
equals in class java.lang.Object
Parameters:
commands - The commands to compare to.
Returns:
True if both sets of commands are the same or false if not.

isEmpty

public boolean isEmpty()
Determines if the list of commands is empty (i.e. the IOS generated is empty) or not.

Returns:
True if the list is empty or false if not.

iterator

public java.util.Iterator iterator()
Returns an iterator to iterate through each of the commands.

Returns:
The iterator.

size

public int size()
Returns the number of commands.

Returns:
the number of commands.

orderDeferredCommands

public void orderDeferredCommands()
Re-orders the commands by placing any "deferred" commands at the end.



Copyright © 2005-2008 Fox Smart, Inc. All Rights Reserved.