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

io.deephaven.engine.table.impl.util.KeyHolder Maven / Gradle / Ivy

There is a newer version: 0.37.1
Show newest version
/**
 * Copyright (c) 2016-2022 Deephaven Data Labs and Patent Pending
 */
package io.deephaven.engine.table.impl.util;

import java.util.ArrayList;

public interface KeyHolder {
    long getKey();

    public long getPrevKey();

    void setKey(long key);

    void addDependent(KeyHolder dependent);

    void removeDependent(KeyHolder dependent);

    void touch();

    public abstract class Base implements KeyHolder {
        protected ArrayList dependents;

        public void addDependent(KeyHolder dependent) {
            if (dependents == null) {
                dependents = new ArrayList(2);
            }
            dependents.add(dependent);
        }

        public void removeDependent(KeyHolder dependent) {
            dependents.remove(dependent);
        }

        public void touch() {
            if (dependents != null) {
                for (KeyHolder dependent : dependents) {
                    dependent.touch();
                }
            }
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy