Example #1
0
 private VR vrOf(String s) throws SAXException {
   try {
     return VR.valueOf(s);
   } catch (NullPointerException e) {
     throw new SAXException("missing vr attribute");
   } catch (IllegalArgumentException e) {
     throw new SAXException("unrecognized vr=\"" + s + '"');
   }
 }
 private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException {
   is.defaultReadObject();
   privateCreator = (String) is.readObject();
   int size = is.readInt();
   table = new IntHashtable<VR>(size);
   for (int i = 0, tag, code; i < size; ++i) {
     tag = is.readInt();
     code = is.readUnsignedShort();
     table.put(tag, VR.valueOf(code));
   }
 }
Example #3
0
  @Override
  public int hashCode() {
    final int prime = 31;

    int hashCode = 1;
    for (Object e : this) hashCode = prime * hashCode + itemHashCode(e);

    hashCode = prime * hashCode + (bigEndian ? 1231 : 1237);
    hashCode = prime * hashCode + ((privateCreator == null) ? 0 : privateCreator.hashCode());
    hashCode = prime * hashCode + tag;
    hashCode = prime * hashCode + ((vr == null) ? 0 : vr.hashCode());
    return hashCode;
  }
 @Override
 public void startElement(String uri, String localName, String qName, Attributes attributes) {
   if ("element".equals(qName)) {
     int tag = (int) Long.parseLong(attributes.getValue("tag").replace('x', '0'), 16);
     String vrstr = attributes.getValue("vr");
     if (vrstr != null && vrstr.length() != 0) {
       VR vr =
           "US|SS|OW".equals(vrstr) ? VR.OW : VR.valueOf(vrstr.charAt(0) << 8 | vrstr.charAt(1));
       table.put(tag, vr);
     }
   } else if ("dictionary".equals(qName)) {
     privateCreator = attributes.getValue("creator");
   }
 }
 private static VR selectVR(String s, int fromIndex) {
   String vrStr = select("@vr=", s, fromIndex);
   return vrStr != null ? VR.valueOf(vrStr) : null;
 }
Example #6
0
 public MemberOf setValues(int... values) {
   if (!vr.isIntType()) throw new IllegalStateException("vr=" + vr);
   this.values = values;
   return this;
 }