using System.Diagnostics; using System.Collections; using System.Collections.Generic; using System; using Godot; namespace Rokojori { public class MultiMap:Map> { public bool Has( K1 key1, K2 key2 ) { if ( ! ContainsKey( key1 ) ) { return false; } return this[ key1 ].ContainsKey( key2 ); } public void Set( K1 key, K2 key2, V value ) { if ( ! ContainsKey( key ) ) { this[ key ] = new Map(); } this[ key ][ key2 ]= value; } public void Remove( K1 key, K2 key2, V value ) { if ( ! ContainsKey( key ) ) { return; } var dictionary = this[ key ]; if ( ! dictionary.ContainsKey( key2 ) ) { return; } dictionary.Remove( key2 ); if ( dictionary.Count == 0 ) { Remove( key ); } } } }