Class ProgramDiffFilter

java.lang.Object
ghidra.program.util.ProgramDiffFilter

public class ProgramDiffFilter extends Object
The ProgramDiffFilter is used when determining or working with differences between two programs. It indicates the types of program differences we are interested in. Each difference type can be set to true, indicating interest in differences of that type between two programs. False indicates no interest in this type of program difference.
Valid filter types are: BYTE_DIFFS, CODE_UNIT_DIFFS, PLATE_COMMENT_DIFFS, PRE_COMMENT_DIFFS, EOL_COMMENT_DIFFS, REPEATABLE_COMMENT_DIFFS, POST_COMMENT_DIFFS, REFERENCE_DIFFS, USER_DEFINED_DIFFS, BOOKMARK_DIFFS, SYMBOL_DIFFS, EQUATE_DIFFS, FUNCTION_DIFFS, PROGRAM_CONTEXT_DIFFS.
Predefined filter type combinations are: COMMENT_DIFFS and ALL_DIFFS.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Indicates all filters for all defined types of differences.
    static final int
    Indicates the filter for bookmark differences.
    static final int
    Indicates the filter for the byte differences.
    static final int
    Indicates the filter for the code unit differences.
    static final int
    Indicates all comment filters.
    static final int
    Indicates the filter for the end of line comment differences.
    static final int
    Indicates the filter for the equates differences.
    static final int
    Indicates the filter for the function differences.
    static final int
    Indicates the filter for the function tag differences.
    static final int
    Indicates the filter for the plate comment differences.
    static final int
    Indicates the filter for the post comment differences.
    static final int
    Indicates the filter for the pre comment differences.
    static final int
    Indicates the filter for the program context (register) differences.
    static final int
    Indicates the filter for memory, variable, and external reference differences.
    static final int
    Indicates the filter for the repeatable comment differences.
    static final int
    Indicates the filter for the symbol differences.
    static final int
    Indicates the filter for the user defined property differences.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates new ProgramDiffFilter with none of the diff types selected.
    Creates new ProgramDiffFilter with the specified diff types selected.
    Creates new ProgramDiffFilter equivalent to the specified ProgramDiffFilter.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    set this filter to look for types of differences in addition to those types where it is already looking for differences.
    void
    Sets all the defined types of differences to false.
    boolean
    Determines whether or not this filter is equal to the object that is passed in.
    boolean
    getFilter(int type)
    getFilter determines whether or not the specified type of filter is set.
    static int[]
    Gets all the valid individual types of differences for this filter.
    void
    Sets all the defined types of differences to true.
    void
    setFilter(int type, boolean filter)
    setFilter specifies whether or not the indicated type of difference will be included by the filter (true) or not included (false).
    Returns a string representation of the current settings for this filter.
    static String
    typeToName(int type)
    typeToName() returns the name of the difference type.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • PROGRAM_CONTEXT_DIFFS

      public static final int PROGRAM_CONTEXT_DIFFS
      Indicates the filter for the program context (register) differences.
      See Also:
    • BYTE_DIFFS

      public static final int BYTE_DIFFS
      Indicates the filter for the byte differences.
      See Also:
    • CODE_UNIT_DIFFS

      public static final int CODE_UNIT_DIFFS
      Indicates the filter for the code unit differences.
      See Also:
    • EOL_COMMENT_DIFFS

      public static final int EOL_COMMENT_DIFFS
      Indicates the filter for the end of line comment differences.
      See Also:
    • PRE_COMMENT_DIFFS

      public static final int PRE_COMMENT_DIFFS
      Indicates the filter for the pre comment differences.
      See Also:
    • POST_COMMENT_DIFFS

      public static final int POST_COMMENT_DIFFS
      Indicates the filter for the post comment differences.
      See Also:
    • PLATE_COMMENT_DIFFS

      public static final int PLATE_COMMENT_DIFFS
      Indicates the filter for the plate comment differences.
      See Also:
    • REPEATABLE_COMMENT_DIFFS

      public static final int REPEATABLE_COMMENT_DIFFS
      Indicates the filter for the repeatable comment differences.
      See Also:
    • REFERENCE_DIFFS

      public static final int REFERENCE_DIFFS
      Indicates the filter for memory, variable, and external reference differences.
      See Also:
    • EQUATE_DIFFS

      public static final int EQUATE_DIFFS
      Indicates the filter for the equates differences.
      See Also:
    • SYMBOL_DIFFS

      public static final int SYMBOL_DIFFS
      Indicates the filter for the symbol differences.
      See Also:
    • FUNCTION_DIFFS

      public static final int FUNCTION_DIFFS
      Indicates the filter for the function differences.
      See Also:
    • BOOKMARK_DIFFS

      public static final int BOOKMARK_DIFFS
      Indicates the filter for bookmark differences.
      See Also:
    • USER_DEFINED_DIFFS

      public static final int USER_DEFINED_DIFFS
      Indicates the filter for the user defined property differences.
      See Also:
    • FUNCTION_TAG_DIFFS

      public static final int FUNCTION_TAG_DIFFS
      Indicates the filter for the function tag differences.
      See Also:
    • COMMENT_DIFFS

      public static final int COMMENT_DIFFS
      Indicates all comment filters.
      See Also:
    • ALL_DIFFS

      public static final int ALL_DIFFS
      Indicates all filters for all defined types of differences.
      See Also:
  • Constructor Details

    • ProgramDiffFilter

      public ProgramDiffFilter()
      Creates new ProgramDiffFilter with none of the diff types selected.
    • ProgramDiffFilter

      public ProgramDiffFilter(ProgramDiffFilter filter)
      Creates new ProgramDiffFilter equivalent to the specified ProgramDiffFilter.
      Parameters:
      filter - the diff filter this one should equal.
    • ProgramDiffFilter

      public ProgramDiffFilter(int type)
      Creates new ProgramDiffFilter with the specified diff types selected.
      Parameters:
      type - one or more of the diff types "OR"ed together.
      i.e. CODE_UNIT_DIFFS | SYMBOL_DIFFS
  • Method Details

    • getFilter

      public boolean getFilter(int type)
      getFilter determines whether or not the specified type of filter is set.
      Parameters:
      type - the set bits indicate the type of differences we want to check as being set in the filter.
      For example, one or more of the diff types "OR"ed together.
      i.e. CODE_UNIT_DIFFS | SYMBOL_DIFFS
      Returns:
      true if filtering for the specified type of differences.
    • addToFilter

      public void addToFilter(ProgramDiffFilter filter)
      set this filter to look for types of differences in addition to those types where it is already looking for differences. The filter that is passed as a parameter indicates the additional types of differences.
      Parameters:
      filter - filter indicating the additional types of differences to look for between the programs.
    • setFilter

      public void setFilter(int type, boolean filter)
      setFilter specifies whether or not the indicated type of difference will be included by the filter (true) or not included (false).
      Parameters:
      type - the set bits indicate the type of differences we want to look for in the programs.
      For example, one or more of the diff types "OR"ed together.
      i.e. CODE_UNIT_DIFFS | SYMBOL_DIFFS
      filter - true if you want to determine differences of the specified type.
    • clearAll

      public void clearAll()
      Sets all the defined types of differences to false. Filter indicates no interest in any difference types.
    • selectAll

      public void selectAll()
      Sets all the defined types of differences to true. Filter indicates interest in all difference types.
    • getPrimaryTypes

      public static int[] getPrimaryTypes()
      Gets all the valid individual types of differences for this filter. These are also referred to as primary difference types.
      Returns:
      an array containing all the currently defined difference types
    • typeToName

      public static String typeToName(int type)
      typeToName() returns the name of the difference type. Only predefined types, as specified in ProgramDiffFilter, will return a name. Otherwise, an empty string is returned.
      Parameters:
      type - the type of difference whose name is wanted.
      Returns:
      the name of the predefined difference type. Otherwise, the empty string.
    • equals

      public boolean equals(Object obj)
      Determines whether or not this filter is equal to the object that is passed in.
      Overrides:
      equals in class Object
      Parameters:
      obj - the object to compare this one with.
      Returns:
      true if the filter matches this one.
    • toString

      public String toString()
      Returns a string representation of the current settings for this filter.
      Overrides:
      toString in class Object