Introducing project eclipse settings. Turning override annotation on.
This commit is contained in:
parent
d75db9eab6
commit
fdf66b83c2
115 changed files with 4491 additions and 2127 deletions
71
DataExtractionOSM/.settings/org.eclipse.jdt.core.prefs
Normal file
71
DataExtractionOSM/.settings/org.eclipse.jdt.core.prefs
Normal file
|
@ -0,0 +1,71 @@
|
|||
#Mon Oct 10 15:46:00 CEST 2011
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
|
||||
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
|
||||
org.eclipse.jdt.core.compiler.problem.deadCode=warning
|
||||
org.eclipse.jdt.core.compiler.problem.deprecation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
|
||||
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
|
||||
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
|
||||
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
|
||||
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=error
|
||||
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
|
||||
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
|
||||
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.nullReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
|
||||
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
|
||||
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
|
@ -47,7 +47,8 @@ import java.util.Map;
|
|||
*/
|
||||
public abstract class AbstractMessage extends AbstractMessageLite
|
||||
implements Message {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public boolean isInitialized() {
|
||||
// Check that all required fields are present.
|
||||
for (final FieldDescriptor field : getDescriptorForType().getFields()) {
|
||||
|
@ -85,7 +86,8 @@ public abstract class AbstractMessage extends AbstractMessageLite
|
|||
return TextFormat.printToString(this);
|
||||
}
|
||||
|
||||
public void writeTo(final CodedOutputStream output) throws IOException {
|
||||
@Override
|
||||
public void writeTo(final CodedOutputStream output) throws IOException {
|
||||
final boolean isMessageSet =
|
||||
getDescriptorForType().getOptions().getMessageSetWireFormat();
|
||||
|
||||
|
@ -112,7 +114,8 @@ public abstract class AbstractMessage extends AbstractMessageLite
|
|||
|
||||
private int memoizedSize = -1;
|
||||
|
||||
public int getSerializedSize() {
|
||||
@Override
|
||||
public int getSerializedSize() {
|
||||
int size = memoizedSize;
|
||||
if (size != -1) {
|
||||
return size;
|
||||
|
@ -187,7 +190,8 @@ public abstract class AbstractMessage extends AbstractMessageLite
|
|||
@Override
|
||||
public abstract BuilderType clone();
|
||||
|
||||
public BuilderType clear() {
|
||||
@Override
|
||||
public BuilderType clear() {
|
||||
for (final Map.Entry<FieldDescriptor, Object> entry :
|
||||
getAllFields().entrySet()) {
|
||||
clearField(entry.getKey());
|
||||
|
@ -195,7 +199,8 @@ public abstract class AbstractMessage extends AbstractMessageLite
|
|||
return (BuilderType) this;
|
||||
}
|
||||
|
||||
public BuilderType mergeFrom(final Message other) {
|
||||
@Override
|
||||
public BuilderType mergeFrom(final Message other) {
|
||||
if (other.getDescriptorForType() != getDescriptorForType()) {
|
||||
throw new IllegalArgumentException(
|
||||
"mergeFrom(Message) can only merge messages of the same type.");
|
||||
|
@ -532,7 +537,8 @@ public abstract class AbstractMessage extends AbstractMessageLite
|
|||
}
|
||||
}
|
||||
|
||||
public BuilderType mergeUnknownFields(final UnknownFieldSet unknownFields) {
|
||||
@Override
|
||||
public BuilderType mergeUnknownFields(final UnknownFieldSet unknownFields) {
|
||||
setUnknownFields(
|
||||
UnknownFieldSet.newBuilder(getUnknownFields())
|
||||
.mergeFrom(unknownFields)
|
||||
|
|
|
@ -44,7 +44,8 @@ import java.util.Collection;
|
|||
* @author kenton@google.com Kenton Varda
|
||||
*/
|
||||
public abstract class AbstractMessageLite implements MessageLite {
|
||||
public ByteString toByteString() {
|
||||
@Override
|
||||
public ByteString toByteString() {
|
||||
try {
|
||||
final ByteString.CodedBuilder out =
|
||||
ByteString.newCodedBuilder(getSerializedSize());
|
||||
|
@ -57,7 +58,8 @@ public abstract class AbstractMessageLite implements MessageLite {
|
|||
}
|
||||
}
|
||||
|
||||
public byte[] toByteArray() {
|
||||
@Override
|
||||
public byte[] toByteArray() {
|
||||
try {
|
||||
final byte[] result = new byte[getSerializedSize()];
|
||||
final CodedOutputStream output = CodedOutputStream.newInstance(result);
|
||||
|
@ -71,7 +73,8 @@ public abstract class AbstractMessageLite implements MessageLite {
|
|||
}
|
||||
}
|
||||
|
||||
public void writeTo(final OutputStream output) throws IOException {
|
||||
@Override
|
||||
public void writeTo(final OutputStream output) throws IOException {
|
||||
final int bufferSize =
|
||||
CodedOutputStream.computePreferredBufferSize(getSerializedSize());
|
||||
final CodedOutputStream codedOutput =
|
||||
|
@ -80,7 +83,8 @@ public abstract class AbstractMessageLite implements MessageLite {
|
|||
codedOutput.flush();
|
||||
}
|
||||
|
||||
public void writeDelimitedTo(final OutputStream output) throws IOException {
|
||||
@Override
|
||||
public void writeDelimitedTo(final OutputStream output) throws IOException {
|
||||
final int serialized = getSerializedSize();
|
||||
final int bufferSize = CodedOutputStream.computePreferredBufferSize(
|
||||
CodedOutputStream.computeRawVarint32Size(serialized) + serialized);
|
||||
|
@ -103,18 +107,21 @@ public abstract class AbstractMessageLite implements MessageLite {
|
|||
@Override
|
||||
public abstract BuilderType clone();
|
||||
|
||||
public BuilderType mergeFrom(final CodedInputStream input)
|
||||
@Override
|
||||
public BuilderType mergeFrom(final CodedInputStream input)
|
||||
throws IOException {
|
||||
return mergeFrom(input, ExtensionRegistryLite.getEmptyRegistry());
|
||||
}
|
||||
|
||||
// Re-defined here for return type covariance.
|
||||
public abstract BuilderType mergeFrom(
|
||||
@Override
|
||||
public abstract BuilderType mergeFrom(
|
||||
final CodedInputStream input,
|
||||
final ExtensionRegistryLite extensionRegistry)
|
||||
throws IOException;
|
||||
|
||||
public BuilderType mergeFrom(final ByteString data)
|
||||
@Override
|
||||
public BuilderType mergeFrom(final ByteString data)
|
||||
throws InvalidProtocolBufferException {
|
||||
try {
|
||||
final CodedInputStream input = data.newCodedInput();
|
||||
|
@ -130,7 +137,8 @@ public abstract class AbstractMessageLite implements MessageLite {
|
|||
}
|
||||
}
|
||||
|
||||
public BuilderType mergeFrom(
|
||||
@Override
|
||||
public BuilderType mergeFrom(
|
||||
final ByteString data,
|
||||
final ExtensionRegistryLite extensionRegistry)
|
||||
throws InvalidProtocolBufferException {
|
||||
|
@ -148,12 +156,14 @@ public abstract class AbstractMessageLite implements MessageLite {
|
|||
}
|
||||
}
|
||||
|
||||
public BuilderType mergeFrom(final byte[] data)
|
||||
@Override
|
||||
public BuilderType mergeFrom(final byte[] data)
|
||||
throws InvalidProtocolBufferException {
|
||||
return mergeFrom(data, 0, data.length);
|
||||
}
|
||||
|
||||
public BuilderType mergeFrom(final byte[] data, final int off,
|
||||
@Override
|
||||
public BuilderType mergeFrom(final byte[] data, final int off,
|
||||
final int len)
|
||||
throws InvalidProtocolBufferException {
|
||||
try {
|
||||
|
@ -171,14 +181,16 @@ public abstract class AbstractMessageLite implements MessageLite {
|
|||
}
|
||||
}
|
||||
|
||||
public BuilderType mergeFrom(
|
||||
@Override
|
||||
public BuilderType mergeFrom(
|
||||
final byte[] data,
|
||||
final ExtensionRegistryLite extensionRegistry)
|
||||
throws InvalidProtocolBufferException {
|
||||
return mergeFrom(data, 0, data.length, extensionRegistry);
|
||||
}
|
||||
|
||||
public BuilderType mergeFrom(
|
||||
@Override
|
||||
public BuilderType mergeFrom(
|
||||
final byte[] data, final int off, final int len,
|
||||
final ExtensionRegistryLite extensionRegistry)
|
||||
throws InvalidProtocolBufferException {
|
||||
|
@ -197,14 +209,16 @@ public abstract class AbstractMessageLite implements MessageLite {
|
|||
}
|
||||
}
|
||||
|
||||
public BuilderType mergeFrom(final InputStream input) throws IOException {
|
||||
@Override
|
||||
public BuilderType mergeFrom(final InputStream input) throws IOException {
|
||||
final CodedInputStream codedInput = CodedInputStream.newInstance(input);
|
||||
mergeFrom(codedInput);
|
||||
codedInput.checkLastTagWas(0);
|
||||
return (BuilderType) this;
|
||||
}
|
||||
|
||||
public BuilderType mergeFrom(
|
||||
@Override
|
||||
public BuilderType mergeFrom(
|
||||
final InputStream input,
|
||||
final ExtensionRegistryLite extensionRegistry)
|
||||
throws IOException {
|
||||
|
@ -269,7 +283,8 @@ public abstract class AbstractMessageLite implements MessageLite {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean mergeDelimitedFrom(
|
||||
@Override
|
||||
public boolean mergeDelimitedFrom(
|
||||
final InputStream input,
|
||||
final ExtensionRegistryLite extensionRegistry)
|
||||
throws IOException {
|
||||
|
@ -283,7 +298,8 @@ public abstract class AbstractMessageLite implements MessageLite {
|
|||
return true;
|
||||
}
|
||||
|
||||
public boolean mergeDelimitedFrom(final InputStream input)
|
||||
@Override
|
||||
public boolean mergeDelimitedFrom(final InputStream input)
|
||||
throws IOException {
|
||||
return mergeDelimitedFrom(input,
|
||||
ExtensionRegistryLite.getEmptyRegistry());
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -427,10 +427,12 @@ public final class Descriptors {
|
|||
public int getIndex() { return index; }
|
||||
|
||||
/** Convert the descriptor to its protocol message representation. */
|
||||
public DescriptorProto toProto() { return proto; }
|
||||
@Override
|
||||
public DescriptorProto toProto() { return proto; }
|
||||
|
||||
/** Get the type's unqualified name. */
|
||||
public String getName() { return proto.getName(); }
|
||||
@Override
|
||||
public String getName() { return proto.getName(); }
|
||||
|
||||
/**
|
||||
* Get the type's fully-qualified name, within the proto language's
|
||||
|
@ -443,10 +445,12 @@ public final class Descriptors {
|
|||
* </pre>
|
||||
* {@code Baz}'s full name is "foo.bar.Baz".
|
||||
*/
|
||||
public String getFullName() { return fullName; }
|
||||
@Override
|
||||
public String getFullName() { return fullName; }
|
||||
|
||||
/** Get the {@link FileDescriptor} containing this descriptor. */
|
||||
public FileDescriptor getFile() { return file; }
|
||||
@Override
|
||||
public FileDescriptor getFile() { return file; }
|
||||
|
||||
/** If this is a nested type, get the outer descriptor, otherwise null. */
|
||||
public Descriptor getContainingType() { return containingType; }
|
||||
|
@ -638,19 +642,23 @@ public final class Descriptors {
|
|||
public int getIndex() { return index; }
|
||||
|
||||
/** Convert the descriptor to its protocol message representation. */
|
||||
public FieldDescriptorProto toProto() { return proto; }
|
||||
@Override
|
||||
public FieldDescriptorProto toProto() { return proto; }
|
||||
|
||||
/** Get the field's unqualified name. */
|
||||
public String getName() { return proto.getName(); }
|
||||
@Override
|
||||
public String getName() { return proto.getName(); }
|
||||
|
||||
/** Get the field's number. */
|
||||
public int getNumber() { return proto.getNumber(); }
|
||||
@Override
|
||||
public int getNumber() { return proto.getNumber(); }
|
||||
|
||||
/**
|
||||
* Get the field's fully-qualified name.
|
||||
* @see Descriptor#getFullName()
|
||||
*/
|
||||
public String getFullName() { return fullName; }
|
||||
@Override
|
||||
public String getFullName() { return fullName; }
|
||||
|
||||
/**
|
||||
* Get the field's java type. This is just for convenience. Every
|
||||
|
@ -659,18 +667,21 @@ public final class Descriptors {
|
|||
public JavaType getJavaType() { return type.getJavaType(); }
|
||||
|
||||
/** For internal use only. */
|
||||
public WireFormat.JavaType getLiteJavaType() {
|
||||
@Override
|
||||
public WireFormat.JavaType getLiteJavaType() {
|
||||
return getLiteType().getJavaType();
|
||||
}
|
||||
|
||||
/** Get the {@code FileDescriptor} containing this descriptor. */
|
||||
public FileDescriptor getFile() { return file; }
|
||||
@Override
|
||||
public FileDescriptor getFile() { return file; }
|
||||
|
||||
/** Get the field's declared type. */
|
||||
public Type getType() { return type; }
|
||||
|
||||
/** For internal use only. */
|
||||
public WireFormat.FieldType getLiteType() {
|
||||
@Override
|
||||
public WireFormat.FieldType getLiteType() {
|
||||
return table[type.ordinal()];
|
||||
}
|
||||
// I'm pretty sure values() constructs a new array every time, since there
|
||||
|
@ -690,12 +701,14 @@ public final class Descriptors {
|
|||
}
|
||||
|
||||
/** Is this field declared repeated? */
|
||||
public boolean isRepeated() {
|
||||
@Override
|
||||
public boolean isRepeated() {
|
||||
return proto.getLabel() == FieldDescriptorProto.Label.LABEL_REPEATED;
|
||||
}
|
||||
|
||||
/** Does this field have the {@code [packed = true]} option? */
|
||||
public boolean isPacked() {
|
||||
@Override
|
||||
public boolean isPacked() {
|
||||
return getOptions().getPacked();
|
||||
}
|
||||
|
||||
|
@ -773,7 +786,8 @@ public final class Descriptors {
|
|||
}
|
||||
|
||||
/** For enum fields, gets the field's type. */
|
||||
public EnumDescriptor getEnumType() {
|
||||
@Override
|
||||
public EnumDescriptor getEnumType() {
|
||||
if (getJavaType() != JavaType.ENUM) {
|
||||
throw new UnsupportedOperationException(
|
||||
"This field is not of enum type.");
|
||||
|
@ -791,7 +805,8 @@ public final class Descriptors {
|
|||
* @return negative, zero, or positive if {@code this} is less than,
|
||||
* equal to, or greater than {@code other}, respectively.
|
||||
*/
|
||||
public int compareTo(final FieldDescriptor other) {
|
||||
@Override
|
||||
public int compareTo(final FieldDescriptor other) {
|
||||
if (other.containingType != containingType) {
|
||||
throw new IllegalArgumentException(
|
||||
"FieldDescriptors can only be compared to other FieldDescriptors " +
|
||||
|
@ -1126,7 +1141,8 @@ public final class Descriptors {
|
|||
* For internal use only. This is to satisfy the FieldDescriptorLite
|
||||
* interface.
|
||||
*/
|
||||
public MessageLite.Builder internalMergeFrom(
|
||||
@Override
|
||||
public MessageLite.Builder internalMergeFrom(
|
||||
MessageLite.Builder to, MessageLite from) {
|
||||
// FieldDescriptors are only used with non-lite messages so we can just
|
||||
// down-cast and call mergeFrom directly.
|
||||
|
@ -1146,19 +1162,23 @@ public final class Descriptors {
|
|||
public int getIndex() { return index; }
|
||||
|
||||
/** Convert the descriptor to its protocol message representation. */
|
||||
public EnumDescriptorProto toProto() { return proto; }
|
||||
@Override
|
||||
public EnumDescriptorProto toProto() { return proto; }
|
||||
|
||||
/** Get the type's unqualified name. */
|
||||
public String getName() { return proto.getName(); }
|
||||
@Override
|
||||
public String getName() { return proto.getName(); }
|
||||
|
||||
/**
|
||||
* Get the type's fully-qualified name.
|
||||
* @see Descriptor#getFullName()
|
||||
*/
|
||||
public String getFullName() { return fullName; }
|
||||
@Override
|
||||
public String getFullName() { return fullName; }
|
||||
|
||||
/** Get the {@link FileDescriptor} containing this descriptor. */
|
||||
public FileDescriptor getFile() { return file; }
|
||||
@Override
|
||||
public FileDescriptor getFile() { return file; }
|
||||
|
||||
/** If this is a nested type, get the outer descriptor, otherwise null. */
|
||||
public Descriptor getContainingType() { return containingType; }
|
||||
|
@ -1192,7 +1212,8 @@ public final class Descriptors {
|
|||
* @param number The value's number.
|
||||
* @return the value's decsriptor, or {@code null} if not found.
|
||||
*/
|
||||
public EnumValueDescriptor findValueByNumber(final int number) {
|
||||
@Override
|
||||
public EnumValueDescriptor findValueByNumber(final int number) {
|
||||
return file.pool.enumValuesByNumber.get(
|
||||
new DescriptorPool.DescriptorIntPair(this, number));
|
||||
}
|
||||
|
@ -1258,22 +1279,27 @@ public final class Descriptors {
|
|||
public int getIndex() { return index; }
|
||||
|
||||
/** Convert the descriptor to its protocol message representation. */
|
||||
public EnumValueDescriptorProto toProto() { return proto; }
|
||||
@Override
|
||||
public EnumValueDescriptorProto toProto() { return proto; }
|
||||
|
||||
/** Get the value's unqualified name. */
|
||||
public String getName() { return proto.getName(); }
|
||||
@Override
|
||||
public String getName() { return proto.getName(); }
|
||||
|
||||
/** Get the value's number. */
|
||||
public int getNumber() { return proto.getNumber(); }
|
||||
@Override
|
||||
public int getNumber() { return proto.getNumber(); }
|
||||
|
||||
/**
|
||||
* Get the value's fully-qualified name.
|
||||
* @see Descriptor#getFullName()
|
||||
*/
|
||||
public String getFullName() { return fullName; }
|
||||
@Override
|
||||
public String getFullName() { return fullName; }
|
||||
|
||||
/** Get the {@link FileDescriptor} containing this descriptor. */
|
||||
public FileDescriptor getFile() { return file; }
|
||||
@Override
|
||||
public FileDescriptor getFile() { return file; }
|
||||
|
||||
/** Get the value's enum type. */
|
||||
public EnumDescriptor getType() { return type; }
|
||||
|
@ -1322,19 +1348,23 @@ public final class Descriptors {
|
|||
public int getIndex() { return index; }
|
||||
|
||||
/** Convert the descriptor to its protocol message representation. */
|
||||
public ServiceDescriptorProto toProto() { return proto; }
|
||||
@Override
|
||||
public ServiceDescriptorProto toProto() { return proto; }
|
||||
|
||||
/** Get the type's unqualified name. */
|
||||
public String getName() { return proto.getName(); }
|
||||
@Override
|
||||
public String getName() { return proto.getName(); }
|
||||
|
||||
/**
|
||||
* Get the type's fully-qualified name.
|
||||
* @see Descriptor#getFullName()
|
||||
*/
|
||||
public String getFullName() { return fullName; }
|
||||
@Override
|
||||
public String getFullName() { return fullName; }
|
||||
|
||||
/** Get the {@link FileDescriptor} containing this descriptor. */
|
||||
public FileDescriptor getFile() { return file; }
|
||||
@Override
|
||||
public FileDescriptor getFile() { return file; }
|
||||
|
||||
/** Get the {@code ServiceOptions}, defined in {@code descriptor.proto}. */
|
||||
public ServiceOptions getOptions() { return proto.getOptions(); }
|
||||
|
@ -1412,19 +1442,23 @@ public final class Descriptors {
|
|||
public int getIndex() { return index; }
|
||||
|
||||
/** Convert the descriptor to its protocol message representation. */
|
||||
public MethodDescriptorProto toProto() { return proto; }
|
||||
@Override
|
||||
public MethodDescriptorProto toProto() { return proto; }
|
||||
|
||||
/** Get the method's unqualified name. */
|
||||
public String getName() { return proto.getName(); }
|
||||
@Override
|
||||
public String getName() { return proto.getName(); }
|
||||
|
||||
/**
|
||||
* Get the method's fully-qualified name.
|
||||
* @see Descriptor#getFullName()
|
||||
*/
|
||||
public String getFullName() { return fullName; }
|
||||
@Override
|
||||
public String getFullName() { return fullName; }
|
||||
|
||||
/** Get the {@link FileDescriptor} containing this descriptor. */
|
||||
public FileDescriptor getFile() { return file; }
|
||||
@Override
|
||||
public FileDescriptor getFile() { return file; }
|
||||
|
||||
/** Get the method's service type. */
|
||||
public ServiceDescriptor getService() { return service; }
|
||||
|
@ -1736,10 +1770,14 @@ public final class Descriptors {
|
|||
* that has the same name as an existing package.
|
||||
*/
|
||||
private static final class PackageDescriptor implements GenericDescriptor {
|
||||
public Message toProto() { return file.toProto(); }
|
||||
public String getName() { return name; }
|
||||
public String getFullName() { return fullName; }
|
||||
public FileDescriptor getFile() { return file; }
|
||||
@Override
|
||||
public Message toProto() { return file.toProto(); }
|
||||
@Override
|
||||
public String getName() { return name; }
|
||||
@Override
|
||||
public String getFullName() { return fullName; }
|
||||
@Override
|
||||
public FileDescriptor getFile() { return file; }
|
||||
|
||||
PackageDescriptor(final String name, final String fullName,
|
||||
final FileDescriptor file) {
|
||||
|
|
|
@ -139,24 +139,29 @@ public final class DynamicMessage extends AbstractMessage {
|
|||
// -----------------------------------------------------------------
|
||||
// Implementation of Message interface.
|
||||
|
||||
public Descriptor getDescriptorForType() {
|
||||
@Override
|
||||
public Descriptor getDescriptorForType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public DynamicMessage getDefaultInstanceForType() {
|
||||
@Override
|
||||
public DynamicMessage getDefaultInstanceForType() {
|
||||
return getDefaultInstance(type);
|
||||
}
|
||||
|
||||
public Map<FieldDescriptor, Object> getAllFields() {
|
||||
@Override
|
||||
public Map<FieldDescriptor, Object> getAllFields() {
|
||||
return fields.getAllFields();
|
||||
}
|
||||
|
||||
public boolean hasField(FieldDescriptor field) {
|
||||
@Override
|
||||
public boolean hasField(FieldDescriptor field) {
|
||||
verifyContainingType(field);
|
||||
return fields.hasField(field);
|
||||
}
|
||||
|
||||
public Object getField(FieldDescriptor field) {
|
||||
@Override
|
||||
public Object getField(FieldDescriptor field) {
|
||||
verifyContainingType(field);
|
||||
Object result = fields.getField(field);
|
||||
if (result == null) {
|
||||
|
@ -169,17 +174,20 @@ public final class DynamicMessage extends AbstractMessage {
|
|||
return result;
|
||||
}
|
||||
|
||||
public int getRepeatedFieldCount(FieldDescriptor field) {
|
||||
@Override
|
||||
public int getRepeatedFieldCount(FieldDescriptor field) {
|
||||
verifyContainingType(field);
|
||||
return fields.getRepeatedFieldCount(field);
|
||||
}
|
||||
|
||||
public Object getRepeatedField(FieldDescriptor field, int index) {
|
||||
@Override
|
||||
public Object getRepeatedField(FieldDescriptor field, int index) {
|
||||
verifyContainingType(field);
|
||||
return fields.getRepeatedField(field, index);
|
||||
}
|
||||
|
||||
public UnknownFieldSet getUnknownFields() {
|
||||
@Override
|
||||
public UnknownFieldSet getUnknownFields() {
|
||||
return unknownFields;
|
||||
}
|
||||
|
||||
|
@ -198,11 +206,13 @@ public final class DynamicMessage extends AbstractMessage {
|
|||
return fields.isInitialized();
|
||||
}
|
||||
|
||||
public boolean isInitialized() {
|
||||
@Override
|
||||
public boolean isInitialized() {
|
||||
return isInitialized(type, fields);
|
||||
}
|
||||
|
||||
public void writeTo(CodedOutputStream output) throws IOException {
|
||||
@Override
|
||||
public void writeTo(CodedOutputStream output) throws IOException {
|
||||
if (type.getOptions().getMessageSetWireFormat()) {
|
||||
fields.writeMessageSetTo(output);
|
||||
unknownFields.writeAsMessageSetTo(output);
|
||||
|
@ -212,7 +222,8 @@ public final class DynamicMessage extends AbstractMessage {
|
|||
}
|
||||
}
|
||||
|
||||
public int getSerializedSize() {
|
||||
@Override
|
||||
public int getSerializedSize() {
|
||||
int size = memoizedSize;
|
||||
if (size != -1) return size;
|
||||
|
||||
|
@ -228,11 +239,13 @@ public final class DynamicMessage extends AbstractMessage {
|
|||
return size;
|
||||
}
|
||||
|
||||
public Builder newBuilderForType() {
|
||||
@Override
|
||||
public Builder newBuilderForType() {
|
||||
return new Builder(type);
|
||||
}
|
||||
|
||||
public Builder toBuilder() {
|
||||
@Override
|
||||
public Builder toBuilder() {
|
||||
return newBuilderForType().mergeFrom(this);
|
||||
}
|
||||
|
||||
|
@ -264,7 +277,8 @@ public final class DynamicMessage extends AbstractMessage {
|
|||
// ---------------------------------------------------------------
|
||||
// Implementation of Message.Builder interface.
|
||||
|
||||
public Builder clear() {
|
||||
@Override
|
||||
public Builder clear() {
|
||||
if (fields == null) {
|
||||
throw new IllegalStateException("Cannot call clear() after build().");
|
||||
}
|
||||
|
@ -272,7 +286,8 @@ public final class DynamicMessage extends AbstractMessage {
|
|||
return this;
|
||||
}
|
||||
|
||||
public Builder mergeFrom(Message other) {
|
||||
@Override
|
||||
public Builder mergeFrom(Message other) {
|
||||
if (other instanceof DynamicMessage) {
|
||||
// This should be somewhat faster than calling super.mergeFrom().
|
||||
DynamicMessage otherDynamicMessage = (DynamicMessage) other;
|
||||
|
@ -288,7 +303,8 @@ public final class DynamicMessage extends AbstractMessage {
|
|||
}
|
||||
}
|
||||
|
||||
public DynamicMessage build() {
|
||||
@Override
|
||||
public DynamicMessage build() {
|
||||
// If fields == null, we'll throw an appropriate exception later.
|
||||
if (fields != null && !isInitialized()) {
|
||||
throw newUninitializedMessageException(
|
||||
|
@ -311,7 +327,8 @@ public final class DynamicMessage extends AbstractMessage {
|
|||
return buildPartial();
|
||||
}
|
||||
|
||||
public DynamicMessage buildPartial() {
|
||||
@Override
|
||||
public DynamicMessage buildPartial() {
|
||||
if (fields == null) {
|
||||
throw new IllegalStateException(
|
||||
"build() has already been called on this Builder.");
|
||||
|
@ -324,29 +341,35 @@ public final class DynamicMessage extends AbstractMessage {
|
|||
return result;
|
||||
}
|
||||
|
||||
public Builder clone() {
|
||||
@Override
|
||||
public Builder clone() {
|
||||
Builder result = new Builder(type);
|
||||
result.fields.mergeFrom(fields);
|
||||
return result;
|
||||
}
|
||||
|
||||
public boolean isInitialized() {
|
||||
@Override
|
||||
public boolean isInitialized() {
|
||||
return DynamicMessage.isInitialized(type, fields);
|
||||
}
|
||||
|
||||
public Descriptor getDescriptorForType() {
|
||||
@Override
|
||||
public Descriptor getDescriptorForType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public DynamicMessage getDefaultInstanceForType() {
|
||||
@Override
|
||||
public DynamicMessage getDefaultInstanceForType() {
|
||||
return getDefaultInstance(type);
|
||||
}
|
||||
|
||||
public Map<FieldDescriptor, Object> getAllFields() {
|
||||
@Override
|
||||
public Map<FieldDescriptor, Object> getAllFields() {
|
||||
return fields.getAllFields();
|
||||
}
|
||||
|
||||
public Builder newBuilderForField(FieldDescriptor field) {
|
||||
@Override
|
||||
public Builder newBuilderForField(FieldDescriptor field) {
|
||||
verifyContainingType(field);
|
||||
|
||||
if (field.getJavaType() != FieldDescriptor.JavaType.MESSAGE) {
|
||||
|
@ -357,12 +380,14 @@ public final class DynamicMessage extends AbstractMessage {
|
|||
return new Builder(field.getMessageType());
|
||||
}
|
||||
|
||||
public boolean hasField(FieldDescriptor field) {
|
||||
@Override
|
||||
public boolean hasField(FieldDescriptor field) {
|
||||
verifyContainingType(field);
|
||||
return fields.hasField(field);
|
||||
}
|
||||
|
||||
public Object getField(FieldDescriptor field) {
|
||||
@Override
|
||||
public Object getField(FieldDescriptor field) {
|
||||
verifyContainingType(field);
|
||||
Object result = fields.getField(field);
|
||||
if (result == null) {
|
||||
|
@ -375,51 +400,60 @@ public final class DynamicMessage extends AbstractMessage {
|
|||
return result;
|
||||
}
|
||||
|
||||
public Builder setField(FieldDescriptor field, Object value) {
|
||||
@Override
|
||||
public Builder setField(FieldDescriptor field, Object value) {
|
||||
verifyContainingType(field);
|
||||
fields.setField(field, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder clearField(FieldDescriptor field) {
|
||||
@Override
|
||||
public Builder clearField(FieldDescriptor field) {
|
||||
verifyContainingType(field);
|
||||
fields.clearField(field);
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getRepeatedFieldCount(FieldDescriptor field) {
|
||||
@Override
|
||||
public int getRepeatedFieldCount(FieldDescriptor field) {
|
||||
verifyContainingType(field);
|
||||
return fields.getRepeatedFieldCount(field);
|
||||
}
|
||||
|
||||
public Object getRepeatedField(FieldDescriptor field, int index) {
|
||||
@Override
|
||||
public Object getRepeatedField(FieldDescriptor field, int index) {
|
||||
verifyContainingType(field);
|
||||
return fields.getRepeatedField(field, index);
|
||||
}
|
||||
|
||||
public Builder setRepeatedField(FieldDescriptor field,
|
||||
@Override
|
||||
public Builder setRepeatedField(FieldDescriptor field,
|
||||
int index, Object value) {
|
||||
verifyContainingType(field);
|
||||
fields.setRepeatedField(field, index, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder addRepeatedField(FieldDescriptor field, Object value) {
|
||||
@Override
|
||||
public Builder addRepeatedField(FieldDescriptor field, Object value) {
|
||||
verifyContainingType(field);
|
||||
fields.addRepeatedField(field, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public UnknownFieldSet getUnknownFields() {
|
||||
@Override
|
||||
public UnknownFieldSet getUnknownFields() {
|
||||
return unknownFields;
|
||||
}
|
||||
|
||||
public Builder setUnknownFields(UnknownFieldSet unknownFields) {
|
||||
@Override
|
||||
public Builder setUnknownFields(UnknownFieldSet unknownFields) {
|
||||
this.unknownFields = unknownFields;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder mergeUnknownFields(UnknownFieldSet unknownFields) {
|
||||
@Override
|
||||
public Builder mergeUnknownFields(UnknownFieldSet unknownFields) {
|
||||
this.unknownFields =
|
||||
UnknownFieldSet.newBuilder(this.unknownFields)
|
||||
.mergeFrom(unknownFields)
|
||||
|
|
|
@ -64,7 +64,8 @@ public abstract class GeneratedMessage extends AbstractMessage {
|
|||
*/
|
||||
protected abstract FieldAccessorTable internalGetFieldAccessorTable();
|
||||
|
||||
public Descriptor getDescriptorForType() {
|
||||
@Override
|
||||
public Descriptor getDescriptorForType() {
|
||||
return internalGetFieldAccessorTable().descriptor;
|
||||
}
|
||||
|
||||
|
@ -119,29 +120,35 @@ private Map<FieldDescriptor, Object> getAllFieldsMutable() {
|
|||
return true;
|
||||
}
|
||||
|
||||
public Map<FieldDescriptor, Object> getAllFields() {
|
||||
@Override
|
||||
public Map<FieldDescriptor, Object> getAllFields() {
|
||||
return Collections.unmodifiableMap(getAllFieldsMutable());
|
||||
}
|
||||
|
||||
public boolean hasField(final FieldDescriptor field) {
|
||||
@Override
|
||||
public boolean hasField(final FieldDescriptor field) {
|
||||
return internalGetFieldAccessorTable().getField(field).has(this);
|
||||
}
|
||||
|
||||
public Object getField(final FieldDescriptor field) {
|
||||
@Override
|
||||
public Object getField(final FieldDescriptor field) {
|
||||
return internalGetFieldAccessorTable().getField(field).get(this);
|
||||
}
|
||||
|
||||
public int getRepeatedFieldCount(final FieldDescriptor field) {
|
||||
@Override
|
||||
public int getRepeatedFieldCount(final FieldDescriptor field) {
|
||||
return internalGetFieldAccessorTable().getField(field)
|
||||
.getRepeatedCount(this);
|
||||
}
|
||||
|
||||
public Object getRepeatedField(final FieldDescriptor field, final int index) {
|
||||
@Override
|
||||
public Object getRepeatedField(final FieldDescriptor field, final int index) {
|
||||
return internalGetFieldAccessorTable().getField(field)
|
||||
.getRepeated(this, index);
|
||||
}
|
||||
|
||||
public final UnknownFieldSet getUnknownFields() {
|
||||
@Override
|
||||
public final UnknownFieldSet getUnknownFields() {
|
||||
return unknownFields;
|
||||
}
|
||||
|
||||
|
@ -174,24 +181,29 @@ private Map<FieldDescriptor, Object> getAllFieldsMutable() {
|
|||
return internalGetResult().internalGetFieldAccessorTable();
|
||||
}
|
||||
|
||||
public Descriptor getDescriptorForType() {
|
||||
@Override
|
||||
public Descriptor getDescriptorForType() {
|
||||
return internalGetFieldAccessorTable().descriptor;
|
||||
}
|
||||
|
||||
public Map<FieldDescriptor, Object> getAllFields() {
|
||||
@Override
|
||||
public Map<FieldDescriptor, Object> getAllFields() {
|
||||
return internalGetResult().getAllFields();
|
||||
}
|
||||
|
||||
public Message.Builder newBuilderForField(
|
||||
@Override
|
||||
public Message.Builder newBuilderForField(
|
||||
final FieldDescriptor field) {
|
||||
return internalGetFieldAccessorTable().getField(field).newBuilder();
|
||||
}
|
||||
|
||||
public boolean hasField(final FieldDescriptor field) {
|
||||
@Override
|
||||
public boolean hasField(final FieldDescriptor field) {
|
||||
return internalGetResult().hasField(field);
|
||||
}
|
||||
|
||||
public Object getField(final FieldDescriptor field) {
|
||||
@Override
|
||||
public Object getField(final FieldDescriptor field) {
|
||||
if (field.isRepeated()) {
|
||||
// The underlying list object is still modifiable at this point.
|
||||
// Make sure not to expose the modifiable list to the caller.
|
||||
|
@ -202,44 +214,52 @@ private Map<FieldDescriptor, Object> getAllFieldsMutable() {
|
|||
}
|
||||
}
|
||||
|
||||
public BuilderType setField(final FieldDescriptor field,
|
||||
@Override
|
||||
public BuilderType setField(final FieldDescriptor field,
|
||||
final Object value) {
|
||||
internalGetFieldAccessorTable().getField(field).set(this, value);
|
||||
return (BuilderType) this;
|
||||
}
|
||||
|
||||
public BuilderType clearField(final FieldDescriptor field) {
|
||||
@Override
|
||||
public BuilderType clearField(final FieldDescriptor field) {
|
||||
internalGetFieldAccessorTable().getField(field).clear(this);
|
||||
return (BuilderType) this;
|
||||
}
|
||||
|
||||
public int getRepeatedFieldCount(final FieldDescriptor field) {
|
||||
@Override
|
||||
public int getRepeatedFieldCount(final FieldDescriptor field) {
|
||||
return internalGetResult().getRepeatedFieldCount(field);
|
||||
}
|
||||
|
||||
public Object getRepeatedField(final FieldDescriptor field,
|
||||
@Override
|
||||
public Object getRepeatedField(final FieldDescriptor field,
|
||||
final int index) {
|
||||
return internalGetResult().getRepeatedField(field, index);
|
||||
}
|
||||
|
||||
public BuilderType setRepeatedField(final FieldDescriptor field,
|
||||
@Override
|
||||
public BuilderType setRepeatedField(final FieldDescriptor field,
|
||||
final int index, final Object value) {
|
||||
internalGetFieldAccessorTable().getField(field)
|
||||
.setRepeated(this, index, value);
|
||||
return (BuilderType) this;
|
||||
}
|
||||
|
||||
public BuilderType addRepeatedField(final FieldDescriptor field,
|
||||
@Override
|
||||
public BuilderType addRepeatedField(final FieldDescriptor field,
|
||||
final Object value) {
|
||||
internalGetFieldAccessorTable().getField(field).addRepeated(this, value);
|
||||
return (BuilderType) this;
|
||||
}
|
||||
|
||||
public final UnknownFieldSet getUnknownFields() {
|
||||
@Override
|
||||
public final UnknownFieldSet getUnknownFields() {
|
||||
return internalGetResult().unknownFields;
|
||||
}
|
||||
|
||||
public final BuilderType setUnknownFields(
|
||||
@Override
|
||||
public final BuilderType setUnknownFields(
|
||||
final UnknownFieldSet unknownFields) {
|
||||
internalGetResult().unknownFields = unknownFields;
|
||||
return (BuilderType) this;
|
||||
|
@ -256,7 +276,8 @@ private Map<FieldDescriptor, Object> getAllFieldsMutable() {
|
|||
return (BuilderType) this;
|
||||
}
|
||||
|
||||
public boolean isInitialized() {
|
||||
@Override
|
||||
public boolean isInitialized() {
|
||||
return internalGetResult().isInitialized();
|
||||
}
|
||||
|
||||
|
@ -1063,37 +1084,46 @@ private Map<FieldDescriptor, Object> getAllFieldsMutable() {
|
|||
protected final Method hasMethod;
|
||||
protected final Method clearMethod;
|
||||
|
||||
public Object get(final GeneratedMessage message) {
|
||||
@Override
|
||||
public Object get(final GeneratedMessage message) {
|
||||
return invokeOrDie(getMethod, message);
|
||||
}
|
||||
public void set(final Builder builder, final Object value) {
|
||||
@Override
|
||||
public void set(final Builder builder, final Object value) {
|
||||
invokeOrDie(setMethod, builder, value);
|
||||
}
|
||||
public Object getRepeated(final GeneratedMessage message,
|
||||
@Override
|
||||
public Object getRepeated(final GeneratedMessage message,
|
||||
final int index) {
|
||||
throw new UnsupportedOperationException(
|
||||
"getRepeatedField() called on a singular field.");
|
||||
}
|
||||
public void setRepeated(final Builder builder,
|
||||
@Override
|
||||
public void setRepeated(final Builder builder,
|
||||
final int index, final Object value) {
|
||||
throw new UnsupportedOperationException(
|
||||
"setRepeatedField() called on a singular field.");
|
||||
}
|
||||
public void addRepeated(final Builder builder, final Object value) {
|
||||
@Override
|
||||
public void addRepeated(final Builder builder, final Object value) {
|
||||
throw new UnsupportedOperationException(
|
||||
"addRepeatedField() called on a singular field.");
|
||||
}
|
||||
public boolean has(final GeneratedMessage message) {
|
||||
@Override
|
||||
public boolean has(final GeneratedMessage message) {
|
||||
return (Boolean) invokeOrDie(hasMethod, message);
|
||||
}
|
||||
public int getRepeatedCount(final GeneratedMessage message) {
|
||||
@Override
|
||||
public int getRepeatedCount(final GeneratedMessage message) {
|
||||
throw new UnsupportedOperationException(
|
||||
"getRepeatedFieldSize() called on a singular field.");
|
||||
}
|
||||
public void clear(final Builder builder) {
|
||||
@Override
|
||||
public void clear(final Builder builder) {
|
||||
invokeOrDie(clearMethod, builder);
|
||||
}
|
||||
public Message.Builder newBuilder() {
|
||||
@Override
|
||||
public Message.Builder newBuilder() {
|
||||
throw new UnsupportedOperationException(
|
||||
"newBuilderForField() called on a non-Message type.");
|
||||
}
|
||||
|
@ -1129,10 +1159,12 @@ private Map<FieldDescriptor, Object> getAllFieldsMutable() {
|
|||
protected final Method getCountMethod;
|
||||
protected final Method clearMethod;
|
||||
|
||||
public Object get(final GeneratedMessage message) {
|
||||
@Override
|
||||
public Object get(final GeneratedMessage message) {
|
||||
return invokeOrDie(getMethod, message);
|
||||
}
|
||||
public void set(final Builder builder, final Object value) {
|
||||
@Override
|
||||
public void set(final Builder builder, final Object value) {
|
||||
// Add all the elements individually. This serves two purposes:
|
||||
// 1) Verifies that each element has the correct type.
|
||||
// 2) Insures that the caller cannot modify the list later on and
|
||||
|
@ -1142,28 +1174,35 @@ private Map<FieldDescriptor, Object> getAllFieldsMutable() {
|
|||
addRepeated(builder, element);
|
||||
}
|
||||
}
|
||||
public Object getRepeated(final GeneratedMessage message,
|
||||
@Override
|
||||
public Object getRepeated(final GeneratedMessage message,
|
||||
final int index) {
|
||||
return invokeOrDie(getRepeatedMethod, message, index);
|
||||
}
|
||||
public void setRepeated(final Builder builder,
|
||||
@Override
|
||||
public void setRepeated(final Builder builder,
|
||||
final int index, final Object value) {
|
||||
invokeOrDie(setRepeatedMethod, builder, index, value);
|
||||
}
|
||||
public void addRepeated(final Builder builder, final Object value) {
|
||||
@Override
|
||||
public void addRepeated(final Builder builder, final Object value) {
|
||||
invokeOrDie(addRepeatedMethod, builder, value);
|
||||
}
|
||||
public boolean has(final GeneratedMessage message) {
|
||||
@Override
|
||||
public boolean has(final GeneratedMessage message) {
|
||||
throw new UnsupportedOperationException(
|
||||
"hasField() called on a singular field.");
|
||||
}
|
||||
public int getRepeatedCount(final GeneratedMessage message) {
|
||||
@Override
|
||||
public int getRepeatedCount(final GeneratedMessage message) {
|
||||
return (Integer) invokeOrDie(getCountMethod, message);
|
||||
}
|
||||
public void clear(final Builder builder) {
|
||||
@Override
|
||||
public void clear(final Builder builder) {
|
||||
invokeOrDie(clearMethod, builder);
|
||||
}
|
||||
public Message.Builder newBuilder() {
|
||||
@Override
|
||||
public Message.Builder newBuilder() {
|
||||
throw new UnsupportedOperationException(
|
||||
"newBuilderForField() called on a non-Message type.");
|
||||
}
|
||||
|
|
|
@ -63,7 +63,8 @@ public abstract class GeneratedMessageLite extends AbstractMessageLite {
|
|||
public abstract BuilderType mergeFrom(MessageType message);
|
||||
|
||||
// Defined here for return type covariance.
|
||||
public abstract MessageType getDefaultInstanceForType();
|
||||
@Override
|
||||
public abstract MessageType getDefaultInstanceForType();
|
||||
|
||||
/**
|
||||
* Get the message being built. We don't just pass this to the
|
||||
|
@ -446,37 +447,45 @@ public abstract class GeneratedMessageLite extends AbstractMessageLite {
|
|||
private final boolean isRepeated;
|
||||
private final boolean isPacked;
|
||||
|
||||
public int getNumber() {
|
||||
@Override
|
||||
public int getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
public WireFormat.FieldType getLiteType() {
|
||||
@Override
|
||||
public WireFormat.FieldType getLiteType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public WireFormat.JavaType getLiteJavaType() {
|
||||
@Override
|
||||
public WireFormat.JavaType getLiteJavaType() {
|
||||
return type.getJavaType();
|
||||
}
|
||||
|
||||
public boolean isRepeated() {
|
||||
@Override
|
||||
public boolean isRepeated() {
|
||||
return isRepeated;
|
||||
}
|
||||
|
||||
public boolean isPacked() {
|
||||
@Override
|
||||
public boolean isPacked() {
|
||||
return isPacked;
|
||||
}
|
||||
|
||||
public Internal.EnumLiteMap<?> getEnumType() {
|
||||
@Override
|
||||
public Internal.EnumLiteMap<?> getEnumType() {
|
||||
return enumTypeMap;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public MessageLite.Builder internalMergeFrom(
|
||||
MessageLite.Builder to, MessageLite from) {
|
||||
return ((Builder) to).mergeFrom((GeneratedMessageLite) from);
|
||||
}
|
||||
|
||||
public int compareTo(ExtensionDescriptor other) {
|
||||
@Override
|
||||
public int compareTo(ExtensionDescriptor other) {
|
||||
return number - other.number;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,7 +59,8 @@ public interface Message extends MessageLite {
|
|||
Descriptors.Descriptor getDescriptorForType();
|
||||
|
||||
// (From MessageLite, re-declared here only for return type covariance.)
|
||||
Message getDefaultInstanceForType();
|
||||
@Override
|
||||
Message getDefaultInstanceForType();
|
||||
|
||||
/**
|
||||
* Returns a collection of all the fields in this message which are set
|
||||
|
@ -152,8 +153,10 @@ public interface Message extends MessageLite {
|
|||
// Builders
|
||||
|
||||
// (From MessageLite, re-declared here only for return type covariance.)
|
||||
Builder newBuilderForType();
|
||||
Builder toBuilder();
|
||||
@Override
|
||||
Builder newBuilderForType();
|
||||
@Override
|
||||
Builder toBuilder();
|
||||
|
||||
/**
|
||||
* Abstract interface implemented by Protocol Message builders.
|
||||
|
@ -161,7 +164,8 @@ public interface Message extends MessageLite {
|
|||
interface Builder extends MessageLite.Builder {
|
||||
// (From MessageLite.Builder, re-declared here only for return type
|
||||
// covariance.)
|
||||
Builder clear();
|
||||
@Override
|
||||
Builder clear();
|
||||
|
||||
/**
|
||||
* Merge {@code other} into the message being built. {@code other} must
|
||||
|
@ -183,11 +187,16 @@ public interface Message extends MessageLite {
|
|||
|
||||
// (From MessageLite.Builder, re-declared here only for return type
|
||||
// covariance.)
|
||||
Message build();
|
||||
Message buildPartial();
|
||||
Builder clone();
|
||||
Builder mergeFrom(CodedInputStream input) throws IOException;
|
||||
Builder mergeFrom(CodedInputStream input,
|
||||
@Override
|
||||
Message build();
|
||||
@Override
|
||||
Message buildPartial();
|
||||
@Override
|
||||
Builder clone();
|
||||
@Override
|
||||
Builder mergeFrom(CodedInputStream input) throws IOException;
|
||||
@Override
|
||||
Builder mergeFrom(CodedInputStream input,
|
||||
ExtensionRegistryLite extensionRegistry)
|
||||
throws IOException;
|
||||
|
||||
|
@ -199,7 +208,8 @@ public interface Message extends MessageLite {
|
|||
|
||||
// (From MessageLite.Builder, re-declared here only for return type
|
||||
// covariance.)
|
||||
Message getDefaultInstanceForType();
|
||||
@Override
|
||||
Message getDefaultInstanceForType();
|
||||
|
||||
/**
|
||||
* Like {@link Message#getAllFields()}. The returned map may or may not
|
||||
|
@ -279,26 +289,36 @@ public interface Message extends MessageLite {
|
|||
|
||||
// (From MessageLite.Builder, re-declared here only for return type
|
||||
// covariance.)
|
||||
Builder mergeFrom(ByteString data) throws InvalidProtocolBufferException;
|
||||
Builder mergeFrom(ByteString data,
|
||||
@Override
|
||||
Builder mergeFrom(ByteString data) throws InvalidProtocolBufferException;
|
||||
@Override
|
||||
Builder mergeFrom(ByteString data,
|
||||
ExtensionRegistryLite extensionRegistry)
|
||||
throws InvalidProtocolBufferException;
|
||||
Builder mergeFrom(byte[] data) throws InvalidProtocolBufferException;
|
||||
Builder mergeFrom(byte[] data, int off, int len)
|
||||
@Override
|
||||
Builder mergeFrom(byte[] data) throws InvalidProtocolBufferException;
|
||||
@Override
|
||||
Builder mergeFrom(byte[] data, int off, int len)
|
||||
throws InvalidProtocolBufferException;
|
||||
Builder mergeFrom(byte[] data,
|
||||
@Override
|
||||
Builder mergeFrom(byte[] data,
|
||||
ExtensionRegistryLite extensionRegistry)
|
||||
throws InvalidProtocolBufferException;
|
||||
Builder mergeFrom(byte[] data, int off, int len,
|
||||
@Override
|
||||
Builder mergeFrom(byte[] data, int off, int len,
|
||||
ExtensionRegistryLite extensionRegistry)
|
||||
throws InvalidProtocolBufferException;
|
||||
Builder mergeFrom(InputStream input) throws IOException;
|
||||
Builder mergeFrom(InputStream input,
|
||||
@Override
|
||||
Builder mergeFrom(InputStream input) throws IOException;
|
||||
@Override
|
||||
Builder mergeFrom(InputStream input,
|
||||
ExtensionRegistryLite extensionRegistry)
|
||||
throws IOException;
|
||||
boolean mergeDelimitedFrom(InputStream input)
|
||||
@Override
|
||||
boolean mergeDelimitedFrom(InputStream input)
|
||||
throws IOException;
|
||||
boolean mergeDelimitedFrom(InputStream input,
|
||||
@Override
|
||||
boolean mergeDelimitedFrom(InputStream input,
|
||||
ExtensionRegistryLite extensionRegistry)
|
||||
throws IOException;
|
||||
}
|
||||
|
|
|
@ -42,7 +42,8 @@ public interface ProtocolMessageEnum extends Internal.EnumLite {
|
|||
/**
|
||||
* Return the value's numeric value as defined in the .proto file.
|
||||
*/
|
||||
int getNumber();
|
||||
@Override
|
||||
int getNumber();
|
||||
|
||||
/**
|
||||
* Return the value's descriptor, which contains information such as
|
||||
|
|
|
@ -71,7 +71,8 @@ public final class RpcUtil {
|
|||
final Class<Type> originalClass,
|
||||
final Type defaultInstance) {
|
||||
return new RpcCallback<Message>() {
|
||||
public void run(final Message parameter) {
|
||||
@Override
|
||||
public void run(final Message parameter) {
|
||||
Type typedParameter;
|
||||
try {
|
||||
typedParameter = originalClass.cast(parameter);
|
||||
|
@ -108,7 +109,8 @@ public final class RpcUtil {
|
|||
return new RpcCallback<ParameterType>() {
|
||||
private boolean alreadyCalled = false;
|
||||
|
||||
public void run(final ParameterType parameter) {
|
||||
@Override
|
||||
public void run(final ParameterType parameter) {
|
||||
synchronized(this) {
|
||||
if (alreadyCalled) {
|
||||
throw new AlreadyCalledException();
|
||||
|
|
|
@ -76,7 +76,8 @@ public final class UnknownFieldSet implements MessageLite {
|
|||
public static UnknownFieldSet getDefaultInstance() {
|
||||
return defaultInstance;
|
||||
}
|
||||
public UnknownFieldSet getDefaultInstanceForType() {
|
||||
@Override
|
||||
public UnknownFieldSet getDefaultInstanceForType() {
|
||||
return defaultInstance;
|
||||
}
|
||||
private static final UnknownFieldSet defaultInstance =
|
||||
|
@ -125,7 +126,8 @@ public final class UnknownFieldSet implements MessageLite {
|
|||
}
|
||||
|
||||
/** Serializes the set and writes it to {@code output}. */
|
||||
public void writeTo(final CodedOutputStream output) throws IOException {
|
||||
@Override
|
||||
public void writeTo(final CodedOutputStream output) throws IOException {
|
||||
for (final Map.Entry<Integer, Field> entry : fields.entrySet()) {
|
||||
entry.getValue().writeTo(entry.getKey(), output);
|
||||
}
|
||||
|
@ -145,7 +147,8 @@ public final class UnknownFieldSet implements MessageLite {
|
|||
* Serializes the message to a {@code ByteString} and returns it. This is
|
||||
* just a trivial wrapper around {@link #writeTo(CodedOutputStream)}.
|
||||
*/
|
||||
public ByteString toByteString() {
|
||||
@Override
|
||||
public ByteString toByteString() {
|
||||
try {
|
||||
final ByteString.CodedBuilder out =
|
||||
ByteString.newCodedBuilder(getSerializedSize());
|
||||
|
@ -162,7 +165,8 @@ public final class UnknownFieldSet implements MessageLite {
|
|||
* Serializes the message to a {@code byte} array and returns it. This is
|
||||
* just a trivial wrapper around {@link #writeTo(CodedOutputStream)}.
|
||||
*/
|
||||
public byte[] toByteArray() {
|
||||
@Override
|
||||
public byte[] toByteArray() {
|
||||
try {
|
||||
final byte[] result = new byte[getSerializedSize()];
|
||||
final CodedOutputStream output = CodedOutputStream.newInstance(result);
|
||||
|
@ -180,13 +184,15 @@ public final class UnknownFieldSet implements MessageLite {
|
|||
* Serializes the message and writes it to {@code output}. This is just a
|
||||
* trivial wrapper around {@link #writeTo(CodedOutputStream)}.
|
||||
*/
|
||||
public void writeTo(final OutputStream output) throws IOException {
|
||||
@Override
|
||||
public void writeTo(final OutputStream output) throws IOException {
|
||||
final CodedOutputStream codedOutput = CodedOutputStream.newInstance(output);
|
||||
writeTo(codedOutput);
|
||||
codedOutput.flush();
|
||||
}
|
||||
|
||||
public void writeDelimitedTo(OutputStream output) throws IOException {
|
||||
@Override
|
||||
public void writeDelimitedTo(OutputStream output) throws IOException {
|
||||
final CodedOutputStream codedOutput = CodedOutputStream.newInstance(output);
|
||||
codedOutput.writeRawVarint32(getSerializedSize());
|
||||
writeTo(codedOutput);
|
||||
|
@ -194,7 +200,8 @@ public final class UnknownFieldSet implements MessageLite {
|
|||
}
|
||||
|
||||
/** Get the number of bytes required to encode this set. */
|
||||
public int getSerializedSize() {
|
||||
@Override
|
||||
public int getSerializedSize() {
|
||||
int result = 0;
|
||||
for (final Map.Entry<Integer, Field> entry : fields.entrySet()) {
|
||||
result += entry.getValue().getSerializedSize(entry.getKey());
|
||||
|
@ -227,7 +234,8 @@ public final class UnknownFieldSet implements MessageLite {
|
|||
return result;
|
||||
}
|
||||
|
||||
public boolean isInitialized() {
|
||||
@Override
|
||||
public boolean isInitialized() {
|
||||
// UnknownFieldSets do not have required fields, so they are always
|
||||
// initialized.
|
||||
return true;
|
||||
|
@ -257,11 +265,13 @@ public final class UnknownFieldSet implements MessageLite {
|
|||
return newBuilder().mergeFrom(input).build();
|
||||
}
|
||||
|
||||
public Builder newBuilderForType() {
|
||||
@Override
|
||||
public Builder newBuilderForType() {
|
||||
return newBuilder();
|
||||
}
|
||||
|
||||
public Builder toBuilder() {
|
||||
@Override
|
||||
public Builder toBuilder() {
|
||||
return newBuilder().mergeFrom(this);
|
||||
}
|
||||
|
||||
|
@ -328,7 +338,8 @@ public final class UnknownFieldSet implements MessageLite {
|
|||
* in undefined behavior and can cause a {@code NullPointerException} to be
|
||||
* thrown.
|
||||
*/
|
||||
public UnknownFieldSet build() {
|
||||
@Override
|
||||
public UnknownFieldSet build() {
|
||||
getFieldBuilder(0); // Force lastField to be built.
|
||||
final UnknownFieldSet result;
|
||||
if (fields.isEmpty()) {
|
||||
|
@ -340,7 +351,8 @@ public final class UnknownFieldSet implements MessageLite {
|
|||
return result;
|
||||
}
|
||||
|
||||
public UnknownFieldSet buildPartial() {
|
||||
@Override
|
||||
public UnknownFieldSet buildPartial() {
|
||||
// No required fields, so this is the same as build().
|
||||
return build();
|
||||
}
|
||||
|
@ -352,7 +364,8 @@ public final class UnknownFieldSet implements MessageLite {
|
|||
new UnknownFieldSet(fields));
|
||||
}
|
||||
|
||||
public UnknownFieldSet getDefaultInstanceForType() {
|
||||
@Override
|
||||
public UnknownFieldSet getDefaultInstanceForType() {
|
||||
return UnknownFieldSet.getDefaultInstance();
|
||||
}
|
||||
|
||||
|
@ -363,7 +376,8 @@ public final class UnknownFieldSet implements MessageLite {
|
|||
}
|
||||
|
||||
/** Reset the builder to an empty set. */
|
||||
public Builder clear() {
|
||||
@Override
|
||||
public Builder clear() {
|
||||
reinitialize();
|
||||
return this;
|
||||
}
|
||||
|
@ -455,7 +469,8 @@ public final class UnknownFieldSet implements MessageLite {
|
|||
* Parse an entire message from {@code input} and merge its fields into
|
||||
* this set.
|
||||
*/
|
||||
public Builder mergeFrom(final CodedInputStream input) throws IOException {
|
||||
@Override
|
||||
public Builder mergeFrom(final CodedInputStream input) throws IOException {
|
||||
while (true) {
|
||||
final int tag = input.readTag();
|
||||
if (tag == 0 || !mergeFieldFrom(tag, input)) {
|
||||
|
@ -504,7 +519,8 @@ public final class UnknownFieldSet implements MessageLite {
|
|||
* set being built. This is just a small wrapper around
|
||||
* {@link #mergeFrom(CodedInputStream)}.
|
||||
*/
|
||||
public Builder mergeFrom(final ByteString data)
|
||||
@Override
|
||||
public Builder mergeFrom(final ByteString data)
|
||||
throws InvalidProtocolBufferException {
|
||||
try {
|
||||
final CodedInputStream input = data.newCodedInput();
|
||||
|
@ -525,7 +541,8 @@ public final class UnknownFieldSet implements MessageLite {
|
|||
* set being built. This is just a small wrapper around
|
||||
* {@link #mergeFrom(CodedInputStream)}.
|
||||
*/
|
||||
public Builder mergeFrom(final byte[] data)
|
||||
@Override
|
||||
public Builder mergeFrom(final byte[] data)
|
||||
throws InvalidProtocolBufferException {
|
||||
try {
|
||||
final CodedInputStream input = CodedInputStream.newInstance(data);
|
||||
|
@ -546,14 +563,16 @@ public final class UnknownFieldSet implements MessageLite {
|
|||
* set being built. This is just a small wrapper around
|
||||
* {@link #mergeFrom(CodedInputStream)}.
|
||||
*/
|
||||
public Builder mergeFrom(final InputStream input) throws IOException {
|
||||
@Override
|
||||
public Builder mergeFrom(final InputStream input) throws IOException {
|
||||
final CodedInputStream codedInput = CodedInputStream.newInstance(input);
|
||||
mergeFrom(codedInput);
|
||||
codedInput.checkLastTagWas(0);
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean mergeDelimitedFrom(InputStream input)
|
||||
@Override
|
||||
public boolean mergeDelimitedFrom(InputStream input)
|
||||
throws IOException {
|
||||
final int firstByte = input.read();
|
||||
if (firstByte == -1) {
|
||||
|
@ -565,21 +584,24 @@ public final class UnknownFieldSet implements MessageLite {
|
|||
return true;
|
||||
}
|
||||
|
||||
public boolean mergeDelimitedFrom(
|
||||
@Override
|
||||
public boolean mergeDelimitedFrom(
|
||||
InputStream input,
|
||||
ExtensionRegistryLite extensionRegistry) throws IOException {
|
||||
// UnknownFieldSet has no extensions.
|
||||
return mergeDelimitedFrom(input);
|
||||
}
|
||||
|
||||
public Builder mergeFrom(
|
||||
@Override
|
||||
public Builder mergeFrom(
|
||||
CodedInputStream input,
|
||||
ExtensionRegistryLite extensionRegistry) throws IOException {
|
||||
// UnknownFieldSet has no extensions.
|
||||
return mergeFrom(input);
|
||||
}
|
||||
|
||||
public Builder mergeFrom(
|
||||
@Override
|
||||
public Builder mergeFrom(
|
||||
ByteString data,
|
||||
ExtensionRegistryLite extensionRegistry)
|
||||
throws InvalidProtocolBufferException {
|
||||
|
@ -587,7 +609,8 @@ public final class UnknownFieldSet implements MessageLite {
|
|||
return mergeFrom(data);
|
||||
}
|
||||
|
||||
public Builder mergeFrom(byte[] data, int off, int len)
|
||||
@Override
|
||||
public Builder mergeFrom(byte[] data, int off, int len)
|
||||
throws InvalidProtocolBufferException {
|
||||
try {
|
||||
final CodedInputStream input =
|
||||
|
@ -604,7 +627,8 @@ public final class UnknownFieldSet implements MessageLite {
|
|||
}
|
||||
}
|
||||
|
||||
public Builder mergeFrom(
|
||||
@Override
|
||||
public Builder mergeFrom(
|
||||
byte[] data,
|
||||
ExtensionRegistryLite extensionRegistry)
|
||||
throws InvalidProtocolBufferException {
|
||||
|
@ -612,7 +636,8 @@ public final class UnknownFieldSet implements MessageLite {
|
|||
return mergeFrom(data);
|
||||
}
|
||||
|
||||
public Builder mergeFrom(
|
||||
@Override
|
||||
public Builder mergeFrom(
|
||||
byte[] data, int off, int len,
|
||||
ExtensionRegistryLite extensionRegistry)
|
||||
throws InvalidProtocolBufferException {
|
||||
|
@ -620,14 +645,16 @@ public final class UnknownFieldSet implements MessageLite {
|
|||
return mergeFrom(data, off, len);
|
||||
}
|
||||
|
||||
public Builder mergeFrom(
|
||||
@Override
|
||||
public Builder mergeFrom(
|
||||
InputStream input,
|
||||
ExtensionRegistryLite extensionRegistry) throws IOException {
|
||||
// UnknownFieldSet has no extensions.
|
||||
return mergeFrom(input);
|
||||
}
|
||||
|
||||
public boolean isInitialized() {
|
||||
@Override
|
||||
public boolean isInitialized() {
|
||||
// UnknownFieldSets do not have required fields, so they are always
|
||||
// initialized.
|
||||
return true;
|
||||
|
|
|
@ -116,16 +116,20 @@ public final class WireFormat {
|
|||
FIXED32 (JavaType.INT , WIRETYPE_FIXED32 ),
|
||||
BOOL (JavaType.BOOLEAN , WIRETYPE_VARINT ),
|
||||
STRING (JavaType.STRING , WIRETYPE_LENGTH_DELIMITED) {
|
||||
public boolean isPackable() { return false; }
|
||||
@Override
|
||||
public boolean isPackable() { return false; }
|
||||
},
|
||||
GROUP (JavaType.MESSAGE , WIRETYPE_START_GROUP ) {
|
||||
public boolean isPackable() { return false; }
|
||||
@Override
|
||||
public boolean isPackable() { return false; }
|
||||
},
|
||||
MESSAGE (JavaType.MESSAGE , WIRETYPE_LENGTH_DELIMITED) {
|
||||
public boolean isPackable() { return false; }
|
||||
@Override
|
||||
public boolean isPackable() { return false; }
|
||||
},
|
||||
BYTES (JavaType.BYTE_STRING, WIRETYPE_LENGTH_DELIMITED) {
|
||||
public boolean isPackable() { return false; }
|
||||
@Override
|
||||
public boolean isPackable() { return false; }
|
||||
},
|
||||
UINT32 (JavaType.INT , WIRETYPE_VARINT ),
|
||||
ENUM (JavaType.ENUM , WIRETYPE_VARINT ),
|
||||
|
|
|
@ -21,7 +21,8 @@ public final class Fileformat {
|
|||
return defaultInstance;
|
||||
}
|
||||
|
||||
public Blob getDefaultInstanceForType() {
|
||||
@Override
|
||||
public Blob getDefaultInstanceForType() {
|
||||
return defaultInstance;
|
||||
}
|
||||
|
||||
|
@ -30,7 +31,8 @@ public final class Fileformat {
|
|||
return crosby.binary.Fileformat.internal_static_Blob_descriptor;
|
||||
}
|
||||
|
||||
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
|
||||
@Override
|
||||
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
|
||||
internalGetFieldAccessorTable() {
|
||||
return crosby.binary.Fileformat.internal_static_Blob_fieldAccessorTable;
|
||||
}
|
||||
|
@ -72,11 +74,13 @@ public final class Fileformat {
|
|||
|
||||
private void initFields() {
|
||||
}
|
||||
public final boolean isInitialized() {
|
||||
@Override
|
||||
public final boolean isInitialized() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void writeTo(com.google.protobuf.CodedOutputStream output)
|
||||
@Override
|
||||
public void writeTo(com.google.protobuf.CodedOutputStream output)
|
||||
throws java.io.IOException {
|
||||
getSerializedSize();
|
||||
if (hasRaw()) {
|
||||
|
@ -98,7 +102,8 @@ public final class Fileformat {
|
|||
}
|
||||
|
||||
private int memoizedSerializedSize = -1;
|
||||
public int getSerializedSize() {
|
||||
@Override
|
||||
public int getSerializedSize() {
|
||||
int size = memoizedSerializedSize;
|
||||
if (size != -1) return size;
|
||||
|
||||
|
@ -196,11 +201,13 @@ public final class Fileformat {
|
|||
}
|
||||
|
||||
public static Builder newBuilder() { return Builder.create(); }
|
||||
public Builder newBuilderForType() { return newBuilder(); }
|
||||
@Override
|
||||
public Builder newBuilderForType() { return newBuilder(); }
|
||||
public static Builder newBuilder(crosby.binary.Fileformat.Blob prototype) {
|
||||
return newBuilder().mergeFrom(prototype);
|
||||
}
|
||||
public Builder toBuilder() { return newBuilder(this); }
|
||||
@Override
|
||||
public Builder toBuilder() { return newBuilder(this); }
|
||||
|
||||
public static final class Builder extends
|
||||
com.google.protobuf.GeneratedMessage.Builder<Builder> {
|
||||
|
@ -215,11 +222,13 @@ public final class Fileformat {
|
|||
return builder;
|
||||
}
|
||||
|
||||
protected crosby.binary.Fileformat.Blob internalGetResult() {
|
||||
@Override
|
||||
protected crosby.binary.Fileformat.Blob internalGetResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public Builder clear() {
|
||||
@Override
|
||||
public Builder clear() {
|
||||
if (result == null) {
|
||||
throw new IllegalStateException(
|
||||
"Cannot call clear() after build().");
|
||||
|
@ -228,23 +237,28 @@ public final class Fileformat {
|
|||
return this;
|
||||
}
|
||||
|
||||
public Builder clone() {
|
||||
@Override
|
||||
public Builder clone() {
|
||||
return create().mergeFrom(result);
|
||||
}
|
||||
|
||||
public com.google.protobuf.Descriptors.Descriptor
|
||||
@Override
|
||||
public com.google.protobuf.Descriptors.Descriptor
|
||||
getDescriptorForType() {
|
||||
return crosby.binary.Fileformat.Blob.getDescriptor();
|
||||
}
|
||||
|
||||
public crosby.binary.Fileformat.Blob getDefaultInstanceForType() {
|
||||
@Override
|
||||
public crosby.binary.Fileformat.Blob getDefaultInstanceForType() {
|
||||
return crosby.binary.Fileformat.Blob.getDefaultInstance();
|
||||
}
|
||||
|
||||
public boolean isInitialized() {
|
||||
@Override
|
||||
public boolean isInitialized() {
|
||||
return result.isInitialized();
|
||||
}
|
||||
public crosby.binary.Fileformat.Blob build() {
|
||||
@Override
|
||||
public crosby.binary.Fileformat.Blob build() {
|
||||
if (result != null && !isInitialized()) {
|
||||
throw newUninitializedMessageException(result);
|
||||
}
|
||||
|
@ -260,7 +274,8 @@ public final class Fileformat {
|
|||
return buildPartial();
|
||||
}
|
||||
|
||||
public crosby.binary.Fileformat.Blob buildPartial() {
|
||||
@Override
|
||||
public crosby.binary.Fileformat.Blob buildPartial() {
|
||||
if (result == null) {
|
||||
throw new IllegalStateException(
|
||||
"build() has already been called on this Builder.");
|
||||
|
@ -270,7 +285,8 @@ public final class Fileformat {
|
|||
return returnMe;
|
||||
}
|
||||
|
||||
public Builder mergeFrom(com.google.protobuf.Message other) {
|
||||
@Override
|
||||
public Builder mergeFrom(com.google.protobuf.Message other) {
|
||||
if (other instanceof crosby.binary.Fileformat.Blob) {
|
||||
return mergeFrom((crosby.binary.Fileformat.Blob)other);
|
||||
} else {
|
||||
|
@ -300,7 +316,8 @@ public final class Fileformat {
|
|||
return this;
|
||||
}
|
||||
|
||||
public Builder mergeFrom(
|
||||
@Override
|
||||
public Builder mergeFrom(
|
||||
com.google.protobuf.CodedInputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
|
@ -473,7 +490,8 @@ public final class Fileformat {
|
|||
return defaultInstance;
|
||||
}
|
||||
|
||||
public BlockHeader getDefaultInstanceForType() {
|
||||
@Override
|
||||
public BlockHeader getDefaultInstanceForType() {
|
||||
return defaultInstance;
|
||||
}
|
||||
|
||||
|
@ -482,7 +500,8 @@ public final class Fileformat {
|
|||
return crosby.binary.Fileformat.internal_static_BlockHeader_descriptor;
|
||||
}
|
||||
|
||||
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
|
||||
@Override
|
||||
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
|
||||
internalGetFieldAccessorTable() {
|
||||
return crosby.binary.Fileformat.internal_static_BlockHeader_fieldAccessorTable;
|
||||
}
|
||||
|
@ -510,13 +529,15 @@ public final class Fileformat {
|
|||
|
||||
private void initFields() {
|
||||
}
|
||||
public final boolean isInitialized() {
|
||||
@Override
|
||||
public final boolean isInitialized() {
|
||||
if (!hasType) return false;
|
||||
if (!hasDatasize) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void writeTo(com.google.protobuf.CodedOutputStream output)
|
||||
@Override
|
||||
public void writeTo(com.google.protobuf.CodedOutputStream output)
|
||||
throws java.io.IOException {
|
||||
getSerializedSize();
|
||||
if (hasType()) {
|
||||
|
@ -532,7 +553,8 @@ public final class Fileformat {
|
|||
}
|
||||
|
||||
private int memoizedSerializedSize = -1;
|
||||
public int getSerializedSize() {
|
||||
@Override
|
||||
public int getSerializedSize() {
|
||||
int size = memoizedSerializedSize;
|
||||
if (size != -1) return size;
|
||||
|
||||
|
@ -622,11 +644,13 @@ public final class Fileformat {
|
|||
}
|
||||
|
||||
public static Builder newBuilder() { return Builder.create(); }
|
||||
public Builder newBuilderForType() { return newBuilder(); }
|
||||
@Override
|
||||
public Builder newBuilderForType() { return newBuilder(); }
|
||||
public static Builder newBuilder(crosby.binary.Fileformat.BlockHeader prototype) {
|
||||
return newBuilder().mergeFrom(prototype);
|
||||
}
|
||||
public Builder toBuilder() { return newBuilder(this); }
|
||||
@Override
|
||||
public Builder toBuilder() { return newBuilder(this); }
|
||||
|
||||
public static final class Builder extends
|
||||
com.google.protobuf.GeneratedMessage.Builder<Builder> {
|
||||
|
@ -641,11 +665,13 @@ public final class Fileformat {
|
|||
return builder;
|
||||
}
|
||||
|
||||
protected crosby.binary.Fileformat.BlockHeader internalGetResult() {
|
||||
@Override
|
||||
protected crosby.binary.Fileformat.BlockHeader internalGetResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public Builder clear() {
|
||||
@Override
|
||||
public Builder clear() {
|
||||
if (result == null) {
|
||||
throw new IllegalStateException(
|
||||
"Cannot call clear() after build().");
|
||||
|
@ -654,23 +680,28 @@ public final class Fileformat {
|
|||
return this;
|
||||
}
|
||||
|
||||
public Builder clone() {
|
||||
@Override
|
||||
public Builder clone() {
|
||||
return create().mergeFrom(result);
|
||||
}
|
||||
|
||||
public com.google.protobuf.Descriptors.Descriptor
|
||||
@Override
|
||||
public com.google.protobuf.Descriptors.Descriptor
|
||||
getDescriptorForType() {
|
||||
return crosby.binary.Fileformat.BlockHeader.getDescriptor();
|
||||
}
|
||||
|
||||
public crosby.binary.Fileformat.BlockHeader getDefaultInstanceForType() {
|
||||
@Override
|
||||
public crosby.binary.Fileformat.BlockHeader getDefaultInstanceForType() {
|
||||
return crosby.binary.Fileformat.BlockHeader.getDefaultInstance();
|
||||
}
|
||||
|
||||
public boolean isInitialized() {
|
||||
@Override
|
||||
public boolean isInitialized() {
|
||||
return result.isInitialized();
|
||||
}
|
||||
public crosby.binary.Fileformat.BlockHeader build() {
|
||||
@Override
|
||||
public crosby.binary.Fileformat.BlockHeader build() {
|
||||
if (result != null && !isInitialized()) {
|
||||
throw newUninitializedMessageException(result);
|
||||
}
|
||||
|
@ -686,7 +717,8 @@ public final class Fileformat {
|
|||
return buildPartial();
|
||||
}
|
||||
|
||||
public crosby.binary.Fileformat.BlockHeader buildPartial() {
|
||||
@Override
|
||||
public crosby.binary.Fileformat.BlockHeader buildPartial() {
|
||||
if (result == null) {
|
||||
throw new IllegalStateException(
|
||||
"build() has already been called on this Builder.");
|
||||
|
@ -696,7 +728,8 @@ public final class Fileformat {
|
|||
return returnMe;
|
||||
}
|
||||
|
||||
public Builder mergeFrom(com.google.protobuf.Message other) {
|
||||
@Override
|
||||
public Builder mergeFrom(com.google.protobuf.Message other) {
|
||||
if (other instanceof crosby.binary.Fileformat.BlockHeader) {
|
||||
return mergeFrom((crosby.binary.Fileformat.BlockHeader)other);
|
||||
} else {
|
||||
|
@ -720,7 +753,8 @@ public final class Fileformat {
|
|||
return this;
|
||||
}
|
||||
|
||||
public Builder mergeFrom(
|
||||
@Override
|
||||
public Builder mergeFrom(
|
||||
com.google.protobuf.CodedInputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
|
@ -857,7 +891,8 @@ public final class Fileformat {
|
|||
};
|
||||
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
|
||||
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
|
||||
public com.google.protobuf.ExtensionRegistry assignDescriptors(
|
||||
@Override
|
||||
public com.google.protobuf.ExtensionRegistry assignDescriptors(
|
||||
com.google.protobuf.Descriptors.FileDescriptor root) {
|
||||
descriptor = root;
|
||||
internal_static_Blob_descriptor =
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -295,7 +295,8 @@ public interface TByteCollection extends Serializable {
|
|||
* @param o object to be compared for equality with this collection
|
||||
* @return <tt>true</tt> if the specified object is equal to this collection
|
||||
*/
|
||||
boolean equals( Object o );
|
||||
@Override
|
||||
boolean equals( Object o );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -310,7 +311,8 @@ public interface TByteCollection extends Serializable {
|
|||
* @see Object#equals(Object)
|
||||
* @see Collection#equals(Object)
|
||||
*/
|
||||
int hashCode();
|
||||
@Override
|
||||
int hashCode();
|
||||
|
||||
|
||||
} // TByteCollection
|
||||
|
|
|
@ -295,7 +295,8 @@ public interface TFloatCollection extends Serializable {
|
|||
* @param o object to be compared for equality with this collection
|
||||
* @return <tt>true</tt> if the specified object is equal to this collection
|
||||
*/
|
||||
boolean equals( Object o );
|
||||
@Override
|
||||
boolean equals( Object o );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -310,7 +311,8 @@ public interface TFloatCollection extends Serializable {
|
|||
* @see Object#equals(Object)
|
||||
* @see Collection#equals(Object)
|
||||
*/
|
||||
int hashCode();
|
||||
@Override
|
||||
int hashCode();
|
||||
|
||||
|
||||
} // TFloatCollection
|
||||
|
|
|
@ -295,7 +295,8 @@ public interface TIntCollection extends Serializable {
|
|||
* @param o object to be compared for equality with this collection
|
||||
* @return <tt>true</tt> if the specified object is equal to this collection
|
||||
*/
|
||||
boolean equals( Object o );
|
||||
@Override
|
||||
boolean equals( Object o );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -310,7 +311,8 @@ public interface TIntCollection extends Serializable {
|
|||
* @see Object#equals(Object)
|
||||
* @see Collection#equals(Object)
|
||||
*/
|
||||
int hashCode();
|
||||
@Override
|
||||
int hashCode();
|
||||
|
||||
|
||||
} // TIntCollection
|
||||
|
|
|
@ -295,7 +295,8 @@ public interface TLongCollection extends Serializable {
|
|||
* @param o object to be compared for equality with this collection
|
||||
* @return <tt>true</tt> if the specified object is equal to this collection
|
||||
*/
|
||||
boolean equals( Object o );
|
||||
@Override
|
||||
boolean equals( Object o );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -310,7 +311,8 @@ public interface TLongCollection extends Serializable {
|
|||
* @see Object#equals(Object)
|
||||
* @see Collection#equals(Object)
|
||||
*/
|
||||
int hashCode();
|
||||
@Override
|
||||
int hashCode();
|
||||
|
||||
|
||||
} // TLongCollection
|
||||
|
|
|
@ -141,7 +141,8 @@ abstract public class TFloatHash extends TPrimitiveHash {
|
|||
* @param initialCapacity an <code>int</code> value
|
||||
* @return the actual capacity chosen
|
||||
*/
|
||||
protected int setUp( int initialCapacity ) {
|
||||
@Override
|
||||
protected int setUp( int initialCapacity ) {
|
||||
int capacity;
|
||||
|
||||
capacity = super.setUp( initialCapacity );
|
||||
|
@ -185,7 +186,8 @@ abstract public class TFloatHash extends TPrimitiveHash {
|
|||
*
|
||||
* @param index an <code>int</code> value
|
||||
*/
|
||||
protected void removeAt( int index ) {
|
||||
@Override
|
||||
protected void removeAt( int index ) {
|
||||
_set[index] = no_entry_value;
|
||||
super.removeAt( index );
|
||||
}
|
||||
|
|
|
@ -395,7 +395,8 @@ abstract public class THash implements Externalizable {
|
|||
}
|
||||
|
||||
|
||||
public void writeExternal( ObjectOutput out ) throws IOException {
|
||||
@Override
|
||||
public void writeExternal( ObjectOutput out ) throws IOException {
|
||||
// VERSION
|
||||
out.writeByte( 0 );
|
||||
|
||||
|
@ -407,7 +408,8 @@ abstract public class THash implements Externalizable {
|
|||
}
|
||||
|
||||
|
||||
public void readExternal( ObjectInput in )
|
||||
@Override
|
||||
public void readExternal( ObjectInput in )
|
||||
throws IOException, ClassNotFoundException {
|
||||
|
||||
// VERSION
|
||||
|
|
|
@ -87,7 +87,8 @@ public abstract class THashIterator<V> implements TIterator, Iterator<V> {
|
|||
* @throws NoSuchElementException if this is called on an
|
||||
* exhausted iterator.
|
||||
*/
|
||||
public V next() {
|
||||
@Override
|
||||
public V next() {
|
||||
moveToNextIndex();
|
||||
return objectAtIndex( _index );
|
||||
}
|
||||
|
@ -99,7 +100,8 @@ public abstract class THashIterator<V> implements TIterator, Iterator<V> {
|
|||
*
|
||||
* @return a <code>boolean</code> value
|
||||
*/
|
||||
public boolean hasNext() {
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return nextIndex() >= 0;
|
||||
}
|
||||
|
||||
|
@ -110,7 +112,8 @@ public abstract class THashIterator<V> implements TIterator, Iterator<V> {
|
|||
* will leave the underlying data structure in a confused
|
||||
* state.
|
||||
*/
|
||||
public void remove() {
|
||||
@Override
|
||||
public void remove() {
|
||||
if ( _expectedSize != _hash.size() ) {
|
||||
throw new ConcurrentModificationException();
|
||||
}
|
||||
|
|
|
@ -98,7 +98,8 @@ public abstract class THashPrimitiveIterator implements TPrimitiveIterator {
|
|||
*
|
||||
* @return a <code>boolean</code> value
|
||||
*/
|
||||
public boolean hasNext() {
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return nextIndex() >= 0;
|
||||
}
|
||||
|
||||
|
@ -109,7 +110,8 @@ public abstract class THashPrimitiveIterator implements TPrimitiveIterator {
|
|||
* will leave the underlying data structure in a confused
|
||||
* state.
|
||||
*/
|
||||
public void remove() {
|
||||
@Override
|
||||
public void remove() {
|
||||
if (_expectedSize != _hash.size()) {
|
||||
throw new ConcurrentModificationException();
|
||||
}
|
||||
|
|
|
@ -157,7 +157,8 @@ abstract public class TIntByteHash extends TPrimitiveHash {
|
|||
* @param initialCapacity an <code>int</code> value
|
||||
* @return the actual capacity chosen
|
||||
*/
|
||||
protected int setUp( int initialCapacity ) {
|
||||
@Override
|
||||
protected int setUp( int initialCapacity ) {
|
||||
int capacity;
|
||||
|
||||
capacity = super.setUp( initialCapacity );
|
||||
|
@ -201,7 +202,8 @@ abstract public class TIntByteHash extends TPrimitiveHash {
|
|||
*
|
||||
* @param index an <code>int</code> value
|
||||
*/
|
||||
protected void removeAt( int index ) {
|
||||
@Override
|
||||
protected void removeAt( int index ) {
|
||||
_set[index] = no_entry_key;
|
||||
super.removeAt( index );
|
||||
}
|
||||
|
@ -309,7 +311,8 @@ abstract public class TIntByteHash extends TPrimitiveHash {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void writeExternal( ObjectOutput out ) throws IOException {
|
||||
@Override
|
||||
public void writeExternal( ObjectOutput out ) throws IOException {
|
||||
// VERSION
|
||||
out.writeByte( 0 );
|
||||
|
||||
|
@ -325,7 +328,8 @@ abstract public class TIntByteHash extends TPrimitiveHash {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void readExternal( ObjectInput in ) throws IOException, ClassNotFoundException {
|
||||
@Override
|
||||
public void readExternal( ObjectInput in ) throws IOException, ClassNotFoundException {
|
||||
// VERSION
|
||||
in.readByte();
|
||||
|
||||
|
|
|
@ -141,7 +141,8 @@ abstract public class TIntHash extends TPrimitiveHash {
|
|||
* @param initialCapacity an <code>int</code> value
|
||||
* @return the actual capacity chosen
|
||||
*/
|
||||
protected int setUp( int initialCapacity ) {
|
||||
@Override
|
||||
protected int setUp( int initialCapacity ) {
|
||||
int capacity;
|
||||
|
||||
capacity = super.setUp( initialCapacity );
|
||||
|
@ -185,7 +186,8 @@ abstract public class TIntHash extends TPrimitiveHash {
|
|||
*
|
||||
* @param index an <code>int</code> value
|
||||
*/
|
||||
protected void removeAt( int index ) {
|
||||
@Override
|
||||
protected void removeAt( int index ) {
|
||||
_set[index] = no_entry_value;
|
||||
super.removeAt( index );
|
||||
}
|
||||
|
|
|
@ -157,7 +157,8 @@ abstract public class TIntLongHash extends TPrimitiveHash {
|
|||
* @param initialCapacity an <code>int</code> value
|
||||
* @return the actual capacity chosen
|
||||
*/
|
||||
protected int setUp( int initialCapacity ) {
|
||||
@Override
|
||||
protected int setUp( int initialCapacity ) {
|
||||
int capacity;
|
||||
|
||||
capacity = super.setUp( initialCapacity );
|
||||
|
@ -201,7 +202,8 @@ abstract public class TIntLongHash extends TPrimitiveHash {
|
|||
*
|
||||
* @param index an <code>int</code> value
|
||||
*/
|
||||
protected void removeAt( int index ) {
|
||||
@Override
|
||||
protected void removeAt( int index ) {
|
||||
_set[index] = no_entry_key;
|
||||
super.removeAt( index );
|
||||
}
|
||||
|
@ -309,7 +311,8 @@ abstract public class TIntLongHash extends TPrimitiveHash {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void writeExternal( ObjectOutput out ) throws IOException {
|
||||
@Override
|
||||
public void writeExternal( ObjectOutput out ) throws IOException {
|
||||
// VERSION
|
||||
out.writeByte( 0 );
|
||||
|
||||
|
@ -325,7 +328,8 @@ abstract public class TIntLongHash extends TPrimitiveHash {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void readExternal( ObjectInput in ) throws IOException, ClassNotFoundException {
|
||||
@Override
|
||||
public void readExternal( ObjectInput in ) throws IOException, ClassNotFoundException {
|
||||
// VERSION
|
||||
in.readByte();
|
||||
|
||||
|
|
|
@ -141,7 +141,8 @@ abstract public class TLongHash extends TPrimitiveHash {
|
|||
* @param initialCapacity an <code>int</code> value
|
||||
* @return the actual capacity chosen
|
||||
*/
|
||||
protected int setUp( int initialCapacity ) {
|
||||
@Override
|
||||
protected int setUp( int initialCapacity ) {
|
||||
int capacity;
|
||||
|
||||
capacity = super.setUp( initialCapacity );
|
||||
|
@ -185,7 +186,8 @@ abstract public class TLongHash extends TPrimitiveHash {
|
|||
*
|
||||
* @param index an <code>int</code> value
|
||||
*/
|
||||
protected void removeAt( int index ) {
|
||||
@Override
|
||||
protected void removeAt( int index ) {
|
||||
_set[index] = no_entry_value;
|
||||
super.removeAt( index );
|
||||
}
|
||||
|
|
|
@ -85,12 +85,14 @@ abstract public class TObjectHash<T> extends THash {
|
|||
}
|
||||
|
||||
|
||||
public int capacity() {
|
||||
@Override
|
||||
public int capacity() {
|
||||
return _set.length;
|
||||
}
|
||||
|
||||
|
||||
protected void removeAt( int index ) {
|
||||
@Override
|
||||
protected void removeAt( int index ) {
|
||||
_set[index] = REMOVED;
|
||||
super.removeAt( index );
|
||||
}
|
||||
|
@ -102,7 +104,8 @@ abstract public class TObjectHash<T> extends THash {
|
|||
* @param initialCapacity an <code>int</code> value
|
||||
* @return an <code>int</code> value
|
||||
*/
|
||||
public int setUp( int initialCapacity ) {
|
||||
@Override
|
||||
public int setUp( int initialCapacity ) {
|
||||
int capacity;
|
||||
|
||||
capacity = super.setUp( initialCapacity );
|
||||
|
|
|
@ -102,7 +102,8 @@ abstract public class TPrimitiveHash extends THash {
|
|||
*
|
||||
* @return the physical capacity of the hash table.
|
||||
*/
|
||||
public int capacity() {
|
||||
@Override
|
||||
public int capacity() {
|
||||
return _states.length;
|
||||
}
|
||||
|
||||
|
@ -112,7 +113,8 @@ abstract public class TPrimitiveHash extends THash {
|
|||
*
|
||||
* @param index an <code>int</code> value
|
||||
*/
|
||||
protected void removeAt( int index ) {
|
||||
@Override
|
||||
protected void removeAt( int index ) {
|
||||
_states[index] = REMOVED;
|
||||
super.removeAt( index );
|
||||
}
|
||||
|
@ -125,7 +127,8 @@ abstract public class TPrimitiveHash extends THash {
|
|||
* @param initialCapacity an <code>int</code> value
|
||||
* @return the actual capacity chosen
|
||||
*/
|
||||
protected int setUp( int initialCapacity ) {
|
||||
@Override
|
||||
protected int setUp( int initialCapacity ) {
|
||||
int capacity;
|
||||
|
||||
capacity = super.setUp( initialCapacity );
|
||||
|
|
|
@ -47,7 +47,8 @@ public interface TPrimitiveIterator extends TIterator {
|
|||
*
|
||||
* @return a <code>boolean</code> value
|
||||
*/
|
||||
public boolean hasNext();
|
||||
@Override
|
||||
public boolean hasNext();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -56,6 +57,7 @@ public interface TPrimitiveIterator extends TIterator {
|
|||
* will leave the underlying data structure in a confused
|
||||
* state.
|
||||
*/
|
||||
public void remove();
|
||||
@Override
|
||||
public void remove();
|
||||
|
||||
} // TPrimitiveIterator
|
||||
|
|
|
@ -45,7 +45,8 @@ public interface TIntList extends TIntCollection, Serializable {
|
|||
*
|
||||
* @return the value that represents null
|
||||
*/
|
||||
public int getNoEntryValue();
|
||||
@Override
|
||||
public int getNoEntryValue();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -53,7 +54,8 @@ public interface TIntList extends TIntCollection, Serializable {
|
|||
*
|
||||
* @return the number of values in the list.
|
||||
*/
|
||||
public int size();
|
||||
@Override
|
||||
public int size();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -61,7 +63,8 @@ public interface TIntList extends TIntCollection, Serializable {
|
|||
*
|
||||
* @return true if the list is empty.
|
||||
*/
|
||||
public boolean isEmpty();
|
||||
@Override
|
||||
public boolean isEmpty();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -70,7 +73,8 @@ public interface TIntList extends TIntCollection, Serializable {
|
|||
* @param val an <code>int</code> value
|
||||
* @return true if the list was modified by the add operation
|
||||
*/
|
||||
public boolean add(int val);
|
||||
@Override
|
||||
public boolean add(int val);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -187,7 +191,8 @@ public interface TIntList extends TIntCollection, Serializable {
|
|||
* Flushes the internal state of the list, resetting the capacity
|
||||
* to the default.
|
||||
*/
|
||||
public void clear();
|
||||
@Override
|
||||
public void clear();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -196,7 +201,8 @@ public interface TIntList extends TIntCollection, Serializable {
|
|||
* @param value an <code>int</code> value
|
||||
* @return true if the list was modified by the remove operation.
|
||||
*/
|
||||
public boolean remove( int value );
|
||||
@Override
|
||||
public boolean remove( int value );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -268,7 +274,8 @@ public interface TIntList extends TIntCollection, Serializable {
|
|||
*
|
||||
* @return an <code>int[]</code> value
|
||||
*/
|
||||
public int[] toArray();
|
||||
@Override
|
||||
public int[] toArray();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -298,7 +305,8 @@ public interface TIntList extends TIntCollection, Serializable {
|
|||
* @param dest the array to copy into.
|
||||
* @return the array passed in.
|
||||
*/
|
||||
public int[] toArray( int[] dest );
|
||||
@Override
|
||||
public int[] toArray( int[] dest );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -331,7 +339,8 @@ public interface TIntList extends TIntCollection, Serializable {
|
|||
* @param procedure a <code>TIntProcedure</code> value
|
||||
* @return true if the procedure did not terminate prematurely.
|
||||
*/
|
||||
public boolean forEach( TIntProcedure procedure );
|
||||
@Override
|
||||
public boolean forEach( TIntProcedure procedure );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -466,7 +475,8 @@ public interface TIntList extends TIntCollection, Serializable {
|
|||
* @param value an <code>int</code> value
|
||||
* @return true if value is in the list.
|
||||
*/
|
||||
public boolean contains( int value );
|
||||
@Override
|
||||
public boolean contains( int value );
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -45,7 +45,8 @@ public interface TLongList extends TLongCollection, Serializable {
|
|||
*
|
||||
* @return the value that represents null
|
||||
*/
|
||||
public long getNoEntryValue();
|
||||
@Override
|
||||
public long getNoEntryValue();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -53,7 +54,8 @@ public interface TLongList extends TLongCollection, Serializable {
|
|||
*
|
||||
* @return the number of values in the list.
|
||||
*/
|
||||
public int size();
|
||||
@Override
|
||||
public int size();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -61,7 +63,8 @@ public interface TLongList extends TLongCollection, Serializable {
|
|||
*
|
||||
* @return true if the list is empty.
|
||||
*/
|
||||
public boolean isEmpty();
|
||||
@Override
|
||||
public boolean isEmpty();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -70,7 +73,8 @@ public interface TLongList extends TLongCollection, Serializable {
|
|||
* @param val an <code>long</code> value
|
||||
* @return true if the list was modified by the add operation
|
||||
*/
|
||||
public boolean add(long val);
|
||||
@Override
|
||||
public boolean add(long val);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -187,7 +191,8 @@ public interface TLongList extends TLongCollection, Serializable {
|
|||
* Flushes the internal state of the list, resetting the capacity
|
||||
* to the default.
|
||||
*/
|
||||
public void clear();
|
||||
@Override
|
||||
public void clear();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -196,7 +201,8 @@ public interface TLongList extends TLongCollection, Serializable {
|
|||
* @param value an <code>long</code> value
|
||||
* @return true if the list was modified by the remove operation.
|
||||
*/
|
||||
public boolean remove( long value );
|
||||
@Override
|
||||
public boolean remove( long value );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -268,7 +274,8 @@ public interface TLongList extends TLongCollection, Serializable {
|
|||
*
|
||||
* @return an <code>long[]</code> value
|
||||
*/
|
||||
public long[] toArray();
|
||||
@Override
|
||||
public long[] toArray();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -298,7 +305,8 @@ public interface TLongList extends TLongCollection, Serializable {
|
|||
* @param dest the array to copy into.
|
||||
* @return the array passed in.
|
||||
*/
|
||||
public long[] toArray( long[] dest );
|
||||
@Override
|
||||
public long[] toArray( long[] dest );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -331,7 +339,8 @@ public interface TLongList extends TLongCollection, Serializable {
|
|||
* @param procedure a <code>TLongProcedure</code> value
|
||||
* @return true if the procedure did not terminate prematurely.
|
||||
*/
|
||||
public boolean forEach( TLongProcedure procedure );
|
||||
@Override
|
||||
public boolean forEach( TLongProcedure procedure );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -466,7 +475,8 @@ public interface TLongList extends TLongCollection, Serializable {
|
|||
* @param value an <code>long</code> value
|
||||
* @return true if value is in the list.
|
||||
*/
|
||||
public boolean contains( long value );
|
||||
@Override
|
||||
public boolean contains( long value );
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -119,7 +119,8 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int getNoEntryValue() {
|
||||
@Override
|
||||
public int getNoEntryValue() {
|
||||
return no_entry_value;
|
||||
}
|
||||
|
||||
|
@ -142,13 +143,15 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int size() {
|
||||
@Override
|
||||
public int size() {
|
||||
return _pos;
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean isEmpty() {
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return _pos == 0;
|
||||
}
|
||||
|
||||
|
@ -168,7 +171,8 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
// modifying
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean add( int val ) {
|
||||
@Override
|
||||
public boolean add( int val ) {
|
||||
ensureCapacity( _pos + 1 );
|
||||
_data[ _pos++ ] = val;
|
||||
return true;
|
||||
|
@ -176,13 +180,15 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void add( int[] vals ) {
|
||||
@Override
|
||||
public void add( int[] vals ) {
|
||||
add( vals, 0, vals.length );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void add( int[] vals, int offset, int length ) {
|
||||
@Override
|
||||
public void add( int[] vals, int offset, int length ) {
|
||||
ensureCapacity( _pos + length );
|
||||
System.arraycopy( vals, offset, _data, _pos, length );
|
||||
_pos += length;
|
||||
|
@ -190,7 +196,8 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void insert( int offset, int value ) {
|
||||
@Override
|
||||
public void insert( int offset, int value ) {
|
||||
if ( offset == _pos ) {
|
||||
add( value );
|
||||
return;
|
||||
|
@ -205,13 +212,15 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void insert( int offset, int[] values ) {
|
||||
@Override
|
||||
public void insert( int offset, int[] values ) {
|
||||
insert( offset, values, 0, values.length );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void insert( int offset, int[] values, int valOffset, int len ) {
|
||||
@Override
|
||||
public void insert( int offset, int[] values, int valOffset, int len ) {
|
||||
if ( offset == _pos ) {
|
||||
add( values, valOffset, len );
|
||||
return;
|
||||
|
@ -227,7 +236,8 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int get( int offset ) {
|
||||
@Override
|
||||
public int get( int offset ) {
|
||||
if ( offset >= _pos ) {
|
||||
throw new ArrayIndexOutOfBoundsException( offset );
|
||||
}
|
||||
|
@ -244,7 +254,8 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int set( int offset, int val ) {
|
||||
@Override
|
||||
public int set( int offset, int val ) {
|
||||
if ( offset >= _pos ) {
|
||||
throw new ArrayIndexOutOfBoundsException( offset );
|
||||
}
|
||||
|
@ -256,7 +267,8 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int replace( int offset, int val ) {
|
||||
@Override
|
||||
public int replace( int offset, int val ) {
|
||||
if ( offset >= _pos ) {
|
||||
throw new ArrayIndexOutOfBoundsException( offset );
|
||||
}
|
||||
|
@ -267,13 +279,15 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void set( int offset, int[] values ) {
|
||||
@Override
|
||||
public void set( int offset, int[] values ) {
|
||||
set( offset, values, 0, values.length );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void set( int offset, int[] values, int valOffset, int length ) {
|
||||
@Override
|
||||
public void set( int offset, int[] values, int valOffset, int length ) {
|
||||
if ( offset < 0 || offset + length > _pos ) {
|
||||
throw new ArrayIndexOutOfBoundsException( offset );
|
||||
}
|
||||
|
@ -290,7 +304,8 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void clear() {
|
||||
@Override
|
||||
public void clear() {
|
||||
clear( DEFAULT_CAPACITY );
|
||||
}
|
||||
|
||||
|
@ -330,7 +345,8 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean remove( int value ) {
|
||||
@Override
|
||||
public boolean remove( int value ) {
|
||||
for ( int index = 0; index < _pos; index++ ) {
|
||||
if ( value == _data[index] ) {
|
||||
remove( index, 1 );
|
||||
|
@ -342,7 +358,8 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int removeAt( int offset ) {
|
||||
@Override
|
||||
public int removeAt( int offset ) {
|
||||
int old = get( offset );
|
||||
remove( offset, 1 );
|
||||
return old;
|
||||
|
@ -350,7 +367,8 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void remove( int offset, int length ) {
|
||||
@Override
|
||||
public void remove( int offset, int length ) {
|
||||
if ( offset < 0 || offset >= _pos ) {
|
||||
throw new ArrayIndexOutOfBoundsException(offset);
|
||||
}
|
||||
|
@ -376,13 +394,15 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public TIntIterator iterator() {
|
||||
@Override
|
||||
public TIntIterator iterator() {
|
||||
return new TIntArrayIterator( 0 );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsAll( Collection<?> collection ) {
|
||||
@Override
|
||||
public boolean containsAll( Collection<?> collection ) {
|
||||
for ( Object element : collection ) {
|
||||
if ( element instanceof Integer ) {
|
||||
int c = ( ( Integer ) element ).intValue();
|
||||
|
@ -399,7 +419,8 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsAll( TIntCollection collection ) {
|
||||
@Override
|
||||
public boolean containsAll( TIntCollection collection ) {
|
||||
if ( this == collection ) {
|
||||
return true;
|
||||
}
|
||||
|
@ -415,7 +436,8 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsAll( int[] array ) {
|
||||
@Override
|
||||
public boolean containsAll( int[] array ) {
|
||||
for ( int i = array.length; i-- > 0; ) {
|
||||
if ( ! contains( array[i] ) ) {
|
||||
return false;
|
||||
|
@ -426,7 +448,8 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean addAll( Collection<? extends Integer> collection ) {
|
||||
@Override
|
||||
public boolean addAll( Collection<? extends Integer> collection ) {
|
||||
boolean changed = false;
|
||||
for ( Integer element : collection ) {
|
||||
int e = element.intValue();
|
||||
|
@ -439,7 +462,8 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean addAll( TIntCollection collection ) {
|
||||
@Override
|
||||
public boolean addAll( TIntCollection collection ) {
|
||||
boolean changed = false;
|
||||
TIntIterator iter = collection.iterator();
|
||||
while ( iter.hasNext() ) {
|
||||
|
@ -453,7 +477,8 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean addAll( int[] array ) {
|
||||
@Override
|
||||
public boolean addAll( int[] array ) {
|
||||
boolean changed = false;
|
||||
for ( int element : array ) {
|
||||
if ( add( element ) ) {
|
||||
|
@ -465,7 +490,8 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@SuppressWarnings({"SuspiciousMethodCalls"})
|
||||
@Override
|
||||
@SuppressWarnings({"SuspiciousMethodCalls"})
|
||||
public boolean retainAll( Collection<?> collection ) {
|
||||
boolean modified = false;
|
||||
TIntIterator iter = iterator();
|
||||
|
@ -480,7 +506,8 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean retainAll( TIntCollection collection ) {
|
||||
@Override
|
||||
public boolean retainAll( TIntCollection collection ) {
|
||||
if ( this == collection ) {
|
||||
return false;
|
||||
}
|
||||
|
@ -497,7 +524,8 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean retainAll( int[] array ) {
|
||||
@Override
|
||||
public boolean retainAll( int[] array ) {
|
||||
boolean changed = false;
|
||||
Arrays.sort( array );
|
||||
int[] data = _data;
|
||||
|
@ -513,7 +541,8 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean removeAll( Collection<?> collection ) {
|
||||
@Override
|
||||
public boolean removeAll( Collection<?> collection ) {
|
||||
boolean changed = false;
|
||||
for ( Object element : collection ) {
|
||||
if ( element instanceof Integer ) {
|
||||
|
@ -528,7 +557,8 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean removeAll( TIntCollection collection ) {
|
||||
@Override
|
||||
public boolean removeAll( TIntCollection collection ) {
|
||||
if ( collection == this ) {
|
||||
clear();
|
||||
return true;
|
||||
|
@ -546,7 +576,8 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean removeAll( int[] array ) {
|
||||
@Override
|
||||
public boolean removeAll( int[] array ) {
|
||||
boolean changed = false;
|
||||
for ( int i = array.length; i-- > 0; ) {
|
||||
if ( remove(array[i]) ) {
|
||||
|
@ -558,7 +589,8 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void transformValues( TIntFunction function ) {
|
||||
@Override
|
||||
public void transformValues( TIntFunction function ) {
|
||||
for ( int i = _pos; i-- > 0; ) {
|
||||
_data[ i ] = function.execute( _data[ i ] );
|
||||
}
|
||||
|
@ -566,13 +598,15 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void reverse() {
|
||||
@Override
|
||||
public void reverse() {
|
||||
reverse( 0, _pos );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void reverse( int from, int to ) {
|
||||
@Override
|
||||
public void reverse( int from, int to ) {
|
||||
if ( from == to ) {
|
||||
return; // nothing to do
|
||||
}
|
||||
|
@ -586,7 +620,8 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void shuffle( Random rand ) {
|
||||
@Override
|
||||
public void shuffle( Random rand ) {
|
||||
for ( int i = _pos; i-- > 1; ) {
|
||||
swap( i, rand.nextInt( i ) );
|
||||
}
|
||||
|
@ -609,7 +644,8 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
// copying
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public TIntList subList( int begin, int end ) {
|
||||
@Override
|
||||
public TIntList subList( int begin, int end ) {
|
||||
if ( end < begin ) {
|
||||
throw new IllegalArgumentException( "end index " + end +
|
||||
" greater than begin index " + begin );
|
||||
|
@ -629,13 +665,15 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int[] toArray() {
|
||||
@Override
|
||||
public int[] toArray() {
|
||||
return toArray( 0, _pos );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int[] toArray( int offset, int len ) {
|
||||
@Override
|
||||
public int[] toArray( int offset, int len ) {
|
||||
int[] rv = new int[ len ];
|
||||
toArray( rv, offset, len );
|
||||
return rv;
|
||||
|
@ -643,7 +681,8 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int[] toArray( int[] dest ) {
|
||||
@Override
|
||||
public int[] toArray( int[] dest ) {
|
||||
int len = dest.length;
|
||||
if ( dest.length > _pos ) {
|
||||
len = _pos;
|
||||
|
@ -655,7 +694,8 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int[] toArray( int[] dest, int offset, int len ) {
|
||||
@Override
|
||||
public int[] toArray( int[] dest, int offset, int len ) {
|
||||
if ( len == 0 ) {
|
||||
return dest; // nothing to copy
|
||||
}
|
||||
|
@ -668,7 +708,8 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int[] toArray( int[] dest, int source_pos, int dest_pos, int len ) {
|
||||
@Override
|
||||
public int[] toArray( int[] dest, int source_pos, int dest_pos, int len ) {
|
||||
if ( len == 0 ) {
|
||||
return dest; // nothing to copy
|
||||
}
|
||||
|
@ -718,7 +759,8 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
// procedures
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean forEach( TIntProcedure procedure ) {
|
||||
@Override
|
||||
public boolean forEach( TIntProcedure procedure ) {
|
||||
for ( int i = 0; i < _pos; i++ ) {
|
||||
if ( !procedure.execute( _data[ i ] ) ) {
|
||||
return false;
|
||||
|
@ -729,7 +771,8 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean forEachDescending( TIntProcedure procedure ) {
|
||||
@Override
|
||||
public boolean forEachDescending( TIntProcedure procedure ) {
|
||||
for ( int i = _pos; i-- > 0; ) {
|
||||
if ( !procedure.execute( _data[ i ] ) ) {
|
||||
return false;
|
||||
|
@ -742,13 +785,15 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
// sorting
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void sort() {
|
||||
@Override
|
||||
public void sort() {
|
||||
Arrays.sort( _data, 0, _pos );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void sort( int fromIndex, int toIndex ) {
|
||||
@Override
|
||||
public void sort( int fromIndex, int toIndex ) {
|
||||
Arrays.sort( _data, fromIndex, toIndex );
|
||||
}
|
||||
|
||||
|
@ -756,13 +801,15 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
// filling
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void fill( int val ) {
|
||||
@Override
|
||||
public void fill( int val ) {
|
||||
Arrays.fill( _data, 0, _pos, val );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void fill( int fromIndex, int toIndex, int val ) {
|
||||
@Override
|
||||
public void fill( int fromIndex, int toIndex, int val ) {
|
||||
if ( toIndex > _pos ) {
|
||||
ensureCapacity( toIndex );
|
||||
_pos = toIndex;
|
||||
|
@ -774,13 +821,15 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
// searching
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int binarySearch( int value ) {
|
||||
@Override
|
||||
public int binarySearch( int value ) {
|
||||
return binarySearch( value, 0, _pos );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int binarySearch(int value, int fromIndex, int toIndex) {
|
||||
@Override
|
||||
public int binarySearch(int value, int fromIndex, int toIndex) {
|
||||
if ( fromIndex < 0 ) {
|
||||
throw new ArrayIndexOutOfBoundsException( fromIndex );
|
||||
}
|
||||
|
@ -810,13 +859,15 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int indexOf( int value ) {
|
||||
@Override
|
||||
public int indexOf( int value ) {
|
||||
return indexOf( 0, value );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int indexOf( int offset, int value ) {
|
||||
@Override
|
||||
public int indexOf( int offset, int value ) {
|
||||
for ( int i = offset; i < _pos; i++ ) {
|
||||
if ( _data[ i ] == value ) {
|
||||
return i;
|
||||
|
@ -827,13 +878,15 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int lastIndexOf( int value ) {
|
||||
@Override
|
||||
public int lastIndexOf( int value ) {
|
||||
return lastIndexOf( _pos, value );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int lastIndexOf( int offset, int value ) {
|
||||
@Override
|
||||
public int lastIndexOf( int offset, int value ) {
|
||||
for ( int i = offset; i-- > 0; ) {
|
||||
if ( _data[ i ] == value ) {
|
||||
return i;
|
||||
|
@ -844,13 +897,15 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean contains( int value ) {
|
||||
@Override
|
||||
public boolean contains( int value ) {
|
||||
return lastIndexOf( value ) >= 0;
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public TIntList grep( TIntProcedure condition ) {
|
||||
@Override
|
||||
public TIntList grep( TIntProcedure condition ) {
|
||||
TIntArrayList list = new TIntArrayList();
|
||||
for ( int i = 0; i < _pos; i++ ) {
|
||||
if ( condition.execute( _data[ i ] ) ) {
|
||||
|
@ -862,7 +917,8 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public TIntList inverseGrep( TIntProcedure condition ) {
|
||||
@Override
|
||||
public TIntList inverseGrep( TIntProcedure condition ) {
|
||||
TIntArrayList list = new TIntArrayList();
|
||||
for ( int i = 0; i < _pos; i++ ) {
|
||||
if ( !condition.execute( _data[ i ] ) ) {
|
||||
|
@ -874,7 +930,8 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int max() {
|
||||
@Override
|
||||
public int max() {
|
||||
if ( size() == 0 ) {
|
||||
throw new IllegalStateException("cannot find maximum of an empty list");
|
||||
}
|
||||
|
@ -889,7 +946,8 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int min() {
|
||||
@Override
|
||||
public int min() {
|
||||
if ( size() == 0 ) {
|
||||
throw new IllegalStateException( "cannot find minimum of an empty list" );
|
||||
}
|
||||
|
@ -941,13 +999,15 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean hasNext() {
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return cursor < size();
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int next() {
|
||||
@Override
|
||||
public int next() {
|
||||
try {
|
||||
int next = get( cursor );
|
||||
lastRet = cursor++;
|
||||
|
@ -959,7 +1019,8 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void remove() {
|
||||
@Override
|
||||
public void remove() {
|
||||
if ( lastRet == -1 )
|
||||
throw new IllegalStateException();
|
||||
|
||||
|
@ -975,7 +1036,8 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
}
|
||||
|
||||
|
||||
public void writeExternal( ObjectOutput out ) throws IOException {
|
||||
@Override
|
||||
public void writeExternal( ObjectOutput out ) throws IOException {
|
||||
// VERSION
|
||||
out.writeByte( 0 );
|
||||
|
||||
|
@ -994,7 +1056,8 @@ public class TIntArrayList implements TIntList, Externalizable {
|
|||
}
|
||||
|
||||
|
||||
public void readExternal( ObjectInput in )
|
||||
@Override
|
||||
public void readExternal( ObjectInput in )
|
||||
throws IOException, ClassNotFoundException {
|
||||
|
||||
// VERSION
|
||||
|
|
|
@ -119,7 +119,8 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public long getNoEntryValue() {
|
||||
@Override
|
||||
public long getNoEntryValue() {
|
||||
return no_entry_value;
|
||||
}
|
||||
|
||||
|
@ -142,13 +143,15 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int size() {
|
||||
@Override
|
||||
public int size() {
|
||||
return _pos;
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean isEmpty() {
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return _pos == 0;
|
||||
}
|
||||
|
||||
|
@ -168,7 +171,8 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
// modifying
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean add( long val ) {
|
||||
@Override
|
||||
public boolean add( long val ) {
|
||||
ensureCapacity( _pos + 1 );
|
||||
_data[ _pos++ ] = val;
|
||||
return true;
|
||||
|
@ -176,13 +180,15 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void add( long[] vals ) {
|
||||
@Override
|
||||
public void add( long[] vals ) {
|
||||
add( vals, 0, vals.length );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void add( long[] vals, int offset, int length ) {
|
||||
@Override
|
||||
public void add( long[] vals, int offset, int length ) {
|
||||
ensureCapacity( _pos + length );
|
||||
System.arraycopy( vals, offset, _data, _pos, length );
|
||||
_pos += length;
|
||||
|
@ -190,7 +196,8 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void insert( int offset, long value ) {
|
||||
@Override
|
||||
public void insert( int offset, long value ) {
|
||||
if ( offset == _pos ) {
|
||||
add( value );
|
||||
return;
|
||||
|
@ -205,13 +212,15 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void insert( int offset, long[] values ) {
|
||||
@Override
|
||||
public void insert( int offset, long[] values ) {
|
||||
insert( offset, values, 0, values.length );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void insert( int offset, long[] values, int valOffset, int len ) {
|
||||
@Override
|
||||
public void insert( int offset, long[] values, int valOffset, int len ) {
|
||||
if ( offset == _pos ) {
|
||||
add( values, valOffset, len );
|
||||
return;
|
||||
|
@ -227,7 +236,8 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public long get( int offset ) {
|
||||
@Override
|
||||
public long get( int offset ) {
|
||||
if ( offset >= _pos ) {
|
||||
throw new ArrayIndexOutOfBoundsException( offset );
|
||||
}
|
||||
|
@ -244,7 +254,8 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public long set( int offset, long val ) {
|
||||
@Override
|
||||
public long set( int offset, long val ) {
|
||||
if ( offset >= _pos ) {
|
||||
throw new ArrayIndexOutOfBoundsException( offset );
|
||||
}
|
||||
|
@ -256,7 +267,8 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public long replace( int offset, long val ) {
|
||||
@Override
|
||||
public long replace( int offset, long val ) {
|
||||
if ( offset >= _pos ) {
|
||||
throw new ArrayIndexOutOfBoundsException( offset );
|
||||
}
|
||||
|
@ -267,13 +279,15 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void set( int offset, long[] values ) {
|
||||
@Override
|
||||
public void set( int offset, long[] values ) {
|
||||
set( offset, values, 0, values.length );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void set( int offset, long[] values, int valOffset, int length ) {
|
||||
@Override
|
||||
public void set( int offset, long[] values, int valOffset, int length ) {
|
||||
if ( offset < 0 || offset + length > _pos ) {
|
||||
throw new ArrayIndexOutOfBoundsException( offset );
|
||||
}
|
||||
|
@ -290,7 +304,8 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void clear() {
|
||||
@Override
|
||||
public void clear() {
|
||||
clear( DEFAULT_CAPACITY );
|
||||
}
|
||||
|
||||
|
@ -330,7 +345,8 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean remove( long value ) {
|
||||
@Override
|
||||
public boolean remove( long value ) {
|
||||
for ( int index = 0; index < _pos; index++ ) {
|
||||
if ( value == _data[index] ) {
|
||||
remove( index, 1 );
|
||||
|
@ -342,7 +358,8 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public long removeAt( int offset ) {
|
||||
@Override
|
||||
public long removeAt( int offset ) {
|
||||
long old = get( offset );
|
||||
remove( offset, 1 );
|
||||
return old;
|
||||
|
@ -350,7 +367,8 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void remove( int offset, int length ) {
|
||||
@Override
|
||||
public void remove( int offset, int length ) {
|
||||
if ( offset < 0 || offset >= _pos ) {
|
||||
throw new ArrayIndexOutOfBoundsException(offset);
|
||||
}
|
||||
|
@ -376,13 +394,15 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public TLongIterator iterator() {
|
||||
@Override
|
||||
public TLongIterator iterator() {
|
||||
return new TLongArrayIterator( 0 );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsAll( Collection<?> collection ) {
|
||||
@Override
|
||||
public boolean containsAll( Collection<?> collection ) {
|
||||
for ( Object element : collection ) {
|
||||
if ( element instanceof Long ) {
|
||||
long c = ( ( Long ) element ).longValue();
|
||||
|
@ -399,7 +419,8 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsAll( TLongCollection collection ) {
|
||||
@Override
|
||||
public boolean containsAll( TLongCollection collection ) {
|
||||
if ( this == collection ) {
|
||||
return true;
|
||||
}
|
||||
|
@ -415,7 +436,8 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsAll( long[] array ) {
|
||||
@Override
|
||||
public boolean containsAll( long[] array ) {
|
||||
for ( int i = array.length; i-- > 0; ) {
|
||||
if ( ! contains( array[i] ) ) {
|
||||
return false;
|
||||
|
@ -426,7 +448,8 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean addAll( Collection<? extends Long> collection ) {
|
||||
@Override
|
||||
public boolean addAll( Collection<? extends Long> collection ) {
|
||||
boolean changed = false;
|
||||
for ( Long element : collection ) {
|
||||
long e = element.longValue();
|
||||
|
@ -439,7 +462,8 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean addAll( TLongCollection collection ) {
|
||||
@Override
|
||||
public boolean addAll( TLongCollection collection ) {
|
||||
boolean changed = false;
|
||||
TLongIterator iter = collection.iterator();
|
||||
while ( iter.hasNext() ) {
|
||||
|
@ -453,7 +477,8 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean addAll( long[] array ) {
|
||||
@Override
|
||||
public boolean addAll( long[] array ) {
|
||||
boolean changed = false;
|
||||
for ( long element : array ) {
|
||||
if ( add( element ) ) {
|
||||
|
@ -465,7 +490,8 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@SuppressWarnings({"SuspiciousMethodCalls"})
|
||||
@Override
|
||||
@SuppressWarnings({"SuspiciousMethodCalls"})
|
||||
public boolean retainAll( Collection<?> collection ) {
|
||||
boolean modified = false;
|
||||
TLongIterator iter = iterator();
|
||||
|
@ -480,7 +506,8 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean retainAll( TLongCollection collection ) {
|
||||
@Override
|
||||
public boolean retainAll( TLongCollection collection ) {
|
||||
if ( this == collection ) {
|
||||
return false;
|
||||
}
|
||||
|
@ -497,7 +524,8 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean retainAll( long[] array ) {
|
||||
@Override
|
||||
public boolean retainAll( long[] array ) {
|
||||
boolean changed = false;
|
||||
Arrays.sort( array );
|
||||
long[] data = _data;
|
||||
|
@ -513,7 +541,8 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean removeAll( Collection<?> collection ) {
|
||||
@Override
|
||||
public boolean removeAll( Collection<?> collection ) {
|
||||
boolean changed = false;
|
||||
for ( Object element : collection ) {
|
||||
if ( element instanceof Long ) {
|
||||
|
@ -528,7 +557,8 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean removeAll( TLongCollection collection ) {
|
||||
@Override
|
||||
public boolean removeAll( TLongCollection collection ) {
|
||||
if ( collection == this ) {
|
||||
clear();
|
||||
return true;
|
||||
|
@ -546,7 +576,8 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean removeAll( long[] array ) {
|
||||
@Override
|
||||
public boolean removeAll( long[] array ) {
|
||||
boolean changed = false;
|
||||
for ( int i = array.length; i-- > 0; ) {
|
||||
if ( remove(array[i]) ) {
|
||||
|
@ -558,7 +589,8 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void transformValues( TLongFunction function ) {
|
||||
@Override
|
||||
public void transformValues( TLongFunction function ) {
|
||||
for ( int i = _pos; i-- > 0; ) {
|
||||
_data[ i ] = function.execute( _data[ i ] );
|
||||
}
|
||||
|
@ -566,13 +598,15 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void reverse() {
|
||||
@Override
|
||||
public void reverse() {
|
||||
reverse( 0, _pos );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void reverse( int from, int to ) {
|
||||
@Override
|
||||
public void reverse( int from, int to ) {
|
||||
if ( from == to ) {
|
||||
return; // nothing to do
|
||||
}
|
||||
|
@ -586,7 +620,8 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void shuffle( Random rand ) {
|
||||
@Override
|
||||
public void shuffle( Random rand ) {
|
||||
for ( int i = _pos; i-- > 1; ) {
|
||||
swap( i, rand.nextInt( i ) );
|
||||
}
|
||||
|
@ -609,7 +644,8 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
// copying
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public TLongList subList( int begin, int end ) {
|
||||
@Override
|
||||
public TLongList subList( int begin, int end ) {
|
||||
if ( end < begin ) {
|
||||
throw new IllegalArgumentException( "end index " + end +
|
||||
" greater than begin index " + begin );
|
||||
|
@ -629,13 +665,15 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public long[] toArray() {
|
||||
@Override
|
||||
public long[] toArray() {
|
||||
return toArray( 0, _pos );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public long[] toArray( int offset, int len ) {
|
||||
@Override
|
||||
public long[] toArray( int offset, int len ) {
|
||||
long[] rv = new long[ len ];
|
||||
toArray( rv, offset, len );
|
||||
return rv;
|
||||
|
@ -643,7 +681,8 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public long[] toArray( long[] dest ) {
|
||||
@Override
|
||||
public long[] toArray( long[] dest ) {
|
||||
int len = dest.length;
|
||||
if ( dest.length > _pos ) {
|
||||
len = _pos;
|
||||
|
@ -655,7 +694,8 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public long[] toArray( long[] dest, int offset, int len ) {
|
||||
@Override
|
||||
public long[] toArray( long[] dest, int offset, int len ) {
|
||||
if ( len == 0 ) {
|
||||
return dest; // nothing to copy
|
||||
}
|
||||
|
@ -668,7 +708,8 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public long[] toArray( long[] dest, int source_pos, int dest_pos, int len ) {
|
||||
@Override
|
||||
public long[] toArray( long[] dest, int source_pos, int dest_pos, int len ) {
|
||||
if ( len == 0 ) {
|
||||
return dest; // nothing to copy
|
||||
}
|
||||
|
@ -718,7 +759,8 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
// procedures
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean forEach( TLongProcedure procedure ) {
|
||||
@Override
|
||||
public boolean forEach( TLongProcedure procedure ) {
|
||||
for ( int i = 0; i < _pos; i++ ) {
|
||||
if ( !procedure.execute( _data[ i ] ) ) {
|
||||
return false;
|
||||
|
@ -729,7 +771,8 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean forEachDescending( TLongProcedure procedure ) {
|
||||
@Override
|
||||
public boolean forEachDescending( TLongProcedure procedure ) {
|
||||
for ( int i = _pos; i-- > 0; ) {
|
||||
if ( !procedure.execute( _data[ i ] ) ) {
|
||||
return false;
|
||||
|
@ -742,13 +785,15 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
// sorting
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void sort() {
|
||||
@Override
|
||||
public void sort() {
|
||||
Arrays.sort( _data, 0, _pos );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void sort( int fromIndex, int toIndex ) {
|
||||
@Override
|
||||
public void sort( int fromIndex, int toIndex ) {
|
||||
Arrays.sort( _data, fromIndex, toIndex );
|
||||
}
|
||||
|
||||
|
@ -756,13 +801,15 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
// filling
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void fill( long val ) {
|
||||
@Override
|
||||
public void fill( long val ) {
|
||||
Arrays.fill( _data, 0, _pos, val );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void fill( int fromIndex, int toIndex, long val ) {
|
||||
@Override
|
||||
public void fill( int fromIndex, int toIndex, long val ) {
|
||||
if ( toIndex > _pos ) {
|
||||
ensureCapacity( toIndex );
|
||||
_pos = toIndex;
|
||||
|
@ -774,13 +821,15 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
// searching
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int binarySearch( long value ) {
|
||||
@Override
|
||||
public int binarySearch( long value ) {
|
||||
return binarySearch( value, 0, _pos );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int binarySearch(long value, int fromIndex, int toIndex) {
|
||||
@Override
|
||||
public int binarySearch(long value, int fromIndex, int toIndex) {
|
||||
if ( fromIndex < 0 ) {
|
||||
throw new ArrayIndexOutOfBoundsException( fromIndex );
|
||||
}
|
||||
|
@ -810,13 +859,15 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int indexOf( long value ) {
|
||||
@Override
|
||||
public int indexOf( long value ) {
|
||||
return indexOf( 0, value );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int indexOf( int offset, long value ) {
|
||||
@Override
|
||||
public int indexOf( int offset, long value ) {
|
||||
for ( int i = offset; i < _pos; i++ ) {
|
||||
if ( _data[ i ] == value ) {
|
||||
return i;
|
||||
|
@ -827,13 +878,15 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int lastIndexOf( long value ) {
|
||||
@Override
|
||||
public int lastIndexOf( long value ) {
|
||||
return lastIndexOf( _pos, value );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int lastIndexOf( int offset, long value ) {
|
||||
@Override
|
||||
public int lastIndexOf( int offset, long value ) {
|
||||
for ( int i = offset; i-- > 0; ) {
|
||||
if ( _data[ i ] == value ) {
|
||||
return i;
|
||||
|
@ -844,13 +897,15 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean contains( long value ) {
|
||||
@Override
|
||||
public boolean contains( long value ) {
|
||||
return lastIndexOf( value ) >= 0;
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public TLongList grep( TLongProcedure condition ) {
|
||||
@Override
|
||||
public TLongList grep( TLongProcedure condition ) {
|
||||
TLongArrayList list = new TLongArrayList();
|
||||
for ( int i = 0; i < _pos; i++ ) {
|
||||
if ( condition.execute( _data[ i ] ) ) {
|
||||
|
@ -862,7 +917,8 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public TLongList inverseGrep( TLongProcedure condition ) {
|
||||
@Override
|
||||
public TLongList inverseGrep( TLongProcedure condition ) {
|
||||
TLongArrayList list = new TLongArrayList();
|
||||
for ( int i = 0; i < _pos; i++ ) {
|
||||
if ( !condition.execute( _data[ i ] ) ) {
|
||||
|
@ -874,7 +930,8 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public long max() {
|
||||
@Override
|
||||
public long max() {
|
||||
if ( size() == 0 ) {
|
||||
throw new IllegalStateException("cannot find maximum of an empty list");
|
||||
}
|
||||
|
@ -889,7 +946,8 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public long min() {
|
||||
@Override
|
||||
public long min() {
|
||||
if ( size() == 0 ) {
|
||||
throw new IllegalStateException( "cannot find minimum of an empty list" );
|
||||
}
|
||||
|
@ -941,13 +999,15 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean hasNext() {
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return cursor < size();
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public long next() {
|
||||
@Override
|
||||
public long next() {
|
||||
try {
|
||||
long next = get( cursor );
|
||||
lastRet = cursor++;
|
||||
|
@ -959,7 +1019,8 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void remove() {
|
||||
@Override
|
||||
public void remove() {
|
||||
if ( lastRet == -1 )
|
||||
throw new IllegalStateException();
|
||||
|
||||
|
@ -975,7 +1036,8 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
}
|
||||
|
||||
|
||||
public void writeExternal( ObjectOutput out ) throws IOException {
|
||||
@Override
|
||||
public void writeExternal( ObjectOutput out ) throws IOException {
|
||||
// VERSION
|
||||
out.writeByte( 0 );
|
||||
|
||||
|
@ -994,7 +1056,8 @@ public class TLongArrayList implements TLongList, Externalizable {
|
|||
}
|
||||
|
||||
|
||||
public void readExternal( ObjectInput in )
|
||||
@Override
|
||||
public void readExternal( ObjectInput in )
|
||||
throws IOException, ClassNotFoundException {
|
||||
|
||||
// VERSION
|
||||
|
|
|
@ -405,7 +405,8 @@ public interface TFloatObjectMap<V> {
|
|||
* @param o object to be compared for equality with this map
|
||||
* @return <tt>true</tt> if the specified object is equal to this map
|
||||
*/
|
||||
boolean equals( Object o );
|
||||
@Override
|
||||
boolean equals( Object o );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -421,5 +422,6 @@ public interface TFloatObjectMap<V> {
|
|||
* @see Object#equals(Object)
|
||||
* @see #equals(Object)
|
||||
*/
|
||||
int hashCode();
|
||||
@Override
|
||||
int hashCode();
|
||||
}
|
||||
|
|
|
@ -405,7 +405,8 @@ public interface TIntObjectMap<V> {
|
|||
* @param o object to be compared for equality with this map
|
||||
* @return <tt>true</tt> if the specified object is equal to this map
|
||||
*/
|
||||
boolean equals( Object o );
|
||||
@Override
|
||||
boolean equals( Object o );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -421,5 +422,6 @@ public interface TIntObjectMap<V> {
|
|||
* @see Object#equals(Object)
|
||||
* @see #equals(Object)
|
||||
*/
|
||||
int hashCode();
|
||||
@Override
|
||||
int hashCode();
|
||||
}
|
||||
|
|
|
@ -405,7 +405,8 @@ public interface TLongObjectMap<V> {
|
|||
* @param o object to be compared for equality with this map
|
||||
* @return <tt>true</tt> if the specified object is equal to this map
|
||||
*/
|
||||
boolean equals( Object o );
|
||||
@Override
|
||||
boolean equals( Object o );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -421,5 +422,6 @@ public interface TLongObjectMap<V> {
|
|||
* @see Object#equals(Object)
|
||||
* @see #equals(Object)
|
||||
*/
|
||||
int hashCode();
|
||||
@Override
|
||||
int hashCode();
|
||||
}
|
||||
|
|
|
@ -57,7 +57,8 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
static final long serialVersionUID = 1L;
|
||||
|
||||
private final TFloatObjectProcedure<V> PUT_ALL_PROC = new TFloatObjectProcedure<V>() {
|
||||
public boolean execute( float key, V value) {
|
||||
@Override
|
||||
public boolean execute( float key, V value) {
|
||||
put( key, value );
|
||||
return true;
|
||||
}
|
||||
|
@ -134,7 +135,8 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
protected int setUp( int initialCapacity ) {
|
||||
int capacity;
|
||||
|
||||
|
@ -145,7 +147,8 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
protected void rehash( int newCapacity ) {
|
||||
int oldCapacity = _set.length;
|
||||
|
||||
|
@ -172,19 +175,22 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
// Query Operations
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public float getNoEntryKey() {
|
||||
@Override
|
||||
public float getNoEntryKey() {
|
||||
return no_entry_key;
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsKey( float key ) {
|
||||
@Override
|
||||
public boolean containsKey( float key ) {
|
||||
return contains( key );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsValue( Object val ) {
|
||||
@Override
|
||||
public boolean containsValue( Object val ) {
|
||||
byte[] states = _states;
|
||||
V[] vals = _values;
|
||||
|
||||
|
@ -209,7 +215,8 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public V get( float key ) {
|
||||
@Override
|
||||
public V get( float key ) {
|
||||
int index = index( key );
|
||||
return index < 0 ? null : _values[index];
|
||||
}
|
||||
|
@ -218,14 +225,16 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
// Modification Operations
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public V put( float key, V value ) {
|
||||
@Override
|
||||
public V put( float key, V value ) {
|
||||
int index = insertionIndex( key );
|
||||
return doPut( key, value, index );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public V putIfAbsent( float key, V value ) {
|
||||
@Override
|
||||
public V putIfAbsent( float key, V value ) {
|
||||
int index = insertionIndex( key );
|
||||
if ( index < 0 )
|
||||
return _values[-index - 1];
|
||||
|
@ -256,7 +265,8 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public V remove( float key ) {
|
||||
@Override
|
||||
public V remove( float key ) {
|
||||
V prev = null;
|
||||
int index = index( key );
|
||||
if ( index >= 0 ) {
|
||||
|
@ -268,7 +278,8 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
protected void removeAt( int index ) {
|
||||
@Override
|
||||
protected void removeAt( int index ) {
|
||||
_values[index] = null;
|
||||
super.removeAt( index ); // clear key, state; adjust size
|
||||
}
|
||||
|
@ -277,7 +288,8 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
// Bulk Operations
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void putAll( Map<? extends Float, ? extends V> map ) {
|
||||
@Override
|
||||
public void putAll( Map<? extends Float, ? extends V> map ) {
|
||||
Set<? extends Map.Entry<? extends Float,? extends V>> set = map.entrySet();
|
||||
for ( Map.Entry<? extends Float,? extends V> entry : set ) {
|
||||
put( entry.getKey(), entry.getValue() );
|
||||
|
@ -286,13 +298,15 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void putAll( TFloatObjectMap<V> map ){
|
||||
@Override
|
||||
public void putAll( TFloatObjectMap<V> map ){
|
||||
map.forEachEntry( PUT_ALL_PROC );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void clear() {
|
||||
@Override
|
||||
public void clear() {
|
||||
super.clear();
|
||||
Arrays.fill( _set, 0, _set.length, no_entry_key );
|
||||
Arrays.fill( _states, 0, _states.length, FREE );
|
||||
|
@ -303,13 +317,15 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
// Views
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public TFloatSet keySet() {
|
||||
@Override
|
||||
public TFloatSet keySet() {
|
||||
return new KeyView();
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public float[] keys() {
|
||||
float[] keys = new float[size()];
|
||||
float[] k = _set;
|
||||
|
@ -325,7 +341,8 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public float[] keys( float[] dest ) {
|
||||
if ( dest.length < _size ) {
|
||||
dest = new float[_size];
|
||||
|
@ -344,13 +361,15 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public Collection<V> valueCollection() {
|
||||
@Override
|
||||
public Collection<V> valueCollection() {
|
||||
return new ValueView();
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public V[] values() {
|
||||
V[] vals = ( V[] ) new Object[size()];
|
||||
V[] v = _values;
|
||||
|
@ -366,7 +385,8 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public <T> T[] values( T[] dest ) {
|
||||
if ( dest.length < _size ) {
|
||||
dest = ( T[] ) java.lang.reflect.Array.newInstance(
|
||||
|
@ -386,19 +406,22 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public TFloatObjectIterator<V> iterator() {
|
||||
@Override
|
||||
public TFloatObjectIterator<V> iterator() {
|
||||
return new TFloatObjectHashIterator<V>( this );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean forEachKey( TFloatProcedure procedure ) {
|
||||
@Override
|
||||
public boolean forEachKey( TFloatProcedure procedure ) {
|
||||
return forEach( procedure );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean forEachValue( TObjectProcedure<V> procedure ) {
|
||||
@Override
|
||||
public boolean forEachValue( TObjectProcedure<V> procedure ) {
|
||||
byte[] states = _states;
|
||||
V[] values = _values;
|
||||
for ( int i = values.length; i-- > 0; ) {
|
||||
|
@ -411,7 +434,8 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public boolean forEachEntry( TFloatObjectProcedure<V> procedure ) {
|
||||
byte[] states = _states;
|
||||
float[] keys = _set;
|
||||
|
@ -426,7 +450,8 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public boolean retainEntries( TFloatObjectProcedure<V> procedure ) {
|
||||
boolean modified = false;
|
||||
byte[] states = _states;
|
||||
|
@ -452,7 +477,8 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void transformValues( TObjectFunction<V,V> function ) {
|
||||
@Override
|
||||
public void transformValues( TObjectFunction<V,V> function ) {
|
||||
byte[] states = _states;
|
||||
V[] values = _values;
|
||||
for ( int i = values.length; i-- > 0; ) {
|
||||
|
@ -466,7 +492,8 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
// Comparison and hashing
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean equals( Object other ) {
|
||||
@Override
|
||||
public boolean equals( Object other ) {
|
||||
if ( ! ( other instanceof TFloatObjectMap ) ) {
|
||||
return false;
|
||||
}
|
||||
|
@ -498,7 +525,8 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int hashCode() {
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hashcode = 0;
|
||||
V[] values = _values;
|
||||
byte[] states = _states;
|
||||
|
@ -515,52 +543,62 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
class KeyView implements TFloatSet {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public float getNoEntryValue() {
|
||||
@Override
|
||||
public float getNoEntryValue() {
|
||||
return no_entry_key;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int size() {
|
||||
@Override
|
||||
public int size() {
|
||||
return _size;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean isEmpty() {
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return _size == 0;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean contains( float entry ) {
|
||||
@Override
|
||||
public boolean contains( float entry ) {
|
||||
return TFloatObjectHashMap.this.containsKey( entry );
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public TFloatIterator iterator() {
|
||||
@Override
|
||||
public TFloatIterator iterator() {
|
||||
return new TFloatHashIterator( TFloatObjectHashMap.this );
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public float[] toArray() {
|
||||
@Override
|
||||
public float[] toArray() {
|
||||
return keys();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public float[] toArray( float[] dest ) {
|
||||
@Override
|
||||
public float[] toArray( float[] dest ) {
|
||||
return keys( dest );
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean add( float entry ) {
|
||||
@Override
|
||||
public boolean add( float entry ) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean remove( float entry ) {
|
||||
@Override
|
||||
public boolean remove( float entry ) {
|
||||
return null != TFloatObjectHashMap.this.remove( entry );
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsAll( Collection<?> collection ) {
|
||||
@Override
|
||||
public boolean containsAll( Collection<?> collection ) {
|
||||
for ( Object element : collection ) {
|
||||
if ( ! TFloatObjectHashMap.this.containsKey( ( ( Float ) element ).floatValue() ) ) {
|
||||
return false;
|
||||
|
@ -570,7 +608,8 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsAll( TFloatCollection collection ) {
|
||||
@Override
|
||||
public boolean containsAll( TFloatCollection collection ) {
|
||||
if ( collection == this ) {
|
||||
return true;
|
||||
}
|
||||
|
@ -584,7 +623,8 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsAll( float[] array ) {
|
||||
@Override
|
||||
public boolean containsAll( float[] array ) {
|
||||
for ( float element : array ) {
|
||||
if ( ! TFloatObjectHashMap.this.containsKey( element ) ) {
|
||||
return false;
|
||||
|
@ -594,22 +634,26 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean addAll( Collection<? extends Float> collection ) {
|
||||
@Override
|
||||
public boolean addAll( Collection<? extends Float> collection ) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean addAll( TFloatCollection collection ) {
|
||||
@Override
|
||||
public boolean addAll( TFloatCollection collection ) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean addAll( float[] array ) {
|
||||
@Override
|
||||
public boolean addAll( float[] array ) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean retainAll( Collection<?> collection ) {
|
||||
@Override
|
||||
public boolean retainAll( Collection<?> collection ) {
|
||||
boolean modified = false;
|
||||
TFloatIterator iter = iterator();
|
||||
while ( iter.hasNext() ) {
|
||||
|
@ -623,7 +667,8 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean retainAll( TFloatCollection collection ) {
|
||||
@Override
|
||||
public boolean retainAll( TFloatCollection collection ) {
|
||||
if ( this == collection ) {
|
||||
return false;
|
||||
}
|
||||
|
@ -639,7 +684,8 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean retainAll( float[] array ) {
|
||||
@Override
|
||||
public boolean retainAll( float[] array ) {
|
||||
boolean changed = false;
|
||||
Arrays.sort( array );
|
||||
float[] set = _set;
|
||||
|
@ -655,7 +701,8 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean removeAll( Collection<?> collection ) {
|
||||
@Override
|
||||
public boolean removeAll( Collection<?> collection ) {
|
||||
boolean changed = false;
|
||||
for ( Object element : collection ) {
|
||||
if ( element instanceof Float ) {
|
||||
|
@ -669,7 +716,8 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean removeAll( TFloatCollection collection ) {
|
||||
@Override
|
||||
public boolean removeAll( TFloatCollection collection ) {
|
||||
if ( collection == this ) {
|
||||
clear();
|
||||
return true;
|
||||
|
@ -686,7 +734,8 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean removeAll( float[] array ) {
|
||||
@Override
|
||||
public boolean removeAll( float[] array ) {
|
||||
boolean changed = false;
|
||||
for ( int i = array.length; i-- > 0; ) {
|
||||
if ( remove(array[i]) ) {
|
||||
|
@ -697,17 +746,20 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void clear() {
|
||||
@Override
|
||||
public void clear() {
|
||||
TFloatObjectHashMap.this.clear();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean forEach( TFloatProcedure procedure ) {
|
||||
@Override
|
||||
public boolean forEach( TFloatProcedure procedure ) {
|
||||
return TFloatObjectHashMap.this.forEachKey( procedure );
|
||||
}
|
||||
|
||||
/** {@inheritDoc) */
|
||||
public boolean equals( Object other ) {
|
||||
@Override
|
||||
public boolean equals( Object other ) {
|
||||
if (! ( other instanceof TFloatSet ) ) {
|
||||
return false;
|
||||
}
|
||||
|
@ -726,7 +778,8 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int hashCode() {
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hashcode = 0;
|
||||
for ( int i = _states.length; i-- > 0; ) {
|
||||
if ( _states[i] == FULL ) {
|
||||
|
@ -737,7 +790,8 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public String toString() {
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder buf = new StringBuilder("{");
|
||||
boolean first = true;
|
||||
for ( int i = _states.length; i-- > 0; ) {
|
||||
|
@ -763,7 +817,8 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public float next() {
|
||||
@Override
|
||||
public float next() {
|
||||
moveToNextIndex();
|
||||
return _hash._set[_index];
|
||||
}
|
||||
|
@ -774,20 +829,24 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
/** a view onto the values of the map. */
|
||||
protected class ValueView extends MapBackedView<V> {
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public Iterator<V> iterator() {
|
||||
return new TFloatObjectValueHashIterator( TFloatObjectHashMap.this ) {
|
||||
protected V objectAtIndex( int index ) {
|
||||
@Override
|
||||
protected V objectAtIndex( int index ) {
|
||||
return _values[index];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public boolean containsElement( V value ) {
|
||||
@Override
|
||||
public boolean containsElement( V value ) {
|
||||
return containsValue( value );
|
||||
}
|
||||
|
||||
public boolean removeElement( V value ) {
|
||||
@Override
|
||||
public boolean removeElement( V value ) {
|
||||
V[] values = _values;
|
||||
byte[] states = _states;
|
||||
|
||||
|
@ -823,7 +882,8 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public V next() {
|
||||
moveToNextIndex();
|
||||
return ( V ) _map._values[_index];
|
||||
|
@ -835,35 +895,42 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
private abstract class MapBackedView<E> extends AbstractSet<E>
|
||||
implements Set<E>, Iterable<E> {
|
||||
|
||||
public abstract Iterator<E> iterator();
|
||||
@Override
|
||||
public abstract Iterator<E> iterator();
|
||||
|
||||
public abstract boolean removeElement( E key );
|
||||
|
||||
public abstract boolean containsElement( E key );
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public boolean contains( Object key ) {
|
||||
return containsElement( (E) key );
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public boolean remove( Object o ) {
|
||||
return removeElement( (E) o );
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
@Override
|
||||
public void clear() {
|
||||
TFloatObjectHashMap.this.clear();
|
||||
}
|
||||
|
||||
public boolean add( E obj ) {
|
||||
@Override
|
||||
public boolean add( E obj ) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public int size() {
|
||||
@Override
|
||||
public int size() {
|
||||
return TFloatObjectHashMap.this.size();
|
||||
}
|
||||
|
||||
public Object[] toArray() {
|
||||
@Override
|
||||
public Object[] toArray() {
|
||||
Object[] result = new Object[size()];
|
||||
Iterator<E> e = iterator();
|
||||
for ( int i = 0; e.hasNext(); i++ ) {
|
||||
|
@ -872,7 +939,8 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
return result;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public <T> T[] toArray( T[] a ) {
|
||||
int size = size();
|
||||
if ( a.length < size ) {
|
||||
|
@ -892,15 +960,18 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
return a;
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return TFloatObjectHashMap.this.isEmpty();
|
||||
}
|
||||
|
||||
public boolean addAll( Collection<? extends E> collection ) {
|
||||
@Override
|
||||
public boolean addAll( Collection<? extends E> collection ) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@SuppressWarnings({"SuspiciousMethodCalls"})
|
||||
@Override
|
||||
@SuppressWarnings({"SuspiciousMethodCalls"})
|
||||
public boolean retainAll( Collection<?> collection ) {
|
||||
boolean changed = false;
|
||||
Iterator<E> i = iterator();
|
||||
|
@ -932,22 +1003,26 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void advance() {
|
||||
@Override
|
||||
public void advance() {
|
||||
moveToNextIndex();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public float key() {
|
||||
@Override
|
||||
public float key() {
|
||||
return _map._set[_index];
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public V value() {
|
||||
@Override
|
||||
public V value() {
|
||||
return _map._values[_index];
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public V setValue( V val ) {
|
||||
@Override
|
||||
public V setValue( V val ) {
|
||||
V old = value();
|
||||
_map._values[_index] = val;
|
||||
return old;
|
||||
|
@ -955,7 +1030,8 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
}
|
||||
|
||||
|
||||
public void writeExternal( ObjectOutput out ) throws IOException {
|
||||
@Override
|
||||
public void writeExternal( ObjectOutput out ) throws IOException {
|
||||
// VERSION
|
||||
out.writeByte( 0 );
|
||||
|
||||
|
@ -978,7 +1054,8 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public void readExternal( ObjectInput in )
|
||||
throws IOException, ClassNotFoundException {
|
||||
|
||||
|
@ -1004,11 +1081,13 @@ public class TFloatObjectHashMap<V> extends TFloatHash implements
|
|||
}
|
||||
|
||||
|
||||
public String toString() {
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder buf = new StringBuilder("{");
|
||||
forEachEntry(new TFloatObjectProcedure<V>() {
|
||||
private boolean first = true;
|
||||
public boolean execute(float key, Object value) {
|
||||
@Override
|
||||
public boolean execute(float key, Object value) {
|
||||
if ( first ) first = false;
|
||||
else buf.append( "," );
|
||||
|
||||
|
|
|
@ -155,7 +155,8 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
* @param initialCapacity an <code>int</code> value
|
||||
* @return the actual capacity chosen
|
||||
*/
|
||||
protected int setUp( int initialCapacity ) {
|
||||
@Override
|
||||
protected int setUp( int initialCapacity ) {
|
||||
int capacity;
|
||||
|
||||
capacity = super.setUp( initialCapacity );
|
||||
|
@ -170,7 +171,8 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
* @param newCapacity an <code>int</code> value
|
||||
*/
|
||||
/** {@inheritDoc} */
|
||||
protected void rehash( int newCapacity ) {
|
||||
@Override
|
||||
protected void rehash( int newCapacity ) {
|
||||
int oldCapacity = _set.length;
|
||||
|
||||
int oldKeys[] = _set;
|
||||
|
@ -194,14 +196,16 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public byte put( int key, byte value ) {
|
||||
@Override
|
||||
public byte put( int key, byte value ) {
|
||||
int index = insertionIndex( key );
|
||||
return doPut( key, value, index );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public byte putIfAbsent( int key, byte value ) {
|
||||
@Override
|
||||
public byte putIfAbsent( int key, byte value ) {
|
||||
int index = insertionIndex( key );
|
||||
if (index < 0)
|
||||
return _values[-index - 1];
|
||||
|
@ -231,7 +235,8 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void putAll( Map<? extends Integer, ? extends Byte> map ) {
|
||||
@Override
|
||||
public void putAll( Map<? extends Integer, ? extends Byte> map ) {
|
||||
ensureCapacity( map.size() );
|
||||
// could optimize this for cases when map instanceof THashMap
|
||||
for ( Map.Entry<? extends Integer, ? extends Byte> entry : map.entrySet() ) {
|
||||
|
@ -241,7 +246,8 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void putAll( TIntByteMap map ) {
|
||||
@Override
|
||||
public void putAll( TIntByteMap map ) {
|
||||
ensureCapacity( map.size() );
|
||||
TIntByteIterator iter = map.iterator();
|
||||
while ( iter.hasNext() ) {
|
||||
|
@ -252,14 +258,16 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public byte get( int key ) {
|
||||
@Override
|
||||
public byte get( int key ) {
|
||||
int index = index( key );
|
||||
return index < 0 ? no_entry_value : _values[index];
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void clear() {
|
||||
@Override
|
||||
public void clear() {
|
||||
super.clear();
|
||||
Arrays.fill( _set, 0, _set.length, no_entry_key );
|
||||
Arrays.fill( _values, 0, _values.length, no_entry_value );
|
||||
|
@ -268,13 +276,15 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean isEmpty() {
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return 0 == _size;
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public byte remove( int key ) {
|
||||
@Override
|
||||
public byte remove( int key ) {
|
||||
byte prev = no_entry_value;
|
||||
int index = index( key );
|
||||
if ( index >= 0 ) {
|
||||
|
@ -286,20 +296,23 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
protected void removeAt( int index ) {
|
||||
@Override
|
||||
protected void removeAt( int index ) {
|
||||
_values[index] = no_entry_value;
|
||||
super.removeAt( index ); // clear key, state; adjust size
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public TIntSet keySet() {
|
||||
@Override
|
||||
public TIntSet keySet() {
|
||||
return new TKeyView();
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int[] keys() {
|
||||
@Override
|
||||
public int[] keys() {
|
||||
int[] keys = new int[size()];
|
||||
int[] k = _set;
|
||||
byte[] states = _states;
|
||||
|
@ -314,7 +327,8 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int[] keys( int[] array ) {
|
||||
@Override
|
||||
public int[] keys( int[] array ) {
|
||||
int size = size();
|
||||
if ( array.length < size ) {
|
||||
array = new int[size];
|
||||
|
@ -333,13 +347,15 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public TByteCollection valueCollection() {
|
||||
@Override
|
||||
public TByteCollection valueCollection() {
|
||||
return new TValueView();
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public byte[] values() {
|
||||
@Override
|
||||
public byte[] values() {
|
||||
byte[] vals = new byte[size()];
|
||||
byte[] v = _values;
|
||||
byte[] states = _states;
|
||||
|
@ -354,7 +370,8 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public byte[] values( byte[] array ) {
|
||||
@Override
|
||||
public byte[] values( byte[] array ) {
|
||||
int size = size();
|
||||
if ( array.length < size ) {
|
||||
array = new byte[size];
|
||||
|
@ -373,7 +390,8 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsValue( byte val ) {
|
||||
@Override
|
||||
public boolean containsValue( byte val ) {
|
||||
byte[] states = _states;
|
||||
byte[] vals = _values;
|
||||
|
||||
|
@ -387,25 +405,29 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsKey( int key ) {
|
||||
@Override
|
||||
public boolean containsKey( int key ) {
|
||||
return contains( key );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public TIntByteIterator iterator() {
|
||||
@Override
|
||||
public TIntByteIterator iterator() {
|
||||
return new TIntByteHashIterator( this );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean forEachKey( TIntProcedure procedure ) {
|
||||
@Override
|
||||
public boolean forEachKey( TIntProcedure procedure ) {
|
||||
return forEach( procedure );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean forEachValue( TByteProcedure procedure ) {
|
||||
@Override
|
||||
public boolean forEachValue( TByteProcedure procedure ) {
|
||||
byte[] states = _states;
|
||||
byte[] values = _values;
|
||||
for ( int i = values.length; i-- > 0; ) {
|
||||
|
@ -418,7 +440,8 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean forEachEntry( TIntByteProcedure procedure ) {
|
||||
@Override
|
||||
public boolean forEachEntry( TIntByteProcedure procedure ) {
|
||||
byte[] states = _states;
|
||||
int[] keys = _set;
|
||||
byte[] values = _values;
|
||||
|
@ -432,7 +455,8 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void transformValues( TByteFunction function ) {
|
||||
@Override
|
||||
public void transformValues( TByteFunction function ) {
|
||||
byte[] states = _states;
|
||||
byte[] values = _values;
|
||||
for ( int i = values.length; i-- > 0; ) {
|
||||
|
@ -444,7 +468,8 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean retainEntries( TIntByteProcedure procedure ) {
|
||||
@Override
|
||||
public boolean retainEntries( TIntByteProcedure procedure ) {
|
||||
boolean modified = false;
|
||||
byte[] states = _states;
|
||||
int[] keys = _set;
|
||||
|
@ -470,13 +495,15 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean increment( int key ) {
|
||||
@Override
|
||||
public boolean increment( int key ) {
|
||||
return adjustValue( key, ( byte ) 1 );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean adjustValue( int key, byte amount ) {
|
||||
@Override
|
||||
public boolean adjustValue( int key, byte amount ) {
|
||||
int index = index( key );
|
||||
if (index < 0) {
|
||||
return false;
|
||||
|
@ -488,7 +515,8 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public byte adjustOrPutValue( int key, byte adjust_amount, byte put_amount ) {
|
||||
@Override
|
||||
public byte adjustOrPutValue( int key, byte adjust_amount, byte put_amount ) {
|
||||
int index = insertionIndex( key );
|
||||
final boolean isNewMapping;
|
||||
final byte newValue;
|
||||
|
@ -517,43 +545,50 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
protected class TKeyView implements TIntSet {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public TIntIterator iterator() {
|
||||
@Override
|
||||
public TIntIterator iterator() {
|
||||
return new TIntByteKeyHashIterator( TIntByteHashMap.this );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int getNoEntryValue() {
|
||||
@Override
|
||||
public int getNoEntryValue() {
|
||||
return no_entry_key;
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int size() {
|
||||
@Override
|
||||
public int size() {
|
||||
return _size;
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean isEmpty() {
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return 0 == _size;
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean contains( int entry ) {
|
||||
@Override
|
||||
public boolean contains( int entry ) {
|
||||
return TIntByteHashMap.this.contains( entry );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int[] toArray() {
|
||||
@Override
|
||||
public int[] toArray() {
|
||||
return TIntByteHashMap.this.keys();
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int[] toArray( int[] dest ) {
|
||||
@Override
|
||||
public int[] toArray( int[] dest ) {
|
||||
return TIntByteHashMap.this.keys( dest );
|
||||
}
|
||||
|
||||
|
@ -563,19 +598,22 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
* <p/>
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public boolean add( int entry ) {
|
||||
@Override
|
||||
public boolean add( int entry ) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean remove( int entry ) {
|
||||
@Override
|
||||
public boolean remove( int entry ) {
|
||||
return no_entry_value != TIntByteHashMap.this.remove( entry );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsAll( Collection<?> collection ) {
|
||||
@Override
|
||||
public boolean containsAll( Collection<?> collection ) {
|
||||
for ( Object element : collection ) {
|
||||
if ( element instanceof Integer ) {
|
||||
int ele = ( ( Integer ) element ).intValue();
|
||||
|
@ -591,7 +629,8 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsAll( TIntCollection collection ) {
|
||||
@Override
|
||||
public boolean containsAll( TIntCollection collection ) {
|
||||
TIntIterator iter = collection.iterator();
|
||||
while ( iter.hasNext() ) {
|
||||
if ( ! TIntByteHashMap.this.containsKey( iter.next() ) ) {
|
||||
|
@ -603,7 +642,8 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsAll( int[] array ) {
|
||||
@Override
|
||||
public boolean containsAll( int[] array ) {
|
||||
for ( int element : array ) {
|
||||
if ( ! TIntByteHashMap.this.contains( element ) ) {
|
||||
return false;
|
||||
|
@ -618,7 +658,8 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
* <p/>
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public boolean addAll( Collection<? extends Integer> collection ) {
|
||||
@Override
|
||||
public boolean addAll( Collection<? extends Integer> collection ) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
@ -628,7 +669,8 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
* <p/>
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public boolean addAll( TIntCollection collection ) {
|
||||
@Override
|
||||
public boolean addAll( TIntCollection collection ) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
@ -638,13 +680,15 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
* <p/>
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public boolean addAll( int[] array ) {
|
||||
@Override
|
||||
public boolean addAll( int[] array ) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@SuppressWarnings({"SuspiciousMethodCalls"})
|
||||
@Override
|
||||
@SuppressWarnings({"SuspiciousMethodCalls"})
|
||||
public boolean retainAll( Collection<?> collection ) {
|
||||
boolean modified = false;
|
||||
TIntIterator iter = iterator();
|
||||
|
@ -659,7 +703,8 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean retainAll( TIntCollection collection ) {
|
||||
@Override
|
||||
public boolean retainAll( TIntCollection collection ) {
|
||||
if ( this == collection ) {
|
||||
return false;
|
||||
}
|
||||
|
@ -676,7 +721,8 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean retainAll( int[] array ) {
|
||||
@Override
|
||||
public boolean retainAll( int[] array ) {
|
||||
boolean changed = false;
|
||||
Arrays.sort( array );
|
||||
int[] set = _set;
|
||||
|
@ -693,7 +739,8 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean removeAll( Collection<?> collection ) {
|
||||
@Override
|
||||
public boolean removeAll( Collection<?> collection ) {
|
||||
boolean changed = false;
|
||||
for ( Object element : collection ) {
|
||||
if ( element instanceof Integer ) {
|
||||
|
@ -708,7 +755,8 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean removeAll( TIntCollection collection ) {
|
||||
@Override
|
||||
public boolean removeAll( TIntCollection collection ) {
|
||||
if ( this == collection ) {
|
||||
clear();
|
||||
return true;
|
||||
|
@ -726,7 +774,8 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean removeAll( int[] array ) {
|
||||
@Override
|
||||
public boolean removeAll( int[] array ) {
|
||||
boolean changed = false;
|
||||
for ( int i = array.length; i-- > 0; ) {
|
||||
if ( remove( array[i] ) ) {
|
||||
|
@ -738,13 +787,15 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void clear() {
|
||||
@Override
|
||||
public void clear() {
|
||||
TIntByteHashMap.this.clear();
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean forEach( TIntProcedure procedure ) {
|
||||
@Override
|
||||
public boolean forEach( TIntProcedure procedure ) {
|
||||
return TIntByteHashMap.this.forEachKey( procedure );
|
||||
}
|
||||
|
||||
|
@ -788,7 +839,8 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
private boolean first = true;
|
||||
|
||||
|
||||
public boolean execute( int key ) {
|
||||
@Override
|
||||
public boolean execute( int key ) {
|
||||
if ( first ) {
|
||||
first = false;
|
||||
} else {
|
||||
|
@ -809,55 +861,64 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
protected class TValueView implements TByteCollection {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public TByteIterator iterator() {
|
||||
@Override
|
||||
public TByteIterator iterator() {
|
||||
return new TIntByteValueHashIterator( TIntByteHashMap.this );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public byte getNoEntryValue() {
|
||||
@Override
|
||||
public byte getNoEntryValue() {
|
||||
return no_entry_value;
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int size() {
|
||||
@Override
|
||||
public int size() {
|
||||
return _size;
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean isEmpty() {
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return 0 == _size;
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean contains( byte entry ) {
|
||||
@Override
|
||||
public boolean contains( byte entry ) {
|
||||
return TIntByteHashMap.this.containsValue( entry );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public byte[] toArray() {
|
||||
@Override
|
||||
public byte[] toArray() {
|
||||
return TIntByteHashMap.this.values();
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public byte[] toArray( byte[] dest ) {
|
||||
@Override
|
||||
public byte[] toArray( byte[] dest ) {
|
||||
return TIntByteHashMap.this.values( dest );
|
||||
}
|
||||
|
||||
|
||||
|
||||
public boolean add( byte entry ) {
|
||||
@Override
|
||||
public boolean add( byte entry ) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean remove( byte entry ) {
|
||||
@Override
|
||||
public boolean remove( byte entry ) {
|
||||
byte[] values = _values;
|
||||
int[] set = _set;
|
||||
|
||||
|
@ -872,7 +933,8 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsAll( Collection<?> collection ) {
|
||||
@Override
|
||||
public boolean containsAll( Collection<?> collection ) {
|
||||
for ( Object element : collection ) {
|
||||
if ( element instanceof Byte ) {
|
||||
byte ele = ( ( Byte ) element ).byteValue();
|
||||
|
@ -888,7 +950,8 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsAll( TByteCollection collection ) {
|
||||
@Override
|
||||
public boolean containsAll( TByteCollection collection ) {
|
||||
TByteIterator iter = collection.iterator();
|
||||
while ( iter.hasNext() ) {
|
||||
if ( ! TIntByteHashMap.this.containsValue( iter.next() ) ) {
|
||||
|
@ -900,7 +963,8 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsAll( byte[] array ) {
|
||||
@Override
|
||||
public boolean containsAll( byte[] array ) {
|
||||
for ( byte element : array ) {
|
||||
if ( ! TIntByteHashMap.this.containsValue( element ) ) {
|
||||
return false;
|
||||
|
@ -911,25 +975,29 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean addAll( Collection<? extends Byte> collection ) {
|
||||
@Override
|
||||
public boolean addAll( Collection<? extends Byte> collection ) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean addAll( TByteCollection collection ) {
|
||||
@Override
|
||||
public boolean addAll( TByteCollection collection ) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean addAll( byte[] array ) {
|
||||
@Override
|
||||
public boolean addAll( byte[] array ) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@SuppressWarnings({"SuspiciousMethodCalls"})
|
||||
@Override
|
||||
@SuppressWarnings({"SuspiciousMethodCalls"})
|
||||
public boolean retainAll( Collection<?> collection ) {
|
||||
boolean modified = false;
|
||||
TByteIterator iter = iterator();
|
||||
|
@ -944,7 +1012,8 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean retainAll( TByteCollection collection ) {
|
||||
@Override
|
||||
public boolean retainAll( TByteCollection collection ) {
|
||||
if ( this == collection ) {
|
||||
return false;
|
||||
}
|
||||
|
@ -961,7 +1030,8 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean retainAll( byte[] array ) {
|
||||
@Override
|
||||
public boolean retainAll( byte[] array ) {
|
||||
boolean changed = false;
|
||||
Arrays.sort( array );
|
||||
byte[] values = _values;
|
||||
|
@ -978,7 +1048,8 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean removeAll( Collection<?> collection ) {
|
||||
@Override
|
||||
public boolean removeAll( Collection<?> collection ) {
|
||||
boolean changed = false;
|
||||
for ( Object element : collection ) {
|
||||
if ( element instanceof Byte ) {
|
||||
|
@ -993,7 +1064,8 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean removeAll( TByteCollection collection ) {
|
||||
@Override
|
||||
public boolean removeAll( TByteCollection collection ) {
|
||||
if ( this == collection ) {
|
||||
clear();
|
||||
return true;
|
||||
|
@ -1011,7 +1083,8 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean removeAll( byte[] array ) {
|
||||
@Override
|
||||
public boolean removeAll( byte[] array ) {
|
||||
boolean changed = false;
|
||||
for ( int i = array.length; i-- > 0; ) {
|
||||
if ( remove( array[i] ) ) {
|
||||
|
@ -1023,13 +1096,15 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void clear() {
|
||||
@Override
|
||||
public void clear() {
|
||||
TIntByteHashMap.this.clear();
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean forEach( TByteProcedure procedure ) {
|
||||
@Override
|
||||
public boolean forEach( TByteProcedure procedure ) {
|
||||
return TIntByteHashMap.this.forEachValue( procedure );
|
||||
}
|
||||
|
||||
|
@ -1041,7 +1116,8 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
forEachValue( new TByteProcedure() {
|
||||
private boolean first = true;
|
||||
|
||||
public boolean execute( byte value ) {
|
||||
@Override
|
||||
public boolean execute( byte value ) {
|
||||
if ( first ) {
|
||||
first = false;
|
||||
} else {
|
||||
|
@ -1070,13 +1146,15 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int next() {
|
||||
@Override
|
||||
public int next() {
|
||||
moveToNextIndex();
|
||||
return _set[_index];
|
||||
}
|
||||
|
||||
/** @{inheritDoc} */
|
||||
public void remove() {
|
||||
@Override
|
||||
public void remove() {
|
||||
if ( _expectedSize != _hash.size() ) {
|
||||
throw new ConcurrentModificationException();
|
||||
}
|
||||
|
@ -1108,13 +1186,15 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public byte next() {
|
||||
@Override
|
||||
public byte next() {
|
||||
moveToNextIndex();
|
||||
return _values[_index];
|
||||
}
|
||||
|
||||
/** @{inheritDoc} */
|
||||
public void remove() {
|
||||
@Override
|
||||
public void remove() {
|
||||
if ( _expectedSize != _hash.size() ) {
|
||||
throw new ConcurrentModificationException();
|
||||
}
|
||||
|
@ -1145,29 +1225,34 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void advance() {
|
||||
@Override
|
||||
public void advance() {
|
||||
moveToNextIndex();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int key() {
|
||||
@Override
|
||||
public int key() {
|
||||
return _set[_index];
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public byte value() {
|
||||
@Override
|
||||
public byte value() {
|
||||
return _values[_index];
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public byte setValue( byte val ) {
|
||||
@Override
|
||||
public byte setValue( byte val ) {
|
||||
byte old = value();
|
||||
_values[_index] = val;
|
||||
return old;
|
||||
}
|
||||
|
||||
/** @{inheritDoc} */
|
||||
public void remove() {
|
||||
@Override
|
||||
public void remove() {
|
||||
if ( _expectedSize != _hash.size() ) {
|
||||
throw new ConcurrentModificationException();
|
||||
}
|
||||
|
@ -1235,7 +1320,8 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
final StringBuilder buf = new StringBuilder( "{" );
|
||||
forEachEntry( new TIntByteProcedure() {
|
||||
private boolean first = true;
|
||||
public boolean execute( int key, byte value ) {
|
||||
@Override
|
||||
public boolean execute( int key, byte value ) {
|
||||
if ( first ) first = false;
|
||||
else buf.append( ", " );
|
||||
|
||||
|
@ -1251,7 +1337,8 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void writeExternal(ObjectOutput out) throws IOException {
|
||||
@Override
|
||||
public void writeExternal(ObjectOutput out) throws IOException {
|
||||
// VERSION
|
||||
out.writeByte( 0 );
|
||||
|
||||
|
@ -1272,7 +1359,8 @@ public class TIntByteHashMap extends TIntByteHash implements TIntByteMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
|
||||
@Override
|
||||
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
|
||||
// VERSION
|
||||
in.readByte();
|
||||
|
||||
|
|
|
@ -155,7 +155,8 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
* @param initialCapacity an <code>int</code> value
|
||||
* @return the actual capacity chosen
|
||||
*/
|
||||
protected int setUp( int initialCapacity ) {
|
||||
@Override
|
||||
protected int setUp( int initialCapacity ) {
|
||||
int capacity;
|
||||
|
||||
capacity = super.setUp( initialCapacity );
|
||||
|
@ -170,7 +171,8 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
* @param newCapacity an <code>int</code> value
|
||||
*/
|
||||
/** {@inheritDoc} */
|
||||
protected void rehash( int newCapacity ) {
|
||||
@Override
|
||||
protected void rehash( int newCapacity ) {
|
||||
int oldCapacity = _set.length;
|
||||
|
||||
int oldKeys[] = _set;
|
||||
|
@ -194,14 +196,16 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public long put( int key, long value ) {
|
||||
@Override
|
||||
public long put( int key, long value ) {
|
||||
int index = insertionIndex( key );
|
||||
return doPut( key, value, index );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public long putIfAbsent( int key, long value ) {
|
||||
@Override
|
||||
public long putIfAbsent( int key, long value ) {
|
||||
int index = insertionIndex( key );
|
||||
if (index < 0)
|
||||
return _values[-index - 1];
|
||||
|
@ -231,7 +235,8 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void putAll( Map<? extends Integer, ? extends Long> map ) {
|
||||
@Override
|
||||
public void putAll( Map<? extends Integer, ? extends Long> map ) {
|
||||
ensureCapacity( map.size() );
|
||||
// could optimize this for cases when map instanceof THashMap
|
||||
for ( Map.Entry<? extends Integer, ? extends Long> entry : map.entrySet() ) {
|
||||
|
@ -241,7 +246,8 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void putAll( TIntLongMap map ) {
|
||||
@Override
|
||||
public void putAll( TIntLongMap map ) {
|
||||
ensureCapacity( map.size() );
|
||||
TIntLongIterator iter = map.iterator();
|
||||
while ( iter.hasNext() ) {
|
||||
|
@ -252,14 +258,16 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public long get( int key ) {
|
||||
@Override
|
||||
public long get( int key ) {
|
||||
int index = index( key );
|
||||
return index < 0 ? no_entry_value : _values[index];
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void clear() {
|
||||
@Override
|
||||
public void clear() {
|
||||
super.clear();
|
||||
Arrays.fill( _set, 0, _set.length, no_entry_key );
|
||||
Arrays.fill( _values, 0, _values.length, no_entry_value );
|
||||
|
@ -268,13 +276,15 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean isEmpty() {
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return 0 == _size;
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public long remove( int key ) {
|
||||
@Override
|
||||
public long remove( int key ) {
|
||||
long prev = no_entry_value;
|
||||
int index = index( key );
|
||||
if ( index >= 0 ) {
|
||||
|
@ -286,20 +296,23 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
protected void removeAt( int index ) {
|
||||
@Override
|
||||
protected void removeAt( int index ) {
|
||||
_values[index] = no_entry_value;
|
||||
super.removeAt( index ); // clear key, state; adjust size
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public TIntSet keySet() {
|
||||
@Override
|
||||
public TIntSet keySet() {
|
||||
return new TKeyView();
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int[] keys() {
|
||||
@Override
|
||||
public int[] keys() {
|
||||
int[] keys = new int[size()];
|
||||
int[] k = _set;
|
||||
byte[] states = _states;
|
||||
|
@ -314,7 +327,8 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int[] keys( int[] array ) {
|
||||
@Override
|
||||
public int[] keys( int[] array ) {
|
||||
int size = size();
|
||||
if ( array.length < size ) {
|
||||
array = new int[size];
|
||||
|
@ -333,13 +347,15 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public TLongCollection valueCollection() {
|
||||
@Override
|
||||
public TLongCollection valueCollection() {
|
||||
return new TValueView();
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public long[] values() {
|
||||
@Override
|
||||
public long[] values() {
|
||||
long[] vals = new long[size()];
|
||||
long[] v = _values;
|
||||
byte[] states = _states;
|
||||
|
@ -354,7 +370,8 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public long[] values( long[] array ) {
|
||||
@Override
|
||||
public long[] values( long[] array ) {
|
||||
int size = size();
|
||||
if ( array.length < size ) {
|
||||
array = new long[size];
|
||||
|
@ -373,7 +390,8 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsValue( long val ) {
|
||||
@Override
|
||||
public boolean containsValue( long val ) {
|
||||
byte[] states = _states;
|
||||
long[] vals = _values;
|
||||
|
||||
|
@ -387,25 +405,29 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsKey( int key ) {
|
||||
@Override
|
||||
public boolean containsKey( int key ) {
|
||||
return contains( key );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public TIntLongIterator iterator() {
|
||||
@Override
|
||||
public TIntLongIterator iterator() {
|
||||
return new TIntLongHashIterator( this );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean forEachKey( TIntProcedure procedure ) {
|
||||
@Override
|
||||
public boolean forEachKey( TIntProcedure procedure ) {
|
||||
return forEach( procedure );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean forEachValue( TLongProcedure procedure ) {
|
||||
@Override
|
||||
public boolean forEachValue( TLongProcedure procedure ) {
|
||||
byte[] states = _states;
|
||||
long[] values = _values;
|
||||
for ( int i = values.length; i-- > 0; ) {
|
||||
|
@ -418,7 +440,8 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean forEachEntry( TIntLongProcedure procedure ) {
|
||||
@Override
|
||||
public boolean forEachEntry( TIntLongProcedure procedure ) {
|
||||
byte[] states = _states;
|
||||
int[] keys = _set;
|
||||
long[] values = _values;
|
||||
|
@ -432,7 +455,8 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void transformValues( TLongFunction function ) {
|
||||
@Override
|
||||
public void transformValues( TLongFunction function ) {
|
||||
byte[] states = _states;
|
||||
long[] values = _values;
|
||||
for ( int i = values.length; i-- > 0; ) {
|
||||
|
@ -444,7 +468,8 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean retainEntries( TIntLongProcedure procedure ) {
|
||||
@Override
|
||||
public boolean retainEntries( TIntLongProcedure procedure ) {
|
||||
boolean modified = false;
|
||||
byte[] states = _states;
|
||||
int[] keys = _set;
|
||||
|
@ -470,13 +495,15 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean increment( int key ) {
|
||||
@Override
|
||||
public boolean increment( int key ) {
|
||||
return adjustValue( key, ( long ) 1 );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean adjustValue( int key, long amount ) {
|
||||
@Override
|
||||
public boolean adjustValue( int key, long amount ) {
|
||||
int index = index( key );
|
||||
if (index < 0) {
|
||||
return false;
|
||||
|
@ -488,7 +515,8 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public long adjustOrPutValue( int key, long adjust_amount, long put_amount ) {
|
||||
@Override
|
||||
public long adjustOrPutValue( int key, long adjust_amount, long put_amount ) {
|
||||
int index = insertionIndex( key );
|
||||
final boolean isNewMapping;
|
||||
final long newValue;
|
||||
|
@ -517,43 +545,50 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
protected class TKeyView implements TIntSet {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public TIntIterator iterator() {
|
||||
@Override
|
||||
public TIntIterator iterator() {
|
||||
return new TIntLongKeyHashIterator( TIntLongHashMap.this );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int getNoEntryValue() {
|
||||
@Override
|
||||
public int getNoEntryValue() {
|
||||
return no_entry_key;
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int size() {
|
||||
@Override
|
||||
public int size() {
|
||||
return _size;
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean isEmpty() {
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return 0 == _size;
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean contains( int entry ) {
|
||||
@Override
|
||||
public boolean contains( int entry ) {
|
||||
return TIntLongHashMap.this.contains( entry );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int[] toArray() {
|
||||
@Override
|
||||
public int[] toArray() {
|
||||
return TIntLongHashMap.this.keys();
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int[] toArray( int[] dest ) {
|
||||
@Override
|
||||
public int[] toArray( int[] dest ) {
|
||||
return TIntLongHashMap.this.keys( dest );
|
||||
}
|
||||
|
||||
|
@ -563,19 +598,22 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
* <p/>
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public boolean add( int entry ) {
|
||||
@Override
|
||||
public boolean add( int entry ) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean remove( int entry ) {
|
||||
@Override
|
||||
public boolean remove( int entry ) {
|
||||
return no_entry_value != TIntLongHashMap.this.remove( entry );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsAll( Collection<?> collection ) {
|
||||
@Override
|
||||
public boolean containsAll( Collection<?> collection ) {
|
||||
for ( Object element : collection ) {
|
||||
if ( element instanceof Integer ) {
|
||||
int ele = ( ( Integer ) element ).intValue();
|
||||
|
@ -591,7 +629,8 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsAll( TIntCollection collection ) {
|
||||
@Override
|
||||
public boolean containsAll( TIntCollection collection ) {
|
||||
TIntIterator iter = collection.iterator();
|
||||
while ( iter.hasNext() ) {
|
||||
if ( ! TIntLongHashMap.this.containsKey( iter.next() ) ) {
|
||||
|
@ -603,7 +642,8 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsAll( int[] array ) {
|
||||
@Override
|
||||
public boolean containsAll( int[] array ) {
|
||||
for ( int element : array ) {
|
||||
if ( ! TIntLongHashMap.this.contains( element ) ) {
|
||||
return false;
|
||||
|
@ -618,7 +658,8 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
* <p/>
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public boolean addAll( Collection<? extends Integer> collection ) {
|
||||
@Override
|
||||
public boolean addAll( Collection<? extends Integer> collection ) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
@ -628,7 +669,8 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
* <p/>
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public boolean addAll( TIntCollection collection ) {
|
||||
@Override
|
||||
public boolean addAll( TIntCollection collection ) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
@ -638,13 +680,15 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
* <p/>
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public boolean addAll( int[] array ) {
|
||||
@Override
|
||||
public boolean addAll( int[] array ) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@SuppressWarnings({"SuspiciousMethodCalls"})
|
||||
@Override
|
||||
@SuppressWarnings({"SuspiciousMethodCalls"})
|
||||
public boolean retainAll( Collection<?> collection ) {
|
||||
boolean modified = false;
|
||||
TIntIterator iter = iterator();
|
||||
|
@ -659,7 +703,8 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean retainAll( TIntCollection collection ) {
|
||||
@Override
|
||||
public boolean retainAll( TIntCollection collection ) {
|
||||
if ( this == collection ) {
|
||||
return false;
|
||||
}
|
||||
|
@ -676,7 +721,8 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean retainAll( int[] array ) {
|
||||
@Override
|
||||
public boolean retainAll( int[] array ) {
|
||||
boolean changed = false;
|
||||
Arrays.sort( array );
|
||||
int[] set = _set;
|
||||
|
@ -693,7 +739,8 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean removeAll( Collection<?> collection ) {
|
||||
@Override
|
||||
public boolean removeAll( Collection<?> collection ) {
|
||||
boolean changed = false;
|
||||
for ( Object element : collection ) {
|
||||
if ( element instanceof Integer ) {
|
||||
|
@ -708,7 +755,8 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean removeAll( TIntCollection collection ) {
|
||||
@Override
|
||||
public boolean removeAll( TIntCollection collection ) {
|
||||
if ( this == collection ) {
|
||||
clear();
|
||||
return true;
|
||||
|
@ -726,7 +774,8 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean removeAll( int[] array ) {
|
||||
@Override
|
||||
public boolean removeAll( int[] array ) {
|
||||
boolean changed = false;
|
||||
for ( int i = array.length; i-- > 0; ) {
|
||||
if ( remove( array[i] ) ) {
|
||||
|
@ -738,13 +787,15 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void clear() {
|
||||
@Override
|
||||
public void clear() {
|
||||
TIntLongHashMap.this.clear();
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean forEach( TIntProcedure procedure ) {
|
||||
@Override
|
||||
public boolean forEach( TIntProcedure procedure ) {
|
||||
return TIntLongHashMap.this.forEachKey( procedure );
|
||||
}
|
||||
|
||||
|
@ -788,7 +839,8 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
private boolean first = true;
|
||||
|
||||
|
||||
public boolean execute( int key ) {
|
||||
@Override
|
||||
public boolean execute( int key ) {
|
||||
if ( first ) {
|
||||
first = false;
|
||||
} else {
|
||||
|
@ -809,55 +861,64 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
protected class TValueView implements TLongCollection {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public TLongIterator iterator() {
|
||||
@Override
|
||||
public TLongIterator iterator() {
|
||||
return new TIntLongValueHashIterator( TIntLongHashMap.this );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public long getNoEntryValue() {
|
||||
@Override
|
||||
public long getNoEntryValue() {
|
||||
return no_entry_value;
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int size() {
|
||||
@Override
|
||||
public int size() {
|
||||
return _size;
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean isEmpty() {
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return 0 == _size;
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean contains( long entry ) {
|
||||
@Override
|
||||
public boolean contains( long entry ) {
|
||||
return TIntLongHashMap.this.containsValue( entry );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public long[] toArray() {
|
||||
@Override
|
||||
public long[] toArray() {
|
||||
return TIntLongHashMap.this.values();
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public long[] toArray( long[] dest ) {
|
||||
@Override
|
||||
public long[] toArray( long[] dest ) {
|
||||
return TIntLongHashMap.this.values( dest );
|
||||
}
|
||||
|
||||
|
||||
|
||||
public boolean add( long entry ) {
|
||||
@Override
|
||||
public boolean add( long entry ) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean remove( long entry ) {
|
||||
@Override
|
||||
public boolean remove( long entry ) {
|
||||
long[] values = _values;
|
||||
int[] set = _set;
|
||||
|
||||
|
@ -872,7 +933,8 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsAll( Collection<?> collection ) {
|
||||
@Override
|
||||
public boolean containsAll( Collection<?> collection ) {
|
||||
for ( Object element : collection ) {
|
||||
if ( element instanceof Long ) {
|
||||
long ele = ( ( Long ) element ).longValue();
|
||||
|
@ -888,7 +950,8 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsAll( TLongCollection collection ) {
|
||||
@Override
|
||||
public boolean containsAll( TLongCollection collection ) {
|
||||
TLongIterator iter = collection.iterator();
|
||||
while ( iter.hasNext() ) {
|
||||
if ( ! TIntLongHashMap.this.containsValue( iter.next() ) ) {
|
||||
|
@ -900,7 +963,8 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsAll( long[] array ) {
|
||||
@Override
|
||||
public boolean containsAll( long[] array ) {
|
||||
for ( long element : array ) {
|
||||
if ( ! TIntLongHashMap.this.containsValue( element ) ) {
|
||||
return false;
|
||||
|
@ -911,25 +975,29 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean addAll( Collection<? extends Long> collection ) {
|
||||
@Override
|
||||
public boolean addAll( Collection<? extends Long> collection ) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean addAll( TLongCollection collection ) {
|
||||
@Override
|
||||
public boolean addAll( TLongCollection collection ) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean addAll( long[] array ) {
|
||||
@Override
|
||||
public boolean addAll( long[] array ) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@SuppressWarnings({"SuspiciousMethodCalls"})
|
||||
@Override
|
||||
@SuppressWarnings({"SuspiciousMethodCalls"})
|
||||
public boolean retainAll( Collection<?> collection ) {
|
||||
boolean modified = false;
|
||||
TLongIterator iter = iterator();
|
||||
|
@ -944,7 +1012,8 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean retainAll( TLongCollection collection ) {
|
||||
@Override
|
||||
public boolean retainAll( TLongCollection collection ) {
|
||||
if ( this == collection ) {
|
||||
return false;
|
||||
}
|
||||
|
@ -961,7 +1030,8 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean retainAll( long[] array ) {
|
||||
@Override
|
||||
public boolean retainAll( long[] array ) {
|
||||
boolean changed = false;
|
||||
Arrays.sort( array );
|
||||
long[] values = _values;
|
||||
|
@ -978,7 +1048,8 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean removeAll( Collection<?> collection ) {
|
||||
@Override
|
||||
public boolean removeAll( Collection<?> collection ) {
|
||||
boolean changed = false;
|
||||
for ( Object element : collection ) {
|
||||
if ( element instanceof Long ) {
|
||||
|
@ -993,7 +1064,8 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean removeAll( TLongCollection collection ) {
|
||||
@Override
|
||||
public boolean removeAll( TLongCollection collection ) {
|
||||
if ( this == collection ) {
|
||||
clear();
|
||||
return true;
|
||||
|
@ -1011,7 +1083,8 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean removeAll( long[] array ) {
|
||||
@Override
|
||||
public boolean removeAll( long[] array ) {
|
||||
boolean changed = false;
|
||||
for ( int i = array.length; i-- > 0; ) {
|
||||
if ( remove( array[i] ) ) {
|
||||
|
@ -1023,13 +1096,15 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void clear() {
|
||||
@Override
|
||||
public void clear() {
|
||||
TIntLongHashMap.this.clear();
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean forEach( TLongProcedure procedure ) {
|
||||
@Override
|
||||
public boolean forEach( TLongProcedure procedure ) {
|
||||
return TIntLongHashMap.this.forEachValue( procedure );
|
||||
}
|
||||
|
||||
|
@ -1041,7 +1116,8 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
forEachValue( new TLongProcedure() {
|
||||
private boolean first = true;
|
||||
|
||||
public boolean execute( long value ) {
|
||||
@Override
|
||||
public boolean execute( long value ) {
|
||||
if ( first ) {
|
||||
first = false;
|
||||
} else {
|
||||
|
@ -1070,13 +1146,15 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int next() {
|
||||
@Override
|
||||
public int next() {
|
||||
moveToNextIndex();
|
||||
return _set[_index];
|
||||
}
|
||||
|
||||
/** @{inheritDoc} */
|
||||
public void remove() {
|
||||
@Override
|
||||
public void remove() {
|
||||
if ( _expectedSize != _hash.size() ) {
|
||||
throw new ConcurrentModificationException();
|
||||
}
|
||||
|
@ -1108,13 +1186,15 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public long next() {
|
||||
@Override
|
||||
public long next() {
|
||||
moveToNextIndex();
|
||||
return _values[_index];
|
||||
}
|
||||
|
||||
/** @{inheritDoc} */
|
||||
public void remove() {
|
||||
@Override
|
||||
public void remove() {
|
||||
if ( _expectedSize != _hash.size() ) {
|
||||
throw new ConcurrentModificationException();
|
||||
}
|
||||
|
@ -1145,29 +1225,34 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void advance() {
|
||||
@Override
|
||||
public void advance() {
|
||||
moveToNextIndex();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int key() {
|
||||
@Override
|
||||
public int key() {
|
||||
return _set[_index];
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public long value() {
|
||||
@Override
|
||||
public long value() {
|
||||
return _values[_index];
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public long setValue( long val ) {
|
||||
@Override
|
||||
public long setValue( long val ) {
|
||||
long old = value();
|
||||
_values[_index] = val;
|
||||
return old;
|
||||
}
|
||||
|
||||
/** @{inheritDoc} */
|
||||
public void remove() {
|
||||
@Override
|
||||
public void remove() {
|
||||
if ( _expectedSize != _hash.size() ) {
|
||||
throw new ConcurrentModificationException();
|
||||
}
|
||||
|
@ -1235,7 +1320,8 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
final StringBuilder buf = new StringBuilder( "{" );
|
||||
forEachEntry( new TIntLongProcedure() {
|
||||
private boolean first = true;
|
||||
public boolean execute( int key, long value ) {
|
||||
@Override
|
||||
public boolean execute( int key, long value ) {
|
||||
if ( first ) first = false;
|
||||
else buf.append( ", " );
|
||||
|
||||
|
@ -1251,7 +1337,8 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void writeExternal(ObjectOutput out) throws IOException {
|
||||
@Override
|
||||
public void writeExternal(ObjectOutput out) throws IOException {
|
||||
// VERSION
|
||||
out.writeByte( 0 );
|
||||
|
||||
|
@ -1272,7 +1359,8 @@ public class TIntLongHashMap extends TIntLongHash implements TIntLongMap, Extern
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
|
||||
@Override
|
||||
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
|
||||
// VERSION
|
||||
in.readByte();
|
||||
|
||||
|
|
|
@ -58,7 +58,8 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
static final long serialVersionUID = 1L;
|
||||
|
||||
private final TIntObjectProcedure<V> PUT_ALL_PROC = new TIntObjectProcedure<V>() {
|
||||
public boolean execute( int key, V value) {
|
||||
@Override
|
||||
public boolean execute( int key, V value) {
|
||||
put( key, value );
|
||||
return true;
|
||||
}
|
||||
|
@ -135,7 +136,8 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
protected int setUp( int initialCapacity ) {
|
||||
int capacity;
|
||||
|
||||
|
@ -146,7 +148,8 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
protected void rehash( int newCapacity ) {
|
||||
int oldCapacity = _set.length;
|
||||
|
||||
|
@ -173,19 +176,22 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
// Query Operations
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int getNoEntryKey() {
|
||||
@Override
|
||||
public int getNoEntryKey() {
|
||||
return no_entry_key;
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsKey( int key ) {
|
||||
@Override
|
||||
public boolean containsKey( int key ) {
|
||||
return contains( key );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsValue( Object val ) {
|
||||
@Override
|
||||
public boolean containsValue( Object val ) {
|
||||
byte[] states = _states;
|
||||
V[] vals = _values;
|
||||
|
||||
|
@ -210,7 +216,8 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public V get( int key ) {
|
||||
@Override
|
||||
public V get( int key ) {
|
||||
int index = index( key );
|
||||
return index < 0 ? null : _values[index];
|
||||
}
|
||||
|
@ -219,14 +226,16 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
// Modification Operations
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public V put( int key, V value ) {
|
||||
@Override
|
||||
public V put( int key, V value ) {
|
||||
int index = insertionIndex( key );
|
||||
return doPut( key, value, index );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public V putIfAbsent( int key, V value ) {
|
||||
@Override
|
||||
public V putIfAbsent( int key, V value ) {
|
||||
int index = insertionIndex( key );
|
||||
if ( index < 0 )
|
||||
return _values[-index - 1];
|
||||
|
@ -257,7 +266,8 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public V remove( int key ) {
|
||||
@Override
|
||||
public V remove( int key ) {
|
||||
V prev = null;
|
||||
int index = index( key );
|
||||
if ( index >= 0 ) {
|
||||
|
@ -269,7 +279,8 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
protected void removeAt( int index ) {
|
||||
@Override
|
||||
protected void removeAt( int index ) {
|
||||
_values[index] = null;
|
||||
super.removeAt( index ); // clear key, state; adjust size
|
||||
}
|
||||
|
@ -278,7 +289,8 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
// Bulk Operations
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void putAll( Map<? extends Integer, ? extends V> map ) {
|
||||
@Override
|
||||
public void putAll( Map<? extends Integer, ? extends V> map ) {
|
||||
Set<? extends Map.Entry<? extends Integer,? extends V>> set = map.entrySet();
|
||||
for ( Map.Entry<? extends Integer,? extends V> entry : set ) {
|
||||
put( entry.getKey(), entry.getValue() );
|
||||
|
@ -287,13 +299,15 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void putAll( TIntObjectMap<V> map ){
|
||||
@Override
|
||||
public void putAll( TIntObjectMap<V> map ){
|
||||
map.forEachEntry( PUT_ALL_PROC );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void clear() {
|
||||
@Override
|
||||
public void clear() {
|
||||
super.clear();
|
||||
Arrays.fill( _set, 0, _set.length, no_entry_key );
|
||||
Arrays.fill( _states, 0, _states.length, FREE );
|
||||
|
@ -304,13 +318,15 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
// Views
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public TIntSet keySet() {
|
||||
@Override
|
||||
public TIntSet keySet() {
|
||||
return new KeyView();
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public int[] keys() {
|
||||
int[] keys = new int[size()];
|
||||
int[] k = _set;
|
||||
|
@ -326,7 +342,8 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public int[] keys( int[] dest ) {
|
||||
if ( dest.length < _size ) {
|
||||
dest = new int[_size];
|
||||
|
@ -345,13 +362,15 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public Collection<V> valueCollection() {
|
||||
@Override
|
||||
public Collection<V> valueCollection() {
|
||||
return new ValueView();
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public V[] values() {
|
||||
V[] vals = ( V[] ) new Object[size()];
|
||||
V[] v = _values;
|
||||
|
@ -367,7 +386,8 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public <T> T[] values( T[] dest ) {
|
||||
if ( dest.length < _size ) {
|
||||
dest = ( T[] ) java.lang.reflect.Array.newInstance(
|
||||
|
@ -387,19 +407,22 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public TIntObjectIterator<V> iterator() {
|
||||
@Override
|
||||
public TIntObjectIterator<V> iterator() {
|
||||
return new TIntObjectHashIterator<V>( this );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean forEachKey( TIntProcedure procedure ) {
|
||||
@Override
|
||||
public boolean forEachKey( TIntProcedure procedure ) {
|
||||
return forEach( procedure );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean forEachValue( TObjectProcedure<V> procedure ) {
|
||||
@Override
|
||||
public boolean forEachValue( TObjectProcedure<V> procedure ) {
|
||||
byte[] states = _states;
|
||||
V[] values = _values;
|
||||
for ( int i = values.length; i-- > 0; ) {
|
||||
|
@ -412,7 +435,8 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public boolean forEachEntry( TIntObjectProcedure<V> procedure ) {
|
||||
byte[] states = _states;
|
||||
int[] keys = _set;
|
||||
|
@ -427,7 +451,8 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public boolean retainEntries( TIntObjectProcedure<V> procedure ) {
|
||||
boolean modified = false;
|
||||
byte[] states = _states;
|
||||
|
@ -453,7 +478,8 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void transformValues( TObjectFunction<V,V> function ) {
|
||||
@Override
|
||||
public void transformValues( TObjectFunction<V,V> function ) {
|
||||
byte[] states = _states;
|
||||
V[] values = _values;
|
||||
for ( int i = values.length; i-- > 0; ) {
|
||||
|
@ -467,7 +493,8 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
// Comparison and hashing
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean equals( Object other ) {
|
||||
@Override
|
||||
public boolean equals( Object other ) {
|
||||
if ( ! ( other instanceof TIntObjectMap ) ) {
|
||||
return false;
|
||||
}
|
||||
|
@ -499,7 +526,8 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int hashCode() {
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hashcode = 0;
|
||||
V[] values = _values;
|
||||
byte[] states = _states;
|
||||
|
@ -516,52 +544,62 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
class KeyView implements TIntSet {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int getNoEntryValue() {
|
||||
@Override
|
||||
public int getNoEntryValue() {
|
||||
return no_entry_key;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int size() {
|
||||
@Override
|
||||
public int size() {
|
||||
return _size;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean isEmpty() {
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return _size == 0;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean contains( int entry ) {
|
||||
@Override
|
||||
public boolean contains( int entry ) {
|
||||
return TIntObjectHashMap.this.containsKey( entry );
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public TIntIterator iterator() {
|
||||
@Override
|
||||
public TIntIterator iterator() {
|
||||
return new TIntHashIterator( TIntObjectHashMap.this );
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int[] toArray() {
|
||||
@Override
|
||||
public int[] toArray() {
|
||||
return keys();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int[] toArray( int[] dest ) {
|
||||
@Override
|
||||
public int[] toArray( int[] dest ) {
|
||||
return keys( dest );
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean add( int entry ) {
|
||||
@Override
|
||||
public boolean add( int entry ) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean remove( int entry ) {
|
||||
@Override
|
||||
public boolean remove( int entry ) {
|
||||
return null != TIntObjectHashMap.this.remove( entry );
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsAll( Collection<?> collection ) {
|
||||
@Override
|
||||
public boolean containsAll( Collection<?> collection ) {
|
||||
for ( Object element : collection ) {
|
||||
if ( ! TIntObjectHashMap.this.containsKey( ( ( Integer ) element ).intValue() ) ) {
|
||||
return false;
|
||||
|
@ -571,7 +609,8 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsAll( TIntCollection collection ) {
|
||||
@Override
|
||||
public boolean containsAll( TIntCollection collection ) {
|
||||
if ( collection == this ) {
|
||||
return true;
|
||||
}
|
||||
|
@ -585,7 +624,8 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsAll( int[] array ) {
|
||||
@Override
|
||||
public boolean containsAll( int[] array ) {
|
||||
for ( int element : array ) {
|
||||
if ( ! TIntObjectHashMap.this.containsKey( element ) ) {
|
||||
return false;
|
||||
|
@ -595,22 +635,26 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean addAll( Collection<? extends Integer> collection ) {
|
||||
@Override
|
||||
public boolean addAll( Collection<? extends Integer> collection ) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean addAll( TIntCollection collection ) {
|
||||
@Override
|
||||
public boolean addAll( TIntCollection collection ) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean addAll( int[] array ) {
|
||||
@Override
|
||||
public boolean addAll( int[] array ) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean retainAll( Collection<?> collection ) {
|
||||
@Override
|
||||
public boolean retainAll( Collection<?> collection ) {
|
||||
boolean modified = false;
|
||||
TIntIterator iter = iterator();
|
||||
while ( iter.hasNext() ) {
|
||||
|
@ -624,7 +668,8 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean retainAll( TIntCollection collection ) {
|
||||
@Override
|
||||
public boolean retainAll( TIntCollection collection ) {
|
||||
if ( this == collection ) {
|
||||
return false;
|
||||
}
|
||||
|
@ -640,7 +685,8 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean retainAll( int[] array ) {
|
||||
@Override
|
||||
public boolean retainAll( int[] array ) {
|
||||
boolean changed = false;
|
||||
Arrays.sort( array );
|
||||
int[] set = _set;
|
||||
|
@ -656,7 +702,8 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean removeAll( Collection<?> collection ) {
|
||||
@Override
|
||||
public boolean removeAll( Collection<?> collection ) {
|
||||
boolean changed = false;
|
||||
for ( Object element : collection ) {
|
||||
if ( element instanceof Integer ) {
|
||||
|
@ -670,7 +717,8 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean removeAll( TIntCollection collection ) {
|
||||
@Override
|
||||
public boolean removeAll( TIntCollection collection ) {
|
||||
if ( collection == this ) {
|
||||
clear();
|
||||
return true;
|
||||
|
@ -687,7 +735,8 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean removeAll( int[] array ) {
|
||||
@Override
|
||||
public boolean removeAll( int[] array ) {
|
||||
boolean changed = false;
|
||||
for ( int i = array.length; i-- > 0; ) {
|
||||
if ( remove(array[i]) ) {
|
||||
|
@ -698,17 +747,20 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void clear() {
|
||||
@Override
|
||||
public void clear() {
|
||||
TIntObjectHashMap.this.clear();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean forEach( TIntProcedure procedure ) {
|
||||
@Override
|
||||
public boolean forEach( TIntProcedure procedure ) {
|
||||
return TIntObjectHashMap.this.forEachKey( procedure );
|
||||
}
|
||||
|
||||
/** {@inheritDoc) */
|
||||
public boolean equals( Object other ) {
|
||||
@Override
|
||||
public boolean equals( Object other ) {
|
||||
if (! ( other instanceof TIntSet ) ) {
|
||||
return false;
|
||||
}
|
||||
|
@ -727,7 +779,8 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int hashCode() {
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hashcode = 0;
|
||||
for ( int i = _states.length; i-- > 0; ) {
|
||||
if ( _states[i] == FULL ) {
|
||||
|
@ -738,7 +791,8 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public String toString() {
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder buf = new StringBuilder("{");
|
||||
boolean first = true;
|
||||
for ( int i = _states.length; i-- > 0; ) {
|
||||
|
@ -764,7 +818,8 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int next() {
|
||||
@Override
|
||||
public int next() {
|
||||
moveToNextIndex();
|
||||
return _hash._set[_index];
|
||||
}
|
||||
|
@ -775,20 +830,24 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
/** a view onto the values of the map. */
|
||||
protected class ValueView extends MapBackedView<V> {
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public Iterator<V> iterator() {
|
||||
return new TIntObjectValueHashIterator( TIntObjectHashMap.this ) {
|
||||
protected V objectAtIndex( int index ) {
|
||||
@Override
|
||||
protected V objectAtIndex( int index ) {
|
||||
return _values[index];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public boolean containsElement( V value ) {
|
||||
@Override
|
||||
public boolean containsElement( V value ) {
|
||||
return containsValue( value );
|
||||
}
|
||||
|
||||
public boolean removeElement( V value ) {
|
||||
@Override
|
||||
public boolean removeElement( V value ) {
|
||||
V[] values = _values;
|
||||
byte[] states = _states;
|
||||
|
||||
|
@ -824,7 +883,8 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public V next() {
|
||||
moveToNextIndex();
|
||||
return ( V ) _map._values[_index];
|
||||
|
@ -836,35 +896,42 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
private abstract class MapBackedView<E> extends AbstractSet<E>
|
||||
implements Set<E>, Iterable<E> {
|
||||
|
||||
public abstract Iterator<E> iterator();
|
||||
@Override
|
||||
public abstract Iterator<E> iterator();
|
||||
|
||||
public abstract boolean removeElement( E key );
|
||||
|
||||
public abstract boolean containsElement( E key );
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public boolean contains( Object key ) {
|
||||
return containsElement( (E) key );
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public boolean remove( Object o ) {
|
||||
return removeElement( (E) o );
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
@Override
|
||||
public void clear() {
|
||||
TIntObjectHashMap.this.clear();
|
||||
}
|
||||
|
||||
public boolean add( E obj ) {
|
||||
@Override
|
||||
public boolean add( E obj ) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public int size() {
|
||||
@Override
|
||||
public int size() {
|
||||
return TIntObjectHashMap.this.size();
|
||||
}
|
||||
|
||||
public Object[] toArray() {
|
||||
@Override
|
||||
public Object[] toArray() {
|
||||
Object[] result = new Object[size()];
|
||||
Iterator<E> e = iterator();
|
||||
for ( int i = 0; e.hasNext(); i++ ) {
|
||||
|
@ -873,7 +940,8 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
return result;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public <T> T[] toArray( T[] a ) {
|
||||
int size = size();
|
||||
if ( a.length < size ) {
|
||||
|
@ -893,15 +961,18 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
return a;
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return TIntObjectHashMap.this.isEmpty();
|
||||
}
|
||||
|
||||
public boolean addAll( Collection<? extends E> collection ) {
|
||||
@Override
|
||||
public boolean addAll( Collection<? extends E> collection ) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@SuppressWarnings({"SuspiciousMethodCalls"})
|
||||
@Override
|
||||
@SuppressWarnings({"SuspiciousMethodCalls"})
|
||||
public boolean retainAll( Collection<?> collection ) {
|
||||
boolean changed = false;
|
||||
Iterator<E> i = iterator();
|
||||
|
@ -933,22 +1004,26 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void advance() {
|
||||
@Override
|
||||
public void advance() {
|
||||
moveToNextIndex();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int key() {
|
||||
@Override
|
||||
public int key() {
|
||||
return _map._set[_index];
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public V value() {
|
||||
@Override
|
||||
public V value() {
|
||||
return _map._values[_index];
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public V setValue( V val ) {
|
||||
@Override
|
||||
public V setValue( V val ) {
|
||||
V old = value();
|
||||
_map._values[_index] = val;
|
||||
return old;
|
||||
|
@ -956,7 +1031,8 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
}
|
||||
|
||||
|
||||
public void writeExternal( ObjectOutput out ) throws IOException {
|
||||
@Override
|
||||
public void writeExternal( ObjectOutput out ) throws IOException {
|
||||
// VERSION
|
||||
out.writeByte( 0 );
|
||||
|
||||
|
@ -979,7 +1055,8 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public void readExternal( ObjectInput in )
|
||||
throws IOException, ClassNotFoundException {
|
||||
|
||||
|
@ -1005,11 +1082,13 @@ public class TIntObjectHashMap<V> extends TIntHash implements
|
|||
}
|
||||
|
||||
|
||||
public String toString() {
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder buf = new StringBuilder("{");
|
||||
forEachEntry(new TIntObjectProcedure<V>() {
|
||||
private boolean first = true;
|
||||
public boolean execute(int key, Object value) {
|
||||
@Override
|
||||
public boolean execute(int key, Object value) {
|
||||
if ( first ) first = false;
|
||||
else buf.append( "," );
|
||||
|
||||
|
|
|
@ -57,7 +57,8 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
static final long serialVersionUID = 1L;
|
||||
|
||||
private final TLongObjectProcedure<V> PUT_ALL_PROC = new TLongObjectProcedure<V>() {
|
||||
public boolean execute( long key, V value) {
|
||||
@Override
|
||||
public boolean execute( long key, V value) {
|
||||
put( key, value );
|
||||
return true;
|
||||
}
|
||||
|
@ -134,7 +135,8 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
protected int setUp( int initialCapacity ) {
|
||||
int capacity;
|
||||
|
||||
|
@ -145,7 +147,8 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
protected void rehash( int newCapacity ) {
|
||||
int oldCapacity = _set.length;
|
||||
|
||||
|
@ -172,19 +175,22 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
// Query Operations
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public long getNoEntryKey() {
|
||||
@Override
|
||||
public long getNoEntryKey() {
|
||||
return no_entry_key;
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsKey( long key ) {
|
||||
@Override
|
||||
public boolean containsKey( long key ) {
|
||||
return contains( key );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsValue( Object val ) {
|
||||
@Override
|
||||
public boolean containsValue( Object val ) {
|
||||
byte[] states = _states;
|
||||
V[] vals = _values;
|
||||
|
||||
|
@ -209,7 +215,8 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public V get( long key ) {
|
||||
@Override
|
||||
public V get( long key ) {
|
||||
int index = index( key );
|
||||
return index < 0 ? null : _values[index];
|
||||
}
|
||||
|
@ -218,14 +225,16 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
// Modification Operations
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public V put( long key, V value ) {
|
||||
@Override
|
||||
public V put( long key, V value ) {
|
||||
int index = insertionIndex( key );
|
||||
return doPut( key, value, index );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public V putIfAbsent( long key, V value ) {
|
||||
@Override
|
||||
public V putIfAbsent( long key, V value ) {
|
||||
int index = insertionIndex( key );
|
||||
if ( index < 0 )
|
||||
return _values[-index - 1];
|
||||
|
@ -256,7 +265,8 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public V remove( long key ) {
|
||||
@Override
|
||||
public V remove( long key ) {
|
||||
V prev = null;
|
||||
int index = index( key );
|
||||
if ( index >= 0 ) {
|
||||
|
@ -268,7 +278,8 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
protected void removeAt( int index ) {
|
||||
@Override
|
||||
protected void removeAt( int index ) {
|
||||
_values[index] = null;
|
||||
super.removeAt( index ); // clear key, state; adjust size
|
||||
}
|
||||
|
@ -277,7 +288,8 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
// Bulk Operations
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void putAll( Map<? extends Long, ? extends V> map ) {
|
||||
@Override
|
||||
public void putAll( Map<? extends Long, ? extends V> map ) {
|
||||
Set<? extends Map.Entry<? extends Long,? extends V>> set = map.entrySet();
|
||||
for ( Map.Entry<? extends Long,? extends V> entry : set ) {
|
||||
put( entry.getKey(), entry.getValue() );
|
||||
|
@ -286,13 +298,15 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void putAll( TLongObjectMap<V> map ){
|
||||
@Override
|
||||
public void putAll( TLongObjectMap<V> map ){
|
||||
map.forEachEntry( PUT_ALL_PROC );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void clear() {
|
||||
@Override
|
||||
public void clear() {
|
||||
super.clear();
|
||||
Arrays.fill( _set, 0, _set.length, no_entry_key );
|
||||
Arrays.fill( _states, 0, _states.length, FREE );
|
||||
|
@ -303,13 +317,15 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
// Views
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public TLongSet keySet() {
|
||||
@Override
|
||||
public TLongSet keySet() {
|
||||
return new KeyView();
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public long[] keys() {
|
||||
long[] keys = new long[size()];
|
||||
long[] k = _set;
|
||||
|
@ -325,7 +341,8 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public long[] keys( long[] dest ) {
|
||||
if ( dest.length < _size ) {
|
||||
dest = new long[_size];
|
||||
|
@ -344,13 +361,15 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public Collection<V> valueCollection() {
|
||||
@Override
|
||||
public Collection<V> valueCollection() {
|
||||
return new ValueView();
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public V[] values() {
|
||||
V[] vals = ( V[] ) new Object[size()];
|
||||
V[] v = _values;
|
||||
|
@ -366,7 +385,8 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public <T> T[] values( T[] dest ) {
|
||||
if ( dest.length < _size ) {
|
||||
dest = ( T[] ) java.lang.reflect.Array.newInstance(
|
||||
|
@ -386,19 +406,22 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public TLongObjectIterator<V> iterator() {
|
||||
@Override
|
||||
public TLongObjectIterator<V> iterator() {
|
||||
return new TLongObjectHashIterator<V>( this );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean forEachKey( TLongProcedure procedure ) {
|
||||
@Override
|
||||
public boolean forEachKey( TLongProcedure procedure ) {
|
||||
return forEach( procedure );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean forEachValue( TObjectProcedure<V> procedure ) {
|
||||
@Override
|
||||
public boolean forEachValue( TObjectProcedure<V> procedure ) {
|
||||
byte[] states = _states;
|
||||
V[] values = _values;
|
||||
for ( int i = values.length; i-- > 0; ) {
|
||||
|
@ -411,7 +434,8 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public boolean forEachEntry( TLongObjectProcedure<V> procedure ) {
|
||||
byte[] states = _states;
|
||||
long[] keys = _set;
|
||||
|
@ -426,7 +450,8 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public boolean retainEntries( TLongObjectProcedure<V> procedure ) {
|
||||
boolean modified = false;
|
||||
byte[] states = _states;
|
||||
|
@ -452,7 +477,8 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void transformValues( TObjectFunction<V,V> function ) {
|
||||
@Override
|
||||
public void transformValues( TObjectFunction<V,V> function ) {
|
||||
byte[] states = _states;
|
||||
V[] values = _values;
|
||||
for ( int i = values.length; i-- > 0; ) {
|
||||
|
@ -466,7 +492,8 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
// Comparison and hashing
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean equals( Object other ) {
|
||||
@Override
|
||||
public boolean equals( Object other ) {
|
||||
if ( ! ( other instanceof TLongObjectMap ) ) {
|
||||
return false;
|
||||
}
|
||||
|
@ -498,7 +525,8 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int hashCode() {
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hashcode = 0;
|
||||
V[] values = _values;
|
||||
byte[] states = _states;
|
||||
|
@ -515,52 +543,62 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
class KeyView implements TLongSet {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public long getNoEntryValue() {
|
||||
@Override
|
||||
public long getNoEntryValue() {
|
||||
return no_entry_key;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int size() {
|
||||
@Override
|
||||
public int size() {
|
||||
return _size;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean isEmpty() {
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return _size == 0;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean contains( long entry ) {
|
||||
@Override
|
||||
public boolean contains( long entry ) {
|
||||
return TLongObjectHashMap.this.containsKey( entry );
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public TLongIterator iterator() {
|
||||
@Override
|
||||
public TLongIterator iterator() {
|
||||
return new TLongHashIterator( TLongObjectHashMap.this );
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public long[] toArray() {
|
||||
@Override
|
||||
public long[] toArray() {
|
||||
return keys();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public long[] toArray( long[] dest ) {
|
||||
@Override
|
||||
public long[] toArray( long[] dest ) {
|
||||
return keys( dest );
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean add( long entry ) {
|
||||
@Override
|
||||
public boolean add( long entry ) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean remove( long entry ) {
|
||||
@Override
|
||||
public boolean remove( long entry ) {
|
||||
return null != TLongObjectHashMap.this.remove( entry );
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsAll( Collection<?> collection ) {
|
||||
@Override
|
||||
public boolean containsAll( Collection<?> collection ) {
|
||||
for ( Object element : collection ) {
|
||||
if ( ! TLongObjectHashMap.this.containsKey( ( ( Long ) element ).longValue() ) ) {
|
||||
return false;
|
||||
|
@ -570,7 +608,8 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsAll( TLongCollection collection ) {
|
||||
@Override
|
||||
public boolean containsAll( TLongCollection collection ) {
|
||||
if ( collection == this ) {
|
||||
return true;
|
||||
}
|
||||
|
@ -584,7 +623,8 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsAll( long[] array ) {
|
||||
@Override
|
||||
public boolean containsAll( long[] array ) {
|
||||
for ( long element : array ) {
|
||||
if ( ! TLongObjectHashMap.this.containsKey( element ) ) {
|
||||
return false;
|
||||
|
@ -594,22 +634,26 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean addAll( Collection<? extends Long> collection ) {
|
||||
@Override
|
||||
public boolean addAll( Collection<? extends Long> collection ) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean addAll( TLongCollection collection ) {
|
||||
@Override
|
||||
public boolean addAll( TLongCollection collection ) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean addAll( long[] array ) {
|
||||
@Override
|
||||
public boolean addAll( long[] array ) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean retainAll( Collection<?> collection ) {
|
||||
@Override
|
||||
public boolean retainAll( Collection<?> collection ) {
|
||||
boolean modified = false;
|
||||
TLongIterator iter = iterator();
|
||||
while ( iter.hasNext() ) {
|
||||
|
@ -623,7 +667,8 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean retainAll( TLongCollection collection ) {
|
||||
@Override
|
||||
public boolean retainAll( TLongCollection collection ) {
|
||||
if ( this == collection ) {
|
||||
return false;
|
||||
}
|
||||
|
@ -639,7 +684,8 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean retainAll( long[] array ) {
|
||||
@Override
|
||||
public boolean retainAll( long[] array ) {
|
||||
boolean changed = false;
|
||||
Arrays.sort( array );
|
||||
long[] set = _set;
|
||||
|
@ -655,7 +701,8 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean removeAll( Collection<?> collection ) {
|
||||
@Override
|
||||
public boolean removeAll( Collection<?> collection ) {
|
||||
boolean changed = false;
|
||||
for ( Object element : collection ) {
|
||||
if ( element instanceof Long ) {
|
||||
|
@ -669,7 +716,8 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean removeAll( TLongCollection collection ) {
|
||||
@Override
|
||||
public boolean removeAll( TLongCollection collection ) {
|
||||
if ( collection == this ) {
|
||||
clear();
|
||||
return true;
|
||||
|
@ -686,7 +734,8 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean removeAll( long[] array ) {
|
||||
@Override
|
||||
public boolean removeAll( long[] array ) {
|
||||
boolean changed = false;
|
||||
for ( int i = array.length; i-- > 0; ) {
|
||||
if ( remove(array[i]) ) {
|
||||
|
@ -697,17 +746,20 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void clear() {
|
||||
@Override
|
||||
public void clear() {
|
||||
TLongObjectHashMap.this.clear();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean forEach( TLongProcedure procedure ) {
|
||||
@Override
|
||||
public boolean forEach( TLongProcedure procedure ) {
|
||||
return TLongObjectHashMap.this.forEachKey( procedure );
|
||||
}
|
||||
|
||||
/** {@inheritDoc) */
|
||||
public boolean equals( Object other ) {
|
||||
@Override
|
||||
public boolean equals( Object other ) {
|
||||
if (! ( other instanceof TLongSet ) ) {
|
||||
return false;
|
||||
}
|
||||
|
@ -726,7 +778,8 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int hashCode() {
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hashcode = 0;
|
||||
for ( int i = _states.length; i-- > 0; ) {
|
||||
if ( _states[i] == FULL ) {
|
||||
|
@ -737,7 +790,8 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public String toString() {
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder buf = new StringBuilder("{");
|
||||
boolean first = true;
|
||||
for ( int i = _states.length; i-- > 0; ) {
|
||||
|
@ -763,7 +817,8 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public long next() {
|
||||
@Override
|
||||
public long next() {
|
||||
moveToNextIndex();
|
||||
return _hash._set[_index];
|
||||
}
|
||||
|
@ -774,20 +829,24 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
/** a view onto the values of the map. */
|
||||
protected class ValueView extends MapBackedView<V> {
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public Iterator<V> iterator() {
|
||||
return new TLongObjectValueHashIterator( TLongObjectHashMap.this ) {
|
||||
protected V objectAtIndex( int index ) {
|
||||
@Override
|
||||
protected V objectAtIndex( int index ) {
|
||||
return _values[index];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public boolean containsElement( V value ) {
|
||||
@Override
|
||||
public boolean containsElement( V value ) {
|
||||
return containsValue( value );
|
||||
}
|
||||
|
||||
public boolean removeElement( V value ) {
|
||||
@Override
|
||||
public boolean removeElement( V value ) {
|
||||
V[] values = _values;
|
||||
byte[] states = _states;
|
||||
|
||||
|
@ -823,7 +882,8 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public V next() {
|
||||
moveToNextIndex();
|
||||
return ( V ) _map._values[_index];
|
||||
|
@ -835,35 +895,42 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
private abstract class MapBackedView<E> extends AbstractSet<E>
|
||||
implements Set<E>, Iterable<E> {
|
||||
|
||||
public abstract Iterator<E> iterator();
|
||||
@Override
|
||||
public abstract Iterator<E> iterator();
|
||||
|
||||
public abstract boolean removeElement( E key );
|
||||
|
||||
public abstract boolean containsElement( E key );
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public boolean contains( Object key ) {
|
||||
return containsElement( (E) key );
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public boolean remove( Object o ) {
|
||||
return removeElement( (E) o );
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
@Override
|
||||
public void clear() {
|
||||
TLongObjectHashMap.this.clear();
|
||||
}
|
||||
|
||||
public boolean add( E obj ) {
|
||||
@Override
|
||||
public boolean add( E obj ) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public int size() {
|
||||
@Override
|
||||
public int size() {
|
||||
return TLongObjectHashMap.this.size();
|
||||
}
|
||||
|
||||
public Object[] toArray() {
|
||||
@Override
|
||||
public Object[] toArray() {
|
||||
Object[] result = new Object[size()];
|
||||
Iterator<E> e = iterator();
|
||||
for ( int i = 0; e.hasNext(); i++ ) {
|
||||
|
@ -872,7 +939,8 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
return result;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public <T> T[] toArray( T[] a ) {
|
||||
int size = size();
|
||||
if ( a.length < size ) {
|
||||
|
@ -892,15 +960,18 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
return a;
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return TLongObjectHashMap.this.isEmpty();
|
||||
}
|
||||
|
||||
public boolean addAll( Collection<? extends E> collection ) {
|
||||
@Override
|
||||
public boolean addAll( Collection<? extends E> collection ) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@SuppressWarnings({"SuspiciousMethodCalls"})
|
||||
@Override
|
||||
@SuppressWarnings({"SuspiciousMethodCalls"})
|
||||
public boolean retainAll( Collection<?> collection ) {
|
||||
boolean changed = false;
|
||||
Iterator<E> i = iterator();
|
||||
|
@ -932,22 +1003,26 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void advance() {
|
||||
@Override
|
||||
public void advance() {
|
||||
moveToNextIndex();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public long key() {
|
||||
@Override
|
||||
public long key() {
|
||||
return _map._set[_index];
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public V value() {
|
||||
@Override
|
||||
public V value() {
|
||||
return _map._values[_index];
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public V setValue( V val ) {
|
||||
@Override
|
||||
public V setValue( V val ) {
|
||||
V old = value();
|
||||
_map._values[_index] = val;
|
||||
return old;
|
||||
|
@ -955,7 +1030,8 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
}
|
||||
|
||||
|
||||
public void writeExternal( ObjectOutput out ) throws IOException {
|
||||
@Override
|
||||
public void writeExternal( ObjectOutput out ) throws IOException {
|
||||
// VERSION
|
||||
out.writeByte( 0 );
|
||||
|
||||
|
@ -978,7 +1054,8 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public void readExternal( ObjectInput in )
|
||||
throws IOException, ClassNotFoundException {
|
||||
|
||||
|
@ -1004,11 +1081,13 @@ public class TLongObjectHashMap<V> extends TLongHash implements
|
|||
}
|
||||
|
||||
|
||||
public String toString() {
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder buf = new StringBuilder("{");
|
||||
forEachEntry(new TLongObjectProcedure<V>() {
|
||||
private boolean first = true;
|
||||
public boolean execute(long key, Object value) {
|
||||
@Override
|
||||
public boolean execute(long key, Object value) {
|
||||
if ( first ) first = false;
|
||||
else buf.append( "," );
|
||||
|
||||
|
|
|
@ -53,7 +53,8 @@ public interface TFloatSet extends TFloatCollection, Serializable {
|
|||
*
|
||||
* @return the value that represents null
|
||||
*/
|
||||
float getNoEntryValue();
|
||||
@Override
|
||||
float getNoEntryValue();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -63,7 +64,8 @@ public interface TFloatSet extends TFloatCollection, Serializable {
|
|||
*
|
||||
* @return the number of elements in this set (its cardinality)
|
||||
*/
|
||||
int size();
|
||||
@Override
|
||||
int size();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -71,7 +73,8 @@ public interface TFloatSet extends TFloatCollection, Serializable {
|
|||
*
|
||||
* @return <tt>true</tt> if this set contains no elements
|
||||
*/
|
||||
boolean isEmpty();
|
||||
@Override
|
||||
boolean isEmpty();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -80,7 +83,8 @@ public interface TFloatSet extends TFloatCollection, Serializable {
|
|||
* @param entry an <code>float</code> value
|
||||
* @return true if the set contains the specified element.
|
||||
*/
|
||||
boolean contains( float entry );
|
||||
@Override
|
||||
boolean contains( float entry );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -89,7 +93,8 @@ public interface TFloatSet extends TFloatCollection, Serializable {
|
|||
*
|
||||
* @return an <code>TFloatIterator</code> value
|
||||
*/
|
||||
TFloatIterator iterator();
|
||||
@Override
|
||||
TFloatIterator iterator();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -108,7 +113,8 @@ public interface TFloatSet extends TFloatCollection, Serializable {
|
|||
*
|
||||
* @return an array containing all the elements in this set
|
||||
*/
|
||||
float[] toArray();
|
||||
@Override
|
||||
float[] toArray();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -134,7 +140,8 @@ public interface TFloatSet extends TFloatCollection, Serializable {
|
|||
* @return an <tt>float[]</tt> containing all the elements in this set
|
||||
* @throws NullPointerException if the specified array is null
|
||||
*/
|
||||
float[] toArray( float[] dest );
|
||||
@Override
|
||||
float[] toArray( float[] dest );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -143,7 +150,8 @@ public interface TFloatSet extends TFloatCollection, Serializable {
|
|||
* @param entry a <code>float</code> value
|
||||
* @return true if the set was modified by the add operation
|
||||
*/
|
||||
boolean add( float entry );
|
||||
@Override
|
||||
boolean add( float entry );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -152,7 +160,8 @@ public interface TFloatSet extends TFloatCollection, Serializable {
|
|||
* @param entry an <code>float</code> value
|
||||
* @return true if the set was modified by the remove operation.
|
||||
*/
|
||||
boolean remove( float entry );
|
||||
@Override
|
||||
boolean remove( float entry );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -162,7 +171,8 @@ public interface TFloatSet extends TFloatCollection, Serializable {
|
|||
* @param collection a <code>Collection</code> value
|
||||
* @return true if all elements were present in the set.
|
||||
*/
|
||||
boolean containsAll( Collection<?> collection );
|
||||
@Override
|
||||
boolean containsAll( Collection<?> collection );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -172,7 +182,8 @@ public interface TFloatSet extends TFloatCollection, Serializable {
|
|||
* @param collection a <code>TFloatCollection</code> value
|
||||
* @return true if all elements were present in the set.
|
||||
*/
|
||||
boolean containsAll( TFloatCollection collection );
|
||||
@Override
|
||||
boolean containsAll( TFloatCollection collection );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -182,7 +193,8 @@ public interface TFloatSet extends TFloatCollection, Serializable {
|
|||
* @param array as <code>array</code> of float primitives.
|
||||
* @return true if all elements were present in the set.
|
||||
*/
|
||||
boolean containsAll( float[] array );
|
||||
@Override
|
||||
boolean containsAll( float[] array );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -191,7 +203,8 @@ public interface TFloatSet extends TFloatCollection, Serializable {
|
|||
* @param collection a <code>Collection</code> value
|
||||
* @return true if the set was modified by the add all operation.
|
||||
*/
|
||||
boolean addAll( Collection<? extends Float> collection );
|
||||
@Override
|
||||
boolean addAll( Collection<? extends Float> collection );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -200,7 +213,8 @@ public interface TFloatSet extends TFloatCollection, Serializable {
|
|||
* @param collection a <code>TFloatCollection</code> value
|
||||
* @return true if the set was modified by the add all operation.
|
||||
*/
|
||||
boolean addAll( TFloatCollection collection );
|
||||
@Override
|
||||
boolean addAll( TFloatCollection collection );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -209,7 +223,8 @@ public interface TFloatSet extends TFloatCollection, Serializable {
|
|||
* @param array a <code>array</code> of float primitives.
|
||||
* @return true if the set was modified by the add all operation.
|
||||
*/
|
||||
boolean addAll( float[] array );
|
||||
@Override
|
||||
boolean addAll( float[] array );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -219,7 +234,8 @@ public interface TFloatSet extends TFloatCollection, Serializable {
|
|||
* @param collection a <code>Collection</code> value
|
||||
* @return true if the set was modified by the retain all operation
|
||||
*/
|
||||
boolean retainAll( Collection<?> collection );
|
||||
@Override
|
||||
boolean retainAll( Collection<?> collection );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -229,7 +245,8 @@ public interface TFloatSet extends TFloatCollection, Serializable {
|
|||
* @param collection a <code>TFloatCollection</code> value
|
||||
* @return true if the set was modified by the retain all operation
|
||||
*/
|
||||
boolean retainAll( TFloatCollection collection );
|
||||
@Override
|
||||
boolean retainAll( TFloatCollection collection );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -239,7 +256,8 @@ public interface TFloatSet extends TFloatCollection, Serializable {
|
|||
* @param array an <code>array</code> of float primitives.
|
||||
* @return true if the set was modified by the retain all operation
|
||||
*/
|
||||
boolean retainAll( float[] array );
|
||||
@Override
|
||||
boolean retainAll( float[] array );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -248,7 +266,8 @@ public interface TFloatSet extends TFloatCollection, Serializable {
|
|||
* @param collection a <code>Collection</code> value
|
||||
* @return true if the set was modified by the remove all operation.
|
||||
*/
|
||||
boolean removeAll( Collection<?> collection );
|
||||
@Override
|
||||
boolean removeAll( Collection<?> collection );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -257,7 +276,8 @@ public interface TFloatSet extends TFloatCollection, Serializable {
|
|||
* @param collection a <code>TFloatCollection</code> value
|
||||
* @return true if the set was modified by the remove all operation.
|
||||
*/
|
||||
boolean removeAll( TFloatCollection collection );
|
||||
@Override
|
||||
boolean removeAll( TFloatCollection collection );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -266,13 +286,15 @@ public interface TFloatSet extends TFloatCollection, Serializable {
|
|||
* @param array an <code>array</code> of float primitives.
|
||||
* @return true if the set was modified by the remove all operation.
|
||||
*/
|
||||
public boolean removeAll( float[] array );
|
||||
@Override
|
||||
public boolean removeAll( float[] array );
|
||||
|
||||
|
||||
/**
|
||||
* Empties the set.
|
||||
*/
|
||||
void clear();
|
||||
@Override
|
||||
void clear();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -282,7 +304,8 @@ public interface TFloatSet extends TFloatCollection, Serializable {
|
|||
* @return false if the loop over the set terminated because
|
||||
* the procedure returned false for some value.
|
||||
*/
|
||||
boolean forEach( TFloatProcedure procedure );
|
||||
@Override
|
||||
boolean forEach( TFloatProcedure procedure );
|
||||
|
||||
|
||||
// Comparison and hashing
|
||||
|
@ -299,7 +322,8 @@ public interface TFloatSet extends TFloatCollection, Serializable {
|
|||
* @param o object to be compared for equality with this set
|
||||
* @return <tt>true</tt> if the specified object is equal to this set
|
||||
*/
|
||||
boolean equals( Object o );
|
||||
@Override
|
||||
boolean equals( Object o );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -314,7 +338,8 @@ public interface TFloatSet extends TFloatCollection, Serializable {
|
|||
* @see Object#equals(Object)
|
||||
* @see Set#equals(Object)
|
||||
*/
|
||||
int hashCode();
|
||||
@Override
|
||||
int hashCode();
|
||||
|
||||
|
||||
} // THashSet
|
||||
|
|
|
@ -53,7 +53,8 @@ public interface TIntSet extends TIntCollection, Serializable {
|
|||
*
|
||||
* @return the value that represents null
|
||||
*/
|
||||
int getNoEntryValue();
|
||||
@Override
|
||||
int getNoEntryValue();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -63,7 +64,8 @@ public interface TIntSet extends TIntCollection, Serializable {
|
|||
*
|
||||
* @return the number of elements in this set (its cardinality)
|
||||
*/
|
||||
int size();
|
||||
@Override
|
||||
int size();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -71,7 +73,8 @@ public interface TIntSet extends TIntCollection, Serializable {
|
|||
*
|
||||
* @return <tt>true</tt> if this set contains no elements
|
||||
*/
|
||||
boolean isEmpty();
|
||||
@Override
|
||||
boolean isEmpty();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -80,7 +83,8 @@ public interface TIntSet extends TIntCollection, Serializable {
|
|||
* @param entry an <code>int</code> value
|
||||
* @return true if the set contains the specified element.
|
||||
*/
|
||||
boolean contains( int entry );
|
||||
@Override
|
||||
boolean contains( int entry );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -89,7 +93,8 @@ public interface TIntSet extends TIntCollection, Serializable {
|
|||
*
|
||||
* @return an <code>TIntIterator</code> value
|
||||
*/
|
||||
TIntIterator iterator();
|
||||
@Override
|
||||
TIntIterator iterator();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -108,7 +113,8 @@ public interface TIntSet extends TIntCollection, Serializable {
|
|||
*
|
||||
* @return an array containing all the elements in this set
|
||||
*/
|
||||
int[] toArray();
|
||||
@Override
|
||||
int[] toArray();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -134,7 +140,8 @@ public interface TIntSet extends TIntCollection, Serializable {
|
|||
* @return an <tt>int[]</tt> containing all the elements in this set
|
||||
* @throws NullPointerException if the specified array is null
|
||||
*/
|
||||
int[] toArray( int[] dest );
|
||||
@Override
|
||||
int[] toArray( int[] dest );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -143,7 +150,8 @@ public interface TIntSet extends TIntCollection, Serializable {
|
|||
* @param entry a <code>int</code> value
|
||||
* @return true if the set was modified by the add operation
|
||||
*/
|
||||
boolean add( int entry );
|
||||
@Override
|
||||
boolean add( int entry );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -152,7 +160,8 @@ public interface TIntSet extends TIntCollection, Serializable {
|
|||
* @param entry an <code>int</code> value
|
||||
* @return true if the set was modified by the remove operation.
|
||||
*/
|
||||
boolean remove( int entry );
|
||||
@Override
|
||||
boolean remove( int entry );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -162,7 +171,8 @@ public interface TIntSet extends TIntCollection, Serializable {
|
|||
* @param collection a <code>Collection</code> value
|
||||
* @return true if all elements were present in the set.
|
||||
*/
|
||||
boolean containsAll( Collection<?> collection );
|
||||
@Override
|
||||
boolean containsAll( Collection<?> collection );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -172,7 +182,8 @@ public interface TIntSet extends TIntCollection, Serializable {
|
|||
* @param collection a <code>TIntCollection</code> value
|
||||
* @return true if all elements were present in the set.
|
||||
*/
|
||||
boolean containsAll( TIntCollection collection );
|
||||
@Override
|
||||
boolean containsAll( TIntCollection collection );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -182,7 +193,8 @@ public interface TIntSet extends TIntCollection, Serializable {
|
|||
* @param array as <code>array</code> of int primitives.
|
||||
* @return true if all elements were present in the set.
|
||||
*/
|
||||
boolean containsAll( int[] array );
|
||||
@Override
|
||||
boolean containsAll( int[] array );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -191,7 +203,8 @@ public interface TIntSet extends TIntCollection, Serializable {
|
|||
* @param collection a <code>Collection</code> value
|
||||
* @return true if the set was modified by the add all operation.
|
||||
*/
|
||||
boolean addAll( Collection<? extends Integer> collection );
|
||||
@Override
|
||||
boolean addAll( Collection<? extends Integer> collection );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -200,7 +213,8 @@ public interface TIntSet extends TIntCollection, Serializable {
|
|||
* @param collection a <code>TIntCollection</code> value
|
||||
* @return true if the set was modified by the add all operation.
|
||||
*/
|
||||
boolean addAll( TIntCollection collection );
|
||||
@Override
|
||||
boolean addAll( TIntCollection collection );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -209,7 +223,8 @@ public interface TIntSet extends TIntCollection, Serializable {
|
|||
* @param array a <code>array</code> of int primitives.
|
||||
* @return true if the set was modified by the add all operation.
|
||||
*/
|
||||
boolean addAll( int[] array );
|
||||
@Override
|
||||
boolean addAll( int[] array );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -219,7 +234,8 @@ public interface TIntSet extends TIntCollection, Serializable {
|
|||
* @param collection a <code>Collection</code> value
|
||||
* @return true if the set was modified by the retain all operation
|
||||
*/
|
||||
boolean retainAll( Collection<?> collection );
|
||||
@Override
|
||||
boolean retainAll( Collection<?> collection );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -229,7 +245,8 @@ public interface TIntSet extends TIntCollection, Serializable {
|
|||
* @param collection a <code>TIntCollection</code> value
|
||||
* @return true if the set was modified by the retain all operation
|
||||
*/
|
||||
boolean retainAll( TIntCollection collection );
|
||||
@Override
|
||||
boolean retainAll( TIntCollection collection );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -239,7 +256,8 @@ public interface TIntSet extends TIntCollection, Serializable {
|
|||
* @param array an <code>array</code> of int primitives.
|
||||
* @return true if the set was modified by the retain all operation
|
||||
*/
|
||||
boolean retainAll( int[] array );
|
||||
@Override
|
||||
boolean retainAll( int[] array );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -248,7 +266,8 @@ public interface TIntSet extends TIntCollection, Serializable {
|
|||
* @param collection a <code>Collection</code> value
|
||||
* @return true if the set was modified by the remove all operation.
|
||||
*/
|
||||
boolean removeAll( Collection<?> collection );
|
||||
@Override
|
||||
boolean removeAll( Collection<?> collection );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -257,7 +276,8 @@ public interface TIntSet extends TIntCollection, Serializable {
|
|||
* @param collection a <code>TIntCollection</code> value
|
||||
* @return true if the set was modified by the remove all operation.
|
||||
*/
|
||||
boolean removeAll( TIntCollection collection );
|
||||
@Override
|
||||
boolean removeAll( TIntCollection collection );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -266,13 +286,15 @@ public interface TIntSet extends TIntCollection, Serializable {
|
|||
* @param array an <code>array</code> of int primitives.
|
||||
* @return true if the set was modified by the remove all operation.
|
||||
*/
|
||||
public boolean removeAll( int[] array );
|
||||
@Override
|
||||
public boolean removeAll( int[] array );
|
||||
|
||||
|
||||
/**
|
||||
* Empties the set.
|
||||
*/
|
||||
void clear();
|
||||
@Override
|
||||
void clear();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -282,7 +304,8 @@ public interface TIntSet extends TIntCollection, Serializable {
|
|||
* @return false if the loop over the set terminated because
|
||||
* the procedure returned false for some value.
|
||||
*/
|
||||
boolean forEach( TIntProcedure procedure );
|
||||
@Override
|
||||
boolean forEach( TIntProcedure procedure );
|
||||
|
||||
|
||||
// Comparison and hashing
|
||||
|
@ -299,7 +322,8 @@ public interface TIntSet extends TIntCollection, Serializable {
|
|||
* @param o object to be compared for equality with this set
|
||||
* @return <tt>true</tt> if the specified object is equal to this set
|
||||
*/
|
||||
boolean equals( Object o );
|
||||
@Override
|
||||
boolean equals( Object o );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -314,7 +338,8 @@ public interface TIntSet extends TIntCollection, Serializable {
|
|||
* @see Object#equals(Object)
|
||||
* @see Set#equals(Object)
|
||||
*/
|
||||
int hashCode();
|
||||
@Override
|
||||
int hashCode();
|
||||
|
||||
|
||||
} // THashSet
|
||||
|
|
|
@ -53,7 +53,8 @@ public interface TLongSet extends TLongCollection, Serializable {
|
|||
*
|
||||
* @return the value that represents null
|
||||
*/
|
||||
long getNoEntryValue();
|
||||
@Override
|
||||
long getNoEntryValue();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -63,7 +64,8 @@ public interface TLongSet extends TLongCollection, Serializable {
|
|||
*
|
||||
* @return the number of elements in this set (its cardinality)
|
||||
*/
|
||||
int size();
|
||||
@Override
|
||||
int size();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -71,7 +73,8 @@ public interface TLongSet extends TLongCollection, Serializable {
|
|||
*
|
||||
* @return <tt>true</tt> if this set contains no elements
|
||||
*/
|
||||
boolean isEmpty();
|
||||
@Override
|
||||
boolean isEmpty();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -80,7 +83,8 @@ public interface TLongSet extends TLongCollection, Serializable {
|
|||
* @param entry an <code>long</code> value
|
||||
* @return true if the set contains the specified element.
|
||||
*/
|
||||
boolean contains( long entry );
|
||||
@Override
|
||||
boolean contains( long entry );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -89,7 +93,8 @@ public interface TLongSet extends TLongCollection, Serializable {
|
|||
*
|
||||
* @return an <code>TLongIterator</code> value
|
||||
*/
|
||||
TLongIterator iterator();
|
||||
@Override
|
||||
TLongIterator iterator();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -108,7 +113,8 @@ public interface TLongSet extends TLongCollection, Serializable {
|
|||
*
|
||||
* @return an array containing all the elements in this set
|
||||
*/
|
||||
long[] toArray();
|
||||
@Override
|
||||
long[] toArray();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -134,7 +140,8 @@ public interface TLongSet extends TLongCollection, Serializable {
|
|||
* @return an <tt>long[]</tt> containing all the elements in this set
|
||||
* @throws NullPointerException if the specified array is null
|
||||
*/
|
||||
long[] toArray( long[] dest );
|
||||
@Override
|
||||
long[] toArray( long[] dest );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -143,7 +150,8 @@ public interface TLongSet extends TLongCollection, Serializable {
|
|||
* @param entry a <code>long</code> value
|
||||
* @return true if the set was modified by the add operation
|
||||
*/
|
||||
boolean add( long entry );
|
||||
@Override
|
||||
boolean add( long entry );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -152,7 +160,8 @@ public interface TLongSet extends TLongCollection, Serializable {
|
|||
* @param entry an <code>long</code> value
|
||||
* @return true if the set was modified by the remove operation.
|
||||
*/
|
||||
boolean remove( long entry );
|
||||
@Override
|
||||
boolean remove( long entry );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -162,7 +171,8 @@ public interface TLongSet extends TLongCollection, Serializable {
|
|||
* @param collection a <code>Collection</code> value
|
||||
* @return true if all elements were present in the set.
|
||||
*/
|
||||
boolean containsAll( Collection<?> collection );
|
||||
@Override
|
||||
boolean containsAll( Collection<?> collection );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -172,7 +182,8 @@ public interface TLongSet extends TLongCollection, Serializable {
|
|||
* @param collection a <code>TLongCollection</code> value
|
||||
* @return true if all elements were present in the set.
|
||||
*/
|
||||
boolean containsAll( TLongCollection collection );
|
||||
@Override
|
||||
boolean containsAll( TLongCollection collection );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -182,7 +193,8 @@ public interface TLongSet extends TLongCollection, Serializable {
|
|||
* @param array as <code>array</code> of long primitives.
|
||||
* @return true if all elements were present in the set.
|
||||
*/
|
||||
boolean containsAll( long[] array );
|
||||
@Override
|
||||
boolean containsAll( long[] array );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -191,7 +203,8 @@ public interface TLongSet extends TLongCollection, Serializable {
|
|||
* @param collection a <code>Collection</code> value
|
||||
* @return true if the set was modified by the add all operation.
|
||||
*/
|
||||
boolean addAll( Collection<? extends Long> collection );
|
||||
@Override
|
||||
boolean addAll( Collection<? extends Long> collection );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -200,7 +213,8 @@ public interface TLongSet extends TLongCollection, Serializable {
|
|||
* @param collection a <code>TLongCollection</code> value
|
||||
* @return true if the set was modified by the add all operation.
|
||||
*/
|
||||
boolean addAll( TLongCollection collection );
|
||||
@Override
|
||||
boolean addAll( TLongCollection collection );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -209,7 +223,8 @@ public interface TLongSet extends TLongCollection, Serializable {
|
|||
* @param array a <code>array</code> of long primitives.
|
||||
* @return true if the set was modified by the add all operation.
|
||||
*/
|
||||
boolean addAll( long[] array );
|
||||
@Override
|
||||
boolean addAll( long[] array );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -219,7 +234,8 @@ public interface TLongSet extends TLongCollection, Serializable {
|
|||
* @param collection a <code>Collection</code> value
|
||||
* @return true if the set was modified by the retain all operation
|
||||
*/
|
||||
boolean retainAll( Collection<?> collection );
|
||||
@Override
|
||||
boolean retainAll( Collection<?> collection );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -229,7 +245,8 @@ public interface TLongSet extends TLongCollection, Serializable {
|
|||
* @param collection a <code>TLongCollection</code> value
|
||||
* @return true if the set was modified by the retain all operation
|
||||
*/
|
||||
boolean retainAll( TLongCollection collection );
|
||||
@Override
|
||||
boolean retainAll( TLongCollection collection );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -239,7 +256,8 @@ public interface TLongSet extends TLongCollection, Serializable {
|
|||
* @param array an <code>array</code> of long primitives.
|
||||
* @return true if the set was modified by the retain all operation
|
||||
*/
|
||||
boolean retainAll( long[] array );
|
||||
@Override
|
||||
boolean retainAll( long[] array );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -248,7 +266,8 @@ public interface TLongSet extends TLongCollection, Serializable {
|
|||
* @param collection a <code>Collection</code> value
|
||||
* @return true if the set was modified by the remove all operation.
|
||||
*/
|
||||
boolean removeAll( Collection<?> collection );
|
||||
@Override
|
||||
boolean removeAll( Collection<?> collection );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -257,7 +276,8 @@ public interface TLongSet extends TLongCollection, Serializable {
|
|||
* @param collection a <code>TLongCollection</code> value
|
||||
* @return true if the set was modified by the remove all operation.
|
||||
*/
|
||||
boolean removeAll( TLongCollection collection );
|
||||
@Override
|
||||
boolean removeAll( TLongCollection collection );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -266,13 +286,15 @@ public interface TLongSet extends TLongCollection, Serializable {
|
|||
* @param array an <code>array</code> of long primitives.
|
||||
* @return true if the set was modified by the remove all operation.
|
||||
*/
|
||||
public boolean removeAll( long[] array );
|
||||
@Override
|
||||
public boolean removeAll( long[] array );
|
||||
|
||||
|
||||
/**
|
||||
* Empties the set.
|
||||
*/
|
||||
void clear();
|
||||
@Override
|
||||
void clear();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -282,7 +304,8 @@ public interface TLongSet extends TLongCollection, Serializable {
|
|||
* @return false if the loop over the set terminated because
|
||||
* the procedure returned false for some value.
|
||||
*/
|
||||
boolean forEach( TLongProcedure procedure );
|
||||
@Override
|
||||
boolean forEach( TLongProcedure procedure );
|
||||
|
||||
|
||||
// Comparison and hashing
|
||||
|
@ -299,7 +322,8 @@ public interface TLongSet extends TLongCollection, Serializable {
|
|||
* @param o object to be compared for equality with this set
|
||||
* @return <tt>true</tt> if the specified object is equal to this set
|
||||
*/
|
||||
boolean equals( Object o );
|
||||
@Override
|
||||
boolean equals( Object o );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -314,7 +338,8 @@ public interface TLongSet extends TLongCollection, Serializable {
|
|||
* @see Object#equals(Object)
|
||||
* @see Set#equals(Object)
|
||||
*/
|
||||
int hashCode();
|
||||
@Override
|
||||
int hashCode();
|
||||
|
||||
|
||||
} // THashSet
|
||||
|
|
|
@ -151,13 +151,15 @@ public class TIntHashSet extends TIntHash implements TIntSet, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public TIntIterator iterator() {
|
||||
@Override
|
||||
public TIntIterator iterator() {
|
||||
return new TIntHashIterator( this );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int[] toArray() {
|
||||
@Override
|
||||
public int[] toArray() {
|
||||
int[] result = new int[ size() ];
|
||||
int[] set = _set;
|
||||
byte[] states = _states;
|
||||
|
@ -172,7 +174,8 @@ public class TIntHashSet extends TIntHash implements TIntSet, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int[] toArray( int[] dest ) {
|
||||
@Override
|
||||
public int[] toArray( int[] dest ) {
|
||||
int[] set = _set;
|
||||
byte[] states = _states;
|
||||
|
||||
|
@ -190,7 +193,8 @@ public class TIntHashSet extends TIntHash implements TIntSet, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean add( int val ) {
|
||||
@Override
|
||||
public boolean add( int val ) {
|
||||
int index = insertionIndex(val);
|
||||
|
||||
if ( index < 0 ) {
|
||||
|
@ -207,7 +211,8 @@ public class TIntHashSet extends TIntHash implements TIntSet, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean remove( int val ) {
|
||||
@Override
|
||||
public boolean remove( int val ) {
|
||||
int index = index(val);
|
||||
if ( index >= 0 ) {
|
||||
removeAt( index );
|
||||
|
@ -218,7 +223,8 @@ public class TIntHashSet extends TIntHash implements TIntSet, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsAll( Collection<?> collection ) {
|
||||
@Override
|
||||
public boolean containsAll( Collection<?> collection ) {
|
||||
for ( Object element : collection ) {
|
||||
if ( element instanceof Integer ) {
|
||||
int c = ( ( Integer ) element ).intValue();
|
||||
|
@ -235,7 +241,8 @@ public class TIntHashSet extends TIntHash implements TIntSet, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsAll( TIntCollection collection ) {
|
||||
@Override
|
||||
public boolean containsAll( TIntCollection collection ) {
|
||||
TIntIterator iter = collection.iterator();
|
||||
while ( iter.hasNext() ) {
|
||||
int element = iter.next();
|
||||
|
@ -248,7 +255,8 @@ public class TIntHashSet extends TIntHash implements TIntSet, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsAll( int[] array ) {
|
||||
@Override
|
||||
public boolean containsAll( int[] array ) {
|
||||
for ( int i = array.length; i-- > 0; ) {
|
||||
if ( ! contains( array[i] ) ) {
|
||||
return false;
|
||||
|
@ -259,7 +267,8 @@ public class TIntHashSet extends TIntHash implements TIntSet, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean addAll( Collection<? extends Integer> collection ) {
|
||||
@Override
|
||||
public boolean addAll( Collection<? extends Integer> collection ) {
|
||||
boolean changed = false;
|
||||
for ( Integer element : collection ) {
|
||||
int e = element.intValue();
|
||||
|
@ -272,7 +281,8 @@ public class TIntHashSet extends TIntHash implements TIntSet, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean addAll( TIntCollection collection ) {
|
||||
@Override
|
||||
public boolean addAll( TIntCollection collection ) {
|
||||
boolean changed = false;
|
||||
TIntIterator iter = collection.iterator();
|
||||
while ( iter.hasNext() ) {
|
||||
|
@ -286,7 +296,8 @@ public class TIntHashSet extends TIntHash implements TIntSet, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean addAll( int[] array ) {
|
||||
@Override
|
||||
public boolean addAll( int[] array ) {
|
||||
boolean changed = false;
|
||||
for ( int i = array.length; i-- > 0; ) {
|
||||
if ( add( array[i] ) ) {
|
||||
|
@ -298,7 +309,8 @@ public class TIntHashSet extends TIntHash implements TIntSet, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@SuppressWarnings({"SuspiciousMethodCalls"})
|
||||
@Override
|
||||
@SuppressWarnings({"SuspiciousMethodCalls"})
|
||||
public boolean retainAll( Collection<?> collection ) {
|
||||
boolean modified = false;
|
||||
TIntIterator iter = iterator();
|
||||
|
@ -313,7 +325,8 @@ public class TIntHashSet extends TIntHash implements TIntSet, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean retainAll( TIntCollection collection ) {
|
||||
@Override
|
||||
public boolean retainAll( TIntCollection collection ) {
|
||||
if ( this == collection ) {
|
||||
return false;
|
||||
}
|
||||
|
@ -330,7 +343,8 @@ public class TIntHashSet extends TIntHash implements TIntSet, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean retainAll( int[] array ) {
|
||||
@Override
|
||||
public boolean retainAll( int[] array ) {
|
||||
boolean changed = false;
|
||||
Arrays.sort( array );
|
||||
int[] set = _set;
|
||||
|
@ -347,7 +361,8 @@ public class TIntHashSet extends TIntHash implements TIntSet, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean removeAll( Collection<?> collection ) {
|
||||
@Override
|
||||
public boolean removeAll( Collection<?> collection ) {
|
||||
boolean changed = false;
|
||||
for ( Object element : collection ) {
|
||||
if ( element instanceof Integer ) {
|
||||
|
@ -362,7 +377,8 @@ public class TIntHashSet extends TIntHash implements TIntSet, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean removeAll( TIntCollection collection ) {
|
||||
@Override
|
||||
public boolean removeAll( TIntCollection collection ) {
|
||||
boolean changed = false;
|
||||
TIntIterator iter = collection.iterator();
|
||||
while ( iter.hasNext() ) {
|
||||
|
@ -376,7 +392,8 @@ public class TIntHashSet extends TIntHash implements TIntSet, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean removeAll( int[] array ) {
|
||||
@Override
|
||||
public boolean removeAll( int[] array ) {
|
||||
boolean changed = false;
|
||||
for ( int i = array.length; i-- > 0; ) {
|
||||
if ( remove(array[i]) ) {
|
||||
|
@ -388,7 +405,8 @@ public class TIntHashSet extends TIntHash implements TIntSet, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void clear() {
|
||||
@Override
|
||||
public void clear() {
|
||||
super.clear();
|
||||
int[] set = _set;
|
||||
byte[] states = _states;
|
||||
|
@ -401,7 +419,8 @@ public class TIntHashSet extends TIntHash implements TIntSet, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
protected void rehash( int newCapacity ) {
|
||||
@Override
|
||||
protected void rehash( int newCapacity ) {
|
||||
int oldCapacity = _set.length;
|
||||
|
||||
int oldSet[] = _set;
|
||||
|
@ -422,7 +441,8 @@ public class TIntHashSet extends TIntHash implements TIntSet, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean equals( Object other ) {
|
||||
@Override
|
||||
public boolean equals( Object other ) {
|
||||
if ( ! ( other instanceof TIntSet ) ) {
|
||||
return false;
|
||||
}
|
||||
|
@ -442,7 +462,8 @@ public class TIntHashSet extends TIntHash implements TIntSet, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int hashCode() {
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hashcode = 0;
|
||||
for ( int i = _states.length; i-- > 0; ) {
|
||||
if ( _states[i] == FULL ) {
|
||||
|
@ -454,7 +475,8 @@ public class TIntHashSet extends TIntHash implements TIntSet, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public String toString() {
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder buffy = new StringBuilder( _size * 2 + 2 );
|
||||
buffy.append("{");
|
||||
for ( int i = _states.length, j = 1; i-- > 0; ) {
|
||||
|
@ -482,7 +504,8 @@ public class TIntHashSet extends TIntHash implements TIntSet, Externalizable {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int next() {
|
||||
@Override
|
||||
public int next() {
|
||||
moveToNextIndex();
|
||||
return _hash._set[_index];
|
||||
}
|
||||
|
@ -490,7 +513,8 @@ public class TIntHashSet extends TIntHash implements TIntSet, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void writeExternal( ObjectOutput out ) throws IOException {
|
||||
@Override
|
||||
public void writeExternal( ObjectOutput out ) throws IOException {
|
||||
|
||||
// VERSION
|
||||
out.writeByte( 1 );
|
||||
|
@ -517,7 +541,8 @@ public class TIntHashSet extends TIntHash implements TIntSet, Externalizable {
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void readExternal( ObjectInput in )
|
||||
@Override
|
||||
public void readExternal( ObjectInput in )
|
||||
throws IOException, ClassNotFoundException {
|
||||
|
||||
// VERSION
|
||||
|
|
|
@ -151,13 +151,15 @@ public class TLongHashSet extends TLongHash implements TLongSet, Externalizable
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public TLongIterator iterator() {
|
||||
@Override
|
||||
public TLongIterator iterator() {
|
||||
return new TLongHashIterator( this );
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public long[] toArray() {
|
||||
@Override
|
||||
public long[] toArray() {
|
||||
long[] result = new long[ size() ];
|
||||
long[] set = _set;
|
||||
byte[] states = _states;
|
||||
|
@ -172,7 +174,8 @@ public class TLongHashSet extends TLongHash implements TLongSet, Externalizable
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public long[] toArray( long[] dest ) {
|
||||
@Override
|
||||
public long[] toArray( long[] dest ) {
|
||||
long[] set = _set;
|
||||
byte[] states = _states;
|
||||
|
||||
|
@ -190,7 +193,8 @@ public class TLongHashSet extends TLongHash implements TLongSet, Externalizable
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean add( long val ) {
|
||||
@Override
|
||||
public boolean add( long val ) {
|
||||
int index = insertionIndex(val);
|
||||
|
||||
if ( index < 0 ) {
|
||||
|
@ -207,7 +211,8 @@ public class TLongHashSet extends TLongHash implements TLongSet, Externalizable
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean remove( long val ) {
|
||||
@Override
|
||||
public boolean remove( long val ) {
|
||||
int index = index(val);
|
||||
if ( index >= 0 ) {
|
||||
removeAt( index );
|
||||
|
@ -218,7 +223,8 @@ public class TLongHashSet extends TLongHash implements TLongSet, Externalizable
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsAll( Collection<?> collection ) {
|
||||
@Override
|
||||
public boolean containsAll( Collection<?> collection ) {
|
||||
for ( Object element : collection ) {
|
||||
if ( element instanceof Long ) {
|
||||
long c = ( ( Long ) element ).longValue();
|
||||
|
@ -235,7 +241,8 @@ public class TLongHashSet extends TLongHash implements TLongSet, Externalizable
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsAll( TLongCollection collection ) {
|
||||
@Override
|
||||
public boolean containsAll( TLongCollection collection ) {
|
||||
TLongIterator iter = collection.iterator();
|
||||
while ( iter.hasNext() ) {
|
||||
long element = iter.next();
|
||||
|
@ -248,7 +255,8 @@ public class TLongHashSet extends TLongHash implements TLongSet, Externalizable
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsAll( long[] array ) {
|
||||
@Override
|
||||
public boolean containsAll( long[] array ) {
|
||||
for ( int i = array.length; i-- > 0; ) {
|
||||
if ( ! contains( array[i] ) ) {
|
||||
return false;
|
||||
|
@ -259,7 +267,8 @@ public class TLongHashSet extends TLongHash implements TLongSet, Externalizable
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean addAll( Collection<? extends Long> collection ) {
|
||||
@Override
|
||||
public boolean addAll( Collection<? extends Long> collection ) {
|
||||
boolean changed = false;
|
||||
for ( Long element : collection ) {
|
||||
long e = element.longValue();
|
||||
|
@ -272,7 +281,8 @@ public class TLongHashSet extends TLongHash implements TLongSet, Externalizable
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean addAll( TLongCollection collection ) {
|
||||
@Override
|
||||
public boolean addAll( TLongCollection collection ) {
|
||||
boolean changed = false;
|
||||
TLongIterator iter = collection.iterator();
|
||||
while ( iter.hasNext() ) {
|
||||
|
@ -286,7 +296,8 @@ public class TLongHashSet extends TLongHash implements TLongSet, Externalizable
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean addAll( long[] array ) {
|
||||
@Override
|
||||
public boolean addAll( long[] array ) {
|
||||
boolean changed = false;
|
||||
for ( int i = array.length; i-- > 0; ) {
|
||||
if ( add( array[i] ) ) {
|
||||
|
@ -298,7 +309,8 @@ public class TLongHashSet extends TLongHash implements TLongSet, Externalizable
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@SuppressWarnings({"SuspiciousMethodCalls"})
|
||||
@Override
|
||||
@SuppressWarnings({"SuspiciousMethodCalls"})
|
||||
public boolean retainAll( Collection<?> collection ) {
|
||||
boolean modified = false;
|
||||
TLongIterator iter = iterator();
|
||||
|
@ -313,7 +325,8 @@ public class TLongHashSet extends TLongHash implements TLongSet, Externalizable
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean retainAll( TLongCollection collection ) {
|
||||
@Override
|
||||
public boolean retainAll( TLongCollection collection ) {
|
||||
if ( this == collection ) {
|
||||
return false;
|
||||
}
|
||||
|
@ -330,7 +343,8 @@ public class TLongHashSet extends TLongHash implements TLongSet, Externalizable
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean retainAll( long[] array ) {
|
||||
@Override
|
||||
public boolean retainAll( long[] array ) {
|
||||
boolean changed = false;
|
||||
Arrays.sort( array );
|
||||
long[] set = _set;
|
||||
|
@ -347,7 +361,8 @@ public class TLongHashSet extends TLongHash implements TLongSet, Externalizable
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean removeAll( Collection<?> collection ) {
|
||||
@Override
|
||||
public boolean removeAll( Collection<?> collection ) {
|
||||
boolean changed = false;
|
||||
for ( Object element : collection ) {
|
||||
if ( element instanceof Long ) {
|
||||
|
@ -362,7 +377,8 @@ public class TLongHashSet extends TLongHash implements TLongSet, Externalizable
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean removeAll( TLongCollection collection ) {
|
||||
@Override
|
||||
public boolean removeAll( TLongCollection collection ) {
|
||||
boolean changed = false;
|
||||
TLongIterator iter = collection.iterator();
|
||||
while ( iter.hasNext() ) {
|
||||
|
@ -376,7 +392,8 @@ public class TLongHashSet extends TLongHash implements TLongSet, Externalizable
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean removeAll( long[] array ) {
|
||||
@Override
|
||||
public boolean removeAll( long[] array ) {
|
||||
boolean changed = false;
|
||||
for ( int i = array.length; i-- > 0; ) {
|
||||
if ( remove(array[i]) ) {
|
||||
|
@ -388,7 +405,8 @@ public class TLongHashSet extends TLongHash implements TLongSet, Externalizable
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void clear() {
|
||||
@Override
|
||||
public void clear() {
|
||||
super.clear();
|
||||
long[] set = _set;
|
||||
byte[] states = _states;
|
||||
|
@ -401,7 +419,8 @@ public class TLongHashSet extends TLongHash implements TLongSet, Externalizable
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
protected void rehash( int newCapacity ) {
|
||||
@Override
|
||||
protected void rehash( int newCapacity ) {
|
||||
int oldCapacity = _set.length;
|
||||
|
||||
long oldSet[] = _set;
|
||||
|
@ -422,7 +441,8 @@ public class TLongHashSet extends TLongHash implements TLongSet, Externalizable
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean equals( Object other ) {
|
||||
@Override
|
||||
public boolean equals( Object other ) {
|
||||
if ( ! ( other instanceof TLongSet ) ) {
|
||||
return false;
|
||||
}
|
||||
|
@ -442,7 +462,8 @@ public class TLongHashSet extends TLongHash implements TLongSet, Externalizable
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int hashCode() {
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hashcode = 0;
|
||||
for ( int i = _states.length; i-- > 0; ) {
|
||||
if ( _states[i] == FULL ) {
|
||||
|
@ -454,7 +475,8 @@ public class TLongHashSet extends TLongHash implements TLongSet, Externalizable
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public String toString() {
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder buffy = new StringBuilder( _size * 2 + 2 );
|
||||
buffy.append("{");
|
||||
for ( int i = _states.length, j = 1; i-- > 0; ) {
|
||||
|
@ -482,7 +504,8 @@ public class TLongHashSet extends TLongHash implements TLongSet, Externalizable
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public long next() {
|
||||
@Override
|
||||
public long next() {
|
||||
moveToNextIndex();
|
||||
return _hash._set[_index];
|
||||
}
|
||||
|
@ -490,7 +513,8 @@ public class TLongHashSet extends TLongHash implements TLongSet, Externalizable
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void writeExternal( ObjectOutput out ) throws IOException {
|
||||
@Override
|
||||
public void writeExternal( ObjectOutput out ) throws IOException {
|
||||
|
||||
// VERSION
|
||||
out.writeByte( 1 );
|
||||
|
@ -517,7 +541,8 @@ public class TLongHashSet extends TLongHash implements TLongSet, Externalizable
|
|||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void readExternal( ObjectInput in )
|
||||
@Override
|
||||
public void readExternal( ObjectInput in )
|
||||
throws IOException, ClassNotFoundException {
|
||||
|
||||
// VERSION
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -152,6 +152,7 @@ public class Amenity extends MapObject {
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void doDataPreparation() {
|
||||
|
||||
}
|
||||
|
|
|
@ -133,6 +133,7 @@ public class City extends MapObject {
|
|||
return "City [" +type+"] " + getName(); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doDataPreparation(){
|
||||
for(Street s : new ArrayList<Street>(getStreets())){
|
||||
s.doDataPreparation();
|
||||
|
|
|
@ -117,6 +117,7 @@ public class Street extends MapObject {
|
|||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doDataPreparation() {
|
||||
sortBuildings();
|
||||
calculateCenter();
|
||||
|
|
|
@ -25,6 +25,7 @@ public class CachedDBStreetDAO extends DBStreetDAO
|
|||
return addressStreetLocalMap.get(createStreetUniqueName(name, city, cityPart)); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
@Override
|
||||
public SimpleStreet findStreet(String name, City city) {
|
||||
return addressStreetLocalMap.get(createStreetUniqueName(name, city)); //$NON-NLS-1$
|
||||
}
|
||||
|
|
|
@ -111,6 +111,7 @@ public class OsmDbAccessor implements OsmDbAccessorContext {
|
|||
return allWays;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadEntityData(Entity e) throws SQLException {
|
||||
if (e.isDataLoaded()) { //data was already loaded, nothing to do
|
||||
return;
|
||||
|
|
|
@ -102,6 +102,7 @@ public class TileSourceManager {
|
|||
return tileSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTileFormat() {
|
||||
return ext;
|
||||
}
|
||||
|
|
|
@ -114,6 +114,7 @@ public class AHSupermarketResolver {
|
|||
public static void selfTest() throws IOException {
|
||||
final String json = "[{city:'Eindhoven',lat:51.443278,format:'TOGO',lng:5.480161,sunday:true,street:'Neckerspoel',hours:[{F:'0630',U:'2300',D:'09-08-2010'},{F:'0630',U:'2300',D:'10-08-2010'},{F:'0630',U:'2300',D:'11-08-2010'},{F:'0630',U:'2300',D:'12-08-2010'},{F:'0630',U:'2330',D:'13-08-2010'},{F:'0700',U:'2330',D:'14-08-2010'},{F:'0800',U:'2300',D:'15-08-2010'},{F:'0630',U:'2300',D:'16-08-2010'},{F:'0630',U:'2300',D:'17-08-2010'},{F:'0630',U:'2300',D:'18-08-2010'},{F:'0630',U:'2300',D:'19-08-2010'},{F:'0630',U:'2330',D:'20-08-2010'},{F:'0700',U:'2330',D:'21-08-2010'},{F:'0800',U:'2300',D:'22-08-2010'}],no:5816,phone:'040-2376060',zip:'5611 AD',housenr:'10'},{city:'Amsterdam',lat:52.346837,format:'TOGO',lng:4.918422,sunday:true,street:'Julianaplein',hours:[{F:'0630',U:'2359',D:'09-08-2010'},{F:'0630',U:'2359',D:'10-08-2010'},{F:'0630',U:'2359',D:'11-08-2010'},{F:'0630',U:'2359',D:'12-08-2010'},{F:'0630',U:'2359',D:'13-08-2010'},{F:'0700',U:'2359',D:'14-08-2010'},{F:'0900',U:'2359',D:'15-08-2010'},{F:'0630',U:'2359',D:'16-08-2010'},{F:'0630',U:'2359',D:'17-08-2010'},{F:'0630',U:'2359',D:'18-08-2010'},{F:'0630',U:'2359',D:'19-08-2010'},{F:'0630',U:'2359',D:'20-08-2010'},{F:'0700',U:'2359',D:'21-08-2010'},{F:'0900',U:'2359',D:'22-08-2010'}],no:5817,phone:'020-4689944',zip:'1097 DN',housenr:'1'}]";
|
||||
AHSupermarketResolver resolver = new AHSupermarketResolver() {
|
||||
@Override
|
||||
protected InputStream openStream() throws IOException {
|
||||
return new ByteArrayInputStream(json.getBytes());
|
||||
}
|
||||
|
|
|
@ -67,6 +67,7 @@ public class BicycleRouter extends VehicleRouter {
|
|||
bicyclePriorityValues.put("steps", 0.6d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptLine(TagValuePair pair) {
|
||||
if (pair.tag.equals("highway")) {
|
||||
return bicycleNotDefinedValues.containsKey(pair.value);
|
||||
|
@ -74,6 +75,7 @@ public class BicycleRouter extends VehicleRouter {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptPoint(TagValuePair pair) {
|
||||
if (pair.tag.equals("highway") && pair.value.equals("traffic_signals")) {
|
||||
return true;
|
||||
|
@ -93,6 +95,7 @@ public class BicycleRouter extends VehicleRouter {
|
|||
/**
|
||||
* return delay in seconds
|
||||
*/
|
||||
@Override
|
||||
public double defineObstacle(BinaryMapDataObject road, int point) {
|
||||
if ((road.getTypes()[0] & 3) == MapRenderingTypes.POINT_TYPE) {
|
||||
// possibly not only first type needed ?
|
||||
|
@ -121,6 +124,7 @@ public class BicycleRouter extends VehicleRouter {
|
|||
/**
|
||||
* return speed in m/s
|
||||
*/
|
||||
@Override
|
||||
public double defineSpeed(BinaryMapDataObject road) {
|
||||
TagValuePair pair = road.getTagValue(0);
|
||||
double speed = 4d;
|
||||
|
@ -140,6 +144,7 @@ public class BicycleRouter extends VehicleRouter {
|
|||
*
|
||||
* @return minimal speed at road
|
||||
*/
|
||||
@Override
|
||||
public double getMinDefaultSpeed() {
|
||||
return 2;
|
||||
}
|
||||
|
@ -149,10 +154,12 @@ public class BicycleRouter extends VehicleRouter {
|
|||
*
|
||||
* @return maximum speed to calculate shortest distance
|
||||
*/
|
||||
@Override
|
||||
public double getMaxDefaultSpeed() {
|
||||
return 6;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double calculateTurnTime(RouteSegment segment, RouteSegment next, int segmentEnd) {
|
||||
boolean end = (segmentEnd == segment.road.getPointsLength() - 1 || segmentEnd == 0);
|
||||
boolean start = next.segmentStart == 0;
|
||||
|
|
|
@ -51,6 +51,7 @@ public class CarRouter extends VehicleRouter {
|
|||
autoPriorityValues.put("living_street", 0.1d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptLine(TagValuePair pair) {
|
||||
if (pair.tag.equals("highway")) {
|
||||
return autoNotDefinedValues.containsKey(pair.value);
|
||||
|
@ -58,6 +59,7 @@ public class CarRouter extends VehicleRouter {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptPoint(TagValuePair pair) {
|
||||
if (pair.tag.equals("traffic_calming")) {
|
||||
return true;
|
||||
|
@ -80,6 +82,7 @@ public class CarRouter extends VehicleRouter {
|
|||
/**
|
||||
* return delay in seconds
|
||||
*/
|
||||
@Override
|
||||
public double defineObstacle(BinaryMapDataObject road, int point) {
|
||||
if ((road.getTypes()[0] & 3) == MapRenderingTypes.POINT_TYPE) {
|
||||
// possibly not only first type needed ?
|
||||
|
@ -118,6 +121,7 @@ public class CarRouter extends VehicleRouter {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getRoadPriorityToCalculateRoute(BinaryMapDataObject road) {
|
||||
TagValuePair pair = road.getTagValue(0);
|
||||
boolean highway = "highway".equals(pair.tag);
|
||||
|
@ -135,6 +139,7 @@ public class CarRouter extends VehicleRouter {
|
|||
/**
|
||||
* return speed in m/s
|
||||
*/
|
||||
@Override
|
||||
public double defineSpeed(BinaryMapDataObject road) {
|
||||
TagValuePair pair = road.getTagValue(0);
|
||||
double speed = MapRenderingTypes.getMaxSpeedIfDefined(road.getHighwayAttributes()) / 3.6d;
|
||||
|
@ -155,6 +160,7 @@ public class CarRouter extends VehicleRouter {
|
|||
*
|
||||
* @return minimal speed at road
|
||||
*/
|
||||
@Override
|
||||
public double getMinDefaultSpeed() {
|
||||
return 9;
|
||||
}
|
||||
|
@ -164,6 +170,7 @@ public class CarRouter extends VehicleRouter {
|
|||
*
|
||||
* @return maximum speed to calculate shortest distance
|
||||
*/
|
||||
@Override
|
||||
public double getMaxDefaultSpeed() {
|
||||
return 30;
|
||||
}
|
||||
|
@ -198,6 +205,7 @@ public class CarRouter extends VehicleRouter {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double calculateTurnTime(RouteSegment segment, RouteSegment next, int segmentEnd) {
|
||||
boolean end = (segmentEnd == segment.road.getPointsLength() - 1 || segmentEnd == 0);
|
||||
boolean start = next.segmentStart == 0 || next.segmentStart == next.getRoad().getPointsLength() - 1;
|
||||
|
|
|
@ -81,6 +81,7 @@ public class PedestrianRouter extends VehicleRouter {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptLine(TagValuePair pair) {
|
||||
if (pair.tag.equals("highway")) {
|
||||
return pedestrianNotDefinedValues.containsKey(pair.value);
|
||||
|
@ -88,6 +89,7 @@ public class PedestrianRouter extends VehicleRouter {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptPoint(TagValuePair pair) {
|
||||
if (pair.tag.equals("highway") && pair.value.equals("traffic_signals")) {
|
||||
return true;
|
||||
|
@ -106,6 +108,7 @@ public class PedestrianRouter extends VehicleRouter {
|
|||
/**
|
||||
* return delay in seconds
|
||||
*/
|
||||
@Override
|
||||
public double defineObstacle(BinaryMapDataObject road, int point) {
|
||||
if ((road.getTypes()[0] & 3) == MapRenderingTypes.POINT_TYPE) {
|
||||
// possibly not only first type needed ?
|
||||
|
@ -126,6 +129,7 @@ public class PedestrianRouter extends VehicleRouter {
|
|||
/**
|
||||
* return speed in m/s
|
||||
*/
|
||||
@Override
|
||||
public double defineSpeed(BinaryMapDataObject road) {
|
||||
TagValuePair pair = road.getTagValue(0);
|
||||
double speed = 1.5d;
|
||||
|
@ -145,6 +149,7 @@ public class PedestrianRouter extends VehicleRouter {
|
|||
*
|
||||
* @return minimal speed at road
|
||||
*/
|
||||
@Override
|
||||
public double getMinDefaultSpeed() {
|
||||
return 1;
|
||||
}
|
||||
|
@ -154,10 +159,12 @@ public class PedestrianRouter extends VehicleRouter {
|
|||
*
|
||||
* @return maximum speed to calculate shortest distance
|
||||
*/
|
||||
@Override
|
||||
public double getMaxDefaultSpeed() {
|
||||
return 1.8;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double calculateTurnTime(RouteSegment segment, RouteSegment next, int j) {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -61,6 +61,7 @@ public class MapClusterLayer implements MapPanelLayer {
|
|||
Action clustering= new AbstractAction("Clustering roads") {
|
||||
private static final long serialVersionUID = 444678942490247133L;
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
clusteringRoadActions(true);
|
||||
}
|
||||
|
@ -71,6 +72,7 @@ public class MapClusterLayer implements MapPanelLayer {
|
|||
clustering= new AbstractAction("Clustering roads with tertiary") {
|
||||
private static final long serialVersionUID = 444678942490247134L;
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
clusteringRoadActions(false);
|
||||
}
|
||||
|
|
|
@ -280,6 +280,7 @@ public class MapPanel extends JPanel implements IMapDownloaderCallback {
|
|||
downloader.addDownloaderCallback(this);
|
||||
setFocusable(true);
|
||||
addComponentListener(new ComponentAdapter(){
|
||||
@Override
|
||||
public void componentResized(ComponentEvent e) {
|
||||
prepareImage();
|
||||
}
|
||||
|
|
|
@ -75,6 +75,7 @@ public class MapRouterLayer implements MapPanelLayer {
|
|||
Action start = new AbstractAction("Mark start point") {
|
||||
private static final long serialVersionUID = 507156107455281238L;
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Point popupMenuPoint = map.getPopupMenuPoint();
|
||||
double fy = (popupMenuPoint.y - map.getCenterPointY()) / map.getTileSize();
|
||||
|
@ -89,6 +90,7 @@ public class MapRouterLayer implements MapPanelLayer {
|
|||
Action end= new AbstractAction("Mark end point") {
|
||||
private static final long serialVersionUID = 4446789424902471319L;
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Point popupMenuPoint = map.getPopupMenuPoint();
|
||||
double fy = (popupMenuPoint.y - map.getCenterPointY()) / map.getTileSize();
|
||||
|
@ -103,6 +105,7 @@ public class MapRouterLayer implements MapPanelLayer {
|
|||
Action route = new AbstractAction("Calculate YOURS route") {
|
||||
private static final long serialVersionUID = 507156107455281238L;
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
new Thread(){
|
||||
@Override
|
||||
|
@ -123,6 +126,7 @@ public class MapRouterLayer implements MapPanelLayer {
|
|||
Action altroute = new AbstractAction("Calculate CloudMade route") {
|
||||
private static final long serialVersionUID = 507156107455281238L;
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
new Thread() {
|
||||
@Override
|
||||
|
@ -143,6 +147,7 @@ public class MapRouterLayer implements MapPanelLayer {
|
|||
Action selfRoute = new AbstractAction("Calculate OsmAnd route") {
|
||||
private static final long serialVersionUID = 507156107455281238L;
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
new Thread() {
|
||||
@Override
|
||||
|
|
|
@ -537,6 +537,7 @@ public class OsmExtractionUI implements IMapLocationListener {
|
|||
|
||||
|
||||
public class ExitListener extends WindowAdapter {
|
||||
@Override
|
||||
public void windowClosing(WindowEvent event) {
|
||||
exit();
|
||||
}
|
||||
|
|
|
@ -49,7 +49,8 @@ public class ProgressDialog extends JDialog implements IProgress {
|
|||
initDialog();
|
||||
}
|
||||
|
||||
public boolean isInterrupted(){
|
||||
@Override
|
||||
public boolean isInterrupted(){
|
||||
return !isVisible();
|
||||
}
|
||||
|
||||
|
@ -164,6 +165,7 @@ public class ProgressDialog extends JDialog implements IProgress {
|
|||
deltaWork = progressBar.getMaximum() - remainingWork - this.progressBar.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isIndeterminate(){
|
||||
return progressBar.isIndeterminate();
|
||||
}
|
||||
|
|
|
@ -93,7 +93,8 @@ public class ABL implements Cloneable
|
|||
temp[l++] = arrABL[i++];
|
||||
System.arraycopy(temp,0,arrABL,first,temp.length);
|
||||
}
|
||||
public Object clone()
|
||||
@Override
|
||||
public Object clone()
|
||||
{
|
||||
return new ABL(element,minDist);
|
||||
}
|
||||
|
|
|
@ -51,7 +51,8 @@ public abstract class Element implements Cloneable, java.io.Serializable
|
|||
//throws IllegalValueException;
|
||||
public abstract void setPtr(long ptr);
|
||||
public abstract int getElementType();
|
||||
public String toString()
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return Rectangle.toString();
|
||||
}
|
||||
|
|
|
@ -311,7 +311,8 @@ public class FileHdr
|
|||
{
|
||||
return rootIndex;
|
||||
}
|
||||
protected void finalize() throws Throwable
|
||||
@Override
|
||||
protected void finalize() throws Throwable
|
||||
{
|
||||
try {
|
||||
flush();
|
||||
|
@ -480,7 +481,8 @@ public class FileHdr
|
|||
/**
|
||||
This method will return only internal varaibles.
|
||||
*/
|
||||
public String toString()
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
try{
|
||||
String str = new String();
|
||||
|
@ -523,7 +525,8 @@ class ThreadInfo
|
|||
this.t = t;
|
||||
this.lockType = lockType;
|
||||
}
|
||||
public String toString()
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
String str = new String("\nThreadInfo");
|
||||
str += "\n lockType : "+ lockType;
|
||||
|
|
|
@ -49,11 +49,13 @@ public class LeafElement extends Element
|
|||
// {
|
||||
// return(new Long(recordPtr));
|
||||
// }
|
||||
public long getPtr()
|
||||
@Override
|
||||
public long getPtr()
|
||||
{
|
||||
return recordPtr;
|
||||
}
|
||||
public int getElementType()
|
||||
@Override
|
||||
public int getElementType()
|
||||
{
|
||||
return Node.LEAF_NODE;
|
||||
}
|
||||
|
@ -64,15 +66,18 @@ public class LeafElement extends Element
|
|||
// throw new IllegalValueException("rtree.LeafElement.setPtr: pointer shoild be Long");
|
||||
// recordPtr = ((Long)ptr).longValue();
|
||||
// }
|
||||
public void setPtr(long ptr)
|
||||
@Override
|
||||
public void setPtr(long ptr)
|
||||
{
|
||||
recordPtr = ptr;
|
||||
}
|
||||
public String toString()
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return (super.toString()+"\n\trecPointer: "+recordPtr);
|
||||
}
|
||||
public Object clone()
|
||||
@Override
|
||||
public Object clone()
|
||||
{
|
||||
try{
|
||||
return new LeafElement(new Rect(Rectangle.getMinX(), Rectangle.getMinY(),
|
||||
|
|
|
@ -257,7 +257,8 @@ public class Node implements Cloneable //can be made abstract if leaf and non le
|
|||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public Object clone()
|
||||
@Override
|
||||
public Object clone()
|
||||
{
|
||||
return new Node(file,fileName,nodeIndex, sorted, elements, fileHdr,totalElements,
|
||||
parent, elementSize, elementType, dirty, nodeMBR);//remove
|
||||
|
@ -1372,7 +1373,8 @@ public class Node implements Cloneable //can be made abstract if leaf and non le
|
|||
/**
|
||||
Obvious, isn't it?
|
||||
*/
|
||||
public String toString()
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
String ret = "\n\t***Node at Index: "+Long.toString(nodeIndex)+"***";
|
||||
ret += "\nLocal Variables-";
|
||||
|
|
|
@ -39,12 +39,14 @@ public class NonLeafElement extends Element
|
|||
// {
|
||||
// return(new Integer(nodePtr));
|
||||
// }
|
||||
public long getPtr()//this is an integer object
|
||||
@Override
|
||||
public long getPtr()//this is an integer object
|
||||
{
|
||||
return nodePtr;
|
||||
}
|
||||
|
||||
public int getElementType()
|
||||
@Override
|
||||
public int getElementType()
|
||||
{
|
||||
return Node.NONLEAF_NODE;
|
||||
}
|
||||
|
@ -55,11 +57,13 @@ public class NonLeafElement extends Element
|
|||
// throw new IllegalValueException("rtree.NonLeafElement.setPtr: pointer shoild be Integer");
|
||||
// nodePtr = ((Integer)ptr).intValue();
|
||||
// }
|
||||
public void setPtr(long ptr)
|
||||
@Override
|
||||
public void setPtr(long ptr)
|
||||
{
|
||||
nodePtr = ptr;
|
||||
}
|
||||
public String toString()
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return (super.toString()+"\n\tnodePointer: "+nodePtr);
|
||||
}
|
||||
|
@ -141,7 +145,8 @@ public class NonLeafElement extends Element
|
|||
return ((elmt.getRect().getMaxY()
|
||||
+ elmt.getRect().getMinY())/2);
|
||||
}
|
||||
public Object clone()
|
||||
@Override
|
||||
public Object clone()
|
||||
{
|
||||
try{
|
||||
return new NonLeafElement(new Rect(Rectangle.getMinX(), Rectangle.getMinY(),
|
||||
|
|
|
@ -32,11 +32,13 @@ public class Point implements Cloneable
|
|||
{
|
||||
return Y;
|
||||
}
|
||||
public Object clone()
|
||||
@Override
|
||||
public Object clone()
|
||||
{
|
||||
return new Point(X,Y);
|
||||
}
|
||||
public String toString()
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
String ret;
|
||||
ret = "\nThe Point:-";
|
||||
|
|
|
@ -86,54 +86,65 @@ class ReadNode extends Node
|
|||
@return thengaa!
|
||||
XXX : This is till not correct.
|
||||
*/
|
||||
public void deleteElement(int index, boolean force)
|
||||
@Override
|
||||
public void deleteElement(int index, boolean force)
|
||||
throws IllegalValueException, NodeWriteException
|
||||
{
|
||||
throw new UnsupportedOperationException("operation not supported");
|
||||
}
|
||||
public void insertElement(Element elmt)
|
||||
@Override
|
||||
public void insertElement(Element elmt)
|
||||
throws NodeWriteException, NodeFullException
|
||||
{
|
||||
throw new UnsupportedOperationException("operation not supported");
|
||||
}
|
||||
public void insertElement(Element[] elmts, boolean updateChldrn)
|
||||
@Override
|
||||
public void insertElement(Element[] elmts, boolean updateChldrn)
|
||||
throws NodeWriteException, NodeFullException
|
||||
{
|
||||
throw new UnsupportedOperationException("operation not supported");
|
||||
}
|
||||
public int getElementType()
|
||||
@Override
|
||||
public int getElementType()
|
||||
{
|
||||
return super.getElementType();
|
||||
}
|
||||
public long getNodeIndex()//for new nodes
|
||||
@Override
|
||||
public long getNodeIndex()//for new nodes
|
||||
{
|
||||
return super.getNodeIndex();
|
||||
}
|
||||
Rect[] getAllRectangles()
|
||||
@Override
|
||||
Rect[] getAllRectangles()
|
||||
throws IllegalValueException
|
||||
{
|
||||
return super.getAllRectangles();
|
||||
}
|
||||
public Element getLeastEnlargement(Element elmt)
|
||||
@Override
|
||||
public Element getLeastEnlargement(Element elmt)
|
||||
throws NodeEmptyException, IllegalValueException, NodeWriteException
|
||||
{
|
||||
return super.getLeastEnlargement(elmt);
|
||||
}
|
||||
boolean isInsertPossible()
|
||||
@Override
|
||||
boolean isInsertPossible()
|
||||
{
|
||||
return super.isInsertPossible();
|
||||
}
|
||||
|
||||
public Node[] splitNode(Element elmtM1, long slotIndex)
|
||||
@Override
|
||||
public Node[] splitNode(Element elmtM1, long slotIndex)
|
||||
throws RTreeException, NodeWriteException
|
||||
{
|
||||
throw new UnsupportedOperationException("operation not supported");
|
||||
}
|
||||
public long getParent()
|
||||
@Override
|
||||
public long getParent()
|
||||
{
|
||||
return super.getParent();
|
||||
}
|
||||
public int getElementIndex(long ptr/*Object ptr*/)
|
||||
@Override
|
||||
public int getElementIndex(long ptr/*Object ptr*/)
|
||||
{
|
||||
return super.getElementIndex(ptr);
|
||||
}
|
||||
|
@ -141,7 +152,8 @@ class ReadNode extends Node
|
|||
Used to overwrite the old Element with the new one.
|
||||
It modifies the element in the disk as well as in the local variables.
|
||||
*/
|
||||
public void modifyElement(int index,Element elmt)
|
||||
@Override
|
||||
public void modifyElement(int index,Element elmt)
|
||||
throws IllegalValueException,IOException, NodeWriteException
|
||||
{
|
||||
throw new UnsupportedOperationException("operation not supported");
|
||||
|
@ -149,7 +161,8 @@ class ReadNode extends Node
|
|||
/**
|
||||
Overloaded
|
||||
*/
|
||||
public void modifyElement(int index,long pointer)
|
||||
@Override
|
||||
public void modifyElement(int index,long pointer)
|
||||
throws IllegalValueException,IOException, NodeWriteException
|
||||
{
|
||||
throw new UnsupportedOperationException("operation not supported");
|
||||
|
@ -157,7 +170,8 @@ class ReadNode extends Node
|
|||
/**
|
||||
Overloaded
|
||||
*/
|
||||
public void modifyElement(int index,Rect rect)
|
||||
@Override
|
||||
public void modifyElement(int index,Rect rect)
|
||||
throws IllegalValueException,IOException, NodeWriteException
|
||||
{
|
||||
throw new UnsupportedOperationException("operation not supported");
|
||||
|
@ -168,7 +182,8 @@ class ReadNode extends Node
|
|||
then it is better to calculate MBR in that loop without calling this method.
|
||||
@throws IllegalValueException When there are no elements in the node.
|
||||
*/
|
||||
public Rect getNodeMBR()
|
||||
@Override
|
||||
public Rect getNodeMBR()
|
||||
throws IllegalValueException
|
||||
{
|
||||
return super.getNodeMBR();
|
||||
|
@ -176,12 +191,14 @@ class ReadNode extends Node
|
|||
/**
|
||||
No error echecking at all.
|
||||
*/
|
||||
public void setParent(long /*int*/ prnt)
|
||||
@Override
|
||||
public void setParent(long /*int*/ prnt)
|
||||
throws IOException, NodeWriteException
|
||||
{
|
||||
throw new UnsupportedOperationException("operation not supported");
|
||||
}
|
||||
public int getTotalElements()
|
||||
@Override
|
||||
public int getTotalElements()
|
||||
{
|
||||
return super.getTotalElements();
|
||||
}
|
||||
|
@ -191,11 +208,13 @@ class ReadNode extends Node
|
|||
</b>. Instead use <code>getTotalElements()</code>.
|
||||
@return An element Array.
|
||||
*/
|
||||
public Element[] getAllElements()
|
||||
@Override
|
||||
public Element[] getAllElements()
|
||||
{
|
||||
return super.getAllElements();
|
||||
}
|
||||
Element getElement(int index)
|
||||
@Override
|
||||
Element getElement(int index)
|
||||
throws IllegalValueException
|
||||
{
|
||||
return super.getElement(index);
|
||||
|
@ -207,7 +226,8 @@ class ReadNode extends Node
|
|||
If the node is the only node then it updates the file header as well.
|
||||
</br><i><b>Once called, there is no turning back!</b></i>.
|
||||
*/
|
||||
public void deleteNode()
|
||||
@Override
|
||||
public void deleteNode()
|
||||
throws NodeWriteException
|
||||
{
|
||||
throw new UnsupportedOperationException("operation not supported");
|
||||
|
@ -215,7 +235,8 @@ class ReadNode extends Node
|
|||
/**
|
||||
* This method is added to sort the elements in this node to help sweepline algorithm.
|
||||
*/
|
||||
void sweepSort()//check out for null elements
|
||||
@Override
|
||||
void sweepSort()//check out for null elements
|
||||
{
|
||||
super.sweepSort();
|
||||
}//sweepSort
|
||||
|
@ -224,16 +245,19 @@ class ReadNode extends Node
|
|||
required.
|
||||
@return true if needed write and written or false (not dirty).
|
||||
*/
|
||||
public boolean flush()
|
||||
@Override
|
||||
public boolean flush()
|
||||
throws NodeWriteException
|
||||
{
|
||||
throw new UnsupportedOperationException("operation not supported");
|
||||
}
|
||||
void setDirty(boolean val)
|
||||
@Override
|
||||
void setDirty(boolean val)
|
||||
{
|
||||
throw new UnsupportedOperationException("operation not supported");
|
||||
}
|
||||
public boolean isDirty()
|
||||
@Override
|
||||
public boolean isDirty()
|
||||
{
|
||||
throw new UnsupportedOperationException("operation not supported");
|
||||
}
|
||||
|
|
|
@ -422,7 +422,8 @@ public class Rect implements java.io.Serializable
|
|||
return true;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
String ret;
|
||||
ret = "\nThe Rectangle:-";
|
||||
|
|
|
@ -20,7 +20,8 @@ import rtree.*;
|
|||
*/
|
||||
public class CompElmtX implements Comparator
|
||||
{
|
||||
public int compare(Object o1, Object o2)
|
||||
@Override
|
||||
public int compare(Object o1, Object o2)
|
||||
{
|
||||
if(o1 instanceof Element && o2 instanceof Element){
|
||||
Rect r1 = ((Element)o1).getRect();
|
||||
|
@ -45,7 +46,8 @@ public class CompElmtX implements Comparator
|
|||
+o1.getClass().getName() + " o2 " + o2.getClass().getName());
|
||||
}
|
||||
}
|
||||
public boolean equals(Object o)
|
||||
@Override
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,8 @@ public class ContainedByPred extends Predicate
|
|||
{
|
||||
public ContainedByPred(){}
|
||||
|
||||
public void relate(Element event, int from, Element[] others, List pairs, int evtSide)
|
||||
@Override
|
||||
public void relate(Element event, int from, Element[] others, List pairs, int evtSide)
|
||||
{
|
||||
//System.out.println("SweepLine.internalLoop : before pairs size : " + pairs.size());
|
||||
if(evtSide == Join.RIGHT){
|
||||
|
@ -48,7 +49,8 @@ public class ContainedByPred extends Predicate
|
|||
/**
|
||||
@param side The side of <code>elmt1</code>.
|
||||
*/
|
||||
public boolean relateMismatch(Element elmt1, Element elmt2, int side)
|
||||
@Override
|
||||
public boolean relateMismatch(Element elmt1, Element elmt2, int side)
|
||||
{
|
||||
try{
|
||||
if(elmt1 instanceof NonLeafElement || elmt2 instanceof NonLeafElement)
|
||||
|
|
|
@ -23,7 +23,8 @@ public class ContainsPred extends Predicate
|
|||
public ContainsPred(){}
|
||||
|
||||
|
||||
public void relate(Element event, int from, Element[] others, List pairs, int evtSide)
|
||||
@Override
|
||||
public void relate(Element event, int from, Element[] others, List pairs, int evtSide)
|
||||
{
|
||||
//System.out.println("SweepLine.internalLoop : before pairs size : " + pairs.size());
|
||||
if(evtSide == Join.LEFT){
|
||||
|
@ -51,7 +52,8 @@ public class ContainsPred extends Predicate
|
|||
/**
|
||||
@param side The side of <code>elmt1</code>.
|
||||
*/
|
||||
public boolean relateMismatch(Element elmt1, Element elmt2, int side)
|
||||
@Override
|
||||
public boolean relateMismatch(Element elmt1, Element elmt2, int side)
|
||||
{
|
||||
//System.out.println("ContainsPred.relateMismatch :");
|
||||
|
||||
|
|
|
@ -25,7 +25,8 @@ public class EqualsPred extends Predicate
|
|||
// {
|
||||
// super(p);
|
||||
// }
|
||||
public void relate(Element event, int from, Element[] others, List pairs, int evtSide)
|
||||
@Override
|
||||
public void relate(Element event, int from, Element[] others, List pairs, int evtSide)
|
||||
{
|
||||
//System.out.println("SweepLine.internalLoop : before pairs size : " + pairs.size());
|
||||
for(int i=from;
|
||||
|
@ -54,7 +55,8 @@ public class EqualsPred extends Predicate
|
|||
// return false;
|
||||
// }
|
||||
//}
|
||||
public boolean relateMismatch(Element elmt1, Element elmt2, int side)
|
||||
@Override
|
||||
public boolean relateMismatch(Element elmt1, Element elmt2, int side)
|
||||
{
|
||||
try{
|
||||
if(elmt1 instanceof NonLeafElement || elmt2 instanceof NonLeafElement)
|
||||
|
|
|
@ -21,7 +21,8 @@ import java.util.List;
|
|||
public class IntersectPred extends Predicate
|
||||
{
|
||||
public IntersectPred(){}
|
||||
public void relate(Element event, int from, Element[] others, List pairs, int evtSide)
|
||||
@Override
|
||||
public void relate(Element event, int from, Element[] others, List pairs, int evtSide)
|
||||
{
|
||||
//System.out.println("SweepLine.internalLoop : before pairs size : " + pairs.size());
|
||||
for(int i=from;
|
||||
|
@ -38,7 +39,8 @@ public class IntersectPred extends Predicate
|
|||
}//for
|
||||
//System.out.println("SweepLine.internalLoop : after pairs size : " + pairs.size());
|
||||
}
|
||||
public boolean relateMismatch(Element ltElmt, Element rtElmt, int side)
|
||||
@Override
|
||||
public boolean relateMismatch(Element ltElmt, Element rtElmt, int side)
|
||||
{
|
||||
try{
|
||||
return ltElmt.getRect().overlaps(rtElmt.getRect());
|
||||
|
|
|
@ -22,12 +22,14 @@ public class MeetPred extends Predicate
|
|||
{
|
||||
public MeetPred(){}
|
||||
|
||||
public void relate(Element event, int from, Element[] others, List pairs, int evtSide)
|
||||
@Override
|
||||
public void relate(Element event, int from, Element[] others, List pairs, int evtSide)
|
||||
{
|
||||
(new IntersectPred()).relate(event, from, others, pairs, evtSide);
|
||||
}
|
||||
|
||||
public boolean relateMismatch(Element nlElmt, Element lfElmt, int side)
|
||||
@Override
|
||||
public boolean relateMismatch(Element nlElmt, Element lfElmt, int side)
|
||||
{
|
||||
try{
|
||||
//if(nlElmt instanceof NonLeafElement)
|
||||
|
|
|
@ -32,11 +32,13 @@ public class PairElmt extends Pair
|
|||
this.rtElmt = rtElmt;
|
||||
}
|
||||
|
||||
public long getLtPtr()
|
||||
@Override
|
||||
public long getLtPtr()
|
||||
{
|
||||
return ltElmt.getPtr();
|
||||
}
|
||||
public long getRtPtr()
|
||||
@Override
|
||||
public long getRtPtr()
|
||||
{
|
||||
return rtElmt.getPtr();
|
||||
}
|
||||
|
@ -49,7 +51,8 @@ public class PairElmt extends Pair
|
|||
{
|
||||
return rtElmt;
|
||||
}
|
||||
public Pair paired(Element ltElmt, Element rtElmt)
|
||||
@Override
|
||||
public Pair paired(Element ltElmt, Element rtElmt)
|
||||
{
|
||||
return new PairElmt(ltElmt, rtElmt);
|
||||
}
|
||||
|
|
|
@ -145,7 +145,8 @@ public class SweepLine
|
|||
*/
|
||||
class CompRectX implements Comparator
|
||||
{
|
||||
public int compare(Object o1, Object o2)
|
||||
@Override
|
||||
public int compare(Object o1, Object o2)
|
||||
{
|
||||
if(o1 instanceof Rect && o2 instanceof Rect){
|
||||
Rect r1 = (Rect)o1;
|
||||
|
@ -161,7 +162,8 @@ class CompRectX implements Comparator
|
|||
throw new ClassCastException("Rect.compareTo : wrong object(s) passed");
|
||||
|
||||
}
|
||||
public boolean equals(Object o)
|
||||
@Override
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -58,7 +58,8 @@ class TreeThread implements Runnable
|
|||
tree.start();
|
||||
}
|
||||
}
|
||||
public void run()
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
try{
|
||||
//RTree rt = new RTree(fileName);
|
||||
|
|
|
@ -43,7 +43,8 @@ public class SdNode extends Node
|
|||
{
|
||||
|
||||
}
|
||||
public int getElementIndex(long param1)
|
||||
@Override
|
||||
public int getElementIndex(long param1)
|
||||
{
|
||||
return super.getElementIndex(param1);
|
||||
}
|
||||
|
@ -52,12 +53,14 @@ public class SdNode extends Node
|
|||
{
|
||||
super.insertElement(elmts, false);
|
||||
}
|
||||
public void insertElement(Element elmt)
|
||||
@Override
|
||||
public void insertElement(Element elmt)
|
||||
throws NodeWriteException, NodeFullException
|
||||
{
|
||||
super.insertElement(elmt);
|
||||
}
|
||||
public Element getLeastEnlargement(Element elmt)
|
||||
@Override
|
||||
public Element getLeastEnlargement(Element elmt)
|
||||
throws NodeEmptyException, IllegalValueException, NodeWriteException
|
||||
{
|
||||
return super.getLeastEnlargement(elmt);
|
||||
|
@ -69,7 +72,8 @@ public class SdNode extends Node
|
|||
* @return <description>
|
||||
* @exception RTreeException <description>
|
||||
*/
|
||||
public Node[] splitNode(Element param1, long slotIndex) throws RTreeException, NodeWriteException
|
||||
@Override
|
||||
public Node[] splitNode(Element param1, long slotIndex) throws RTreeException, NodeWriteException
|
||||
{
|
||||
Node[] nodes = super.splitNode(param1, slotIndex);
|
||||
return nodes;
|
||||
|
@ -78,18 +82,21 @@ public class SdNode extends Node
|
|||
/**
|
||||
* Overriden so that this package can use it.
|
||||
*/
|
||||
public void modifyElement(int index,long pointer)
|
||||
@Override
|
||||
public void modifyElement(int index,long pointer)
|
||||
throws IllegalValueException, IOException, NodeWriteException
|
||||
{
|
||||
super.modifyElement(index, pointer);
|
||||
}
|
||||
|
||||
public void deleteNode() throws NodeWriteException
|
||||
@Override
|
||||
public void deleteNode() throws NodeWriteException
|
||||
{
|
||||
super.deleteNode();
|
||||
}
|
||||
|
||||
public void modifyElement(int param1, Rect param2)
|
||||
@Override
|
||||
public void modifyElement(int param1, Rect param2)
|
||||
throws IllegalValueException, IOException, NodeWriteException
|
||||
{
|
||||
super.modifyElement(param1, param2);
|
||||
|
@ -100,7 +107,8 @@ public class SdNode extends Node
|
|||
super.deleteElement(param1, false);
|
||||
}
|
||||
|
||||
public void setParent(long param1) throws IOException, NodeWriteException
|
||||
@Override
|
||||
public void setParent(long param1) throws IOException, NodeWriteException
|
||||
{
|
||||
super.setParent(param1);
|
||||
}
|
||||
|
|
71
OsmAnd/.settings/org.eclipse.jdt.core.prefs
Normal file
71
OsmAnd/.settings/org.eclipse.jdt.core.prefs
Normal file
|
@ -0,0 +1,71 @@
|
|||
#Mon Oct 10 15:52:08 CEST 2011
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
|
||||
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
|
||||
org.eclipse.jdt.core.compiler.problem.deadCode=warning
|
||||
org.eclipse.jdt.core.compiler.problem.deprecation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
|
||||
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
|
||||
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
|
||||
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
|
||||
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=error
|
||||
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
|
||||
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
|
||||
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.nullReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
|
||||
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
|
||||
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
|
@ -75,6 +75,7 @@ public class QuickAction extends CustomPopupWindow {
|
|||
mTrackAnim = AnimationUtils.loadAnimation(anchor.getContext(), R.anim.rail);
|
||||
|
||||
mTrackAnim.setInterpolator(new Interpolator() {
|
||||
@Override
|
||||
public float getInterpolation(float t) {
|
||||
// Pushes past the target area, then snaps back into place.
|
||||
// Equation for graphing: 1.2-((x*1.6)-1.1)^2
|
||||
|
|
|
@ -111,6 +111,7 @@ public class AmenityIndexRepositoryBinary implements AmenityIndexRepository {
|
|||
protected double cRightLongitude;
|
||||
protected int cZoom;
|
||||
|
||||
@Override
|
||||
public synchronized boolean checkCachedAmenities(double topLatitude, double leftLongitude, double bottomLatitude, double rightLongitude,
|
||||
int zoom, String filterId, List<Amenity> toFill, boolean fillFound){
|
||||
boolean inside = cTopLatitude >= topLatitude && cLeftLongitude <= leftLongitude && cRightLongitude >= rightLongitude
|
||||
|
|
|
@ -43,6 +43,7 @@ public class AmenityIndexRepositoryOdb extends BaseLocationIndexRepository<Ameni
|
|||
|
||||
|
||||
private final String[] columns = new String[]{"id", "x", "y", "name", "name_en", "type", "subtype", "opening_hours", "phone", "site"}; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$//$NON-NLS-5$//$NON-NLS-6$//$NON-NLS-7$//$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$
|
||||
@Override
|
||||
public List<Amenity> searchAmenities(int stop, int sleft, int sbottom, int sright, int zoom, PoiFilter filter,
|
||||
List<Amenity> amenities, ResultMatcher<Amenity> matcher){
|
||||
long now = System.currentTimeMillis();
|
||||
|
@ -97,6 +98,7 @@ public class AmenityIndexRepositoryOdb extends BaseLocationIndexRepository<Ameni
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public synchronized void clearCache(){
|
||||
super.clearCache();
|
||||
cFilterId = null;
|
||||
|
@ -124,6 +126,7 @@ public class AmenityIndexRepositoryOdb extends BaseLocationIndexRepository<Ameni
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized boolean checkCachedAmenities(double topLatitude, double leftLongitude, double bottomLatitude, double rightLongitude, int zoom, String filterId, List<Amenity> toFill, boolean fillFound){
|
||||
if (db == null) {
|
||||
return true;
|
||||
|
|
|
@ -99,6 +99,7 @@ public class OsmandSettings {
|
|||
|
||||
// this value string is synchronized with settings_pref.xml preference name
|
||||
public final OsmandPreference<ApplicationMode> APPLICATION_MODE = new OsmandPreference<ApplicationMode>(){
|
||||
@Override
|
||||
public String getId() {
|
||||
return "application_mode";
|
||||
};
|
||||
|
@ -440,6 +441,7 @@ public class OsmandSettings {
|
|||
// this value string is synchronized with settings_pref.xml preference name
|
||||
public final OsmandPreference<DayNightMode> DAYNIGHT_MODE =
|
||||
new EnumIntPreference<DayNightMode>("daynight_mode", DayNightMode.AUTO, false, DayNightMode.values()) {
|
||||
@Override
|
||||
protected boolean setValue(SharedPreferences prefs, DayNightMode val) {
|
||||
ctx.getDaynightHelper().setDayNightMode(val);
|
||||
return super.setValue(prefs, val);
|
||||
|
@ -984,6 +986,7 @@ public class OsmandSettings {
|
|||
|
||||
// this value string is synchronized with settings_pref.xml preference name
|
||||
public final CommonPreference<String> RENDERER = new StringPreference("renderer", RendererRegistry.DEFAULT_RENDER, false) {
|
||||
@Override
|
||||
protected boolean setValue(SharedPreferences prefs, String val) {
|
||||
if(val == null){
|
||||
val = RendererRegistry.DEFAULT_RENDER;
|
||||
|
|
|
@ -143,6 +143,7 @@ public class ProgressDialogImplementation implements IProgress {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isIndeterminate(){
|
||||
return work == -1;
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ public class RegionAddressRepositoryBinary implements RegionAddressRepository {
|
|||
this.postCodes = new TreeMap<String, PostCode>(collator);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close(){
|
||||
this.file = null;
|
||||
}
|
||||
|
@ -64,6 +65,7 @@ public class RegionAddressRepositoryBinary implements RegionAddressRepository {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void preloadBuildings(Street street, ResultMatcher<Building> resultMatcher) {
|
||||
if(street.getBuildings().isEmpty()){
|
||||
try {
|
||||
|
@ -80,10 +82,12 @@ public class RegionAddressRepositoryBinary implements RegionAddressRepository {
|
|||
cities.put(city.getId(), city);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized List<MapObject> getLoadedCities(){
|
||||
return new ArrayList<MapObject>(cities.values());
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void preloadStreets(MapObject o, ResultMatcher<Street> resultMatcher) {
|
||||
assert o instanceof PostCode || o instanceof City;
|
||||
Collection<Street> streets = o instanceof PostCode ? ((PostCode) o).getStreets() : ((City) o).getStreets();
|
||||
|
|
|
@ -114,13 +114,16 @@ public class DownloadIndexActivity extends ListActivity {
|
|||
|
||||
filterText = (EditText) findViewById(R.id.search_box);
|
||||
textWatcher = new TextWatcher() {
|
||||
public void afterTextChanged(Editable s) {
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
}
|
||||
public void beforeTextChanged(CharSequence s, int start, int count,
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count,
|
||||
int after) {
|
||||
}
|
||||
|
||||
public void onTextChanged(CharSequence s, int start, int before,
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before,
|
||||
int count) {
|
||||
DownloadIndexAdapter adapter = ((DownloadIndexAdapter)getListAdapter());
|
||||
if(adapter != null){
|
||||
|
|
|
@ -107,6 +107,7 @@ public class EditPOIFilterActivity extends ListActivity {
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate(R.menu.edit_filter_menu, menu);
|
||||
|
@ -244,6 +245,7 @@ public class EditPOIFilterActivity extends ListActivity {
|
|||
super(EditPOIFilterActivity.this, R.layout.editing_poi_filter_list, amenityTypes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
LayoutInflater inflater = getLayoutInflater();
|
||||
View row = convertView;
|
||||
|
|
|
@ -772,6 +772,7 @@ public class EditingPOIActivity implements DialogProvider {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(int id, Bundle args) {
|
||||
switch (id) {
|
||||
case DIALOG_CREATE_POI:
|
||||
|
@ -833,6 +834,7 @@ public class EditingPOIActivity implements DialogProvider {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPrepareDialog(int id, Dialog dialog, Bundle args) {
|
||||
switch (id) {
|
||||
case DIALOG_CREATE_POI:
|
||||
|
|
|
@ -150,14 +150,17 @@ public class FavouritesActivity extends ExpandableListActivity {
|
|||
private void deleteFavorites() {
|
||||
new AsyncTask<Void, Object, String>(){
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
showProgressBar();
|
||||
};
|
||||
@Override
|
||||
protected void onPostExecute(String result) {
|
||||
hideProgressBar();
|
||||
favouritesAdapter.synchronizeGroups();
|
||||
};
|
||||
|
||||
@Override
|
||||
protected void onProgressUpdate(Object... values) {
|
||||
for(Object o : values){
|
||||
if(o instanceof FavouritePoint){
|
||||
|
@ -345,10 +348,12 @@ public class FavouritesActivity extends ExpandableListActivity {
|
|||
return GPXUtilities.writeGpxFile(f, gpx, FavouritesActivity.this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
showProgressBar();
|
||||
};
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(String warning) {
|
||||
hideProgressBar();
|
||||
if(warning == null){
|
||||
|
@ -401,16 +406,19 @@ public class FavouritesActivity extends ExpandableListActivity {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onProgressUpdate(FavouritePoint... values) {
|
||||
for(FavouritePoint p : values){
|
||||
favouritesAdapter.addFavoritePoint(p);
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
showProgressBar();
|
||||
};
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(String warning) {
|
||||
hideProgressBar();
|
||||
if(warning == null){
|
||||
|
|
|
@ -987,6 +987,7 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate(R.menu.map_menu, menu);
|
||||
|
|
|
@ -674,6 +674,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(int id, Bundle args) {
|
||||
switch (id) {
|
||||
case DIALOG_ADD_FAVORITE:
|
||||
|
@ -694,6 +695,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPrepareDialog(int id, Dialog dialog, Bundle args) {
|
||||
switch (id) {
|
||||
case DIALOG_ADD_FAVORITE:
|
||||
|
|
|
@ -85,6 +85,7 @@ public class OpeningHoursView {
|
|||
public TimeAdapter(List<BasicDayOpeningHourRule> l ){
|
||||
super(ctx, R.layout.open_hours_list_item, l);
|
||||
}
|
||||
@Override
|
||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||
View row = convertView;
|
||||
final BasicDayOpeningHourRule item = getItem(position);
|
||||
|
|
|
@ -66,7 +66,8 @@ public class OsmandApplication extends Application {
|
|||
private Locale prefferedLocale = null;
|
||||
|
||||
|
||||
public void onCreate(){
|
||||
@Override
|
||||
public void onCreate(){
|
||||
super.onCreate();
|
||||
long timeToStart = System.currentTimeMillis();
|
||||
osmandSettings = OsmandSettings.getOsmandSettings(this);
|
||||
|
|
|
@ -70,6 +70,7 @@ public class ShowRouteInfoActivity extends ListActivity {
|
|||
setListAdapter(new RouteInfoAdapter(((OsmandApplication)getApplication()).getRoutingHelper().getRouteDirections()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onListItemClick(ListView parent, View v, int position, long id) {
|
||||
if(position == 0){
|
||||
return;
|
||||
|
@ -138,6 +139,7 @@ public class ShowRouteInfoActivity extends ListActivity {
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
View row = convertView;
|
||||
if (row == null) {
|
||||
|
|
|
@ -136,6 +136,7 @@ public class TipsAndTricksActivity {
|
|||
|
||||
nextButton.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if(historyInd[0] == toShow.size() - 1){
|
||||
int suggest = 0;
|
||||
|
@ -156,6 +157,7 @@ public class TipsAndTricksActivity {
|
|||
|
||||
prevButton.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if(historyInd[0] > 0){
|
||||
historyInd[0] --;
|
||||
|
@ -169,6 +171,7 @@ public class TipsAndTricksActivity {
|
|||
});
|
||||
|
||||
((Button)dlg.findViewById(R.id.CloseButton)).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
dlg.dismiss();
|
||||
}
|
||||
|
|
|
@ -125,6 +125,7 @@ public class GeoIntentActivity extends ListActivity {
|
|||
R.layout.search_address_offline_list_item, places);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
View row = convertView;
|
||||
if (row == null) {
|
||||
|
@ -322,6 +323,7 @@ public class GeoIntentActivity extends ListActivity {
|
|||
point.setName("Lat: " + latitude + ",Lon:" + longitude);
|
||||
} catch (NumberFormatException e) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Toast.makeText(GeoIntentActivity.this,
|
||||
getString(R.string.search_offline_geo_error, geo),
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue