Clover Coverage Report - JmDNS 3.4.1
Coverage timestamp: Thu Aug 25 2011 13:06:33 CEST
../../../../img/srcFileCovDistChart0.png 77% of files have more coverage
10   86   6   2
2   33   0.6   5
5     1.2  
1    
 
  DNSOperationCode       Line # 11 10 0% 6 17 0% 0.0
 
No Tests
 
1    /**
2    *
3    */
4    package javax.jmdns.impl.constants;
5   
6    /**
7    * DNS operation code.
8    *
9    * @author Arthur van Hoff, Jeff Sonstein, Werner Randelshofer, Pierre Frisch, Rick Blair
10    */
 
11    public enum DNSOperationCode {
12    /**
13    * Query [RFC1035]
14    */
15    Query("Query", 0),
16    /**
17    * IQuery (Inverse Query, Obsolete) [RFC3425]
18    */
19    IQuery("Inverse Query", 1),
20    /**
21    * Status [RFC1035]
22    */
23    Status("Status", 2),
24    /**
25    * Unassigned
26    */
27    Unassigned("Unassigned", 3),
28    /**
29    * Notify [RFC1996]
30    */
31    Notify("Notify", 4),
32    /**
33    * Update [RFC2136]
34    */
35    Update("Update", 5);
36   
37    /**
38    * DNS RCode types are encoded on the last 4 bits
39    */
40    static final int OpCode_MASK = 0x7800;
41   
42    private final String _externalName;
43   
44    private final int _index;
45   
 
46  0 toggle DNSOperationCode(String name, int index) {
47  0 _externalName = name;
48  0 _index = index;
49    }
50   
51    /**
52    * Return the string representation of this type
53    *
54    * @return String
55    */
 
56  0 toggle public String externalName() {
57  0 return _externalName;
58    }
59   
60    /**
61    * Return the numeric value of this type
62    *
63    * @return String
64    */
 
65  0 toggle public int indexValue() {
66  0 return _index;
67    }
68   
69    /**
70    * @param flags
71    * @return label
72    */
 
73  0 toggle public static DNSOperationCode operationCodeForFlags(int flags) {
74  0 int maskedIndex = (flags & OpCode_MASK) >> 11;
75  0 for (DNSOperationCode aCode : DNSOperationCode.values()) {
76  0 if (aCode._index == maskedIndex) return aCode;
77    }
78  0 return Unassigned;
79    }
80   
 
81  0 toggle @Override
82    public String toString() {
83  0 return this.name() + " index " + this.indexValue();
84    }
85   
86    }