當前位置: 首頁>>代碼示例>>Java>>正文


Java Edge.getProperty方法代碼示例

本文整理匯總了Java中com.tinkerpop.blueprints.Edge.getProperty方法的典型用法代碼示例。如果您正苦於以下問題:Java Edge.getProperty方法的具體用法?Java Edge.getProperty怎麽用?Java Edge.getProperty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.tinkerpop.blueprints.Edge的用法示例。


在下文中一共展示了Edge.getProperty方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: migrateContainer

import com.tinkerpop.blueprints.Edge; //導入方法依賴的package包/類
private void migrateContainer(Vertex container) {

		boolean isPublished = false;
		Iterable<Edge> edges = container.getEdges(Direction.IN, "HAS_FIELD_CONTAINER");

		// Check whether the container is published
		for (Edge edge : edges) {
			String type = edge.getProperty("edgeType");
			if ("P".equals(type)) {
				isPublished = true;
			}
		}

		// The container is not published anywhere. Remove the bogus publish webroot info which otherwise causes publish webroot conflicts with new versions.
		if (!isPublished) {
			if (container.getProperty(WEBROOT_PUB) != null) {
				log.info("Found inconsistency on container {" + container.getProperty("uuid") + "}");
				container.removeProperty(WEBROOT_PUB);
				log.info("Inconsistency fixed");
			}
		}
	}
 
開發者ID:gentics,項目名稱:mesh,代碼行數:23,代碼來源:RemoveBogusWebrootProperty.java

示例2: getDistance

import com.tinkerpop.blueprints.Edge; //導入方法依賴的package包/類
protected float getDistance(final OrientVertex node, final OrientVertex target) {
  final Iterator<Edge> edges = node.getEdges(target, paramDirection).iterator();
  if (edges.hasNext()) {
    final Edge e = edges.next();
    if (e != null && e.getLabel().equals("Frameshift") 
            && e.getProperty(paramWeightFieldName) != null 
            && ((double)e.getProperty(paramWeightFieldName) <=  paramWeightLimit)) {
 
      final Object fieldValue = e.getProperty(paramWeightFieldName);
      if (fieldValue != null) {
        if (fieldValue instanceof Float) {
          return (Float) fieldValue;
        } else if (fieldValue instanceof Number) {
          return ((Number) fieldValue).floatValue();
        }
      }
    }
    return Float.MAX_VALUE;
  }
  return Float.MAX_VALUE;
}
 
開發者ID:jrosocha,項目名稱:jarvisCli,代碼行數:22,代碼來源:OSQLFunctionDijkstraWithWeightMax.java

示例3: getStationBuyCommodities

import com.tinkerpop.blueprints.Edge; //導入方法依賴的package包/類
public Map<String, Commodity> getStationBuyCommodities(Vertex stationVertex, Ship ship) {
    Map<String, Commodity> stationBuyCommodities = new HashMap<>();
    for (Edge exchange: stationVertex.getEdges(Direction.OUT, "Exchange")) {            

        int sellPrice = exchange.getProperty("sellPrice");
        int buyPrice = exchange.getProperty("buyPrice");
        int supply = exchange.getProperty("supply");
        int demand = exchange.getProperty("demand");
                   
        if (buyPrice > 0 && supply >= ship.getCargoSpace() && (buyPrice * ship.getCargoSpace()) <= ship.getCash()) {
            Vertex commodityVertex = exchange.getVertex(Direction.IN);
            Commodity commodity = new Commodity(commodityVertex.getProperty("name"), buyPrice, supply, sellPrice, demand);
            commodity.setGroup(commodityService.getCommodityGroup(commodity.getName()));
            stationBuyCommodities.put(commodity.getName(), commodity);
        }
    }
    return stationBuyCommodities;
}
 
開發者ID:jrosocha,項目名稱:jarvisCli,代碼行數:19,代碼來源:StationService.java

示例4: getReleventStationSellCommodities

