/*
* Copyright 2014 Goldman Sachs.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.gs.collections.impl.list.mutable.primitive;
import com.gs.collections.api.DoubleIterable;
import com.gs.collections.api.LazyDoubleIterable;
import com.gs.collections.api.block.function.primitive.DoubleToObjectFunction;
import com.gs.collections.api.block.function.primitive.ObjectDoubleToObjectFunction;
import com.gs.collections.api.block.function.primitive.ObjectDoubleIntToObjectFunction;
import com.gs.collections.api.block.predicate.primitive.DoublePredicate;
import com.gs.collections.api.block.procedure.primitive.DoubleIntProcedure;
import com.gs.collections.api.list.MutableList;
import com.gs.collections.api.list.primitive.DoubleList;
import com.gs.collections.api.list.primitive.ImmutableDoubleList;
import com.gs.collections.api.list.primitive.MutableDoubleList;
import com.gs.collections.impl.collection.mutable.primitive.AbstractUnmodifiableDoubleCollection;
import com.gs.collections.impl.factory.primitive.DoubleLists;
import com.gs.collections.impl.lazy.primitive.LazyDoubleIterableAdapter;
import com.gs.collections.impl.lazy.primitive.ReverseDoubleIterable;
import net.jcip.annotations.NotThreadSafe;
/**
* This file was automatically generated from template file unmodifiablePrimitiveList.stg.
*
* @since 3.1.
*/
@NotThreadSafe
public final class UnmodifiableDoubleList
extends AbstractUnmodifiableDoubleCollection
implements MutableDoubleList
{
private static final long serialVersionUID = 1L;
UnmodifiableDoubleList(MutableDoubleList list)
{
super(list);
}
private MutableDoubleList getMutableDoubleList()
{
return (MutableDoubleList) this.getDoubleCollection();
}
public double get(int index)
{
return this.getMutableDoubleList().get(index);
}
public double getFirst()
{
return this.getMutableDoubleList().getFirst();
}
public double getLast()
{
return this.getMutableDoubleList().getLast();
}
public int indexOf(double value)
{
return this.getMutableDoubleList().indexOf(value);
}
public int lastIndexOf(double value)
{
return this.getMutableDoubleList().lastIndexOf(value);
}
public void addAtIndex(int index, double element)
{
throw new UnsupportedOperationException("Cannot call addAtIndex() on " + this.getClass().getSimpleName());
}
public boolean addAllAtIndex(int index, double... source)
{
throw new UnsupportedOperationException("Cannot call addAllAtIndex() on " + this.getClass().getSimpleName());
}
public boolean addAllAtIndex(int index, DoubleIterable source)
{
throw new UnsupportedOperationException("Cannot call addAllAtIndex() on " + this.getClass().getSimpleName());
}
public double removeAtIndex(int index)
{
throw new UnsupportedOperationException("Cannot call removeAtIndex() on " + this.getClass().getSimpleName());
}
public double set(int index, double element)
{
throw new UnsupportedOperationException("Cannot call set() on " + this.getClass().getSimpleName());
}
@Override
public UnmodifiableDoubleList with(double element)
{
throw new UnsupportedOperationException("Cannot call with() on " + this.getClass().getSimpleName());
}
@Override
public UnmodifiableDoubleList without(double element)
{
throw new UnsupportedOperationException("Cannot call without() on " + this.getClass().getSimpleName());
}
@Override
public UnmodifiableDoubleList withAll(DoubleIterable elements)
{
throw new UnsupportedOperationException("Cannot call withAll() on " + this.getClass().getSimpleName());
}
@Override
public UnmodifiableDoubleList withoutAll(DoubleIterable elements)
{
throw new UnsupportedOperationException("Cannot call withoutAll() on " + this.getClass().getSimpleName());
}
@Override
public MutableDoubleList select(DoublePredicate predicate)
{
return this.getMutableDoubleList().select(predicate);
}
@Override
public MutableDoubleList reject(DoublePredicate predicate)
{
return this.getMutableDoubleList().reject(predicate);
}
@Override
public <V> MutableList<V> collect(DoubleToObjectFunction<? extends V> function)
{
return this.getMutableDoubleList().collect(function);
}
public MutableDoubleList sortThis()
{
throw new UnsupportedOperationException("Cannot call sortThis() on " + this.getClass().getSimpleName());
}
public double dotProduct(DoubleList list)
{
return this.getMutableDoubleList().dotProduct(list);
}
@Override
public boolean equals(Object otherList)
{
return this.getMutableDoubleList().equals(otherList);
}
@Override
public int hashCode()
{
return this.getMutableDoubleList().hashCode();
}
@Override
public LazyDoubleIterable asLazy()
{
return new LazyDoubleIterableAdapter(this);
}
@Override
public MutableDoubleList asUnmodifiable()
{
return this;
}
@Override
public MutableDoubleList asSynchronized()
{
return new SynchronizedDoubleList(this);
}
@Override
public ImmutableDoubleList toImmutable()
{
int size = this.size();
if (size == 0)
{
return DoubleLists.immutable.with();
}
if (size == 1)
{
return DoubleLists.immutable.with(this.getFirst());
}
return DoubleLists.immutable.with(this.toArray());
}
public MutableDoubleList reverseThis()
{
throw new UnsupportedOperationException("Cannot call reverseThis() on " + this.getClass().getSimpleName());
}
public MutableDoubleList toReversed()
{
return this.getMutableDoubleList().toReversed();
}
public void forEachWithIndex(DoubleIntProcedure procedure)
{
this.getMutableDoubleList().forEachWithIndex(procedure);
}
public LazyDoubleIterable asReversed()
{
return ReverseDoubleIterable.adapt(this);
}
public <T> T injectInto(T injectedValue, ObjectDoubleToObjectFunction<? super T, ? extends T> function)
{
return this.getMutableDoubleList().injectInto(injectedValue, function);
}
public <T> T injectIntoWithIndex(T injectedValue, ObjectDoubleIntToObjectFunction<? super T, ? extends T> function)
{
return this.getMutableDoubleList().injectIntoWithIndex(injectedValue, function);
}
public MutableDoubleList subList(int fromIndex, int toIndex)
{
throw new UnsupportedOperationException("subList not yet implemented!");
}
}