org.apache.lucene.util
Class AttributeImpl

java.lang.Object
  extended by org.apache.lucene.util.AttributeImpl
All Implemented Interfaces:
Serializable, Cloneable, Attribute
Direct Known Subclasses:
AllowLeadingWildcardAttributeImpl, AnalyzerAttributeImpl, BoostAttributeImpl, DateResolutionAttributeImpl, DefaultOperatorAttributeImpl, DefaultPhraseSlopAttributeImpl, FieldBoostMapAttributeImpl, FieldDateResolutionMapAttributeImpl, FlagsAttributeImpl, FuzzyAttributeImpl, LocaleAttributeImpl, LowercaseExpandedTermsAttributeImpl, MultiFieldAttributeImpl, MultiTermRewriteMethodAttributeImpl, OffsetAttributeImpl, PayloadAttributeImpl, PositionIncrementAttributeImpl, PositionIncrementsAttributeImpl, RangeCollatorAttributeImpl, TermAttributeImpl, Token, TypeAttributeImpl

public abstract class AttributeImpl
extends Object
implements Cloneable, Serializable, Attribute

Base class for Attributes that can be added to a AttributeSource.

Attributes are used to add data in a dynamic, yet type-safe way to a source of usually streamed objects, e. g. a TokenStream.

See Also:
Serialized Form

Constructor Summary
AttributeImpl()
           
 
Method Summary
abstract  void clear()
          Clears the values in this AttributeImpl and resets it to its default value.
 Object clone()
          Shallow clone.
abstract  void copyTo(AttributeImpl target)
          Copies the values from this Attribute into the passed-in target attribute.
abstract  boolean equals(Object other)
          All values used for computation of hashCode() should be checked here for equality.
abstract  int hashCode()
          Subclasses must implement this method and should compute a hashCode similar to this:
 String toString()
          The default implementation of this method accesses all declared fields of this object and prints the values in the following syntax:
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AttributeImpl

public AttributeImpl()
Method Detail

clear

public abstract void clear()
Clears the values in this AttributeImpl and resets it to its default value. If this implementation implements more than one Attribute interface it clears all.


toString

public String toString()
The default implementation of this method accesses all declared fields of this object and prints the values in the following syntax:
   public String toString() {
     return "start=" + startOffset + ",end=" + endOffset;
   }
 
This method may be overridden by subclasses.

Overrides:
toString in class Object

hashCode

public abstract int hashCode()
Subclasses must implement this method and should compute a hashCode similar to this:
   public int hashCode() {
     int code = startOffset;
     code = code * 31 + endOffset;
     return code;
   }
 
see also equals(Object)

Overrides:
hashCode in class Object

equals

public abstract boolean equals(Object other)
All values used for computation of hashCode() should be checked here for equality. see also Object.equals(Object)

Overrides:
equals in class Object

copyTo

public abstract void copyTo(AttributeImpl target)
Copies the values from this Attribute into the passed-in target attribute. The target implementation must support all the Attributes this implementation supports.


clone

public Object clone()
Shallow clone. Subclasses must override this if they need to clone any members deeply,

Overrides:
clone in class Object


Copyright © 2000-2010 Apache Software Foundation. All Rights Reserved.