package me.hugmanrique.pokedata.sprites.signs;

import me.hugmanrique.pokedata.sprites.Sprite;
import me.hugmanrique.pokedata.utils.ROM;

/**
 * @author Hugmanrique
 * @since 02/05/2017
 */
public class SpriteSign extends Sprite {
    private byte b2;
    private byte b4;
    private byte b5;
    private byte b6;
    private byte b7;
    private byte b8;
    private long scriptPtr;

    public SpriteSign(ROM rom) {
        x = rom.readByte();
        b2 = rom.readByte();
        y = rom.readByte();
        b4 = rom.readByte();
        b5 = rom.readByte();
        b6 = rom.readByte();
        b7 = rom.readByte();
        b8 = rom.readByte();
        scriptPtr = rom.getPointer();
    }

    @Override
    public int getSize() {
        return 12;
    }
}

package me.hugmanrique.pokedata.sprites.signs;

import me.hugmanrique.pokedata.sprites.Sprite;
import me.hugmanrique.pokedata.utils.ROM;

/**
 * @author Hugmanrique
 * @since 02/05/2017
 */
public class SpriteSign extends Sprite {
    // TODO Check if some of these bytes are words values
    private byte b2;
    private byte b4;
    private byte b5;
    private byte b6;
    private byte b7;
    private byte b8;
    private long scriptPtr;

    public SpriteSign(ROM rom) {
        x = rom.readByte();
        b2 = rom.readByte();
        y = rom.readByte();
        b4 = rom.readByte();
        b5 = rom.readByte();
        b6 = rom.readByte();
        b7 = rom.readByte();
        b8 = rom.readByte();
        scriptPtr = rom.getPointer();
    }

    @Override
    public int getSize() {
        return 12;
    }
}

Add TODO, sign bytes may be words


/*
 * Copyright 2014 Red Hat, Inc, and individual contributors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.projectodd.wunderboss.codecs;

import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

public class Codecs {

    public Codecs add(Codec codec) {
        codecs.put(codec.name(), codec);
        codecs.put(codec.contentType(), codec);

        return this;
    }

    public Codec forName(String name) {
        return codecs.get(name);
    }

    public Codec forContentType(String contentType) {
        return codecs.get(contentType);
    }

    public Collection<Codec> codecs() {
        return Collections.unmodifiableCollection(codecs.values());
    }

    private final Map<String, Codec> codecs = new HashMap<>();
}

/*
 * Copyright 2014 Red Hat, Inc, and individual contributors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.projectodd.wunderboss.codecs;

import java.util.*;

public class Codecs {

    public Codecs add(Codec codec) {
        codecs.put(codec.name(), codec);
        codecs.put(codec.contentType(), codec);

        return this;
    }

    public Codec forName(String name) {
        return codecs.get(name);
    }

    public Codec forContentType(String contentType) {
        return codecs.get(contentType);
    }

    public Set<Codec> codecs() {
        return Collections.unmodifiableSet(new HashSet<>(codecs.values()));
    }

    private final Map<String, Codec> codecs = new HashMap<>();
}

Return a set of codecs instead of a collection to strip the duplicates.


package com.redpois0n.gitj;

import java.io.File;

import javax.swing.UIManager;

import com.redpois0n.git.Repository;
import com.redpois0n.gitj.ui.MainFrame;

public class Main {

	public static void main(String[] args) throws Exception {
		try {
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

			MainFrame frame = new MainFrame();
			frame.setVisible(true);

			if (argsContains("--debug", args)) {
				File dir = new File(System.getProperty("user.dir"));
				Repository repository = new Repository(dir);

				frame.loadRepository(repository);
				frame.addBookmark(repository);
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

	public static boolean argsContains(String s, String[] args) {
		for (String arg : args) {
			if (arg.equalsIgnoreCase(s)) {
				return true;
			}
		}

		return false;
	}

	public static void displayError(Exception e) {

	}

	public static void print(String s) {
		System.out.println(s);
	}
}

package com.redpois0n.gitj;

import java.io.File;

import javax.swing.UIManager;

import com.redpois0n.git.Repository;
import com.redpois0n.gitj.ui.MainFrame;

public class Main {

	public static void main(String[] args) {
		try {
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

			MainFrame frame = new MainFrame();
			frame.setVisible(true);

			if (argsContains("--debug", args)) {
				File dir = new File(System.getProperty("user.dir"));
				Repository repository = new Repository(dir);

				frame.loadRepository(repository);
				frame.addBookmark(repository);
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

	public static boolean argsContains(String s, String[] args) {
		for (String arg : args) {
			if (arg.equalsIgnoreCase(s)) {
				return true;
			}
		}

		return false;
	}

	public static void displayError(Exception e) {

	}

	public static void print(String s) {
		System.out.println(s);
	}
}

Remove throws exception on main()


package com.google.sampling.experiential.server.stats.usage;

import java.io.IOException;
import java.util.logging.Logger;

public class UsageStatsBlobWriter {

  private static final Logger log = Logger.getLogger(UsageStatsBlobWriter.class.getName());

  public UsageStatsBlobWriter() {
  }

  public String writeStatsAsJson(String jobId, String timeZone, String requestorEmail) {
    log.info("writing usage stats report");
//    UsageStatsBackfillJob job = new UsageStatsBackfillJob();
    UsageStatsCreatorStatsJob job = new UsageStatsCreatorStatsJob();
    try {
      job.run();
    } catch (IOException e) {
      e.printStackTrace();
    }
    return "it doesn't do that anymore :-)";
  }

}

package com.google.sampling.experiential.server.stats.usage;

import java.io.IOException;
import java.util.logging.Logger;

public class UsageStatsBlobWriter {

  private static final Logger log = Logger.getLogger(UsageStatsBlobWriter.class.getName());

  public UsageStatsBlobWriter() {
  }

  public String writeStatsAsJson(String jobId, String timeZone, String requestorEmail) {
    log.info("writing usage stats report");
//    UsageStatsBackfillJob job = new UsageStatsBackfillJob();
//    UsageStatsCreatorStatsJob job = new UsageStatsCreatorStatsJob();
    UsageStatsCronJob job = new UsageStatsCronJob();
    try {
      job.run();
    } catch (IOException e) {
      e.printStackTrace();
    }
    return "no job id reported for this type of job";
  }

}

Switch back to usage stas cronjob


package ch.difty.sipamato.persistance.jooq;

public final class TestDbConstants {

    public static final int RECORD_COUNT_PREPOPULATED = 36;
    public static final Long MAX_ID_PREPOPULATED = 41l;

    private TestDbConstants() {
    }

}

package ch.difty.sipamato.persistance.jooq;

public final class TestDbConstants {

    public static final int RECORD_COUNT_PREPOPULATED = 76;
    public static final Long MAX_ID_PREPOPULATED = 81l;

    private TestDbConstants() {
    }

}

Adjust integration tests to match new number of papers


package io.syndesis.qe.steps.other;

import com.dropbox.core.DbxException;
import cucumber.api.java.en.When;
import io.syndesis.qe.utils.DropBoxUtils;
import org.assertj.core.api.Assertions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

public class DropBoxSteps {
    @Lazy
    @Autowired
    private DropBoxUtils dropBoxUtils;

    @When("^.*uploads? file with path \"([^\"]*)\" and content \"([^\"]*)\" on Dropbox$")
    public void uploadFile(String filePath, String content) throws IOException, DbxException, TimeoutException, InterruptedException {
        dropBoxUtils.uploadFile(filePath, content);
    }

    @When("^.*checks? that file with path \"([^\"]*)\" exists? on Dropbox$")
    public void checkThatFileExists(String filePath) throws IOException, DbxException, TimeoutException, InterruptedException {
        Assertions.assertThat(dropBoxUtils.checkIfFileExists(filePath)).isTrue();
    }

    @When("^.*deletes? file with path \"([^\"]*)\" from Dropbox$")
    public void deleteFile(String filePath) throws DbxException {
        dropBoxUtils.deleteFile(filePath);
        Assertions.assertThat(dropBoxUtils.checkIfFileExists(filePath)).isFalse();
    }
}

package io.syndesis.qe.steps.other;

import com.dropbox.core.DbxException;
import cucumber.api.java.en.When;
import io.syndesis.qe.utils.DropBoxUtils;
import io.syndesis.qe.utils.TestUtils;
import org.assertj.core.api.Assertions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;

import java.io.IOException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

public class DropBoxSteps {
    @Lazy
    @Autowired
    private DropBoxUtils dropBoxUtils;

    @When("^.*uploads? file with path \"([^\"]*)\" and content \"([^\"]*)\" on Dropbox$")
    public void uploadFile(String filePath, String content) throws IOException, DbxException, TimeoutException, InterruptedException {
        dropBoxUtils.uploadFile(filePath, content);
    }

    @When("^.*checks? that file with path \"([^\"]*)\" exists? on Dropbox$")
    public void checkThatFileExists(String filePath) throws IOException, DbxException, TimeoutException, InterruptedException {
        boolean fileExists = TestUtils.waitForEvent(r -> r, () -> dropBoxUtils.checkIfFileExists(filePath), TimeUnit.MINUTES, 2, TimeUnit.SECONDS, 15);
        Assertions.assertThat(fileExists).isTrue();
    }

    @When("^.*deletes? file with path \"([^\"]*)\" from Dropbox$")
    public void deleteFile(String filePath) throws DbxException {
        dropBoxUtils.deleteFile(filePath);
        Assertions.assertThat(dropBoxUtils.checkIfFileExists(filePath)).isFalse();
    }
}

Add wait for file to appear in Dropbox


package edu.northwestern.bioinformatics.studycalendar.xml.writers;

import edu.northwestern.bioinformatics.studycalendar.domain.delta.Add;
import edu.northwestern.bioinformatics.studycalendar.domain.delta.Change;
import edu.northwestern.bioinformatics.studycalendar.domain.Study;
import edu.northwestern.bioinformatics.studycalendar.domain.PlanTreeNode;
import org.dom4j.Element;

public class AddXmlSerializer extends AbstractChangeXmlSerializer {
    private static final String ADD = "add";
    private static final String INDEX = "index";

    public AddXmlSerializer(Study study) {
        super(study);
    }

    protected Change changeInstance() {
        return new Add();
    }

    protected String elementName() {
        return ADD;
    }

    protected void addAdditionalAttributes(final Change change, Element element) {
        element.addAttribute(INDEX, ((Add)change).getIndex().toString());
        PlanTreeNode<?> planTreeNode = ((Add)change).getChild();
        AbstractPlanTreeNodeXmlSerializer serializer = getPlanTreeNodeSerializerFactory().createPlanTreeNodeXmlSerializer(planTreeNode);
        Element ePlanTreeNode = serializer.createElement(planTreeNode);
        element.add(ePlanTreeNode);
    }

    protected void setAdditionalProperties(final Element element, Change change) {
        ((Add)change).setIndex(new Integer(element.attributeValue(INDEX)));
        // TODO: Call PlanTreeNodeXmlSerializer
    }
}

package edu.northwestern.bioinformatics.studycalendar.xml.writers;

import edu.northwestern.bioinformatics.studycalendar.domain.delta.Add;
import edu.northwestern.bioinformatics.studycalendar.domain.delta.Change;
import edu.northwestern.bioinformatics.studycalendar.domain.Study;
import edu.northwestern.bioinformatics.studycalendar.domain.PlanTreeNode;
import org.dom4j.Element;

import java.util.List;

public class AddXmlSerializer extends AbstractChangeXmlSerializer {
    private static final String ADD = "add";
    private static final String INDEX = "index";

    public AddXmlSerializer(Study study) {
        super(study);
    }

    protected Change changeInstance() {
        return new Add();
    }

    protected String elementName() {
        return ADD;
    }

    protected void addAdditionalAttributes(final Change change, Element element) {
        element.addAttribute(INDEX, ((Add)change).getIndex().toString());
        PlanTreeNode<?> planTreeNode = ((Add)change).getChild();
        AbstractPlanTreeNodeXmlSerializer serializer = getPlanTreeNodeSerializerFactory().createPlanTreeNodeXmlSerializer(planTreeNode);
        Element ePlanTreeNode = serializer.createElement(planTreeNode);
        element.add(ePlanTreeNode);
    }

    protected void setAdditionalProperties(final Element element, Change add) {
        ((Add)add).setIndex(new Integer(element.attributeValue(INDEX)));
        List<Element> ePlanTreeNodes = element.elements();
        Element ePlanTreeNode = ePlanTreeNodes.get(0);
        AbstractPlanTreeNodeXmlSerializer serializer = getPlanTreeNodeSerializerFactory().createPlanTreeNodeXmlSerializer(ePlanTreeNode);
        PlanTreeNode<?> planTreeNode = serializer.readElement(ePlanTreeNode);
        ((Add)add).setChild(planTreeNode);
    }
}

Add change will now de-serialize a PlanTreeNode children when readElement is called.


/*
 * Copyright 2017 anand.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package sshd.shell.springboot.console;

import static org.junit.Assert.assertTrue;
import org.junit.Test;

/**
 *
 * @author anand
 */