import com.tinkerpop.blueprints.Edge; //導入方法依賴的package包/類
public Map<String, Commodity> getReleventStationSellCommodities(Vertex stationVertex, Map<String, Commodity> buyCommodities, Ship ship) {
    Map<String, Commodity> stationSellReleventCommodities = new HashMap<>();
    for (Edge exchange: stationVertex.getEdges(Direction.OUT, "Exchange")) {            

        int sellPrice = exchange.getProperty("sellPrice");
        int buyPrice = exchange.getProperty("buyPrice");
        int supply = exchange.getProperty("supply");
        int demand = exchange.getProperty("demand");
        
        if (demand > ship.getCargoSpace() && sellPrice > 0) {
            Vertex commodityVertex = exchange.getVertex(Direction.IN);
            Commodity sellCommodity = new Commodity(commodityVertex.getProperty("name"), buyPrice, supply, sellPrice, demand);
            sellCommodity.setGroup(commodityService.getCommodityGroup(sellCommodity.getName()));
            Commodity boughtCommodity = buyCommodities.get(sellCommodity.getName());
            
            if (boughtCommodity != null && boughtCommodity.getBuyPrice() < sellCommodity.getSellPrice()) {
                stationSellReleventCommodities.put(sellCommodity.getName(), sellCommodity);
            }
        }
    }
    
    return stationSellReleventCommodities;
}
 
開發者ID:jrosocha,項目名稱:jarvisCli,代碼行數:24,代碼來源:StationService.java

示例5: getStationCommodities

import com.tinkerpop.blueprints.Edge; //導入方法依賴的package包/類
public List<Commodity> getStationCommodities(Vertex stationVertex) {
    
    List<Commodity> stationCommodities = new ArrayList<>();
    
    for (Edge exchange: stationVertex.getEdges(Direction.OUT, "Exchange")) {            

        int sellPrice = exchange.getProperty("sellPrice");
        int buyPrice = exchange.getProperty("buyPrice");
        int supply = exchange.getProperty("supply");
        int demand = exchange.getProperty("demand");
        long date = exchange.getProperty("date");
        
        if ( (demand > 0 && sellPrice > 0) || (supply > 0 && buyPrice > 0)) {
            Vertex commodityVertex = exchange.getVertex(Direction.IN);
            Commodity commodity = new Commodity(commodityVertex.getProperty("name"), buyPrice, supply, sellPrice, demand, date);
            commodity.setGroup(commodityService.getCommodityGroup(commodity.getName()));
            stationCommodities.add(commodity);
        }
    }
    
    return stationCommodities;
}
 
開發者ID:jrosocha,項目名稱:jarvisCli,代碼行數:23,代碼來源:StationService.java

示例6: getChildren

import com.tinkerpop.blueprints.Edge; //導入方法依賴的package包/類
@Override
public TransformablePage<? extends Node> getChildren(InternalActionContext ac, List<String> languageTags, String releaseUuid, ContainerType type,
		PagingParameters pagingInfo) {
	String indexName = "e." + HAS_PARENT_NODE.toLowerCase() + "_release";
	Object indexKey = DB.get().createComposedIndexKey(getId(), releaseUuid);

	GraphPermission perm = type == PUBLISHED ? READ_PUBLISHED_PERM : READ_PERM;
	return new DynamicTransformablePageImpl<NodeImpl>(ac.getUser(), indexName, indexKey, NodeImpl.class, pagingInfo, perm, (item) -> {

		// Filter out nodes which do not provide one of the specified language tags and type
		if (languageTags != null) {
			Iterator<Edge> edgeIt = item.getEdges(OUT, HAS_FIELD_CONTAINER).iterator();
			while (edgeIt.hasNext()) {
				Edge edge = edgeIt.next();
				String currentType = edge.getProperty(GraphFieldContainerEdgeImpl.EDGE_TYPE_KEY);
				if (!type.getCode().equals(currentType)) {
					continue;
				}
				String languageTag = edge.getProperty(GraphFieldContainerEdgeImpl.LANGUAGE_TAG_KEY);
				if (languageTags.contains(languageTag)) {
					return true;
				}
			}
			return false;
		}
		return true;
	}, true);
}
 
開發者ID:gentics,項目名稱:mesh,代碼行數:29,代碼來源:NodeImpl.java

示例7: writeNeatoEdges

