Package lv.odylab.evemanage.client.rpc

Examples of lv.odylab.evemanage.client.rpc.PathExpression


    @Test
    public void testBuild() {
        CalculationDto calculation = new CalculationDto();
        CalculationItemDto calculationItem1 = new CalculationItemDto();
        calculationItem1.setPathExpression(new PathExpression(new Long[]{1L, 2L, 3L}));
        CalculationItemDto calculationItem2 = new CalculationItemDto();
        calculationItem2.setPathExpression(new PathExpression(new Long[]{1L, 2L, 4L}));
        List<CalculationItemDto> calculationItems = new ArrayList<CalculationItemDto>();
        calculationItems.add(calculationItem1);
        calculationItems.add(calculationItem2);
        calculation.setItems(calculationItems);
        calculationTree.build(calculation);
View Full Code Here


    }

    @Test
    public void testCreateNode_FirstNodeMustBeIgnored() {
        CalculationItemDto calculationItem = new CalculationItemDto();
        calculationItem.setPathExpression(new PathExpression(new Long[]{1L, 2L, 3L}));
        calculationTree.createNode(calculationItem);

        Map<Long, CalculationTreeNode> nodeMap = calculationTree.getNodeMap();
        assertNull(nodeMap.get(1L));
        CalculationTreeNode node2 = nodeMap.get(2L);
View Full Code Here

    }

    @Test
    public void testCreateNode_AddingChildren() {
        CalculationItemDto calculationItem1 = new CalculationItemDto();
        calculationItem1.setPathExpression(new PathExpression(new Long[]{1L, 2L, 3L}));
        calculationTree.createNode(calculationItem1);
        CalculationItemDto calculationItem2 = new CalculationItemDto();
        calculationItem2.setPathExpression(new PathExpression(new Long[]{1L, 2L, 4L}));
        calculationTree.createNode(calculationItem2);

        Map<Long, CalculationTreeNode> nodeMap = calculationTree.getNodeMap().get(2L).getNodeMap();
        CalculationTreeNode node3 = nodeMap.get(3L);
        CalculationTreeNode node4 = nodeMap.get(4L);
View Full Code Here

    }

    @Test
    public void testCreateNode_AddingManyChildren() {
        CalculationItemDto calculationItem1 = new CalculationItemDto();
        calculationItem1.setPathExpression(new PathExpression(new Long[]{1L, 2L, 3L}));
        calculationTree.createNode(calculationItem1);
        CalculationItemDto calculationItem2 = new CalculationItemDto();
        calculationItem2.setPathExpression(new PathExpression(new Long[]{1L, 2L, 4L}));
        calculationTree.createNode(calculationItem2);
        CalculationItemDto calculationItem3 = new CalculationItemDto();
        calculationItem3.setPathExpression(new PathExpression(new Long[]{1L, 5L, 6L}));
        calculationTree.createNode(calculationItem3);
        CalculationItemDto calculationItem4 = new CalculationItemDto();
        calculationItem4.setPathExpression(new PathExpression(new Long[]{1L, 5L, 7L}));
        calculationTree.createNode(calculationItem4);

        Map<Long, CalculationTreeNode> nodeMap = calculationTree.getNodeMap().get(2L).getNodeMap();
        CalculationTreeNode node3 = nodeMap.get(3L);
        CalculationTreeNode node4 = nodeMap.get(4L);
View Full Code Here

    }

    @Test
    public void testGetNodeByPathNodes() {
        CalculationItemDto calculationItem = new CalculationItemDto();
        calculationItem.setPathExpression(new PathExpression(new Long[]{1L, 2L, 3L}));
        calculationTree.createNode(calculationItem);

        assertNotNull(calculationTree.getNodeByPathNodes(new Long[]{1L, 2L, 3L}));
    }
View Full Code Here

    }

    @Test
    public void testGetNodeByPathNodes_Many() {
        CalculationItemDto calculationItem1 = new CalculationItemDto();
        calculationItem1.setPathExpression(new PathExpression(new Long[]{1L, 2L, 3L}));
        calculationTree.createNode(calculationItem1);
        CalculationItemDto calculationItem2 = new CalculationItemDto();
        calculationItem2.setPathExpression(new PathExpression(new Long[]{1L, 2L, 4L}));
        calculationTree.createNode(calculationItem2);
        CalculationItemDto calculationItem3 = new CalculationItemDto();
        calculationItem3.setPathExpression(new PathExpression(new Long[]{1L, 5L, 6L}));
        calculationTree.createNode(calculationItem3);
        CalculationItemDto calculationItem4 = new CalculationItemDto();
        calculationItem4.setPathExpression(new PathExpression(new Long[]{1L, 5L, 7L}));
        calculationTree.createNode(calculationItem4);

        assertNotNull(calculationTree.getNodeByPathNodes(new Long[]{1L, 2L, 3L}));
        assertNotNull(calculationTree.getNodeByPathNodes(new Long[]{1L, 2L, 4L}));
        assertNotNull(calculationTree.getNodeByPathNodes(new Long[]{1L, 5L, 6L}));
View Full Code Here

        }
        return calculationPriceSetItem;
    }

    private Long calculateQuantityForCalculationItem(CalculationItemDto calculationItem) {
        PathExpression pathExpression = calculationItem.getPathExpression();
        if (pathExpression.isMaterial()) {
            return calculator.calculateMaterialAmount(calculationItem.getPerfectQuantity(), pathExpression.getMeLevel(), calculationItem.getWasteFactor());
        } else {
            return calculationItem.getPerfectQuantity();
        }
    }
View Full Code Here

            createNode(calculationItem);
        }
    }

    public void createNode(CalculationItemDto calculationItem) {
        PathExpression pathExpression = calculationItem.getPathExpression();
        Long[] pathNodes = pathExpression.getPathNodes();
        Map<Long, CalculationTreeNode> currentNodes = nodeMap;
        for (int i = 1; i < pathNodes.length - 1; i++) {
            Long pathNode = pathNodes[i];
            CalculationTreeNode node = currentNodes.get(pathNode);
            if (node == null) {
View Full Code Here

    public void changeRootNodesMePeQuantity(Integer meLevel, Integer peLevel, Long quantity) {
        for (Map.Entry<Long, CalculationTreeNode> mapEntry : nodeMap.entrySet()) {
            CalculationTreeNode node = mapEntry.getValue();
            List<CalculationItemDto> calculationItems = node.getCalculationItems();
            for (CalculationItemDto calculationItem : calculationItems) {
                PathExpression pathExpression = calculationItem.getPathExpression();
                if (pathExpression.isMaterial()) {
                    pathExpression.setMeLevel(meLevel);
                    pathExpression.setPeLevel(peLevel);
                }
                calculationItem.setParentQuantity(quantity);
            }
        }
    }
View Full Code Here

                recursivelyPopulateCalculationExpressionWithBlueprintInformation(pathNodes, calculationTreeNode, pathNodesToPathExpressionMap);
            }
        }
        for (Map.Entry<String, PathExpression> entry : pathNodesToPathExpressionMap.entrySet()) {
            String blueprintPath = entry.getKey();
            PathExpression pathExpression = entry.getValue();
            calculationExpression.getBlueprintPathToMeLevelMap().put(blueprintPath, pathExpression.getMeLevel());
            calculationExpression.getBlueprintPathToPeLevelMap().put(blueprintPath, pathExpression.getPeLevel());
        }
    }
View Full Code Here

TOP

Related Classes of lv.odylab.evemanage.client.rpc.PathExpression

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.