1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.directory.api.ldap.aci.protectedItem;
21
22
23 import java.util.Collections;
24 import java.util.Iterator;
25 import java.util.Set;
26
27 import org.apache.directory.api.ldap.aci.ProtectedItem;
28
29
30
31
32
33
34
35
36
37
38
39
40
41 public class MaxValueCountItem extends ProtectedItem
42 {
43
44 private final Set<MaxValueCountElem> items;
45
46
47
48
49
50
51 public MaxValueCountItem( Set<MaxValueCountElem> items )
52 {
53 this.items = Collections.unmodifiableSet( items );
54 }
55
56
57
58
59
60
61
62 public Iterator<MaxValueCountElem> iterator()
63 {
64 return items.iterator();
65 }
66
67
68
69
70
71 @Override
72 public int hashCode()
73 {
74 int hash = 37;
75
76 if ( items != null )
77 {
78 for ( MaxValueCountElem item : items )
79 {
80 if ( item != null )
81 {
82 hash = hash * 17 + item.hashCode();
83 }
84 else
85 {
86 hash = hash * 17 + 37;
87 }
88 }
89 }
90
91 return hash;
92 }
93
94
95
96
97
98 @Override
99 public boolean equals( Object o )
100 {
101 if ( this == o )
102 {
103 return true;
104 }
105
106 if ( o instanceof MaxValueCountItem )
107 {
108 MaxValueCountItem that = ( MaxValueCountItem ) o;
109
110 return items.equals( that.items );
111 }
112
113 return false;
114 }
115
116
117
118
119
120 @Override
121 public String toString()
122 {
123 StringBuilder buf = new StringBuilder();
124
125 buf.append( "maxValueCount {" );
126
127 boolean isFirst = true;
128
129 if ( items != null )
130 {
131 for ( MaxValueCountElem item : items )
132 {
133 if ( isFirst )
134 {
135 isFirst = false;
136 }
137 else
138 {
139 buf.append( ", " );
140 }
141
142 buf.append( item.toString() );
143 }
144 }
145
146 buf.append( "}" );
147
148 return buf.toString();
149 }
150 }