protected void assertTagEquals(
      Tag expected, Tag source, final List<String> ignoreAttr, final List<String> ignoreTag) {
    if (!expected.getName().equals(source.getName())) {
      throw new ComparisonFailure(
          "Tags not equal: ", expected.getName().toString(), source.getName().toString());
    }

    assertAttributesEquals(
        expected.getName(), expected.getAttributes(), source.getAttributes(), ignoreAttr);
    assertAttributesEquals(
        expected.getName(), source.getAttributes(), expected.getAttributes(), ignoreAttr);

    if (!StringUtils.isEmpty(expected.getText()) && !expected.getText().equals(source.getText())) {
      throw new ComparisonFailure("Text not equal: ", expected.getText(), source.getText());
    }

    if (!expected.getTags().isEmpty()) {
      for (Tag expectedTag : expected.getTags()) {
        if (ignoreTag.contains(expectedTag.getName().getLocalPart())
            && expectedTag.getTags().isEmpty()) {
          continue;
        }
        Tag sourceTag = getFromSource(source, expectedTag);
        if (sourceTag == null) {
          throw new AssertionError(
              "\n"
                  + expected.toString()
                  + " is missing in the source file:"
                  + "\n"
                  + source.toString());
        }
        assertTagEquals(expectedTag, sourceTag, ignoreAttr, ignoreTag);
      }
    }
  }
Esempio n. 2
0
 // save
 // tag/////////////////////////////////////////////////////////////////////////////////////////
 public static int saveTag(Tag tag) {
   int insertId = -1;
   if (BuildConfig.DEBUG) {
     if (BuildConfig.DEBUG) Log.d("CoCoin", "recordManager.saveTag: " + tag.toString());
   }
   boolean duplicatedName = false;
   for (Tag t : TAGS) {
     if (t.getName().equals(tag.getName())) {
       duplicatedName = true;
       break;
     }
   }
   if (duplicatedName) {
     return SAVE_TAG_ERROR_DUPLICATED_NAME;
   }
   insertId = db.saveTag(tag);
   if (insertId == -1) {
     if (BuildConfig.DEBUG) {
       if (BuildConfig.DEBUG) Log.d("CoCoin", "Save the above tag FAIL!");
       return SAVE_TAG_ERROR_DATABASE_ERROR;
     }
   } else {
     if (BuildConfig.DEBUG) {
       if (BuildConfig.DEBUG) Log.d("CoCoin", "Save the above tag SUCCESSFULLY!");
     }
     TAGS.add(tag);
     TAG_NAMES.put(tag.getId(), tag.getName());
     sortTAGS();
   }
   return insertId;
 }
