Author: erodriguez
Date: Tue Jan  4 08:05:22 2005
New Revision: 124115

URL: http://svn.apache.org/viewcvs?view=rev&rev=124115
Log:
NTP message value object as immutable value, mutable companion.
Added:
   
incubator/directory/ntp/trunk/core/src/java/org/apache/ntp/message/NtpMessage.java
   (contents, props changed)
   
incubator/directory/ntp/trunk/core/src/java/org/apache/ntp/message/NtpMessageModifier.java

Added: 
incubator/directory/ntp/trunk/core/src/java/org/apache/ntp/message/NtpMessage.java
Url: 
http://svn.apache.org/viewcvs/incubator/directory/ntp/trunk/core/src/java/org/apache/ntp/message/NtpMessage.java?view=auto&rev=124115
==============================================================================
--- (empty file)
+++ 
incubator/directory/ntp/trunk/core/src/java/org/apache/ntp/message/NtpMessage.java
  Tue Jan  4 08:05:22 2005
@@ -0,0 +1,168 @@
+/*
+ *   Copyright 2005 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+
+package org.apache.ntp.message;
+
+
+public class NtpMessage
+{
+       private LeapIndicatorType leapIndicator;
+       private int               versionNumber;
+       private ModeType          mode;
+       private StratumType       stratumType;
+       private int               pollInterval;
+       private double            precision;
+       
+       private double rootDelay;
+       private double rootDispersion;
+       
+       private ReferenceIdentifier referenceIdentifier;
+       
+       private NtpTimeStamp referenceTimestamp;
+       private NtpTimeStamp originateTimestamp;
+       private NtpTimeStamp receiveTimestamp;
+       private NtpTimeStamp transmitTimestamp;
+       
+       
+       public NtpMessage( LeapIndicatorType leapIndicator, int versionNumber,
+                       ModeType mode, StratumType stratumType, int 
pollInterval,
+                       double precision, double rootDelay, double 
rootDispersion,
+                       ReferenceIdentifier referenceIdentifier, NtpTimeStamp 
referenceTimestamp,
+                       NtpTimeStamp originateTimestamp, NtpTimeStamp 
receiveTimestamp,
+                       NtpTimeStamp transmitTimestamp )
+       {
+               this.leapIndicator       = leapIndicator;
+               this.versionNumber       = versionNumber;
+               this.mode                = mode;
+               this.stratumType         = stratumType;
+               this.pollInterval        = pollInterval;
+               this.precision           = precision;
+               this.rootDelay           = rootDelay;
+               this.rootDispersion      = rootDispersion;
+               this.referenceIdentifier = referenceIdentifier;
+               this.referenceTimestamp  = referenceTimestamp;
+               this.originateTimestamp  = originateTimestamp;
+               this.receiveTimestamp    = receiveTimestamp;
+               this.transmitTimestamp   = transmitTimestamp;
+       }
+       
+       
+       /**
+        * @return Returns the Leap Indicator.
+        */
+       public LeapIndicatorType getLeapIndicator()
+       {
+               return leapIndicator;
+       }
+       
+       /**
+        * @return Returns the Mode.
+        */
+       public ModeType getMode()
+       {
+               return mode;
+       }
+       
+       /**
+        * @return Returns the Originate Timestamp.
+        */
+       public NtpTimeStamp getOriginateTimestamp()
+       {
+               return originateTimestamp;
+       }
+       
+       /**
+        * @return Returns the Poll Interval.
+        */
+       public int getPollInterval()
+       {
+               return pollInterval;
+       }
+       
+       /**
+        * @return Returns the Precision.
+        */
+       public double getPrecision()
+       {
+               return precision;
+       }
+       
+       /**
+        * @return Returns the Receive Timestamp.
+        */
+       public NtpTimeStamp getReceiveTimestamp()
+       {
+               return receiveTimestamp;
+       }
+       
+       /**
+        * @return Returns the Reference Identifier.
+        */
+       public ReferenceIdentifier getReferenceIdentifier()
+       {
+               return referenceIdentifier;
+       }
+       
+       /**
+        * @return Returns the Reference Timestamp.
+        */
+       public NtpTimeStamp getReferenceTimestamp()
+       {
+               return referenceTimestamp;
+       }
+       
+       /**
+        * @return Returns the Root Delay.
+        */
+       public double getRootDelay()
+       {
+               return rootDelay;
+       }
+       
+       /**
+        * @return Returns the Root Dispersion.
+        */
+       public double getRootDispersion()
+       {
+               return rootDispersion;
+       }
+       
+       /**
+        * @return Returns the Stratum.
+        */
+       public StratumType getStratum()
+       {
+               return stratumType;
+       }
+       
+       /**
+        * @return Returns the Transmit Timestamp.
+        */
+       public NtpTimeStamp getTransmitTimestamp()
+       {
+               return transmitTimestamp;
+       }
+       
+       /**
+        * @return Returns the Version Number.
+        */
+       public int getVersionNumber()
+       {
+               return versionNumber;
+       }
+}
+

