1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
|
/*
* Created on 15.02.2004
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
package org.gnu.pilotlink;
/**
* @author stephan
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class FTB3VehicleRecord extends Record {
private String name;
private String note;
private String plate;
private double monthlyCost;
/**
*
*/
public FTB3VehicleRecord() {
super();
}
/**
* @param i
* @param att
* @param cat
* @param sz
*/
public FTB3VehicleRecord(int i, int att, int cat, int sz) {
super(i, att, cat, sz);
}
/**
* @param r
*/
public FTB3VehicleRecord(Record r) {
super(r);
}
/* (non-Javadoc)
* @see org.gnu.pilotlink.Record#getBuffer()
*/
public byte[] getBuffer() {
byte buf[]=new byte[0x70];
setStringAt(buf,name,0x08);
setStringAt(buf,plate,0x18);
setStringAt(buf,note,0x30);
return buf;
}
/* (non-Javadoc)
* @see org.gnu.pilotlink.Record#setBuffer(byte[])
*/
public void setBuffer(byte[] buf) {
name=getStringAt(buf,0x08);
plate=getStringAt(buf,0x18);
//TODO: parse monthly cost as float at 0x28
monthlyCost=getDoubleAt(buf,0x28);
note=getStringAt(buf,0x30);
setSize(buf.length);
}
/**
* @return Returns the name.
*/
public String getName() {
return name;
}
/**
* @param name The name to set.
*/
public void setName(String name) {
this.name= name;
setSize(getBuffer().length);
}
/**
* @return Returns the note.
*/
public String getNote() {
return note;
}
/**
* @param note The note to set.
*/
public void setNote(String note) {
this.note= note;
setSize(getBuffer().length);
}
/**
* @return Returns the plate.
*/
public String getPlate() {
return plate;
}
/**
* @param plate The plate to set.
*/
public void setPlate(String plate) {
this.plate= plate;
setSize(getBuffer().length);
}
public String toString() {
return "Vehicle: "+name+" ("+plate+") - "+note+ " Cost: "+monthlyCost;
}
}
|