Interface ModuleContract<T>

Type Parameters:
T - the type of object this contract validates
All Known Implementing Classes:
ProcessSystemContract, SeparatorContract, StreamContract, ThermodynamicSystemContract

public interface ModuleContract<T>
Base interface for module contracts.

Module contracts define what a component requires (preconditions) and provides (postconditions). AI agents can use these contracts to:

  • Validate setup before execution
  • Understand dependencies between modules
  • Self-correct when requirements are not met

Contract Pattern:


// Before running equipment
ValidationResult pre = contract.checkPreconditions(equipment);
if (!pre.isValid()) {
  // AI reads errors and fixes setup
}

equipment.run();

// Verify output is valid
ValidationResult post = contract.checkPostconditions(equipment);

Version:
1.0
Author:
NeqSim
  • Method Details

    • getContractName

      String getContractName()
      Get the name of this contract.
      Returns:
      contract name for logging/debugging
    • checkPreconditions

      ValidationResult checkPreconditions(T target)
      Check preconditions before execution.

      Validates that all requirements are met before running the module.

      Parameters:
      target - object to validate
      Returns:
      validation result with any precondition failures
    • checkPostconditions

      ValidationResult checkPostconditions(T target)
      Check postconditions after execution.

      Validates that the module produced valid output.

      Parameters:
      target - object to validate
      Returns:
      validation result with any postcondition failures
    • getRequirementsDescription

      String getRequirementsDescription()
      Get a description of what this module requires.

      AI agents can use this to understand setup requirements.

      Returns:
      human-readable requirements description
    • getProvidesDescription

      String getProvidesDescription()
      Get a description of what this module provides.

      AI agents can use this to understand available outputs.

      Returns:
      human-readable outputs description