public class ConsoleIOTest {

    @Test
    public void testConsoleIOAsJsonException() {
        assertTrue(ConsoleIO.asJson(new X("x")).startsWith("Error processing json output"));
    }

    @lombok.AllArgsConstructor
    private static class X {
        private final String x;
    }
}

/*
 * Copyright 2017 anand.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package sshd.shell.springboot.console;

import static org.junit.Assert.assertTrue;
import org.junit.Test;

/**
 *
 * @author anand
 */
public class ConsoleIOTest {

    @Test
    public void testConsoleIOAsJsonException() {
        assertTrue(ConsoleIO.asJson(new X("x")).startsWith("Error processing json output"));
    }

    @lombok.AllArgsConstructor
    private static class X {
        final String x;
    }
}

Fix for broken unit test in Linux


package org.workcraft.presets;

import org.workcraft.gui.dialogs.ModalDialog;
import org.workcraft.utils.DesktopApi;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.io.File;

public abstract class PresetDialog<T> extends ModalDialog<PresetManager<T>> {

    public PresetDialog(Window owner, String title, PresetManager<T> presetManager) {
        super(owner, title, presetManager);
    }

    public JButton addCheckerButton(ActionListener action) {
        return addButton("Check syntax", action, false);
    }

    public JButton addHelpButton(File helpFile) {
        return addButton("Help", event -> DesktopApi.open(helpFile), true);
    }

    public abstract T getPresetData();

}

package org.workcraft.presets;

import org.workcraft.gui.dialogs.ModalDialog;
import org.workcraft.utils.DesktopApi;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.io.File;
import java.net.URI;

public abstract class PresetDialog<T> extends ModalDialog<PresetManager<T>> {

    public PresetDialog(Window owner, String title, PresetManager<T> presetManager) {
        super(owner, title, presetManager);
    }

    public JButton addCheckerButton(ActionListener action) {
        return addButton("Check syntax", action, false);
    }

    public JButton addHelpButton(File file) {
        return addButton("Help", event -> DesktopApi.open(file), true);
    }

    public JButton addHelpButton(URI uri) {
        return addButton("Help", event -> DesktopApi.browse(uri), true);
    }

    public abstract T getPresetData();

}

Enable linking external URI to Help button


package com.github.aleksandermielczarek.napkin;

import android.content.Context;

/**
 * Created by Aleksander Mielczarek on 14.05.2016.
 */
public class Napkin {

    private Napkin() {

    }

    public static <T> T provideComponent(Context context) {
        Context applicationContext = context.getApplicationContext();
        ComponentProvider<T> componentProvider = (ComponentProvider<T>) applicationContext;
        return componentProvider.provideComponent();
    }
}

package com.github.aleksandermielczarek.napkin;

import android.content.Context;

/**
 * Created by Aleksander Mielczarek on 14.05.2016.
 */
public class Napkin {

    private Napkin() {

    }

    public static <T> T provideComponent(Context context) {
        Context applicationContext = context.getApplicationContext();
        ComponentProvider<T> componentProvider = (ComponentProvider<T>) applicationContext;
        return componentProvider.provideComponent();
    }

    public static <T> T provideComponent(Context context, Class<T> componentClass) {
        Context applicationContext = context.getApplicationContext();
        ComponentProvider<T> componentProvider = (ComponentProvider<T>) applicationContext;
        return componentProvider.provideComponent();
    }
}

Add new method for component retrieve


package com.lenguyenthanh.nimble.view;

import android.app.Activity;
import android.content.Context;
import android.content.ContextWrapper;

public class ViewHelper {
  private ViewHelper() {
  }

  private static ViewHelper instance;

  public synchronized static ViewHelper getInstance() {
    if(instance == null){
      instance = new ViewHelper();
    }
    return instance;
  }

  public Activity getActivity(Context context) {
    while (!(context instanceof Activity) && context instanceof ContextWrapper) {
      context = ((ContextWrapper) context).getBaseContext();
    }
    if (!(context instanceof Activity)) {
      throw new IllegalStateException(
          "Expected an activity context, got " + context.getClass().getSimpleName());
    }
    return (Activity) context;
  }
}

package com.lenguyenthanh.nimble.view;

import android.app.Activity;
import android.content.Context;
import android.content.ContextWrapper;

public final class ViewHelper {

  private static ViewHelper instance;

  private ViewHelper() {
  }

  public static ViewHelper getInstance() {
    synchronized (ViewHelper.class) {
      if (instance == null) {
        instance = new ViewHelper();
      }
    }
    return instance;
  }

  public Activity getActivity(final Context viewContext) {
    Context context = viewContext;
    while (!(context instanceof Activity) && context instanceof ContextWrapper) {
      context = ((ContextWrapper) context).getBaseContext();
    }
    if (!(context instanceof Activity)) {
      throw new IllegalStateException(
          "Expected an activity context, got " + context.getClass().getSimpleName());
    }
    return (Activity) context;
  }
}

Fix potential bugs follow PMD


package org.realityforge.replicant.server;

import javax.annotation.Nonnull;

/**
 * A representation indicating that an entity message will cause another channel to be subscribed.
 */
public final class ChannelLink
{
  @Nonnull
  private final ChannelDescriptor _sourceChannel;
  @Nonnull
  private final ChannelDescriptor _targetChannel;

  public ChannelLink( @Nonnull final ChannelDescriptor sourceChannel,
                      @Nonnull final ChannelDescriptor targetChannel )
  {
    if ( null == sourceChannel.getSubChannelID() )
    {
      throw new IllegalArgumentException( "Channel Link source sub-channel id should not be null" );
    }
    if ( null == targetChannel.getSubChannelID() )
    {
      throw new IllegalArgumentException( "Channel Link target sub-channel id should not be null" );
    }
    _sourceChannel = sourceChannel;
    _targetChannel = targetChannel;
  }

  @Nonnull
  public ChannelDescriptor getSourceChannel()
  {
    return _sourceChannel;
  }

  @Nonnull
  public ChannelDescriptor getTargetChannel()
  {
    return _targetChannel;
  }

  @Override
  public boolean equals( final Object o )
  {
    if ( this == o )
    {
      return true;
    }
    if ( o == null || getClass() != o.getClass() )
    {
      return false;
    }

    final ChannelLink that = (ChannelLink) o;
    return _targetChannel.equals( that._targetChannel );
  }

  @Override
  public int hashCode()
  {
    return _targetChannel.hashCode();
  }

  @Override
  public String toString()
  {
    return _targetChannel.toString();
  }
}

package org.realityforge.replicant.server;

import javax.annotation.Nonnull;

/**
 * A representation indicating that an entity message will cause another channel to be subscribed.
 */
public final class ChannelLink
{
  @Nonnull
  private final ChannelDescriptor _sourceChannel;
  @Nonnull
  private final ChannelDescriptor _targetChannel;

  public ChannelLink( @Nonnull final ChannelDescriptor sourceChannel,
                      @Nonnull final ChannelDescriptor targetChannel )
  {
    _sourceChannel = sourceChannel;
    _targetChannel = targetChannel;
  }

  @Nonnull
  public ChannelDescriptor getSourceChannel()
  {
    return _sourceChannel;
  }

  @Nonnull
  public ChannelDescriptor getTargetChannel()
  {
    return _targetChannel;
  }

  @Override
  public boolean equals( final Object o )
  {
    if ( this == o )
    {
      return true;
    }
    if ( o == null || getClass() != o.getClass() )
    {
      return false;
    }

    final ChannelLink that = (ChannelLink) o;
    return _targetChannel.equals( that._targetChannel );
  }

  @Override
  public int hashCode()
  {
    return _targetChannel.hashCode();
  }

