/*
 * $Log: Place.java,v $
# Revision 1.3  1996/05/12  09:40:52  inder
# added alpha and omega.
#
# Revision 1.2  1996/04/22  06:17:54  inder
# created constructor and getName functions.
#
# Revision 1.1  1996/03/18  18:59:58  rlj1
# Initial revision
#
 */
//////////////////////////////////////////////////
package physical;

import general.*;
import java.io.*;
//////////////////////////////////////////////////
public class Place {
  private String name;

  // "Discrete" version: switch put in this Place must be at
  // these coordinates.
  public double x, y;

  // "Continuous" version: switch put in this Place can be at
  // any x,y coordinates that fall in the Region reg.
  //Region reg;

  public double alpha, omega;
  GeneralProperties prop;
//************************************************
public Place(String PlaceName, double X, double Y, double Alpha, double
	     Omega) { 
  name = PlaceName;
  x = X;
  y = Y;
  alpha = Alpha;
  omega = Omega;
  prop = new GeneralProperties();
}

//************************************************
// creator with name, x, and y only.
// alpha and omega should be part of constraint.
//
public Place(String PlaceName, double X, double Y) {
  name = PlaceName;
  x = X;
  y = Y;
  alpha = -1; // just give it an impossible value
  omega = -1;
  prop = new GeneralProperties();
}

//************************************************
public Place(StreamTokenizer stk) throws IOException {
  int tokenType, i;
  
  // read the starting '('
  while ( stk.nextToken() != '(' );

  // read the first word, it should be the place name 
  while ( stk.nextToken() != StreamTokenizer.TT_WORD );
  name = stk.sval;

  // get the first number, it would be the x coordinate
  while ( stk.nextToken() != StreamTokenizer.TT_NUMBER );
  x = stk.nval;
    
  // get the second number, it would be the y coordinate
  while ( stk.nextToken() != StreamTokenizer.TT_NUMBER );
  y = stk.nval;

  // get the closing ')'
  while (stk.nextToken() != ')');
}

//************************************************
public String getName() {
  return name;
}

//************************************************
public double getX() {
  return x;
}

//************************************************
public double getY() {
  return y;
}

//************************************************
public String toString() {
  return ( "(" + name + "," + x + "," + y + "," + alpha + "," + omega + ")" );
}

}
//////////////////////////////////////////////////














