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


Java FeatureSchema类代码示例

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


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

示例1: populate

import gate.creole.FeatureSchema; //导入依赖的package包/类
/**
   * Called internally whenever the data represented changes.
   * Get feature names from targetFeatures and schema then sort them
   * and add them to featureList.
   * Fire a table data changed event for the feature table whith featureList
   * used as data model.
   */
  protected void populate(){
    featureList.clear();
    //get all the existing features
    Set fNames = new HashSet();
    
    if(targetFeatures != null){
      //add all the schema features
      fNames.addAll(targetFeatures.keySet());
      if(schema != null && schema.getFeatureSchemaSet() != null){
        for(FeatureSchema featureSchema : schema.getFeatureSchemaSet()) {
          //        if(featureSchema.isRequired())
          fNames.add(featureSchema.getFeatureName());
        }
      }
      List featureNames = new ArrayList(fNames);
      Collections.sort(featureNames);
      for(Object featureName : featureNames) {
        String name = (String) featureName;
        Object value = targetFeatures.get(name);
        featureList.add(new Feature(name, value));
      }
    }
    if (!featureList.contains(emptyFeature)) {
      featureList.add(emptyFeature);
    }
    featuresModel.fireTableDataChanged();
//    mainTable.setSize(mainTable.getPreferredScrollableViewportSize());
  }
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:36,代码来源:FeaturesSchemaEditor.java

示例2: populate

import gate.creole.FeatureSchema; //导入依赖的package包/类
/**
 * Called internally whenever the data represented changes.
 * 
 */
protected void populate() {
  featureList.clear();

  // get all the exisitng features
  Set<Object> features = new LinkedHashSet<Object>();

  if(targetFeatures != null) {
    // add all the schema features
    for(Object key : targetFeatures.keySet()) {
      
      Object value = targetFeatures.get(key);
      if(key.equals(Settings.VALUE_FEATURES_DIALOG_GUI_LABEL)){
        initValueEditor(value);
        featureList.add(new Feature(key.toString(), value));
      } else{
        featureList.add(new Feature(key.toString(), value));
      }
      features.add(key.toString());
    }
  }

  if(schema != null && schema.getFeatureSchemaSet() != null) {
    Iterator fSchemaIter = schema.getFeatureSchemaSet().iterator();
    while(fSchemaIter.hasNext()) {
      FeatureSchema fSchema = (FeatureSchema)fSchemaIter.next();
      if(!features.contains(fSchema.getFeatureName())) {
        featureList
          .add(new Feature(fSchema.getFeatureName(), new ArrayList()));
      }
    }
  }

  featureList.add(emptyFeature);
  featuresModel.fireTableDataChanged();
  mainTable.setSize(mainTable.getPreferredScrollableViewportSize());
}
 
开发者ID:naditina,项目名称:gate-semano,代码行数:41,代码来源:FeaturesEditor.java

示例3: populate

import gate.creole.FeatureSchema; //导入依赖的package包/类
/**
 * Called internally whenever the data represented changes.
 * 
 */
protected void populate() {
  featureList.clear();

  // get all the existing features
  Set features = new HashSet();

  if(targetFeatures != null) {
    // add all the schema features
    for(Object key : targetFeatures.keySet()) {
      Object value = targetFeatures.get(key);
      featureList.add(new Feature(key.toString(), value));
      features.add(key.toString());
    }
  }

  if(schema != null && schema.getFeatureSchemaSet() != null) {
    Iterator fSchemaIter = schema.getFeatureSchemaSet().iterator();
    while(fSchemaIter.hasNext()) {
      FeatureSchema fSchema = (FeatureSchema)fSchemaIter.next();
      if(!features.contains(fSchema.getFeatureName())) {
        featureList
          .add(new Feature(fSchema.getFeatureName(), new ArrayList()));
      }
    }
  }

  featureList.add(emptyFeature);
  featuresModel.fireTableDataChanged();
  mainTable.setSize(mainTable.getPreferredScrollableViewportSize());
}
 
开发者ID:Network-of-BioThings,项目名称:GettinCRAFTy,代码行数:35,代码来源:FeaturesEditor.java

示例4: isCorrect

import gate.creole.FeatureSchema; //导入依赖的package包/类
boolean isCorrect(){
  if(schema == null) return true;
  FeatureSchema fSchema = schema.getFeatureSchema(name);
  return fSchema == null || fSchema.getPermittedValues() == null||
         fSchema.getPermittedValues().contains(value);
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:7,代码来源:FeaturesSchemaEditor.java

示例5: isRequired

import gate.creole.FeatureSchema; //导入依赖的package包/类
boolean isRequired(){
  if(schema == null) return false;
  FeatureSchema fSchema = schema.getFeatureSchema(name);
  return fSchema != null && fSchema.isRequired();
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:6,代码来源:FeaturesSchemaEditor.java

示例6: getDefaultValue

import gate.creole.FeatureSchema; //导入依赖的package包/类
Object getDefaultValue(){
  if(schema == null) return null;
  FeatureSchema fSchema = schema.getFeatureSchema(name);
  return fSchema == null ? null : fSchema.getFeatureValue();
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:6,代码来源:FeaturesSchemaEditor.java

示例7: prepareCombo

import gate.creole.FeatureSchema; //导入依赖的package包/类
protected void prepareCombo(JComboBox combo, int row, int column){
  Feature feature = featureList.get(row);
  DefaultComboBoxModel comboModel = (DefaultComboBoxModel)combo.getModel(); 
  comboModel.removeAllElements();
  switch(column){
    case NAME_COL:
      List<String> fNames = new ArrayList<String>();
      if(schema != null && schema.getFeatureSchemaSet() != null){
        Iterator<FeatureSchema> fSchemaIter = schema.getFeatureSchemaSet().iterator();
        while(fSchemaIter.hasNext())
          fNames.add(fSchemaIter.next().getFeatureName());
      }
      if(!fNames.contains(feature.name))fNames.add(feature.name);
      Collections.sort(fNames);
      for(Iterator<String> nameIter = fNames.iterator(); 
          nameIter.hasNext(); 
          comboModel.addElement(nameIter.next()));
      combo.getEditor().getEditorComponent().setBackground(defaultBackground);          
      combo.setSelectedItem(feature.name);
      break;
    case VALUE_COL:
      List<Object> fValues = new ArrayList<Object>();
      if(feature.isSchemaFeature()){
        Set<Object> permValues = schema.getFeatureSchema(feature.name).
          getPermittedValues();
        if(permValues != null) fValues.addAll(permValues);
      }
      if(!fValues.contains(feature.value)) fValues.add(feature.value);
      Collections.sort(fValues, defaultComparator);
      for(Iterator<Object> valIter = fValues.iterator(); 
          valIter.hasNext(); 
          comboModel.addElement(valIter.next()));
      combo.getEditor().getEditorComponent().setBackground(feature.isCorrect() ?
          defaultBackground :
          (feature.isRequired() ? REQUIRED_WRONG : OPTIONAL_WRONG));
      combo.setSelectedItem(feature.value);
      break;
    default: ;
  }
  
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:42,代码来源:FeaturesSchemaEditor.java

示例8: isCorrect

import gate.creole.FeatureSchema; //导入依赖的package包/类
boolean isCorrect() {
  if(schema == null) return true;
  FeatureSchema fSchema = schema.getFeatureSchema(name);
  return fSchema == null || fSchema.getPermittedValues() == null
    || fSchema.getPermittedValues().contains(value);
}
 
开发者ID:naditina,项目名称:gate-semano,代码行数:7,代码来源:FeaturesEditor.java

示例9: isRequired

import gate.creole.FeatureSchema; //导入依赖的package包/类
boolean isRequired() {
  if(schema == null) return false;
  FeatureSchema fSchema = schema.getFeatureSchema(name);
  return fSchema != null && fSchema.isRequired();
}
 
开发者ID:naditina,项目名称:gate-semano,代码行数:6,代码来源:FeaturesEditor.java

示例10: getDefaultValue

import gate.creole.FeatureSchema; //导入依赖的package包/类
Object getDefaultValue() {
  if(schema == null) return null;
  FeatureSchema fSchema = schema.getFeatureSchema(name);
  return fSchema == null ? null : fSchema.getFeatureValue();
}
 
开发者ID:naditina,项目名称:gate-semano,代码行数:6,代码来源:FeaturesEditor.java

示例11: prepareCombo

import gate.creole.FeatureSchema; //导入依赖的package包/类
protected void prepareCombo(JComboBox combo, int row, int column) {
  Feature feature = (Feature)featureList.get(row);
  DefaultComboBoxModel comboModel = (DefaultComboBoxModel)combo.getModel();
  comboModel.removeAllElements();
  switch(column){
    case NAME_COL:
      List fNames = new ArrayList();
      if(schema != null && schema.getFeatureSchemaSet() != null) {
        Iterator fSchemaIter = schema.getFeatureSchemaSet().iterator();
        while(fSchemaIter.hasNext())
          fNames.add(((FeatureSchema)fSchemaIter.next()).getFeatureName());
      }
      if(!fNames.contains(feature.name)) fNames.add(feature.name);
      Collections.sort(fNames);
      for(Iterator nameIter = fNames.iterator(); nameIter.hasNext(); comboModel
        .addElement(nameIter.next()))
        ;
      combo.getEditor().getEditorComponent().setBackground(
        FeaturesEditor.this.getBackground());
      combo.setSelectedItem(feature.name);
      break;
    case VALUE_COL:
      List fValues = new ArrayList();
      if(feature.isSchemaFeature()) {
        Set permValues =
          schema.getFeatureSchema(feature.name).getPermittedValues();
        if(permValues != null) fValues.addAll(permValues);
      }
      if(!fValues.contains(feature.value)) fValues.add(feature.value);
      Collections.sort(fValues, defaultComparator);
      for(Iterator valIter = fValues.iterator(); valIter.hasNext(); comboModel
        .addElement(valIter.next()))
        ;
      combo.getEditor().getEditorComponent().setBackground(
        feature.isCorrect()
          ? FeaturesEditor.this.getBackground()
          : (feature.isRequired() ? REQUIRED_WRONG : OPTIONAL_WRONG));
      combo.setSelectedItem(feature.value);
      break;
    default:
      ;
  }
}
 
开发者ID:naditina,项目名称:gate-semano,代码行数:44,代码来源:FeaturesEditor.java


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