Package javolution.util

Examples of javolution.util.FastList$Node


    for (Way way : waysById.values()) {
     
      List<WayNode> origWayNodes = way.getWayNodes();
      List<OwnNode> wayNodes = new ArrayList<OwnNode>(origWayNodes.size());
      for (WayNode origWayNode : origWayNodes) {
        Node origNode = nodesById.get(origWayNode.getNodeId());
        wayNodes.add(nodeMap.get(origNode));
      }
     
      OwnWay ownWay = new OwnWay(tagGroupForEntity(way), wayNodes);
     
View Full Code Here


        CommonEntityData entityData = new CommonEntityData(id, version, timestamp, osmuser,
                changeset, tags);
        if (type.equals(OSMUtils.nodeType())) {
            Point pt = (Point) feature.getDefaultGeometryProperty().getValue();
            entity = new Node(entityData, pt.getY(), pt.getX());

        } else {
            List<WayNode> nodes = Lists.newArrayList();
            String nodesString = (String) feature.getAttribute("nodes");
            for (String s : nodesString.split(";")) {
View Full Code Here

  /* save */

  @Test
  public void saveNode() {
    // Setup
    Node node = OsmDataBuilder.buildSampleNode();

    // Action
    entityDao.save(node);
    refresh(INDEX_NAME);

View Full Code Here

  }

  @Test
  public void saveAll() throws InterruptedException {
    // Setup
    Node node1 = OsmDataBuilder.buildSampleNode(1);
    Node node2 = OsmDataBuilder.buildSampleNode(2);

    // Action
    entityDao.saveAll(Arrays.asList(new Entity[] { node1, node2 }));
    refresh(INDEX_NAME);
View Full Code Here

public class ESNodeUTest {

  @Test
  public void buildFromNodeEntity() {
    // Setup
    Node node = mock(Node.class);
    when(node.getId()).thenReturn(1l);
    List<Tag> tags = new ArrayList<Tag>();
    tags.add(new Tag("highway", "primary"));
    when(node.getTags()).thenReturn(tags);
    when(node.getLatitude()).thenReturn(1.0);
    when(node.getLongitude()).thenReturn(2.0);

    ESNode expected = ESNode.Builder.create().id(1l).location(1.0, 2.0)
        .addTag("highway", "primary").build();

    // Action
View Full Code Here

  public static void assertNodesEquals(Collection<Node> expected, Collection<Node> actual) {
    Assert.assertEquals(expected.size(), actual.size());
    Iterator<Node> expectedNodes = expected.iterator();
    Iterator<Node> actualNodes = actual.iterator();
    while (expectedNodes.hasNext() && actualNodes.hasNext()) {
      Node expectedNode = expectedNodes.next();
      Node actualNode = actualNodes.next();
      assertEquals(expectedNode, actualNode);
    }
  }
View Full Code Here

public class OsmDataBuilder {

  public static Node buildSampleNode(long id) {
    List<Tag> tags = Arrays.asList(new Tag[] { new Tag("highway", "traffic_signals") });
    CommonEntityData entityData = new CommonEntityData(id, 0, new Date(), new OsmUser(1, "nco"), 1l, tags);
    return new Node(entityData, 1.0d, 2.0d);
  }
View Full Code Here

    Point point;
   
    geom = (PGgeometry) rs.getObject("geom");
    point = (Point) geom.getGeometry();
   
    return new Node(mapCommonEntityData(rs), point.y, point.x);
  }
View Full Code Here

    TimestampContainer timestamp;
    OsmUser user;
    long changesetId;
    double latitude;
    double longitude;
    Node node;
   
    id = Long.parseLong(reader.getAttributeValue(null, ATTRIBUTE_NAME_ID));
    version = Integer.parseInt(reader.getAttributeValue(null, ATTRIBUTE_NAME_VERSION));
    timestamp = parseTimestamp(reader.getAttributeValue(null, ATTRIBUTE_NAME_TIMESTAMP));
    changesetId = Long.parseLong(reader.getAttributeValue(null, ATTRIBUTE_NAME_CHANGESET_ID));
    user = readUser();
    changesetId = readChangesetId();
    latitude = Double.parseDouble(reader.getAttributeValue(null, ATTRIBUTE_NAME_LATITUDE));
    longitude = Double.parseDouble(reader.getAttributeValue(null, ATTRIBUTE_NAME_LONGITUDE));
   
    node = new Node(new CommonEntityData(id, version, timestamp, user, changesetId), latitude, longitude);
   
    reader.nextTag();
    while (reader.getEventType() == XMLStreamConstants.START_ELEMENT) {
      if (reader.getLocalName().equals(ELEMENT_NAME_TAG)) {
        node.getTags().add(readTag());
      } else {
        readUnknownElement();
      }
    }
   
View Full Code Here

  @Test
  public void computeBoundNoUpstreamBound() {
    SinkEntityInspector inspector = new SinkEntityInspector();
    BoundComputer bc = new BoundComputer("NewBound");
    bc.setSink(inspector);
    bc.process(new NodeContainer(new Node(new CommonEntityData(1, 1, new Date(), OsmUser.NONE, 1), 1, 1)));
    bc.process(new NodeContainer(new Node(new CommonEntityData(2, 2, new Date(), OsmUser.NONE, 1), 2, 2)));
    bc.complete();
    bc.release();

    EntityContainer ec = inspector.getProcessedEntities().iterator().next();
    Assert.assertEquals(new Bound(2, 1, 2, 1, "NewBound"), ec.getEntity());
View Full Code Here

TOP

Related Classes of javolution.util.FastList$Node

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.