Adds a record to the Cache. @param r The record to be added @param cred The credibility of the record @param o The source of the record (this could be a Message, for example) @see Record
(Record r, int cred, Object o)
| 324 | * @see Record |
| 325 | */ |
| 326 | public synchronized void |
| 327 | addRecord(Record r, int cred, Object o) { |
| 328 | Name name = r.getName(); |
| 329 | int type = r.getRRsetType(); |
| 330 | if (!Type.isRR(type)) |
| 331 | return; |
| 332 | Element element = findElement(name, type, cred); |
| 333 | if (element == null) { |
| 334 | CacheRRset crrset = new CacheRRset(r, cred, maxcache); |
| 335 | addRRset(crrset, cred); |
| 336 | } else if (element.compareCredibility(cred) == 0) { |
| 337 | if (element instanceof CacheRRset) { |
| 338 | CacheRRset crrset = (CacheRRset) element; |
| 339 | crrset.addRR(r); |
| 340 | } |
| 341 | } |
| 342 | } |
| 343 | |
| 344 | /** |
| 345 | * Adds an RRset to the Cache. |
no test coverage detected