~ubuntu-branches/ubuntu/precise/classpath/precise

« back to all changes in this revision

Viewing changes to gnu/xml/xpath/Expr.java

  • Committer: Bazaar Package Importer
  • Author(s): Michael Koch
  • Date: 2006-05-27 16:11:15 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20060527161115-h6e39eposdt5snb6
Tags: 2:0.91-3
* Install header files to /usr/include/classpath.
* debian/control: classpath: Conflict with jamvm < 1.4.3 and
  cacao < 0.96 (Closes: #368172).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Expr.java -- 
2
 
   Copyright (C) 2004 Free Software Foundation, Inc.
 
2
   Copyright (C) 2004,2006 Free Software Foundation, Inc.
3
3
 
4
4
This file is part of GNU Classpath.
5
5
 
233
233
   */
234
234
  public static String _local_name(Node context, Collection nodeSet)
235
235
  {
236
 
    Node node = (nodeSet == null || nodeSet.size() == 0) ? context :
237
 
      firstNode(nodeSet);
238
 
    return node.getLocalName();
 
236
    if (nodeSet == null || nodeSet.isEmpty())
 
237
      return "";
 
238
    Node node = firstNode(nodeSet);
 
239
    String ret = node.getLocalName();
 
240
    return (ret == null) ? "" : ret;
239
241
  }
240
242
 
241
243
  /**
248
250
   */
249
251
  public static String _namespace_uri(Node context, Collection nodeSet)
250
252
  {
251
 
    Node node = (nodeSet == null || nodeSet.size() == 0) ? context :
252
 
      firstNode(nodeSet);
253
 
    return node.getNamespaceURI();
 
253
    if (nodeSet == null || nodeSet.isEmpty())
 
254
      return "";
 
255
    Node node = firstNode(nodeSet);
 
256
    String ret = node.getNamespaceURI();
 
257
    return (ret == null) ? "" : ret;
254
258
  }
255
259
  
256
260
  /**
271
275
   */
272
276
  public static String _name(Node context, Collection nodeSet)
273
277
  {
274
 
    Node node = (nodeSet == null || nodeSet.size() == 0) ? context :
275
 
      firstNode(nodeSet);
 
278
    if (nodeSet == null || nodeSet.isEmpty())
 
279
      return "";
 
280
    Node node = firstNode(nodeSet);
 
281
    String ret = null;
276
282
    switch (node.getNodeType())
277
283
      {
278
284
      case Node.ATTRIBUTE_NODE:
279
285
      case Node.ELEMENT_NODE:
280
286
      case Node.PROCESSING_INSTRUCTION_NODE:
281
 
        return node.getNodeName();
282
 
      default:
283
 
        return "";
 
287
        ret = node.getNodeName();
284
288
      }
 
289
    return (ret == null) ? "" : ret;
285
290
  }
286
291
 
287
292
  /**
371
376
      }
372
377
    if (object instanceof Double)
373
378
      {
374
 
        return ((Double) object).doubleValue() != 0.0;
 
379
        Double value = (Double) object;
 
380
        if (value.isNaN())
 
381
          return false;
 
382
        return value.doubleValue() != 0.0;
375
383
      }
376
384
    if (object instanceof String)
377
385
      {
473
481
      }
474
482
  }
475
483
 
 
484
  static int intValue(Object val)
 
485
  {
 
486
    if (val instanceof Double)
 
487
      {
 
488
        Double d = (Double) val;
 
489
        return d.isNaN() ? 0 : d.intValue();
 
490
      }
 
491
    else
 
492
      return (int) Math.ceil(_number(null, val));
 
493
  }
 
494
 
476
495
}