home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2007 April / PCpro_2007_04.ISO / files / dsl / jNetTool.exe / org / xbill / DNS / Cache$NegativeElement.class (.txt) < prev    next >
Encoding:
Java Class File  |  2005-06-05  |  1.6 KB  |  40 lines

  1. package org.xbill.DNS;
  2.  
  3. class Cache$NegativeElement extends Cache.Element {
  4.    int type;
  5.    Name name;
  6.    SOARecord soa;
  7.  
  8.    public Cache$NegativeElement(Name name, int type, SOARecord soa, int cred, long maxttl) {
  9.       this.name = name;
  10.       this.type = type;
  11.       this.soa = soa;
  12.       long cttl = 0L;
  13.       if (soa != null) {
  14.          cttl = soa.getMinimum();
  15.          if (maxttl >= 0L) {
  16.             cttl = Math.min(cttl, maxttl);
  17.          }
  18.       }
  19.  
  20.       this.setValues(cred, cttl);
  21.    }
  22.  
  23.    public int getType() {
  24.       return this.type;
  25.    }
  26.  
  27.    public String toString() {
  28.       StringBuffer sb = new StringBuffer();
  29.       if (this.type == 0) {
  30.          sb.append("NXDOMAIN " + this.name);
  31.       } else {
  32.          sb.append("NXRRSET " + this.name + " " + Type.string(this.type));
  33.       }
  34.  
  35.       sb.append(" cl = ");
  36.       sb.append(this.credibility);
  37.       return sb.toString();
  38.    }
  39. }
  40.