information-system-model/src/main/java/org/gcube/informationsystem/model/knowledge/UsageKnowledge.java

36 lines
708 B
Java
Raw Normal View History

2023-10-26 17:19:01 +02:00
package org.gcube.informationsystem.model.knowledge;
2023-10-24 15:18:48 +02:00
2023-10-25 18:01:11 +02:00
import java.util.ArrayList;
2023-10-24 15:18:48 +02:00
import java.util.LinkedHashMap;
2023-10-25 18:01:11 +02:00
import java.util.List;
2023-10-24 15:18:48 +02:00
import java.util.Map;
import org.gcube.informationsystem.base.reference.AccessType;
/**
* @author Luca Frosini (ISTI - CNR)
*/
public class UsageKnowledge<U> {
2023-10-25 18:01:11 +02:00
protected Map<String, List<U>> map;
2023-10-24 15:18:48 +02:00
public UsageKnowledge(AccessType accessType){
this.map = new LinkedHashMap<>();
}
public void add(String typeName, U u) {
2023-10-25 18:01:11 +02:00
List<U> list = map.get(typeName);
2023-10-24 15:18:48 +02:00
if(list==null) {
2023-10-25 18:01:11 +02:00
list = new ArrayList<>();
2023-10-24 15:18:48 +02:00
map.put(typeName, list);
}
list.add(u);
}
2023-10-25 18:01:11 +02:00
public List<U> getUsage(String typeName){
List<U> list = map.get(typeName);
2023-10-24 15:18:48 +02:00
return list;
}
}