示例#1
0
  public void initializeObjects() {
    xPos.setEditable(true);
    m_function.setOperation(m_initialExpression);
    m_function.setVerticesCount(500);
    m_function.setBoundarysVisible(false);
    PolygonDisplayProperties prop = new PolygonDisplayProperties();
    prop.setObjectColor(Color.blue);
    prop.setBorderColor(Color.blue);
    prop.setAntiAliasing(false);
    m_function.setDisplayProperties(prop);
    PointDisplayProperties pointProp = new PointDisplayProperties();
    pointProp.setObjectColor(Color.red);
    pointProp.setPointRadius(3);
    pointProp.setAntiAliasing(false);
    m_lower.setXY(m_initLowerBound, 0);
    m_upper.setXY(m_initUpperBound, 0);
    m_lower.setDisplayProperties(pointProp);
    m_upper.setDisplayProperties(pointProp);
    getCanvas2D().getW2STransformationHandler().setUniformWorldDim(m_initialCanvasDim);
    m_defInterval.setEditable(true);
    DisplayProperties props = m_defInterval.getDisplayProperties();
    props.setFont(new Font("Serif", Font.PLAIN, 18));
    props.setAntiAliasing(false);
    m_defInterval.setDisplayProperties(props);

    m_defInterval.setBoundary(
        m_initLowerBound, Interval.CLOSED, m_initUpperBound, Interval.OPEN, Interval.SQUARE);
  }
示例#2
0
  private void defineDependencies() {
    m_function.dependsOn(
        new MMInterval[] {m_defInterval},
        new DependencyAdapter() {
          public void doUpdate() {
            m_function.setBorelSet(new FiniteBorelSet(m_defInterval));
          }
        });
    m_defInterval.dependsOn(
        m_lower,
        new DependencyAdapter() {
          public void doUpdate() {
            m_defInterval.setLowerBoundary(
                m_lower.getAffineCoordinatesOfPoint().getEntry(1), Interval.CLOSED);
          }
        });
    m_defInterval.dependsOn(
        m_upper,
        new DependencyAdapter() {
          public void doUpdate() {
            m_defInterval.setUpperBoundary(
                m_upper.getAffineCoordinatesOfPoint().getEntry(1), Interval.OPEN);
          }
        });
    yPos.dependsOn(
        new MMObjectIF[] {xPos, m_function},
        new DependencyAdapter() {
          public void doUpdate() {
            yPos.setDouble(m_function.evaluate(xPos.getDouble()));
          }
        });

    m_lower.dependsOn(
        new MMInterval[] {m_defInterval},
        new DependencyAdapter() {
          public void doUpdate() {
            m_lower.setVisible(true);
            m_lower.setXY(m_defInterval.getLowerBoundaryVal().getDouble(), 0);
            if (m_defInterval.getLowerBoundaryVal().isInfinity()) {
              m_lower.setVisible(false);
            }
          }
        });

    m_upper.dependsOn(
        new MMInterval[] {m_defInterval},
        new DependencyAdapter() {
          public void doUpdate() {
            m_upper.setVisible(true);
            m_upper.setXY(m_defInterval.getUpperBoundaryVal().getDouble(), 0);
            if (m_defInterval.getUpperBoundaryVal().isInfinity()) {
              m_upper.setVisible(false);
            }
          }
        });
  }
示例#3
0
 public void reset() {
   initializeObjects();
   defineDependencies();
   m_lower.invokeUpdaters();
   m_upper.invokeUpdaters();
   m_defInterval.invokeUpdaters();
   m_defInterval.render();
   getCanvas2D().renderScene();
   getCanvas2D().repaint();
 }
示例#4
0
  private void createObjects() {
    m_function = new MMFunctionDefByOp(m_numberClass, m_initialExpression);
    m_function.setEditable(true);
    DisplayProperties props = m_function.getDisplayProperties();
    props.setFont(new Font("Serif", Font.PLAIN, 18));
    m_function.setDisplayProperties(props);

    Affine2DMouseTranslateHandler amth = new Affine2DMouseTranslateHandler(getCanvas2D());
    amth.setinXOnly(true);
    m_lower = new MMAffine2DPoint(m_numberClass);
    m_lower.addHandler(amth);
    m_upper = new MMAffine2DPoint(m_numberClass);
    m_upper.addHandler(amth);
    m_defInterval =
        new MMInterval(
            MMDouble.class,
            m_initLowerBound,
            Interval.CLOSED,
            m_initUpperBound,
            Interval.OPEN,
            Interval.SQUARE);
  }