HamBook – Diff between revs 3 and 15
?pathlinks?
Rev 3 | Rev 15 | |||
---|---|---|---|---|
Line 13... | Line 13... | |||
13 | public ClarifierDirection(char symbol) |
13 | public ClarifierDirection(char symbol) |
|
14 | { |
14 | { |
|
15 | Direction = Parse(symbol); |
15 | Direction = Parse(symbol); |
|
16 | } |
16 | } |
|
Line -... | Line 17... | |||
- | 17 | |
||
- | 18 | public ClarifierDirection(string symbol) |
||
- | 19 | { |
||
- | 20 | Direction = Parse(symbol); |
||
- | 21 | } |
||
17 | |
22 | |
|
18 | private static ShiftDirection Parse(char symbol) |
23 | private static ShiftDirection Parse(char symbol) |
|
19 | { |
24 | { |
|
20 | switch (symbol) |
25 | switch (symbol) |
|
21 | { |
26 | { |
|
Line 26... | Line 31... | |||
26 | default: |
31 | default: |
|
27 | throw new ArgumentException(); |
32 | throw new ArgumentException(); |
|
28 | } |
33 | } |
|
29 | } |
34 | } |
|
Line -... | Line 35... | |||
- | 35 | |
||
- | 36 | private static ShiftDirection Parse(string symbol) |
||
- | 37 | { |
||
- | 38 | switch (symbol) |
||
- | 39 | { |
||
- | 40 | case "+": |
||
- | 41 | return ShiftDirection.PLUS_SHIFT; |
||
- | 42 | case "-": |
||
- | 43 | return ShiftDirection.MINUS_SHIFT; |
||
- | 44 | default: |
||
- | 45 | throw new ArgumentException(); |
||
- | 46 | } |
||
- | 47 | } |
||
30 | |
48 | |
|
31 | private char ToChar() |
49 | private char ToChar() |
|
32 | { |
50 | { |
|
33 | switch (Direction) |
51 | switch (Direction) |
|
34 | { |
52 | { |
|
Line 48... | Line 66... | |||
48 | |
66 | |
|
49 | public static implicit operator char(ClarifierDirection clarifierDirection) |
67 | public static implicit operator char(ClarifierDirection clarifierDirection) |
|
50 | { |
68 | { |
|
51 | return clarifierDirection.ToChar(); |
69 | return clarifierDirection.ToChar(); |
|
- | 70 | } |
||
- | 71 | |
||
- | 72 | public static implicit operator ClarifierDirection(string symbol) |
||
- | 73 | { |
||
- | 74 | return new ClarifierDirection(symbol); |
||
- | 75 | } |
||
- | 76 | |
||
- | 77 | public static implicit operator string(ClarifierDirection clarifierDirection) |
||
- | 78 | { |
||
- | 79 | switch (clarifierDirection.Direction) |
||
- | 80 | { |
||
- | 81 | case ShiftDirection.PLUS_SHIFT: |
||
- | 82 | return "+"; |
||
- | 83 | case ShiftDirection.MINUS_SHIFT: |
||
- | 84 | return "-"; |
||
- | 85 | default: |
||
- | 86 | throw new ArgumentException(); |
||
- | 87 | } |
||
52 | } |
88 | } |
|
53 | } |
89 | } |