id stringlengths 36 36 | text stringlengths 1 1.25M |
|---|---|
aff250f9-5480-417e-97c6-a675255e87b7 | public Matrix copy () {
Matrix X = new Matrix(m,n);
double[][] C = X.getArray();
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
C[i][j] = A[i][j];
}
}
return X;
} |
7757810b-810a-4ead-9cbc-9df9ff6c9685 | public Object clone () {
return this.copy();
} |
a3416f1a-e62f-430c-bee1-d42ddbaa0c4c | public double[][] getArray () {
return A;
} |
dcc094e9-a951-46a0-8445-6e29d3ddbea0 | public double[][] getArrayCopy () {
double[][] C = new double[m][n];
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
C[i][j] = A[i][j];
}
}
return C;
} |
a82c53b8-ad43-4208-9285-01ac281f6453 | public double[] getColumnPackedCopy () {
double[] vals = new double[m*n];
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
vals[i+j*m] = A[i][j];
}
}
return vals;
} |
7ca068de-2837-4e78-9d34-f025c840d2e3 | public double[] getRowPackedCopy () {
double[] vals = new double[m*n];
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
vals[i*n+j] = A[i][j];
}
}
return vals;
} |
71e7c533-9a8b-4d3f-96bb-468228945f3a | public int getRowDimension () {
return m;
} |
96e27ec8-8a1f-4741-8608-5f7f92599e7f | public int getColumnDimension () {
return n;
} |
6b4f92fd-05dc-4b98-90eb-d8654e0e8369 | public double get (int i, int j) {
return A[i][j];
} |
20d029d5-d947-4676-b6a2-b4e24d636e2e | public Matrix getMatrix (int i0, int i1, int j0, int j1) {
Matrix X = new Matrix(i1-i0+1,j1-j0+1);
double[][] B = X.getArray();
try {
for (int i = i0; i <= i1; i++) {
for (int j = j0; j <= j1; j++) {
B[i-i0][j-j0] = A[i][j];
}
}
} catch(Ar... |
696b8cd0-62dd-4b26-b52c-515c2ea92abd | public Matrix getMatrix (int[] r, int[] c) {
Matrix X = new Matrix(r.length,c.length);
double[][] B = X.getArray();
try {
for (int i = 0; i < r.length; i++) {
for (int j = 0; j < c.length; j++) {
B[i][j] = A[r[i]][c[j]];
}
}
} catch(ArrayI... |
ef1021d7-630c-4b09-ab1e-553fb0277bd0 | public Matrix getMatrix (int i0, int i1, int[] c) {
Matrix X = new Matrix(i1-i0+1,c.length);
double[][] B = X.getArray();
try {
for (int i = i0; i <= i1; i++) {
for (int j = 0; j < c.length; j++) {
B[i-i0][j] = A[i][c[j]];
}
}
} catch(Arra... |
fe0006ea-a712-4406-a56a-d5bdbf31bf7a | public Matrix getMatrix (int[] r, int j0, int j1) {
Matrix X = new Matrix(r.length,j1-j0+1);
double[][] B = X.getArray();
try {
for (int i = 0; i < r.length; i++) {
for (int j = j0; j <= j1; j++) {
B[i][j-j0] = A[r[i]][j];
}
}
} catch(Arra... |
67898ab4-3387-4c2b-81ef-7da3cbedf473 | public void set (int i, int j, double s) {
A[i][j] = s;
} |
f44ce9eb-77ca-4676-bbe8-73f91fa0b3fb | public void setMatrix (int i0, int i1, int j0, int j1, Matrix X) {
try {
for (int i = i0; i <= i1; i++) {
for (int j = j0; j <= j1; j++) {
A[i][j] = X.get(i-i0,j-j0);
}
}
} catch(ArrayIndexOutOfBoundsException e) {
throw new ArrayIndexOutOfBo... |
15c6905d-0cc9-45fb-b582-7aee0b15ba41 | public void setMatrix (int[] r, int[] c, Matrix X) {
try {
for (int i = 0; i < r.length; i++) {
for (int j = 0; j < c.length; j++) {
A[r[i]][c[j]] = X.get(i,j);
}
}
} catch(ArrayIndexOutOfBoundsException e) {
throw new ArrayIndexOutOfBoundsEx... |
0cd2da39-9c43-49cc-8ea9-846bf09283d1 | public void setMatrix (int[] r, int j0, int j1, Matrix X) {
try {
for (int i = 0; i < r.length; i++) {
for (int j = j0; j <= j1; j++) {
A[r[i]][j] = X.get(i,j-j0);
}
}
} catch(ArrayIndexOutOfBoundsException e) {
throw new ArrayIndexOutOfBound... |
bf1939eb-5172-4dfd-aad7-bb4e94850165 | public void setMatrix (int i0, int i1, int[] c, Matrix X) {
try {
for (int i = i0; i <= i1; i++) {
for (int j = 0; j < c.length; j++) {
A[i][c[j]] = X.get(i-i0,j);
}
}
} catch(ArrayIndexOutOfBoundsException e) {
throw new ArrayIndexOutOfBound... |
29e559e9-01bb-4782-8102-f55b84f35d2c | public Matrix transpose () {
Matrix X = new Matrix(n,m);
double[][] C = X.getArray();
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
C[j][i] = A[i][j];
}
}
return X;
} |
31b2b0c2-fbb2-4f8c-a4b4-cdf0292d6038 | public double norm1 () {
double f = 0;
for (int j = 0; j < n; j++) {
double s = 0;
for (int i = 0; i < m; i++) {
s += Math.abs(A[i][j]);
}
f = Math.max(f,s);
}
return f;
} |
680b4194-1a30-442d-91e0-1f34af418fd8 | public double norm2 () {
return (new SingularValueDecomposition(this).norm2());
} |
df6c319b-acdf-4f28-97a3-b55a8deea6c2 | public double normInf () {
double f = 0;
for (int i = 0; i < m; i++) {
double s = 0;
for (int j = 0; j < n; j++) {
s += Math.abs(A[i][j]);
}
f = Math.max(f,s);
}
return f;
} |
56a7ec6e-5d03-420c-87b3-d097b9463bb3 | public double normF () {
double f = 0;
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
f = Maths.hypot(f,A[i][j]);
}
}
return f;
} |
0bd7d473-6f20-4b5d-9701-f311bb4dd4b3 | public Matrix uminus () {
Matrix X = new Matrix(m,n);
double[][] C = X.getArray();
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
C[i][j] = -A[i][j];
}
}
return X;
} |
9e3c2ff6-f922-4bc2-be94-4a5dfd29178e | public Matrix plus (Matrix B) {
checkMatrixDimensions(B);
Matrix X = new Matrix(m,n);
double[][] C = X.getArray();
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
C[i][j] = A[i][j] + B.A[i][j];
}
}
return X;
} |
bd68401a-c9e8-468a-b67e-763c0cd22586 | public Matrix plusEquals (Matrix B) {
checkMatrixDimensions(B);
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
A[i][j] = A[i][j] + B.A[i][j];
}
}
return this;
} |
aa6a2972-35eb-4463-9d52-1c898cae0e03 | public Matrix minus (Matrix B) {
checkMatrixDimensions(B);
Matrix X = new Matrix(m,n);
double[][] C = X.getArray();
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
C[i][j] = A[i][j] - B.A[i][j];
}
}
return X;
} |
e8f63ab3-5c0e-479b-a657-7ef5947771f3 | public Matrix minusEquals (Matrix B) {
checkMatrixDimensions(B);
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
A[i][j] = A[i][j] - B.A[i][j];
}
}
return this;
} |
3a936877-a6b9-4a3c-bb7a-2d2b91a9ceba | public Matrix arrayTimes (Matrix B) {
checkMatrixDimensions(B);
Matrix X = new Matrix(m,n);
double[][] C = X.getArray();
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
C[i][j] = A[i][j] * B.A[i][j];
}
}
return X;
} |
38c7feab-f52d-4570-b6b3-c2cfcd5b695e | public Matrix arrayTimesEquals (Matrix B) {
checkMatrixDimensions(B);
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
A[i][j] = A[i][j] * B.A[i][j];
}
}
return this;
} |
6c3e4e39-c3aa-4964-9f71-2aa2f1333ff4 | public Matrix arrayRightDivide (Matrix B) {
checkMatrixDimensions(B);
Matrix X = new Matrix(m,n);
double[][] C = X.getArray();
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
C[i][j] = A[i][j] / B.A[i][j];
}
}
return X;
} |
5c230c4c-a34d-4607-bd14-cbc30c9038e5 | public Matrix arrayRightDivideEquals (Matrix B) {
checkMatrixDimensions(B);
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
A[i][j] = A[i][j] / B.A[i][j];
}
}
return this;
} |
d9361c83-736c-4bc9-a322-d44bda05c7f3 | public Matrix arrayLeftDivide (Matrix B) {
checkMatrixDimensions(B);
Matrix X = new Matrix(m,n);
double[][] C = X.getArray();
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
C[i][j] = B.A[i][j] / A[i][j];
}
}
return X;
} |
d870ec2e-49d2-4405-89cf-3f26c046dd6a | public Matrix arrayLeftDivideEquals (Matrix B) {
checkMatrixDimensions(B);
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
A[i][j] = B.A[i][j] / A[i][j];
}
}
return this;
} |
2954c77a-ce79-4ee2-a6ef-c4cdd70011e0 | public Matrix times (double s) {
Matrix X = new Matrix(m,n);
double[][] C = X.getArray();
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
C[i][j] = s*A[i][j];
}
}
return X;
} |
9f1606ea-a006-424d-9c58-3b0a0055cd22 | public Matrix timesEquals (double s) {
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
A[i][j] = s*A[i][j];
}
}
return this;
} |
a01cd6a2-4a5f-4835-ad62-c0d0d915da3e | public Matrix times (Matrix B) {
if (B.m != n) {
throw new IllegalArgumentException("Matrix inner dimensions must agree.");
}
Matrix X = new Matrix(m,B.n);
double[][] C = X.getArray();
double[] Bcolj = new double[n];
for (int j = 0; j < B.n; j++) {
for (int k = 0; k... |
ce3f4e20-807c-44da-9ef7-d95eeba577c2 | public LUDecomposition lu () {
return new LUDecomposition(this);
} |
a00ed10a-02d3-42ae-9f00-e605c8602bb8 | public QRDecomposition qr () {
return new QRDecomposition(this);
} |
12c210ce-ca6c-49b6-9cba-abe10fea7a2b | public CholeskyDecomposition chol () {
return new CholeskyDecomposition(this);
} |
21dbedf9-2981-4d4c-865c-ead5e0229e5c | public SingularValueDecomposition svd () {
return new SingularValueDecomposition(this);
} |
22fab20d-f211-47ae-87bf-1bd70259fcf2 | public EigenvalueDecomposition eig () {
return new EigenvalueDecomposition(this);
} |
cb00eaff-91d5-46f3-9daf-e471f9137cca | public Matrix solve (Matrix B) {
return (m == n ? (new LUDecomposition(this)).solve(B) :
(new QRDecomposition(this)).solve(B));
} |
b720120a-c43d-4522-acf8-05ed9cd8a5e1 | public Matrix solveTranspose (Matrix B) {
return transpose().solve(B.transpose());
} |
fa50fcce-aaf7-4033-94ba-410c574b4fd8 | public Matrix inverse () {
return solve(identity(m,m));
} |
e9448480-a00a-45a2-8c94-5defeae9ba37 | public double det () {
return new LUDecomposition(this).det();
} |
62e26de1-bd0c-4351-ba8a-a5a04971fa41 | public int rank () {
return new SingularValueDecomposition(this).rank();
} |
f560056f-2915-4a31-af7f-e662dbe54388 | public double cond () {
return new SingularValueDecomposition(this).cond();
} |
8da5417a-52bb-4f5d-974c-66bfb81d834b | public double trace () {
double t = 0;
for (int i = 0; i < Math.min(m,n); i++) {
t += A[i][i];
}
return t;
} |
fbeca4c2-864a-4fbe-aecd-42e334bbd254 | public static Matrix random (int m, int n) {
Matrix A = new Matrix(m,n);
double[][] X = A.getArray();
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
X[i][j] = Math.random();
}
}
return A;
} |
319a3f65-d569-4de2-9c0c-143c798cb2a7 | public static Matrix identity (int m, int n) {
Matrix A = new Matrix(m,n);
double[][] X = A.getArray();
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
X[i][j] = (i == j ? 1.0 : 0.0);
}
}
return A;
} |
658b54a2-b102-4a2e-a04e-343ebf73098f | public void print (int w, int d) {
print(new PrintWriter(System.out,true),w,d); } |
c479c844-164e-447f-9bfc-e2041ea4c498 | public void print (PrintWriter output, int w, int d) {
DecimalFormat format = new DecimalFormat();
format.setDecimalFormatSymbols(new DecimalFormatSymbols(Locale.US));
format.setMinimumIntegerDigits(1);
format.setMaximumFractionDigits(d);
format.setMinimumFractionDigits(d);
format.se... |
ca8bce47-5ca8-4912-916f-21ad039fb543 | public void print (NumberFormat format, int width) {
print(new PrintWriter(System.out,true),format,width); } |
9b9c9818-1ff7-4ae9-b6f9-385c3b1a6095 | public void print (PrintWriter output, NumberFormat format, int width) {
output.println(); // start on new line.
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
String s = format.format(A[i][j]); // format the number
int padding = Math.max(1,width-s.length()); /... |
6993f7de-81cb-4dc0-b479-60654737a358 | public static Matrix read (BufferedReader input) throws java.io.IOException {
StreamTokenizer tokenizer= new StreamTokenizer(input);
// Although StreamTokenizer will parse numbers, it doesn't recognize
// scientific notation (E or D); however, Double.valueOf does.
// The strategy here is to dis... |
79b355d7-c072-4977-8056-20bfee9f911d | private void checkMatrixDimensions (Matrix B) {
if (B.m != m || B.n != n) {
throw new IllegalArgumentException("Matrix dimensions must agree.");
}
} |
efd73149-0c29-42e6-a09d-1bfbd9dc2e36 | public void reduce(IntWritable key, Iterable<Text> values,
Context context
) throws IOException, InterruptedException {
ArrayList<String> list = new ArrayList<String>();
for (Text val : values) {
list.add(val.toString());
context.write(val, null);
}... |
d8977af3-7f08-450a-84cb-cd9b27ec4df6 | public void setup(Context context) {
Configuration conf = context.getConfiguration();
try {
FileSystem fs = FileSystem.get(conf);
Path infile = new Path(conf.get("CentroidFile")); //give it as an argument
if (!fs.exists(infile))
System.out.println("Centroids.txt does not exist");
... |
72e534ce-1e73-46aa-8a5c-e8a0d02421a6 | private double EucledianDistance(String s1, String s2) {
StringTokenizer itr1 = new StringTokenizer(s1);
StringTokenizer itr2 = new StringTokenizer(s2);
String id1 = itr1.nextToken("\t");//Do not remove (needed to remove the first id element)
String id2 = itr2.nextToken("\t");//Do not remove (needed... |
42b20e83-2597-4a6c-8cf2-46803e8fdafb | public void map(Object key, Text value, Context context
) throws IOException, InterruptedException {
int minCentroidID=0;
double dist, mindist = -1.0;
Iterator<Integer> keyIter = Centroids.keySet().iterator();
while (keyIter.hasNext()) {
Integer CentroidID = keyIter.next();
dist =... |
755e2853-88b2-44ed-812a-ac99fb9a13c9 | public void map(Object key, Text value, Context context
) throws IOException, InterruptedException {
IntWritable one = new IntWritable(1);
context.write(one, value);
} |
a153d1c0-cce8-4402-a03a-32d564a4ce84 | public void reduce(IntWritable key, Iterable<Text> values,
Context context
) throws IOException, InterruptedException {
for (Text val : values) {
context.write(val, null);
}
} |
b4a3337a-0598-4b99-8937-048611eac2a1 | public Map()
{
System.out.println("============CALLING THE CONSTRUCTOR==============");
} |
1433cc45-6a5b-427c-ad77-7bae85562d2d | public void setup(Context context) {
Configuration conf = context.getConfiguration();
docCount = termCount = 0;
int maxTermCount = Integer.parseInt(conf.get("TermCount"));
curDocId.set(-1);
tdMat = conf.get("MatType").trim();
/* Fetch information about documents from docIndex */
try {
... |
45d66fad-027f-4226-b851-1dabc0ea35e4 | public void map(LongWritable key, Text value, Context context) throws IOException {
String line = value.toString();
line = line.replaceAll("[^a-zA-Z0-9]+"," ");
line = line.toLowerCase();
IntWritable dummyDocId = new IntWritable();
dummyDocId.set(1);
Configuration conf = context.g... |
52502c12-d333-4aae-84d8-436228c25001 | public void reduce(IntWritable docId, Iterable<Text> termFrequencies,
Context context)
throws IOException {
/* Dont collect to reduce rather write straight-away to $OUTPUT_FOLDER/Index/TermIndex/ */
int[] finalTermFrq = new int[2];
boolean mtTypeIncdence = false;
Configuration conf = context.getConfi... |
9c414e29-233e-47ce-ba26-e59dfeb64563 | public static void main(String[] args) throws Exception {
Configuration conf = new Configuration();
conf.set("TermIndex",args[0]+"/../Index/TermIndex.dat");
conf.set("DocIndex",args[0]+"/../Index/DocIndex.dat");
conf.set("TermCount", args[1]);
conf.set("MatType", args[2]);
//JobC... |
57fb22db-8e8e-4da2-9a60-d9111c549da0 | public Parser() {
analyzer = new LexicalAnalyzer();
} |
8515b59c-05c7-4d14-be2a-98bea8e158bd | public Node parse(Reader src) throws ScriptException {
analyzer.load(src);
return parseExpression();
} |
9c79756d-11fa-42d7-8eec-6aab1a8cc6b4 | private Node parseExpression() throws ScriptException {
return parseAdditive();
} |
d3e81b06-bdd5-4e2c-9864-c721b4d46417 | private Node parseAdditive() throws ScriptException {
Node left = parseMultiplicative();
if (left == null)
return null;
Token token;
while ((token = analyzer.getNextToken()) != null) {
if (token.getType() != Operators.ADD
&& token.getType() != ... |
d76ccd68-0586-453c-94a4-181cdb71fc27 | private Node parseMultiplicative() throws ScriptException {
Node left = parsePower();
if (left == null)
return null;
Token token;
while ((token = analyzer.getNextToken()) != null) {
if (token.getType() != Operators.MUL
&& token.getType() != Ope... |
7d6224e4-9573-47d7-b6ee-50ce6d24d77b | private Node parsePower() throws ScriptException {
Node left = parseUnary();
if (left == null)
return null;
Token token;
while ((token = analyzer.getNextToken()) != null) {
if (token.getType() != Operators.POW) {
analyzer.ungetToken(token);
... |
7dc99c50-46da-458f-a15c-4bc6ea424622 | private Node parseUnary() throws ScriptException {
Token token = analyzer.getNextToken();
if (token == null)
return null;
if (token.getType() == Operators.ADD) {
return parsePrimary();
} else if (token.getType() == Operators.SUB) {
Node node = parsePri... |
95adb2ca-c0b6-43a4-b659-178bab8a68ac | private Node parsePrimary() throws ScriptException {
Token token = analyzer.getNextToken();
if (token == null)
return null;
if (token.getType() == Tokens.NUMBER) {
return new Node(token.toNumber());
} else if (token.getType() == Operators.OPEN_PARENS) {
... |
e0073482-a399-4f46-93c5-abb458a7284e | public void load(Reader reader) throws ScriptException {
this.reader = new LineNumberReader(reader);
readNextLine();
} |
6dfa1b26-9750-496b-a1d1-e7b4ffbb15ce | private String readNextLine() throws ScriptException {
try {
while ((line = reader.readLine()) != null) {
if (line.length() != 0)
break;
}
index = 0;
return line;
} catch (IOException ex) {
throw new ScriptEx... |
fccff210-331a-4e93-953f-f83c811dce87 | private char charAt(int column) throws ScriptException {
if (column < line.length())
return line.charAt(column);
if (readNextLine() != null)
return line.charAt(0);
else
return '\0'; // ファイルの末尾に達した場合
} |
cc7d14d0-de72-49e8-b6ae-f3939e0088b9 | private boolean isOperator(Token token, char ch) {
String target = token + Character.toString(ch);
for (Operators oper : opers) {
if (oper.toString().indexOf(target) >= 0)
return true;
}
return false;
} |
5be961c3-fa67-41e9-98ba-cefe32ecce11 | private Enum<?> getOperator(Token token) {
for (Enum<?> oper : opers) {
if (token.equals(oper.toString()))
return oper;
}
return null;
} |
75eb0356-db04-4474-b40b-d5f302beae9a | private ScriptException error(char ch) {
index++;
return error("Character \'" + ch + "\' is illegal here.");
} |
e39731a2-dee4-4997-a863-60d55e02ee36 | private ScriptException error(Object msg) {
int line = reader.getLineNumber();
return new ScriptException(
msg + " at line : " + line +
"\n => " + getLine(), null, line, index + 1);
} |
1ad65b07-f9e4-4df2-95fb-75f01b337e14 | public Token getNextToken() throws ScriptException {
Token token = next;
if (next != null) {
next = null;
return token;
}
return read(new Token());
} |
715da5d5-f3be-4890-a00d-1c33d8a29e7c | public void ungetToken(Token token) {
this.next = token; // 最大で大きさ1のスタック
} |
4d3370d9-26c0-4c04-b323-fa016a844b7d | private Token read(Token token) throws ScriptException {
while (line != null) {
char ch = charAt(index);
index++;
if (Character.isDigit(ch))
return readInteger(token.append(ch));
if (ch == '\0')
return token;
if (isOpera... |
3dc312b2-c6a1-4c18-805c-80acdc5eb6cf | private Token readInteger(Token token) throws ScriptException {
while (line != null) {
char ch = charAt(index);
index++;
if (Character.isDigit(ch))
token.append(ch);
else if (ch == '.' && Character.isDigit(charAt(index)))
return rea... |
0a912b01-683e-43bd-b921-9831e064ac06 | private Token readNumber(Token token) throws ScriptException {
while (line != null) {
char ch = charAt(index);
index++;
if (Character.isDigit(ch))
token.append(ch);
else {
index--;
return token.setType(Tokens.NUMBER)... |
45dca1a2-4dcd-4176-92ee-cc0a977cca55 | private Token readOperator(Token token)
throws ScriptException {
while (line != null) {
char ch = charAt(index);
index++;
if (isOperator(token, ch)) {
token.append(ch);
} else {
index--;
return token.setT... |
3d7bf10e-5571-4284-a6be-2fa0512f3480 | public Token checkNextToken(Enum<?>... expected)
throws ScriptException {
Token next = getNextToken();
if (next != null) {
for (Enum<?> exp : expected) {
if (next.getType() == exp)
return next;
}
}
throw error("\"" +... |
f34c8905-d9b8-46d4-9551-290c7fbf15a8 | public String getLine() {
return (line != null) ? line.substring(0, index) : "";
} |
faf5af9c-6e8b-44ce-8dbf-d34219ddae74 | public int getLineNumber() {
return reader.getLineNumber();
} |
e9d5e497-e4fb-4336-8e35-9837770f1528 | public int getColumnNumber() {
return index + 1;
} |
57bf439f-b158-41c9-9c27-ac44e1d67b7e | public Node(Enum<?> op, Node left, Node right) {
this.op = (Operators) op;
this.left = left;
this.right = right;
} |
1215996a-7e6e-4dff-b29a-698bf72962a7 | public Node(BigDecimal value) {
this.op = null;
this.value = value;
} |
99cc0ecc-87e1-4582-8789-4f26e79bb98a | public BigDecimal value() {
if (op == null)
return value;
BigDecimal l = left.value();
BigDecimal r = (right != null) ? right.value() : null;
switch (op) {
case ADD:
return l.add(r);
case SUB:
return r != null ? l.subtract(r) : l.negate... |
7355479e-efcd-4d29-9826-089917357b7a | public String toString() {
if (op == null)
return String.valueOf(value);
StringBuilder sb = new StringBuilder();
sb.append(left);
sb.append(" ");
sb.append(right);
sb.append(" ");
sb.append(op);
return new String(sb);
} |
35f691a7-4a4a-422e-a80f-af3ceded1381 | public Token() {
sb = new StringBuilder();
} |
397009df-75cf-481b-8b20-14d2928a290d | public Token append(char ch) {
sb.append(ch);
return this;
} |
facd4b11-4dfd-4562-8a5b-b9a321582c0e | public String toString() {
return sb.toString();
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.