001package jmri.jmrix; 002 003import java.beans.PropertyChangeListener; 004import java.util.List; 005import javax.annotation.Nonnull; 006import jmri.ProgListener; 007import jmri.Programmer; 008import jmri.ProgrammerException; 009import jmri.ProgrammingMode; 010 011/** 012 * Common implementations of the Programmer interface for making Programmer 013 * facade classes. 014 * 015 * @author Bob Jacobsen Copyright (C) 2013 016 */ 017public abstract class AbstractProgrammerFacade implements Programmer { 018 019 protected Programmer prog; 020 021 public AbstractProgrammerFacade(Programmer prog) { 022 this.prog = prog; 023 } 024 025 /** 026 * {@inheritDoc} 027 */ 028 @Nonnull 029 @Override 030 public String decodeErrorCode(int code) { 031 return prog.decodeErrorCode(code); 032 } 033 034 /** 035 * {@inheritDoc} 036 */ 037 @Override 038 public synchronized void addPropertyChangeListener(PropertyChangeListener l) { 039 prog.addPropertyChangeListener(l); 040 } 041 042 /** 043 * {@inheritDoc} 044 */ 045 @Override 046 public synchronized void removePropertyChangeListener(PropertyChangeListener l) { 047 prog.removePropertyChangeListener(l); 048 } 049 050 /** 051 * {@inheritDoc} 052 */ 053 @Override 054 public void writeCV(String CV, int val, ProgListener p) throws ProgrammerException { 055 prog.writeCV(CV, val, p); 056 } 057 058 /** 059 * {@inheritDoc} 060 */ 061 @Override 062 public void readCV(String CV, ProgListener p) throws ProgrammerException { 063 prog.readCV(CV, p); 064 } 065 066 /** 067 * {@inheritDoc} 068 */ 069 @Override 070 public void confirmCV(String CV, int val, ProgListener p) throws ProgrammerException { 071 prog.confirmCV(CV, val, p); 072 } 073 074 /** 075 * {@inheritDoc} 076 */ 077 @Override 078 public ProgrammingMode getMode() { 079 return prog.getMode(); 080 } 081 082 /** 083 * {@inheritDoc} 084 */ 085 @Override 086 @Nonnull 087 public List<ProgrammingMode> getSupportedModes() { 088 return prog.getSupportedModes(); 089 } 090 091 /** 092 * {@inheritDoc} 093 */ 094 @Override 095 public void setMode(ProgrammingMode p) { 096 prog.setMode(p); 097 } 098 099 /** 100 * {@inheritDoc} 101 */ 102 @Override 103 public boolean getCanRead() { 104 return prog.getCanRead(); 105 } 106 107 /** 108 * {@inheritDoc} 109 */ 110 @Override 111 public boolean getCanRead(String addr) { 112 return prog.getCanRead(addr); 113 } 114 115 /** 116 * {@inheritDoc} 117 */ 118 @Override 119 public boolean getCanWrite() { 120 return prog.getCanWrite(); 121 } 122 123 /** 124 * {@inheritDoc} 125 */ 126 @Override 127 public boolean getCanWrite(String addr) { 128 return prog.getCanWrite(addr); 129 } 130 131 /** 132 * {@inheritDoc} 133 */ 134 @Override 135 @Nonnull 136 public WriteConfirmMode getWriteConfirmMode(String addr) { return prog.getWriteConfirmMode(addr); } 137 138}