当前位置: 首页>>代码示例>>Java>>正文


Java DTM.NTYPES属性代码示例

本文整理汇总了Java中com.sun.org.apache.xml.internal.dtm.DTM.NTYPES属性的典型用法代码示例。如果您正苦于以下问题:Java DTM.NTYPES属性的具体用法?Java DTM.NTYPES怎么用?Java DTM.NTYPES使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.sun.org.apache.xml.internal.dtm.DTM的用法示例。


在下文中一共展示了DTM.NTYPES属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getReverseMapping

/**
 * Get mapping from external element/attribute types to DOM types
 */
public int[] getReverseMapping(String[] names, String[] uris, int[] types)
{
    int i;
    final int[] result = new int[names.length + DTM.NTYPES];

    // primitive types map to themselves
    for (i = 0; i < DTM.NTYPES; i++) {
        result[i] = i;
    }

    // caller's types map into appropriate dom types
    for (i = 0; i < names.length; i++) {
        int type = m_expandedNameTable.getExpandedTypeID(uris[i], names[i], types[i], true);
        result[i+DTM.NTYPES] = type;
    }
    return(result);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:SAXImpl.java

示例2: next

/**
 * Get the next node in the iteration.
 *
 * @return The next node handle in the iteration, or END.
 */
public int next()
{

  final int result = _currentNode;
  if (result == END)
    return DTM.NULL;

  _currentNode = END;

  if (_nodeType >= DTM.NTYPES) {
    if (_exptype2(makeNodeIdentity(result)) == _nodeType) {
      return returnNode(result);
    }
  }
  else {
    if (_type2(makeNodeIdentity(result)) == _nodeType) {
      return returnNode(result);
    }
  }

  return NULL;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:SAX2DTM2.java

示例3: getMapping

/**
 * Get mapping from DOM element/attribute types to external types
 */
public short[] getMapping(String[] names, String[] uris, int[] types)
{
    // Delegate the work to getMapping2 if the document is not fully built.
    // Some of the processing has to be different in this case.
    if (_namesSize < 0) {
        return getMapping2(names, uris, types);
    }

    int i;
    final int namesLength = names.length;
    final int exLength = m_expandedNameTable.getSize();

    final short[] result = new short[exLength];

    // primitive types map to themselves
    for (i = 0; i < DTM.NTYPES; i++) {
        result[i] = (short)i;
    }

    for (i = NTYPES; i < exLength; i++) {
        result[i] = m_expandedNameTable.getType(i);
    }

    // actual mapping of caller requested names
    for (i = 0; i < namesLength; i++) {
        int genType = m_expandedNameTable.getExpandedTypeID(uris[i],
                                                            names[i],
                                                            types[i],
                                                            true);
        if (genType >= 0 && genType < exLength) {
            result[genType] = (short)(i + DTM.NTYPES);
        }
    }

    return result;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:39,代码来源:SAXImpl.java

示例4: reset

/**
 * Initializes the compiler to produce a new translet
 */
private void reset() {
    _nextGType      = DTM.NTYPES;
    _elements       = new Hashtable();
    _attributes     = new Hashtable();
    _namespaces     = new Hashtable();
    _namespaces.put("",new Integer(_nextNSType));
    _namesIndex     = new Vector(128);
    _namespaceIndex = new Vector(32);
    _namespacePrefixes = new Hashtable();
    _stylesheet     = null;
    _parser.init();
    //_variableSerial     = 1;
    _modeSerial         = 1;
    _stylesheetSerial   = 1;
    _stepPatternSerial  = 1;
    _helperClassSerial  = 0;
    _attributeSetSerial = 0;
    _multiDocument      = false;
    _hasIdCall          = false;
    _numberFieldIndexes = new int[] {
        -1,         // LEVEL_SINGLE
        -1,         // LEVEL_MULTIPLE
        -1          // LEVEL_ANY
    };
    _externalExtensionFunctions.clear();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:29,代码来源:XSLTC.java

示例5: initExtendedTypes

/**
 *  Initialize the vector of extended types with the
 *  basic DOM node types.
 */
private void initExtendedTypes()
{
  m_extendedTypes = new ExtendedType[m_initialSize];
  for (int i = 0; i < DTM.NTYPES; i++) {
      m_extendedTypes[i] = m_defaultExtendedTypes[i];
      m_table[i] = new HashEntry(m_defaultExtendedTypes[i], i, i, null);
  }

  m_nextType = DTM.NTYPES;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:ExpandedNameTable.java

示例6: reset

/**
 * Initializes the compiler to produce a new translet
 */
private void reset() {
    _nextGType      = DTM.NTYPES;
    _elements       = new HashMap<>();
    _attributes     = new HashMap<>();
    _namespaces     = new HashMap<>();
    _namespaces.put("", _nextNSType);
    _namesIndex     = new Vector(128);
    _namespaceIndex = new Vector(32);
    _namespacePrefixes = new HashMap<>();
    _stylesheet     = null;
    _parser.init();
    //_variableSerial     = 1;
    _modeSerial         = 1;
    _stylesheetSerial   = 1;
    _stepPatternSerial  = 1;
    _helperClassSerial  = 0;
    _attributeSetSerial = 0;
    _multiDocument      = false;
    _hasIdCall          = false;
    _numberFieldIndexes = new int[] {
        -1,         // LEVEL_SINGLE
        -1,         // LEVEL_MULTIPLE
        -1          // LEVEL_ANY
    };
    _externalExtensionFunctions.clear();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:29,代码来源:XSLTC.java

示例7: getNodeByPosition

/**
 * Return the node at the given position.
 */
public int getNodeByPosition(int position) {
  if (position <= 0)
    return DTM.NULL;

  int node = _currentNode;
  int pos = 0;

  final int nodeType = _nodeType;
  if (nodeType != DTM.ELEMENT_NODE) {
    while (node != DTM.NULL) {
      if (_exptype2(node) == nodeType) {
        pos++;
        if (pos == position)
          return makeNodeHandle(node);
      }

      node = _nextsib2(node);
    }
    return NULL;
  } else {
    while (node != DTM.NULL) {
      if (_exptype2(node) >= DTM.NTYPES) {
        pos++;
        if (pos == position)
          return makeNodeHandle(node);
      }
      node = _nextsib2(node);
    }
    return NULL;
  }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:34,代码来源:SAX2DTM2.java

示例8: getLast

/**
 * Return the index of the last node in this iterator.
 */
public int getLast() {
  if (_last != -1)
    return _last;

  setMark();

  int node = _currentNode;
  final int nodeType = _nodeType;
  final int startNodeID = _startNodeID;

  int last = 0;
  if (nodeType != DTM.ELEMENT_NODE) {
    while (node != NULL && node != startNodeID) {
      if (_exptype2(node) == nodeType) {
        last++;
      }
      node = _nextsib2(node);
    }
  } else {
    while (node != NULL && node != startNodeID) {
      if (_exptype2(node) >= DTM.NTYPES) {
        last++;
      }
      node = _nextsib2(node);
    }
  }

  gotoMark();

  return (_last = last);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:34,代码来源:SAX2DTM2.java

示例9: getMapping2

/**
 * Get mapping from DOM element/attribute types to external types.
 * This method is used when the document is not fully built.
 */
private short[] getMapping2(String[] names, String[] uris, int[] types)
{
    int i;
    final int namesLength = names.length;
    final int exLength = m_expandedNameTable.getSize();
    int[] generalizedTypes = null;
    if (namesLength > 0) {
        generalizedTypes = new int[namesLength];
    }

    int resultLength = exLength;

    for (i = 0; i < namesLength; i++) {
        // When the document is not fully built, the searchOnly
        // flag should be set to false. That means we should add
        // the type if it is not already in the expanded name table.
        //generalizedTypes[i] = getGeneralizedType(names[i], false);
        generalizedTypes[i] =
            m_expandedNameTable.getExpandedTypeID(uris[i],
                                                  names[i],
                                                  types[i],
                                                  false);
        if (_namesSize < 0 && generalizedTypes[i] >= resultLength) {
            resultLength = generalizedTypes[i] + 1;
        }
    }

    final short[] result = new short[resultLength];

    // primitive types map to themselves
    for (i = 0; i < DTM.NTYPES; i++) {
        result[i] = (short)i;
    }

    for (i = NTYPES; i < exLength; i++) {
        result[i] = m_expandedNameTable.getType(i);
    }

    // actual mapping of caller requested names
    for (i = 0; i < namesLength; i++) {
        int genType = generalizedTypes[i];
        if (genType >= 0 && genType < resultLength) {
            result[genType] = (short)(i + DTM.NTYPES);
        }
    }

    return(result);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:52,代码来源:SAXImpl.java

示例10: compileNamespaces

private InstructionList compileNamespaces(ClassGenerator classGen,
                                          MethodGenerator methodGen,
                                          boolean[] isNamespace,
                                          boolean[] isAttribute,
                                          boolean attrFlag,
                                          InstructionHandle defaultTarget) {
    final XSLTC xsltc = classGen.getParser().getXSLTC();
    final ConstantPoolGen cpg = classGen.getConstantPool();

    // Append switch() statement - namespace test dispatch loop
    final Vector namespaces = xsltc.getNamespaceIndex();
    final Vector names = xsltc.getNamesIndex();
    final int namespaceCount = namespaces.size() + 1;
    final int namesCount = names.size();

    final InstructionList il = new InstructionList();
    final int[] types = new int[namespaceCount];
    final InstructionHandle[] targets = new InstructionHandle[types.length];

    if (namespaceCount > 0) {
        boolean compiled = false;

        // Initialize targets for namespace() switch statement
        for (int i = 0; i < namespaceCount; i++) {
            targets[i] = defaultTarget;
            types[i] = i;
        }

        // Add test sequences for known namespace types
        for (int i = DTM.NTYPES; i < (DTM.NTYPES+namesCount); i++) {
            if ((isNamespace[i]) && (isAttribute[i] == attrFlag)) {
                String name = (String)names.elementAt(i-DTM.NTYPES);
                String namespace = name.substring(0,name.lastIndexOf(':'));
                final int type = xsltc.registerNamespace(namespace);

                if ((i < _testSeq.length) &&
                    (_testSeq[i] != null)) {
                    targets[type] =
                        (_testSeq[i]).compile(classGen,
                                                   methodGen,
                                                   defaultTarget);
                    compiled = true;
                }
            }
        }

        // Return "null" if no test sequences were compiled
        if (!compiled) return(null);

        // Append first code in applyTemplates() - get type of current node
        final int getNS = cpg.addInterfaceMethodref(DOM_INTF,
                                                    "getNamespaceType",
                                                    "(I)I");
        il.append(methodGen.loadDOM());
        il.append(new ILOAD(_currentIndex));
        il.append(new INVOKEINTERFACE(getNS, 2));
        il.append(new SWITCH(types, targets, defaultTarget));
        return(il);
    }
    else {
        return(null);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:63,代码来源:Mode.java


注:本文中的com.sun.org.apache.xml.internal.dtm.DTM.NTYPES属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。