Skip to main content
added 12 characters in body; added 30 characters in body
Source Link
candied_orange
  • 114.6k
  • 27
  • 222
  • 352
Map<String, Selection> selectionMap = new HashMap<>();
selectionMap.put("RawFitnessSelction", new RawFitnessSelction());
selectionMap.put("RouletteWheelSelection", new RouletteWheelSelection());
selectionMap.put("TournamentSelection", new TournamentSelection());

AbstractSelectionFactory asf = new DOSInputSelectionFactory(
    selectionMap, 
    "Input choice of selection method: ");

class Client {
    AbstractSelectionFactory asf;
    Client (AbstractSelectionFactory asf) { 
        this.asf = asf;
    }

    public void select(Map<String, Double> population) {
        Selection selection = asf.chooseSelection();
        ...
    }

An abstract factory can be passed to a client and called as many times as you like, or just once. So long as the Client never sees the abstract factory being built, it doesn't care if you're getting input from the command line, a GUI, a file, a database, the internet, or whatever else.

Map<String, Selection> selectionMap = new HashMap<>();
selectionMap.put("RawFitnessSelction", new RawFitnessSelction());
selectionMap.put("RouletteWheelSelection", new RouletteWheelSelection());
selectionMap.put("TournamentSelection", new TournamentSelection());

AbstractSelectionFactory asf = new DOSInputSelectionFactory(
    selectionMap, 
    "Input choice of selection method: ");

class Client {
    AbstractSelectionFactory asf;
    Client (AbstractSelectionFactory asf) { 
        this.asf = asf;
    }

    select() {
        Selection selection = asf.chooseSelection();
        ...
    }

An abstract factory can be passed to a client and called as many times as you like, or just once. So long as the Client never sees the abstract factory being built, it doesn't care if you're getting input from the command line, a GUI, a file, a database, the internet, or whatever else.

Map<String, Selection> selectionMap = new HashMap<>();
selectionMap.put("RawFitnessSelction", new RawFitnessSelction());
selectionMap.put("RouletteWheelSelection", new RouletteWheelSelection());
selectionMap.put("TournamentSelection", new TournamentSelection());

AbstractSelectionFactory asf = new DOSInputSelectionFactory(
    selectionMap, 
    "Input choice of selection method: ");

class Client {
    AbstractSelectionFactory asf;
    Client (AbstractSelectionFactory asf) { 
        this.asf = asf;
    }

    public void select(Map<String, Double> population) {
        Selection selection = asf.chooseSelection();
        ...
    }

An abstract factory can be passed to a client and called as many times as you like, or just once. So long as the Client never sees the abstract factory being built, it doesn't care if you're getting input from the command line, a GUI, a file, a database, the internet, or whatever else.

added 21 characters in body
Source Link
candied_orange
  • 114.6k
  • 27
  • 222
  • 352
Map<String, Selection> selectionMap = new HashMap<>();
selectionMap.put("RawFitnessSelction", new RawFitnessSelction());
selectionMap.put("RouletteWheelSelection", new RouletteWheelSelection());
selectionMap.put("TournamentSelection", new TournamentSelection());

AbstractSelectionFactory asf = new DOSInputSelectionFactory(
    selectionMap, 
    "Input choice of selection method: ");

class Client {
    AbstractSelectionFactory asf;
    Client (AbstractSelectionFactory asf) { 
        this.asf = asf;
    }

    select() {
        Selection selection = asf.chooseSelection();
        ...
    }

An abstract factory can be passed to a client and called as many times as you like, or just once. So long as the Client never sees the abstract factory being built, it doesn't care if you're getting input from the command line, a GUI, a file, a database, the internet, or whatever else.

Map<String, Selection> selectionMap = new HashMap<>();
selectionMap.put("RawFitnessSelction", new RawFitnessSelction());
selectionMap.put("RouletteWheelSelection", new RouletteWheelSelection());
selectionMap.put("TournamentSelection", new TournamentSelection());

AbstractSelectionFactory asf = new DOSInputSelectionFactory(
    selectionMap, 
    "Input choice of selection method: ");

class Client {
    AbstractSelectionFactory asf;
    Client (AbstractSelectionFactory asf) {  this.asf = asf;}