Added: 
incubator/directory/ntp/trunk/core/src/java/org/apache/ntp/message/NtpMessageModifier.java
Url: 
http://svn.apache.org/viewcvs/incubator/directory/ntp/trunk/core/src/java/org/apache/ntp/message/NtpMessageModifier.java?view=auto&rev=124115
==============================================================================
--- (empty file)
+++ 
incubator/directory/ntp/trunk/core/src/java/org/apache/ntp/message/NtpMessageModifier.java
  Tue Jan  4 08:05:22 2005
@@ -0,0 +1,154 @@
+/*
+ *   Copyright 2005 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+
+package org.apache.ntp.message;
+
+
+public class NtpMessageModifier
+{
+       private LeapIndicatorType leapIndicator;
+       private int               versionNumber;
+       private ModeType          mode;
+       private StratumType       stratumType;
+       private int               pollInterval;
+       private double            precision;
+       
+       private double rootDelay;
+       private double rootDispersion;
+       
+       private ReferenceIdentifier referenceIdentifier;
+       
+       private NtpTimeStamp referenceTimestamp;
+       private NtpTimeStamp originateTimestamp;
+       private NtpTimeStamp receiveTimestamp;
+       private NtpTimeStamp transmitTimestamp;
+       
+       
+       public NtpMessage getNtpMessage()
+       {
+               return new NtpMessage( leapIndicator, versionNumber, mode, 
stratumType,
+                               pollInterval, precision, rootDelay, 
rootDispersion, referenceIdentifier,
+                               referenceTimestamp, originateTimestamp, 
receiveTimestamp,
+                               transmitTimestamp );
+       }
+       
+       
+       /**
+        * @param leapIndicator The Leap Indicator to set.
+        */
+       public void setLeapIndicator(LeapIndicatorType leapIndicator)
+       {
+               this.leapIndicator = leapIndicator;
+       }
+       
+       /**
+        * @param mode The Mode to set.
+        */
+       public void setMode(ModeType mode)
+       {
+               this.mode = mode;
+       }
+       
+       /**
+        * @param originateTimestamp The Originate Timestamp to set.
+        */
+       public void setOriginateTimestamp(NtpTimeStamp originateTimestamp)
+       {
+               this.originateTimestamp = originateTimestamp;
+       }
+       
+       /**
+        * @param pollInterval The Poll Interval to set.
+        */
+       public void setPollInterval(int pollInterval)
+       {
+               this.pollInterval = pollInterval;
+       }
+       
+       /**
+        * @param precision The Precision to set.
+        */
+       public void setPrecision(double precision)
+       {
+               this.precision = precision;
+       }
+       
+       /**
+        * @param receiveTimestamp The Receive Timestamp to set.
+        */
+       public void setReceiveTimestamp(NtpTimeStamp receiveTimestamp)
+       {
+               this.receiveTimestamp = receiveTimestamp;
+       }
+       
+       /**
+        * @param referenceIdentifier The Reference Identifier to set.
+        */
+       public void setReferenceIdentifier( ReferenceIdentifier 
referenceIdentifier )
+       {
+               this.referenceIdentifier = referenceIdentifier;
+       }
+       
+       /**
+        * @param referenceTimestamp The Reference Timestamp to set.
+        */
+       public void setReferenceTimestamp(NtpTimeStamp referenceTimestamp)
+       {
+               this.referenceTimestamp = referenceTimestamp;
+       }
+       
+       /**
+        * @param rootDelay The Root Delay to set.
+        */
+       public void setRootDelay(double rootDelay)
+       {
+               this.rootDelay = rootDelay;
+       }
+       
+       /**
+        * @param rootDispersion The Root Dispersion to set.
+        */
+       public void setRootDispersion(double rootDispersion)
+       {
+               this.rootDispersion = rootDispersion;
+       }
+       
+       /**
+        * @param stratumType The Stratum to set.
+        */
+       public void setStratum(StratumType stratumType)
+       {
+               this.stratumType = stratumType;
+       }
+       
+       /**
+        * @param transmitTimestamp The Transmit Timestamp to set.
+        */
+       public void setTransmitTimestamp(NtpTimeStamp transmitTimestamp)
+       {
+               this.transmitTimestamp = transmitTimestamp;
+       }
+       
+       /**
+        * @param versionNumber The Version Number to set.
+        */
+       public void setVersionNumber(int versionNumber)
+       {
+               this.versionNumber = versionNumber;
+       }
+}
+

Reply via email to