Merge niceRoads with master

This commit is contained in:
Victor Shcherb 2011-10-20 21:08:27 +02:00
commit ba3ecbd0a0
167 changed files with 8463 additions and 4160 deletions

View file

@ -0,0 +1,3 @@
#Mon Oct 10 15:40:12 CEST 2011
eclipse.preferences.version=1
line.separator=\n

View 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

View file

@ -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)

View file

@ -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());

View file

@ -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) {

View 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)

View file

@ -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.");
}

View file

@ -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;
}
}

View file

@ -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;
}

View file

@ -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

View file

@ -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();

View file

@ -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;

View file

@ -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 ),

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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 );
}

View file

@ -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

View file

@ -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();
}

View file

@ -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();
}

View file

@ -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();

View file

@ -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 );
}

View file

@ -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();

View file

@ -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 );
}

View file

@ -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 );

View file

@ -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 );

View file

@ -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

View file

@ -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 );
/**

View file

@ -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 );
/**

View file

@ -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

View file

@ -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

View file

@ -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();
}

View file

@ -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();
}

View file

@ -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();
}

View file

@ -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( "," );

View file

@ -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();

View file

@ -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();

View file

@ -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( "," );

View file

@ -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( "," );

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -174,6 +174,8 @@ package net.osmand;
// Import required classes and packages
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.text.NumberFormat;
import java.text.DecimalFormat;
import java.util.Date;
import java.util.TimeZone;
@ -258,16 +260,21 @@ public class SunriseSunset
double dfLatIn, // latitude
double dfLonIn, // longitude
Date dateInputIn, // date
double dfTimeZoneIn // time zone
)
TimeZone tzIn // time zone
)
{
// Calculate internal representation of timezone offset as fraction of hours from GMT
// Our calculations consider offsets to the West as positive, so we must invert
// the signal of the values provided by the standard library
double dfTimeZoneIn = -1.0 * tzIn.getOffset(dateInputIn.getTime()) / 3600000;
// Copy values supplied as agruments to local variables.
dfLat = dfLatIn;
dfLon = dfLonIn;
dateInput = dateInputIn;
dfTimeZone = dfTimeZoneIn;
origTimeZone = dfTimeZoneIn;
origTimeZone= dfTimeZoneIn;
// Call the method to do the calculations.
doCalculations();
@ -602,6 +609,15 @@ public class SunriseSunset
// Load dateSunrise with data
dfmtDateTime = new SimpleDateFormat( "d M yyyy HH:mm z" );
// Timezone signal is reversed in SunriseSunset class
String tz_signal = origTimeZone <= 0?"+":"-";
double abs_tz = Math.abs(origTimeZone);
NumberFormat formatter = new DecimalFormat("00");
String tz_offset_hours = formatter.format((int)abs_tz);
String tz_offset_minutes = formatter.format((int)(60 * (abs_tz - (int)abs_tz)));
if( bSunriseToday )
{
dateSunrise = dfmtDateTime.parse( iDay
@ -609,7 +625,9 @@ public class SunriseSunset
+ " " + iYear
+ " " + (int)dfHourRise
+ ":" + (int)dfMinRise
+ " GMT+"+origTimeZone );
+ " GMT"
+ tz_signal + tz_offset_hours
+":" + tz_offset_minutes );
}
// Load dateSunset with data
@ -620,7 +638,9 @@ public class SunriseSunset
+ " " + iYear
+ " " + (int)dfHourSet
+ ":" + (int)dfMinSet
+ " GMT+"+origTimeZone );
+ " GMT"
+ tz_signal + tz_offset_hours
+":" + tz_offset_minutes );
}
} // end of try

View file

@ -18,6 +18,7 @@ import net.osmand.binary.BinaryMapIndexReader.MapIndex;
import net.osmand.binary.BinaryMapIndexReader.MapRoot;
import net.osmand.binary.BinaryMapPoiReaderAdapter.PoiRegion;
import net.osmand.binary.BinaryMapTransportReaderAdapter.TransportIndex;
import net.osmand.data.Building;
import net.osmand.data.City;
import net.osmand.data.Street;
import net.osmand.osm.MapUtils;
@ -34,7 +35,7 @@ public class BinaryInspector {
inspector(args);
// test cases show info
//inspector(new String[]{"/home/victor/projects/OsmAnd/data/osm-gen/saved/Belarus-newzooms-new-rt.obf"});
//inspector(new String[]{"-v","C:\\Users\\tpd\\osmand\\Slovakia.obf"});
// inspector(new String[]{"-v","C:\\Users\\tpd\\osmand\\Housenumbers.obf"});
// test case extract parts
@ -338,7 +339,17 @@ public class BinaryInspector {
index.preloadStreets(c, null);
System.out.println("\t\tCity:" + c.getName());
for (Street t : c.getStreets()) {
System.out.println("\t\t\t" + t.getName());
System.out.print("\t\t\t" + t.getName());
index.preloadBuildings(t, null);
List<Building> buildings = t.getBuildings();
if (buildings != null && !buildings.isEmpty()) {
System.out.print(" (");
for (Building b : buildings) {
System.out.print(b.getName() + ",");
}
System.out.print(")");
}
System.out.println();
}
}
for (City c : index.getVillages(region, null,null,false)) {

File diff suppressed because it is too large Load diff

View file

@ -152,6 +152,7 @@ public class Amenity extends MapObject {
}
@Override
public void doDataPreparation() {
}

View file

@ -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();

View file

@ -117,6 +117,7 @@ public class Street extends MapObject {
});
}
@Override
public void doDataPreparation() {
sortBuildings();
calculateCenter();

View file

@ -193,12 +193,16 @@ public class BinaryMapIndexWriter {
MapRulType rule = types.get(tag);
int type = rule.getType(null);
int subType = rule.getSubType(null);
Collection<String> valuesSet = types.get(tag).getValuesSet();
if(type != 0 && subType != 0){
builder.setTag(tag).setType(type).setSubtype(subType).setMinZoom(rule.getMinZoom(null));
builder.setTag(tag).setValue("").setType(type).setSubtype(subType).setMinZoom(rule.getMinZoom(null));
if (valuesSet.isEmpty()) {
codedOutStream.writeMessage(OsmandOdb.OsmAndMapIndex.RULES_FIELD_NUMBER, builder.build());
}
builder = OsmandOdb.MapEncodingRule.newBuilder();
}
for(String val : types.get(tag).getValuesSet()){
for(String val : valuesSet){
type = rule.getType(val);
subType = rule.getSubType(val);
builder.setTag(tag).setValue(val).setType(type).setSubtype(subType).setMinZoom(rule.getMinZoom(null));

View file

@ -9,7 +9,6 @@ import java.util.Set;
import net.osmand.data.Building;
import net.osmand.data.City;
import net.osmand.data.preparation.DBStreetDAO.SimpleStreet;
import net.osmand.osm.Entity;
import net.osmand.osm.LatLon;
import net.osmand.osm.Way;
@ -25,6 +24,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$
}

View file

@ -102,7 +102,7 @@ public enum DBDialect {
//we are exclusive, some speed increase ( no need to get and release logs
statement.executeQuery("PRAGMA locking_mode = EXCLUSIVE");
//increased cache_size, by default it is 2000 and we have quite huge files...
statement.executeUpdate("PRAGMA cache_size = 10000");
//statement.executeUpdate("PRAGMA cache_size = 10000"); cache size could be probably contraproductive on slower disks?
statement.close();
System.out.println(String.format("SQLITE running in %s mode", SQLiteJDBCLoader.isNativeMode() ? "native" : "pure-java"));
return connection;

View file

@ -535,14 +535,14 @@ public class IndexAddressCreator extends AbstractIndexPartCreator{
String cityPart = null;
SimpleStreet foundStreet = streetDAO.findStreet(name, city);
if (foundStreet != null) {
//oops, same street name within one city!
if (foundStreet.getCityPart() == null) {
//we need to update the city part first
String aCityPart = findCityPart(foundStreet.getLocation(), city);
foundStreet = streetDAO.updateStreetCityPart(foundStreet, city, aCityPart != null ? aCityPart : city.getName());
}
//matching the nodes is done somewhere else. This is just a simple check if the streets are really close to each other
if (MapUtils.getDistance(location, foundStreet.getLocation()) > 500) {
//oops, same street name within one city!
if (foundStreet.getCityPart() == null) {
//we need to update the city part first
String aCityPart = findCityPart(foundStreet.getLocation(), city);
foundStreet = streetDAO.updateStreetCityPart(foundStreet, city, aCityPart != null ? aCityPart : city.getName());
}
//now, try to find our cityPart again
cityPart = findCityPart(location, city);
foundStreet = streetDAO.findStreet(name, city, cityPart);
@ -552,6 +552,8 @@ public class IndexAddressCreator extends AbstractIndexPartCreator{
//by default write city with cityPart of the city
long streetId = streetDAO.insertStreet(name, nameEn, location, city, cityPart);
values.add(streetId);
} else {
values.add(foundStreet.getId());
}
}
return values;

View file

@ -608,6 +608,8 @@ public class IndexCreator {
// do not delete first db connection
if (dbConn != null) {
dialect.commitDatabase(dbConn);
dialect.closeDatabase(dbConn);
dbConn = null;
}
if (deleteOsmDB) {
if (DBDialect.DERBY == dialect) {

View file

@ -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;

View file

@ -102,6 +102,7 @@ public class TileSourceManager {
return tileSize;
}
@Override
public String getTileFormat() {
return ext;
}

View file

@ -36,7 +36,6 @@ public class MapRenderingTypes {
private static final Log log = LogUtil.getLog(MapRenderingTypes.class);
// TODO Internet access bits for point, polygon
/** standard schema :
polygon : ll aaaaa ttttt 11 : 14 bits
multi : ll aaaaa ttttt 00 : 14 bits
@ -47,6 +46,7 @@ public class MapRenderingTypes {
t - object type, s - subtype
*/
// keep sync ! not change values
public final static int MULTY_POLYGON_TYPE = 0;
public final static int POLYGON_TYPE = 3;
public final static int POLYLINE_TYPE = 2;

View file

@ -19,6 +19,7 @@
<subtype id="4" polyline="true" tag="highway" value="secondary" minzoom="9" />
<subtype id="4" polyline="true" tag="highway" value="secondary_link" minzoom="10" />
<subtype id="5" polyline="true" tag="highway" value="tertiary" minzoom="10" />
<subtype id="5" polyline="true" tag="highway" value="tertiary_link" minzoom="11" />
<subtype id="6" polygon="true" polyline="true" tag="highway" value="residential" minzoom="12" />
<subtype id="7" polygon="true" polyline="true" tag="highway" value="service" minzoom="13" />
@ -410,7 +411,7 @@
<type id="17" name="natural">
<subtype id="5" polygon="true" tag="natural" value="coastline" minzoom="1" />
<subtype id="1" point="true" polygon="true" tag="natural" value="bay" minzoom="11" />
<subtype id="1" point="true" polygon="true" tag="natural" value="bay" minzoom="5" />
<subtype id="2" point="true" polygon="true" tag="natural" value="beach" minzoom="11" />
<subtype id="3" point="true" polygon_center="true" tag="natural" value="cave_entrance" minzoom="13" />
<subtype id="4" point="true" polyline="true" tag="natural" value="cliff" minzoom="13" />

View file

@ -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());
}

View file

