com.foxsmart.csu.config
Class MultiLineConfigComponent

java.lang.Object
  extended by com.foxsmart.csu.config.CiscoRouterConfigParser
      extended by com.foxsmart.csu.config.CiscoRouterConfigComponent
          extended by com.foxsmart.csu.config.MultiLineConfigComponent
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
CommentComponent, UnknownComponent

public abstract class MultiLineConfigComponent
extends CiscoRouterConfigComponent

The MultiLineConfigComponent class represents a Cisco Router Configuration Component with multiple lines.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.foxsmart.csu.config.CiscoRouterConfigComponent
commentComponent, componentMap, log, parentComponent
 
Fields inherited from class com.foxsmart.csu.config.CiscoRouterConfigParser
NO, tokenIndex
 
Constructor Summary
MultiLineConfigComponent()
          Default constructor.
 
Method Summary
 void add(java.util.Collection lines)
          Adds a collection of lines.
 void add(int index, java.lang.String line)
          Adds an individual line to the list of lines at a specified index.
 void add(java.lang.String line)
          Adds an individual line to the list of lines.
 void clear()
          Clears all lines from the list of lines.
 boolean contains(java.lang.String line)
          Determines if the list of lines contains the specified line.
 java.lang.String get(int index)
          Gets a line at a specified index.
protected  java.util.List getLines()
          Gets the lines
 int indexOf(java.lang.String line)
          Determines which index the specific line is located.
 boolean isEmpty()
          Returns true if the list of lines is empty or false if not.
 int lastIndexOf(java.lang.String line)
          Determines the last index the specific line is located.
 java.lang.String remove(int index)
          Removes a line at a specified index.
 java.lang.String set(int index, java.lang.String line)
          Sets an individual line at a specified index.
protected  void setLines(java.util.List lines)
          Sets the lines
 int size()
          Returns the number of lines current in the list of lines.
 java.lang.Object[] toArray()
          Returns an array of the lines.
 
Methods inherited from class com.foxsmart.csu.config.CiscoRouterConfigComponent
addComponent, addComponent, buildFromIos, checkComponentType, deleteOldConfigWhenUpdating, dumpComponents, generateChildrenUpdateConfiglet, generateCompositeIos, generateCompositeIos, generateDeleteIos, generateIos, generateIos, generateIos, generateIos, generateMultiLineUpdateConfiglet, generateUpdateCompositeIos, generateUpdateIos, generateUpdateIos, getAllComponents, getCiscoRouterConfig, getComment, getComponentClassName, getComponentClassName, getComponentKeys, getComponents, getComponents, getDeferredDelete, getFirstComponent, getFirstComponent, getParentComponent, getTotalComponents, getTotalComponents, getUpdateConfiglet, instantiateComponent, instantiateComponent, isValid, removeAllComponents, removeAllComponents, removeAllComponents, removeComponent, removeComponent, removeComponent, requiresCommentSeparator, setComment, setParentComponent, validate, validateChildren
 
Methods inherited from class com.foxsmart.csu.config.CiscoRouterConfigParser
checkExists, checkLineComplete, checkNotEmpty, checkRange, checkTokenCount, checkTokenCount, checkTokenMatch, checkTokenMatch, decrementTokenIndex, generateCommands, getBigDecimalNumberFromString, getDoubleNumberFromString, getEnum, getHexadecimalNumberFromString, getIntegerNumberFromString, getIpAddressFromString, getLine, getLongNumberFromString, getMacAddressFromString, getNextOptionalToken, getNextToken, getToken, getTokenIndex, getTokens, getTotalIndentedLines, getTotalLines, incrementTokenIndex, invalidConfiguration, invalidTokenFound, isEmpty, moreIndentedLines, moreLines, moreTokens, removeLines, resetTokenIndex, setTokenIndex, tokensLeft
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiLineConfigComponent

public MultiLineConfigComponent()
Default constructor.

Method Detail

add

public void add(int index,
                java.lang.String line)
         throws java.lang.IndexOutOfBoundsException
Adds an individual line to the list of lines at a specified index. Shifts the line currently at that position (if any) and any subsequent lines to the right (adds one to their indices). A null will be considered an empty line.

Parameters:
index - The index to add the line to.
line - The line.
Throws:
java.lang.IndexOutOfBoundsException - if the index is out of bounds.

add

public void add(java.lang.String line)
Adds an individual line to the list of lines. A null will be considered an empty line.

Parameters:
line - The line.

add

public void add(java.util.Collection lines)
Adds a collection of lines. Each element in the passed in collection should be a string although if other objects are found, their toString method will be called to determine the string of the line to be added. A null will be considered an empty collection and nothing will be added.

Parameters:
lines - The collection of lines to add.

clear

public void clear()
Clears all lines from the list of lines.


contains

public boolean contains(java.lang.String line)
Determines if the list of lines contains the specified line. A line match is determined using the equals method of the line strings. A null line string is automatically considered "no match".

Parameters:
line - The line to check.
Returns:
true if the line is already in the list of false if not.

get

public java.lang.String get(int index)
                     throws java.lang.IndexOutOfBoundsException
Gets a line at a specified index.

Parameters:
index - The index position to retrieve the line.
Returns:
The line at the specified index
Throws:
java.lang.IndexOutOfBoundsException - if the index is out of bounds.

indexOf

public int indexOf(java.lang.String line)
Determines which index the specific line is located. The equals method is used to determine if a match exists. -1 is returned if a match isn't found or if the specified line is null.

Parameters:
line - The line to search for.
Returns:
the index of the first matching line or -1 if a match wasn't found.

isEmpty

public boolean isEmpty()
Returns true if the list of lines is empty or false if not.

Returns:
true if empty or false if not.

lastIndexOf

public int lastIndexOf(java.lang.String line)
Determines the last index the specific line is located. The equals method is used to determine if a match exists. -1 is returned if a match isn't found or if the specified line is null.

Parameters:
line - The line to search for.
Returns:
the index of the last matching line or -1 if a match wasn't found.

remove

public java.lang.String remove(int index)
                        throws java.lang.IndexOutOfBoundsException
Removes a line at a specified index. Shifts any subsequent lines to the left (subtracts one from their indices).

Parameters:
index - The index position to retrieve the line.
Returns:
The line that was removed from the list of lines.
Throws:
java.lang.IndexOutOfBoundsException - if the index is out of bounds.

set

public java.lang.String set(int index,
                            java.lang.String line)
                     throws java.lang.IndexOutOfBoundsException
Sets an individual line at a specified index. A null will be considered an empty line.

Parameters:
index - The index to add the line to.
line - The line.
Returns:
The line previously at the specified index.
Throws:
java.lang.IndexOutOfBoundsException - if the index is out of bounds.

size

public int size()
Returns the number of lines current in the list of lines.

Returns:
The number of lines.

toArray

public java.lang.Object[] toArray()
Returns an array of the lines.

Returns:
The line array

getLines

protected java.util.List getLines()
Gets the lines

Returns:
the lines

setLines

protected void setLines(java.util.List lines)
Sets the lines

Parameters:
lines - the lines


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