mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-25 14:08:27 -04:00
add some comments.
This commit is contained in:
parent
94d58dc13d
commit
aaa5783948
@ -10,12 +10,20 @@ import java.util.List;
|
|||||||
import static de.neemann.digital.draw.shapes.GenericShape.SIZE;
|
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
|
* @author hneemann
|
||||||
*/
|
*/
|
||||||
public class FragmentSameInValue implements Fragment {
|
public class FragmentSameInValue implements Fragment {
|
||||||
private final Fragment fragment;
|
private final Fragment fragment;
|
||||||
private Vector pos;
|
private Vector pos;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new instance
|
||||||
|
*
|
||||||
|
* @param fragment the fragment with all imputs are the same value
|
||||||
|
*/
|
||||||
public FragmentSameInValue(Fragment fragment) {
|
public FragmentSameInValue(Fragment fragment) {
|
||||||
this.fragment = fragment;
|
this.fragment = fragment;
|
||||||
}
|
}
|
||||||
@ -36,13 +44,13 @@ public class FragmentSameInValue implements Fragment {
|
|||||||
public void addToCircuit(Vector pos, Circuit circuit) {
|
public void addToCircuit(Vector pos, Circuit circuit) {
|
||||||
List<Vector> in = Vector.add(fragment.getInputs(), pos);
|
List<Vector> in = Vector.add(fragment.getInputs(), pos);
|
||||||
|
|
||||||
Vector last=null;
|
Vector last = null;
|
||||||
for (Vector v : in) {
|
for (Vector v : in) {
|
||||||
Vector p = v.add(-SIZE, 0);
|
Vector p = v.add(-SIZE, 0);
|
||||||
circuit.add(new Wire(v, p));
|
circuit.add(new Wire(v, p));
|
||||||
if (last!=null)
|
if (last != null)
|
||||||
circuit.add(new Wire(last, p));
|
circuit.add(new Wire(last, p));
|
||||||
last=p;
|
last = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
fragment.addToCircuit(pos, circuit);
|
fragment.addToCircuit(pos, circuit);
|
||||||
|
@ -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
|
* @param n number of pin to ignore
|
||||||
* @return this for call chaining
|
* @return this for call chaining
|
||||||
@ -75,7 +75,7 @@ public class FragmentVisualElement implements Fragment {
|
|||||||
*
|
*
|
||||||
* @param key the key
|
* @param key the key
|
||||||
* @param value the value
|
* @param value the value
|
||||||
* @param <VALUE> the tyype of the value
|
* @param <VALUE> the type of the value
|
||||||
* @return this for call chaining
|
* @return this for call chaining
|
||||||
*/
|
*/
|
||||||
public <VALUE> FragmentVisualElement setAttr(Key<VALUE> key, VALUE value) {
|
public <VALUE> FragmentVisualElement setAttr(Key<VALUE> key, VALUE value) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user