Skip to content

Commit

Permalink
CbusTableEvent - use memo
Browse files Browse the repository at this point in the history
  • Loading branch information
icklesteve committed Jan 6, 2020
1 parent 19d21a4 commit 4330a1a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
30 changes: 26 additions & 4 deletions java/src/jmri/jmrix/can/cbus/eventtable/CbusTableEvent.java
Expand Up @@ -24,11 +24,12 @@ public class CbusTableEvent extends CbusEvent {
private String _stloffstring;
private Date _timestamp;

public CbusTableEvent( int nn, int en,
public CbusTableEvent( jmri.jmrix.can.CanSystemConnectionMemo memo,
int nn, int en,
EvState state, int canid, String name, String comment,
int sesson, int sessoff, int sessin, int sessout, Date timestamp ){

super(nn,en);
super(memo,nn,en);
_state = state;
_canid = canid;
_name = name;
Expand All @@ -42,7 +43,7 @@ public CbusTableEvent( int nn, int en,
_timestamp = timestamp;

}

/**
* Get the last-seen date time.
* @return The last time the event was heard on the network
Expand All @@ -53,146 +54,167 @@ protected Date getDate(){

/**
* Set the last-seen date time
* @param newval the last-seen date time
*/
protected void setDate(Date newval) {
_timestamp = newval;
}

/**
* Get the Sensor Turnout and Light user names associated with event on
* @return Sensor Turnout and Light user names
*/
protected String getStlOn(){
return _stlonstring;
}

/**
* Get the Sensor Turnout and Light user names associated with event off
* @return Sensor Turnout and Light user names
*/
protected String getStlOff(){
return _stloffstring;
}

/**
* Set the Sensor Turnout and Light user names associated with event on
* @param newval Sensor Turnout and Light string
*/
protected void setStlOn(String newval){
_stlonstring = newval;
}

/**
* Set the Sensor Turnout and Light user names associated with event on
* Set the Sensor Turnout and Light user names associated with event off
* @param newval Sensor Turnout and Light string
*/
protected void setStlOff(String newval){
_stloffstring = newval;
}

/**
* Get the CAN ID to last send the event
* @return CAN ID
*/
protected int getEventCanId(){
return _canid;
}

/**
* Set the event comment
* @param newval Comment String
*/
protected void setComment(String newval){
_comment = newval;
}

/**
* Get the event comment
* @return Comment String
*/
protected String getComment(){
return _comment;
}

/**
* Set the CAN ID to last send the event
* @param newval CAN ID
*/
protected void setCanId(int newval){
_canid = newval;
}

/**
* Number of times event on for current session
* @return Number of times event on for current session
*/
protected int getSessionOn(){
return _sesson;
}

/**
* Number of times event on all sessions
* @return Number of times event on all sessions
*/
protected int getTotalOn(){
return _toton;
}

/**
* Number of times event off for current session
* @return Number of times event off for current session
*/
protected int getSessionOff(){
return _sessoff;
}

/**
* Number of times event off all sessions
* @return Number of times event off all sessions
*/
protected int getTotalOff(){
return _totoff;
}

/**
* Number of times event heard coming in to JMRI this session
* @return Number of times event heard coming in to JMRI this session
*/
protected int getSessionIn(){
return _sessin;
}

/**
* Number of times event heard coming in to JMRI all sessions
* @return Number of times event heard coming in to JMRI all sessions
*/
protected int getTotalIn(){
return _totin;
}

/**
* Number of times event heard being sent from JMRI this session
* @return Number of times event heard being sent from JMRI this session
*/
protected int getSessionOut(){
return _sessout;
}

/**
* Number of times event heard being sent from JMRI all sessions
* @return Number of times event heard being sent from JMRI all sessions
*/
protected int getTotalOut(){
return _totout;
}

/**
* Set Total On Events
* @param newVal Total On Events
*/
protected void setTotalOn(int newVal) {
_toton = newVal;
}

/**
* Set Total Off Events
* @param newVal Total Off Events
*/
protected void setTotalOff(int newVal) {
_totoff = newVal;
}

/**
* Set Total Inward Events
* @param newVal Total Inward Events
*/
protected void setTotalIn( int newVal) {
_totin = newVal;
}

/**
* Set Total Outward Events
* @param newVal Total Outward Events
*/
protected void setTotalOut( int newVal ){
_totout = newVal;
Expand Down
Expand Up @@ -15,16 +15,16 @@ public class CbusTableEventTest {

@Test
public void testCTor() {
// int,int,EvState,int,String,String,String,int,int,int,int,Date
CbusTableEvent t = new CbusTableEvent(0,1,null,0,"","",0,0,0,0,null);
// memo,int,int,EvState,int,String,String,String,int,int,int,int,Date
CbusTableEvent t = new CbusTableEvent(null,0,1,null,0,"","",0,0,0,0,null);
Assert.assertNotNull("exists",t);
t = null;
}

@Test
public void testSetGet() {

CbusTableEvent t = new CbusTableEvent(0,1,null,0,"","",0,0,0,0,null);
CbusTableEvent t = new CbusTableEvent(null,0,1,null,0,"","",0,0,0,0,null);

t.setDate(new java.util.Date() );
Assert.assertNotNull("date",t.getDate());
Expand Down

0 comments on commit 4330a1a

Please sign in to comment.