import com.tinkerpop.blueprints.Edge; //導入方法依賴的package包/類
void writeNeatoEdges(StringBuilder buf){
    for(Edge e : g.getEdges()){
        if(RELATED_EDGE.equals(e.getLabel())){
            String from = e.getVertex(Direction.OUT).getId().toString();
            String to = e.getVertex(Direction.IN).getId().toString();
            float score = e.getProperty(Brainstormer.SCORE_PROPERTY);
            buf.append(from).append(" -- ").append(to).append(" [label=\"").append(score).append("\"];").append('\n');
        }
    }
}
 
開發者ID:pvoosten,項目名稱:explicit-semantic-analysis,代碼行數:11,代碼來源:Brainstormer.java

示例8: findSystemsWithinOneFrameshiftJumpOfDistance

import com.tinkerpop.blueprints.Edge; //導入方法依賴的package包/類
public Set<Vertex> findSystemsWithinOneFrameshiftJumpOfDistance(Vertex system, float jumpDistance) {

        Set<Vertex> systemsWithinOneJumpOfDistance = new HashSet<>();

        for (Edge edgeFrameshift : system.getEdges(com.tinkerpop.blueprints.Direction.BOTH, "Frameshift")) {
            double ly = edgeFrameshift.getProperty("ly");
            if (ly > jumpDistance) {
                // ignore any shift that is out of range
                continue;
            }

            // because we cant tell what direction the edge is from
            // system--shift--system, just try both.
            Vertex destinationSystem = null;
            destinationSystem = edgeFrameshift.getVertex(com.tinkerpop.blueprints.Direction.IN);
            if (destinationSystem == null || destinationSystem.getProperty("name").equals(system.getProperty("name"))) {
                destinationSystem = edgeFrameshift.getVertex(com.tinkerpop.blueprints.Direction.OUT);
            }

            if (destinationSystem == null) {
                continue;
            }

            systemsWithinOneJumpOfDistance.add(destinationSystem);
        }

        return systemsWithinOneJumpOfDistance;
    }
 
開發者ID:jrosocha,項目名稱:jarvisCli,代碼行數:29,代碼來源:StarSystemService.java

示例9: testBulkEdgePropertyUpdates

import com.tinkerpop.blueprints.Edge; //導入方法依賴的package包/類
@Test
public void testBulkEdgePropertyUpdates() throws Exception {
    bulkLoadGraphOfTheGods(f1);
    new HadoopPipeline(f2).E().has("label", "battled").sideEffect("{it.time = it.time+1}").submit();

    clopen();

    assertEquals(12, new GremlinPipeline(g).V().count());
    assertEquals(17, new GremlinPipeline(g).E().count());

    int counter = 0;
    for (Edge edge : g.getEdges()) {
        if (edge.getLabel().equals("battled")) {
            assertEquals(edge.getPropertyKeys().size(), 1);
            int time = edge.getProperty("time");
            assertTrue(time == 2 || time == 3 || time == 13);
            counter++;
        } else {
            assertEquals(edge.getPropertyKeys().size(), 0);
        }
    }
    assertEquals(counter, 3);
    assertEquals(3, new GremlinPipeline(g).V("name", "hercules").outE("battled").count());
    assertEquals(1, new GremlinPipeline(g).V("name", "hercules").outE("father").count());
    assertEquals(1, new GremlinPipeline(g).V("name", "hercules").outE("mother").count());
    assertEquals(3, new GremlinPipeline(g).V("name", "hercules").out("battled").count());
    assertEquals(1, new GremlinPipeline(g).V("name", "hercules").out("father").count());
    assertEquals(1, new GremlinPipeline(g).V("name", "hercules").out("mother").count());
    assertEquals(5, new GremlinPipeline(g).V("name", "hercules").out().count());
}
 
開發者ID:graben1437,項目名稱:titan0.5.4-hbase1.1.1-custom,代碼行數:31,代碼來源:TitanOutputFormatTest.java

示例10: doAssociateTextboxWithShape

