• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Strings类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中gate.util.Strings的典型用法代码示例。如果您正苦于以下问题:Java Strings类的具体用法?Java Strings怎么用?Java Strings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: setIndexer

import gate.util.Strings; //导入依赖的package包/类
/**
 * Sets the Indexer to be used for indexing Datastore
 */
@Override
public void setIndexer(Indexer indexer, Map<String,Object> indexParameters)
        throws IndexException {

  this.indexer = indexer;
  this.indexParameters = indexParameters;
  this.indexURL = (URL)this.indexParameters.get(Constants.INDEX_LOCATION_URL);
  this.indexer.createIndex(this.indexParameters);

  // dump the version file
  try {
    File versionFile = getVersionFile();
    OutputStreamWriter osw =
            new OutputStreamWriter(new FileOutputStream(versionFile));
    osw.write(versionNumber + Strings.getNl());
    String indexDirRelativePath =
            PersistenceManager.getRelativePath(storageDir.toURI().toURL(),
                    indexURL);
    osw.write(indexDirRelativePath);
    osw.close();
  } catch(IOException e) {
    throw new IndexException("couldn't write version file: " + e);
  }
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:28,代码来源:LuceneDataStoreImpl.java


示例2: setParameterValue

import gate.util.Strings; //导入依赖的package包/类
/**
 * Sets the value for a specified parameter.
 *
 * @param paramaterName the name for the parameteer
 * @param parameterValue the value the parameter will receive
 */
@Override
public void setParameterValue(String paramaterName, Object parameterValue)
            throws ResourceInstantiationException{
  // get the beaninfo for the resource bean, excluding data about Object
  BeanInfo resBeanInf = null;
  try {
    resBeanInf = Introspector.getBeanInfo(this.getClass(), Object.class);
  } catch(Exception e) {
    throw new ResourceInstantiationException(
      "Couldn't get bean info for resource " + this.getClass().getName()
      + Strings.getNl() + "Introspector exception was: " + e
    );
  }
  AbstractResource.setParameterValue(this, resBeanInf, paramaterName, parameterValue);
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:22,代码来源:CorpusAnnotationDiff.java


示例3: toString

import gate.util.Strings; //导入依赖的package包/类
/** String respresentation */
@Override
public String toString() {
  String n = Strings.getNl();
  StringBuffer s = new StringBuffer("DocumentImpl: " + n);
  s.append("  content:" + content + n);
  s.append("  defaultAnnots:" + defaultAnnots + n);
  s.append("  encoding:" + encoding + n);
  s.append("  features:" + features + n);
  s.append("  markupAware:" + markupAware + n);
  s.append("  namedAnnotSets:" + namedAnnotSets + n);
  s.append("  nextAnnotationId:" + nextAnnotationId + n);
  s.append("  nextNodeId:" + nextNodeId + n);
  s.append("  sourceUrl:" + sourceUrl + n);
  s.append("  sourceUrlStartOffset:" + sourceUrlStartOffset + n);
  s.append("  sourceUrlEndOffset:" + sourceUrlEndOffset + n);
  s.append(n);
  return s.toString();
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:20,代码来源:DocumentImpl.java


示例4: setParameterValues

import gate.util.Strings; //导入依赖的package包/类
/**
 * Sets the values for more parameters for a resource in one step.
 *
 * @param parameters a feature map that has parameter names as keys and
 * parameter values as values.
 */
public static void setParameterValues(Resource resource,
                                      FeatureMap parameters)
            throws ResourceInstantiationException{
  // get the beaninfo for the resource bean, excluding data about Object
  BeanInfo resBeanInf = null;
  try {
    resBeanInf = getBeanInfo(resource.getClass());
  } catch(Exception e) {
    throw new ResourceInstantiationException(
      "Couldn't get bean info for resource " + resource.getClass().getName()
      + Strings.getNl() + "Introspector exception was: " + e
    );
  }

  Iterator<Object> parnameIter = parameters.keySet().iterator();
  while(parnameIter.hasNext()){
    String parName = (String)parnameIter.next();
    setParameterValue(resource, resBeanInf, parName, parameters.get(parName));
  }
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:27,代码来源:AbstractResource.java


示例5: setParameterValue

import gate.util.Strings; //导入依赖的package包/类
/**
 * Sets the value for a specified parameter for this resource.
 *
 * @param paramaterName the name for the parameter
 * @param parameterValue the value the parameter will receive
 */
@Override
public void setParameterValue(String paramaterName, Object parameterValue)
            throws ResourceInstantiationException{
  // get the beaninfo for the resource bean, excluding data about Object
  BeanInfo resBeanInf = null;
  try {
    resBeanInf = getBeanInfo(this.getClass());
  } catch(Exception e) {
    throw new ResourceInstantiationException(
      "Couldn't get bean info for resource " + this.getClass().getName()
      + Strings.getNl() + "Introspector exception was: " + e
    );
  }
  setParameterValue(this, resBeanInf, paramaterName, parameterValue);
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:22,代码来源:AbstractResource.java


示例6: setParameterValue

import gate.util.Strings; //导入依赖的package包/类
/**
 * Sets the value for a specified parameter.
 * 
 * @param paramaterName the name for the parameteer
 * @param parameterValue the value the parameter will receive
 */
@Override
public void setParameterValue(String paramaterName, Object parameterValue)
        throws ResourceInstantiationException {
  // get the beaninfo for the resource bean, excluding data about
  // Object
  BeanInfo resBeanInf = null;
  try {
    resBeanInf = Introspector.getBeanInfo(this.getClass(), Object.class);
  }
  catch(Exception e) {
    throw new ResourceInstantiationException(
            "Couldn't get bean info for resource "
                    + this.getClass().getName() + Strings.getNl()
                    + "Introspector exception was: " + e);
  }
  AbstractResource.setParameterValue(this, resBeanInf, paramaterName,
          parameterValue);
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:25,代码来源:SerialDatastoreViewer.java


示例7: testSessionStateFileNaming

import gate.util.Strings; //导入依赖的package包/类
/** Test session state file naming */
@Test
public void testSessionStateFileNaming() throws Exception {
  
  //TODO fix this
  //again we can't test these thinfs if there is no file to test
  if (Gate.getUserConfigFile() == null) return;
  
  String fileSep = Strings.getFileSep();
  if(DEBUG) {
    Out.prln("file sep is: " + fileSep);
  }

  if(Gate.runningOnUnix()) {
    assertTrue(fileSep.equals("/"));
    assertTrue(
      Gate.getUserSessionFile().toString().endsWith("."+GateConstants.GATE_DOT_SER)
    );
  } else {
    assertTrue(! fileSep.equals("/"));
    assertTrue(
      ! Gate.getUserSessionFile().toString().endsWith("."+GateConstants.GATE_DOT_SER)
    );
  }

}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:27,代码来源:TestConfig.java


示例8: testConfigFileNaming

import gate.util.Strings; //导入依赖的package包/类
/** Test config file naming */
public void testConfigFileNaming() throws Exception {
  String fileSep = Strings.getFileSep();
  if(DEBUG) {
    Out.prln("file sep is: " + fileSep);
  }

  if(Gate.runningOnUnix()) {
    assertTrue(fileSep.equals("/"));
    assertTrue(
      Gate.getDefaultUserConfigFileName().endsWith("."+GateConstants.GATE_DOT_XML)
    );
  } else {
    assertTrue(! fileSep.equals("/"));
    assertTrue(
      ! Gate.getDefaultUserConfigFileName().endsWith("."+GateConstants.GATE_DOT_XML)
    );
  }

}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:21,代码来源:TestConfig.java


示例9: create

import gate.util.Strings; //导入依赖的package包/类
/** Create a new data store. This tries to create a directory in
  * the local file system. If the directory already exists and is
  * non-empty, or is
  * a file, or cannot be created, PersistenceException is thrown.
  */
@Override
public void create()
throws PersistenceException {
  if(storageDir == null)
    throw new PersistenceException("null storage directory: cannot create");

  if(! storageDir.exists()) { // if doesn't exist create it
    
    if(! storageDir.mkdir())
      throw new
        PersistenceException("cannot create directory " + storageDir);
  } else { // must be empty
    String[] existingFiles = filterIgnoredFileNames(storageDir.list());
    if(! (existingFiles == null || existingFiles.length == 0) )
      throw new PersistenceException(
        "directory "+ storageDir +" is not empty: cannot use for data store"
      );
  }

  // dump the version file
  try {
    File versionFile = getVersionFile();
    OutputStreamWriter osw = new OutputStreamWriter(
      new FileOutputStream(versionFile)
    );
    osw.write(versionNumber + Strings.getNl());
    osw.close();
  } catch(IOException e) {
    throw new PersistenceException("couldn't write version file: " + e);
  }
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:37,代码来源:SerialDataStore.java


示例10: toString

import gate.util.Strings; //导入依赖的package包/类
/** String representation */
@Override
public String toString() {
  String nl = Strings.getNl();
  StringBuffer s = new StringBuffer("SerialDataStore: ");
  s.append("autoSaving: " + autoSaving);
  s.append("; storageDir: " + storageDir);
  s.append(nl);

  return s.toString();
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:12,代码来源:SerialDataStore.java


示例11: getDefaultUserConfigFileName

import gate.util.Strings; //导入依赖的package包/类
/**
 * Get the default path to the user's config file, which is used unless an
 * alternative name has been specified via system properties or
 * {@link #setUserConfigFile}.
 *
 * @return the default user config file path.
 */
public static String getDefaultUserConfigFileName() {
  String filePrefix = "";
  if(runningOnUnix()) filePrefix = ".";

  String userConfigName =
    System.getProperty("user.home") + Strings.getFileSep() + filePrefix
      + GATE_DOT_XML;
  return userConfigName;
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:17,代码来源:Gate.java


示例12: getDefaultUserSessionFileName

import gate.util.Strings; //导入依赖的package包/类
/**
 * Get the default path to the user's session file, which is used unless an
 * alternative name has been specified via system properties or
 * {@link #setUserSessionFile(File)}
 *
 * @return the default user session file path.
 */
public static String getDefaultUserSessionFileName() {
  String filePrefix = "";
  if(runningOnUnix()) filePrefix = ".";

  String userSessionName =
    System.getProperty("user.home") + Strings.getFileSep() + filePrefix
      + GATE_DOT_SER;

  return userSessionName;
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:18,代码来源:Gate.java


示例13: help

import gate.util.Strings; //导入依赖的package包/类
/** Display a help message */
public static void help() {
  String nl = Strings.getNl();
  Out.prln(
    "For help on command-line options and other information " + nl +
    "see the user manual in your GATE distribution or at " + nl +
    "http://gate.ac.uk/userguide/"
  );
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:10,代码来源:Main.java


示例14: endDocument

import gate.util.Strings; //导入依赖的package包/类
/** Called when the SAX parser encounts the end of the XML document */
@Override
public void endDocument() throws GateSaxException {
  if(DEBUG) Out.prln("end document");
  if(! contentStack.isEmpty()) {
    StringBuffer errorMessage =
      new StringBuffer("document ended but element stack not empty:");
    while(! contentStack.isEmpty())
      errorMessage.append(Strings.getNl()+"  "+contentStack.pop());
    throw new GateSaxException(errorMessage.toString());
  }
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:13,代码来源:ConfigXmlHandler.java


示例15: getParameterClass

import gate.util.Strings; //导入依赖的package包/类
/** Find the class for this parameter type. */
  protected Class<?> getParameterClass() throws ParameterException
  {
    // get java builtin classes via class; else look in the register
    try {
      ResourceData resData = Gate.getCreoleRegister().get(typeName);
      if(resData == null){
        paramClass = Gate.getClassLoader().loadClass(typeName);
      }else{
        paramClass = resData.getResourceClass();
      }

//      if(typeName.startsWith("java."))
//          paramClass = Class.forName(typeName);
//      else {
//        ResourceData resData =
//          (ResourceData) Gate.getCreoleRegister().get(typeName);
//        if(resData == null)
//          throw new ParameterException(
//            "No resource data for " + typeName + " in Parameter/getParamClz"
//          );
//        paramClass = resData.getResourceClass();
//      }
    } catch(ClassNotFoundException e) {
      throw new ParameterException(
        "Couldn't find class " + typeName + ": " + Strings.getNl() + e
      );
    }

    if(paramClass == null)
      throw new ParameterException("Couldn't find class " + typeName);

    return paramClass;
  }
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:35,代码来源:Parameter.java


示例16: saveStackViewConfiguration

import gate.util.Strings; //导入依赖的package包/类
/**
 * Save the user config data.
 */
protected void saveStackViewConfiguration() {
  Map<String, String> map = new HashMap<String, String>();
  for(int row = 0; row < numStackRows; row++) {
    for(int col = 0; col < columnNames.length; col++) {
      map.put(columnNames[col] + '_' + row, stackRows[row][col]);
    }
  }
  Gate.getUserConfig().put(
          LuceneDataStoreSearchGUI.class.getName() + ".rows",
          Strings.toString(map));
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:15,代码来源:LuceneDataStoreSearchGUI.java


示例17: saveSettings

import gate.util.Strings; //导入依赖的package包/类
/**
 * Save the layout of the views and selected annotations.
 */
public void saveSettings() {
  DocumentEditor de = DocumentEditor.this;
  Gate.getUserConfig().put(
      DocumentEditor.class.getName() + ".centralViewIdx",
      Strings.toString(de.centralViewIdx));
  Gate.getUserConfig().put(DocumentEditor.class.getName() + ".rightViewIdx",
      Strings.toString(de.rightViewIdx));
  Gate.getUserConfig().put(DocumentEditor.class.getName() + ".bottomViewIdx",
      Strings.toString(de.bottomViewIdx));
  Gate.getUserConfig().put(DocumentEditor.class.getName() + ".topViewIdx",
      Strings.toString(de.topViewIdx));
  LinkedHashSet<String> setTypeSet = new LinkedHashSet<String>();
  DocumentView dv = de.getRightView();
  if(dv instanceof AnnotationSetsView) {
    AnnotationSetsView av = (AnnotationSetsView)dv;
    for(AnnotationSetsView.SetHandler sh : av.setHandlers) {
      for(AnnotationSetsView.TypeHandler th : sh.typeHandlers) {
        if(th.isSelected()) {
          setTypeSet.add((sh.set.getName() == null ? "" : sh.set.getName())
              + '.' + th.name);
        }
      }
    }
  }
  Gate.getUserConfig().put(DocumentEditor.class.getName() + ".setTypeSet",
      Strings.toString(setTypeSet));
  DocumentView bottomView = de.getBottomView();
  if(bottomView instanceof AnnotationStackView) {
    AnnotationStackView view = (AnnotationStackView)bottomView;
    Gate.getUserConfig().put(
        DocumentEditor.class.getName() + ".stackTypesFeatures",
        Strings.toString(view.typesFeatures));
    Gate.getUserConfig().put(
        DocumentEditor.class.getName() + ".stackTargetSetName",
        view.targetSetName);
  }
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:41,代码来源:DocumentEditor.java


示例18: toString

import gate.util.Strings; //导入依赖的package包/类
public String toString() {
  StringBuffer output = new StringBuffer();
  output.append("S: ").append(Strings.toString(startPosToOffset))
      .append('\n');
  output.append("   ").append(Strings.toString(startPosToString))
      .append('\n');
  output.append("   ").append(Strings.toString(endPosToOffset));
  return output.toString();
}
 
开发者ID:GateNLP,项目名称:gateplugin-Stanford_CoreNLP,代码行数:10,代码来源:StanfordSentence.java


示例19: toString

import gate.util.Strings; //导入依赖的package包/类
public String toString() {
  StringBuffer output = new StringBuffer();
  output.append("S: ").append(Strings.toString(startPosToOffset)).append('\n');
  output.append("   ").append(Strings.toString(startPosToString)).append('\n');
  output.append("   ").append(Strings.toString(endPosToOffset));
  return output.toString();
}
 
开发者ID:vita-us,项目名称:ViTA,代码行数:8,代码来源:StanfordSentence.java


示例20: setGazetteerFeatureSeparator

import gate.util.Strings; //导入依赖的package包/类
@CreoleParameter(
    comment = "The character used to separate features for entries in gazetteer lists. Accepts strings like &quot;\t&quot; and will unescape it to the relevant character. If not specified, a tab character will be used",
    defaultValue = "\\t"
    )
@Optional
public void setGazetteerFeatureSeparator(String sep) {
  gazetteerFeatureSeparator = sep;
  if(sep == null || sep.isEmpty()) {
    unescapedSeparator = Strings.unescape("\\t");
  } else {
    unescapedSeparator = Strings.unescape(sep);
  }
}
 
开发者ID:johann-petrak,项目名称:gateplugin-StringAnnotation,代码行数:14,代码来源:GazetteerBase.java



注:本文中的gate.util.Strings类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BindingTypeFeature类代码示例发布时间:2022-05-23
下一篇:
Java Location类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap