All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.jetbrains.datalore.base.composite.NavComposite.kt Maven / Gradle / Ivy

There is a newer version: 4.5.3-alpha1
Show newest version
/*
 * Copyright (c) 2019. JetBrains s.r.o.
 * Use of this source code is governed by the MIT license that can be found in the LICENSE file.
 */

package jetbrains.datalore.base.composite

/**
 * Composite which supports optimized navigation between siblings.
 *
 * If we store children in an array and a composite has a lot of children, navigation might be
 * expensive because we need to use indexOf which takes O(children). This class is an optimized
 * version of Composite tailored for such cases.
 *
 * Invariants:
 * - prevSibling, nextSibling, firstChild and lastChild must be consistent with the children collection from
 * Composite.
 */
interface NavComposite> : Composite {
    fun nextSibling(): CompositeT?
    fun prevSibling(): CompositeT?

    fun firstChild(): CompositeT?
    fun lastChild(): CompositeT?
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy