-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
88 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
convex-core/src/main/java/convex/core/data/impl/DummyCell.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package convex.core.data.impl; | ||
|
||
import convex.core.data.ACell; | ||
import convex.core.data.Tag; | ||
import convex.core.data.util.BlobBuilder; | ||
import convex.core.exceptions.InvalidDataException; | ||
|
||
/** | ||
* A dummy cell implementation, not a valid CVM value | ||
*/ | ||
public class DummyCell extends ACell { | ||
|
||
@Override | ||
public int estimatedEncodingSize() { | ||
return 1; | ||
} | ||
|
||
@Override | ||
public void validateCell() throws InvalidDataException { | ||
throw new InvalidDataException("This is a dummy value",this); | ||
} | ||
|
||
@Override | ||
protected byte getTag() { | ||
return Tag.ILLEGAL; | ||
} | ||
|
||
@Override | ||
public boolean equals(ACell a) { | ||
return this==a; | ||
} | ||
|
||
@Override | ||
public int encode(byte[] bs, int pos) { | ||
bs[pos++]=Tag.ILLEGAL; | ||
return pos; | ||
} | ||
|
||
@Override | ||
protected int encodeRaw(byte[] bs, int pos) { | ||
// Nothing to encode | ||
return pos; | ||
} | ||
|
||
@Override | ||
public boolean isCanonical() { | ||
return true; | ||
} | ||
|
||
@Override | ||
protected ACell toCanonical() { | ||
return this; | ||
} | ||
|
||
@Override | ||
public boolean isCVMValue() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean isDataValue() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean print(BlobBuilder sb, long limit) { | ||
sb.append("DUMMY"); | ||
return sb.check(limit); | ||
} | ||
|
||
|
||
|
||
} |