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

Class AbstractType

src/main/java/wyil/lang/WyilFile.java:5086–5147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5084 }
5085
5086 static abstract class AbstractType extends AbstractItem implements Type {
5087 AbstractType(int opcode) {
5088 super(opcode);
5089 }
5090
5091 AbstractType(int opcode, Syntactic.Item operand) {
5092 super(opcode, operand);
5093 }
5094
5095 AbstractType(int opcode, Syntactic.Item... operands) {
5096 super(opcode, operands);
5097 }
5098
5099 AbstractType(int opcode, byte[] bytes) {
5100 super(opcode, bytes);
5101 }
5102
5103 @Override
5104 public int shape() {
5105 return 1;
5106 }
5107
5108 @Override
5109 public Type dimension(int nth) {
5110 if(nth != 0) {
5111 throw new IllegalArgumentException("invalid dimension");
5112 } else {
5113 return this;
5114 }
5115 }
5116
5117 @Override
5118 public boolean isWriteable() {
5119 return true;
5120 }
5121
5122 @Override
5123 public boolean isReadable() {
5124 return true;
5125 }
5126
5127
5128 @Override
5129 public <T extends Type> T as(Class<T> kind) {
5130 if (kind.isInstance(this)) {
5131 return (T) this;
5132 } else {
5133 return null;
5134 }
5135 }
5136
5137 @Override
5138 public <T extends Type> List<T> filter(Class<T> kind) {
5139 if (kind.isInstance(this)) {
5140 ArrayList<T> results = new ArrayList<>();
5141 results.add((T) this);
5142 return results;
5143 } else {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected