Top Description Fields Constructors Methods
org.python.indexer.ast

public Class NQname

extends NNode
Class Inheritance
Imports
org.python.indexer.Indexer, .NBinding, .Scope, .Util, org.python.indexer.types.NType, .NModuleType, .NUnknownType, java.io.File

Recursive doubly-linked list representation of a qualified module name, either absolute or relative. Similar to NAttribute, but handles leading dots and other import-specific special cases.

Qualified names with leading dots are given NQname elements for each leading dot. Dots separating simple names are not given NQname elements.

Field Summary

Modifier and TypeField and Description
private NName
private NQname
pack-priv static final long
Inherited from org.python.indexer.ast.NNode:
parent

Constructor Summary

AccessConstructor and Description
public
NQname(NQname next, NName name)

public
NQname(NQname next, NName name, int start, int end)

Method Summary

Modifier and TypeMethod and Description
public NQname
getBottom()

Returns the last/bottom component of the chain.

public NName
getName()

Returns this component of the qname chain.

public NQname
getNext()

Returns the next component of the chain, or null if this is the last component.

public NQname
getPrevious()

Returns the previous component of this qname chain, or null if this is the first component.

private NModuleType
public NQname
getTop()

Returns the top (first) component in the chain.

public boolean
isBottom()

Returns true if this is the last/bottom component of the chain, or if the name is unqualified (i.e. has only one component, no dots).

public boolean
isDot()

Returns true if this qname component is a leading dot.

private boolean
public boolean
isTop()

Returns true if this is the first/top component of the chain, or if the name is unqualified (i.e. has only one component, no dots).

public boolean
isUnqualified()

Returns true if this qname represents a simple, non-dotted module name such as "os", "random" or "foo".

private void
public NType

Returns:

the module represented by the qname up to this point.
resolve
(Scope s)

Overrides org.python.indexer.ast.NNode.resolve.

Resolves and loads the module named by this qname.

private NType
public String
thisQname()

Returns the qname down to (and including) this component, ending with this component's name.

public String
toQname()

Joins all components in this qname chain, beginning with the current component.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public void
visit(NNodeVisitor
the object to call with this node. If the visitor returns true, the node also passes its children to the visitor.
v
)

Implements abstract org.python.indexer.ast.NNode.visit.

Visits this node and optionally its children.

Inherited from org.python.indexer.ast.NNode:
addChildrenaddChildrenaddErroraddErroraddTypeaddWarningaddWarningbindNamesbindsNameendgetAstRootgetDeepestNodeAtOffsetgetEnclosingNamespacegetFilegetParentgetTablegetTypeisCallisClassDefisFunctionDefisLambdaisModuleisNamelengthresolveExprresolveListresolveListAsUnionsetEndsetParentsetStartsetTypestartvisitNodevisitNodeList

Field Detail

nameback to summary
private NName name
nextback to summary
private NQname next
serialVersionUIDback to summary
pack-priv static final long serialVersionUID

Hides org.python.indexer.ast.NNode.serialVersionUID.

Constructor Detail

NQnameback to summary
public NQname(NQname next, NName name)
NQnameback to summary
public NQname(NQname next, NName name, int start, int end)

Method Detail

getBottomback to summary
public NQname getBottom()

Returns the last/bottom component of the chain.

getNameback to summary
public NName getName()

Returns this component of the qname chain.

getNextback to summary
public NQname getNext()

Returns the next component of the chain, or null if this is the last component.

getPreviousback to summary
public NQname getPrevious()

Returns the previous component of this qname chain, or null if this is the first component.

getStartModuleback to summary
private NModuleType getStartModule(Scope s) throws Exception
getTopback to summary
public NQname getTop()

Returns the top (first) component in the chain.

isBottomback to summary
public boolean isBottom()

Returns true if this is the last/bottom component of the chain, or if the name is unqualified (i.e. has only one component, no dots).

isDotback to summary
public boolean isDot()

Returns true if this qname component is a leading dot.

isInitPyback to summary
private boolean isInitPy()
isTopback to summary
public boolean isTop()

Returns true if this is the first/top component of the chain, or if the name is unqualified (i.e. has only one component, no dots).

isUnqualifiedback to summary
public boolean isUnqualified()

Returns true if this qname represents a simple, non-dotted module name such as "os", "random" or "foo".

reportUnresolvedModuleback to summary
private void reportUnresolvedModule()
resolveback to summary
public NType resolve(Scope s) throws Exception

Overrides org.python.indexer.ast.NNode.resolve.

Resolves and loads the module named by this qname.

Returns:NType

the module represented by the qname up to this point.

Annotations
@Override
resolveInFilesystemback to summary
private NType resolveInFilesystem(Scope s) throws Exception
thisQnameback to summary
public String thisQname()

Returns the qname down to (and including) this component, ending with this component's name. For instance, if this NQname instance represents the foo in org.foo.bar, this method will return org.foo.

toQnameback to summary
public String toQname()

Joins all components in this qname chain, beginning with the current component.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
visitback to summary
public void visit(NNodeVisitor v)

Implements abstract org.python.indexer.ast.NNode.visit.

Doc from org.python.indexer.ast.NNode.visit.

Visits this node and optionally its children.

Parameters
v:NNodeVisitor

the object to call with this node. If the visitor returns true, the node also passes its children to the visitor.

Annotations
@Override