Skip to content

Commit

Permalink
CR: comments
Browse files Browse the repository at this point in the history
  • Loading branch information
radeusgd committed Jan 7, 2025
1 parent d913ce7 commit 5432f67
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,26 @@ public final class AtomTypeDefinition {
private final String name;
private final List<Constructor> constructors;

/**
* Constructs the type definition.
*
* @param name The simple name of the type, e.g. the "Name" in `type Name`
* @param constructors the list of constructor representations
*/
public AtomTypeDefinition(String name, List<Constructor> constructors) {
this.name = name;
this.constructors = constructors;
}

/** Returns the short name of the type. */
public String getName() {
return name;
}

/**
* Returns the constructor of the type with the given name, or {@code null} if a constructor with
* that name does not exist.
*/
public Constructor getConstructor(String name) {
return constructors.stream().filter(c -> c.name().equals(name)).findFirst().orElse(null);
}
Expand Down

0 comments on commit 5432f67

Please sign in to comment.