public virtual ILabel NewLabel(ILabel oldLabel) { if (oldLabel is CoreLabel) { return(new CoreLabel((CoreLabel)oldLabel)); } else { //Map the old interfaces to the correct key/value pairs //Don't need to worry about HasIndex, which doesn't appear in any legacy code CoreLabel label = new CoreLabel(); if (oldLabel is IHasWord) { label.SetWord(((IHasWord)oldLabel).Word()); } if (oldLabel is IHasTag) { label.SetTag(((IHasTag)oldLabel).Tag()); } if (oldLabel is IHasOffset) { label.SetBeginPosition(((IHasOffset)oldLabel).BeginPosition()); label.SetEndPosition(((IHasOffset)oldLabel).EndPosition()); } if (oldLabel is IHasCategory) { label.SetCategory(((IHasCategory)oldLabel).Category()); } if (oldLabel is IHasIndex) { label.SetIndex(((IHasIndex)oldLabel).Index()); } label.SetValue(oldLabel.Value()); return(label); } }
public virtual void SetIndex(int index) { label.SetIndex(index); }