/** * Resolves a reference from within this module to a symbol in the same module, an imported module * or in the whole mib * * @param idToken Token of the identifier that has to be resolved. * @param reporter If not null, the reporter will be used to reporter the not found error message. * @return The symbol that was found, or null. */ public SmiSymbol resolveReference(IdToken idToken, XRefProblemReporter reporter) { // doesn't work anymore with hardcoded missing symbols // if (!idToken.getLocation().getSource().equals(getIdToken().getLocation().getSource())) // { // // note this check is not entirely fool-proof in case multiple modules are located // in one file // throw new IllegalArgumentException("Resolving references is only allowed from // inside the same module"); // } SmiSymbol result = findSymbol(idToken.getId()); if (result == null) { result = findImportedSymbol(idToken.getId()); } if (result == null) { List<SmiSymbol> symbols = getMib().getSymbols().findAll(idToken.getId()); if (symbols.size() == 1) { result = symbols.get(0); } else if (symbols.size() > 0) { result = determineBestMatch(idToken, symbols); } } if (result == null && reporter != null) { reporter.reportCannotFindSymbol(idToken); } return result; }
public SmiModule(SmiMib mib, IdToken idToken) { m_mib = mib; if (idToken == null) { throw new IllegalArgumentException(); } setIdToken(idToken); m_isSmiDefinitionModule = SmiConstants.SMI_DEFINITION_MODULE_NAMES.contains(idToken.getId()); }
public String toString() { return m_idToken.toString(); }
public SmiRow createRow(IdToken idToken) { SmiRow row = new SmiRow(idToken, this); m_rowMap.put(idToken.getId(), row); return row; }
public SmiTable createTable(IdToken idToken) { SmiTable table = new SmiTable(idToken, this); m_tableMap.put(idToken.getId(), table); return table; }
public SmiType createType(IdToken idToken) { SmiType type = new SmiType(idToken, this); m_typeMap.put(idToken.getId(), type); return type; }
public String getId() { return m_idToken.getId(); }
public void setIdToken(IdToken id) { assert (m_idToken == null); m_idToken = id; m_mib.addModule(id.getId(), this); }