-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJavaExpVariables.swift
More file actions
48 lines (40 loc) · 1.14 KB
/
JavaExpVariables.swift
File metadata and controls
48 lines (40 loc) · 1.14 KB
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
//
// JavaExpVariables.swift
// textToCode
//
// Created by Michael Smith on 4/30/19.
// Copyright © 2019 Michael Smith. All rights reserved.
//
import Foundation
//Variables in methods
class JavaExpVariables: JavaExpression{
private var INDENT = "\t";
private var name: String;
private final var type: String;
private var value: String?;
init(name: String, type: String, value: String?) {
self.name = name;
self.type = type.uppercasingFirst;
self.value = value;
}
func getType() -> String{
return self.type;
}
func getName() -> String{
return self.name;
}
func getValue() -> String?{
return self.value;
}
override func toString() -> String{
if value == nil{
return "\(INDENT)\(type) \(name);"
}else{
return "\(INDENT)\(type) \(name) = \(value ?? "you should never see this");"
}
}
override func copy() -> JavaExpVariables {
let expVarCopy = JavaExpVariables.init(name: self.getName(), type: self.getType(), value: self.getValue())
return expVarCopy;
}
}