Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/*
 * FPInstructionUtils.java
 *
 * 6th may, 2007
 * (c) 2006 EduMips64 project - Trubia Massimo
 *
 * This file is part of the EduMIPS64 project, and is released under the GNU
 * General Public License.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

public class Main {
    static String PLUSINFINITY = "0111111111110000000000000000000000000000000000000000000000000000";
    static String MINUSINFINITY = "1111111111110000000000000000000000000000000000000000000000000000";
    static String PLUSZERO = "0000000000000000000000000000000000000000000000000000000000000000";
    static String MINUSZERO = "1000000000000000000000000000000000000000000000000000000000000000";
    final static String SNAN_NEW = "0111111111111111111111111111111111111111111111111111111111111111";
    final static String QNAN_NEW = "0111111111110111111111111111111111111111111111111111111111111111";

    /** determines if the passed string contains the keywords for special values
     * @param value a binary string or a string containing POSITIVEINFINITY,NEGATIVEINFINITY,POSITIVEZERO,NEGATIVEZERO,QNAN,SNAN
     * @return the proper binary string if value contains special values, or value itself if the string is not special*/
    public static String parseKeywords(String value) {
        if (value.compareToIgnoreCase("POSITIVEINFINITY") == 0) {
            return PLUSINFINITY;
        } else if (value.compareToIgnoreCase("NEGATIVEINFINITY") == 0) {
            return MINUSINFINITY;
        } else if (value.compareToIgnoreCase("POSITIVEZERO") == 0) {
            return PLUSZERO;
        } else if (value.compareToIgnoreCase("NEGATIVEZERO") == 0) {
            return MINUSZERO;
        } else if (value.compareToIgnoreCase("QNAN") == 0) {
            return QNAN_NEW;
        } else if (value.compareToIgnoreCase("SNAN") == 0) {
            return SNAN_NEW;
        }

        return value;
    }
}