Ejemplo n.º 1
0
 /**
  * Connects the node to another one
  *
  * @param location An other node
  * @param section The section between the two nodes
  * @return The newly created section or null if the nodes doesn't belong to the same graph
  */
 public Section connectTo(Location location, Section section) {
   if (location.getMap() != null && location.getMap().equals(mMap)) {
     section.setOrigin(this);
     mOuts.add(section);
     location.connectedFrom(section);
     return section;
   }
   return null;
 }
Ejemplo n.º 2
0
 /**
  * Connects the node to another one
  *
  * @param location An other node
  * @param streetName The name of the street between the two nodes
  * @param speed The speed in the street
  * @param length The length of the street
  * @return The newly created section or null if the nodes doesn't belong to the same graph
  */
 public Section connectTo(Location location, String streetName, double speed, double length) {
   if (location.getMap() != null && location.getMap().equals(mMap)) {
     Section section;
     if (streetName != null) {
       section = new Section(streetName, speed, length);
     } else {
       section = new Section();
     }
     section.setOrigin(this);
     mOuts.add(section);
     location.connectedFrom(section);
     return section;
   }
   return null;
 }