Example usage for java.lang Double floatValue

List of usage examples for java.lang Double floatValue

Introduction

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

Prototype

public float floatValue() 

Source Link

Document

Returns the value of this Double as a float after a narrowing primitive conversion.

Usage

From source file:coolmap.application.io.internal.coolmapobject.InternalCoolMapObjectIO.java

public static VNode createNodeFromJSON(JSONObject object) throws Exception {
    String id = object.getString(IOTerm.ATTR_NODE_ID);
    String name = object.getString(IOTerm.ATTR_NODE_NAME);
    Double defaultViewMultiplier = object.optDouble(IOTerm.ATTR_NODE_VIEWMULTIPLIER_DEFAULT, -1);
    if (defaultViewMultiplier == null || defaultViewMultiplier < 0) {
        defaultViewMultiplier = 1.0;//from   w w w .j a  v  a  2 s  .  co  m
    }
    Double currentViewMultiplier = object.optDouble(IOTerm.ATTR_NODE_VIEWMULTIPLIER, -1);
    if (currentViewMultiplier == null || currentViewMultiplier < 0) {
        currentViewMultiplier = defaultViewMultiplier;
    }
    boolean isExpanded = object.optInt(IOTerm.ATTR_NODE_ISEXPANDED, 0) == 1 ? true : false;

    String colorString = object.optString(IOTerm.ATTR_NODE_COLOR);
    Color viewColor;
    if (colorString == null) {
        viewColor = null;
    } else {
        try {
            viewColor = new Color(Integer.parseInt(colorString));
        } catch (Exception e) {
            viewColor = null;
        }

    }

    //        System.out.println(object);
    String contologyID = object.optString(IOTerm.ATTR_NODE_ONTOLOGYID);

    COntology ontology = CoolMapMaster.getCOntologyByID(contologyID); //This part may need to be refactored: nodes only need to associate with ontology ID

    //        System.out.println("ontology to be loaded:" + contologyID + " " + ontology);
    //set view heights
    VNode node = new VNode(name, ontology, id);
    node.setViewColor(viewColor);
    node.setDefaultViewMultiplier(defaultViewMultiplier.floatValue());
    node.setViewMultiplier(currentViewMultiplier.floatValue());
    node.setExpanded(isExpanded);

    Float viewHeight = new Float(object.optDouble(IOTerm.ATTR_NODE_VIEWHEIGHT, -1));
    node.setViewHeight(viewHeight == -1 ? null : viewHeight);
    return node;
}

From source file:org.openfaces.component.chart.impl.renderers.LineFillRenderer.java

private void configureGradientAreaFill(Graphics2D g2, CategoryPlot plot, Paint itemPaint,
        PlotRenderingInfo info, GradientLineAreaFill gradientLineAreaFill) {
    double plotWidth = info.getPlotArea().getWidth();
    double plotHeight = info.getPlotArea().getHeight();
    Double mainColorTransparency = gradientLineAreaFill.getMaxValueTransparency();
    Double bgColorTransparency = gradientLineAreaFill.getMinValueTransparency();

    if (itemPaint instanceof Color) {
        Color itemColor = (Color) itemPaint;
        int red = itemColor.getRed();
        int green = itemColor.getGreen();
        int blue = itemColor.getBlue();
        int mainColorAlpha = (mainColorTransparency >= 0.0 && mainColorTransparency <= 1.0)
                ? Math.round(255 * mainColorTransparency.floatValue())
                : 150;/*  www.  j  a v  a2  s .  com*/
        int bgColorAlpha = (bgColorTransparency >= 0.0 && bgColorTransparency <= 1.0)
                ? Math.round(255 * bgColorTransparency.floatValue())
                : 128;

        Color mainColor = new Color(red, green, blue, mainColorAlpha);
        Paint bgColor = getBackgroundPaint();
        if (bgColor == null) {
            bgColor = plot.getBackgroundPaint();
        }
        Color secondaryColor = getSecondaryColor(bgColorAlpha, bgColor);
        Paint areaPaint = getAreaFillPaint(plot, plotWidth, plotHeight, mainColor, secondaryColor);

        g2.setPaint(areaPaint);
    } else {
        g2.setPaint(itemPaint);
    }
}

