You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

IHierarchy.java 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /* *******************************************************************
  2. * Copyright (c) 2003,2010 Contributors
  3. * All rights reserved.
  4. * This program and the accompanying materials are made available
  5. * under the terms of the Eclipse Public License v1.0
  6. * which accompanies this distribution and is available at
  7. * http://www.eclipse.org/legal/epl-v10.html
  8. *
  9. * Contributors:
  10. * Mik Kersten initial implementation
  11. * Andy Clement
  12. * ******************************************************************/
  13. package org.aspectj.asm;
  14. import java.io.Serializable;
  15. import java.util.HashMap;
  16. import java.util.Map;
  17. import java.util.Set;
  18. import org.aspectj.asm.internal.ProgramElement;
  19. import org.aspectj.bridge.ISourceLocation;
  20. /**
  21. * @author Mik Kersten
  22. * @author Andy Clement
  23. */
  24. public interface IHierarchy extends Serializable {
  25. public static final IProgramElement NO_STRUCTURE = new ProgramElement(null, "<build to view structure>",
  26. IProgramElement.Kind.ERROR, null);
  27. public IProgramElement getElement(String handle);
  28. public IProgramElement getRoot();
  29. public void setRoot(IProgramElement root);
  30. public void addToFileMap(String canonicalFilePath, IProgramElement compilationUnitProgramElement);
  31. public boolean removeFromFileMap(String canonicalFilePath);
  32. public void setFileMap(HashMap<String, IProgramElement> fileMap);
  33. public Object findInFileMap(Object key);
  34. public Set<Map.Entry<String, IProgramElement>> getFileMapEntrySet();
  35. public boolean isValid();
  36. public IProgramElement findElementForHandle(String handle);
  37. public IProgramElement findElementForHandleOrCreate(String handle, boolean create);
  38. /**
  39. * Returns the first match
  40. *
  41. * @param parent
  42. * @param kind not null
  43. * @return null if not found
  44. */
  45. public IProgramElement findElementForSignature(IProgramElement parent, IProgramElement.Kind kind, String signature);
  46. /**
  47. * Returns the first match
  48. *
  49. * @param parent
  50. * @param kind not null
  51. * @return null if not found
  52. */
  53. public IProgramElement findElementForLabel(IProgramElement parent, IProgramElement.Kind kind, String label);
  54. /**
  55. * @param packageName if null default package is searched
  56. * @param className can't be null
  57. */
  58. public IProgramElement findElementForType(String packageName, String typeName);
  59. /**
  60. * @param sourceFilePath modified to '/' delimited path for consistency
  61. * @return a new structure node for the file if it was not found in the model
  62. */
  63. public IProgramElement findElementForSourceFile(String sourceFile);
  64. /**
  65. * TODO: discriminate columns
  66. */
  67. public IProgramElement findElementForSourceLine(ISourceLocation location);
  68. /**
  69. * Never returns null
  70. *
  71. * @param sourceFilePath canonicalized path for consistency
  72. * @param lineNumber if 0 or 1 the corresponding file node will be returned
  73. * @return a new structure node for the file if it was not found in the model
  74. */
  75. public IProgramElement findElementForSourceLine(String sourceFilePath, int lineNumber);
  76. public IProgramElement findElementForOffSet(String sourceFilePath, int lineNumber, int offSet);
  77. public String getConfigFile();
  78. public void setConfigFile(String configFile);
  79. public void flushTypeMap();
  80. public void flushHandleMap();
  81. public void updateHandleMap(Set<String> deletedFiles);
  82. /**
  83. * For a specified node, check if any of the children more accurately represent the specified line.
  84. *
  85. * @param node where to start looking
  86. * @param lineno the line number
  87. * @return any closer match below 'node' or null if nothing is a more accurate match
  88. */
  89. public IProgramElement findCloserMatchForLineNumber(IProgramElement node, int lineno);
  90. /**
  91. * Discover the node representing a particular source file.
  92. *
  93. * @param node where in the model to start looking (usually the root on the initial call)
  94. * @param sourcefilePath the source file being searched for
  95. * @return the node representing that source file or null if it cannot be found
  96. */
  97. public IProgramElement findNodeForSourceFile(IProgramElement node, String sourcefilePath);
  98. }