1. /*
  2. * Copyright 2004 The Apache Software Foundation.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package com.sun.org.apache.xerces.internal.dom;
  17. import java.util.Vector;
  18. import org.w3c.dom.DOMImplementationList;
  19. import org.w3c.dom.DOMImplementation;
  20. /**
  21. * <p>This class implements the DOM Level 3 Core interface DOMImplementationList.</p>
  22. *
  23. * @author Neil Delima, IBM
  24. * @since DOM Level 3 Core
  25. */
  26. public class DOMImplementationListImpl implements DOMImplementationList {
  27. //A collection of DOMImplementations
  28. private Vector fImplementations;
  29. /**
  30. * Construct an empty list of DOMImplementations
  31. */
  32. public DOMImplementationListImpl() {
  33. fImplementations = new Vector();
  34. }
  35. /**
  36. * Construct an empty list of DOMImplementations
  37. */
  38. public DOMImplementationListImpl(Vector params) {
  39. fImplementations = params;
  40. }
  41. /**
  42. * Returns the indexth item in the collection.
  43. *
  44. * @param index The index of the DOMImplemetation from the list to return.
  45. */
  46. public DOMImplementation item(int index) {
  47. try {
  48. return (DOMImplementation) fImplementations.elementAt(index);
  49. } catch (ArrayIndexOutOfBoundsException e) {
  50. return null;
  51. }
  52. }
  53. /**
  54. * Returns the number of DOMImplementations in the list.
  55. *
  56. * @return An integer indicating the number of DOMImplementations.
  57. */
  58. public int getLength() {
  59. return fImplementations.size();
  60. }
  61. }