Package rinde.sim.core.graph

Examples of rinde.sim.core.graph.LengthData


    }

    @Override
    public LengthData deserialize(String connection) {
      final double distance = Double.parseDouble(connection.split("\"")[1]);
      return new LengthData(distance);
    }
View Full Code Here


    final Point B = new Point(10, 0);

    final Graph<LengthData> g = new MultimapGraph<LengthData>();
    final GraphRoadModel rm = new GraphRoadModel(g, SI.KILOMETER,
        NonSI.KILOMETERS_PER_HOUR);
    g.addConnection(A, B, new LengthData(3));

    final UnitConverter conv = NonSI.KILOMETERS_PER_HOUR
        .getConverterTo(AbstractRoadModel.INTERNAL_SPEED_UNIT);

    assertEquals(conv.convert(10),
View Full Code Here

          final Point to = nodeMapping.get(toStr);
          // if (!from.equals(to)) {
          if (Point.distance(from, to) == distance) {
            graph.addConnection(from, to);
          } else {
            graph.addConnection(from, to, new LengthData(distance));
            containsDistances = true;
          }
          // }
        }
      }
View Full Code Here

  // TODO do something with maxSpeed!!
  @SuppressWarnings("unchecked")
  static <E extends ConnectionData> E mergeEdgeData(E empty, E e1, double l1,
      E e2, double l2) {
    if (empty instanceof LengthData) {
      return (E) new LengthData(l1 + l2);
    } else if (empty instanceof MultiAttributeData) {
      return (E) new MultiAttributeData(l1 + l2);
    }
    throw new IllegalArgumentException("EdgeData objects are of unknown type");
  }
View Full Code Here

TOP

Related Classes of rinde.sim.core.graph.LengthData

Copyright © 2018 www.massapicom. 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.