Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /************************************************************************
- *
- *Class: SwitchEntry
- *Author :Robert Taracha CST8130 - 2016
- *purpose: This class handles the array objects of a layer 2 switch table
- *data members: seAddress: MACAddress - holds address of entry
- * port: String - holds port information
- *methods: addEntry (MACAddress, String) - initializes object with parameters
- * isEqual(MACAddress):boolean - compares seAddress in object to parameter
- * getAddress(): MACAddress
- * getPort():String
- *
- */
- public class SwitchEntry {
- private MACAddress seAddress;
- private String port;
- public SwitchEntry () {
- seAddress = new MACAddress();
- port = "no";
- }
- public SwitchEntry (MACAddress address, String port) {
- seAddress = new MACAddress(address);
- this.port = new String(port);
- }
- // note to students...this is not actually used in the assignment - I wrote it to demo that it could be written
- public boolean isEqual (MACAddress rhs) {
- return seAddress.isEqual(rhs);
- }
- public MACAddress getAddress() {
- return seAddress;
- }
- public MACAddress getSeAddress() {
- return seAddress;
- }
- public void setSeAddress(MACAddress seAddress) {
- this.seAddress = seAddress;
- }
- public void setPort(String port) {
- this.port = port;
- }
- public String getPort() {
- return port;
- }
- public String toString() {
- return "address: " + seAddress + " port " + port;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement