OpenSplice Java 5 DCPS  v6.x
OpenSplice Java 5 OpenSplice Data Distribution Service Data-Centric Publish-Subscribe API
DestinationOrderImpl.java
Go to the documentation of this file.
1 /*
2  * Vortex OpenSplice
3  *
4  * This software and documentation are Copyright 2006 to 2021 ADLINK
5  * Technology Limited, its affiliated companies and licensors. All rights
6  * reserved.
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21 package org.opensplice.dds.core.policy;
22 
27 
28 public class DestinationOrderImpl extends QosPolicyImpl implements
30  private static final long serialVersionUID = 2722089115467848342L;
31  private final Kind kind;
32 
34  super(environment);
35  this.kind = Kind.BY_RECEPTION_TIMESTAMP;
36  }
37 
39  super(environment);
40 
41  if (kind == null) {
42  throw new IllegalArgumentExceptionImpl(environment,
43  "Supplied invalid Kind.");
44  }
45  this.kind = kind;
46  }
47 
48  @Override
49  public Comparable<DestinationOrder> requestedOfferedContract() {
50  return this;
51  }
52 
53  @Override
54  public int compareTo(DestinationOrder o) {
55  // BY_RECEPTION_TIMESTAMP < BY_SOURCE_TIMESTAMP
56  if (this.kind.equals(o.getKind())) {
57  return 0;
58  } else if (this.kind.equals(Kind.BY_RECEPTION_TIMESTAMP)) {
59  return -1;
60  }
61  return 1;
62  }
63 
64  @Override
65  public boolean equals(Object other) {
66  if (!(other instanceof DestinationOrderImpl)) {
67  return false;
68  }
69  return (this.kind == ((DestinationOrderImpl) other).kind);
70  }
71 
72  @Override
73  public int hashCode() {
74  return 31 * 17 + this.kind.hashCode();
75  }
76 
77  @Override
78  public Kind getKind() {
79  return this.kind;
80  }
81 
82  @Override
84  return new DestinationOrderImpl(this.environment, kind);
85  }
86 
87  @Override
89  return new DestinationOrderImpl(this.environment,
91  }
92 
93  @Override
95  return new DestinationOrderImpl(this.environment,
97  }
98 
99  @Override
100  public Class<? extends QosPolicy> getPolicyClass() {
101  return DestinationOrder.class;
102  }
103 
104 }
BY_SOURCE_TIMESTAMP
Indicates that data is ordered based on a time stamp placed at the source (by the Service or by the a...
DestinationOrderImpl(OsplServiceEnvironment environment, Kind kind)
DestinationOrderImpl(OsplServiceEnvironment environment)
This class is the abstract root for all the QoS policies.
Definition: QosPolicy.java:118
Controls the criteria used to determine the logical order among changes made by org.omg.dds.pub.Publisher entities to the same instance of data (i.e., matching Topic and key).
BY_RECEPTION_TIMESTAMP
Indicates that data is ordered based on the reception time at each org.omg.dds.sub.Subscriber.
DestinationOrder withKind(Kind kind)
Copy this policy and override the value of the property.