gpt4 book ai didi

com.ctc.wstx.util.WordResolver类的使用及代码示例

转载 作者:知者 更新时间:2024-03-25 19:39:05 30 4
gpt4 key购买 nike

本文整理了Java中com.ctc.wstx.util.WordResolver类的一些代码示例,展示了WordResolver类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WordResolver类的具体详情如下:
包路径:com.ctc.wstx.util.WordResolver
类名称:WordResolver

WordResolver介绍

[英]A specialized Map/Symbol table - like data structure that can be used for both checking whether a word (passed in as a char array) exists in certain set of words AND getting that word as a String. It is reasonably efficient both time and speed-wise, at least for certain use cases; specifically, if there is no existing key to use, it is more efficient way to get to a shared copy of that String The general usage pattern is expected to be such that most checks are positive, ie. that the word indeed is contained in the structure.

Although this is an efficient data struct for specific set of usage patterns, one restriction is that the full set of words to include has to be known before constructing the instnace. Also, the size of the set is limited to total word content of about 20k characters.

TODO: Should document the internal data structure...
[中]一种专门的映射/符号表式数据结构,可用于检查某组单词中是否存在某个单词(作为字符数组传入),以及将该单词作为字符串获取。它在时间和速度上都相当有效,至少在某些用例中是如此;具体来说,如果没有现有的密钥可供使用,那么获取该字符串的共享副本是一种更有效的方法。一般使用模式应确保大多数检查都是肯定的,即单词确实包含在结构中。
尽管对于特定的使用模式集来说,这是一种有效的数据结构,但一个限制是,在构建Instance之前,必须知道要包含的完整单词集。此外,该集合的大小仅限于约20k个字符的总单词内容。
TODO:应该记录内部数据结构。。。

代码示例

代码示例来源:origin: org.codehaus.woodstox/woodstox-core-asl

/**
 * @return Raw character data that contains compressed structure
 *   of the word set
 */
public WordResolver construct() 
{
  char[] result;
  /* 03-Jan-2006, TSa: Special case: just one entry; if so,
   *   let's leave char array null, and just have the String
   *   array with one entry.
   */
  if (mData == null) {
    result = null;
  } else {
    constructBranch(0, 0, mWords.length);
    
    // Too big?
    if (mSize > NEGATIVE_OFFSET) {
      return null;
    }
    
    result = new char[mSize];
    System.arraycopy(mData, 0, result, 0, mSize);
  }
  return new WordResolver(mWords, result);
}

代码示例来源:origin: org.codehaus.woodstox/woodstox-core-asl

return WordResolver.constructInstance(set);

代码示例来源:origin: org.codehaus.woodstox/woodstox-core-asl

protected void checkXmlSpaceAttr(int type, WordResolver enumValues)
  throws XMLStreamException
{
  boolean ok = (type == DTDAttribute.TYPE_ENUMERATED);
  if (ok) {
    switch (enumValues.size()) {
    case 1:
      ok = (enumValues.find("preserve") != null)
        || (enumValues.find("default") != null);
      break;
    case 2:
      ok = (enumValues.find("preserve") != null)
        && (enumValues.find("default") != null);
      break;
    default:
      ok = false;
    }
  }
  
  if (!ok) {
    _reportVCViolation(ErrorConsts.ERR_DTD_XML_SPACE);
  }
}

代码示例来源:origin: org.codehaus.woodstox/woodstox-core-asl

return null;
return res.find(cbuf, start, end);

代码示例来源:origin: org.codehaus.woodstox/woodstox-core-asl

return findFromOne(str, start, end);

代码示例来源:origin: org.codehaus.woodstox/woodstox-core-asl

/**
   * Method called by the validator
   * to ask attribute to verify that the default it has (if any) is
   * valid for such type.
   */
  public void validateDefault(InputProblemReporter rep, boolean normalize)
    throws XMLStreamException
  {
    String def = validateDefaultNmToken(rep, normalize);

    // And then that it's one of listed values:
    String shared = mEnumValues.find(def);
    if (shared == null) {
      reportValidationProblem(rep, "Invalid default value '"+def+"': has to be one of ("
                  +mEnumValues+")");
      return;
    }

    // Ok, cool it's ok...
    if (normalize) {
      mDefValue.setValue(shared);
    }
  }
}

代码示例来源:origin: com.fasterxml.woodstox/woodstox-core

return findFromOne(str, start, end);

代码示例来源:origin: woodstox/wstx-asl

protected void checkXmlSpaceAttr(int type, WordResolver enumValues)
  throws XMLStreamException
{
  boolean ok = (type == DTDAttribute.TYPE_ENUMERATED);
  if (ok) {
    switch (enumValues.size()) {
    case 1:
      ok = (enumValues.find("preserve") != null)
        || (enumValues.find("default") != null);
      break;
    case 2:
      ok = (enumValues.find("preserve") != null)
        && (enumValues.find("default") != null);
      break;
    default:
      ok = false;
    }
  }
  
  if (!ok) {
    reportVCViolation(ErrorConsts.ERR_DTD_XML_SPACE);
  }
}

