lucmoreau/ProvToolbox

Issue with IndexedDocument.getAgent(String name) ?

exas opened this issue · 1 comments

exas commented

At one of my projects i try to use IndexedDocument to extend an existing document.

Agents, Activities, Entities and other elements are saved in HashMaps at IndexedDocument.
For example the Agents are saved in agentMap using QualifiedName as Key:
private HashMap<QualifiedName,Agent> agentMap=new HashMap<QualifiedName, Agent>();

The corresponding getter functions for these elements seem to be not correctly implemented, e.g. getAgent(String name) at IndexedDocument:
public Agent getAgent(String name) { return agentMap.get(name); }

Shouldn't it be getAgent(QualifiedName name) to be working correctly, otherwise agentMap.get(name) will not work correctly with the String name as the hashcode will not be the same for the HashMap lookup for QualifiedName Objects.