-
Notifications
You must be signed in to change notification settings - Fork 0
/
diagram3.puml
176 lines (174 loc) · 4.13 KB
/
diagram3.puml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
@startuml diagram2
+class Mainclass {
+ {{static}} void main()
+ {{static}} String inputTranslate(StringBuilde)
}
+class Funsave {
- {static} HashMap<String, String> content
- {static} HashMap<String, String[]> fparam
+ {static} void registerFunction(String)
+ {static} String getContent(String)
+ {static} String[] getFparam(String)
+ {static} boolean isFunctionName(String)
}
+class Funcall {
- String name
- int cur
- HashMap<String, Expr> args
- boolean argsfull
+ Funcall(String)
+ void loadFactor(Expr...)
+ Expr calculate()
+ boolean fullargs()
}
+class MyParser {
- final Lexer lexer
- HashMap<String, Expr> args
__
..constructor..
+ MyParser(Lexer)
+ MyParser(Lexer, HashMap<String, Expr>)
..parser manners..
+ Expr parseExpr()
- Gneral parseMulti()
+ Gneral parsePowAndMinus()
- Gneral parseFactor()
}
+class Lexer {
- final String input;
- int pos = 0;
- String curToken;
__
..constructor..
+ Lexer(String)
..inner lexer..
- String getNumber()
- String getVarOrFunc()
- String getTrigono()
....
+ void next()
+ String peek()
}
package expr {
+interface Factor {
+ String toString()
+ int hashCode()
+ Factor Derivation(String)
}
interface Gneral {
+ Gneral pow(String)
+ Gneral multiply(Num)
+ Gneral multiply(Gneral)
}
+class Num implements Factor {
- BigInteger num
__
..constructor..
+ Num()
+ Num(String)
+ Num(BigInteger)
+ Num(Num)
..operator..
+ void add(Num)
+ void sub(Num)
+ Num multiply(Num)
+ Num multiply(BigInteger)
+ Num pow(String)
..tool..
+ int hashCode()
+ boolean equals(object)
+ String toString()
+ boolean equalsStr(String)
..compare..
+ int compareTo(String)
}
+class Term implements Factor, Gneral {
- Num coefficient
- HashMap<Var, Integer> vars
- HashMap<Trigono, Integer> trigos
__
..constructors..
+ Term()
+ Term(String)
+ Term(Var)
+ Term(Trigono)
+ Term(Term)
..getters..
+ Num getCoefficient()
..tool..
+ int hashCode()
+ boolean equals(object)
+ boolean isNum()
+ boolean isPowFactor()
+ String toString()
..operator..
+ void add(Num)
+ void sub(Num)
+ Term multiply(Num)
+ Term multiply(Term)
+ Term multiply(Gneral)
+ Term pow(String)
+ Factor Derivation(String)
}
+class Expr implements Factor, Gneral {
- HashMap<Term, Num> terms
__
..constructor..
+ Expr()
+ Expr(String)
+ Expr(Expr)
..operator..
+ void add(Num)
+ void add(Term)
+ void add(Expr)
+ void sub(Num)
+ void sub(Term)
+ void sub(Expr)
+ Expr multiply(Gneral)
+ Expr multiply(Num)
+ Expr multiply(Term)
+ Expr multiply(Expr)
+ Expr pow(String)
+ Factor Derivation(String)
..tool..
+ int hashCode()
+ boolean equals(object)
+ String toString()
+ boolean isPowFactor()
}
+class Trigono implements Factor {
- String prefixName;
- Expr content;
+ Trigono(String, Expr)
+ Factor Derivation(String)
+ Factor simplify()
+ int hashCode()
+ boolean minusHead()
+ boolean equals(Object)
+ String toString()
}
+class Var implements Factor {
- String varName
+ Var(String)
+ int hashCode()
+ Factor Derivation(String)
+ boolean equals(Object)
+ String toString()
}
}
Mainclass::main ..> Lexer
Mainclass::main ..> MyParser
MyParser::lexer --> Lexer
MyParser ..> Gneral
MyParser ..> Expr
MyParser ..> Funcall
Lexer ..> Funsave
Funcall --> Expr
Funcall ..> Funsave
Funcall::calculate ..> MyParser::parseExpr
Expr --> Term
Trigono --> Expr
Term --> Num
Term --> Trigono
Term --> Var
@enduml