Input:
    protected void checkExtraRules(final SQueriableLog log) {
        if (log.getActionStatus() != SQueriableLog.STATUS_FAIL && log.getNumericIndex(COMMENT_INDEX) == 0L) {
            throw new MissingMandatoryFieldsException("Some mandatoryFildes are missing: " + "comment Id");
        }
    }

Output:
    protected void checkExtraRules(final SQueriableLog log) {
        if (log.getActionStatus() != SQueriableLog.STATUS_FAIL && log.getNumericIndex(COMMENT_INDEX) == 0L) {
            throw new MissingMandatoryFieldsException("Some mandatory fields are missing: " + "comment Id");
        }
    }


Input:
    public void init() {
        logger = LoggerFactory.getLogger(getClass());
        logger.debug("initializing bean " + getClass().getName());
        attributes = Attributes.getBehaviorAttributes(ToggleControl.class, getClass());
        attributes.setAttribute("forPanel", "panel1");
        attributes.setAttribute("targetItem", "item1");
        attributes.remove("disableDefault");
        attributes.remove("event");
    }

Output:
    public void init() {
        logger = LoggerFactory.getLogger(getClass());
        logger.debug("initializing bean " + getClass().getName());
        attributes = Attributes.getBehaviorAttributes(ToggleControl.class, getClass());
        attributes.setAttribute("targetPanel", "panel1");
        attributes.setAttribute("targetItem", "item1");
        attributes.remove("disableDefault");
        attributes.remove("event");
    }


Input:
	public static boolean onOptionsItemSelected(MenuItem item, Context context) {
		switch (item.getItemId()) {
		case R.id.menu_log_in_out:
			SessionHandler sh = SessionHandler.getInstance(context);
			if(sh.hasSession()){
				sh.logOut();
			} else {
				context.startActivity(new Intent(context, LogInActivity.class));
			}
			return true;
		case R.id.menu_options:
			Toast.makeText(context, "Not implemented", Toast.LENGTH_SHORT);
			return true;
		default:
			return false;
		}
	}

Output:
	public static boolean onOptionsItemSelected(MenuItem item, Context context) {
		switch (item.getItemId()) {
		case R.id.menu_log_in_out:
			SessionHandler sh = SessionHandler.getInstance(context);
			if(sh.hasSession()){
				sh.logOut();
			} else {
				context.startActivity(new Intent(context, LogInActivity.class));
			}
			return true;
		case R.id.menu_options:
			Toast.makeText(context, "Not implemented", Toast.LENGTH_SHORT).show();
			return true;
		default:
			return false;
		}
	}


Input:
    protected static void initialize(Object mystcraft) {
        if (mystcraft == null) {
            Objects.log.log(Level.SEVERE, "Mystcraft is not installed or not found! This mod requires mystcraft to function!");
            return;
        }
        try {
            hideTechnicalBlocks();
        }
        catch (Exception ex) {
            Objects.log.log(Level.SEVERE, "Failed hiding technical blocks from NEI", ex);
        }
        catch (Error ex) {
            Objects.log.log(Level.SEVERE, "Failed hiding technical blocks from NEI, you don't need to report this as I'll probably already know about this", ex);
        }
        try {
            addDecayTypes();
        }
        catch (Exception ex) {
            Objects.log.log(Level.SEVERE, "Failed adding different kinds of decay to NEI", ex);
        }
        catch (Error ex) {
            Objects.log.log(Level.SEVERE, "Failed adding different kinds of decay to NEI, you don't need to report this as I'll probably already know about this", ex);
        }
        try {
            addCreativeNotebook(mystcraft);
        }
        catch (Exception ex) {
            Objects.log.log(Level.SEVERE, "Failed adding a creative notebook to NEI", ex);
        }
        catch (Error ex) {
            Objects.log.log(Level.SEVERE, "Failed adding a creative notebook to NEI, you don't need to report this as I'll probably already know about this", ex);
        }
        try {
            addPages();
        }
        catch (Exception ex) {
            Objects.log.log(Level.SEVERE, "Failed adding symbol pages to NEI", ex);
        }
        catch (Error ex) {
            Objects.log.log(Level.SEVERE, "Failed adding symbol pages to NEI, you don't need to report this as I'll probably already know about this", ex);
        }
        try {
            addLinkPanels();
        }
        catch (Exception ex) {
            Objects.log.log(Level.SEVERE, "Failed adding link panels to NEI", ex);
        }
        catch (Error ex) {
            Objects.log.log(Level.SEVERE, "Failed adding link panels to NEI, you don't need to report this as I'll probably already know about this", ex);
        }
        try {
            addItemRanges();
        }
        catch (Exception ex) {
            Objects.log.log(Level.SEVERE, "Failed adding item ranges to NEI", ex);
        }
        catch (Error ex) {
            Objects.log.log(Level.SEVERE, "Failed adding item ranges to NEI, you don't need to report this as I'll probably already know about this", ex);
        }
        try {
            getMethodsAndFields();
        }
        catch (Exception ex) {
            Objects.log.log(Level.SEVERE, "Failed getting methods and fields", ex);
        }
        catch (Error ex) {
            Objects.log.log(Level.SEVERE, "Failed getting methods and fields, you don't need to report this as I'll probably already know about this", ex);
        }
        try {
            PluginNEIMystcraft.guiInkMixerClass = (Class<? extends GuiContainer>) Class.forName("com.xcompwiz.mystcraft.client.GuiInkMixer");
        }
        catch (Exception ex) {
            Objects.log.log(Level.SEVERE, "Failed getting GUI classes", ex);
        }
        catch (Error ex) {
            Objects.log.log(Level.SEVERE, "Failed getting GUI classes, you don't need to report this as I'll probably already know about this", ex);
        }
    }

Output:
    protected static void initialize(Object mystcraft) {
        if (mystcraft == null) {
            Objects.log.log(Level.SEVERE, "Mystcraft is not installed or not found! This mod requires mystcraft to function!");
            return;
        }
        try {
            hideTechnicalBlocks();
        }
        catch (Exception ex) {
            Objects.log.log(Level.SEVERE, "Failed hiding technical blocks from NEI", ex);
        }
        catch (Error ex) {
            Objects.log.log(Level.SEVERE, "Failed hiding technical blocks from NEI, you don't need to report this as I'll probably already know about this", ex);
        }
        try {
            addDecayTypes();
        }
        catch (Exception ex) {
            Objects.log.log(Level.SEVERE, "Failed adding different kinds of decay to NEI", ex);
        }
        catch (Error ex) {
            Objects.log.log(Level.SEVERE, "Failed adding different kinds of decay to NEI, you don't need to report this as I'll probably already know about this", ex);
        }
        try {
            addCreativeNotebook(mystcraft);
        }
        catch (Exception ex) {
            Objects.log.log(Level.SEVERE, "Failed adding a creative notebook to NEI", ex);
        }
        catch (Error ex) {
            Objects.log.log(Level.SEVERE, "Failed adding a creative notebook to NEI, you don't need to report this as I'll probably already know about this", ex);
        }
        try {
            addPages();
        }
        catch (Exception ex) {
            Objects.log.log(Level.SEVERE, "Failed adding symbol pages to NEI", ex);
        }
        catch (Error ex) {
            Objects.log.log(Level.SEVERE, "Failed adding symbol pages to NEI, you don't need to report this as I'll probably already know about this", ex);
        }
        try {
            addLinkPanels();
        }
        catch (Exception ex) {
            Objects.log.log(Level.SEVERE, "Failed adding link panels to NEI", ex);
        }
        catch (Error ex) {
            Objects.log.log(Level.SEVERE, "Failed adding link panels to NEI, you don't need to report this as I'll probably already know about this", ex);
        }
        try {
            addItemRanges();
        }
        catch (Exception ex) {
            Objects.log.log(Level.SEVERE, "Failed adding item ranges to NEI", ex);
        }
        catch (Error ex) {
            Objects.log.log(Level.SEVERE, "Failed adding item ranges to NEI, you don't need to report this as I'll probably already know about this", ex);
        }
        try {
            getMethodsAndFields();
        }
        catch (Exception ex) {
            Objects.log.log(Level.SEVERE, "Failed getting methods and fields", ex);
        }
        catch (Error ex) {
            Objects.log.log(Level.SEVERE, "Failed getting methods and fields, you don't need to report this as I'll probably already know about this", ex);
        }
        try {
            PluginNEIMystcraft.guiInkMixerClass = (Class<? extends GuiContainer>) Class.forName("com.xcompwiz.mystcraft.client.gui.GuiInkMixer");
        }
        catch (Exception ex) {
            Objects.log.log(Level.SEVERE, "Failed getting GUI classes", ex);
        }
        catch (Error ex) {
            Objects.log.log(Level.SEVERE, "Failed getting GUI classes, you don't need to report this as I'll probably already know about this", ex);
        }
    }


Input:
  private InferredPath traverseEdge(
    EdgeTransitionDistributions edgeTransDist,
    final MultivariateGaussian belief, PathEdge startEdge,
    StandardRoadTrackingFilter movementFilter) {
    rng.setSeed(this.localSeed);
    PathEdge currentEdge = startEdge;
    PathEdge previousEdge = null;
    final MultivariateGaussian newBelief = belief.clone();
    final List<PathEdge> currentPath = Lists.newArrayList();
    double distTraveled = 0d;
    Double totalDistToTravel = null;
    while (totalDistToTravel == null ||
        Math.abs(totalDistToTravel) > Math.abs(distTraveled)) {
      final List<InferredEdge> transferEdges = Lists.newArrayList();
      if (currentEdge.getInferredEdge() == InferredEdge
          .getEmptyEdge()) {
        final Vector projLocation =
            StandardRoadTrackingFilter.getOg().times(
                newBelief.getMean());
        for (final StreetEdge edge : this.inferredGraph
            .getNearbyEdges(projLocation,
                movementFilter.getObservationErrorAbsRadius())) {
          transferEdges.add(this.inferredGraph.getInferredEdge(edge));
        }
      } else {
        if (totalDistToTravel == null) {
          transferEdges.add(startEdge.getInferredEdge());
        } else {
          if (newBelief.getMean().getElement(0) < 0d) {
            transferEdges.addAll(currentEdge.getInferredEdge()
                .getIncomingTransferableEdges());
          } else if (newBelief.getMean().getElement(0) > 0d) {
            transferEdges.addAll(currentEdge.getInferredEdge()
                .getOutgoingTransferableEdges());
          } else {
            transferEdges.addAll(currentEdge.getInferredEdge()
                .getIncomingTransferableEdges());
            transferEdges.addAll(currentEdge.getInferredEdge()
                .getOutgoingTransferableEdges());
          }
          transferEdges.remove(currentEdge.getInferredEdge());
        }
      }
      final InferredEdge sampledEdge =
          edgeTransDist.sample(rng, transferEdges,
              currentEdge == null ? startEdge.getInferredEdge()
                  : currentEdge.getInferredEdge());
      if (sampledEdge == InferredEdge.getEmptyEdge()) {
        if (totalDistToTravel == null) {
          movementFilter.predict(newBelief,
              PathEdge.getEmptyPathEdge(), startEdge);
        } else {
          StandardRoadTrackingFilter.convertToGroundBelief(newBelief,
              currentEdge, true);
        }
        currentEdge = PathEdge.getEmptyPathEdge();
        currentPath.add(PathEdge.getEmptyPathEdge());
        break;
      }
      double direction =
          newBelief.getMean().getElement(0) >= 0d ? 1d : -1d;
      final PathEdge sampledPathEdge =
          PathEdge.getEdge(sampledEdge, previousEdge == null
              || previousEdge.isEmptyEdge() ? 0d : direction
              * previousEdge.getInferredEdge().getLength()
              + previousEdge.getDistToStartOfEdge());
      if (sampledPathEdge == null) {
        newBelief.getMean().setElement(0,
            direction * currentEdge.getInferredEdge().getLength());
        newBelief.getMean().setElement(1, 0d);
        break;
      }
      if (totalDistToTravel == null) {
        final PathEdge initialEdge =
            startEdge.isEmptyEdge() ? sampledPathEdge : startEdge;
        currentEdge = initialEdge;
        if (newBelief.getInputDimensionality() == 4) {
          StandardRoadTrackingFilter.convertToRoadBelief(newBelief,
              InferredPath.getInferredPath(initialEdge));
        }
        double previousLocation = newBelief.getMean().getElement(0);
        movementFilter.predict(newBelief, initialEdge, initialEdge);
        final Vector transStateSample =
            StandardRoadTrackingFilter.sampleMovementBelief(rng,
                newBelief.getMean(), movementFilter);
        newBelief.setMean(transStateSample);
        totalDistToTravel =
            newBelief.getMean().getElement(0) - previousLocation;
        double newLocation = newBelief.getMean().getElement(0);
        final double L = initialEdge.getInferredEdge().getLength();
        if (newLocation < 0d && previousLocation > 0d) {
          previousLocation = -L + previousLocation;
          newLocation = previousLocation + totalDistToTravel;
          newBelief.getMean().setElement(0, newLocation);
        } else if (newLocation >= 0d && previousLocation < 0d) {
          previousLocation = L + previousLocation;
          newLocation = previousLocation + totalDistToTravel;
          newBelief.getMean().setElement(0, newLocation);
        }
        direction = totalDistToTravel >= 0d ? 1d : -1d;
        if (L < Math.abs(newLocation)) {
          final double r = L - Math.abs(previousLocation);
          distTraveled += r * direction;
        } else {
          distTraveled += totalDistToTravel;
        }
      } else {
        distTraveled +=
            direction * sampledPathEdge.getInferredEdge().getLength();
        currentEdge = sampledPathEdge;
      }
      previousEdge = currentEdge;
      currentPath.add(currentEdge);
    }
    if(!Iterables.getLast(currentPath).isEmptyEdge() &&
          !Iterables.getLast(currentPath).isOnEdge(newBelief.getMean().getElement(0))) {
      Iterables.getLast(currentPath).isOnEdge(newBelief.getMean().getElement(0));
    }
    assert (Iterables.getLast(currentPath).isEmptyEdge() || Iterables
        .getLast(currentPath).isOnEdge(
            newBelief.getMean().getElement(0)));
    belief.setMean(newBelief.getMean());
    belief.setCovariance(newBelief.getCovariance());
    return InferredPath.getInferredPath(currentPath,
        (totalDistToTravel != null && totalDistToTravel < 0d) ? true
            : false);
  }

Output:
  private InferredPath traverseEdge(
    EdgeTransitionDistributions edgeTransDist,
    final MultivariateGaussian belief, PathEdge startEdge,
    StandardRoadTrackingFilter movementFilter) {
    rng.setSeed(this.localSeed);
    PathEdge currentEdge = startEdge;
    PathEdge previousEdge = null;
    final MultivariateGaussian newBelief = belief.clone();
    final List<PathEdge> currentPath = Lists.newArrayList();
    double distTraveled = 0d;
    Double totalDistToTravel = null;
    while (totalDistToTravel == null ||
        Math.abs(totalDistToTravel) > Math.abs(distTraveled)) {
      final List<InferredEdge> transferEdges = Lists.newArrayList();
      if (currentEdge.getInferredEdge() == InferredEdge
          .getEmptyEdge()) {
        final Vector projLocation =
            StandardRoadTrackingFilter.getOg().times(
                newBelief.getMean());
        for (final StreetEdge edge : this.inferredGraph
            .getNearbyEdges(projLocation,
                movementFilter.getObservationErrorAbsRadius())) {
          transferEdges.add(this.inferredGraph.getInferredEdge(edge));
        }
      } else {
        if (totalDistToTravel == null) {
          transferEdges.add(startEdge.getInferredEdge());
        } else {
          if (newBelief.getMean().getElement(0) < 0d) {
            transferEdges.addAll(currentEdge.getInferredEdge()
                .getIncomingTransferableEdges());
          } else if (newBelief.getMean().getElement(0) > 0d) {
            transferEdges.addAll(currentEdge.getInferredEdge()
                .getOutgoingTransferableEdges());
          } else {
            transferEdges.addAll(currentEdge.getInferredEdge()
                .getIncomingTransferableEdges());
            transferEdges.addAll(currentEdge.getInferredEdge()
                .getOutgoingTransferableEdges());
          }
          transferEdges.remove(currentEdge.getInferredEdge());
        }
      }
      final InferredEdge sampledEdge =
          edgeTransDist.sample(rng, transferEdges,
              currentEdge == null ? startEdge.getInferredEdge()
                  : currentEdge.getInferredEdge());
      if (sampledEdge == InferredEdge.getEmptyEdge()) {
        if (totalDistToTravel == null) {
          movementFilter.predict(newBelief,
              PathEdge.getEmptyPathEdge(), startEdge);
        } else {
          StandardRoadTrackingFilter.convertToGroundBelief(newBelief,
              currentEdge, true);
        }
        currentEdge = PathEdge.getEmptyPathEdge();
        currentPath.add(PathEdge.getEmptyPathEdge());
        break;
      }
      double direction =
          newBelief.getMean().getElement(0) >= 0d ? 1d : -1d;
      final PathEdge sampledPathEdge =
          PathEdge.getEdge(sampledEdge, previousEdge == null
              || previousEdge.isEmptyEdge() ? 0d : direction
              * previousEdge.getInferredEdge().getLength()
              + previousEdge.getDistToStartOfEdge(), direction < 0d);
      if (sampledPathEdge == null) {
        newBelief.getMean().setElement(0,
            direction * currentEdge.getInferredEdge().getLength());
        newBelief.getMean().setElement(1, 0d);
        break;
      }
      if (totalDistToTravel == null) {
        final PathEdge initialEdge =
            startEdge.isEmptyEdge() ? sampledPathEdge : startEdge;
        currentEdge = initialEdge;
        if (newBelief.getInputDimensionality() == 4) {
          StandardRoadTrackingFilter.convertToRoadBelief(newBelief,
              InferredPath.getInferredPath(initialEdge));
        }
        double previousLocation = newBelief.getMean().getElement(0);
        movementFilter.predict(newBelief, initialEdge, initialEdge);
        final Vector transStateSample =
            StandardRoadTrackingFilter.sampleMovementBelief(rng,
                newBelief.getMean(), movementFilter);
        newBelief.setMean(transStateSample);
        totalDistToTravel =
            newBelief.getMean().getElement(0) - previousLocation;
        double newLocation = newBelief.getMean().getElement(0);
        final double L = initialEdge.getInferredEdge().getLength();
        if (newLocation < 0d && previousLocation > 0d) {
          previousLocation = -L + previousLocation;
          newLocation = previousLocation + totalDistToTravel;
          newBelief.getMean().setElement(0, newLocation);
        } else if (newLocation >= 0d && previousLocation < 0d) {
          previousLocation = L + previousLocation;
          newLocation = previousLocation + totalDistToTravel;
          newBelief.getMean().setElement(0, newLocation);
        }
        direction = totalDistToTravel >= 0d ? 1d : -1d;
        if (L < Math.abs(newLocation)) {
          final double r = L - Math.abs(previousLocation);
          distTraveled += r * direction;
        } else {
          distTraveled += totalDistToTravel;
        }
      } else {
        distTraveled +=
            direction * sampledPathEdge.getInferredEdge().getLength();
        currentEdge = sampledPathEdge;
      }
      previousEdge = currentEdge;
      currentPath.add(currentEdge);
    }
    assert (Iterables.getLast(currentPath).isEmptyEdge() || Iterables
        .getLast(currentPath).isOnEdge(
            newBelief.getMean().getElement(0)));
    belief.setMean(newBelief.getMean());
    belief.setCovariance(newBelief.getCovariance());
    return InferredPath.getInferredPath(currentPath,
        (totalDistToTravel != null && totalDistToTravel < 0d) ? true
            : false);
  }


Input:
    public Set<Declared> getUnusedImports() {
        Set<Declared> unused = new HashSet<Declared>();
        for(Declared declared : declaredImports) {
            if (declared.importName.endsWith(".*")) {
                int imprtLen = declared.importName.length() - 1;
                String target = declared.importName.substring(0, imprtLen);
                boolean found = false;
                for(String imprt : usedImports) {
                    if (imprt.length() > imprtLen) {
                        if (imprt.indexOf(".", imprtLen + 1) > -1)  continue;
                        if (imprt.substring(0, imprtLen).equals(target)) {
                            found = true;
                            break;
                        }
                    }
                }
                if (!found) {
                    unused.add(declared);
                }
            } else {
                if (!usedImports.contains(declared.importName)) {
                    unused.add(declared);
                }
            }
        }
        return unused;
    }

Output:
    public Set<Declared> getUnusedImports() {
        Set<Declared> unused = new HashSet<Declared>();
        for(Declared declared : declaredImports) {
            if (declared.importName.endsWith(".*")) {
                int imprtLen = declared.importName.length() - 2;
                String target = declared.importName.substring(0, imprtLen);
                boolean found = false;
                for(String imprt : usedImports) {
                    if (imprt.length() > imprtLen) {
                        if (imprt.indexOf(".", imprtLen + 2) > -1)  continue;
                        if (imprt.substring(0, imprtLen).equals(target)) {
                            found = true;
                            break;
                        }
                    } else {
                        if (imprt.length() == imprtLen && target.equals(imprt)) {
                            found = true;
                            break;
                        }
                    }
                }
                if (!found) {
                    unused.add(declared);
                }
            } else {
                if (!usedImports.contains(declared.importName)) {
                    unused.add(declared);
                }
            }
        }
        return unused;
    }


Input:
	public ItemStack onEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
    {
        if (!par2World.isRemote)
        {
            if(par1ItemStack.getItemDamage() == 2)
            	TFC_Core.getPlayerFoodStats(par3EntityPlayer).restoreWater(par3EntityPlayer, 8000);
            if (par1ItemStack.getItemDamage() > 1)
            {
            	if(par2World.rand.nextInt(25) == 0)
            		par1ItemStack = null;
            	else
            	{
            		par1ItemStack.setItemDamage(1);
            	}
            }
        }
        return par1ItemStack;
    }

Output:
	public ItemStack onEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
    {
        if (!par2World.isRemote)
        {
            if(par1ItemStack.getItemDamage() == 2)
            	TFC_Core.getPlayerFoodStats(par3EntityPlayer).restoreWater(par3EntityPlayer, 8000);
            if (par1ItemStack.getItemDamage() > 1)
            {
            	if(par2World.rand.nextInt(25) == 0)
            		par1ItemStack.stackSize--;
            	else
            	{
            		par1ItemStack.setItemDamage(1);
            	}
            }
        }
        return par1ItemStack;
    }


Input:
	public void process(MApplication application, EModelService modelService) {
		MCommand command = null;
		for (MCommand cmd : application.getCommands()) {
			if (E4_TOOLING_LIVEMODEL.equals(cmd.getElementId())) {
				command = cmd;
			}
		}
		if (command == null) {
			command = modelService.createModelElement(MCommand.class);
			command.setElementId(E4_TOOLING_LIVEMODEL);
			command.setCommandName("Show running app model");
			command.setDescription("Show the running application model");
			application.getCommands().add(command);
		}
		MHandler handler = null;
		for (MHandler hdl : application.getHandlers()) {
			if (E4_TOOLING_LIVEMODEL_HANDLER.equals(hdl.getElementId())) {
				handler = hdl;
			}
		}
		if (handler == null) {
			handler = modelService.createModelElement(MHandler.class);
			handler.setElementId(E4_TOOLING_LIVEMODEL_HANDLER);
			handler.setContributionURI("bundleclass://org.eclipse.e4.tools.emf.liveeditor/org.eclipse.e4.tools.emf.liveeditor.OpenLiveDialogHandler");
			application.getHandlers().add(handler);
		}
		handler.setCommand(command);
		MKeyBinding binding = null;
		if (application.getBindingTables().size() <= 0) {
			MBindingContext bc = null;
			final List<MBindingContext> bindingContexts = application
					.getBindingContexts();
			if (bindingContexts.size() == 0) {
				bc = modelService.createModelElement(MBindingContext.class);
				bc.setElementId("org.eclipse.ui.contexts.window");
			} else {
				for (MBindingContext aBindingContext : bindingContexts) {
					bc = aBindingContext;
					if ("org.eclipse.ui.contexts.dialogAndWindow"
							.equals(aBindingContext.getElementId())) {
						break;
					}
				}
			}
			MBindingTable bt = modelService
					.createModelElement(MBindingTable.class);
			bt.setElementId("e4.tooling.livemodel.bindingTable");
			bt.setBindingContext(bc);
			application.getBindingTables().add(bt);
		}
		List<MKeyBinding> keyBindings = modelService.findElements(application,
				"e4.tooling.livemodel.binding", MKeyBinding.class, null);
		if (keyBindings.size() == 0) {
			binding = modelService.createModelElement(MKeyBinding.class);
			binding.setElementId("e4.tooling.livemodel.binding");
			binding.setKeySequence("M2+M3+F9");
			if (application.getBindingTables().size() > 0) {
				application.getBindingTables().get(0).getBindings()
						.add(binding);
			}
		} else {
			binding = keyBindings.get(0);
		}
		binding.setCommand(command);
		MPartDescriptor descriptor = null;
		List<MPartDescriptor> descriptors = modelService.findElements(
				application, "org.eclipse.e4.tools.emf.liveeditor.view",
				MPartDescriptor.class, null);
		if (descriptors.size() == 0) {
			descriptor = modelService.createModelElement(MPartDescriptor.class);
			descriptor.setCategory("org.eclipse.e4.secondaryDataStack");
			descriptor.setElementId("org.eclipse.e4.tools.emf.liveeditor.view");
			descriptor.getTags().add("View");
			descriptor.getTags().add("categoryTag:General");
			descriptor.setLabel("Live Application Model");
			descriptor
					.setContributionURI("bundleclass://org.eclipse.e4.tools.emf.liveeditor/org.eclipse.e4.tools.emf.liveeditor.LivePartDelegator");
			descriptor
					.setContributorURI("bundleclass://org.eclipse.e4.tools.emf.liveeditor");
			descriptor
					.setIconURI("platform:/plugin/org.eclipse.e4.tools.emf.liveeditor/icons/full/obj16/application_lightning.png");
			application.getDescriptors().add(descriptor);
		}
	}

