View Javadoc
1   /*
2    * This file is part of Waarp Project (named also Waarp or GG).
3    *
4    *  Copyright (c) 2019, Waarp SAS, and individual contributors by the @author
5    *  tags. See the COPYRIGHT.txt in the distribution for a full listing of
6    * individual contributors.
7    *
8    *  All Waarp Project is free software: you can redistribute it and/or
9    * modify it under the terms of the GNU General Public License as published by
10   * the Free Software Foundation, either version 3 of the License, or (at your
11   * option) any later version.
12   *
13   * Waarp is distributed in the hope that it will be useful, but WITHOUT ANY
14   * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15   * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16   *
17   *  You should have received a copy of the GNU General Public License along with
18   * Waarp . If not, see <http://www.gnu.org/licenses/>.
19   */
20  package org.waarp.openr66.protocol.localhandler.packet.json;
21  
22  import org.waarp.openr66.protocol.localhandler.packet.LocalPacketFactory;
23  
24  /**
25   * Bandwidth setting or getting JSON packet
26   */
27  public class BandwidthJsonPacket extends JsonPacket {
28  
29    protected boolean setter;
30    protected long writeglobal = -10;
31    protected long readglobal = -10;
32    protected long writesession = -10;
33    protected long readsession = -10;
34  
35    /**
36     * @return the setter
37     */
38    public final boolean isSetter() {
39      return setter;
40    }
41  
42    /**
43     * @param setter the setter to set
44     */
45    public final void setSetter(final boolean setter) {
46      this.setter = setter;
47    }
48  
49    /**
50     * @return the writeglobal
51     */
52    public final long getWriteglobal() {
53      return writeglobal;
54    }
55  
56    /**
57     * @param writeglobal the writeglobal to set
58     */
59    public final void setWriteglobal(final long writeglobal) {
60      this.writeglobal = writeglobal;
61    }
62  
63    /**
64     * @return the readglobal
65     */
66    public final long getReadglobal() {
67      return readglobal;
68    }
69  
70    /**
71     * @param readglobal the readglobal to set
72     */
73    public final void setReadglobal(final long readglobal) {
74      this.readglobal = readglobal;
75    }
76  
77    /**
78     * @return the writesession
79     */
80    public final long getWritesession() {
81      return writesession;
82    }
83  
84    /**
85     * @param writesession the writesession to set
86     */
87    public final void setWritesession(final long writesession) {
88      this.writesession = writesession;
89    }
90  
91    /**
92     * @return the readsession
93     */
94    public final long getReadsession() {
95      return readsession;
96    }
97  
98    /**
99     * @param readsession the readsession to set
100    */
101   public final void setReadsession(final long readsession) {
102     this.readsession = readsession;
103   }
104 
105   @Override
106   public final void fromJson(final JsonPacket other) {
107     super.fromJson(other);
108     if (other instanceof BandwidthJsonPacket) {
109       final BandwidthJsonPacket other2 = (BandwidthJsonPacket) other;
110       setter = other2.setter;
111       writeglobal = other2.writeglobal;
112       readglobal = other2.readglobal;
113       writesession = other2.writeglobal;
114       readsession = other2.readsession;
115     }
116   }
117 
118   @Override
119   public final void setRequestUserPacket() {
120     setRequestUserPacket(LocalPacketFactory.BANDWIDTHPACKET);
121   }
122 
123 }