Exemple #1
0
  public void buildTransitionTree() throws Exception {
    A2AConfiguration config = (A2AConfiguration) init.getConfiguration();
    C2CBubble context = init.getContext();

    if (config.isUnderspecified() && context == null)
      throw new A2AException("A2AConfiguration is underspecified");

    if (config.fixedLHSFocusAttribute() && config.fixedRHSFocusAttribute()) {

      Element _lhsFocusAttribute = config.getRoleElement(Roles.lhsFocusAttribute);
      Element _rhsFocusAttribute = config.getRoleElement(Roles.rhsFocusAttribute);
      this.configIt = new A2AConfigurationIterator();
      this.configIt.setDOMView(this.domView);
      this.configIt.setLHSFocusAttribute(_lhsFocusAttribute);
      this.configIt.setRHSFocusAttribute(_rhsFocusAttribute);
      this.configIt.setType(TYPE.allFixed);
    } else if (config.fixedLHSFocusAttribute()) {
      Element _lhsFocusAttribute = config.getRoleElement(Roles.lhsFocusAttribute);
      this.configIt = new A2AConfigurationIterator();
      this.configIt.setDOMView(this.domView);
      this.configIt.setLHSFocusAttribute(_lhsFocusAttribute);
      this.configIt.setType(TYPE.lhsFocusAttributeFixed);

    } else if (config.fixedRHSFocusAttribute()) {
      Element _rhsFocusAttribute = config.getRoleElement(Roles.rhsFocusAttribute);
      this.configIt = new A2AConfigurationIterator();
      this.configIt.setDOMView(this.domView);
      this.configIt.setRHSFocusAttribute(_rhsFocusAttribute);
      this.configIt.setType(TYPE.rhsFocusAttributeFixed);
    } else if (context != null) {
      this.configIt = new A2AConfigurationIterator();
      this.configIt.setDOMView(this.domView);
      this.configIt.setContext(context);
      this.configIt.setType(TYPE.contextFixed);
    } else {
      throw new Exception(
          "Initial configuration is underspecified. At least the LHS "
              + "or the RHS focus attribute or the C2C-context must be fixed");
    }
  }
Exemple #2
0
 /**
  * Returns if the given configuration contains a blacklisted element in role.
  *
  * @param _config
  * @param b
  * @return
  */
 public boolean filter(A2AConfiguration _config, A2ABubble b) {
   // filter configurations that contain a blacklisted role element
   Set<Entry<Role<A2A>, Element>> entries = _config.getRoles().entrySet();
   for (Entry<Role<A2A>, Element> entry : entries) {
     Role<A2A> r = entry.getKey();
     Element e = entry.getValue();
     if (b.getConfiguration().blacklistContains(r, e)) {
       logger.debug(
           "Filtering: A2A-Configuration contains blacklisted element "
               + e.getName()
               + " in role "
               + r);
       return true;
     }
   }
   return false;
 }