Interface Referent<TB,S,I,QI>
- Type Parameters:
TB- The type binding typeS- The scope type (optional)I- The type used to represent identifiersQI- The type used to represent qualified identifiers
- All Superinterfaces:
FeatureContainer<QI>
- All Known Implementing Classes:
AbstractReferent,DA1ReStrategy.DA1Referent,IA1MrStrategy.IA1MrReferent,IA2FStrategy.IA2FReferent,IA2MgStrategy.IA2MgReferent
public interface Referent<TB,S,I,QI> extends FeatureContainer<QI>
The representation of a referent. A referent may provide a number of
features.
-
Method Summary
Modifier and Type Method Description booleancanBeUsedInsteadOf(Referent<TB,S,I,QI> other)Used to resolve ambiguity between referents.StringgetDescription()ObjectgetMemento()Return an object whoseObject.toString()method returns a representation of the internal state of the referent that can be passed toAnaphorResolutionStrategy.createReferent(Object, de.monochromata.anaphors.ast.relatedexp.RelatedExpression, Object)TODO: UseRelatedExpressionsSpimethods to convert the memento to a String and back, or create a ReferentSpi.IgetMethodName()Returns the name of the method invocation which creates this referent, ifhasMethodName()returns true.QIgetName()Returns the name of this referent.booleanhasMethodName()Returns true, if this referent is created by a method invocation.booleanhasName()TBresolveType(S scope)The type of the referent - is identical to the return type, if the referent is a method.Methods inherited from interface de.monochromata.anaphors.ast.feature.FeatureContainer
containsFeaturesOf, getFeatures, isEmpty
-
Method Details
-
canBeUsedInsteadOf
Used to resolve ambiguity between referents. Cases of resolvable ambiguity include e.g. a referent that represents the invocation of a getter method that returns the value of the field that is represented by another referent.- Parameters:
other- Another referent.- Returns:
- True, if this referent represents the same referent as
otherand this related expression should be used instead ofotherin order to eliminate the ambiguity between the two. False is returned otherwise.
-
hasName
boolean hasName() -
getName
Returns the name of this referent. IfhasMethodName()returns true and the method name is the only name of this referent, this method returns a name constructed from the method name. That name is constructed by removing any getter or setter prefix to the method name and by turning the first character of the remaining string into lower case.- Returns:
- The name of this referent.
- Throws:
UnsupportedOperationException- IfhasName()returns false.
-
hasMethodName
boolean hasMethodName()Returns true, if this referent is created by a method invocation. TODO: Maybe replace by a system of thematic roles- Returns:
- True, if the referent is created by a method invocation, false otherwise.
- See Also:
getMethodName()
-
getMethodName
Returns the name of the method invocation which creates this referent, ifhasMethodName()returns true. TODO: Maybe replace by a system of thematic roles- Returns:
- The method name.
- Throws:
UnsupportedOperationException- IfhasMethodName()returns false.
-
resolveType
The type of the referent - is identical to the return type, if the referent is a method.- Parameters:
scope- The scope containing the referent if used by the compiler-specific implementation. Implementations of this method must not access the scope but merely pass it on to SPI's they invoke.- Returns:
- The type binding of the referent.
-
getMemento
Return an object whoseObject.toString()method returns a representation of the internal state of the referent that can be passed toAnaphorResolutionStrategy.createReferent(Object, de.monochromata.anaphors.ast.relatedexp.RelatedExpression, Object)TODO: UseRelatedExpressionsSpimethods to convert the memento to a String and back, or create a ReferentSpi.- Returns:
- A memento object.
-
getDescription
-