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

javolution.util.internal.table.UnmodifiableTableImpl Maven / Gradle / Ivy

Go to download

Only the Java Core part of Javolution library, with slight modifications for use in MSFTBX.

The newest version!
/*
 * Javolution - Java(TM) Solution for Real-Time and Embedded Systems
 * Copyright (C) 2012 - Javolution (http://javolution.org/)
 * All rights reserved.
 * 
 * Permission to use, copy, modify, and distribute this software is
 * freely granted, provided that this notice is preserved.
 */
package javolution.util.internal.table;

import javolution.util.function.Equality;
import javolution.util.service.TableService;

/**
 * An unmodifiable view over a table.
 */
public class UnmodifiableTableImpl extends TableView {

    private static final long serialVersionUID = 0x600L; // Version.

    public UnmodifiableTableImpl(TableService target) {
        super(target);
    }

    @Override
    public boolean add(E element) {
        throw new UnsupportedOperationException("Read-Only Collection.");
    }

    @Override
    public void add(int index, E element) {
        throw new UnsupportedOperationException("Unmodifiable");
    }

    @Override
    public void clear() {
        throw new UnsupportedOperationException("Read-Only Collection.");
    }

    @Override
    public Equality comparator() {
        return target().comparator();
    }

    @Override
    public E get(int index) {
        return target().get(index);
    }

    @Override
    public int indexOf(Object o) {
        return target().indexOf(o);
    }

    @Override
    public int lastIndexOf(Object o) {
        return target().lastIndexOf(o);
    }

    @Override
    public E remove(int index) {
        throw new UnsupportedOperationException("Read-Only Collection.");
    }

    @Override
    public E set(int index, E element) {
        throw new UnsupportedOperationException("Read-Only Collection.");
    }

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

    @Override
    public TableService[] split(int n, boolean updateable) {
        return SubTableImpl.splitOf(this, n, false); // Sub-views over this.
    }
    
    @Override
    protected TableService target() {
        return (TableService) super.target();
    }
 }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy