Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.stanford.nlp.ling
Class CyclicCoreLabel

    java.lang.Object
      edu.stanford.nlp.util.ArrayCoreMap
          edu.stanford.nlp.ling.CoreLabel
              edu.stanford.nlp.ling.CyclicCoreLabel

All Implemented Interfaces:
  HasCategory, HasContext, HasIndex, HasTag, HasWord, Label, CoreMap, TypesafeMap<CoreMap>, Serializable

    public class CyclicCoreLabel

extends CoreLabel

Version of CoreLabel that allows for cycles in values/keys. Equals is defined as object equality, hashcode is defined on object address, and toString will not print cycles. TODO: This class may be removable if it is the case that TreeGraphNode (it's main user) doesn't actually need the cyclic semantics (because we fixed a bug in its lack of hashCode).

Author:
  rafferty
See Also:
  Serialized Form

Nested Class Summary

Nested classes/interfaces inherited from class edu.stanford.nlp.ling.CoreLabel
`CoreLabel.GenericAnnotation<T>`

Nested classes/interfaces inherited from interface edu.stanford.nlp.util.TypesafeMap
`TypesafeMap.Key<BASE,VALUE>`

Field Summary

Fields inherited from class edu.stanford.nlp.ling.CoreLabel
`genericKeys, genericValues`

Constructor Summary
`CyclicCoreLabel()` Default constructor, calls super()
`CyclicCoreLabel(CoreLabel label)` Copy constructor from any CoreMap.
`CyclicCoreLabel(CoreMap label)` Copy constructor from any CoreMap.
`CyclicCoreLabel(CyclicCoreLabel label)` Copy constructor from any CoreMap.
`CyclicCoreLabel(Label label)` Copy constructor from any CoreMap.

Method Summary
`boolean` | `cyclicEquals(Object obj)` Equals method that is well defined even if there are cycles in keys/values.
`int` | `cyclicHashCode()` Hashcode function that works on object address equality.
`String` | `cyclicToString()` To string method that works regardless of whether cycles exist
`boolean` | `equals(Object obj)` Two CoreMaps are equal iff all keys and values are equal.
`static LabelFactory` | `factory()`
`int` | `hashCode()` Returns a composite hashcode over all the keys and values currently stored in the map.
`LabelFactory` | `labelFactory()` Returns a factory that makes labels of the exact same type as this one.
`String` | `toString()` Return a `String` containing the value (and index, if any) of this label.
`String` | `toString(String format)` Returns a formatted string representing this label.

Methods inherited from class edu.stanford.nlp.ling.CoreLabel
`after, appendAfter, before, category, current, docID, getString, index, lemma, ner, prependBefore, sentIndex, setAfter, setBefore, setCategory, setCurrent, setDocID, setFromString, setIndex, setLemma, setNER, setSentIndex, setTag, setValue, setWord, tag, value, word`

Methods inherited from class edu.stanford.nlp.util.ArrayCoreMap
`compact, containsKey, get, has, keySet, remove, set, size, toShorterString`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### CyclicCoreLabel

    public CyclicCoreLabel()

  Default constructor, calls super()

### CyclicCoreLabel

    public CyclicCoreLabel(Label label)

  Copy constructor from any CoreMap.

### CyclicCoreLabel

    public CyclicCoreLabel(CoreMap label)

  Copy constructor from any CoreMap.

### CyclicCoreLabel

    public CyclicCoreLabel(CoreLabel label)

  Copy constructor from any CoreMap.

### CyclicCoreLabel

    public CyclicCoreLabel(CyclicCoreLabel label)

  Copy constructor from any CoreMap.

Method Detail

### equals

    public boolean equals(Object obj)

  Two CoreMaps are equal iff all keys and values are equal.

  Overrides:
    `equals` in class `ArrayCoreMap`

### hashCode

    public int hashCode()

  Returns a composite hashcode over all the keys and values currently stored in the map. Because they may change over time, this class is not appropriate for use as map keys.

  Overrides:
    `hashCode` in class `ArrayCoreMap`

### toString

    public String toString()

  Return a `String` containing the value (and index, if any) of this label. This is equivalent to toString("value-index").

  Specified by:
    `toString` in interface `Label`
  Overrides:
    `toString` in class `ArrayCoreMap`
  Returns:
    a text representation of the full label contents

### toString

    public String toString(String format)

  Returns a formatted string representing this label. The desired format is passed in as a `String`. Currently supported formats include:
  - "value": just prints the value
  - "{map}": prints the complete map
  - "value{map}": prints the value followed by the contained map (less the map entry containing key `CATEGORY_KEY`)
  - "value-index": extracts a value and an integer index from the contained map using keys `INDEX_KEY`, respectively, and prints them with a hyphen in between
  - "value-index{map}": a combination of the above; the index is displayed first and then not shown in the map that is displayed
  - "word": Just the value of HEAD_WORD_KEY in the map

  Map is printed in alphabetical order of keys.

### factory

    public static LabelFactory factory()

### labelFactory

    public LabelFactory labelFactory()

  Returns a factory that makes labels of the exact same type as this one. May return `null` if no appropriate factory is known.

  Specified by:
    `labelFactory` in interface `Label`
  Overrides:
    `labelFactory` in class `CoreLabel`
  Returns:
    the LabelFactory for this kind of label

### cyclicToString

    public String cyclicToString()

  To string method that works regardless of whether cycles exist

### cyclicHashCode

    public int cyclicHashCode()

  Hashcode function that works on object address equality. Compatible with cyclicEquals

### cyclicEquals

    public boolean cyclicEquals(Object obj)

  Equals method that is well defined even if there are cycles in keys/values. Checks for object address equality for key-value pairs.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Stanford NLP Group