Package com.tonic.analysis.similarity
Enum SimilarityMetric
- java.lang.Object
-
- java.lang.Enum<SimilarityMetric>
-
- com.tonic.analysis.similarity.SimilarityMetric
-
- All Implemented Interfaces:
Serializable,Comparable<SimilarityMetric>
public enum SimilarityMetric extends Enum<SimilarityMetric>
Types of similarity metrics for comparing methods.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description COMBINEDBlends the other metrics by their weights; the only kind that is not a single metric.CONTROL_FLOWCompares control-flow graphs for isomorphic shape, ignoring the instructions in each block; weighted 0.7.EXACT_BYTECODEThe strictest comparison: normalized instruction bytes must match exactly, at full weight.OPCODE_SEQUENCECompares opcode sequences while ignoring operands, so constant and index changes do not break a match; weighted 0.8.STRUCTURALCompares coarse shape measures such as size, complexity, and loop count; the loosest signal, weighted 0.5.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description doublegetDefaultWeight()StringgetDescription()StringgetDisplayName()booleanisSingleMetric()static SimilarityMetricvalueOf(String name)Returns the enum constant of this type with the specified name.static SimilarityMetric[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
EXACT_BYTECODE
public static final SimilarityMetric EXACT_BYTECODE
The strictest comparison: normalized instruction bytes must match exactly, at full weight.
-
OPCODE_SEQUENCE
public static final SimilarityMetric OPCODE_SEQUENCE
Compares opcode sequences while ignoring operands, so constant and index changes do not break a match; weighted 0.8.
-
CONTROL_FLOW
public static final SimilarityMetric CONTROL_FLOW
Compares control-flow graphs for isomorphic shape, ignoring the instructions in each block; weighted 0.7.
-
STRUCTURAL
public static final SimilarityMetric STRUCTURAL
Compares coarse shape measures such as size, complexity, and loop count; the loosest signal, weighted 0.5.
-
COMBINED
public static final SimilarityMetric COMBINED
Blends the other metrics by their weights; the only kind that is not a single metric.
-
-
Method Detail
-
values
public static SimilarityMetric[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (SimilarityMetric c : SimilarityMetric.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static SimilarityMetric valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
getDisplayName
public String getDisplayName()
- Returns:
- the display name
-
getDescription
public String getDescription()
- Returns:
- the description
-
getDefaultWeight
public double getDefaultWeight()
- Returns:
- the default weight
-
isSingleMetric
public boolean isSingleMetric()
- Returns:
- true unless this is the weighted COMBINED metric
-
-