Example usage for java.lang Float isNaN

List of usage examples for java.lang Float isNaN

Introduction

In this page you can find the example usage for java.lang Float isNaN.

Prototype

public static boolean isNaN(float v) 

Source Link

Document

Returns true if the specified number is a Not-a-Number (NaN) value, false otherwise.

Usage

From source file:org.eclipse.birt.chart.device.svg.SVGGraphics2D.java

static String toString(float v) {
    if (Float.isNaN(v)) {
        return "0"; //$NON-NLS-1$
    }//from  w ww .  j  ava  2 s  .  c  om
    return String.valueOf(v);
}

From source file:services.object.ObjectService.java

public void insertOpcodes(Map<Integer, INetworkRemoteEvent> swgOpcodes,
        Map<Integer, INetworkRemoteEvent> objControllerOpcodes) {

    swgOpcodes.put(Opcodes.SelectCharacter, new INetworkRemoteEvent() {

        @Override/*from   w ww. java 2s. com*/
        public void handlePacket(IoSession session, IoBuffer data) throws Exception {

            data = data.order(ByteOrder.LITTLE_ENDIAN);
            data.position(0);
            SelectCharacter selectCharacter = new SelectCharacter();
            selectCharacter.deserialize(data);

            long objectId = selectCharacter.getCharacterId();
            Client client = core.getClient(session);
            if (client == null) {
                System.err.println("NULL Client");
                return;
            }

            CreatureObject creature = null;

            if (objectId != 0L && getObject(objectId) == null) {
                creature = getCreatureFromDB(objectId);
                if (creature == null) {
                    System.err.println("Cant get creature from db");
                } else {
                    if (creature.getCustomName() == null || creature.getCustomName().isEmpty()) {
                        System.err.println("Name: " + creature.getCustomName());
                        System.err.println("Player with ObjID of " + creature.getObjectID()
                                + " tried logging in but has a null/empty name!");
                        return;
                    } else {
                        //System.err.println("SelectCharacter: not in object list"); Because it wasnt added still at this point
                    }
                }

            } else {

                if (!(getObject(objectId) instanceof CreatureObject)) {
                    System.out.println("Character is not an instance of CreatureObject or is null!");
                    return;
                }

                creature = (CreatureObject) getObject(objectId);
                if (creature.getCustomName() == null || creature.getCustomName().isEmpty()) {
                    System.err.println(
                            "Creature's custom name was null/empty! Name: " + creature.getCustomName());
                }
                if (creature.getAttachment("disconnectTask") != null)
                    ((ScheduledFuture<?>) creature.getAttachment("disconnectTask")).cancel(true);
                if (creature.getClient() != null) {
                    if (!creature.getClient().getSession().isClosing()) {
                        System.err.println("Character is already disconnecting...");
                        return;
                    }
                    creature.setClient(null);
                }
            }

            creature.setIntendedTarget(0);

            creature.setLookAtTarget(0);

            PlayerObject ghost = (PlayerObject) creature.getSlottedObject("ghost");

            if (ghost == null) {
                System.err.println("The Character's Ghost is null!");
                return;
            }

            System.out.println("Character '" + creature.getCustomName() + "' now zoning...");

            ghost.clearFlagBitmask(PlayerFlags.LD);

            final CreatureObject finalCreature = creature;
            creature.viewChildren(creature, true, false, new Traverser() {
                public void process(SWGObject object) {
                    finalCreature.makeUnaware(object);
                }
            });
            creature.getAwareObjects().removeAll(creature.getAwareObjects());
            creature.setAttachment("disconnectTask", null);

            creature.setClient(client);
            Planet planet = core.terrainService.getPlanetByID(creature.getPlanetId());
            creature.setPlanet(planet);
            client.setParent(creature);

            session.setAttribute("CmdSceneReady", false);

            objectList.put(creature.getObjectID(), creature);

            creature.viewChildren(creature, true, true, (object) -> {
                objectList.put(object.getObjectID(), object);
            });

            creature.viewChildren(creature, true, true, (object) -> {
                if (object != null) {
                    if (object.getMutex() == null)
                        object.initializeBaselines();
                    object.initAfterDBLoad();
                    if (object.getParentId() != 0 && object.getContainer() == null)
                        object.setParent(getObject(object.getParentId()));
                    object.getContainerInfo(object.getTemplate());
                    //                  if(getObject(object.getObjectID()) != null)
                    //                     objectList.put(object.getObjectID(), object);
                    if (!checkIfObjectAlreadyInList(object.getObjectID()))
                        objectList.put(object.getObjectID(), object);
                } else {
                    Thread.currentThread().dumpStack();
                }
            });

            if (creature.getParentId() != 0) {
                SWGObject parent = getObject(creature.getParentId());
                if (parent == null)
                    System.out.println("parentId isn't 0 but getObject(parentId) is null in SelectCharacter");
                else if (parent.getContainer() == null)
                    System.out.println("parent.getContainer() is null in SelectCharacter");
                else if (parent.getContainer().getTemplate() == null)
                    System.out.println("parent.getContainer().getTemplate() is null in SelectCharacter");
                if (parent != null && parent.getContainer() != null
                        && parent.getContainer().getTemplate() != null)
                    System.out.println("Building: " + parent.getContainer().getTemplate());
                parent._add(creature);
            }

            Point3D position = creature.getPosition();

            if (Float.isNaN(position.x) || Float.isNaN(position.y) || Float.isNaN(position.z)) {
                creature.setPosition(new Point3D(0, 0, 0));
                position = creature.getPosition();
            }

            HeartBeatMessage heartBeat = new HeartBeatMessage();
            session.write(heartBeat.serialize());

            UnkByteFlag unkByteFlag = new UnkByteFlag();
            session.write(unkByteFlag.serialize());

            core.buffService.clearBuffs(creature);

            CmdStartScene startScene = new CmdStartScene((byte) 0, objectId, creature.getPlanet().getPath(),
                    creature.getTemplate(), position.x, position.y, position.z, core.getGalacticTime() / 1000,
                    0);
            session.write(startScene.serialize());

            ChatServerStatus chatServerStatus = new ChatServerStatus();
            client.getSession().write(chatServerStatus.serialize());

            VoiceChatStatus voiceStatus = new VoiceChatStatus();
            client.getSession().write(voiceStatus.serialize());

            ParametersMessage parameters = new ParametersMessage();
            session.write(parameters.serialize());

            ChatOnConnectAvatar chatConnect = new ChatOnConnectAvatar();
            creature.getClient().getSession().write(chatConnect.serialize());

            creature.makeAware(core.guildService.getGuildObject());
            core.chatService.loadMailHeaders(client);

            core.simulationService.handleZoneIn(client);

            creature.makeAware(creature);

            //ChatOnGetFriendsList friendsListMessage = new ChatOnGetFriendsList(ghost);
            //client.getSession().write(friendsListMessage.serialize());

            if (ghost != null) {
                //ghost.clearFlagBitmask(PlayerFlags.LD);
                String objectShortName = creature.getCustomName().toLowerCase();

                if (creature.getCustomName().contains(" ")) {
                    String[] splitName = creature.getCustomName().toLowerCase().split(" ");
                    objectShortName = splitName[0].toLowerCase();
                }

                core.chatService.playerStatusChange(objectShortName, (byte) 1);

                if (!ghost.getFriendList().isEmpty()) {

                    // Find out what friends are online/offline
                    for (String friend : ghost.getFriendList()) {
                        SWGObject friendObject = core.objectService.getObjectByFirstName(friend);

                        if (friendObject != null && friendObject.isInQuadtree()) {
                            ChatFriendsListUpdate onlineNotifyStatus = new ChatFriendsListUpdate(friend,
                                    (byte) 1);
                            client.getSession().write(onlineNotifyStatus.serialize());

                        } else {
                            ChatFriendsListUpdate onlineNotifyStatus = new ChatFriendsListUpdate(friend,
                                    (byte) 0);
                            client.getSession().write(onlineNotifyStatus.serialize());
                        }
                    }
                }

                List<Integer> joinedChannels = ghost.getJoinedChatChannels();
                for (Integer roomId : joinedChannels) {
                    ChatRoom room = core.chatService.getChatRoom(roomId);

                    if (room != null) {
                        core.chatService.joinChatRoom(objectShortName, roomId);
                    }
                    // work-around for any channels that may have been deleted, or only spawn on server startup, that were added to the joined channels
                    else {
                        ghost.removeChannel(roomId);
                    }
                }
            }

            creature.sendSystemMessage(core.getMotd(), DisplayType.Chat);

            if (creature.getGuildId() != 0) {
                Guild guild = core.guildService.getGuildById(creature.getGuildId());

                if (guild != null && guild.getMembers().containsKey(creature.getObjectID())) {
                    core.guildService.sendGuildMotd(creature, guild);
                }
            }

            if (core.getBountiesODB().contains(creature.getObjectID()))
                core.missionService.getBountyMap().put(creature.getObjectID(),
                        (BountyListItem) core.getBountiesODB().get(creature.getObjectID()));

            if (creature.getSlottedObject("datapad") != null) {
                creature.getSlottedObject("datapad").viewChildren(creature, true, false, new Traverser() {

                    @Override
                    public void process(SWGObject obj) {
                        if (obj instanceof MissionObject) {
                            MissionObject mission = (MissionObject) obj;
                            if (mission.getMissionType().equals("bounty")) {
                                ((BountyMissionObjective) mission.getObjective()).checkBountyActiveStatus(core);
                            }
                        }
                    }
                });
            }

            // New players that skip tutorial
            if (creature.getLevel() <= (short) 1) {
                core.playerService.grantLevel(creature, 5);
                TangibleObject inventory = (TangibleObject) creature.getSlottedObject("inventory");
                if (inventory != null)
                    inventory.add(core.objectService.createObject(
                            "object/tangible/npe/shared_npe_uniform_box.iff", creature.getPlanet()));
            }

            core.playerService.postZoneIn(creature);
        }

    });

}

From source file:ml.shifu.shifu.core.dtrain.dt.DTWorker.java

private float getFloatValue(String input) {
    // check here to avoid bad performance in failed NumberFormatUtils.getFloat(input, 0f)
    float floatValue = input.length() == 0 ? 0f : NumberFormatUtils.getFloat(input, 0f);
    // no idea about why NaN in input data, we should process it as missing value TODO , according to norm type
    floatValue = (Float.isNaN(floatValue) || Double.isNaN(floatValue)) ? 0f : floatValue;
    return floatValue;
}

From source file:org.eclipse.january.dataset.DatasetUtils.java

/**
 * Removes NaNs and infinities from floating point datasets.
 * All other dataset types are ignored.//  w w  w  .  j  a v a  2s . c  om
 * 
 * @param a dataset
 * @param value replacement value
 */
public static void removeNansAndInfinities(Dataset a, final Number value) {
    if (a instanceof DoubleDataset) {
        final double dvalue = DTypeUtils.toReal(value);
        final DoubleDataset set = (DoubleDataset) a;
        final IndexIterator it = set.getIterator();
        final double[] data = set.getData();
        while (it.hasNext()) {
            double x = data[it.index];
            if (Double.isNaN(x) || Double.isInfinite(x))
                data[it.index] = dvalue;
        }
    } else if (a instanceof FloatDataset) {
        final float fvalue = (float) DTypeUtils.toReal(value);
        final FloatDataset set = (FloatDataset) a;
        final IndexIterator it = set.getIterator();
        final float[] data = set.getData();
        while (it.hasNext()) {
            float x = data[it.index];
            if (Float.isNaN(x) || Float.isInfinite(x))
                data[it.index] = fvalue;
        }
    } else if (a instanceof CompoundDoubleDataset) {
        final double dvalue = DTypeUtils.toReal(value);
        final CompoundDoubleDataset set = (CompoundDoubleDataset) a;
        final int is = set.getElementsPerItem();
        final IndexIterator it = set.getIterator();
        final double[] data = set.getData();
        while (it.hasNext()) {
            for (int j = 0; j < is; j++) {
                double x = data[it.index + j];
                if (Double.isNaN(x) || Double.isInfinite(x))
                    data[it.index + j] = dvalue;
            }
        }
    } else if (a instanceof CompoundFloatDataset) {
        final float fvalue = (float) DTypeUtils.toReal(value);
        final CompoundFloatDataset set = (CompoundFloatDataset) a;
        final int is = set.getElementsPerItem();
        final IndexIterator it = set.getIterator();
        final float[] data = set.getData();
        while (it.hasNext()) {
            for (int j = 0; j < is; j++) {
                float x = data[it.index + j];
                if (Float.isNaN(x) || Float.isInfinite(x))
                    data[it.index + j] = fvalue;
            }
        }
    }
}

From source file:org.eclipse.january.dataset.DatasetUtils.java

/**
 * Make floating point datasets contain only finite values. Infinities and NaNs are replaced
 * by +/- MAX_VALUE and 0, respectively.
 * All other dataset types are ignored./*from  w w  w  .j a v a 2s. com*/
 * 
 * @param a dataset
 */
public static void makeFinite(Dataset a) {
    if (a instanceof DoubleDataset) {
        final DoubleDataset set = (DoubleDataset) a;
        final IndexIterator it = set.getIterator();
        final double[] data = set.getData();
        while (it.hasNext()) {
            final double x = data[it.index];
            if (Double.isNaN(x))
                data[it.index] = 0;
            else if (Double.isInfinite(x))
                data[it.index] = x > 0 ? Double.MAX_VALUE : -Double.MAX_VALUE;
        }
    } else if (a instanceof FloatDataset) {
        final FloatDataset set = (FloatDataset) a;
        final IndexIterator it = set.getIterator();
        final float[] data = set.getData();
        while (it.hasNext()) {
            final float x = data[it.index];
            if (Float.isNaN(x))
                data[it.index] = 0;
            else if (Float.isInfinite(x))
                data[it.index] = x > 0 ? Float.MAX_VALUE : -Float.MAX_VALUE;
        }
    } else if (a instanceof CompoundDoubleDataset) {
        final CompoundDoubleDataset set = (CompoundDoubleDataset) a;
        final int is = set.getElementsPerItem();
        final IndexIterator it = set.getIterator();
        final double[] data = set.getData();
        while (it.hasNext()) {
            for (int j = 0; j < is; j++) {
                final double x = data[it.index + j];
                if (Double.isNaN(x))
                    data[it.index + j] = 0;
                else if (Double.isInfinite(x))
                    data[it.index + j] = x > 0 ? Double.MAX_VALUE : -Double.MAX_VALUE;
            }
        }
    } else if (a instanceof CompoundFloatDataset) {
        final CompoundFloatDataset set = (CompoundFloatDataset) a;
        final int is = set.getElementsPerItem();
        final IndexIterator it = set.getIterator();
        final float[] data = set.getData();
        while (it.hasNext()) {
            for (int j = 0; j < is; j++) {
                final float x = data[it.index + j];
                if (Float.isNaN(x))
                    data[it.index + j] = 0;
                else if (Float.isInfinite(x))
                    data[it.index + j] = x > 0 ? Float.MAX_VALUE : -Float.MAX_VALUE;
            }
        }
    }
}