import com.tinkerpop.blueprints.Edge; //導入方法依賴的package包/類
protected void doAssociateTextboxWithShape(ShapeData textBox, ShapeData other) {
	other.vertex.setProperty("label", textBox.vertex.getProperty("label"));
	other.vertex.setProperty("textRef", textBox.shapeId);
	other.vertex.setProperty("textRefWhy", "associateWithShape");
	other.hasText = true;
	other.textCenter = textBox.textCenter;
	
	// move any edges from the textbox to us
	for (Edge edge: textBox.vertex.getEdges(Direction.BOTH)) {
		
		ShapeData in = getShapeFromEdge(edge, Direction.IN);
		ShapeData out = getShapeFromEdge(edge, Direction.OUT);
		
		if (in != other && out != other) {
			
			Double x = edge.getProperty("x");
			Double y = edge.getProperty("y");
			
			if (in == textBox)
				createEdge(out, other, "reparent", x, y);
			else if (out == textBox)
				createEdge(in, other, "reparent", x, y);
			else
				throw new POIXMLException("Internal error");
		}
		
		graph.removeEdge(edge);
	}
	
	helper.onAssignText(textBox, other);
	
	// remove the textbox from the tree so others can't use it
	removeShape(textBox);
}
 
開發者ID:BBN-D,項目名稱:poi-visio-graph,代碼行數:35,代碼來源:VisioPageParser.java

示例11: sellOrientDb

import com.tinkerpop.blueprints.Edge; //導入方法依賴的package包/類
public String sellOrientDb(Station fromStation, Ship ship, int maxJumps, String commodity) {
    Date start = new Date();
    List<Map<String, Object>> tableData = new ArrayList<>();
    OrientGraph graph = null;
    try {
        graph = orientDbService.getFactory().getTx();
        
        Vertex stationVertex = graph.getVertexByKey("Station.name", fromStation.getName());
        Vertex systemVertex = stationService.getSystemVertexForStationVertex(stationVertex);
        
        Set<Vertex> systemsWithinNShipJumps = starSystemService.findSystemsWithinNFrameshiftJumpsOfDistance(graph, systemVertex, ship.getJumpDistance(), maxJumps);
        systemsWithinNShipJumps.add(systemVertex);
        
        for (Vertex destinationSystem: systemsWithinNShipJumps) {
            Set<Vertex> systemStations = starSystemService.findStationsInSystemOrientDb(destinationSystem, null);
            for (Vertex station: systemStations) {
                for (Edge exchange: station.getEdges(Direction.OUT, "Exchange")) {            

                    int sellPrice = exchange.getProperty("sellPrice");
                    int buyPrice = exchange.getProperty("buyPrice");
                    int supply = exchange.getProperty("supply");
                    int demand = exchange.getProperty("demand");
                    long date = exchange.getProperty("date");
                    
                    if (demand > ship.getCargoSpace() && sellPrice > 0) {
                        Vertex commodityVertex = exchange.getVertex(Direction.IN);
                        if (commodityVertex.getProperty("name").equals(commodity)) {
                            Commodity sellCommodity = new Commodity(commodityVertex.getProperty("name"), buyPrice, supply, sellPrice, demand);
                            Map<String, Object> row = new HashMap<>();
                            row.put("COMMODITY", sellCommodity.getName());
                            row.put("TO SYSTEM", destinationSystem.getProperty("name"));
                            row.put("TO STATION", station.getProperty("name"));
                            row.put("UNIT PRICE", sellPrice);
                            row.put("DEMAND", demand);
                            row.put("DAYS OLD", (((new Date().getTime() - date)/1000/60/60/24) * 100)/100);
                            tableData.add(row);
                        }
                    }
                }
                
            }
        }           
        graph.commit();
    } catch(Exception e) {
        if (graph != null) {
            graph.rollback();
        }
    }
        
    if (tableData.size() == 0) {
        return "No sale available in provided range";
    }
    
    tableData = tableData.parallelStream().sorted((row1,row2)->{
        int p1 = (int) row1.get("UNIT PRICE");
        int p2 = (int) row2.get("UNIT PRICE");
        return Integer.compare(p1, p2);
    }).collect(Collectors.toList());
    
    Collections.reverse(tableData);
    
    String out = OsUtils.LINE_SEPARATOR;
    out += "From System: " + fromStation.getSystem() + OsUtils.LINE_SEPARATOR;
    out += "From Station: " + fromStation.getName() + OsUtils.LINE_SEPARATOR;
    out += "Cargo Capacity: " + ship.getCargoSpace() + OsUtils.LINE_SEPARATOR;
    out += tableData.size() + " Best stations to sell " + tableData.get(0).get("COMMODITY") + " within " + maxJumps + " jump(s) @ " + ship.getJumpDistance() + " ly or less." + OsUtils.LINE_SEPARATOR;
    out += OsUtils.LINE_SEPARATOR + TableRenderer.renderMapDataAsTable(tableData, 
            ImmutableList.of("TO SYSTEM", "TO STATION", "UNIT PRICE", "DEMAND",  "DAYS OLD"));
    
    out += OsUtils.LINE_SEPARATOR + "executed in " + (new Date().getTime() - start.getTime())/1000.0 + " seconds.";
    return out;
}
 
