Class relationships: Correct Solution


Consider the follow class declarations:

public class Antlorm {
    public File getSaEsm() {
        ...
    }
}

public class Boroct extends Udmac {
    public Eang getCruas() {
        ...
    }

    public Liol getNen() {
        ...
    }
}

public class Buiap {
    public String getPhus() {
        ...
    }
}

public class Eang {
    public List<Sicril> getStis() {
        ...
    }

    public List<Ocris> getPaFleffs() {
        ...
    }
}

public class Eblar {
    public List<Phosa> getDewres() {
        ...
    }

    public Rasm getCasm() {
        ...
    }
}

public class Glest extends OngElphi {
    public Tifot getXadas() {
        ...
    }
}

public class Hisswrint extends Boroct {
    public Buiap getCeauc() {
        ...
    }
}

public class Kusmi {
    public String getOpist() {
        ...
    }

    public File getKiIro() {
        ...
    }
}

public class Liol {
    public File getInSpil() {
        ...
    }
}

public class Ocris extends Antlorm {
    public int getIje() {
        ...
    }
}

public class OngElphi {
    public List<Kusmi> getNurs() {
        ...
    }

    public String getZihos() {
        ...
    }
}

public class OumTeprol {
    public byte[] getNaast() {
        ...
    }
}

public class Phosa {
    public byte[] getPirch() {
        ...
    }
}

public class Psard {
    public String getTaPha() {
        ...
    }

    public List<Eblar> getIdRhis() {
        ...
    }
}

public class Rasm extends Hisswrint {
    public List<String> getZiHenme() {
        ...
    }
}

public class Sicril extends OumTeprol {
    public Glest getAso() {
        ...
    }
}

public class Tifot {
    public byte[] getEfa() {
        ...
    }
}

public class Udmac {
    public byte[] getEtGlocs() {
        ...
    }
}
  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:

    Psard ogiw

    ...and the following method:

    public void process(File item)

    ...write code to process the kiIro of the first nur of the first sti of the first idRhi of ogiw.

    Solution

    for (Eblar idRhi : ogiw.getIdRhisList()) {
        for (Sicril sti : idRhi.getCasm().getHisswrint().getBoroct().getCruas().getStisList()) {
            for (Kusmi nur : sti.getAso().getOngElphi().getNursList()) {
                process(nur.getKiIro());
            }
        }
    }

Related puzzles: