⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 schemashort.java

📁 java 3d game jme 工程开发源代码
💻 JAVA
字号:
/**
 * SchemaShort.java
 *
 * This file was generated by XMLSpy 2007sp2 Enterprise Edition.
 *
 * YOU SHOULD NOT MODIFY THIS FILE, BECAUSE IT WILL BE
 * OVERWRITTEN WHEN YOU RE-RUN CODE GENERATION.
 *
 * Refer to the XMLSpy Documentation for further details.
 * http://www.altova.com/xmlspy
 */


package com.jmex.xml.types;

import java.math.BigDecimal;
import java.math.BigInteger;

public class SchemaShort implements SchemaTypeNumber {
  protected short value;
  protected boolean isempty;
  protected boolean isnull;

  // construction
  public SchemaShort() {
    setEmpty();
  }

  public SchemaShort(SchemaShort newvalue) {
    value = newvalue.value;
    isempty = newvalue.isempty;
    isnull = newvalue.isnull;
  }

  public SchemaShort(short newvalue) {
    setValue ((short) newvalue);
  }

  public SchemaShort(int newvalue) {
    setValue ((short)newvalue);
  }

  public SchemaShort(String newvalue) {
    parse(newvalue);
  }

  public SchemaShort(SchemaType newvalue) {
    assign( newvalue );
  }

  public SchemaShort(SchemaTypeNumber newvalue) {
    assign( (SchemaType)newvalue );
  }

  // getValue, setValue
  public short getValue() {
    return value;
  }

  public void setValue(short newvalue) {
    value = newvalue;
    isempty = false;
  }

  public void parse(String s) {
	  
	String newvalue = SchemaNormalizedString.normalize(SchemaNormalizedString.WHITESPACE_COLLAPSE, s);

    if( newvalue == null )
      setNull();
    else if( newvalue.length() == 0)
      setEmpty();
    else {
      value = Short.parseShort(newvalue);
      isempty = false;
      isnull = false;
    }
  }

  public void assign(SchemaType newvalue) {
    if( newvalue == null || newvalue.isNull() )
      setNull();
    else if( newvalue.isEmpty() )
      setEmpty();
    else if( newvalue instanceof SchemaTypeNumber) {
      value = (short) ( (SchemaTypeNumber) newvalue).intValue();
      isempty = false;
      isnull = false;
    }
    else
      throw new TypesIncompatibleException( newvalue, this );
  }

  public void setNull() {
    isnull = true;
    isempty = true;
    value = 0;
  }

  public void setEmpty() {
    isnull = false;
    isempty = true;
    value = 0;
  }

  // further
  public int hashCode() {
    return value;
  }

  public boolean equals(Object obj) {
    if (! (obj instanceof SchemaShort))
      return false;
    return value == ( (SchemaShort) obj).value;
  }

  public Object clone() {
    return new SchemaShort( this );
  }

  public String toString() {
    if( isempty || isnull )
      return "";
    return Short.toString(value);
  }

  public int length() {
    return toString().length();
  }

  public boolean booleanValue() {
    return value != 0;
  }

  public boolean isEmpty() {
    return isempty;
  }

  public boolean isNull() {
    return isnull;
  }

  public int compareTo(Object obj) {
    return compareTo( (SchemaShort) obj);
  }

  public int compareTo(SchemaShort obj) {
    return new Short(value).compareTo(new Short(obj.value));
  }

  // interface SchemaTypeNumber
  public int numericType() {
    return NUMERIC_VALUE_INT;
  }

  public int intValue() {
    return value;
  }

  public long longValue() {
    return value;
  }

  public BigInteger bigIntegerValue() {
    return BigInteger.valueOf(value);
  }

  public float floatValue() {
    return value;
  }

  public double doubleValue() {
    return value;
  }

  public BigDecimal bigDecimalValue() {
    return BigDecimal.valueOf(value);
  }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -