예제 #1
0
 @Override
 public List<String> getChoiches(Localization loc) {
   TreeSet<GeoElement> points = app.getKernel().getPointSet();
   choices.clear();
   choices.add("");
   Iterator<GeoElement> it = points.iterator();
   int count = 0;
   while (it.hasNext() || ++count > MAX_CHOICES) {
     GeoElement p = it.next();
     choices.add(p.getLabel(StringTemplate.editTemplate));
   }
   return choices;
 }
예제 #2
0
  /** @param cell initialize table with cell information */
  protected void initData(GeoCasCell cell) {
    HashSet<GeoElement> vars = new HashSet<GeoElement>();
    if (cell.getInputVE().getVariables() != null) {
      for (GeoElement var : cell.getInputVE().getVariables()) {
        addVariables(var, vars);
      }
    }

    // get the substitution list from cell
    ArrayList<Vector<String>> substList = cell.getSubstList();

    Vector<String> row;
    data = new Vector<Vector<String>>(vars.size() + 1);
    Iterator<GeoElement> iter = vars.iterator();
    while (iter.hasNext()) {
      row = new Vector<String>(2);
      GeoElement var = iter.next();
      String nextVar = var.getLabel(StringTemplate.defaultTemplate);
      int i = 0;
      for (i = 0; i < data.size(); i++) {
        if (data.get(i).firstElement().compareTo(nextVar) >= 0) {
          break;
        }
      }
      if (i == data.size() || !data.get(i).firstElement().equals(nextVar)) {
        row.add(nextVar);
        boolean added = false;
        if (substList != null && !substList.isEmpty()) {
          // search for nextVar in subst list
          for (int k = 0; k < substList.size(); k++) {
            // case we found it
            if (substList.get(k).get(0).equals(nextVar)) {
              // add to substitution data
              row.add(substList.get(k).get(1));
              added = true;
              break;
            }
          }
        }
        // case we didn't found
        if (!added) {
          row.add("");
        }
        data.insertElementAt(row, i);
      }
    }
    row = new Vector<String>(2);
    row.add("");
    row.add("");
    data.add(row);
  }
 @Override
 public final String toString(StringTemplate tpl) {
   // Michael Borcherds 2008-03-30
   // simplified to allow better Chinese translation
   return getLoc().getPlain("TangentToAatB", f.getLabel(tpl), "x = " + ngeo.getLabel(tpl));
 }