Output:
	public void process(MApplication application, EModelService modelService) {
		MCommand command = null;
		for (MCommand cmd : application.getCommands()) {
			if (E4_TOOLING_LIVEMODEL.equals(cmd.getElementId())) {
				command = cmd;
			}
		}
		if (command == null) {
			command = modelService.createModelElement(MCommand.class);
			command.setElementId(E4_TOOLING_LIVEMODEL);
			command.setCommandName("Show Live Application Model");
			command.setDescription("Show the running application model");
			application.getCommands().add(command);
		}
		MHandler handler = null;
		for (MHandler hdl : application.getHandlers()) {
			if (E4_TOOLING_LIVEMODEL_HANDLER.equals(hdl.getElementId())) {
				handler = hdl;
			}
		}
		if (handler == null) {
			handler = modelService.createModelElement(MHandler.class);
			handler.setElementId(E4_TOOLING_LIVEMODEL_HANDLER);
			handler.setContributionURI("bundleclass://org.eclipse.e4.tools.emf.liveeditor/org.eclipse.e4.tools.emf.liveeditor.OpenLiveDialogHandler");
			application.getHandlers().add(handler);
		}
		handler.setCommand(command);
		MKeyBinding binding = null;
		if (application.getBindingTables().size() <= 0) {
			MBindingContext bc = null;
			final List<MBindingContext> bindingContexts = application
					.getBindingContexts();
			if (bindingContexts.size() == 0) {
				bc = modelService.createModelElement(MBindingContext.class);
				bc.setElementId("org.eclipse.ui.contexts.window");
			} else {
				for (MBindingContext aBindingContext : bindingContexts) {
					bc = aBindingContext;
					if ("org.eclipse.ui.contexts.dialogAndWindow"
							.equals(aBindingContext.getElementId())) {
						break;
					}
				}
			}
			MBindingTable bt = modelService
					.createModelElement(MBindingTable.class);
			bt.setElementId("e4.tooling.livemodel.bindingTable");
			bt.setBindingContext(bc);
			application.getBindingTables().add(bt);
		}
		List<MKeyBinding> keyBindings = modelService.findElements(application,
				"e4.tooling.livemodel.binding", MKeyBinding.class, null);
		if (keyBindings.size() == 0) {
			binding = modelService.createModelElement(MKeyBinding.class);
			binding.setElementId("e4.tooling.livemodel.binding");
			binding.setKeySequence("M2+M3+F9");
			if (application.getBindingTables().size() > 0) {
				application.getBindingTables().get(0).getBindings()
						.add(binding);
			}
		} else {
			binding = keyBindings.get(0);
		}
		binding.setCommand(command);
		MPartDescriptor descriptor = null;
		List<MPartDescriptor> descriptors = modelService.findElements(
				application, "org.eclipse.e4.tools.emf.liveeditor.view",
				MPartDescriptor.class, null);
		if (descriptors.size() == 0) {
			descriptor = modelService.createModelElement(MPartDescriptor.class);
			descriptor.setCategory("org.eclipse.e4.secondaryDataStack");
			descriptor.setElementId("org.eclipse.e4.tools.emf.liveeditor.view");
			descriptor.getTags().add("View");
			descriptor.getTags().add("categoryTag:General");
			descriptor.setLabel("Live Application Model");
			descriptor
					.setContributionURI("bundleclass://org.eclipse.e4.tools.emf.liveeditor/org.eclipse.e4.tools.emf.liveeditor.LivePartDelegator");
			descriptor
					.setContributorURI("bundleclass://org.eclipse.e4.tools.emf.liveeditor");
			descriptor
					.setIconURI("platform:/plugin/org.eclipse.e4.tools.emf.liveeditor/icons/full/obj16/application_lightning.png");
			application.getDescriptors().add(descriptor);
		}
	}


Input:
	public void onPlayerMove(PlayerMoveEvent event)
	{
		Player player = event.getPlayer();
		Vector vector = player.getVelocity();
		Block blockTo = event.getTo().getBlock();
		Region regionTo = RegionManager.getRegion(event.getTo());
		Region regionFrom = RegionManager.getRegion(event.getFrom());
		PortalManager.checkPlayerMove(player, regionFrom, regionTo);
		if (blockTo.getType() == Material.SUGAR_CANE_BLOCK && regionTo.getBoolean(RegionSetting.ENABLE_GRILLS))
		{
			for (Grill grill: GrillManager.grills)
			{
				if (grill.getInside().contains(blockTo))
				{
					GrillManager.emancipate(player);
				}
			}
		}
		if (player.isInsideVehicle()) return;
		if (!Permission.teleport(player)) return;
		double addX = 0.0;
		double addY = 0.0;
		double addZ = 0.0;
		if (Math.abs(vector.getX()) > 1)
		{
			addX += 3.0;
			addY += 2.0;
			addZ += 2.0;
		}
		if (Math.abs(vector.getZ()) > 1)
		{
			addX += 2.0;
			addY += 2.0;
			addZ += 3.0;
		}
		if (Math.abs(vector.getY()) > 1)
		{
			addX += 2.0;
			addY += 3.0;
			addZ += 2.0;
		}
		Portal portal = null;
		for (Portal p : PortalManager.portals)
		{
			for (Block b : p.getInside())
			{
				if (offsetequals(b.getLocation().getX(), blockTo.getX(),addX) && offsetequals(b.getLocation().getZ(), blockTo.getZ(), addZ) && offsetequals(b.getLocation().getY(), blockTo.getY(),addY))
				{
					portal = p;
					break;
				}
			}
		}
		if (portal != null)
		{
			if (!portal.isOpen() || portal.isDisabled()) return;
			User owner = portal.getOwner();
			Location teleport;
			Portal destination;
			if (portal.isOrange())
				destination = owner.getBluePortal();
			else
				destination = owner.getOrangePortal();
			teleport = destination.getTeleportLocation().clone();
			float yaw = 0;
			float pitch = 0;
			Double momentum = 0.0;
			switch(portal.getTeleportFace())
	        {
	        	case NORTH:
	        	case SOUTH:
	        		momentum = vector.getX();
	        		break;
	        	case EAST:
	        	case WEST:
	        		momentum = vector.getZ();
	        		break;
	        	case UP:
	        	case DOWN:
	        		momentum = vector.getY();
	        		break;
	        }
			momentum = Math.abs(momentum);
			momentum = momentum * regionTo.getDouble(RegionSetting.VELOCITY_MULTIPLIER);
			Vector outvector = player.getVelocity().zero();
			switch(destination.getTeleportFace())
	        {
	        	case NORTH:
	        		yaw = 270;
	        		outvector = outvector.setX(momentum);
	        		break;
	        	case EAST:
	        		yaw = 0;
	        		outvector = outvector.setZ(momentum);
	        		break;
	        	case SOUTH:
	        		yaw = 90;
	        		outvector = outvector.setX(-momentum);
	        		break;
	        	case WEST:
	        		yaw = 180;
	        		outvector = outvector.setZ(-momentum);
	        		break;
	        	case UP:
	        		pitch = 90;
	        		outvector = outvector.setY(momentum);
	        		break;
	        	case DOWN:
	        		pitch = -90;
	        		outvector = outvector.setY(-momentum);
	        		break;
	        }
			player.setFallDistance(0);
			player.setVelocity(player.getVelocity().zero());
			teleport.setPitch(pitch);
			teleport.setYaw(yaw);
			event.setTo(teleport);
			player.teleport(teleport);
			player.setVelocity(outvector);
			destination.setDisabled(true);
			plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new EnablePortal(destination), 10L);
		}
	}

Output:
	public void onPlayerMove(PlayerMoveEvent event)
	{
		Player player = event.getPlayer();
		Vector vector = player.getVelocity();
		Block blockTo = event.getTo().getBlock();
		Region regionTo = RegionManager.getRegion(event.getTo());
		Region regionFrom = RegionManager.getRegion(event.getFrom());
		PortalManager.checkPlayerMove(player, regionFrom, regionTo);
		if (blockTo.getType() == Material.SUGAR_CANE_BLOCK && regionTo.getBoolean(RegionSetting.ENABLE_GRILLS))
		{
			for (Grill grill: GrillManager.grills)
			{
				if (grill.getInside().contains(blockTo))
				{
					GrillManager.emancipate(player);
				}
			}
		}
		if (player.isInsideVehicle()) return;
		if (!Permission.teleport(player)) return;
		double addX = 0.0;
		double addY = 0.0;
		double addZ = 0.0;
		if (Math.abs(vector.getX()) > 1)
		{
			addX += 3.0;
			addY += 2.0;
			addZ += 2.0;
		}
		if (Math.abs(vector.getZ()) > 1)
		{
			addX += 2.0;
			addY += 2.0;
			addZ += 3.0;
		}
		if (Math.abs(vector.getY()) > 1)
		{
			addX += 2.0;
			addY += 3.0;
			addZ += 2.0;
		}
		Portal portal = null;
		for (Portal p : PortalManager.portals)
		{
			for (Block b : p.getInside())
			{
				if (offsetequals(b.getLocation().getX(), blockTo.getX(),addX) && offsetequals(b.getLocation().getZ(), blockTo.getZ(), addZ) && offsetequals(b.getLocation().getY(), blockTo.getY(),addY))
				{
					portal = p;
					break;
				}
			}
		}
		if (portal != null)
		{
			if (!portal.isOpen() || portal.isDisabled()) return;
			if (Math.abs(vector.getY()) > 1 && !portal.isVertical()) return;
			User owner = portal.getOwner();
			Location teleport;
			Portal destination;
			if (portal.isOrange())
				destination = owner.getBluePortal();
			else
				destination = owner.getOrangePortal();
			teleport = destination.getTeleportLocation().clone();
			float yaw = 0;
			float pitch = 0;
			Double momentum = 0.0;
			switch(portal.getTeleportFace())
	        {
	        	case NORTH:
	        	case SOUTH:
	        		momentum = vector.getX();
	        		break;
	        	case EAST:
	        	case WEST:
	        		momentum = vector.getZ();
	        		break;
	        	case UP:
	        	case DOWN:
	        		momentum = vector.getY();
	        		break;
	        }
			momentum = Math.abs(momentum);
			momentum = momentum * regionTo.getDouble(RegionSetting.VELOCITY_MULTIPLIER);
			Vector outvector = player.getVelocity().zero();
			switch(destination.getTeleportFace())
	        {
	        	case NORTH:
	        		yaw = 270;
	        		outvector = outvector.setX(momentum);
	        		break;
	        	case EAST:
	        		yaw = 0;
	        		outvector = outvector.setZ(momentum);
	        		break;
	        	case SOUTH:
	        		yaw = 90;
	        		outvector = outvector.setX(-momentum);
	        		break;
	        	case WEST:
	        		yaw = 180;
	        		outvector = outvector.setZ(-momentum);
	        		break;
	        	case UP:
	        		pitch = 90;
	        		outvector = outvector.setY(momentum);
	        		break;
	        	case DOWN:
	        		pitch = -90;
	        		outvector = outvector.setY(-momentum);
	        		break;
	        }
			player.setFallDistance(0);
			player.setVelocity(player.getVelocity().zero());
			teleport.setPitch(pitch);
			teleport.setYaw(yaw);
			event.setTo(teleport);
			player.teleport(teleport);
			player.setVelocity(outvector);
			destination.setDisabled(true);
			plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new EnablePortal(destination), 10L);
		}
	}


Input:
  public void loadPartOk() throws IOException {
    final Part part = new Part( sections1File ) ;
    final Tree partTree = part.getTree();
    Assert.assertNotNull( partTree ) ;
    final Tree expected = tree( PART,
        tree( SECTION,
            tree( IDENTIFIER, tree( WORD, "Section1nlp" ) ),
            tree( PARAGRAPH_PLAIN, tree( WORD, "p00" ), tree( WORD, "w001" ) )
        ),
        tree( SECTION,
            tree( TITLE, tree( WORD, "section1" ), tree( WORD, "w11" ) ),
            tree( PARAGRAPH_PLAIN,
                tree( WORD, "p10" ),
                tree( WORD, "w101" ),
                tree( WORD, "w102" )
            )
        )
    ) ;
    TreeHelper.assertEquals( expected, partTree ) ;
    Assert.assertFalse( part.getProblems().iterator().hasNext() ) ;
  }

Output:
  public void loadPartOk() throws IOException {
    final Part part = new Part( sections1File ) ;
    final Tree partTree = part.getTree();
    Assert.assertNotNull( partTree ) ;
    final Tree expected = tree( PART,
        tree( SECTION, tree( IDENTIFIER, tree( WORD, "Section1nlp" ) ) ),
        tree( PARAGRAPH_PLAIN, tree( WORD, "p00" ), tree( WORD, "w001" ) ),
        tree( SECTION, tree( TITLE, tree( WORD, "section1" ), tree( WORD, "w11" ) ) ),
        tree( PARAGRAPH_PLAIN, tree( WORD, "p10" ), tree( WORD, "w101" ), tree( WORD, "w102" ) )
    ) ;
    TreeHelper.assertEquals( expected, partTree ) ;
    Assert.assertFalse( part.getProblems().iterator().hasNext() ) ;
  }


