Gem-graph/archéologie

242 lines
14 KiB
Plaintext

Ce document, récemment découvert, est en cours d'investigation.
Dans l'état actuel des recherches, il apparait déjà qu'il pourrait s'agir d'une écriture jusqu'ici inconnue.
Le fragment qui nous est parvenu comporte plus de 10000 caractères distincts et semble organisé en lignes dont le sens de lecture reste incertain.
L'hypothèse d'un texte sacré s'appuie sur la répétition de certains caractères (ex: ';') qui pourraient indiquer le début ou la fin d'incantations répétées (?)
L'hypothèse (fragile) d'un texte informatique a été émise après identification de quelques éléments 'for' ( ref: ) qui pourraient être des formes d'itérations primitives mais aucune structuration de l'ensemble n'a, jusqu'ici, pu être décelée.
La datation est en cours.
package state;
import static java.lang.System.out;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import init_close.XML_Model_Reader;
import objects.ObjectsManagerAccess;
import session.AutomatonType;
public class StateManager {
public static DIMENSION space_dimension; // {ONE, TWO, THREE, ANY} < assigned by XML_Header_RW
public static PAVAGE pavage; // {SEGMENTS, SQUARES, HEXAGONS, CUBES, TETRAHEDRONS, ERROR}
// In this constructor, X, Y and Z, the space_dimension, number_of_sites_in_a_cell, the size of the array quiver and other parameters are assigned by XML_Header_RW.
public StateManager (final Node parameters, final Node initial_state, final Node final_state, final Node space_view_presentation) {
// The parameters describing the space size and borders are treated here and only here @see also Memory Manager
StateManager.setSpaceDimensionAndSize (
Integer.parseInt (parameters.getAttributes().getNamedItem("X").getNodeValue()),
Integer.parseInt (parameters.getAttributes().getNamedItem("Y").getNodeValue()),
Integer.parseInt (parameters.getAttributes().getNamedItem("Z").getNodeValue()),
AutomatonType.getNumberOfsitesPerCell()
);
StateManager.setSpacePavage (parameters.getAttributes().getNamedItem("pavage").getNodeValue());
StateManager.setSpaceBorders (
Boolean.parseBoolean(parameters.getAttributes().getNamedItem("XO").getNodeValue()),
Boolean.parseBoolean(parameters.getAttributes().getNamedItem("OX").getNodeValue()),
Boolean.parseBoolean(parameters.getAttributes().getNamedItem("YO").getNodeValue()),
Boolean.parseBoolean(parameters.getAttributes().getNamedItem("OY").getNodeValue()),
Boolean.parseBoolean(parameters.getAttributes().getNamedItem("ZO").getNodeValue()),
Boolean.parseBoolean(parameters.getAttributes().getNamedItem("OZ").getNodeValue())
);
final NodeList particlesList = initial_state.getChildNodes();
StateManager.particles_nb = particlesList.getLength() / 2; // The number of nodes in the XML tree is twice the number of data as each end of line is a node _ out.println("StateManager particles_nb="+particles_nb);
cells_ref = new int [particles_nb];
level_II = new OneObjectInSpace [particles_nb];
// The size of the array [occupied] is equal to the particles number.
// It is impossible to know the position of a "particle" in [sites] knowing its position in [occupied]. This is why there is an array [cells]
// ! WARNING ! ObjectsManager must have been created before the next instruction
// ! WARNING ! If several particles occupy the same location, the previous ones will be totally or partially overwritten
for (int k = 0; k < particlesList.getLength(); k++)
if (particlesList.item(k).getNodeType() == Node.ELEMENT_NODE && particlesList.item(k).getNodeName().equals("particle")) {
final Node particle = particlesList.item(k);
switch(StateManager.space_dimension) {
case ONE :StateManager.setParticle1DSg(
k / 2,
particle.getAttributes().getNamedItem("arrows").getNodeValue(),
particle.getAttributes().getNamedItem("name") .getNodeValue().trim(),
Integer.parseInt(particle.getAttributes().getNamedItem("x") .getNodeValue())); break;
case TWO :StateManager.setParticle2DHx(
k / 2,
particle.getAttributes().getNamedItem("arrows").getNodeValue(),
particle.getAttributes().getNamedItem("name") .getNodeValue().trim(),
Integer.parseInt(particle.getAttributes().getNamedItem("x") .getNodeValue()),
Integer.parseInt(particle.getAttributes().getNamedItem("y") .getNodeValue())); break;
case THREE :StateManager.setParticle3DCu(
k / 2,
particle.getAttributes().getNamedItem("arrows").getNodeValue(),
particle.getAttributes().getNamedItem("name") .getNodeValue().trim(),
Integer.parseInt(particle.getAttributes().getNamedItem("x") .getNodeValue()),
Integer.parseInt(particle.getAttributes().getNamedItem("y") .getNodeValue()),
Integer.parseInt(particle.getAttributes().getNamedItem("z") .getNodeValue())); break;
default:;
} // end switch(StateManager.space_dimension)
}
StateManagerLook.unit_space_size = Integer.parseInt (space_view_presentation.getAttributes().getNamedItem("space_unit_size").getNodeValue());
StateManagerLook.scaleFactor = Integer.parseInt (space_view_presentation.getAttributes().getNamedItem("scale_factor") .getNodeValue());
StateManagerLook.appearance = SPACE_LOOK.valueOf(space_view_presentation.getAttributes().getNamedItem("appearance") .getNodeValue());
if (XML_Model_Reader.comment_IdentityManager_init_model) out.println("from XML_Header_RW to ViewsManager.setPresentation size = " + StateManagerLook.unit_space_size +" APPEARANCE."+ StateManagerLook.appearance);
if (comment_on_sites_state) switch(StateManager.space_dimension) {
case ONE : StateManagerTest_V0.quiver_D1Sg(); break;
case TWO: StateManagerTest_V0.quiver_D2Hx(); break;
case THREE: StateManagerTest_V0.quiver_D3Cu(0); break;
default:;}
}
public StateManager () {} // Needed by LocalStateManager which extends StateManager
private static final void setSpaceDimensionAndSize (final int X, final int Y, final int Z, final int number_of_sites_in_a_cell) {
// TODO out.println("StateManager.setDimensionsSizeAndQiversArray coherence constraints : space must be big enough to allow particles to get their place");
StateManager.X = X;
StateManager.Y = Y;
StateManager.Z = Z;
StateManager.number_of_sites_in_a_cell = number_of_sites_in_a_cell; // number_of_sites != number_of_arrows
if (Z > 0 & Y > 0 & X > 0 & number_of_sites_in_a_cell > 0) {
space_dimension = DIMENSION.THREE;
sites = new int [X * Y * Z * number_of_sites_in_a_cell]; for (int i=0; i < X * Y * Z * number_of_sites_in_a_cell; i++) sites[i] = 0;
cells = new int [X * Y * Z]; for (int i=0; i < X * Y * Z; i++) cells[i] = -1;
} else if (Z == 0 & Y > 0 & X > 0 & number_of_sites_in_a_cell > 0) {
space_dimension = DIMENSION.TWO; // independent of the pavement
sites = new int [X * Y * number_of_sites_in_a_cell]; for (int i=0; i < X * Y * number_of_sites_in_a_cell; i++) sites[i] = 0;
cells = new int [X * Y]; for (int i=0; i < X * Y; i++) cells[i] = -1;
} else if (Z == 0 & Y == 0 & X > 0 & number_of_sites_in_a_cell > 0) {
space_dimension = DIMENSION.ONE;
sites = new int [X * number_of_sites_in_a_cell]; for (int i=0; i < X * number_of_sites_in_a_cell; i++) sites[i] = 0;
cells = new int [X]; for (int i=0; i < X; i++) cells[i] = -1;
} else {
out.println("StateManager.space_dimension = Parameters.DIMENSION.ANY ! WARNING !");
}
}
private static final void setSpaceBorders (final boolean XO, final boolean OX, final boolean YO, final boolean OY, final boolean ZO, final boolean OZ) {
StateManager.XO = XO;
StateManager.OX = OX;
StateManager.YO = YO;
StateManager.OY = OY;
StateManager.ZO = ZO;
StateManager.OZ = OZ;
StateManager.borders = (XO | OX | YO | OY | ZO | OZ); // TODO Each border (X, Y, Z) can be true or false > 2³ = 8 possibilities As a first approximation : [borders = false]
if (XML_Model_Reader.comment_IdentityManager_init_model)
out.println("from XML_Model_RW to StateManager.setParameters(...) X = " + X + " Y = " + Y + " Z = " + Z + " borders = [" + (XO ? "+" : "-") + (YO ? "+" : "-") + (ZO ? "+" : "-") + "] "+ borders);
}
private static final void setSpacePavage (final String name) {
switch (name) {
case "SEGMENTS" : pavage = PAVAGE.SEGMENTS; break;
case "SQUARES" : pavage = PAVAGE.SQUARES; break;
case "HEXAGONS" : pavage = PAVAGE.HEXAGONS; break;
case "CUBES" : pavage = PAVAGE.CUBES; break;
case "TETRAHEDRONS" : pavage = PAVAGE.TETRAHEDRONS; break;
default: pavage = PAVAGE.ERROR;
}
}
protected static final int get1D (final int x) {return ( x) * number_of_sites_in_a_cell;}
protected static final int get2D (final int x, final int y) {return ( X * y + x) * number_of_sites_in_a_cell;}
protected static final int get3D (final int x, final int y, final int z) {return (Y * X * z + X * y + x) * number_of_sites_in_a_cell;}
private static final void setParticle1DSg (final int key, final String arrows, final String name, int x) {
// TODO assert x * 2 + code % 2 < state_size_1D * 2
x = (x + X) % X;
int E = Integer.parseInt(arrows.substring(1, 2)); sites [get1D (x) + 0] = E;
int W = Integer.parseInt(arrows.substring(3, 4)); sites [get1D (x) + 1] = W;
cells_ref [ key ] = x; // x = get1D (x) / number_of_sites_in_a_cell;
cells [ x ] = key;
level_II [ key ] = new OneObjectInSpace(ObjectsManagerAccess.getOneObjectFromName(name), x, -1, -1);
if (XML_Model_Reader.comment_IdentityManager_init_model) StateManagerTest_V0.particle_1DSg(key, E, W, name, x);
}
public static final String get_EW_from_01 (final int d) { // 2020 This method should stay here in order to compare easily the association Integer / String with its inverse
switch (d){
case 0: return "E";
case 1: return "W";
default: return "Err="+ Integer.toString(d);
}
}
private static final void setParticle2DHx (final int key, final String arrows, final String name, int x, int y) {
x = (x + X) % X;
y = (y + Y) % Y;
int E = Integer.parseInt(arrows.substring( 1, 2)); sites [get2D (x,y) + 0] = E;
int SE = Integer.parseInt(arrows.substring( 3, 4)); sites [get2D (x,y) + 1] = SE;
int SW = Integer.parseInt(arrows.substring( 5, 6)); sites [get2D (x,y) + 2] = SW;
int W = Integer.parseInt(arrows.substring( 7, 8)); sites [get2D (x,y) + 3] = W;
int NW = Integer.parseInt(arrows.substring( 9,10)); sites [get2D (x,y) + 4] = NW;
int NE = Integer.parseInt(arrows.substring(11,12)); sites [get2D (x,y) + 5] = NE;
cells_ref [ key ] = get2D (x,y) / number_of_sites_in_a_cell;
cells [ get2D (x,y) / number_of_sites_in_a_cell ] = key;
level_II [ key ] = new OneObjectInSpace(ObjectsManagerAccess.getOneObjectFromName(name), x, y, -1);
if (XML_Model_Reader.comment_IdentityManager_init_model) if (key < 20) StateManagerTest_V0.particle_2DHx (key, E, SE, SW, W, NW, NE, name, x, y );
}
public static final String get_NSEW_from_012345(final int d) { // 2020 This method should stay here in order to compare easily the association Integer / String with its inverse
switch (d){
case 0: return "E";
case 1: return "SE";
case 2: return "SW"; // if (language.equals("francais")) return "SO";
case 3: return "W"; //
case 4: return "NW"; //
case 5: return "NE";
default: return "Err="+ Integer.toString(d);
}
}
public static final String get_NSEW_from_0123 (final int d) { // 2020 This method should stay here in order to compare easily the association Integer / String with its inverse
switch (d){
case 0: return "E";
case 1: return "S";
case 2: return "W"; // TODO if (language.equals("francais")) return "O" ? not sure ...
case 3: return "N"; //
default: return "Err="+ Integer.toString(d);
}
}
private static final void setParticle3DCu (final int key, final String arrows, final String name, int x, int y, int z) {
x = (x + X) % X;
y = (y + Y) % Y;
z = (z + Z) % Z;
int E = Integer.parseInt(arrows.substring( 1, 2)); sites [get3D (x,y,z) + 0] = E;
int W = Integer.parseInt(arrows.substring( 3, 4)); sites [get3D (x,y,z) + 1] = W;
int N = Integer.parseInt(arrows.substring( 5, 6)); sites [get3D (x,y,z) + 2] = N;
int S = Integer.parseInt(arrows.substring( 7, 8)); sites [get3D (x,y,z) + 3] = S;
int Z = Integer.parseInt(arrows.substring( 9,10)); sites [get3D (x,y,z) + 4] = Z;
int A = Integer.parseInt(arrows.substring(11,12)); sites [get3D (x,y,z) + 5] = A;
cells_ref [ key ] = get3D (x,y,z) / number_of_sites_in_a_cell;
cells [ get3D(x,y,z) / number_of_sites_in_a_cell ] = key;
level_II [ key ] = new OneObjectInSpace(ObjectsManagerAccess.getOneObjectFromName(name), x, y, z);
if (XML_Model_Reader.comment_IdentityManager_init_model) StateManagerTest_V0.particle_3DCu (key, E, W, N, S, Z, A, name, x, y, z);
}
public static final String get_NSEWZA_from_012345 (final int d) { // 2020 This method should stay here in order to compare easily the association Integer / String with its inverse
switch (d){
case 0: return "E";
case 1: return "W"; // TODO if (language.equals("francais")) return "O" ? not sure ...
case 2: return "N";
case 3: return "S"; //
case 4: return "Z"; // Zenith
case 5: return "A"; // nAdir and also A is at the opposite of Z in the alphabet
default: return "Err="+ Integer.toString(d);
}
}
public static int X, Y, Z, particles_nb;
public static boolean borders, XO, OX, YO, OY, ZO, OZ;
public static int number_of_sites_in_a_cell;
public static int[] sites; // [ 0.0 0.0 1.0 0.1 0.0 1.0 0.0 ] [ 0.0 1.0 0.0 0.1 0.0 1.0 0.0 ] if 2 x 3
public static int[] cells; // [ - - 0 1 - 2 - ] [ - 0 - 1 - 2 - ] | - - |
public static int[] cells_ref; // [ 2 3 5 ] [ 1 3 5 ] | 0 1 |
public static OneObjectInSpace[] level_II; // [ 2 3 5 ] [ 1 3 5 ] | 2 - |
private static boolean comment_on_sites_state = false;
}