private void addUnassigned(Client client)
{
for (Security security : client.getSecurities())
{
Assignment assignment = new Assignment(security);
assignment.setWeight(0);
investmentVehicle2weight.put(security, assignment);
}
for (Account account : client.getAccounts())
{
Assignment assignment = new Assignment(account);
assignment.setWeight(0);
investmentVehicle2weight.put(account, assignment);
}
visitAll(new NodeVisitor()
{
@Override
public void visit(TaxonomyNode node)
{
if (!(node instanceof AssignmentNode))
return;
Assignment assignment = node.getAssignment();
Assignment count = investmentVehicle2weight.get(assignment.getInvestmentVehicle());
count.setWeight(count.getWeight() + assignment.getWeight());
}
});
List<Assignment> unassigned = new ArrayList<Assignment>();
for (Assignment assignment : investmentVehicle2weight.values())
{
if (assignment.getWeight() >= Classification.ONE_HUNDRED_PERCENT)
continue;
Assignment a = new Assignment(assignment.getInvestmentVehicle());
a.setWeight(Classification.ONE_HUNDRED_PERCENT - assignment.getWeight());
unassigned.add(a);
assignment.setWeight(Classification.ONE_HUNDRED_PERCENT);
}