[15771] | 1 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; |
---|
| 2 | |
---|
| 3 | namespace HeuristicLab.Problems.ProgramSynthesis { |
---|
[14952] | 4 | /// <summary>
|
---|
| 5 | /// Tells whether that stack is empty.
|
---|
| 6 | /// </summary>
|
---|
| 7 | [StorableClass]
|
---|
[15344] | 8 | public abstract class EmptyExpression : StatelessExpression {
|
---|
[14952] | 9 | protected EmptyExpression() { }
|
---|
| 10 | [StorableConstructor]
|
---|
| 11 | protected EmptyExpression(bool deserializing) : base(deserializing) { }
|
---|
| 12 |
|
---|
| 13 | public override bool IsNoop(IInternalPushInterpreter interpreter) {
|
---|
| 14 | return false;
|
---|
| 15 | }
|
---|
| 16 |
|
---|
[15344] | 17 | public void Eval(IPushStack stack, IPushStack<bool> booleanStack) {
|
---|
[14952] | 18 | booleanStack.Push(stack.IsEmpty);
|
---|
| 19 | }
|
---|
| 20 | }
|
---|
| 21 |
|
---|
| 22 | [StorableClass]
|
---|
[15032] | 23 | [PushExpression(
|
---|
| 24 | StackTypes.Exec,
|
---|
| 25 | "EXEC.EMPTY",
|
---|
| 26 | "Pushes TRUE onto the BOOLEAN stack if the EXEC stack is empty, otherwise FALSE.",
|
---|
| 27 | StackTypes.Boolean)]
|
---|
[15344] | 28 | public class ExecEmptyExpression : EmptyExpression {
|
---|
[14952] | 29 | public ExecEmptyExpression() { }
|
---|
| 30 | [StorableConstructor]
|
---|
| 31 | protected ExecEmptyExpression(bool deserializing) : base(deserializing) { }
|
---|
| 32 |
|
---|
| 33 | public override void Eval(IInternalPushInterpreter interpreter) {
|
---|
| 34 | Eval(interpreter.ExecStack, interpreter.BooleanStack);
|
---|
| 35 | }
|
---|
| 36 | }
|
---|
| 37 |
|
---|
| 38 | [StorableClass]
|
---|
[15032] | 39 | [PushExpression(
|
---|
| 40 | StackTypes.Code,
|
---|
| 41 | "CODE.EMPTY",
|
---|
| 42 | "Pushes TRUE onto the BOOLEAN stack if the CODE stack is empty, otherwise FALSE.",
|
---|
| 43 | StackTypes.Boolean)]
|
---|
[15344] | 44 | public class CodeEmptyExpression : EmptyExpression {
|
---|
[14952] | 45 | public CodeEmptyExpression() { }
|
---|
| 46 | [StorableConstructor]
|
---|
| 47 | protected CodeEmptyExpression(bool deserializing) : base(deserializing) { }
|
---|
| 48 | public override void Eval(IInternalPushInterpreter interpreter) {
|
---|
| 49 | Eval(interpreter.CodeStack, interpreter.BooleanStack);
|
---|
| 50 | }
|
---|
| 51 | }
|
---|
| 52 |
|
---|
| 53 | [StorableClass]
|
---|
[15032] | 54 | [PushExpression(
|
---|
| 55 | StackTypes.Integer,
|
---|
| 56 | "INTEGER.EMPTY",
|
---|
| 57 | "Pushes TRUE onto the BOOLEAN stack if the INTEGER stack is empty, otherwise FALSE.",
|
---|
| 58 | StackTypes.Boolean)]
|
---|
[15344] | 59 | public class IntegerEmptyExpression : EmptyExpression {
|
---|
[14952] | 60 | public IntegerEmptyExpression() { }
|
---|
| 61 | [StorableConstructor]
|
---|
| 62 | protected IntegerEmptyExpression(bool deserializing) : base(deserializing) { }
|
---|
| 63 | public override void Eval(IInternalPushInterpreter interpreter) {
|
---|
| 64 | Eval(interpreter.IntegerStack, interpreter.BooleanStack);
|
---|
| 65 | }
|
---|
| 66 | }
|
---|
| 67 |
|
---|
[15334] | 68 | [StorableClass]
|
---|
[15032] | 69 | [PushExpression(
|
---|
| 70 | StackTypes.Float,
|
---|
| 71 | "FLOAT.EMPTY", "Pushes TRUE onto the BOOLEAN stack if the FLOAT stack is empty, otherwise FALSE.",
|
---|
| 72 | StackTypes.Boolean)]
|
---|
[15344] | 73 | public class FloatEmptyExpression : EmptyExpression {
|
---|
[14952] | 74 | public FloatEmptyExpression() { }
|
---|
| 75 | [StorableConstructor]
|
---|
| 76 | protected FloatEmptyExpression(bool deserializing) : base(deserializing) { }
|
---|
| 77 | public override void Eval(IInternalPushInterpreter interpreter) {
|
---|
| 78 | Eval(interpreter.FloatStack, interpreter.BooleanStack);
|
---|
| 79 | }
|
---|
| 80 | }
|
---|
| 81 |
|
---|
[15334] | 82 | [StorableClass]
|
---|
[15032] | 83 | [PushExpression(
|
---|
| 84 | StackTypes.Boolean,
|
---|
| 85 | "BOOLEAN.EMPTY",
|
---|
[15334] | 86 | "Pushes TRUE onto the BOOLEAN stack if the BOOLEAN stack is empty, otherwise FALSE.")]
|
---|
[15344] | 87 | public class BooleanEmptyExpression : EmptyExpression {
|
---|
[14952] | 88 | public BooleanEmptyExpression() { }
|
---|
| 89 | [StorableConstructor]
|
---|
| 90 | protected BooleanEmptyExpression(bool deserializing) : base(deserializing) { }
|
---|
| 91 | public override void Eval(IInternalPushInterpreter interpreter) {
|
---|
| 92 | Eval(interpreter.BooleanStack, interpreter.BooleanStack);
|
---|
| 93 | }
|
---|
| 94 | }
|
---|
| 95 |
|
---|
[15334] | 96 | [StorableClass]
|
---|
[15032] | 97 | [PushExpression(
|
---|
| 98 | StackTypes.Char,
|
---|
| 99 | "CHAR.EMPTY",
|
---|
| 100 | "Pushes TRUE onto the BOOLEAN stack if the CHAR stack is empty, otherwise FALSE.",
|
---|
| 101 | StackTypes.Boolean)]
|
---|
[15344] | 102 | public class CharEmptyExpression : EmptyExpression {
|
---|
[14952] | 103 | public CharEmptyExpression() { }
|
---|
| 104 | [StorableConstructor]
|
---|
| 105 | protected CharEmptyExpression(bool deserializing) : base(deserializing) { }
|
---|
| 106 | public override void Eval(IInternalPushInterpreter interpreter) {
|
---|
| 107 | Eval(interpreter.CharStack, interpreter.BooleanStack);
|
---|
| 108 | }
|
---|
| 109 | }
|
---|
| 110 |
|
---|
[15334] | 111 | [StorableClass]
|
---|
[15032] | 112 | [PushExpression(
|
---|
| 113 | StackTypes.String,
|
---|
| 114 | "STRING.EMPTY",
|
---|
| 115 | "Pushes TRUE onto the BOOLEAN stack if the STRING stack is empty, otherwise FALSE.",
|
---|
| 116 | StackTypes.Boolean)]
|
---|
[15344] | 117 | public class StringEmptyExpression : EmptyExpression {
|
---|
[14952] | 118 | public StringEmptyExpression() { }
|
---|
| 119 | [StorableConstructor]
|
---|
| 120 | protected StringEmptyExpression(bool deserializing) : base(deserializing) { }
|
---|
| 121 | public override void Eval(IInternalPushInterpreter interpreter) {
|
---|
| 122 | Eval(interpreter.StringStack, interpreter.BooleanStack);
|
---|
| 123 | }
|
---|
| 124 | }
|
---|
| 125 |
|
---|
[15334] | 126 | [StorableClass]
|
---|
[15032] | 127 | [PushExpression(
|
---|
| 128 | StackTypes.IntegerVector,
|
---|
| 129 | "INTEGER[].EMPTY",
|
---|
| 130 | "Pushes TRUE onto the BOOLEAN stack if the INTEGER[] stack is empty, otherwise FALSE.",
|
---|
| 131 | StackTypes.Boolean)]
|
---|
[15344] | 132 | public class IntegerVectorEmptyExpression : EmptyExpression {
|
---|
[14952] | 133 | public IntegerVectorEmptyExpression() { }
|
---|
| 134 | [StorableConstructor]
|
---|
| 135 | protected IntegerVectorEmptyExpression(bool deserializing) : base(deserializing) { }
|
---|
| 136 | public override void Eval(IInternalPushInterpreter interpreter) {
|
---|
| 137 | Eval(interpreter.IntegerVectorStack, interpreter.BooleanStack);
|
---|
| 138 | }
|
---|
| 139 | }
|
---|
| 140 |
|
---|
[15334] | 141 | [StorableClass]
|
---|
[15032] | 142 | [PushExpression(
|
---|
| 143 | StackTypes.FloatVector,
|
---|
| 144 | "FLOAT[].EMPTY",
|
---|
| 145 | "Pushes TRUE onto the BOOLEAN stack if the FLOAT[] stack is empty, otherwise FALSE.",
|
---|
| 146 | StackTypes.Boolean)]
|
---|
[15344] | 147 | public class FloatVectorEmptyExpression : EmptyExpression {
|
---|
[14952] | 148 | public FloatVectorEmptyExpression() { }
|
---|
| 149 | [StorableConstructor]
|
---|
| 150 | protected FloatVectorEmptyExpression(bool deserializing) : base(deserializing) { }
|
---|
| 151 | public override void Eval(IInternalPushInterpreter interpreter) {
|
---|
| 152 | Eval(interpreter.FloatVectorStack, interpreter.BooleanStack);
|
---|
| 153 | }
|
---|
| 154 | }
|
---|
| 155 |
|
---|
[15334] | 156 | [StorableClass]
|
---|
[15032] | 157 | [PushExpression(
|
---|
| 158 | StackTypes.BooleanVector,
|
---|
| 159 | "BOOLEAN[].EMPTY",
|
---|
| 160 | "Pushes TRUE onto the BOOLEAN stack if the BOOLEAN[] stack is empty, otherwise FALSE.",
|
---|
| 161 | StackTypes.Boolean)]
|
---|
[15344] | 162 | public class BooleanVectorEmptyExpression : EmptyExpression {
|
---|
[14952] | 163 | public BooleanVectorEmptyExpression() { }
|
---|
| 164 | [StorableConstructor]
|
---|
| 165 | protected BooleanVectorEmptyExpression(bool deserializing) : base(deserializing) { }
|
---|
| 166 | public override void Eval(IInternalPushInterpreter interpreter) {
|
---|
| 167 | Eval(interpreter.BooleanVectorStack, interpreter.BooleanStack);
|
---|
| 168 | }
|
---|
| 169 | }
|
---|
| 170 |
|
---|
[15334] | 171 | [StorableClass]
|
---|
[15032] | 172 | [PushExpression(
|
---|
| 173 | StackTypes.StringVector,
|
---|
| 174 | "STRING[].EMPTY",
|
---|
| 175 | "Pushes TRUE onto the BOOLEAN stack if the STRING[] stack is empty, otherwise FALSE.",
|
---|
| 176 | StackTypes.Boolean)]
|
---|
[15344] | 177 | public class StringVectorEmptyExpression : EmptyExpression {
|
---|
[14952] | 178 | public StringVectorEmptyExpression() { }
|
---|
| 179 | [StorableConstructor]
|
---|
| 180 | protected StringVectorEmptyExpression(bool deserializing) : base(deserializing) { }
|
---|
| 181 | public override void Eval(IInternalPushInterpreter interpreter) {
|
---|
| 182 | Eval(interpreter.StringVectorStack, interpreter.BooleanStack);
|
---|
| 183 | }
|
---|
| 184 | }
|
---|
[15344] | 185 |
|
---|
| 186 | [StorableClass]
|
---|
| 187 | [PushExpression(
|
---|
| 188 | StackTypes.Print,
|
---|
| 189 | "PRINT.EMPTY",
|
---|
| 190 | "Pushes TRUE onto the BOOLEAN stack if the PRINT stack is empty, otherwise FALSE.",
|
---|
| 191 | StackTypes.Boolean)]
|
---|
| 192 | public class PrintEmptyExpression : EmptyExpression {
|
---|
| 193 | public PrintEmptyExpression() { }
|
---|
| 194 | [StorableConstructor]
|
---|
| 195 | protected PrintEmptyExpression(bool deserializing) : base(deserializing) { }
|
---|
| 196 | public override void Eval(IInternalPushInterpreter interpreter) {
|
---|
| 197 | Eval(interpreter.PrintStack, interpreter.BooleanStack);
|
---|
| 198 | }
|
---|
| 199 | }
|
---|
[14952] | 200 | }
|
---|