public Box toBox(Argument argument, Vector<Box> boxArgs, long settings, ColourScheme colourScheme) {
switch (boxArgs.size()) {
case 0:
case 1:
{
Box sum1 = new BoxWord(argument, Symbol.Sigma.toUnicode(),
Box.X_CENTRE_ALIGN|Box.Y_CENTRE_ALIGN|Box.LARGE_FONT|Box.PLAIN_FONT);
Box arg1 = boxArgs.firstElement();
arg1.setProperty(Box.LEFT_ALIGN|Box.Y_CENTRE_ALIGN);
BoxList list1 = new BoxList(argument, Box.X_CENTRE_ALIGN|Box.Y_CENTRE_ALIGN);
list1.nextHorizontalPath(new Box[]{sum1, arg1});
list1.nextVerticalPath(new Box[]{sum1});
list1.nextVerticalPath(new Box[]{arg1});
return list1;
}
case 2:
{
Box sum2 = new BoxWord(argument,
Symbol.Sigma.toUnicode(),
Box.X_CENTRE_ALIGN|Box.Y_CENTRE_ALIGN|Box.LARGE_FONT|Box.PLAIN_FONT);
Box arg2 = boxArgs.get(1);
Box from2 = boxArgs.get(0);
BoxList list2 = new BoxList(argument, Box.X_CENTRE_ALIGN|Box.Y_CENTRE_ALIGN);
list2.nextHorizontalPath(new Box[]{sum2, arg2});
list2.nextHorizontalPath(new Box[]{from2});
list2.nextVerticalPath(new Box[]{sum2, from2});
list2.nextVerticalPath(new Box[]{arg2});
arg2.setProperty(Box.LEFT_ALIGN|Box.Y_CENTRE_ALIGN);
from2.setProperty(Box.X_CENTRE_ALIGN|Box.TOP_ALIGN|Box.SMALL_FONT);
return list2;
}
default:
{
Box sumDefault = new BoxWord(argument,
Symbol.Sigma.toUnicode(),
Box.X_CENTRE_ALIGN|Box.Y_CENTRE_ALIGN|Box.LARGE_FONT|Box.PLAIN_FONT);
Box arg = boxArgs.get(2);
arg.setProperty(Box.LEFT_ALIGN|Box.Y_CENTRE_ALIGN);
Box from = boxArgs.get(0);
Box to = boxArgs.get(1);
BoxList list = new BoxList(argument, Box.X_CENTRE_ALIGN|Box.Y_CENTRE_ALIGN);
list.nextHorizontalPath(new Box[]{to});
list.nextHorizontalPath(new Box[]{sumDefault, arg});
list.nextHorizontalPath(new Box[]{from});
list.nextVerticalPath(new Box[]{to, sumDefault, from});
list.nextVerticalPath(new Box[]{arg});
from.setProperty(Box.X_CENTRE_ALIGN|Box.TOP_ALIGN|Box.SMALL_FONT);
to.setProperty(Box.X_CENTRE_ALIGN|Box.BOTTOM_ALIGN|Box.SMALL_FONT);
return list;
}
}
}