001package jmri.jmrix.ztc.ztc611; 002 003import javax.annotation.Nonnull; 004import jmri.Turnout; 005import jmri.jmrix.lenz.XNetAddress; 006import jmri.jmrix.lenz.XNetSystemConnectionMemo; 007 008/** 009 * Implement turnout manager - Specific to ZTC ZTC611 010 * <p> 011 * System names are "XTnnn", where X is the user-configurable system prefix, 012 * nnn is the turnout number without padding. 013 * 014 * @author Paul Bender Copyright (C) 2008, 2017 015 */ 016public class ZTC611XNetTurnoutManager extends jmri.jmrix.lenz.XNetTurnoutManager { 017 018 public ZTC611XNetTurnoutManager(XNetSystemConnectionMemo memo) { 019 super(memo); 020 } 021 022 // XNet-specific methods 023 024 /** 025 * {@inheritDoc} 026 */ 027 @Nonnull 028 @Override 029 protected Turnout createNewTurnout(@Nonnull String systemName, String userName) throws IllegalArgumentException { 030 // check if the output bit is available 031 int bitNum = XNetAddress.getBitFromSystemName(systemName, getSystemPrefix()); 032 if (bitNum == -1) { 033 throw new IllegalArgumentException("Cannot get Bit from System Name " + systemName); 034 } 035 Turnout t = new ZTC611XNetTurnout(getSystemPrefix(), bitNum, tc); 036 t.setUserName(userName); 037 return t; 038 } 039 040 @Override 041 public boolean allowMultipleAdditions(@Nonnull String systemName) { 042 return true; 043 } 044 045 // private final static Logger log = LoggerFactory.getLogger(ZTC611XNetTurnoutManager.class); 046 047}