001package jmri.jmrix.can.cbus.node; 002 003import jmri.jmrix.can.cbus.CbusEvent; 004 005// import org.slf4j.Logger; 006// import org.slf4j.LoggerFactory; 007 008/** 009 * Base Class of CbusNodeEvent 010 * 011 * @author Steve Young Copyright (C) 2019 012 */ 013public class CbusBasicNodeEvent extends CbusEvent { 014 private final int _thisnode; 015 private int _index; 016 private String _fcuNodeName; 017 private CbusNodeSingleEventTableDataModel eventDataModel; 018 019 /** 020 * Set the value of the event variable array by index 021 * 022 * @param memo CAN System Connection 023 * @param nn Event node Number 024 * @param en Event event or device number 025 * @param thisnode Host node number 026 * @param index number assigned by node, -1 if unknown 027 */ 028 public CbusBasicNodeEvent( jmri.jmrix.can.CanSystemConnectionMemo memo, 029 int nn, int en, int thisnode, int index){ 030 super(memo,nn,en); 031 _thisnode = thisnode; 032 _index = index; 033 _fcuNodeName = ""; 034 } 035 036 protected void setEditTableModel( CbusNodeSingleEventTableDataModel model ) { 037 eventDataModel = model; 038 } 039 040 protected void notifyModel(){ 041 if ( eventDataModel != null ) { 042 eventDataModel.fireTableDataChanged(); 043 } 044 } 045 046 /** 047 * Returns the parent host node of the node event 048 * 049 * @return decimal node number 050 */ 051 public int getParentNn(){ 052 return _thisnode; 053 } 054 055 /** 056 * Set the index number of this event on a node 057 * <p> 058 * Index number not valid after any event has been written to or deleted from the node 059 * 060 * @param index number, -1 if unset 061 */ 062 public final void setIndex(int index){ 063 _index = index; 064 } 065 066 /** 067 * Get the index number of this event on a node 068 * 069 * @return index number, -1 if unset 070 */ 071 public final int getIndex(){ 072 return _index; 073 } 074 075 /** 076 * Set a temporary node name 077 * @param tempName the name to use 078 */ 079 public final void setTempFcuNodeName( String tempName){ 080 if ( tempName !=null ){ 081 _fcuNodeName = tempName; 082 } 083 } 084 085 /** 086 * Get the temporary node name 087 * @return the name 088 */ 089 public final String getTempFcuNodeName(){ 090 return _fcuNodeName; 091 } 092 093 /** 094 * {@inheritDoc} 095 */ 096 @Override 097 public boolean equals(Object o) { 098 return super.equals(o); 099 } 100 101 /** {@inheritDoc} */ 102 @Override 103 public int hashCode() { 104 return super.hashCode(); 105 } 106 107 // private static final Logger log = LoggerFactory.getLogger(CbusBasicNodeEvent.class); 108 109}