use of megamek.common.BattleArmor in project megameklab by MegaMek.
the class CriticalTransferHandler method exportDone.
@Override
public void exportDone(JComponent source, Transferable data, int action) {
if (data == null) {
return;
}
Mounted mounted = null;
try {
mounted = getUnit().getEquipment(Integer.parseInt((String) data.getTransferData(DataFlavor.stringFlavor)));
} catch (NumberFormatException e) {
e.printStackTrace();
} catch (UnsupportedFlavorException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
if ((source instanceof DropTargetCriticalList) && (mounted.getLocation() != Entity.LOC_NONE)) {
DropTargetCriticalList<?> list = (DropTargetCriticalList<?>) source;
int loc;
if (getUnit() instanceof BattleArmor) {
String[] split = list.getName().split(":");
loc = Integer.parseInt(split[0]);
} else {
loc = Integer.parseInt(list.getName());
if (loc == mounted.getLocation()) {
return;
}
}
int slot = list.getSelectedIndex();
int startSlot = slot;
mounted = list.getMounted();
if (mounted == null) {
return;
}
if (UnitUtil.isFixedLocationSpreadEquipment(mounted.getType())) {
return;
}
while (slot > 0) {
slot--;
CriticalSlot cs = getUnit().getCritical(loc, slot);
if ((cs != null) && (cs.getType() == CriticalSlot.TYPE_EQUIPMENT) && cs.getMount().equals(mounted)) {
startSlot = slot;
}
}
if (!(getUnit() instanceof BattleArmor)) {
for (int i = startSlot; i < (startSlot + UnitUtil.getCritsUsed(getUnit(), mounted.getType())); i++) {
getUnit().setCritical(loc, i, null);
}
}
Mounted linkedBy = mounted.getLinkedBy();
if (linkedBy != null && !(getUnit() instanceof BattleArmor)) {
UnitUtil.removeCriticals(getUnit(), linkedBy);
try {
UnitUtil.addMounted(getUnit(), linkedBy, mounted.getLocation(), linkedBy.isRearMounted());
} catch (LocationFullException e) {
UnitUtil.changeMountStatus(getUnit(), linkedBy, Entity.LOC_NONE, Entity.LOC_NONE, false);
linkedBy.setLinked(null);
mounted.setLinkedBy(null);
}
}
// UnitUtil.compactCriticals(unit);
refresh.refreshBuild();
}
}
use of megamek.common.BattleArmor in project megameklab by MegaMek.
the class MenuBarCreator method loadUnitFromFile.
private void loadUnitFromFile(File unitFile) {
try {
Entity tempEntity = new MechFileParser(unitFile).getEntity();
if (null == tempEntity) {
return;
}
if (UnitUtil.validateUnit(tempEntity).trim().length() > 0) {
JOptionPane.showMessageDialog(parentFrame, String.format("Warning:Invalid unit, it might load incorrectly!\n%1$s", UnitUtil.validateUnit(tempEntity)));
}
if (tempEntity.getEntityType() != parentFrame.getEntity().getEntityType()) {
MegaMekLabMainUI newUI = null;
if (tempEntity.hasETypeFlag(Entity.ETYPE_SMALL_CRAFT)) {
newUI = new megameklab.com.ui.Dropship.MainUI(((Aero) tempEntity).isPrimitive());
} else if ((tempEntity instanceof Aero) && !((tempEntity instanceof Jumpship) || (tempEntity instanceof FixedWingSupport))) {
newUI = new megameklab.com.ui.Aero.MainUI(((Aero) tempEntity).isPrimitive());
} else if (tempEntity instanceof BattleArmor) {
newUI = new megameklab.com.ui.BattleArmor.MainUI();
} else if (tempEntity instanceof Infantry) {
newUI = new megameklab.com.ui.Infantry.MainUI();
} else if (tempEntity instanceof Mech) {
newUI = new megameklab.com.ui.Mek.MainUI();
} else if ((tempEntity instanceof Tank) && !(tempEntity instanceof GunEmplacement)) {
newUI = new megameklab.com.ui.Vehicle.MainUI();
}
if (null == newUI) {
JOptionPane.showMessageDialog(parentFrame, "Warning: Could not create new UI, aborting unit load!");
return;
}
parentFrame.dispose();
UnitUtil.updateLoadedUnit(tempEntity);
newUI.setEntity(tempEntity);
newUI.reloadTabs();
newUI.repaint();
newUI.refreshAll();
return;
}
parentFrame.setEntity(tempEntity);
UnitUtil.updateLoadedUnit(parentFrame.getEntity());
CConfig.updateSaveFiles(unitFile.getAbsolutePath());
} catch (Exception ex) {
JOptionPane.showMessageDialog(parentFrame, String.format("Warning:Invalid unit, it might load incorrectly!\n%1$s", ex.getMessage()));
}
reload();
refresh();
parentFrame.setVisible(true);
}
use of megamek.common.BattleArmor in project megameklab by MegaMek.
the class MenuBarCreator method loadFileMenuOptions.
private void loadFileMenuOptions() {
file.removeAll();
file.setMnemonic(KeyEvent.VK_F);
JMenuItem item = new JMenuItem();
item = new JMenuItem("Reset Current Unit");
item.setMnemonic(KeyEvent.VK_R);
item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_R, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jMenuResetEntity_actionPerformed(e);
}
});
file.add(item);
JMenu unitMenu = new JMenu("Switch Unit Type");
unitMenu.setMnemonic(KeyEvent.VK_S);
Entity en = parentFrame.getEntity();
if (!(en instanceof Mech) || ((Mech) en).isPrimitive()) {
item = new JMenuItem();
item.setText("Mech");
item.setMnemonic(KeyEvent.VK_M);
item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_M, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
item.addActionListener(e -> jMenuLoadMech());
unitMenu.add(item);
}
if (!(en.isFighter() || (en.isFighter() && ((Aero) en).isPrimitive()))) {
item = new JMenuItem();
item.setText("Aero/Conv Fighter");
item.setMnemonic(KeyEvent.VK_A);
item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jMenuLoadAero();
}
});
unitMenu.add(item);
}
if (!(en instanceof SmallCraft) || ((Aero) en).isPrimitive()) {
item = new JMenuItem();
item.setText("Dropship/Small Craft");
item.setMnemonic(KeyEvent.VK_D);
item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
item.addActionListener(e -> jMenuLoadDropship());
unitMenu.add(item);
}
if (!(parentFrame.getEntity() instanceof Tank)) {
item = new JMenuItem();
item.setText("Combat Vehicle");
item.setMnemonic(KeyEvent.VK_T);
item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jMenuLoadVehicle();
}
});
unitMenu.add(item);
}
if (!(parentFrame.getEntity() instanceof BattleArmor)) {
item = new JMenuItem();
item.setText("BattleArmor");
item.setMnemonic(KeyEvent.VK_B);
item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_B, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jMenuLoadBattleArmor();
}
});
unitMenu.add(item);
}
if (!(parentFrame.getEntity() instanceof Infantry) || (parentFrame.getEntity() instanceof BattleArmor)) {
item = new JMenuItem();
item.setText("Infantry");
item.setMnemonic(KeyEvent.VK_I);
item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_I, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jMenuLoadInfantry();
}
});
unitMenu.add(item);
}
JMenu pMenu = new JMenu("Primitive/Retro");
if (!(en instanceof Mech) || !((Mech) en).isPrimitive()) {
item = new JMenuItem();
item.setText("Mech");
item.addActionListener(e -> jMenuLoadPrimitiveMech());
pMenu.add(item);
}
if (!(en.isFighter()) || !((Aero) en).isPrimitive()) {
item = new JMenuItem();
item.setText("Aero");
item.addActionListener(e -> jMenuLoadPrimitiveAero());
pMenu.add(item);
}
if (!(en.hasETypeFlag(Entity.ETYPE_SMALL_CRAFT)) || !((Aero) en).isPrimitive()) {
item = new JMenuItem();
item.setText("Dropship/Small Craft");
item.addActionListener(e -> jMenuLoadPrimitiveDropship());
pMenu.add(item);
}
unitMenu.add(pMenu);
file.add(unitMenu);
JMenu loadMenu = new JMenu("Load");
loadMenu.setMnemonic(KeyEvent.VK_L);
item = new JMenuItem();
item.setText("From Cache");
item.setMnemonic(KeyEvent.VK_C);
item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_U, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jMenuLoadEntity_actionPerformed(e);
}
});
loadMenu.add(item);
item = new JMenuItem();
item.setText("From File");
item.setMnemonic(KeyEvent.VK_F);
item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jMenuLoadEntityFromFile_actionPerformed(e);
}
});
loadMenu.add(item);
file.add(loadMenu);
item = new JMenuItem(String.format("Current Unit"));
item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
item.setMnemonic(KeyEvent.VK_C);
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jMenuPrintCurrentUnit();
}
});
file.add(UnitPrintManager.printMenu(parentFrame, item));
item = new JMenuItem();
item.setText("Save");
item.setMnemonic(KeyEvent.VK_S);
item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jMenuSaveEntity_actionPerformed(e);
}
});
file.add(item);
item = new JMenuItem();
item.setText("Save As");
item.setMnemonic(KeyEvent.VK_A);
item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jMenuSaveAsEntity_actionPerformed(e);
}
});
file.add(item);
JMenu exportMenu = new JMenu("Export");
item = new JMenuItem("to HTML");
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jMenuExportEntityHTML_actionPerformed(e);
}
});
exportMenu.add(item);
item = new JMenuItem("to Text");
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jMenuExportEntityText_actionPerformed(e);
}
});
exportMenu.add(item);
item = new JMenuItem("to Clipboard (text)");
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jMenuExportEntityClipboard_actionPerformed(e);
}
});
exportMenu.add(item);
file.add(exportMenu);
item = new JMenuItem("Configuration");
item.setMnemonic(KeyEvent.VK_C);
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jMenuConfiguration_actionPerformed(e);
}
});
file.add(item);
int fileNumber = 1;
if (CConfig.getParam(CConfig.CONFIG_SAVE_FILE_1).length() > 1) {
file.addSeparator();
item = new JMenuItem();
String newFile = CConfig.getParam(CConfig.CONFIG_SAVE_FILE_1);
if (newFile.length() > 35) {
item.setText(fileNumber + ". .." + newFile.substring(newFile.length() - 36));
} else {
item.setText(fileNumber + ". " + newFile);
}
item.setMnemonic(fileNumber);
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jMenuLoadEntityFromFile_actionPerformed(1);
}
});
file.add(item);
fileNumber++;
}
if (CConfig.getParam(CConfig.CONFIG_SAVE_FILE_2).length() > 1) {
item = new JMenuItem();
String newFile = CConfig.getParam(CConfig.CONFIG_SAVE_FILE_2);
if (newFile.length() > 35) {
item.setText(fileNumber + ". .." + newFile.substring(newFile.length() - 36));
} else {
item.setText(fileNumber + ". " + newFile);
}
item.setMnemonic(fileNumber);
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jMenuLoadEntityFromFile_actionPerformed(2);
}
});
file.add(item);
fileNumber++;
}
if (CConfig.getParam(CConfig.CONFIG_SAVE_FILE_3).length() > 1) {
item = new JMenuItem();
String newFile = CConfig.getParam(CConfig.CONFIG_SAVE_FILE_3);
if (newFile.length() > 35) {
item.setText(fileNumber + ". .." + newFile.substring(newFile.length() - 36));
} else {
item.setText(fileNumber + ". " + newFile);
}
item.setMnemonic(fileNumber);
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jMenuLoadEntityFromFile_actionPerformed(3);
}
});
file.add(item);
fileNumber++;
}
if (CConfig.getParam(CConfig.CONFIG_SAVE_FILE_4).length() > 1) {
item = new JMenuItem();
String newFile = CConfig.getParam(CConfig.CONFIG_SAVE_FILE_4);
if (newFile.length() > 35) {
item.setText(fileNumber + ". .." + newFile.substring(newFile.length() - 36));
} else {
item.setText(fileNumber + ". " + newFile);
}
item.setMnemonic(fileNumber);
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jMenuLoadEntityFromFile_actionPerformed(4);
}
});
file.add(item);
fileNumber++;
}
file.addSeparator();
item = new JMenuItem();
item.setText("Exit");
item.setMnemonic(KeyEvent.VK_X);
item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jMenuExit_actionPerformed(e);
}
});
file.add(item);
}
use of megamek.common.BattleArmor in project megameklab by MegaMek.
the class UnitPrintManager method printAllUnits.
public static boolean printAllUnits(Vector<Entity> loadedUnits, boolean singlePrint) {
Book book = new Book();
List<Infantry> infList = new ArrayList<>();
List<BattleArmor> baList = new ArrayList<>();
List<Protomech> protoList = new ArrayList<>();
List<Entity> unprintable = new ArrayList<>();
HashPrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
aset.add(MediaSizeName.NA_LETTER);
aset.add(new MediaPrintableArea(0, 0, 8.5f, 11, MediaPrintableArea.INCH));
PrinterJob masterPrintJob = PrinterJob.getPrinterJob();
if (!masterPrintJob.printDialog(aset)) {
return true;
}
PageFormat pageFormat = new PageFormat();
pageFormat = masterPrintJob.getPageFormat(null);
Paper p = pageFormat.getPaper();
p.setImageableArea(0, 0, p.getWidth(), p.getHeight());
pageFormat.setPaper(p);
Tank tank1 = null;
Tank wige1 = null;
Tank dualTurret1 = null;
for (Entity unit : loadedUnits) {
if (unit instanceof Mech) {
UnitUtil.removeOneShotAmmo(unit);
UnitUtil.expandUnitMounts((Mech) unit);
book.append(new PrintMech((Mech) unit, book.getNumberOfPages()), pageFormat);
} else if ((unit instanceof LargeSupportTank) || ((unit instanceof Tank) && (unit.getMovementMode() != EntityMovementMode.VTOL) && ((Tank) unit).isSuperHeavy())) {
book.append(new PrintLargeSupportVehicle((Tank) unit), pageFormat);
} else if (unit instanceof VTOL) {
book.append(new PrintVTOL((VTOL) unit), pageFormat);
} else if (unit.getMovementMode() == EntityMovementMode.WIGE) {
if (singlePrint) {
book.append(new PrintVehicle((Tank) unit, null), pageFormat);
} else if (null != wige1) {
book.append(new PrintVehicle(wige1, (Tank) unit), pageFormat);
wige1 = null;
} else {
wige1 = (Tank) unit;
}
} else if ((unit instanceof Tank) && ((unit.getMovementMode() == EntityMovementMode.NAVAL) || (unit.getMovementMode() == EntityMovementMode.SUBMARINE) || (unit.getMovementMode() == EntityMovementMode.HYDROFOIL))) {
unprintable.add(unit);
// book.append(new PrintNavalVehicle((Tank) unit), pageFormat);
} else if (unit instanceof Tank) {
if (!((Tank) unit).hasNoDualTurret()) {
if (singlePrint) {
book.append(new PrintDualTurretVehicle((Tank) unit, null), pageFormat);
} else if (null != dualTurret1) {
book.append(new PrintDualTurretVehicle(dualTurret1, (Tank) unit), pageFormat);
dualTurret1 = null;
} else {
dualTurret1 = (Tank) unit;
}
} else {
if (singlePrint) {
book.append(new PrintVehicle((Tank) unit, null), pageFormat);
} else if (null != tank1) {
book.append(new PrintVehicle(tank1, (Tank) unit), pageFormat);
tank1 = null;
} else {
tank1 = (Tank) unit;
}
}
} else if (unit.hasETypeFlag(Entity.ETYPE_AERO) && !unit.hasETypeFlag(Entity.ETYPE_JUMPSHIP)) {
if (unit instanceof Dropship) {
if (unit.getMovementMode() == EntityMovementMode.AERODYNE) {
book.append(new PrintAerodyne((Dropship) unit), pageFormat);
} else {
book.append(new PrintSpheroid((Dropship) unit), pageFormat);
}
} else if (unit instanceof FixedWingSupport) {
book.append(new PrintFixedWingSupport((FixedWingSupport) unit), pageFormat);
} else if (unit instanceof ConvFighter) {
book.append(new PrintConventionalFighter((ConvFighter) unit), pageFormat);
} else if (unit instanceof SmallCraft) {
if (unit.getMovementMode() == EntityMovementMode.AERODYNE) {
book.append(new PrintSmallCraftAerodyne((SmallCraft) unit), pageFormat);
} else {
book.append(new PrintSmallCraftSpheroid((SmallCraft) unit), pageFormat);
}
} else {
book.append(new PrintAero((Aero) unit), pageFormat);
}
} else if (unit instanceof BattleArmor) {
baList.add((BattleArmor) unit);
if (singlePrint || baList.size() > 4) {
book.append(new PrintBattleArmor(baList), pageFormat);
baList = new ArrayList<>();
}
} else if (unit instanceof Infantry) {
infList.add((Infantry) unit);
if (singlePrint || infList.size() > 3) {
book.append(new PrintInfantry(infList), pageFormat);
infList = new ArrayList<>();
}
} else if (unit instanceof Protomech) {
protoList.add((Protomech) unit);
if (singlePrint || protoList.size() > 4) {
book.append(new PrintProtomech(protoList), pageFormat);
protoList = new ArrayList<>();
}
} else {
// TODO: show a message dialog that lists the unprintable units
unprintable.add(unit);
}
}
if (unprintable.size() > 0) {
JOptionPane.showMessageDialog(null, "Printing is not currently supported for the following units:\n" + unprintable.stream().map(en -> en.getChassis() + " " + en.getModel()).collect(Collectors.joining("\n")));
}
if (null != wige1) {
book.append(new PrintVehicle(wige1, null), pageFormat);
}
if (null != tank1) {
book.append(new PrintVehicle(tank1, null), pageFormat);
}
if (null != dualTurret1) {
book.append(new PrintDualTurretVehicle(dualTurret1, null), pageFormat);
}
if (baList.size() > 0) {
book.append(new PrintBattleArmor(baList), pageFormat);
}
if (infList.size() > 0) {
book.append(new PrintInfantry(infList), pageFormat);
}
if (protoList.size() > 0) {
book.append(new PrintProtomech(protoList), pageFormat);
}
masterPrintJob.setPageable(book);
if (loadedUnits.size() > 1) {
masterPrintJob.setJobName(loadedUnits.get(0).getShortNameRaw() + " etc");
} else if (loadedUnits.size() > 0) {
masterPrintJob.setJobName(loadedUnits.get(0).getShortNameRaw());
}
PrintTask task = new PrintTask(masterPrintJob, aset);
task.execute();
return true;
}
use of megamek.common.BattleArmor in project megameklab by MegaMek.
the class UnitUtil method getToolTipInfo.
public static String getToolTipInfo(Entity unit, Mounted eq) {
DecimalFormatSymbols unusualSymbols = new DecimalFormatSymbols();
unusualSymbols.setDecimalSeparator('.');
unusualSymbols.setGroupingSeparator(',');
DecimalFormat myFormatter = new DecimalFormat("#,##0", unusualSymbols);
StringBuilder sb = new StringBuilder("<HTML>");
sb.append(eq.getName());
if ((eq.getType().hasFlag(MiscType.F_DETACHABLE_WEAPON_PACK) || eq.getType().hasFlag(MiscType.F_AP_MOUNT)) && (eq.getLinked() != null)) {
sb.append(" (attached " + eq.getLinked().getName() + ")");
}
if (eq.isSquadSupportWeapon()) {
sb.append(" (squad support weapon)");
}
if (eq.getType() instanceof InfantryWeapon) {
sb.append("<br>Damage/Trooper: ");
double infDamage = ((InfantryWeapon) eq.getType()).getInfantryDamage();
sb.append(infDamage);
sb.append("<br>Range Class: " + ((InfantryWeapon) eq.getType()).getInfantryRange());
} else {
sb.append("<br>Crits: ");
sb.append(eq.getType().getCriticals(unit));
sb.append("<br>Tonnage: ");
if (eq.getType() instanceof MiscType) {
sb.append(((MiscType) eq.getType()).getTonnage(unit, eq.getLocation()));
} else {
sb.append(eq.getType().getTonnage(unit));
}
if (eq.getType() instanceof WeaponType) {
sb.append("<br>Heat: ");
sb.append(((WeaponType) eq.getType()).getHeat());
}
}
sb.append("<Br>Cost: ");
double cost = eq.getType().getCost(unit, false, eq.getLocation());
sb.append(myFormatter.format(cost));
sb.append(" CBills");
if (eq.isRearMounted()) {
sb.append("<br>Rear Facing");
}
if (eq.isMechTurretMounted()) {
sb.append("<br>Turret mounted");
}
if (eq.isArmored()) {
sb.append("<br>Armored");
}
if ((unit instanceof BattleArmor) && eq.getType().hasFlag(WeaponType.F_INF_SUPPORT)) {
sb.append("<br>* Infantry support weapons must be held in an " + "Armored Glove");
} else if ((unit instanceof BattleArmor) && eq.getType().hasFlag(WeaponType.F_INFANTRY)) {
sb.append("<br>* Infantry weapons must be mounted in AP Mounts");
}
sb.append("</html>");
return sb.toString();
}
Aggregations