MCPcopy Create free account
hub / github.com/Whiley/WhileyCompiler / SectionedSchema

Class SectionedSchema

src/main/java/wycc/util/SectionedSchema.java:31–382  ·  view source on GitHub ↗

Represents a schema which is divided up into named sections, where the intention is that each section represents some grouping of opcodes which has spare capacity that can be filled in subsequent versions. @author David J. Pearce

Source from the content-addressed store, hash-verified

29 *
30 */
31public class SectionedSchema implements Schema {
32 /**
33 * The base schema with version 0.0 which contains nothing. From this, all
34 * schemas derive.
35 */
36 public static final SectionedSchema ROOT = new SectionedSchema(null, 0, 0, new Section[0]);
37
38 private final Schema parent;
39 private final int major;
40 private final int minor;
41 private final Section[] sections;
42 private final Opcode[] opcodes;
43
44 public SectionedSchema(Schema parent, int major, int minor, Section[] sections) {
45 this.parent = parent;
46 this.major = major;
47 this.minor = minor;
48 this.sections = sections;
49 this.opcodes = flattern(sections);
50 }
51
52 @Override
53 public int getMinorVersion() {
54 return minor;
55 }
56
57 @Override
58 public int getMajorVersion() {
59 return major;
60 }
61
62 @Override
63 public Schema getParent() {
64 return parent;
65 }
66
67 /**
68 * Determine number of sections in this schema.
69 *
70 * @return
71 */
72 public int size() {
73 return sections.length;
74 }
75
76 /**
77 * Get the ith section of this schema.
78 *
79 * @param ith
80 * @return
81 */
82 public Section get(int ith) {
83 return sections[ith];
84 }
85
86 /**
87 * Begin an extension of this schema
88 *

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected