Skip to content
This repository has been archived by the owner on Jun 22, 2019. It is now read-only.

Commit

Permalink
Clone 메서드에서 객체 타입으로 반환하도록 개선
Browse files Browse the repository at this point in the history
  • Loading branch information
sunghwan2789 committed Dec 1, 2018
1 parent 7e0ec07 commit 780788f
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
Binary file modified ClassDiagram1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 8 additions & 8 deletions SchedulerSimulator/ClassDiagram1.cd
Original file line number Diff line number Diff line change
Expand Up @@ -8,51 +8,51 @@
</TypeIdentifier>
</Class>
<Class Name="SchedulerSimulator.HighestResponseRatioNext">
<Position X="14.25" Y="12.75" Width="1.75" />
<Position X="14.5" Y="12.75" Width="1.75" />
<TypeIdentifier>
<HashCode>AAgAAAAAAAAAAAAAAAAAAIDAACAAAAAAAAAAAAAACAA=</HashCode>
<FileName>HighestResponseRatioNext.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="SchedulerSimulator.MainWindow" BaseTypeListCollapsed="true">
<Position X="12.5" Y="5.25" Width="2.75" />
<Position X="12.25" Y="5.5" Width="2.75" />
<TypeIdentifier>
<HashCode>AAABAAIAAAIAAAAIAAAAAAAAAAABAABAAAAQAAAAAAA=</HashCode>
<FileName>MainWindow.xaml.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Class>
<Class Name="SchedulerSimulator.NonPreemptivePriority">
<Position X="7" Y="12.75" Width="2.25" />
<Position X="7.25" Y="12.75" Width="2.25" />
<TypeIdentifier>
<HashCode>AAgAAAAAAAAAAAAAAAAAAIDAAAAAAAAAAAAAAAAACAA=</HashCode>
<FileName>NonPreemptivePriority.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="SchedulerSimulator.PreemptivePriority">
<Position X="9.5" Y="12.75" Width="2.25" />
<Position X="9.75" Y="12.75" Width="2.25" />
<TypeIdentifier>
<HashCode>AAgAAAAAAAAAAAAAAAAAAIDAAAAAAAAAAAAAAAAACAA=</HashCode>
<FileName>PreemptivePriority.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="SchedulerSimulator.Process">
<Position X="10.75" Y="1.25" Width="2" />
<Position X="10.5" Y="1.25" Width="2" />
<TypeIdentifier>
<HashCode>AAAoAAAEAAAAAAAEAAAAEAAAAAAAUAAAAAAAgAAAAAA=</HashCode>
<FileName>Process.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="SchedulerSimulator.ProcessControlBlock" BaseTypeListCollapsed="true">
<Position X="13.25" Y="1.25" Width="2" />
<Position X="12.75" Y="1.25" Width="2.25" />
<TypeIdentifier>
<HashCode>BAAAAAkEAAAAAAAAAgAAAAAAAAAgAABBAAAAgAQAABA=</HashCode>
<HashCode>BAAAAAkEAAAAAAAIAgAAAAAAAAAgAABBAAAAgAQAABA=</HashCode>
<FileName>ProcessControlBlock.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Class>
<Class Name="SchedulerSimulator.RoundRobin">
<Position X="12" Y="12.75" Width="2" />
<Position X="12.25" Y="12.75" Width="2" />
<TypeIdentifier>
<HashCode>AAgAAAAAAAAAAEAAAAAAAIDAAAAAAAAAAAAAAAAACAA=</HashCode>
<FileName>RoundRobin.cs</FileName>
Expand Down
2 changes: 1 addition & 1 deletion SchedulerSimulator/PreemptivePriority.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected override void Dispatch()
{
if (workingPcb.RemainingBurstTime > 0)
{
readyQueue.Add(workingPcb.Process.Priority, (ProcessControlBlock)workingPcb.Clone());
readyQueue.Add(workingPcb.Process.Priority, workingPcb.Clone());
}
Timeout();
}
Expand Down
4 changes: 3 additions & 1 deletion SchedulerSimulator/ProcessControlBlock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public int TurnaroundTime

private int? turnaroundTime = null;

public object Clone() => new ProcessControlBlock
public ProcessControlBlock Clone() => new ProcessControlBlock
{
Process = Process,
IsInitial = false,
Expand All @@ -71,5 +71,7 @@ public int TurnaroundTime
ResponseTime = ResponseTime,
WaitingTime = WaitingTime,
};

object ICloneable.Clone() => Clone();
}
}
2 changes: 1 addition & 1 deletion SchedulerSimulator/RoundRobin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ protected override void Dispatch()
{
if (workingPcb.RemainingBurstTime > 0)
{
readyQueue.Enqueue((ProcessControlBlock)workingPcb.Clone());
readyQueue.Enqueue(workingPcb.Clone());
}
Timeout();
}
Expand Down
2 changes: 1 addition & 1 deletion SchedulerSimulator/ShortestRemainingTimeFirst.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected override void Dispatch()
{
if (workingPcb.RemainingBurstTime > 0)
{
readyQueue.Add(workingPcb.RemainingBurstTime, (ProcessControlBlock)workingPcb.Clone());
readyQueue.Add(workingPcb.RemainingBurstTime, workingPcb.Clone());
}
Timeout();
}
Expand Down

0 comments on commit 780788f

Please sign in to comment.