177 lines
3.9 KiB
Java
177 lines
3.9 KiB
Java
/* 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
|
|
*
|
|
* You may use and distribute under the terms of either the GNU Lesser
|
|
* General Public License, either version 2 of the license or,
|
|
* at your choice, any later version. Alternatively, you may use and
|
|
* distribute under the terms of the XPL.
|
|
*
|
|
* See the LICENSE.lgpl and LICENSE.xpl files for the specific terms of
|
|
* the licenses.
|
|
*
|
|
* This software 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 README
|
|
* file for more details.
|
|
*
|
|
*/
|
|
/*
|
|
* 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 :
|