@ -1,561 +0,0 @@
package net.osmand.render;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Stack;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import net.osmand.osm.MapRenderingTypes;
import net.osmand.LogUtil;
import org.apache.commons.logging.Log;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
public class OsmandRenderingRulesParser {
private final static Log log = LogUtil.getLog(OsmandRenderingRulesParser.class);
public static class EffectAttributes {
public int color = 0;
public float strokeWidth = 0;
public String pathEffect = null;
public int shadowColor = 0;
public float shadowRadius = 0;
public String cap = null;
}
public static class TextAttributes {
public int textColor = 0;
public int textOrder = 0;
public float textSize = 0;
public boolean textBold = false;
public String textShield = null;
public int textMinDistance = 0;
public boolean textOnPath = false;
public int textWrapWidth = 0;
public float textHaloRadius = 0;
public int textDy = 0;
public String ref = null;
}
protected static class SwitchState {
List<FilterState> filters = new ArrayList<FilterState>();
}
public static class FilterState {
public int minzoom = -1;
public int maxzoom = -1;
public String tag = null;
public String val = null;
public int layer = 0;
public int textLength = 0;
public float order = 0;
public int orderType = -1;
public Boolean nightMode = null;
public String shader = null;
// point
public String icon = null;
public EffectAttributes main = new EffectAttributes();
public TextAttributes text = null;
public List<EffectAttributes> effectAttributes = new ArrayList<EffectAttributes>(3);
protected EffectAttributes getEffectAttributes(int i) {
i -= 2;
while (i >= effectAttributes.size()) {
effectAttributes.add(new EffectAttributes());
}
return effectAttributes.get(i);
}
}
public interface RenderingRuleVisitor {
/**
* @param state - one of the point, polygon, line, text state
* @param filter
*/
public void visitRule(int state, FilterState filter);
public void rendering(String name, String depends, int defaultColor, int defaultNightColor);
}
public final static int POINT_STATE = MapRenderingTypes.POINT_TYPE;
public final static int LINE_STATE = MapRenderingTypes.POLYLINE_TYPE;
public final static int POLYGON_STATE = MapRenderingTypes.POLYGON_TYPE;
public final static int TEXT_STATE = 4;
public final static int ORDER_STATE = 5;
public void parseRenderingRules(InputStream is, RenderingRuleVisitor visitor) throws IOException, SAXException {
try {
final SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
saxParser.parse(is, new RenderingRulesHandler(saxParser, visitor));
} catch (ParserConfigurationException e) {
throw new SAXException(e);
}
}
private class RenderingRulesHandler extends DefaultHandler {
private final SAXParser parser;
private final RenderingRuleVisitor visitor;
private int state;
Stack<Object> stack = new Stack<Object>();
public RenderingRulesHandler(SAXParser parser, RenderingRuleVisitor visitor){
this.parser = parser;
this.visitor = visitor;
}
@Override
public void startElement(String uri, String localName, String name, Attributes attributes) throws SAXException {
name = parser.isNamespaceAware() ? localName : name;
if("filter".equals(name)){ //$NON-NLS-1$
FilterState st = parseFilterAttributes(attributes);
stack.push(st);
} else if("order".equals(name)){ //$NON-NLS-1$
state = ORDER_STATE;
} else if("text".equals(name)){ //$NON-NLS-1$
state = TEXT_STATE;
} else if("point".equals(name)){ //$NON-NLS-1$
state = POINT_STATE;
} else if("line".equals(name)){ //$NON-NLS-1$
state = LINE_STATE;
} else if("polygon".equals(name)){ //$NON-NLS-1$
state = POLYGON_STATE;
} else if("switch".equals(name)){ //$NON-NLS-1$
SwitchState st = new SwitchState();
stack.push(st);
} else if("case".equals(name)){ //$NON-NLS-1$
FilterState st = parseFilterAttributes(attributes);
((SwitchState)stack.peek()).filters.add(st);
} else if("renderer".equals(name)){ //$NON-NLS-1$
String dc = attributes.getValue("defaultColor");
int defaultColor = 0;
if(dc != null && dc.length() > 0){
defaultColor = parseColor(dc);
}
String dnc = attributes.getValue("defaultNightColor");
int defautNightColor = defaultColor;
if(dnc != null && dnc.length() > 0){
defautNightColor = parseColor(dnc);
}
visitor.rendering(attributes.getValue("name"), attributes.getValue("depends"), defaultColor, defautNightColor); //$NON-NLS-1$ //$NON-NLS-2$
} else {
log.warn("Unknown tag" + name); //$NON-NLS-1$
}
}
@Override
public void endElement(String uri, String localName, String name) throws SAXException {
name = parser.isNamespaceAware() ? localName : name;
if ("filter".equals(name)) { //$NON-NLS-1$
List<FilterState> list = popAndAggregateState();
for (FilterState pop : list) {
if (pop.tag != null && (pop.minzoom != -1 || state == ORDER_STATE)) {
visitor.visitRule(state, pop);
}
}
} else if("switch".equals(name)){ //$NON-NLS-1$
stack.pop();
}
}
public List<FilterState> popAndAggregateState() {
FilterState pop = (FilterState) stack.pop();
List<FilterState> res = null;
for (int i = stack.size() - 1; i >= 0; i--) {
Object o = stack.get(i);
if(o instanceof FilterState){
if(res == null){
mergeStateInto((FilterState) o, pop);
} else {
for(FilterState f : res){
mergeStateInto((FilterState) o, f);
}
}
} else {
List<FilterState> filters = ((SwitchState)o).filters;
if (res == null) {
res = new ArrayList<FilterState>();
res.add(pop);
}
int l = res.size();
for (int t = 0; t < filters.size() - 1; t++) {
for (int j = 0; j < l; j++) {
FilterState n = new FilterState();
mergeStateInto(res.get(j), n);
res.add(n);
}
}
for (int j = 0; j < res.size(); j++) {
mergeStateInto(filters.get(j / l), res.get(j));
}
}
}
if(res == null){
return Collections.singletonList(pop);
} else {
return res;
}
}
public void mergeStateInto(FilterState toMerge, FilterState mergeInto){
if(toMerge.maxzoom != -1 && mergeInto.maxzoom == -1){
mergeInto.maxzoom = toMerge.maxzoom;
}
if(toMerge.minzoom != -1 && mergeInto.minzoom == -1){
mergeInto.minzoom = toMerge.minzoom;
}
if(toMerge.nightMode != null && mergeInto.nightMode == null){
mergeInto.nightMode = toMerge.nightMode;
}
if(toMerge.icon != null && mergeInto.icon == null){
mergeInto.icon = toMerge.icon;
}
if(toMerge.tag != null && mergeInto.tag == null){
mergeInto.tag = toMerge.tag;
}
if(toMerge.orderType != -1 && mergeInto.orderType == -1){
mergeInto.orderType = toMerge.orderType;
}
if(toMerge.layer != 0 && mergeInto.layer == 0){
mergeInto.layer = toMerge.layer;
}
if(toMerge.order != 0 && mergeInto.order == 0){
mergeInto.order = toMerge.order;
}
if(toMerge.textLength != 0 && mergeInto.textLength == 0){
mergeInto.textLength = toMerge.textLength;
}
if(toMerge.val != null && mergeInto.val == null){
mergeInto.val = toMerge.val;
}
if(toMerge.text != null){
if(mergeInto.text == null){
mergeInto.text = new TextAttributes();
}
if(toMerge.text.textColor != 0 && mergeInto.text.textColor == 0){
mergeInto.text.textColor = toMerge.text.textColor;
}
if(toMerge.text.textSize != 0 && mergeInto.text.textSize == 0){
mergeInto.text.textSize = toMerge.text.textSize;
}
if(toMerge.text.textOrder != 0 && mergeInto.text.textOrder == 0){
mergeInto.text.textOrder = toMerge.text.textOrder;
}
if(toMerge.text.textBold && !mergeInto.text.textBold){
mergeInto.text.textBold = toMerge.text.textBold;
}
if(toMerge.text.textShield != null && mergeInto.text.textShield == null){
mergeInto.text.textShield = toMerge.text.textShield;
}
if(toMerge.text.ref != null && mergeInto.text.ref == null){
mergeInto.text.ref = toMerge.text.ref;
}
if(toMerge.text.textMinDistance != 0 && mergeInto.text.textMinDistance == 0){
mergeInto.text.textMinDistance = toMerge.text.textMinDistance;
}
if(toMerge.text.textDy != 0 && mergeInto.text.textDy == 0){
mergeInto.text.textDy = toMerge.text.textDy;
}
if(toMerge.text.textHaloRadius != 0 && mergeInto.text.textHaloRadius == 0){
mergeInto.text.textHaloRadius = toMerge.text.textHaloRadius;
}
if(toMerge.text.textWrapWidth != 0 && mergeInto.text.textWrapWidth == 0){
mergeInto.text.textWrapWidth = toMerge.text.textWrapWidth;
}
if(toMerge.text.textOnPath && !mergeInto.text.textOnPath){
mergeInto.text.textOnPath = toMerge.text.textOnPath;
}
}
mergeStateInto(toMerge.main, mergeInto.main);
while(mergeInto.effectAttributes.size() < toMerge.effectAttributes.size()){
mergeInto.effectAttributes.add(new EffectAttributes());
}
for(int i=0; i<toMerge.effectAttributes.size(); i++){
mergeStateInto(toMerge.effectAttributes.get(i), mergeInto.effectAttributes.get(i));
}
}
public void mergeStateInto(EffectAttributes toMerge, EffectAttributes mergeInto){
if(toMerge.color != 0 && mergeInto.color == 0){
mergeInto.color = toMerge.color;
}
if(toMerge.strokeWidth != 0 && mergeInto.strokeWidth == 0){
mergeInto.strokeWidth = toMerge.strokeWidth;
}
if(toMerge.pathEffect != null && mergeInto.pathEffect == null){
mergeInto.pathEffect = toMerge.pathEffect;
}
if(toMerge.shadowRadius != 0 && mergeInto.shadowRadius == 0){
mergeInto.shadowRadius = toMerge.shadowRadius;
}
if(toMerge.shadowColor != 0 && mergeInto.shadowColor == 0){
mergeInto.shadowColor = toMerge.shadowColor;
}
if(toMerge.cap != null && mergeInto.cap == null){
mergeInto.cap = toMerge.cap;
}
}
public FilterState parseFilterAttributes(Attributes attributes){
FilterState state = new FilterState();
if(this.state == TEXT_STATE){
state.text = new TextAttributes();
}
for(int i=0; i<attributes.getLength(); i++){
String name = attributes.getLocalName(i);
String val = attributes.getValue(i);
if(name.equals("tag")){ //$NON-NLS-1$
state.tag = val;
} else if(name.equals("value")){ //$NON-NLS-1$
state.val = val;
} else if(name.equals("minzoom")){ //$NON-NLS-1$
state.minzoom = Integer.parseInt(val);
} else if(name.equals("maxzoom")){ //$NON-NLS-1$
state.maxzoom = Integer.parseInt(val);
} else if(name.equals("maxzoom")){ //$NON-NLS-1$
state.maxzoom = Integer.parseInt(val);
} else if(name.equals("layer")){ //$NON-NLS-1$
state.layer = Integer.parseInt(val);
} else if(name.equals("orderType")){ //$NON-NLS-1$
int i1 = val.equals("polygon") ? 3 : (val.equals("line") ? 2 : 1); //$NON-NLS-1$ //$NON-NLS-2$
state.orderType = i1;
} else if(name.equals("order")){ //$NON-NLS-1$
state.order = Float.parseFloat(val);
} else if(name.equals("nightMode")){ //$NON-NLS-1$
state.nightMode = Boolean.parseBoolean(val);
} else if(name.equals("icon")){ //$NON-NLS-1$
state.icon = val;
} else if(name.equals("color")){ //$NON-NLS-1$
state.main.color = parseColor(val);
} else if(name.startsWith("color_")){ //$NON-NLS-1$
EffectAttributes ef = state.getEffectAttributes(Integer.parseInt(name.substring(6)));
ef.color = parseColor(val);
} else if(name.equals("shader")){ //$NON-NLS-1$
state.shader = val;
} else if(name.equals("strokeWidth")){ //$NON-NLS-1$
state.main.strokeWidth = Float.parseFloat(val);
} else if(name.startsWith("strokeWidth_")){ //$NON-NLS-1$
EffectAttributes ef = state.getEffectAttributes(Integer.parseInt(name.substring(12)));
ef.strokeWidth = Float.parseFloat(val);
} else if(name.equals("pathEffect")){ //$NON-NLS-1$
state.main.pathEffect = val;
} else if(name.startsWith("pathEffect_")){ //$NON-NLS-1$
EffectAttributes ef = state.getEffectAttributes(Integer.parseInt(name.substring(11)));
ef.pathEffect = val;
} else if(name.equals("shadowRadius")){ //$NON-NLS-1$
state.main.shadowRadius = Float.parseFloat(val);
} else if(name.startsWith("shadowRadius_")){ //$NON-NLS-1$
EffectAttributes ef = state.getEffectAttributes(Integer.parseInt(name.substring(14)));
ef.shadowRadius = Float.parseFloat(val);
} else if(name.equals("shadowColor")){ //$NON-NLS-1$
state.main.shadowColor = parseColor(val);
} else if(name.startsWith("shadowColor_")){ //$NON-NLS-1$
EffectAttributes ef = state.getEffectAttributes(Integer.parseInt(name.substring(12)));
ef.shadowColor = parseColor(val);
} else if(name.equals("cap")){ //$NON-NLS-1$
state.main.cap = val;
} else if(name.startsWith("cap_")){ //$NON-NLS-1$
EffectAttributes ef = state.getEffectAttributes(Integer.parseInt(name.substring(4)));
ef.cap = val;
} else if(name.equals("ref")){ //$NON-NLS-1$
state.text.ref = val;
} else if(name.equals("textSize")){ //$NON-NLS-1$
state.text.textSize = Float.parseFloat(val);
} else if(name.equals("textOrder")){ //$NON-NLS-1$
state.text.textOrder = Integer.parseInt(val);
} else if(name.equals("textBold")){ //$NON-NLS-1$
state.text.textBold = Boolean.parseBoolean(val);
} else if(name.equals("textColor")){ //$NON-NLS-1$
state.text.textColor = parseColor(val);
} else if(name.equals("textLength")){ //$NON-NLS-1$
state.textLength = Integer.parseInt(val);
} else if(name.equals("textShield")){ //$NON-NLS-1$
state.text.textShield = val;
} else if(name.equals("textMinDistance")){ //$NON-NLS-1$
state.text.textMinDistance = Integer.parseInt(val);
} else if(name.equals("textOnPath")){ //$NON-NLS-1$
state.text.textOnPath = Boolean.parseBoolean(val);
} else if(name.equals("textWrapWidth")){ //$NON-NLS-1$
state.text.textWrapWidth = Integer.parseInt(val);
} else if(name.equals("textDy")){ //$NON-NLS-1$
state.text.textDy = Integer.parseInt(val);
} else if(name.equals("textHaloRadius")){ //$NON-NLS-1$
state.text.textHaloRadius = Float.parseFloat(val);
} else {
log.warn("Unknown attribute " + name); //$NON-NLS-1$
}
}
return state;
}
}
/**
* Parse the color string, and return the corresponding color-int.
* If the string cannot be parsed, throws an IllegalArgumentException
* exception. Supported formats are:
* #RRGGBB
* #AARRGGBB
* 'red', 'blue', 'green', 'black', 'white', 'gray', 'cyan', 'magenta',
* 'yellow', 'lightgray', 'darkgray'
*/
public static int parseColor(String colorString) {
if (colorString.charAt(0) == '#') {
// Use a long to avoid rollovers on #ffXXXXXX
long color = Long.parseLong(colorString.substring(1), 16);
if (colorString.length() == 7) {
// Set the alpha value
color |= 0x00000000ff000000;
} else if (colorString.length() != 9) {
throw new IllegalArgumentException("Unknown color" + colorString); //$NON-NLS-1$
}
return (int)color;
}
throw new IllegalArgumentException("Unknown color" + colorString); //$NON-NLS-1$
}
// TEST purpose
public static void main(String[] args) throws IOException, SAXException {
OsmandRenderingRulesParser parser = new OsmandRenderingRulesParser();
parser.parseRenderingRules(OsmandRenderingRulesParser.class.getResourceAsStream("hm.render.xml"), //$NON-NLS-1$
new RenderingRuleVisitor() {
@Override
public void rendering(String name, String depends, int defColor, int defaultNightColor) {
System.out.println("Renderer " + name); //$NON-NLS-1$
}
@Override
public void visitRule(int state, FilterState filter) {
if(filter.nightMode != null){
System.out.println(filter.minzoom +" " +filter.tag + " " + filter.val);
}
String gen = generateAttributes(state, filter);
if (gen != null) {
String res = ""; //$NON-NLS-1$
if (filter.maxzoom != -1) {
res += " zoom : " +filter.minzoom + "-" + filter.maxzoom; //$NON-NLS-1$ //$NON-NLS-2$
} else {
res += " zoom : " +filter.minzoom; //$NON-NLS-1$
}
res += " tag="+filter.tag; //$NON-NLS-1$
res += " val="+filter.val; //$NON-NLS-1$
if(filter.layer != 0){
res += " layer="+filter.layer; //$NON-NLS-1$
}
res += gen;
System.out.println(res);
}
}
});
}
public static String colorToString(int color) {
if ((0xFF000000 & color) == 0xFF000000) {
return "#" + Integer.toHexString(color & 0x00FFFFFF); //$NON-NLS-1$
} else {
return "#" + Integer.toHexString(color); //$NON-NLS-1$
}
}
private static String generateAttributes(int state, FilterState s){
String res = ""; //$NON-NLS-1$
if(s.shader != null){
res+=" shader=" + s.shader; //$NON-NLS-1$
}
if(s.icon != null){
res+= " icon="+s.icon; //$NON-NLS-1$
}
if(s.order != 0){
res+= " order="+s.order; //$NON-NLS-1$
}
if(s.orderType != 0){
res+= " orderType="+s.orderType; //$NON-NLS-1$
}
res = generateAttributes(s.main, res, ""); //$NON-NLS-1$
int p = 2;
for(EffectAttributes ef : s.effectAttributes){
res = generateAttributes(ef, res, "_"+(p++)); //$NON-NLS-1$
}
if(s.text != null){
if(s.text.textSize != 0){
res+= " textSize="+s.text.textSize; //$NON-NLS-1$
}
if(s.text.textOrder != 0){
res+= " textOrder="+s.text.textOrder; //$NON-NLS-1$
}
if(s.text.ref != null){
res+= " ref="+s.text.ref; //$NON-NLS-1$
}
if(s.text.textColor != 0){
res+= " textColor="+colorToString(s.text.textColor); //$NON-NLS-1$
}
if(s.text.textShield != null){
res+= " textShield="+s.text.textShield; //$NON-NLS-1$
}
}
if(state == POLYGON_STATE){
// return res;
} else if(state == LINE_STATE){
// return res;
} else if(state == POINT_STATE){
// return res;
} else if(state == TEXT_STATE){
// return res;
} else if(state == ORDER_STATE){
return res;
}
return null;
}
private static String generateAttributes(EffectAttributes s, String res, String prefix) {
if(s.color != 0){
res +=" color"+prefix+"="+colorToString(s.color); //$NON-NLS-1$ //$NON-NLS-2$
}
if(s.strokeWidth != 0){
res+= " strokeWidth"+prefix+"="+s.strokeWidth; //$NON-NLS-1$ //$NON-NLS-2$
}
if(s.pathEffect != null){
res+= " pathEffect"+prefix+"="+s.pathEffect; //$NON-NLS-1$ //$NON-NLS-2$
}
return res;
}
}

View file

@ -0,0 +1,132 @@
package net.osmand.render;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
public class RenderingRule {
private RenderingRuleProperty[] properties;
private int[] intProperties;
private float[] floatProperties;
private List<RenderingRule> ifElseChildren;
private List<RenderingRule> ifChildren;
private final RenderingRulesStorage storage;
public RenderingRule(Map<String, String> attributes, RenderingRulesStorage storage){
this.storage = storage;
process(attributes);
}
private void process(Map<String, String> attributes) {
ArrayList<RenderingRuleProperty> props = new ArrayList<RenderingRuleProperty>(attributes.size());
intProperties = new int[attributes.size()];
int i = 0;
Iterator<Entry<String, String>> it = attributes.entrySet().iterator();
while (it.hasNext()) {
Entry<String, String> e = it.next();
RenderingRuleProperty property = storage.PROPS.get(e.getKey());
if (property != null) {
props.add(property);
if (property.isString()) {
intProperties[i] = storage.getDictionaryValue(e.getValue());
} else if (property.isFloat()) {
if (floatProperties == null) {
// lazy creates
floatProperties = new float[attributes.size()];
}
floatProperties[i] = property.parseFloatValue(e.getValue());
} else {
intProperties[i] = property.parseIntValue(e.getValue());
}
i++;
}
}
properties = props.toArray(new RenderingRuleProperty[props.size()]);
}
private int getPropertyIndex(String property){
for (int i = 0; i < properties.length; i++) {
RenderingRuleProperty prop = properties[i];
if (prop.getAttrName().equals(property)) {
return i;
}
}
return -1;
}
public String getStringPropertyValue(String property) {
int i = getPropertyIndex(property);
if(i >= 0){
return storage.getStringValue(intProperties[i]);
}
return null;
}
public float getFloatPropertyValue(String property) {
int i = getPropertyIndex(property);
if(i >= 0){
return floatProperties[i];
}
return 0;
}
public String getColorPropertyValue(String property) {
int i = getPropertyIndex(property);
if(i >= 0){
return RenderingRuleProperty.colorToString(intProperties[i]);
}
return null;
}
public int getIntPropertyValue(String property) {
int i = getPropertyIndex(property);
if(i >= 0){
return intProperties[i];
}
return -1;
}
protected int getIntProp(int ind){
return intProperties[ind];
}
protected float getFloatProp(int ind){
return floatProperties[ind];
}
public RenderingRuleProperty[] getProperties() {
return properties;
}
@SuppressWarnings("unchecked")
public List<RenderingRule> getIfChildren() {
return ifChildren != null ? ifChildren : Collections.EMPTY_LIST ;
}
@SuppressWarnings("unchecked")
public List<RenderingRule> getIfElseChildren() {
return ifElseChildren != null ? ifElseChildren : Collections.EMPTY_LIST ;
}
public void addIfChildren(RenderingRule rr){
if(ifChildren == null){
ifChildren = new ArrayList<RenderingRule>();
}
ifChildren.add(rr);
}
public void addIfElseChildren(RenderingRule rr){
if(ifElseChildren == null){
ifElseChildren = new ArrayList<RenderingRule>();
}
ifElseChildren.add(rr);
}
}

View file

@ -0,0 +1,264 @@
package net.osmand.render;
import net.osmand.LogUtil;
import org.apache.commons.logging.Log;
public class RenderingRuleProperty {
private final static Log log = LogUtil.getLog(RenderingRuleProperty.class);
private final static int INT_TYPE = 1;
private final static int FLOAT_TYPE = 2;
private final static int STRING_TYPE = 3;
private final static int COLOR_TYPE = 4;
private final static int BOOLEAN_TYPE = 5;
public static final int TRUE_VALUE = 1;
public static final int FALSE_VALUE = 0;
protected final int type;
protected final boolean input;
protected final String attrName;
protected int id = -1;
// use for custom rendering rule properties
protected String name;
protected String description;
protected String[] possibleValues;
private RenderingRuleProperty(String attrName, int type, boolean input){
this.attrName = attrName;
this.type = type;
this.input = input;
}
public boolean isInputProperty() {
return input;
}
public boolean isOutputProperty() {
return !input;
}
public void setId(int id) {
if (this.id != -1) {
throw new IllegalArgumentException();
}
this.id = id;
}
public int getId() {
return id;
}
public String getAttrName() {
return attrName;
}
public String getName() {
return name;
}
public String getDescription() {
return description;
}
protected void setName(String name) {
this.name = name;
}
protected void setDescription(String description) {
this.description = description;
}
protected void setPossibleValues(String[] possibleValues) {
this.possibleValues = possibleValues;
}
public String[] getPossibleValues() {
if (isBoolean()) {
return new String[] { "true", "false" };
}
return possibleValues;
}
public boolean isBoolean() {
return type == BOOLEAN_TYPE;
}
public boolean isFloat() {
return type == FLOAT_TYPE;
}
public boolean isInt() {
return type == INT_TYPE;
}
public boolean isColor() {
return type == COLOR_TYPE;
}
public boolean isString() {
return type == STRING_TYPE;
}
public boolean isIntParse(){
return type == INT_TYPE || type == STRING_TYPE || type == COLOR_TYPE || type == BOOLEAN_TYPE;
}
public boolean accept(int ruleValue, int renderingProperty){
if(!isIntParse() || !input){
return false;
}
return ruleValue == renderingProperty;
}
public boolean accept(float ruleValue, float renderingProperty){
if(type != FLOAT_TYPE || !input){
return false;
}
return ruleValue == renderingProperty;
}
@Override
public String toString() {
return "#RenderingRuleProperty " + getAttrName();
}
public int parseIntValue(String value){
if(type == INT_TYPE){
try {
return Integer.parseInt(value);
} catch (NumberFormatException e) {
log.error("Rendering parse " + value);
}
return -1;
} else if(type == BOOLEAN_TYPE){
return Boolean.parseBoolean(value) ? TRUE_VALUE : FALSE_VALUE;
} else if(type == STRING_TYPE){
// requires dictionary to parse
return -1;
} else if(type == COLOR_TYPE){
try {
return parseColor(value);
} catch (RuntimeException e) {
log.error("Rendering parse " + e.getMessage());
}
return -1;
} else {
return -1;
}
}
public float parseFloatValue(String value){
if(type == FLOAT_TYPE){
try {
return Float.parseFloat(value);
} catch (NumberFormatException e) {
log.error("Rendering parse " + value);
}
return -1;
} else {
return -1;
}
}
public static RenderingRuleProperty createOutputIntProperty(String name){
return new RenderingRuleProperty(name, INT_TYPE, false);
}
public static RenderingRuleProperty createOutputBooleanProperty(String name){
return new RenderingRuleProperty(name, BOOLEAN_TYPE, false);
}
public static RenderingRuleProperty createInputBooleanProperty(String name){
return new RenderingRuleProperty(name, BOOLEAN_TYPE, true);
}
public static RenderingRuleProperty createOutputFloatProperty(String name){
return new RenderingRuleProperty(name, FLOAT_TYPE, false);
}
public static RenderingRuleProperty createOutputStringProperty(String name){
return new RenderingRuleProperty(name, STRING_TYPE, false);
}
public static RenderingRuleProperty createInputIntProperty(String name){
return new RenderingRuleProperty(name, INT_TYPE, true);
}
public static RenderingRuleProperty createInputColorProperty(String name){
return new RenderingRuleProperty(name, COLOR_TYPE, true);
}
public static RenderingRuleProperty createOutputColorProperty(String name){
return new RenderingRuleProperty(name, COLOR_TYPE, false);
}
public static RenderingRuleProperty createInputStringProperty(String name){
return new RenderingRuleProperty(name, STRING_TYPE, true);
}
public static RenderingRuleProperty createInputLessIntProperty(String name){
return new RenderingRuleProperty(name, INT_TYPE, true) {
@Override
public boolean accept(int ruleValue, int renderingProperty) {
if(!isIntParse() || !input){
return false;
}
return ruleValue >= renderingProperty;
}
};
}
public static RenderingRuleProperty createInputGreaterIntProperty(String name){
return new RenderingRuleProperty(name, INT_TYPE, true) {
@Override
public boolean accept(int ruleValue, int renderingProperty) {
if(!isIntParse() || !input){
return false;
}
return ruleValue <= renderingProperty;
}
};
}
/**
* Parse the color string, and return the corresponding color-int.
* If the string cannot be parsed, throws an IllegalArgumentException
* exception. Supported formats are:
* #RRGGBB
* #AARRGGBB
* 'red', 'blue', 'green', 'black', 'white', 'gray', 'cyan', 'magenta',
* 'yellow', 'lightgray', 'darkgray'
*/
public static int parseColor(String colorString) {
if (colorString.charAt(0) == '#') {
// Use a long to avoid rollovers on #ffXXXXXX
long color = Long.parseLong(colorString.substring(1), 16);
if (colorString.length() == 7) {
// Set the alpha value
color |= 0x00000000ff000000;
} else if (colorString.length() != 9) {
throw new IllegalArgumentException("Unknown color" + colorString); //$NON-NLS-1$
}
return (int)color;
}
throw new IllegalArgumentException("Unknown color" + colorString); //$NON-NLS-1$
}
public static String colorToString(int color) {
if ((0xFF000000 & color) == 0xFF000000) {
return "#" + Integer.toHexString(color & 0x00FFFFFF); //$NON-NLS-1$
} else {
return "#" + Integer.toHexString(color); //$NON-NLS-1$
}
}
}

View file