Esempio n. 3
0
  private void resolveIntent(Intent intent) {
    String action = intent.getAction();
    toast("resolving intent");
    if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action)) {
      toast("RESOLVE THIS INTENT");
      Tag tagFromIntent = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
      receiveTab.append("\nResolve Intent for NDEF discovery");
    } else if (NfcAdapter.ACTION_TECH_DISCOVERED.equals(action)) {
      Tag tagFromIntent = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
      MifareClassic mfc = MifareClassic.get(tagFromIntent);
      byte[] data;
      receiveTab.append("\nNew tech tag received");
      try {
        mfc.connect();
        boolean auth = false;
        String cardData = null;
        int secCount = mfc.getSectorCount();
        int bCount = 0;
        int bIndex = 0;
        for (int j = 0; j < secCount; j++) {
          auth = mfc.authenticateSectorWithKeyA(j, MifareClassic.KEY_DEFAULT);
          if (auth) {
            bCount = mfc.getBlockCountInSector(j);
            bIndex = 0;
            for (int i = 0; i < bCount; i++) {
              bIndex = mfc.sectorToBlock(j);
              data = mfc.readBlock(bIndex);
              cardData = new String(data);
              receiveTab.append("\n" + cardData);
              bIndex++;
            }
          } else {
            Toast.makeText(this, "Auth failed", Toast.LENGTH_LONG).show();
          }
        }
      } catch (IOException ex) {
        Toast.makeText(this, "IO Error while attempting to read mifare", Toast.LENGTH_LONG).show();
      }
    } else if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(action)) {
      receiveTab.append("\nSome Tag found from card");
      Tag tagFromIntent = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);

      receiveTab.append("\n" + tagFromIntent.toString());
      for (int k = 0; k < tagFromIntent.getTechList().length; k++) {
        receiveTab.append("\nTech List: " + tagFromIntent.getTechList()[k]);
        if (tagFromIntent.getTechList()[k].equals("android.nfc.tech.NfcA")) {
          // Run connection method
          parseNfcATag(tagFromIntent);
          // connectToNDEF(tagFromIntent);
          // parseMifareTag(tagFromIntent);
        } else if (tagFromIntent.getTechList()[k].equals("android.nfc.tech.Ndef")) {
          connectToNDEF(tagFromIntent);
          // receiveTab.append("\nRun connect to NDEF");
        }
      }
    }
  }
 void handleTitle() {
   Tag tag = FgdcTag.Title;
   try {
     this.metadataParseResponse.metadata.setTitle(getTitleValue());
   } catch (Exception e) {
     logger.error("handleTitle: " + e.getMessage());
     this.metadataParseResponse.addWarning(
         tag.toString(), tag.getTagName(), e.getClass().getName(), e.getMessage());
   }
 }
 @Override
 void handleAbstract() {
   Tag tag = FgdcTag.Abstract;
   try {
     this.metadataParseResponse.metadata.setDescription(getDocumentValue(tag));
   } catch (Exception e) {
     logger.error("handleAbstract: " + e.getMessage());
     this.metadataParseResponse.addWarning(
         tag.toString(), tag.getTagName(), e.getClass().getName(), e.getMessage());
   }
 }
 @Override
 void handleTitle() {
   /* <gmd:title>
     <gco:CharacterString>Global Volcano Proportional Economic Loss Risk Deciles_CHRR</gco:CharacterString>
   </gmd:title>*/
   Tag tag = Iso19139Tag.Title;
   try {
     this.metadataParseResponse.metadata.setTitle(getDocumentValue(tag));
   } catch (Exception e) {
     logger.error("handleTitle: " + e.getMessage());
     this.metadataParseResponse.addWarning(
         tag.toString(), tag.getTagName(), e.getClass().getName(), e.getMessage());
   }
 }
 @Override
 void handleAbstract() {
   /*  <gmd:abstract>
           <gco:CharacterString>Global Volcano Proportional Economic Loss Risk Deciles is a 2.5 by 2.5 minute grid of volcano hazard economic loss as proportions of gross domestic product (GDP) per analytical unit. Estimates of GDP at risk are based on regional economic loss rates derived from historical records of the Emergency Events Database (EM-DAT). Loss rates are weighted by the hazard's frequency and distribution. The methodology of Sachs et al. (2003) is followed to determine baseline estimates of GDP per grid cell. To better reflect the confidence surrounding the data and procedures, the range of proportionalities is classified into deciles, 10 class of an approximately equal number of grid cells of increasing risk. The dataset is a result of the collaboration among the Center for Hazards and Risk Research (CHRR), International Bank for Reconstruction and Development/The World Bank, and the Columbia University Center for International Earth Science Information Network (CIESIN).
   The Center for Hazards and Risk Research (CHRR) draws on Columbia's acknowledged expertise in Earth and environmental sciences, engineering, social sciences, public policy, public health and business. The mission is to advance the predictive science of natural and environmental hazards and the integration of science with hazard risk assessment and risk management. The CHRR produced the core dataset of Natural Disaster Hotspots – A global risk analysis, which contains 4 libraries of data: Hazard Frequency and/or Distribution; Hazard Mortality Risks and Distribution; Hazard Total Economic Loss Risk Deciles; Hazard Proportional Economic Loss Risk Deciles for each natural disaster.</gco:CharacterString>
         </gmd:abstract>*/
   Tag tag = Iso19139Tag.Abstract;
   try {
     this.metadataParseResponse.metadata.setDescription(getDocumentValue(tag));
   } catch (Exception e) {
     logger.error("handleAbstract: " + e.getMessage());
     this.metadataParseResponse.addWarning(
         tag.toString(), tag.getTagName(), e.getClass().getName(), e.getMessage());
   }
 }
 @Override
 void handleBounds() {
   /*
   *       <gmd:extent>
          <gmd:EX_Extent>
            <gmd:geographicElement>
              <gmd:EX_GeographicBoundingBox>
                <gmd:westBoundLongitude>
                  <gco:Decimal>-180</gco:Decimal>
                </gmd:westBoundLongitude>
                <gmd:eastBoundLongitude>
                  <gco:Decimal>180</gco:Decimal>
                </gmd:eastBoundLongitude>
                <gmd:southBoundLatitude>
                  <gco:Decimal>-90</gco:Decimal>
                </gmd:southBoundLatitude>
                <gmd:northBoundLatitude>
                  <gco:Decimal>90</gco:Decimal>
                </gmd:northBoundLatitude>
              </gmd:EX_GeographicBoundingBox>
            </gmd:geographicElement>
          </gmd:EX_Extent>
        </gmd:extent>
   */
   Tag tag = Iso19139Tag.NorthBc;
   try {
     String maxY = getDocumentValue(tag);
     tag = Iso19139Tag.EastBc;
     String maxX = getDocumentValue(tag);
     tag = Iso19139Tag.SouthBc;
     String minY = getDocumentValue(tag);
     tag = Iso19139Tag.WestBc;
     String minX = getDocumentValue(tag);
     // should validate bounds here
     if (validateBounds(minX, minY, maxX, maxY)) {
       this.metadataParseResponse.metadata.setBounds(minX, minY, maxX, maxY);
     } else {
       throw new Exception("Invalid Bounds: " + minX + "," + minY + "," + maxX + "," + maxY);
     }
   } catch (Exception e) {
     logger.error("handleBounds: " + e.getMessage());
     this.metadataParseResponse.addWarning(
         tag.toString(), tag.getTagName(), e.getClass().getName(), e.getMessage());
   }
 }
 @Override
 void handleLayerName() {
   /*
    *
    *   <gmd:fileIdentifier xmlns:srv="http://www.isotc211.org/2005/srv" xmlns:gmx="http://www.isotc211.org/2005/gmx">
     <gco:CharacterString>11334f95-ceee-44d9-b2f8-cd9daf08c427</gco:CharacterString>
   </gmd:fileIdentifier>
    *
    */
   Tag tag = Iso19139Tag.LayerName;
   try {
     this.metadataParseResponse.metadata.setOwsName(getDocumentValue(tag));
   } catch (Exception e) {
     logger.error("handleLayerName: " + e.getMessage());
     this.metadataParseResponse.addError(
         tag.toString(), tag.getTagName(), e.getClass().getName(), e.getMessage());
   }
 }
