Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
public interface IStyleRegistry {

    // To work with Style Stores
   
    String[] getAvailableStoreNames();
   
    IStyleStore getStore(String storeName);
   
   
    // To work with categories, this can be a separate service
    // Available category keys are filled from Rules of all available Stores
   
    String[] getAvailableCategoryKeys();
   
    String getCategoryValue(String categoryKey);
   
    void setCategoryCurrentValue(String categoryKey, String categoryValue);
   
    // Following methods are used to obtain cumulative IPlotterStyle
    // for particular region, object, action, and (possibly) categories
   
    IPlotterStyle getStyleForState(IPlotterState state);
}

IStyleStore interface:

Style Rule has type and value. Rule applies to the IPlotterState if state has approptiate type, and rule value is compatible with the state value. All Rules that are added to a particular Style are assumed to have "AND" groupping

Code Block
import hep.aida.IPlotterStyle;

/**
 * This interface can be implemented as "In-Memory" copy of persistent
 * facility, or as keeping live connections and committing any change
 * immediately.
 */

public interface IStyleStore {
   
    String getStoreName();
   
    String getStoreType();
   
    boolean isReadOnly();
   
   
    void addStyle(String styleName, IPlotterStyle style);
   
    boolean hasStyle(String styleName);
   
    IPlotterStyle getStyle(String styleName);
   
    /**
     * Remove Style and all Rules associated with it from the Store
     */
    IPlotterStyle removeStyle(String styleName);
   
    String[] getAllStyleNames();
   
    IStyleRule[] getRulesForStyle(String styleName);
   
    void addRuleForStyle(String styleName, IStyleRule rule);
   
    void setRuleForStyle(String styleName, IStyleRule rule);
   
    void removeRuleForStyle(String styleName, IStyleRule rule);
   
    void removeAllRulesForStyle(String styleName);
   
    /**
     * Write all information from Store to the undelying persistent
     * facility: XML file, database, etc.
     */
    void commit();
          
    /**
     * Close all connections and free all resources.
     * Store is not usable after this method is executed.
     */
    void close();
          
}

...

Code Block
public interface IStyleRule {

     // Possible types of Style Rules
     static int CLASS     = 0; // Class of the object: hep.aida.IHistogram1D
     static int PATH      = 1; // Position of the object in a Tree
     static int ORDER     = 2; // Order in the IPlotterRegion: specific number, or cyclical
     static int ATTRIBUTE = 3; // Arbitrary "key=value" pair, evalyated by the Rule
                               // From AIDA object's annotation any entry with "plotterState." prefix in key
                               // will be stripped of this prefix and put into PlotterState with ATTRIBUTE
                               // type before obtaining Style from the StyleRegistry
     static int ACTION    = 4; // What is going to happen with the object: plotting, printing
     static int CATEGORY  = 5; // "experiment=GLAST", "quality=preliminary"
                               // ACTION seems like a sub-type of CATEGORY: "printing=true"

     // Operations that chain rules together
     static int ANDOR  = 0;
     static int OR AND = 1;
     
     int getType();

     /**
      * Priority determines the order in which corresponding IPlotterStyle
      * should be used when assembling the cumulative IPlotterStyle
      */
      int getPriority();

     String getDescription();

     void addRule(IStyleRule rule, int operation);

     boolean ruleApplies(IPlotterState state);
}

...

IPlotterState interface:

Code Block
/** 
 * This object encapsulates information about relevant
 * IPlotterRegion, object, and actions.
 * It is used for obtaining implicit IPlotterStyle
 */
public interface IPlotterState {
     // IStyleRule types are used here
     String getValueForType(int styleRuleType);
}