AwtLink.java from gzz at Krugle
Show AwtLink.java syntax highlighted
/* DO NOT EDIT THIS FILE. THIS FILE WAS GENERATED FROM ../Modules/awtool/AwtLink.zob,
* EDIT THAT FILE INSTEAD!
* All changes to this file will be lost.
*/
/*
AwtLink.zob
*
* Copyright (c) 1999-2000, Ted Nelson and Tuomas Lukka
*
* This file is part of Gzz.
*
* Gzz is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Gzz is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
* Public License for more details.
*
* You should have received a copy of the GNU Lesser General
* Public License along with Gzz; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
*/
/*
* Written by Kimmo Wideroos
*/
package org.gzigzag.module;
import org.gzigzag.*;
import java.awt.*;
import java.util.*;
public class AwtLink extends ZObCellRepr implements ZOb {
public static boolean dbg = false;
static final void p(String s) { if(dbg) System.out.println(s); }
static final void pa(String s) { System.out.println(s); }
/** UNDOCUMENTED.
* <p>Default value: <PRE> 0.0;</PRE>.
* @structparam 1
*/
public
double x
= 0.0;/** UNDOCUMENTED.
* <p>Default value: <PRE> 0.0;</PRE>.
* @structparam 1
*/
public double y
= 0.0;/** UNDOCUMENTED.
* <p>Default value: <PRE> false;</PRE>.
* @structparam 1
*/
public boolean fixed
= false;
/* AUTOGENERATED! */
static final private int fullmask = 7;
/* AUTOGENERATED! */
public String readParams(ZZCell start) {
int m = 0;
try {
if(start != null)
m = readParams(start, 0);
} catch(Throwable t) {
ZZLogger.exc(t);
} finally {
}
if((m & fullmask) != fullmask) {
// not all parameters present - no problem right now.
}
return "";
}
/* AUTOGENERATED! */
private int readParams(ZZCell start, int mask) {
ZZCell n = start;
while(n != null) {
String s = n.getText();
// Tests autogenerated from members.
if(s.equals("x")) {
mask |= 1;
try {
ZZCell c = n.s("d.1"); s = c.getText(); x = (Double.valueOf(s)).doubleValue();
} catch(Exception e) {
ZZLogger.exc(e);
}
} else
if(s.equals("y")) {
mask |= 2;
try {
ZZCell c = n.s("d.1"); s = c.getText(); y = (Double.valueOf(s)).doubleValue();
} catch(Exception e) {
ZZLogger.exc(e);
}
} else
if(s.equals("fixed")) {
mask |= 4;
try {
ZZCell c = n.s("d.1"); s = c.getText();
if(s.equals("true")) fixed=true;
else if(s.equals("false")) fixed=false;
else { /* XXX ??? */ }
} catch(Exception e) {
ZZLogger.exc(e);
}
} else
{ } // grab that last "else"
ZZCell h = n.h("d.3");
if(h != null && h != n) {
// recurse
mask |= readParams(h, mask);
}
n = n.s("d.2");
}
return mask;
}
public boolean isFixed() { return fixed; }
public void setX(double x) { this.x = x; }
public void setY(double y) { this.y = y; }
public double getX() { return x; }
public double getY() { return y; }
public ZZCell toHeadCell() {
return getCell().h(AwtUtil.d_from, 1).h(AwtUtil.d_clone);
}
public ZZCell fromHeadCell() {
return getCell().h(AwtUtil.d_to).h(AwtUtil.d_clone);
}
public String getZObName() {
return "Link";
}
public String cellRepr(ZZCell start, boolean clone)
{
ZZCell c = start.getOrNewCell("d.1");
c.setText(getZObClassName());
c = c.getOrNewCell("d.1");
c.setText("x");
c.getOrNewCell("d.1").setText(""+getX());
c = c.getOrNewCell("d.2");
c.setText("y");
c.getOrNewCell("d.1").setText(""+getY());
return "";
}
}
// vim: set syntax=java :
See more files for this project here