From aaa57839489731d83f64c159a4b6a0dd75238815 Mon Sep 17 00:00:00 2001 From: hneemann Date: Thu, 14 Jul 2016 22:51:15 +0200 Subject: [PATCH] add some comments. --- .../builder/circuit/FragmentSameInValue.java | 14 +++++++++++--- .../builder/circuit/FragmentVisualElement.java | 4 ++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/main/java/de/neemann/digital/builder/circuit/FragmentSameInValue.java b/src/main/java/de/neemann/digital/builder/circuit/FragmentSameInValue.java index cbed8352c..3130c2dfd 100644 --- a/src/main/java/de/neemann/digital/builder/circuit/FragmentSameInValue.java +++ b/src/main/java/de/neemann/digital/builder/circuit/FragmentSameInValue.java @@ -10,12 +10,20 @@ import java.util.List; import static de.neemann.digital.draw.shapes.GenericShape.SIZE; /** + * Takes a fragment ans sets all inputs to a single value. + * Used to create a circuit with a JK ff with J==K. + * * @author hneemann */ public class FragmentSameInValue implements Fragment { private final Fragment fragment; private Vector pos; + /** + * Creates a new instance + * + * @param fragment the fragment with all imputs are the same value + */ public FragmentSameInValue(Fragment fragment) { this.fragment = fragment; } @@ -36,13 +44,13 @@ public class FragmentSameInValue implements Fragment { public void addToCircuit(Vector pos, Circuit circuit) { List in = Vector.add(fragment.getInputs(), pos); - Vector last=null; + Vector last = null; for (Vector v : in) { Vector p = v.add(-SIZE, 0); circuit.add(new Wire(v, p)); - if (last!=null) + if (last != null) circuit.add(new Wire(last, p)); - last=p; + last = p; } fragment.addToCircuit(pos, circuit); diff --git a/src/main/java/de/neemann/digital/builder/circuit/FragmentVisualElement.java b/src/main/java/de/neemann/digital/builder/circuit/FragmentVisualElement.java index 7542e8a12..0de041edc 100644 --- a/src/main/java/de/neemann/digital/builder/circuit/FragmentVisualElement.java +++ b/src/main/java/de/neemann/digital/builder/circuit/FragmentVisualElement.java @@ -60,7 +60,7 @@ public class FragmentVisualElement implements Fragment { } /** - * Used to ignore the c input at the JK flipflop + * Used to ignore the c input at a JK flipflop * * @param n number of pin to ignore * @return this for call chaining @@ -75,7 +75,7 @@ public class FragmentVisualElement implements Fragment { * * @param key the key * @param value the value - * @param the tyype of the value + * @param the type of the value * @return this for call chaining */ public FragmentVisualElement setAttr(Key key, VALUE value) {