// Path: src/com/microchip/mplab/nbide/embedded/serialmonitor/SerialPortCommunicator.java
// public static final String PORT_OWNER_NAME = "SerialPortCommunicator";


import static com.microchip.mplab.nbide.embedded.serialmonitor.SerialPortCommunicator.PORT_OWNER_NAME;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;
import org.openide.util.Utilities;
import purejavacomm.CommPortIdentifier;
import purejavacomm.PortInUseException;
import purejavacomm.PureJavaIllegalStateException;
import purejavacomm.SerialPort;
    }

    @Override
    public void setCurrentParity(String value) {
        parity = value;
    }

    @Override
    public String getCurrentParity() {
        return parity != null ? parity : getDefaultParity();
    }

    @Override
    public SerialPortConfig getCurrentConfig() {
        return new SerialPortConfig.Builder()
            .portName( getCurrentPortName() )
            .baudRate( Integer.parseInt( getCurrentBaudRate() ) )
            .flowControl( parseFlowControl( getCurrentFlowControl() ) )
            .dataBits( Integer.parseInt( getCurrentDataBits() ) )
            .stopBits( parseStopBits( getCurrentStopBits() ) )
            .parity( parseParity( getCurrentParity() ) )
            .build();
    }
    
    
    private boolean isPortAvailable( CommPortIdentifier p ) {
        if ( Utilities.isUnix() && p.getName().startsWith("ttyS") ) {        
            SerialPort port = null;
            try {            
                if ( !p.isCurrentlyOwned() ) {
// Path: src/com/microchip/mplab/nbide/embedded/serialmonitor/SerialPortCommunicator.java
// public static final String PORT_OWNER_NAME = "SerialPortCommunicator";


// Path: src/com/microchip/mplab/nbide/embedded/serialmonitor/DefaultSerialMonitorConfigModel.java
import static com.microchip.mplab.nbide.embedded.serialmonitor.SerialPortCommunicator.PORT_OWNER_NAME;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;
import org.openide.util.Utilities;
import purejavacomm.CommPortIdentifier;
import purejavacomm.PortInUseException;
import purejavacomm.PureJavaIllegalStateException;
import purejavacomm.SerialPort;

    }

    @Override
    public void setCurrentParity(String value) {
        parity = value;
    }

    @Override
    public String getCurrentParity() {
        return parity != null ? parity : getDefaultParity();
    }

    @Override
    public SerialPortConfig getCurrentConfig() {
        return new SerialPortConfig.Builder()
            .portName( getCurrentPortName() )
            .baudRate( Integer.parseInt( getCurrentBaudRate() ) )
            .flowControl( parseFlowControl( getCurrentFlowControl() ) )
            .dataBits( Integer.parseInt( getCurrentDataBits() ) )
            .stopBits( parseStopBits( getCurrentStopBits() ) )
            .parity( parseParity( getCurrentParity() ) )
            .build();
    }
    
    
    private boolean isPortAvailable( CommPortIdentifier p ) {
        if ( Utilities.isUnix() && p.getName().startsWith("ttyS") ) {        
            SerialPort port = null;
            try {            
                if ( !p.isCurrentlyOwned() ) {
                    port = (SerialPort) p.open( PORT_OWNER_NAME, 200 );