コード例 #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();
        }
コード例 #2
0
        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
ファイル: Token.cs プロジェクト: ahmedfe/Xamarin-Lucene.Net
 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
ファイル: TestToken.cs プロジェクト: maximburyak/lucenenet
 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
ファイル: TestToken.cs プロジェクト: Nangal/lucene.net
 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);
 }
コード例 #13
0
 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;
 }