Class TaxModelRegistry

java.lang.Object
neqsim.process.fielddevelopment.economics.TaxModelRegistry

public final class TaxModelRegistry extends Object
Registry of tax model parameters for different countries and regions.

This class provides a centralized database of fiscal regime parameters for various oil and gas producing countries. Parameters are loaded from a JSON resource file at startup and can be extended with custom parameters at runtime.

Data Source

Parameters are loaded from data/fiscal/fiscal_parameters.json in the classpath. If the file is not found or cannot be parsed, hardcoded defaults are used as fallback.

Predefined Countries

  • NO - Norway (Norwegian Continental Shelf)
  • UK - United Kingdom (UKCS)
  • US-GOM - United States (Gulf of Mexico)
  • BR - Brazil (Concession regime)
  • BR-PSA - Brazil (Pre-Salt Production Sharing Agreement)
  • BR-DW - Brazil (Deep Water with Special Participation)
  • AO - Angola
  • NG - Nigeria
  • AU - Australia
  • MY - Malaysia
  • ID - Indonesia
  • AE - United Arab Emirates
  • CA-AB - Canada (Alberta)
  • GY - Guyana
  • EG - Egypt
  • KZ - Kazakhstan

Example Usage

// Get Norway parameters
FiscalParameters norway = TaxModelRegistry.getParameters("NO");

// Create a tax model
TaxModel model = TaxModelRegistry.createModel("NO");

// Get all available countries
List<String> countries = TaxModelRegistry.getAvailableCountries();

// Register custom parameters
FiscalParameters custom = FiscalParameters.builder("CUSTOM").countryName("Custom Country")
    .corporateTaxRate(0.30).build();
TaxModelRegistry.register(custom);

Customization

To add or modify country parameters:

  1. Edit the data/fiscal/fiscal_parameters.json file in resources
  2. Or call register(FiscalParameters) at runtime
  3. Or call loadFromJson(InputStream) to load a custom JSON file

Note: These parameters are for screening purposes only and should be validated against current regulations before making investment decisions.

Version:
1.0
Author:
ESOL
See Also:
  • Field Details

    • logger

      private static final org.apache.logging.log4j.Logger logger
      Logger for this class.
    • JSON_RESOURCE_PATH

      private static final String JSON_RESOURCE_PATH
      Path to the JSON resource file.
      See Also:
    • REGISTRY

      private static final Map<String, FiscalParameters> REGISTRY
  • Constructor Details

    • TaxModelRegistry

      private TaxModelRegistry()
  • Method Details

    • getParameters

      public static FiscalParameters getParameters(String countryCode)
      Gets fiscal parameters for a country.
      Parameters:
      countryCode - country code (e.g., "NO", "UK", "US-GOM")
      Returns:
      fiscal parameters, or null if not found
    • getParametersOrDefault

      public static FiscalParameters getParametersOrDefault(String countryCode, FiscalParameters fallback)
      Gets fiscal parameters for a country, with fallback.
      Parameters:
      countryCode - country code
      fallback - fallback parameters if country not found
      Returns:
      fiscal parameters
    • createModel

      public static TaxModel createModel(String countryCode)
      Creates a tax model for a country.
      Parameters:
      countryCode - country code
      Returns:
      tax model instance
      Throws:
      IllegalArgumentException - if country not found
    • register

      public static void register(FiscalParameters parameters)
      Registers custom fiscal parameters.
      Parameters:
      parameters - parameters to register
    • getAvailableCountries

      public static List<String> getAvailableCountries()
      Gets list of available country codes.
      Returns:
      list of country codes
    • getAllParameters

      public static Map<String, FiscalParameters> getAllParameters()
      Gets all registered parameters.
      Returns:
      unmodifiable map of all parameters
    • isRegistered

      public static boolean isRegistered(String countryCode)
      Checks if a country is registered.
      Parameters:
      countryCode - country code
      Returns:
      true if registered
    • getRegisteredCount

      public static int getRegisteredCount()
      Gets the number of registered countries.
      Returns:
      number of countries
    • reload

      public static boolean reload()
      Reloads parameters from the resource file.
      Returns:
      true if successfully loaded
    • loadFromJson

      public static int loadFromJson(InputStream inputStream)
      Loads fiscal parameters from a JSON input stream.

      This method can be used to load parameters from a custom JSON file.

      Parameters:
      inputStream - JSON input stream
      Returns:
      number of countries loaded
      Throws:
      IllegalArgumentException - if JSON is invalid
    • loadFromResource

      private static boolean loadFromResource()
      Loads parameters from the default resource file.
      Returns:
      true if loaded successfully
    • parseAndRegisterJson

      private static int parseAndRegisterJson(String jsonContent)
      Parses JSON content and registers all countries.
      Parameters:
      jsonContent - JSON string
      Returns:
      number of countries registered
    • parseCountryJson

      private static FiscalParameters parseCountryJson(com.google.gson.JsonObject json)
      Parses a single country JSON object into FiscalParameters.
      Parameters:
      json - country JSON object
      Returns:
      FiscalParameters instance
    • getStringOrDefault

      private static String getStringOrDefault(com.google.gson.JsonObject json, String key, String defaultValue)
    • getDoubleOrDefault

      private static double getDoubleOrDefault(com.google.gson.JsonObject json, String key, double defaultValue)
    • getIntOrDefault

      private static int getIntOrDefault(com.google.gson.JsonObject json, String key, int defaultValue)
    • getBooleanOrDefault

      private static boolean getBooleanOrDefault(com.google.gson.JsonObject json, String key, boolean defaultValue)
    • parseFiscalSystemType

      private static FiscalParameters.FiscalSystemType parseFiscalSystemType(String value)
    • parseDepreciationMethod

      private static FiscalParameters.DepreciationMethod parseDepreciationMethod(String value)
    • parseRingFenceLevel

      private static FiscalParameters.RingFenceLevel parseRingFenceLevel(String value)
    • initializeHardcodedDefaults

      private static void initializeHardcodedDefaults()
      Initializes hardcoded default countries (fallback if JSON fails).
    • getSummaryTable

      public static String getSummaryTable()
      Gets a summary table of all registered countries.
      Returns:
      formatted table string
    • repeatChar

      private static String repeatChar(char c, int n)
      Repeats a character n times (Java 8 compatible).
      Parameters:
      c - character to repeat
      n - number of times
      Returns:
      repeated string
    • truncate

      private static String truncate(String s, int maxLen)
      Truncates a string.
      Parameters:
      s - string to truncate
      maxLen - maximum length
      Returns:
      truncated string