Esempio n. 10
0
 public static long updateTag(Tag tag) {
   int updateId = -1;
   if (BuildConfig.DEBUG) Log.d("CoCoin", "Manager: Update tag: " + tag.toString());
   updateId = db.updateTag(tag);
   if (updateId == -1) {
     if (BuildConfig.DEBUG) Log.d("CoCoin", "Update the above tag FAIL!");
   } else {
     if (BuildConfig.DEBUG)
       Log.d("CoCoin", "Update the above tag SUCCESSFULLY!" + " - " + updateId);
     for (Tag t : TAGS) {
       if (t.getId() == tag.getId()) {
         t.set(tag);
         break;
       }
     }
     sortTAGS();
   }
   return updateId;
 }
Esempio n. 11
0
 void handleBounds() {
   Tag tag = FgdcTag.NorthBc;
   try {
     String maxY = getDocumentValue(tag);
     tag = FgdcTag.EastBc;
     String maxX = getDocumentValue(tag);
     tag = FgdcTag.SouthBc;
     String minY = getDocumentValue(tag);
     tag = FgdcTag.WestBc;
     String minX = getDocumentValue(tag);
     // should validate bounds here
     if (validateBounds(minX, minY, maxX, maxY)) {
       this.metadataParseResponse.metadata.setBounds(minX, minY, maxX, maxY);
     } else {
       throw new Exception("Invalid Bounds: " + minX + "," + minY + "," + maxX + "," + maxY);
     }
   } catch (Exception e) {
     logger.error("handleBounds: " + e.getMessage());
     this.metadataParseResponse.addWarning(
         tag.toString(), tag.getTagName(), e.getClass().getName(), e.getMessage());
   }
 }
