Class relationships: Correct Solution


Consider the follow class declarations:

public class Adme {
    public byte[] getSiLun() {
        ...
    }
}

public class Bress extends Elist {
    public Nass getBla() {
        ...
    }
}

public class Chrusm {
    public List<Adme> getMeests() {
        ...
    }

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

public class Clecsa extends Epwest {
    public List<Qolni> getInHanons() {
        ...
    }
}

public class Colec {
    public byte[] getQaWe() {
        ...
    }
}

public class Desm {
    public Sceusi getCle() {
        ...
    }

    public Sanlal getMePruc() {
        ...
    }
}

public class Elist {
    public File getArau() {
        ...
    }
}

public class Enci {
    public String getSedbo() {
        ...
    }
}

public class Epwest {
    public Enci getNenfo() {
        ...
    }

    public List<Iawac> getEmCipbis() {
        ...
    }
}

public class FimHiuwel {
    public List<Pior> getEnPhics() {
        ...
    }

    public Glomeis getAcMedas() {
        ...
    }
}

public class Glomeis {
    public int getRaEd() {
        ...
    }
}

public class Iant {
    public int getLae() {
        ...
    }
}

public class Iawac extends Desm {
    public List<Iant> getHaces() {
        ...
    }
}

public class Nass {
    public int getApon() {
        ...
    }

    public List<Clecsa> getNins() {
        ...
    }
}

public class Pior {
    public List<String> getPafec() {
        ...
    }

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

public class Proern extends Colec {
    public List<Renve> getScrars() {
        ...
    }
}

public class Qolni {
    public File getOec() {
        ...
    }
}

public class Renve {
    public FimHiuwel getMulpa() {
        ...
    }

    public File getJel() {
        ...
    }
}

public class Sanlal extends Chrusm {
    public int getUpep() {
        ...
    }
}

public class Sceusi extends Proern {
    public String getDiaes() {
        ...
    }
}
  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:

    Bress diha

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the eaeph of the first enPhic of each scrar of the first emCipbi of the first nin of diha.

    Solution

    for (Clecsa nin : diha.getBla().getNinsList()) {
        for (Iawac emCipbi : nin.getEpwest().getEmCipbisList()) {
            for (Pior enPhic : emCipbi.getDesm().getCle().getProern().getScrars().get(0).getMulpa().getEnPhicsList()) {
                process(enPhic.getEaeph());
            }
        }
    }

Related puzzles: