Package narzedzia.op1

Source Code of narzedzia.op1.Variable

package narzedzia.op1;

import narzedzia.Expression;
import narzedzia.Pair;
import narzedzia.Collection;

import java.io.*;

public class Variable extends Expression{
  private static Collection c=new Collection();

  public static void add(String s, int n) throws Exception {
    try {
      c.insert(new Pair(s,n));
    }
    catch (Exception e) {
      c.update(s,n);
    }
  }

  private String s;

  public Variable(String s) {
    this.s=s;
  }

  public int Compute() {
    try {
      return c.find(s);
    }
    catch (Exception e) {
      return 0;
    }
  }

  public String toString() {
    return s;
  }
}
TOP

Related Classes of narzedzia.op1.Variable

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.