Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/sourcetools/com.ibm.jpp.preprocessor/com/ibm/jpp/om/Src.java
6004 views
1
/*******************************************************************************
2
* Copyright (c) 1999, 2019 IBM Corp. and others
3
*
4
* This program and the accompanying materials are made available under
5
* the terms of the Eclipse Public License 2.0 which accompanies this
6
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
7
* or the Apache License, Version 2.0 which accompanies this distribution and
8
* is available at https://www.apache.org/licenses/LICENSE-2.0.
9
*
10
* This Source Code may also be made available under the following
11
* Secondary Licenses when the conditions for such availability set
12
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
13
* General Public License, version 2 with the GNU Classpath
14
* Exception [1] and GNU General Public License, version 2 with the
15
* OpenJDK Assembly Exception [2].
16
*
17
* [1] https://www.gnu.org/software/classpath/license.html
18
* [2] http://openjdk.java.net/legal/assembly-exception.html
19
*
20
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
21
*******************************************************************************/
22
package com.ibm.jpp.om;
23
24
import java.io.File;
25
import java.util.Properties;
26
27
/**
28
* Src represents a preprocessor source folder and it's associated options (such as the jxelink
29
* or msg output directories).
30
*/
31
public class Src {
32
private final File srcFolder;
33
private final Properties options;
34
private final boolean isSimple;
35
private final String srcPath;
36
private final String simpleCopyOutput;
37
38
/**
39
* Class constructor.
40
*
41
* @param folderString the source directory
42
* @param isSimple <code>true</code> if this is a simple copy source
43
*/
44
public Src(String folderString, boolean isSimple) {
45
this.srcFolder = new File(folderString);
46
this.options = new Properties();
47
this.isSimple = isSimple;
48
this.srcPath = folderString;
49
this.simpleCopyOutput = "";
50
}
51
52
/**
53
* Class constructor.
54
*
55
* @param folderString the source directory
56
* @param simpleCopyOutput the simple copy output path
57
*/
58
public Src(String folderString, String simpleCopyOutput) {
59
this.srcFolder = new File(folderString);
60
this.options = new Properties();
61
this.isSimple = true;
62
this.srcPath = folderString;
63
this.simpleCopyOutput = simpleCopyOutput;
64
}
65
66
/**
67
* Class constructor.
68
*
69
* @param folderString the source directory
70
*/
71
public Src(String folderString) {
72
this.srcFolder = new File(folderString);
73
this.options = new Properties();
74
this.isSimple = false;
75
this.srcPath = folderString;
76
this.simpleCopyOutput = "";
77
}
78
79
/**
80
* Returns this source's relative folder.
81
*
82
* @return the relative folder
83
*/
84
public File getRelativeSrcFolder() {
85
return srcFolder;
86
}
87
88
/**
89
* Returns this source's relative path.
90
*
91
* @return the relative path
92
*/
93
public String getRelativeSrcPath() {
94
return srcPath;
95
}
96
97
/**
98
* Returns this source's simplecopy output.
99
*
100
* @return the simplecopy output
101
*/
102
public String getSimpleCopyOutput() {
103
return simpleCopyOutput;
104
}
105
106
/**
107
* Adds an option to this source.
108
*
109
* @param name the option name
110
* @param value the option value
111
*/
112
public void addOption(String name, String value) {
113
options.setProperty(name, value);
114
}
115
116
/**
117
* Returns the options associated with this source.
118
*
119
* @return the source options
120
*/
121
public Properties getOptions() {
122
return options;
123
}
124
125
/**
126
* Returns whether this source is a simple copy source.
127
*
128
* @return <code>true</code> if the source is simple copy, <code>false</code> otherwise
129
*/
130
public boolean isSimpleCopy() {
131
return isSimple;
132
}
133
134
/**
135
* @see java.lang.Object#toString()
136
*/
137
@Override
138
public String toString() {
139
return srcFolder.toString() + " " + options.toString();
140
}
141
}
142
143