* Constructor, optionally does copy-construction. * @param feeds An Array of `Feed`s, or another `FeedDict`, in which case * copy-construction will be performed.
(feeds?: Feed[]|FeedDict)
| 65 | * copy-construction will be performed. |
| 66 | */ |
| 67 | constructor(feeds?: Feed[]|FeedDict) { |
| 68 | if (feeds instanceof FeedDict) { |
| 69 | for (const id in feeds.id2Value) { |
| 70 | this.id2Value[id] = feeds.id2Value[id]; |
| 71 | if (id in feeds.id2Mask) { |
| 72 | this.id2Mask[id] = feeds.id2Mask[id]; |
| 73 | } |
| 74 | } |
| 75 | } else { |
| 76 | if (feeds == null) { |
| 77 | return; |
| 78 | } |
| 79 | for (const feed of feeds) { |
| 80 | this.add(feed.key, feed.value); |
| 81 | } |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * Add a key-value pair to the FeedDict. |