Esempio n. 12
0
 @Override
 public String toString() {
   String name = getName();
   String append = "";
   if (name != null && !name.equals("")) {
     append = "(\"" + this.getName() + "\")";
   }
   StringBuilder bldr = new StringBuilder();
   bldr.append(
       "TAG_List"
           + append
           + ": "
           + value.size()
           + " entries of type "
           + NBTUtils.getTypeName(type)
           + "\r\n{\r\n");
   for (Tag t : value) {
     bldr.append("   " + t.toString().replaceAll("\r\n", "\r\n   ") + "\r\n");
   }
   bldr.append("}");
   return bldr.toString();
 }
Esempio n. 13
0
  @Override
  public JsonObject getAttributes() {
    JsonObject attributes = new JsonObject();

    write(attributes, KEY_IDENTIFIER, m_identifier);
    write(attributes, KEY_IMAGE, m_image);
    write(attributes, KEY_TITLE, m_title);
    write(attributes, KEY_AUTHOR, m_author);
    write(attributes, KEY_SOURCE, m_source);

    if (m_tags != null && m_tags.size() > 0) {
      JsonArray array = new JsonArray();

      for (Tag tag : m_tags) {
        array.add(new JsonPrimitive(tag.toString()));
      }

      attributes.add(KEY_TAGS, array);
    }

    return attributes;
  }
Esempio n. 14
0
 @Override
 void handleAccess() {
   /*
   *       <gmd:resourceConstraints>
          <gmd:MD_LegalConstraints>
            <gmd:accessConstraints>
              <gmd:MD_RestrictionCode codeListValue="" codeList="http://www.isotc211.org/2005/resources/codeList.xml#MD_RestrictionCode" />
            </gmd:accessConstraints>
            <gmd:useConstraints>
              <gmd:MD_RestrictionCode codeListValue="intellectualPropertyRights" codeList="http://www.isotc211.org/2005/resources/codeList.xml#MD_RestrictionCode" />
            </gmd:useConstraints>
            <gmd:otherConstraints>
              <gco:CharacterString>The Trustees of Columbia University in the City of New York, the Center for Hazards and Risk Research (CHRR), and the Center for International Earth Science Information Network (CIESIN) hold the copyright of this dataset. Users are prohibited from any commercial, non-free resale, or redistribution without explicit written permission from CHRR or CIESIN. Use of this data set is restricted to scientific research only. Users should acknowledge CHRR and CIESIN as the source used in the creation of any reports, publications, new data sets, derived products, or services resulting from the use of this data set. CHRR and CIESIN also request reprints of any publications and notification of any redistribution efforts.</gco:CharacterString>
            </gmd:otherConstraints>
          </gmd:MD_LegalConstraints>
        </gmd:resourceConstraints>
   */
   Tag tag = Iso19139Tag.Access;
   try {
     String accessValue$ = "";
     try {
       accessValue$ = getDocumentValue(tag);
     } catch (Exception e) {
       AccessLevel nullAccess = null;
       this.metadataParseResponse.metadata.setAccessLevel(nullAccess);
       return;
     }
     AccessLevel accessValue = AccessLevel.Public;
     accessValue$ = accessValue$.toLowerCase();
     if (accessValue$.startsWith("restricted")) {
       accessValue = AccessLevel.Restricted;
     }
     this.metadataParseResponse.metadata.setAccessLevel(accessValue);
   } catch (Exception e) {
     logger.error("handleAccess: " + e.getMessage());
     this.metadataParseResponse.addError(
         tag.toString(), tag.getTagName(), e.getClass().getName(), e.getMessage());
   }
 }
