Pass all test cases
This commit is contained in:
parent
edcf0e8b80
commit
fb47df2a7a
@ -2,7 +2,6 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="d7d3389b-0262-48b5-81ce-827f8aae7d1b" name="Default Changelist" comment="">
|
<list default="true" id="d7d3389b-0262-48b5-81ce-827f8aae7d1b" name="Default Changelist" comment="">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/bufmgr/BufMgr.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/bufmgr/BufMgr.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/bufmgr/BufMgr.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/bufmgr/BufMgr.java" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<ignored path="$PROJECT_DIR$/out/" />
|
<ignored path="$PROJECT_DIR$/out/" />
|
||||||
@ -32,7 +31,7 @@
|
|||||||
</usages-collector>
|
</usages-collector>
|
||||||
<usages-collector id="statistics.file.types.edit">
|
<usages-collector id="statistics.file.types.edit">
|
||||||
<counts>
|
<counts>
|
||||||
<entry key="JAVA" value="2946" />
|
<entry key="JAVA" value="3505" />
|
||||||
<entry key="PLAIN_TEXT" value="2" />
|
<entry key="PLAIN_TEXT" value="2" />
|
||||||
</counts>
|
</counts>
|
||||||
</usages-collector>
|
</usages-collector>
|
||||||
@ -43,8 +42,8 @@
|
|||||||
<file pinned="false" current-in-tab="false">
|
<file pinned="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/src/tests/BMTest.java">
|
<entry file="file://$PROJECT_DIR$/src/tests/BMTest.java">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="404">
|
<state relative-caret-position="184">
|
||||||
<caret line="778" selection-start-line="778" selection-end-line="778" />
|
<caret line="575" selection-start-line="575" selection-end-line="575" />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
@ -70,17 +69,17 @@
|
|||||||
<file pinned="false" current-in-tab="true">
|
<file pinned="false" current-in-tab="true">
|
||||||
<entry file="file://$PROJECT_DIR$/src/bufmgr/BufMgr.java">
|
<entry file="file://$PROJECT_DIR$/src/bufmgr/BufMgr.java">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="379">
|
<state relative-caret-position="300">
|
||||||
<caret line="110" column="24" selection-start-line="110" selection-start-column="24" selection-end-line="110" selection-end-column="24" />
|
<caret line="164" column="42" selection-start-line="164" selection-start-column="42" selection-end-line="164" selection-end-column="42" />
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="e#13728#13729#0" expanded="true" />
|
<element signature="e#14808#14809#0" expanded="true" />
|
||||||
<element signature="e#13762#13763#0" expanded="true" />
|
<element signature="e#14842#14843#0" expanded="true" />
|
||||||
<element signature="e#14251#14252#0" expanded="true" />
|
<element signature="e#15331#15332#0" expanded="true" />
|
||||||
<element signature="e#14292#14293#0" expanded="true" />
|
<element signature="e#15372#15373#0" expanded="true" />
|
||||||
<element signature="e#14342#14343#0" expanded="true" />
|
<element signature="e#15422#15423#0" expanded="true" />
|
||||||
<element signature="e#14384#14385#0" expanded="true" />
|
<element signature="e#15464#15465#0" expanded="true" />
|
||||||
<element signature="e#14435#14436#0" expanded="true" />
|
<element signature="e#15515#15516#0" expanded="true" />
|
||||||
<element signature="e#14493#14494#0" expanded="true" />
|
<element signature="e#15573#15574#0" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
@ -308,34 +307,34 @@
|
|||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TestHistory">
|
<component name="TestHistory">
|
||||||
<history-entry file="BMTest_TestL_NewPageDeallocation - 2019.02.24 at 17h 23m 53s.xml">
|
<history-entry file="BMTest - 2019.02.24 at 18h 45m 17s.xml">
|
||||||
<configuration name="BMTest.TestL_NewPageDeallocation" configurationId="JUnit" />
|
|
||||||
</history-entry>
|
|
||||||
<history-entry file="BMTest - 2019.02.24 at 17h 27m 01s.xml">
|
|
||||||
<configuration name="BMTest" configurationId="JUnit" />
|
<configuration name="BMTest" configurationId="JUnit" />
|
||||||
</history-entry>
|
</history-entry>
|
||||||
<history-entry file="BMTest - 2019.02.24 at 17h 29m 37s.xml">
|
<history-entry file="BMTest - 2019.02.24 at 18h 45m 21s.xml">
|
||||||
<configuration name="BMTest" configurationId="JUnit" />
|
<configuration name="BMTest" configurationId="JUnit" />
|
||||||
</history-entry>
|
</history-entry>
|
||||||
<history-entry file="BMTest - 2019.02.24 at 17h 33m 36s.xml">
|
<history-entry file="BMTest - 2019.02.24 at 18h 45m 50s.xml">
|
||||||
<configuration name="BMTest" configurationId="JUnit" />
|
<configuration name="BMTest" configurationId="JUnit" />
|
||||||
</history-entry>
|
</history-entry>
|
||||||
<history-entry file="BMTest - 2019.02.24 at 17h 33m 47s.xml">
|
<history-entry file="BMTest - 2019.02.24 at 18h 48m 02s.xml">
|
||||||
<configuration name="BMTest" configurationId="JUnit" />
|
<configuration name="BMTest" configurationId="JUnit" />
|
||||||
</history-entry>
|
</history-entry>
|
||||||
<history-entry file="BMTest - 2019.02.24 at 17h 33m 58s.xml">
|
<history-entry file="BMTest - 2019.02.24 at 19h 39m 20s.xml">
|
||||||
<configuration name="BMTest" configurationId="JUnit" />
|
<configuration name="BMTest" configurationId="JUnit" />
|
||||||
</history-entry>
|
</history-entry>
|
||||||
<history-entry file="BMTest - 2019.02.24 at 17h 34m 23s.xml">
|
<history-entry file="BMTest - 2019.02.24 at 19h 45m 22s.xml">
|
||||||
<configuration name="BMTest" configurationId="JUnit" />
|
<configuration name="BMTest" configurationId="JUnit" />
|
||||||
</history-entry>
|
</history-entry>
|
||||||
<history-entry file="BMTest - 2019.02.24 at 17h 34m 43s.xml">
|
<history-entry file="BMTest - 2019.02.24 at 19h 49m 03s.xml">
|
||||||
<configuration name="BMTest" configurationId="JUnit" />
|
<configuration name="BMTest" configurationId="JUnit" />
|
||||||
</history-entry>
|
</history-entry>
|
||||||
<history-entry file="BMTest - 2019.02.24 at 17h 35m 05s.xml">
|
<history-entry file="BMTest - 2019.02.24 at 19h 49m 11s.xml">
|
||||||
<configuration name="BMTest" configurationId="JUnit" />
|
<configuration name="BMTest" configurationId="JUnit" />
|
||||||
</history-entry>
|
</history-entry>
|
||||||
<history-entry file="BMTest - 2019.02.24 at 18h 18m 24s.xml">
|
<history-entry file="BMTest - 2019.02.24 at 19h 54m 05s.xml">
|
||||||
|
<configuration name="BMTest" configurationId="JUnit" />
|
||||||
|
</history-entry>
|
||||||
|
<history-entry file="BMTest - 2019.02.24 at 19h 57m 29s.xml">
|
||||||
<configuration name="BMTest" configurationId="JUnit" />
|
<configuration name="BMTest" configurationId="JUnit" />
|
||||||
</history-entry>
|
</history-entry>
|
||||||
</component>
|
</component>
|
||||||
@ -381,9 +380,15 @@
|
|||||||
<breakpoints>
|
<breakpoints>
|
||||||
<line-breakpoint enabled="true" type="java-line">
|
<line-breakpoint enabled="true" type="java-line">
|
||||||
<url>file://$PROJECT_DIR$/src/tests/BMTest.java</url>
|
<url>file://$PROJECT_DIR$/src/tests/BMTest.java</url>
|
||||||
<line>769</line>
|
<line>575</line>
|
||||||
<properties />
|
<properties />
|
||||||
<option name="timeStamp" value="20" />
|
<option name="timeStamp" value="24" />
|
||||||
|
</line-breakpoint>
|
||||||
|
<line-breakpoint enabled="true" type="java-line">
|
||||||
|
<url>file://$PROJECT_DIR$/src/tests/BMTest.java</url>
|
||||||
|
<line>581</line>
|
||||||
|
<properties />
|
||||||
|
<option name="timeStamp" value="26" />
|
||||||
</line-breakpoint>
|
</line-breakpoint>
|
||||||
</breakpoints>
|
</breakpoints>
|
||||||
</breakpoint-manager>
|
</breakpoint-manager>
|
||||||
@ -461,24 +466,24 @@
|
|||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/src/tests/BMTest.java">
|
<entry file="file://$PROJECT_DIR$/src/tests/BMTest.java">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="404">
|
<state relative-caret-position="184">
|
||||||
<caret line="778" selection-start-line="778" selection-end-line="778" />
|
<caret line="575" selection-start-line="575" selection-end-line="575" />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/src/bufmgr/BufMgr.java">
|
<entry file="file://$PROJECT_DIR$/src/bufmgr/BufMgr.java">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="379">
|
<state relative-caret-position="300">
|
||||||
<caret line="110" column="24" selection-start-line="110" selection-start-column="24" selection-end-line="110" selection-end-column="24" />
|
<caret line="164" column="42" selection-start-line="164" selection-start-column="42" selection-end-line="164" selection-end-column="42" />
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="e#13728#13729#0" expanded="true" />
|
<element signature="e#14808#14809#0" expanded="true" />
|
||||||
<element signature="e#13762#13763#0" expanded="true" />
|
<element signature="e#14842#14843#0" expanded="true" />
|
||||||
<element signature="e#14251#14252#0" expanded="true" />
|
<element signature="e#15331#15332#0" expanded="true" />
|
||||||
<element signature="e#14292#14293#0" expanded="true" />
|
<element signature="e#15372#15373#0" expanded="true" />
|
||||||
<element signature="e#14342#14343#0" expanded="true" />
|
<element signature="e#15422#15423#0" expanded="true" />
|
||||||
<element signature="e#14384#14385#0" expanded="true" />
|
<element signature="e#15464#15465#0" expanded="true" />
|
||||||
<element signature="e#14435#14436#0" expanded="true" />
|
<element signature="e#15515#15516#0" expanded="true" />
|
||||||
<element signature="e#14493#14494#0" expanded="true" />
|
<element signature="e#15573#15574#0" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
|
@ -106,27 +106,17 @@ public class BufMgr {
|
|||||||
Page foundPage = new Page();
|
Page foundPage = new Page();
|
||||||
if (isFull) {
|
if (isFull) {
|
||||||
int index = -1;
|
int index = -1;
|
||||||
|
Integer head = fifo.poll();
|
||||||
|
|
||||||
for (Integer item : fifo) {
|
if (head != null) {
|
||||||
Integer pointer = hashTable.get(item);
|
index = hashTable.get(head);
|
||||||
if (pointer != null && bufDescr[pointer].PinCount <= 0) {
|
if (bufDescr[index].PinCount > 0) {
|
||||||
index = pointer;
|
throw new BufferPoolExceededException("No head found in FIFO Queue");
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
throw new BufferPoolExceededException("No head found in FIFO Queue");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index <= -1) {
|
|
||||||
throw new BufferPoolExceededException("No item found with 0 pin count");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Integer head = fifo.poll();
|
|
||||||
//
|
|
||||||
// if (head != null) {
|
|
||||||
// index = hashTable.get(head);
|
|
||||||
// } else {
|
|
||||||
// throw new BufferPoolExceededException("No head found in FIFO Queue");
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (bufDescr[index].DirtyBit) {
|
if (bufDescr[index].DirtyBit) {
|
||||||
try {
|
try {
|
||||||
// TODO: May be wrong error.
|
// TODO: May be wrong error.
|
||||||
@ -175,7 +165,7 @@ public class BufMgr {
|
|||||||
page.setPage(foundPage);
|
page.setPage(foundPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
fifo.remove(foundEntry);
|
fifo.remove(hashTable.get(pageno.pid));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -283,10 +273,25 @@ public class BufMgr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (nextIndex > 0) {
|
if (nextIndex > 0) {
|
||||||
int move = nextIndex;
|
int relocate = nextIndex;
|
||||||
nextIndex--;
|
nextIndex--;
|
||||||
|
|
||||||
fifo.remove(hashTable.get(globalPageId.pid));
|
fifo.remove(hashTable.get(globalPageId.pid));
|
||||||
|
|
||||||
|
int destroy = hashTable.get(globalPageId.pid);
|
||||||
|
hashTable.remove(globalPageId.pid);
|
||||||
|
if (destroy == relocate) {
|
||||||
|
bufFrames[relocate] = null;
|
||||||
|
bufDescr[relocate] = null;
|
||||||
|
} else {
|
||||||
|
bufFrames[destroy] = bufFrames[relocate];
|
||||||
|
bufDescr[destroy] = bufDescr[relocate];
|
||||||
|
bufFrames[relocate] = null;
|
||||||
|
bufDescr[relocate] = null;
|
||||||
|
|
||||||
|
hashTable.put(bufDescr[destroy].PageNumber, destroy);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// then delete from disk
|
// then delete from disk
|
||||||
|
Loading…
Reference in New Issue
Block a user