Input:
	public synchronized RoutingEntry getBestEntry(HRMID pDestination, int pDesiredMaxDelay, int pDesiredMinDataRate)
	{
		RoutingEntry tResult = null;
		RoutingEntry tBestResultHopCount = null;
		RoutingEntry tBestResultQoS = null;
		boolean DEBUG = HRMConfig.DebugOutput.GUI_SHOW_ROUTING;
		Logging.log(this, "### Searching for best routing table entry towards: " + pDestination +", desired max. delay=" + pDesiredMaxDelay + ", desired min. data rate=" + pDesiredMinDataRate);
		if(size() > 0){
			for(RoutingEntry tEntry : this){
				if(pDestination.isCluster(tEntry.getDest())){
					if(tBestResultHopCount != null){
						if(
						  (tBestResultHopCount.getHopCount() > tEntry.getHopCount()) ||
						  (
							  (tBestResultHopCount.getHopCount() == tEntry.getHopCount()) &&
							  (
						          (tBestResultHopCount.getMaxAvailableDataRate() < tEntry.getMaxAvailableDataRate()) ||
								  (
								      (tBestResultHopCount.getMaxAvailableDataRate() == tEntry.getMaxAvailableDataRate()) && (tBestResultHopCount.getMinDelay() > tEntry.getMinDelay())
								  )
							  )
						  )
						  ){
							if (DEBUG){
								Logging.log(this, "      ..found better (BE) entry: " + tEntry);
							}
							tBestResultHopCount = tEntry.clone();
						}else{
							if (DEBUG){
								Logging.log(this, "      ..found uninteresting (BE) entry: " + tEntry);
							}
						}
					}else{
						if (DEBUG){
							Logging.log(this, "      ..found first matching (BE) entry: " + tEntry);
						}
						tBestResultHopCount = tEntry.clone();
					}
					if (((pDesiredMaxDelay > 0) && (pDesiredMaxDelay >= tEntry.getMinDelay()) || (pDesiredMaxDelay <= 0)) &&
					   ((pDesiredMinDataRate > 0) && (pDesiredMinDataRate <= tEntry.getMaxAvailableDataRate())) || (pDesiredMinDataRate <= 0)){
						if(tBestResultQoS != null){
							if(
							  ( (pDesiredMinDataRate > 0) &&
							  ( (tBestResultQoS.getMaxAvailableDataRate() < tEntry.getMaxAvailableDataRate()) ||
							  ( (tBestResultQoS.getMaxAvailableDataRate() == tEntry.getMaxAvailableDataRate()) && (pDesiredMaxDelay <= 0) && (tBestResultQoS.getHopCount() > tEntry.getHopCount()) ) ) ) ||
							  ( (pDesiredMaxDelay > 0) && ( (pDesiredMinDataRate <= 0) || (tBestResultQoS.getMaxAvailableDataRate() == tEntry.getMaxAvailableDataRate()) ) &&
							  ( (tBestResultQoS.getMinDelay() > tEntry.getMinDelay()) ||
							  ( (tBestResultQoS.getMinDelay() == tEntry.getMinDelay()) && (tBestResultQoS.getHopCount() > tEntry.getHopCount()) ) ) )
							  ){
								if (DEBUG){
									Logging.log(this, "      ..found better (QoS) entry: " + tEntry);
								}
								tBestResultQoS = tEntry.clone();
							}else{
								if (DEBUG){
									Logging.log(this, "      ..found uninteresting (QoS) entry: " + tEntry);
								}
							}
						}else{
							if (DEBUG){
								Logging.log(this, "      ..found first matching (QoS) entry: " + tEntry);
							}
							tBestResultQoS = tEntry.clone();
						}
					}
				}else{
					if (DEBUG){
						Logging.log(this, "      ..ignoring entry: " + tEntry);
					}
				}
			}
			tResult = tBestResultHopCount;
			if((pDesiredMinDataRate > 0) || (pDesiredMaxDelay > 0)) {
				if(tBestResultQoS != null){
					tResult = tBestResultQoS;
				}
			}
		}else{
			if (DEBUG){
				Logging.log(this, "      ..found empty routing table");
			}
		}
		Logging.log(this, "### BEST ROUTE is: " + tResult);
		return tResult;
	}

Output:
	public synchronized RoutingEntry getBestEntry(HRMID pDestination, int pDesiredMaxDelay, int pDesiredMinDataRate)
	{
		RoutingEntry tResult = null;
		RoutingEntry tBestResultHopCount = null;
		RoutingEntry tBestResultQoS = null;
		boolean DEBUG = HRMConfig.DebugOutput.GUI_SHOW_ROUTING;
		if (DEBUG){
			Logging.log(this, "### Searching for best routing table entry towards: " + pDestination +", desired max. delay=" + pDesiredMaxDelay + ", desired min. data rate=" + pDesiredMinDataRate);
		}
		if(size() > 0){
			for(RoutingEntry tEntry : this){
				if(pDestination.isCluster(tEntry.getDest())){
					if(tBestResultHopCount != null){
						if(
						  (tBestResultHopCount.getHopCount() > tEntry.getHopCount()) ||
						  (
							  (tBestResultHopCount.getHopCount() == tEntry.getHopCount()) &&
							  (
						          (tBestResultHopCount.getMaxAvailableDataRate() < tEntry.getMaxAvailableDataRate()) ||
								  (
								      (tBestResultHopCount.getMaxAvailableDataRate() == tEntry.getMaxAvailableDataRate()) && (tBestResultHopCount.getMinDelay() > tEntry.getMinDelay())
								  )
							  )
						  )
						  ){
							if (DEBUG){
								Logging.log(this, "      ..found better (BE) entry: " + tEntry);
							}
							tBestResultHopCount = tEntry.clone();
						}else{
							if (DEBUG){
								Logging.log(this, "      ..found uninteresting (BE) entry: " + tEntry);
							}
						}
					}else{
						if (DEBUG){
							Logging.log(this, "      ..found first matching (BE) entry: " + tEntry);
						}
						tBestResultHopCount = tEntry.clone();
					}
					if (((pDesiredMaxDelay > 0) && (pDesiredMaxDelay >= tEntry.getMinDelay()) || (pDesiredMaxDelay <= 0)) &&
					   ((pDesiredMinDataRate > 0) && (pDesiredMinDataRate <= tEntry.getMaxAvailableDataRate())) || (pDesiredMinDataRate <= 0)){
						if(tBestResultQoS != null){
							if(
							  ( (pDesiredMinDataRate > 0) &&
							  ( (tBestResultQoS.getMaxAvailableDataRate() < tEntry.getMaxAvailableDataRate()) ||
							  ( (tBestResultQoS.getMaxAvailableDataRate() == tEntry.getMaxAvailableDataRate()) && (pDesiredMaxDelay <= 0) && (tBestResultQoS.getHopCount() > tEntry.getHopCount()) ) ) ) ||
							  ( (pDesiredMaxDelay > 0) && ( (pDesiredMinDataRate <= 0) || (tBestResultQoS.getMaxAvailableDataRate() == tEntry.getMaxAvailableDataRate()) ) &&
							  ( (tBestResultQoS.getMinDelay() > tEntry.getMinDelay()) ||
							  ( (tBestResultQoS.getMinDelay() == tEntry.getMinDelay()) && (tBestResultQoS.getHopCount() > tEntry.getHopCount()) ) ) )
							  ){
								if (DEBUG){
									Logging.log(this, "      ..found better (QoS) entry: " + tEntry);
								}
								tBestResultQoS = tEntry.clone();
							}else{
								if (DEBUG){
									Logging.log(this, "      ..found uninteresting (QoS) entry: " + tEntry);
								}
							}
						}else{
							if (DEBUG){
								Logging.log(this, "      ..found first matching (QoS) entry: " + tEntry);
							}
							tBestResultQoS = tEntry.clone();
						}
					}
				}else{
					if (DEBUG){
						Logging.log(this, "      ..ignoring entry: " + tEntry);
					}
				}
			}
			tResult = tBestResultHopCount;
			if((pDesiredMinDataRate > 0) || (pDesiredMaxDelay > 0)) {
				if(tBestResultQoS != null){
					tResult = tBestResultQoS;
				}
			}
		}else{
			if (DEBUG){
				Logging.log(this, "      ..found empty routing table");
			}
		}
		if (DEBUG){
			Logging.log(this, "### BEST ROUTE is: " + tResult);
		}
		return tResult;
	}


Input:
	private void fillData()
	{
		String[] from = new String[] { HomeworkTable.COLUMN_NAME, HomeworkTable.COLUMN_DATE, HomeworkTable.COLUMN_DESCRIPTION };
		int[] to = new int[] { R.id.hwName, R.id.date, R.id.descrption };
		getLoaderManager().initLoader( 0, null, this );
		this.adapter = new SimpleCursorAdapter( this, R.layout.list_row, null, from, to, 0 ){
			@Override
		    public View getView(int position, View convertView, ViewGroup parent) {
				 View v = super.getView(position, convertView, parent);
			        if (position %2 ==1) {
			            v.setBackgroundColor(Color.argb(TRIM_MEMORY_MODERATE, 100, 100, 100));
			        } else {
			            v.setBackgroundColor(Color.argb(TRIM_MEMORY_MODERATE, 170, 170, 170));
			        }
			        return v;
			}
		};;
		setListAdapter( this.adapter );
	}

Output:
	private void fillData()
	{
		String[] from = new String[] { HomeworkTable.COLUMN_NAME, HomeworkTable.COLUMN_DATE, HomeworkTable.COLUMN_DESCRIPTION };
		int[] to = new int[] { R.id.hwName, R.id.date, R.id.descrption };
		getLoaderManager().initLoader( 0, null, this );
		this.adapter = new SimpleCursorAdapter( this, R.layout.home_list_row, null, from, to, 0 ){
			@Override
		    public View getView(int position, View convertView, ViewGroup parent) {
				 View v = super.getView(position, convertView, parent);
			        if (position %2 ==1) {
			            v.setBackgroundColor(Color.argb(TRIM_MEMORY_MODERATE, 100, 100, 100));
			        } else {
			            v.setBackgroundColor(Color.argb(TRIM_MEMORY_MODERATE, 170, 170, 170));
			        }
			        return v;
			}
		};;
		setListAdapter( this.adapter );
	}


Input:
  public BufferedImage openImage(int no)
    throws FormatException, IOException
  {
    FormatTools.assertId(currentId, true, 1);
    if (no < 0 || no >= getImageCount()) {
      throw new FormatException("Invalid image number: " + no);
    }
    if (noImageJ) throw new FormatException(NO_IJ);
    try {
      Location file = new Location(currentId);
      r.setVar("dir", file.getParent() + System.getProperty("file.separator"));
      r.setVar("name", file.getName());
      synchronized (ImageJReader.class) {
        try {
          r.exec("state = Opener.getOpenUsingPlugins()");
          r.exec("Opener.setOpenUsingPlugins(false)");
        }
        catch (ReflectException exc) {
        }
        r.exec("image = opener.openImage(dir, name)");
        try {
          r.exec("Opener.setOpenUsingPlugins(state)");
        }
        catch (ReflectException exc) {
        }
      }
      r.exec("size = image.getStackSize()");
      Image img = (Image) r.exec("image.getImage()");
      BufferedImage b = ImageTools.makeBuffered(img);
      return b;
    }
    catch (ReflectException exc) {
      throw new FormatException(exc);
    }
  }

Output:
  public BufferedImage openImage(int no)
    throws FormatException, IOException
  {
    FormatTools.assertId(currentId, true, 1);
    if (no < 0 || no >= getImageCount()) {
      throw new FormatException("Invalid image number: " + no);
    }
    if (noImageJ) throw new FormatException(NO_IJ);
    try {
      Location file = new Location(currentId).getAbsoluteFile();
      r.setVar("dir", file.getParent() + System.getProperty("file.separator"));
      r.setVar("name", file.getName());
      synchronized (ImageJReader.class) {
        try {
          r.exec("state = Opener.getOpenUsingPlugins()");
          r.exec("Opener.setOpenUsingPlugins(false)");
        }
        catch (ReflectException exc) {
        }
        r.exec("image = opener.openImage(dir, name)");
        try {
          r.exec("Opener.setOpenUsingPlugins(state)");
        }
        catch (ReflectException exc) {
        }
      }
      if (r.getVar("image") == null) {
        throw new FormatException("ImageJ cannot read this image");
      }
      r.exec("size = image.getStackSize()");
      Image img = (Image) r.exec("image.getImage()");
      BufferedImage b = ImageTools.makeBuffered(img);
      return b;
    }
    catch (ReflectException exc) {
      throw new FormatException(exc);
    }
  }


Input:
	private Integer[] getRows( String line, int indent ) {
		final FontMetrics METRICS = getFontMetrics(getFont());
		final int WIDTH = getWidth() - 2*PAD;
		final int indentsize = indent*METRICS.stringWidth(" ")*indent;
		List<Integer> rows = new util.LinkedList<Integer>();
		int row = 0;
		int remaining = WIDTH;
		if ( METRICS.stringWidth(" ")*indent > WIDTH )
			return new Integer[0];
		StringTokenizer st = new StringTokenizer(line, " ",true);
		while (st.hasMoreTokens()) {
			String tok = st.nextToken();
			int width = METRICS.stringWidth(tok);
			if ( width <= remaining ) {
				row += tok.length();
				remaining -= width;
			} else if ( width > WIDTH-indentsize ) {
				for (int i = 0; i < tok.length(); ++i) {
					char chr = tok.charAt(i);
					width = METRICS.charWidth(chr);
					if  ( width <= remaining ) {
						remaining -= width;
						row += 1;
					} else {
						rows.add(row);
						row = 1;
						remaining = WIDTH - indentsize - width;
					}
				}
			} else {
				rows.add(row);
				row = tok.length();
				remaining = WIDTH - indentsize - width;
			}
		}
		if (row != 0)
			rows.add(row);
		return rows.toArray(new Integer[rows.size()]);
	}

