private static int documentAccess(String[] records, String[] userGroups, String[] roomRights){
		
		// agent has no access to groups or rooms
		if(roomRights.length==0 || userGroups.length == 0){
			return 0;
		}
				
		Set<String> docs = new HashSet<>();
		Set<String> groups = new HashSet<>();
		Set<String> rooms = new HashSet<>();
		
		for(String group: userGroups)
			groups.add(group);
		
		for(String room: roomRights)
			rooms.add(room);

		for(String record: records){
			String[] rec = record.split(" ");
			String doc = rec[0];
			String room = rec[1];
			String group = rec[2];
			
			if(rooms.contains(room) && groups.contains(group)){
				docs.add(doc);
			}
			
		}
		
		return docs.size();
		
	}