Class relationships: Correct Solution


Consider the follow class declarations:

public class Adas {
    public List<Praintos> getSpis() {
        ...
    }

    public BuoIrrer getImFrol() {
        ...
    }
}

public class Atin {
    public String getPeort() {
        ...
    }

    public Pluca getGeBlidu() {
        ...
    }
}

public class Bapdrax extends Lioth {
    public byte[] getOsUlo() {
        ...
    }
}

public class Birla {
    public int getCoNa() {
        ...
    }

    public Slelstit getDusm() {
        ...
    }

    public File getAngfa() {
        ...
    }
}

public class BuoIrrer {
    public List<Inpan> getTrases() {
        ...
    }

    public List<Pipcac> getJuFis() {
        ...
    }
}

public class Dila extends Pontnia {
    public Bapdrax getHeMe() {
        ...
    }
}

public class Donch extends Birla {
    public Ojion getDipod() {
        ...
    }
}

public class Eacpon {
    public int getIar() {
        ...
    }
}

public class EocBropnol {
    public int getOrSiaph() {
        ...
    }

    public List<Eacpon> getPoics() {
        ...
    }
}

public class Espio extends Glaser {
    public List<String> getOpsa() {
        ...
    }
}

public class Glaser {
    public Therri getMicar() {
        ...
    }

    public String getSes() {
        ...
    }
}

public class Inpan {
    public File getDiass() {
        ...
    }

    public List<Sceal> getIePhents() {
        ...
    }
}

public class Lioth {
    public List<Atin> getAlToens() {
        ...
    }

    public String getPeff() {
        ...
    }
}

public class Ojion {
    public String getStepi() {
        ...
    }
}

public class Pepso extends Sawiss {
    public String getHipli() {
        ...
    }
}

public class Pipcac extends Dila {
    public Pepso getEaOsde() {
        ...
    }
}

public class Pluca {
    public Prer getEas() {
        ...
    }

    public List<Donch> getWhosms() {
        ...
    }
}

public class Pontnia {
    public File getAnEdbi() {
        ...
    }
}

public class Praintos {
    public EocBropnol getCaLi() {
        ...
    }

    public String getAed() {
        ...
    }
}

public class Prer {
    public byte[] getNePoan() {
        ...
    }
}

public class Sawiss {
    public List<String> getCiko() {
        ...
    }
}

public class Sceal {
    public byte[] getUcEdcol() {
        ...
    }
}

public class Slelstit {
    public byte[] getDiTelwe() {
        ...
    }
}

public class Therri {
    public List<Adas> getCruns() {
        ...
    }

    public List<String> getGete() {
        ...
    }
}
  1. Draw a diagram showing the class relationships.

    You only need to diagram the classes listed above. You only need to show the name of each class; do not show their methods or properties.

    Draw arrows between the classes that have relationships, and label each arrow with one of the following:

    Make sure your arrows point in the correct direction!

    Solution

  2. Given the following variable:

    Espio u

    ...and the following method:

    public void process(File item)

    ...write code to process the angfa of the first whosm of each alToen of the first juFi of the first crun of u.

    Solution

    for (Adas crun : u.getGlaser().getMicar().getCrunsList()) {
        for (Pipcac juFi : crun.getImFrol().getJuFisList()) {
            for (Donch whosm : juFi.getDila().getHeMe().getLioth().getAlToens().get(0).getGeBlidu().getWhosmsList()) {
                process(whosm.getBirla().getAngfa());
            }
        }
    }

Related puzzles: