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 boolean isNaN() 

Source Link

Document

Returns true if this Float value is a Not-a-Number (NaN), false otherwise.

Usage

From source file:Main.java

public static void main(String[] args) {

    Float f1 = new Float(-1.0 / 0.0);
    Float f2 = new Float(0.0 / 0.0);

    System.out.println(f1 + " = " + f1.isNaN());
    System.out.println(f2 + " = " + f2.isNaN());
}

From source file:volumesculptor.shell.ShapeJSGlobal.java

/**
 * Create a new grid/*from   ww w .  j  a v a2 s  .  c om*/
 * <p/>
 * This method is defined as a JavaScript function.
 */
public static Object createGrid(Context cx, Scriptable thisObj, Object[] args, Function funObj) {

    double[] grid_bounds = new double[6];
    double vs = 0.1 * MM;

    for (int i = 0; i < args.length; i++) {
        String st = null;

        if (args[i] instanceof NativeJavaObject) {
            Object o = ((NativeJavaObject) args[i]).unwrap();
            st = "JNO class=" + o.getClass() + " val: " + (o.toString());
        } else {
            st = args[i].toString();
        }
        System.out.println("arg: " + i + " val: " + st);
    }
    if (args.length == 1) { // grid 
        if (args[0] instanceof AttributeGrid) {
            AttributeGrid grid = (AttributeGrid) args[0];
            grid.getGridBounds(grid_bounds);
            vs = grid.getVoxelSize();
        } else if (args[0] instanceof NativeJavaObject) {
            AttributeGrid grid = (AttributeGrid) ((NativeJavaObject) args[0]).unwrap();
            grid.getGridBounds(grid_bounds);
            vs = grid.getVoxelSize();
        }
    } else if (args.length == 2) { // Bounds, voxelSize
        Bounds bounds;
        if (args[0] instanceof Bounds) {
            bounds = (Bounds) args[0];
        } else {
            bounds = (Bounds) ((NativeJavaObject) args[0]).unwrap();
        }
        grid_bounds[0] = bounds.xmin;
        grid_bounds[1] = bounds.xmax;
        grid_bounds[2] = bounds.ymin;
        grid_bounds[3] = bounds.ymax;
        grid_bounds[4] = bounds.zmin;
        grid_bounds[5] = bounds.zmax;
        vs = getDouble(args[1]);
    } else if (args.length == 4) { // grid, sizex, sizey, sizez 
        if (args[0] instanceof AttributeGrid) {
            AttributeGrid grid = (AttributeGrid) args[0];
            grid.getGridBounds(grid_bounds);
            vs = grid.getVoxelSize();
        } else if (args[0] instanceof NativeJavaObject) {
            AttributeGrid grid = (AttributeGrid) ((NativeJavaObject) args[0]).unwrap();
            grid.getGridBounds(grid_bounds);
            vs = grid.getVoxelSize();
        }
        double x = getDouble(args[1]);
        double y = getDouble(args[2]);
        double z = getDouble(args[3]);

        grid_bounds[0] -= x;
        grid_bounds[1] += x;
        grid_bounds[2] -= y;
        grid_bounds[3] += y;
        grid_bounds[4] -= z;
        grid_bounds[5] += z;
    } else if (args.length == 7) { // bounds[], voxleSize
        grid_bounds[0] = getDouble(args[0]);
        grid_bounds[1] = getDouble(args[1]);
        grid_bounds[2] = getDouble(args[2]);
        grid_bounds[3] = getDouble(args[3]);
        grid_bounds[4] = getDouble(args[4]);
        grid_bounds[5] = getDouble(args[5]);

        vs = getDouble(args[6]);
    } else {
        throw new IllegalArgumentException(
                "Invalid number of arguments to CreateGrid(xmin,xmax,ymin,ymax,zmin,zmax,voxelSize)");
    }

    // range check bounds and voxelSized
    for (int i = 0; i < grid_bounds.length; i++) {
        Float f = new Float(grid_bounds[i]);
        if (f.isNaN()) {
            throw new IllegalArgumentException("Grid size[" + i + "] is Not a Number.");
        }
    }

    if (args.length != 1) {
        // When passed a grid make sure its exactly the same size
        grid_bounds = MathUtil.roundBounds(grid_bounds, vs);
    }
    int[] gs = MathUtil.getGridSize(grid_bounds, vs);

    // range check bounds and voxelSized
    for (int i = 0; i < gs.length; i++) {
        if (gs[i] <= 0) {
            throw new IllegalArgumentException("Grid size[" + i + "] <= 0");
        }
    }

    AttributeGrid dest = makeEmptyGrid(gs, vs);

    System.out.println("Creating grid: " + java.util.Arrays.toString(gs)
            + java.util.Arrays.toString(grid_bounds) + " vs: " + vs);
    dest.setGridBounds(grid_bounds);

    return cx.getWrapFactory().wrapAsJavaObject(cx, funObj.getParentScope(), dest, null);
}

