public class RedFileManager
extends java.lang.Object
Warrior| Constructor and Description |
|---|
RedFileManager() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getError(int line)
Gets the error referenced by line in correspondence to the instruction
string.
|
java.lang.String |
getErrorLabel()
Gets the label which causes an error.
|
int |
getErrorLabelLine()
Gets the line number where the first error label was found.
|
java.lang.String |
getRedCodeLine(int line)
Gets the referenced line string.
|
int |
getRedCodeLineCount()
Gets the number of instruction lines.
|
Warrior |
getWarrior()
Gets the Warrior loaded from file or string.
|
boolean |
hasError()
Tests if there is an error within the loaded warrior.
|
boolean |
hasError(int line)
Tests if there is an error within a specific instruction line.
|
boolean |
hasErrorLabel()
Tests if there is at least one unknown label within a field.
|
boolean |
isSupportedStandard(java.lang.String redcodeversion)
Tests if the parsed RedCode is likely compatible with a RedCode version.
|
void |
loadFromFile(java.lang.String uri)
Loads a file into the RedFileManager and its warrior.
|
void |
loadFromString(java.lang.String redcode)
Loads a string into the RedFileManager and its warrior.
|
void |
saveToRcFile(java.lang.String uri)
Saves the warrior of the RedFileManager instance into a Resource-File.
|
void |
saveToRedFile(java.lang.String uri)
Saves the warrior of the RedFileManager instance into a Red-File.
|
void |
updateFromString(java.lang.String redcode)
Loads a string into the RedFileManager and its warrior.
|
public void loadFromFile(java.lang.String uri)
throws java.io.IOException
uri - must be an existing red or rc file reference.java.io.IOException - if there is no such RedFile at the given uri or loadWarrior()
fails.public void loadFromString(java.lang.String redcode)
throws java.io.IOException
redcode - must contain RedCode with line breaksjava.io.IOException - in case loadWarrior() fails.public void updateFromString(java.lang.String redcode)
throws java.io.IOException
redcode - must contain RedCode with line breaksjava.io.IOException - in case loadWarrior() fails.public void saveToRedFile(java.lang.String uri)
throws java.io.FileNotFoundException,
java.io.IOException
uri - should be a possible file path depending on the surrounding
system.java.io.FileNotFoundException - In case FileOutputStream() fails.java.io.IOException - In case writeMetaToFile() fails.public void saveToRcFile(java.lang.String uri)
throws java.io.FileNotFoundException,
java.io.IOException
uri - should be a possible file path depending on the surrounding
system.java.io.FileNotFoundException - In case FileOutputStream() fails.java.io.IOException - In case writeMetaToFile() fails.public java.lang.String getRedCodeLine(int line)
throws java.io.IOException
line - must be within the range of possible lines.java.io.IOException - In case the line value was out of bound.public java.lang.String getError(int line)
throws java.io.IOException
line - must be within the range of possible lines.java.io.IOException - In case the line value was out of bound.public int getRedCodeLineCount()
public boolean hasError()
public boolean hasError(int line)
throws java.io.IOException
line - must be within the range of possible lines.java.io.IOException - In case the line value was out of bound.public boolean hasErrorLabel()
public java.lang.String getErrorLabel()
public int getErrorLabelLine()
public Warrior getWarrior()
public boolean isSupportedStandard(java.lang.String redcodeversion)
redcodeversion -