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
ConstructorDescriptionThis 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 TypeMethodDescriptionvoid
addFormat
(Command.CommandTextFormat format, int repeatCount) Applies the format argument to all Command's in the CommandSet.void
Copies the Remotes in the RemoteSet as argument, possibly replacing already existing.void
Tries to generate the parameter version of the signal (decoding the signals), unless parameters already are present.void
Serializes the oject and writes it to a file.void
dump
(OutputStream outputStream) Serializes the oject and writes it to a stream.(package private) AdminData
getCommand
(String name) getCommand
(String remote, String commandSet, String command) Deprecated.Generates a list of the commands in all contained remotes.org.harctoolbox.irp.IrpDatabase
int
Deprecated.Returns a particular remote.getTool()
getTool2()
boolean
isEmpty()
iterator()
static void
For testing only, not deployment.static RemoteSet
Give a file or directory, parses the contained file(s) into a RemoteSet.static RemoteSet
Give a file or directory, parses the contained file(s) into a RemoteSet.static RemoteSet
static RemoteSet
Give a file or directory, parses the contained file(s) into a RemoteSet.static RemoteSet
static 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 RemoteSet
Restores a RemoteSet from a serialized file.static RemoteSet
pmud
(InputStream inputStream) Restores a RemoteSet from a serialized stream.static RemoteSet
Restores a RemoteSet from a serialized String.void
void
setCreationDate
(String date) int
size()
Return the number of contained Remotes.void
sort
(boolean recurse) void
sort
(Comparator<? super Named> comparator, boolean recurse) void
strip()
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, toDocument
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:
GirrException
IOException
SAXException
-
RemoteSet
This constructor is used to read a Girr file into a RemoteSet.- Parameters:
file
- XML file with root element of type remotes.- Throws:
GirrException
IOException
SAXException
-
RemoteSet
This constructor is used to read a Reader into a RemoteSet.- Parameters:
reader
-schema
-- Throws:
GirrException
IOException
SAXException
-
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:
GirrException
IOException
SAXException
-
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:
GirrException
IOException
SAXException
-
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:
IOException
SAXException
GirrException
-
parse
- Throws:
IOException
SAXException
GirrException
-
parse
- Throws:
GirrException
-
pmud
Restores a RemoteSet from a serialized stream.- Parameters:
inputStream
-- Returns:
- Throws:
IOException
ClassNotFoundException
-
pmud
Restores a RemoteSet from a serialized file.- Parameters:
file
-- Returns:
- Throws:
IOException
ClassNotFoundException
-
pmud
Restores a RemoteSet from a serialized String.- Parameters:
thing
-- Returns:
- Throws:
IOException
ClassNotFoundException
-
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: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
-
-
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.IrpException
org.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
-