From source file:volumesculptor.shell.ShapeJSGlobal.java

/**
 * Load a model into a Grid/*from   ww w .  j a v  a 2s.  c o m*/
 * <p/>
 * This method is defined as a JavaScript function.
 */
public static Object load(Context cx, Scriptable thisObj, Object[] args, Function funObj) {
    if (args.length < 1) {
        throw Context.reportRuntimeError("No file provided for load() command");
    }
    String filename = Context.toString(args[0]);
    printf("filename: %s\n", filename);
    AttributeGrid grid = null;

    if (filename == null || filename.length() == 0) {
        throw Context.reportRuntimeError("No file provided for load() command");
    }

    double vs = 0.1 * MM;
    if (args.length > 1) {
        Object arg1 = unwrap(args[1]);
        printf("arg[1]: %s\n", arg1);
        if (arg1 instanceof Grid) {
            grid = (AttributeGrid) arg1;
        } else {
            vs = getDouble(arg1);
        }
    }
    double margin = vs;
    if (args.length > 2) {
        Object arg2 = unwrap(args[2]);
        margin = getDouble(arg2);
    }

    printf("load(%s, vs: %7.3f mm, margin: %7.3f mm)\n", filename, vs / MM, margin / MM);

    try {
        BoundingBoxCalculator bb = new BoundingBoxCalculator();
        TriangleProducer tp = null;

        if (filename.endsWith(".x3d") || filename.endsWith(".x3db") || filename.endsWith(".x3dv")) {
            tp = new X3DReader(filename);
            tp.getTriangles(bb);
        } else if (filename.endsWith(".svx")) {
            SVXReader reader = new SVXReader();
            return reader.load(filename);
        } else {
            tp = new STLReader(filename);
            tp.getTriangles(bb);
        }

        double bounds[] = new double[6];
        bb.getBounds(bounds);

        printf("   orig bounds: [ %7.3f, %7.3f], [%7.3f, %7.3f], [%7.3f, %7.3f] mm; vs: %7.3f mm\n",
                bounds[0] / MM, bounds[1] / MM, bounds[2] / MM, bounds[3] / MM, bounds[4] / MM, bounds[5] / MM,
                vs / MM);

        // Add a margin around the model to get some space 
        bounds = MathUtil.extendBounds(bounds, margin);
        //
        // round up to the nearest voxel 
        //
        MathUtil.roundBounds(bounds, vs);
        int nx = (int) Math.round((bounds[1] - bounds[0]) / vs);
        int ny = (int) Math.round((bounds[3] - bounds[2]) / vs);
        int nz = (int) Math.round((bounds[5] - bounds[4]) / vs);
        printf("   grid bounds: [ %7.3f, %7.3f], [%7.3f, %7.3f], [%7.3f, %7.3f] mm; vs: %7.3f mm\n",
                bounds[0] / MM, bounds[1] / MM, bounds[2] / MM, bounds[3] / MM, bounds[4] / MM, bounds[5] / MM,
                vs / MM);
        printf("  grid size: [%d x %d x %d]\n", nx, ny, nz);

        // range check bounds and voxelSized
        for (int i = 0; i < bounds.length; i++) {
            Float f = new Float(bounds[i]);
            if (f.isNaN()) {
                throw new IllegalArgumentException("Grid size[" + i + "] is Not a Number.");
            }

        }

        if (nx <= 0) {
            throw new IllegalArgumentException("Grid x size <= 0: " + nx);
        }
        if (ny <= 0) {
            throw new IllegalArgumentException("Grid y size <= 0" + ny);
        }
        if (nz <= 0) {
            throw new IllegalArgumentException("Grid z size <= 0" + nz);
        }

        AttributeGrid dest = null;

        if (grid == null) {
            dest = makeEmptyGrid(new int[] { nx, ny, nz }, vs);
        } else {
            dest = grid;
        }

        dest.setGridBounds(bounds);

        WaveletRasterizer rasterizer = new WaveletRasterizer(bounds, nx, ny, nz);
        rasterizer.setMaxAttributeValue(maxAttribute);

        tp.getTriangles(rasterizer);

        rasterizer.getRaster(dest);

        System.out.println("Loaded: " + filename);

        return dest;
    } catch (Throwable t) {
        t.printStackTrace();
    }
    throw Context.reportRuntimeError("Failed to load file: " + filename);
}

