예제 #1
0
        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());
        }
예제 #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;
     }
 }
예제 #4
0
 public AnonymousTokenStream(TokenArrayAnalyzer parent)
     : base(Token.TOKEN_ATTRIBUTE_FACTORY)
 {
     this.parent        = parent;
     this.reusableToken = (Attribute)AddAttribute <ITermAttribute>();
 }
예제 #5
0
 public override void CopyTo(Attribute target)
 {
 }
예제 #6
0
        public override void CopyTo(Attribute target)
        {
            TermToBytesRefAttribute other = (TermToBytesRefAttribute)target;

            other.Bytes = Bytes;
        }
예제 #7
0
 public override void CopyTo(Lucene.Net.Util.Attribute target)
 {
     target.Clear();
 }
예제 #8
0
 public override void CopyTo(Attribute target) 
 { }
예제 #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);
        }
예제 #10
0
 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();
 }
예제 #12
0
 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;
 }
예제 #14
0
 public override void CopyTo(Attribute target)
 {
     TermToBytesRefAttribute other = (TermToBytesRefAttribute)target;
     other.Bytes = Bytes;
 }