Trivial Prolog in Java

01: package ca.draisey.free.tprolog;
02:
03:
04:
05:
06: // unused but logical organization:
07: //      a table of dyads
08: //      requires 1 + numberofVariables objects to be constructed
09: // used and efficient organization
10: //      a dyad of tables
11: //      requires 3 objects to be constructed
12: final class Variables {
13:         Variables( int numberofVariables )
14:         {
15:                 ruleBindings = new Term[ numberofVariables ];
16:                 instanceBindings = new Variables[ numberofVariables ];
17:         }
18:         Term[] ruleBindings;            // table of references to the rule
19:         Variables[] instanceBindings;   // table of references to the table
20: }
21:
22: // fin