Committed by
Ray Milkey
Simplify statement and write comment
Change-Id: Ie1f1cb087a2a38c4fd5749d71dc635428dbdb765
Showing
16 changed files
with
41 additions
and
43 deletions
... | @@ -525,7 +525,7 @@ class PcepChannelHandler extends IdleStateAwareChannelHandler { | ... | @@ -525,7 +525,7 @@ class PcepChannelHandler extends IdleStateAwareChannelHandler { |
525 | } | 525 | } |
526 | } | 526 | } |
527 | 527 | ||
528 | - return (bFoundPceccCapability && bFoundStatefulPceCapability && bFoundPcInstantiationCapability) ? true : false; | 528 | + return (bFoundPceccCapability && bFoundStatefulPceCapability && bFoundPcInstantiationCapability); |
529 | } | 529 | } |
530 | 530 | ||
531 | /** | 531 | /** | ... | ... |
... | @@ -67,7 +67,7 @@ public class PcepErrorInfoVer1 implements PcepErrorInfo { | ... | @@ -67,7 +67,7 @@ public class PcepErrorInfoVer1 implements PcepErrorInfo { |
67 | 67 | ||
68 | @Override | 68 | @Override |
69 | public boolean isErrorInfoPresent() { | 69 | public boolean isErrorInfoPresent() { |
70 | - return (!this.errList.isEmpty()) ? true : false; | 70 | + return !this.errList.isEmpty(); |
71 | } | 71 | } |
72 | 72 | ||
73 | @Override | 73 | @Override | ... | ... |
... | @@ -47,7 +47,6 @@ public class PcepInterLayerObjectVer1 implements PcepInterLayerObject { | ... | @@ -47,7 +47,6 @@ public class PcepInterLayerObjectVer1 implements PcepInterLayerObject { |
47 | public static final int OBJECT_HEADER_LENGTH = 4; | 47 | public static final int OBJECT_HEADER_LENGTH = 4; |
48 | public static final int NFLAG_SHIFT_VALUE = 0x02; | 48 | public static final int NFLAG_SHIFT_VALUE = 0x02; |
49 | public static final int IFLAG_SHIFT_VALUE = 0x01; | 49 | public static final int IFLAG_SHIFT_VALUE = 0x01; |
50 | - public static final int FLAGS_SET_VALUE = 1; | ||
51 | 50 | ||
52 | static final PcepObjectHeader DEFAULT_INTER_LAYER_OBJECT_HEADER = new PcepObjectHeader(INTER_LAYER_OBJ_CLASS, | 51 | static final PcepObjectHeader DEFAULT_INTER_LAYER_OBJECT_HEADER = new PcepObjectHeader(INTER_LAYER_OBJ_CLASS, |
53 | INTER_LAYER_OBJ_TYPE, PcepObjectHeader.REQ_OBJ_OPTIONAL_PROCESS, PcepObjectHeader.RSP_OBJ_PROCESSED, | 52 | INTER_LAYER_OBJ_TYPE, PcepObjectHeader.REQ_OBJ_OPTIONAL_PROCESS, PcepObjectHeader.RSP_OBJ_PROCESSED, |
... | @@ -128,8 +127,8 @@ public class PcepInterLayerObjectVer1 implements PcepInterLayerObject { | ... | @@ -128,8 +127,8 @@ public class PcepInterLayerObjectVer1 implements PcepInterLayerObject { |
128 | ChannelBuffer tempCb = cb.readBytes(interLayerObjHeader.getObjLen() - OBJECT_HEADER_LENGTH); | 127 | ChannelBuffer tempCb = cb.readBytes(interLayerObjHeader.getObjLen() - OBJECT_HEADER_LENGTH); |
129 | 128 | ||
130 | int iTemp = tempCb.readInt(); | 129 | int iTemp = tempCb.readInt(); |
131 | - bIFlag = ((iTemp & (byte) IFLAG_SHIFT_VALUE) == FLAGS_SET_VALUE) ? true : false; | 130 | + bIFlag = ((iTemp & (byte) IFLAG_SHIFT_VALUE) == IFLAG_SHIFT_VALUE); |
132 | - bNFlag = ((iTemp & (byte) NFLAG_SHIFT_VALUE) == FLAGS_SET_VALUE) ? true : false; | 131 | + bNFlag = ((iTemp & (byte) NFLAG_SHIFT_VALUE) == NFLAG_SHIFT_VALUE); |
133 | 132 | ||
134 | return new PcepInterLayerObjectVer1(interLayerObjHeader, bNFlag, bIFlag); | 133 | return new PcepInterLayerObjectVer1(interLayerObjHeader, bNFlag, bIFlag); |
135 | } | 134 | } | ... | ... |
... | @@ -145,7 +145,7 @@ public class PcepLabelObjectVer1 implements PcepLabelObject { | ... | @@ -145,7 +145,7 @@ public class PcepLabelObjectVer1 implements PcepLabelObject { |
145 | ChannelBuffer tempCb = cb.readBytes(labelObjHeader.getObjLen() - OBJECT_HEADER_LENGTH); | 145 | ChannelBuffer tempCb = cb.readBytes(labelObjHeader.getObjLen() - OBJECT_HEADER_LENGTH); |
146 | 146 | ||
147 | int iTemp = tempCb.readInt(); | 147 | int iTemp = tempCb.readInt(); |
148 | - bOFlag = (iTemp & (byte) 0x01) == 1 ? true : false; | 148 | + bOFlag = (iTemp & (byte) 0x01) == 1; |
149 | label = tempCb.readInt(); | 149 | label = tempCb.readInt(); |
150 | 150 | ||
151 | // parse optional TLV | 151 | // parse optional TLV | ... | ... |
... | @@ -249,13 +249,13 @@ public class PcepLspObjectVer1 implements PcepLspObject { | ... | @@ -249,13 +249,13 @@ public class PcepLspObjectVer1 implements PcepLspObject { |
249 | Integer iX = (iTemp & OFLAG_TEMP_SHIFT_VALUE) >> OFLAG_SHIFT_VALUE; | 249 | Integer iX = (iTemp & OFLAG_TEMP_SHIFT_VALUE) >> OFLAG_SHIFT_VALUE; |
250 | yOFlag = iX.byteValue(); | 250 | yOFlag = iX.byteValue(); |
251 | iX = (iTemp & AFLAG_TEMP_SHIFT_VALUE) >> AFLAG_SHIFT_VALUE; | 251 | iX = (iTemp & AFLAG_TEMP_SHIFT_VALUE) >> AFLAG_SHIFT_VALUE; |
252 | - bAFlag = (iX > 0) ? true : false; | 252 | + bAFlag = iX > 0; |
253 | iX = (iTemp & RFLAG_TEMP_SHIFT_VALUE) >> RFLAG_SHIFT_VALUE; | 253 | iX = (iTemp & RFLAG_TEMP_SHIFT_VALUE) >> RFLAG_SHIFT_VALUE; |
254 | - bRFlag = (iX > 0) ? true : false; | 254 | + bRFlag = iX > 0; |
255 | iX = (iTemp & SFLAG_TEMP_SHIFT_VALUE) >> SFLAG_SHIFT_VALUE; | 255 | iX = (iTemp & SFLAG_TEMP_SHIFT_VALUE) >> SFLAG_SHIFT_VALUE; |
256 | - bSFlag = (iX > 0) ? true : false; | 256 | + bSFlag = iX > 0; |
257 | iX = iTemp & DFLAG_TEMP_SHIFT_VALUE; | 257 | iX = iTemp & DFLAG_TEMP_SHIFT_VALUE; |
258 | - bDFlag = (iX > 0) ? true : false; | 258 | + bDFlag = iX > 0; |
259 | 259 | ||
260 | // parse optional TLV | 260 | // parse optional TLV |
261 | llOptionalTlv = parseOptionalTlv(tempCb); | 261 | llOptionalTlv = parseOptionalTlv(tempCb); | ... | ... |
... | @@ -227,7 +227,7 @@ public class PcepLspaObjectVer1 implements PcepLspaObject { | ... | @@ -227,7 +227,7 @@ public class PcepLspaObjectVer1 implements PcepLspaObject { |
227 | flags = tempCb.readByte(); | 227 | flags = tempCb.readByte(); |
228 | tempCb.readByte(); | 228 | tempCb.readByte(); |
229 | 229 | ||
230 | - bLFlag = (flags & (byte) LFLAG_SET) == LFLAG_SET ? true : false; | 230 | + bLFlag = (flags & (byte) LFLAG_SET) == LFLAG_SET; |
231 | 231 | ||
232 | llOptionalTlv = parseOptionalTlv(tempCb); | 232 | llOptionalTlv = parseOptionalTlv(tempCb); |
233 | 233 | ... | ... |
... | @@ -202,8 +202,8 @@ public class PcepMetricObjectVer1 implements PcepMetricObject { | ... | @@ -202,8 +202,8 @@ public class PcepMetricObjectVer1 implements PcepMetricObject { |
202 | tempCb.readShort(); | 202 | tempCb.readShort(); |
203 | yFlag = tempCb.readByte(); | 203 | yFlag = tempCb.readByte(); |
204 | bType = tempCb.readByte(); | 204 | bType = tempCb.readByte(); |
205 | - bCFlag = (yFlag & CFLAG_CHECK) == CFLAG_CHECK ? true : false; | 205 | + bCFlag = (yFlag & CFLAG_CHECK) == CFLAG_CHECK; |
206 | - bBFlag = (yFlag & BFLAG_SET) == BFLAG_SET ? true : false; | 206 | + bBFlag = (yFlag & BFLAG_SET) == BFLAG_SET; |
207 | iMetricVal = tempCb.readInt(); | 207 | iMetricVal = tempCb.readInt(); |
208 | 208 | ||
209 | return new PcepMetricObjectVer1(metricObjHeader, iMetricVal, yFlag, bCFlag, bBFlag, bType); | 209 | return new PcepMetricObjectVer1(metricObjHeader, iMetricVal, yFlag, bCFlag, bBFlag, bType); | ... | ... |
... | @@ -198,9 +198,9 @@ public class PcepRPObjectVer1 implements PcepRPObject { | ... | @@ -198,9 +198,9 @@ public class PcepRPObjectVer1 implements PcepRPObject { |
198 | 198 | ||
199 | int iTemp = tempCb.readInt(); | 199 | int iTemp = tempCb.readInt(); |
200 | yPriFlag = (byte) (iTemp & PRIFLAG_TEMP_SHIFT_VALUE); | 200 | yPriFlag = (byte) (iTemp & PRIFLAG_TEMP_SHIFT_VALUE); |
201 | - bOFlag = (iTemp & OFLAG_TEMP_SHIFT_VALUE) == OFLAG_TEMP_SHIFT_VALUE ? true : false; | 201 | + bOFlag = (iTemp & OFLAG_TEMP_SHIFT_VALUE) == OFLAG_TEMP_SHIFT_VALUE; |
202 | - bBFlag = (iTemp & BFLAG_TEMP_SHIFT_VALUE) == BFLAG_TEMP_SHIFT_VALUE ? true : false; | 202 | + bBFlag = (iTemp & BFLAG_TEMP_SHIFT_VALUE) == BFLAG_TEMP_SHIFT_VALUE; |
203 | - bRFlag = (iTemp & RFLAG_TEMP_SHIFT_VALUE) == RFLAG_TEMP_SHIFT_VALUE ? true : false; | 203 | + bRFlag = (iTemp & RFLAG_TEMP_SHIFT_VALUE) == RFLAG_TEMP_SHIFT_VALUE; |
204 | 204 | ||
205 | iRequestIdNum = tempCb.readInt(); | 205 | iRequestIdNum = tempCb.readInt(); |
206 | 206 | ... | ... |
... | @@ -166,7 +166,7 @@ public class PcepSrpObjectVer1 implements PcepSrpObject { | ... | @@ -166,7 +166,7 @@ public class PcepSrpObjectVer1 implements PcepSrpObject { |
166 | //take only SrpObject buffer. | 166 | //take only SrpObject buffer. |
167 | ChannelBuffer tempCb = cb.readBytes(srpObjHeader.getObjLen() - MINIMUM_COMMON_HEADER_LENGTH); | 167 | ChannelBuffer tempCb = cb.readBytes(srpObjHeader.getObjLen() - MINIMUM_COMMON_HEADER_LENGTH); |
168 | flags = tempCb.readInt(); | 168 | flags = tempCb.readInt(); |
169 | - bRFlag = (0 < flags) ? true : false; | 169 | + bRFlag = 0 < flags; |
170 | srpID = tempCb.readInt(); | 170 | srpID = tempCb.readInt(); |
171 | 171 | ||
172 | llOptionalTlv = parseOptionalTlv(tempCb); | 172 | llOptionalTlv = parseOptionalTlv(tempCb); | ... | ... |
... | @@ -211,8 +211,8 @@ public class PcepTEObjectVer1 implements PcepTEObject { | ... | @@ -211,8 +211,8 @@ public class PcepTEObjectVer1 implements PcepTEObject { |
211 | tempCb.readShort(); | 211 | tempCb.readShort(); |
212 | 212 | ||
213 | Integer iTemp = (int) tempCb.readByte(); //read 3rd byte Flag | 213 | Integer iTemp = (int) tempCb.readByte(); //read 3rd byte Flag |
214 | - bSFlag = ((iTemp & FLAG_SET_S_FLAG) == FLAG_SET_S_FLAG) ? true : false; | 214 | + bSFlag = (iTemp & FLAG_SET_S_FLAG) == FLAG_SET_S_FLAG; |
215 | - bRFlag = ((iTemp & FLAG_SET_R_FLAG) == FLAG_SET_R_FLAG) ? true : false; | 215 | + bRFlag = (iTemp & FLAG_SET_R_FLAG) == FLAG_SET_R_FLAG; |
216 | 216 | ||
217 | iTEId = tempCb.readInt(); | 217 | iTEId = tempCb.readInt(); |
218 | 218 | ... | ... |
... | @@ -99,7 +99,7 @@ public class ErrorObjListWithOpen { | ... | @@ -99,7 +99,7 @@ public class ErrorObjListWithOpen { |
99 | public boolean isErrorObjListWithOpenPresent() { | 99 | public boolean isErrorObjListWithOpenPresent() { |
100 | // ( <error-obj-list> [<Open>] | 100 | // ( <error-obj-list> [<Open>] |
101 | // At least in this case <error-obj-list> should be present. | 101 | // At least in this case <error-obj-list> should be present. |
102 | - return (!this.llerrorObjList.isEmpty()) ? true : false; | 102 | + return !this.llerrorObjList.isEmpty(); |
103 | } | 103 | } |
104 | 104 | ||
105 | /** | 105 | /** | ... | ... |
... | @@ -63,11 +63,10 @@ public class NodeFlagBitsTlv implements PcepValueType { | ... | @@ -63,11 +63,10 @@ public class NodeFlagBitsTlv implements PcepValueType { |
63 | public NodeFlagBitsTlv(byte rawValue) { | 63 | public NodeFlagBitsTlv(byte rawValue) { |
64 | this.rawValue = rawValue; | 64 | this.rawValue = rawValue; |
65 | isRawValueSet = true; | 65 | isRawValueSet = true; |
66 | - byte temp = rawValue; | 66 | + this.bOFlag = (rawValue & OFLAG_SET) == OFLAG_SET; |
67 | - this.bOFlag = (temp & OFLAG_SET) == OFLAG_SET ? true : false; | 67 | + this.bTFlag = (rawValue & TFLAG_SET) == TFLAG_SET; |
68 | - this.bTFlag = (temp & TFLAG_SET) == TFLAG_SET ? true : false; | 68 | + this.bEFlag = (rawValue & EFLAG_SET) == EFLAG_SET; |
69 | - this.bEFlag = (temp & EFLAG_SET) == EFLAG_SET ? true : false; | 69 | + this.bBFlag = (rawValue & BFLAG_SET) == BFLAG_SET; |
70 | - this.bBFlag = (temp & BFLAG_SET) == BFLAG_SET ? true : false; | ||
71 | } | 70 | } |
72 | 71 | ||
73 | /** | 72 | /** | ... | ... |
... | @@ -48,8 +48,8 @@ public class PceccCapabilityTlv implements PcepValueType { | ... | @@ -48,8 +48,8 @@ public class PceccCapabilityTlv implements PcepValueType { |
48 | this.rawValue = rawValue; | 48 | this.rawValue = rawValue; |
49 | this.isRawValueSet = true; | 49 | this.isRawValueSet = true; |
50 | 50 | ||
51 | - bLFlag = (rawValue & LFLAG_CHECK) == LFLAG_CHECK ? true : false; | 51 | + bLFlag = (rawValue & LFLAG_CHECK) == LFLAG_CHECK; |
52 | - bGFlag = (rawValue & GFLAG_CHECK) == GFLAG_CHECK ? true : false; | 52 | + bGFlag = (rawValue & GFLAG_CHECK) == GFLAG_CHECK; |
53 | } | 53 | } |
54 | 54 | ||
55 | /** | 55 | /** | ... | ... |
... | @@ -204,8 +204,8 @@ public class PcepObjectHeader { | ... | @@ -204,8 +204,8 @@ public class PcepObjectHeader { |
204 | short objLen; | 204 | short objLen; |
205 | objClass = cb.readByte(); | 205 | objClass = cb.readByte(); |
206 | byte temp = cb.readByte(); | 206 | byte temp = cb.readByte(); |
207 | - bIFlag = ((temp & IFLAG_SET) == IFLAG_SET) ? true : false; | 207 | + bIFlag = (temp & IFLAG_SET) == IFLAG_SET; |
208 | - bPFlag = ((temp & PFLAG_SET) == PFLAG_SET) ? true : false; | 208 | + bPFlag = (temp & PFLAG_SET) == PFLAG_SET; |
209 | objType = (byte) (temp >> OBJECT_TYPE_SHIFT_VALUE); | 209 | objType = (byte) (temp >> OBJECT_TYPE_SHIFT_VALUE); |
210 | objLen = cb.readShort(); | 210 | objLen = cb.readShort(); |
211 | return new PcepObjectHeader(objClass, objType, bPFlag, bIFlag, objLen); | 211 | return new PcepObjectHeader(objClass, objType, bPFlag, bIFlag, objLen); | ... | ... |
... | @@ -275,10 +275,10 @@ public class SrEroSubObject implements PcepValueType { | ... | @@ -275,10 +275,10 @@ public class SrEroSubObject implements PcepValueType { |
275 | byte st; | 275 | byte st; |
276 | PcepNai nai = null; | 276 | PcepNai nai = null; |
277 | 277 | ||
278 | - bMFlag = (temp & MFLAG_SET) == MFLAG_SET ? true : false; | 278 | + bMFlag = (temp & MFLAG_SET) == MFLAG_SET; |
279 | - bCFlag = (temp & CFLAG_SET) == CFLAG_SET ? true : false; | 279 | + bCFlag = (temp & CFLAG_SET) == CFLAG_SET; |
280 | - bSFlag = (temp & SFLAG_SET) == SFLAG_SET ? true : false; | 280 | + bSFlag = (temp & SFLAG_SET) == SFLAG_SET; |
281 | - bFFlag = (temp & FFLAG_SET) == FFLAG_SET ? true : false; | 281 | + bFFlag = (temp & FFLAG_SET) == FFLAG_SET; |
282 | 282 | ||
283 | st = (byte) (temp >> SHIFT_ST); | 283 | st = (byte) (temp >> SHIFT_ST); |
284 | 284 | ... | ... |
... | @@ -70,11 +70,11 @@ public class StatefulPceCapabilityTlv implements PcepValueType { | ... | @@ -70,11 +70,11 @@ public class StatefulPceCapabilityTlv implements PcepValueType { |
70 | public StatefulPceCapabilityTlv(int rawValue) { | 70 | public StatefulPceCapabilityTlv(int rawValue) { |
71 | this.rawValue = rawValue; | 71 | this.rawValue = rawValue; |
72 | isRawValueSet = true; | 72 | isRawValueSet = true; |
73 | - this.bUFlag = (rawValue & UFLAG_SET) == UFLAG_SET ? true : false; | 73 | + this.bUFlag = (rawValue & UFLAG_SET) == UFLAG_SET; |
74 | - this.bSFlag = (rawValue & SFLAG_SET) == SFLAG_SET ? true : false; | 74 | + this.bSFlag = (rawValue & SFLAG_SET) == SFLAG_SET; |
75 | - this.bIFlag = (rawValue & IFLAG_SET) == IFLAG_SET ? true : false; | 75 | + this.bIFlag = (rawValue & IFLAG_SET) == IFLAG_SET; |
76 | - this.bTFlag = (rawValue & TFLAG_SET) == TFLAG_SET ? true : false; | 76 | + this.bTFlag = (rawValue & TFLAG_SET) == TFLAG_SET; |
77 | - this.bDFlag = (rawValue & DFLAG_SET) == DFLAG_SET ? true : false; | 77 | + this.bDFlag = (rawValue & DFLAG_SET) == DFLAG_SET; |
78 | } | 78 | } |
79 | 79 | ||
80 | /** | 80 | /** |
... | @@ -245,11 +245,11 @@ public class StatefulPceCapabilityTlv implements PcepValueType { | ... | @@ -245,11 +245,11 @@ public class StatefulPceCapabilityTlv implements PcepValueType { |
245 | boolean bSFlag; | 245 | boolean bSFlag; |
246 | boolean bUFlag; | 246 | boolean bUFlag; |
247 | 247 | ||
248 | - bUFlag = (temp & UFLAG_SET) == UFLAG_SET ? true : false; | 248 | + bUFlag = (temp & UFLAG_SET) == UFLAG_SET; |
249 | - bSFlag = (temp & SFLAG_SET) == SFLAG_SET ? true : false; | 249 | + bSFlag = (temp & SFLAG_SET) == SFLAG_SET; |
250 | - bIFlag = (temp & IFLAG_SET) == IFLAG_SET ? true : false; | 250 | + bIFlag = (temp & IFLAG_SET) == IFLAG_SET; |
251 | - bTFlag = (temp & TFLAG_SET) == TFLAG_SET ? true : false; | 251 | + bTFlag = (temp & TFLAG_SET) == TFLAG_SET; |
252 | - bDFlag = (temp & DFLAG_SET) == DFLAG_SET ? true : false; | 252 | + bDFlag = (temp & DFLAG_SET) == DFLAG_SET; |
253 | 253 | ||
254 | return new StatefulPceCapabilityTlv(bDFlag, bTFlag, bIFlag, bSFlag, bUFlag); | 254 | return new StatefulPceCapabilityTlv(bDFlag, bTFlag, bIFlag, bSFlag, bUFlag); |
255 | } | 255 | } | ... | ... |
-
Please register or login to post a comment