public override void CopyTo(Attribute target)
        {

            if (!(target is UniqueFieldAttributeImpl))
            {
                throw new System.ArgumentException(
                    "cannot copy the values from attribute UniqueFieldAttribute to an instance of "
                        + target.GetType().Name);
            }

            UniqueFieldAttributeImpl uniqueFieldAttr = (UniqueFieldAttributeImpl)target;
            uniqueFieldAttr.uniqueField = uniqueField.toString();
        }
        public void Test()
        {
            Token token = new Token();
            SingleTokenTokenStream ts = new SingleTokenTokenStream(token);
            Attribute tokenAtt        = (Attribute)ts.AddAttribute <ITermAttribute>();

            Assert.True(tokenAtt is Token);
            ts.Reset();

            Assert.True(ts.IncrementToken());
            Assert.AreEqual(token, tokenAtt);
            Assert.False(ts.IncrementToken());

            token = new Token("hallo", 10, 20, "someType");
            ts.SetToken(token);
            ts.Reset();

            Assert.True(ts.IncrementToken());
            Assert.AreEqual(token, tokenAtt);
            Assert.False(ts.IncrementToken());
        }
Exemple #3
0
 public override void  CopyTo(Attribute target)
 {
     if (target is Token)
     {
         var to = (Token)target;
         to.Reinit(this);
         // reinit shares the payload, so clone it:
         if (payload != null)
         {
             to.payload = (Payload)payload.Clone();
         }
     }
     else
     {
         InitTermBuffer();
         ((ITermAttribute)target).SetTermBuffer(termBuffer, 0, termLength);
         ((IOffsetAttribute)target).SetOffset(startOffset, endOffset);
         ((IPositionIncrementAttribute)target).PositionIncrement = positionIncrement;
         ((IPayloadAttribute)target).Payload = (payload == null)?null:(Payload)payload.Clone();
         ((IFlagsAttribute)target).Flags     = flags;
         ((ITypeAttribute)target).Type       = type;
     }
 }
Exemple #4
0
 public AnonymousTokenStream(TokenArrayAnalyzer parent)
     : base(Token.TOKEN_ATTRIBUTE_FACTORY)
 {
     this.parent        = parent;
     this.reusableToken = (Attribute)AddAttribute <ITermAttribute>();
 }
Exemple #5
0
 public override void CopyTo(Attribute target)
 {
 }
Exemple #6
0
        public override void CopyTo(Attribute target)
        {
            TermToBytesRefAttribute other = (TermToBytesRefAttribute)target;

            other.Bytes = Bytes;
        }
 public override void CopyTo(Lucene.Net.Util.Attribute target)
 {
     target.Clear();
 }
Exemple #8
0
 public override void CopyTo(Attribute target) 
 { }
Exemple #9
0
        /// <summary>
        /// Copy the offset.
        /// </summary>
        /// <param name="target">The target.</param>
        public override void CopyTo(Lucene.Net.Util.Attribute target)
        {
            SimpleUnicodeTermAttribute t = (SimpleUnicodeTermAttribute)target;

            t.SetOffset(_startOffset, _endOffset);
        }
 public AnonymousTokenStream(TokenArrayAnalyzer parent)
     : base(Token.TOKEN_ATTRIBUTE_FACTORY)
 {
     this.parent = parent;
     this.reusableToken = (Attribute)AddAttribute<ITermAttribute>();
 }
 public override void CopyTo(LuceneAttribute target)
 {
     throw new NotImplementedException();
 }
 public override void CopyTo(Attribute target)
 {
     BinaryTermAttribute other = (BinaryTermAttribute)target;
     other.Bytes.CopyBytes(Bytes);
 }
 public override void CopyTo(Attribute target)
 {
     IMockRetainAttribute t = (IMockRetainAttribute)target;
     t.Retain = retain;
 }
 public override void CopyTo(Attribute target)
 {
     TermToBytesRefAttribute other = (TermToBytesRefAttribute)target;
     other.Bytes = Bytes;
 }