Package org.harctoolbox.girr
Class CommandSet
java.lang.Object
org.harctoolbox.girr.XmlExporter
org.harctoolbox.girr.CommandSet
- All Implemented Interfaces:
Serializable
,Iterable<Command>
,Named
A CommandSet is a set of Commands with unique names.
Typically, but not necessarily, they share the same protocol, but with different parameter values.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.harctoolbox.girr.Named
Named.CompareNameCaseInsensitive, Named.CompareNameCaseSensitive
-
Constructor Summary
ConstructorDescriptionCommandSet
(Reader reader) This constructor is used to read a Reader into a CommandSet.CommandSet
(String file) This constructor is used to read a Girr file into a CommandSet.CommandSet
(String name, Map<String, String> notes, Map<String, Command> commands, String protocolName, Map<String, Long> parameters) Constructs a CommandSet from its argument.CommandSet
(Command command) Constructs a CommandSet from a single Command.CommandSet
(Document doc) This constructor is used to import a Document.CommandSet
(Element element) Imports a CommandSet from an Element. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addFormat
(Command.CommandTextFormat format, int repeatCount) Applies the format argument to all Command's in the CommandSet.void
Deletes inheritance information, if present.void
Attempt to generate inheritance information.getCommand
(String commandName) Returns the Command with the given name, or null if not found.Returns the Commands in the CommandSet.getName()
Return the name of the object.int
boolean
isEmpty()
iterator()
int
size()
Size, i.e., the number of contained Commands.void
sort()
Calls sort with a comparator that amounts to case-insensitive alphabetical sorting.void
sort
(Comparator<? super Named> comparator) Sort the commands according to the Comparator given as argument.void
void
strip()
Apply the strip() method to all contained Commands.(package private) Element
toElement
(Document doc, boolean fatRaw, boolean generateParameters, boolean generateProntoHex, boolean generateRaw) Exports the Object to an Element.toString()
Methods inherited from class org.harctoolbox.girr.XmlExporter
getElement, getElement, getElement, getElement, getElement, getElement, getElement, print, print, print, print, print, toDocument
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
CommandSet
This constructor is used to read a Girr file into a CommandSet.- Parameters:
file
-- Throws:
GirrException
IOException
SAXException
-
CommandSet
This constructor is used to read a Reader into a CommandSet.- Parameters:
reader
-- Throws:
GirrException
IOException
SAXException
-
CommandSet
This constructor is used to import a Document.- Parameters:
doc
- W3C Document- Throws:
GirrException
-
CommandSet
Imports a CommandSet from an Element.- Parameters:
element
- of type "commandSet"- Throws:
GirrException
-
CommandSet
public CommandSet(String name, Map<String, String> notes, Map<String, Command> commands, String protocolName, Map<String, Long> parameters) Constructs a CommandSet from its argument.- Parameters:
name
-notes
-commands
-protocolName
-parameters
-
-
CommandSet
Constructs a CommandSet from a single Command.- Parameters:
command
-
-
CommandSet
public CommandSet()
-
-
Method Details
-
getCommands
Returns the Commands in the CommandSet.- Returns:
- unmodifiable Map.
-
getNumberOfCommand
public int getNumberOfCommand() -
getCommand
Returns the Command with the given name, or null if not found.- Parameters:
commandName
-- Returns:
-
getName
Description copied from interface:Named
Return the name of the object. -
toString
-
size
public int size()Size, i.e., the number of contained Commands.- Returns:
-
isEmpty
public boolean isEmpty() -
iterator
-
sort
Sort the commands according to the Comparator given as argument.- Parameters:
comparator
-
-
sort
public void sort()Calls sort with a comparator that amounts to case-insensitive alphabetical sorting. -
sortIgnoringCase
public void sortIgnoringCase() -
generateInheritanceParameters
public void generateInheritanceParameters()Attempt to generate inheritance information. -
deleteInheritanceParameters
public void deleteInheritanceParameters()Deletes inheritance information, if present. -
toElement
Element toElement(Document doc, boolean fatRaw, boolean generateParameters, boolean generateProntoHex, boolean generateRaw) Description copied from class:XmlExporter
Exports the Object to an Element.- Specified by:
toElement
in classXmlExporter
- Parameters:
doc
- Owner Document.fatRaw
- If generating the raw form, generate it in the so-called fat form, with one element per duration.generateParameters
- If true, generate the parameter form.generateProntoHex
- If true, generate the Pronto Hex form.generateRaw
- If true, generate the raw form.- Returns:
- newly constructed element, belonging to the doc Document.
-
addFormat
Applies the format argument to all Command's in the CommandSet.- Parameters:
format
-repeatCount
-
-
strip
public void strip()Apply the strip() method to all contained Commands.
-