From source file:net.pms.util.Rational.java

/**
 * Compares this {@link Rational} by value with any class implementing
 * {@link Number}.//from   ww w  . ja va  2s .  c  o  m
 * <p>
 * This method is provided in preference to individual methods for each of
 * the six boolean comparison operators ({@literal <}, ==, {@literal >},
 * {@literal >=}, !=, {@literal <=}). The suggested idiom for performing
 * these comparisons is: {@code (x.compareTo(y)} &lt;<i>op</i>&gt;
 * {@code 0)}, where &lt;<i>op</i>&gt; is one of the six comparison
 * operators.
 * <p>
 * <b>Note:</b> {@code NaN} can't be compared by value and is considered
 * greater than anything but itself as defined for {@link Double}.
 *
 * @param number the {@link Number} to which this {@link Rational}'s value
 *            is to be compared.
 * @return A negative integer, zero, or a positive integer as this
 *         {@link Rational} is numerically less than, equal to, or greater
 *         than {@code number}.
 */
public int compareTo(@Nonnull Number number) {
    // Establish special cases
    boolean numberIsNaN;
    boolean numberIsInfinite;
    int numberSignum;
    if (number instanceof Rational) {
        numberIsNaN = Rational.isNaN((Rational) number);
        numberIsInfinite = Rational.isInfinite((Rational) number);
        numberSignum = ((Rational) number).numerator.signum();
    } else if (number instanceof Float) {
        numberIsNaN = Float.isNaN(number.floatValue());
        numberIsInfinite = Float.isInfinite(number.floatValue());
        numberSignum = (int) Math.signum(number.floatValue());
    } else if (number instanceof Double) {
        numberIsNaN = Double.isNaN(number.doubleValue());
        numberIsInfinite = Double.isInfinite(number.doubleValue());
        numberSignum = (int) Math.signum(number.doubleValue());
    } else {
        numberIsNaN = false;
        numberIsInfinite = false;
        long l = number.longValue();
        numberSignum = l == 0 ? 0 : l > 0 ? 1 : -1;
    }

    // NaN comparison is done according to the rules for Double.
    if (isNaN()) {
        return numberIsNaN ? 0 : 1;
    }
    if (numberIsNaN) {
        return -1;
    }

    if (isInfinite()) {
        if (numberIsInfinite) {
            return signum() - numberSignum;
        }
        return this.signum();
    }
    if (numberIsInfinite) {
        return -numberSignum;
    }

    // List known integer types for faster and more accurate comparison
    if (number instanceof BigInteger) {
        if (isInteger()) {
            return bigIntegerValue().compareTo((BigInteger) number);
        }
        return bigDecimalValue(2, RoundingMode.HALF_EVEN).compareTo(new BigDecimal((BigInteger) number));
    }
    if (number instanceof AtomicInteger || number instanceof AtomicLong || number instanceof Byte
            || number instanceof Integer || number instanceof Long || number instanceof Short) {
        if (isInteger()) {
            return bigIntegerValue().compareTo(BigInteger.valueOf(number.longValue()));
        }
        return bigDecimalValue(2, RoundingMode.HALF_EVEN).compareTo(new BigDecimal(number.longValue()));
    }
    if (number instanceof BigDecimal) {
        Rational other = valueOf((BigDecimal) number);
        return compareTo(other);
    }
    return bigDecimalValue().compareTo(new BigDecimal(number.doubleValue()));
}

