private boolean allWagonsLoaded()
    {
        boolean condition = true;
        java.util.List listOfWagons = getWorld().getObjects(Wagon.class);
        if(listOfWagons.size() > 0){
            for(int i = 0; i < listOfWagons.size(); i++)
            {
                Wagon x =(Wagon) listOfWagons.get(i);
                if(!x.checkLoadingState()){
                    condition = false;

                }
               
            }
                if(condition){
                   return true;
                }
                else{
                    return false;
                }
        }
        else{
            return false;
        }
    }