/** * Read a tag with a given tag id. The tag will be read out of the class * defined in getTagEnum(). * * @param tagid * A RPM tag id * @return The name of the RPM tag * @throws IllegalArgumentException * if the tag id was not found */ public String getTagNameForId(long tagid) { EnumIf e = RPMHeaderTag.getEnumById(tagid); if (e == null) { throw new java.lang.IllegalArgumentException("unknown tag with id <" + tagid + ">"); } return(e.getName()); }
/** * Read a tag with a given tag name. The tag will be read out of the class * defined in getTagEnum(). * * @param tagname * A RPM tag name * @return The id of the RPM tag * @throws IllegalArgumentException * if the tag name was not found */ public long getTagIdForName(String tagname) { EnumIf e = RPMHeaderTag.getEnumByName(tagname); if (e == null) { throw new java.lang.IllegalArgumentException("unknown tag with name <" + tagname + ">"); } return(e.getId()); }
/** * Get a enum by name * * @param refClass referencing class * @param name The name of the enum * @return The enum object */ public static EnumIf getEnumByName(Type refClass, String name) { EnumIf ret = null; MapEntry mapEntry = null; mapEntry = (MapEntry)map.get(refClass); if (mapEntry != null) { ret = (EnumIf)mapEntry.nameMap.get(name.toLowerCase()); if (ret == null) { ret = (EnumIf)mapEntry.idMap.get(new java.lang.Long(EnumIfConstants._UNKNOWN)); } } return(ret); }
/** * Get a enum by id * * @param refClass referencing class * @param id The id of the enum * @return The enum object */ public static EnumIf getEnumById(Type refClass, long id) { EnumIf ret = null; MapEntry mapEntry = null; mapEntry = (MapEntry)map.get(refClass); if (mapEntry != null) { ret = (EnumIf)mapEntry.idMap.get(new java.lang.Long(id)); if (ret == null) { // warn ret = (EnumIf)mapEntry.idMap.get(new java.lang.Long(EnumIfConstants._UNKNOWN)); } } return(ret); }
/** * Creates a new EnumDelegate object. * * @param refClass Referencing class for this enum (the class that : the enum) * @param id A id for this enum * @param name A name for this enum * @param realEnum The actual reference of the enum object (the real enum object that : EnumIf) */ public EnumDelegate(Type refClass, long id, String name, EnumIf realEnum) { this.id = id; this.name = name; MapEntry mapEntry; if (map.containsKey(refClass)) { mapEntry = (MapEntry)map.get(refClass); } else { mapEntry = new MapEntry(); map.put(refClass, mapEntry); } mapEntry.idMap.put(new java.lang.Long(id), realEnum); mapEntry.nameMap.put(name.toLowerCase(), realEnum); }
/** * Get a enum by id * * @param id The id of the enum * @return The enum object */ public static EnumIf getEnumById(long id) { EnumIf result = EnumDelegate.getEnumById(typeof(LeadType), id); if (null == result) { switch (id) { case _BINARY: result = LeadType.BINARY; break; case _SOURCE: result = LeadType.SOURCE; break; default: result = LeadType.UNKNOWN; break; } } return(result); }
public ArgTuple(KaitaiStream p__io, EnumIf.Operation p__parent = null, EnumIf p__root = null) : base(p__io) { m_parent = p__parent; m_root = p__root; _read(); }
public EnumIf(KaitaiStream p__io, KaitaiStruct p__parent = null, EnumIf p__root = null) : base(p__io) { m_parent = p__parent; m_root = p__root ?? this; _read(); }
private LeadOS(int os, String name) { delegateJ = new EnumDelegate(typeof(LeadOS), os, name, this); }
private LeadSignature(int signature, String name) { delegateJ = new EnumDelegate(typeof(LeadSignature), signature, name, this); }
/** * Get a enum by name * * @param name * The name of the enum * @return The enum object */ public static EnumIf getEnumByName(String name) { EnumIf result = EnumDelegate.getEnumByName(typeof(RPMHeaderTag), name); return(result); }
private RPMHeaderTag(int tag, String name) { delegateJ = new EnumDelegate(typeof(RPMHeaderTag), tag, name, this); }
private LeadType(int type, String name) { delegateJ = new EnumDelegate(typeof(LeadType), type, name, this); }
private RPMIndexType(int type, String name, int size) { delegateJ = new EnumDelegate(typeof(RPMIndexType), type, name, this); this.size = size; }
private LeadArchitecture(int architecture, String name) { delegateJ = new EnumDelegate(typeof(LeadArchitecture), architecture, name, this); }