Package name.abuchen.portfolio.model

Examples of name.abuchen.portfolio.model.Classification


    @Test
    public void testThat100PercentAssignmentIsIdenticalToClientPerformance()
    {
        Client client = createClient(Classification.ONE_HUNDRED_PERCENT);

        Classification classification = client.getTaxonomies().get(0).getClassificationById("one");

        ArrayList<Exception> warnings = new ArrayList<Exception>();

        PerformanceIndex iClient = PerformanceIndex.forClient(client, period, warnings);
        PerformanceIndex iClassification = PerformanceIndex.forClassification(client, classification, period, warnings);
View Full Code Here


    @Test
    public void testThatPartialAssignmentIsNOTIdenticalToClientPerformance()
    {
        Client client = createClient(Classification.ONE_HUNDRED_PERCENT);

        Classification classification = client.getTaxonomies().get(0).getClassificationById("one");

        // remove account assignment
        classification.getAssignments().remove(1);

        ArrayList<Exception> warnings = new ArrayList<Exception>();

        PerformanceIndex iClient = PerformanceIndex.forClient(client, period, warnings);
        PerformanceIndex iClassification = PerformanceIndex.forClassification(client, classification, period, warnings);
View Full Code Here

    @Test
    public void testThat50PercentAssignmentHasIdenticalPerformanceButOnly50PercentTotals()
    {
        Client client = createClient(Classification.ONE_HUNDRED_PERCENT / 2);

        Classification classification = client.getTaxonomies().get(0).getClassificationById("one");

        ArrayList<Exception> warnings = new ArrayList<Exception>();

        PerformanceIndex iClient = PerformanceIndex.forClient(client, period, warnings);
        PerformanceIndex iClassification = PerformanceIndex.forClassification(client, classification, period, warnings);
View Full Code Here

            buf.append(label);

            if (instance instanceof Classification)
            {
                Classification parent = ((Classification) instance).getParent();
                buf.append(" (").append(parent.getPathName(true)).append(")"); //$NON-NLS-1$ //$NON-NLS-2$
            }

            if (isBenchmark())
                buf.append(Messages.ChartSeriesBenchmarkSuffix);
View Full Code Here

        }
    }

    private void doAddClassification(TaxonomyNode parent)
    {
        Classification newClassification = new Classification(null, UUID.randomUUID().toString(),
                        Messages.LabelNewClassification);

        TaxonomyNode newNode = parent.addChild(newClassification);

        nodeViewer.setExpandedState(parent, true);
View Full Code Here

    /* package */TaxonomyModel(Client client, Taxonomy taxonomy)
    {
        this.taxonomy = taxonomy;
        this.snapshot = ClientSnapshot.create(client, Dates.today());

        Classification root = taxonomy.getRoot();
        rootNode = new ClassificationNode(null, root);

        LinkedList<TaxonomyNode> stack = new LinkedList<TaxonomyNode>();
        stack.add(rootNode);

        while (!stack.isEmpty())
        {
            TaxonomyNode m = stack.pop();

            Classification classification = m.getClassification();

            for (Classification c : classification.getChildren())
            {
                TaxonomyNode cm = new ClassificationNode(m, c);
                stack.push(cm);
                m.getChildren().add(cm);
            }

            for (Assignment assignment : classification.getAssignments())
                m.getChildren().add(new AssignmentNode(m, assignment));

            Collections.sort(m.getChildren(), new Comparator<TaxonomyNode>()
            {
                @Override
                public int compare(TaxonomyNode o1, TaxonomyNode o2)
                {
                    return o1.getRank() > o2.getRank() ? 1 : o1.getRank() == o2.getRank() ? 0 : -1;
                }
            });
        }

        unassignedNode = new UnassignedContainerNode(rootNode, new Classification(root, Classification.UNASSIGNED_ID,
                        Messages.LabelWithoutClassification));
        rootNode.getChildren().add(unassignedNode);

        // add unassigned
        addUnassigned(client);
View Full Code Here

        return this;
    }

    public AccountBuilder assign(Taxonomy taxonomy, String id, int weight)
    {
        Classification classification = taxonomy.getClassificationById(id);
        classification.addAssignment(new Assignment(account, weight));
        return this;
    }
View Full Code Here

    }

    public static PerformanceIndex forAccount(Client client, Account account, ReportingPeriod reportInterval,
                    List<Exception> warnings)
    {
        Classification classification = new Classification(null, null);
        classification.addAssignment(new Assignment(account));
        return forClassification(client, classification, reportInterval, warnings);
    }
View Full Code Here

    }

    public static PerformanceIndex forInvestment(Client client, Security security, ReportingPeriod reportInterval,
                    List<Exception> warnings)
    {
        Classification classification = new Classification(null, null);
        classification.addAssignment(new Assignment(security));
        return forClassification(client, classification, reportInterval, warnings);
    }
View Full Code Here

            return null;
    }

    /* package */TaxonomyNode addChild(Classification newClassification)
    {
        Classification classification = getClassification();
        if (classification == null)
            return null;

        newClassification.setWeight(Classification.ONE_HUNDRED_PERCENT - classification.getChildrenWeight());
        newClassification.setParent(classification);
        classification.addChild(newClassification);

        TaxonomyNode newChild = new ClassificationNode(this, newClassification);

        int insertAt = isRoot() ? children.size() - 1 : children.size();
        children.add(insertAt, newChild);
View Full Code Here

TOP

Related Classes of name.abuchen.portfolio.model.Classification

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.