Class GlobalCommand

java.lang.Object
VASSAL.counters.GlobalCommand
All Implemented Interfaces:
Auditable
Direct Known Subclasses:
DeckGlobalKeyCommand.DeckGlobalCommand, GlobalAttach, GlobalDetach, GlobalSetter

public class GlobalCommand extends Object implements Auditable
The heart of all the different forms of Global Key Command, GlobalCommand handles sending a key command to multiple pieces, potentially on multiple maps, as long as they match its filtering condition. The various forms of Global Key Command that use GlobalCommand are: GlobalKeyCommand - Global Key Commands from a Module window StartupGlobalKeyCommand - Startup Global Key Commands from a Module MassKeyCommand - Global Key Commands from a specific Map window DeckGlobalKeyCommand - Global Key Commands from a Deck CounterGlobalKeyCommand - Global Key Command from a Game Piece Other important classes: GlobalCommandTarget - "Fast Match" parameters GlobalCommandTargetConfigurer - configurer for "Fast Match" parameters
  • Field Details

  • Constructor Details

  • Method Details

    • getComponentTypeName

      public String getComponentTypeName()
      Description copied from interface: Auditable
      Return a description of the Type of trait or Component an Auditable is
      Specified by:
      getComponentTypeName in interface Auditable
      Returns:
      Component Type
    • getComponentName

      public String getComponentName()
      Description copied from interface: Auditable
      Return the name of the trait or Component an Auditable is
      Specified by:
      getComponentName in interface Auditable
      Returns:
      Component name
    • setPropertySource

      public void setPropertySource(PropertySource ps)
    • getPropertySource

      public PropertySource getPropertySource()
    • setKeyStroke

      public void setKeyStroke(KeyStroke keyStroke)
    • setKeyStroke

      public void setKeyStroke(NamedKeyStroke keyStroke)
    • setReportFormat

      public void setReportFormat(String format)
    • getKeyStroke

      public KeyStroke getKeyStroke()
    • getReportFormat

      public String getReportFormat()
    • isReportSingle

      public boolean isReportSingle()
    • setReportSingle

      public void setReportSingle(boolean reportSingle)
    • isSuppressSounds

      public boolean isSuppressSounds()
    • setSuppressSounds

      public void setSuppressSounds(boolean suppressSounds)
    • setTarget

      public void setTarget(GlobalCommandTarget target)
    • setRange

      public void setRange(Integer fastRange)
    • getParameters

      public List<Parameter> getParameters()
    • setParameters

      public void setParameters(List<Parameter> parameters)
    • isAbortIfNoCommand

      public boolean isAbortIfNoCommand()
      Allows subclasses like GlobalAttach to operate with no key command to send
      Returns:
      true if we should short-circuit (abort) the search if we have no key command to send
    • getTarget

      public GlobalCommandTarget getTarget()
    • apply

      public Command apply(Map[] maps, PieceFilter filter, GlobalCommandTarget fastMatch)
      Apply the key command to all pieces that pass the given filter and our Fast Match GlobalCommandTarget parameters on all the given maps
      Parameters:
      maps - Array of Maps
      filter - Filter to apply (created e.g. with PropertyExpression.getFilter(PropertySource, Auditable, String)
      fastMatch - Fast matching parameters, or null. GlobalCommandTarget and GlobalCommandTargetConfigurer
      Returns:
      the corresponding Command that would reproduce all the things this GKC just did, on another client.
    • apply

      public Command apply(Map[] maps, PieceFilter filter, GlobalCommandTarget fastMatch, AuditTrail audit)
      Apply the key command to all pieces that pass the given filter and our Fast Match GlobalCommandTarget parameters on all the given maps
      Parameters:
      maps - Array of Maps
      filter - Filter to apply (created e.g. with PropertyExpression.getFilter(PropertySource, Auditable, String)
      fastMatch - Fast matching parameters, or null. GlobalCommandTarget and GlobalCommandTargetConfigurer
      audit - Audit trail of evaluation of the filter so far
      Returns:
      the corresponding Command that would reproduce all the things this GKC just did, on another client.
    • checkForMatchingAttachments

      protected void checkForMatchingAttachments(Attachment attach, String attachmentName, String attachmentId, Set<GamePiece> pieces)
      Parameters:
      attach - Attachment trait to test
      attachmentName - Optional Attachment name to check for match
      attachmentId - Optional Basic Name or Attachment Index to check for match
      pieces - List of matching pieces to update
    • apply

      public Command apply(Map map, PieceFilter filter)
      (Legacy - applies GKC without Fast Match)
      Parameters:
      map - a single map
      filter - filter
      Returns:
      command
    • apply

      public Command apply(Map[] maps, PieceFilter filter)
      (Legacy - applies GKC without Fast Match)
      Parameters:
      maps - list of maps
      filter - filter
      Returns:
      command
    • apply

      public Command apply(Map map, PieceFilter filter, GlobalCommandTarget fastMatch)
      Apply the key command on ONE SPECIFIC MAP to all pieces that pass the given filter and our Fast Match parameters.
      Parameters:
      map - a single map
      filter - Filter to apply (created e.g. with PropertyExpression.getFilter(PropertySource, Auditable, String)
      fastMatch - Fast matching parameters, or null. GlobalCommandTarget and GlobalCommandTargetConfigurer
      Returns:
      the corresponding Command that would reproduce all the things this GKC just did, on another client.
    • apply

      public Command apply(Map map, PieceFilter filter, GlobalCommandTarget fastMatch, AuditTrail audit)
    • getVisitor

      protected GlobalCommandVisitor getVisitor(Command command, PieceFilter filter, KeyStroke keyStroke, AuditTrail audit, Auditable owner, int selectFromDeck)
    • getSelectFromDeck

      public int getSelectFromDeck()
    • getSelectFromDeckExpression

      public String getSelectFromDeckExpression()
    • setSelectFromDeckExpression

      public void setSelectFromDeckExpression(String selectFromDeck)
      Set the number of pieces to select from a deck that the command will apply to. A value lesser than 0 means to apply to all pieces in the deck
      Parameters:
      selectFromDeck - Number of pieces to select
    • setSelectFromDeck

      public void setSelectFromDeck(int selectFromDeck)
      Set the number of pieces to select from a deck that the command will apply to. A value lesser than 0 means to apply to all pieces in the deck
      Parameters:
      selectFromDeck - Number of pieces to select
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object