Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/* Copyright 2004 - 2007 Kasper Nielsen <kasper@codehaus.org> Licensed under
 * the Apache 2.0 License, see http://coconut.codehaus.org/license.
 */

import org.w3c.dom.Element;

public class Main {
    /**
     * Sets an attribute on the specified element with the specified name if the specified
     * value is different from the specified default value.
     *
     * @param base
     *            the Element to set the attribute on
     * @param name
     *            the attribute name
     * @param value
     *            the value that attribute should be set to
     * @param defaultValue
     *            the default value of the attribute
     */
    public static void attributeBooleanSet(Element base, String name, boolean value, boolean defaultValue) {
        if (value != defaultValue) {
            base.setAttribute(name, Boolean.toString(value));
        }
    }
}