Meki Cherkaoui | f441d3a | 2012-04-22 15:17:52 -0700 | [diff] [blame] | 1 | /* |
| 2 | * @author: ucla-cs |
| 3 | * This class represents Exclude objects |
| 4 | */ |
| 5 | |
| 6 | var Exclude = function Exclude(_Values){ |
| 7 | |
| 8 | this.OPTIMUM_FILTER_SIZE = 100; |
| 9 | |
| 10 | |
| 11 | this.Values = _Values; //array of elements |
| 12 | |
| 13 | } |
| 14 | |
| 15 | Exclude.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 | |
| 38 | Exclude.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 | |
| 52 | Exclude.prototype.getElementLabel = function() { return CCNProtocolDTags.Exclude; }; |
| 53 | |