Example usage for java.lang Double MIN_VALUE

List of usage examples for java.lang Double MIN_VALUE

Introduction

In this page you can find the example usage for java.lang Double MIN_VALUE.

Prototype

double MIN_VALUE

To view the source code for java.lang Double MIN_VALUE.

Click Source Link

Document

A constant holding the smallest positive nonzero value of type double , 2-1074.

Usage

From source file:sbu.srl.rolextract.ArgumentClassifier.java

public void performedFeatureAddition(String outputDir, int crossValidation)
        throws FileNotFoundException, IOException, ClassNotFoundException, NoSuchMethodException,
        IllegalAccessException, IllegalArgumentException, InvocationTargetException, InterruptedException {
    List<String> ablationFeatures = getAblationFeatures("./configSBUProcRel/features.ablation");
    ArrayList<String> stepwiseFeatures = new ArrayList<String>();
    for (int idxAblation = 0; idxAblation < ablationFeatures.size(); idxAblation++) {
        double maxF1 = Double.MIN_VALUE;
        ArrayList<String> currentBestFeat = new ArrayList<String>();
        String[] metricsBest = null;
        for (int idxFeat = 0; idxFeat < ablationFeatures.size(); idxFeat++) {
            Thread.sleep(3000);//from  ww w .j  a  va 2s .  c  om
            ArrayList<String> addedFeatures = new ArrayList<String>();
            addedFeatures.addAll(Arrays.asList(ablationFeatures.get(idxFeat).split(",")));
            //(ArrayList<String>) Arrays.asList(ablationFeatures.get(idxAblation).split(","));
            boolean triedFeatures = false;

            for (int i = 0; i < addedFeatures.size(); i++) {
                if (stepwiseFeatures.contains(addedFeatures.get(i))) {
                    triedFeatures = true;
                }
            }
            if (triedFeatures) {
                continue;
            }
            System.out.println("Adding features : " + ablationFeatures.get(idxFeat));
            stepwiseFeatures.addAll(addedFeatures);
            FileUtil.dumpToFile(stepwiseFeatures, "./configSBUProcRel/features");

            for (int idxFold = 1; idxFold <= crossValidation; idxFold++) {
                File trainFoldDir = new File(outputDir.concat("/fold-").concat("" + idxFold).concat("/train"));
                File testFoldDir = new File(outputDir.concat("/fold-").concat("" + idxFold).concat("/test"));
                SBURoleTrain trainer = new SBURoleTrain(trainFoldDir.getAbsolutePath().concat("/train.ser"),
                        isMultiClass);
                trainer.train(trainFoldDir.getAbsolutePath());

                SBURolePredict predict = new SBURolePredict(trainFoldDir.getAbsolutePath(),
                        testFoldDir.getAbsolutePath().concat("/test.arggold.ser"), isMultiClass);
                predict.performPrediction(testFoldDir.getAbsolutePath().concat("/test.arggold.ser"));

                ArrayList<Sentence> predictedSentences = (ArrayList<Sentence>) FileUtil
                        .deserializeFromFile(testFoldDir.getAbsolutePath().concat("/test.argpredict.ser"));
                Map<String, List<Sentence>> groupByProcess = predictedSentences.stream()
                        .collect(Collectors.groupingBy(Sentence::getProcessName));

                ArrayList<JSONData> jsonData = SentenceUtil.generateJSONData(groupByProcess);
                SentenceUtil.flushDataToJSON(jsonData,
                        testFoldDir.getAbsolutePath().concat("/test.srlout.json"), false);
                SentenceUtil.flushDataToJSON(jsonData,
                        testFoldDir.getAbsolutePath().concat("/test.srlpredict.json"), true);
                SentenceUtil.flushDataToJSON(jsonData,
                        testFoldDir.getAbsolutePath().concat("/test.ilppredict.json"), true); // dummy
                SentenceUtil.flushDataToJSON(jsonData,
                        testFoldDir.getAbsolutePath().concat("/test.semaforpredict.json"), true);// dummy
                SentenceUtil.flushDataToJSON(jsonData,
                        testFoldDir.getAbsolutePath().concat("/test.easysrlpredict.json"), true);// dummy
                SentenceUtil.flushDataToJSON(jsonData,
                        testFoldDir.getAbsolutePath().concat("/test.fgpredict.json"), true);// dummy

            }
            // copy all data to ILP's data folder
            // cp -r outputDir /home/slouvan/NetBeansProjects/ILP/data/
            copyAndEval(outputDir);
            String[] lines = FileUtil.readLinesFromFile("/home/slouvan/NetBeansProjects/ILP/stats.txt");
            double currentF1 = Double.parseDouble(lines[0].split("\t")[2]);
            if (currentF1 > maxF1) {
                maxF1 = currentF1;
                currentBestFeat = addedFeatures;
                metricsBest = lines;
            }

            stepwiseFeatures.removeAll(addedFeatures);
        }
        PrintWriter out = new PrintWriter(
                new BufferedWriter(new FileWriter(GlobalV.PROJECT_DIR + "/additionNew.txt", true)));
        out.println((new Date()).toString() + " Best features at this stage is  " + currentBestFeat);
        out.println("Eval : " + Arrays.toString(metricsBest));
        stepwiseFeatures.addAll(currentBestFeat);
        out.println("All current features :" + stepwiseFeatures);
        out.close();
    }
}