From source file:pts4.googlemaps.Gmaps.java

public void createStage() {

    GeoPosition Utrecht = new GeoPosition(52.0907370, 5.1214200);
    /*// Create a waypoint painter that takes all the waypoints
     WaypointPainter<Waypoint> waypointPainter = new WaypointPainter<Waypoint>();
     waypointPainter.setWaypoints(waypoints);*/
    // Set the focus
    mapViewer.setZoom(10);// w ww.  jav a 2s  .  co  m
    mapViewer.setAddressLocation(Utrecht);

    // Add interactions
    MouseInputListener mia = new PanMouseInputListener(mapViewer);

    mapViewer.addMouseListener(sa);
    mapViewer.addMouseMotionListener(sa);
    mapViewer.setOverlayPainter(sp);
    mapViewer.addMouseListener(mia);
    mapViewer.addMouseMotionListener(mia);
    //mapViewer.addMouseListener(new CenterMapListener(mapViewer));
    mapViewer.addMouseWheelListener(new ZoomMouseWheelListenerCenter(mapViewer));
    mapViewer.addKeyListener(new PanKeyListener(mapViewer));

    mapViewer.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent me) {

            //Rechter muisknop klik
            if (me.getButton() == MouseEvent.BUTTON3) {
                GeoPosition mousepoint = mapViewer.convertPointToGeoPosition(me.getPoint());
                Double lat1 = mousepoint.getLatitude();
                Double lng1 = mousepoint.getLongitude();
                Double lat2;
                Double lng2;

                for (MyWaypoint u : units) {
                    lat2 = u.getPosition().getLatitude();
                    lng2 = u.getPosition().getLongitude();

                    if (UnitControl.distFrom(lat1.floatValue(), lng1.floatValue(), lat2.floatValue(),
                            lng2.floatValue()) < (mapViewer.getZoom() * mapViewer.getZoom()
                                    * mapViewer.getZoom() * 2)) {
                        Platform.runLater(new Runnable() {

                            @Override
                            public void run() {

                                MessageBox msg = new MessageBox("Send message to unit " + u.getLabel() + "?",
                                        MessageBoxType.YES_NO);
                                msg.showAndWait();

                                if (msg.getMessageBoxResult() == MessageBoxResult.YES) {

                                    try {
                                        if (gui.messageToUnit(u.getLabel()) == false) {
                                            MessageBox msg2 = new MessageBox("Error connecting to unit",
                                                    MessageBoxType.OK_ONLY);
                                            msg2.show();

                                        }
                                    } catch (IOException ex) {
                                        Logger.getLogger(Gmaps.class.getName()).log(Level.SEVERE, null, ex);
                                    }

                                } else {
                                    //msg.close();
                                }
                            }

                        });
                    }
                }

            } else {
                if (createUnit == true) {
                    Color kleur = null;
                    if (type == 1) {
                        kleur = Color.cyan;
                    }
                    if (type == 2) {
                        kleur = Color.YELLOW;
                    }
                    if (type == 3) {
                        kleur = Color.RED;
                    }
                    GeoPosition plek = mapViewer.convertPointToGeoPosition(me.getPoint());
                    Platform.runLater(new Runnable() {
                        @Override
                        public void run() {
                            gui.setUnit(plek.getLongitude(), plek.getLatitude());
                        }
                    });

                    for (MyWaypoint p : orders) {
                        if (p.getLabel().equals(id)) {
                            orders.remove(p);
                        }
                    }
                    orders.add(new MyWaypoint(id, kleur, plek));
                    for (Unit a : EmergencyUnits) {
                        if (a.getName().equals(id)) {
                            GeoPosition plek2 = new GeoPosition(a.getLatidude(), a.getLongitude());
                            ChatMessage chat = new ChatMessage(
                                    gui.getIncidentorder() + "\n" + gui.getUnitDescription(), "Meldkamer", id);
                            server.sendMessage(chat);
                            a.setIncident(incidentstring);
                            new Animation(plek, plek2, id, orders, units, Gmaps.this, waypointPainter3);
                        }
                    }
                    createUnit = false;
                    // Create a waypoint painter that takes all the waypoints
                    waypointPainter3.setWaypoints(orders);
                    waypointPainter3.setRenderer(new FancyWaypointRenderer());
                    draw();
                }

                if (simulation == true) {
                    Color kleur = null;
                    if (type == 1) {
                        kleur = Color.cyan;
                    }
                    if (type == 2) {
                        kleur = Color.YELLOW;
                    }
                    if (type == 3) {
                        kleur = Color.RED;
                    }
                    GeoPosition plek = mapViewer.convertPointToGeoPosition(me.getPoint());
                    Platform.runLater(new Runnable() {
                        @Override
                        public void run() {
                            gui.setUnit(plek.getLongitude(), plek.getLatitude());
                        }
                    });

                    for (MyWaypoint p : orders) {
                        if (p.getLabel().equals(id)) {
                            orders.remove(p);
                        }
                    }
                    orders.add(new MyWaypoint(id, kleur, plek));
                    for (Unit a : EmergencyUnits) {
                        if (a.getName().equals(id)) {
                            GeoPosition plek2 = new GeoPosition(a.getLatidude(), a.getLongitude());
                            ChatMessage chat = new ChatMessage(
                                    gui.getIncidentorder() + "\n" + gui.getUnitDescription(), "Meldkamer", id);
                            server.sendMessage(chat);
                            a.setIncident(incidentstring);
                            Point2D fire = mapViewer.getTileFactory().geoToPixel(plek, mapViewer.getZoom());
                            simulations = new Simulation(plek, plek2, id, orders, units, Gmaps.this,
                                    waypointPainter3);
                            new SimulationAnimation(simulations, plek, plek2, id, orders, units, Gmaps.this,
                                    waypointPainter3);

                        }
                    }
                    createUnit = false;
                    // Create a waypoint painter that takes all the waypoints
                    waypointPainter3.setWaypoints(orders);
                    waypointPainter3.setRenderer(new FancyWaypointRenderer());
                    /*
                     List<Painter<JXMapViewer>> painters = new ArrayList<Painter<JXMapViewer>>();
                     painters.add(simulations);
                     CompoundPainter<JXMapViewer> painter = new CompoundPainter<JXMapViewer>(painters);
                                
                     mapViewer.setOverlayPainter(painter);*/
                    draw();
                    simulation = false;
                }

                if (weather == true) {
                    GeoPosition mousepoint = mapViewer.convertPointToGeoPosition(me.getPoint());
                    Double lat1 = mousepoint.getLatitude();
                    Double lng1 = mousepoint.getLongitude();
                    try {
                        new Weather(lng1, lat1);
                    } catch (IOException ex) {
                        Logger.getLogger(Gmaps.class.getName()).log(Level.SEVERE, null, ex);
                    } catch (JSONException ex) {
                        Logger.getLogger(Gmaps.class.getName()).log(Level.SEVERE, null, ex);
                    }
                }
            }
        }
    }); // end MouseAdapter

}