Esempio n. 15
0
 /**
  * look at the document field associated with Key.Access (for FGDC: accconst) if the field starts
  * with Restricted, the layer is restricted. Otherwise it is public.
  *
  * @throws Exception
  */
 protected void handleAccess() {
   Tag tag = FgdcTag.Access;
   try {
     String accessValue$ = "";
     try {
       accessValue$ = getDocumentValue(tag);
     } catch (Exception e) {
       AccessLevel nullAccess = null;
       this.metadataParseResponse.metadata.setAccessLevel(nullAccess);
       return;
     }
     AccessLevel accessValue = AccessLevel.Public;
     accessValue$ = accessValue$.toLowerCase();
     if (accessValue$.startsWith("restricted")) {
       accessValue = AccessLevel.Restricted;
     }
     this.metadataParseResponse.metadata.setAccessLevel(accessValue);
   } catch (Exception e) {
     logger.error("handleAccess: " + e.getMessage());
     this.metadataParseResponse.addError(
         tag.toString(), tag.getTagName(), e.getClass().getName(), e.getMessage());
   }
 }
  //    @Test
  // @Repeat(value = 1)
  public void entitiesUnderLoad() throws Exception {
    // This test suffered under DAT-348 and was quarantined.
    String companyName = "entitiesUnderLoad";
    setSecurity();
    SystemUser su = registerSystemUser(companyName, "entitiesUnderLoad");

    Fortress fortress =
        fortressService.registerFortress(
            su.getCompany(), new FortressInputBean("entitiesUnderLoad", true));
    String docType = "entitiesUnderLoad";

    int tagCount = 1; // unique tags per entity - tags are shared across the entities
    int docCount = 1; // how many entities to create per thread
    // Tried reducing threadMax
    int threadMax = 3; // Each thread will create a unique document type
    ArrayList<TagInputBean> tags = getTags(tagCount, false);

    Collection<Tag> createdTags =
        tagService.findTags(fortress.getCompany(), tags.get(0).getLabel());
    assertEquals("Database is not in a cleared down state", 0, createdTags.size());

    Map<Integer, EntityRunner> runners = new HashMap<>();

    CountDownLatch latch = new CountDownLatch(threadMax);
    CountDownLatch startSignal = new CountDownLatch(1);
    for (int thread = 0; thread < threadMax; thread++) {
      EntityRunner runner =
          addEntityRunner(
              thread + 1,
              su,
              fortress,
              docType,
              "ABC" + thread,
              docCount,
              tags,
              latch,
              startSignal);
      runners.put(thread, runner);
    }
    startSignal.countDown();
    latch.await();
    Tag found = null;

    for (int thread = 0; thread < threadMax; thread++) {
      assertEquals("Thread " + (thread + 1), true, runners.get(thread).isWorked());
      for (int count = 0; count < docCount; count++) {
        // Thread.sleep(2000);
        Entity entity =
            entityService.findByCode(
                su.getCompany(), fortress.getName(), docType, "ABC" + thread + "" + count);
        assertNotNull(entity);
        Collection<EntityTag> entityTags = entityTagService.findEntityTags(entity);
        if (entityTags.size() == 0) {
          logger.debug("Why is this 0?");
        }
        assertEquals(tagCount, entityTags.size());
        // Make sure every thread's tags point to the same tag
        if (found == null) found = entityTags.iterator().next().getTag();
        else
          assertEquals(
              found.toString() + " / " + entityTags.iterator().next().getTag().toString(),
              found.getId(),
              entityTags.iterator().next().getTag().getId());
      }
    }
    assertNotNull(
        tagService.findTag(fortress.getCompany(), "Deadlock", null, tags.get(0).getCode()));

    createdTags = tagService.findTags(fortress.getCompany(), "Deadlock");
    assertEquals(false, createdTags.isEmpty());
    if (createdTags.size() != tagCount) {

      for (Tag createdTag : createdTags) {
        // logger.info(createdTag.toString());
        logger.info("Finding... {}", createdTag.toString());
        Tag xtra =
            tagService.findTag(su.getCompany(), createdTag.getLabel(), null, createdTag.getCode());

        logger.info(xtra.toString());
      }
    }
    assertEquals(tagCount, createdTags.size());
  }
