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

org.nd4j.linalg.util.SynchronizedTable Maven / Gradle / Ivy

There is a newer version: 1.0.0-M2.1
Show newest version
package org.nd4j.linalg.util;

import com.google.common.collect.Table;

import java.util.Collection;
import java.util.Map;
import java.util.Set;

/**
 * Synchronized table
 *
 * @author Adam Gibson
 */
public class SynchronizedTable implements Table {
    private Table wrapped;

    public SynchronizedTable(Table wrapped) {
        this.wrapped = wrapped;
    }

    @Override
    public synchronized boolean contains(Object rowKey, Object columnKey) {
        return wrapped.contains(rowKey,columnKey);
    }

    @Override
    public synchronized boolean containsRow(Object rowKey) {
        return wrapped.containsRow(rowKey);
    }

    @Override
    public synchronized boolean containsColumn(Object columnKey) {
        return wrapped.containsColumn(columnKey);
    }

    @Override
    public synchronized boolean containsValue(Object value) {
        return wrapped.containsValue(value);
    }

    @Override
    public synchronized V get(Object rowKey, Object columnKey) {
        return get(rowKey,columnKey);
    }

    @Override
    public synchronized boolean isEmpty() {
        return  wrapped.isEmpty();
    }

    @Override
    public int size() {
        return wrapped.size();
    }

    @Override
    public synchronized void clear() {
      wrapped.clear();
    }

    @Override
    public synchronized V put(R rowKey, C columnKey, V value) {
        return wrapped.put(rowKey,columnKey,value);
    }

    @Override
    public synchronized void putAll(Table table) {
         wrapped.putAll(table);
    }

    @Override
    public synchronized V remove(Object rowKey, Object columnKey) {
        return wrapped.remove(rowKey,columnKey);
    }

    @Override
    public synchronized Map row(R rowKey) {
        return wrapped.row(rowKey);
    }

    @Override
    public synchronized Map column(C columnKey) {
        return wrapped.column(columnKey);
    }

    @Override
    public synchronized Set> cellSet() {
        return wrapped.cellSet();
    }

    @Override
    public synchronized Set rowKeySet() {
        return wrapped.rowKeySet();
    }

    @Override
    public synchronized Set columnKeySet() {
        return wrapped.columnKeySet();
    }

    @Override
    public synchronized Collection values() {
        return wrapped.values();
    }

    @Override
    public synchronized Map> rowMap() {
        return wrapped.rowMap();
    }

    @Override
    public synchronized Map> columnMap() {
        return wrapped.columnMap();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy