package rocks.inspectit.shared.cs.indexing.indexer;
/**
*
* Abstract branch indexer for all indexers that work as shared instance.
*
* @param <E>
* Element type that indexer can return keys for.
* @author Ivan Senic
*
*/
public abstract class AbstractSharedInstanceBranchIndexer<E> implements IBranchIndexer<E> {
/**
* {@inheritDoc}
*/
@Override
public boolean sharedInstance() {
return true;
}
/**
* {@inheritDoc}
*/
@Override
public IBranchIndexer<E> getNewInstance() {
throw new UnsupportedOperationException("Branch indexer can not return new instance because it uses the shared one.");
}
/**
* {@inheritDoc}
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = (prime * result) + this.getClass().hashCode();
return result;
}
/**
* {@inheritDoc}
*/
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
return true;
}
}