From source file:org.opentox.jaqpot3.qsar.util.WekaInstancesProcess.java

private static double attributeMaxValue(Instances dataInst, int attributeIndex) {
    double maxVal = Double.MIN_VALUE;
    double currentValue = maxVal;
    int nInst = dataInst.numInstances();
    for (int i = 0; i < nInst; i++) {
        currentValue = dataInst.instance(i).value(attributeIndex);
        if (currentValue > maxVal) {
            maxVal = currentValue;/*w w  w.  j  a  v  a 2 s.  c  o  m*/
        }
    }
    return maxVal;
}

From source file:org.tinymediamanager.ui.dialogs.ImageChooserDialog.java

@SuppressWarnings({ "unchecked", "rawtypes" })
private void addImage(BufferedImage originalImage, final MediaArtwork artwork) {
    Point size = null;//  ww w.jav  a2  s  . co  m

    GridBagLayout gbl = new GridBagLayout();

    switch (type) {
    case FANART:
    case CLEARART:
    case THUMB:
    case DISC:
        gbl.columnWidths = new int[] { 130 };
        gbl.rowHeights = new int[] { 180 };
        size = ImageCache.calculateSize(300, 150, originalImage.getWidth(), originalImage.getHeight(), true);
        break;

    case BANNER:
    case LOGO:
    case CLEARLOGO:
        gbl.columnWidths = new int[] { 130 };
        gbl.rowHeights = new int[] { 120 };
        size = ImageCache.calculateSize(300, 100, originalImage.getWidth(), originalImage.getHeight(), true);
        break;

    case POSTER:
    default:
        gbl.columnWidths = new int[] { 180 };
        gbl.rowHeights = new int[] { 270 };
        size = ImageCache.calculateSize(150, 250, originalImage.getWidth(), originalImage.getHeight(), true);
        break;

    }

    gbl.columnWeights = new double[] { Double.MIN_VALUE };
    gbl.rowWeights = new double[] { Double.MIN_VALUE };
    JPanel imagePanel = new JPanel();
    imagePanel.setLayout(gbl);

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.BOTH;
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.gridwidth = 3;
    gbc.insets = new Insets(5, 5, 5, 5);

    JToggleButton button = new JToggleButton();
    button.setBackground(Color.white);
    button.setUI(toggleButtonUI);
    button.setMargin(new Insets(10, 10, 10, 10));
    ImageIcon imageIcon = new ImageIcon(Scalr.resize(originalImage, Scalr.Method.BALANCED, Scalr.Mode.AUTOMATIC,
            size.x, size.y, Scalr.OP_ANTIALIAS));
    button.setIcon(imageIcon);
    button.putClientProperty("MediaArtwork", artwork);

    buttonGroup.add(button);
    buttons.add(button);
    imagePanel.add(button, gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 1;
    gbc.anchor = GridBagConstraints.LAST_LINE_START;
    gbc.insets = new Insets(0, 5, 0, 0);

    JComboBox cb = null;
    if (artwork.getImageSizes().size() > 0) {
        cb = new JComboBox(artwork.getImageSizes().toArray());
    } else {
        cb = new JComboBox(new String[] { originalImage.getWidth() + "x" + originalImage.getHeight() });
    }
    button.putClientProperty("MediaArtworkSize", cb);
    imagePanel.add(cb, gbc);

    // should we provide an option for extrathumbs
    if (mediaType == MediaType.MOVIE && type == ImageType.FANART
            && MovieModuleManager.MOVIE_SETTINGS.isImageExtraThumbs()) {
        gbc = new GridBagConstraints();
        gbc.gridx = 1;
        gbc.gridy = 1;
        gbc.anchor = GridBagConstraints.LINE_END;
        JLabel label = new JLabel("Extrathumb");
        imagePanel.add(label, gbc);

        gbc = new GridBagConstraints();
        gbc.gridx = 2;
        gbc.gridy = 1;
        gbc.anchor = GridBagConstraints.LINE_END;
        JCheckBox chkbx = new JCheckBox();
        button.putClientProperty("MediaArtworkExtrathumb", chkbx);
        imagePanel.add(chkbx, gbc);
    }

    // should we provide an option for extrafanart
    if (mediaType == MediaType.MOVIE && type == ImageType.FANART
            && MovieModuleManager.MOVIE_SETTINGS.isImageExtraFanart()) {
        gbc = new GridBagConstraints();
        gbc.gridx = 1;
        gbc.gridy = MovieModuleManager.MOVIE_SETTINGS.isImageExtraThumbs() ? 2 : 1;
        gbc.anchor = GridBagConstraints.LINE_END;
        JLabel label = new JLabel("Extrafanart");
        imagePanel.add(label, gbc);

        gbc = new GridBagConstraints();
        gbc.gridx = 2;
        gbc.gridy = MovieModuleManager.MOVIE_SETTINGS.isImageExtraThumbs() ? 2 : 1;
        gbc.anchor = GridBagConstraints.LINE_END;
        JCheckBox chkbx = new JCheckBox();
        button.putClientProperty("MediaArtworkExtrafanart", chkbx);
        imagePanel.add(chkbx, gbc);
    }

    /* show image button */
    gbc.gridx = 0;
    gbc.gridy++;
    gbc.anchor = GridBagConstraints.LAST_LINE_START;
    gbc.gridwidth = 3;
    gbc.insets = new Insets(0, 0, 0, 0);
    JButton btnShowImage = new JButton("<html><font color=\"#0000CF\"><u>"
            + BUNDLE.getString("image.showoriginal") + "</u></font></html>");
    btnShowImage.setBorderPainted(false);
    btnShowImage.setFocusPainted(false);
    btnShowImage.setContentAreaFilled(false);
    btnShowImage.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            ImagePreviewDialog dialog = new ImagePreviewDialog(artwork.getDefaultUrl());
            dialog.setVisible(true);
        }
    });
    imagePanel.add(btnShowImage, gbc);

    panelImages.add(imagePanel);
    panelImages.validate();
    panelImages.getParent().validate();
}

From source file:raptor.swt.chess.analysis.AnalysisCommentsGenerator.java

public String getComment(List<ScoreInfo> positionScores, AutomaticAnalysisController controller,
        double scoreDiff, boolean isWhite, BestLineFoundInfo thisPosBestLine, Game game) {

    double previous = controller.asDouble(positionScores.get(positionScores.size() - 2));
    double current = controller.asDouble(positionScores.get(positionScores.size() - 1));

    if (current == Double.MAX_VALUE || current == Double.MIN_VALUE || game.isCheckmate())
        return ""; //$NON-NLS-1$

    Game extendedGame = extendMoves(thisPosBestLine, game);

    if ((isWhite && previous < -2.0 && scoreDiff >= 2.0) || (!isWhite && previous > 2.0 && scoreDiff >= 2.0)) {
        String result = L10n.getStringS("AnalysisCommentsGenerator_12"); //White or black had an advantage by over 2 points, then score changed by at least 2 and hence they lose the initiative //$NON-NLS-1$
        if (game.isInCheck())
            result += L10n.getStringS("AnalysisCommentsGenerator_13"); //$NON-NLS-1$

        return result;
    }//from w w  w.jav  a 2  s.  c  om

    if ((isWhite && previous < -2.0 && scoreDiff >= 4.0) || (!isWhite && previous > 2.0 && scoreDiff >= 4.0))
        return L10n.getStringS("AnalysisCommentsGenerator_14"); //$NON-NLS-1$

    // forks recognition code
    if (positionScores.size() >= 3) {
        double minThSc = controller.asDouble(positionScores.get(positionScores.size() - 3));
        double minThDiff = Math.abs(minThSc - current);
        if (game.isInCheck()
                && game.getPiece(thisPosBestLine.getMoves()[1].getEndSquare()) != GameConstants.EMPTY
                && ((isWhite && minThSc > -1.0 && minThDiff >= 2.0)
                        || (!isWhite && minThSc < 1.0 && minThDiff >= 2.0)))
            return L10n.getStringS("AnalysisCommentsGenerator_15"); //$NON-NLS-1$
    }

    /*System.out.println("This move: " + game.getLastMove().getSan());
    int materialBefore = GameUtils.getMaterialScore(game);
    Move lastMove = game.getLastMove();
    materialBefore += (isWhite ? pieceMaterialScore(lastMove.getCapture()) :
       -pieceMaterialScore(lastMove.getCapture()));
    System.out.println("materialBefore: " + materialBefore);
    System.out.println("materialExtend: " + GameUtils.getMaterialScore(extendedGame));
            
    if (((isWhite && current > 2 && GameUtils.getMaterialScore(extendedGame) < materialBefore) 
    || (!isWhite && current < -2 && GameUtils.getMaterialScore(extendedGame) > materialBefore) 
    && lastMove.isCapture())) {
       return "SAC";         
    }*/

    boolean[] whiteAdvVec = getAdvantageVector(GameConstants.WHITE, game, extendedGame, previous, current,
            true);
    boolean[] blackAdvVec = getAdvantageVector(GameConstants.BLACK, game, extendedGame, previous, current,
            true);

    int whiteAdvMultiplicity = getAdvantageMultiplicity(whiteAdvVec);
    int blackAdvMultiplicity = getAdvantageMultiplicity(blackAdvVec);

    if (whiteAdvMultiplicity > 0) {
        String comment = L10n.getStringS("AnalysisCommentsGenerator_16"); //$NON-NLS-1$
        boolean[] blackAdvVecScoreless = getAdvantageVector(GameConstants.BLACK, game, extendedGame, previous,
                current, false);
        int blackScorelessMul = getAdvantageMultiplicity(blackAdvVecScoreless);
        comment += getAdvantageName(whiteAdvVec);
        if (blackScorelessMul > 0)
            comment += L10n.getStringS("AnalysisCommentsGenerator_17") + getAdvantageName(blackAdvVecScoreless) //$NON-NLS-1$
                    + L10n.getStringS("AnalysisCommentsGenerator_18"); //$NON-NLS-1$

        fireAdvantages(whiteAdvVec);
        return comment + "."; //$NON-NLS-1$
    } else if (blackAdvMultiplicity > 0) {
        String comment = L10n.getStringS("AnalysisCommentsGenerator_20"); //$NON-NLS-1$
        boolean[] whiteAdvVecScoreless = getAdvantageVector(GameConstants.WHITE, game, extendedGame, previous,
                current, false);
        int whiteScorelessMul = getAdvantageMultiplicity(whiteAdvVecScoreless);
        comment += getAdvantageName(blackAdvVec);
        if (whiteScorelessMul > 0)
            comment += L10n.getStringS("AnalysisCommentsGenerator_21") + getAdvantageName(whiteAdvVecScoreless) //$NON-NLS-1$
                    + L10n.getStringS("AnalysisCommentsGenerator_22"); //$NON-NLS-1$

        fireAdvantages(blackAdvVec);
        return comment + "."; //$NON-NLS-1$
    }

    //Need to be edited to check if a player has castled and opponent cannot, then make a castle advantage comment. Not sure of how to do this.
    if (!whiteCastleFired) {

        if (!game.canBlackCastleLong() && !game.canBlackCastleShort()
                && (game.canWhiteCastleLong() || game.canWhiteCastleLong())
                && notAlreadyCastled(game, GameConstants.BLACK)) {

            whiteCastleFired = true;
            return L10n.getStringS("AnalysisCommentsGenerator_24"); //$NON-NLS-1$
        }
    }

    if (!blackCastleFired) {
        if (!game.canWhiteCastleLong() && !game.canWhiteCastleShort()
                && (game.canBlackCastleLong() || game.canBlackCastleLong())
                && notAlreadyCastled(game, GameConstants.WHITE)) {
            blackCastleFired = true;
            return L10n.getStringS("AnalysisCommentsGenerator_25"); //$NON-NLS-1$
        }
    }

    /*else if (((isWhite && current > 2) || (!isWhite && current < -2)) ) {            
    Game gameCopy = game.deepCopy(true);
    gameCopy.rollback();
    int materialPrevious = GameUtils.getMaterialScore(gameCopy);
    gameCopy.move(game.getLastMove());
    int captureSquare = game.getLastMove().getTo();
    for (UCIMove move: thisPosBestLine.getMoves()) {
       if (move.isPromotion()) {
          gameCopy.makeMove(
                move.getStartSquare(),
                move.getEndSquare(),
                move.getPromotedPiece());
       } else {
          gameCopy.makeMove(
                move.getStartSquare(),
                move.getEndSquare());
       }
               
       if (!(move.getEndSquare() == captureSquare 
             || gameCopy.isInCheck()))
          break;
    }
    int materialScore = GameUtils.getMaterialScore(gameCopy);
            
    if (isWhite && (materialPrevious-materialScore) <= -2 
          || !isWhite && (materialPrevious-materialScore) >= 2)
       return " What a sacrifice!";
    }*/

    return ""; //$NON-NLS-1$
}