From source file:org.kordamp.ezmorph.object.BigDecimalMorpher.java

public Object morph(Object value) {
    if (value instanceof BigDecimal) {
        return value;
    }//from  w w w . java 2s  .c  om

    if (value == null) {
        if (isUseDefault()) {
            return defaultValue;
        } else {
            return (BigDecimal) null;
        }
    }

    if (value instanceof Number) {
        if (value instanceof Float) {
            Float f = ((Float) value);
            if (f.isInfinite() || f.isNaN()) {
                throw new MorphException("BigDecimal can not be infinite or NaN");
            }
        } else if (value instanceof Double) {
            Double d = ((Double) value);
            if (d.isInfinite() || d.isNaN()) {
                throw new MorphException("BigDecimal can not be infinite or NaN");
            }
        } else if (value instanceof BigInteger) {
            return new BigDecimal((BigInteger) value);
        }

        return new BigDecimal(((Number) value).doubleValue());
    } else {
        try {
            String str = String.valueOf(value).trim();
            if (str.length() == 0 || str.equalsIgnoreCase("null")) {
                return (BigDecimal) null;
            } else {
                return new BigDecimal(str);
            }
        } catch (NumberFormatException nfe) {
            if (isUseDefault()) {
                return defaultValue;
            } else {
                throw new MorphException(nfe);
            }
        }
    }
}

From source file:org.apache.predictionio.examples.java.recommendations.tutorial3.Evaluator.java

@Override
public Double evaluateUnit(Query query, Float predicted, Float actual) {
    logger.info("Q: " + query.toString() + " P: " + predicted + " A: " + actual);
    // return squared error
    double error;
    if (predicted.isNaN())
        error = -actual;/*from  w  ww  .  j  a va2 s  .  co  m*/
    else
        error = predicted - actual;
    return (error * error);
}

From source file:org.caleydo.view.tourguide.impl.PAGEAlgorithm.java

@Override
public void init(IProgressMonitor monitor) {
    if (!foldChanges.isEmpty())
        return;/*from  w ww . j  ava2s .  com*/

    final Set<Integer> inA = new HashSet<>(perspective.getVirtualArray().getIDsOfGroup(group.getGroupIndex()));
    ATableBasedDataDomain dataDomain = (ATableBasedDataDomain) perspective.getDataDomain();
    Table table = dataDomain.getTable();

    List<Integer> rows = perspective.getVirtualArray().getIDs();
    List<Integer> cols = table.getDefaultDimensionPerspective(false).getVirtualArray().getIDs();

    Stopwatch w = new Stopwatch().start();

    float sum = 0;
    float squaredSum = 0;

    for (Integer col : cols) {
        // mean of the expressions level of the samples for the given gen.
        float asum = 0;
        int acount = 0;
        float bsum = 0;
        int bcount = 0;
        for (Integer row : rows) {
            Float v = table.getRaw(col, row);
            if (v == null || v.isNaN() || v.isInfinite())
                continue;
            if (inA.contains(row)) {
                asum += v;
                acount++;
            } else {
                bsum += v;
                bcount++;
            }

        }
        if (monitor.isCanceled()) {
            foldChanges.clear(); // undo init
            return;
        }

        // now some kind of correlation between the two
        float foldChange = Statistics.foldChange((asum / acount), (bsum / bcount));
        Set<Integer> davids = dim2primary.apply(col);
        if (davids == null)
            continue;
        sum += foldChange * davids.size();
        squaredSum += (foldChange * foldChange) * davids.size();
        for (Integer david : davids)
            foldChanges.put(david, foldChange);
    }
    foldChangesMean = sum / foldChanges.size();
    foldChangesSD = (float) Math.sqrt(squaredSum / foldChanges.size() - foldChangesMean * foldChangesMean);
    System.out.println(w);
}

From source file:org.kordamp.ezmorph.object.BigIntegerMorpher.java

