protected void do_endbfrange(CSOperation operation) {
   Iterator it = operation.getOperands();
   while (it.hasNext()) {
     COSString start = (COSString) it.next();
     COSString end = (COSString) it.next();
     COSObject destination = (COSObject) it.next();
     CMapRangeMap map;
     if (destination instanceof COSString) {
       byte[] destBytes = ((COSString) destination).byteValue();
       if (destBytes.length > 2) {
         // this is special to /ToUnicode maps
         map =
             new CMapBFRangeStringMap(
                 start.byteValue(), end.byteValue(), ((COSString) destination).byteValue());
       } else {
         map =
             new CMapBFRangeCodeMap(
                 start.byteValue(), end.byteValue(), ((COSString) destination).byteValue());
       }
     } else {
       COSArray array = destination.asArray();
       if (array.get(0) instanceof COSString) {
         // this is special to /ToUnicode maps
         map =
             new CMapBFRangeStringArrayMap(
                 start.byteValue(), end.byteValue(), (COSArray) destination);
       } else {
         map =
             new CMapBFRangeNameArrayMap(
                 start.byteValue(), end.byteValue(), (COSArray) destination);
       }
     }
     addMap(map);
   }
 }
 protected void do_def(CSOperation operation) {
   // define key / value association
   Iterator it = operation.getOperands();
   COSObject operand = COSNull.NULL;
   if (it.hasNext()) {
     operand = (COSObject) it.next();
   }
   COSDictionary dict = operand.asDictionary();
   if (dict == null) {
     COSName key = operand.asName();
     if (key == null) {
       return;
     }
     COSObject value = COSNull.NULL;
     if (it.hasNext()) {
       value = (COSObject) it.next();
     }
     addDefinition(key, value);
   } else {
     Iterator<Map.Entry<COSName, COSObject>> eit = dict.entryIterator();
     while (eit.hasNext()) {
       Map.Entry<COSName, COSObject> entry = eit.next();
       COSName key = entry.getKey();
       COSObject value = entry.getValue();
       addDefinition(key, value);
     }
   }
 }
 protected void do_endnotdefchar(CSOperation operation) {
   Iterator it = operation.getOperands();
   while (it.hasNext()) {
     COSString start = (COSString) it.next();
     COSInteger destination = (COSInteger) it.next();
     CMapCharMap map = new CMapCIDCharCodeMap(start.byteValue(), destination.intValue());
     addNotdef(map);
   }
 }
 protected void do_endcidrange(CSOperation operation) {
   Iterator it = operation.getOperands();
   while (it.hasNext()) {
     COSString start = (COSString) it.next();
     COSString end = (COSString) it.next();
     COSInteger destination = (COSInteger) it.next();
     CMapRangeMap map =
         new CMapCIDRangeCodeMap(start.byteValue(), end.byteValue(), destination.intValue());
     addMap(map);
   }
 }
 protected void do_endcodespacerange(CSOperation operation) {
   Iterator it = operation.getOperands();
   while (it.hasNext()) {
     COSString startString = (COSString) it.next();
     if (!it.hasNext()) {
       break;
     }
     COSString endString = (COSString) it.next();
     CMapRange range = new CMapRange(startString.byteValue(), endString.byteValue());
     addRange(range);
   }
 }
 protected void do_endbfchar(CSOperation operation) {
   Iterator it = operation.getOperands();
   while (it.hasNext()) {
     COSString start = (COSString) it.next();
     COSObject destination = (COSObject) it.next();
     CMapCharMap map;
     if (destination instanceof COSString) {
       byte[] destBytes = ((COSString) destination).byteValue();
       if (destBytes.length > 2) {
         // this is special to /ToUnicode maps
         map = new CMapBFCharStringMap(start.byteValue(), destBytes);
       } else {
         map = new CMapBFCharCodeMap(start.byteValue(), destBytes);
       }
     } else {
       map = new CMapBFCharNameMap(start.byteValue(), (COSName) destination);
     }
     addMap(map);
   }
 }
 protected void initializeFromOperation(CSOperation operation) {
   if (operation.matchesOperator(CMapOperator.CMO_beginbfchar)) {
     do_beginbfchar(operation);
   } else if (operation.matchesOperator(CMapOperator.CMO_beginbfrange)) {
     do_beginbfrange(operation);
   } else if (operation.matchesOperator(CMapOperator.CMO_begincidchar)) {
     do_begincidchar(operation);
   } else if (operation.matchesOperator(CMapOperator.CMO_begincidrange)) {
     do_begincidrange(operation);
   } else if (operation.matchesOperator(CMapOperator.CMO_begincmap)) {
     do_begincmap(operation);
   } else if (operation.matchesOperator(CMapOperator.CMO_begincodespacerange)) {
     do_begincodespacerange(operation);
   } else if (operation.matchesOperator(CMapOperator.CMO_beginnotdefchar)) {
     do_beginnotdefchar(operation);
   } else if (operation.matchesOperator(CMapOperator.CMO_beginnotdefrange)) {
     do_beginnotdefrange(operation);
   } else if (operation.matchesOperator(CMapOperator.CMO_endbfchar)) {
     do_endbfchar(operation);
   } else if (operation.matchesOperator(CMapOperator.CMO_endbfrange)) {
     do_endbfrange(operation);
   } else if (operation.matchesOperator(CMapOperator.CMO_endcidchar)) {
     do_endcidchar(operation);
   } else if (operation.matchesOperator(CMapOperator.CMO_endcidrange)) {
     do_endcidrange(operation);
   } else if (operation.matchesOperator(CMapOperator.CMO_endcmap)) {
     do_endcmap(operation);
   } else if (operation.matchesOperator(CMapOperator.CMO_endcodespacerange)) {
     do_endcodespacerange(operation);
   } else if (operation.matchesOperator(CMapOperator.CMO_endnotdefchar)) {
     do_endnotdefchar(operation);
   } else if (operation.matchesOperator(CMapOperator.CMO_endnotdefrange)) {
     do_endnotdefrange(operation);
   } else if (operation.matchesOperator(CMapOperator.CMO_usecmap)) {
     do_usecmap(operation);
   } else if (operation.matchesOperator(CMapOperator.CMO_usefont)) {
     do_usefont(operation);
   } else if (operation.matchesOperator(CMapOperator.CMO_def)) {
     do_def(operation);
   } else {
     // unknown operator
   }
 }