// Used in the table label provider
 public String getViewerColumnValue(int index) {
   switch (index) {
     case 0: // transition name
       return transitionName;
     case 1: // qualified name
       return sourceFeature.getName()
           + "."
           + transitionData.stateMachineName
           + "."
           + transitionData.regionName;
     case 2: // requires safe composition
       return Boolean.toString(needsSAT);
     case 3: // has error
       return Boolean.toString(hasError);
     case 4: // logical proposition
       if (!needsSAT || hasError) { // if does not need SAT or is an error return empty
         return "";
       }
       return SCUtils.translatesRequiringImpl(sourceFeature, requiringFeatures);
     case 5: // is consistent (if satisfiable means is inconsistent, that is why it is negated)
       if (!needsSAT || hasError) { // if does not need SAT or is an error return empty
         return "";
       }
       return Boolean.toString(!evaluationValues.get(0)); //
     case 6: // eval time
       if (!needsSAT || hasError) { // if does not need SAT or is an error return empty
         return "";
       }
       return Long.toString(evaluationTime);
     case 7: // remarks
       return errorMessage;
     default:
       return "unkown " + index;
   }
 } // getViewrColumnValue
Esempio n. 2
0
  // --------------------------------------------------------------------------------
  private void verifyData() {
    int typeIndex = typeCombo.getSelectionIndex();
    if (typeIndex == -1) {
      return;
    }
    String value = valueText.getText();
    boolean verified = false;
    switch (typeIndex) {
      case 0: // Double
        try {
          Double.parseDouble(value);
          verified = true;
        } catch (Exception e) {
        }
        break;
      case 1: // Integer
        try {
          Integer.parseInt(value);
          verified = true;
        } catch (Exception e) {
        }
        break;
      case 2: // Long
        try {
          Long.parseLong(value);
          verified = true;
        } catch (Exception e) {
        }
        break;
      case 3: // String
        verified = true;
        break;
      case 4: // List
        try {
          Object o = dataManager.getDB().eval(value, null);
          if (o instanceof BasicDBList) {
            verified = true;
          }
        } catch (Exception e) {
        }
        break;
      case 5: // Map
        try {
          Object o = dataManager.getDB().eval(value, null);
          if (o instanceof BasicDBObject) {
            verified = true;
          }
        } catch (Exception e) {
        }
        break;
      case 6: // Date
        try {
          DateFormat df = new SimpleDateFormat("EEE MMM d HH:mm:ss z yyyy", Locale.ENGLISH);
          df.parse(value);
          verified = true;
        } catch (Exception e) {
          // e.printStackTrace();
        }
        break;
      case 7: // ObjectId
        try {
          new ObjectId(value);
          verified = true;
        } catch (Exception e) {
        }
        break;
      case 8: // Code
        verified = true;
        break;
      case 9: // Binary always false
        break;
      case 10: // Boolean
        if (value.equalsIgnoreCase("true") || value.equalsIgnoreCase("false")) {
          verified = true;
        }
        break;
      case 11: // null
        if (value.equalsIgnoreCase("null")) {
          verified = true;
        }
        break;
      case 12: // Regex
        try {
          java.util.regex.Pattern.compile(value);
          verified = true;
        } catch (Exception e) {
        }
        break;
      case 13: // Symbol not supported yet
        break;
      case 14: // Code with scope not supported yet
        break;
      case 15: // Timestamp not supported yet
        break;
      case 16: // Minkey not supported yet
        break;
      case 17: // Maxkey not supported yet
        break;
    }

    updateButton.setEnabled(verified);
  }