jaxp/src/com/sun/org/apache/xpath/internal/objects/XNull.java
author lana
Tue, 18 Mar 2014 17:49:48 -0700
changeset 23377 2af1ddf102a4
parent 12457 c348e06f0e82
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6
7f561c08de6b Initial load
duke
parents:
diff changeset
     1
/*
7f561c08de6b Initial load
duke
parents:
diff changeset
     2
 * reserved comment block
7f561c08de6b Initial load
duke
parents:
diff changeset
     3
 * DO NOT REMOVE OR ALTER!
7f561c08de6b Initial load
duke
parents:
diff changeset
     4
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
     5
/*
7f561c08de6b Initial load
duke
parents:
diff changeset
     6
 * Copyright 1999-2004 The Apache Software Foundation.
7f561c08de6b Initial load
duke
parents:
diff changeset
     7
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
     8
 * Licensed under the Apache License, Version 2.0 (the "License");
7f561c08de6b Initial load
duke
parents:
diff changeset
     9
 * you may not use this file except in compliance with the License.
7f561c08de6b Initial load
duke
parents:
diff changeset
    10
 * You may obtain a copy of the License at
7f561c08de6b Initial load
duke
parents:
diff changeset
    11
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    12
 *     http://www.apache.org/licenses/LICENSE-2.0
7f561c08de6b Initial load
duke
parents:
diff changeset
    13
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    14
 * Unless required by applicable law or agreed to in writing, software
7f561c08de6b Initial load
duke
parents:
diff changeset
    15
 * distributed under the License is distributed on an "AS IS" BASIS,
7f561c08de6b Initial load
duke
parents:
diff changeset
    16
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7f561c08de6b Initial load
duke
parents:
diff changeset
    17
 * See the License for the specific language governing permissions and
7f561c08de6b Initial load
duke
parents:
diff changeset
    18
 * limitations under the License.
7f561c08de6b Initial load
duke
parents:
diff changeset
    19
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    20
/*
7f561c08de6b Initial load
duke
parents:
diff changeset
    21
 * $Id: XNull.java,v 1.2.4.1 2005/09/14 20:34:46 jeffsuttor Exp $
7f561c08de6b Initial load
duke
parents:
diff changeset
    22
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    23
package com.sun.org.apache.xpath.internal.objects;
7f561c08de6b Initial load
duke
parents:
diff changeset
    24
7f561c08de6b Initial load
duke
parents:
diff changeset
    25
import com.sun.org.apache.xml.internal.dtm.DTM;
7f561c08de6b Initial load
duke
parents:
diff changeset
    26
import com.sun.org.apache.xpath.internal.XPathContext;
7f561c08de6b Initial load
duke
parents:
diff changeset
    27
7f561c08de6b Initial load
duke
parents:
diff changeset
    28
/**
7f561c08de6b Initial load
duke
parents:
diff changeset
    29
 * This class represents an XPath null object, and is capable of
7f561c08de6b Initial load
duke
parents:
diff changeset
    30
 * converting the null to other types, such as a string.
7f561c08de6b Initial load
duke
parents:
diff changeset
    31
 * @xsl.usage general
7f561c08de6b Initial load
duke
parents:
diff changeset
    32
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    33
public class XNull extends XNodeSet
7f561c08de6b Initial load
duke
parents:
diff changeset
    34
{
7f561c08de6b Initial load
duke
parents:
diff changeset
    35
    static final long serialVersionUID = -6841683711458983005L;
7f561c08de6b Initial load
duke
parents:
diff changeset
    36
7f561c08de6b Initial load
duke
parents:
diff changeset
    37
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    38
   * Create an XObject.
7f561c08de6b Initial load
duke
parents:
diff changeset
    39
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
    40
  public XNull()
7f561c08de6b Initial load
duke
parents:
diff changeset
    41
  {
7f561c08de6b Initial load
duke
parents:
diff changeset
    42
    super();
7f561c08de6b Initial load
duke
parents:
diff changeset
    43
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
    44
7f561c08de6b Initial load
duke
parents:
diff changeset
    45
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    46
   * Tell what kind of class this is.
7f561c08de6b Initial load
duke
parents:
diff changeset
    47
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
    48
   * @return type CLASS_NULL
7f561c08de6b Initial load
duke
parents:
diff changeset
    49
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
    50
  public int getType()
7f561c08de6b Initial load
duke
parents:
diff changeset
    51
  {
7f561c08de6b Initial load
duke
parents:
diff changeset
    52
    return CLASS_NULL;
7f561c08de6b Initial load
duke
parents:
diff changeset
    53
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
    54
7f561c08de6b Initial load
duke
parents:
diff changeset
    55
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    56
   * Given a request type, return the equivalent string.
7f561c08de6b Initial load
duke
parents:
diff changeset
    57
   * For diagnostic purposes.
7f561c08de6b Initial load
duke
parents:
diff changeset
    58
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
    59
   * @return type string "#CLASS_NULL"
7f561c08de6b Initial load
duke
parents:
diff changeset
    60
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
    61
  public String getTypeString()
7f561c08de6b Initial load
duke
parents:
diff changeset
    62
  {
7f561c08de6b Initial load
duke
parents:
diff changeset
    63
    return "#CLASS_NULL";
7f561c08de6b Initial load
duke
parents:
diff changeset
    64
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
    65
7f561c08de6b Initial load
duke
parents:
diff changeset
    66
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    67
   * Cast result object to a number.
7f561c08de6b Initial load
duke
parents:
diff changeset
    68
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
    69
   * @return 0.0
7f561c08de6b Initial load
duke
parents:
diff changeset
    70
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
    71
7f561c08de6b Initial load
duke
parents:
diff changeset
    72
  public double num()
7f561c08de6b Initial load
duke
parents:
diff changeset
    73
  {
7f561c08de6b Initial load
duke
parents:
diff changeset
    74
    return 0.0;
7f561c08de6b Initial load
duke
parents:
diff changeset
    75
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
    76
7f561c08de6b Initial load
duke
parents:
diff changeset
    77
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    78
   * Cast result object to a boolean.
7f561c08de6b Initial load
duke
parents:
diff changeset
    79
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
    80
   * @return false
7f561c08de6b Initial load
duke
parents:
diff changeset
    81
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
    82
  public boolean bool()
7f561c08de6b Initial load
duke
parents:
diff changeset
    83
  {
7f561c08de6b Initial load
duke
parents:
diff changeset
    84
    return false;
7f561c08de6b Initial load
duke
parents:
diff changeset
    85
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
    86
7f561c08de6b Initial load
duke
parents:
diff changeset
    87
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    88
   * Cast result object to a string.
7f561c08de6b Initial load
duke
parents:
diff changeset
    89
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
    90
   * @return empty string ""
7f561c08de6b Initial load
duke
parents:
diff changeset
    91
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
    92
  public String str()
7f561c08de6b Initial load
duke
parents:
diff changeset
    93
  {
7f561c08de6b Initial load
duke
parents:
diff changeset
    94
    return "";
7f561c08de6b Initial load
duke
parents:
diff changeset
    95
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
    96
7f561c08de6b Initial load
duke
parents:
diff changeset
    97
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    98
   * Cast result object to a result tree fragment.
7f561c08de6b Initial load
duke
parents:
diff changeset
    99
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
   100
   * @param support XPath context to use for the conversion
7f561c08de6b Initial load
duke
parents:
diff changeset
   101
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
   102
   * @return The object as a result tree fragment.
7f561c08de6b Initial load
duke
parents:
diff changeset
   103
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   104
  public int rtf(XPathContext support)
7f561c08de6b Initial load
duke
parents:
diff changeset
   105
  {
7f561c08de6b Initial load
duke
parents:
diff changeset
   106
    // DTM frag = support.createDocumentFragment();
7f561c08de6b Initial load
duke
parents:
diff changeset
   107
    // %REVIEW%
7f561c08de6b Initial load
duke
parents:
diff changeset
   108
    return DTM.NULL;
7f561c08de6b Initial load
duke
parents:
diff changeset
   109
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   110
7f561c08de6b Initial load
duke
parents:
diff changeset
   111
//  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   112
//   * Cast result object to a nodelist.
7f561c08de6b Initial load
duke
parents:
diff changeset
   113
//   *
7f561c08de6b Initial load
duke
parents:
diff changeset
   114
//   * @return null
7f561c08de6b Initial load
duke
parents:
diff changeset
   115
//   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   116
//  public DTMIterator iter()
7f561c08de6b Initial load
duke
parents:
diff changeset
   117
//  {
7f561c08de6b Initial load
duke
parents:
diff changeset
   118
//    return null;
7f561c08de6b Initial load
duke
parents:
diff changeset
   119
//  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   120
7f561c08de6b Initial load
duke
parents:
diff changeset
   121
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   122
   * Tell if two objects are functionally equal.
7f561c08de6b Initial load
duke
parents:
diff changeset
   123
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
   124
   * @param obj2 Object to compare this to
7f561c08de6b Initial load
duke
parents:
diff changeset
   125
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
   126
   * @return True if the given object is of type CLASS_NULL
7f561c08de6b Initial load
duke
parents:
diff changeset
   127
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   128
  public boolean equals(XObject obj2)
7f561c08de6b Initial load
duke
parents:
diff changeset
   129
  {
7f561c08de6b Initial load
duke
parents:
diff changeset
   130
    return obj2.getType() == CLASS_NULL;
7f561c08de6b Initial load
duke
parents:
diff changeset
   131
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   132
}