Ejemplo n.º 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);
  }
Ejemplo n.º 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);
            }
          }
        });
  }