Risiko94

Type.java

Oct 19th, 2021
589
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package DataTypes;
  2.  
  3. public class Type {
  4.     final byte type;
  5.     final String name;
  6.    
  7.     public byte getType() {
  8.         return this.type;
  9.     }
  10.     public String getName() {
  11.         return this.name;
  12.     }
  13.    
  14.     public Type(String name, byte type) {
  15.         this.type = type;
  16.         this.name = name;
  17.     }
  18.     public Type(String name, int type) {
  19.         this.type = (byte) type;
  20.         this.name = name;
  21.     }
  22.     public Type(byte type, String name) {
  23.         this.type = type;
  24.         this.name = name;
  25.     }
  26.     public Type(int type, String name) {
  27.         this.type = (byte) type;
  28.         this.name = name;
  29.     }
  30.     public Type(int type) {
  31.         this.type = (byte) type;
  32.         this.name = Messagetypes.getNameFromByte((byte)type);
  33.     }
  34.     public String toString(){
  35.         return (String.format("%#02x", getType()) + " " + getName());      
  36.     }
  37. }
RAW Paste Data