From source file:org.vertx.java.http.eventbusbridge.integration.MessagePublishTest.java

@Test
public void testPublishingDoubleXml() throws IOException {
    final EventBusMessageType messageType = EventBusMessageType.Double;
    final Double sentDouble = Double.MIN_VALUE;
    Map<String, String> expectations = createExpectations(generateUniqueAddress(),
            Base64.encodeAsString(sentDouble.toString()), messageType);
    final AtomicInteger completedCount = new AtomicInteger(0);
    Handler<Message> messagePublishHandler = new MessagePublishHandler(sentDouble, expectations,
            completedCount);// w  ww.ja va  2  s . c  om
    registerListenersAndCheckForResponses(messagePublishHandler, expectations, NUMBER_OF_PUBLISH_HANDLERS,
            completedCount);
    String body = TemplateHelper.generateOutputUsingTemplate(SEND_REQUEST_TEMPLATE_XML, expectations);
    HttpRequestHelper.sendHttpPostRequest(url, body, (VertxInternal) vertx, Status.ACCEPTED.getStatusCode(),
            MediaType.APPLICATION_XML);
}

From source file:org.apache.carbondata.core.indexstore.blockletindex.BlockletDataMap.java

/**
 * Fill the measures min values with minimum , this is needed for backward version compatability
 * as older versions don't store min values for measures
 *//*w w  w  .j av a  2  s.c o m*/
private byte[][] updateMinValues(byte[][] minValues, int[] minMaxLen) {
    byte[][] updatedValues = minValues;
    if (minValues.length < minMaxLen.length) {
        updatedValues = new byte[minMaxLen.length][];
        System.arraycopy(minValues, 0, updatedValues, 0, minValues.length);
        List<CarbonMeasure> measures = segmentProperties.getMeasures();
        ByteBuffer buffer = ByteBuffer.allocate(8);
        for (int i = 0; i < measures.size(); i++) {
            buffer.rewind();
            DataType dataType = measures.get(i).getDataType();
            if (dataType == DataTypes.BYTE) {
                buffer.putLong(Byte.MIN_VALUE);
                updatedValues[minValues.length + i] = buffer.array().clone();
            } else if (dataType == DataTypes.SHORT) {
                buffer.putLong(Short.MIN_VALUE);
                updatedValues[minValues.length + i] = buffer.array().clone();
            } else if (dataType == DataTypes.INT) {
                buffer.putLong(Integer.MIN_VALUE);
                updatedValues[minValues.length + i] = buffer.array().clone();
            } else if (dataType == DataTypes.LONG) {
                buffer.putLong(Long.MIN_VALUE);
                updatedValues[minValues.length + i] = buffer.array().clone();
            } else if (DataTypes.isDecimal(dataType)) {
                updatedValues[minValues.length + i] = DataTypeUtil
                        .bigDecimalToByte(BigDecimal.valueOf(Long.MIN_VALUE));
            } else {
                buffer.putDouble(Double.MIN_VALUE);
                updatedValues[minValues.length + i] = buffer.array().clone();
            }
        }
    }
    return updatedValues;
}

