Modifier and Type | Field and Description |
---|---|
private static boolean |
DEBUG
just used for debugging
|
private LiveSetElement |
first
The beginning of the list
|
Constructor and Description |
---|
LiveSet() |
Modifier and Type | Method and Description |
---|---|
boolean |
add(LiveSet additionList)
Adds the contents of the given set to this set.
|
void |
add(RegisterOperand item)
create a new object from the passed parameter and add it to the list
|
void |
clear()
Empties the set.
|
boolean |
contains(Register item)
Determines if the item passed is in the current set
|
private LiveSetElement |
createAndAddToCurrentList(RegisterOperand register,
LiveSetElement prevElement)
Copy the newElement into a new object and add it to the list
after prevElement.
|
LiveSetEnumerator |
enumerator()
Returns an enumerator of the list
|
private LiveSetElement |
getNextPtr(LiveSetElement ptr)
Inspects the passed ptr, if it is nonnull it returns its next field
otherwise, it returns "first"
|
boolean |
isEmpty()
Is the current set empty?
|
void |
remove(LiveSet removalList)
Removes the contents of the passed set from the this set, i.e.,
this = this - removeList |
(package private) void |
remove(RegisterOperand item)
Removes the passed register from this set.
|
String |
toString()
String-i-fy the current list
|
private LiveSetElement first
private static final boolean DEBUG
public LiveSet()
public final void clear()
public boolean contains(Register item)
item
- the register to search forpublic void add(RegisterOperand item)
item
- an object that contains the register to used in the newly
created objectpublic boolean add(LiveSet additionList)
additionList
- the set to add to this setpublic void remove(LiveSet removalList)
this = this - removeList
removalList
- the list to remove from this setvoid remove(RegisterOperand item)
item
- the registerOperand holding the register of interestpublic boolean isEmpty()
true
iff the set is emptypublic final LiveSetEnumerator enumerator()
private LiveSetElement createAndAddToCurrentList(RegisterOperand register, LiveSetElement prevElement)
register
- the element to copy and insertprevElement
- the element on the current list to insert after
or null, indicating insert at the frontprivate LiveSetElement getNextPtr(LiveSetElement ptr)
ptr
- the ptr to look at it