created mirror
This commit is contained in:
commit
6764738d92
600 files changed
+87187
No files matched your search
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
ChangeDim.java
|
||||
*
|
||||
* 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 Tuukka Hastrup
|
||||
*/
|
||||
package org.gzigzag.transform;
|
||||
import java.util.*;
|
||||
import org.gzigzag.*;
|
||||
|
||||
/** ZZspace dimension changer - substitute a dimension name with another
|
||||
*/
|
||||
|
||||
public class ChangeDim {
|
||||
String rcsid = "$Id: ChangeDim.java,v 1.5 2000/10/18 14:35:32 tjl Exp $";
|
||||
String olddim, newdim;
|
||||
ZZSpace space;
|
||||
/** Constructs dimension changer for a space
|
||||
* @param od The old dimension
|
||||
* @param nd The new dimension
|
||||
* @param s The space to convert
|
||||
*/
|
||||
public ChangeDim(String od, String nd, ZZSpace s) {
|
||||
olddim = od;
|
||||
newdim = nd;
|
||||
space = s;
|
||||
}
|
||||
|
||||
/** Performs the actual transformation. All connections along the old
|
||||
* dimension are disconnected and new ones connected along the new dimension.
|
||||
*/
|
||||
public void transform() {
|
||||
Enumeration e=space.cells();
|
||||
ZZCell c, n;
|
||||
while(e.hasMoreElements()) {
|
||||
c = (ZZCell)e.nextElement();
|
||||
n = c.s(olddim, 1);
|
||||
if(n!=null) {
|
||||
c.disconnect(olddim, 1);
|
||||
c.connect(newdim, 1, n);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
ClearDim.java
|
||||
*
|
||||
* 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 Tuukka Hastrup
|
||||
*/
|
||||
package org.gzigzag.transform;
|
||||
import java.util.*;
|
||||
import org.gzigzag.*;
|
||||
|
||||
/** ZZspace dimension clearer - disconnects every connection along a dimension
|
||||
*/
|
||||
|
||||
public class ClearDim {
|
||||
String rcsid = "$Id: ClearDim.java,v 1.4 2000/10/18 14:35:32 tjl Exp $";
|
||||
String dim;
|
||||
ZZSpace space;
|
||||
/** Constructs dimension changer for a space
|
||||
* @param od The old dimension
|
||||
* @param nd The new dimension
|
||||
* @param s The space to convert
|
||||
*/
|
||||
public ClearDim(String d, ZZSpace s) {
|
||||
dim = d;
|
||||
space = s;
|
||||
}
|
||||
|
||||
/** Performs the actual transformation. All connections along the
|
||||
* dimension are simply disconnected.
|
||||
*/
|
||||
public void transform() {
|
||||
Enumeration e=space.cells();
|
||||
ZZCell c, n;
|
||||
while(e.hasMoreElements()) {
|
||||
c = (ZZCell)e.nextElement();
|
||||
if(c.s(dim, 1)!=null) {
|
||||
c.disconnect(dim, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
CopyDim.java
|
||||
*
|
||||
* 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 Tuukka Hastrup
|
||||
*/
|
||||
package org.gzigzag.transform;
|
||||
import java.util.*;
|
||||
import org.gzigzag.*;
|
||||
|
||||
/** ZZspace dimension copier - duplicate connections of a dimension into
|
||||
* another dimension
|
||||
*/
|
||||
|
||||
public class CopyDim {
|
||||
String rcsid = "$Id: CopyDim.java,v 1.4 2000/10/18 14:35:32 tjl Exp $";
|
||||
String olddim, newdim;
|
||||
ZZSpace space;
|
||||
/** Constructs dimension changer for a space
|
||||
* @param od The old dimension
|
||||
* @param nd The new dimension
|
||||
* @param s The space to convert
|
||||
*/
|
||||
public CopyDim(String od, String nd, ZZSpace s) {
|
||||
olddim = od;
|
||||
newdim = nd;
|
||||
space = s;
|
||||
}
|
||||
|
||||
/** Performs the actual transformation. All connections along the old
|
||||
* dimension are recreated along the new dimensions.
|
||||
*/
|
||||
public void transform() {
|
||||
Enumeration e=space.cells();
|
||||
ZZCell c, n;
|
||||
while(e.hasMoreElements()) {
|
||||
c = (ZZCell)e.nextElement();
|
||||
n = c.s(olddim, 1);
|
||||
if(n!=null) {
|
||||
c.connect(newdim, 1, n);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
FoldDim.java
|
||||
*
|
||||
* 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 Benjamin Fallenstein
|
||||
* (Borrowing heavily from ReverseDim.java by Tuukka Hastrup)
|
||||
*/
|
||||
package org.gzigzag.transform;
|
||||
import java.util.*;
|
||||
import org.gzigzag.*;
|
||||
|
||||
/** "Fold" a dimension into two new ones
|
||||
* Take one start and two result dimensions. Target dim
|
||||
*/
|
||||
|
||||
public class FoldDim {
|
||||
String rcsid = "$Id: FoldDim.java,v 1.4 2000/10/18 14:35:32 tjl Exp $";
|
||||
public static final boolean dbg = false;
|
||||
void p(String s) { if (dbg) System.out.println(s); }
|
||||
void pa(String s) { System.out.println(s); }
|
||||
|
||||
String dim, hdim; // Headcell dim
|
||||
ZZSpace space;
|
||||
|
||||
public FoldDim(String d, String h, ZZSpace s) {
|
||||
dim=d; hdim=h; space=s;
|
||||
}
|
||||
|
||||
public void transform() {
|
||||
Enumeration e=space.cells();
|
||||
ZZCell c;
|
||||
Hashtable donecells = new Hashtable(); // Cells on the folded ranks
|
||||
while(e.hasMoreElements()) { // Do ranks
|
||||
c = (ZZCell)e.nextElement();
|
||||
if(c.s(dim, -1)==null) {
|
||||
if (c.s(dim, 1)!=null) {
|
||||
if(!donecells.containsKey(c)) {
|
||||
ZZCell next = c.s(dim, 1);
|
||||
c.disconnect(dim, 1); c.connect(hdim, 1, next);
|
||||
donecells.put(c, c);
|
||||
for(; next != null; next=next.s(dim, 1))
|
||||
donecells.put(next, next);
|
||||
p("Folded rank beginning from cell #"+c.getID());
|
||||
}
|
||||
else
|
||||
p("Rank beginning from cell #"+c.getID()+" already done");
|
||||
}
|
||||
else
|
||||
p("Cell #"+c.getID()+" not placed on "+dim);
|
||||
donecells.put(c, c); // This cell is not in loop
|
||||
} // Negwards connected cells will be done later
|
||||
}
|
||||
e = space.cells();
|
||||
while(e.hasMoreElements()) { // Detect loops
|
||||
c = (ZZCell)e.nextElement();
|
||||
if(!donecells.containsKey(c)) { // If it wasn't rank, then it's loop
|
||||
pa("FoldDim couldn't convert cell on loop, #"+c.getID()+
|
||||
", '"+c.getText()+"'");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
ReverseDim.java
|
||||
*
|
||||
* 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 Tuukka Hastrup
|
||||
*/
|
||||
package org.gzigzag.transform;
|
||||
import java.util.*;
|
||||
import org.gzigzag.*;
|
||||
|
||||
/** ZZspace dimension changer - reverse positive and negative directions.
|
||||
*/
|
||||
|
||||
public class ReverseDim {
|
||||
String rcsid = "$Id: ReverseDim.java,v 1.6 2000/10/18 14:35:32 tjl Exp $";
|
||||
public static final boolean dbg = false;
|
||||
void p(String s) { if (dbg) System.out.println(s); }
|
||||
String dim;
|
||||
ZZSpace space;
|
||||
/** Constructs direction changer for a dimension in a space
|
||||
* @param d The dimension
|
||||
* @param s The space to convert
|
||||
*/
|
||||
public ReverseDim(String d, ZZSpace s) {
|
||||
dim = d;
|
||||
space = s;
|
||||
}
|
||||
|
||||
/** Performs the actual transformation. All connections along the dimension
|
||||
* are disconnected and new ones connected in reverse direction.
|
||||
*/
|
||||
public void transform() {
|
||||
Enumeration e=space.cells();
|
||||
ZZCell c;
|
||||
Hashtable donecells = new Hashtable(); // Cells on the reversed ranks
|
||||
while(e.hasMoreElements()) { // Do ranks
|
||||
c = (ZZCell)e.nextElement();
|
||||
if(c.s(dim, -1)==null) {
|
||||
if (c.s(dim, 1)!=null) {
|
||||
if(!donecells.containsKey(c)) {
|
||||
swapRank(c, donecells);
|
||||
p("Swapped rank beginning from cell #"+c.getID());
|
||||
}
|
||||
else
|
||||
p("Rank beginning from cell #"+c.getID()+" already done");
|
||||
}
|
||||
else
|
||||
p("Cell #"+c.getID()+" not placed on "+dim);
|
||||
donecells.put(c, c); // This cell is not in loop
|
||||
} // Negwards connected cells will be done later
|
||||
}
|
||||
e = space.cells();
|
||||
while(e.hasMoreElements()) { // Do loops
|
||||
c = (ZZCell)e.nextElement();
|
||||
if(!donecells.containsKey(c)) { // If it wasn't rank, then it's loop
|
||||
c.disconnect(dim, -1); // Cut into a rank
|
||||
c.connect(dim, 1, swapRank(c, donecells)); // Flip and join
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Swap the cells in a rank. Return the new headcell.
|
||||
protected ZZCell swapRank(ZZCell head, Hashtable done)
|
||||
{
|
||||
ZZCell newrank = head; // The latest cell in the new rank
|
||||
ZZCell curr = head.s(dim, 1); // The head of the old one
|
||||
head.disconnect(dim, 1);
|
||||
ZZCell next;
|
||||
while (curr != null) {
|
||||
next = curr.s(dim, 1);
|
||||
if(next!=null) {
|
||||
curr.disconnect(dim, 1);
|
||||
}
|
||||
curr.connect(dim, 1, newrank);
|
||||
done.put(curr, curr);
|
||||
newrank = curr;
|
||||
curr = next;
|
||||
};
|
||||
return newrank;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
Version0.java
|
||||
*
|
||||
* 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 Tuukka Hastrup
|
||||
*/
|
||||
package org.gzigzag.transform;
|
||||
import java.util.*;
|
||||
import org.gzigzag.*;
|
||||
|
||||
/** ZZspace version changer - from version 0 to version 1.
|
||||
*/
|
||||
|
||||
public class Version0 implements VersionChanger {
|
||||
String rcsid = "$Id: Version0.java,v 1.7 2000/10/18 14:35:32 tjl Exp $";
|
||||
static public final void pa(String s) { System.out.println(s); }
|
||||
static public final void pan(String s) { System.out.print(s); }
|
||||
/** Change the space from version 0 to version 1 to make it compatible:
|
||||
* <ul>
|
||||
* <li> d.mycursor is renamed to d.cursor-cargo
|
||||
* <li> d.cursor-cargo and d.cursor directions are reversed
|
||||
* <li> System cell "FlobCanvasRasters" is renamed as "FlobRasters"
|
||||
* </ul>
|
||||
* Note that flobs will not work before a new client space is created
|
||||
* with command line options <b>new</b> and <b>dcold</b>.
|
||||
* @param s The space to convert
|
||||
*/
|
||||
public int changeVersion(ZZSpace s) {
|
||||
pa("Converting from version 0 to version 1:");
|
||||
pa("Cursor dimensions rearranged for consistency.");
|
||||
pan("Changing d.mycursor connections to d.cursor-cargo:");
|
||||
(new ChangeDim("d.mycursor", "d.cursor-cargo", s)).transform();
|
||||
pa(" Name changed.");
|
||||
pan("Reversing connections along d.cursor and d.cursor-cargo:");
|
||||
(new ReverseDim("d.cursor", s)).transform();
|
||||
(new ReverseDim("d.cursor-cargo", s)).transform();
|
||||
pa(" Headcell (negend) now accursed.");
|
||||
pa("The new flob code won't work unless you create "
|
||||
+ "new client space (options -new and -dcold).");
|
||||
pa("Changing the system cell \"FlobCanvasRasters\" "
|
||||
+ "to \"Flobrasters\" to respect code changes.");
|
||||
ZZCell frasters = s.getHomeCell()
|
||||
.findText("d.2", 1, "FlobCanvasRasters");
|
||||
if(frasters != null) {
|
||||
frasters.setText("FlobRasters");
|
||||
frasters.disconnect("d.1", 1);
|
||||
frasters.N("d.1", 1).setText("dummy");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
Version0.java
|
||||
*
|
||||
* 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 Benjamin Fallenstein
|
||||
*/
|
||||
package org.gzigzag.transform;
|
||||
import java.util.*;
|
||||
import org.gzigzag.*;
|
||||
|
||||
/** ZZspace version changer - from version 1 to version 2.
|
||||
*/
|
||||
|
||||
public class Version1 implements VersionChanger {
|
||||
String rcsid = "$Id: Version1.java,v 1.3 2000/09/19 10:32:01 ajk Exp $";
|
||||
static public final void pa(String s) { System.out.println(s); }
|
||||
static public final void pan(String s) { System.out.print(s); }
|
||||
/** Change the space from version 1 to version 2 to make it compatible.
|
||||
* Change to 3-dimension cursing system, allowing every cell to be accursed:
|
||||
* <ol>
|
||||
* <li> fold d.cursor's headcells onto TMPDIM
|
||||
* <li> change d.cursor to d.cursor-list
|
||||
* <li> change TMPDIM to d.cursor
|
||||
* </ol>
|
||||
* @param s The space to convert
|
||||
*/
|
||||
public int changeVersion(ZZSpace s) {
|
||||
pa("Converting from version 1 to version 2:");
|
||||
pa("Change to 3-dimension cursing system.");
|
||||
pan("Folding d.cursor's headcells to TMPDIM... ");
|
||||
(new FoldDim("d.cursor", "TMPDIM", s)).transform();
|
||||
pa("done.");
|
||||
pan("Renaming to d.cursor and d.cursor-list... ");
|
||||
(new ChangeDim("d.cursor", "d.cursor-list", s)).transform();
|
||||
pan("d.cursor-list done... ");
|
||||
(new ChangeDim("TMPDIM", "d.cursor", s)).transform();
|
||||
pa(" d.cursor done.");
|
||||
pa("Converted to version 2.");
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
Version2.java
|
||||
*
|
||||
* 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 Tuomas Lukka
|
||||
*/
|
||||
package org.gzigzag.transform;
|
||||
import java.util.*;
|
||||
import org.gzigzag.*;
|
||||
|
||||
/** ZZspace version changer - from version 2 to version 3.
|
||||
* The change in the structure is that now rasters have names,
|
||||
* and rasters are called views.
|
||||
*/
|
||||
|
||||
public class Version2 implements VersionChanger {
|
||||
String rcsid = "$Id: Version2.java,v 1.3 2000/09/19 10:32:01 ajk Exp $";
|
||||
static public final void pa(String s) { System.out.println(s); }
|
||||
static public final void pan(String s) { System.out.print(s); }
|
||||
/** Change the space from version 2 to version 3 to make it compatible.
|
||||
* Simply recreates the system part of the space, since we now use names for views.
|
||||
*/
|
||||
public int changeVersion(ZZSpace s) {
|
||||
pa("Converting from version 2 to version 3:");
|
||||
pa("Recreating system space (not disconnecting old)");
|
||||
ZZDefaultSpace.create(s.getHomeCell(), false);
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
VersionChanger.java
|
||||
*
|
||||
* 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 Tuukka Hastrup
|
||||
*/
|
||||
package org.gzigzag.transform;
|
||||
import java.util.*;
|
||||
import org.gzigzag.*;
|
||||
|
||||
/** A general interface for changing ZZspaces between versions.
|
||||
*/
|
||||
public interface VersionChanger {
|
||||
String rcsid = "$Id: VersionChanger.java,v 1.4 2000/09/19 10:32:01 ajk Exp $";
|
||||
/** Takes the space which conforms to client space version of the
|
||||
* converter class. Needed transformations are then carried out
|
||||
* to make the space conform to a newer version returned.
|
||||
* @param s The space to convert
|
||||
* @return The new version of the space
|
||||
*/
|
||||
int changeVersion(ZZSpace s);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user