Package org.jasen.interfaces

Examples of org.jasen.interfaces.JasenTestResult


        // Now, loop through the plugins in order and test...
        if(plugins != null) {

            PluginContainer container = null;
            JasenTestResult pluginResult = null;

            double[] probabilities = new double[plugins.size()];
            double[] pointProbabilities = null;
            int points = 0;
            float min = 0.0f;
            float max = 0.0f;
            int pointThreshold = 1;
            float prob = 0.5f;
            double finalProbability = 0.5d;
            boolean thresholdReached = false;

            String[][] testResults = new String[plugins.size()][4];

            long time;
           
            // Ensure the ignore list is sorted for the binary search
            if(ignored != null) {
                Arrays.sort(ignored);
            }

            for (int i = 0; i < plugins.size(); i++)
            {
                time = System.currentTimeMillis();

                container = (PluginContainer)plugins.get(i);
               
                // Determine if we should ignore this plugin
                if(ignored != null && ignored.length > 0 && Arrays.binarySearch(ignored, container.getName()) > -1) {
                    probabilities[i] =  JasenEngineConfiguration.getInstance().getGuess();
                   
                    testResults[i][RESULT_INDEX_PROBABILITY] = String.valueOf(probabilities[i])
                    testResults[i][RESULT_INDEX_TIME] = "0";
                    testResults[i][RESULT_INDEX_NAME] = container.getName();
                    testResults[i][RESULT_INDEX_PROBABILITY] = container.getDisplayName();
                }
                else
                {
                    try
                    {
                        pluginResult = container.getPlugin().test(this, mm, wrapper, parserData, parser);
                    }
                    catch (JasenException e)
                    {
                        // We couldn't execute this plugin... record the error and continue
                        ErrorHandlerBroker.getInstance().getErrorHandler().handleException(e);

                        probabilities[i] = JasenEngineConfiguration.getInstance().getGuess();
                    }

                    testResults[i][RESULT_INDEX_NAME] = container.getName();
                    testResults[i][RESULT_INDEX_DISPLAY] = container.getDisplayName();

                    if(pluginResult != null) {
                        if(pluginResult.isAbsolute()) {
                            // We know it's definately spam
                            result.setProbability(1.0d);

                            testResults[i][RESULT_INDEX_PROBABILITY] = "1.0";

                            // Stop processing here
                            return result;
                        }
                        else
                        {
                            probabilities[i] = pluginResult.calculateProbability();
                            testResults[i][RESULT_INDEX_PROBABILITY] = String.valueOf(probabilities[i]);
                        }
                    }
                    else
                    {
View Full Code Here

TOP

Related Classes of org.jasen.interfaces.JasenTestResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.