From source file:org.deidentifier.arx.DataHandle.java

/**
 * Returns a float value from the specified cell.
 *
 * @param row The cell's row index/*  www.  java  2  s .  c om*/
 * @param col The cell's column index
 * @return the float
 * @throws ParseException the parse exception
 */
public Float getFloat(int row, int col) throws ParseException {
    String value = getValue(row, col);
    DataType<?> type = getDataType(getAttributeName(col));
    if (type instanceof ARXDecimal) {
        Double _double = ((ARXDecimal) type).parse(value);
        return _double == null ? null : _double.floatValue();
    } else if (type instanceof ARXInteger) {
        Long _long = ((ARXInteger) type).parse(value);
        return _long == null ? null : _long.floatValue();
    } else {
        throw new ParseException("Invalid datatype: " + type.getClass().getSimpleName(), col);
    }
}

From source file:io.github.mzmine.modules.plots.msspectrum.MsSpectrumPlotWindowController.java

public void handleAddIsotopePattern(Event e) {
    ParameterSet parameters = MZmineCore.getConfiguration().getModuleParameters(IsotopePatternPlotModule.class);
    ButtonType exitCode = parameters.showSetupDialog("Add isotope pattern");
    if (exitCode != ButtonType.OK)
        return;//from ww w .  ja  v  a  2s.c  om
    final String formula = parameters.getParameter(IsotopePatternPlotParameters.formula).getValue();
    final Double mzTolerance = parameters.getParameter(IsotopePatternPlotParameters.mzTolerance).getValue();
    final Double minAbundance = parameters.getParameter(IsotopePatternPlotParameters.minAbundance).getValue();
    final Double normalizedIntensity = parameters.getParameter(IsotopePatternPlotParameters.normalizedIntensity)
            .getValue();
    final MsSpectrum pattern = IsotopePatternGeneratorAlgorithm.generateIsotopes(formula, minAbundance,
            normalizedIntensity.floatValue(), mzTolerance);
    addSpectrum(pattern, formula);
}

From source file:org.openfaces.component.chart.impl.renderers.XYLineFillRenderer.java

private void configureGradientAreaFill(Graphics2D g2, XYPlot plot, PlotRenderingInfo info, Paint itemPaint,
        GradientLineAreaFill gradientLineAreaFill) {
    final Rectangle2D plotArea = info.getPlotArea();
    double plotWidth = plotArea.getWidth();
    double plotHeight = plotArea.getHeight();
    Double mainColorTransparency = gradientLineAreaFill.getMaxValueTransparency();
    Double bgColorTransparency = gradientLineAreaFill.getMinValueTransparency();

    if (itemPaint instanceof Color) {
        Color itemColor = (Color) itemPaint;
        int red = itemColor.getRed();
        int green = itemColor.getGreen();
        int blue = itemColor.getBlue();
        int mainColorAlpha = (mainColorTransparency >= 0.0 && mainColorTransparency <= 1.0)
                ? Math.round(255 * mainColorTransparency.floatValue())
                : 150;/* ww  w.  jav a 2s .c  o  m*/
        int bgColorAlpha = (bgColorTransparency >= 0.0 && bgColorTransparency <= 1.0)
                ? Math.round(255 * bgColorTransparency.floatValue())
                : 128;

        Color mainColor = new Color(red, green, blue, mainColorAlpha);
        Paint bgColor = getBackgroundPaint();
        if (bgColor == null) {
            bgColor = plot.getBackgroundPaint();
        }
        Color secondaryColor = getSecondaryColor(bgColorAlpha, bgColor);

        Paint areaPaint = getAreaFillPaint(plot, plotWidth, plotHeight, mainColor, secondaryColor);
        g2.setPaint(areaPaint);
    } else {
        g2.setPaint(itemPaint);
    }
}

From source file:com.virtusa.akura.student.controller.MessageBoardController.java

/**
 * Returns a list of StudentTermMarkDTO.
 *
 * @param termMarksForTerm - a list of properties of StudentTermMarkDTO.
 * @param parameterMap - a map containing the data.
 * @return - a list of StudentTermMarkDTO.
 *//*w  w w.  java 2 s  .c  o m*/