From source file:au.org.ala.layers.intersect.Grid.java

public void mergeMissingValues(Grid sourceOfMissingValues, boolean hideMissing) {
    float[] cells = sourceOfMissingValues.getGrid();

    float[] actual = getGrid();

    int length = actual.length;

    int i;//from w w w  . j a va  2s. com
    RandomAccessFile afile = null;
    File f2 = new File(filename + ".GRI");

    try { //read of random access file can throw an exception
        if (!f2.exists()) {
            afile = new RandomAccessFile(filename + ".gri", "rw");
        } else {
            afile = new RandomAccessFile(filename + ".GRI", "rw");
        }

        byte[] b = new byte[(int) afile.length()];

        ByteBuffer bb = ByteBuffer.wrap(b);

        if (byteorderLSB) {
            bb.order(ByteOrder.LITTLE_ENDIAN);
        }

        afile.seek(0);

        if (datatype.equalsIgnoreCase("UBYTE")) {
            for (i = 0; i < length; i++) {
                if (hideMissing == Float.isNaN(cells[i])) {
                    if (nodatavalue >= 128) {
                        bb.put((byte) (nodatavalue - 256));
                    } else {
                        bb.put((byte) nodatavalue);
                    }
                } else {
                    if (actual[i] >= 128) {
                        bb.put((byte) (actual[i] - 256));
                    } else {
                        bb.put((byte) actual[i]);
                    }
                }
            }
        } else if (datatype.equalsIgnoreCase("BYTE")) {
            for (i = 0; i < length; i++) {
                bb.put((byte) actual[i]);
            }
        } else if (datatype.equalsIgnoreCase("SHORT")) {
            for (i = 0; i < length; i++) {
                if (hideMissing == Float.isNaN(cells[i])) {
                    bb.putShort((short) nodatavalue);
                } else {
                    bb.putShort((short) actual[i]);
                }
            }
        } else if (datatype.equalsIgnoreCase("INT")) {
            for (i = 0; i < length; i++) {
                if (hideMissing == Float.isNaN(cells[i])) {
                    bb.putInt((int) nodatavalue);
                } else {
                    bb.putInt((int) actual[i]);
                }
            }
        } else if (datatype.equalsIgnoreCase("LONG")) {
            for (i = 0; i < length; i++) {
                if (hideMissing == Float.isNaN(cells[i])) {
                    bb.putLong((long) nodatavalue);
                } else {
                    bb.putLong((long) actual[i]);
                }
            }
        } else if (datatype.equalsIgnoreCase("FLOAT")) {
            for (i = 0; i < length; i++) {
                if (hideMissing == Float.isNaN(cells[i])) {
                    bb.putFloat((float) nodatavalue);
                } else {
                    bb.putFloat(actual[i]);
                }
            }
        } else if (datatype.equalsIgnoreCase("DOUBLE")) {
            for (i = 0; i < length; i++) {
                if (hideMissing == Float.isNaN(cells[i])) {
                    bb.putDouble((double) nodatavalue);
                } else {
                    bb.putDouble((double) actual[i]);
                }
            }
        } else {
            // should not happen
            logger.error("unsupported grid data type: " + datatype);
        }

        afile.write(bb.array());
    } catch (Exception e) {
        logger.error("error getting grid file values", e);
    } finally {
        if (afile != null) {
            try {
                afile.close();
            } catch (Exception e) {
                logger.error(e.getMessage(), e);
            }
        }
    }
}

From source file:gdsc.smlm.ij.plugins.PeakFit.java

private FitJob createJob(int slice, int endFrame, float[] data, Rectangle bounds2, float noise) {
    FitParameters fitParams = null;/*from ww  w. jav a  2s  .c  o  m*/
    if (slice != endFrame) {
        fitParams = new FitParameters();
        fitParams.endT = endFrame;
    }

    if (maximaIdentification) {
        if (fitParams == null)
            fitParams = new FitParameters();
        fitParams.fitTask = FitTask.MAXIMA_IDENITIFICATION;
        fitParams.noise = noise;
    } else if (!Float.isNaN(noise)) {
        if (fitParams == null)
            fitParams = new FitParameters();
        fitParams.fitTask = FitTask.PSF_FITTING;
        fitParams.noise = noise;
    }

    if (fitParams != null)
        return new ParameterisedFitJob(fitParams, slice, data, bounds);
    else
        return new FitJob(slice, data, bounds);
}

From source file:com.actelion.research.table.view.JVisualization.java

private void updateBarAndPieNaNExclusion() {
    boolean excludeNaN = (mChartType == cChartTypeBars || mChartType == cChartTypePies)
            && (mChartMode != cChartModeCount && mChartMode != cChartModePercent)
            && mChartColumn != cColumnUnassigned && !mTableModel.isDescriptorColumn(mChartColumn);

    for (int i = 0; i < mDataPoints; i++) {
        if (excludeNaN && Float.isNaN(mPoint[i].record.getDouble(mChartColumn)))
            mPoint[i].exclusionFlags |= EXCLUSION_FLAG_DETAIL_GRAPH;
        else//from   w  w w.  ja  va2s.  com
            mPoint[i].exclusionFlags &= ~EXCLUSION_FLAG_DETAIL_GRAPH;
    }
}

From source file:com.actelion.research.table.view.JVisualization.java

/**
 * Based on axis column assignments and on hvIndices of VisualizationPoints
 * this method assigns all visible VisualizationPoints to boxes and to color categories
 * within these boxes. It also calculates statistical parameters of all boxes.
 * @param hvCount//from  w  w w .java 2 s . com
 */