@ -0,0 +1,218 @@
package net.osmand.render;
public class RenderingRuleSearchRequest {
private final RenderingRulesStorage storage;
private final RenderingRuleSearchRequest dependsRequest;
RenderingRuleProperty[] props;
int[] values;
float[] fvalues;
int[] savedValues;
float[] savedFvalues;
boolean searchResult = false;
public final RenderingRuleStorageProperties ALL;
public RenderingRuleSearchRequest(RenderingRulesStorage storage) {
this.storage = storage;
this.ALL = storage.PROPS;
if(storage.getDependsStorage() != null){
dependsRequest = new RenderingRuleSearchRequest(storage.getDependsStorage());
} else {
dependsRequest = null;
}
props = storage.PROPS.getPoperties();
values = new int[props.length];
for (int i = 0; i < props.length; i++) {
if (!props[i].isColor()) {
values[i] = -1;
}
}
fvalues = new float[props.length];
saveState();
}
public void setStringFilter(RenderingRuleProperty p, String filter) {
assert p.isInputProperty();
values[p.getId()] = storage.getDictionaryValue(filter);
}
public void setIntFilter(RenderingRuleProperty p, int filter) {
assert p.isInputProperty();
values[p.getId()] = filter;
}
public void setBooleanFilter(RenderingRuleProperty p, boolean filter) {
assert p.isInputProperty();
values[p.getId()] = filter ? RenderingRuleProperty.TRUE_VALUE : RenderingRuleProperty.FALSE_VALUE;
}
public void saveState() {
savedValues = new int[values.length];
savedFvalues = new float[fvalues.length];
System.arraycopy(values, 0, savedValues, 0, values.length);
System.arraycopy(fvalues, 0, savedFvalues, 0, fvalues.length);
}
public void clearState() {
System.arraycopy(savedValues, 0, values, 0, values.length);
System.arraycopy(savedFvalues, 0, fvalues, 0, fvalues.length);
}
public void setInitialTagValueZoom(String tag, String val, int zoom){
clearState();
setIntFilter(ALL.R_MINZOOM, zoom);
setIntFilter(ALL.R_MAXZOOM, zoom);
setStringFilter(ALL.R_TAG, tag);
setStringFilter(ALL.R_VALUE, val);
}
public void setTagValueZoomLayer(String tag, String val, int zoom, int layer){
setIntFilter(ALL.R_MINZOOM, zoom);
setIntFilter(ALL.R_MAXZOOM, zoom);
setIntFilter(ALL.R_LAYER, layer);
setStringFilter(ALL.R_TAG, tag);
setStringFilter(ALL.R_VALUE, val);
}
public boolean isFound() {
return searchResult;
}
public boolean search(int state) {
return search(state, true);
}
public boolean search(int state, boolean loadOutput) {
searchResult = false;
int tagKey = values[storage.PROPS.R_TAG.getId()];
int valueKey = values[storage.PROPS.R_VALUE.getId()];
boolean result = searchInternal(state, tagKey, valueKey, loadOutput);
if (result) {
searchResult = true;
return true;
}
result = searchInternal(state, tagKey, 0, loadOutput);
if (result) {
searchResult = true;
return true;
}
result = searchInternal(state, 0, 0, loadOutput);
if (result) {
searchResult = true;
return true;
}
if(dependsRequest != null){
// TODO search depends ?
// and copy results to local array
// dependsRequest.search(state);
}
return false;
}
private boolean searchInternal(int state, int tagKey, int valueKey, boolean loadOutput) {
values[storage.PROPS.R_TAG.getId()] = tagKey;
values[storage.PROPS.R_VALUE.getId()] = valueKey;
RenderingRule accept = storage.getRule(state, tagKey, valueKey);
if (accept == null) {
return false;
}
boolean match = visitRule(accept, loadOutput);
return match;
}
private boolean visitRule(RenderingRule rule, boolean loadOutput) {
RenderingRuleProperty[] properties = rule.getProperties();
for (int i = 0; i < properties.length; i++) {
RenderingRuleProperty rp = properties[i];
if (rp.isInputProperty()) {
boolean match;
if (rp.isFloat()) {
match = rp.accept(rule.getFloatProp(i), fvalues[rp.getId()]);
} else {
match = rp.accept(rule.getIntProp(i), values[rp.getId()]);
}
if (!match) {
return false;
}
}
}
if (!loadOutput) {
return true;
}
// accept it
for (int i = 0; i < properties.length; i++) {
RenderingRuleProperty rp = properties[i];
if (rp.isOutputProperty()) {
searchResult = true;
if (rp.isFloat()) {
fvalues[rp.getId()] = rule.getFloatProp(i);
} else {
values[rp.getId()] = rule.getIntProp(i);
}
}
}
for (RenderingRule rr : rule.getIfElseChildren()) {
boolean match = visitRule(rr, loadOutput);
if (match) {
break;
}
}
for(RenderingRule rr : rule.getIfChildren()){
visitRule(rr, loadOutput);
}
return true;
}
public boolean isSpecified(RenderingRuleProperty property){
if(property.isFloat()){
return fvalues[property.getId()] != 0;
} else {
int val = values[property.getId()];
if(property.isColor()){
return val != 0;
} else {
return val != -1;
}
}
}
public RenderingRuleProperty[] getProperties() {
return props;
}
public String getStringPropertyValue(RenderingRuleProperty property) {
int val = values[property.getId()];
if(val < 0){
return null;
}
return storage.getStringValue(val);
}
public float getFloatPropertyValue(RenderingRuleProperty property) {
return fvalues[property.getId()];
}
public String getColorStringPropertyValue(RenderingRuleProperty property) {
return RenderingRuleProperty.colorToString(values[property.getId()]);
}
public int getIntPropertyValue(RenderingRuleProperty property) {
return values[property.getId()];
}
public int getIntPropertyValue(RenderingRuleProperty property, int defValue) {
int val = values[property.getId()];
return val == -1 ? defValue : val;
}
}

View file

@ -0,0 +1,168 @@
package net.osmand.render;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
public class RenderingRuleStorageProperties {
public static final String TEXT_LENGTH = "textLength";
public static final String REF = "ref";
public static final String TEXT_SHIELD = "textShield";
public static final String SHADOW_RADIUS = "shadowRadius";
public static final String SHADOW_COLOR = "shadowColor";
public static final String SHADER = "shader";
public static final String CAP_3 = "cap_3";
public static final String CAP_2 = "cap_2";
public static final String CAP = "cap";
public static final String PATH_EFFECT_3 = "pathEffect_3";
public static final String PATH_EFFECT_2 = "pathEffect_2";
public static final String PATH_EFFECT = "pathEffect";
public static final String STROKE_WIDTH_3 = "strokeWidth_3";
public static final String STROKE_WIDTH_2 = "strokeWidth_2";
public static final String STROKE_WIDTH = "strokeWidth";
public static final String COLOR_3 = "color_3";
public static final String COLOR = "color";
public static final String COLOR_2 = "color_2";
public static final String TEXT_BOLD = "textBold";
public static final String TEXT_ORDER = "textOrder";
public static final String TEXT_MIN_DISTANCE = "textMinDistance";
public static final String TEXT_ON_PATH = "textOnPath";
public static final String ICON = "icon";
public static final String LAYER = "layer";
public static final String ORDER = "order";
public static final String ORDER_TYPE = "orderType";
public static final String TAG = "tag";
public static final String VALUE = "value";
public static final String MINZOOM = "minzoom";
public static final String MAXZOOM = "maxzoom";
public static final String NIGHT_MODE = "nightMode";
public static final String TEXT_DY = "textDy";
public static final String TEXT_SIZE = "textSize";
public static final String TEXT_COLOR = "textColor";
public static final String TEXT_HALO_RADIUS = "textHaloRadius";
public static final String TEXT_WRAP_WIDTH = "textWrapWidth";
public RenderingRuleProperty R_TEXT_LENGTH;
public RenderingRuleProperty R_REF;
public RenderingRuleProperty R_TEXT_SHIELD;
public RenderingRuleProperty R_SHADOW_RADIUS;
public RenderingRuleProperty R_SHADOW_COLOR;
public RenderingRuleProperty R_SHADER;
public RenderingRuleProperty R_CAP_3;
public RenderingRuleProperty R_CAP_2;
public RenderingRuleProperty R_CAP;
public RenderingRuleProperty R_PATH_EFFECT_3;
public RenderingRuleProperty R_PATH_EFFECT_2;
public RenderingRuleProperty R_PATH_EFFECT;
public RenderingRuleProperty R_STROKE_WIDTH_3;
public RenderingRuleProperty R_STROKE_WIDTH_2;
public RenderingRuleProperty R_STROKE_WIDTH;
public RenderingRuleProperty R_COLOR_3;
public RenderingRuleProperty R_COLOR;
public RenderingRuleProperty R_COLOR_2;
public RenderingRuleProperty R_TEXT_BOLD;
public RenderingRuleProperty R_TEXT_ORDER;
public RenderingRuleProperty R_TEXT_MIN_DISTANCE;
public RenderingRuleProperty R_TEXT_ON_PATH;
public RenderingRuleProperty R_ICON;
public RenderingRuleProperty R_LAYER;
public RenderingRuleProperty R_ORDER;
public RenderingRuleProperty R_ORDER_TYPE;
public RenderingRuleProperty R_TAG;
public RenderingRuleProperty R_VALUE;
public RenderingRuleProperty R_MINZOOM;
public RenderingRuleProperty R_MAXZOOM;
public RenderingRuleProperty R_NIGHT_MODE;
public RenderingRuleProperty R_TEXT_DY;
public RenderingRuleProperty R_TEXT_SIZE;
public RenderingRuleProperty R_TEXT_COLOR;
public RenderingRuleProperty R_TEXT_HALO_RADIUS;
public RenderingRuleProperty R_TEXT_WRAP_WIDTH;
final Map<String, RenderingRuleProperty> properties = new LinkedHashMap<String, RenderingRuleProperty>();
final List<RenderingRuleProperty> rules = new ArrayList<RenderingRuleProperty>();
final List<RenderingRuleProperty> customRules = new ArrayList<RenderingRuleProperty>();
public RenderingRuleStorageProperties() {
createDefaultRenderingRuleProperties();
}
public void createDefaultRenderingRuleProperties() {
R_TAG = registerRuleInternal(RenderingRuleProperty.createInputStringProperty(TAG));
R_VALUE = registerRuleInternal(RenderingRuleProperty.createInputStringProperty(VALUE));
R_MINZOOM = registerRuleInternal(RenderingRuleProperty.createInputGreaterIntProperty(MINZOOM));
R_MAXZOOM = registerRuleInternal(RenderingRuleProperty.createInputLessIntProperty(MAXZOOM));
R_NIGHT_MODE = registerRuleInternal(RenderingRuleProperty.createInputBooleanProperty(NIGHT_MODE));
R_LAYER = registerRuleInternal(RenderingRuleProperty.createInputIntProperty(LAYER));
R_ORDER_TYPE = registerRuleInternal(RenderingRuleProperty.createInputIntProperty(ORDER_TYPE));
R_TEXT_LENGTH = registerRuleInternal(RenderingRuleProperty.createInputIntProperty(TEXT_LENGTH));
R_REF = registerRuleInternal(RenderingRuleProperty.createInputBooleanProperty(REF));
// order - no sense to make it float
R_ORDER = registerRuleInternal(RenderingRuleProperty.createOutputIntProperty(ORDER));
// text properties
R_TEXT_WRAP_WIDTH = registerRuleInternal(RenderingRuleProperty.createOutputIntProperty(TEXT_WRAP_WIDTH));
R_TEXT_DY = registerRuleInternal(RenderingRuleProperty.createOutputIntProperty(TEXT_DY));
R_TEXT_HALO_RADIUS = registerRuleInternal(RenderingRuleProperty.createOutputIntProperty(TEXT_HALO_RADIUS));
R_TEXT_SIZE = registerRuleInternal(RenderingRuleProperty.createOutputIntProperty(TEXT_SIZE));
R_TEXT_ORDER = registerRuleInternal(RenderingRuleProperty.createOutputIntProperty(TEXT_ORDER));
R_TEXT_MIN_DISTANCE = registerRuleInternal(RenderingRuleProperty.createOutputIntProperty(TEXT_MIN_DISTANCE));
R_TEXT_SHIELD = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty(TEXT_SHIELD));
R_TEXT_COLOR = registerRuleInternal(RenderingRuleProperty.createOutputColorProperty(TEXT_COLOR));
R_TEXT_BOLD = registerRuleInternal(RenderingRuleProperty.createOutputBooleanProperty(TEXT_BOLD));
R_TEXT_ON_PATH = registerRuleInternal(RenderingRuleProperty.createOutputBooleanProperty(TEXT_ON_PATH));
// point
R_ICON = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty(ICON));
// polygon/way
R_COLOR = registerRuleInternal(RenderingRuleProperty.createOutputColorProperty(COLOR));
R_COLOR_2 = registerRuleInternal(RenderingRuleProperty.createOutputColorProperty(COLOR_2));
R_COLOR_3 = registerRuleInternal(RenderingRuleProperty.createOutputColorProperty(COLOR_3));
R_STROKE_WIDTH = registerRuleInternal(RenderingRuleProperty.createOutputFloatProperty(STROKE_WIDTH));
R_STROKE_WIDTH_2 = registerRuleInternal(RenderingRuleProperty.createOutputFloatProperty(STROKE_WIDTH_2));
R_STROKE_WIDTH_3 = registerRuleInternal(RenderingRuleProperty.createOutputFloatProperty(STROKE_WIDTH_3));
R_PATH_EFFECT = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty(PATH_EFFECT));
R_PATH_EFFECT_2 = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty(PATH_EFFECT_2));
R_PATH_EFFECT_3 = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty(PATH_EFFECT_3));
R_CAP = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty(CAP));
R_CAP_2 = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty(CAP_2));
R_CAP_3 = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty(CAP_3));
R_SHADER = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty(SHADER));
R_SHADOW_COLOR = registerRuleInternal(RenderingRuleProperty.createOutputColorProperty(SHADOW_COLOR));
R_SHADOW_RADIUS = registerRuleInternal(RenderingRuleProperty.createOutputIntProperty(SHADOW_RADIUS));
}
public RenderingRuleProperty get(String name) {
return properties.get(name);
}
public RenderingRuleProperty[] getPoperties() {
return rules.toArray(new RenderingRuleProperty[rules.size()]);
}
public List<RenderingRuleProperty> getCustomRules() {
return customRules;
}
private RenderingRuleProperty registerRuleInternal(RenderingRuleProperty p) {
properties.put(p.getAttrName(), p);
p.setId(rules.size());
rules.add(p);
return p;
}
public RenderingRuleProperty registerRule(RenderingRuleProperty p) {
registerRuleInternal(p);
customRules.add(p);
return p;
}
}

View file