開發者ID:jrosocha,項目名稱:jarvisCli,代碼行數:73,代碼來源:TradeService.java

示例12: buyOrientDb

import com.tinkerpop.blueprints.Edge; //導入方法依賴的package包/類
public String buyOrientDb(Station fromStation, Ship ship, int maxJumps, String commodity) {
    Date start = new Date();
    List<Map<String, Object>> tableData = new ArrayList<>();
    OrientGraph graph = null;
    try {
        graph = orientDbService.getFactory().getTx();
        
        Vertex stationVertex = graph.getVertexByKey("Station.name", fromStation.getName());
        Vertex systemVertex = stationService.getSystemVertexForStationVertex(stationVertex);
        
        Set<Vertex> systemsWithinNShipJumps = starSystemService.findSystemsWithinNFrameshiftJumpsOfDistance(graph, systemVertex, ship.getJumpDistance(), maxJumps);
        systemsWithinNShipJumps.add(systemVertex);
        
        for (Vertex destinationSystem: systemsWithinNShipJumps) {
            Set<Vertex> systemStations = starSystemService.findStationsInSystemOrientDb(destinationSystem, null);
            for (Vertex station: systemStations) {
                for (Edge exchange: station.getEdges(Direction.OUT, "Exchange")) {            

                    int sellPrice = exchange.getProperty("sellPrice");
                    int buyPrice = exchange.getProperty("buyPrice");
                    int supply = exchange.getProperty("supply");
                    int demand = exchange.getProperty("demand");
                    long date = exchange.getProperty("date");
                    
                    if (supply > ship.getCargoSpace() && buyPrice > 0) {
                        Vertex commodityVertex = exchange.getVertex(Direction.IN);
                        if (commodityVertex.getProperty("name").equals(commodity)) {
                            Commodity buyCommodity = new Commodity(commodityVertex.getProperty("name"), buyPrice, supply, sellPrice, demand);
                            Map<String, Object> row = new HashMap<>();
                            row.put("COMMODITY", buyCommodity.getName());
                            row.put("TO SYSTEM", destinationSystem.getProperty("name"));
                            row.put("TO STATION", station.getProperty("name"));
                            row.put("UNIT PRICE", buyPrice);
                            row.put("SUPPLY", supply);
                            row.put("DAYS OLD", (((new Date().getTime() - date)/1000/60/60/24) * 100)/100);
                            tableData.add(row);
                        }
                    }
                }
                
            }
        }           
        graph.commit();
    } catch(Exception e) {
        if (graph != null) {
            graph.rollback();
        }
    }
        
    if (tableData.size() == 0) {
        return "No purchase available in provided range";
    }
    
    tableData = tableData.parallelStream().sorted((row1,row2)->{
        int p1 = (int) row1.get("UNIT PRICE");
        int p2 = (int) row2.get("UNIT PRICE");
        return Integer.compare(p1, p2);
    }).collect(Collectors.toList());
    
    String out = OsUtils.LINE_SEPARATOR;
    out += "From System: " + fromStation.getSystem() + OsUtils.LINE_SEPARATOR;
    out += "From Station: " + fromStation.getName() + OsUtils.LINE_SEPARATOR;
    out += "Cargo Capacity: " + ship.getCargoSpace() + OsUtils.LINE_SEPARATOR;
    out += tableData.size() + " Best stations to buy " + tableData.get(0).get("COMMODITY") + " within " + maxJumps + " jump(s) @ " + ship.getJumpDistance() + " ly or less." + OsUtils.LINE_SEPARATOR;
    out += OsUtils.LINE_SEPARATOR + TableRenderer.renderMapDataAsTable(tableData, 
            ImmutableList.of("TO SYSTEM", "TO STATION", "UNIT PRICE", "SUPPLY", "DAYS OLD"));
    
    out += OsUtils.LINE_SEPARATOR + "executed in " + (new Date().getTime() - start.getTime())/1000.0 + " seconds.";
    return out;
}
 