  @Override
  public String toString()
  {
    return _targetChannel.toString();
  }
}

Remove checks that are not valid as we already have graph links between typed graphs and instanced graphs and will probably have links between type graphs sooner rather than later


/*
 * Cuelib library for manipulating cue sheets.
 * Copyright (C) 2007-2009 Jan-Willem van den Broek
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */
package jwbroek.id3.v2;

import java.io.IOException;
import java.io.InputStream;

import jwbroek.id3.ID3Frame;

public interface FrameReader
{
  public ID3Frame readFrameBody(final int size, final InputStream input)
    throws IOException, UnsupportedEncodingException, MalformedFrameException;
}

/*
 * Cuelib library for manipulating cue sheets.
 * Copyright (C) 2007-2009 Jan-Willem van den Broek
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */
package jwbroek.id3.v2;

import jwbroek.id3.ID3Frame;

import java.io.IOException;
import java.io.InputStream;

public interface FrameReader {

    public ID3Frame readFrameBody(final int size, final InputStream input) throws IOException, UnsupportedEncodingException, MalformedFrameException;
}

Reformat code, remove hardcoded path.


package com.ezardlabs.lostsector.objects.weapons;

import com.ezardlabs.dethsquare.Animation;
import com.ezardlabs.dethsquare.Collider;
import com.ezardlabs.dethsquare.GameObject;
import com.ezardlabs.dethsquare.TextureAtlas;
import com.ezardlabs.lostsector.Game;
import com.ezardlabs.lostsector.objects.enemies.Enemy;

public abstract class MeleeWeapon extends Weapon {
	private final Game.DamageType damageType;
	private final GameObject wielder;
	protected String currentAnimation = null;

	public MeleeWeapon(String name, Game.DamageType damageType, GameObject wielder) {
		super(name);
		this.damageType = damageType;
		this.wielder = wielder;
	}

	public abstract Animation[] getAnimations(TextureAtlas ta);

	public abstract String getNextAnimation(int direction);

	public final void reset() {
		currentAnimation = null;
	}

	protected void damageEnemies(int damage, float left, float top, float right, float bottom) {
		Collider c;
		for (GameObject go : GameObject.findAllWithTag("enemy")) {
			if ((c = go.getComponent(Collider.class)) != null && c.bounds.intersects(left, top, right, bottom)) {
				//noinspection ConstantConditions
				go.getComponentOfType(Enemy.class).applyDamage(damage, damageType, wielder.transform.position);
			}
		}
	}
}

package com.ezardlabs.lostsector.objects.weapons;

import com.ezardlabs.dethsquare.Animation;
import com.ezardlabs.dethsquare.Collider;
import com.ezardlabs.dethsquare.GameObject;
import com.ezardlabs.dethsquare.TextureAtlas;
import com.ezardlabs.lostsector.Game;
import com.ezardlabs.lostsector.objects.enemies.Enemy;

public abstract class MeleeWeapon extends Weapon {
	private final Game.DamageType damageType;
	private final GameObject wielder;
	protected String currentAnimation = null;

	public MeleeWeapon(String name, Game.DamageType damageType, GameObject wielder) {
		super(name);
		this.damageType = damageType;
		this.wielder = wielder;
	}

	public abstract Animation[] getAnimations(TextureAtlas ta);

	public abstract String getNextAnimation(int direction);

	public final void reset() {
		currentAnimation = null;
	}

	protected void damageEnemies(float damage, float left, float top, float right, float bottom) {
		Collider c;
		for (GameObject go : GameObject.findAllWithTag("enemy")) {
			if ((c = go.getComponent(Collider.class)) != null && c.bounds.intersects(left, top, right, bottom)) {
				//noinspection ConstantConditions
				go.getComponentOfType(Enemy.class).applyDamage(damage, damageType, wielder.transform.position);
			}
		}
	}
}

Allow damage to be a float


package org.metaborg.spoofax.core.shell;

import javax.annotation.Nullable;

import org.metaborg.spoofax.core.esv.ESVReader;
import org.spoofax.interpreter.terms.IStrategoAppl;

public class ShellFacetFromESV {

    public static @Nullable ShellFacet create(IStrategoAppl esv) {
        IStrategoAppl shellTerm = ESVReader.findTerm(esv, "Shell");
        if (shellTerm == null) {
            return null;
        }
        String commandPrefix = commandPrefix(shellTerm);
        String evaluationMethod = evaluationMethod(shellTerm);
        return new ShellFacet(commandPrefix, evaluationMethod);
    }

    private static @Nullable String commandPrefix(IStrategoAppl term) {
        return ESVReader.getProperty(term, "CommandPrefix");
    }

    private static @Nullable String evaluationMethod(IStrategoAppl term) {
        return ESVReader.getProperty(term, "EvaluationMethod");
    }
}

package org.metaborg.spoofax.core.shell;

import javax.annotation.Nullable;

import org.metaborg.spoofax.core.esv.ESVReader;
import org.spoofax.interpreter.terms.IStrategoAppl;

public class ShellFacetFromESV {

    public static @Nullable ShellFacet create(IStrategoAppl esv) {
        IStrategoAppl shellTerm = ESVReader.findTerm(esv, "Shell");
        if (shellTerm == null) {
            return null;
        }
        String commandPrefix = commandPrefix(shellTerm);
        String evaluationMethod = evaluationMethod(shellTerm);
        return new ShellFacet(commandPrefix, evaluationMethod);
    }

    private static String commandPrefix(IStrategoAppl term) {
        // Default is ":"
        return ESVReader.getProperty(term, "CommandPrefix", ":");
    }

    private static String evaluationMethod(IStrategoAppl term) {
        // Default is "dynsem"
        return ESVReader.getProperty(term, "EvaluationMethod", "dynsem");
    }
}

Add default values for command prefix and evaluation method


package com.averi.worldscribe.activities;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;

import com.averi.worldscribe.R;

public class SettingsActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_settings);

        setAppBar();
    }

    /**
     * Setup this Activity's app bar.
     */
    private void setAppBar() {
        Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar);
        assert myToolbar != null;
        myToolbar.setTitle(R.string.settingsTitle);
        setSupportActionBar(myToolbar);
    }

}

package com.averi.worldscribe.activities;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.widget.Spinner;

import com.averi.worldscribe.R;
import com.averi.worldscribe.adapters.AppThemeArrayAdapter;

public class SettingsActivity extends AppCompatActivity {

    private Spinner appThemeSpinner;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_settings);

        appThemeSpinner = (Spinner) findViewById(R.id.themeSelector);

        setAppBar();
        populateAppThemeSpinner();
    }

    /**
     * Setup this Activity's app bar.
     */
    private void setAppBar() {
        Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar);
        assert myToolbar != null;
        myToolbar.setTitle(R.string.settingsTitle);
        setSupportActionBar(myToolbar);
    }

    /**
     * Populate the App Theme spinner with all available app themes.
     */
    private void populateAppThemeSpinner() {
        Integer allThemes[] = {R.style.AppTheme, R.style.SunsetOrange, R.style.EnchantedGreen,
            R.style.UbePurple, R.style.LovelyRed};
        AppThemeArrayAdapter adapter = new AppThemeArrayAdapter(this, allThemes);
        appThemeSpinner.setAdapter(adapter);
    }

}

Set adapter for select app theme spinner


/*
 * #%L
 * ACS AEM Commons Bundle
 * %%
 * Copyright (C) 2016 Adobe
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */
@aQute.bnd.annotation.Version("1.0.0")
package com.adobe.acs.commons.fam.actions;

/*
 * #%L
 * ACS AEM Commons Bundle
 * %%
 * Copyright (C) 2016 Adobe
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */
@aQute.bnd.annotation.Version("1.1.0")
package com.adobe.acs.commons.fam.actions;

Increase package version for ActionBatch addition


/*
 * Copyright 2018, TeamDev. All rights reserved.
 *
 * Redistribution and use in source and/or binary forms, with or without
 * modification, must retain the above copyright notice and the following
 * disclaimer.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package io.spine.system.server;

import com.google.protobuf.Message;
import io.spine.annotation.Internal;

/**
 * A gateway for sending messages into a system bounded context.
 *
 * @author Dmytro Dashenkov
 */
@Internal
public interface SystemGateway {

    /**
     * Posts a system command.
     *
     * <p>In a multitenant environment, the command is posted for
     * the {@linkplain io.spine.server.tenant.TenantAwareOperation current tenant}.
     *
     * @param systemCommand command message
     */
    void postCommand(Message systemCommand);
}

/*
 * Copyright 2018, TeamDev. All rights reserved.
 *
 * Redistribution and use in source and/or binary forms, with or without
 * modification, must retain the above copyright notice and the following
 * disclaimer.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package io.spine.system.server;

import com.google.protobuf.Message;
import io.spine.annotation.Internal;

/**
 * A gateway for sending messages into a system bounded context.
 *
 * @author Dmytro Dashenkov
 */
@Internal
public interface SystemGateway {

    /**
     * Posts a system command.
     *
     * <p>If the associated bounded context is
     * {@linkplain io.spine.server.BoundedContext#isMultitenant() multitenant}, the command is
     * posted for the {@linkplain io.spine.server.tenant.TenantAwareOperation current tenant}.
     *
     * @param systemCommand command message
     */
    void postCommand(Message systemCommand);
}

Make doc more strictly correct.


package com.avairebot.orion.commands.interaction;

import com.avairebot.orion.Orion;
import com.avairebot.orion.contracts.commands.InteractionCommand;

import java.util.Arrays;
import java.util.List;

public class HugCommand extends InteractionCommand {

    public HugCommand(Orion orion) {
        super(orion, "hugs");
    }

    @Override
    public List<String> getInteractionImages() {
        return Arrays.asList(
            "https://i.imgur.com/aBdIEEu.gif",
            "https://i.imgur.com/03grRGj.gif",
            "https://i.imgur.com/EuIBiLi.gif",
            "https://i.imgur.com/8KgVR9j.gif"
        );
    }

    @Override
    public String getName() {
        return "Hug Command";
    }

    @Override
    public List<String> getTriggers() {
        return Arrays.asList("hug", "hugs");
    }
}

package com.avairebot.orion.commands.interaction;

import com.avairebot.orion.Orion;
import com.avairebot.orion.contracts.commands.InteractionCommand;

import java.util.Arrays;
import java.util.List;