public Object morph(Object value) {
    if (value instanceof BigInteger) {
        return value;
    }//  w ww . ja v a 2  s .c  o  m

    if (value == null) {
        if (isUseDefault()) {
            return defaultValue;
        } else {
            return (BigInteger) null;
        }
    }

    if (value instanceof Number) {
        if (value instanceof Float) {
            Float f = ((Float) value);
            if (f.isInfinite() || f.isNaN()) {
                throw new MorphException("BigInteger can not be infinite or NaN");
            }
        } else if (value instanceof Double) {
            Double d = ((Double) value);
            if (d.isInfinite() || d.isNaN()) {
                throw new MorphException("BigInteger can not be infinite or NaN");
            }
        } else if (value instanceof BigDecimal) {
            return ((BigDecimal) value).toBigInteger();
        }
        return BigInteger.valueOf(((Number) value).longValue());
    } else {
        try {
            String str = getIntegerValue(value);
            if (str.length() == 0 || str.equalsIgnoreCase("null")) {
                return (BigInteger) null;
            } else {
                return new BigInteger(str);
            }
        } catch (NumberFormatException nfe) {
            if (isUseDefault()) {
                return defaultValue;
            } else {
                throw new MorphException(nfe);
            }
        }
    }
}

From source file:jason.architecture.JaCaRosArtifact.java

/***
 * Returns a very high value when a NaN is found 
 * @param value value to check if is NaN or not
 * @return 50000f//w w  w . j  av a  2  s  .  c o m
 */
public Float checkNan(Float value) {
    //logger1.info("JaCaRosArtifact >> checkNan(Float value)");
    if (value.isNaN()) {
        //logger1.info("JaCaRosArtifact >> checkNan(Float value): an NaN was found.");
        value = 50000f;
    }
    return value;
}

From source file:eu.uqasar.util.UQasarUtil.java

/**
 * Traverse the tree in postorder and update tree values
 * @param node/*  w  w w  .jav a 2s.com*/
 */