@ -0,0 +1,417 @@
package net.osmand.render;
import gnu.trove.map.hash.TIntObjectHashMap;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Stack;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import net.osmand.LogUtil;
import net.osmand.osm.MapRenderingTypes;
import org.apache.commons.logging.Log;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
public class RenderingRulesStorage {
private final static Log log = LogUtil.getLog(RenderingRulesStorage.class);
// keep sync !
public final static int POINT_RULES = MapRenderingTypes.POINT_TYPE;
public final static int LINE_RULES = MapRenderingTypes.POLYLINE_TYPE;
public final static int POLYGON_RULES = MapRenderingTypes.POLYGON_TYPE;
public final static int TEXT_RULES = 4;
public final static int ORDER_RULES = 5;
private final static int LENGTH_RULES = 6;
private final static int SHIFT_TAG_VAL = 16;
List<String> dictionary = new ArrayList<String>();
Map<String, Integer> dictionaryMap = new LinkedHashMap<String, Integer>();
public final RenderingRuleStorageProperties PROPS = new RenderingRuleStorageProperties();
@SuppressWarnings("unchecked")
protected TIntObjectHashMap<RenderingRule>[] tagValueGlobalRules = new TIntObjectHashMap[LENGTH_RULES];
private int bgColor = 0;
private int bgNightColor = 0;
private String renderingName;
private String depends;
private RenderingRulesStorage dependsStorage;
public RenderingRulesStorage(){
// register empty string as 0
getDictionaryValue("");
}
public int getDictionaryValue(String val) {
if(dictionaryMap.containsKey(val)){
return dictionaryMap.get(val);
}
int nextInd = dictionaryMap.size();
dictionaryMap.put(val, nextInd);
dictionary.add(val);
return nextInd;
}
public String getStringValue(int i){
return dictionary.get(i);
}
public String getName() {
return renderingName;
}
public int getBgColor() {
return bgColor;
}
public int getBgNightColor() {
return bgNightColor;
}
public int getBgColor(boolean nightMode){
return nightMode ? bgNightColor : bgColor;
}
public String getDepends() {
return depends;
}
public RenderingRulesStorage getDependsStorage() {
return dependsStorage;
}
public void setDependsStorage(RenderingRulesStorage dependsStorage) {
this.dependsStorage = dependsStorage;
}
public void parseRulesFromXmlInputStream(InputStream is) throws SAXException, IOException {
try {
final SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
saxParser.parse(is, new RenderingRulesHandler(saxParser));
} catch (ParserConfigurationException e) {
throw new SAXException(e);
}
}
public static String colorToString(int color) {
if ((0xFF000000 & color) == 0xFF000000) {
return "#" + Integer.toHexString(color & 0x00FFFFFF); //$NON-NLS-1$
} else {
return "#" + Integer.toHexString(color); //$NON-NLS-1$
}
}
@SuppressWarnings("unchecked")
private void registerGlobalRule(RenderingRule rr, int state, Map<String, String> attrsMap) throws SAXException {
int tag = rr.getIntPropertyValue(RenderingRuleStorageProperties.TAG);
if(tag == -1){
throw new SAXException("Attribute tag should be specified for root filter " + attrsMap.toString());
}
int value = rr.getIntPropertyValue(RenderingRuleStorageProperties.VALUE);
if(value == -1){
throw new SAXException("Attribute tag should be specified for root filter " + attrsMap.toString());
}
int key = (tag << SHIFT_TAG_VAL) + value;
RenderingRule toInsert = rr;
RenderingRule previous = tagValueGlobalRules[state].get(key);
if(previous != null){
if(previous.getProperties().length != 0){
toInsert = new RenderingRule(Collections.EMPTY_MAP, RenderingRulesStorage.this);
toInsert.addIfElseChildren(previous);
} else {
toInsert = previous;
}
toInsert.addIfElseChildren(rr);
}
tagValueGlobalRules[state].put(key, toInsert);
}
private class GroupRules {
Map<String, String> groupAttributes = new LinkedHashMap<String, String>();
List<RenderingRule> children = new ArrayList<RenderingRule>();
List<GroupRules> childrenGroups = new ArrayList<GroupRules>();
private void addGroupFilter(RenderingRule rr) {
for (RenderingRule ch : children) {
ch.addIfChildren(rr);
}
for(GroupRules gch : childrenGroups){
gch.addGroupFilter(rr);
}
}
public void registerGlobalRules(int state) throws SAXException {
for (RenderingRule ch : children) {
registerGlobalRule(ch, state, groupAttributes);
}
for(GroupRules gch : childrenGroups){
gch.registerGlobalRules(state);
}
}
}
private class RenderingRulesHandler extends DefaultHandler {
private final SAXParser parser;
private int state;
Stack<Object> stack = new Stack<Object>();
Map<String, String> attrsMap = new LinkedHashMap<String, String>();
public RenderingRulesHandler(SAXParser parser){
this.parser = parser;
}
@Override
public void startElement(String uri, String localName, String name, Attributes attributes) throws SAXException {
name = parser.isNamespaceAware() ? localName : name;
boolean stateChanged = false;
if("filter".equals(name)){ //$NON-NLS-1$
attrsMap.clear();
if (stack.size() > 0 && stack.peek() instanceof GroupRules) {
GroupRules parent = ((GroupRules) stack.peek());
attrsMap.putAll(parent.groupAttributes);
}
parseAttributes(attributes, attrsMap);
RenderingRule renderingRule = new RenderingRule(attrsMap, RenderingRulesStorage.this);
if (stack.size() > 0 && stack.peek() instanceof GroupRules) {
GroupRules parent = ((GroupRules) stack.peek());
parent.children.add(renderingRule);
} else if (stack.size() > 0 && stack.peek() instanceof RenderingRule) {
RenderingRule parent = ((RenderingRule) stack.peek());
parent.addIfElseChildren(renderingRule);
} else {
registerGlobalRule(renderingRule, state, attrsMap);
}
stack.push(renderingRule);
} else if("groupFilter".equals(name)){ //$NON-NLS-1$
attrsMap.clear();
parseAttributes(attributes, attrsMap);
RenderingRule renderingRule = new RenderingRule(attrsMap, RenderingRulesStorage.this);
if (stack.size() > 0 && stack.peek() instanceof GroupRules) {
GroupRules parent = ((GroupRules) stack.peek());
parent.addGroupFilter(renderingRule);
} else if (stack.size() > 0 && stack.peek() instanceof RenderingRule) {
((RenderingRule) stack.peek()).addIfChildren(renderingRule);
} else {
throw new SAXException("Group filter without parent");
}
stack.push(renderingRule);
} else if("group".equals(name)){ //$NON-NLS-1$
GroupRules groupRules = new GroupRules();
if (stack.size() > 0 && stack.peek() instanceof GroupRules) {
GroupRules parent = ((GroupRules) stack.peek());
groupRules.groupAttributes.putAll(parent.groupAttributes);
parent.childrenGroups.add(groupRules);
}
parseAttributes(attributes, groupRules.groupAttributes);
stack.push(groupRules);
} else if("order".equals(name)){ //$NON-NLS-1$
state = ORDER_RULES;
stateChanged = true;
} else if("text".equals(name)){ //$NON-NLS-1$
state = TEXT_RULES;
stateChanged = true;
} else if("point".equals(name)){ //$NON-NLS-1$
state = POINT_RULES;
stateChanged = true;
} else if("line".equals(name)){ //$NON-NLS-1$
state = LINE_RULES;
stateChanged = true;
} else if("polygon".equals(name)){ //$NON-NLS-1$
state = POLYGON_RULES;
stateChanged = true;
} else if("renderingProperty".equals(name)){ //$NON-NLS-1$
String attr = attributes.getValue("attr");
RenderingRuleProperty prop;
String type = attributes.getValue("type");
if("boolean".equalsIgnoreCase(type)){
prop = RenderingRuleProperty.createInputBooleanProperty(attr);
} else if("string".equalsIgnoreCase(type)){
prop = RenderingRuleProperty.createInputStringProperty(attr);
} else {
prop = RenderingRuleProperty.createInputIntProperty(attr);
}
prop.setDescription(attributes.getValue("description"));
prop.setName(attributes.getValue("name"));
if(attributes.getValue("possibleValues") != null){
prop.setPossibleValues(attributes.getValue("possibleValues").split(","));
}
PROPS.registerRule(prop);
} else if("renderingStyle".equals(name)){ //$NON-NLS-1$
String dc = attributes.getValue("defaultColor");
int defaultColor = 0;
if(dc != null && dc.length() > 0){
bgColor = RenderingRuleProperty.parseColor(dc);
}
String dnc = attributes.getValue("defaultNightColor");
bgNightColor = defaultColor;
if(dnc != null && dnc.length() > 0){
bgNightColor = RenderingRuleProperty.parseColor(dnc);
}
renderingName = attributes.getValue("name");
depends = attributes.getValue("depends");
} else if("renderer".equals(name)){ //$NON-NLS-1$
throw new SAXException("Rendering style is deprecated and no longer supported.");
} else {
log.warn("Unknown tag : " + name); //$NON-NLS-1$
}
if(stateChanged){
tagValueGlobalRules[state] = new TIntObjectHashMap<RenderingRule>();
}
}
private Map<String, String> parseAttributes(Attributes attributes, Map<String, String> m) {
for (int i = 0; i < attributes.getLength(); i++) {
String name = parser.isNamespaceAware() ? attributes.getLocalName(i) : attributes.getQName(i);
m.put(name, attributes.getValue(i));
}
return m;
}
@Override
public void endElement(String uri, String localName, String name) throws SAXException {
name = parser.isNamespaceAware() ? localName : name;
if ("filter".equals(name)) { //$NON-NLS-1$
stack.pop();
} else if("group".equals(name)){ //$NON-NLS-1$
GroupRules group = (GroupRules) stack.pop();
if (stack.size() == 0) {
group.registerGlobalRules(state);
}
} else if("groupFilter".equals(name)){ //$NON-NLS-1$
stack.pop();
}
}
}
public int getTagValueKey(String tag, String value){
int itag = getDictionaryValue(tag);
int ivalue = getDictionaryValue(value);
return (itag << SHIFT_TAG_VAL) | ivalue;
}
public String getValueString(int tagValueKey){
return getStringValue(tagValueKey & ((1 << SHIFT_TAG_VAL) - 1));
}
public String getTagString(int tagValueKey){
return getStringValue(tagValueKey >> SHIFT_TAG_VAL);
}
protected RenderingRule getRule(int state, int itag, int ivalue){
if(tagValueGlobalRules[state] != null){
return tagValueGlobalRules[state].get((itag << SHIFT_TAG_VAL) | ivalue);
}
return null;
}
public void printDebug(int state, PrintStream out){
for(int key : tagValueGlobalRules[state].keys()) {
RenderingRule rr = tagValueGlobalRules[state].get(key);
out.print("\n\n"+getTagString(key) + " : " + getValueString(key));
printRenderingRule("", rr, out);
}
}
private static void printRenderingRule(String indent, RenderingRule rr, PrintStream out){
indent += " ";
out.print("\n"+indent);
for(RenderingRuleProperty p : rr.getProperties()){
out.print(" " + p.getAttrName() + "= ");
if(p.isString()){
out.print("\"" + rr.getStringPropertyValue(p.getAttrName()) + "\"");
} else if(p.isFloat()){
out.print(rr.getFloatPropertyValue(p.getAttrName()));
} else if(p.isColor()){
out.print(rr.getColorPropertyValue(p.getAttrName()));
} else if(p.isIntParse()){
out.print(rr.getIntPropertyValue(p.getAttrName()));
}
}
for(RenderingRule rc : rr.getIfElseChildren()){
printRenderingRule(indent, rc, out);
}
}
public static void main(String[] args) throws SAXException, IOException {
RenderingRulesStorage storage = new RenderingRulesStorage();
storage.parseRulesFromXmlInputStream(RenderingRulesStorage.class.getResourceAsStream("new_default.render.xml"));
// storage.printDebug(LINE_RULES, System.out);
long tm = System.nanoTime();
int count = 100000;
for (int i = 0; i < count; i++) {
RenderingRuleSearchRequest searchRequest = new RenderingRuleSearchRequest(storage);
searchRequest.setStringFilter(storage.PROPS.R_TAG, "highway");
searchRequest.setStringFilter(storage.PROPS.R_VALUE, "motorway");
// searchRequest.setIntFilter(storage.PROPS.R_LAYER, 1);
searchRequest.setIntFilter(storage.PROPS.R_MINZOOM, 14);
searchRequest.setIntFilter(storage.PROPS.R_MAXZOOM, 14);
// searchRequest.setStringFilter(storage.PROPS.R_ORDER_TYPE, "line");
// searchRequest.setBooleanFilter(storage.PROPS.R_NIGHT_MODE, true);
// searchRequest.setBooleanFilter(storage.PROPS.get("hmRendered"), true);
searchRequest.search(ORDER_RULES);
printResult(searchRequest, new PrintStream(new OutputStream() {
@Override
public void write(int b) throws IOException {
}
}));
}
System.out.println((System.nanoTime()- tm)/ (1e6f * count) );
}
private static void printResult(RenderingRuleSearchRequest searchRequest, PrintStream out) {
if(searchRequest.isFound()){
out.print(" Found : ");
for (RenderingRuleProperty rp : searchRequest.getProperties()) {
if(rp.isOutputProperty() && searchRequest.isSpecified(rp)){
out.print(" " + rp.getAttrName() + "= ");
if(rp.isString()){
out.print("\"" + searchRequest.getStringPropertyValue(rp) + "\"");
} else if(rp.isFloat()){
out.print(searchRequest.getFloatPropertyValue(rp));
} else if(rp.isColor()){
out.print(searchRequest.getColorStringPropertyValue(rp));
} else if(rp.isIntParse()){
out.print(searchRequest.getIntPropertyValue(rp));
}
}
}
} else {
out.println("Not found");
}
}
}

View file

