-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package gof.dp.strategy; | ||
|
||
public class LeastJob implements Scheduler{ | ||
@Override | ||
public void getNextCall() { | ||
System.out.println("가장 짧은 작업을 호출한다."); | ||
} | ||
|
||
@Override | ||
public void sendCallAgent() { | ||
System.out.println("현재 상담업무가 없거나 상담대기가 가장 작은 상담원에게 콜한다."); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package gof.dp.strategy; | ||
|
||
public class Priority implements Scheduler{ | ||
@Override | ||
public void getNextCall() { | ||
System.out.println("가장 우선순위가 높은 작업을 호출한다."); | ||
} | ||
|
||
@Override | ||
public void sendCallAgent() { | ||
System.out.println("현상담 우선순위가 높은 상담원에게 콜한다."); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package gof.dp.strategy; | ||
|
||
public class Roundrobin implements Scheduler{ | ||
@Override | ||
public void getNextCall() { | ||
System.out.println("순서대로 작업을 호출한다."); | ||
} | ||
|
||
@Override | ||
public void sendCallAgent() { | ||
System.out.println("상담원들에게 순차적으로 돌아가며 콜한다."); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package gof.dp.strategy; | ||
|
||
public interface Scheduler { | ||
public void getNextCall(); | ||
public void sendCallAgent(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package gof.dp.strategy; | ||
|
||
import java.io.BufferedReader; | ||
import java.io.IOException; | ||
import java.io.InputStreamReader; | ||
|
||
public class SchedulerTest { | ||
public static void main(String[] args) throws IOException { | ||
|
||
Scheduler scheduler = null; | ||
BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); | ||
|
||
System.out.println("L: 가장 짧은 작업 처리"); | ||
System.out.println("P: 가장 우선순위가 높은 작업 우선 처리"); | ||
System.out.println("R: 순차적으로 작업 처리"); | ||
|
||
String input = br.readLine(); | ||
|
||
if(input.equals("L") || input.equals("ㅣ") ){ | ||
scheduler = new LeastJob(); | ||
}else if(input.equals("P") || input.equals("p") ){ | ||
scheduler = new Priority(); | ||
}else if(input.equals("R") || input.equals("r") ){ | ||
scheduler = new Roundrobin(); | ||
}else{ | ||
System.out.println("잘못된 입력입니다."); | ||
return; | ||
} | ||
|
||
scheduler.getNextCall(); | ||
scheduler.sendCallAgent(); | ||
|
||
} | ||
} |