Class ModelInfoGenerator

java.lang.Object
network.ike.foundation.ike.model.ModelInfoGenerator

public final class ModelInfoGenerator extends Object
Writes a family of IKE's own patterns as model information (IKE-Network/ike-issues#1115), so that a library can be written against IKE's own knowledge. A pattern that carries the class mark for the model becomes a class whose identifier is the pattern's identity, so an import resolves it back to the pattern rather than making a concept; each field becomes an element whose type follows from the field's data type, a string to System's String, a boolean to Boolean, an integer to Integer, a decimal to Decimal, a concept to Code, a list of components to a list of Any, and anything else to Any; the mark says whether the class is retrievable and which field carries its code. The file requires the System model.
  • Constructor Details

    • ModelInfoGenerator

      public ModelInfoGenerator(dev.ikm.tinkar.coordinate.stamp.calculator.StampCalculator calculator)
      Creates a generator over a view.
      Parameters:
      calculator - the view that decides which versions count
  • Method Details

    • write

      public String write(String modelName, String version, String url)
      Writes the model information of a model of IKE's own.
      Parameters:
      modelName - the model's name, the one the marks name
      version - the version to write
      url - the url a library will qualify the model's types by
      Returns:
      the file's text
    • isMarked

      public boolean isMarked(long patternNid, String modelName)
      Whether a pattern carries a mark for a model.
      Parameters:
      patternNid - the pattern
      modelName - the model
      Returns:
      true when marked
    • nameOf

      public Optional<String> nameOf(long nid)
      The regular name of a component on this generator's view, for gates that compare an element with its field.
      Parameters:
      nid - the component
      Returns:
      the name, or empty