Package model.devscore.couplings

Examples of model.devscore.couplings.MultiCoupling


    if (port1 == null) {
      throw new InvalidCouplingException(
          "Cannot use null as starting port of a coupling (" + name
              + ") starting model " + model1.getName() + "");
    }
    MultiCoupling coupling =
        new MultiCoupling(model1, port1, model2, name, selector);
    // only allow addition if models and ports are existent!
    if ((!subModels.contains(model1) && (this != model1))
        || !model1.hasPort(port1)) {
      throw new InvalidCouplingException(
          "Add coupling: Not existing model or port! " + model1.getName() + ":"
View Full Code Here


   *          of the coupling
   * @param targets
   *          the targets to be added
   */
  public void addToCoupling(String ident, MultiCouplingTargetList targets) {
    MultiCoupling mc = (MultiCoupling) getCoupling(ident);

    if (mc != null) {
      mc.addTargetList(targets);
    } else {
      throw new InvalidModelException(
          "BasicCoupledModel, addToCoupling: unknown coupling " + ident);
      // System.out.println();
    }
View Full Code Here

   * @param targets
   *          the targets to be removed
   */
  public void removeFromCoupling(String ident, MultiCouplingTargetList targets) {

    MultiCoupling mc = (MultiCoupling) getCoupling(ident);

    if (mc == null) {
      SimSystem.report(Level.WARNING,
          "BasicCoupledModel, removeFromCoupling: unknown coupling " + ident);
    } else {
      mc.removeTargetList(targets);
    }

  }
View Full Code Here

          }
        }
      } // if classcoupling
      else if (coupling instanceof MultiCoupling) {
        // get the next coupling
        MultiCoupling currentCoupling = (MultiCoupling) coupling;
        // this is an out coupling of the current childModel
        // backup a reference to the port
        IPort a = currentCoupling.getPort1();
        // get the number of elements stored at this out port
        int numberOfElements = a.getValuesCount();
        // if there are any elements
        if (numberOfElements > 0) {
          // retrieve vector containing the selected targets of this
          // classcoupling
          List<IBasicDEVSModel> targets =
              currentCoupling.getSelector().executeSelection(
                  currentCoupling.getTargetsAsArrayList());
          // create iterator for retrieved elements
          // Iterator targetIterator = targets.iterator();
          // System.out.println(currentCoupling.getTargetsAsArrayList().size());
          for (int j = 0; j < targets.size(); j++) {
            // retrieve current targetmodel
            IBasicDEVSModel targetModel = targets.get(j);
            // retrieve inputport for the given model
            String portname =
                (currentCoupling.getTargets().getTarget(targetModel))
                    .getPortName();
            IPort b = targetModel.getInPort(portname);

            copyPortValues(a, b, numberOfElements);
View Full Code Here

TOP

Related Classes of model.devscore.couplings.MultiCoupling

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.