Output:
	private Integer[] getRows( String line, int indent ) {
		final FontMetrics METRICS = getFontMetrics(getFont());
		final int WIDTH = getWidth() - 2*PAD;
		final int indentsize = METRICS.stringWidth(" ")*indent;
		List<Integer> rows = new util.LinkedList<Integer>();
		int row = 0;
		int remaining = WIDTH;
		if ( METRICS.stringWidth(" ")*indent > WIDTH )
			return new Integer[0];
		StringTokenizer st = new StringTokenizer(line, " ",true);
		while (st.hasMoreTokens()) {
			String tok = st.nextToken();
			int width = METRICS.stringWidth(tok);
			if ( width <= remaining ) {
				row += tok.length();
				remaining -= width;
			} else if ( width > WIDTH-indentsize ) {
				for (int i = 0; i < tok.length(); ++i) {
					char chr = tok.charAt(i);
					width = METRICS.charWidth(chr);
					if  ( width <= remaining ) {
						remaining -= width;
						row += 1;
					} else {
						rows.add(row);
						row = 1;
						remaining = WIDTH - indentsize - width;
					}
				}
			} else {
				rows.add(row);
				row = tok.length();
				remaining = WIDTH - indentsize - width;
			}
		}
		if (row != 0)
			rows.add(row);
		return rows.toArray(new Integer[rows.size()]);
	}


Input:
	private void handleUploadVideo(HttpServletRequest request,
			HttpServletResponse response, HttpSession session)
			throws IOException {
		PrintWriter out = response.getWriter();
		out.println("Uploading file...");
		response.setContentType("text/plain");
		DiskFileItemFactory fileItemFactory = new DiskFileItemFactory();
		fileItemFactory.setSizeThreshold(1 * 1024 * 1024);
		fileItemFactory.setRepository(tempDir);
		ServletFileUpload uploadHandler = new ServletFileUpload(fileItemFactory);
		File file = null;
		try {
			List items = uploadHandler.parseRequest(request);
			Iterator itr = items.iterator();
			FileItem videoNameItem = null;
			FileItem fileItem = null;
			while (itr.hasNext()) {
				FileItem item = (FileItem) itr.next();
				if (item.isFormField()
						&& item.getFieldName().equals("new-video-name")) {
					log.info("Form Name = \"" + item.getFieldName()
							+ "\", Value = \"" + item.getString() + "\"");
					videoNameItem = item;
				} else {
					log.info("Field Name = \"" + item.getFieldName()
							+ "\", File Name = \"" + item.getName()
							+ "\", Content type = \""
							+ item.getContentType()
							+ "\", File Size (bytes) = \"" + item.getSize()
							+ "\"");
					fileItem = item;
				}
			}
			if (videoNameItem == null) {
				log.severe("Video name field not found in video upload form");
				return;
			}
			if (fileItem == null) {
				log.severe("File field not found in video upload form");
				return;
			}
			FileItem i = fileItem;
			file = new File(destinationDir, fileItem.getName());
			fileItem.write(file);
			int projectId = getProjectIdFromSessionAttributes(session);
			String videoName = videoNameItem.getString();
			if (Security.isSafeVideoName(videoName)
					&& Security.isSafeVideo(i)
					&& Security.isUniqueVideoName(videoName, projectId)
					&& Security.videoFits(DatabaseApi.getNumberOfVideos(projectId))) {
				String videoUrl = S3Api.uploadFile(file);
				if (videoUrl != null) {
					DatabaseApi.addVideo(new Video(videoName,
							videoUrl, "/olive/images/bbb480.jpg", projectId,
							-1, -1, false));
					out.println("File uploaded. Please close this window and refresh the editor page.");
					out.println();
				} else {
					out.println("Upload Failed. Error uploading video to the cloud.");
					log.warning("Upload Failed. Error uploading video to the cloud.");
					return;
				}
			} else if (!Security.isSafeVideoName(videoName)) {
				out.println("Upload Failed. Video name may consist of a-z, 0-9; and must begin with a letter.");
				log.warning("Upload Failed. Video name may consist of a-z, 0-9; and must begin with a letter.");
				return;
			} else if (!Security.isUniqueVideoName(videoName, projectId)) {
				out.println("Upload Failed. Video name already exists.");
				log.warning("Upload Failed. Video name already exists.");
				return;
			} else {
				out.println("Upload Failed. Video type is invalid or maximum number of videos reached.");
				log.warning("Upload Failed. Video type is invalid or maximum number of videos reached.");
				return;
			}
		} catch (FileUploadException e) {
			log.severe("Error encountered while parsing the request in the upload handler");
			out.println("Upload failed.");
			e.printStackTrace();
		} catch (InvalidFileSizeException e) {
			log.severe("Invalid file size");
			out.println("Upload failed (invalid file size)");
			e.printStackTrace();
		} catch (Exception e) {
			log.severe("Unknown error encountered while uploading file");
			out.println("Upload failed (unknown reason).");
			e.printStackTrace();
		} finally {
			if (out != null) {
				out.close();
			}
			if (file != null) {
				file.delete();
			}
		}
	}

Output:
	private void handleUploadVideo(HttpServletRequest request,
			HttpServletResponse response, HttpSession session)
			throws IOException {
		PrintWriter out = response.getWriter();
		out.println("Uploading file...");
		response.setContentType("text/plain");
		DiskFileItemFactory fileItemFactory = new DiskFileItemFactory();
		fileItemFactory.setSizeThreshold(1 * 1024 * 1024);
		fileItemFactory.setRepository(tempDir);
		ServletFileUpload uploadHandler = new ServletFileUpload(fileItemFactory);
		File file = null;
		try {
			List items = uploadHandler.parseRequest(request);
			Iterator itr = items.iterator();
			FileItem videoNameItem = null;
			FileItem fileItem = null;
			while (itr.hasNext()) {
				FileItem item = (FileItem) itr.next();
				if (item.isFormField()
						&& item.getFieldName().equals("new-video-name")) {
					log.info("Form Name = \"" + item.getFieldName()
							+ "\", Value = \"" + item.getString() + "\"");
					videoNameItem = item;
				} else {
					log.info("Field Name = \"" + item.getFieldName()
							+ "\", File Name = \"" + item.getName()
							+ "\", Content type = \""
							+ item.getContentType()
							+ "\", File Size (bytes) = \"" + item.getSize()
							+ "\"");
					fileItem = item;
				}
			}
			if (videoNameItem == null) {
				log.severe("Video name field not found in video upload form");
				return;
			}
			if (fileItem == null) {
				log.severe("File field not found in video upload form");
				return;
			}
			FileItem i = fileItem;
			file = new File(destinationDir, fileItem.getName());
			fileItem.write(file);
			int projectId = getProjectIdFromSessionAttributes(session);
			String videoName = videoNameItem.getString();
			if (Security.isSafeVideoName(videoName)
					&& Security.isSafeVideo(i)
					&& Security.isUniqueVideoName(videoName, projectId)
					&& Security.videoFits(DatabaseApi.getNumberOfVideos(projectId))) {
				String videoUrl = S3Api.uploadFile(file);
				if (videoUrl != null) {
					DatabaseApi.addVideo(new Video(videoName,
							videoUrl, "/olive/images/bbb480.jpg", projectId,
							-1, -1, false));
					out.println("File uploaded. Please close this window and refresh the editor page.");
					out.println();
					response.sendRedirect("editor.jsp");
				} else {
					out.println("Upload Failed. Error uploading video to the cloud.");
					log.warning("Upload Failed. Error uploading video to the cloud.");
					return;
				}
			} else if (!Security.isSafeVideoName(videoName)) {
				out.println("Upload Failed. Video name may consist of a-z, 0-9; and must begin with a letter.");
				log.warning("Upload Failed. Video name may consist of a-z, 0-9; and must begin with a letter.");
				return;
			} else if (!Security.isUniqueVideoName(videoName, projectId)) {
				out.println("Upload Failed. Video name already exists.");
				log.warning("Upload Failed. Video name already exists.");
				return;
			} else {
				out.println("Upload Failed. Video type is invalid or maximum number of videos reached.");
				log.warning("Upload Failed. Video type is invalid or maximum number of videos reached.");
				return;
			}
		} catch (FileUploadException e) {
			log.severe("Error encountered while parsing the request in the upload handler");
			out.println("Upload failed.");
			e.printStackTrace();
		} catch (InvalidFileSizeException e) {
			log.severe("Invalid file size");
			out.println("Upload failed (invalid file size)");
			e.printStackTrace();
		} catch (Exception e) {
			log.severe("Unknown error encountered while uploading file");
			out.println("Upload failed (unknown reason).");
			e.printStackTrace();
		} finally {
			if (out != null) {
				out.close();
			}
			if (file != null) {
				file.delete();
			}
		}
	}


Input:
    protected void append(ILoggingEvent event)
    {
        Throwable throwable = null;
        IThrowableProxy throwableProxy = event.getThrowableProxy();
        if (throwableProxy instanceof ThrowableProxy) {
            throwable = ((ThrowableProxy) throwableProxy).getThrowable();
        }
        try {
            LogLevel logLevel = LogLevel.valueOf(event.getLevel().toString());
            LogEvent logevent = new LogEvent(logLevel, event.getMessage(), event.getArgumentArray(), throwable);
            getObservationManager().notify(logevent, event.getLoggerName(), null);
        } catch (IllegalArgumentException e) {
            this.logger.debug("Unsupported log level {0}", event.getLevel());
        } catch (ComponentLookupException e) {
            this.logger.error("Can't find any implementation of org.xwiki.observation.ObservationManager", e);
        }
    }

Output:
    protected void append(ILoggingEvent event)
    {
        Throwable throwable = null;
        IThrowableProxy throwableProxy = event.getThrowableProxy();
        if (throwableProxy instanceof ThrowableProxy) {
            throwable = ((ThrowableProxy) throwableProxy).getThrowable();
        }
        try {
            LogLevel logLevel = LogLevel.valueOf(event.getLevel().toString());
            LogEvent logevent = new LogEvent(logLevel, event.getMessage(), event.getArgumentArray(), throwable);
            getObservationManager().notify(logevent, event.getLoggerName(), null);
        } catch (IllegalArgumentException e) {
            this.logger.debug("Unsupported log level {0}", event.getLevel());
        } catch (ComponentLookupException e) {
            this.logger.error("Can't find any implementation of [" + ObservationManager.class.getName() + "]", e);
        }
    }


Input:
	public final void updateEntity() {
		if(checkTileEntity(_initialInit)) {
			stillNeedReplace = true;
			return;
		} else {
			if(stillNeedReplace) {
				stillNeedReplace = false;
				worldObj.notifyBlockChange(getX(), getY(), getZ(), worldObj.getBlockId(getX(), getY(), getZ()));
				for(Pair3<IRoutedItem, ForgeDirection, ItemSendMode> item : _sendQueue) {
					item.getValue1().getEntityPassiveItem().setWorld(worldObj);
				}
				getRouter();
				return;
			}
		}
		if(repeatFor > 0) {
			if(delayTo < System.currentTimeMillis()) {
				delayTo = System.currentTimeMillis() + 200;
				repeatFor--;
				worldObj.markBlockForUpdate(this.getX(), this.getY(), this.getZ());
			}
		}
		while(this._inTransitToMe.peek()!=null && this._inTransitToMe.peek().getTickToTimeOut()<=0){
			if (LogisticsPipes.DEBUG) {
				final IRoutedItem p=_inTransitToMe.poll();
				LogisticsPipes.log.info("Timed Out: "+p.getIDStack().getItem().getFriendlyName());
			}
		}
		getRouter().update(worldObj.getWorldTime() % Configs.LOGISTICS_DETECTION_FREQUENCY == _delayOffset || _initialInit);
		getUpgradeManager().securityTick();
		super.updateEntity();
		ignoreDisableUpdateEntity();
		_initialInit = false;
		if (!_sendQueue.isEmpty()){
			if(getItemSendMode() == ItemSendMode.Normal || !SimpleServiceLocator.buildCraftProxy.checkMaxItems()) {
				Pair3<IRoutedItem, ForgeDirection, ItemSendMode> itemToSend = _sendQueue.getFirst();
				sendRoutedItem(itemToSend.getValue1(), itemToSend.getValue2());
				_sendQueue.removeFirst();
				if(SimpleServiceLocator.buildCraftProxy.checkMaxItems()) {
					for(int i=0;i < 16 && !_sendQueue.isEmpty() && _sendQueue.getFirst().getValue3() == ItemSendMode.Fast;i++) {
						if (!_sendQueue.isEmpty()){
							itemToSend = _sendQueue.getFirst();
							sendRoutedItem(itemToSend.getValue1(), itemToSend.getValue2());
							_sendQueue.removeFirst();
						}
					}
				}
				sendQueueChanged(false);
			} else if(getItemSendMode() == ItemSendMode.Fast) {
				for(int i=0;i < 16;i++) {
					if (!_sendQueue.isEmpty()){
						Pair3<IRoutedItem, ForgeDirection, ItemSendMode> itemToSend = _sendQueue.getFirst();
						sendRoutedItem(itemToSend.getValue1(), itemToSend.getValue2());
						_sendQueue.removeFirst();
					}
				}
				sendQueueChanged(false);
			} else if(getItemSendMode() == null) {
				throw new UnsupportedOperationException("getItemSendMode() can't return null. "+this.getClass().getName());
			} else {
				throw new UnsupportedOperationException("getItemSendMode() returned unhandled value. " + getItemSendMode().name() + " in "+this.getClass().getName());
			}
		}
		if(MainProxy.isClient(worldObj)) return;
		checkTexturePowered();
		if (!isEnabled()) return;
		enabledUpdateEntity();
		if (getLogisticsModule() == null) return;
		getLogisticsModule().tick();
	}

Output:
	public final void updateEntity() {
		if(checkTileEntity(_initialInit)) {
			stillNeedReplace = true;
			return;
		} else {
			if(stillNeedReplace) {
				stillNeedReplace = false;
				worldObj.notifyBlockChange(getX(), getY(), getZ(), worldObj.getBlockId(getX(), getY(), getZ()));
				for(Pair3<IRoutedItem, ForgeDirection, ItemSendMode> item : _sendQueue) {
					item.getValue1().getEntityPassiveItem().setWorld(worldObj);
				}
				getRouter();
				return;
			}
		}
		if(repeatFor > 0) {
			if(delayTo < System.currentTimeMillis()) {
				delayTo = System.currentTimeMillis() + 200;
				repeatFor--;
				worldObj.markBlockForUpdate(this.getX(), this.getY(), this.getZ());
			}
		}
		while(this._inTransitToMe.peek()!=null && this._inTransitToMe.peek().getTickToTimeOut()<=0){
			final IRoutedItem p=_inTransitToMe.poll();
			if (LogisticsPipes.DEBUG) {
					LogisticsPipes.log.info("Timed Out: "+p.getIDStack().getItem().getFriendlyName());
			}
		}
		getRouter().update(worldObj.getWorldTime() % Configs.LOGISTICS_DETECTION_FREQUENCY == _delayOffset || _initialInit);
		getUpgradeManager().securityTick();
		super.updateEntity();
		ignoreDisableUpdateEntity();
		_initialInit = false;
		if (!_sendQueue.isEmpty()){
			if(getItemSendMode() == ItemSendMode.Normal || !SimpleServiceLocator.buildCraftProxy.checkMaxItems()) {
				Pair3<IRoutedItem, ForgeDirection, ItemSendMode> itemToSend = _sendQueue.getFirst();
				sendRoutedItem(itemToSend.getValue1(), itemToSend.getValue2());
				_sendQueue.removeFirst();
				if(SimpleServiceLocator.buildCraftProxy.checkMaxItems()) {
					for(int i=0;i < 16 && !_sendQueue.isEmpty() && _sendQueue.getFirst().getValue3() == ItemSendMode.Fast;i++) {
						if (!_sendQueue.isEmpty()){
							itemToSend = _sendQueue.getFirst();
							sendRoutedItem(itemToSend.getValue1(), itemToSend.getValue2());
							_sendQueue.removeFirst();
						}
					}
				}
				sendQueueChanged(false);
			} else if(getItemSendMode() == ItemSendMode.Fast) {
				for(int i=0;i < 16;i++) {
					if (!_sendQueue.isEmpty()){
						Pair3<IRoutedItem, ForgeDirection, ItemSendMode> itemToSend = _sendQueue.getFirst();
						sendRoutedItem(itemToSend.getValue1(), itemToSend.getValue2());
						_sendQueue.removeFirst();
					}
				}
				sendQueueChanged(false);
			} else if(getItemSendMode() == null) {
				throw new UnsupportedOperationException("getItemSendMode() can't return null. "+this.getClass().getName());
			} else {
				throw new UnsupportedOperationException("getItemSendMode() returned unhandled value. " + getItemSendMode().name() + " in "+this.getClass().getName());
			}
		}
		if(MainProxy.isClient(worldObj)) return;
		checkTexturePowered();
		if (!isEnabled()) return;
		enabledUpdateEntity();
		if (getLogisticsModule() == null) return;
		getLogisticsModule().tick();
	}


Input:
  public Changeset getChangeset(Repository repository, String revision)
          throws RepositoryException, IOException, NotSupportedFeatuerException
  {
    AssertUtil.assertIsNotNull(repository);
    ChangesetViewer viewer = repositoryManager.getChangesetViewer(repository);
    if (viewer == null)
    {
      throw new NotSupportedFeatuerException(
          "ChangesetViewer is not supported for type ".concat(
            repository.getType()));
    }
    Changeset changeset = null;
    ChangesetViewerCacheKey key =
      new ChangesetViewerCacheKey(repository.getId(), -1, -1);
    ChangesetPagingResult result = cache.get(key);
    if (result == null)
    {
      changeset = viewer.getChangeset(revision);
      if (changeset != null)
      {
        callPreProcessors(changeset);
        callPreProcessorFactories(repository, changeset);
        result = new ChangesetPagingResult(1, Arrays.asList(changeset));
        cache.put(key, result);
      }
      else
      {
        throw new RepositoryException("could not find changeset");
      }
    }
    else
    {
      if (logger.isDebugEnabled())
      {
        logger.debug("fetch changesetviewer result from cache");
      }
      changeset = result.getChangesets().get(0);
    }
    return changeset;
  }

Output:
  public Changeset getChangeset(Repository repository, String revision)
          throws RepositoryException, IOException, NotSupportedFeatuerException
  {
    AssertUtil.assertIsNotNull(repository);
    ChangesetViewer viewer = repositoryManager.getChangesetViewer(repository);
    if (viewer == null)
    {
      throw new NotSupportedFeatuerException(
          "ChangesetViewer is not supported for type ".concat(
            repository.getType()));
    }
    Changeset changeset = null;
    ChangesetViewerCacheKey key =
      new ChangesetViewerCacheKey(repository.getId(), null, revision, -1, -1);
    ChangesetPagingResult result = cache.get(key);
    if (result == null)
    {
      changeset = viewer.getChangeset(revision);
      if (changeset != null)
      {
        callPreProcessors(changeset);
        callPreProcessorFactories(repository, changeset);
        result = new ChangesetPagingResult(1, Arrays.asList(changeset));
        cache.put(key, result);
      }
      else
      {
        throw new RepositoryException("could not find changeset");
      }
    }
    else
    {
      if (logger.isDebugEnabled())
      {
        logger.debug("fetch changesetviewer result from cache");
      }
      changeset = result.getChangesets().get(0);
    }
    return changeset;
  }


Input:
  private static SpacingBuilder createSpacingBuilder(CommonCodeStyleSettings settings) {
    TokenSet rules = TokenSet.create(ERL_RULE, ERL_RECORD_DEFINITION, ERL_INCLUDE, ERL_MACROS_DEFINITION, ERL_ATTRIBUTE);
    TokenSet keywords = TokenSet.create(
      ERL_AFTER, ERL_WHEN, ERL_BEGIN, ERL_END, ERL_OF, ERL_CASE, ERL_QUERY, ERL_CATCH, ERL_IF, ERL_RECEIVE,
      ERL_TRY, ERL_DIV, ERL_REM, ERL_OR, ERL_XOR, ERL_BOR, ERL_BXOR, ERL_BSL, ERL_BSR, ERL_AND, ERL_BAND);
    return new SpacingBuilder(settings.getRootSettings())
      .before(ERL_COMMA).spaceIf(settings.SPACE_BEFORE_COMMA)
      .after(ERL_COMMA).spaceIf(settings.SPACE_AFTER_COMMA)
      .around(ERL_OP_EQ).spaceIf(settings.SPACE_AROUND_ASSIGNMENT_OPERATORS)
      .around(ERL_OP_LT_MINUS).spaceIf(settings.SPACE_AROUND_ASSIGNMENT_OPERATORS)
      .around(ERL_OP_EXL).spaceIf(settings.SPACE_AROUND_ASSIGNMENT_OPERATORS)
      .after(ERL_ARROW).spaceIf(settings.SPACE_AROUND_ASSIGNMENT_OPERATORS)
      .before(ERL_CLAUSE_BODY).spaceIf(settings.SPACE_AROUND_ASSIGNMENT_OPERATORS)
      .around(ERL_OP_PLUS).spaceIf(settings.SPACE_AROUND_ADDITIVE_OPERATORS)
      .around(ERL_OP_PLUS_PLUS).spaceIf(settings.SPACE_AROUND_ADDITIVE_OPERATORS)
      .aroundInside(ERL_OP_MINUS, ERL_ADDITIVE_EXPRESSION).spaceIf(settings.SPACE_AROUND_ADDITIVE_OPERATORS)
      .aroundInside(ERL_OP_AR_DIV, ERL_MULTIPLICATIVE_EXPRESSION).spaceIf(settings.SPACE_AROUND_MULTIPLICATIVE_OPERATORS)
      .around(ERL_OP_AR_MUL).spaceIf(settings.SPACE_AROUND_MULTIPLICATIVE_OPERATORS)
      .around(ERL_OP_EQ_EQ).spaceIf(settings.SPACE_AROUND_EQUALITY_OPERATORS)
      .around(ERL_OP_DIV_EQ).spaceIf(settings.SPACE_AROUND_EQUALITY_OPERATORS)
      .around(ERL_OP_EQ_DIV_EQ).spaceIf(settings.SPACE_AROUND_EQUALITY_OPERATORS)
      .around(ERL_OP_EQ_COL_EQ).spaceIf(settings.SPACE_AROUND_EQUALITY_OPERATORS)
      .around(ERL_OP_LT).spaceIf(settings.SPACE_AROUND_LOGICAL_OPERATORS)
      .around(ERL_OP_EQ_LT).spaceIf(settings.SPACE_AROUND_LOGICAL_OPERATORS)
      .around(ERL_OP_GT).spaceIf(settings.SPACE_AROUND_LOGICAL_OPERATORS)
      .around(ERL_OP_GT_EQ).spaceIf(settings.SPACE_AROUND_LOGICAL_OPERATORS)
      .around(ERL_OR_OR).spaceIf(settings.SPACE_AROUND_LOGICAL_OPERATORS)
      .around(ERL_OR).spaceIf(settings.SPACE_AROUND_LOGICAL_OPERATORS)
      .after(ERL_BRACKET_LEFT).none()
      .before(ERL_BRACKET_RIGHT).none()
      .after(ERL_CURLY_LEFT).none()
      .before(ERL_CURLY_RIGHT).none()
      .after(ERL_BIN_START).none()
      .before(ERL_BIN_END).none()
      .before(ERL_ARGUMENT_DEFINITION_LIST).none()
      .before(ERL_ARGUMENT_LIST).none()
      .withinPair(ERL_PAR_LEFT, ERL_PAR_RIGHT).spaceIf(settings.SPACE_WITHIN_METHOD_CALL_PARENTHESES)
      .withinPair(ERL_BRACKET_LEFT, ERL_BRACKET_RIGHT).spaceIf(true)
      .withinPair(ERL_CURLY_LEFT, ERL_CURLY_RIGHT).spaceIf(true)
      .withinPair(ERL_BIN_START, ERL_BIN_END).spaceIf(true)
      .beforeInside(rules, ERL_PAR_LEFT).none()
      .around(keywords).spaces(1)
      .before(ERL_FUN_TYPE_SIGS_BRACES).none()
      .between(ERL_SPEC_FUN, ERL_TYPE_SIG).none()
      .aroundInside(ERL_OP_AR_DIV, ERL_SPEC_FUN).none()
      .beforeInside(ERL_PAR_LEFT, ERL_EXPORT).none()
      .beforeInside(ERL_PAR_LEFT, ERL_EXPORT_TYPE_ATTRIBUTE).none()
      .beforeInside(ERL_PAR_LEFT, ERL_INCLUDE).none()
      .beforeInside(ERL_PAR_LEFT, ERL_RECORD_DEFINITION).none()
      .beforeInside(ERL_PAR_LEFT, ERL_MODULE).none()
      .beforeInside(ERL_PAR_LEFT, ERL_MACROS_DEFINITION).none()
      .beforeInside(ERL_PAR_LEFT, ERL_BEHAVIOUR).none()
      .beforeInside(ERL_TYPED_ATTR_VAL, ERL_ATOM_ATTRIBUTE).spaces(1)
      .afterInside(ERL_Q_ATOM, ERL_ATOM_ATTRIBUTE).none()
      .beforeInside(ERL_PAR_LEFT, ERL_SPECIFICATION).none()
      .beforeInside(ERL_FUN_TYPE_SIGS, ERL_SPECIFICATION).spaces(1)
      .beforeInside(ERL_PAR_LEFT, ERL_CALLBACK_SPEC).none()
      .beforeInside(ERL_FUN_TYPE_SIGS, ERL_CALLBACK_SPEC).spaces(1)
      .aroundInside(ERL_OP_AR_DIV, ERL_FUN_TYPE_SIGS).none()
      .aroundInside(ERL_OP_AR_DIV, ERL_EXPORT_FUNCTION).none()
      .aroundInside(ERL_OP_AR_DIV, ERL_EXPORT_TYPE).none()
      .aroundInside(ERL_COLON_COLON, ERL_FUN_TYPE_SIGS).spaces(1)
      .betweenInside(ERL_COLON_COLON, ERL_TYPE_SIG, ERL_FUN_TYPE_SIGS).spaces(1)
      .between(ERL_FUN_TYPE_ARGUMENTS, ERL_TOP_TYPE_CLAUSE).spaceIf(settings.SPACE_AROUND_ASSIGNMENT_OPERATORS)
      .betweenInside(ERL_Q_ATOM, ERL_PAR_LEFT, ERL_TYPE).none()
      .before(ERL_CLAUSE_GUARD).spaces(1)
      .before(ERL_FUN_TYPE_SIGS).spaces(1)
      .around(ERL_FUN_TYPE).spaces(1)
      .around(ERL_TYPE_SIG).spaces(1)
      .beforeInside(ERL_PAR_LEFT, ERL_FUN_TYPE).spaces(1)
      .afterInside(ERL_PAR_RIGHT, ERL_FUN_TYPE).spaces(1)
      .aroundInside(ERL_COLON, ERL_GLOBAL_FUNCTION_CALL_EXPRESSION).none()
      .around(ERL_COLON_COLON).spaces(1)
      .aroundInside(ERL_DOT, ERL_RECORD_FIELD).none()
      .before(ERL_RECORD_FIELD).none()
      .aroundInside(ERL_RADIX, ERL_RECORD_EXPRESSION).none()
      .before(ERL_DOT).none()
      .around(ERL_QMARK).none()
      .before(ERL_RECORD_TUPLE).none()
      .after(ERL_FUN).none()
      .before(ERL_END).spaces(1)
      ;
  }

