Name

class Name(tokens: List<NameToken>)

The general interface for working with names. The name is a dot separated list of strings like token1.token2.token3. Each token could contain additional index in square brackets.

Constructors

Name
Link copied to clipboard
common
fun Name(tokens: List<NameToken>)

Types

Companion
Link copied to clipboard
common
object Companion

Functions

equals
Link copied to clipboard
common
open operator override fun equals(other: Any?): Boolean
hashCode
Link copied to clipboard
common
open override fun hashCode(): Int
toString
Link copied to clipboard
common
open override fun toString(): String

Properties

tokens
Link copied to clipboard
common
val tokens: List<NameToken>

Extensions

appendLeft
Link copied to clipboard
common
fun Name.appendLeft(other: String): Name
cutFirst
Link copied to clipboard
common
fun Name.cutFirst(): Name

The reminder of the name after first element is cut. For empty name return itself.

cutLast
Link copied to clipboard
common
fun Name.cutLast(): Name

The reminder of the name after last element is cut. For empty name return itself.

endsWith
Link copied to clipboard
common
fun Name.endsWith(token: NameToken): Boolean
fun Name.endsWith(name: Name): Boolean
first
Link copied to clipboard
common
fun Name.first(): NameToken

First token or throw exception

firstOrNull
Link copied to clipboard
common
fun Name.firstOrNull(): NameToken?

First token of the name or null if it is empty

get
Link copied to clipboard
common
operator fun Name.get(i: Int): NameToken
isEmpty
Link copied to clipboard
common
fun Name.isEmpty(): Boolean
lastOrNull
Link copied to clipboard
common
fun Name.lastOrNull(): NameToken?

Last token of the name or null if it is empty

length
Link copied to clipboard
common
val Name.length: Int
matches
Link copied to clipboard
common
fun Name.matches(pattern: Name): Boolean

Matches all names in pattern according to NameToken.matches rules.

fun Name.matches(pattern: String): Boolean
plus
Link copied to clipboard
common
operator fun Name.plus(other: Name): Name
operator fun Name.plus(other: String): Name
operator fun Name.plus(other: NameToken): Name
removeHeadOrNull
Link copied to clipboard
common
fun Name.removeHeadOrNull(head: Name): Name?

if this starts with given head name, returns the reminder of the name (could be empty). Otherwise, returns null

startsWith
Link copied to clipboard
common
fun Name.startsWith(token: NameToken): Boolean
fun Name.startsWith(name: Name): Boolean
withIndex
Link copied to clipboard
common
fun Name.withIndex(index: String): Name

Set or replace last token index