blob: 878a6d9237e6bb67e57beb0737236a401fbb198f [file] [log] [blame]
Meki Cherkaoui97e7a592012-04-14 02:50:06 -07001
2var Exclude = function Exclude(_Values){
3
4 this.OPTIMUM_FILTER_SIZE = 100;
5
6
7 this.Values = _Values; //array of elements
8
9}
10
11Exclude.prototype.decode = function(/*XMLDecoder*/ decoder) {
12
13
14
15 decoder.readStartElement(this.getElementLabel());
16
17 //TODO
18 /*var component;
19 var any = false;
20 while ((component = decoder.peekStartElement(CCNProtocolDTags.Component)) ||
21 (any = decoder.peekStartElement(CCNProtocolDTags.Any)) ||
22 decoder.peekStartElement(CCNProtocolDTags.Bloom)) {
23 var ee = component?new ExcludeComponent(): any ? new ExcludeAny() : new BloomFilter();
24 ee.decode(decoder);
25 _values.add(ee);
26 }*/
27
28 decoder.readEndElement();
29
30};
31
32Exclude.prototype.encode=function(/*XMLEncoder*/ encoder) {
33 if (!validate()) {
34 throw new ContentEncodingException("Cannot encode " + this.getClass().getName() + ": field values missing.");
35 }
36 // if everything is null, output nothing
37 if (empty())
38 return;
39
40 encoder.writeStartElement(getElementLabel());
41
42 encoder.writeEndElement();
43
44 };
45
46Exclude.prototype.getElementLabel = function() { return CCNProtocolDTags.Exclude; };
47