Examples of Subset


Examples of java.lang.Character.Subset

            return;
        }

        // Use first subset only. Other subsets in array is ignored.
        // This is restriction of Win32 implementation.
        Subset subset1 = subsets[0];

        Locale locale = getNativeLocale();
        int newmode;

        if (locale == null) {
View Full Code Here

Examples of org.foray.font.Subset

     * Same as for {@link FontOutput4a#getCharsUsed()}, except that this
     * returns the chars used for the font subset.
     * @return The chars actually used by the document.
     */
    private char[] getSubsetCharsUsed() {
        final Subset subset = this.fontUse.getSubset();
        final Encoding encoding = this.fontUse.getEncoding();
        final char[] charArray = new char[subset.numGlyphsUsed()];
        for (int i = 0; i < subset.numGlyphsUsed(); i++) {
            final int originalGlyphIndex = subset.decodeSubsetIndex(i);
            final int codePoint = encoding.decodeCharacter(
                    (char) originalGlyphIndex);
            charArray[i] = (char) codePoint;
        }
        return charArray;
View Full Code Here

Examples of org.foray.font.Subset

        final FreeStandingFont fsf = this.getFreeStandingFont();
        if (fsf == null) {
            return null;
        }
        if (fsf.getFontComplexity() != Font.Complexity.SIMPLE) {
            final Subset subset = this.fontUse.getSubset();
            if (subset == null) {
                return fsf.getWidths();
            }
            return getSubsetWidths();
        }
View Full Code Here

Examples of org.foray.font.Subset

    /**
     * Returns the width array for reencoded glyphs in a subsetted font.
     * @return The width array for the reencoded glyphs.
     */
    private short[] getSubsetWidths() {
        final Subset subset = this.fontUse.getSubset();
        final short[] originalWidths = this.fontUse.getFreeStandingFont()
                .getWidths();
        final short[] tmpWidth = new short[subset.numGlyphsUsed()];
        for (int i = 0; i < subset.numGlyphsUsed(); i++) {
            final int originalIndex = subset.decodeSubsetIndex(i);
            tmpWidth[i] = originalWidths[originalIndex];
        }
        return tmpWidth;
    }
View Full Code Here

Examples of org.nexml.model.Subset

           
          // increment from beginning to end. This number is probably either null, for a
          // contiguous range, or perhaps 3 for codon positions
          int tbInc = 1;
          // create the equivalent nexml character set
          Subset nexSubset = xmlMatrix.createSubset(tbCharSet.getLabel());
       
          // assign character objects to the subset. Here we get the full list
          List<org.nexml.model.Character> nexCharacters = xmlMatrix.getCharacters();
     
          // now we iterate over the coordinates and assign the nexml characters to the set
          for ( int i = tbStart; i <= tbStop; i += tbInc ) {
            nexSubset.addThing(nexCharacters.get(i));
          }
        }
      }     
    }
   
View Full Code Here

Examples of org.nexml.model.Subset

        if ( null != tbRepeatInterval ) {           
          tbInc = tbRepeatInterval;
        }       
       
        // create the equivalent nexml character set
        Subset xmlSubset = xmlMatrix.createSubset(tbCharSet.getLabel());
     
        // assign character objects to the subset. Here we get the full list
        List<org.nexml.model.Character> xmlCharacters = xmlMatrix.getCharacters();
   
        // now we iterate over the coordinates and assign the nexml characters to the set
        for ( int i = tbStart; i <= tbStop; i += tbInc ) {
          xmlSubset.addThing(xmlCharacters.get(i));
        }
      }
    }
  } 
View Full Code Here

Examples of org.nexml.model.Subset

              }
             
              // this is how we create the equivalent nexml character set
              // you will need to update CharSet to get the new implementation of getLabel(), which
              // returns the same value as getTitle()
              Subset nexSubset = nexMatrix.createSubset(tbCharSet.getLabel());
             
              // we have to assign character objects to the subset. Here we get the full list
              List<org.nexml.model.Character> nexCharacters = nexMatrix.getCharacters();
             
              // now we iterate over the coordinates and assign the nexml characters to the set
              for ( int i = start; i <= stop; i += inc ) {
                nexSubset.addThing(nexCharacters.get(i));
              }
            }
          }
        }
      }
View Full Code Here

Examples of org.nexml.model.Subset

          if (tbCharSets.isEmpty() != true) {
            // a treebase matrix has zero or more character sets, we must iterate over them
            for ( CharSet tbCharSet : tbCharSets ) {
             
              // this is how we fetch the equivalent nexml character set
              Subset nexSubset = nexMatrix.getSubset(tbCharSet.getLabel());
              Assert.assertNotNull("If NexmlMatrixConverter works correctly, a Subset is returned", nexSubset);             
           
              //get names of TreeBASE and NeXML character set
              String tbCharSetName = tbCharSet.getLabel();
              String nexCharSetName = nexSubset.getLabel();
             
              //verify that the names are the same
              Assert.assertEquals("The NeXML character set must have copied the label of the TreeBASE character set",tbCharSetName,nexCharSetName);             
             
              // the coordinates of the character set are defined by a collection of column ranges that we iterate over
              Collection<ColumnRange> tbColumnRanges = tbCharSet.getColumns(tbCharacterMatrix);
           
              for ( ColumnRange tbColumnRange : tbColumnRanges ) {
             
                // these are the beginning and end of the range
                int tbStart = tbColumnRange.getStartColIndex();
                int tbStop = tbColumnRange.getEndColIndex();
               
                // this is how we increment from beginning to end. This number is probably either null, for a
                // contiguous range, or perhaps 3 for codon positions
                int tbInc = 1;
                 
                // need to do this to prevent nullpointerexceptions
                if ( null != tbColumnRange.getRepeatInterval()) {
                   
                  tbInc = tbColumnRange.getRepeatInterval();
                }
               
                // The NexmlMatrixConverter should have created a Subset for each tbCharSet
                if ( null != nexSubset ) {                                   
               
                  // now we iterate over the coordinates in this column range
                  //and verify whether correct character objects are returned
                  for ( int i = tbStart; i <= tbStop; i += tbInc ) {
                   
                    // get the nexml character that should have been created
                    org.nexml.model.Character nexCharacter = nexCharacters.get(i);
                    Assert.assertNotNull("The NeXML Character should not be null if there as an index into it in this set", nexCharacter);
                    Assert.assertTrue("The Subset should contain the character at index i", nexSubset.containsThing(nexCharacter));
                   
                    //get the treebase character for the index in this column range
                    PhyloChar tbCharacter = tbCharacterMatrix.getCharacter(i);
                    Assert.assertNotNull("The TreeBASE PhyloChar should not be null if there as an index into it in this set", tbCharacter);                   
                    Assert.assertEquals("If the TreeBASE character has a label, then the NeXML character's label should match it", tbCharacter.getLabel(), nexCharacter.getLabel());
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.