Package ghidra.program.model.data
Class ParameterDefinitionImpl
- java.lang.Object
-
- ghidra.program.model.data.ParameterDefinitionImpl
-
- All Implemented Interfaces:
ParameterDefinition,java.lang.Comparable<ParameterDefinition>
public class ParameterDefinitionImpl extends java.lang.Object implements ParameterDefinition
-
-
Constructor Summary
Constructors Modifier Constructor Description ParameterDefinitionImpl(java.lang.String name, DataType dataType, java.lang.String comment)Constructs a new ParameterImp with an unassigned ordinal.protectedParameterDefinitionImpl(java.lang.String name, DataType dataType, java.lang.String comment, int ordinal)Constructs a new ParameterImp
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(ParameterDefinition p)java.lang.StringgetComment()Get the Comment for this variableDataTypegetDataType()Get the Data Type of this variableintgetLength()Get the length of this variablejava.lang.StringgetName()Get the Name of this variable.intgetOrdinal()Get the parameter ordinalbooleanisEquivalent(ParameterDefinition parm)Determine if parm is equivalent to this parameter definition by both ordinal and datatype.booleanisEquivalent(Variable variable)Determine if a variable corresponds to a parameter which is equivalent to this parameter definition by both ordinal and datatype.voidsetComment(java.lang.String comment)Set the comment for this variablevoidsetDataType(DataType type)Set the Data Type of this variable.voidsetName(java.lang.String name)Set the name of this variable.java.lang.StringtoString()static DataTypevalidateDataType(DataType dataType, DataTypeManager dtMgr, boolean isReturn)Validate the specified datatype based upon its' use as a parameter or return type.
-
-
-
Constructor Detail
-
ParameterDefinitionImpl
public ParameterDefinitionImpl(java.lang.String name, DataType dataType, java.lang.String comment)Constructs a new ParameterImp with an unassigned ordinal. The ordinal will be established by the function definition.- Parameters:
name- the name of the parameter.dataType- the fixed-length datatype of the parametercomment- the comment to store about this parameter.- Throws:
java.lang.IllegalArgumentException- if invalid parameter datatype specified
-
ParameterDefinitionImpl
protected ParameterDefinitionImpl(java.lang.String name, DataType dataType, java.lang.String comment, int ordinal)Constructs a new ParameterImp- Parameters:
name- the name of the parameter.dataType- the fixed-length datatype of the parametercomment- the comment to store about this parameter.ordinal- the index of this parameter within the function signature.- Throws:
java.lang.IllegalArgumentException- if invalid parameter datatype specified
-
-
Method Detail
-
validateDataType
public static DataType validateDataType(DataType dataType, DataTypeManager dtMgr, boolean isReturn) throws java.lang.IllegalArgumentException
Validate the specified datatype based upon its' use as a parameter or return type. Ensure that the datatype has been cloned to the specified datatype manager (dtMgr).- Parameters:
dataType- datatype to be validateddtMgr- target datatype managerisReturn- true if checking return datatype, false if parameter datatype.- Returns:
- datatype suitable for use within the target
FunctionDefinition. - Throws:
java.lang.IllegalArgumentException- if invalid datatype specified
-
compareTo
public final int compareTo(ParameterDefinition p)
- Specified by:
compareToin interfacejava.lang.Comparable<ParameterDefinition>- See Also:
Comparable.compareTo(java.lang.Object)
-
getOrdinal
public int getOrdinal()
Description copied from interface:ParameterDefinitionGet the parameter ordinal- Specified by:
getOrdinalin interfaceParameterDefinition- Returns:
- the ordinal (index) of this parameter within the function signature.
-
getComment
public java.lang.String getComment()
Description copied from interface:ParameterDefinitionGet the Comment for this variable- Specified by:
getCommentin interfaceParameterDefinition- Returns:
- the comment
-
getDataType
public DataType getDataType()
Description copied from interface:ParameterDefinitionGet the Data Type of this variable- Specified by:
getDataTypein interfaceParameterDefinition- Returns:
- the data type of the variable
-
getLength
public int getLength()
Description copied from interface:ParameterDefinitionGet the length of this variable- Specified by:
getLengthin interfaceParameterDefinition- Returns:
- the length of the variable
-
getName
public java.lang.String getName()
Description copied from interface:ParameterDefinitionGet the Name of this variable.- Specified by:
getNamein interfaceParameterDefinition- Returns:
- the name of the variable or null if no name has been specified.
-
setComment
public void setComment(java.lang.String comment)
Description copied from interface:ParameterDefinitionSet the comment for this variable- Specified by:
setCommentin interfaceParameterDefinition- Parameters:
comment- the comment
-
setDataType
public void setDataType(DataType type)
Description copied from interface:ParameterDefinitionSet the Data Type of this variable.- Specified by:
setDataTypein interfaceParameterDefinition- Parameters:
type- dataType the fixed-length datatype of the parameter
-
setName
public void setName(java.lang.String name)
Description copied from interface:ParameterDefinitionSet the name of this variable.- Specified by:
setNamein interfaceParameterDefinition- Parameters:
name- the name
-
isEquivalent
public boolean isEquivalent(Variable variable)
Description copied from interface:ParameterDefinitionDetermine if a variable corresponds to a parameter which is equivalent to this parameter definition by both ordinal and datatype. Name is not considered relevant.- Specified by:
isEquivalentin interfaceParameterDefinition- Parameters:
variable- variable to be compared with this parameter definition.- Returns:
- true if the specified variable represents the same parameter by ordinal
and dataType. False will always be returned if specified variable is
not a
Parameter.
-
isEquivalent
public boolean isEquivalent(ParameterDefinition parm)
Description copied from interface:ParameterDefinitionDetermine if parm is equivalent to this parameter definition by both ordinal and datatype. Name is not considered relevant.- Specified by:
isEquivalentin interfaceParameterDefinition- Parameters:
parm- parameter definition to be compared with this parameter definition.- Returns:
- true if the specified parameter definition represents the same parameter by ordinal and dataType.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-