Examples of ICrossRoad


Examples of trafficjams.model.interfaces.ICrossRoad

    }



    private ArrayList<ICrossRoad> makeTrips(RoadMap map, IElementPosition startPosition, IElementPosition finishPosition) throws Exception {
        ICrossRoad firstCross = this.findFirstCross(startPosition);
        if (firstCross==null){
            throw new Exception("make trip exception 1");
        }

        ICrossRoad end = this.findFirstCross(startPosition);
        //ICrossRoad preend = ((Road)finishPosition.getElement()).getOtherEnd(end);
        ArrayList<ICrossRoad> retVal = null;

        //CrossRoad cr = (CrossRoad) preend;
        CrossRoad cr = (CrossRoad) end;
View Full Code Here

Examples of trafficjams.model.interfaces.ICrossRoad

    public IRoad getNextElement(IMapElement _currentElement, boolean fToL) throws Exception {

        if(_currentElement.getClass().equals(IRoad.class)){
            IRoad currentElement = (IRoad) _currentElement;
            ICrossRoad first = currentElement.getFCross();
            ICrossRoad last =  currentElement.getLCross();
            ICrossRoad nextCross = this.getNextCross(first,last);

            if (nextCross !=null){

                if (nextCross.equals(first)&&!fToL){
                    return currentElement;
                }
                if (nextCross.equals(last)&&fToL){
                    return currentElement;
                }
                if (fToL){
                    return this.findRoad(first, nextCross);
                }
                if (!fToL){
                    return this.findRoad(last,nextCross);
                }
                throw new Exception("paths errors!!") ;
            }else {
                return null;
            }
        }else {
            ICrossRoad currentElement = (ICrossRoad) _currentElement;
            ICrossRoad nextCross = this.getNextCross(currentElement);
            if (nextCross !=null){
                if(nextCross.equals(currentElement)){
                    return this.getNextElement(currentElement, fToL);
                }
                return this.findRoad(currentElement,nextCross);
            }else {
                return null;
View Full Code Here

Examples of trafficjams.model.interfaces.ICrossRoad

        return ((CrossRoad)currentElement).findRoad(nextCross);
    }

    private ICrossRoad getNextCross(ICrossRoad currentElement) {
        ListIterator<ICrossRoad> iter = trip.listIterator();
        ICrossRoad nextCross = null;
        while (iter.hasNext()){
            //nextCross = iter.next();
            if (iter.next().equals(currentElement)){
                nextCross = null;
                if (iter.hasNext()){
View Full Code Here

Examples of trafficjams.model.interfaces.ICrossRoad

        return nextCross;
    }

    public ICrossRoad getNextCross(ICrossRoad first, ICrossRoad last) {
        ListIterator<ICrossRoad> iter = trip.listIterator();
        ICrossRoad nextCross = null;
        //boolean isFinded = false;
        while (iter.hasNext()){
            nextCross = iter.next();
            if (nextCross.equals(first)||nextCross.equals(last)){
                nextCross = null;
                if (iter.hasNext()){
                    nextCross = iter.next();
                }
                iter.previous();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.