Skip to content

Commit bbdf1cd

Browse files
committed
Adding Hayes and Zoom classes
1 parent 323395d commit bbdf1cd

File tree

2 files changed

+123
-0
lines changed

2 files changed

+123
-0
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/**
2+
* The MIT License
3+
* Copyright (c) 2014-2016 Ilkka Seppälä
4+
*
5+
* Permission is hereby granted, free of charge, to any person obtaining a copy
6+
* of this software and associated documentation files (the "Software"), to deal
7+
* in the Software without restriction, including without limitation the rights
8+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
* copies of the Software, and to permit persons to whom the Software is
10+
* furnished to do so, subject to the following conditions:
11+
*
12+
* The above copyright notice and this permission notice shall be included in
13+
* all copies or substantial portions of the Software.
14+
*
15+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
* THE SOFTWARE.
22+
*/
23+
package com.iluwatar.acyclicvisitor;
24+
25+
import org.slf4j.Logger;
26+
import org.slf4j.LoggerFactory;
27+
28+
/**
29+
* Hayes class implements its
30+
* accept method
31+
*/
32+
33+
public class Hayes extends Modem {
34+
35+
private static final Logger LOGGER = LoggerFactory.getLogger(ConfigureForDosVisitor.class);
36+
37+
public Hayes() {
38+
39+
}
40+
41+
/**
42+
* Accept visitor
43+
*/
44+
@Override
45+
public void accept(ModemVisitor modemVisitor) {
46+
try {
47+
((HayesVisitor) modemVisitor).visit(this);
48+
} catch (ClassCastException e) {
49+
LOGGER.error("Unable to cast to HayesVisitor");
50+
}
51+
52+
}
53+
54+
/**
55+
* Hayes' modem's toString
56+
* method
57+
*/
58+
@Override
59+
public String toString() {
60+
return "Hayes modem";
61+
}
62+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/**
2+
* The MIT License
3+
* Copyright (c) 2014-2016 Ilkka Seppälä
4+
*
5+
* Permission is hereby granted, free of charge, to any person obtaining a copy
6+
* of this software and associated documentation files (the "Software"), to deal
7+
* in the Software without restriction, including without limitation the rights
8+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
* copies of the Software, and to permit persons to whom the Software is
10+
* furnished to do so, subject to the following conditions:
11+
*
12+
* The above copyright notice and this permission notice shall be included in
13+
* all copies or substantial portions of the Software.
14+
*
15+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
* THE SOFTWARE.
22+
*/
23+
package com.iluwatar.acyclicvisitor;
24+
25+
import org.slf4j.Logger;
26+
import org.slf4j.LoggerFactory;
27+
28+
/**
29+
* Zoom class implements its
30+
* accept method
31+
*/
32+
33+
public class Zoom extends Modem {
34+
35+
private static final Logger LOGGER = LoggerFactory.getLogger(ConfigureForDosVisitor.class);
36+
37+
public Zoom() {
38+
39+
}
40+
41+
/**
42+
* Accept visitor
43+
*/
44+
@Override
45+
public void accept(ModemVisitor modemVisitor) {
46+
try {
47+
((ZoomVisitor) modemVisitor).visit(this);
48+
} catch (ClassCastException e) {
49+
LOGGER.error("Unable to cast to ZoomVisitor");
50+
}
51+
}
52+
53+
/**
54+
* Zoom modem's toString
55+
* method
56+
*/
57+
@Override
58+
public String toString() {
59+
return "Zoom modem";
60+
}
61+
}

0 commit comments

Comments
 (0)