-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from nam-ng/dev
Dev
- Loading branch information
Showing
22 changed files
with
1,053 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package model; | ||
|
||
import org.w3c.dom.Element; | ||
|
||
import common.LogUtil; | ||
|
||
public class Action { | ||
private String id; | ||
private int order; | ||
|
||
public Action(Element element) { | ||
setAttributes(element); | ||
} | ||
|
||
private void setAttributes(Element element) { | ||
id = element.getAttribute("id"); | ||
try { | ||
order = Integer.parseInt(element.getAttribute("order")); | ||
} catch (Exception e) { | ||
LogUtil.logException(e); | ||
order = 0; | ||
} | ||
} | ||
|
||
public String getActionId() { | ||
return id; | ||
} | ||
|
||
public int getActionOrder() { | ||
return order; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
package model; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collection; | ||
|
||
import org.w3c.dom.Element; | ||
import org.w3c.dom.Node; | ||
import org.w3c.dom.NodeList; | ||
|
||
public class GroupSetting { | ||
private String id; | ||
private Language language; | ||
private Collection<Toolchain> toolchains = new ArrayList<>(); | ||
private String rtosType; | ||
private String rtosVersion; | ||
private Collection<Board> boards = new ArrayList<>(); | ||
private Collection<Config> configs = new ArrayList<>(); | ||
|
||
public GroupSetting(Element element) { | ||
parseAttribute(element); | ||
NodeList children = element.getChildNodes(); | ||
for (int i = 0; i < children.getLength(); i++) { | ||
Node childNode = children.item(i); | ||
if (childNode.getNodeType() == Node.ELEMENT_NODE) { | ||
Element childElement = (Element) childNode; | ||
String name = childElement.getTagName(); | ||
switch (name) { | ||
case "language": | ||
setLanguage(new Language(childElement)); | ||
break; | ||
case "toolchain": | ||
addToolchain(new Toolchain(childElement)); | ||
break; | ||
case "RTOSType": | ||
setRTOSType(childElement.getTextContent()); | ||
break; | ||
case "RTOSVersion": | ||
setRTOSVersion(childElement.getTextContent()); | ||
break; | ||
case "board": | ||
addBoard(new Board(childElement)); | ||
break; | ||
case "config": | ||
addConfig(new Config(childElement)); | ||
break; | ||
default: | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
|
||
private void parseAttribute(Element element) { | ||
id = element.getAttribute("id"); | ||
} | ||
|
||
public String getSettingId() { | ||
return id; | ||
} | ||
|
||
private void setLanguage(Language language) { | ||
this.language = language; | ||
} | ||
|
||
public Language getLanguage() { | ||
return language; | ||
} | ||
|
||
private void addToolchain(Toolchain toolchain) { | ||
toolchains.add(toolchain); | ||
} | ||
|
||
public Collection<Toolchain> getToolchains() { | ||
return toolchains; | ||
} | ||
|
||
private void setRTOSType(String rtosType) { | ||
this.rtosType = rtosType; | ||
} | ||
|
||
public String getRTOSType() { | ||
return rtosType; | ||
} | ||
|
||
private void setRTOSVersion(String version) { | ||
rtosVersion = version; | ||
} | ||
|
||
public String getRTOSVersion() { | ||
return rtosVersion; | ||
} | ||
|
||
private void addBoard(Board board) { | ||
boards.add(board); | ||
} | ||
|
||
public Collection<Board> getBoards() { | ||
return boards; | ||
} | ||
|
||
private void addConfig(Config config) { | ||
configs.add(config); | ||
} | ||
|
||
public Collection<Config> getConfigs() { | ||
return configs; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package model; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collection; | ||
|
||
import org.w3c.dom.Element; | ||
import org.w3c.dom.Node; | ||
import org.w3c.dom.NodeList; | ||
|
||
public class Project { | ||
private String id; | ||
private String projectName; | ||
private Collection<GroupSetting> groupSettings = new ArrayList<>(); | ||
private Collection<Application> apps = new ArrayList<>(); | ||
|
||
public Project(Element element) { | ||
parseAttribute(element); | ||
NodeList children = element.getChildNodes(); | ||
for (int i = 0; i < children.getLength(); i++) { | ||
Node childNode = children.item(i); | ||
if (childNode.getNodeType() == Node.ELEMENT_NODE) { | ||
Element childElement = (Element) childNode; | ||
String name = childElement.getTagName(); | ||
if ("projectname".equalsIgnoreCase(name)) { | ||
setProjectName(childElement.getTextContent()); | ||
} else if ("group".equalsIgnoreCase(name)) { | ||
addGroupSetting(new GroupSetting(childElement)); | ||
} else if ("application".equalsIgnoreCase(name)) { | ||
addApplication(new Application(childElement)); | ||
} | ||
} | ||
} | ||
} | ||
|
||
private void parseAttribute(Element element) { | ||
id = element.getAttribute("id"); | ||
} | ||
|
||
public String getProjectId() { | ||
return id; | ||
} | ||
|
||
private void setProjectName(String name) { | ||
projectName = name; | ||
} | ||
|
||
public String getProjectName() { | ||
return projectName; | ||
} | ||
|
||
private void addGroupSetting(GroupSetting setting) { | ||
groupSettings.add(setting); | ||
} | ||
|
||
public GroupSetting getGroupSettingById(String id) { | ||
for (GroupSetting setting : groupSettings) { | ||
if (setting.getSettingId().equalsIgnoreCase(id)) { | ||
return setting; | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
private void addApplication(Application app) { | ||
apps.add(app); | ||
} | ||
|
||
public Collection<Application> getApps() { | ||
return apps; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package model; | ||
|
||
import org.w3c.dom.Element; | ||
import org.w3c.dom.Node; | ||
import org.w3c.dom.NodeList; | ||
|
||
public class RXCLinkerFile extends AbstractNode { | ||
private String path; | ||
|
||
public RXCLinkerFile(Element element) { | ||
NodeList children = element.getChildNodes(); | ||
for (int i = 0; i < children.getLength(); i++) { | ||
Node childNode = children.item(i); | ||
if (childNode.getNodeType() == Node.ELEMENT_NODE) { | ||
Element childElement = (Element) childNode; | ||
String name = childElement.getTagName(); | ||
if ("path".equalsIgnoreCase(name)) { | ||
setLinkerPath(childElement.getTextContent()); | ||
} else { | ||
parseFilter(name, childElement); | ||
} | ||
} | ||
} | ||
} | ||
|
||
private void setLinkerPath(String path) { | ||
this.path = path; | ||
} | ||
|
||
public String getLinkerPath() { | ||
return path; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package model; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collection; | ||
|
||
import org.w3c.dom.Element; | ||
import org.w3c.dom.Node; | ||
import org.w3c.dom.NodeList; | ||
|
||
public class TC { | ||
private String id; | ||
private Collection<Project> projects = new ArrayList<>(); | ||
private Collection<Action> actions = new ArrayList<>(); | ||
|
||
public TC(Element element) { | ||
parseAttribute(element); | ||
NodeList children = element.getChildNodes(); | ||
for (int i = 0; i < children.getLength(); i++) { | ||
Node childNode = children.item(i); | ||
if (childNode.getNodeType() == Node.ELEMENT_NODE) { | ||
Element childElement = (Element) childNode; | ||
String name = childElement.getTagName(); | ||
if ("project".equalsIgnoreCase(name)) { | ||
addProject(new Project(childElement)); | ||
} else if ("action".equalsIgnoreCase(name)) { | ||
addAction(new Action(childElement)); | ||
} | ||
} | ||
} | ||
} | ||
|
||
private void parseAttribute(Element element) { | ||
id = element.getAttribute("id"); | ||
} | ||
|
||
public String getTCId() { | ||
return id; | ||
} | ||
|
||
private void addProject(Project project) { | ||
projects.add(project); | ||
} | ||
|
||
public Collection<Project> getProjects() { | ||
return projects; | ||
} | ||
|
||
private void addAction(Action action) { | ||
actions.add(action); | ||
} | ||
|
||
public Collection<Action> getActions() { | ||
return actions; | ||
} | ||
} |
Oops, something went wrong.