public void distributeJobs() { for (int i = 0; i < EMaterialType.NUMBER_OF_DROPPABLE_MATERIALS && !joblessSupplier.isEmpty(); i++) { if (joblessSupplier.isEmpty()) // no jobless? just return break; distributeJobForMaterial(settings.getMaterialTypeForPriority(i)); } }
private void updatePositions() { IPartitionData data = getPartitonData(); if (data == null) { setOrder(null); removeAll(); } else { EMaterialType[] newOrder = new EMaterialType[EMaterialType.DROPPABLE_MATERIALS.length]; BitSet materialsAccepted = new BitSet(); for (int i = 0; i < newOrder.length; i++) { // FIXME: Synchronize! newOrder[i] = data.getPartitionSettings().getMaterialTypeForPriority(i); } IStockSettings stockSettings = data.getPartitionSettings().getStockSettings(); for (EMaterialType materialType : EMaterialType.DROPPABLE_MATERIALS) { materialsAccepted.set(materialType.ordinal, stockSettings.isAccepted(materialType)); } setOrder(newOrder); for (EMaterialType material : newOrder) { SelectionManagedMaterialButton button = buttons[material.ordinal]; AnimatablePosition position = positions[material.ordinal]; button.setDotColor(getColor(materialsAccepted, button)); removeChild(button); addChild(button, position.getX(), position.getY(), position.getX() + BUTTON_WIDTH, position.getY() + BUTTON_HEIGHT); } } }