use of jmri.jmrit.signalling.entryexit.PointDetails in project JMRI by JMRI.
the class EntryExitPairs method getNxPairNumbers.
public int getNxPairNumbers(LayoutEditor panel) {
int total = 0;
for (Entry<PointDetails, Source> e : nxpair.entrySet()) {
PointDetails key = e.getKey();
LayoutEditor pan = key.getPanel();
if (pan == panel) {
total = total + e.getValue().getNumberOfDestinations();
}
// end while
}
return total;
}
use of jmri.jmrit.signalling.entryexit.PointDetails in project JMRI by JMRI.
the class EntryExitPairs method providePoint.
/**
* Return a point if it already exists, or create a new one if not.
*/
private PointDetails providePoint(LayoutBlock source, List<LayoutBlock> protecting, LayoutEditor panel) {
PointDetails sourcePoint = getPointDetails(source, protecting, panel);
if (sourcePoint == null) {
sourcePoint = new PointDetails(source, protecting);
sourcePoint.setPanel(panel);
}
return sourcePoint;
}
use of jmri.jmrit.signalling.entryexit.PointDetails in project JMRI by JMRI.
the class EntryExitPairs method getSourcePanelList.
public ArrayList<LayoutEditor> getSourcePanelList() {
ArrayList<LayoutEditor> list = new ArrayList<LayoutEditor>();
for (Entry<PointDetails, Source> e : nxpair.entrySet()) {
PointDetails key = e.getKey();
LayoutEditor pan = key.getPanel();
if (!list.contains(pan)) {
list.add(pan);
}
}
return list;
}
use of jmri.jmrit.signalling.entryexit.PointDetails in project JMRI by JMRI.
the class EntryExitPairs method addNXSourcePoint.
public void addNXSourcePoint(NamedBean source, LayoutEditor panel) {
if (source == null) {
log.error("source bean supplied is null");
return;
}
if (panel == null) {
log.error("panel supplied is null");
return;
}
PointDetails point;
point = providePoint(source, panel);
if (point == null) {
log.error("Unable to find a location on the panel " + panel.getLayoutName() + " for item " + source.getDisplayName());
return;
}
}
use of jmri.jmrit.signalling.entryexit.PointDetails in project JMRI by JMRI.
the class EntryExitPairs method addNXDestination.
public void addNXDestination(NamedBean source, NamedBean destination, LayoutEditor panel, String id) {
if (source == null) {
log.error("no source Object provided");
return;
}
if (destination == null) {
log.error("no destination Object provided");
return;
}
PointDetails sourcePoint = providePoint(source, panel);
if (sourcePoint == null) {
log.error("source point for " + source.getDisplayName() + " not created addNXDes");
return;
}
sourcePoint.setPanel(panel);
sourcePoint.setRefObject(source);
PointDetails destPoint = providePoint(destination, panel);
if (destPoint != null) {
destPoint.setPanel(panel);
destPoint.setRefObject(destination);
if (!nxpair.containsKey(sourcePoint)) {
nxpair.put(sourcePoint, new Source(sourcePoint));
}
nxpair.get(sourcePoint).addDestination(destPoint, id);
}
firePropertyChange("length", null, null);
}
Aggregations