private List<StudentTermMarkDTO> getStudentTermAverage(List<Object> termMarksForTerm,
        Map<String, Object> parameterMap) {

    Iterator<?> iteratorList = termMarksForTerm.iterator();
    List<StudentTermMarkDTO> studentTermMarkDTOList = new LinkedList<StudentTermMarkDTO>();

    while (iteratorList.hasNext()) {
        Object[] object = (Object[]) iteratorList.next();
        StudentTermMarkDTO termMarkDto = new StudentTermMarkDTO();
        int index = 1;
        termMarkDto.setTerm((String) object[index]);
        Double marks = (Double) object[0];
        Float floatMarks = marks.floatValue();
        floatMarks = roundFloat(floatMarks, 2);
        termMarkDto.setMarks(floatMarks);
        studentTermMarkDTOList.add(termMarkDto);
    }

    JRDataSource averageTermMarks = new JRBeanCollectionDataSource(studentTermMarkDTOList);

    parameterMap.put(JASPER_CUSTOM_SUB_REPORT_DATASOURCE5, averageTermMarks);
    return studentTermMarkDTOList;
}

From source file:com.attentec.AttentecService.java

/**
 * Saves and sends a new (our own) location to server.
 * @param location new location//from   ww w  .java2s  .  c  om
 */
private void handleNewLocation(final Location location) {
    Log.d(TAG, "handleNewLocation");
    if (location != null) {

        Double lat = location.getLatitude();
        Double lng = location.getLongitude();

        //save the location in preferences
        SharedPreferences sp = getSharedPreferences("attentec_preferences", MODE_PRIVATE);

        String username = sp.getString("username", "");
        String phoneKey = sp.getString("phone_key", "");

        Date d = new Date();

        SharedPreferences.Editor editor = sp.edit();
        editor.putFloat("latitude", lat.floatValue());
        editor.putFloat("longitude", lng.floatValue());
        editor.putLong("location_updated_at", d.getTime() / DevelopmentSettings.MILLISECONDS_IN_SECOND);
        editor.commit();

        //check if we need to update the server
        if (d.getTime() - lastUpdatedToServer < PreferencesHelper.getLocationsUpdateInterval(ctx) / 2) {
            Log.d(TAG, "Not updating location to server, to soon since last time: "
                    + (d.getTime() - lastUpdatedToServer));
            return;
        }

        Log.d(TAG, "Updating location to server");
        //get logindata for server contact
        Hashtable<String, List<NameValuePair>> postdata = ServerContact.getLogin(username, phoneKey);

        //add location to POST data
        List<NameValuePair> locationdata = new ArrayList<NameValuePair>();
        locationdata.add(new BasicNameValuePair("latitude", lat.toString()));
        locationdata.add(new BasicNameValuePair("longitude", lng.toString()));
        postdata.put("location", locationdata);

        //send location to server
        String url = "/app/app_update_user_info.json";

        try {
            ServerContact.postJSON(postdata, url, ctx);
        } catch (LoginException e) {
            //Login was wrong, so close activity
            endAllActivities();
            return;
        }
        lastUpdatedToServer = new Date().getTime();
    }
}

From source file:no.abmu.finances.service.hibernate3.FinanceServiceHelperH3Impl.java

private void doubleFromReportDataFloatToJasperReport(Map<String, Object> m, MainReportData mainReportData,
        int startIndex, int stopIndex, String prefix) {

    Assert.checkRequiredArgument("m", m);
    Assert.checkRequiredArgument("mainReportData", mainReportData);

    for (int i = startIndex; i <= stopIndex; i++) {
        String fieldName = intTo3DigitString(i);
        DoublePostData doublePostData = (DoublePostData) mainReportData.getPostData(fieldName);

        if (doublePostData != null) {
            String key;// ww w. j av a 2 s  .  c o m
            if (prefix == null) {
                key = fieldName;
            } else {
                key = prefix + fieldName;
            }
            Double doublePostDataValue = doublePostData.getDoubleValue();
            if (doublePostDataValue != null) {
                m.put(key, doublePostDataValue.floatValue());
            }
        }
    }
}

