Skip to content

Package: RotateQuadrantOp

RotateQuadrantOp

nameinstructionbranchcomplexitylinemethod
RotateQuadrantOp(int)
M: 2 C: 21
91%
M: 1 C: 3
75%
M: 1 C: 2
67%
M: 1 C: 7
88%
M: 0 C: 1
100%
getDegrees()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
toString()
M: 0 C: 4
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%

Coverage

1: /*
2: * *********************************************************************************************************************
3: *
4: * Mistral: open source imaging engine
5: * http://tidalwave.it/projects/mistral
6: *
7: * Copyright (C) 2003 - 2023 by Tidalwave s.a.s. (http://tidalwave.it)
8: *
9: * *********************************************************************************************************************
10: *
11: * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
12: * the License. You may obtain a copy of the License at
13: *
14: * http://www.apache.org/licenses/LICENSE-2.0
15: *
16: * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
17: * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
18: * specific language governing permissions and limitations under the License.
19: *
20: * *********************************************************************************************************************
21: *
22: * git clone https://bitbucket.org/tidalwave/mistral-src
23: * git clone https://github.com/tidalwave-it/mistral-src
24: *
25: * *********************************************************************************************************************
26: */
27: package it.tidalwave.image.op;
28:
29: /***********************************************************************************************************************
30: *
31: * @author Fabrizio Giudici
32: *
33: **********************************************************************************************************************/
34: public class RotateQuadrantOp extends Operation
35: {
36: private final int degrees;
37:
38: /*******************************************************************************************************************
39: *
40: * Rotates the image by a quadrant. The angle is expressed in degress and can
41: * only be a multiple of 90. Rotation is counterclockwise.
42: *
43: * @param degree the rotation angle in degrees
44: * @throws IllegalArgumentException if degrees is not a multiple of 90
45: *
46: ******************************************************************************************************************/
47: public RotateQuadrantOp (int degrees)
48: {
49:• while (degrees < 0)
50: {
51: degrees += 360;
52: }
53:
54: degrees %= 360;
55:
56:• if ((degrees % 90) != 0)
57: {
58: throw new IllegalArgumentException("degrees should be a multiple of 90");
59: }
60:
61: this.degrees = degrees;
62: }
63:
64: /*******************************************************************************************************************
65: *
66: *
67: ******************************************************************************************************************/
68: public int getDegrees()
69: {
70: return degrees;
71: }
72:
73: /*******************************************************************************************************************
74: *
75: * {@inheritDoc}
76: *
77: ******************************************************************************************************************/
78: @Override
79: public String toString()
80: {
81: return "RotateQuadrantOp(" + degrees + ")";
82: }
83: }