added some documentation

This commit is contained in:
hneemann 2016-04-16 15:16:23 +02:00
parent 4668f42a5f
commit 5f23e580a7
7 changed files with 63 additions and 2 deletions

View File

@ -10,10 +10,15 @@ import de.neemann.digital.core.element.Keys;
import de.neemann.digital.lang.Lang; import de.neemann.digital.lang.Lang;
/** /**
* The Button
*
* @author hneemann * @author hneemann
*/ */
public class Button implements Element { public class Button implements Element {
/**
* The Button description
*/
public static final ElementTypeDescription DESCRIPTION = new ElementTypeDescription(Button.class) public static final ElementTypeDescription DESCRIPTION = new ElementTypeDescription(Button.class)
.addAttribute(Keys.ROTATE) .addAttribute(Keys.ROTATE)
.addAttribute(Keys.LABEL); .addAttribute(Keys.LABEL);
@ -21,6 +26,11 @@ public class Button implements Element {
private final ObservableValue output; private final ObservableValue output;
private final String label; private final String label;
/**
* Creates a new instance
*
* @param attributes the attributes
*/
public Button(ElementAttributes attributes) { public Button(ElementAttributes attributes) {
output = new ObservableValue("out", 1); output = new ObservableValue("out", 1);
label = attributes.get(Keys.LABEL); label = attributes.get(Keys.LABEL);

View File

@ -10,10 +10,15 @@ import de.neemann.digital.core.element.Keys;
import de.neemann.digital.lang.Lang; import de.neemann.digital.lang.Lang;
/** /**
* A constant
*
* @author hneemann * @author hneemann
*/ */
public class Const implements Element { public class Const implements Element {
/**
* The Constant description
*/
public static final ElementTypeDescription DESCRIPTION = new ElementTypeDescription(Const.class) public static final ElementTypeDescription DESCRIPTION = new ElementTypeDescription(Const.class)
.addAttribute(Keys.ROTATE) .addAttribute(Keys.ROTATE)
.addAttribute(Keys.BITS) .addAttribute(Keys.BITS)
@ -21,6 +26,11 @@ public class Const implements Element {
private final ObservableValue output; private final ObservableValue output;
/**
* Creates a new instance
*
* @param attributes the attributes
*/
public Const(ElementAttributes attributes) { public Const(ElementAttributes attributes) {
output = new ObservableValue("out", attributes.get(Keys.BITS)); output = new ObservableValue("out", attributes.get(Keys.BITS));
output.setValue(attributes.get(Keys.VALUE)); output.setValue(attributes.get(Keys.VALUE));

View File

@ -10,6 +10,8 @@ import de.neemann.digital.core.element.Keys;
import de.neemann.digital.lang.Lang; import de.neemann.digital.lang.Lang;
/** /**
* The Input
*
* @author hneemann * @author hneemann
*/ */
public class In implements Element { public class In implements Element {

View File

@ -11,10 +11,15 @@ import de.neemann.digital.core.element.Keys;
import static de.neemann.digital.core.element.PinInfo.input; import static de.neemann.digital.core.element.PinInfo.input;
/** /**
* The different outputs
*
* @author hneemann * @author hneemann
*/ */
public class Out implements Element { public class Out implements Element {
/**
* The Input description
*/
public static final ElementTypeDescription DESCRIPTION public static final ElementTypeDescription DESCRIPTION
= new ElementTypeDescription(Out.class, input("in")) { = new ElementTypeDescription(Out.class, input("in")) {
@Override @Override
@ -27,12 +32,18 @@ public class Out implements Element {
.addAttribute(Keys.LABEL) .addAttribute(Keys.LABEL)
.addAttribute(Keys.DESCRIPTION); .addAttribute(Keys.DESCRIPTION);
/**
* The LED description
*/
public static final ElementTypeDescription LEDDESCRIPTION public static final ElementTypeDescription LEDDESCRIPTION
= new ElementTypeDescription("LED", Out.class, input("in")) = new ElementTypeDescription("LED", Out.class, input("in"))
.addAttribute(Keys.ROTATE) .addAttribute(Keys.ROTATE)
.addAttribute(Keys.LABEL) .addAttribute(Keys.LABEL)
.addAttribute(Keys.COLOR); .addAttribute(Keys.COLOR);
/**
* The seven segment display description
*/
public static final ElementTypeDescription SEVENDESCRIPTION public static final ElementTypeDescription SEVENDESCRIPTION
= new ElementTypeDescription("Seven-Seg", = new ElementTypeDescription("Seven-Seg",
attributes -> { attributes -> {
@ -42,6 +53,9 @@ public class Out implements Element {
.addAttribute(Keys.LABEL) .addAttribute(Keys.LABEL)
.addAttribute(Keys.COLOR); .addAttribute(Keys.COLOR);
/**
* The seven segment hex display description
*/
public static final ElementTypeDescription SEVENHEXDESCRIPTION public static final ElementTypeDescription SEVENHEXDESCRIPTION
= new ElementTypeDescription("Seven-Seg-Hex", = new ElementTypeDescription("Seven-Seg-Hex",
attributes -> { attributes -> {
@ -54,11 +68,21 @@ public class Out implements Element {
private final String label; private final String label;
private ObservableValue value; private ObservableValue value;
/**
* Creates a new instance
*
* @param attributes the attributes
*/
public Out(ElementAttributes attributes) { public Out(ElementAttributes attributes) {
bits = new int[]{attributes.getBits()}; bits = new int[]{attributes.getBits()};
label = attributes.get(Keys.LABEL); label = attributes.get(Keys.LABEL);
} }
/**
* Creates a new instance
*
* @param bits the bitcount of the different inputs
*/
public Out(int... bits) { public Out(int... bits) {
this.bits = bits; this.bits = bits;
label = null; label = null;

View File

@ -11,11 +11,15 @@ import de.neemann.digital.core.element.Keys;
import static de.neemann.digital.core.element.PinInfo.input; import static de.neemann.digital.core.element.PinInfo.input;
/** /**
* The measurement Probe
*
* @author hneemann * @author hneemann
*/ */
public class Probe implements Element { public class Probe implements Element {
/**
* The Probe description
*/
public static final ElementTypeDescription DESCRIPTION public static final ElementTypeDescription DESCRIPTION
= new ElementTypeDescription("Probe", Probe.class, input("in")) = new ElementTypeDescription("Probe", Probe.class, input("in"))
.addAttribute(Keys.ROTATE) .addAttribute(Keys.ROTATE)
@ -24,6 +28,11 @@ public class Probe implements Element {
private final String label; private final String label;
private ObservableValue value; private ObservableValue value;
/**
* Creates a new instance
*
* @param attributes the attributes
*/
public Probe(ElementAttributes attributes) { public Probe(ElementAttributes attributes) {
label = attributes.get(Keys.LABEL); label = attributes.get(Keys.LABEL);
} }

View File

@ -0,0 +1,6 @@
/**
* The basic IO elements like Buttons, Inputs, Outputs, LEDs
*
* @author hneemann
*/
package de.neemann.digital.core.io;

View File

@ -8,4 +8,4 @@
* *
* @author hneemann * @author hneemann
*/ */
package de.neemann.digital.core; package de.neemann.digital.core;