Esempio n. 17
0
 /** Tests the {@link Tag#toString()} method. */
 @Test
 public void toStringTest() {
   Tag tag = new Tag(KEY, VALUE);
   Assert.assertEquals(TAG_TO_STRING, tag.toString());
 }
Esempio n. 18
0
  /** Prints the given <code>JimpleBody</code> to the specified <code>PrintWriter</code>. */
  private void printStatementsInBody(
      Body body, java.io.PrintWriter out, LabeledUnitPrinter up, UnitGraph unitGraph) {
    Chain units = body.getUnits();
    Iterator unitIt = units.iterator();
    Unit currentStmt = null, previousStmt;

    while (unitIt.hasNext()) {

      previousStmt = currentStmt;
      currentStmt = (Unit) unitIt.next();

      // Print appropriate header.
      {
        // Put an empty line if the previous node was a branch node, the current node is a join node
        //   or the previous statement does not have body statement as a successor, or if
        //   body statement has a label on it

        if (currentStmt != units.getFirst()) {
          if (unitGraph.getSuccsOf(previousStmt).size() != 1
              || unitGraph.getPredsOf(currentStmt).size() != 1
              || up.labels().containsKey(currentStmt)) {
            up.newline();
          } else {
            // Or if the previous node does not have body statement as a successor.

            List succs = unitGraph.getSuccsOf(previousStmt);

            if (succs.get(0) != currentStmt) {
              up.newline();
            }
          }
        }

        if (up.labels().containsKey(currentStmt)) {
          up.unitRef(currentStmt, true);
          up.literal(":");
          up.newline();
        }

        if (up.references().containsKey(currentStmt)) {
          up.unitRef(currentStmt, false);
        }
      }

      up.startUnit(currentStmt);
      currentStmt.toString(up);
      up.endUnit(currentStmt);

      up.literal(";");
      up.newline();

      // only print them if not generating attributes files
      // because they mess up line number
      // if (!addJimpleLn()) {
      if (Options.v().print_tags_in_output()) {
        Iterator tagIterator = currentStmt.getTags().iterator();
        while (tagIterator.hasNext()) {
          Tag t = (Tag) tagIterator.next();
          up.noIndent();
          up.literal("/*");
          up.literal(t.toString());
          up.literal("*/");
          up.newline();
        }
        /*Iterator udIt = currentStmt.getUseAndDefBoxes().iterator();
        while (udIt.hasNext()) {
            ValueBox temp = (ValueBox)udIt.next();
            Iterator vbtags = temp.getTags().iterator();
            while (vbtags.hasNext()) {
                Tag t = (Tag) vbtags.next();
                up.noIndent();
                up.literal("VB Tag: "+t.toString());
                up.newline();
            }
        }*/
      }
    }

    out.print(up.toString());
    if (addJimpleLn()) {
      setJimpleLnNum(up.getPositionTagger().getEndLn());
    }

    // Print out exceptions
    {
      Iterator trapIt = body.getTraps().iterator();

      if (trapIt.hasNext()) {
        out.println();
        incJimpleLnNum();
      }

      while (trapIt.hasNext()) {
        Trap trap = (Trap) trapIt.next();

        out.println(
            "        catch "
                + Scene.v().quotedNameOf(trap.getException().getName())
                + " from "
                + up.labels().get(trap.getBeginUnit())
                + " to "
                + up.labels().get(trap.getEndUnit())
                + " with "
                + up.labels().get(trap.getHandlerUnit())
                + ";");

        incJimpleLnNum();
      }
    }
  }
