com.flamenk.util.ImmutableDeque Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of flamenk Show documentation
Show all versions of flamenk Show documentation
Flamenk is an srticle extractor,
extracts the article present in a web page.
The newest version!
/*
* Copyright 2013 Torindo Nesci.
*
* 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.flamenk.util;
import com.google.common.base.Preconditions;
import java.util.Collection;
import java.util.Deque;
import java.util.Iterator;
/**
* An immutable Deque. This implementation does not guarantee to be immutable, since
* the backed deque can be modified. In order to guarantee the immutability of the current
* ImmutableDeque, the backed deque must not be exposed to the client.
*
* All the methods calls are forwarded to the backed queue.
*
*
This implementation is Thread Safe
* only if the backed Deque is Thread Safe.
*
* @author Torindo Nesci
*/
public class ImmutableDeque implements Deque {
private final Deque mDeque;
/**
* Creates a new immutable deque with the given backed deque.
*
* @param deque The deque to forward the the calls to.
*/
public ImmutableDeque(Deque deque) {
Preconditions.checkNotNull(deque);
this.mDeque = deque;
}
/**
* Not implemented.
*
* @param e
* @throws UnsupportedOperationException Always.
*/
@Override
public void addFirst(T e) {
throw new UnsupportedOperationException("Not supported yet.");
}
/**
* Not implemented.
*
* @param e
* @throws UnsupportedOperationException Always.
*/
@Override
public void addLast(T e) {
throw new UnsupportedOperationException("Not supported yet.");
}
/**
* Not implemented
*
* @param e
* @return Not implemented.
* @throws UnsupportedOperationException Always.
*/
@Override
public boolean offerFirst(T e) {
throw new UnsupportedOperationException("Not supported yet.");
}
/**
* Not implemented
*
* @param e
* @return Not implemented.
* @throws UnsupportedOperationException Always.
*/
@Override
public boolean offerLast(T e) {
throw new UnsupportedOperationException("Not supported yet.");
}
/**
* Not implemented.
*
* @return Not implemented.
* @throws UnsupportedOperationException Always.
*/
@Override
public T removeFirst() {
throw new UnsupportedOperationException("Not supported yet.");
}
/**
* Not implemented.
*
* @return Not implemented.
* @throws UnsupportedOperationException Always.
*/
@Override
public T removeLast() {
throw new UnsupportedOperationException("Not supported yet.");
}
/**
* Not implemented.
*
* @return Not implemented.
* @throws UnsupportedOperationException Always.
*/
@Override
public T pollFirst() {
throw new UnsupportedOperationException("Not supported yet.");
}
/**
* Not implemented.
*
* @return Not implemented.
* @throws UnsupportedOperationException Always.
*/
@Override
public T pollLast() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public T getFirst() {
return this.mDeque.getFirst();
}
@Override
public T getLast() {
return this.mDeque.getLast();
}
/**
* Not implemented.
*
* @return Not implemented.
* @throws UnsupportedOperationException Always.
*/
@Override
public T peekFirst() {
throw new UnsupportedOperationException("Not supported yet.");
}
/**
* Not implemented.
*
* @return Not implemented.
* @throws UnsupportedOperationException Always.
*/
@Override
public T peekLast() {
throw new UnsupportedOperationException("Not supported yet.");
}
/**
* Not implemented.
*
* @return Not implemented.
* @throws UnsupportedOperationException Always.
*/
@Override
public boolean removeFirstOccurrence(Object o) {
throw new UnsupportedOperationException("Not supported yet.");
}
/**
* Not implemented.
*
* @return Not implemented.
* @throws UnsupportedOperationException Always.
*/
@Override
public boolean removeLastOccurrence(Object o) {
throw new UnsupportedOperationException("Not supported yet.");
}
/**
* Not implemented.
*
* @param e
* @return Not implemented.
* @throws UnsupportedOperationException Always.
*/
@Override
public boolean add(T e) {
throw new UnsupportedOperationException("Not supported yet.");
}
/**
* Not implemented.
*
* @param e
* @return Not implemented.
* @throws UnsupportedOperationException Always.
*/
@Override
public boolean offer(T e) {
throw new UnsupportedOperationException("Not supported yet.");
}
/**
* Not implemented.
*
* @return Not implemented.
* @throws UnsupportedOperationException Always.
*/
@Override
public T remove() {
throw new UnsupportedOperationException("Not supported yet.");
}
/**
* Not implemented.
*
* @return Not implemented.
* @throws UnsupportedOperationException Always.
*/
@Override
public T poll() {
throw new UnsupportedOperationException("Not supported yet.");
}
/**
* Not implemented.
*
* @return Not implemented.
* @throws UnsupportedOperationException Always.
*/
@Override
public T element() {
throw new UnsupportedOperationException("Not supported yet.");
}
/**
* Not implemented.
*
* @return Not implemented.
* @throws UnsupportedOperationException Always.
*/
@Override
public T peek() {
throw new UnsupportedOperationException("Not supported yet.");
}
/**
* Not implemented.
*
* @param e
* @throws UnsupportedOperationException Always.
*/
@Override
public void push(T e) {
throw new UnsupportedOperationException("Not supported yet.");
}
/**
* Not implemented.
*
* @return Not implemented.
* @throws UnsupportedOperationException Always.
*/
@Override
public T pop() {
throw new UnsupportedOperationException("Not supported yet.");
}
/**
* Not implemented.
*
* @param o
* @return Not implemented.
* @throws UnsupportedOperationException
*/
@Override
public boolean remove(Object o) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean contains(Object o) {
return this.mDeque.contains(o);
}
@Override
public int size() {
return this.mDeque.size();
}
@Override
public Iterator iterator() {
return this.mDeque.iterator();
}
@Override
public Iterator descendingIterator() {
return this.mDeque.descendingIterator();
}
@Override
public boolean isEmpty() {
return this.mDeque.isEmpty();
}
@Override
public Object[] toArray() {
return this.mDeque.toArray();
}
@Override
public T[] toArray(T[] ts) {
return this.mDeque.toArray(ts);
}
@Override
public boolean containsAll(Collection> clctn) {
return this.mDeque.containsAll(clctn);
}
/**
* Not implemented.
*
* @param clctn
* @return Not implemented.
* @throws UnsupportedOperationException Always.
*/
@Override
public boolean addAll(Collection extends T> clctn) {
throw new UnsupportedOperationException("Not supported yet.");
}
/**
* Not implemented.
*
* @param clctn
* @return Not implemented.
* @throws UnsupportedOperationException Always.
*/
@Override
public boolean removeAll(Collection> clctn) {
throw new UnsupportedOperationException("Not supported yet.");
}
/**
* Not implemented.
*
* @param clctn
* @return Not implemented.
* @throws UnsupportedOperationException Always.
*/
@Override
public boolean retainAll(Collection> clctn) {
throw new UnsupportedOperationException("Not supported yet.");
}
/**
* Not implemented.
*
* @throws UnsupportedOperationException Always.
*/
@Override
public void clear() {
throw new UnsupportedOperationException("Not supported yet.");
}
}