priority = (Integer) child.getChild(Signal.PRIORITY);  if (priority != null) {
} else {
    public Signal fetchSignal() throws Exception {        Signal s = null;        SignalMemory mem = (SignalMemory) getChild(Item.SIGNAL_MEMORY);        if (mem != null) {            Item[] c = mem.getChildren();                        if (c != null) {                int index = 0;                int no = mem.getChildrenNumber();                Signal child = null;                String n = null;                Integer priority = null;                Integer max = new Integer(0);                    while (index < no) {                        child = (Signal) c[index];                        if (child != null) {                            n = child.getName();                                                if (n != null) {                                if (n.startsWith(Item.SIGNAL)) {                                priority = (Integer) child.getChild(Signal.PRIORITY);                                if (priority != null) {                                        if (priority.isGreaterThan(max)) {                                            max = priority;                                        s = child;                                    }                                } else {                                    throw new Exception("Could not fetch signal. The priority is null.");                                }                            }                            } else {                                        throw new Exception("Could not fetch signal. The name is null.");                        }                            } else {                            throw new Exception("Could not fetch signal. A child is null.");                    }                        index++;                }                if (s != null) {                    mem.removeChild(s.getName());                }            } else {                    throw new Exception("Could not place signal. The signal memory is null.");            }        } else {            throw new Exception("Could not place signal. The signal memory is null.");        }        return s;    }