Beispiel #1
0
 public Locator(
     ImMap <string, ImMap <string, LocatorTarget> > registrationList,
     ImList <LocatorPlug> plugs
     )
 {
     RegistrationList = registrationList;
     Plugs            = plugs;
 }
Beispiel #2
0
 public static void Maybe <K, V>(Action <V, K> action, K key, ImMap <K, V> map)
 {
     if (!map.Has(key))
     {
         return;
     }
     action(map[key], key);
 }
Beispiel #3
0
 public static T Maybe <K, V, T>(Func <V, K, T> action, K key, ImMap <K, V> map)
 {
     if (!map.Has(key))
     {
         return(default(T));
     }
     return(action(map[key], key));
 }
Beispiel #4
0
 public PlugState(
     string domain,
     string address,
     ImMap <string, ImMap <string, LocatorTarget> > registrationList
     )
 {
     Domain           = domain;
     Address          = address;
     RegistrationList = registrationList;
 }
Beispiel #5
0
 private ImMap <string, LocatorTarget> GetTargetList(
     string domain,
     ImMap <string, ImMap <string, LocatorTarget> > registrationList
     )
 {
     if (!registrationList.Has(domain))
     {
         return(Im.Map <LocatorTarget>());
     }
     return(RegistrationList[domain]);
 }
Beispiel #6
0
 private LocatorTarget GetTargetFromTargetList(
     string address,
     ImMap <string, LocatorTarget> targetList
     )
 {
     if (!targetList.Has(address))
     {
         // MEMO: do error handling inside a plug
         return(new LocatorTarget());
     }
     return(targetList[address]);
 }
Beispiel #7
0
 public static void Maybe <V>(Action <V, string> action, string key, ImMap <string, V> map)
 {
     Maybe <string, V>(action, key, map);
 }
Beispiel #8
0
 public static T Maybe <V, T>(Func <V, string, T> action, string key, ImMap <string, V> map)
 {
     return(Maybe <string, V, T>(action, key, map));
 }