Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/strangeberry/rendezvous/DNSQuestion.java


1   // Copyright (C) 2002  Strangeberry Inc.
2   // @(#)DNSQuestion.java, 1.13, 11/29/2002
3   //
4   // This library is free software; you can redistribute it and/or
5   // modify it under the terms of the GNU Lesser General Public
6   // License as published by the Free Software Foundation; either
7   // version 2.1 of the License, or (at your option) any later version.
8   // 
9   // This library is distributed in the hope that it will be useful,
10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  // Lesser General Public License for more details.
13  // 
14  // You should have received a copy of the GNU Lesser General Public
15  // License along with this library; if not, write to the Free Software
16  // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  
18  package com.strangeberry.rendezvous;
19  
20  import java.io.*;
21  import java.util.*;
22  
23  /**
24   * A DNS question.
25   *
26   * @author  Arthur van Hoff
27   * @version   1.13, 11/29/2002
28   */
29  final class DNSQuestion extends DNSEntry
30  {
31      /**
32       * Create a question.
33       */
34      DNSQuestion(String name, int type, int clazz)
35      {
36    super(name, type, clazz);
37      }
38  
39      /**
40       * Check if this question is answered by a given DNS record.
41       */
42      boolean answeredBy(DNSRecord rec)
43      {
44    return (clazz == rec.clazz) && ((type == rec.type) || (type == TYPE_ANY)) &&
45        name.equals(rec.name);
46      }
47  
48      /**
49       * For debugging only.
50       */
51      public String toString()
52      {
53    return toString("question", null);
54      }
55  }