Free cookie consent management tool by TermsFeed Policy Generator

source: branches/OKBJavaConnector/ECJClient/src/ec/app/multiplexer/MultiplexerData.java @ 9449

Last change on this file since 9449 was 6152, checked in by bfarka, 14 years ago

added ecj and custom statistics to communicate with the okb services #1441

File size: 2.8 KB
Line 
1/*
2  Copyright 2006 by Sean Luke
3  Licensed under the Academic Free License version 3.0
4  See the file "LICENSE" for more information
5*/
6
7
8package ec.app.multiplexer;
9import java.util.*;
10import ec.gp.*;
11
12/*
13 * MultiplexerData.java
14 *
15 * Created: Wed Nov  3 18:32:13 1999
16 * By: Sean Luke
17 */
18
19/**
20 * This is ugly and complicated because it needs to hold a variety
21 * of different-length bitstrings, including temporary ones held
22 * while computing subtrees.
23 *
24 * @author Sean Luke
25 * @version 1.0
26 */
27
28public class MultiplexerData extends GPData
29    {
30    /** A stack of available long arrays for popDat11/pushDat11 */
31    public Stack tmp;
32
33    /** The number of Dn in Multiplexer-3 */
34    public static final byte STATUS_3 = 1;
35    /** The number of Dn in Multiplexer-6 */
36    public static final byte STATUS_6 = 2;
37    /** The number of Dn in Multiplexer-11 */
38    public static final byte STATUS_11 = 3;
39    /** The length of an atomic data element in Multiplexer-3 (a byte) */
40    public static final int MULTI_3_BITLENGTH = 8;
41    /** The length of an atomic data element in Multiplexer-6 (a long) */
42    public static final int MULTI_6_BITLENGTH = 64;
43    /** The length of an atomic data element in Multiplexer-11 (a long) */
44    public static final int MULTI_11_BITLENGTH = 64;
45    /** The number of atomic elements in Multiplexer-11 comprising one string (32) */
46    public static final int MULTI_11_NUM_BITSTRINGS = 32;
47
48    /** An array of 32 longs for Multiplexer-11 data */
49    public long[] dat_11;
50    /** A long for Multiplexer-6 data */
51    public long dat_6;
52    /** A byte for Multiplexer-3 data */
53    public byte dat_3;
54    /** A byte indicating the number of Dn in this problem */
55    public byte status;
56
57    /** Pops a dat_11 off of the stack; if the stack is empty, creates a new dat_11 and returns that. */
58    public long[] popDat11()
59        {
60        if (tmp.empty())
61            return new long[MULTI_11_NUM_BITSTRINGS];
62        else return (long[])(tmp.pop());
63        }
64
65    /** Pushes a dat_11 onto the stack */
66    public void pushDat11(long[] l)
67        {
68        tmp.push(l);
69        }
70
71    public MultiplexerData()
72        {
73        dat_11 = new long[MULTI_11_NUM_BITSTRINGS];
74        tmp = new Stack();
75        }
76
77    public Object clone()
78        {
79        MultiplexerData dat = (MultiplexerData)(super.clone());
80        dat.dat_11 = new long[MULTI_11_NUM_BITSTRINGS];
81        System.arraycopy(dat_11,0,dat.dat_11,0,MULTI_11_NUM_BITSTRINGS);
82        dat.tmp = new Stack();
83        return dat;
84        }
85
86    public void copyTo(final GPData gpd)
87        {
88        MultiplexerData md = ((MultiplexerData)gpd);
89        for(int x=0;x<MULTI_11_NUM_BITSTRINGS;x++)
90            md.dat_11[x] = dat_11[x];
91        md.dat_6 = dat_6;
92        md.status = status;
93        }
94    }
Note: See TracBrowser for help on using the repository browser.