Class relationships: Correct Solution


Consider the follow class declarations:

public class Ciltec {
    public byte[] getGlel() {
        ...
    }

    public List<Mirdo> getEdUsos() {
        ...
    }
}

public class Gatqen {
    public List<Hioing> getStrucs() {
        ...
    }

    public List<String> getSeche() {
        ...
    }
}

public class Hioing extends Spheress {
    public String getUdpic() {
        ...
    }
}

public class Icra {
    public int getOnSu() {
        ...
    }
}

public class Isiss extends Gatqen {
    public String getHism() {
        ...
    }
}

public class Lecri {
    public List<Seshven> getCisses() {
        ...
    }

    public Isiss getPaTa() {
        ...
    }

    public List<Icra> getTidils() {
        ...
    }
}

public class Macet {
    public byte[] getTriu() {
        ...
    }
}

public class Mancil {
    public File getPri() {
        ...
    }
}

public class Mirdo extends Mancil {
    public List<String> getEngi() {
        ...
    }

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

public class Pindo {
    public List<String> getOntac() {
        ...
    }
}

public class Purme {
    public String getFli() {
        ...
    }

    public Macet getIal() {
        ...
    }
}

public class Seshven {
    public int getNoce() {
        ...
    }
}

public class Spheress {
    public Ciltec getAdBi() {
        ...
    }

    public Pindo getFenhi() {
        ...
    }

    public Purme getDeShabi() {
        ...
    }
}

public class UimDobid {
    public File getErm() {
        ...
    }

    public List<Lecri> getAsPilres() {
        ...
    }
}
  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:

    UimDobid pra

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the tecem of the first edUso of the first struc of each asPilre of pra.

    Solution

    for (Hioing struc : pra.getAsPilres().get(0).getPaTa().getGatqen().getStrucsList()) {
        for (Mirdo edUso : struc.getSpheress().getAdBi().getEdUsosList()) {
            process(edUso.getTecem());
        }
    }

Related puzzles: