Examples of ParameterListDescriptor


Examples of javax.media.jai.ParameterListDescriptor

      } else {
    negStatus = 3;
      }
  }

  ParameterListDescriptor pld = getParameterListDescriptor();
  ParameterListDescriptor otherPld =
      capability.getParameterListDescriptor();
  String thisNames[] = pld.getParamNames();
        if (thisNames == null)
            thisNames = new String[0];
  String otherNames[] = otherPld.getParamNames();
        if (otherNames == null)
            otherNames = new String[0];
  Hashtable thisHash = hashNames(thisNames);
  Hashtable otherHash = hashNames(otherNames);

  Class thisClasses[] = pld.getParamClasses();
  Class otherClasses[] = otherPld.getParamClasses();
  Object thisDefaults[] = pld.getParamDefaults();
  Object otherDefaults[] = otherPld.getParamDefaults();

  NegotiableCapability result = null;
  String currParam;
  Negotiable thisValue, otherValue, resultValue;
  ArrayList resultGenerators = new ArrayList();
  if (generators != null)
      resultGenerators.addAll(generators);
  if (capability.getGenerators() != null)
      resultGenerators.addAll(capability.getGenerators());

  switch (negStatus) {

  case 0:

      Vector commonNames = commonElements(thisHash, otherHash);
      Hashtable commonHash = hashNames(commonNames);
      Vector thisExtras = removeAll(thisHash, commonHash);
      Vector otherExtras = removeAll(otherHash, commonHash);

      int thisExtraLength = thisExtras.size();
      int otherExtraLength = otherExtras.size();

      // Create a new PLD which is the amalgamation of the two
      // NC's PLD's
      Vector resultParams = new Vector(commonNames);
      resultParams.addAll(thisExtras);
      resultParams.addAll(otherExtras);
      int resultLength = resultParams.size();
      String resultNames[] = new String[resultLength];
      for (int i=0; i<resultLength; i++) {
    resultNames[i] = (String)resultParams.elementAt(i);
      }

      Class resultClasses[] = new Class[resultLength];
      Object resultDefaults[] = new Object[resultLength];
      Object resultValidValues[] = new Object[resultLength];
      String name;
      int count;
      for (count=0; count<commonNames.size(); count++) {
    name = (String)commonNames.elementAt(count);
    resultClasses[count] = thisClasses[getIndex(thisHash, name)];
    resultDefaults[count] = thisDefaults[getIndex(thisHash, name)];
    resultValidValues[count] = pld.getParamValueRange(name);
      }
      for (int i=0; i<thisExtraLength; i++) {
    name = (String)thisExtras.elementAt(i);
    resultClasses[count+i] = thisClasses[getIndex(thisHash, name)];
    resultDefaults[count+i] = thisDefaults[getIndex(thisHash,
                name)];
    resultValidValues[count+i] = pld.getParamValueRange(name);
      }
      count += thisExtraLength;
      for (int i=0; i<otherExtraLength; i++) {
    name = (String)otherExtras.elementAt(i);
    resultClasses[i+count] = otherClasses[getIndex(otherHash,
                     name)];
    resultDefaults[i+count] = otherDefaults[getIndex(otherHash,
                 name)];
    resultValidValues[i+count] = otherPld.getParamValueRange(name);
      }

      ParameterListDescriptorImpl resultPLD =
    new ParameterListDescriptorImpl(null,
            resultNames,
            resultClasses,
            resultDefaults,
            resultValidValues);

      // Both NC's are preferences
      result = new NegotiableCapability(category,
                capabilityName,
                resultGenerators,
                resultPLD,
                true);

      for (int i=0; i<commonNames.size(); i++) {
    currParam = (String)commonNames.elementAt(i);
    thisValue = (Negotiable)getObjectParameter(currParam);
    otherValue =
        (Negotiable)capability.getObjectParameter(currParam);

    // If one of the values is null, select the other one, and
    // negotiation succeeds. Note that this also takes care
    // of the scenario when both are null, therefore the result
    // is null, and on a non-pref, this would have failed the
    // negotiation, but on a pref, it doesn't, so we just set
    // null (otherValue) as the result and allow negotiation to
    // succeed.
    if (thisValue == null) {
        result.setParameter(currParam, otherValue);
        continue;
    }

    if (otherValue == null) {
        result.setParameter(currParam, thisValue);
        continue;
    }

    // Following only gets executed if neither of the two is
    // a null, and therefore both have set values. If negotiation
    // fails, the negotiation as a whole is failed, otherwise
    // set the result on the resultant NC.
    resultValue = thisValue.negotiate(otherValue);
    if (resultValue == null) {
        return null;
    }

    result.setParameter(currParam, resultValue);
      }

      // Copy the extra ones directly into the result
      for (int i=0; i<thisExtraLength; i++) {
    currParam = (String)thisExtras.elementAt(i);
    result.setParameter(currParam,
            (Negotiable)getObjectParameter(currParam));
      }

      for (int i=0; i<otherExtraLength; i++) {
    currParam = (String)otherExtras.elementAt(i);
    result.setParameter(currParam,
       (Negotiable)capability.getObjectParameter(currParam));
      }

      break;

  case 1:

      // The given capability is a pref, while this is a non-pref
      commonNames = commonElements(thisHash, otherHash);
      commonHash = hashNames(commonNames);
      thisExtras = removeAll(thisHash, commonHash);

      // Create a new PLD which is the amalgamation of the two
      // NC's PLD's
      resultParams = new Vector(commonNames);
      resultParams.addAll(thisExtras);
      resultLength = resultParams.size();
      resultNames = new String[resultLength];
      for (int i=0; i<resultLength; i++) {
    resultNames[i] = (String)resultParams.elementAt(i);
      }

      resultClasses = new Class[resultLength];
      resultDefaults = new Object[resultLength];
      resultValidValues = new Object[resultLength];

      count = 0;
      for (count=0; count<commonNames.size(); count++) {
    name = (String)commonNames.elementAt(count);
    resultClasses[count] = thisClasses[getIndex(thisHash, name)];
    resultDefaults[count] = thisDefaults[getIndex(thisHash, name)];
    resultValidValues[count] = pld.getParamValueRange(name);
      }
      for (int i=0; i<thisExtras.size(); i++) {
    name = (String)thisExtras.elementAt(i);
    resultClasses[i+count] = thisClasses[getIndex(thisHash, name)];
    resultDefaults[i+count] = thisDefaults[getIndex(thisHash,
                name)];
    resultValidValues[i+count] = pld.getParamValueRange(name);
      }

      resultPLD = new ParameterListDescriptorImpl(null,
              resultNames,
              resultClasses,
              resultDefaults,
              resultValidValues);

      result = new NegotiableCapability(category,
                capabilityName,
                resultGenerators,
                resultPLD,
                false);

      for (int i=0; i<commonNames.size(); i++) {
    currParam = (String)commonNames.elementAt(i);
    thisValue = (Negotiable)getObjectParameter(currParam);
    otherValue =
        (Negotiable)capability.getObjectParameter(currParam);

    if (thisValue == null) {
        // If non-pref doesn't have value, negotiation fails right
        // away
        return null;
    }

    if (otherValue == null) {
        // If pref value is null, then non-pref's value wins.
        // This needs to be done separately, since
        // non-null.negotiate(null) returns null, which is *not*
        // what we want.
        result.setParameter(currParam, thisValue);
    } else {
        // Do the negotiation.
        resultValue = thisValue.negotiate(otherValue);

        if (resultValue == null) {
      // Negotiation on one parameter failed, so negotiation
      // on the entire NC has also failed, return null to
      // signify this
      return null;
        } else {
      result.setParameter(currParam, resultValue);
        }
    }
      }

      // Copy the extra ones directly into the result
      for (int i=0; i<thisExtras.size(); i++) {
    currParam = (String)thisExtras.elementAt(i);
    resultValue = (Negotiable)getObjectParameter(currParam);
    if (resultValue == null)
        return null;
    result.setParameter(currParam, resultValue);
      }

      break;

  case 2:

      // The given capability is a non-pref, while this is a pref
      commonNames = commonElements(thisHash, otherHash);
      commonHash = hashNames(commonNames);
      otherExtras = removeAll(otherHash, commonHash);

      // Create a new PLD which is the amalgamation of the two
      // NC's PLD's
      resultParams = new Vector(commonNames);
      resultParams.addAll(otherExtras);
      resultLength = resultParams.size();
      resultNames = new String[resultLength];
      for (int i=0; i<resultLength; i++) {
    resultNames[i] = (String)resultParams.elementAt(i);
      }

      resultClasses = new Class[resultLength];
      resultDefaults = new Object[resultLength];
      resultValidValues = new Object[resultLength];
      count = 0;
      for (count=0; count<commonNames.size(); count++) {
    name = (String)commonNames.elementAt(count);
    resultClasses[count] = thisClasses[getIndex(thisHash, name)];
    resultDefaults[count] = thisDefaults[getIndex(thisHash, name)];
    resultValidValues[count] = pld.getParamValueRange(name);
      }

      for (int i=0; i<otherExtras.size(); i++) {
    name = (String)otherExtras.elementAt(i);
    resultClasses[i+count] = otherClasses[getIndex(otherHash,
                     name)];
    resultDefaults[i+count] = otherDefaults[getIndex(otherHash,
                 name)];
    resultValidValues[i+count] = otherPld.getParamValueRange(name);
      }

      resultPLD = new ParameterListDescriptorImpl(null,
              resultNames,
              resultClasses,
View Full Code Here

Examples of javax.media.jai.ParameterListDescriptor

  if (other == null) {
      throw new IllegalArgumentException(
          JaiI18N.getString("NegotiableCapability6"));
  }

  ParameterListDescriptor thisDesc = getParameterListDescriptor();
  ParameterListDescriptor otherDesc = other.getParameterListDescriptor();

  String thisNames[] = thisDesc.getParamNames();
        if (thisNames == null)
            thisNames = new String[0];
  String otherNames[] = otherDesc.getParamNames();
        if (otherNames == null)
            otherNames = new String[0];
  Hashtable thisHash = hashNames(thisNames);
  Hashtable otherHash = hashNames(otherNames);

  if (isPreference == false && other.isPreference() == false) {

      // The number of parameters must be the same.
      if (thisDesc.getNumParameters() != otherDesc.getNumParameters())
    return false;

      // The same names should be present in both in the same order.
      if (containsAll(thisHash, otherHash) == false)
    return false;

      Class thisParamClasses[] = thisDesc.getParamClasses();
      Class otherParamClasses[] = otherDesc.getParamClasses();
      for (int i=0; i<thisNames.length; i++) {
    if (thisParamClasses[i] !=
                    otherParamClasses[getIndex(otherHash, thisNames[i])])
        return false;
      }

      return true;

  } else {

      Vector commonNames = commonElements(thisHash, otherHash);

      Class thisParamClasses[] = thisDesc.getParamClasses();
      Class otherParamClasses[] = otherDesc.getParamClasses();
      String currName;
      for (int i=0; i<commonNames.size(); i++) {
    currName = (String)commonNames.elementAt(i);
    if (thisParamClasses[getIndex(thisHash, currName)] !=
        otherParamClasses[getIndex(otherHash, currName)])
View Full Code Here

Examples of javax.media.jai.ParameterListDescriptor

  } else {

      // If the supplied parameterList is null and the default one is
      // null too, then check whether this format supports no parameters
      ParameterListDescriptor pld =
    tcd.getParameterListDescriptor("tileDecoder");

      // Check whether a non-null samplemodel value is needed
      if (tcd.includesSampleModelInfo() == false) {
    // SampleModel must be specified via the parameter list
    throw new IllegalArgumentException(
            JaiI18N.getString("TileDecoderImpl5"));
      }

      // If the PLD is not null and says that there are supposed to
      // be some parameters (numParameters returns non-zero value)
      // throw an IllegalArgumentException
      if (pld != null && pld.getNumParameters() != 0) {
    throw new IllegalArgumentException(
          JaiI18N.getString("TileDecoderImpl6"));
      }
  }
View Full Code Here

Examples of javax.media.jai.ParameterListDescriptor

  } else {

      // If the supplied parameterList is null and the default one is
      // null too, then check whether this format supports no parameters
      ParameterListDescriptor pld =
    tcd.getParameterListDescriptor("tileEncoder");

      // If the PLD is not null and says that there are supposed to
      // be some parameters (numParameters returns non-zero value)
      // throw an IllegalArgumentException
      if (pld != null && pld.getNumParameters() != 0) {
    throw new IllegalArgumentException(
          JaiI18N.getString("TileDecoderImpl6"));
      }
  }
View Full Code Here

Examples of javax.media.jai.ParameterListDescriptor

/*  885 */       if ((!tcd.includesSampleModelInfo()) || (!tcd.includesLocationInfo()))
/*      */       {
/*  887 */         throw new RemoteImagingException(JaiI18N.getString("RMIServerProxy1"));
/*      */       }
/*      */
/*  891 */       ParameterListDescriptor pld = tcd.getParameterListDescriptor("tileDecoder");
/*      */
/*  894 */       tcpl = new TileCodecParameterList(capabilityName, new String[] { "tileDecoder" }, pld);
/*      */
/*  900 */       if (pld != null)
/*      */       {
/*  902 */         String[] paramNames = pld.getParamNames();
/*      */
/*  905 */         if (paramNames != null) {
/*  906 */           for (int i = 0; i < paramNames.length; i++) { String currParam = paramNames[i];
/*      */             Object currValue;
/*      */             try { currValue = codecCap.getNegotiatedValue(currParam); }
View Full Code Here

Examples of javax.media.jai.ParameterListDescriptor

/*  466 */       if ((!tcd.includesSampleModelInfo()) || (!tcd.includesLocationInfo()))
/*      */       {
/*  468 */         throw new RuntimeException(JaiI18N.getString("JAIRMIImageServer1"));
/*      */       }
/*      */
/*  472 */       ParameterListDescriptor pld = tcd.getParameterListDescriptor("tileEncoder");
/*      */
/*  475 */       tcpl = new TileCodecParameterList(capabilityName, new String[] { "tileEncoder" }, pld);
/*      */
/*  479 */       if (pld != null)
/*      */       {
/*  481 */         String[] paramNames = pld.getParamNames();
/*      */
/*  485 */         if (paramNames != null) {
/*  486 */           for (int i = 0; i < paramNames.length; i++) { String currParam = paramNames[i];
/*      */             Object currValue;
/*      */             try { currValue = codecCap.getNegotiatedValue(currParam);
View Full Code Here

Examples of javax.media.jai.ParameterListDescriptor

/*      */
/*  262 */     if (capabilityName == null) {
/*  263 */       throw new IllegalArgumentException(JaiI18N.getString("NegotiableCapability1"));
/*      */     }
/*      */
/*  267 */     ParameterListDescriptor desc = getParameterListDescriptor();
/*  268 */     int numParams = desc.getNumParameters();
/*  269 */     String[] names = desc.getParamNames();
/*  270 */     Class[] classes = desc.getParamClasses();
/*  271 */     Object[] defaults = desc.getParamDefaults();
/*      */
/*  273 */     for (int i = 0; i < numParams; i++)
/*      */     {
/*  276 */       if (!Negotiable.class.isAssignableFrom(classes[i])) {
/*  277 */         throw new IllegalArgumentException(JaiI18N.getString("NegotiableCapability4"));
View Full Code Here

Examples of javax.media.jai.ParameterListDescriptor

/*      */       else {
/*  468 */         negStatus = 3;
/*      */       }
/*      */     }
/*      */
/*  472 */     ParameterListDescriptor pld = getParameterListDescriptor();
/*  473 */     ParameterListDescriptor otherPld = capability.getParameterListDescriptor();
/*      */
/*  475 */     String[] thisNames = pld.getParamNames();
/*  476 */     if (thisNames == null)
/*  477 */       thisNames = new String[0];
/*  478 */     String[] otherNames = otherPld.getParamNames();
/*  479 */     if (otherNames == null)
/*  480 */       otherNames = new String[0];
/*  481 */     Hashtable thisHash = hashNames(thisNames);
/*  482 */     Hashtable otherHash = hashNames(otherNames);
/*      */
/*  484 */     Class[] thisClasses = pld.getParamClasses();
/*  485 */     Class[] otherClasses = otherPld.getParamClasses();
/*  486 */     Object[] thisDefaults = pld.getParamDefaults();
/*  487 */     Object[] otherDefaults = otherPld.getParamDefaults();
/*      */
/*  489 */     NegotiableCapability result = null;
/*      */
/*  492 */     ArrayList resultGenerators = new ArrayList();
/*  493 */     if (this.generators != null)
/*  494 */       resultGenerators.addAll(this.generators);
/*  495 */     if (capability.getGenerators() != null)
/*  496 */       resultGenerators.addAll(capability.getGenerators());
/*      */     Vector commonNames;
/*      */     Hashtable commonHash;
/*      */     Vector thisExtras;
/*      */     Vector otherExtras;
/*      */     Vector resultParams;
/*      */     int resultLength;
/*      */     String[] resultNames;
/*      */     Class[] resultClasses;
/*      */     Object[] resultDefaults;
/*      */     Object[] resultValidValues;
/*      */     int count;
/*      */     ParameterListDescriptorImpl resultPLD;
/*  498 */     switch (negStatus)
/*      */     {
/*      */     case 0:
/*  502 */       commonNames = commonElements(thisHash, otherHash);
/*  503 */       commonHash = hashNames(commonNames);
/*  504 */       thisExtras = removeAll(thisHash, commonHash);
/*  505 */       otherExtras = removeAll(otherHash, commonHash);
/*      */
/*  507 */       int thisExtraLength = thisExtras.size();
/*  508 */       int otherExtraLength = otherExtras.size();
/*      */
/*  512 */       resultParams = new Vector(commonNames);
/*  513 */       resultParams.addAll(thisExtras);
/*  514 */       resultParams.addAll(otherExtras);
/*  515 */       resultLength = resultParams.size();
/*  516 */       resultNames = new String[resultLength];
/*  517 */       for (int i = 0; i < resultLength; i++) {
/*  518 */         resultNames[i] = ((String)resultParams.elementAt(i));
/*      */       }
/*      */
/*  521 */       resultClasses = new Class[resultLength];
/*  522 */       resultDefaults = new Object[resultLength];
/*  523 */       resultValidValues = new Object[resultLength];
/*      */
/*  526 */       for (count = 0; count < commonNames.size(); count++) {
/*  527 */         String name = (String)commonNames.elementAt(count);
/*  528 */         resultClasses[count] = thisClasses[getIndex(thisHash, name)];
/*  529 */         resultDefaults[count] = thisDefaults[getIndex(thisHash, name)];
/*  530 */         resultValidValues[count] = pld.getParamValueRange(name);
/*      */       }
/*  532 */       for (int i = 0; i < thisExtraLength; i++) {
/*  533 */         String name = (String)thisExtras.elementAt(i);
/*  534 */         resultClasses[(count + i)] = thisClasses[getIndex(thisHash, name)];
/*  535 */         resultDefaults[(count + i)] = thisDefaults[getIndex(thisHash, name)];
/*      */
/*  537 */         resultValidValues[(count + i)] = pld.getParamValueRange(name);
/*      */       }
/*  539 */       count += thisExtraLength;
/*  540 */       for (int i = 0; i < otherExtraLength; i++) {
/*  541 */         String name = (String)otherExtras.elementAt(i);
/*  542 */         resultClasses[(i + count)] = otherClasses[getIndex(otherHash, name)];
/*      */
/*  544 */         resultDefaults[(i + count)] = otherDefaults[getIndex(otherHash, name)];
/*      */
/*  546 */         resultValidValues[(i + count)] = otherPld.getParamValueRange(name);
/*      */       }
/*      */
/*  549 */       resultPLD = new ParameterListDescriptorImpl(null, resultNames, resultClasses, resultDefaults, resultValidValues);
/*      */
/*  557 */       result = new NegotiableCapability(this.category, this.capabilityName, resultGenerators, resultPLD, true);
/*      */
/*  563 */       for (int i = 0; i < commonNames.size(); i++) {
/*  564 */         String currParam = (String)commonNames.elementAt(i);
/*  565 */         Negotiable thisValue = (Negotiable)getObjectParameter(currParam);
/*  566 */         Negotiable otherValue = (Negotiable)capability.getObjectParameter(currParam);
/*      */
/*  576 */         if (thisValue == null) {
/*  577 */           result.setParameter(currParam, otherValue);
/*      */         }
/*  581 */         else if (otherValue == null) {
/*  582 */           result.setParameter(currParam, thisValue);
/*      */         }
/*      */         else
/*      */         {
/*  590 */           Negotiable resultValue = thisValue.negotiate(otherValue);
/*  591 */           if (resultValue == null) {
/*  592 */             return null;
/*      */           }
/*      */
/*  595 */           result.setParameter(currParam, resultValue);
/*      */         }
/*      */       }
/*      */
/*  599 */       for (int i = 0; i < thisExtraLength; i++) {
/*  600 */         String currParam = (String)thisExtras.elementAt(i);
/*  601 */         result.setParameter(currParam, (Negotiable)getObjectParameter(currParam));
/*      */       }
/*      */
/*  605 */       for (int i = 0; i < otherExtraLength; i++) {
/*  606 */         String currParam = (String)otherExtras.elementAt(i);
/*  607 */         result.setParameter(currParam, (Negotiable)capability.getObjectParameter(currParam));
/*      */       }
/*      */
/*  611 */       break;
/*      */     case 1:
/*  616 */       commonNames = commonElements(thisHash, otherHash);
/*  617 */       commonHash = hashNames(commonNames);
/*  618 */       thisExtras = removeAll(thisHash, commonHash);
/*      */
/*  622 */       resultParams = new Vector(commonNames);
/*  623 */       resultParams.addAll(thisExtras);
/*  624 */       resultLength = resultParams.size();
/*  625 */       resultNames = new String[resultLength];
/*  626 */       for (int i = 0; i < resultLength; i++) {
/*  627 */         resultNames[i] = ((String)resultParams.elementAt(i));
/*      */       }
/*      */
/*  630 */       resultClasses = new Class[resultLength];
/*  631 */       resultDefaults = new Object[resultLength];
/*  632 */       resultValidValues = new Object[resultLength];
/*      */
/*  634 */       count = 0;
/*  635 */       for (count = 0; count < commonNames.size(); count++) {
/*  636 */         String name = (String)commonNames.elementAt(count);
/*  637 */         resultClasses[count] = thisClasses[getIndex(thisHash, name)];
/*  638 */         resultDefaults[count] = thisDefaults[getIndex(thisHash, name)];
/*  639 */         resultValidValues[count] = pld.getParamValueRange(name);
/*      */       }
/*  641 */       for (int i = 0; i < thisExtras.size(); i++) {
/*  642 */         String name = (String)thisExtras.elementAt(i);
/*  643 */         resultClasses[(i + count)] = thisClasses[getIndex(thisHash, name)];
/*  644 */         resultDefaults[(i + count)] = thisDefaults[getIndex(thisHash, name)];
/*      */
/*  646 */         resultValidValues[(i + count)] = pld.getParamValueRange(name);
/*      */       }
/*      */
/*  649 */       resultPLD = new ParameterListDescriptorImpl(null, resultNames, resultClasses, resultDefaults, resultValidValues);
/*      */
/*  655 */       result = new NegotiableCapability(this.category, this.capabilityName, resultGenerators, resultPLD, false);
/*      */
/*  661 */       for (int i = 0; i < commonNames.size(); i++) {
/*  662 */         String currParam = (String)commonNames.elementAt(i);
/*  663 */         Negotiable thisValue = (Negotiable)getObjectParameter(currParam);
/*  664 */         Negotiable otherValue = (Negotiable)capability.getObjectParameter(currParam);
/*      */
/*  667 */         if (thisValue == null)
/*      */         {
/*  670 */           return null;
/*      */         }
/*      */
/*  673 */         if (otherValue == null)
/*      */         {
/*  678 */           result.setParameter(currParam, thisValue);
/*      */         }
/*      */         else {
/*  681 */           Negotiable resultValue = thisValue.negotiate(otherValue);
/*      */
/*  683 */           if (resultValue == null)
/*      */           {
/*  687 */             return null;
/*      */           }
/*  689 */           result.setParameter(currParam, resultValue);
/*      */         }
/*      */
/*      */       }
/*      */
/*  695 */       for (int i = 0; i < thisExtras.size(); i++) {
/*  696 */         String currParam = (String)thisExtras.elementAt(i);
/*  697 */         Negotiable resultValue = (Negotiable)getObjectParameter(currParam);
/*  698 */         if (resultValue == null)
/*  699 */           return null;
/*  700 */         result.setParameter(currParam, resultValue);
/*      */       }
/*      */
/*  703 */       break;
/*      */     case 2:
/*  708 */       commonNames = commonElements(thisHash, otherHash);
/*  709 */       commonHash = hashNames(commonNames);
/*  710 */       otherExtras = removeAll(otherHash, commonHash);
/*      */
/*  714 */       resultParams = new Vector(commonNames);
/*  715 */       resultParams.addAll(otherExtras);
/*  716 */       resultLength = resultParams.size();
/*  717 */       resultNames = new String[resultLength];
/*  718 */       for (int i = 0; i < resultLength; i++) {
/*  719 */         resultNames[i] = ((String)resultParams.elementAt(i));
/*      */       }
/*      */
/*  722 */       resultClasses = new Class[resultLength];
/*  723 */       resultDefaults = new Object[resultLength];
/*  724 */       resultValidValues = new Object[resultLength];
/*  725 */       count = 0;
/*  726 */       for (count = 0; count < commonNames.size(); count++) {
/*  727 */         String name = (String)commonNames.elementAt(count);
/*  728 */         resultClasses[count] = thisClasses[getIndex(thisHash, name)];
/*  729 */         resultDefaults[count] = thisDefaults[getIndex(thisHash, name)];
/*  730 */         resultValidValues[count] = pld.getParamValueRange(name);
/*      */       }
/*      */
/*  733 */       for (int i = 0; i < otherExtras.size(); i++) {
/*  734 */         String name = (String)otherExtras.elementAt(i);
/*  735 */         resultClasses[(i + count)] = otherClasses[getIndex(otherHash, name)];
/*      */
/*  737 */         resultDefaults[(i + count)] = otherDefaults[getIndex(otherHash, name)];
/*      */
/*  739 */         resultValidValues[(i + count)] = otherPld.getParamValueRange(name);
/*      */       }
/*      */
/*  742 */       resultPLD = new ParameterListDescriptorImpl(null, resultNames, resultClasses, resultDefaults, resultValidValues);
/*      */
/*  748 */       result = new NegotiableCapability(this.category, this.capabilityName, resultGenerators, resultPLD, false);
View Full Code Here

Examples of javax.media.jai.ParameterListDescriptor

/*      */   {
/*  856 */     if (other == null) {
/*  857 */       throw new IllegalArgumentException(JaiI18N.getString("NegotiableCapability6"));
/*      */     }
/*      */
/*  861 */     ParameterListDescriptor thisDesc = getParameterListDescriptor();
/*  862 */     ParameterListDescriptor otherDesc = other.getParameterListDescriptor();
/*      */
/*  864 */     String[] thisNames = thisDesc.getParamNames();
/*  865 */     if (thisNames == null)
/*  866 */       thisNames = new String[0];
/*  867 */     String[] otherNames = otherDesc.getParamNames();
/*  868 */     if (otherNames == null)
/*  869 */       otherNames = new String[0];
/*  870 */     Hashtable thisHash = hashNames(thisNames);
/*  871 */     Hashtable otherHash = hashNames(otherNames);
/*      */
/*  873 */     if ((!this.isPreference) && (!other.isPreference()))
/*      */     {
/*  876 */       if (thisDesc.getNumParameters() != otherDesc.getNumParameters()) {
/*  877 */         return false;
/*      */       }
/*      */
/*  880 */       if (!containsAll(thisHash, otherHash)) {
/*  881 */         return false;
/*      */       }
/*  883 */       Class[] thisParamClasses = thisDesc.getParamClasses();
/*  884 */       Class[] otherParamClasses = otherDesc.getParamClasses();
/*  885 */       for (int i = 0; i < thisNames.length; i++) {
/*  886 */         if (thisParamClasses[i] != otherParamClasses[getIndex(otherHash, thisNames[i])])
/*      */         {
/*  888 */           return false;
/*      */         }
/*      */       }
/*  891 */       return true;
/*      */     }
/*      */
/*  895 */     Vector commonNames = commonElements(thisHash, otherHash);
/*      */
/*  897 */     Class[] thisParamClasses = thisDesc.getParamClasses();
/*  898 */     Class[] otherParamClasses = otherDesc.getParamClasses();
/*      */
/*  900 */     for (int i = 0; i < commonNames.size(); i++) {
/*  901 */       String currName = (String)commonNames.elementAt(i);
/*  902 */       if (thisParamClasses[getIndex(thisHash, currName)] != otherParamClasses[getIndex(otherHash, currName)])
/*      */       {
View Full Code Here

Examples of javax.media.jai.ParameterListDescriptor

/* 332 */       throw new IllegalArgumentException(JaiI18N.getString("JAIRMIDescriptor1"));
/*     */     }
/*     */
/* 335 */     int numSources = oldOD.getNumSources();
/*     */
/* 341 */     ParameterListDescriptor oldPLD = null;
/* 342 */     if (registryModeName.equalsIgnoreCase("remoteRendered"))
/* 343 */       oldPLD = oldOD.getParameterListDescriptor("rendered");
/* 344 */     else if (registryModeName.equalsIgnoreCase("remoteRenderable"))
/* 345 */       oldPLD = oldOD.getParameterListDescriptor("renderable");
/*     */     else {
/* 347 */       oldPLD = oldOD.getParameterListDescriptor(registryModeName);
/*     */     }
/*     */
/* 350 */     int numParams = oldPLD.getNumParameters();
/*     */
/* 353 */     if (oldServerName != newServerName)
/*     */     {
/* 357 */       OperationDescriptor[] newDescs = getServerSupportedOperationList(newServerName);
/*     */       OperationDescriptor newOD;
/* 361 */       if ((newOD = getOperationDescriptor(newDescs, operationName)) == null)
/*     */       {
/* 363 */         throw new IllegalArgumentException(JaiI18N.getString("JAIRMIDescriptor2"));
/*     */       }
/*     */
/* 369 */       if (numSources != newOD.getNumSources()) {
/* 370 */         throw new IllegalArgumentException(JaiI18N.getString("JAIRMIDescriptor3"));
/*     */       }
/*     */
/* 374 */       ParameterListDescriptor newPLD = newOD.getParameterListDescriptor(registryModeName);
/*     */
/* 377 */       if (numParams != newPLD.getNumParameters()) {
/* 378 */         throw new IllegalArgumentException(JaiI18N.getString("JAIRMIDescriptor4"));
/*     */       }
/*     */
/* 382 */       String[] oldParamNames = oldPLD.getParamNames();
/* 383 */       if (oldParamNames == null)
/* 384 */         oldParamNames = new String[0];
/* 385 */       String[] newParamNames = newPLD.getParamNames();
/* 386 */       if (newParamNames == null) {
/* 387 */         newParamNames = new String[0];
/*     */       }
/* 389 */       Hashtable oldHash = hashNames(oldParamNames);
/* 390 */       Hashtable newHash = hashNames(newParamNames);
/*     */
/* 393 */       if (!containsAll(oldHash, newHash)) {
/* 394 */         throw new IllegalArgumentException(JaiI18N.getString("JAIRMIDescriptor8"));
/*     */       }
/*     */
/* 398 */       Class[] thisParamClasses = oldPLD.getParamClasses();
/* 399 */       Class[] otherParamClasses = newPLD.getParamClasses();
/* 400 */       for (int i = 0; i < oldParamNames.length; i++) {
/* 401 */         if (thisParamClasses[i] != otherParamClasses[getIndex(newHash, oldParamNames[i])])
/*     */         {
/* 403 */           throw new IllegalArgumentException(JaiI18N.getString("JAIRMIDescriptor9"));
/*     */         }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.