-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBadger.java
More file actions
95 lines (86 loc) · 2.93 KB
/
Badger.java
File metadata and controls
95 lines (86 loc) · 2.93 KB
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
//////////////////// ALL ASSIGNMENTS INCLUDE THIS SECTION /////////////////////
//
// Title: Access Control
// Files: User.Java, AccessControlTest.java, AccessControl.java
// Course: CS300, Fall, 2018
//
// Author: Daniel Chu
// Email: dchu22@wisc.edu
// Lecturer's Name: Gary Dahl
//
//////////////////// PAIR PROGRAMMERS COMPLETE THIS SECTION ///////////////////
//
// Partner Name: Tolga Beser
// Partner Email: tbeser@wisc.edu
// Partner Lecturer's Name: Gary Dahl
//
// VERIFY THE FOLLOWING BY PLACING AN X NEXT TO EACH TRUE STATEMENT:
// _x_ Write-up states that pair programming is allowed for this assignment.
// _x_ We have both read and understand the course Pair Programming Policy.
// _x_ We have registered our team prior to the team registration deadline.
//
///////////////////////////// CREDIT OUTSIDE HELP /////////////////////////////
//
// Students who get help from sources other than their partner must fully
// acknowledge and credit those sources of help here. Instructors and TAs do
// not need to be credited here, but tutors, friends, relatives, room mates,
// strangers, and others do. If you received no outside help from either type
// of source, then please explicitly indicate NONE.
//
// Persons: N/A
// Online Sources: N/A
//
/////////////////////////////// 80 COLUMNS WIDE ///////////////////////////////
/**
* This class represents a Badger which is designed to live in a Sett. Each Badger object represents a single node within a BST (known as a Sett).
*
*/
public class Badger {
private Badger leftLowerNeighbor; // left node of this badger
private Badger rightLowerNeighbor; // right node of this badger
private final int size; // the size of the badger
/**
* Creates a new Badger with specified size.
* @param size - The size of the newly constructed Badger object.
*/
public Badger(int size) {
leftLowerNeighbor = null; // assigns neighbor values to null
rightLowerNeighbor = null;
this.size = size;
}
/**
* Retrieves neighboring badger that is smaller than this one.
* @return The left lower neighbor of current badger.
*/
public Badger getLeftLowerNeighbor() {
return leftLowerNeighbor;
}
/**
* Retrieves neighboring badger that is larger than this one.
* @return The right lower neighbor of current badger.
*/
public Badger getRightLowerNeighbor() {
return rightLowerNeighbor;
}
/**
* Retrieves the size of this badger.
* @return The size of current badger.
*/
public int getSize() {
return size;
}
/**
* Changes this badger's lower left neighbor.
* @param badger - The new left lower neighbor of current badger.
*/
public void setLeftLowerNeighbor(Badger badger) {
leftLowerNeighbor = badger;
}
/**
* Changes this badger's lower right neighbor.
* @param badger - The new right lower neighbor of current badger.
*/
public void setRightLowerNeighbor(Badger badger) {
rightLowerNeighbor = badger;
}
}