001package jmri.jmrix.pi; 002 003import javax.annotation.Nonnull; 004import jmri.Turnout; 005 006/** 007 * Implement Pi turnout manager. 008 * <p> 009 * System names are "PTnnn", where P is the user configurable system prefix, 010 * nnn is the turnout number without padding. 011 * 012 * @author Paul Bender Copyright (C) 2015 013 */ 014public class RaspberryPiTurnoutManager extends jmri.managers.AbstractTurnoutManager { 015 016 // ctor has to register for RaspberryPi events 017 public RaspberryPiTurnoutManager(RaspberryPiSystemConnectionMemo memo) { 018 super(memo); 019 } 020 021 /** 022 * {@inheritDoc} 023 */ 024 @Override 025 @Nonnull 026 public RaspberryPiSystemConnectionMemo getMemo() { 027 return (RaspberryPiSystemConnectionMemo) memo; 028 } 029 030 /** 031 * {@inheritDoc} 032 */ 033 @Nonnull 034 @Override 035 protected Turnout createNewTurnout(@Nonnull String systemName, String userName) throws IllegalArgumentException { 036 Turnout t = new RaspberryPiTurnout(systemName, userName); 037 return t; 038 } 039 040 /** 041 * Validates to Integer Format 0-999 with valid prefix. 042 * eg. PT0 to PT999 043 * {@inheritDoc} 044 */ 045 @Override 046 @Nonnull 047 public String validateSystemNameFormat(@Nonnull String name, @Nonnull java.util.Locale locale) throws jmri.NamedBean.BadSystemNameException { 048 return this.validateIntegerSystemNameFormat(name, 0, 999, locale); 049 } 050 051}