Package com.cburch.logisim.analyze.model

Examples of com.cburch.logisim.analyze.model.Entry


    public void keyTyped(KeyEvent e) {
      int mask = e.getModifiers();
      if ((mask & ~InputEvent.SHIFT_MASK) != 0) return;
 
      char c = e.getKeyChar();
      Entry newEntry = null;
      switch (c) {
      case ' ':
        if (cursorRow >= 0) {
          TruthTable model = table.getTruthTable();
          int inputs = model.getInputColumnCount();
          if (cursorCol >= inputs) {
            Entry cur = model.getOutputEntry(cursorRow, cursorCol - inputs);
            if (cur == Entry.ZERO) cur = Entry.ONE;
            else if (cur == Entry.ONE) cur = Entry.DONT_CARE;
            else cur = Entry.ZERO;
            model.setOutputEntry(cursorRow, cursorCol - inputs, cur);
          }
View Full Code Here


 
  @Override
  public String getToolTipText(MouseEvent event) {
    int row = getRow(event);
    int col = getOutputColumn(event);
    Entry entry = table.getOutputEntry(row, col);
    return entry.getErrorMessage();
  }
View Full Code Here

    if (inputs == 0) left += cellWidth + COLUMN_SEP;
    boolean provisional = false;
    for (int i = firstRow; i < lastRow; i++) {
      x = left;
      for (int j = 0; j < inputs + outputs; j++) {
        Entry entry = j < inputs ? table.getInputEntry(i, j)
            : table.getOutputEntry(i, j - inputs);
        if (provisionalValue != null && i == provisionalY
            && j - inputs == provisionalX) {
          provisional = true;
          entry = provisionalValue;
        }
        if (entry.isError()) {
          g.setColor(ERROR_COLOR);
          g.fillRect(x, y, cellWidth, cellHeight);
          g.setColor(Color.BLACK);
        }
        String label = entry.getDescription();
        int width = bodyMetric.stringWidth(label);
        if (provisional) {
          provisional = false;
          g.setColor(Color.GREEN);
          g.drawString(label, x + (cellWidth - width) / 2,
View Full Code Here

  @Override
  public String getToolTipText(MouseEvent event) {
    TruthTable table = model.getTruthTable();
    int row = getRow(event);
    int col = getOutputColumn(event);
    Entry entry = table.getOutputEntry(row, col);
    return entry.getErrorMessage();
  }
View Full Code Here

    y += cellHeight;
    g.setColor(ERROR_COLOR);
    for (int i = 0; i < rows; i++) {
      for (int j = 0; j < cols; j++) {
        int row = getTableRow(i, j, rows, cols);
        Entry entry = table.getOutputEntry(row, outputColumn);
        if (provisionalValue != null && row == provisionalY
            && outputColumn == provisionalX) entry = provisionalValue;
        if (entry.isError()) {
          g.fillRect(x + j * cellWidth, y + i * cellHeight, cellWidth, cellHeight);
        }
      }
    }
   
    List<Implicant> implicants = model.getOutputExpressions().getMinimalImplicants(output);
    if (implicants != null) {
      int index = 0;
      for (Implicant imp : implicants) {
        g.setColor(IMP_COLORS[index % IMP_COLORS.length]);
        paintImplicant(g, imp, x, y, rows, cols);
        index++;
      }
    }
   
    g.setColor(Color.GRAY);
    if (cols > 1 || inputCount == 0) g.drawLine(x, y, left + tableWidth, y);
    if (rows > 1 || inputCount == 0) g.drawLine(x, y, x, top + tableHeight);
    if (outputColumn < 0) return;
   
    g.setColor(Color.BLACK);
    for (int i = 0; i < rows; i++) {
      for (int j = 0; j < cols; j++) {
        int row = getTableRow(i, j, rows, cols);
        if (provisionalValue != null && row == provisionalY
            && outputColumn == provisionalX) {
          String text = provisionalValue.getDescription();
          g.setColor(Color.GREEN);
          g.drawString(text,
              x + j * cellWidth + (cellWidth - fm.stringWidth(text)) / 2,
              y + i * cellHeight + dy);
          g.setColor(Color.BLACK);
        } else {
          Entry entry = table.getOutputEntry(row, outputColumn);
          String text = entry.getDescription();
          g.drawString(text,
              x + j * cellWidth + (cellWidth - fm.stringWidth(text)) / 2,
              y + i * cellHeight + dy);
        }
      }
View Full Code Here

        }
      } else {
        for (int j = 0; j < columns.length; j++) {
          Instance pin = outputPins.get(j);
          InstanceState pinState = circuitState.getInstanceState(pin);
          Entry out;
          Value outValue = Pin.FACTORY.getValue(pinState).get(0);
          if (outValue == Value.TRUE) out = Entry.ONE;
          else if (outValue == Value.FALSE) out = Entry.ZERO;
          else if (outValue == Value.ERROR) out = Entry.BUS_ERROR;
          else out = Entry.DONT_CARE;
View Full Code Here

                }
            } else {
                for (int j = 0; j < columns.length; j++) {
                    Instance pin = outputPins.get(j);
                    InstanceState pinState = circuitState.getInstanceState(pin);
                    Entry out;
                    Value outValue = Pin.FACTORY.getValue(pinState).get(0);
                    if (outValue == Value.TRUE) {
                        out = Entry.ONE;
                    }
View Full Code Here

        public void keyTyped(KeyEvent e) {
            int mask = e.getModifiers();
            if ((mask & ~InputEvent.SHIFT_MASK) != 0) return;

            char c = e.getKeyChar();
            Entry newEntry = null;
            switch (c) {
            case ' ':
                if (cursorRow >= 0) {
                    TruthTable model = table.getTruthTable();
                    int inputs = model.getInputColumnCount();
                    if (cursorCol >= inputs) {
                        Entry cur = model.getOutputEntry(cursorRow, cursorCol - inputs);
                        if (cur == Entry.ZERO) cur = Entry.ONE;
                        else if (cur == Entry.ONE) {
                            cur = Entry.DONT_CARE;
                        }
View Full Code Here

    @Override
    public String getToolTipText(MouseEvent event) {
        int row = getRow(event);
        int col = getOutputColumn(event);
        Entry entry = table.getOutputEntry(row, col);
        return entry.getErrorMessage();
    }
View Full Code Here

        if (inputs == 0) left += cellWidth + COLUMN_SEP;
        boolean provisional = false;
        for (int i = firstRow; i < lastRow; i++) {
            x = left;
            for (int j = 0; j < inputs + outputs; j++) {
                Entry entry = j < inputs ? table.getInputEntry(i, j)
                        : table.getOutputEntry(i, j - inputs);
                if (provisionalValue != null && i == provisionalY
                        && j - inputs == provisionalX) {
                    provisional = true;
                    entry = provisionalValue;
                }
                if (entry.isError()) {
                    g.setColor(ERROR_COLOR);
                    g.fillRect(x, y, cellWidth, cellHeight);
                    g.setColor(Color.BLACK);
                }
                String label = entry.getDescription();
                int width = bodyMetric.stringWidth(label);
                if (provisional) {
                    provisional = false;
                    g.setColor(Color.GREEN);
                    g.drawString(label, x + (cellWidth - width) / 2,
View Full Code Here

TOP

Related Classes of com.cburch.logisim.analyze.model.Entry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.