PageRenderTime 44ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/bundles/plugins-trunk/XML/xml/completion/EntityDecl.java

#
Java | 82 lines | 53 code | 11 blank | 18 comment | 7 complexity | 86e8ce14cc373e945f0152e08bbb130f MD5 | raw file
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
  1. /*
  2. * EntityDecl.java
  3. * :tabSize=8:indentSize=8:noTabs=false:
  4. * :folding=explicit:collapseFolds=1:
  5. *
  6. * Copyright (C) 2001 Slava Pestov
  7. *
  8. * The XML plugin is licensed under the GNU General Public License, with
  9. * the following exception:
  10. *
  11. * "Permission is granted to link this code with software released under
  12. * the Apache license version 1.1, for example used by the Xerces XML
  13. * parser package."
  14. */
  15. package xml.completion;
  16. import org.gjt.sp.jedit.MiscUtilities;
  17. import org.gjt.sp.util.StandardUtilities;
  18. import java.util.Comparator;
  19. public class EntityDecl
  20. {
  21. public static final int INTERNAL = 0;
  22. public static final int EXTERNAL = 1;
  23. public int type;
  24. public String name;
  25. public String value;
  26. public String publicId;
  27. public String systemId;
  28. //{{{ EntityDecl constructor
  29. public EntityDecl(int type, String name, String value)
  30. {
  31. this.type = type;
  32. this.name = name;
  33. this.value = value;
  34. } //}}}
  35. //{{{ EntityDecl constructor
  36. public EntityDecl(int type, String name, String publicId, String systemId)
  37. {
  38. this.type = type;
  39. this.name = name;
  40. this.publicId = publicId;
  41. this.systemId = systemId;
  42. } //}}}
  43. //{{{ toString() method
  44. public String toString()
  45. {
  46. if(type == INTERNAL)
  47. return getClass().getName() + "[" + name + "," + value + "]";
  48. else if(type == EXTERNAL)
  49. return getClass().getName() + "[" + name
  50. + "," + publicId + "," + systemId + "]";
  51. else
  52. return null;
  53. } //}}}
  54. //{{{ Compare class
  55. public static class Compare implements Comparator
  56. {
  57. public int compare(Object obj1, Object obj2)
  58. {
  59. EntityDecl entity1 = (EntityDecl)obj1;
  60. EntityDecl entity2 = (EntityDecl)obj2;
  61. if(entity1.type != entity2.type)
  62. return entity2.type - entity1.type;
  63. else
  64. {
  65. return StandardUtilities.compareStrings(
  66. entity1.name,
  67. entity2.name,true);
  68. }
  69. }
  70. } //}}}
  71. }