Output:
  private static SpacingBuilder createSpacingBuilder(CommonCodeStyleSettings settings) {
    TokenSet rules = TokenSet.create(ERL_RULE, ERL_RECORD_DEFINITION, ERL_INCLUDE, ERL_MACROS_DEFINITION, ERL_ATTRIBUTE);
    TokenSet keywords = TokenSet.create(
      ERL_AFTER, ERL_WHEN, ERL_BEGIN, ERL_END, ERL_OF, ERL_CASE, ERL_QUERY, ERL_CATCH, ERL_IF, ERL_RECEIVE,
      ERL_TRY, ERL_DIV, ERL_REM, ERL_OR, ERL_XOR, ERL_BOR, ERL_BXOR, ERL_BSL, ERL_BSR, ERL_AND, ERL_BAND);
    return new SpacingBuilder(settings.getRootSettings())
      .before(ERL_COMMA).spaceIf(settings.SPACE_BEFORE_COMMA)
      .after(ERL_COMMA).spaceIf(settings.SPACE_AFTER_COMMA)
      .around(ERL_OP_EQ).spaceIf(settings.SPACE_AROUND_ASSIGNMENT_OPERATORS)
      .around(ERL_OP_LT_MINUS).spaceIf(settings.SPACE_AROUND_ASSIGNMENT_OPERATORS)
      .around(ERL_OP_EXL).spaceIf(settings.SPACE_AROUND_ASSIGNMENT_OPERATORS)
      .after(ERL_ARROW).spaceIf(settings.SPACE_AROUND_ASSIGNMENT_OPERATORS)
      .before(ERL_CLAUSE_BODY).spaceIf(settings.SPACE_AROUND_ASSIGNMENT_OPERATORS)
      .around(ERL_OP_PLUS).spaceIf(settings.SPACE_AROUND_ADDITIVE_OPERATORS)
      .around(ERL_OP_PLUS_PLUS).spaceIf(settings.SPACE_AROUND_ADDITIVE_OPERATORS)
      .aroundInside(ERL_OP_MINUS, ERL_ADDITIVE_EXPRESSION).spaceIf(settings.SPACE_AROUND_ADDITIVE_OPERATORS)
      .aroundInside(ERL_OP_AR_DIV, ERL_MULTIPLICATIVE_EXPRESSION).spaceIf(settings.SPACE_AROUND_MULTIPLICATIVE_OPERATORS)
      .around(ERL_OP_AR_MUL).spaceIf(settings.SPACE_AROUND_MULTIPLICATIVE_OPERATORS)
      .around(ERL_OP_EQ_EQ).spaceIf(settings.SPACE_AROUND_EQUALITY_OPERATORS)
      .around(ERL_OP_DIV_EQ).spaceIf(settings.SPACE_AROUND_EQUALITY_OPERATORS)
      .around(ERL_OP_EQ_DIV_EQ).spaceIf(settings.SPACE_AROUND_EQUALITY_OPERATORS)
      .around(ERL_OP_EQ_COL_EQ).spaceIf(settings.SPACE_AROUND_EQUALITY_OPERATORS)
      .around(ERL_OP_LT).spaceIf(settings.SPACE_AROUND_LOGICAL_OPERATORS)
      .around(ERL_OP_EQ_LT).spaceIf(settings.SPACE_AROUND_LOGICAL_OPERATORS)
      .around(ERL_OP_GT).spaceIf(settings.SPACE_AROUND_LOGICAL_OPERATORS)
      .around(ERL_OP_GT_EQ).spaceIf(settings.SPACE_AROUND_LOGICAL_OPERATORS)
      .around(ERL_OR_OR).spaceIf(settings.SPACE_AROUND_LOGICAL_OPERATORS)
      .around(ERL_OR).spaceIf(settings.SPACE_AROUND_LOGICAL_OPERATORS)
      .after(ERL_BRACKET_LEFT).none()
      .before(ERL_BRACKET_RIGHT).none()
      .after(ERL_CURLY_LEFT).none()
      .before(ERL_CURLY_RIGHT).none()
      .after(ERL_BIN_START).none()
      .before(ERL_BIN_END).none()
      .before(ERL_ARGUMENT_DEFINITION_LIST).none()
      .before(ERL_ARGUMENT_LIST).none()
      .withinPair(ERL_PAR_LEFT, ERL_PAR_RIGHT).spaceIf(settings.SPACE_WITHIN_METHOD_CALL_PARENTHESES)
      .withinPair(ERL_BRACKET_LEFT, ERL_BRACKET_RIGHT).spaceIf(true)
      .withinPair(ERL_CURLY_LEFT, ERL_CURLY_RIGHT).spaceIf(true)
      .withinPair(ERL_BIN_START, ERL_BIN_END).spaceIf(true)
      .beforeInside(rules, ERL_PAR_LEFT).none()
      .around(keywords).spaces(1)
      .before(ERL_FUN_TYPE_SIGS_BRACES).none()
      .between(ERL_SPEC_FUN, ERL_TYPE_SIG).none()
      .aroundInside(ERL_OP_AR_DIV, ERL_SPEC_FUN).none()
      .beforeInside(ERL_PAR_LEFT, ERL_EXPORT).none()
      .beforeInside(ERL_PAR_LEFT, ERL_EXPORT_TYPE_ATTRIBUTE).none()
      .beforeInside(ERL_PAR_LEFT, ERL_INCLUDE).none()
      .beforeInside(ERL_PAR_LEFT, ERL_RECORD_DEFINITION).none()
      .beforeInside(ERL_PAR_LEFT, ERL_MODULE).none()
      .beforeInside(ERL_PAR_LEFT, ERL_MACROS_DEFINITION).none()
      .beforeInside(ERL_PAR_LEFT, ERL_BEHAVIOUR).none()
      .beforeInside(ERL_TYPED_ATTR_VAL, ERL_ATOM_ATTRIBUTE).spaces(1)
      .afterInside(ERL_Q_ATOM, ERL_ATOM_ATTRIBUTE).none()
      .beforeInside(ERL_PAR_LEFT, ERL_SPECIFICATION).none()
      .beforeInside(ERL_FUN_TYPE_SIGS, ERL_SPECIFICATION).spaces(1)
      .beforeInside(ERL_PAR_LEFT, ERL_CALLBACK_SPEC).none()
      .beforeInside(ERL_FUN_TYPE_SIGS, ERL_CALLBACK_SPEC).spaces(1)
      .aroundInside(ERL_OP_AR_DIV, ERL_FUN_TYPE_SIGS).none()
      .aroundInside(ERL_OP_AR_DIV, ERL_EXPORT_FUNCTION).none()
      .aroundInside(ERL_OP_AR_DIV, ERL_EXPORT_TYPE).none()
      .aroundInside(ERL_COLON_COLON, ERL_FUN_TYPE_SIGS).spaces(1)
      .betweenInside(ERL_COLON_COLON, ERL_TYPE_SIG, ERL_FUN_TYPE_SIGS).spaces(1)
      .between(ERL_FUN_TYPE_ARGUMENTS, ERL_TOP_TYPE_CLAUSE).spaceIf(settings.SPACE_AROUND_ASSIGNMENT_OPERATORS)
      .betweenInside(ERL_Q_ATOM, ERL_PAR_LEFT, ERL_TYPE).none()
      .before(ERL_CLAUSE_GUARD).spaces(1)
      .before(ERL_FUN_TYPE_SIGS).spaces(1)
      .around(ERL_FUN_TYPE).spaces(1)
      .around(ERL_TYPE_SIG).spaces(1)
      .beforeInside(ERL_PAR_LEFT, ERL_FUN_TYPE).spaces(1)
      .afterInside(ERL_PAR_RIGHT, ERL_FUN_TYPE).spaces(1)
      .aroundInside(ERL_COLON, ERL_GLOBAL_FUNCTION_CALL_EXPRESSION).none()
      .around(ERL_COLON_COLON).spaces(1)
      .aroundInside(ERL_DOT, ERL_RECORD_FIELD).none()
      .before(ERL_RECORD_FIELD).none()
      .aroundInside(ERL_RADIX, ERL_RECORD_EXPRESSION).none()
      .before(ERL_DOT).none()
      .around(ERL_QMARK).none()
      .before(ERL_RECORD_TUPLE).none()
      .between(ERL_FUN, ERL_MODULE_REF).spaces(1)
      .between(ERL_FUN, ERL_FUNCTION_WITH_ARITY).spaces(1)
      .after(ERL_FUN).none()
      .before(ERL_END).spaces(1)
      ;
  }


