Package org.harctoolbox.girr
Class RemoteSet
java.lang.Object
org.harctoolbox.girr.XmlExporter
org.harctoolbox.girr.RemoteSet
- All Implemented Interfaces:
Serializable,Iterable<Remote>
This class contains a map of Remotes, indexed by their names.
Earlier versions of this library could only import and export RemoteSets.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionThis constructor sets up an empty RemoteSet.This constructor is used to read a Girr file into a RemoteSet.This constructor is used to read a Reader into a RemoteSet.This constructor is used to read a Girr file into a RemoteSet.RemoteSet(String creatingUser, String source, String creationDate, String tool, String toolVersion, String tool2, String tool2Version) This constructor sets up a RemoteSet with no Remotes.RemoteSet(String creatingUser, String source, String creationDate, String tool, String toolVersion, String tool2, String tool2Version, Map<String, String> notes, Map<String, Remote> remotes) This constructor sets up a RemoteSet from a given Map of Remotes, so that it can later be used through the xmlExport or xmlExportDocument to generate an XML export.RemoteSet(String creatingUser, String source, String creationDate, String tool, String toolVersion, String tool2, String tool2Version, Map<String, String> notes, Remote remote) This constructor sets up a RemoteSet from one single Remote.RemoteSet(String creatingUser, String source, Collection<RemoteSet> remoteSets) Convenience version of the many-remote constructor.Convenience version of the one-remote constructor.RemoteSet(String source, String creatingUser, org.harctoolbox.ircore.IrSignal irSignal, String name, String comment, String deviceName) This constructor creates a RemoteSet from a single IrSignal.Create a RemoteSet from a single Remote, given as argument.This constructor is used to import a Document.This constructor is used to import an Element. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFormat(Command.CommandTextFormat format, int repeatCount) Applies the format argument to all Command's in the CommandSet.voidCopies the Remotes in the RemoteSet as argument, possibly replacing already existing.voidTries to generate the parameter version of the signal (decoding the signals), unless parameters already are present.voidSerializes the oject and writes it to a file.voiddump(OutputStream outputStream) Serializes the oject and writes it to a stream.(package private) AdminDatagetCommand(String name) getCommand(String remote, String commandSet, String command) Deprecated.Generates a list of the commands in all contained remotes.org.harctoolbox.irp.IrpDatabaseintDeprecated.Returns a particular remote.getTool()getTool2()booleanisEmpty()iterator()static voidFor testing only, not deployment.static RemoteSetGive a file or directory, parses the contained file(s) into a RemoteSet.static RemoteSetGive a file or directory, parses the contained file(s) into a RemoteSet.static RemoteSetstatic RemoteSetGive a file or directory, parses the contained file(s) into a RemoteSet.static RemoteSetstatic Collection<RemoteSet> parseAsCollection(File file) static Collection<RemoteSet> parseAsCollection(File file, Schema schema) Give a file or directory, parses the contained file(s) into a Collection of RemoteSets.static RemoteSetRestores a RemoteSet from a serialized file.static RemoteSetpmud(InputStream inputStream) Restores a RemoteSet from a serialized stream.static RemoteSetRestores a RemoteSet from a serialized String.voidvoidsetCreationDate(String date) intsize()Return the number of contained Remotes.voidsort(boolean recurse) voidsort(Comparator<? super Named> comparator, boolean recurse) voidstrip()Applies the strip function to the contained Ramotes.toElement(Document doc, boolean fatRaw, boolean generateParameters, boolean generateProntoHex, boolean generateRaw) Exports the Object to an Element.Methods inherited from class org.harctoolbox.girr.XmlExporter
getElement, getElement, getElement, getElement, getElement, getElement, getElement, print, print, print, print, print, toDocumentMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
RemoteSet
-
RemoteSet
-
RemoteSet
This constructor is used to import a Document.- Parameters:
doc- W3C Document with root element "remotes".- Throws:
GirrException
-
RemoteSet
This constructor is used to import an Element.- Parameters:
root- W3C Element of type "remotes".source-- Throws:
GirrException
-
RemoteSet
This constructor is used to read a Girr file into a RemoteSet.- Parameters:
file- XML file with root element of type remotes.- Throws:
GirrExceptionIOExceptionSAXException
-
RemoteSet
This constructor is used to read a Girr file into a RemoteSet.- Parameters:
file- XML file with root element of type remotes.- Throws:
GirrExceptionIOExceptionSAXException
-
RemoteSet
This constructor is used to read a Reader into a RemoteSet.- Parameters:
reader-schema-- Throws:
GirrExceptionIOExceptionSAXException
-
RemoteSet
public RemoteSet(String creatingUser, String source, String creationDate, String tool, String toolVersion, String tool2, String tool2Version, Map<String, String> notes, Map<String, Remote> remotes) This constructor sets up a RemoteSet from a given Map of Remotes, so that it can later be used through the xmlExport or xmlExportDocument to generate an XML export.- Parameters:
creatingUser- Comment field for the creating user, if wanted.source- Comment field describing the origin of the data; e.g. name of human author or creating program.creationDate- Date of creation, as text string.tool- Name of creating tool.toolVersion- Version of creating tool.tool2- Name of secondary tool, if applicable.tool2Version- Version of secondary tool.notes- Textual notes.remotes- Map of remotes.
-
RemoteSet
public RemoteSet(String creatingUser, String source, String creationDate, String tool, String toolVersion, String tool2, String tool2Version) This constructor sets up a RemoteSet with no Remotes.- Parameters:
creatingUser- Comment field for the creating user, if wanted.source- Comment field describing the origin of the data; e.g. name of human author or creating program.creationDate- Date of creation, as text string.tool- Name of creating tool.toolVersion- Version of creating tool.tool2- Name of secondary tppl, if applicable.tool2Version- Version of secondary tool.
-
RemoteSet
-
RemoteSet
public RemoteSet()This constructor sets up an empty RemoteSet. -
RemoteSet
public RemoteSet(String creatingUser, String source, String creationDate, String tool, String toolVersion, String tool2, String tool2Version, Map<String, String> notes, Remote remote) This constructor sets up a RemoteSet from one single Remote.- Parameters:
creatingUser-source-creationDate-tool-toolVersion-tool2-tool2Version-notes-remote-
-
RemoteSet
Convenience version of the one-remote constructor.- Parameters:
creatingUser-source-remote-
-
RemoteSet
Convenience version of the many-remote constructor.- Parameters:
creatingUser-source-remotes-
-
RemoteSet
public RemoteSet(String source, String creatingUser, org.harctoolbox.ircore.IrSignal irSignal, String name, String comment, String deviceName) This constructor creates a RemoteSet from a single IrSignal.- Parameters:
source-creatingUser-irSignal-name-comment-deviceName-
-
RemoteSet
Create a RemoteSet from a single Remote, given as argument.- Parameters:
remote-
-
-
Method Details
-
main
For testing only, not deployment.- Parameters:
args-
-
parseAsCollection
Give a file or directory, parses the contained file(s) into a Collection of RemoteSets. Can handle XML documents with root element to type remotes, remote, commandSet and command.- Parameters:
file-schema-- Returns:
-
parseAsCollection
-
parse
public static RemoteSet parse(File file, Schema schema) throws GirrException, IOException, SAXException Give a file or directory, parses the contained file(s) into a RemoteSet. Can handle XML documents with root element to type remotes, remote, commandSet and command.- Parameters:
file-schema-- Returns:
- Throws:
GirrExceptionIOExceptionSAXException
-
parse
Give a file or directory, parses the contained file(s) into a RemoteSet. Can handle XML documents with root element to type remotes, remote, commandSet and command.- Parameters:
file-- Returns:
- Throws:
GirrExceptionIOExceptionSAXException
-
parse
public static RemoteSet parse(String file, Schema schema) throws IOException, SAXException, GirrException Give a file or directory, parses the contained file(s) into a RemoteSet. Can handle XML documents with root element to type remotes, remote, commandSet and command.- Parameters:
file-schema-- Returns:
- Throws:
IOExceptionSAXExceptionGirrException
-
parse
- Throws:
IOExceptionSAXExceptionGirrException
-
parse
- Throws:
GirrException
-
pmud
Restores a RemoteSet from a serialized stream.- Parameters:
inputStream-- Returns:
- Throws:
IOExceptionClassNotFoundException
-
pmud
Restores a RemoteSet from a serialized file.- Parameters:
file-- Returns:
- Throws:
IOExceptionClassNotFoundException
-
pmud
Restores a RemoteSet from a serialized String.- Parameters:
thing-- Returns:
- Throws:
IOExceptionClassNotFoundException
-
setCreationDate
-
setCreationDate
public void setCreationDate() -
sort
-
sort
public void sort(boolean recurse) -
isEmpty
public boolean isEmpty() -
append
Copies the Remotes in the RemoteSet as argument, possibly replacing already existing.- Parameters:
remoteSet-
-
toElement
public Element toElement(Document doc, boolean fatRaw, boolean generateParameters, boolean generateProntoHex, boolean generateRaw) Description copied from class:XmlExporterExports the Object to an Element.- Specified by:
toElementin 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-
-
getCommands
Deprecated.Generates a list of the commands in all contained remotes. It may contain non-unique names. Deprecated, while meaningless: You do not want to know all commands of a RemoteSet, you want to know the commands of the individual Remotes.- Returns:
- ArrayList of the commands.
-
getCommand
-
getCommand
-
getNumberOfCommands
public int getNumberOfCommands()Deprecated.- Returns:
-
checkForParameters
public void checkForParameters() throws org.harctoolbox.irp.IrpException, org.harctoolbox.ircore.IrCoreExceptionTries to generate the parameter version of the signal (decoding the signals), unless parameters already are present.- Throws:
org.harctoolbox.irp.IrpExceptionorg.harctoolbox.ircore.IrCoreException
-
getAdminData
AdminData getAdminData() -
getCreatingUser
- Returns:
- the creatingUser
-
getSource
- Returns:
- the source
-
getCreationDate
- Returns:
- the creationDate
-
getTool
- Returns:
- the tool
-
getToolVersion
- Returns:
- the toolVersion
-
getTool2
- Returns:
- the tool2
-
getTool2Version
- Returns:
- the tool2Version
-
getNotes
- Parameters:
lang-- Returns:
- the notes
-
getRemotes
- Returns:
- Collection of the contained remotes.
-
getRemote
Returns a particular remote.- Parameters:
name-- Returns:
- Remote with the corresponding name, or null if not found.
-
iterator
-
getIrpDatabase
public org.harctoolbox.irp.IrpDatabase getIrpDatabase() -
size
public int size()Return the number of contained Remotes.- Returns:
-
strip
public void strip()Applies the strip function to the contained Ramotes. -
dump
Serializes the oject and writes it to a stream.- Parameters:
outputStream-- Throws:
IOException
-
dump
Serializes the oject and writes it to a file.- Parameters:
file-- Throws:
IOException
-