1package umontreal.ssj.latnetbuilder.weights;
3import java.io.FileWriter;
4import java.io.IOException;
5import java.util.ArrayList;
97 public void write() throws IOException {
99 StringBuffer sb =
new StringBuffer(
"");
101 sb.append(
"order " + w.getIndex() +
":\t" + w.getWeight() +
"\n");
102 sb.append(
"default:\t" + defaultWeight);
103 file.write(sb.toString());
118 StringBuffer sb =
new StringBuffer(
"");
119 if (weights.size() > 0) {
122 while (index < w.getIndex()) {
123 sb.append(getDefaultWeight() +
",");
126 sb.append(w.getWeight() +
",");
129 sb.deleteCharAt(sb.length() - 1);
131 return sb.toString();
143 StringBuffer sb =
new StringBuffer(
"");
144 sb.append(
"Order dependent weights [default = " + getDefaultWeight() +
"]:\n");
145 if (weights.size() > 0)
148 return sb.toString() + (weights.size() > 0 ?
"]" :
"");
157 StringBuffer sb =
new StringBuffer(
"");
158 sb.append(
"order-dependent:" + getDefaultWeight());
159 if (weights.size() > 0)
163 return sb.toString();
void write()
Writes a file with name fileName to the directory fileDir containing information on the weights.
String toString()
Creates a formatted output of the order dependent weights sorted w.r.t.
void setFileDir(String dir)
Sets the directory to which an output-file can be generated.
OrderDependentWeights()
Default constructor.
String fileName
Filename when weights are printed to a file.
String printBody()
Sorts the weights and creates a rudimentary string containing the order dependent weights separated b...
void setFileName(String name)
Sets the name of the file to which an output can be generated.
OrderDependentWeights(ArrayList< SingletonWeightComparable< Integer > > weightList)
Constructs an instance of order dependent weights from a given list of comparable weights indexed by ...
String getFileDir()
Returns the directory to which an output-file can be generated.
String toLatNetBuilder()
Creates a string formatted for passing it to LatticeBuilder.
String fileDir
Output directory when weights are printed to a file.
String getFileName()
Returns the name of the file to which an output can be generated.
Implements single instances of weights.
WeightsComparable(List< SingletonWeightComparable< T > > w)