Package ghidra.program.util
Class ProgramDiffFilter
- java.lang.Object
-
- ghidra.program.util.ProgramDiffFilter
-
public class ProgramDiffFilter extends java.lang.Object
TheProgramDiffFilter
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 int
ALL_DIFFS
Indicates all filters for all defined types of differences.static int
BOOKMARK_DIFFS
Indicates the filter for bookmark differences.static int
BYTE_DIFFS
Indicates the filter for the byte differences.static int
CODE_UNIT_DIFFS
Indicates the filter for the code unit differences.static int
COMMENT_DIFFS
Indicates all comment filters.static int
EOL_COMMENT_DIFFS
Indicates the filter for the end of line comment differences.static int
EQUATE_DIFFS
Indicates the filter for the equates differences.static int
FUNCTION_DIFFS
Indicates the filter for the function differences.static int
FUNCTION_TAG_DIFFS
Indicates the filter for the function tag differences.static int
PLATE_COMMENT_DIFFS
Indicates the filter for the plate comment differences.static int
POST_COMMENT_DIFFS
Indicates the filter for the post comment differences.static int
PRE_COMMENT_DIFFS
Indicates the filter for the pre comment differences.static int
PROGRAM_CONTEXT_DIFFS
Indicates the filter for the program context (register) differences.static int
REFERENCE_DIFFS
Indicates the filter for memory, variable, and external reference differences.static int
REPEATABLE_COMMENT_DIFFS
Indicates the filter for the repeatable comment differences.static int
SYMBOL_DIFFS
Indicates the filter for the symbol differences.static int
USER_DEFINED_DIFFS
Indicates the filter for the user defined property differences.
-
Constructor Summary
Constructors Constructor Description ProgramDiffFilter()
Creates new ProgramDiffFilter with none of the diff types selected.ProgramDiffFilter(int type)
Creates new ProgramDiffFilter with the specified diff types selected.ProgramDiffFilter(ProgramDiffFilter filter)
Creates new ProgramDiffFilter equivalent to the specified ProgramDiffFilter.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.void
clearAll()
Sets all the defined types of differences to false.boolean
equals(java.lang.Object obj)
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[]
getPrimaryTypes()
Gets all the valid individual types of differences for this filter.void
selectAll()
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).java.lang.String
toString()
Returns a string representation of the current settings for this filter.static java.lang.String
typeToName(int type)
typeToName()
returns the name of the difference type.
-
-
-
Field Detail
-
PROGRAM_CONTEXT_DIFFS
public static final int PROGRAM_CONTEXT_DIFFS
Indicates the filter for the program context (register) differences.- See Also:
- Constant Field Values
-
BYTE_DIFFS
public static final int BYTE_DIFFS
Indicates the filter for the byte differences.- See Also:
- Constant Field Values
-
CODE_UNIT_DIFFS
public static final int CODE_UNIT_DIFFS
Indicates the filter for the code unit differences.- See Also:
- Constant Field Values
-
EOL_COMMENT_DIFFS
public static final int EOL_COMMENT_DIFFS
Indicates the filter for the end of line comment differences.- See Also:
- Constant Field Values
-
PRE_COMMENT_DIFFS
public static final int PRE_COMMENT_DIFFS
Indicates the filter for the pre comment differences.- See Also:
- Constant Field Values
-
POST_COMMENT_DIFFS
public static final int POST_COMMENT_DIFFS
Indicates the filter for the post comment differences.- See Also:
- Constant Field Values
-
PLATE_COMMENT_DIFFS
public static final int PLATE_COMMENT_DIFFS
Indicates the filter for the plate comment differences.- See Also:
- Constant Field Values
-
REPEATABLE_COMMENT_DIFFS
public static final int REPEATABLE_COMMENT_DIFFS
Indicates the filter for the repeatable comment differences.- See Also:
- Constant Field Values
-
REFERENCE_DIFFS
public static final int REFERENCE_DIFFS
Indicates the filter for memory, variable, and external reference differences.- See Also:
- Constant Field Values
-
EQUATE_DIFFS
public static final int EQUATE_DIFFS
Indicates the filter for the equates differences.- See Also:
- Constant Field Values
-
SYMBOL_DIFFS
public static final int SYMBOL_DIFFS
Indicates the filter for the symbol differences.- See Also:
- Constant Field Values
-
FUNCTION_DIFFS
public static final int FUNCTION_DIFFS
Indicates the filter for the function differences.- See Also:
- Constant Field Values
-
BOOKMARK_DIFFS
public static final int BOOKMARK_DIFFS
Indicates the filter for bookmark differences.- See Also:
- Constant Field Values
-
USER_DEFINED_DIFFS
public static final int USER_DEFINED_DIFFS
Indicates the filter for the user defined property differences.- See Also:
- Constant Field Values
-
FUNCTION_TAG_DIFFS
public static final int FUNCTION_TAG_DIFFS
Indicates the filter for the function tag differences.- See Also:
- Constant Field Values
-
COMMENT_DIFFS
public static final int COMMENT_DIFFS
Indicates all comment filters.- See Also:
- Constant Field Values
-
ALL_DIFFS
public static final int ALL_DIFFS
Indicates all filters for all defined types of differences.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
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 Detail
-
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_DIFFSfilter
- 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 java.lang.String typeToName(int type)
typeToName()
returns the name of the difference type. Only predefined types, as specified inProgramDiffFilter
, 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(java.lang.Object obj)
Determines whether or not this filter is equal to the object that is passed in.- Overrides:
equals
in classjava.lang.Object
- Parameters:
obj
- the object to compare this one with.- Returns:
- true if the filter matches this one.
-
toString
public java.lang.String toString()
Returns a string representation of the current settings for this filter.- Overrides:
toString
in classjava.lang.Object
-
-