Repository: NationalSecurityAgency/ghidra
File: Ghidra/Features/Base/src/main/java/ghidra/program/flatapi/FlatProgramAPI.java (Java)

Code before:
	/**
	 * Returns a list of all the symbols with the given name in the given namespace.
	 * @param name the name of the symbols to retrieve.
	 * @param namespace the namespace containing the symbols, or null for the global namespace.
	 * @return a list of all the symbols with the given name in the given namespace.
	 */
	public final List<Symbol> getSymbols(String name, Namespace namespace) {
		return currentProgram.getSymbolTable().getSymbols(name, namespace);
	}

	/**
	 * Returns the non-function namespace with the given name contained inside the
	 * specified parent namespace.
	 * Pass <code>null</code> for namespace to indicate the global namespace.
	 * @param parent the parent namespace, or null for global namespace
	 * @param namespaceName the requested namespace's name
	 * @return the namespace with the given name or null if not found
	 */
	public final Namespace getNamespace(Namespace parent, String namespaceName) {
		return currentProgram.getSymbolTable().getNamespace(namespaceName, parent);
	}
	
	/**
	 * Creates a new namespace with the given name contained inside the
	 * specified parent namespace.
	 * Pass <code>null</code> for namespace to indicate the global namespace.
	 * If a Namespace or GhidraClass with the given name already exists, the
	 * existing one will be returned.
	 * @param parent the parent namespace, or null for global namespace
	 * @param namespaceName the requested namespace's name
	 * @return the namespace with the given name
	 * @throws DuplicateNameException thrown if a {@link Library} symbol exists with the given name
	 * @throws InvalidInputException if the name is invalid
	 */
	public final Namespace createNamespace(Namespace parent, String namespaceName)
			throws DuplicateNameException, InvalidInputException {
		SymbolTable symbolTable = currentProgram.getSymbolTable();
		Namespace ns = symbolTable.getNamespace(namespaceName, parent);
		if (ns != null) {
			SymbolType type = ns.getSymbol().getSymbolType();
			if (type == SymbolType.NAMESPACE || type == SymbolType.CLASS) {
				return ns;
			}
		}
		return symbolTable.createNameSpace(parent, namespaceName, SourceType.USER_DEFINED);
	}
	
	/**
	 * Creates a new GhidraClass with the given name contained inside the
	 * specified parent namespace.
	 * Pass <code>null</code> for namespace to indicate the global namespace.

Review comment (suggestion):
"for namespace" should be "for parent" or "for parent namespace".  This comment also applies to `createClass` method.

Code after:
	/**
	 * Returns a list of all the symbols with the given name in the given namespace.
	 * @param name the name of the symbols to retrieve.
	 * @param namespace the namespace containing the symbols, or null for the global namespace.
	 * @return a list of all the symbols with the given name in the given namespace.
	 */
	public final List<Symbol> getSymbols(String name, Namespace namespace) {
		return currentProgram.getSymbolTable().getSymbols(name, namespace);
	}

	/**
	 * Returns the non-function namespace with the given name contained inside the
	 * specified parent namespace.
	 * Pass <code>null</code> for parent to indicate the global namespace.
	 * @param parent the parent namespace, or null for global namespace
	 * @param namespaceName the requested namespace's name
	 * @return the namespace with the given name or null if not found
	 */
	public final Namespace getNamespace(Namespace parent, String namespaceName) {
		return currentProgram.getSymbolTable().getNamespace(namespaceName, parent);
	}
	
/**
	 * Creates a new {@link Namespace} with the given name contained inside the
	 * specified parent namespace.
	 * Pass <code>null</code> for parent to indicate the global namespace.
	 * If a {@link Namespace} or {@link GhidraClass} with the given name already exists, the
	 * existing one will be returned.
	 * @param parent the parent namespace, or null for global namespace
	 * @param namespaceName the requested namespace's name
	 * @return the namespace with the given name
	 * @throws DuplicateNameException if a {@link Library} symbol exists with the given name
	 * @throws InvalidInputException if the name is invalid
	 */
	public final Namespace createNamespace(Namespace parent, String namespaceName)
			throws DuplicateNameException, InvalidInputException {
		SymbolTable symbolTable = currentProgram.getSymbolTable();
		Namespace ns = symbolTable.getNamespace(namespaceName, parent);
		if (ns != null) {
			SymbolType type = ns.getSymbol().getSymbolType();
			if (type == SymbolType.NAMESPACE || type == SymbolType.CLASS) {
				return ns;
			}
		}
		return symbolTable.createNameSpace(parent, namespaceName, SourceType.USER_DEFINED);
	}
	
	/**
	 * Creates a new {@link GhidraClass} with the given name contained inside the
	 * specified parent namespace.
	 * Pass <code>null</code> for parent to indicate the global namespace.