protected void calculateBoxPlot() {
    int doubleAxis = determineBoxPlotDoubleAxis();
    calculateCategoryCounts(doubleAxis);

    Color[] colorList = mMarkerColor.getColorList();
    int focusFlagNo = getFocusFlag();
    int basicColorCount = colorList.length + 1;
    int colorCount = basicColorCount * ((focusFlagNo == -1) ? 1 : 2);

    int catCount = mCaseSeparationCategoryCount;
    for (int axis = 0; axis < mDimensions; axis++)
        if (axis != doubleAxis)
            catCount *= mCategoryVisibleCount[axis];

    BoxPlotViewInfo boxPlotInfo = new BoxPlotViewInfo(mHVCount, catCount, colorCount);
    mChartInfo = boxPlotInfo;
    boxPlotInfo.barAxis = doubleAxis;

    // create array with all visible values separated by hv and cat
    int[][] vCount = new int[mHVCount][catCount];
    for (int i = 0; i < mDataPoints; i++) {
        if (isVisibleExcludeNaN(mPoint[i])) {
            int cat = getChartCategoryIndex(mPoint[i]);
            int hv = mPoint[i].hvIndex;
            vCount[hv][cat]++;
        }
    }
    double[][][] value = new double[mHVCount][catCount][];
    for (int hv = 0; hv < mHVCount; hv++)
        for (int cat = 0; cat < catCount; cat++)
            if (vCount[hv][cat] != 0)
                value[hv][cat] = new double[vCount[hv][cat]];

    // fill in values
    vCount = new int[mHVCount][catCount];
    for (int i = 0; i < mDataPoints; i++) {
        if (isVisibleExcludeNaN(mPoint[i])) {
            int hv = mPoint[i].hvIndex;
            int cat = getChartCategoryIndex(mPoint[i]);
            float d = getValue(mPoint[i].record, boxPlotInfo.barAxis);
            boxPlotInfo.barValue[hv][cat] += d;
            value[hv][cat][vCount[hv][cat]] = d;
            vCount[hv][cat]++;
        }
    }

    boxPlotInfo.boxQ1 = new float[mHVCount][catCount];
    boxPlotInfo.median = new float[mHVCount][catCount];
    boxPlotInfo.boxQ3 = new float[mHVCount][catCount];
    boxPlotInfo.boxLAV = new float[mHVCount][catCount];
    boxPlotInfo.boxUAV = new float[mHVCount][catCount];

    // calculate statistical parameters from sorted values
    for (int hv = 0; hv < mHVCount; hv++) {
        for (int cat = 0; cat < catCount; cat++) {
            if (vCount[hv][cat] != 0) {
                Arrays.sort(value[hv][cat]);
                boxPlotInfo.boxQ1[hv][cat] = getPercentile(value[hv][cat], 0.25f);
                boxPlotInfo.median[hv][cat] = getPercentile(value[hv][cat], 0.50f);
                boxPlotInfo.boxQ3[hv][cat] = getPercentile(value[hv][cat], 0.75f);
                boxPlotInfo.barValue[hv][cat] /= vCount[hv][cat];

                // set lower and upper adjacent values
                float iqr = boxPlotInfo.boxQ3[hv][cat] - boxPlotInfo.boxQ1[hv][cat];
                float lowerLimit = boxPlotInfo.boxQ1[hv][cat] - 1.5f * iqr;
                float upperLimit = boxPlotInfo.boxQ3[hv][cat] + 1.5f * iqr;
                int i = 0;
                while (value[hv][cat][i] < lowerLimit)
                    i++;
                boxPlotInfo.boxLAV[hv][cat] = (float) value[hv][cat][i];
                i = value[hv][cat].length - 1;
                while (value[hv][cat][i] > upperLimit)
                    i--;
                boxPlotInfo.boxUAV[hv][cat] = (float) value[hv][cat][i];

                if (mChartType == cChartTypeWhiskerPlot)
                    boxPlotInfo.pointsInCategory[hv][cat] = vCount[hv][cat];
            }
        }
    }

    int pValueColumn = getPValueColumn();
    if (pValueColumn != cColumnUnassigned) {
        int categoryIndex = getCategoryIndex(pValueColumn, mPValueRefCategory);
        if (categoryIndex != -1) {
            if (mBoxplotShowFoldChange)
                boxPlotInfo.foldChange = new float[mHVCount][catCount];
            if (mBoxplotShowPValue)
                boxPlotInfo.pValue = new float[mHVCount][catCount];
            int[] individualIndex = new int[1 + mDimensions];
            for (int hv = 0; hv < mHVCount; hv++) {
                for (int cat = 0; cat < catCount; cat++) {
                    if (vCount[hv][cat] != 0) {
                        int refHV = getReferenceHV(hv, pValueColumn, categoryIndex);
                        int refCat = getReferenceCat(cat, pValueColumn, categoryIndex, individualIndex);
                        if ((refHV != hv || refCat != cat) && vCount[refHV][refCat] != 0) {
                            if (mBoxplotShowFoldChange) {
                                if (mTableModel.isLogarithmicViewMode(mAxisIndex[boxPlotInfo.barAxis]))
                                    boxPlotInfo.foldChange[hv][cat] = 3.321928094887363f
                                            * (boxPlotInfo.barValue[hv][cat]
                                                    - boxPlotInfo.barValue[refHV][refCat]); // this is the log2(fc)
                                else
                                    boxPlotInfo.foldChange[hv][cat] = boxPlotInfo.barValue[hv][cat]
                                            / boxPlotInfo.barValue[refHV][refCat];
                            }
                            if (mBoxplotShowPValue) {
                                try {
                                    boxPlotInfo.pValue[hv][cat] = (float) new TTestImpl().tTest(value[hv][cat],
                                            value[refHV][refCat]);
                                } catch (IllegalArgumentException e) {
                                    boxPlotInfo.pValue[hv][cat] = Float.NaN;
                                } catch (MathException e) {
                                    boxPlotInfo.pValue[hv][cat] = Float.NaN;
                                }
                            }
                        } else {
                            if (mBoxplotShowFoldChange)
                                boxPlotInfo.foldChange[hv][cat] = Float.NaN;
                            if (mBoxplotShowPValue)
                                boxPlotInfo.pValue[hv][cat] = Float.NaN;
                        }
                    }
                }
            }
        }
    }

    // for this chart type we need the statistical parameters, but no colored bar
    if (mChartType == cChartTypeWhiskerPlot)
        return;

    // create color list
    for (int i = 0; i < colorList.length; i++)
        boxPlotInfo.color[i] = colorList[i];
    boxPlotInfo.color[colorList.length] = VisualizationColor.cSelectedColor;
    if (focusFlagNo != -1) {
        for (int i = 0; i < colorList.length; i++)
            boxPlotInfo.color[i + basicColorCount] = VisualizationColor.grayOutColor(colorList[i]);
        boxPlotInfo.color[colorList.length + basicColorCount] = VisualizationColor
                .grayOutColor(VisualizationColor.cSelectedColor);
    }

    boxPlotInfo.outlierCount = new int[mHVCount][catCount];

    for (int i = 0; i < mDataPoints; i++) {
        if (isVisibleExcludeNaN(mPoint[i])) {
            int cat = getChartCategoryIndex(mPoint[i]);
            int hv = mPoint[i].hvIndex;
            if (boxPlotInfo.isOutsideValue(hv, cat, getValue(mPoint[i].record, boxPlotInfo.barAxis))) {
                boxPlotInfo.outlierCount[hv][cat]++;
            } else {
                int colorIndex = ((mPoint[i].record.getFlags() & CompoundRecord.cFlagMaskSelected) != 0
                        && mFocusHitlist != cFocusOnSelection) ? colorList.length : mPoint[i].colorIndex;
                if (focusFlagNo != -1 && !mPoint[i].record.isFlagSet(focusFlagNo))
                    colorIndex += basicColorCount;

                boxPlotInfo.pointsInCategory[hv][cat]++;
                boxPlotInfo.pointsInColorCategory[hv][cat][colorIndex]++;
            }
        }
    }

    int[][][] count = new int[mHVCount][catCount][colorCount];
    for (int hv = 0; hv < mHVCount; hv++)
        for (int cat = 0; cat < catCount; cat++)
            for (int color = 1; color < colorCount; color++)
                count[hv][cat][color] = count[hv][cat][color - 1]
                        + boxPlotInfo.pointsInColorCategory[hv][cat][color - 1];
    for (int i = 0; i < mDataPoints; i++) {
        if (isVisible(mPoint[i])) {
            float v = getValue(mPoint[i].record, boxPlotInfo.barAxis);
            if (Float.isNaN(v)) {
                mPoint[i].chartGroupIndex = -1;
            } else {
                int hv = mPoint[i].hvIndex;
                int cat = getChartCategoryIndex(mPoint[i]);
                if (boxPlotInfo.isOutsideValue(hv, cat, v)) {
                    mPoint[i].chartGroupIndex = -1;
                } else {
                    CompoundRecord record = mPoint[i].record;
                    int colorIndex = (record.isSelected() && mFocusHitlist != cFocusOnSelection)
                            ? colorList.length
                            : mPoint[i].colorIndex;
                    if (focusFlagNo != -1 && !record.isFlagSet(focusFlagNo))
                        colorIndex += basicColorCount;

                    mPoint[i].chartGroupIndex = count[hv][cat][colorIndex];
                    count[hv][cat][colorIndex]++;
                }
            }
        }
    }
}