代码示例来源:origin: org.codehaus.woodstox/woodstox-core-asl

/**
   * Method called by the validator
   * to ask attribute to verify that the default it has (if any) is
   * valid for such type.
   */
  public void validateDefault(InputProblemReporter rep, boolean normalize)
    throws XMLStreamException
  {
    // First, basic checks that it's a valid non-empty name:
    String def = validateDefaultName(rep, normalize);

    // And then that it's one of listed values:
    String shared = mEnumValues.find(def);
    if (shared == null) {
      reportValidationProblem(rep, "Invalid default value '"+def+"': has to be one of ("
                  +mEnumValues+")");
    }

    // Ok, cool it's ok...
    if (normalize) {
      mDefValue.setValue(shared);
    }
  }
}

代码示例来源:origin: org.codehaus.woodstox/woodstox-core-lgpl

/**
 * @return Raw character data that contains compressed structure
 *   of the word set
 */
public WordResolver construct() 
{
  char[] result;
  /* 03-Jan-2006, TSa: Special case: just one entry; if so,
   *   let's leave char array null, and just have the String
   *   array with one entry.
   */
  if (mData == null) {
    result = null;
  } else {
    constructBranch(0, 0, mWords.length);
    
    // Too big?
    if (mSize > NEGATIVE_OFFSET) {
      return null;
    }
    
    result = new char[mSize];
    System.arraycopy(mData, 0, result, 0, mSize);
  }
  return new WordResolver(mWords, result);
}

代码示例来源:origin: woodstox/wstx-asl

return WordResolver.constructInstance(set);

代码示例来源:origin: woodstox/wstx-asl

return findFromOne(str, start, end);

代码示例来源:origin: org.codehaus.woodstox/woodstox-core-lgpl

protected void checkXmlSpaceAttr(int type, WordResolver enumValues)
  throws XMLStreamException
{
  boolean ok = (type == DTDAttribute.TYPE_ENUMERATED);
  if (ok) {
    switch (enumValues.size()) {
    case 1:
      ok = (enumValues.find("preserve") != null)
        || (enumValues.find("default") != null);
      break;
    case 2:
      ok = (enumValues.find("preserve") != null)
        && (enumValues.find("default") != null);
      break;
    default:
      ok = false;
    }
  }
  
  if (!ok) {
    _reportVCViolation(ErrorConsts.ERR_DTD_XML_SPACE);
  }
}

代码示例来源:origin: com.fasterxml.woodstox/woodstox-core

return null;
return res.find(cbuf, start, end);

代码示例来源:origin: woodstox/wstx-lgpl

/**
 * @return Raw character data that contains compressed structure
 *   of the word set
 */
public WordResolver construct() 
{
  char[] result;
  /* 03-Jan-2006, TSa: Special case: just one entry; if so,
   *   let's leave char array null, and just have the String
   *   array with one entry.
   */
  if (mData == null) {
    result = null;
  } else {
    constructBranch(0, 0, mWords.length);
    
    // Too big?
    if (mSize > NEGATIVE_OFFSET) {
      return null;
    }
    
    result = new char[mSize];
    System.arraycopy(mData, 0, result, 0, mSize);
  }
  return new WordResolver(mWords, result);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.woodstox

return WordResolver.constructInstance(set);

代码示例来源:origin: woodstox/wstx-lgpl

return findFromOne(str, start, end);

代码示例来源:origin: com.fasterxml.woodstox/woodstox-core

protected void checkXmlSpaceAttr(int type, WordResolver enumValues)
  throws XMLStreamException
{
  boolean ok = (type == DTDAttribute.TYPE_ENUMERATED);
  if (ok) {
    switch (enumValues.size()) {
    case 1:
      ok = (enumValues.find("preserve") != null)
        || (enumValues.find("default") != null);
      break;
    case 2:
      ok = (enumValues.find("preserve") != null)
        && (enumValues.find("default") != null);
      break;
    default:
      ok = false;
    }
  }
  
  if (!ok) {
    _reportVCViolation(ErrorConsts.ERR_DTD_XML_SPACE);
  }
}

代码示例来源:origin: Nextdoor/bender

return null;
return res.find(cbuf, start, end);

代码示例来源:origin: com.fasterxml.woodstox/woodstox-core

/**
 * @return Raw character data that contains compressed structure
 *   of the word set
 */
public WordResolver construct() 
{
  char[] result;
  /* 03-Jan-2006, TSa: Special case: just one entry; if so,
   *   let's leave char array null, and just have the String
   *   array with one entry.
   */
  if (mData == null) {
    result = null;
  } else {
    constructBranch(0, 0, mWords.length);
    
    // Too big?
    if (mSize > NEGATIVE_OFFSET) {
      return null;
    }
    
    result = new char[mSize];
    System.arraycopy(mData, 0, result, 0, mSize);
  }
  return new WordResolver(mWords, result);
}

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com