public abstract class RealReferrer extends RealFeature
Modifier and Type | Field and Description |
---|---|
protected RealFeature |
referent
The feature being referred to.
|
containingPackage, generatingClassifier
Modifier | Constructor and Description |
---|---|
protected |
RealReferrer()
For internal use only.
|
|
RealReferrer(Classifier c,
RealFeature r)
Sets both the identifier and the referent.
|
|
RealReferrer(String p,
String c,
RealFeature r)
Sets both the identifier and the referent.
|
Modifier and Type | Method and Description |
---|---|
int |
childLexiconLookup(ChildLexicon lex,
int label)
Does a feature-type-specific lookup of this feature in the given
ChildLexicon . |
int |
compareTo(Object o)
Used to sort features into an order that is convenient both to page through and for the
lexicon to read off disk.
|
int |
depth()
The depth of a feature is one more than the maximum depth of any of its children, or 0 if it
has no children.
|
RealFeature |
getReferent()
Returns the value of
referent . |
double |
getStrength()
Simply returns the strength of
referent . |
int |
hashCode()
The hash code of a
RealReferrer is the sum of the hash codes of the containing
package, the identifier, and the referent feature. |
boolean |
isReferrer()
Determines if this feature is a referring feature.
|
void |
lexRead(edu.illinois.cs.cogcomp.core.datastructures.vectors.ExceptionlessInputStream in,
Lexicon lex,
String p,
String g,
String si,
ByteString bi)
Reads the representation of a feature with this object's run-time type as stored by a
lexicon, overwriting the data in this object.
|
String |
lexWrite(edu.illinois.cs.cogcomp.core.datastructures.vectors.ExceptionlessOutputStream out,
Lexicon lex,
String c,
String p,
String g,
String si,
ByteString bi)
Writes a binary representation of the feature intended for use by a lexicon, omitting
redundant information when possible.
|
void |
read(edu.illinois.cs.cogcomp.core.datastructures.vectors.ExceptionlessInputStream in)
Reads the representation of a feaeture with this object's run-time type from the given
stream, overwriting the data in this object.
|
void |
removeFromChildLexicon(ChildLexicon lex)
Takes care of any feature-type-specific tasks that need to be taken care of when removing a
feature of this type from a
ChildLexicon , in particular updating parent counts and
removing children of this feature if necessary. |
void |
write(edu.illinois.cs.cogcomp.core.datastructures.vectors.ExceptionlessOutputStream out)
Writes a complete binary representation of the feature.
|
void |
write(StringBuffer buffer)
Writes a string representation of this
Feature to the specified buffer. |
void |
writeNoPackage(StringBuffer buffer)
Writes a string representation of this
Feature to the specified buffer, omitting
the package name. |
conjunction, getByteStringValue, getStringValue, isDiscrete, makeReal, multiply, valueEquals
classEquivalent, clone, compareNameStrings, conjunctWith, conjunctWith, encode, equals, fromArray, getByteStringIdentifier, getFeatureKey, getFeatureKey, getGeneratingClassifier, getPackage, getStringIdentifier, getValueIndex, hasByteStringIdentifier, hasStringIdentifier, isConjunctive, isPrimitive, lexReadFeature, readFeature, setArrayLength, toString, toStringNoPackage, totalValues, withStrength, writeNameString
protected RealFeature referent
protected RealReferrer()
public RealReferrer(Classifier c, RealFeature r)
c
- The classifier that produced this feature.r
- The real feature referred to by this new feature.public RealReferrer(String p, String c, RealFeature r)
p
- The new real feature's package.c
- The name of the classifier that produced this feature.r
- The real feature referred to by this new feature.public boolean isReferrer()
isReferrer
in class Feature
true
iff this feature is a referring feature.public RealFeature getReferent()
referent
.public int depth()
public double getStrength()
referent
.getStrength
in class Feature
public void removeFromChildLexicon(ChildLexicon lex)
ChildLexicon
, in particular updating parent counts and
removing children of this feature if necessary.removeFromChildLexicon
in class Feature
lex
- The child lexicon this feature is being removed from.public int childLexiconLookup(ChildLexicon lex, int label)
ChildLexicon
.childLexiconLookup
in class Feature
lex
- The child lexicon this feature is being looked up in.label
- The label of the example containing this feature, or -1 if we aren't doing per
class feature counting.f
in this lexicon.public int hashCode()
RealReferrer
is the sum of the hash codes of the containing
package, the identifier, and the referent feature.public int compareTo(Object o)
compareTo
in interface Comparable
compareTo
in class Feature
o
- An object to compare with.public void write(StringBuffer buffer)
Feature
to the specified buffer.public void writeNoPackage(StringBuffer buffer)
Feature
to the specified buffer, omitting
the package name.writeNoPackage
in class Feature
buffer
- The buffer to write to.public void write(edu.illinois.cs.cogcomp.core.datastructures.vectors.ExceptionlessOutputStream out)
public void read(edu.illinois.cs.cogcomp.core.datastructures.vectors.ExceptionlessInputStream in)
public String lexWrite(edu.illinois.cs.cogcomp.core.datastructures.vectors.ExceptionlessOutputStream out, Lexicon lex, String c, String p, String g, String si, ByteString bi)
lexWrite
in class Feature
out
- The output stream.lex
- The lexicon out of which this feature is being written.c
- The fully qualified name of the assumed class. The runtime class of this feature
won't be written if it's equivalent to c
.p
- The assumed package string. This feature's package string won't be written if it's
equivalent to p
.g
- The assumed classifier name string. This feature's classifier name string won't be
written if it's equivalent to g
.si
- The assumed identifier as a string. If this feature has a string identifier, it
won't be written if it's equivalent to si
.bi
- The assumed identifier as a byte string. If this feature has a byte string
identifier, it won't be written if it's equivalent to bi
.public void lexRead(edu.illinois.cs.cogcomp.core.datastructures.vectors.ExceptionlessInputStream in, Lexicon lex, String p, String g, String si, ByteString bi)
This method is appropriate for reading features as written by
lexWrite(ExceptionlessOutputStream,Lexicon,String,String,String,String,ByteString)
.
lexRead
in class Feature
in
- The input stream.lex
- The lexicon we are reading in to.p
- The assumed package string. If no package name is given in the input stream, the
instantiated feature is given this package.g
- The assumed classifier name string. If no classifier name is given in the input
stream, the instantiated feature is given this classifier name.si
- The assumed identifier as a string. If the feature being read has a string
identifier field and no identifier is given in the input stream, the feature is given
this identifier.bi
- The assumed identifier as a byte string. If the feature being read has a byte
string identifier field and no identifier is given in the input stream, the feature is
given this identifier.Copyright © 2016. All rights reserved.