001package jmri.implementation; 002 003import jmri.Consist; 004import jmri.LocoAddress; 005import jmri.DccLocoAddress; 006import jmri.CommandStation; 007 008/** 009 * Default Consist Manager which uses the NmraConsist class for 010 * the consists it builds 011 * 012 * @author Paul Bender Copyright (C) 2003 013 * @author Randall Wood Copyright (C) 2013 014 */ 015public class NmraConsistManager extends AbstractConsistManager { 016 017 private CommandStation commandStation = null; 018 019 public NmraConsistManager(CommandStation cs) { 020 super(); 021 commandStation = cs; 022 } 023 024 @Override 025 public Consist addConsist(LocoAddress address) { 026 if (! (address instanceof DccLocoAddress)) { 027 throw new IllegalArgumentException("address is not a DccLocoAddress object"); 028 } 029 if (consistTable.containsKey(address)) { 030 return (consistTable.get(address)); 031 } 032 NmraConsist consist; 033 consist = new NmraConsist((DccLocoAddress) address, commandStation); 034 consistTable.put(address, consist); 035 notifyConsistListChanged(); 036 return (consist); 037 } 038 039 /** 040 * This implementation does NOT support Command Station consists, so return 041 * false. 042 */ 043 @Override 044 public boolean isCommandStationConsistPossible() { 045 return false; 046 } 047 048 /** 049 * Does a CS consist require a separate consist address? This implementation 050 * does not support Command Station consists, so return false 051 */ 052 @Override 053 public boolean csConsistNeedsSeperateAddress() { 054 return false; 055 } 056}