001package jmri.jmrix.ipocs; 002 003import jmri.*; 004 005/** 006 * 007 * @author Fredrik Elestedt Copyright (C) 2020 008 * @since 4.21.2 009 */ 010public class IpocsSystemConnectionMemo extends jmri.jmrix.DefaultSystemConnectionMemo implements jmri.jmrix.ConfiguringSystemConnectionMemo { 011 private IpocsPortController portController; 012 013 public IpocsSystemConnectionMemo() { 014 super("P", "IPOCS"); 015 storeThisInstance(); 016 } 017 018 private void storeThisInstance(){ 019 InstanceManager.store(this, IpocsSystemConnectionMemo.class); 020 } 021 022 @Override 023 public void configureManagers() { 024 InstanceManager.setSensorManager(getSensorManager()); 025 InstanceManager.setTurnoutManager(getTurnoutManager()); 026 InstanceManager.setLightManager(getLightManager()); 027 028 register(); 029 } 030 031 @Override 032 public <B extends jmri.NamedBean> java.util.Comparator<B> getNamedBeanComparator(final Class<B> type) { 033 return new jmri.util.NamedBeanComparator<>(); 034 } 035 036 @Override 037 protected java.util.ResourceBundle getActionModelResourceBundle() { 038 return null; 039 } 040 041 public IpocsSensorManager getSensorManager() { 042 if (getDisabled()) { 043 return null; 044 } 045 return (IpocsSensorManager) classObjectMap.computeIfAbsent(SensorManager.class, (c) -> { 046 IpocsSensorManager t = new IpocsSensorManager(this); 047 return t; 048 }); 049 } 050 051 public IpocsLightManager getLightManager() { 052 if (getDisabled()) { 053 return null; 054 } 055 return (IpocsLightManager) classObjectMap.computeIfAbsent(LightManager.class, (c) -> { 056 IpocsLightManager t = new IpocsLightManager(this); 057 return t; 058 }); 059 } 060 061 public IpocsTurnoutManager getTurnoutManager() { 062 if (getDisabled()) { 063 return null; 064 } 065 return (IpocsTurnoutManager) classObjectMap.computeIfAbsent(TurnoutManager.class, (c) -> { 066 IpocsTurnoutManager t = new IpocsTurnoutManager(this); 067 return t; 068 }); 069 } 070 071 public IpocsPortController getPortController() { 072 return portController; 073 } 074 075 public void setPortController(IpocsPortController portController) { 076 this.portController = portController; 077 } 078}