if(ObjThreadMap.containsKey(ObjID)) {
HashMap<Timespec, ArrayList<threadAddressArray>> innerMap = ObjThreadMap.get(ObjID);
// Find the existing earliest deadline for this object
Timespec existingEarliestDeadline = null;
DeadlineStatus compareResult = DeadlineStatus.NOTFOUND;
for(Timespec deadlineKeys: innerMap.keySet()) {
if(existingEarliestDeadline == null) {
existingEarliestDeadline = deadlineKeys;
} else {
compareResult = earlierDeadline(existingEarliestDeadline, deadlineKeys);
if(compareResult == DeadlineStatus.LATER) {
existingEarliestDeadline = deadlineKeys;
}
}
}
if(existingEarliestDeadline == null) {
// Not a possible case -- still add entry and return
System.out.println("Not a possible case -- If Obj exists, deadline should exist --- still implemented");
HashMap<Timespec, ArrayList<threadAddressArray>> newObjEntry = new HashMap<Timespec, ArrayList<threadAddressArray>>();
ArrayList<threadAddressArray> newThreadEntry = new ArrayList<threadAddressArray>();
newThreadEntry.add(new threadAddressArray(thread_id, hashCode, threadAddress, false));
newObjEntry.put(deadline, newThreadEntry);
ObjThreadMap.put(ObjID, newObjEntry);
return true;
}
// Otherwise compare with the earliest deadline
// Iterate over the key-set
DeadlineStatus compareDeadline = earlierDeadline(existingEarliestDeadline, deadline);
if(compareDeadline == DeadlineStatus.EARLIER) {
Timespec Key = null;
boolean deadlineExists = false;
for(Timespec deadlineKeys: innerMap.keySet()) {
if(earlierDeadline(deadlineKeys, deadline) == DeadlineStatus.EQUAL) {
deadlineExists = true;
Key = deadlineKeys;