開發者ID:jrosocha,項目名稱:jarvisCli,代碼行數:71,代碼來源:TradeService.java

示例13: bestBuyPriceOrientDb

import com.tinkerpop.blueprints.Edge; //導入方法依賴的package包/類
public String bestBuyPriceOrientDb(String commodityName) {
    Date start = new Date();
    
    List<Map<String, Object>> tableData = new ArrayList<>();
    
    OrientGraph graph = null;
    try {
        graph = orientDbService.getFactory().getTx();
        //starting commodity
        OrientVertex commodityVertex = (OrientVertex) graph.getVertexByKey("Commodity.name", commodityName);
        
        for (Edge hasExchange: commodityVertex.getEdges(Direction.IN, "Exchange")) {
            
            int supply = hasExchange.getProperty("supply");
            int buyPrice = hasExchange.getProperty("buyPrice");
            long date = hasExchange.getProperty("date");
            if (supply > 0 && buyPrice > 0) {
                Vertex stationVertex = hasExchange.getVertex(Direction.OUT);
                Vertex systemVertex = stationService.getSystemVertexForStationVertex(stationVertex);
                Map<String, Object> row = new HashMap<>();
                row.put("TO SYSTEM", systemVertex.getProperty("name"));
                row.put("TO STATION", stationVertex.getProperty("name"));
                row.put("UNIT PRICE", buyPrice);
                row.put("SUPPLY", supply);
                row.put("DAYS OLD", (((new Date().getTime() - date)/1000/60/60/24) * 100)/100);
                tableData.add(row);
            }
        }
        graph.commit();
    } catch (Exception e) {
        if (graph != null) {
            graph.rollback();
        }
    }
    
    if (tableData.size() == 0) {
        return "No sale available in data";
    }
    
    tableData = tableData.parallelStream().sorted((row1,row2)->{
        int p1 = (int) row1.get("UNIT PRICE");
        int p2 = (int) row2.get("UNIT PRICE");
        return Integer.compare(p1, p2);
    }).collect(Collectors.toList());       
    
    String out = OsUtils.LINE_SEPARATOR;
    out += tableData.size() + " Best stations to buy " + commodityName + OsUtils.LINE_SEPARATOR;
    out += OsUtils.LINE_SEPARATOR + TableRenderer.renderMapDataAsTable(tableData, 
            ImmutableList.of("TO SYSTEM", "TO STATION", "UNIT PRICE", "SUPPLY", "DAYS OLD"));
    out += OsUtils.LINE_SEPARATOR + "executed in " + (new Date().getTime() - start.getTime())/1000.0 + " seconds.";
    return out;
}
 
開發者ID:jrosocha,項目名稱:jarvisCli,代碼行數:53,代碼來源:TradeService.java

示例14: bestSellPriceOrientDb

