Examples of PrimitiveData


Examples of com.google.template.soy.data.restricted.PrimitiveData

  @VisibleForTesting
  class SubstituteGlobalsInExprVisitor extends AbstractExprNodeVisitor<Void> {

    @Override protected void visitGlobalNode(GlobalNode node) {

      PrimitiveData value =
          (compileTimeGlobals != null) ? compileTimeGlobals.get(node.getName()) : null;

      if (value == null) {
        if (shouldAssertNoUnboundGlobals) {
          throw SoySyntaxException.createWithoutMetaInfo(
View Full Code Here

Examples of com.google.template.soy.data.restricted.PrimitiveData

    ImmutableMap.Builder<String, PrimitiveData> resultMapBuilder = ImmutableMap.builder();

    for (Map.Entry<String, ?> entry : compileTimeGlobalsMap.entrySet()) {

      Object valueObj = entry.getValue();
      PrimitiveData value;
      boolean isValidValue = true;
      try {
        SoyData value0 = SoyData.createFromExistingData(valueObj);
        if (!(value0 instanceof PrimitiveData)) {
          isValidValue = false;
View Full Code Here

Examples of org.openstreetmap.josm.data.osm.PrimitiveData

        Map<Long, Long> newRelationIds = new HashMap<>();
        for (PrimitiveData data: pasteBuffer.getAll()) {
            if (data.isIncomplete()) {
                continue;
            }
            PrimitiveData copy = data.makeCopy();
            copy.clearOsmMetadata();
            if (data instanceof NodeData) {
                newNodeIds.put(data.getUniqueId(), copy.getUniqueId());
            } else if (data instanceof WayData) {
                newWayIds.put(data.getUniqueId(), copy.getUniqueId());
            } else if (data instanceof RelationData) {
                newRelationIds.put(data.getUniqueId(), copy.getUniqueId());
            }
            bufferCopy.add(copy);
            if (pasteBuffer.getDirectlyAdded().contains(data)) {
                toSelect.add(copy);
            }
View Full Code Here

Examples of org.openstreetmap.josm.data.osm.PrimitiveData

    }

    protected void rememberIncomplete(OsmPrimitive primitive) {
        if (isAlreadyRemembered(primitive))
            return;
        PrimitiveData clone = primitive.save();
        clone.setIncomplete(true);
        mappedPrimitives.put(primitive, clone);
    }
View Full Code Here

Examples of org.openstreetmap.josm.data.osm.PrimitiveData

                // If the history has been loaded and a timestamp is known
                if (history != null && date != null) {
                    // Lookup for the primitive version at the specified timestamp
                    HistoryOsmPrimitive hp = history.getByDate(date);
                    if (hp != null) {
                        PrimitiveData data = null;

                        switch (p.getType()) {
                        case NODE:
                            data = new NodeData();
                            ((NodeData)data).setCoor(((HistoryNode)hp).getCoords());
                            break;
                        case WAY:
                            data = new WayData();
                            List<Long> nodeIds = ((HistoryWay)hp).getNodes();
                            ((WayData)data).setNodes(nodeIds);
                            // Find incomplete nodes to load at next run
                            for (Long nodeId : nodeIds) {
                                if (p.getDataSet().getPrimitiveById(nodeId, OsmPrimitiveType.NODE) == null) {
                                    Node n = new Node(nodeId);
                                    p.getDataSet().addPrimitive(n);
                                    toLoadNext.put(n, date);
                                }
                            }
                            break;
                        case RELATION:
                            data = new RelationData();
                            List<RelationMemberData> members = ((HistoryRelation)hp).getMembers();
                            ((RelationData)data).setMembers(members);
                            break;
                        default: throw new AssertionError("Unknown primitive type");
                        }

                        data.setUser(hp.getUser());
                        try {
                            data.setVisible(hp.isVisible());
                        } catch (IllegalStateException e) {
                            Main.error("Cannot change visibility for "+p+": "+e.getMessage());
                        }
                        data.setTimestamp(hp.getTimestamp());
                        data.setKeys(hp.getTags());
                        data.setOsmId(hp.getId(), (int) hp.getVersion());

                        // Load the history data
                        try {
                            p.load(data);
                            // Forget this primitive
View Full Code Here

Examples of org.openstreetmap.josm.data.osm.PrimitiveData

                OsmPrimitive osm = toPurge.get(i);
                if (makeIncompleteData_byPrimId.containsKey(osm)) {
                    // we could simply set the incomplete flag
                    // but that would not free memory in case the
                    // user clears undo/redo buffer after purge
                    PrimitiveData empty;
                    switch(osm.getType()) {
                    case NODE: empty = new NodeData(); break;
                    case WAY: empty = new WayData(); break;
                    case RELATION: empty = new RelationData(); break;
                    default: throw new AssertionError();
                    }
                    empty.setId(osm.getUniqueId());
                    empty.setIncomplete(true);
                    osm.load(empty);
                } else {
                    ds.removePrimitive(osm);
                    Conflict<?> conflict = getLayer().getConflicts().getConflictForMy(osm);
                    if (conflict != null) {
View Full Code Here

Examples of org.openstreetmap.josm.data.osm.PrimitiveData

    public void undoCommand() {
        if (ds == null)
            return;

        for (OsmPrimitive osm : toPurge) {
            PrimitiveData data = makeIncompleteData_byPrimId.get(osm);
            if (data != null) {
                if (ds.getPrimitiveById(osm) != osm)
                    throw new AssertionError(String.format("Primitive %s has been made incomplete when purging, but it cannot be found on undo.", osm));
                osm.load(data);
            } else {
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.