mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-18 17:34:43 -04:00
fixed some checkstyle issues
This commit is contained in:
parent
d3bd8afe89
commit
2f79bce329
@ -10,7 +10,8 @@ public final class Not implements Expression {
|
|||||||
private Expression expression;
|
private Expression expression;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a not expression
|
* Creates a not expression.
|
||||||
|
* Simplifies the expression if possible.
|
||||||
*
|
*
|
||||||
* @param a the child expression to invert
|
* @param a the child expression to invert
|
||||||
* @return the inverted expression
|
* @return the inverted expression
|
||||||
@ -27,6 +28,12 @@ public final class Not implements Expression {
|
|||||||
return new Not(a);
|
return new Not(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new instance.
|
||||||
|
* In most cases it's better to use {@link Not#not(Expression)}.
|
||||||
|
*
|
||||||
|
* @param expression
|
||||||
|
*/
|
||||||
public Not(Expression expression) {
|
public Not(Expression expression) {
|
||||||
this.expression = expression;
|
this.expression = expression;
|
||||||
}
|
}
|
||||||
|
@ -152,14 +152,14 @@ public class Builder {
|
|||||||
for (FragmentVariable f : fragmentVariables) {
|
for (FragmentVariable f : fragmentVariables) {
|
||||||
Vector p = f.getCircuitPos();
|
Vector p = f.getCircuitPos();
|
||||||
int in = varPos.get(f.getVariable().getIdentifier());
|
int in = varPos.get(f.getVariable().getIdentifier());
|
||||||
if (f.isNeg()) in += SIZE;
|
if (f.isInvert()) in += SIZE;
|
||||||
circuit.add(new Wire(p, new Vector(in, p.y)));
|
circuit.add(new Wire(p, new Vector(in, p.y)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isNotNeeded(String identifier) {
|
private boolean isNotNeeded(String identifier) {
|
||||||
for (FragmentVariable fv : fragmentVariables)
|
for (FragmentVariable fv : fragmentVariables)
|
||||||
if (fv.isNeg() && fv.getVariable().getIdentifier().equals(identifier))
|
if (fv.isInvert() && fv.getVariable().getIdentifier().equals(identifier))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -8,17 +8,25 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Represents a variable
|
||||||
|
*
|
||||||
* @author hneemann
|
* @author hneemann
|
||||||
*/
|
*/
|
||||||
public class FragmentVariable implements Fragment {
|
public class FragmentVariable implements Fragment {
|
||||||
private final Variable variable;
|
private final Variable variable;
|
||||||
private final boolean neg;
|
private final boolean invert;
|
||||||
private Vector pos;
|
private Vector pos;
|
||||||
private Vector circuitPos;
|
private Vector circuitPos;
|
||||||
|
|
||||||
public FragmentVariable(Variable variable, boolean neg) {
|
/**
|
||||||
|
* Creates a new variable
|
||||||
|
*
|
||||||
|
* @param variable the variable
|
||||||
|
* @param invert true if variable needs to be inverted
|
||||||
|
*/
|
||||||
|
public FragmentVariable(Variable variable, boolean invert) {
|
||||||
this.variable = variable;
|
this.variable = variable;
|
||||||
this.neg = neg;
|
this.invert = invert;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -36,12 +44,18 @@ public class FragmentVariable implements Fragment {
|
|||||||
circuitPos = pos.add(this.pos);
|
circuitPos = pos.add(this.pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the position of the variable in the circuit
|
||||||
|
*/
|
||||||
public Vector getCircuitPos() {
|
public Vector getCircuitPos() {
|
||||||
return circuitPos;
|
return circuitPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isNeg() {
|
/**
|
||||||
return neg;
|
* @return true if variable is inverted
|
||||||
|
*/
|
||||||
|
public boolean isInvert() {
|
||||||
|
return invert;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -56,6 +70,9 @@ public class FragmentVariable implements Fragment {
|
|||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the variable
|
||||||
|
*/
|
||||||
public Variable getVariable() {
|
public Variable getVariable() {
|
||||||
return variable;
|
return variable;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user