@ -1,7 +1,12 @@
<renderer name="all-purpose" depends="" defaultColor="#f1eee8" defaultNightColor="#003333">
<!-- renderer name="default" depends="" defaultColor="#f1eee8" defaultNightColor="#003333" -->
<!--
All Purpose Renderer (essentially more details than default) (by Hardy Mueller), v021:
Map rendering aligned to typical map use for all zoom levels/scales, hence always yields a complete and reliable map.
Based on All-Purpose Renderer (by Hardy Mueller). switch "moreDetail" creates the "all-purpose" which provides more detail than "default" with some less performance, as follows:
- slightly less detail, some roads only rendered at higher zooms than described below for all-purpose renderer
- different motorway/trunk colors
- shadowRadius suppressed for white roads from z16, but this decreases visibility in some surroundings (was reverted again later)
All-Purpose Renderer: Map rendering aligned to typical map use for all zoom levels/scales, hence always yields a complete and reliable map.
All features displayed at each zoom level (zX) are those for its typical use:
- z7 = "Rough Country Level Overview": Shows motorways, trunks, primary roads and city names
- z11 = "Country Road Atlas": Secondary roads (already from z9) and tertiary (already from z10). Show large scale landuse like forest and residential areas (already from z10). Also all town names (already from z9) and now all other locality names. Shows mountain peaks for orientation.
@ -26,8 +31,9 @@
- v019: synced with default on 2011-07-13: Added dentist, veterinary, doctors, optician, bureau_de_change, vending_machine, kiosk, outdoor, wreck, wayside_shrine, wayside_cross, ruins, monument, battlefield, water_park, video, horse_racing, stadium, kindergarten, theme_park, baseball, archery, golf, swimming, diving, canoe, skiing, soccer, tennis, greengorcer, mobile_phone, motorcycle, electronics, fishing, barrier_block, tobacco, townhall, barrier_kissing, barrier_toll, laundry, copyshop
- v020: Fixed textHaloRadius: Do not use at zoom levels used for driving or routing, obstructs important map details. Used now for all leisure and building tags (which mostly appear from z15 or higher).
- v021: Fixed textDy for new behavior: Textsize/2 + 1. =7 good enough for all cases, except use =1 for city/town icons (anomaly)
- v022: Combined default and all-purpose renderers, former all-purpose now means flag "moreDetail"=true
- v023: synced 'fix bay problems' and 'Ranging city/towns by priority' from default renderer
-->
<!--
Main colors for night renderer:
- default: 003333
@ -50,7 +56,8 @@
shop_supermarket, sosphone, spring station_small, station, telephone, theatre, toilets, tower_water, traffic_light transport_ford, tree,
tree2, viewpoint, vineyard, windmill, zoo, dentist, veterinary, doctors, optician, bureau_de_change, vending_machine, kiosk, outdoor, wreck, wyside_shrine,
wayside_cross, ruins, monument, battlefield, water_park, video, horse_racing, stadium, kindergarten, theme_park, baseball, archery, golf, swimming, diving,
canoe, skiing, soccer, tennis, greengorcer, mobile_phone, motorcycle, electronics, fishing, barrier_block, tobacco, townhall, barrier_kissing, barrier_toll, laundry, copyshop
canoe, skiing, soccer, tennis, greengorcer, mobile_phone, motorcycle, electronics, fishing, barrier_block, tobacco, townhall, barrier_kissing, barrier_toll,
laundry, copyshop
-->
<!-- input exact layer, orderType check tag, value -->
@ -68,6 +75,7 @@
<filter tag="landuse" value="reservoir" order="5" />
<filter tag="landuse" value="water" order="5" />
<filter tag="natural" value="water" order="5" />
<filter tag="natural" value="bay" order="5" />
<filter tag="waterway" order="5" />
<filter tag="leisure" order="2" />
@ -125,10 +133,10 @@
</filter>
</order>
<!-- PRIORITY Input to filter : tag, value, zoom [minzoom, maxzoom], textLength, ref -->
<!-- PRIORITY Input to filter : tag, value, zoom [minzoom, maxzoom], textLength, ref , textOrder (default=20) -->
<text>
<!-- Highway ref -->
<filter minzoom="10" tag="highway" value="motorway" ref="only" textMinDistance="70" textColor="#ffffff" textSize="12" textBold="true">
<filter minzoom="10" tag="highway" value="motorway" ref="only" textMinDistance="70" textColor="#ffffff" textSize="12" textBold="true" textOrder="6">
<filter textLength="1" textShield="mot_shield1" />
<filter textLength="2" textShield="mot_shield2" />
<filter textLength="3" textShield="mot_shield3" />
@ -137,7 +145,7 @@
<filter textLength="6" textShield="mot_shield6" />
</filter>
<filter minzoom="10" tag="highway" value="trunk" ref="only" textMinDistance="70" textColor="#ffffff" textSize="12" textBold="true">
<filter minzoom="10" tag="highway" value="trunk" ref="only" textMinDistance="70" textColor="#ffffff" textSize="12" textBold="true" textOrder="6">
<filter textLength="1" textShield="tru_shield1" />
<filter textLength="2" textShield="tru_shield2" />
<filter textLength="3" textShield="tru_shield3" />
@ -146,7 +154,7 @@
<filter textLength="6" textShield="tru_shield6" />
</filter>
<filter minzoom="11" tag="highway" value="primary" ref="only" textMinDistance="70" textColor="#ffffff" textSize="12" textBold="true">
<filter minzoom="11" tag="highway" value="primary" ref="only" textMinDistance="70" textColor="#ffffff" textSize="12" textBold="true" textOrder="7">
<filter textLength="1" textShield="pri_shield1" />
<filter textLength="2" textShield="pri_shield2" />
<filter textLength="3" textShield="pri_shield3" />
@ -155,7 +163,7 @@
<filter textLength="6" textShield="pri_shield6" />
</filter>
<filter minzoom="13" tag="highway" value="secondary" ref="only" textMinDistance="70" textColor="#ffffff" textSize="12" textBold="true">
<filter minzoom="13" tag="highway" value="secondary" ref="only" textMinDistance="70" textColor="#ffffff" textSize="12" textBold="true" textOrder="8">
<filter textLength="1" textShield="sec_shield1" />
<filter textLength="2" textShield="sec_shield2" />
<filter textLength="3" textShield="sec_shield3" />
@ -164,7 +172,7 @@
<filter textLength="6" textShield="sec_shield6" />
</filter>
<filter minzoom="14" tag="highway" value="tertiary" ref="only" textMinDistance="70" textColor="#ffffff" textSize="12" textBold="true">
<filter minzoom="14" tag="highway" value="tertiary" ref="only" textMinDistance="70" textColor="#ffffff" textSize="12" textBold="true" textOrder="9">
<filter textLength="1" textShield="ter_shield1" />
<filter textLength="2" textShield="ter_shield2" />
<filter textLength="3" textShield="ter_shield3" />
@ -175,14 +183,14 @@
<!-- Highway text -->
<switch>
<case tag="highway" value="motorway" />
<case tag="highway" value="motorway_link" />
<case tag="highway" value="trunk" />
<case tag="highway" value="trunk_link" />
<case tag="highway" value="primary" />
<case tag="highway" value="primary_link" />
<case tag="highway" value="secondary" />
<case tag="highway" value="secondary_link" />
<case tag="highway" value="motorway" textOrder="6"/>
<case tag="highway" value="motorway_link" textOrder="7"/>
<case tag="highway" value="trunk" textOrder="6"/>
<case tag="highway" value="trunk_link" textOrder="7"/>
<case tag="highway" value="primary" textOrder="7"/>
<case tag="highway" value="primary_link" textOrder="8"/>
<case tag="highway" value="secondary" textOrder="8"/>
<case tag="highway" value="secondary_link" textOrder="9"/>
<filter textOnPath="true">
<filter minzoom="13" maxzoom="13" textSize="12" />
<filter minzoom="14" maxzoom="14" textSize="13" />
@ -194,21 +202,21 @@
</switch>
<switch>
<case tag="highway" value="tertiary" />
<case tag="highway" value="tertiary_link" />
<case tag="highway" value="tertiary" textOrder="8"/>
<case tag="highway" value="tertiary_link" textOrder="9"/>
<case tag="highway" value="road" />
<case tag="highway" value="unclassified" />
<case tag="highway" value="residential" />
<case tag="highway" value="road" textOrder="9"/>
<case tag="highway" value="unclassified" textOrder="9"/>
<case tag="highway" value="residential" textOrder="9"/>
<case tag="highway" value="service" />
<case tag="highway" value="living_street" />
<case tag="highway" value="pedestrian" />
<case tag="highway" value="service" textOrder="10"/>
<case tag="highway" value="living_street" textOrder="10"/>
<case tag="highway" value="pedestrian" textOrder="11"/>
<case tag="highway" value="services" />
<case tag="highway" value="ford" />
<case tag="highway" value="construction" />
<case tag="highway" value="proposed" />
<case tag="highway" value="services" textOrder="10"/>
<case tag="highway" value="ford" textOrder="10"/>
<case tag="highway" value="construction" textOrder="9"/>
<case tag="highway" value="proposed" textOrder="9"/>
<filter textOnPath="true">
<filter minzoom="14" maxzoom="14" textSize="12" />
<filter minzoom="15" maxzoom="15" textSize="13" />
@ -222,14 +230,14 @@
<case nightMode="true" textColor="#ffffff"/>
<case nightMode="false" textColor="#000000"/>
<switch>
<case tag="highway" value="track" />
<case tag="highway" value="path" />
<case tag="highway" value="cycleway" />
<case tag="highway" value="track" textOrder="9"/>
<case tag="highway" value="path" textOrder="9"/>
<case tag="highway" value="cycleway" textOrder="14"/>
<case tag="highway" value="byway" />
<case tag="highway" value="footway" />
<case tag="highway" value="steps" />
<case tag="highway" value="bridleway" />
<case tag="highway" value="byway" textOrder="15"/>
<case tag="highway" value="footway" textOrder="15"/>
<case tag="highway" value="steps" textOrder="15"/>
<case tag="highway" value="bridleway" textOrder="15"/>
<filter textOnPath="true">
<filter minzoom="14" maxzoom="14" textSize="12" />
<filter minzoom="15" maxzoom="15" textSize="13" />
@ -240,37 +248,37 @@
</switch>
</switch>
<filter minzoom="15" textSize="14" textBold="true" textWrapWidth="12" textMinDistance="20" tag="highway" value="motorway_junction"/>
<filter minzoom="15" textSize="14" textBold="true" textWrapWidth="12" textMinDistance="20" tag="highway" value="motorway_junction" textOrder="12"/>
<!-- Natural -->
<filter minzoom="15" textSize="12" textColor="#09dd09" textWrapWidth="15" tag="natural" value="park" />
<filter minzoom="15" textSize="12" textColor="#09dd09" textWrapWidth="15" tag="natural" value="park" textOrder="10"/>
<filter minzoom="14" textSize="12" textHaloRadius="1" textColor="#6699cc" textWrapWidth="20" tag="natural" value="beach" />
<filter minzoom="14" textSize="12" textHaloRadius="1" textColor="#6699cc" textWrapWidth="20" tag="natural" value="beach" textOrder="10"/>
<switch>
<case nightMode="true" textColor="#CC3300"/>
<case nightMode="false" textColor="#654321"/>
<filter>
<filter minzoom="15" textSize="12" textDy="7" textWrapWidth="20" tag="natural" value="cave_entrance" />
<filter minzoom="12" maxzoom="14" textSize="12" textHaloRadius="1" textDy="7" tag="natural" value="peak" />
<filter minzoom="15" maxzoom="16" textSize="13" textHaloRadius="1" textDy="7" tag="natural" value="peak" />
<filter minzoom="17" textSize="16" textHaloRadius="1" textDy="7" tag="natural" value="peak" />
<filter minzoom="15" textSize="12" textDy="7" textWrapWidth="20" tag="natural" value="cave_entrance" textOrder="15"/>
<filter minzoom="12" maxzoom="14" textSize="12" textHaloRadius="1" textDy="7" tag="natural" value="peak" textOrder="10"/>
<filter minzoom="15" maxzoom="16" textSize="13" textHaloRadius="1" textDy="7" tag="natural" value="peak" textOrder="15"/>
<filter minzoom="17" textSize="16" textHaloRadius="1" textDy="7" tag="natural" value="peak" textOrder="15"/>
</filter>
</switch>
<filter minzoom="15" textSize="12" textColor="#6699cc" textDy="7" textWrapWidth="20" tag="natural" value="spring" />
<filter minzoom="6" textSize="12" textColor="#6699cc" textWrapWidth="20" tag="natural" value="water" />
<filter minzoom="6" textSize="12" textColor="#6699cc" textWrapWidth="20" tag="natural" value="lake" />
<filter minzoom="13" textSize="12" textColor="#ff000000" textWrapWidth="10" tag="natural" value="wood" />
<filter minzoom="15" textSize="12" textColor="#6699cc" textDy="7" textWrapWidth="20" tag="natural" value="spring" textOrder="15"/>
<filter minzoom="6" textSize="12" textColor="#6699cc" textWrapWidth="20" tag="natural" value="water" textOrder="10"/>
<filter minzoom="6" textSize="12" textColor="#6699cc" textWrapWidth="20" tag="natural" value="lake" textOrder="10"/>
<filter minzoom="13" textSize="12" textColor="#ff000000" textWrapWidth="10" tag="natural" value="wood" textOrder="10"/>
<filter minzoom="13" textSize="12" textColor="#6699cc" textOnPath="true" tag="waterway" value="stream" />
<filter minzoom="11" textSize="12" textColor="#6699cc" textOnPath="true" textMinDistance="70" tag="waterway" value="river" />
<filter minzoom="13" textSize="12" textColor="#6699cc" textOnPath="true" textMinDistance="70" tag="waterway" value="canal" />
<filter minzoom="15" textSize="12" textColor="#6699cc" textOnPath="true" tag="waterway" value="ditch" />
<filter minzoom="15" textSize="12" textColor="#6699cc" textOnPath="true" tag="waterway" value="drain" />
<filter minzoom="15" textSize="12" textColor="#0066ff" textDy="7" textWrapWidth="70" tag="waterway" value="lock_gate" />
<filter minzoom="15" textSize="12" textColor="#0066ff" textDy="7" textWrapWidth="70" tag="waterway" value="lock" />
<filter minzoom="15" textSize="12" tag="waterway" value="dam" />
<filter minzoom="13" textSize="12" textColor="#6699cc" textOnPath="true" tag="waterway" value="stream" textOrder="15"/>
<filter minzoom="11" textSize="12" textColor="#6699cc" textOnPath="true" textMinDistance="70" tag="waterway" value="river" textOrder="10"/>
<filter minzoom="13" textSize="12" textColor="#6699cc" textOnPath="true" textMinDistance="70" tag="waterway" value="canal" textOrder="10"/>
<filter minzoom="15" textSize="12" textColor="#6699cc" textOnPath="true" tag="waterway" value="ditch" textOrder="15"/>
<filter minzoom="15" textSize="12" textColor="#6699cc" textOnPath="true" tag="waterway" value="drain" textOrder="15"/>
<filter minzoom="15" textSize="12" textColor="#0066ff" textDy="7" textWrapWidth="70" tag="waterway" value="lock_gate" textOrder="15"/>
<filter minzoom="15" textSize="12" textColor="#0066ff" textDy="7" textWrapWidth="70" tag="waterway" value="lock" textOrder="15"/>
<filter minzoom="15" textSize="12" tag="waterway" value="dam" textOrder="15"/>
<switch>
<case nightMode="true" textColor="#CC3300"/>
@ -279,11 +287,11 @@
</switch>
<filter minzoom="14" maxzoom="14" textSize="12" textBold="true" textColor="#6666ff" textDy="7" tag="railway" value="station" />
<filter minzoom="15" textSize="13" textBold="true" textColor="#6666ff" textDy="7" tag="railway" value="station" />
<filter minzoom="15" textSize="13" textHaloRadius="1" textBold="true" textColor="#6666ff" textDy="7" tag="railway" value="station" />
<filter minzoom="14" maxzoom="14" textSize="12" textColor="#6666ff" textDy="7" tag="railway" value="halt" />
<filter minzoom="15" textSize="12" textColor="#6666ff" textDy="7" tag="railway" value="halt" />
<filter minzoom="15" textSize="12" textHaloRadius="1" textColor="#6666ff" textDy="7" tag="railway" value="halt" />
<filter minzoom="14" maxzoom="14" textSize="12" textColor="#6666ff" textDy="7" tag="railway" value="tram_stop" />
<filter minzoom="15" textSize="12" textColor="#6666ff" textDy="7" tag="railway" value="tram_stop" />
<filter minzoom="15" textSize="12" textHaloRadius="1" textColor="#6666ff" textDy="7" tag="railway" value="tram_stop" />
<filter minzoom="10" textSize="12" textColor="#6692da" textDy="7" tag="aeroway" value="aerodrome" />
<filter minzoom="15" textSize="12" textColor="#333333" textOnPath="true" textMinDistance="50" tag="aeroway" value="runway" ref="true" />
@ -297,6 +305,8 @@
<filter minzoom="16" maxzoom="16" textSize="13" textColor="#444444" textWrapWidth="16" textMinDistance="40" tag="building" />
<filter minzoom="17" maxzoom="17" textSize="13" textColor="#444444" textWrapWidth="16" tag="building" />
<filter minzoom="18" textSize="15" textColor="#444444" textWrapWidth="16" tag="building" />
<filter minzoom="18" textSize="15" textColor="#444444" textWrapWidth="16" tag="addr:housenumber" />
<filter minzoom="15" textSize="12" textColor="#000033" textDy="7" textWrapWidth="12" tag="man_made" value="lighthouse" />
<filter minzoom="17" textSize="12" textColor="#734a08" textDy="7" textWrapWidth="20" tag="man_made" value="windmill" />
@ -425,19 +435,19 @@
<switch>
<case nightMode="true" textColor="#ffffff"/>
<case nightMode="false"/>
<filter minzoom="4" textSize="20" textDy="1" textBold="true" textWrapWidth="20" tag="place" value="city" />
<filter minzoom="6" textSize="16" textDy="1" textBold="true" textWrapWidth="20" tag="place" value="town" />
<filter minzoom="11" textSize="14" tag="place" value="village" />
<filter minzoom="4" textSize="20" textDy="1" textBold="true" textWrapWidth="20" tag="place" value="city" textOrder="4"/>
<filter minzoom="6" textSize="16" textDy="1" textBold="true" textWrapWidth="20" tag="place" value="town" textOrder="5"/>
<filter minzoom="11" textSize="14" tag="place" value="village" textOrder="10"/>
</switch>
<switch>
<case nightMode="true" textColor="#D7D7D7"/>
<case nightMode="false" textColor="#777777"/>
<filter minzoom="11" textSize="13" tag="place" value="hamlet" />
<filter minzoom="11" textSize="14" tag="place" value="suburb" />
<filter minzoom="11" textSize="13" tag="place" value="locality" />
<filter minzoom="11" textSize="14" tag="place" value="island" />
<filter minzoom="10" textSize="14" textBold="true" textColor="#99cc99" textWrapWidth="14" tag="boundary" value="national_park" />
<filter minzoom="11" textSize="13" tag="place" value="hamlet" textOrder="12"/>
<filter minzoom="11" textSize="14" tag="place" value="suburb" textOrder="12"/>
<filter minzoom="11" textSize="13" tag="place" value="locality" textOrder="15"/>
<filter minzoom="11" textSize="14" tag="place" value="island" textOrder="10"/>
<filter minzoom="10" textSize="14" textBold="true" textColor="#99cc99" textWrapWidth="14" tag="boundary" value="national_park" textOrder="10"/>
</switch>
</text>
@ -622,11 +632,15 @@
</filter>
</switch>
<filter minzoom="13" strokeWidth_2="0.5" color_2="#b0b0b0" color="#ECECEC">
<filter tag="highway" value="service" />
<filter tag="highway" value="pedestrian" />
<filter tag="highway" value="footway" />
</filter>
<switch>
<case moreDetail="true" minzoom="13"/>
<case moreDetail="false" minzoom="14"/>
<filter strokeWidth_2="0.5" color_2="#b0b0b0" color="#ECECEC">
<filter tag="highway" value="service" />
<filter tag="highway" value="pedestrian" />
<filter tag="highway" value="footway" />
</filter>
</switch>
<switch>
<case nightMode="true" color="#560000"/>
@ -657,7 +671,7 @@
<filter minzoom="12" tag="aeroway">
<filter value="aerodrome" />
<filter value="airport" />
</filter>
</filter>
</switch>
<switch>
@ -693,17 +707,16 @@
<filter minzoom="1" tag="natural" value="coastline" />
<filter minzoom="4" tag="natural" value="water" />
<filter minzoom="4" tag="natural" value="lake" />
<filter minzoom="4" tag="natural" value="bay" />
</switch>
<filter minzoom="12" shader="beach" tag="natural" value="beach" />
<filter minzoom="10" shader="glacier" color_2="#99ccff" strokeWidth_2="2" tag="natural" value="glacier" />
<filter nightMode="true" minzoom="10" shader="glacier" color_2="#497CAF" strokeWidth_2="2" tag="natural" value="glacier" />
<filter minzoom="11" shader="beach" tag="natural" value="beach" />
<filter minzoom="9" shader="glacier" color_2="#99ccff" strokeWidth_2="2" tag="natural" value="glacier" />
<filter nightMode="true" minzoom="9" shader="glacier" color_2="#497CAF" strokeWidth_2="2" tag="natural" value="glacier" />
<filter minzoom="12" color="#ffffc0" tag="natural" value="heath" />
<filter nightMode="true" minzoom="12" color="#004333" tag="natural" value="heath" />
<filter minzoom="10" color="#f2efe9" tag="natural" value="land" />
<filter nightMode="true" minzoom="10" color="#004333" tag="natural" value="land" />
<filter minzoom="12" shader="marsh" tag="natural" value="marsh" />
<filter nightMode="true" minzoom="12" shader="marsh" color="#004333" tag="natural" value="marsh" />
<filter minzoom="12" shader="mud" tag="natural" value="mud" />
@ -712,9 +725,8 @@
<filter nightMode="true" minzoom="12" color="#004333" tag="natural" value="scrub" />
<filter minzoom="10" shader="marsh" tag="natural" value="wetland" />
<filter nightMode="true" minzoom="10" shader="marsh" color="#004333" tag="natural" value="wetland" />
<filter minzoom="10" color="#aed1a0" tag="natural" value="wood" />
<filter nightMode="true" minzoom="10" color="#000034" tag="natural" value="wood" />
<filter minzoom="9" color="#aed1a0" tag="natural" value="wood" />
<filter nightMode="true" minzoom="9" color="#000034" tag="natural" value="wood" />
<!-- man made -->
<filter minzoom="16" color="#bca9a9" tag="building" />
@ -738,8 +750,8 @@
<filter nightMode="true" minzoom="12" color="#004333" color_2="#888888" strokeWidth_2="1" tag="leisure" value="track" />
<filter minzoom="12" color="#8ad3af" color_2="#888888" strokeWidth_2="1" tag="leisure" value="pitch" />
<filter nightMode="true" minzoom="12" color="#004333" color_2="#888888" strokeWidth_2="1" tag="leisure" value="pitch" />
<filter minzoom="10" shader="nr" color="#abdf96" tag="leisure" value="nature_reserve" />
<filter minzoom="10" nightMode="true" color="#000034" tag="leisure" value="nature_reserve" />
<filter minzoom="9" shader="nr" color="#abdf96" tag="leisure" value="nature_reserve" />
<filter minzoom="9" nightMode="true" color="#000034" tag="leisure" value="nature_reserve" />
<switch>
<case nightMode="true" color="#b0004333"/>
@ -809,8 +821,8 @@
<filter minzoom="12" nightMode="true" color="#004333" tag="landuse" value="cemetery" />
<filter minzoom="12" shader="grave_yard" color="#aacbaf" tag="landuse" value="grave_yard" />
<filter minzoom="12" nightMode="true" color="#004333" tag="landuse" value="grave_yard" />
<filter minzoom="10" color="#efc8c8" tag="landuse" value="commercial" />
<filter minzoom="10" nightMode="true" color="#66004B" tag="landuse" value="commercial" />
<filter minzoom="12" color="#efc8c8" tag="landuse" value="commercial" />
<filter minzoom="12" nightMode="true" color="#66004B" tag="landuse" value="commercial" />
<filter minzoom="12" color="#9d9d6c" tag="landuse" value="construction" />
<filter minzoom="12" nightMode="true" color="#66004B" tag="landuse" value="construction" />
<filter minzoom="12" color="#ead8bd" tag="landuse" value="farm" />
@ -819,20 +831,18 @@
<filter minzoom="12" nightMode="true" color="#004333" tag="landuse" value="farmland" />
<filter minzoom="12" color="#ddbf92" tag="landuse" value="farmyard" />
<filter minzoom="12" nightMode="true" color="#004333" tag="landuse" value="farmyard" />
<filter minzoom="10" maxzoom="12" color="#8dc56c" tag="landuse" value="forest" />
<filter minzoom="10" maxzoom="12" nightMode="true" color="#000034" tag="landuse" value="forest" />
<filter minzoom="9" maxzoom="12" color="#8dc56c" tag="landuse" value="forest" />
<filter minzoom="9" maxzoom="12" nightMode="true" color="#000034" tag="landuse" value="forest" />
<filter minzoom="13" shader="forest" color="#8dc56c" tag="landuse" value="forest" />
<filter minzoom="13" nightMode="true" color="#000034" tag="landuse" value="forest" />
<filter minzoom="12" color="#dfd1d6" tag="landuse" value="garages" />
<filter minzoom="12" nightMode="true" color="#560000" tag="landuse" value="garages" />
<filter minzoom="14" color="#dfd1d6" tag="landuse" value="garages" />
<filter minzoom="14" nightMode="true" color="#560000" tag="landuse" value="garages" />
<filter minzoom="12" color="#cfeca8" tag="landuse" value="grass" />
<filter minzoom="12" nightMode="true" color="#004333" tag="landuse" value="grass" />
<filter minzoom="12" color="#9d9d6c" tag="landuse" value="greenfield" />
<filter minzoom="12" nightMode="true" color="#004333" tag="landuse" value="greenfield" />
<filter minzoom="10" color="#dfd1d6" tag="landuse" value="industrial" />
<filter minzoom="10" nightMode="true" color="#66004B" tag="landuse" value="industrial" />
<filter minzoom="11" color="#dfd1d6" tag="landuse" value="industrial" />
<filter minzoom="11" nightMode="true" color="#66004B" tag="landuse" value="industrial" />
<filter minzoom="12" color="#9d9d6c" tag="landuse" value="landfill" />
<filter minzoom="12" nightMode="true" color="#66004B" tag="landuse" value="landfill" />
<filter minzoom="12" color="#cfeca8" tag="landuse" value="meadow" />
@ -866,17 +876,21 @@
<filter minzoom="12" maxzoom="13" color="#30666600" tag="natural" value="field" />
<filter minzoom="14" color="#30666600" color_2="#60666600" strokeWidth_2="1" tag="natural" value="field" />
<filter nightMode="true" minzoom="12" color="#004333" tag="natural" value="field" />
<filter minzoom="10" color="#aed1a0" tag="landuse" value="wood" />
<filter minzoom="10" nightMode="true" color="#000034" tag="landuse" value="wood" />
<filter minzoom="9" color="#aed1a0" tag="landuse" value="wood" />
<filter minzoom="9" nightMode="true" color="#000034" tag="landuse" value="wood" />
</polygon>
<!-- Priority input : tag, value, layer, zoom -->
<line>
<switch>
<case tag="highway" value="motorway" color="#809BFF" />
<case tag="highway" value="motorway_link" color="#809BFF" />
<case tag="highway" value="trunk" color="#DF1346" />
<case tag="highway" value="trunk_link" color="#DF1346" />
<case tag="highway" value="motorway" moreDetail="false" color="#a58dff" />
<case tag="highway" value="motorway" moreDetail="true" color="#809bff" />
<case tag="highway" value="motorway_link" moreDetail="false" color="#a58dff" />
<case tag="highway" value="motorway_link" moreDetail="true" color="#809bff" />
<case tag="highway" value="trunk" moreDetail="false" color="#ffaf80" />
<case tag="highway" value="trunk" moreDetail="true" color="#df1346" />
<case tag="highway" value="trunk_link" moreDetail="false" color="#ffaf80" />
<case tag="highway" value="trunk_link" moreDetail="true" color="#df1346" />
<filter>
<filter minzoom="5" maxzoom="9" strokeWidth="5" />
<filter minzoom="10" maxzoom="10" strokeWidth="6" />
@ -911,10 +925,14 @@
</switch>
<switch>
<case tag="highway" value="motorway" color="#809BFF" color_2="#809BFF" />
<case tag="highway" value="motorway_link" color="#809BFF" color_2="#809BFF" />
<case tag="highway" value="trunk" color="#DF1346" color_2="#DF1346" />
<case tag="highway" value="trunk_link" color="#DF1346" color_2="#DF1346" />
<case tag="highway" value="motorway" moreDetail="false" color="#a58dff" color_2="#a58dff" />
<case tag="highway" value="motorway" moreDetail="true" color="#809bff" color_2="#809bff" />
<case tag="highway" value="motorway_link" moreDetail="false" color="#a58dff" color_2="#a58dff" />
<case tag="highway" value="motorway_link" moreDetail="true" color="#809bff" color_2="#809bff" />
<case tag="highway" value="trunk" moreDetail="false" color="#ffaf80" color_2="#ffaf80" />
<case tag="highway" value="trunk" moreDetail="true" color="#df1346" color_2="#df1346" />
<case tag="highway" value="trunk_link" moreDetail="false" color="#ffaf80" color_2="#ffaf80" />
<case tag="highway" value="trunk_link" moreDetail="true" color="#df1346" color_2="#df1346" />
<case tag="highway" value="primary" color="#eb989a" color_2="#eb989a" />
<case tag="highway" value="primary_link" color="#eb989a" color_2="#eb989a" />
<case tag="highway" value="secondary" color="#fdd6a4" color_2="#fdd6a4" shadowColor="#464646" shadowRadius="1" />
@ -949,7 +967,7 @@
<switch>
<case tag="highway" value="tertiary" />
<case tag="highway" value="tertiary_link" />
<filter color="#fefeb3" color_2="#fefeb3" shadowColor="#bababa" shadowRadius="1" >
<filter color="#fefeb3" color_2="#fefeb3" shadowColor="#bababa" shadowRadius="1" >
<filter minzoom="10" maxzoom="10" strokeWidth="3" />
<filter minzoom="11" maxzoom="11" strokeWidth="4" />
<filter minzoom="12" maxzoom="12" strokeWidth="5" />
@ -960,8 +978,8 @@
<filter>
<filter minzoom="14" maxzoom="14" strokeWidth="6" />
<filter minzoom="15" maxzoom="15" strokeWidth="8" />
<!-- radius 0 from z16 to avoid many dark lines. But removed again in v017 -->
<filter minzoom="16" maxzoom="16" strokeWidth="10" />
<!-- radius 0 to avoid showing many black lines, but removed again due to bad visibility on some backgrounds -->
<filter minzoom="17" maxzoom="17" strokeWidth="13" />
<filter minzoom="18" strokeWidth="18" />
</filter>
@ -990,7 +1008,7 @@
<case nightMode="true" color="#9F9F9F" color_2="#9F9F9F" shadowColor="#666666" shadowRadius="1" />
<case nightMode="false" color="#ffffff" color_2="#ffffff" shadowColor="#464646" shadowRadius="1" />
<filter>
<filter minzoom="12" maxzoom="12" strokeWidth="3" />
<filter moreDetail="true" minzoom="12" maxzoom="12" strokeWidth="3" />
<filter minzoom="13" maxzoom="13" strokeWidth="4" />
<switch>
<case layer="-1" pathEffect="4_4" />
@ -998,8 +1016,8 @@
<filter>
<filter minzoom="14" maxzoom="14" strokeWidth="6" />
<filter minzoom="15" maxzoom="15" strokeWidth="8" />
<!-- radius 0 from z16 to avoid many dark lines. But removed again in v017 -->
<filter minzoom="16" maxzoom="16" strokeWidth="10" />
<!-- radius 0 to avoid showing many black lines, but removed again due to bad visibility on some backgrounds -->
<filter minzoom="17" maxzoom="17" strokeWidth="13" />
<filter minzoom="18" strokeWidth="18" />
</filter>
@ -1030,10 +1048,9 @@
<case layer="-1" pathEffect="4_4" />
<case /> <!-- all other cases -->
<filter>
<filter minzoom="13" maxzoom="13" strokeWidth="2" />
<filter minzoom="14" maxzoom="14" strokeWidth="3" />
<filter moreDetail="true" minzoom="13" maxzoom="13" strokeWidth="2" />
<filter moreDetail="true" minzoom="14" maxzoom="14" strokeWidth="3" />
<filter minzoom="15" maxzoom="15" strokeWidth="4" />
<!-- radius 0 from z16 to avoid many dark lines. But removed again in v017 -->
<filter minzoom="16" maxzoom="16" strokeWidth="5" />
<filter minzoom="17" maxzoom="17" strokeWidth="8" />
<filter minzoom="18" strokeWidth="12"/>
@ -1044,7 +1061,7 @@
<case nightMode="false" color="#000000" />
<case nightMode="true" color="#000000" />
<filter layer="1" cap_2="SQUARE">
<filter minzoom="13" maxzoom="14" strokeWidth="5" strokeWidth_2="3" />
<filter moreDetail="true" minzoom="13" maxzoom="14" strokeWidth="5" strokeWidth_2="3" />
<filter minzoom="15" maxzoom="15" strokeWidth="6" strokeWidth_2="4" />
<filter minzoom="16" maxzoom="16" strokeWidth="7" strokeWidth_2="5" />
<filter minzoom="17" maxzoom="17" strokeWidth="10" strokeWidth_2="8" />
@ -1055,14 +1072,15 @@
</switch>
<filter tag="highway" value="cycleway">
<filter minzoom="12" maxzoom="12" color="#0000ff" strokeWidth="0.5" pathEffect="2_2" />
<filter moreDetail="true" minzoom="12" maxzoom="12" color="#0000ff" strokeWidth="0.5" pathEffect="2_2" />
<filter minzoom="13" color="#0000ff" strokeWidth="1" pathEffect="2_2" />
<filter layer="1" minzoom="14" color="#0000ff" strokeWidth="1" pathEffect="2_2" />
<filter layer="1" minzoom="15" color="#88ffffff" strokeWidth="2" color_2="#0000ff" strokeWidth_2="2" pathEffect_2="2_2" />
</filter>
<filter tag="highway" value="byway">
<filter minzoom="11" color="#ffcc00" strokeWidth="1" pathEffect="4_3" />
<filter moreDetail="true" minzoom="11" color="#ffcc00" strokeWidth="1" pathEffect="4_3" />
<filter moreDetail="false" minzoom="12" color="#ffcc00" strokeWidth="1" pathEffect="4_3" />
<filter layer="1" minzoom="14" maxzoom="14" color="#ffcc00" strokeWidth="2" pathEffect="4_3" />
<filter layer="1" minzoom="15" color="#88ffffff" strokeWidth="4" color_2="#ffcc00" strokeWidth_2="2" pathEffect_2="4_3" />
</filter>
@ -1070,21 +1088,23 @@
<switch>
<case nightMode="false" color="#000000"/>
<case nightMode="true" color="#787878"/>
<filter minzoom="12" maxzoom="12" strokeWidth="0.5" pathEffect="6_3" tag="highway" value="path" />
<filter moreDetail="true" minzoom="12" maxzoom="12" strokeWidth="0.5" pathEffect="6_3" tag="highway" value="path" />
<filter minzoom="13" strokeWidth="1" pathEffect="6_3" tag="highway" value="path" />
</switch>
<filter minzoom="12" maxzoom="12" color="#996600" strokeWidth="0.5" pathEffect="4_3" tag="highway" value="track" />
<filter moreDetail="true" minzoom="12" maxzoom="12" color="#996600" strokeWidth="0.5" pathEffect="4_3" tag="highway" value="track" />
<filter minzoom="13" color="#996600" strokeWidth="1" pathEffect="4_3" tag="highway" value="track" />
<filter minzoom="12" maxzoom="12" color="#fa8073" strokeWidth="0.5" pathEffect="2_2" tag="highway" value="footway" />
<filter minzoom="13" color="#fa8073" strokeWidth="1" pathEffect="2_2" tag="highway" value="footway" />
<filter layer="1" minzoom="14" color="#88ffffff" strokeWidth="4" color_2="#fa8073" strokeWidth_2="2" pathEffect_2="2_2" tag="highway" value="footway" />
<filter moreDetail="true" minzoom="12" maxzoom="12" color="#fa8073" strokeWidth="0.5" pathEffect="2_2" tag="highway" value="footway" />
<filter moreDetail="true" minzoom="13" maxzoom="14" color="#fa8073" strokeWidth="1" pathEffect="2_2" tag="highway" value="footway" />
<filter minzoom="15" color="#fa8073" strokeWidth="1" pathEffect="2_2" tag="highway" value="footway" />
<filter layer="1" minzoom="15" color="#88ffffff" strokeWidth="4" color_2="#fa8073" strokeWidth_2="2" pathEffect_2="2_2" tag="highway" value="footway" />
<filter minzoom="14" color="#fa8073" strokeWidth="4" pathEffect="1_2" tag="highway" value="steps" />
<filter moreDetail="true" minzoom="14" color="#fa8073" strokeWidth="4" pathEffect="1_2" tag="highway" value="steps" />
<filter moreDetail="false" minzoom="15" color="#fa8073" strokeWidth="4" pathEffect="1_2" tag="highway" value="steps" />
<filter layer="1" minzoom="15" color="#88ffffff" strokeWidth="7" color_2="#fa8073" strokeWidth_2="5" pathEffect_2="1_2" tag="highway" value="steps" />
<filter minzoom="12" maxzoom="12" color="#00ff00" strokeWidth="0.5" pathEffect="2_2" tag="highway" value="bridleway" />
<filter moreDetail="true" minzoom="12" maxzoom="12" color="#00ff00" strokeWidth="0.5" pathEffect="2_2" tag="highway" value="bridleway" />
<filter minzoom="13" color="#00ff00" strokeWidth="1" pathEffect="2_2" tag="highway" value="bridleway" />
<filter layer="1" minzoom="14" maxzoom="14" color="#00ff00" strokeWidth="1" pathEffect="2_2" tag="highway" value="bridleway" />
<filter layer="1" minzoom="15" color="#88ffffff" strokeWidth="2" color_2="#00ff00" strokeWidth_2="2" pathEffect_2="2_2" tag="highway" value="bridleway" />