Input:
    public void onSurfaceCreated(final SurfaceHolder holder) {
      if (_debug) Log.d(TAG, "start onSurfaceCreated() [" + this + "]");
      super.onSurfaceCreated(holder);
      Runnable surfaceCreatedCommand = new Runnable() {
        @Override
        public void run() {
          doSurfaceCreated();
        }
        protected void doSurfaceCreated() {
          if (mInitialized) {
            if (_debug) Log.d(TAG, "already Initialized(surfaceCreatedCommand)");
            return;
          }
          boolean ret;
          int counter = 0;
          int specCounter = 0;
          while(true) {
            if (_debug) Log.d(TAG, "start EGLContext.getEGL()");
            exitEgl();
            egl10 = (EGL10) EGLContext.getEGL();
            if (_debug) Log.d(TAG, "end EGLContext.getEGL()");
            if (_debug) Log.d(TAG, "start eglGetDisplay");
            eglDisplay = egl10.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
            if (_debug) Log.d(TAG, "end eglGetDisplay");
            if (eglDisplay == null || EGL10.EGL_NO_DISPLAY.equals(eglDisplay)) {
              String errStr = AtlantisService.getErrorString(egl10.eglGetError());
              if (_debug) Log.d(TAG, "eglGetDisplayがEGL_NO_DISPLAY [" + errStr + "]");
              exitEgl();
              if (++counter >= AtlantisService.RETRY_COUNT) {
                Log.e(TAG, "egl10.eglCreateContextがEGL_NO_DISPLAY");
                throw new RuntimeException("OpenGL Error(EGL_NO_DISPLAY) "
                  + errStr + ": "
                );
              }
              if (_debug) Log.d(TAG, "RETRY");
              System.gc();
              waitNano();
              continue;
            }
            {
              egl10.eglMakeCurrent(eglDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT);
            }
            int[] version = new int[2];
            if (! egl10.eglInitialize(eglDisplay, version)) {
              String errStr = AtlantisService.getErrorString(egl10.eglGetError());
              if (_debug) Log.d(TAG, "egl10.eglInitializeがfalse [" + errStr + "]");
              exitEgl();
              if (++counter >= AtlantisService.RETRY_COUNT) {
                Log.e(TAG,"egl10.eglInitializeがfalse");
                throw new RuntimeException("OpenGL Error(eglInitialize) "
                  + errStr + ": "
                );
              }
              if (_debug) Log.d(TAG,"RETRY");
              System.gc();
              waitNano();
              continue;
            }
            EGLConfig[] configs = new EGLConfig[1];
            int[] numConfig = new int[1];
            egl10.eglChooseConfig(eglDisplay, configSpec[specCounter++], configs, 1, numConfig);
            if (numConfig[0] == 0) {
              if (_debug) Log.d(TAG, "numConfig[0]=" + numConfig[0] + "");
              String errStr = AtlantisService.getErrorString(egl10.eglGetError());
              errStr += " eglChooseConfig numConfig == 0 ";
              errStr += " numConfig:[" + numConfig[0] + "]";
              errStr += " specCounter:[" + (specCounter - 1) + "]";
              exitEgl();
              Log.e(TAG,"eglChooseConfig失敗:"
                 + "numConfig:[" + numConfig[0] + "]"
                 + errStr);
              if (++counter >= AtlantisService.RETRY_COUNT) {
                throw new RuntimeException("OpenGL Error "
                  + errStr + " :"
                );
              }
            }
            EGLConfig config = configs[0];
            eglContext = egl10.eglCreateContext(eglDisplay, config, EGL10.EGL_NO_CONTEXT, null);
            if (eglContext == null || EGL10.EGL_NO_CONTEXT.equals(eglContext)) {
              String errStr = AtlantisService.getErrorString(egl10.eglGetError());
              errStr += "egl10.eglCreateContext == EGL_NO_CONTEXT ";
              errStr += "specCounter:[" + (specCounter - 1) + "]";
              if (_debug) Log.d(TAG, "egl10.eglCreateContext == EGL_NO_CONTEXT [" + errStr + "]");
              exitEgl();
              if (++counter >= AtlantisService.RETRY_COUNT) {
                Log.e(TAG, "egl10.eglCreateContextがEGL_NO_CONTEXT");
                throw new RuntimeException("OpenGL Error(EGL_NO_CONTEXT) "
                  + errStr + " :"
                );
              }
              if (_debug) Log.d(TAG, "RETRY");
              System.gc();
              waitNano();
              continue;
            }
            if (_debug) Log.d(TAG, "eglCreateContext done.");
            eglSurface = egl10.eglCreateWindowSurface(eglDisplay, config, holder, null);
            if (eglSurface == null || EGL10.EGL_NO_SURFACE.equals(eglSurface)) {
              String errStr = AtlantisService.getErrorString(egl10.eglGetError());
              errStr += "egl10.eglCreateWindowSurface == EGL_NO_SURFACE ";
              errStr += "specCounter:[" + (specCounter - 1) + "]";
              if (_debug) Log.d(TAG, "egl10.eglCreateWindowSurface == EGL_NO_SURFACE [" + errStr + "]");
              exitEgl();
              if (++counter >= AtlantisService.RETRY_COUNT) {
                Log.e(TAG, "egl10.eglCreateWindowSurfaceがEGL_NO_SURFACE");
                throw new RuntimeException("OpenGL Error(EGL_NO_SURFACE) "
                  + errStr + " :"
                );
              }
              if (_debug) Log.e(TAG, "RETRY");
              System.gc();
              waitNano();
              continue;
            }
            if (_debug) Log.d(TAG, "eglCreateWindowSurface done.");
            if (! egl10.eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext)) {
              String errStr = AtlantisService.getErrorString(egl10.eglGetError());
              errStr += "egl10.eglMakeCurrent == false ";
              errStr += "specCounter:[" + (specCounter - 1) + "]";
              if (_debug) Log.d(TAG, "egl10.eglMakeCurrent == false [" + errStr + "]");
              exitEgl();
              if (++counter >= AtlantisService.RETRY_COUNT) {
                Log.e(TAG,"egl10.eglMakeCurrentがfalse");
                throw new RuntimeException("OpenGL Error(eglMakeCurrent) "
                  + errStr + " :"
                );
              }
              if (_debug) Log.d(TAG,"RETRY");
              System.gc();
              waitNano();
              continue;
            }
            if (_debug) Log.d(TAG, "eglMakeCurrent done.");
            if (_debug) Log.d(TAG, "now create gl10 object");
            gl10 = new MatrixTrackingGL((GL10) (eglContext.getGL()));
            glRenderer = GLRenderer.getInstance(getApplicationContext());
            synchronized (glRenderer) {
              glRenderer.onSurfaceCreated(gl10, config, getApplicationContext());
            }
            if (_debug) Log.d(TAG, "EGL initalize done.");
            mInitialized = true;
            if (drawCommand == null) {
              drawCommand = new Runnable() {
                public void run() {
                  doDrawCommand();
                }
                protected void doDrawCommand() {
                  if (mInitialized && glRenderer != null && gl10 != null) {
                    synchronized (glRenderer) {
                      long nowTime = System.nanoTime();
                      if (nowTime - glRenderer.prevTick < BASE_TICK) {
                        try {
                          TimeUnit.NANOSECONDS.sleep(BASE_TICK - (nowTime - glRenderer.prevTick));
                        } catch (InterruptedException e) {
                        }
                      }
                      glRenderer.onDrawFrame(gl10);
                      glRenderer.prevTick = nowTime;
                    }
                    egl10.eglSwapBuffers(eglDisplay, eglSurface);
                    if (!getExecutor().isShutdown() && isVisible() && egl10.eglGetError() != EGL11.EGL_CONTEXT_LOST) {
                      doExecute(drawCommand);
                    }
                  }
                }
              };
              doExecute(drawCommand);
            }
            break;
          }
        }
      };
      doExecute(surfaceCreatedCommand);
      if (_debug) Log.d(TAG, "end onSurfaceCreated() [" + this + "]");
    }

Output:
    public void onSurfaceCreated(final SurfaceHolder holder) {
      if (_debug) Log.d(TAG, "start onSurfaceCreated() [" + this + "]");
      super.onSurfaceCreated(holder);
      Runnable surfaceCreatedCommand = new Runnable() {
        @Override
        public void run() {
          doSurfaceCreated();
        }
        protected void doSurfaceCreated() {
          if (mInitialized) {
            if (_debug) Log.d(TAG, "already Initialized(surfaceCreatedCommand)");
            return;
          }
          boolean ret;
          int counter = 0;
          int specCounter = 0;
          while(true) {
            if (_debug) Log.d(TAG, "start EGLContext.getEGL()");
            exitEgl();
            egl10 = (EGL10) EGLContext.getEGL();
            if (_debug) Log.d(TAG, "end EGLContext.getEGL()");
            if (_debug) Log.d(TAG, "start eglGetDisplay");
            eglDisplay = egl10.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
            if (_debug) Log.d(TAG, "end eglGetDisplay");
            if (eglDisplay == null || EGL10.EGL_NO_DISPLAY.equals(eglDisplay)) {
              String errStr = AtlantisService.getErrorString(egl10.eglGetError());
              if (_debug) Log.d(TAG, "eglGetDisplayがEGL_NO_DISPLAY [" + errStr + "]");
              exitEgl();
              if (++counter >= AtlantisService.RETRY_COUNT) {
                Log.e(TAG, "egl10.eglCreateContextがEGL_NO_DISPLAY");
                throw new RuntimeException("OpenGL Error(EGL_NO_DISPLAY) "
                  + errStr + ": "
                );
              }
              if (_debug) Log.d(TAG, "RETRY");
              System.gc();
              waitNano();
              continue;
            }
            {
              egl10.eglMakeCurrent(eglDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT);
            }
            int[] version = new int[2];
            if (! egl10.eglInitialize(eglDisplay, version)) {
              String errStr = AtlantisService.getErrorString(egl10.eglGetError());
              if (_debug) Log.d(TAG, "egl10.eglInitializeがfalse [" + errStr + "]");
              exitEgl();
              if (++counter >= AtlantisService.RETRY_COUNT) {
                Log.e(TAG,"egl10.eglInitializeがfalse");
                throw new RuntimeException("OpenGL Error(eglInitialize) "
                  + errStr + ": "
                );
              }
              if (_debug) Log.d(TAG,"RETRY");
              System.gc();
              waitNano();
              continue;
            }
            EGLConfig[] configs = new EGLConfig[1];
            int[] numConfig = new int[1];
            egl10.eglChooseConfig(eglDisplay, configSpec[specCounter++], configs, 1, numConfig);
            if (numConfig[0] == 0) {
              if (_debug) Log.d(TAG, "numConfig[0]=" + numConfig[0] + "");
              String errStr = AtlantisService.getErrorString(egl10.eglGetError());
              errStr += " eglChooseConfig numConfig == 0 ";
              errStr += " numConfig:[" + numConfig[0] + "]";
              errStr += " specCounter:[" + (specCounter - 1) + "]";
              exitEgl();
              Log.e(TAG,"eglChooseConfig失敗:"
                 + "numConfig:[" + numConfig[0] + "]"
                 + errStr);
              if (++counter >= AtlantisService.RETRY_COUNT) {
                throw new RuntimeException("OpenGL Error "
                  + errStr + " :"
                );
              }
              if (_debug) Log.d(TAG, "RETRY");
              System.gc();
              waitNano();
              continue;
            }
            EGLConfig config = configs[0];
            eglContext = egl10.eglCreateContext(eglDisplay, config, EGL10.EGL_NO_CONTEXT, null);
            if (eglContext == null || EGL10.EGL_NO_CONTEXT.equals(eglContext)) {
              String errStr = AtlantisService.getErrorString(egl10.eglGetError());
              errStr += "egl10.eglCreateContext == EGL_NO_CONTEXT ";
              errStr += "specCounter:[" + (specCounter - 1) + "]";
              if (_debug) Log.d(TAG, "egl10.eglCreateContext == EGL_NO_CONTEXT [" + errStr + "]");
              exitEgl();
              if (++counter >= AtlantisService.RETRY_COUNT) {
                Log.e(TAG, "egl10.eglCreateContextがEGL_NO_CONTEXT");
                throw new RuntimeException("OpenGL Error(EGL_NO_CONTEXT) "
                  + errStr + " :"
                );
              }
              if (_debug) Log.d(TAG, "RETRY");
              System.gc();
              waitNano();
              continue;
            }
            if (_debug) Log.d(TAG, "eglCreateContext done.");
            eglSurface = egl10.eglCreateWindowSurface(eglDisplay, config, holder, null);
            if (eglSurface == null || EGL10.EGL_NO_SURFACE.equals(eglSurface)) {
              String errStr = AtlantisService.getErrorString(egl10.eglGetError());
              errStr += "egl10.eglCreateWindowSurface == EGL_NO_SURFACE ";
              errStr += "specCounter:[" + (specCounter - 1) + "]";
              if (_debug) Log.d(TAG, "egl10.eglCreateWindowSurface == EGL_NO_SURFACE [" + errStr + "]");
              exitEgl();
              if (++counter >= AtlantisService.RETRY_COUNT) {
                Log.e(TAG, "egl10.eglCreateWindowSurfaceがEGL_NO_SURFACE");
                throw new RuntimeException("OpenGL Error(EGL_NO_SURFACE) "
                  + errStr + " :"
                );
              }
              if (_debug) Log.e(TAG, "RETRY");
              System.gc();
              waitNano();
              continue;
            }
            if (_debug) Log.d(TAG, "eglCreateWindowSurface done.");
            if (! egl10.eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext)) {
              String errStr = AtlantisService.getErrorString(egl10.eglGetError());
              errStr += "egl10.eglMakeCurrent == false ";
              errStr += "specCounter:[" + (specCounter - 1) + "]";
              if (_debug) Log.d(TAG, "egl10.eglMakeCurrent == false [" + errStr + "]");
              exitEgl();
              if (++counter >= AtlantisService.RETRY_COUNT) {
                Log.e(TAG,"egl10.eglMakeCurrentがfalse");
                throw new RuntimeException("OpenGL Error(eglMakeCurrent) "
                  + errStr + " :"
                );
              }
              if (_debug) Log.d(TAG,"RETRY");
              System.gc();
              waitNano();
              continue;
            }
            if (_debug) Log.d(TAG, "eglMakeCurrent done.");
            if (_debug) Log.d(TAG, "now create gl10 object");
            gl10 = new MatrixTrackingGL((GL10) (eglContext.getGL()));
            glRenderer = GLRenderer.getInstance(getApplicationContext());
            synchronized (glRenderer) {
              glRenderer.onSurfaceCreated(gl10, config, getApplicationContext());
            }
            if (_debug) Log.d(TAG, "EGL initalize done.");
            mInitialized = true;
            if (drawCommand == null) {
              drawCommand = new Runnable() {
                public void run() {
                  doDrawCommand();
                }
                protected void doDrawCommand() {
                  if (mInitialized && glRenderer != null && gl10 != null) {
                    synchronized (glRenderer) {
                      long nowTime = System.nanoTime();
                      if (nowTime - glRenderer.prevTick < BASE_TICK) {
                        try {
                          TimeUnit.NANOSECONDS.sleep(BASE_TICK - (nowTime - glRenderer.prevTick));
                        } catch (InterruptedException e) {
                        }
                      }
                      glRenderer.onDrawFrame(gl10);
                      glRenderer.prevTick = nowTime;
                    }
                    egl10.eglSwapBuffers(eglDisplay, eglSurface);
                    if (!getExecutor().isShutdown() && isVisible() && egl10.eglGetError() != EGL11.EGL_CONTEXT_LOST) {
                      doExecute(drawCommand);
                    }
                  }
                }
              };
              doExecute(drawCommand);
            }
            break;
          }
        }
      };
      doExecute(surfaceCreatedCommand);
      if (_debug) Log.d(TAG, "end onSurfaceCreated() [" + this + "]");
    }