From source file:org.micromanager.plugins.magellan.surfacesandregions.SurfaceInterpolator.java

private void calculateConvexHullBounds() {
    //convert convex hull vertices to pixel offsets in an arbitrary pixel space
    AffineTransform transform = AffineUtils.getAffineTransform(getCurrentPixelSizeConfig(), 0, 0);
    boundYPixelMin_ = Integer.MAX_VALUE;
    boundYPixelMax_ = Integer.MIN_VALUE;
    boundXPixelMin_ = Integer.MAX_VALUE;
    boundXPixelMax_ = Integer.MIN_VALUE;
    boundXMin_ = Double.MAX_VALUE;
    boundXMax_ = Double.MIN_VALUE;
    boundYMin_ = Double.MAX_VALUE;
    boundYMax_ = Double.MIN_VALUE;
    for (int i = 0; i < convexHullVertices_.length; i++) {
        //calculate edges of interpolation bounding box
        //for later use by interpolating function
        boundXMin_ = Math.min(boundXMin_, convexHullVertices_[i].getX());
        boundXMax_ = Math.max(boundXMax_, convexHullVertices_[i].getX());
        boundYMin_ = Math.min(boundYMin_, convexHullVertices_[i].getY());
        boundYMax_ = Math.max(boundYMax_, convexHullVertices_[i].getY());
        //also get pixel bounds of convex hull for fitting of XY positions
        double dx = convexHullVertices_[i].getX() - convexHullVertices_[0].getX();
        double dy = convexHullVertices_[i].getY() - convexHullVertices_[0].getY();
        Point2D.Double pixelOffset = new Point2D.Double(); // pixel offset from convex hull vertex 0;
        try {//from w  w w  .j a  v a2s.c  o m
            transform.inverseTransform(new Point2D.Double(dx, dy), pixelOffset);
        } catch (NoninvertibleTransformException ex) {
            Log.log("Problem inverting affine transform");
        }
        boundYPixelMin_ = (int) Math.min(boundYPixelMin_, pixelOffset.y);
        boundYPixelMax_ = (int) Math.max(boundYPixelMax_, pixelOffset.y);
        boundXPixelMin_ = (int) Math.min(boundXPixelMin_, pixelOffset.x);
        boundXPixelMax_ = (int) Math.max(boundXPixelMax_, pixelOffset.x);
    }
}