public class HugCommand extends InteractionCommand {

    public HugCommand(Orion orion) {
        super(orion, "hugs");
    }

    @Override
    public List<String> getInteractionImages() {
        return Arrays.asList(
            "https://i.imgur.com/aBdIEEu.gif",
            "https://i.imgur.com/03grRGj.gif",
            "https://i.imgur.com/EuIBiLi.gif",
            "https://i.imgur.com/8KgVR9j.gif",
            "https://i.imgur.com/ZepPo0t.gif"
        );
    }

    @Override
    public String getName() {
        return "Hug Command";
    }

    @Override
    public List<String> getTriggers() {
        return Arrays.asList("hug", "hugs");
    }
}

Add new image to hug interaction


/*
 * Skybot, a multipurpose discord bot
 *      Copyright (C) 2017 - 2019  Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published
 * by the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package ml.duncte123.skybot.unstable.utils;

import ml.duncte123.skybot.Author;

@Author(nickname = "Sanduhr32", author = "Maurice R S")
public class ComparatingUtils {
    // Needs to be fixed
    public static void execCheck(Throwable t) {
        t.printStackTrace();
        Throwable cause = t.getCause();
        while (cause != null) {
            cause.printStackTrace();
            cause = cause.getCause();
        }
    }
}

/*
 * Skybot, a multipurpose discord bot
 *      Copyright (C) 2017 - 2019  Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published
 * by the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package ml.duncte123.skybot.unstable.utils;

import ml.duncte123.skybot.Author;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Author(nickname = "Sanduhr32", author = "Maurice R S")
public class ComparatingUtils {

    private static final Logger logger = LoggerFactory.getLogger(ComparatingUtils.class);

    // Needs to be fixed
    public static void execCheck(Throwable t) {
        logger.error("An error occurred", t);
        t.printStackTrace();
        Throwable cause = t.getCause();
        while (cause != null) {
            cause.printStackTrace();
            cause = cause.getCause();
        }
    }
}

Add error log for execCheck


package simplemods.cheesemod.blocks;

import java.util.Random;

import simplemods.cheesemod.BaseMod;
import simplemods.cheesemod.CommonProxy;
import simplemods.cheesemod.inventory.CCreativeTabs;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.item.Item;
/**
 * No, this is not a hopper...
 */
public class BlockHotPepperCheeseOre extends Block{

	public BlockHotPepperCheeseOre(Material p_i45394_1_) {
		super(Material.rock);
		setCreativeTab(CCreativeTabs.tabBlock);
		setBlockName("pepper_cheese_ore");
		setBlockTextureName("cheesemod:pepper_cheese_ore");
		setLightLevel(0.325F);
	}

	@Override
	public Item getItemDropped(int p_149650_1_, Random p_149650_2_,
			int p_149650_3_) {
		return CommonProxy.hot_pepper_cheese;
	}

}

package simplemods.cheesemod.blocks;

import java.util.Random;

import simplemods.cheesemod.BaseMod;
import simplemods.cheesemod.CommonProxy;
import simplemods.cheesemod.inventory.CCreativeTabs;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.item.Item;
import net.minecraft.item.ItemPickaxe;
/**
 * No, this is not a hopper...
 */
public class BlockHotPepperCheeseOre extends Block{

	public BlockHotPepperCheeseOre(Material p_i45394_1_) {
		super(Material.rock);
		setCreativeTab(CCreativeTabs.tabBlock);
		setBlockName("pepper_cheese_ore");
		setBlockTextureName("cheesemod:pepper_cheese_ore");
		setLightLevel(0.325F);
		setHardness(0.4F);
		setHarvestLevel("pickaxe", 0);
	}

	@Override
	public Item getItemDropped(int p_149650_1_, Random p_149650_2_,
			int p_149650_3_) {
		return CommonProxy.hot_pepper_cheese;
	}

}

Fix hot pepper cheese hardness bug


/*
 * $HeadURL$
 * $Id$
 * Copyright (c) 2006-2013 by Public Library of Science http://plos.org http://ambraproject.org
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.ambraproject.wombat.controller;

import org.ambraproject.wombat.config.site.Site;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Controller intended to serve static pages
 */
@Controller
public class StaticContentController extends WombatController {

  @RequestMapping(value = {"/s", "/{site}/s"})
  public String renderStaticContent(Model model, @SiteParam Site site)
          throws IOException {

    return site + "/ftl/static/container";
  }

}

/*
 * $HeadURL$
 * $Id$
 * Copyright (c) 2006-2013 by Public Library of Science http://plos.org http://ambraproject.org
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.ambraproject.wombat.controller;

import org.ambraproject.wombat.config.site.Site;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.HandlerMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Controller intended to serve static pages
 */
@Controller
public class StaticContentController extends WombatController {

  @RequestMapping(value = {"/s/*", "/{site}/s/*"})
  public String renderStaticContent(Model model, @SiteParam Site site)
          throws IOException {

    return site + "/ftl/static/container";
  }

}

Use wild card for static content controller to support multiple pages


package com.openxc.measurements;

import java.util.Locale;

import com.openxc.units.State;

/**
 * The ClimateMode measurement is used to start the AC/Heater/Fan
 */
public class ClimateMode extends BaseMeasurement<State<ClimateMode.ClimateControls>> {
	public final static String ID = "climate_mode";

	public enum ClimateControls {
		UNUSED(0),
		PANEL_VENT(1),
		PANEL_FLOOR(2),
		FLOOR(3),
		FAN_SPEED_INCREMENT(11),
		FAN_SPEED_DECREMENT(12),
		AUTO(13),
		MAX_AC(14),
		RECIRCULATION(15),
		FRONT_DEFROST(16),
		REAR_DEFROST(17),
		MAX_DEFROTS(22)
	}

	public ClimateMode(State<ClimateControls> value) {
		super(value);
	}

	public ClimateMode(ClimateControls value) {
		this(new State<ClimateControls>(value));
	}
    public ClimateMode(String value) {
        this(ClimateControls.valueOf(value.toUpperCase(Locale.US)));
    }

    @Override
    public String getGenericName() {
        return ID;
    }
}

package com.openxc.measurements;

import java.util.Locale;

import com.openxc.units.State;

/**
 * The ClimateMode measurement is used to start the AC/Heater/Fan
 */
public class ClimateMode extends BaseMeasurement<State<ClimateMode.ClimateControls>> {
	public final static String ID = "climate_mode";

	public enum ClimateControls {
		OFF,
		PANEL_VENT,
		PANEL_FLOOR,
		FLOOR,
		FAN_SPEED_INCREMENT,
		FAN_SPEED_DECREMENT,
		AUTO,
		MAX_AC,
		RECIRCULATION,
		FRONT_DEFROST,
		REAR_DEFROST,
		MAX_DEFROST
	}

	public ClimateMode(State<ClimateControls> value) {
		super(value);
	}

	public ClimateMode(ClimateControls value) {
		this(new State<ClimateControls>(value));
	}
    public ClimateMode(String value) {
        this(ClimateControls.valueOf(value.toUpperCase(Locale.US)));
    }

    @Override
    public String getGenericName() {
        return ID;
    }
}

Remove int enum values, as they are unneeded


package ${packageName};

import static org.junit.Assert.*;

public class ${testClassName} {

    private final ${productionClassName} production = new ${productionClassName}("value");

    @org.junit.Test
    public void testOne() {
        for (int i = 0; i < 500; i++) {
            System.out.println("Some test output from ${testClassName}.testOne - " + i);
            System.err.println("Some test error  from ${testClassName}.testOne - " + i);
        }
        assertEquals(production.getProperty(), "value");
    }

    @org.junit.Test
    public void testTwo() {
        for (int i = 0; i < 500; i++) {
            System.out.println("Some test output from ${testClassName}.testTwo - " + i);
            System.err.println("Some test error  from ${testClassName}.testTwo - " + i);
        }
        String expected = <%= binding.hasVariable("halfTestsFail") && binding.halfTestsFail ? "\"foo\"" : "\"value\"" %>;
        assertEquals(production.getProperty(), expected);
    }
}

package ${packageName};

import static org.junit.Assert.*;

public class ${testClassName} {

    private final ${productionClassName} production = new ${productionClassName}("value");

    @org.junit.Test
    public void testOne() throws Exception {
        for (int i = 0; i < 500; i++) {
            System.out.println("Some test output from ${testClassName}.testOne - " + i);
            System.err.println("Some test error  from ${testClassName}.testOne - " + i);
            Thread.sleep(5);
        }
        assertEquals(production.getProperty(), "value");
    }

    @org.junit.Test
    public void testTwo() throws Exception {
        for (int i = 0; i < 500; i++) {
            System.out.println("Some test output from ${testClassName}.testTwo - " + i);
            System.err.println("Some test error  from ${testClassName}.testTwo - " + i);
            Thread.sleep(5);
        }
        String expected = <%= binding.hasVariable("halfTestsFail") && binding.halfTestsFail ? "\"foo\"" : "\"value\"" %>;
        assertEquals(production.getProperty(), expected);
    }
}

Introduce pause in the output so as not to overwhelm the IPC mechanism between test worker and build host.


package de.is24.util.monitoring.metrics;

import com.codahale.metrics.MetricRegistry;
import de.is24.util.monitoring.AbstractMonitorPlugin;
import java.util.concurrent.TimeUnit;

public class MetricsPlugin extends AbstractMonitorPlugin {
  private MetricRegistry metricRegistry;

  public MetricsPlugin(MetricRegistry metricRegistry) {
    this.metricRegistry = metricRegistry;
  }

  @Override
  public String getUniqueName() {
    return null;
  }

  @Override
  public void initializeCounter(String name) {
  }

  @Override
  public void incrementCounter(String name, int increment) {
    metricRegistry.counter(name).inc(increment);
  }

  @Override
  public void incrementHighRateCounter(String name, int increment) {
    incrementCounter(name, increment);
  }

  @Override
  public void addTimerMeasurement(String name, long timing) {
    metricRegistry.timer(name).update(timing, TimeUnit.MILLISECONDS);
  }

  @Override
  public void addSingleEventTimerMeasurement(String name, long timing) {
    metricRegistry.timer(name).update(timing, TimeUnit.MILLISECONDS);
  }

  @Override
  public void addHighRateTimerMeasurement(String name, long timing) {
    metricRegistry.timer(name).update(timing, TimeUnit.MILLISECONDS);
  }

