Package javax.media.jai

Examples of javax.media.jai.ParameterListDescriptorImpl


  generators.add(RawTileEncoderFactory.class);

  return new NegotiableCapability("tileCodec",
          "raw",
          generators,
          new ParameterListDescriptorImpl(null,
                  null,
                  null,
                  null,
                  null),
          false);
View Full Code Here


  generators.add(GZIPTileDecoderFactory.class);

  return new NegotiableCapability("tileCodec",
          "gzip",
          generators,
          new ParameterListDescriptorImpl(null,
                  null,
                  null,
                  null,
                  null),
          false);
View Full Code Here

  NegotiableCapability decodeCap =
      new NegotiableCapability("tileCodec",
             "jpeg",
             generators,
             new ParameterListDescriptorImpl(
               null, //descriptor
               paramNames,
               paramClasses,
               defaults,
               null), // validValues
View Full Code Here

  generators.add(RawTileDecoderFactory.class);

  return new NegotiableCapability("tileCodec",
          "raw",
          generators,
          new ParameterListDescriptorImpl(null,
                  null,
                  null,
                  null,
                  null),
          false);
View Full Code Here

  generators.add(GZIPTileEncoderFactory.class);

  return new NegotiableCapability("tileCodec",
          "gzip",
          generators,
          new ParameterListDescriptorImpl(null,
                  null,
                  null,
                  null,
                  null),
          false);
View Full Code Here

  NegotiableCapability encodeCap =
      new NegotiableCapability("tileCodec",
             "jpeg",
             generators,
             new ParameterListDescriptorImpl(
                null, // descriptor
                paramNames,
                paramClasses,
                defaults,
                null), // validValues
View Full Code Here

    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,
              resultDefaults,
              resultValidValues);

View Full Code Here

/*      */     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);
/*      */
/*  754 */       for (int i = 0; i < commonNames.size(); i++) {
/*  755 */         String currParam = (String)commonNames.elementAt(i);
View Full Code Here

/*     */
/* 144 */     NegotiableNumericRange nnr2 = new NegotiableNumericRange(jpegPld.getParamValueRange(paramNames[2]));
/*     */
/* 149 */     Object[] defaults = { nnr1, negCollection, nnr2, negCollection, negCollection, negCollection };
/*     */
/* 158 */     NegotiableCapability encodeCap = new NegotiableCapability("tileCodec", "jpeg", generators, new ParameterListDescriptorImpl(null, paramNames, paramClasses, defaults, null), false);
/*     */
/* 171 */     encodeCap.setParameter(paramNames[0], nnr1);
/* 172 */     encodeCap.setParameter(paramNames[1], negCollection);
/* 173 */     encodeCap.setParameter(paramNames[2], nnr2);
/* 174 */     encodeCap.setParameter(paramNames[3], negCollection);
View Full Code Here

/*    */   public NegotiableCapability getEncodeCapability()
/*    */   {
/* 87 */     Vector generators = new Vector();
/* 88 */     generators.add(RawTileEncoderFactory.class);
/*    */
/* 90 */     return new NegotiableCapability("tileCodec", "raw", generators, new ParameterListDescriptorImpl(null, null, null, null, null), false);
/*    */   }
View Full Code Here

TOP

Related Classes of javax.media.jai.ParameterListDescriptorImpl

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.