    select() {
        Selection selection = asf.chooseSelection();
        ...
    }

An abstract factory can be passed to a client and called as many times as you like, or just once. So long as the Client never sees the abstract factory being built, it doesn't care if you're getting input from the command line, a GUI, a file, a database, the internet, or whatever else.

Map<String, Selection> selectionMap = new HashMap<>();
selectionMap.put("RawFitnessSelction", new RawFitnessSelction());
selectionMap.put("RouletteWheelSelection", new RouletteWheelSelection());
selectionMap.put("TournamentSelection", new TournamentSelection());

AbstractSelectionFactory asf = new DOSInputSelectionFactory(
    selectionMap, 
    "Input choice of selection method: ");

class Client {
    AbstractSelectionFactory asf;
    Client (AbstractSelectionFactory asf) { 
        this.asf = asf;
    }

    select() {
        Selection selection = asf.chooseSelection();
        ...
    }

An abstract factory can be passed to a client and called as many times as you like, or just once. So long as the Client never sees the abstract factory being built, it doesn't care if you're getting input from the command line, a GUI, a file, a database, the internet, or whatever else.

added 1 character in body
Source Link
candied_orange
  • 114.6k
  • 27
  • 222
  • 352
Map<String, Selection> selectionMap = new HashMap<>();
selectionMap.put("RawFitnessSelction", new RawFitnessSelction());
selectionMap.put("RouletteWheelSelection", new RouletteWheelSelection());
selectionMap.put("TournamentSelection", new TournamentSelection());

AbstractSelectionFactory asf = new DOSInputSelectionFactory(
    selectionMap, 
    "Input choice of selection method: ");

class Client {
    AbstractSelectionFactory asf;
    Client (AbstractSelectionFactory asf) {  this.asf = asf;}

    select() {
        Selection selection = asf.chooseSelection();
        ...
    }

An abstract factory can be passed to a client and called as many times as you like, or just once. So long as the Client never sees the abstract factory being built, it doesn't care if you're getting input from the command line, a GUI, a file, a database, the internet, or whatever else.

Map<String, Selection> selectionMap = new HashMap<>();
selectionMap.put("RawFitnessSelction", new RawFitnessSelction());
selectionMap.put("RouletteWheelSelection", new RouletteWheelSelection));
selectionMap.put("TournamentSelection", new TournamentSelection());

AbstractSelectionFactory asf = new DOSInputSelectionFactory(
    selectionMap, 
    "Input choice of selection method: ");

class Client {
    AbstractSelectionFactory asf;
    Client (AbstractSelectionFactory asf) {  this.asf = asf;}

    select() {
        Selection selection = asf.chooseSelection();
        ...
    }

An abstract factory can be passed to a client and called as many times as you like, or just once. So long as the Client never sees the abstract factory being built, it doesn't care if you're getting input from the command line, a GUI, a file, a database, the internet, or whatever else.

Map<String, Selection> selectionMap = new HashMap<>();
selectionMap.put("RawFitnessSelction", new RawFitnessSelction());
selectionMap.put("RouletteWheelSelection", new RouletteWheelSelection());
selectionMap.put("TournamentSelection", new TournamentSelection());

AbstractSelectionFactory asf = new DOSInputSelectionFactory(
    selectionMap, 
    "Input choice of selection method: ");

class Client {
    AbstractSelectionFactory asf;
    Client (AbstractSelectionFactory asf) {  this.asf = asf;}

    select() {
        Selection selection = asf.chooseSelection();
        ...
    }

An abstract factory can be passed to a client and called as many times as you like, or just once. So long as the Client never sees the abstract factory being built, it doesn't care if you're getting input from the command line, a GUI, a file, a database, the internet, or whatever else.

Source Link
candied_orange
  • 114.6k
  • 27
  • 222
  • 352
Loading