View file

@ -60,6 +60,7 @@
<filter tag="landuse" value="reservoir" order="5" />
<filter tag="landuse" value="water" order="5" />
<filter tag="natural" value="water" order="5" />
<filter tag="natural" value="bay" order="5" />
<filter tag="waterway" order="5" />
<filter tag="leisure" order="2" />
@ -277,11 +278,11 @@
</switch>
<filter minzoom="14" maxzoom="14" textSize="12" textBold="true" textColor="#6666ff" textDy="7" tag="railway" value="station" />
<filter minzoom="15" textSize="13" textBold="true" textColor="#6666ff" textDy="7" tag="railway" value="station" />
<filter minzoom="15" textSize="13" textHaloRadius="1" textBold="true" textColor="#6666ff" textDy="7" tag="railway" value="station" />
<filter minzoom="14" maxzoom="14" textSize="12" textColor="#6666ff" textDy="7" tag="railway" value="halt" />
<filter minzoom="15" textSize="12" textColor="#6666ff" textDy="7" tag="railway" value="halt" />
<filter minzoom="15" textSize="12" textHaloRadius="1" textColor="#6666ff" textDy="7" tag="railway" value="halt" />
<filter minzoom="14" maxzoom="14" textSize="12" textColor="#6666ff" textDy="7" tag="railway" value="tram_stop" />
<filter minzoom="15" textSize="12" textColor="#6666ff" textDy="7" tag="railway" value="tram_stop" />
<filter minzoom="15" textSize="12" textHaloRadius="1" textColor="#6666ff" textDy="7" tag="railway" value="tram_stop" />
<filter minzoom="10" textSize="12" textColor="#6692da" textDy="7" tag="aeroway" value="aerodrome" />
<filter minzoom="15" textSize="12" textColor="#333333" textOnPath="true" textMinDistance="50" tag="aeroway" value="runway" ref="true" />
@ -295,6 +296,7 @@
<filter minzoom="16" maxzoom="16" textSize="13" textColor="#444444" textWrapWidth="16" textMinDistance="40" tag="building" />
<filter minzoom="17" maxzoom="17" textSize="13" textColor="#444444" textWrapWidth="16" tag="building" />
<filter minzoom="18" textSize="15" textColor="#444444" textWrapWidth="16" tag="building" />
<filter minzoom="18" textSize="15" textColor="#444444" textWrapWidth="16" tag="addr:housenumber" />
<filter minzoom="15" textSize="12" textColor="#000033" textDy="7" textWrapWidth="12" tag="man_made" value="lighthouse" />
<filter minzoom="17" textSize="12" textColor="#734a08" textDy="7" textWrapWidth="20" tag="man_made" value="windmill" />
@ -693,6 +695,7 @@
<filter minzoom="1" tag="natural" value="coastline" />
<filter minzoom="4" tag="natural" value="water" />
<filter minzoom="4" tag="natural" value="lake" />
<filter minzoom="4" tag="natural" value="bay" />
</switch>
<!-- ZM 12 -->
<filter minzoom="11" shader="beach" tag="natural" value="beach" />

File diff suppressed because it is too large Load diff

View file

@ -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;

View file

@ -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;

View file

@ -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;
}

View file

@ -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);
}

View file

@ -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();
}

View file

@ -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

View file

@ -537,6 +537,7 @@ public class OsmExtractionUI implements IMapLocationListener {
public class ExitListener extends WindowAdapter {
@Override
public void windowClosing(WindowEvent event) {
exit();
}

View file

@ -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();
}

View file

@ -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);
}

View file

@ -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();
}

View file

@ -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;

View file

@ -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(),

View file

@ -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-";

View file

@ -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(),

View file

@ -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:-";

View file

@ -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");
}

View file

@ -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:-";

View file

@ -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;
}

View file

@ -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)

View file

@ -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 :");

View file

@ -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)

View file

@ -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());

View file

@ -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)

View file

@ -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);
}

View file

@ -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;
}

View file

@ -58,7 +58,8 @@ class TreeThread implements Runnable
tree.start();
}
}
public void run()
@Override
public void run()
{
try{
//RTree rt = new RTree(fileName);

View file

@ -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);
}

Some files were not shown because too many files have changed in this diff Show more