  @Override
  public void initializeTimerMeasurement(String name) {
  }

  @Override
  public void afterRemovalNotification() {
  }
}

package de.is24.util.monitoring.metrics;

import com.codahale.metrics.MetricRegistry;
import de.is24.util.monitoring.AbstractMonitorPlugin;
import java.util.concurrent.TimeUnit;

public class MetricsPlugin extends AbstractMonitorPlugin {
  private MetricRegistry metricRegistry;

  public MetricsPlugin(MetricRegistry metricRegistry) {
    this.metricRegistry = metricRegistry;
  }

  @Override
  public String getUniqueName() {
    return null;
  }

  @Override
  public void initializeCounter(String name) {
  }

  @Override
  public void incrementCounter(String name, int increment) {
    metricRegistry.counter(withCountersPrefix(name)).inc(increment);
  }

  @Override
  public void incrementHighRateCounter(String name, int increment) {
    incrementCounter(name, increment);
  }

  @Override
  public void addTimerMeasurement(String name, long timing) {
    metricRegistry.timer(withTimersPrefix(name)).update(timing, TimeUnit.MILLISECONDS);
  }

  @Override
  public void addSingleEventTimerMeasurement(String name, long timing) {
    addTimerMeasurement(name, timing);
  }

  @Override
  public void addHighRateTimerMeasurement(String name, long timing) {
    addTimerMeasurement(name, timing);
  }

  @Override
  public void initializeTimerMeasurement(String name) {
  }

  @Override
  public void afterRemovalNotification() {
  }

  private String withTimersPrefix(String name) {
    return "timers." + name;
  }

  private String withCountersPrefix(String name) {
    return "counters." + name;
  }
}

Add prefixes for timers and counters to emulate StatsD behavior.


package com.rudeshko.csscomb;

import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.LangDataKeys;
import com.intellij.psi.PsiFile;

public class CssCombAction extends AnAction {
    public void actionPerformed(AnActionEvent e) {
        PsiFile psiFile = e.getData(LangDataKeys.PSI_FILE);
        if (psiFile != null) {
            psiFile.acceptChildren(new CSSCombVisitor());
        }
    }

    @Override
    public void update(AnActionEvent e) {
        e.getPresentation().setEnabled(isCss(e));
    }

    private boolean isCss(AnActionEvent e) {
        PsiFile psiFile = e.getData(LangDataKeys.PSI_FILE);
        return psiFile != null && "CSS".equals(psiFile.getLanguage().getDisplayName());
    }
}

package com.rudeshko.csscomb;

import com.intellij.lang.css.CSSLanguage;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.LangDataKeys;
import com.intellij.psi.PsiFile;

public class CssCombAction extends AnAction {
    public void actionPerformed(AnActionEvent e) {
        PsiFile psiFile = getPsiFileFromActionEvent(e);
        if (psiFile != null) {
            psiFile.acceptChildren(new CSSCombVisitor());
        }
    }

    @Override
    public void update(AnActionEvent e) {
        e.getPresentation().setEnabled(isCss(e));
    }

    private boolean isCss(AnActionEvent e) {
        PsiFile psiFile = getPsiFileFromActionEvent(e);
        return psiFile != null && psiFile.getLanguage().isKindOf(CSSLanguage.INSTANCE);

    }

    private static PsiFile getPsiFileFromActionEvent(AnActionEvent e) {
        return e.getData(LangDataKeys.PSI_FILE);
    }
}

Correct way to detect file language


package com.github.vlsi.mat.tests.calcite;

import org.junit.Test;

import java.sql.SQLException;

public class GetByKeyTests extends SampleHeapDumpTests {
  @Test
  public void testHashMapByKey() throws SQLException {
    returnsInOrder("select getByKey(m.this, 'GMT') v from java.util.HashMap m where getSize(m.this) = 208",
        "v",
        "Etc/GMT");
  }

  @Test
  public void testReferenceResult() throws SQLException {
    returnsInOrder("select length(getByKey(m.this, 'GMT')['value']) l from java.util.HashMap m where getSize(m.this) " +
            "= 208",
        "l",
        "7");
  }

  //@Test
  public void testConcurrentHashMap() throws SQLException {
    returnsInOrder("select getByKey(m.this, 'MST')['ID'] c from java.util.concurrent.ConcurrentHashMap m where " +
            "getByKey(m.this, 'MST') is not null",
        "c",
        "MST");
  }
}

package com.github.vlsi.mat.tests.calcite;

import org.junit.Ignore;
import org.junit.Test;

import java.sql.SQLException;

public class GetByKeyTests extends SampleHeapDumpTests {
  @Test
  public void testHashMapByKey() throws SQLException {
    returnsInOrder("select getByKey(m.this, 'GMT') v from java.util.HashMap m where getSize(m.this) = 208",
        "v",
        "Etc/GMT");
  }

  @Test
  public void testReferenceResult() throws SQLException {
    returnsInOrder("select length(getByKey(m.this, 'GMT')['value']) l from java.util.HashMap m where getSize(m.this) " +
            "= 208",
        "l",
        "7");
  }

  @Test
  @Ignore
  public void testConcurrentHashMap() throws SQLException {
    returnsInOrder("select getByKey(m.this, 'MST')['ID'] c from java.util.concurrent.ConcurrentHashMap m where " +
            "getByKey(m.this, 'MST') is not null",
        "c",
        "MST");
  }
}

Use @Ignore instead of commenting @Test


/*
 * CODENVY CONFIDENTIAL
 * __________________
 *
 * [2013] - [2014] Codenvy, S.A.
 * All Rights Reserved.
 *
 * NOTICE:  All information contained herein is, and remains
 * the property of Codenvy S.A. and its suppliers,
 * if any.  The intellectual and technical concepts contained
 * herein are proprietary to Codenvy S.A.
 * and its suppliers and may be covered by U.S. and Foreign Patents,
 * patents in process, and are protected by trade secret or copyright law.
 * Dissemination of this information or reproduction of this material
 * is strictly forbidden unless prior written permission is obtained
 * from Codenvy S.A..
 */
package com.codenvy.ide.ext.datasource.shared;

import java.util.Map;

import com.codenvy.dto.shared.DTO;

@DTO
public interface DatabaseDTO extends DatabaseMetadataEntityDTO {

    DatabaseDTO withName(String name);

    DatabaseDTO withSchemas(Map<String, SchemaDTO> schemas);

    Map<String, SchemaDTO> getSchemas();

    void setSchemas(Map<String, SchemaDTO> schemas);

}

/*
 * CODENVY CONFIDENTIAL
 * __________________
 *
 * [2013] - [2014] Codenvy, S.A.
 * All Rights Reserved.
 *
 * NOTICE:  All information contained herein is, and remains
 * the property of Codenvy S.A. and its suppliers,
 * if any.  The intellectual and technical concepts contained
 * herein are proprietary to Codenvy S.A.
 * and its suppliers and may be covered by U.S. and Foreign Patents,
 * patents in process, and are protected by trade secret or copyright law.
 * Dissemination of this information or reproduction of this material
 * is strictly forbidden unless prior written permission is obtained
 * from Codenvy S.A..
 */
package com.codenvy.ide.ext.datasource.shared;

import java.util.Map;

import com.codenvy.dto.shared.DTO;

@DTO
public interface DatabaseDTO extends DatabaseMetadataEntityDTO {

    DatabaseDTO withName(String name);

    DatabaseDTO withSchemas(Map<String, SchemaDTO> schemas);

    DatabaseDTO withJdbcDriverName(String driverName);

    DatabaseDTO withJdbcDriverVersion(String driverVersion);

    DatabaseDTO withDatabaseProductName(String productName);

    DatabaseDTO withDatabaseProductVersion(String productVersion);

    DatabaseDTO withUserName(String userName);

    Map<String, SchemaDTO> getSchemas();

    void setSchemas(Map<String, SchemaDTO> schemas);

}

Add more information in the dataabse DTO


/*******************************************************************************
 * Copyright (c) Incoming Pty. Ltd. 2015
 ******************************************************************************/
package com.incoming.example.incomingpvntemplate;

import android.app.Activity;
import android.os.Bundle;
import android.preference.PreferenceFragment;

/**
 * Basic settings Activity that includes the  default Push Video settings and some content targeting settings for the user.
 */
public class PVNTemplateSettings extends Activity {

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Display the Push Video settings fragment as the main content.
    getFragmentManager().beginTransaction().replace(android.R.id.content, new SettingsFragment()).commit();
  }

  public static class SettingsFragment extends PreferenceFragment {
    @Override
    public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      // Include the content targeting settings
      addPreferencesFromResource(R.xml.preferences);
      // Include the PVN SDK settings
      addPreferencesFromResource(R.xml.pvn_preferences);
    }
  }

}

/*******************************************************************************
 * Copyright (c) Incoming Pty. Ltd. 2015
 ******************************************************************************/
package com.incoming.example.incomingpvntemplate;

import android.app.Activity;
import android.os.Bundle;
import android.preference.PreferenceFragment;
import android.preference.PreferenceManager;

/**
 * Basic settings Activity that includes the  default Push Video settings and some content targeting settings for the user.
 */
public class PVNTemplateSettings extends Activity {

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Display the settings fragment as the main content.
    getFragmentManager().beginTransaction().replace(android.R.id.content, new SettingsFragment()).commit();

    // Apply the default values from the preferences file. This is important if application preferences are used to control audience
    // segmentation targets.
    PreferenceManager.setDefaultValues(PVNTemplateSettings.this, R.xml.pvn_preferences, false);
    PreferenceManager.setDefaultValues(PVNTemplateSettings.this, R.xml.preferences, false);

  }

  public static class SettingsFragment extends PreferenceFragment {
    @Override
    public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      // Include the content targeting settings
      addPreferencesFromResource(R.xml.preferences);
      // Include the PVN SDK settings
      addPreferencesFromResource(R.xml.pvn_preferences);
    }
  }

}

Apply default preference values in xml to preference store


/*
 * Copyright 2010 Proofpoint, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.proofpoint.bootstrap;

import com.google.common.collect.Maps;

import java.util.Map;

class LifeCycleMethodsMap
{
    private final Map<Class<?>, LifeCycleMethods> map = Maps.newHashMap();

    synchronized LifeCycleMethods get(Class<?> clazz)
    {
        LifeCycleMethods methods = map.get(clazz);
        if (methods == null) {
            methods = new LifeCycleMethods(clazz);
            map.put(clazz, methods);
        }
        return methods;
    }
}

/*
 * Copyright 2010 Proofpoint, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.proofpoint.bootstrap;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

class LifeCycleMethodsMap
{
    private final Map<Class<?>, LifeCycleMethods> map = new ConcurrentHashMap<>();

    public LifeCycleMethods get(Class<?> clazz)
    {
        return map.computeIfAbsent(clazz, LifeCycleMethods::new);
    }
}

Reduce contention during lifecycle tracking


package com.indeed.proctor.common.dynamic;

import com.indeed.proctor.common.model.ConsumableTestDefinition;
import com.sun.javaws.exceptions.InvalidArgumentException;

import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;

public class TestNamePatternFilter implements DynamicFilter {
    private final Pattern pattern;

    /**
     * Construct the filter from regular expression string.
     * @param regex regular expression for test name pattern
     * @throws IllegalArgumentException If the regular expression's syntax is invalid.
     */
    public TestNamePatternFilter(final String regex) {
        try {
            this.pattern = Pattern.compile(regex);
        } catch (final PatternSyntaxException e) {
            throw new IllegalArgumentException("the regular expression for test name pattern has syntax error.", e);
        }
    }

    @Override
    public boolean matches(final String testName, final ConsumableTestDefinition testDefinition) {
        return pattern.matcher(testName).matches();
    }
}

package com.indeed.proctor.common.dynamic;

import com.indeed.proctor.common.model.ConsumableTestDefinition;

import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;

public class TestNamePatternFilter implements DynamicFilter {
    private final Pattern pattern;

    /**
     * Construct the filter from regular expression string.
     *
     * @param regex regular expression for test name pattern
     * @throws IllegalArgumentException If the regular expression's syntax is invalid.
     */
    public TestNamePatternFilter(final String regex) {
        try {
            this.pattern = Pattern.compile(regex);
        } catch (final PatternSyntaxException e) {
            throw new IllegalArgumentException("the regular expression for test name pattern has syntax error.", e);
        }
    }

    @Override
    public boolean matches(final String testName, final ConsumableTestDefinition testDefinition) {
        return pattern.matcher(testName).matches();
    }
}

Fix compile error due to invalid import


package com.grayben.riskExtractor.htmlScorer.elementScorers;

import org.jsoup.nodes.Element;
import org.jsoup.parser.Tag;

/**
 * Score the segmentation of an {@link org.jsoup.nodes.Element} based upon the {@link org.jsoup.parser.Tag} it contains.
 */
public class SegmentationElementScorer implements Scorer<Element> {

	Scorer<Tag> tagScorer;

	@Override
	public int score(Element input) {
		// TODO Auto-generated method stub
		return 0;
	}

}

package com.grayben.riskExtractor.htmlScorer.elementScorers;

import org.jsoup.nodes.Element;
import org.jsoup.parser.Tag;

/**
 * Score the segmentation of an {@link org.jsoup.nodes.Element} based upon the {@link org.jsoup.parser.Tag} it contains.
 */
public class SegmentationElementScorer implements Scorer<Element> {

	Scorer<Tag> tagScorer;

	@Override
	public int score(Element input) {
		Integer integer = null;
		return integer;
	}

}

Clean up, make scoring function utterly useless for testing fun


package net.happybrackets.extras.assignment_autograding;

import java.io.IOException;

/**
 * Created by ollie on 8/08/2016.
 */
public class TestBeadsChecker {

    public static void main(String[] args) throws IOException {

        ExampleBeadsCheckable checkable = new ExampleBeadsCheckable();
        BeadsChecker checker = new BeadsChecker(checkable, 10000, 1000, "My Results");

    }

}

package net.happybrackets.extras.assignment_autograding;

import java.io.IOException;

/**
 * Created by ollie on 8/08/2016.
 */
public class TestBeadsChecker {

    public static void main(String[] args) throws IOException {

        ExampleBeadsCheckable checkable = new ExampleBeadsCheckable();
        BeadsChecker checker = new BeadsChecker(checkable, 10000, 1000, "build/Test Results");

    }

}

Put Test Results from BeadsChecker Test into build dir.


package com.carrot.carrotshop.listener;

import org.spongepowered.api.event.Listener;
import org.spongepowered.api.event.Order;
import org.spongepowered.api.event.network.ClientConnectionEvent;
import org.spongepowered.api.text.Text;
import org.spongepowered.api.text.action.TextActions;
import org.spongepowered.api.text.format.TextColors;

import com.carrot.carrotshop.ShopsData;

public class PlayerConnexionListener {

	@Listener(order=Order.LATE)
	public void onPlayerJoin(ClientConnectionEvent.Join event)
	{
		if (ShopsData.hasSoldSomethingOffline(event.getTargetEntity().getUniqueId()) && event.getTargetEntity().hasPermission("carrotshop.report.self")) {
			event.getTargetEntity().sendMessage(Text.of(TextColors.YELLOW, "Someone used your shop signs while you were away. Use ",
					Text.builder("/cs report")
					.color(TextColors.DARK_AQUA)
					.onClick(TextActions.runCommand("/cs report")).build(),
					TextColors.YELLOW, " for more details" ));
		}
	}
}

package com.carrot.carrotshop.listener;

import org.spongepowered.api.event.Listener;
import org.spongepowered.api.event.Order;
import org.spongepowered.api.event.network.ClientConnectionEvent;
import org.spongepowered.api.text.Text;
import org.spongepowered.api.text.action.TextActions;
import org.spongepowered.api.text.format.TextColors;

import com.carrot.carrotshop.ShopsData;

public class PlayerConnexionListener {

	@Listener(order=Order.LATE)
	public void onPlayerJoin(ClientConnectionEvent.Join event)
	{
		if (ShopsData.hasSoldSomethingOffline(event.getTargetEntity().getUniqueId()) && event.getTargetEntity().hasPermission("carrotshop.report.self")) {
			event.getTargetEntity().sendMessage(Text.of(TextColors.YELLOW, "Someone used your shop signs while you were away. Use ",
					Text.builder("/carrotreport")
					.color(TextColors.DARK_AQUA)
					.onClick(TextActions.runCommand("/carrotreport")).build(),
					TextColors.YELLOW, " for more details" ));
		}
	}
}

Change command name in hint


package org.robovm.bindings.cocoatouch.gamekit;

import org.robovm.rt.bro.ValuedEnum;

public enum GKGameCenterViewControllerState implements ValuedEnum {
	GKGameCenterViewControllerStateDefault(0), GKGameCenterViewControllerStateLeaderboards(1), GKGameCenterViewControllerStateAchievements(
		2), GKGameCenterViewControllerStateChallenges(3);

	private final long n;

	private GKGameCenterViewControllerState (long n) {
		this.n = n;
	}

	@Override
	public long value () {
		return n;
	}

}

package org.robovm.bindings.cocoatouch.gamekit;

import org.robovm.rt.bro.ValuedEnum;

public enum GKGameCenterViewControllerState implements ValuedEnum {
	GKGameCenterViewControllerStateDefault(-1), GKGameCenterViewControllerStateLeaderboards(0), GKGameCenterViewControllerStateAchievements(
		1), GKGameCenterViewControllerStateChallenges(2);

	private final long n;

	private GKGameCenterViewControllerState (long n) {
		this.n = n;
	}

	@Override
	public long value () {
		return n;
	}

}

Fix for Game Center to open the correct views


/*
 * copyright 2016 Hewlett Packard Enterprise
 */
package com.hpe.caf.worker.document;

public final class DocumentWorkerFailure
{
    public String workerName;
    public String failureId;
    public String failureMessage;
    public String failureStack;
}

/*
 * copyright 2016 Hewlett Packard Enterprise
 */
package com.hpe.caf.worker.document;

public final class DocumentWorkerFailure
{
    public String failureId;
    public String failureMessage;
    public String failureStack;
}

Revert "CAF-1888: Updated to include workerName variable for reporting functionality"


/*
 *
 * third: That's How I Roll Dice
 *     A dice roller for roleplaying nerds.
 *         http://swords.id.au/third/
 *
 * Copyright (c) 2010, Brendan Jurd <bj@swords.id.au>
 * All rights reserved.
 *
 * third is open-source, licensed under the Simplified BSD License, a copy of
 * which can be found in the file LICENSE at the top level of the source code.
 */
package au.id.swords.third2;

class ThirdUtil
{
    /*
     * Append 'content' to the 'builder', separated with 'delimiter'.
     *
     * If this is the first item to be appended to the builder (i.e. it is
     * currently empty), do not insert the delimiter.
     */
    public static StringBuilder append(StringBuilder builder, String delimiter, Object content)
    {
        if(builder.length() > 0)
            return builder.append(delimiter).append(content);
        else
            return builder.append(content);
    }
}

/*
 *
 * third: That's How I Roll Dice
 *     A dice roller for roleplaying nerds.
 *         http://swords.id.au/third/
 *
 * Copyright (c) 2010, Brendan Jurd <bj@swords.id.au>
 * All rights reserved.
 *
 * third is open-source, licensed under the Simplified BSD License, a copy of
 * which can be found in the file LICENSE at the top level of the source code.
 */
package au.id.swords.third2;

class ThirdUtil
{
    /*
     * Append 'content' to the 'builder', separated with 'delimiter'.
     *
     * If this is the first item to be appended to the builder (i.e. it is
     * currently empty), do not insert the delimiter.
     */
    public static StringBuilder append(StringBuilder builder, String delimiter, Object content)
    {
        if(builder.length() > 0)
            return builder.append(delimiter).append(content);
        else
            return builder.append(content);
    }

    public static int[] primitiveIntArray(java.util.Collection<Integer> c)
    {
        int[] result = new int[c.size()];
        int i = 0;
        for(Integer v: c)
        {
            result[i] = v;
            i++;
        }
        return result;
    }
}

Add utility method for making primitive int arrays.


package teamOD.armourReborn.common.core.handler;

import java.io.File;

import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;

public final class ConfigHandler {

	public static Configuration config ;

	public static boolean generateOre = true ;
	public static boolean disableVanillaArmours = true ;

	public static void init (File configFile) {
		config = new Configuration (configFile) ;

		config.load() ;
		load() ;

		config.save() ;
	}

	public static void load () {
		String desc ;

		desc = "Set this to false to disable the world generation of this mod's added ores." + "\n" ;
		desc += "Make sure your pack has an alternative way to obtain the following ores if disabled:" + "\n" ;
		desc += "Copper Ore, Aluminum Ore" ;
		generateOre = loadPropBool ("enable.worldGen", desc, generateOre) ;

		desc = "If set to true, all vanilla armours will not provide any protection to the user" ;
		disableVanillaArmours = loadPropBool ("disable.vanillaArmour", desc, disableVanillaArmours) ;

	}

	private static boolean loadPropBool(String propName, String desc, boolean default_) {
		Property prop = config.get(Configuration.CATEGORY_GENERAL, propName, default_);
		prop.setComment(desc);

		return prop.getBoolean(default_);
	}
}

package teamOD.armourReborn.common.core.handler;

import java.io.File;

import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;

public final class ConfigHandler {

	public static Configuration config ;

	public static boolean generateOre = true ;
	public static boolean disableVanillaArmours = false ;

	public static void init (File configFile) {
		config = new Configuration (configFile) ;

		config.load() ;
		load() ;

		config.save() ;
	}

	public static void load () {
		String desc ;

		desc = "Set this to false to disable the world generation of this mod's added ores." + "\n" ;
		desc += "Make sure your pack has an alternative way to obtain the following ores if disabled:" + "\n" ;
		desc += "Copper Ore, Aluminum Ore" ;
		generateOre = loadPropBool ("enable.worldGen", desc, generateOre) ;

		desc = "If set to true, all vanilla armours will not provide any protection to the user" ;
		disableVanillaArmours = loadPropBool ("disable.vanillaArmour", desc, disableVanillaArmours) ;

	}

	private static boolean loadPropBool(String propName, String desc, boolean default_) {
		Property prop = config.get(Configuration.CATEGORY_GENERAL, propName, default_);
		prop.setComment(desc);

		return prop.getBoolean(default_);
	}
}

Disable vanilla armours is turned off by default


package edu.northwestern.bioinformatics.studycalendar.testing;

import junit.framework.TestCase;

import java.lang.reflect.Method;
import java.util.Set;
import java.util.HashSet;

import org.easymock.classextension.EasyMock;

/**
 * @author Rhett Sutphin
 */
public abstract class StudyCalendarTestCase extends TestCase {
    protected Set<Object> mocks = new HashSet<Object>();

    ////// MOCK REGISTRATION AND HANDLING

    protected <T> T registerMockFor(Class<T> forClass) {
        return registered(EasyMock.createMock(forClass));
    }

    protected <T> T registerMockFor(Class<T> forClass, Method[] methodsToMock) {
        return registered(EasyMock.createMock(forClass, methodsToMock));
    }

    protected void replayMocks() {
        for (Object mock : mocks) EasyMock.replay(mock);
    }

    protected void verifyMocks() {
        for (Object mock : mocks) EasyMock.verify(mock);
    }

    protected void resetMocks() {
        for (Object mock : mocks) EasyMock.reset(mock);
    }

    private <T> T registered(T mock) {
        mocks.add(mock);
        return mock;
    }
}

package edu.northwestern.bioinformatics.studycalendar.testing;

import edu.nwu.bioinformatics.commons.testing.CoreTestCase;

import junit.framework.TestCase;

import java.lang.reflect.Method;
import java.util.Set;
import java.util.HashSet;

import org.easymock.classextension.EasyMock;

/**
 * @author Rhett Sutphin
 */
public abstract class StudyCalendarTestCase extends CoreTestCase {
    protected Set<Object> mocks = new HashSet<Object>();

    ////// MOCK REGISTRATION AND HANDLING

    protected <T> T registerMockFor(Class<T> forClass) {
        return registered(EasyMock.createMock(forClass));
    }

    protected <T> T registerMockFor(Class<T> forClass, Method[] methodsToMock) {
        return registered(EasyMock.createMock(forClass, methodsToMock));
    }

    protected void replayMocks() {
        for (Object mock : mocks) EasyMock.replay(mock);
    }

    protected void verifyMocks() {
        for (Object mock : mocks) EasyMock.verify(mock);
    }

    protected void resetMocks() {
        for (Object mock : mocks) EasyMock.reset(mock);
    }

    private <T> T registered(T mock) {
        mocks.add(mock);
        return mock;
    }
}

Extend CoreTestCase for access to assertPositve/Negative, others


/*
 * JBoss, Home of Professional Open Source
 * Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors
 * as indicated by the @author tags. All rights reserved.
 * See the copyright.txt in the distribution for a
 * full listing of individual contributors.
 *
 * This copyrighted material is made available to anyone wishing to use,
 * modify, copy, or redistribute it subject to the terms and conditions
 * of the GNU Lesser General Public License, v. 2.1.
 * This program is distributed in the hope that it will be useful, but WITHOUT A
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
 * You should have received a copy of the GNU Lesser General Public License,
 * v.2.1 along with this distribution; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA  02110-1301, USA.
 */
package org.switchyard.quickstarts.demos.helpdesk;

import org.switchyard.component.bpm.BPM;
import org.switchyard.component.bpm.jbpm.CommandBasedWSHumanTaskHandler;

/**
 * @author David Ward <dward@jboss.org> (C) 2011 Red Hat Inc.
 */
@BPM(
    processInterface = HelpDeskService.class,
    taskHandlers = { CommandBasedWSHumanTaskHandler.class }
)
public final class HelpDeskServiceProcess {}

/*
 * JBoss, Home of Professional Open Source
 * Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors
 * as indicated by the @author tags. All rights reserved.
 * See the copyright.txt in the distribution for a
 * full listing of individual contributors.
 *
 * This copyrighted material is made available to anyone wishing to use,
 * modify, copy, or redistribute it subject to the terms and conditions
 * of the GNU Lesser General Public License, v. 2.1.
 * This program is distributed in the hope that it will be useful, but WITHOUT A
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
 * You should have received a copy of the GNU Lesser General Public License,
 * v.2.1 along with this distribution; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA  02110-1301, USA.
 */
package org.switchyard.quickstarts.demos.helpdesk;

import org.switchyard.component.bpm.Process;
import org.switchyard.component.bpm.task.jbpm.CommandBasedWSHumanTaskHandler;

/**
 * @author David Ward <dward@jboss.org> (C) 2011 Red Hat Inc.
 */
@Process(
    value=HelpDeskService.class,
    taskHandlers={CommandBasedWSHumanTaskHandler.class})
public interface HelpDeskServiceProcess {}

Add BPM annotations to mark methods as process action triggers


package com.lopei.collageview;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ImageView;

import com.lopei.collageview.CollageView.ImageForm;

/**
 * Created by alan on 08.12.16.
 */

public class RectangleImageView extends ImageView {
    private ImageForm imageForm = ImageForm.IMAGE_FORM_SQUARE;

    public RectangleImageView(Context context, ImageForm imageForm) {
        super(context);
        this.imageForm = imageForm;
    }

    public RectangleImageView(Context context, AttributeSet attrs, ImageForm imageForm) {
        super(context, attrs);
        this.imageForm = imageForm;
    }

    public RectangleImageView(Context context, AttributeSet attrs, ImageForm imageForm, int defStyle) {
        super(context, attrs, defStyle);
        this.imageForm = imageForm;
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
        if (getParent() != null) {
            getLayoutParams().height = widthMeasureSpec / imageForm.getDivider();
            setMeasuredDimension(widthMeasureSpec, widthMeasureSpec / imageForm.getDivider());
        }
    }
}

package com.lopei.collageview;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ImageView;

import com.lopei.collageview.CollageView.ImageForm;

/**
 * Created by alan on 08.12.16.
 */

public class RectangleImageView extends androidx.appcompat.widget.AppCompatImageView {
    private ImageForm imageForm = ImageForm.IMAGE_FORM_SQUARE;

    public RectangleImageView(Context context, ImageForm imageForm) {
        super(context);
        this.imageForm = imageForm;
    }

    public RectangleImageView(Context context, AttributeSet attrs, ImageForm imageForm) {
        super(context, attrs);
        this.imageForm = imageForm;
    }

    public RectangleImageView(Context context, AttributeSet attrs, ImageForm imageForm, int defStyle) {
        super(context, attrs, defStyle);
        this.imageForm = imageForm;
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
        if (getParent() != null) {
            getLayoutParams().height = widthMeasureSpec / imageForm.getDivider();
            setMeasuredDimension(widthMeasureSpec, widthMeasureSpec / imageForm.getDivider());
        }
    }
}

Make rectangle image view extend AppCompatImageView


package org.cniska.noc3;

/**
 * Configuration parameters for the application.
 */
class Config {
    // Adjust these values if necessary.
    int numberOfPlayers = 3;
    int numberOfRounds = 2;
    int totalNumberOfChips = 500;
}

package org.cniska.noc3;

/**
 * Configuration parameters for the application.
 */
class Config {
    // Adjust these values if necessary.
    int numberOfPlayers = 5;
    int numberOfRounds = 20;
    int totalNumberOfChips = 500;
}

Adjust the config params according to the exercise description


package com.saraighatsoftware.flexicalculator;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;

class ResultFormat {

    private static final int RESULT_SCALE = 6;
    private static final DecimalFormat format = new DecimalFormat();

    static String Format(BigDecimal value) {
        format.setMaximumFractionDigits(RESULT_SCALE);
        format.setMinimumFractionDigits(0);
        format.setGroupingUsed(false);
        format.setRoundingMode(RoundingMode.HALF_EVEN);
        return format.format(value).replace('-', Calculator.SUBTRACT_CHAR);
    }
}

package com.saraighatsoftware.flexicalculator;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;

class ResultFormat {

    private static final int RESULT_SCALE = 9;
    private static final DecimalFormat format = new DecimalFormat();

    static String Format(BigDecimal value) {
        format.setMaximumFractionDigits(RESULT_SCALE);
        format.setMinimumFractionDigits(0);
        format.setGroupingUsed(false);
        format.setRoundingMode(RoundingMode.HALF_EVEN);
        return format.format(value).replace('-', Calculator.SUBTRACT_CHAR);
    }
}

Change result scale from 6 to 9


package edu.pdx.cs410J.grader.poa.ui;

import com.google.inject.Singleton;
import edu.pdx.cs410J.grader.poa.POASubmissionsView;

import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
import java.awt.*;
import java.util.List;
import java.util.Vector;

@Singleton
public class POASubmissionsPanel extends JPanel implements POASubmissionsView {

  private final JList<String> submissions;

  public POASubmissionsPanel() {
    submissions = new JList<>();
    submissions.setVisibleRowCount(10);

    this.setLayout(new BorderLayout());

    this.add(new JScrollPane(submissions), BorderLayout.CENTER);

    this.add(new JLabel("Hello??"), BorderLayout.SOUTH);
  }

  @Override
  public void setPOASubmissionsDescriptions(List<String> strings) {
    submissions.setListData(new Vector<>(strings));
  }

  @Override
  public void addSubmissionSelectedListener(POASubmissionSelectedListener listener) {
    submissions.addListSelectionListener(e -> {
      if (isFinalEventInUserSelection(e)) {
        listener.submissionSelected(e.getFirstIndex());
      }
    });
  }

  private boolean isFinalEventInUserSelection(ListSelectionEvent e) {
    return !e.getValueIsAdjusting();
  }
}

package edu.pdx.cs410J.grader.poa.ui;

import com.google.inject.Singleton;
import edu.pdx.cs410J.grader.poa.POASubmissionsView;

import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
import java.awt.*;
import java.util.List;
import java.util.Vector;

@Singleton
public class POASubmissionsPanel extends JPanel implements POASubmissionsView {

  private final JList<String> submissions;

  public POASubmissionsPanel() {
    submissions = new JList<>();
    submissions.setVisibleRowCount(10);

    this.setLayout(new BorderLayout());

    this.add(new JScrollPane(submissions), BorderLayout.CENTER);

    this.add(new JLabel("Hello??"), BorderLayout.SOUTH);
  }

  @Override
  public void setPOASubmissionsDescriptions(List<String> strings) {
    submissions.setListData(new Vector<>(strings));
  }

  @Override
  public void addSubmissionSelectedListener(POASubmissionSelectedListener listener) {
    submissions.addListSelectionListener(e -> {
      if (isFinalEventInUserSelection(e)) {
        listener.submissionSelected(submissions.getSelectedIndex());
      }
    });
  }

  private boolean isFinalEventInUserSelection(ListSelectionEvent e) {
    return !e.getValueIsAdjusting();
  }
}

Fix an issue with submission selection by just using the index of the selected submission.


package org.realityforge.replicant.client;

import arez.component.NoSuchEntityException;
import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

/**
 * The service interface for looking up entities by type+id.
 * This is used from within the entities during linking phase.
 */
public interface EntityLocator
{
  @Nonnull
  default <T> T getByID( @Nonnull final Class<T> type, @Nonnull final Object id )
  {
    final T entity = findByID( type, id );
    if ( null == entity )
    {
      throw new NoSuchEntityException( id );
    }
    return entity;
  }

  /**
   * Lookup an entity of specified type with specified id, returning null if not present.
   *
   * @param type the type of the entity.
   * @param id   the id of the entity.
   * @param <T>  the entity type.
   * @return the entity or null if no such entity.
   */
  @Nullable
  <T> T findByID( @Nonnull Class<T> type, @Nonnull Object id );
}

package org.realityforge.replicant.client;

import arez.component.NoSuchEntityException;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

/**
 * The service interface for looking up entities by type+id.
 * This is used from within the entities during linking phase.
 */
public interface EntityLocator
{
  @Nonnull
  default <T> T getByID( @Nonnull final Class<T> type, @Nonnull final Object id )
  {
    final T entity = findById( type, id );
    if ( null == entity )
    {
      throw new NoSuchEntityException( id );
    }
    return entity;
  }

  /**
   * Lookup an entity of specified type with specified id, returning null if not present.
   *
   * @param type the type of the entity.
   * @param id   the id of the entity.
   * @param <T>  the entity type.
   * @return the entity or null if no such entity.
   */
  @Nullable
  <T> T findById( @Nonnull Class<T> type, @Nonnull Object id );
}

Rename method findByID to findById


package io.subutai.common.peer;

import org.codehaus.jackson.annotate.JsonIgnore;

/**
 * Registration DTO
 */
public class RegistrationData
{
    private PeerInfo peerInfo;
    @JsonIgnore
    private String keyPhrase;
    private RegistrationStatus status;
    private Encrypted data;

    public RegistrationData()
    {
    }

    public RegistrationData( final PeerInfo peerInfo, final String keyPhrase, final RegistrationStatus status )
    {
        this.peerInfo = peerInfo;
        this.keyPhrase = keyPhrase;
        this.status = status;
    }

    public RegistrationData( final PeerInfo peerInfo, final RegistrationStatus status )
    {
        this.peerInfo = peerInfo;
        this.status = status;
    }

    public PeerInfo getPeerInfo()
    {
        return peerInfo;
    }

    public void setPeerInfo( final PeerInfo peerInfo )
    {
        this.peerInfo = peerInfo;
    }

    public String getKeyPhrase()
    {
        return keyPhrase;
    }

    public RegistrationStatus getStatus()
    {
        return status;
    }

    public void setStatus( final RegistrationStatus status )
    {
        this.status = status;
    }

    public Encrypted getData()
    {
        return data;
    }

    public void setData( final Encrypted data )
    {
        this.data = data;
    }

    public void setKeyPhrase( final String keyPhrase )
    {
        this.keyPhrase = keyPhrase;
    }
}

package io.subutai.common.peer;

import org.codehaus.jackson.annotate.JsonIgnore;

/**
 * Registration DTO
 */
public class RegistrationData
{
    private PeerInfo peerInfo;
    @JsonIgnore
    private String keyPhrase;
    private RegistrationStatus status;
    private Encrypted data;
    private String token;

    public RegistrationData()
    {
    }

    public RegistrationData( final PeerInfo peerInfo, final String keyPhrase, final RegistrationStatus status )
    {
        this.peerInfo = peerInfo;
        this.keyPhrase = keyPhrase;
        this.status = status;
    }

    public RegistrationData( final PeerInfo peerInfo, final RegistrationStatus status )
    {
        this.peerInfo = peerInfo;
        this.status = status;
    }

    public PeerInfo getPeerInfo()
    {
        return peerInfo;
    }

    public void setPeerInfo( final PeerInfo peerInfo )
    {
        this.peerInfo = peerInfo;
    }

    public String getKeyPhrase()
    {
        return keyPhrase;
    }

    public RegistrationStatus getStatus()
    {
        return status;
    }

    public void setStatus( final RegistrationStatus status )
    {
        this.status = status;
    }

    public Encrypted getData()
    {
        return data;
    }

    public void setData( final Encrypted data )
    {
        this.data = data;
    }

    public void setKeyPhrase( final String keyPhrase )
    {
        this.keyPhrase = keyPhrase;
    }

    /**
     * Token generated by the owner of initiator peer. To be used
     * in kurjun if the request is approved by the remote peer.
     */
    public String getToken()
    {
        return token;
    }

    /**
     * Token generated by the owner of initiator peer. To be used
     * in kurjun if the request is approved by the remote peer.
     */
    public void setToken( String token )
    {
        this.token = token;
    }

}

Add token to be transfered between registered peers


/*
 * Copyright 2015 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.springframework.social.facebook.api;

import java.io.Serializable;

/**
 * A simple reference to another Facebook object without the complete set of object data.
 * @author Craig Walls
 */
@SuppressWarnings("serial")
public class Reference extends FacebookObject implements Serializable {

	private final String id;

	private final String name;

	public Reference(String id) {
		this(id, null);
	}

	public Reference(String id, String name) {
		this.id = id;
		this.name = name;
	}

	public String getId() {
		return id;
	}

	public String getName() {
		return name;
	}

}

/*
 * Copyright 2015 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.springframework.social.facebook.api;

import java.io.Serializable;

/**
 * A simple reference to another Facebook object without the complete set of object data.
 * @author Craig Walls
 */
@SuppressWarnings("serial")
public class Reference extends FacebookObject implements Serializable {

	private final String id;

	private final String name;

    @SuppressWarnings("unused")
    private Reference() {
        this(null, null);
    }

    public Reference(String id) {
		this(id, null);
	}

	public Reference(String id, String name) {
		this.id = id;
		this.name = name;
	}

	public String getId() {
		return id;
	}

	public String getName() {
		return name;
	}

}

Fix MappingInstantiationException for no default constructor


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.dspace.doi;

import java.sql.SQLException;
import org.dspace.content.DCValue;
import org.dspace.content.Item;
import org.dspace.content.MetadataSchema;

/**
 * Convenience methods involved in registering DOIs.
 * @author dan
 */
public class DryadDOIRegistrationHelper {

    public static final String REGISTER_PENDING_PUBLICATION_STEP = "registerPendingPublicationStep";

    public static boolean isDataPackageInPublicationBlackout(Item dataPackage) throws SQLException {
        // Publication blackout is indicated by provenance metadata
        boolean isInBlackout = false;
        DCValue provenance[] =  dataPackage.getMetadata(MetadataSchema.DC_SCHEMA, "description", "provenance", "en");
        for(DCValue dcValue : provenance) {
            // only return true if the last recorded provenance indicates publication blackout
            if(dcValue.value != null)
                if(dcValue.value.contains("Entered publication blackout")) {
                    isInBlackout = true;
                } else {
                    isInBlackout = false;
            }

        }
        // now find something that would negate blackout
        return isInBlackout;
    }

}

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.dspace.doi;

import java.sql.SQLException;
import org.dspace.content.DCValue;
import org.dspace.content.Item;
import org.dspace.content.MetadataSchema;

/**
 * Convenience methods involved in registering DOIs.
 * @author dan
 */
public class DryadDOIRegistrationHelper {

    public static final String REGISTER_PENDING_PUBLICATION_STEP = "registerPendingPublicationStep";

    public static boolean isDataPackageInPublicationBlackout(Item dataPackage) throws SQLException {
        // Publication blackout is indicated by provenance metadata
        boolean isInBlackout = false;
        DCValue provenance[] =  dataPackage.getMetadata(MetadataSchema.DC_SCHEMA, "description", "provenance", Item.ANY);
        for(DCValue dcValue : provenance) {
            // only return true if the last recorded provenance indicates publication blackout
            if(dcValue.value != null)
                if(dcValue.value.contains("Entered publication blackout")) {
                    isInBlackout = true;
                } else {
                    isInBlackout = false;
            }

        }
        // now find something that would negate blackout
        return isInBlackout;
    }

}

Remove 'en' restriction when checking provenance for blackout