import java.util.*; import java.util.regex.*; import static java.lang.Math.*; /** * A RecordOfRecords holds classes for comparing to Ada * * @see http://www.radford.edu/itec320/2018fall-ibarland/Lectures/records-of-records.html * * @author ibarland@radford.edu * @version 2018-Oct-17 * * License: CC Attribution 4.0 International -- you are free to share and adapt * this material for any purpose, provided you include appropriate attribution. * https://creativecommons.org/licenses/by/4.0/ * https://creativecommons.org/licenses/by/4.0/legalcode * Including the source material's URL satisifies "appropriate attribution". */ class NestedRecords { public static void main( String[] __ ) { p = new Point(1,6); q = new Point(7,2); l = new Line(p,q); Line everywhere = new Line( new Point(0,0), new Point(0,0) ); } public static Point p,q; public static Line l, origin; } class Point { int x,y; String name = "goodness gracious!"; Point(int _x, int _y) { this.x = _x; this.y = _y; } public String toString(/* Point this */) { return "new Point("+this.x+", "+this.y+")"; } } class Line { Point start, end; Line( Point _start, Point _end ) { this.start = _start; this.end = _end; } public String toString(/* Line this */) { return "new Line("+this.start.toString()+", "+this.end.toString()+")"; } } class LineList { final int CAPACITY; Line[] lines; int size; void add( /* LineList this, */ Line p ) { this.lines[size] = p; size = size + 1; } LineList( int _CAPACITY ) { this.CAPACITY = _CAPACITY; this.lines = new Line[this.CAPACITY]; this.size = 0; } }