Class relationships: Correct Solution


Consider the follow class declarations:

public class Ancer {
    public List<Chiss> getOdhins() {
        ...
    }

    public List<Tictess> getDengs() {
        ...
    }
}

public class Cetlof {
    public int getGla() {
        ...
    }

    public List<Eler> getIsVids() {
        ...
    }
}

public class Chiss extends Pestun {
    public File getSpo() {
        ...
    }
}

public class Daod {
    public File getVen() {
        ...
    }

    public List<Efsha> getRoas() {
        ...
    }
}

public class Efsha extends Pahec {
    public List<Sush> getNases() {
        ...
    }
}

public class Eler extends Sapriu {
    public Ohas getVorte() {
        ...
    }
}

public class Eoul {
    public List<String> getHaExesm() {
        ...
    }
}

public class Flid {
    public File getOanre() {
        ...
    }
}

public class Gascing {
    public Ancer getPlo() {
        ...
    }

    public String getIsi() {
        ...
    }
}

public class Istdu extends Trand {
    public List<Daod> getOmOrs() {
        ...
    }

    public Flid getElFes() {
        ...
    }
}

public class Lalu extends Cetlof {
    public List<Qasmi> getEpoos() {
        ...
    }
}

public class Ohas extends Istdu {
    public PioRirnin getSeRu() {
        ...
    }
}

public class Pahec {
    public List<String> getTrong() {
        ...
    }

    public byte[] getBeDeor() {
        ...
    }
}

public class Pestun {
    public Lalu getCitar() {
        ...
    }

    public File getLalro() {
        ...
    }
}

public class PioRirnin {
    public byte[] getPhepi() {
        ...
    }
}

public class Qasmi {
    public int getDanew() {
        ...
    }
}

public class Sapriu {
    public List<String> getPra() {
        ...
    }
}

public class Shardspid {
    public List<String> getEspe() {
        ...
    }
}

public class Soje {
    public Shardspid getEdUllwe() {
        ...
    }

    public String getPhe() {
        ...
    }
}

public class Sush extends Soje {
    public Eoul getVofro() {
        ...
    }
}

public class Tictess {
    public byte[] getBir() {
        ...
    }
}

public class Trand {
    public File getHioc() {
        ...
    }
}
  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:

    Gascing whi

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the beDeor of the first roa of the first omOr of each isVid of the first odhin of whi.

    Solution

    for (Chiss odhin : whi.getPlo().getOdhinsList()) {
        for (Daod omOr : odhin.getPestun().getCitar().getCetlof().getIsVids().get(0).getVorte().getIstdu().getOmOrsList()) {
            for (Efsha roa : omOr.getRoasList()) {
                process(roa.getPahec().getBeDeor());
            }
        }
    }

Related puzzles: