mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-12 22:36:02 -04:00
improves performance of model creation
This commit is contained in:
parent
56e7ec7d01
commit
4cebc973ca
@ -137,7 +137,8 @@ public class Net {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add all given pins to the net
|
* Add all given pins to the net.
|
||||||
|
* Used during custom component connection.
|
||||||
*
|
*
|
||||||
* @param p the pins
|
* @param p the pins
|
||||||
*/
|
*/
|
||||||
@ -146,7 +147,8 @@ public class Net {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add all given pins to the net
|
* Add all given pins to the net.
|
||||||
|
* Used during custom component connection.
|
||||||
*
|
*
|
||||||
* @param otherNet the other net
|
* @param otherNet the other net
|
||||||
*/
|
*/
|
||||||
@ -238,7 +240,8 @@ public class Net {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a pin from the net
|
* Removes a pin from the net.
|
||||||
|
* Used during custom component connection.
|
||||||
*
|
*
|
||||||
* @param p the pin to remove
|
* @param p the pin to remove
|
||||||
* @throws PinException is thrown if pin is not present
|
* @throws PinException is thrown if pin is not present
|
||||||
|
@ -21,6 +21,7 @@ import java.util.Iterator;
|
|||||||
public class NetList implements Iterable<Net> {
|
public class NetList implements Iterable<Net> {
|
||||||
|
|
||||||
private final ArrayList<Net> netList;
|
private final ArrayList<Net> netList;
|
||||||
|
private HashMap<Vector, Net> posMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a net list from the given circuit
|
* Creates a net list from the given circuit
|
||||||
@ -130,7 +131,8 @@ public class NetList implements Iterable<Net> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a complete net list to this net list
|
* Adds a complete net list to this net list.
|
||||||
|
* Used during custom component connection.
|
||||||
*
|
*
|
||||||
* @param netList the net list to add
|
* @param netList the net list to add
|
||||||
*/
|
*/
|
||||||
@ -139,17 +141,18 @@ public class NetList implements Iterable<Net> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a pin to this net list
|
* Adds a pin to this net list.
|
||||||
* Used only during model creation
|
* Used only during model creation.
|
||||||
*
|
*
|
||||||
* @param pin the pin to add
|
* @param pin the pin to add
|
||||||
*/
|
*/
|
||||||
public void add(Pin pin) {
|
public void add(Pin pin) {
|
||||||
for (Net net : netList)
|
if (posMap == null)
|
||||||
if (net.contains(pin.getPos())) {
|
posMap = getAllNetPositions();
|
||||||
net.add(pin);
|
|
||||||
return;
|
Net net = posMap.get(pin.getPos());
|
||||||
}
|
if (net != null)
|
||||||
|
net.add(pin);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void add(Wire w) {
|
private void add(Wire w) {
|
||||||
@ -188,7 +191,8 @@ public class NetList implements Iterable<Net> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the net of the given pin
|
* Returns the net of the given pin.
|
||||||
|
* Used during custom component connection.
|
||||||
*
|
*
|
||||||
* @param p the pin
|
* @param p the pin
|
||||||
* @return the net or null if not found
|
* @return the net or null if not found
|
||||||
@ -222,7 +226,8 @@ public class NetList implements Iterable<Net> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a net from this net list
|
* Removes a net from this net list.
|
||||||
|
* Used during custom component connection.
|
||||||
*
|
*
|
||||||
* @param childNet the net to remove
|
* @param childNet the net to remove
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user