From source file:eus.ixa.ixa.pipe.convert.AbsaSemEval.java

public static String absa2015Toabsa2015AnotatedWithMultipleDocClasModels(String fileName, String modelsList) {
    //reading the ABSA xml file
    SAXBuilder sax = new SAXBuilder();
    XPathFactory xFactory = XPathFactory.instance();
    Document doc = null;//from   w  w w.j a v a 2s  . com
    try {
        doc = sax.build(fileName);
        XPathExpression<Element> expr = xFactory.compile("//sentence", Filters.element());
        List<Element> sentences = expr.evaluate(doc);

        int cantSent = 0;

        for (Element sent : sentences) {

            Element opinionsElement = sent.getChild("Opinions");
            if (opinionsElement != null) {
                //iterating over every opinion in the opinions element
                List<Element> opinionList = opinionsElement.getChildren();
                for (int i = opinionList.size() - 1; i >= 0; i--) {
                    Element opinion = opinionList.get(i);
                    opinionsElement.removeContent(opinion);
                }
            }

            KAFDocument kaf;
            final String lang = "en";
            final String kafVersion = "1.0";
            kaf = new KAFDocument(lang, kafVersion);
            final Properties properties = new Properties();
            properties.setProperty("language", lang);
            properties.setProperty("normalize", "default");
            properties.setProperty("untokenizable", "no");
            properties.setProperty("hardParagraph", "no");
            InputStream inputStream = new ByteArrayInputStream(
                    sent.getChildText("text").getBytes(Charset.forName("UTF-8")));
            BufferedReader breader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));
            final eus.ixa.ixa.pipe.tok.Annotate annotator = new eus.ixa.ixa.pipe.tok.Annotate(breader,
                    properties);
            annotator.tokenizeToKAF(kaf);

            //System.err.println(kaf.toString());

            BufferedReader reader = new BufferedReader(new FileReader(modelsList));
            int lines = 0;
            while (reader.readLine() != null)
                lines++;
            reader.close();

            boolean Binary = false;
            if (lines > 1)
                Binary = true;

            File file = new File(modelsList);
            FileReader fileReader = new FileReader(file);
            BufferedReader bufferedReader = new BufferedReader(fileReader);
            String line;
            while ((line = bufferedReader.readLine()) != null) {
                //System.err.println("-" + line + "-" + kaf.getLang());

                /*
                File fileTmp = new File(line);
                String fileTmp0 = Paths.get(".").toAbsolutePath().normalize().toString()+"/tmpModels/"+line+"."+cantSent;
                File fileTmp2 = new File(fileTmp0);
                Files.copy(fileTmp.toPath(), fileTmp2.toPath());
                */
                Properties oteProperties = new Properties();
                oteProperties.setProperty("model", line);
                oteProperties.setProperty("language", kaf.getLang());
                oteProperties.setProperty("clearFeatures", "no");

                //eus.ixa.ixa.pipe.doc.Annotate docClassifier = new eus.ixa.ixa.pipe.doc.Annotate(oteProperties);
                //docClassifier.classify(kaf);

                StatisticalDocumentClassifier docClassifier = new StatisticalDocumentClassifier(oteProperties);
                String source = oteProperties.getProperty("model");

                List<List<WF>> sentences0 = kaf.getSentences();
                List<String> tokens = new ArrayList<>();
                for (List<WF> sentence : sentences0) {
                    for (WF wf : sentence) {
                        tokens.add(wf.getForm());
                    }
                }
                String[] document = tokens.toArray(new String[tokens.size()]);
                String label = docClassifier.classify(document);
                //Topic topic = kaf.newTopic(label);
                double[] probs = docClassifier.classifyProb(document);
                //topic.setConfidence((float) probs[0]);
                //topic.setSource(Paths.get(source).getFileName().toString());
                //topic.setMethod("ixa-pipe-doc");

                SortedMap<Double, String> map = new TreeMap<Double, String>(Collections.reverseOrder());

                //System.err.println("RESULTADO: " + docClassifier.getClassifierME().getAllLabels(probs));
                System.err.println("SENTENCE:" + sent.getChildText("text"));
                Double sum = 0.0;
                for (int i = 0; i < probs.length; i++) {
                    //System.err.println("RESULTADO: " + docClassifier.getClassifierME().getLabel(i) + "\t\t" + probs[i]);
                    sum += probs[i];

                    map.put(probs[i], docClassifier.getClassifierME().getLabel(i));

                    //System.err.println("\t\tPUT: " + probs[i] + " -- " + docClassifier.getClassifierME().getLabel(i));

                    //Topic topic = kaf.newTopic(docClassifier.getClassifierME().getLabel(i));
                    //topic.setConfidence((float) probs[i]);
                    //topic.setSource(Paths.get(source).getFileName().toString());
                    //topic.setMethod("ixa-pipe-doc");
                }
                sum = sum / probs.length;
                System.err.println("MEDIA: " + sum);

                Set<Double> Keys = map.keySet();

                boolean first = true;
                for (Double key : Keys) {
                    System.err.println("\t\t" + key + "\t" + map.get(key));
                    if (Binary) {
                        if (key >= 0.40) {
                            Topic topic = kaf.newTopic(map.get(key));
                            topic.setConfidence((float) key.floatValue());
                            topic.setSource(Paths.get(source).getFileName().toString());
                            topic.setMethod("ixa-pipe-doc");
                        }
                        break;
                    } else {
                        if (first) {
                            first = false;
                            /*if (key > 0.65 || (key < 0.20 && key > 0.10)) {
                               Topic topic = kaf.newTopic(map.get(key));
                               topic.setConfidence((float) key.floatValue());
                               topic.setSource(Paths.get(source).getFileName().toString());
                               topic.setMethod("ixa-pipe-doc");
                               //break;
                            }
                            else */
                            if (key < 0.10) {
                                break;
                            } else {
                                Topic topic = kaf.newTopic(map.get(key));
                                topic.setConfidence((float) key.floatValue());
                                topic.setSource(Paths.get(source).getFileName().toString());
                                topic.setMethod("ixa-pipe-doc");
                            }
                        } else if (key > 0.25) {
                            Topic topic = kaf.newTopic(map.get(key));
                            topic.setConfidence((float) key.floatValue());
                            topic.setSource(Paths.get(source).getFileName().toString());
                            topic.setMethod("ixa-pipe-doc");
                        }
                    }

                }

                //Files.delete(fileTmp2.toPath());
            }
            fileReader.close();

            //System.err.println(kaf.toString());
            cantSent++;

            System.err.println("IsBinary: " + Binary);

            List<Topic> topicList = kaf.getTopics();
            for (Topic topic : topicList) {
                //System.err.println(topic.getTopicValue());
                if (!topic.getTopicValue().equals("NO")) {
                    Element opinionElem = new Element("Opinion");
                    opinionElem.setAttribute("target", "na");
                    opinionElem.setAttribute("category", topic.getTopicValue());
                    //TODO we still do not have polarity here
                    opinionElem.setAttribute("polarity", String.valueOf(topic.getConfidence()));
                    opinionElem.setAttribute("from", "0");
                    opinionElem.setAttribute("to", "0");
                    opinionsElement.addContent(opinionElem);
                }
            }

        } //end of sentence
    } catch (JDOMException | IOException e) {
        e.printStackTrace();
    }

    XMLOutputter xmlOutput = new XMLOutputter();
    Format format = Format.getPrettyFormat();
    xmlOutput.setFormat(format);
    return xmlOutput.outputString(doc);
}