import com.tinkerpop.blueprints.Edge; //導入方法依賴的package包/類
public String bestSellPriceOrientDb(String commodityName) {
    Date start = new Date();
    
    List<Map<String, Object>> tableData = new ArrayList<>();
    
    OrientGraph graph = null;
    try {
        graph = orientDbService.getFactory().getTx();
        //starting commodity
        OrientVertex commodityVertex = (OrientVertex) graph.getVertexByKey("Commodity.name", commodityName);
        
        for (Edge hasExchange: commodityVertex.getEdges(Direction.IN, "Exchange")) {
            
            int demand = hasExchange.getProperty("demand");
            int sellPrice = hasExchange.getProperty("sellPrice");
            long date = hasExchange.getProperty("date");
            if (demand > 0 && sellPrice > 0) {
                Vertex stationVertex = hasExchange.getVertex(Direction.OUT);
                Vertex systemVertex = stationService.getSystemVertexForStationVertex(stationVertex);
                Map<String, Object> row = new HashMap<>();
                row.put("TO SYSTEM", systemVertex.getProperty("name"));
                row.put("TO STATION", stationVertex.getProperty("name"));
                row.put("UNIT PRICE", sellPrice);
                row.put("DEMAND", demand);
                row.put("DAYS OLD", (((new Date().getTime() - date)/1000/60/60/24) * 100)/100);
                tableData.add(row);
            }
        }
        graph.commit();
    } catch (Exception e) {
        if (graph != null) {
            graph.rollback();
        }
    }
    
    if (tableData.size() == 0) {
        return "No sale available in data";
    }
    
    tableData = tableData.parallelStream().sorted((row1,row2)->{
        int p1 = (int) row1.get("UNIT PRICE");
        int p2 = (int) row2.get("UNIT PRICE");
        return Integer.compare(p1, p2);
    }).collect(Collectors.toList());
    
    Collections.reverse(tableData);
    
    
    String out = OsUtils.LINE_SEPARATOR;
    out += tableData.size() + " Best stations to sell " + commodityName + OsUtils.LINE_SEPARATOR;
    out += OsUtils.LINE_SEPARATOR + TableRenderer.renderMapDataAsTable(tableData, 
            ImmutableList.of("TO SYSTEM", "TO STATION", "UNIT PRICE", "DEMAND", "DAYS OLD"));
    out += OsUtils.LINE_SEPARATOR + "executed in " + (new Date().getTime() - start.getTime())/1000.0 + " seconds.";
    return out;
}
 
開發者ID:jrosocha,項目名稱:jarvisCli,代碼行數:56,代碼來源:TradeService.java

示例15: testEdgeTTLImplicitKey

import com.tinkerpop.blueprints.Edge; //導入方法依賴的package包/類
@Test
public void testEdgeTTLImplicitKey() throws Exception {
    Duration d;

    if (!features.hasCellTTL()) {
        return;
    }

    clopen(option(GraphDatabaseConfiguration.STORE_META_TTL, "edgestore"), true);

    assertEquals("$ttl", ImplicitKey.TTL.getName());

    int ttl = 24*60*60;
    EdgeLabel likes = mgmt.makeEdgeLabel("likes").make();
    EdgeLabel hasLiked = mgmt.makeEdgeLabel("hasLiked").make();
    mgmt.setTTL(likes, ttl, TimeUnit.SECONDS);
    assertEquals(ttl, mgmt.getTTL(likes).getLength(TimeUnit.SECONDS));
    assertEquals(0, mgmt.getTTL(hasLiked).getLength(TimeUnit.SECONDS));
    mgmt.commit();

    Vertex v1 = graph.addVertex(null), v2 = graph.addVertex(null);

    Edge e1 = graph.addEdge(null, v1, v2, "likes");
    Edge e2 = graph.addEdge(null, v1, v2, "hasLiked");
    graph.commit();

    // read from the edge created in this transaction
    d = e1.getProperty("$ttl");
    assertEquals(86400, d.getLength(TimeUnit.SECONDS));

    // get the edge via a vertex
    e1 = v1.getEdges(Direction.OUT, "likes").iterator().next();
    d = e1.getProperty("$ttl");
    assertEquals(86400, d.getLength(TimeUnit.SECONDS));

    // returned value of $ttl is the total time to live since commit, not remaining time
    Thread.sleep(1001);
    graph.rollback();
    e1 = v1.getEdges(Direction.OUT, "likes").iterator().next();
    d = e1.getProperty("$ttl");
    assertEquals(86400, d.getLength(TimeUnit.SECONDS));

    // no ttl on edges of this label
    d = e2.getProperty("$ttl");
    assertEquals(0, d.getLength(TimeUnit.SECONDS));
}
 
開發者ID:graben1437,項目名稱:titan0.5.4-hbase1.1.1-custom,代碼行數:47,代碼來源:TitanGraphTest.java


注:本文中的com.tinkerpop.blueprints.Edge.getProperty方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。