From source file:org.apache.nifi.processors.orc.PutORCTest.java

private void verifyORCUsers(final Path orcUsers, final int numExpectedUsers,
        BiFunction<List<Object>, Integer, Void> assertFunction) throws IOException {
    Reader reader = OrcFile.createReader(orcUsers, OrcFile.readerOptions(testConf));
    RecordReader recordReader = reader.rows();

    TypeInfo typeInfo = TypeInfoUtils.getTypeInfoFromTypeString(
            "struct<name:string,favorite_number:int,favorite_color:string,scale:double>");
    StructObjectInspector inspector = (StructObjectInspector) OrcStruct.createObjectInspector(typeInfo);

    int currUser = 0;
    Object nextRecord = null;/*  w w  w  . ja v a 2 s.c o  m*/
    while ((nextRecord = recordReader.next(nextRecord)) != null) {
        Assert.assertNotNull(nextRecord);
        Assert.assertTrue("Not an OrcStruct", nextRecord instanceof OrcStruct);
        List<Object> x = inspector.getStructFieldsDataAsList(nextRecord);

        if (assertFunction == null) {
            assertEquals("name" + currUser, x.get(0).toString());
            assertEquals(currUser, ((IntWritable) x.get(1)).get());
            assertEquals("blue" + currUser, x.get(2).toString());
            assertEquals(10.0 * currUser, ((DoubleWritable) x.get(3)).get(), Double.MIN_VALUE);
        } else {
            assertFunction.apply(x, currUser);
        }
        currUser++;
    }

    assertEquals(numExpectedUsers, currUser);
}

From source file:lfsom.visualization.clustering.LFSKMeans.java

/**
 * Get a double[][] of all cluster centroids. Normalised in the range of the
 * centroids.//from www. ja va2 s .  co m
 * 
 * @return all cluster centroids
 */
public double[][] getMinMaxNormalisedClusterCentroidsWithin() {
    double[] min = new double[data.clone()[0].length];
    double[] max = new double[data.clone()[0].length];
    // min[] = Double.MAX_VALUE;
    // double max[] = Double.MIN_VALUE;

    for (int i = 0; i < data[0].length; i++) {
        for (LFSCluster cluster : clusters) {
            if (i == 0) {
                min[i] = Double.MAX_VALUE;
                max[i] = Double.MIN_VALUE;
            }
            if (cluster.getCentroid()[i] > max[i]) {
                max[i] = cluster.getCentroid()[i];
            }
            if (cluster.getCentroid()[i] < min[i]) {
                min[i] = cluster.getCentroid()[i];
            }
        }
    }
    double[][] centroids = new double[k][numberOfAttributes];
    for (int indexClusters = 0; indexClusters < k; indexClusters++) {
        double[] centroid = clusters[indexClusters].getCentroid();
        for (int i = 0; i < centroid.length; i++) {
            centroid[i] = (centroid[i] - minValues[i]) / maxValues[i];
        }
        centroids[indexClusters] = centroid;
    }
    return centroids;
}

From source file:net.tourbook.photo.Photo.java

/**
 * Image direction//from   www .  jav  a 2  s.  c  o  m
 * 
 * @param tagInfo
 */
private double getExifValueDouble(final JpegImageMetadata jpegMetadata, final TagInfo tagInfo) {
    try {
        final TiffField field = jpegMetadata.findEXIFValueWithExactMatch(tagInfo);
        if (field != null) {
            return field.getDoubleValue();
        }
    } catch (final Exception e) {
        // ignore
    }

    return Double.MIN_VALUE;
}