Class RemoteSet

java.lang.Object
org.harctoolbox.girr.XmlExporter
org.harctoolbox.girr.RemoteSet
All Implemented Interfaces:
Serializable, Iterable<Remote>

public final class RemoteSet extends XmlExporter implements 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 Details

    • RemoteSet

      public RemoteSet(String creatingUser, File file)
    • RemoteSet

      public RemoteSet(String creatingUser, String source, Collection<RemoteSet> remoteSets)
    • RemoteSet

      public RemoteSet(Document doc) throws GirrException
      This constructor is used to import a Document.
      Parameters:
      doc - W3C Document with root element "remotes".
      Throws:
      GirrException
    • RemoteSet

      public RemoteSet(Element root, String source) throws GirrException
      This constructor is used to import an Element.
      Parameters:
      root - W3C Element of type "remotes".
      source -
      Throws:
      GirrException
    • RemoteSet

      public RemoteSet(File file) throws GirrException, IOException, SAXException
      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

      public RemoteSet(String file) throws GirrException, IOException, SAXException
      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

      public RemoteSet(Reader reader, Schema schema) throws IOException, SAXException, GirrException
      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(AdminData adminData, Map<String,Remote> remotes)
    • 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

      public RemoteSet(String creatingUser, String source, Remote remote)
      Convenience version of the one-remote constructor.
      Parameters:
      creatingUser -
      source -
      remote -
    • RemoteSet

      public RemoteSet(String creatingUser, String source, Map<String,Remote> remotes)
      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

      public RemoteSet(Remote remote)
      Create a RemoteSet from a single Remote, given as argument.
      Parameters:
      remote -
  • Method Details

    • main

      public static void main(String[] args)
      For testing only, not deployment.
      Parameters:
      args -
    • parseAsCollection

      public static Collection<RemoteSet> parseAsCollection(File file, Schema schema)
      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

      public static Collection<RemoteSet> parseAsCollection(File file)
    • 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

      public static RemoteSet parse(File file) 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 -
      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

      public static RemoteSet parse(String file) throws IOException, SAXException, GirrException
      Throws:
      IOException
      SAXException
      GirrException
    • parse

      public static RemoteSet parse(Element element, String source) throws GirrException
      Throws:
      GirrException
    • pmud

      public static RemoteSet pmud(InputStream inputStream) throws IOException, ClassNotFoundException
      Restores a RemoteSet from a serialized stream.
      Parameters:
      inputStream -
      Returns:
      Throws:
      IOException
      ClassNotFoundException
    • pmud

      public static RemoteSet pmud(File file) throws IOException, ClassNotFoundException
      Restores a RemoteSet from a serialized file.
      Parameters:
      file -
      Returns:
      Throws:
      IOException
      ClassNotFoundException
    • pmud

      public static RemoteSet pmud(String thing) throws IOException, ClassNotFoundException
      Restores a RemoteSet from a serialized String.
      Parameters:
      thing -
      Returns:
      Throws:
      IOException
      ClassNotFoundException
    • setCreationDate

      public void setCreationDate(String date)
    • setCreationDate

      public void setCreationDate()
    • sort

      public void sort(Comparator<? super Named> comparator, boolean recurse)
    • sort

      public void sort(boolean recurse)
    • isEmpty

      public boolean isEmpty()
    • append

      public void append(RemoteSet remoteSet)
      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 class XmlExporter
      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

      public void addFormat(Command.CommandTextFormat format, int repeatCount)
      Applies the format argument to all Command's in the CommandSet.
      Parameters:
      format -
      repeatCount -
    • getCommands

      public Collection<Command> 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

      public List<Command> getCommand(String name)
    • getCommand

      public Command getCommand(String remote, String commandSet, String command)
    • getNumberOfCommands

      public int getNumberOfCommands()
      Deprecated.
      Returns:
    • checkForParameters

      public void checkForParameters() throws org.harctoolbox.irp.IrpException, org.harctoolbox.ircore.IrCoreException
      Tries 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

      public String getCreatingUser()
      Returns:
      the creatingUser
    • getSource

      public String getSource()
      Returns:
      the source
    • getCreationDate

      public String getCreationDate()
      Returns:
      the creationDate
    • getTool

      public String getTool()
      Returns:
      the tool
    • getToolVersion

      public String getToolVersion()
      Returns:
      the toolVersion
    • getTool2

      public String getTool2()
      Returns:
      the tool2
    • getTool2Version

      public String getTool2Version()
      Returns:
      the tool2Version
    • getNotes

      public String getNotes(String lang)
      Parameters:
      lang -
      Returns:
      the notes
    • getRemotes

      public Collection<Remote> getRemotes()
      Returns:
      Collection of the contained remotes.
    • getRemote

      public Remote getRemote(String name)
      Returns a particular remote.
      Parameters:
      name -
      Returns:
      Remote with the corresponding name, or null if not found.
    • iterator

      public Iterator<Remote> iterator()
      Specified by:
      iterator in interface Iterable<Remote>
    • 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

      public void dump(OutputStream outputStream) throws IOException
      Serializes the oject and writes it to a stream.
      Parameters:
      outputStream -
      Throws:
      IOException
    • dump

      public void dump(File file) throws IOException
      Serializes the oject and writes it to a file.
      Parameters:
      file -
      Throws:
      IOException