fixed RelayDT documentation

This commit is contained in:
hneemann 2018-07-17 20:15:08 +02:00
parent 896ce2beb4
commit 0a0e9ca4e9
4 changed files with 19 additions and 11 deletions

View File

@ -10,6 +10,11 @@ package de.neemann.digital.core.element;
*/
public interface PinDescription {
/**
* If the description is set to this value, the pin is ignored in the documentation.
*/
String IGNORE = "ignore";
/**
* The possible pull resistor configurations
* "both" is an error condition which can happen if nets are merged

View File

@ -6,10 +6,7 @@
package de.neemann.digital.core.switching;
import de.neemann.digital.core.*;
import de.neemann.digital.core.element.Element;
import de.neemann.digital.core.element.ElementAttributes;
import de.neemann.digital.core.element.ElementTypeDescription;
import de.neemann.digital.core.element.Keys;
import de.neemann.digital.core.element.*;
import static de.neemann.digital.core.element.PinInfo.input;
@ -103,8 +100,8 @@ public class RelayDT extends Node implements Element {
private Pole(int bits, int num) {
outputAB = new ObservableValue("AB" + num, bits).setBidirectional().setToHighZ();
outputAC = new ObservableValue("AC" + num, bits).setBidirectional().setToHighZ();
outputAB = new ObservableValue("A" + num, bits).setBidirectional().setToHighZ();
outputAC = new ObservableValue("AC" + num, bits).setBidirectional().setToHighZ().setDescription(PinDescription.IGNORE);
outputB = new ObservableValue("B" + num, bits).setBidirectional().setToHighZ();
outputC = new ObservableValue("C" + num, bits).setBidirectional().setToHighZ();
s1 = new Switch(outputAB, outputB, false);

View File

@ -223,8 +223,11 @@ public class ElementHelpDialog extends JDialog {
PinDescriptions outputs = et.getOutputDescriptions(elementAttributes);
if (outputs != null && outputs.size() > 0) {
w.append("<h4>").append(Lang.get("elem_Help_outputs")).append(":</h4>\n<dl>\n");
for (PinDescription i : outputs)
writeEntry(w, ElementAttributes.cleanLabel(i.getName()), i.getDescription());
for (PinDescription i : outputs) {
final String description = i.getDescription();
if (description != PinDescription.IGNORE)
writeEntry(w, ElementAttributes.cleanLabel(i.getName()), description);
}
w.append("</dl>\n");
}

View File

@ -151,9 +151,12 @@ public class DocuTest extends TestCase {
private void writePins(Writer w, PinDescriptions pinDescriptions) throws IOException {
for (PinDescription p : pinDescriptions) {
w.append(" <pin name=\"").append(escapeHTML(p.getName())).append("\">");
w.append(escapeHTML(p.getDescription()));
w.append("</pin>\n");
final String description = p.getDescription();
if (description != PinDescription.IGNORE) {
w.append(" <pin name=\"").append(escapeHTML(p.getName())).append("\">");
w.append(escapeHTML(description));
w.append("</pin>\n");
}
}
}