Esempio n. 19
0
  public void printTo(SootClass cl, PrintWriter out) {
    // add jimple line number tags
    setJimpleLnNum(1);

    // Print class name + modifiers
    {
      StringTokenizer st = new StringTokenizer(Modifier.toString(cl.getModifiers()));
      while (st.hasMoreTokens()) {
        String tok = (String) st.nextToken();
        if (cl.isInterface() && tok.equals("abstract")) continue;
        out.print(tok + " ");
      }

      String classPrefix = "";

      if (!cl.isInterface()) {
        classPrefix = classPrefix + " class";
        classPrefix = classPrefix.trim();
      }

      out.print(classPrefix + " " + Scene.v().quotedNameOf(cl.getName()) + "");
    }

    // Print extension
    {
      if (cl.hasSuperclass())
        out.print(" extends " + Scene.v().quotedNameOf(cl.getSuperclass().getName()) + "");
    }

    // Print interfaces
    {
      Iterator interfaceIt = cl.getInterfaces().iterator();

      if (interfaceIt.hasNext()) {
        out.print(" implements ");

        out.print("" + Scene.v().quotedNameOf(((SootClass) interfaceIt.next()).getName()) + "");

        while (interfaceIt.hasNext()) {
          out.print(",");
          out.print(" " + Scene.v().quotedNameOf(((SootClass) interfaceIt.next()).getName()) + "");
        }
      }
    }

    out.println();
    incJimpleLnNum();
    /*        if (!addJimpleLn()) {
        Iterator clTagsIt = cl.getTags().iterator();
        while (clTagsIt.hasNext()) {
            final Tag t = (Tag)clTagsIt.next();
            out.println(t);
        }
    }*/
    out.println("{");
    incJimpleLnNum();
    if (Options.v().print_tags_in_output()) {
      Iterator cTagIterator = cl.getTags().iterator();
      while (cTagIterator.hasNext()) {
        Tag t = (Tag) cTagIterator.next();
        out.print("/*");
        out.print(t.toString());
        out.println("*/");
      }
    }

    // Print fields
    {
      Iterator fieldIt = cl.getFields().iterator();

      if (fieldIt.hasNext()) {
        while (fieldIt.hasNext()) {
          SootField f = (SootField) fieldIt.next();

          if (f.isPhantom()) continue;

          if (Options.v().print_tags_in_output()) {
            Iterator fTagIterator = f.getTags().iterator();
            while (fTagIterator.hasNext()) {
              Tag t = (Tag) fTagIterator.next();
              out.print("/*");
              out.print(t.toString());
              out.println("*/");
            }
          }
          out.println("    " + f.getDeclaration() + ";");
          if (addJimpleLn()) {
            setJimpleLnNum(addJimpleLnTags(getJimpleLnNum(), f));
          }

          // incJimpleLnNum();
        }
      }
    }

    // Print methods
    {
      Iterator methodIt = cl.methodIterator();

      if (methodIt.hasNext()) {
        if (cl.getMethodCount() != 0) {
          out.println();
          incJimpleLnNum();
        }

        while (methodIt.hasNext()) {
          SootMethod method = (SootMethod) methodIt.next();

          if (method.isPhantom()) continue;

          if (!Modifier.isAbstract(method.getModifiers())
              && !Modifier.isNative(method.getModifiers())) {
            if (!method.hasActiveBody())
              throw new RuntimeException("method " + method.getName() + " has no active body!");
            else if (Options.v().print_tags_in_output()) {
              Iterator mTagIterator = method.getTags().iterator();
              while (mTagIterator.hasNext()) {
                Tag t = (Tag) mTagIterator.next();
                out.print("/*");
                out.print(t.toString());
                out.println("*/");
              }
            }
            printTo(method.getActiveBody(), out);

            if (methodIt.hasNext()) {
              out.println();
              incJimpleLnNum();
            }
          } else {

            if (Options.v().print_tags_in_output()) {
              Iterator mTagIterator = method.getTags().iterator();
              while (mTagIterator.hasNext()) {
                Tag t = (Tag) mTagIterator.next();
                out.print("/*");
                out.print(t.toString());
                out.println("*/");
              }
            }

            out.print("    ");
            out.print(method.getDeclaration());
            out.println(";");
            incJimpleLnNum();
            if (methodIt.hasNext()) {
              out.println();
              incJimpleLnNum();
            }
          }
        }
      }
    }
    out.println("}");
    incJimpleLnNum();
  }