private static void postorder(TreeNode node) {

    if (node == null) {
        return;
    }

    logger.debug("------------postorder: " + node.getName() + "---------------");

    // Iterate the node children
    for (Object o : node.getChildren()) {
        TreeNode nodeChild = (TreeNode) o;
        UQasarUtil.postorder(nodeChild);
    }
    logger.debug("Traversing project tree in postorder..." + node.toString());
    // Update the value
    try {
        InitialContext ic = new InitialContext();
        AdapterDataService adapterDataService = new AdapterDataService();
        TreeNodeService treeNodeService = (TreeNodeService) ic.lookup("java:module/TreeNodeService");

        if (node instanceof Metric) {
            Metric metric = (Metric) node;
            logger.debug("Recomputing the value of the Metric " + node);
            Float value = null;
            if (metric.getMetricSource() == MetricSource.Manual) {
                metric.updateQualityStatus();
            } else {
                value = adapterDataService.getMetricValue(metric.getMetricSource(), metric.getMetricType(),
                        metric.getProject());
                metric.setValue(value);
            }
            metric.setLastUpdated(getLatestTreeUpdateDate());
            metric.addHistoricValue();
            // End Metric node treatment 
        } else if (node instanceof QualityIndicator) {
            logger.info("Recomputing the value of the Quality Indicator " + node);
            QualityIndicator qi = (QualityIndicator) node;
            if (qi.getUseFormula()) {
                String formulaToEval = Formula.parseFormula(qi.getViewFormula());
                if (formulaToEval != null && !formulaToEval.isEmpty()) {

                    Float computedValue = Formula.evalFormula(formulaToEval);
                    if (computedValue != null && !computedValue.isNaN()) {
                        qi.setValue(computedValue);
                        qi.setLastUpdated(getLatestTreeUpdateDate());
                        treeNodeService.update(qi);
                    }

                }
            } else {
                float achieved = 0;
                float denominator = 0;
                for (final TreeNode me : qi.getChildren()) {
                    float weight = ((Metric) me).getWeight();
                    if (me.getQualityStatus() == QualityStatus.Green) {
                        achieved += weight;
                    }
                    denominator += weight;
                }
                if (denominator == 0)
                    qi.getChildren().size();
                qi.setValue(achieved * 100 / denominator);
            }
            qi.setLastUpdated(getLatestTreeUpdateDate());
            qi.addHistoricValue();
            // End Q.Indicator node treatment 
        } else if (node instanceof QualityObjective) {
            logger.info("Recomputing the value of the Quality Objective " + node);
            QualityObjective qo = (QualityObjective) node;
            if (qo.getUseFormula()) {
                String formulaToEval = Formula.parseFormula(qo.getViewFormula());
                if (formulaToEval != null && !formulaToEval.isEmpty()) {

                    Float computedValue = Formula.evalFormula(formulaToEval);
                    if (computedValue != null && !computedValue.isNaN()) {
                        qo.setValue(computedValue);
                        qo.setLastUpdated(getLatestTreeUpdateDate());
                    }

                }
            } else {
                float denominator = 0;
                float achieved = 0;
                for (final TreeNode qi : qo.getChildren()) {
                    float weight = ((QualityIndicator) qi).getWeight();
                    if (qi.getQualityStatus() == QualityStatus.Green) {
                        achieved += weight;
                    }
                    denominator += weight;
                }
                qo.setValue(achieved * 100 / denominator);
            }
            qo.setLastUpdated(getLatestTreeUpdateDate());
            qo.addHistoricValue();
            // End Quality Objective node treatment 
        } else if (node instanceof Project) {
            logger.info("Recomputing the value of the Project " + node);
            Project prj = (Project) node;
            double qoValueSum = 0;
            double denominator = 0;
            for (Object o : node.getChildren()) {
                QualityObjective qo = (QualityObjective) o;
                if (qo.getWeight() == 0) {
                    continue;
                }
                qoValueSum += qo.getValue() * (prj.isFormulaAverage() ? qo.getWeight() : 1);
                denominator += prj.isFormulaAverage() ? qo.getWeight() : 1;
            }

            // bad idea to divide something under 0
            if (denominator == 0) {
                denominator = 1;
            }

            Double computedValue = qoValueSum / denominator;

            if (computedValue != null && !computedValue.isNaN() && !computedValue.isInfinite()) {
                prj.setValue(computedValue);
            }

            prj.setLastUpdated(getLatestTreeUpdateDate());
            prj.addHistoricValue();
            logger.debug(" [" + qoValueSum + "] denominator [" + denominator + "] " + computedValue);
            // End Project node treatment 
        }

        // Get a (possible) suggestion for the tree node
        Multimap<?, ?> suggestions = getSuggestionForNode(node);
        //TODO: take all the suggestions into account
        Object[] types = suggestions.keys().toArray();
        Object[] suggestionsValues = suggestions.values().toArray();
        if (types.length > 0) {
            // for now use the first item as suggestion
            SuggestionType stype = (SuggestionType) types[0];
            node.setSuggestionType(stype);
            if (suggestionsValues[0] != null && !suggestionsValues[0].equals("")) {
                node.setSuggestionValue((String) suggestionsValues[0]);
            }
        }

        treeNodeService.update(node);

    } catch (NamingException e) {
        e.printStackTrace();
    }

    return;
}

From source file:eu.uqasar.util.UQasarUtil.java

/**
 * Traverse the tree in postorder and update tree values
 * @param node/*from  w w w.j av a2 s.  c o  m*/
 */
