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