Class AssemblyResolution
- All Implemented Interfaces:
Comparable<AssemblyResolution>
- Direct Known Subclasses:
AssemblyResolvedBackfill,AssemblyResolvedError,AssemblyResolvedPatterns
These may represent a successful construction (AssemblyResolvedPatterns, a future field
(AssemblyResolvedBackfill), or an error (AssemblyResolvedError).
This class also provides the static factory methods for constructing any of its subclasses.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final List<AssemblyResolution>protected final Stringprotected final AssemblyResolution -
Method Summary
Modifier and TypeMethodDescriptionstatic AssemblyResolvedBackfillbackfill(PatternExpression exp, MaskedLong goal, int inslen, String description) Build a backfill record to attach to a successful resolution resultprotected StringchildrenToString(String indent) Get the child portion oftoString()protected voidintcompareTo(AssemblyResolution that) protected abstract intstatic AssemblyResolvedPatternscontextOnly(AssemblyPatternBlock ctx, String description) Build a context-only successful resolution resultstatic AssemblyResolutionerror(String error, AssemblyResolvedPatterns res) Build an error resolution record, based on an intermediate SLEIGH constructor recordstatic AssemblyResolvedErrorBuild an error resolution recordstatic AssemblyResolvedErrorerror(String error, String description, List<? extends AssemblyResolution> children, AssemblyResolution right) Build an error resolution recordstatic AssemblyResolvedPatternsfromPattern(DisjointPattern pat, int minLen, String description, Constructor cons) Build a successful resolution result from a SLEIGH constructor's patternsprotected List<AssemblyResolution>booleanCheck if this record has childreninthashCode()static AssemblyResolvedPatternsinstrOnly(AssemblyPatternBlock ins, String description) Build an instruction-only successful resolution resultabstract booleanCheck if this record describes a backfillabstract booleanisError()Check if this record describes an errorprotected abstract StringDisplay the resolution result in one line (omitting child details)static AssemblyResolvedPatternsObtain a new "blank" resolved SLEIGH constructor recordstatic AssemblyResolvedPatternsnop(String description, List<? extends AssemblyResolution> children, AssemblyResolution right) Obtain a new "blank" resolved SLEIGH constructor recordabstract AssemblyResolutionGet this same resolution, pushing its right siblings down to its childrenstatic AssemblyResolvedPatternsresolved(AssemblyPatternBlock ins, AssemblyPatternBlock ctx, String description, Constructor cons, List<? extends AssemblyResolution> children, AssemblyResolution right) Build the result of successfully resolving a SLEIGH constructorabstract AssemblyResolutionshift(int amt) Shift the resolution's instruction pattern to the right, if applicabletoString()Describe this record including indented children, grandchildren, etc., each on its own lineUsed only by parents: get a multi-line description of this record, indentedGet this same resolution, but without any right siblingsabstract AssemblyResolutionwithRight(AssemblyResolution right) Get this same resolution, but with the given right sibling
-
Field Details
-
description
-
children
-
right
-
-
Method Details
-
hashCode
public int hashCode() -
computeHash
protected abstract int computeHash() -
resolved
public static AssemblyResolvedPatterns resolved(AssemblyPatternBlock ins, AssemblyPatternBlock ctx, String description, Constructor cons, List<? extends AssemblyResolution> children, AssemblyResolution right) Build the result of successfully resolving a SLEIGH constructorNOTE: This is not used strictly for resolved SLEIGH constructors. It may also be used to store intermediates, e.g., encoded operands, during constructor resolution.
- Parameters:
ins- the instruction pattern blockctx- the context pattern blockdescription- a description of the resolutioncons- the constructor, or nullchildren- the children of this constructor, or null- Returns:
- the new resolution
-
instrOnly
Build an instruction-only successful resolution result- Parameters:
ins- the instruction pattern blockdescription- a description of the resolution- Returns:
- the new resolution
- See Also:
-
contextOnly
Build a context-only successful resolution result- Parameters:
ctx- the context pattern blockdescription- a description of the resolution- Returns:
- the new resolution
- See Also:
-
fromPattern
public static AssemblyResolvedPatterns fromPattern(DisjointPattern pat, int minLen, String description, Constructor cons) Build a successful resolution result from a SLEIGH constructor's patterns- Parameters:
pat- the constructor's patterndescription- a description of the resolution- Returns:
- the new resolution
-
backfill
public static AssemblyResolvedBackfill backfill(PatternExpression exp, MaskedLong goal, int inslen, String description) Build a backfill record to attach to a successful resolution result- Parameters:
exp- the expression depending on a missing symbolgoal- the desired value of the expressioninslen- the length of instruction portion expected in the future solutiondescription- a description of the backfill record- Returns:
- the new record
-
nop
public static AssemblyResolvedPatterns nop(String description, List<? extends AssemblyResolution> children, AssemblyResolution right) Obtain a new "blank" resolved SLEIGH constructor record- Parameters:
description- a description of the resolutionchildren- any children that will be involved in populating this record- Returns:
- the new resolution
-
nop
Obtain a new "blank" resolved SLEIGH constructor record- Parameters:
description- a description of the resolution- Returns:
- the new resolution
-
error
public static AssemblyResolvedError error(String error, String description, List<? extends AssemblyResolution> children, AssemblyResolution right) Build an error resolution record- Parameters:
error- a description of the errordescription- a description of what the resolver was doing when the error ocurredchildren- any children involved in generating the error- Returns:
- the new resolution
-
error
Build an error resolution record- Parameters:
error- a description of the errordescription- a description of what the resolver was doing when the error occurred- Returns:
- the new resolution
-
error
Build an error resolution record, based on an intermediate SLEIGH constructor record- Parameters:
error- a description of the errorres- the constructor record that was being populated when the error ocurred- Returns:
- the new error resolution
-
isError
public abstract boolean isError()Check if this record describes an error- Returns:
- true if the record is an error
-
isBackfill
public abstract boolean isBackfill()Check if this record describes a backfill- Returns:
- true if the record is a backfill
-
lineToString
Display the resolution result in one line (omitting child details)- Returns:
- the display description
-
getAllRight
-
collectAllRight
-
childrenToString
Get the child portion oftoString()If a subclass has another, possible additional, notion of children that it would like to include in
toString(), it must override this method.- Parameters:
indent- the current indentation- Returns:
- the indented description for each child on its own line
- See Also:
-
toString
Used only by parents: get a multi-line description of this record, indented- Parameters:
indent- the current indentation- Returns:
- the indented description
-
toString
Describe this record including indented children, grandchildren, etc., each on its own line -
compareTo
- Specified by:
compareToin interfaceComparable<AssemblyResolution>
-
hasChildren
public boolean hasChildren()Check if this record has childrenIf a subclass has another, possibly additional, notion of children that it would like to include in
toString(), it must override this method to return true when such children are present.- Returns:
- true if this record has children
- See Also:
-
shift
Shift the resolution's instruction pattern to the right, if applicableThis also shifts any backfill and forbidden pattern records.
- Parameters:
amt- the number of bytes to shift.- Returns:
- the result
-
withoutRight
Get this same resolution, but without any right siblings- Returns:
- the resolution
-
withRight
Get this same resolution, but with the given right sibling- Returns:
- the resolution
-
parent
Get this same resolution, pushing its right siblings down to its children
-