private static void postorderWithParticularNode(TreeNode node, TreeNode projectTreeNode) {

    if (node == null) {
        return;
    }

    if (projectTreeNode == null) {
        return;
    }

    logger.debug("------------postorder: " + projectTreeNode.getName() + "---------------");

    logger.debug("Traversing project tree in postorder..." + projectTreeNode.toString());
    // Update the value
    try {
        InitialContext ic = new InitialContext();
        AdapterDataService adapterDataService = new AdapterDataService();
        TreeNodeService treeNodeService = (TreeNodeService) ic.lookup("java:module/TreeNodeService");

        if (projectTreeNode instanceof Metric) {
            Metric metric = (Metric) projectTreeNode;
            logger.debug("Recomputing the value of the Metric " + projectTreeNode);
            Float value = null;
            if (metric.getMetricSource() == MetricSource.Manual) {
                metric.updateQualityStatus();
            } else {
                value = adapterDataService.getMetricValue(metric.getMetricSource(), metric.getMetricType(),
                        metric.getProject());
                metric.setValue(value);
            }
            metric.setLastUpdated(getLatestTreeUpdateDate());
            metric.addHistoricValue();
            // End Metric node treatment 
        } else if (projectTreeNode instanceof QualityIndicator) {
            logger.info("Recomputing the value of the Quality Indicator " + projectTreeNode);
            QualityIndicator qi = (QualityIndicator) projectTreeNode;
            if (qi.getUseFormula()) {
                String formulaToEval = Formula.parseFormula(qi.getViewFormula());
                if (formulaToEval != null && !formulaToEval.isEmpty()) {

                    Float computedValue = Formula.evalFormula(formulaToEval);
                    if (computedValue != null && !computedValue.isNaN()) {
                        qi.setValue(computedValue);
                        qi.setLastUpdated(getLatestTreeUpdateDate());
                        treeNodeService.update(qi);
                    }

                }
            } else {
                float achieved = 0;
                float denominator = 0;
                for (final TreeNode me : qi.getChildren()) {
                    float weight = ((Metric) me).getWeight();
                    if (me.getQualityStatus() == QualityStatus.Green) {
                        achieved += weight;
                    }
                    denominator += weight;
                }
                if (denominator == 0)
                    qi.getChildren().size();
                qi.setValue(achieved * 100 / denominator);
            }
            qi.setLastUpdated(getLatestTreeUpdateDate());
            qi.addHistoricValue();
            // End Q.Indicator node treatment 
        } else if (projectTreeNode instanceof QualityObjective) {
            logger.info("Recomputing the value of the Quality Objective " + projectTreeNode);
            QualityObjective qo = (QualityObjective) projectTreeNode;
            if (qo.getUseFormula()) {
                String formulaToEval = Formula.parseFormula(qo.getViewFormula());
                if (formulaToEval != null && !formulaToEval.isEmpty()) {

                    Float computedValue = Formula.evalFormula(formulaToEval);
                    if (computedValue != null && !computedValue.isNaN()) {
                        qo.setValue(computedValue);
                        qo.setLastUpdated(getLatestTreeUpdateDate());
                    }

                }
            } else {
                float denominator = 0;
                float achieved = 0;
                for (final TreeNode qi : qo.getChildren()) {
                    float weight = ((QualityIndicator) qi).getWeight();
                    if (qi.getQualityStatus() == QualityStatus.Green) {
                        achieved += weight;
                    }
                    denominator += weight;
                }
                qo.setValue(achieved * 100 / denominator);
            }
            qo.setLastUpdated(getLatestTreeUpdateDate());
            qo.addHistoricValue();
            // End Quality Objective node treatment 
        } else if (projectTreeNode instanceof Project) {
            logger.info("Recomputing the value of the Project " + projectTreeNode);
            Project prj = (Project) projectTreeNode;
            double qoValueSum = 0;
            double denominator = 0;
            for (Object o : projectTreeNode.getChildren()) {
                QualityObjective qo = (QualityObjective) o;
                if (qo.getWeight() == 0) {
                    continue;
                }
                qoValueSum += qo.getValue() * (prj.isFormulaAverage() ? qo.getWeight() : 1);
                denominator += prj.isFormulaAverage() ? qo.getWeight() : 1;
            }

            // bad idea to divide something under 0
            if (denominator == 0) {
                denominator = 1;
            }

            Double computedValue = qoValueSum / denominator;

            if (computedValue != null && !computedValue.isNaN() && !computedValue.isInfinite()) {
                prj.setValue(computedValue);
            }

            prj.setLastUpdated(getLatestTreeUpdateDate());
            prj.addHistoricValue();
            logger.debug(" [" + qoValueSum + "] denominator [" + denominator + "] " + computedValue);
            // End Project node treatment 
        }

        // Get a (possible) suggestion for the tree node
        Multimap<?, ?> suggestions = getSuggestionForNode(projectTreeNode);
        //TODO: take all the suggestions into account
        Object[] types = suggestions.keys().toArray();
        Object[] suggestionsValues = suggestions.values().toArray();
        if (types.length > 0) {
            // for now use the first item as suggestion
            SuggestionType stype = (SuggestionType) types[0];
            projectTreeNode.setSuggestionType(stype);
            if (suggestionsValues[0] != null && !suggestionsValues[0].equals("")) {
                projectTreeNode.setSuggestionValue((String) suggestionsValues[0]);
            }
        }

        treeNodeService.update(projectTreeNode);

    } catch (NamingException e) {
        e.printStackTrace();
    }

    // Iterate the node children
    TreeNode nodeChild = projectTreeNode.getParent();
    UQasarUtil.postorderWithParticularNode(projectTreeNode, nodeChild);

    return;
}