Name

class Name(val localName: String, val parent: Name? = null, val delimiter: String = ".") : Cloneable, Comparable<Name> , CharSequence

This class represents anything that can have a "Name". In the simplest case it only represents a local name in a flat hierarchy, such as myVariable. However, it can also be used to represent fully qualified name with a complex name hierarchy, such as my::namespace::function.

Constructors

Link copied to clipboard
constructor(localName: String, parent: Name? = null, language: Language<*>?)
constructor(localName: String, parent: Name? = null, delimiter: String = ".")

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

A potential namespace delimiter, usually either . or ::.

Link copied to clipboard

Checks whether the name for a function (as CharSequence) is a known operator name.

Link copied to clipboard
open override val length: Int
Link copied to clipboard

The local name (sometimes also called simple name) without any namespace information.

Link copied to clipboard
val parent: Name? = null

The parent name, e.g., the namespace this name lives in.

Functions

Link copied to clipboard
fun append(s: String): Name

This function appends a string to the local name and returns a new Name.

Link copied to clipboard
open fun chars(): IntStream
Link copied to clipboard
open override fun clone(): Name
Link copied to clipboard
open fun codePoints(): IntStream
Link copied to clipboard
open operator override fun compareTo(other: Name): Int

Compare names according to the string representation of the fullName.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
fun Name?.fqn(localName: String, delimiter: String = this?.delimiter ?: "."): Name

Returns a new Name based on the localName and the current name as parent.

Link copied to clipboard
open operator override fun get(index: Int): Char
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open fun isEmpty(): Boolean
Link copied to clipboard

A name can be considered as "qualified", if it has any specified parent. Otherwise, only the localName is specified and the name is "unqualified".

Link copied to clipboard

Determines if this name ends with the ending (i.e., the localNames match until the ending has no parent anymore).

Link copied to clipboard
fun replace(oldValue: String, newValue: String): Name

This functions replaces all occurrences of oldValue with newValue in the local name and returns a new Name.

Link copied to clipboard
open override fun subSequence(startIndex: Int, endIndex: Int): CharSequence
Link copied to clipboard
open override fun toString(): String

Returns the string representation of this name using a fully qualified name notation with the specified delimiter.