Skip to content
Snippets Groups Projects
Commit f6ed2edc authored by Brutzman, Don's avatar Brutzman, Don
Browse files

permit progressive setters

parent 648022e1
No related branches found
No related tags found
No related merge requests found
...@@ -187,8 +187,8 @@ public class PduRecorder // implements PduReceiver ...@@ -187,8 +187,8 @@ public class PduRecorder // implements PduReceiver
/** /**
* @param newEncodingPduLog the pduLogEncoding to set * @param newEncodingPduLog the pduLogEncoding to set
*/ * @return same object to permit progressive setters */
public void setEncodingPduLog(String newEncodingPduLog) public PduRecorder setEncodingPduLog(String newEncodingPduLog)
{ {
newEncodingPduLog = newEncodingPduLog.trim(); newEncodingPduLog = newEncodingPduLog.trim();
String errorMessage = "*** setEncodingPduLog(" + newEncodingPduLog + ") "; String errorMessage = "*** setEncodingPduLog(" + newEncodingPduLog + ") ";
...@@ -196,7 +196,7 @@ public class PduRecorder // implements PduReceiver ...@@ -196,7 +196,7 @@ public class PduRecorder // implements PduReceiver
{ {
encodingPduLog = newEncodingPduLog; encodingPduLog = newEncodingPduLog;
includeHeaders = encodingPduLog.equals(ENCODING_PLAINTEXT); includeHeaders = encodingPduLog.equals(ENCODING_PLAINTEXT);
return; return this;
} }
else if (ENCODING_OPTIONS_TODO.contains(newEncodingPduLog)) else if (ENCODING_OPTIONS_TODO.contains(newEncodingPduLog))
{ {
...@@ -209,7 +209,7 @@ public class PduRecorder // implements PduReceiver ...@@ -209,7 +209,7 @@ public class PduRecorder // implements PduReceiver
errorMessage += ", encodingPduLog=" + encodingPduLog + " is unchanged"; errorMessage += ", encodingPduLog=" + encodingPduLog + " is unchanged";
System.err.println (errorMessage); System.err.println (errorMessage);
System.err.flush(); // since network threads may be occurring System.err.flush(); // since network threads may be occurring
// return return this;
} }
/** Resume instance operation /** Resume instance operation
...@@ -611,12 +611,13 @@ public class PduRecorder // implements PduReceiver ...@@ -611,12 +611,13 @@ public class PduRecorder // implements PduReceiver
* Network address for send and receive connections. * Network address for send and receive connections.
* @see <a href="https://en.wikipedia.org/wiki/Multicast_address">https://en.wikipedia.org/wiki/Multicast_address</a> * @see <a href="https://en.wikipedia.org/wiki/Multicast_address">https://en.wikipedia.org/wiki/Multicast_address</a>
* @param newAddress the new network address to set * @param newAddress the new network address to set
*/ * @return same object to permit progressive setters */
public void setAddress(String newAddress) { public PduRecorder setAddress(String newAddress) {
if (isRunning() && !disAddress.equals(newAddress)) if (isRunning() && !disAddress.equals(newAddress))
System.out.println(TRACE_PREFIX + "*** warning, attempting to change network address while running..."); System.out.println(TRACE_PREFIX + "*** warning, attempting to change network address while running...");
// TODO warn if netIF already created // TODO warn if netIF already created
this.disAddress = newAddress; this.disAddress = newAddress;
return this;
} }
/** Get network port used, multicast or unicast. /** Get network port used, multicast or unicast.
* @see <a href="https://en.wikipedia.org/wiki/Port_(computer_networking)">https://en.wikipedia.org/wiki/Port_(computer_networking)</a> * @see <a href="https://en.wikipedia.org/wiki/Port_(computer_networking)">https://en.wikipedia.org/wiki/Port_(computer_networking)</a>
...@@ -630,13 +631,14 @@ public class PduRecorder // implements PduReceiver ...@@ -630,13 +631,14 @@ public class PduRecorder // implements PduReceiver
/** Set network port used, multicast or unicast. /** Set network port used, multicast or unicast.
* @see <a href="https://en.wikipedia.org/wiki/Port_(computer_networking)">https://en.wikipedia.org/wiki/Port_(computer_networking)</a> * @see <a href="https://en.wikipedia.org/wiki/Port_(computer_networking)">https://en.wikipedia.org/wiki/Port_(computer_networking)</a>
* @param newPortValue the disPort value to set * @param newPortValue the disPort value to set
*/ * @return same object to permit progressive setters */
public void setPort(int newPortValue) public PduRecorder setPort(int newPortValue)
{ {
if (isRunning() && (this.disPort != newPortValue)) if (isRunning() && (this.disPort != newPortValue))
System.out.println(TRACE_PREFIX + "*** warning, attempting to change network port while running..."); System.out.println(TRACE_PREFIX + "*** warning, attempting to change network port while running...");
// TODO warn if netIF already created // TODO warn if netIF already created
this.disPort = newPortValue; this.disPort = newPortValue;
return this;
} }
/** /**
* Get simple descriptor (such as parent class name) for this network interface, used in trace statements * Get simple descriptor (such as parent class name) for this network interface, used in trace statements
...@@ -649,19 +651,21 @@ public class PduRecorder // implements PduReceiver ...@@ -649,19 +651,21 @@ public class PduRecorder // implements PduReceiver
/** /**
* Set new simple descriptor (such as parent class name) for this network interface, used in trace statements * Set new simple descriptor (such as parent class name) for this network interface, used in trace statements
* @param newDescriptor simple descriptor name * @param newDescriptor simple descriptor name
*/ * @return same object to permit progressive setters */
public void setDescriptor(String newDescriptor) public PduRecorder setDescriptor(String newDescriptor)
{ {
this.descriptor = newDescriptor; if (newDescriptor != null)
TRACE_PREFIX = "[" + (DisThreadedNetworkInterface.class.getSimpleName() + " " + descriptor).trim() + "] "; this.descriptor = newDescriptor.trim();
TRACE_PREFIX = "[" + DisThreadedNetworkInterface.class.getSimpleName() + " " + descriptor + "] ";
return this;
} }
/** /**
* Set whether or not trace statements are provided when packets are sent or received. * Set whether or not trace statements are provided when packets are sent or received.
* @param newValue the verbose status to set, also resets verboseReceipt and verboseSending to match. * @param newValue the verbose status to set, also resets verboseReceipt and verboseSending to match.
* @see verboseReceipt * @see verboseReceipt
* @see verboseSending * @see verboseSending
*/ * @return same object to permit progressive setters */
public void setVerbose(boolean newValue) public PduRecorder setVerbose(boolean newValue)
{ {
this.verbose = newValue; this.verbose = newValue;
verboseReceipt = verbose; verboseReceipt = verbose;
...@@ -670,6 +674,7 @@ public class PduRecorder // implements PduReceiver ...@@ -670,6 +674,7 @@ public class PduRecorder // implements PduReceiver
{ {
disThreadedNetworkInterface.setVerbose(newValue); disThreadedNetworkInterface.setVerbose(newValue);
} }
return this;
} }
/** /**
* Whether or not trace statements are provided when packets are sent or received. * Whether or not trace statements are provided when packets are sent or received.
...@@ -686,8 +691,8 @@ public class PduRecorder // implements PduReceiver ...@@ -686,8 +691,8 @@ public class PduRecorder // implements PduReceiver
* @param newValue the verboseReceipt status to set * @param newValue the verboseReceipt status to set
* @see verbose * @see verbose
* @see verboseSending * @see verboseSending
*/ * @return same object to permit progressive setters */
public void setVerboseReceipt(boolean newValue) public PduRecorder setVerboseReceipt(boolean newValue)
{ {
this.verboseReceipt = newValue; this.verboseReceipt = newValue;
verbose = (verboseReceipt || verboseSending); verbose = (verboseReceipt || verboseSending);
...@@ -695,6 +700,7 @@ public class PduRecorder // implements PduReceiver ...@@ -695,6 +700,7 @@ public class PduRecorder // implements PduReceiver
{ {
disThreadedNetworkInterface.setVerboseReceipt(newValue); disThreadedNetworkInterface.setVerboseReceipt(newValue);
} }
return this;
} }
/** /**
* Whether or not trace statements are provided when packets are received. * Whether or not trace statements are provided when packets are received.
...@@ -710,8 +716,8 @@ public class PduRecorder // implements PduReceiver ...@@ -710,8 +716,8 @@ public class PduRecorder // implements PduReceiver
* @param newValue the verboseSending status to set * @param newValue the verboseSending status to set
* @see verbose * @see verbose
* @see verboseReceipt * @see verboseReceipt
*/ * @return same object to permit progressive setters */
public void setVerboseSending(boolean newValue) public PduRecorder setVerboseSending(boolean newValue)
{ {
this.verboseSending = newValue; this.verboseSending = newValue;
verbose = (verboseReceipt || verboseSending); verbose = (verboseReceipt || verboseSending);
...@@ -719,6 +725,7 @@ public class PduRecorder // implements PduReceiver ...@@ -719,6 +725,7 @@ public class PduRecorder // implements PduReceiver
{ {
disThreadedNetworkInterface.setVerboseSending(newValue); disThreadedNetworkInterface.setVerboseSending(newValue);
} }
return this;
} }
/** /**
* Whether or not trace statements are provided when packets are sent. * Whether or not trace statements are provided when packets are sent.
...@@ -741,14 +748,15 @@ public class PduRecorder // implements PduReceiver ...@@ -741,14 +748,15 @@ public class PduRecorder // implements PduReceiver
/** /**
* Set whether or not trace statements include timestamp values. * Set whether or not trace statements include timestamp values.
* @param verboseIncludesTimestamp the value to set * @param verboseIncludesTimestamp the value to set
*/ * @return same object to permit progressive setters */
public void setVerboseIncludesTimestamp(boolean verboseIncludesTimestamp) public PduRecorder setVerboseIncludesTimestamp(boolean verboseIncludesTimestamp)
{ {
this.verboseIncludesTimestamp = verboseIncludesTimestamp; this.verboseIncludesTimestamp = verboseIncludesTimestamp;
if (disThreadedNetworkInterface != null) if (disThreadedNetworkInterface != null)
{ {
disThreadedNetworkInterface.setVerboseIncludesTimestamp(verboseIncludesTimestamp); disThreadedNetworkInterface.setVerboseIncludesTimestamp(verboseIncludesTimestamp);
} }
return this;
} }
/** /**
...@@ -760,9 +768,10 @@ public class PduRecorder // implements PduReceiver ...@@ -760,9 +768,10 @@ public class PduRecorder // implements PduReceiver
/** /**
* @param logFileName the logFileName to set * @param logFileName the logFileName to set
*/ * @return same object to permit progressive setters */
public void setLogFileName(String logFileName) { public PduRecorder setLogFileName(String logFileName) {
this.logFileName = logFileName; this.logFileName = logFileName;
return this;
} }
/** /**
...@@ -776,10 +785,11 @@ public class PduRecorder // implements PduReceiver ...@@ -776,10 +785,11 @@ public class PduRecorder // implements PduReceiver
/** /**
* Set output directory for this PduRecorder * Set output directory for this PduRecorder
* @param outputDirectory the outputDirectory to set * @param outputDirectory the outputDirectory to set
*/ * @return same object to permit progressive setters */
public void setOutputDirectory(String outputDirectory) { public PduRecorder setOutputDirectory(String outputDirectory) {
this.outputDirectory = outputDirectory; this.outputDirectory = outputDirectory;
outputDirectoryPath = new File(outputDirectory).toPath(); outputDirectoryPath = new File(outputDirectory).toPath();
return this;
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment