package net.qbar.common.card;

import java.util.Map;

import com.google.common.collect.Maps;

import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;

public class PunchedCardDataManager
{
    private static PunchedCardDataManager instance;

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

    private Map<Short, PunchedCardData> datas;

    private PunchedCardDataManager()
    {
        datas = Maps.newHashMap();
    }

    public PunchedCardData registerDataType(int id, IPunchedCard data)
    {
        if (this.datas.containsKey(id))
            throw new IllegalArgumentException("id already used");
        PunchedCardData card = new PunchedCardData(id, data);

        this.datas.put(card.getId(), card);
        return card;
    }

    public PunchedCardData getCardData(ItemStack card)
    {
        NBTTagCompound tag = card.getTagCompound();
        if (!tag.hasKey("PunchedCardDataId"))
            throw new IllegalArgumentException("Invalid ItemStack");
        short id = tag.getShort("PunchedCardDataId");
        if (!this.datas.containsKey(id))
            throw new IllegalArgumentException("No data found");

        return this.datas.get(id);
    }
}

package net.qbar.common.card;

import java.util.Map;

import com.google.common.collect.Maps;

import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;

public class PunchedCardDataManager
{
    private static volatile PunchedCardDataManager instance;

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

    private Map<Short, PunchedCardData> datas;

    private PunchedCardDataManager()
    {
        datas = Maps.newHashMap();
    }

    public PunchedCardData registerDataType(int id, IPunchedCard data)
    {
        if (this.datas.containsKey(id))
            throw new IllegalArgumentException("id already used");
        PunchedCardData card = new PunchedCardData(id, data);

        this.datas.put(card.getId(), card);
        return card;
    }

    public PunchedCardData getCardData(ItemStack card)
    {
        NBTTagCompound tag = card.getTagCompound();
        if (!tag.hasKey("PunchedCardDataId"))
            throw new IllegalArgumentException("Invalid ItemStack");
        short id = tag.getShort("PunchedCardDataId");
        if (!this.datas.containsKey(id))
            throw new IllegalArgumentException("No data found");

        return this.datas.get(id);
    }
}

Use synchronized block for getInstance


package protocolsupport.protocol.packet.middleimpl.clientbound.play.v_4_5_6_7_8_9r1_9r2_10_11_12;

import protocolsupport.api.ProtocolVersion;
import protocolsupport.protocol.packet.ClientBoundPacket;
import protocolsupport.protocol.packet.middle.clientbound.play.MiddleTimeUpdate;
import protocolsupport.protocol.packet.middleimpl.ClientBoundPacketData;
import protocolsupport.utils.recyclable.RecyclableCollection;
import protocolsupport.utils.recyclable.RecyclableSingletonList;

public class TimeUpdate extends MiddleTimeUpdate {

	@Override
	public RecyclableCollection<ClientBoundPacketData> toData(ProtocolVersion version) {
		ClientBoundPacketData serializer = ClientBoundPacketData.create(ClientBoundPacket.PLAY_UPDATE_TIME_ID, version);
		serializer.writeLong(worldAge);
		serializer.writeLong(timeOfDay);
		return RecyclableSingletonList.create(serializer);
	}

}

package protocolsupport.protocol.packet.middleimpl.clientbound.play.v_4_5_6_7_8_9r1_9r2_10_11_12;

import protocolsupport.api.ProtocolVersion;
import protocolsupport.protocol.packet.ClientBoundPacket;
import protocolsupport.protocol.packet.middle.clientbound.play.MiddleTimeUpdate;
import protocolsupport.protocol.packet.middleimpl.ClientBoundPacketData;
import protocolsupport.utils.recyclable.RecyclableCollection;
import protocolsupport.utils.recyclable.RecyclableSingletonList;

public class TimeUpdate extends MiddleTimeUpdate {

	@Override
	public RecyclableCollection<ClientBoundPacketData> toData(ProtocolVersion version) {
		ClientBoundPacketData serializer = ClientBoundPacketData.create(ClientBoundPacket.PLAY_UPDATE_TIME_ID, version);
		if (version.isBeforeOrEq(ProtocolVersion.MINECRAFT_1_4_7)) {
			timeOfDay = Math.abs(timeOfDay);
		}
		serializer.writeLong(worldAge);
		serializer.writeLong(timeOfDay);
		return RecyclableSingletonList.create(serializer);
	}

}

Use abs time in <= 1.4.7 to emulate daynight cycle disable


package net.wequick.example.small.appavailable_if_stub;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.support.annotation.Nullable;
import android.util.Log;

/**
 * Created by galen on 2016/11/4.
 */
public class MyService extends Service {

    private static final String TAG = "MyService";

    @Override
    public void onCreate() {
        super.onCreate();
        Log.i(TAG, "onCreate");
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        Log.i(TAG, "onDestroy");
    }

    @Nullable
    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }
}

package net.wequick.example.small.appavailable_if_stub;

import android.app.Service;
import android.content.Intent;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.support.annotation.Nullable;
import android.widget.Toast;

/**
 * Created by galen on 2016/11/4.
 */
public class MyService extends Service {

    private Handler mUI;

    @Override
    public void onCreate() {
        super.onCreate();
        mUI = new Handler(Looper.myLooper());
        mUI.post(new Runnable() {
            @Override
            public void run() {
                Toast.makeText(getApplicationContext(), "MyService is on!", Toast.LENGTH_SHORT).show();
            }
        });
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        mUI.post(new Runnable() {
            @Override
            public void run() {
                Toast.makeText(getApplicationContext(), "MyService is off!", Toast.LENGTH_SHORT).show();
                mUI = null;
            }
        });
    }

    @Nullable
    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }
}

Add toast on server start and stop for sample


package org.nwapw.abacus.tree;

/**
 * Enum to represent the type of the token that has been matched
 * by the lexer.
 */
public enum TokenType {

    INTERNAL_FUNCTION_END(-1),
    ANY(0), WHITESPACE(1), COMMA(2), OP(3), TREE_VALUE_OP(3),
    NUM(4), VARIABLE(5), FUNCTION(6), TREE_VALUE_FUNCTION(6), OPEN_PARENTH(7), CLOSE_PARENTH(8);

    /**
     * The priority by which this token gets sorted.
     */
    public final int priority;

    /**
     * Creates a new token type with the given priority.
     *
     * @param priority the priority of this token type.
     */
    TokenType(int priority) {
        this.priority = priority;
    }

}

package org.nwapw.abacus.tree;

/**
 * Enum to represent the type of the token that has been matched
 * by the lexer.
 */
public enum TokenType {

    INTERNAL_FUNCTION_END(-1),
    ANY(0), WHITESPACE(1), COMMA(2), VARIABLE(3), OP(4), TREE_VALUE_OP(4),
    NUM(5), FUNCTION(6), TREE_VALUE_FUNCTION(6), OPEN_PARENTH(7), CLOSE_PARENTH(7);

    /**
     * The priority by which this token gets sorted.
     */
    public final int priority;

    /**
     * Creates a new token type with the given priority.
     *
     * @param priority the priority of this token type.
     */
    TokenType(int priority) {
        this.priority = priority;
    }

}

Fix token precedence for variable names / operators.


package sorts.options;

import sorts.results.Column;

import com.google.common.base.Preconditions;

public class Index {

  protected final Column column;
  protected final Order order;

  public Index(Column column) {
    this(column, Order.ASCENDING);
  }

  public Index(Column column, Order order) {
    Preconditions.checkNotNull(column);
    Preconditions.checkNotNull(order);

    this.column = column;
    this.order = order;
  }

  public static Index define(String columnName) {
    return define(Column.create(columnName));
  }

  public static Index define(Column column) {
    return new Index(column);
  }

  public static Index define(Column column, Order order) {
    return new Index(column, order);
  }

  public Column column() {
    return this.column;
  }

  public Order order() {
    return this.order;
  }

  @Override
  public boolean equals(Object o) {
    if (o instanceof Index) {
      Index other = (Index) o;

      if (this.column.equals(other.column) && this.order.equals(other.order)) {
        return true;
      }
    }

    return false;
  }

  @Override
  public int hashCode() {
    return this.column.hashCode() ^ this.order.hashCode();
  }

  @Override
  public String toString() {
    return this.column + ", " + this.order;
  }

}

package sorts.options;

import sorts.results.Column;

import com.google.common.base.Preconditions;

public class Index {

  protected final Column column;
  protected final Order order;

  public Index(Column column) {
    this(column, Order.ASCENDING);
  }

  public Index(Column column, Order order) {
    Preconditions.checkNotNull(column);
    Preconditions.checkNotNull(order);

    this.column = column;
    this.order = order;
  }

  public static Index define(String columnName) {
    return define(Column.create(columnName));
  }

  public static Index define(Column column) {
    return new Index(column);
  }

  public static Index define(String columnName, Order order) {
	return define(Column.create(columnName), order);
  }

  public static Index define(Column column, Order order) {
    return new Index(column, order);
  }

  public Column column() {
    return this.column;
  }

  public Order order() {
    return this.order;
  }

  @Override
  public boolean equals(Object o) {
    if (o instanceof Index) {
      Index other = (Index) o;

      if (this.column.equals(other.column) && this.order.equals(other.order)) {
        return true;
      }
    }

    return false;
  }

  @Override
  public int hashCode() {
    return this.column.hashCode() ^ this.order.hashCode();
  }

  @Override
  public String toString() {
    return this.column + ", " + this.order;
  }

}

Add in a missing convenience method


package com.annimon.hotarufx.visual;

import com.annimon.hotarufx.lib.NumberValue;
import com.annimon.hotarufx.lib.StringValue;
import com.annimon.hotarufx.lib.Types;
import com.annimon.hotarufx.lib.Value;
import java.util.function.Function;
import javafx.scene.paint.Color;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor(access = AccessLevel.PACKAGE)
@Getter
public enum PropertyType {

    NUMBER(toNumber(), o -> NumberValue.of((Number) o)),
    PAINT(v -> Color.valueOf(v.asString()), o -> new StringValue(o.toString()));

    private final Function<Value, Object> fromHFX;
    private final Function<Object, Value> toHFX;

    private static Function<Value, Object> toNumber() {
        return value -> {
            if (value.type() == Types.NUMBER) {
                return ((NumberValue) value).raw();
            }
            return value.asNumber();
        };
    }
}

package com.annimon.hotarufx.visual;

import com.annimon.hotarufx.lib.NumberValue;
import com.annimon.hotarufx.lib.StringValue;
import com.annimon.hotarufx.lib.Types;
import com.annimon.hotarufx.lib.Value;
import java.util.function.Function;
import javafx.scene.paint.Color;
import lombok.AccessLevel;
import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor(access = AccessLevel.PACKAGE)
public enum PropertyType {

    NUMBER(toNumber(), o -> NumberValue.of((Number) o)),
    PAINT(v -> Color.valueOf(v.asString()), o -> new StringValue(o.toString()));

    private final Function<Value, Object> fromHFX;
    private final Function<Object, Value> toHFX;

    @SuppressWarnings("unchecked")
    public <T> Function<Value, T> getFromHFX() {
        return (Function<Value, T>) fromHFX;
    }

    @SuppressWarnings("unchecked")
    public <T> Function<T, Value> getToHFX() {
        return (Function<T, Value>) toHFX;
    }

    private static Function<Value, Object> toNumber() {
        return value -> {
            if (value.type() == Types.NUMBER) {
                return ((NumberValue) value).raw();
            }
            return value.asNumber();
        };
    }
}

Add generic type to converters signature


package com.github.triplesolitaire;

import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.os.Bundle;

/**
 * Dialog to show when a user pauses the game
 */
public class GamePauseDialogFragment extends DialogFragment {
    @Override
    public Dialog onCreateDialog(final Bundle savedInstanceState) {
        final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setTitle(R.string.app_name).setIcon(R.drawable.icon).setMessage(R.string.game_paused)
                .setNegativeButton(getText(R.string.resume), null);
        return builder.create();
    }
}

package com.github.triplesolitaire;

import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.os.Build;
import android.os.Bundle;

/**
 * Dialog to show when a user pauses the game
 */
public class GamePauseDialogFragment extends DialogFragment {
    @Override
    public Dialog onCreateDialog(final Bundle savedInstanceState) {
        final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
            builder.setIcon(R.drawable.icon);
        }
        builder.setTitle(R.string.app_name).setMessage(R.string.game_paused)
                .setNegativeButton(getText(R.string.resume), null);
        return builder.create();
    }
}

Remove icon from Pause dialog on Android 5.0+ devices


/*
 * Copyright 2014 Codenvy, S.A.
 *
 * 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.codenvy.ide.ext.datasource.client.explorer;

import com.google.gwt.i18n.client.LocalizableResource.DefaultLocale;
import com.google.gwt.i18n.client.Messages;

/**
 * Constant interface for the datasource explorer.
 *
 * @author "Mickaël Leduque"
 */
@DefaultLocale("en")
public interface DatasourceExplorerConstants extends Messages {

    /** The tooltip for the refresh button. */
    @DefaultMessage("Refresh and explore")
    String exploreButtonTooltip();

    /** The string used in the part (top). */
    @DefaultMessage("Datasource Explorer")
    String datasourceExplorerPartTitle();

    /** The string used in the side tab. */
    @DefaultMessage("Datasource")
    String datasourceExplorerTabTitle();
}

/*
 * Copyright 2014 Codenvy, S.A.
 *
 * 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.codenvy.ide.ext.datasource.client.explorer;

import com.google.gwt.i18n.client.Constants;
import com.google.gwt.i18n.client.LocalizableResource.DefaultLocale;

/**
 * Constant interface for the datasource explorer.
 *
 * @author "Mickaël Leduque"
 */
@DefaultLocale("en")
public interface DatasourceExplorerConstants extends Constants {

    /** The tooltip for the refresh button. */
    @DefaultStringValue("Refresh and explore")
    String exploreButtonTooltip();

    /** The string used in the part (top). */
    @DefaultStringValue("Datasource Explorer")
    String datasourceExplorerPartTitle();

    /** The string used in the side tab. */
    @DefaultStringValue("Datasource")
    String datasourceExplorerTabTitle();

    @DefaultStringArrayValue({"Simplest - Tables and views",
            "Standard - adds materialized views, aliases, syn.",
            "System - add system tables/views",
            "All existing table types"})
    String[] tableCategories();
}

Add constants for table category selection


package com.jfixby.tools.bleed.gemserk;

import com.jfixby.cmns.api.filesystem.File;
import com.jfixby.tools.bleed.api.TextureBleedSpecs;

public class GemserkProcessorSpecsImpl implements TextureBleedSpecs {

	private File folder;

	@Override
	public File getInputFolder() {
		return folder;
	}

	@Override
	public void setInputFolder(File input_folder) {
		folder = input_folder;
	}

}

package com.jfixby.tools.bleed.gemserk;

import com.jfixby.cmns.api.filesystem.File;
import com.jfixby.tools.bleed.api.TextureBleedSpecs;

public class GemserkProcessorSpecsImpl implements TextureBleedSpecs {

	private File folder;

	@Override
	public File getInputFolder() {
		return folder;
	}

	@Override
	public void setInputFolder(File input_folder) {
		folder = input_folder;
	}

	@Override
	public boolean getDebugMode() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public void setDebugMode(boolean flag) {
		// TODO Auto-generated method stub

	}

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

	@Override
	public void setMaxScans(int maxScans) {
		// TODO Auto-generated method stub

	}

}

Add some parameters: debugFlag and maxScans.


package org.azavea.otm.data;

import org.json.JSONArray;

public abstract class ModelContainer<T> {
	protected JSONArray data;

	public void setData(JSONArray array) {
		this.data = array;
	}

	public JSONArray getData() {
		return data;
	}

	public abstract T[] getAll();
}

package org.azavea.otm.data;

import java.util.LinkedHashMap;

import org.json.JSONArray;

public abstract class ModelContainer<T> {
	protected JSONArray data;

	public void setData(JSONArray array) {
		this.data = array;
	}

	public JSONArray getData() {
		return data;
	}

	public abstract LinkedHashMap<Integer,T> getAll();
}

Change T[] to Hash for modelContainer


package org.jboss.loom.actions;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

/**
 * Sorts a list of actions so that dependencies go first, and depending actions go after.
 *
 * @Jira  MIGR-104
 * @author Ondrej Zizka, ozizka at redhat.com
 */
public class ActionDependencySorter {

    public static <T extends IMigrationAction> List<T> sort( List<T> actions ){

        List<T> ret = new ArrayList(actions);
        Collections.sort( ret, new DepComparator() );
        return ret;
    }

    static class DepComparator implements Comparator<IMigrationAction> {
        @Override
        public int compare( IMigrationAction o1, IMigrationAction o2 ) {
            try {
                int a = o1.dependsOn( o2 );
                if( a != -1 )  return -a;

                int b = o2.dependsOn( o1 );
                if( b != -1 )  return -b;

                return Integer.compare( o1.hashCode(), o2.hashCode() ); // For deterministic behavior.
            }
            catch( AbstractStatefulAction.CircularDependencyException ex ){
                throw new RuntimeException( ex );
            }
        }
    }

}// class

package org.jboss.loom.actions;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

/**
 * Sorts a list of actions so that dependencies go first, and depending actions go after.
 *
 * @Jira  MIGR-104
 * @author Ondrej Zizka, ozizka at redhat.com
 */
public class ActionDependencySorter {

    public static <T extends IMigrationAction> List<T> sort( List<T> actions ){

        List<T> ret = new ArrayList(actions);
        Collections.sort( ret, new DepComparator() );
        return ret;
    }

    static class DepComparator implements Comparator<IMigrationAction> {
        @Override
        public int compare( IMigrationAction o1, IMigrationAction o2 ) {
            try {
                int a = o1.dependsOn( o2 );
                if( a != -1 )  return -a;

                int b = o2.dependsOn( o1 );
                if( b != -1 )  return -b;

                //return Integer.compare( o1.hashCode(), o2.hashCode() ); // For deterministic behavior.
                return 0; // All right that was not a good idea - it breaks those from Migrators which don't set dependency yet...
            }
            catch( AbstractStatefulAction.CircularDependencyException ex ){
                throw new RuntimeException( ex );
            }
        }
    }

}// class

Remove sorting by hashCode() - All right that was not a good idea - it breaks those from Migrators which don't set dependency yet...


package br.com.alura.agenda.modelo;

import java.io.Serializable;

/**
 * Created by alura on 12/08/15.
 */
public class Aluno implements Serializable {
    private Long id;
    private String nome;
    private String endereco;
    private String telefone;
    private String site;
    private Double nota;
    private String caminhoFoto;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public String getEndereco() {
        return endereco;
    }

    public void setEndereco(String endereco) {
        this.endereco = endereco;
    }

    public String getTelefone() {
        return telefone;
    }

    public void setTelefone(String telefone) {
        this.telefone = telefone;
    }

    public String getSite() {
        return site;
    }

    public void setSite(String site) {
        this.site = site;
    }

    public Double getNota() {
        return nota;
    }

    public void setNota(Double nota) {
        this.nota = nota;
    }

    public String getCaminhoFoto() {
        return caminhoFoto;
    }

    public void setCaminhoFoto(String caminhoFoto) {
        this.caminhoFoto = caminhoFoto;
    }

    @Override
    public String toString() {
        return getId() + " - " + getNome();
    }
}

package br.com.alura.agenda.modelo;

import com.fasterxml.jackson.annotation.JsonProperty;

import java.io.Serializable;

public class Aluno implements Serializable {

    @JsonProperty("idCliente")
    private Long id;
    private String nome;
    private String endereco;
    private String telefone;
    private String site;
    private Double nota;
    private String caminhoFoto;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public String getEndereco() {
        return endereco;
    }

    public void setEndereco(String endereco) {
        this.endereco = endereco;
    }

    public String getTelefone() {
        return telefone;
    }

    public void setTelefone(String telefone) {
        this.telefone = telefone;
    }

    public String getSite() {
        return site;
    }

    public void setSite(String site) {
        this.site = site;
    }

    public Double getNota() {
        return nota;
    }

    public void setNota(Double nota) {
        this.nota = nota;
    }

    public String getCaminhoFoto() {
        return caminhoFoto;
    }

    public void setCaminhoFoto(String caminhoFoto) {
        this.caminhoFoto = caminhoFoto;
    }

    @Override
    public String toString() {
        return getId() + " - " + getNome();
    }
}

Add UUID on user update


package ganymedes01.etfuturum.blocks;

import ganymedes01.etfuturum.EtFuturum;
import ganymedes01.etfuturum.IConfigurable;
import ganymedes01.etfuturum.core.utils.Utils;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;

public class CoarseDirt extends Block implements IConfigurable {

	public CoarseDirt() {
		super(Material.ground);
		setHardness(0.5F);
		setStepSound(soundTypeGravel);
		setBlockTextureName("coarse_dirt");
		setBlockName(Utils.getUnlocalisedName("coarse_dirt"));
		setCreativeTab(EtFuturum.enableCoarseDirt ? EtFuturum.creativeTab : null);
	}

	@Override
	public boolean isEnabled() {
		return EtFuturum.enableCoarseDirt;
	}
}

package ganymedes01.etfuturum.blocks;

import ganymedes01.etfuturum.EtFuturum;
import ganymedes01.etfuturum.IConfigurable;
import ganymedes01.etfuturum.core.utils.Utils;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.util.ForgeDirection;

public class CoarseDirt extends Block implements IConfigurable {

	public CoarseDirt() {
		super(Material.ground);
		setHardness(0.5F);
		setStepSound(soundTypeGravel);
		setBlockTextureName("coarse_dirt");
		setBlockName(Utils.getUnlocalisedName("coarse_dirt"));
		setCreativeTab(EtFuturum.enableCoarseDirt ? EtFuturum.creativeTab : null);
	}

	@Override
	public boolean canSustainPlant(IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plant) {
		return Blocks.dirt.canSustainPlant(world, x, y, z, direction, plant);
	}

	@Override
	public boolean isEnabled() {
		return EtFuturum.enableCoarseDirt;
	}
}

Fix Coarse Dirt not letting plants be placed on top of itself


package com.bookcrossing.mobile.modules;

import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.storage.FirebaseStorage;

import javax.inject.Singleton;

import dagger.Module;
import dagger.Provides;

/** (c) 2016 Andrey Mukamolow aka fobo66 <fobo66@protonmail.com>
 * Created by fobo66 on 15.11.2016.
 */

@Module
public class ApiModule {

    @Provides
    @Singleton
    public FirebaseDatabase provideDatabase() {
        return FirebaseDatabase.getInstance();
    }

    @Provides
    @Singleton
    public FirebaseStorage provideStorage() {
        return FirebaseStorage.getInstance();
    }

    @Provides
    @Singleton
    public FirebaseAuth provideAuth() {
        return FirebaseAuth.getInstance();
    }

}

package com.bookcrossing.mobile.modules;

import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.storage.FirebaseStorage;

import dagger.Module;
import dagger.Provides;

/** (c) 2016 Andrey Mukamolow aka fobo66 <fobo66@protonmail.com>
 * Created by fobo66 on 15.11.2016.
 */

@Module
public class ApiModule {

    @Provides
    public FirebaseDatabase provideDatabase() {
        return FirebaseDatabase.getInstance();
    }

    @Provides
    public FirebaseStorage provideStorage() {
        return FirebaseStorage.getInstance();
    }

    @Provides
    public FirebaseAuth provideAuth() {
        return FirebaseAuth.getInstance();
    }

}

Remove @Singletone annotation from API for better performance


package com.amee.platform.science;

import org.joda.time.DateTime;

import java.util.Date;

public abstract class BaseDate extends java.util.Date {

    protected String dateStr;

    public BaseDate(long time) {
        setTime(time);
        setDefaultDateStr();
    }

    public BaseDate(String dateStr) {
        super();
        if (dateStr != null) {
            setTime(parseStr(dateStr));
            this.dateStr = dateStr;
        } else {
            setTime(defaultDate());
            setDefaultDateStr();
        }
    }

    protected abstract long parseStr(String dateStr);

    protected abstract void setDefaultDateStr();

    protected abstract long defaultDate();

    public String toString() {
        return dateStr;
    }

    public DateTime toDateTime() {
        return new DateTime(this.getTime());
    }
}

package com.amee.platform.science;

import org.joda.time.DateTime;

import java.util.Date;

public abstract class BaseDate extends java.util.Date {

    protected String dateStr;

    public BaseDate(long time) {
        setTime(time);
        setDefaultDateStr();
    }

    public BaseDate(String dateStr) {
        super();
        if (dateStr != null) {
            setTime(parseStr(dateStr));
            this.dateStr = dateStr;
        } else {
            setTime(defaultDate());
            setDefaultDateStr();
        }
    }

    protected abstract long parseStr(String dateStr);

    protected abstract void setDefaultDateStr();

    protected abstract long defaultDate();

    public String toString() {
        return dateStr;
    }

    public DateTime toDateTime() {
        return new DateTime(this.getTime());
    }

    public Date toDate() {
        return new DateTime(this.getTime()).toDate();
    }
}

Revert "Removed unused method. PL-1321."


/**
 * Copyright © 2011-2012 EMBL - European Bioinformatics Institute
 *
 * 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 uk.ac.ebi.phenotype.dao;

/**
 *
 * Phenotyping project data access manager interface.
 *
 * @author Gautier Koscielny (EMBL-EBI) <koscieln@ebi.ac.uk>
 * @since February 2012
 */

import java.util.List;

import uk.ac.ebi.phenotype.pojo.Project;

public interface ProjectDAO {

	/**
	 * Get all projects in the system
	 * @return all projects
	 */
	public List<Project> getAllProjects();

	/**
	 * Find an project by its number.
	 * @param name the project name
	 * @return the project
	 */
	public Project getProjectByName(String name);
}

/**
 * Copyright © 2011-2013 EMBL - European Bioinformatics Institute
 *
 * 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 uk.ac.ebi.phenotype.dao;

/**
 *
 * Phenotyping project data access manager interface.
 *
 * @author Gautier Koscielny (EMBL-EBI) <koscieln@ebi.ac.uk>
 * @since February 2012
 */

import java.util.List;

import uk.ac.ebi.phenotype.pojo.Project;

public interface ProjectDAO {

	/**
	 * Get all projects in the system
	 * @return all projects
	 */
	public List<Project> getAllProjects();

	/**
	 * Find an project by its number.
	 * @param name the project name
	 * @return the project
	 */
	public Project getProjectByName(String name);
}

Change copyright in Apache 2 license to 2013


package name.abuchen.portfolio.util;

public class Isin
{
    private static final String CHARACTERS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; //$NON-NLS-1$
    public static final String PATTERN = "[A-Z]{2}[A-Z0-9]{9}\\d"; //$NON-NLS-1$

    private Isin()
    {
    }

    public static final boolean isValid(String isin) // NOSONAR
    {
        if (isin == null || isin.length() != 12)
            return false;

        int sum = 0;
        boolean even = false;

        for (int ii = 11; ii >= 0; ii--)
        {
            int v = CHARACTERS.indexOf(isin.charAt(ii));
            if (v < 0)
                return false;

            int digit = v % 10 * (even ? 2 : 1);
            sum += digit > 9 ? digit - 9 : digit;
            even = !even;

            if (v >= 10)
            {
                digit = v / 10 * (even ? 2 : 1);
                sum += digit > 9 ? digit - 9 : digit;
                even = !even;
            }
        }

        return sum % 10 == 0;
    }
}

package name.abuchen.portfolio.util;

public class Isin
{
    private static final String CHARACTERS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; //$NON-NLS-1$
    public static final String PATTERN = "[A-Z]{2}[A-Z0-9]{9}\\d"; //$NON-NLS-1$

    private Isin()
    {
    }

    public static final boolean isValid(String isin) // NOSONAR
    {
        if (isin == null || isin.length() != 12)
            return false;

        int sum = 0;
        boolean even = false;

        for (int ii = 11; ii >= 0; ii--)
        {
            int v = CHARACTERS.indexOf(isin.charAt(ii));
            if (v < 0)
                return false;

            int digit = v % 10 * (even ? 2 : 1);
            sum += digit > 9 ? digit - 9 : digit;
            even = !even;

            if (v >= 10)
            {
                digit = v / 10 * (even ? 2 : 1);
                sum += digit;
                even = !even;
            }
        }

        return sum % 10 == 0;
    }
}

Remove unused conditon which cant hold anyway


package org.pentaho.di.run.sortedmerge;

import junit.framework.TestCase;

import org.pentaho.di.core.Result;
import org.pentaho.di.core.logging.LogWriter;
import org.pentaho.di.run.AllRunTests;
import org.pentaho.di.run.TimedTransRunner;

public class RunSortedMerge extends TestCase
{
    public void test_SORTED_MERGE_00()
    {
        System.out.println();
        System.out.println("SORTED MERGE");
        System.out.println("==================");
    }

    public void test_SORTED_MERGE_01_SIMPLE() throws Exception
    {
        TimedTransRunner timedTransRunner = new TimedTransRunner(
                "test/org/pentaho/di/run/sortedmerge/SortedMergeSimple.ktr",
                LogWriter.LOG_LEVEL_ERROR,
                AllRunTests.getOldTargetDatabase(),
                AllRunTests.getNewTargetDatabase(),
                1000000
            );
        timedTransRunner.runOldAndNew();

        be.ibridge.kettle.core.Result oldResult = timedTransRunner.getOldResult();
        assertTrue(oldResult.getNrErrors()==0);

        Result newResult = timedTransRunner.getNewResult();
        assertTrue(newResult.getNrErrors()==0);
    }
}

Update of sorted merge step test case


package org.tigris.subversion.lib;

/**
 * ====================================================================
 * Copyright (c) 2000-2001 CollabNet.  All rights reserved.
 *
 * This software is licensed as described in the file COPYING, which
 * you should have received as part of this distribution.  The terms
 * are also available at http://subversion.tigris.org/license-1.html.
 * If newer versions of this license are posted there, you may use a
 * newer version instead, at your option.
 *
 * This software consists of voluntary contributions made by many
 * individuals.  For exact contribution history, see the revision
 * history and logs, available at http://subversion.tigris.org/.
 * ====================================================================
 *
 */

public class StatusKind
{
    public final static int NONE=1;
    public final static int NORMAL=2;
    public final static int ADDED=3;
    public final static int ABSENT=4;
    public final static int DELETED=5;
    public final static int REPLACED=6;
    public final static int MODIFIED=7;
    public final static int MERGED=8;
    public final static int CONFLICTED=9;

    public final int kind;

    public StatusKind(int kind)
	{
	    this.kind = kind;
	}
}

package org.tigris.subversion.lib;

/**
 * ====================================================================
 * Copyright (c) 2000-2001 CollabNet.  All rights reserved.
 *
 * This software is licensed as described in the file COPYING, which
 * you should have received as part of this distribution.  The terms
 * are also available at http://subversion.tigris.org/license-1.html.
 * If newer versions of this license are posted there, you may use a
 * newer version instead, at your option.
 *
 * This software consists of voluntary contributions made by many
 * individuals.  For exact contribution history, see the revision
 * history and logs, available at http://subversion.tigris.org/.
 * ====================================================================
 *
 */

public class StatusKind
{
    public final static int NONE=1;
    public final static int NORMAL=2;
    public final static int ADDED=3;
    public final static int ABSENT=4;
    public final static int DELETED=5;
    public final static int REPLACED=6;
    public final static int MODIFIED=7;
    public final static int MERGED=8;
    public final static int CONFLICTED=9;

    private int kind = NONE;

    public StatusKind(int kind)
	{
	    super();
	    this.kind = kind;
	}

    public StatusKind()
	{
	    this(NONE);
	}

    public void setKind(int _kind)
	{
	    kind = _kind;
	}

    public int getKind()
	{
	    return kind;
	}
}

Integrate the hashtable Unit testcases.


package com.cloudrobotics.hello_world_client;

import cloudrobotics.hello_world.v1alpha1.K8sHelloWorldGrpc;
import cloudrobotics.hello_world.v1alpha1.Service;
import io.grpc.ManagedChannelBuilder;
import java.util.logging.Logger;

/** */
final class Main {

  private static final Logger logger = Logger.getLogger(Main.class.getName());

  public static void main(String[] args) {
    K8sHelloWorldGrpc.K8sHelloWorldBlockingStub stub =
        K8sHelloWorldGrpc.newBlockingStub(
            ManagedChannelBuilder.forAddress("localhost", 50051).usePlaintext().build());
    Service.HelloWorld world =
        stub.get(Service.GetHelloWorldRequest.newBuilder().setName("foo").build());
    System.out.println(world.getMetadata().getResourceVersion());
  }
}

package com.cloudrobotics.hello_world_client;

import cloudrobotics.hello_world.v1alpha1.K8sHelloWorldGrpc;
import cloudrobotics.hello_world.v1alpha1.Service;
import io.grpc.ManagedChannelBuilder;
import java.util.logging.Logger;

/** */
final class Main {

  private static final Logger logger = Logger.getLogger(Main.class.getName());

  public static void main(String[] args) {
    K8sHelloWorldGrpc.K8sHelloWorldBlockingStub stub =
        K8sHelloWorldGrpc.newBlockingStub(
            ManagedChannelBuilder.forAddress("localhost", 50051).usePlaintext().build());
    Service.CreateHelloWorldRequest.Builder req = Service.CreateHelloWorldRequest.newBuilder();
    req.getObjectBuilder().getMetadataBuilder().setName("foo");
    stub.create(req.build());
    Service.HelloWorld world =
        stub.get(Service.GetHelloWorldRequest.newBuilder().setName("foo").build());
    System.out.println(world.getMetadata().getResourceVersion());
    stub.delete(Service.DeleteHelloWorldRequest.newBuilder().setName("foo").build());
  }
}

Add coverage the Hello World client example.


package org.rundeck.api;

import org.rundeck.api.RundeckApiException;
import org.rundeck.api.RundeckApiException.RundeckApiLoginException;
import org.rundeck.api.RundeckApiException.RundeckApiTokenException;
import org.rundeck.api.RundeckClient;
import org.rundeck.api.domain.RundeckHistory;
import org.rundeck.api.parser.HistoryParser;
import org.rundeck.api.util.AssertUtil;

public class RundeckMonitorClient extends RundeckClient{

	private static final long serialVersionUID = 6744841390473909439L;

	public RundeckMonitorClient(String url, String login, String password)
			throws IllegalArgumentException {
		super(url, login, password);
	}

	@Override
	public RundeckHistory getHistory( final String project, final String statut, final Long max, final Long offset) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException {

		AssertUtil.notBlank(project, "project is mandatory to get the history !"); //$NON-NLS-1$

		return new ApiCall(this).get( new ApiPathBuilder( "/history" ).param( "project", project).param( "statFilter", statut ).param( "max", max ).param("offset", offset), new HistoryParser( "result/events" ) ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
	}
}

package org.rundeck.api;

import org.rundeck.api.RundeckApiException;
import org.rundeck.api.RundeckApiException.RundeckApiLoginException;
import org.rundeck.api.RundeckApiException.RundeckApiTokenException;
import org.rundeck.api.RundeckClient;
import org.rundeck.api.domain.RundeckHistory;
import org.rundeck.api.parser.HistoryParser;
import org.rundeck.api.util.AssertUtil;

public class RundeckMonitorClient extends RundeckClient{

	private static final long serialVersionUID = 6744841390473909439L;

	public RundeckMonitorClient(String url, String login, String password)
			throws IllegalArgumentException {
		super(url, login, password);
	}

	@Override
	public RundeckHistory getHistory( final String project, final String statut, final Long max, final Long offset) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException {

		AssertUtil.notBlank(project, "project is mandatory to get the history !"); //$NON-NLS-1$

		return new ApiCall(this).get( new ApiPathBuilder( "/history" ).param( "project", project).param( "statFilter", statut ).param( "max", max ).param("offset", offset), new HistoryParser( "/events" ) ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
	}
}

Fix MonitorClient not working to detect failed jobs


package refinedstorage.api.autocrafting.registry;

import javax.annotation.Nullable;

/**
 * A registry that stores crafting task factories.
 * Implement this for adding custom crafting tasks.
 */
public interface ICraftingTaskRegistry {
    /**
     * Adds a crafting task factory to the registry.
     * The id is used for identifying tasks when they are read from disk.
     *
     * @param id      the id of the factory
     * @param factory the factory
     */
    void addFactory(String id, ICraftingTaskFactory factory);

    /**
     * Returns the crafting task factory by factory id.
     *
     * @param id the factory id
     * @return the factory
     */
    @Nullable
    ICraftingTaskFactory getFactory(String id);
}

package refinedstorage.api.autocrafting.registry;

import javax.annotation.Nullable;

/**
 * A registry that stores crafting task factories.
 * Implement this to handle the loading of custom crafting tasks.
 */
public interface ICraftingTaskRegistry {
    /**
     * Adds a crafting task factory to the registry.
     * The id is used for identifying tasks when they are read from disk.
     *
     * @param id      the id of the factory
     * @param factory the factory
     */
    void addFactory(String id, ICraftingTaskFactory factory);

    /**
     * Returns the crafting task factory by factory id.
     *
     * @param id the factory id
     * @return the factory
     */
    @Nullable
    ICraftingTaskFactory getFactory(String id);
}

Update some docs, 1.0.1 done


package com.salesforce.phoenix.schema;

public enum ColumnSortOrder {

	ASC, DESC;

	public static ColumnSortOrder defaultValue() {
		return ASC;
	}

	public static ColumnSortOrder fromDDLStatement(String sortOrder) {
		return sortOrder == null ? defaultValue() : ColumnSortOrder.valueOf(sortOrder.toUpperCase());
	}

	public static ColumnSortOrder fromDbValue(int value) {
		switch (value) {
		    case 0: return ASC;
		    case 1: return DESC;
		    default: throw new IllegalArgumentException("Bad db value for ColumnSortOrder: " + value);
		}
	}

	public int toDbValue() {
		return this == ASC ? 0 : 1;
	}
}

package com.salesforce.phoenix.schema;

public enum ColumnSortOrder {

	ASC, DESC;

	public static ColumnSortOrder defaultValue() {
		return ASC;
	}

	public static ColumnSortOrder fromDDLStatement(String sortOrder) {
		return sortOrder == null ? defaultValue() : ColumnSortOrder.valueOf(sortOrder.toUpperCase());
	}

	public static ColumnSortOrder fromDbValue(int value) {
		switch (value) {
		    case 0: return ASC;
		    case 1: return DESC;
		    default: return defaultValue();
		}
	}

	public int toDbValue() {
		return this == ASC ? 0 : 1;
	}
}

Return default value when sort order is not found in system.table.


package arnelid.bjorn.redo.rest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import arnelid.bjorn.redo.model.Family;
import arnelid.bjorn.redo.repository.FamilyRepository;

@RestController
public class FamilyController {
	@Autowired
	FamilyRepository familyRepository;

	@GetMapping("/{name}")
	Family getFamily(@PathVariable String name) {
		return familyRepository.findByName(name);
	}

	@PostMapping(path = "/Family", consumes = MediaType.APPLICATION_JSON_VALUE)
	void postFamily(@RequestBody Family newFamily) {
		familyRepository.save(newFamily);
	}
}

package arnelid.bjorn.redo.rest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import arnelid.bjorn.redo.model.Family;
import arnelid.bjorn.redo.repository.FamilyRepository;

@RestController
public class FamilyController {
	@Autowired
	FamilyRepository familyRepository;

	@PostMapping(path = "/family", consumes = MediaType.APPLICATION_JSON_VALUE)
	void postFamily(@RequestBody Family newFamily) {
		familyRepository.save(newFamily);
	}

	@DeleteMapping("/{name}")
	void deleteFAmily(@PathVariable String name) {
		Family toBeDeleted = familyRepository.findByName(name);
		familyRepository.delete(toBeDeleted);
	}

	@GetMapping("/{name}")
	Family getFamily(@PathVariable String name) {
		return familyRepository.findByName(name);
	}
}

Add delete mapping for family.


package com.darwinsys.springbootdemo;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

@Controller()
public class NotAServlet {

	@RequestMapping(value="/notaservlet", method=RequestMethod.GET)
	public String doWork(@RequestParam("name") String name, ModelMap model) {
		System.out.println("NotAServlet.doWork()");
		model.addAttribute("greetings", String.format("<b>Hello %s!!</b>", name));
		return "hello";
	}
}

package com.darwinsys.springbootdemo;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * It's not a Servlet, it's a Controller
 */
@Controller()
public class NotAServlet {

	@RequestMapping(value="/notaservlet", method=RequestMethod.GET)
	public String doWork(@RequestParam("name") String name, ModelMap model) {
		System.out.println("NotAServlet.doWork()");
		model.addAttribute("greetings", String.format("<b>Hello %s!!</b>", name));
		return "hello";
	}
}

Add doc comment for cryptic name.


package edu.virginia.psyc.r01.persistence;

import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.collections.map.HashedMap;
import org.mindtrails.domain.questionnaire.LinkedQuestionnaireData;
import org.mindtrails.domain.questionnaire.MeasureField;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import java.util.Collections;
import java.util.Map;

/**
 * Created by samportnow on 7/21/14.
 */
@Entity
@Table(name="CC")
@EqualsAndHashCode(callSuper = true)
@Data

public class CC extends LinkedQuestionnaireData {

    @MeasureField(desc="While reading the brief stories in the training program, how much did you relate to the situations presented?")
    @NotNull
    private Integer related;

    @MeasureField(desc="While reading the brief stories in the training program, how much did you feel like it could be you behaving that way in those stories?")
    @NotNull
    private Integer compare;

    @Override
    public Map<Integer, String> getScale(String scale) {
        Map<Integer, String> tmpScale = new HashedMap();
        tmpScale.put(1, "Not at all");
        tmpScale.put(2, "Slightly");
        tmpScale.put(3, "Somewhat");
        tmpScale.put(4, "Mostly");
        tmpScale.put(5, "Very much");
        return Collections.unmodifiableMap(tmpScale);
    }
}

package edu.virginia.psyc.r01.persistence;

import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.collections.map.HashedMap;
import org.mindtrails.domain.questionnaire.LinkedQuestionnaireData;
import org.mindtrails.domain.questionnaire.MeasureField;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import java.util.Collections;
import java.util.Map;
import java.util.TreeMap;

/**
 * Created by samportnow on 7/21/14.
 */
@Entity
@Table(name="CC")
@EqualsAndHashCode(callSuper = true)
@Data

public class CC extends LinkedQuestionnaireData {

    @MeasureField(desc="While reading the brief stories in the training program, how much did you relate to the situations presented?")
    @NotNull
    private Integer related;

    @MeasureField(desc="While reading the brief stories in the training program, how much did you feel like it could be you behaving that way in those stories?")
    @NotNull
    private Integer compare;

    @Override
    public Map<Integer, String> getScale(String scale) {
        Map<Integer, String> tmpScale = new TreeMap<>();
        tmpScale.put(1, "Not at all");
        tmpScale.put(2, "Slightly");
        tmpScale.put(3, "Somewhat");
        tmpScale.put(4, "Mostly");
        tmpScale.put(5, "Very much");
        return Collections.unmodifiableMap(tmpScale);
    }
}

Return the scale in the order it was created.


/*
 * Copyright (c) 2013 TIBCO Software Inc. All Rights Reserved.
 *
 * Use is subject to the terms of the TIBCO license terms accompanying the download of this code.
 * In most instances, the license terms are contained in a file named license.txt.
 */
package org.fabrician.enabler.hadoop;

public class HadoopTasktrackerMBeanServerRef extends HadoopMBeanServerRef {

    public String getEnableFlagVar() {
        return "hadoop_enabler_ENABLE_DATANODE";
    }

    public String getJMXBasePortVar() {
        return "hadoop_enabler_DATANODE_JMX_BASEPORT";
    }

}

/*
 * Copyright (c) 2013 TIBCO Software Inc. All Rights Reserved.
 *
 * Use is subject to the terms of the TIBCO license terms accompanying the download of this code.
 * In most instances, the license terms are contained in a file named license.txt.
 */
package org.fabrician.enabler.hadoop;

public class HadoopTasktrackerMBeanServerRef extends HadoopMBeanServerRef {

    public String getEnableFlagVar() {
        return "hadoop_enabler_ENABLE_TASKTRACKER";
    }

    public String getJMXBasePortVar() {
        return "hadoop_enabler_TASKTRACKER_JMX_BASEPORT";
    }

}

Fix name of enabler flag variable for tasktracker.


package org.enoir.graphvizapi.test;
import org.enoir.graphvizapi.Attribute;
import org.enoir.graphvizapi.Node;
import org.enoir.graphvizapi.exception.AttributeNotFondException;
import org.junit.Assert;
import org.junit.Test;

/**
 * Created by frank on 2014/11/27.
 */
public class TestException {
    @Test
    public void TestAttributeNotFond(){
        try {
            Node node = new Node("testId");
            node.addAttribute(new Attribute("color", "#000"));
            node.removeAttribute("label");
        }catch (AttributeNotFondException e) {
            Assert.assertTrue(true);
        }catch (Exception ex){
            Assert.assertTrue(false);
        }
    }
}

package org.enoir.graphvizapi.test;
import org.enoir.graphvizapi.*;
import org.enoir.graphvizapi.exception.AttributeNotFondException;
import org.enoir.graphvizapi.exception.GraphException;
import org.junit.Assert;
import org.junit.Test;

/**
 * Created by frank on 2014/11/27.
 */
public class TestException {
    @Test
    public void TestAttributeNotFond(){
        try {
            Node node = new Node("testId");
            node.addAttribute(new Attribute("color", "#000"));
            node.removeAttribute("label");
        }catch (AttributeNotFondException e) {
            Assert.assertTrue(true);
        }catch (Exception ex){
            Assert.assertTrue(false);
        }
    }

    @Test
    public void TestDotCommandNotFound() {
        Graphviz gz = new Graphviz("/usr/bin/dot1","./");
        Graph graph = new Graph("g1", GraphType.DIGRAPH);
        String type = "png";
        try {
            byte[] bytearray = gz.getGraphByteArray(graph, type, "100");
            Assert.assertTrue(false);
        }catch (GraphException ge){
            Assert.assertTrue(true);
        }
    }

}

Add dot command not found exception.


/*
 * Copyright 2013 MovingBlocks
 *
 * 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.terasology.world.propagation;

/**
 */
public enum PropagationComparison {
    /**
     * Lighting is restricted in some way it wasn't before
     */
    MORE_RESTRICTED(true, false),
    /**
     * Lighting is identical to before
     */
    IDENTICAL(false, false),
    /**
     * Lighting is strictly more permissive than before
     */
    MORE_PERMISSIVE(false, true);

    private boolean restricting;
    private boolean permitting;

     PropagationComparison(boolean restricts, boolean permits) {
        this.restricting = restricts;
        this.permitting = permits;
    }

    public boolean isRestricting() {
        return restricting;
    }

    public boolean isPermitting() {
        return permitting;
    }
}

/*
 * Copyright 2013 MovingBlocks
 *
 * 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.terasology.world.propagation;

/**
 * An enum that describes how propagation rules have changes when blocks are replaced with others
 */
public enum PropagationComparison {
    /**
     * Propagation is restricted in some way it wasn't before
     */
    MORE_RESTRICTED(true, false),
    /**
     * Propagation is identical to before
     */
    IDENTICAL(false, false),
    /**
     * Propagation is strictly more permissive than before
     */
    MORE_PERMISSIVE(false, true);

    private boolean restricting;
    private boolean permitting;

     PropagationComparison(boolean restricts, boolean permits) {
        this.restricting = restricts;
        this.permitting = permits;
    }

    public boolean isRestricting() {
        return restricting;
    }

    public boolean isPermitting() {
        return permitting;
    }
}

Update javadoc for propgation comparison enum


package org.basex.server;

import org.basex.util.*;
import org.basex.util.hash.*;

/**
 * This class delays blocked clients.
 *
 * @author BaseX Team 2005-18, BSD License
 * @author Christian Gruen
 */
public final class ClientBlocker {
  /** Temporarily blocked clients. */
  private final TokenIntMap blocked = new TokenIntMap();

  /**
   * Registers the client and delays the process.
   * @param client client address
   */
  public synchronized void delay(final byte[] client) {
    int delay = blocked.get(client);
    delay = delay == -1 ? 1 : Math.min(delay, 1024) << 1;
    blocked.put(client, delay);
    while(--delay > 0) Performance.sleep(1000);
  }

  /**
   * Resets the login delay after successful login.
   * @param client client address
   */
  public synchronized void remove(final byte[] client) {
    blocked.remove(client);
  }
}

package org.basex.server;

import org.basex.util.*;
import org.basex.util.hash.*;

/**
 * This class delays blocked clients.
 *
 * @author BaseX Team 2005-18, BSD License
 * @author Christian Gruen
 */
public final class ClientBlocker {
  /** Temporarily blocked clients. */
  private final TokenIntMap blocked = new TokenIntMap();

  /**
   * Registers the client and delays the process.
   * @param client client address
   */
  public synchronized void delay(final byte[] client) {
    int delay = blocked.get(client);
    delay = delay == -1 ? 1 : Math.min(delay, 1024) << 1;
    blocked.put(client, delay);
    while(--delay > 0) Performance.sleep(100);
  }

  /**
   * Resets the login delay after successful login.
   * @param client client address
   */
  public synchronized void remove(final byte[] client) {
    blocked.remove(client);
  }
}

Reduce delays for invalid passwords


package com.gh4a.loader;

import java.io.IOException;
import java.util.List;

import org.eclipse.egit.github.core.User;
import org.eclipse.egit.github.core.service.OrganizationService;

import android.content.Context;

import com.gh4a.Gh4Application;

public class OrganizationListLoader extends BaseLoader<List<User>> {
    private String mUserLogin;

    public OrganizationListLoader(Context context, String userLogin) {
        super(context);
        mUserLogin = userLogin;
    }

    @Override
    public List<User> doLoadInBackground() throws IOException {
        OrganizationService orgService = (OrganizationService)
                Gh4Application.get().getService(Gh4Application.ORG_SERVICE);
        return orgService.getOrganizations(mUserLogin);
    }
}

package com.gh4a.loader;

import java.io.IOException;
import java.util.List;

import org.eclipse.egit.github.core.User;
import org.eclipse.egit.github.core.service.OrganizationService;

import android.content.Context;

import com.gh4a.Gh4Application;

public class OrganizationListLoader extends BaseLoader<List<User>> {
    private String mUserLogin;

    public OrganizationListLoader(Context context, String userLogin) {
        super(context);
        mUserLogin = userLogin;
    }

    @Override
    public List<User> doLoadInBackground() throws IOException {
        Gh4Application app = Gh4Application.get();
        OrganizationService orgService = (OrganizationService)
                app.getService(Gh4Application.ORG_SERVICE);
        if (mUserLogin.equals(app.getAuthLogin())) {
            return orgService.getOrganizations();
        } else {
            return orgService.getOrganizations(mUserLogin);
        }
    }
}

Include private organization memberships for logged in user.


/*
 * Bach - Java Shell Builder
 * Copyright (C) 2019 Christian Stein
 *
 * 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
 *
 *     https://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.
 */

module de.sormuras.bach {
  requires java.compiler;
  requires java.net.http;

  exports de.sormuras.bach;
  exports de.sormuras.bach.project;

  uses java.util.spi.ToolProvider;
}

/*
 * Bach - Java Shell Builder
 * Copyright (C) 2019 Christian Stein
 *
 * 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
 *
 *     https://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.
 */

// --main-class de.sormuras.bach.Bach
module de.sormuras.bach {
  requires java.compiler;
  requires java.net.http;

  exports de.sormuras.bach;
  exports de.sormuras.bach.project;

  uses java.util.spi.ToolProvider;
}

Add textual main class "declaration"


package uk.ac.ebi.quickgo.rest.search.query;

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

/**
 * Holds the data required to specify a filter value
 *
 * @author Tony Wardell
 * Date: 03/05/2016
 * Time: 10:25
 * Created with IntelliJ IDEA.
 */
public class PrototypeFilter {

    private static final String COMMA = ",";
    private String filterField;
    private List<String> args;
    private Validator<String> validator;

    public String getFilterField() {
        return filterField;
    }

    public List<String> getArgs() {
        return args;
    }

    public static final PrototypeFilter create(String filterField, String argIncludingDelimiters, Validator<String>
            validator ){
        PrototypeFilter prototypeFilter = new PrototypeFilter();
        prototypeFilter.filterField = filterField;
        prototypeFilter.args = Arrays.asList(argIncludingDelimiters.split(COMMA));
        prototypeFilter.validator = validator;
        return prototypeFilter;
    }

    /**
     *
     * Test each argument in the list to see if its valid
     */
    public void validate(){
        args.stream().forEach(a -> validator.validate(a));
    }
}

package uk.ac.ebi.quickgo.rest.search.query;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;

/**
 * Holds the data required to specify a filter value
 *
 * @author Tony Wardell
 * Date: 03/05/2016
 * Time: 10:25
 * Created with IntelliJ IDEA.
 */
public class PrototypeFilter {

    private static final String COMMA = ",";
    private String filterField;
    private List<String> args;
    private Validator<String> validator;

    public String getFilterField() {
        return filterField;
    }

    public static final PrototypeFilter create(String filterField, String argIncludingDelimiters, Validator<String>
            validator ){
        PrototypeFilter prototypeFilter = new PrototypeFilter();
        prototypeFilter.filterField = filterField;
        prototypeFilter.args = Arrays.asList(argIncludingDelimiters.split(COMMA));
        prototypeFilter.validator = validator;
        return prototypeFilter;
    }

    /**
     *
     * Test each argument in the list to see if its valid
     */
    public void validate(){
        args.stream().forEach(a -> validator.validate(a));
    }

    public Stream<String> provideStream(){
        return args.stream();

    }
}

Stop direct access to the list of args, allow them to be streamed instead.


/*
 * Copyright 2013-2016 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.cloudfoundry.client;

import org.junit.Test;

import static org.cloudfoundry.client.ValidationResult.Status.VALID;
import static org.junit.Assert.assertEquals;

public final class ValidationResultTest {

    @Test
    public void invalid() {
        ValidationResult result = ValidationResult.builder()
                .message("Test Message")
                .build();

        assertEquals(VALID, result.getStatus());
    }

    @Test
    public void valid() {
        ValidationResult result = ValidationResult.builder()
                .build();

        assertEquals(VALID, result.getStatus());
    }

}

/*
 * Copyright 2013-2016 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.cloudfoundry.client;

import org.junit.Test;

import static org.cloudfoundry.client.ValidationResult.Status.INVALID;
import static org.cloudfoundry.client.ValidationResult.Status.VALID;
import static org.junit.Assert.assertEquals;

public final class ValidationResultTest {

    @Test
    public void invalid() {
        ValidationResult result = ValidationResult.builder()
                .message("Test Message")
                .build();

        assertEquals(INVALID, result.getStatus());
    }

    @Test
    public void valid() {
        ValidationResult result = ValidationResult.builder()
                .build();

        assertEquals(VALID, result.getStatus());
    }

}

Revert "Unit Test Failure Trial"


package edu.northwestern.bioinformatics.studycalendar.domain.auditing;

import java.util.Date;

/**
 * Subclass of core-commons' DataAuditInfo that aliases the "on" property as "time".
 * This is so that it can be used in HQL queries ("on" is apparently a reserved word).
 *
 * @author Rhett Sutphin
 */
public class DataAuditInfo extends edu.nwu.bioinformatics.commons.DataAuditInfo {
    public DataAuditInfo() { }

    public DataAuditInfo(String by, String ip) {
        super(by, ip);
    }

    public DataAuditInfo(String by, String ip, Date on) {
        super(by, ip, on);
    }

    public static DataAuditInfo copy(edu.nwu.bioinformatics.commons.DataAuditInfo source) {
        return new DataAuditInfo(
            source.getBy(), source.getIp(), source.getOn()
        );
    }

    public Date getTime() {
        return getOn();
    }

    public void setTime(Date on) {
        setOn(on);
    }

    /* Have to duplicate other accessors so that it will work with annotations without
       annotating the superclass. */
    public String getUsername() { return super.getBy(); }
    public void setUsername(String by) { super.setBy(by); }
    public String getIp() { return super.getIp(); }
    public void setIp(String ip) { super.setIp(ip); }
}

package edu.northwestern.bioinformatics.studycalendar.domain.auditing;

import org.hibernate.annotations.Type;

import java.util.Date;
import java.sql.Timestamp;

/**
 * Subclass of core-commons' DataAuditInfo that aliases the "on" property as "time".
 * This is so that it can be used in HQL queries ("on" is apparently a reserved word).
 *
 * @author Rhett Sutphin
 */
public class DataAuditInfo extends edu.nwu.bioinformatics.commons.DataAuditInfo {
    public DataAuditInfo() { }

    public DataAuditInfo(String by, String ip) {
        super(by, ip);
    }

    public DataAuditInfo(String by, String ip, Date on) {
        super(by, ip, on);
    }

    public static DataAuditInfo copy(edu.nwu.bioinformatics.commons.DataAuditInfo source) {
        return new DataAuditInfo(
            source.getBy(), source.getIp(), source.getOn()
        );
    }

    @Type(type = "timestamp")
    public Date getTime() {
        return getOn();
    }

    public void setTime(Date on) {
        setOn(on);
    }

    /* Have to duplicate other accessors so that it will work with annotations without
       annotating the superclass. */
    public String getUsername() { return super.getBy(); }
    public void setUsername(String by) { super.setBy(by); }
    public String getIp() { return super.getIp(); }
    public void setIp(String ip) { super.setIp(ip); }
}

Add timestamp type to time property for oracle


package devopsdistilled.operp.server.data.repo.stock;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import devopsdistilled.operp.server.data.entity.stock.Stock;

@Repository
public interface StockRepository extends JpaRepository<Stock, Long> {

}

package devopsdistilled.operp.server.data.repo.stock;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import devopsdistilled.operp.server.data.entity.items.Item;
import devopsdistilled.operp.server.data.entity.stock.Stock;
import devopsdistilled.operp.server.data.entity.stock.Warehouse;

@Repository
public interface StockRepository extends JpaRepository<Stock, Long> {
	Stock findByItemAndWarehouse(Item item,Warehouse warehouse);

}

Create functionalities to find stock with item and warehouse


package org.chaplib;

import static org.junit.Assert.*;

import org.apache.http.HttpRequest;
import org.apache.http.client.methods.HttpGet;
import org.junit.Before;
import org.junit.Test;

public class TestDefaultUserAgentGenerator {

    private DefaultUserAgentGenerator impl;

    @Before
    public void setUp() {
        impl = new DefaultUserAgentGenerator();
    }

    @Test
    public void generatesAUserAgentString() {
        HttpRequest request = new HttpGet("http://www.example.com/");
        impl.setUserAgent(request);
        assertFalse("".equals(request.getFirstHeader("User-Agent").getValue().trim()));
    }
}

package org.chaplib;

import static org.junit.Assert.*;

import org.apache.http.HttpRequest;
import org.apache.http.client.methods.HttpGet;
import org.junit.Before;
import org.junit.Test;

public class TestDefaultUserAgentGenerator {

    private DefaultUserAgentGenerator impl;

    @Before
    public void setUp() {
        impl = new DefaultUserAgentGenerator();
    }

    /*
     * "User agents SHOULD include this [User-Agent] field with requests."
     * http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43
     */
    @Test
    public void generatesAUserAgentString() {
        HttpRequest request = new HttpGet("http://www.example.com/");
        impl.setUserAgent(request);
        assertFalse("".equals(request.getFirstHeader("User-Agent").getValue().trim()));
    }
}

Include RFC2616 quote on unit test for User-Agent.


package uk.co.sftrabbit.stackanswers;

import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import uk.co.sftrabbit.stackanswers.app.DrawerActivity;

public class AuthenticationActivity extends DrawerActivity {
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		setContentView(R.layout.activity_authentication);

		setDrawerIndicatorEnabled(false);

		WebView webView = (WebView) findViewById(R.id.authentication_web_view);
		webView.setWebViewClient(new WebViewClient());

		WebSettings webSettings = webView.getSettings();
		webSettings.setJavaScriptEnabled(true);

		webView.loadUrl(
			"https://stackexchange.com/oauth/dialog?" +
			"client_id=2265&" +
			"scope=read_inbox,write_access,private_info&" +
			"redirect_uri=https://stackexchange.com/oauth/login_success"
		);
	}
}

package uk.co.sftrabbit.stackanswers;

import android.os.Bundle;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ProgressBar;
import uk.co.sftrabbit.stackanswers.app.DrawerActivity;

public class AuthenticationActivity extends DrawerActivity {
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		setContentView(R.layout.activity_authentication);

		setDrawerIndicatorEnabled(false);

		final ProgressBar progressBar =
			(ProgressBar) findViewById(R.id.authentication_progress);

		WebView webView = (WebView) findViewById(R.id.authentication_web_view);
		webView.setWebViewClient(new WebViewClient());
		webView.setWebChromeClient(new WebChromeClient() {
			@Override
			public void onProgressChanged(WebView webview, int newProgress) {
				progressBar.setProgress(newProgress);
			}
		});

		WebSettings webSettings = webView.getSettings();
		webSettings.setJavaScriptEnabled(true);

		webView.loadUrl(
			"https://stackexchange.com/oauth/dialog?" +
			"client_id=2265&" +
			"scope=read_inbox,write_access,private_info&" +
			"redirect_uri=https://stackexchange.com/oauth/login_success"
		);
	}
}

Update progress bar as authentication pages load


package net.openhft.chronicle.bytes;

import net.openhft.chronicle.core.Maths;
import org.junit.Test;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.nio.ByteBuffer;
import java.util.Random;

import static junit.framework.TestCase.assertEquals;

public class StopBitDecimalTest {
    @Test
    public void testDecimals() {
        Bytes<ByteBuffer> bytes = Bytes.elasticHeapByteBuffer(16);
        Random rand = new Random();
        for (int i = 0; i < 10000; i++) {
            rand.setSeed(i);
            bytes.clear();
            int scale = rand.nextInt(10);
            double d = (rand.nextLong() % 1e14) / Maths.tens(scale);
            bytes.writeStopBitDecimal(d);
            BigDecimal bd = BigDecimal.valueOf(d);
            long v = bytes.readStopBit();
            BigDecimal ebd = new BigDecimal(BigInteger.valueOf(v / 10), (int) (Math.abs(v) % 10));
            assertEquals("i: " + i + ", d: " + d + ", v: " + v, ebd.doubleValue(), bd.doubleValue(), 0.0);
            bytes.readPosition(0);
            double d2 = bytes.readStopBitDecimal();
            assertEquals("i: " + i + ", d: " + d + ", v: " + v, d, d2, 0.0);
        }

    }
}

package net.openhft.chronicle.bytes;

import net.openhft.chronicle.core.Maths;
import org.junit.Test;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.nio.ByteBuffer;
import java.util.Random;

import static junit.framework.TestCase.assertEquals;

public class StopBitDecimalTest {
    @Test
    public void testDecimals() {
        Bytes<ByteBuffer> bytes = Bytes.elasticHeapByteBuffer(16);
        Random rand = new Random();
        for (int i = 0; i < 10_000; i++) {
            rand.setSeed(i);
            bytes.clear();
            int scale = rand.nextInt(10);
            double d = (rand.nextLong() % 1e14) / Maths.tens(scale);
            bytes.writeStopBitDecimal(d);
            BigDecimal bd = BigDecimal.valueOf(d);
            long v = bytes.readStopBit();
            BigDecimal ebd = new BigDecimal(BigInteger.valueOf(v / 10), (int) (Math.abs(v) % 10));
            assertEquals("i: " + i + ", d: " + d + ", v: " + v, ebd.doubleValue(), bd.doubleValue(), 0.0);
            bytes.readPosition(0);
            double d2 = bytes.readStopBitDecimal();
            assertEquals("i: " + i + ", d: " + d + ", v: " + v, d, d2, 0.0);
        }

    }
}

Add support for stopBit encoded small decimal.


package edu.rpi.cs.yacs.core;

import android.app.Application;

import com.crashlytics.android.Crashlytics;
import com.squareup.leakcanary.LeakCanary;

import edu.rpi.cs.yacs.retrofit.ServiceHelper;
import io.fabric.sdk.android.Fabric;
import io.realm.Realm;
import io.realm.RealmConfiguration;

/**
 * Created by Mark Robinson on 10/4/16.
 */
public class YACSApplication extends Application {
    private static YACSApplication instance;

    private ServiceHelper serviceHelper = null;
    private Realm realm = null;

    public static YACSApplication getInstance() {
        return instance;
    }

    @Override
    public void onCreate() {
        super.onCreate();

        if (LeakCanary.isInAnalyzerProcess(this)) {
            // This process is dedicated to LeakCanary for heap analysis.
            return;
        }

        Fabric.with(this, new Crashlytics());

        instance = this;

        LeakCanary.install(this);

        serviceHelper = new ServiceHelper(getApplicationContext());

        RealmConfiguration realmConfiguration = new RealmConfiguration.Builder(this).build();
        Realm.setDefaultConfiguration(realmConfiguration);

        realm = Realm.getDefaultInstance();
    }

    public ServiceHelper getServiceHelper() {
        return serviceHelper;
    }

    public Realm getRealm() {
        return realm;
    }
}

package edu.rpi.cs.yacs.core;

import android.app.Application;

import com.crashlytics.android.Crashlytics;
import com.squareup.leakcanary.LeakCanary;

import edu.rpi.cs.yacs.enums.RecyclerViewMode;
import edu.rpi.cs.yacs.retrofit.ServiceHelper;
import io.fabric.sdk.android.Fabric;
import io.realm.Realm;
import io.realm.RealmConfiguration;

/**
 * Created by Mark Robinson on 10/4/16.
 */
public class YACSApplication extends Application {
    private static YACSApplication instance;

    private ServiceHelper serviceHelper = null;
    private Realm realm = null;
    private RecyclerViewMode recyclerViewMode = RecyclerViewMode.DEPARTMENTS;

    public static YACSApplication getInstance() {
        return instance;
    }

    @Override
    public void onCreate() {
        super.onCreate();

        if (LeakCanary.isInAnalyzerProcess(this)) {
            // This process is dedicated to LeakCanary for heap analysis.
            return;
        }

        Fabric.with(this, new Crashlytics());

        instance = this;

        LeakCanary.install(this);

        serviceHelper = new ServiceHelper(getApplicationContext());

        RealmConfiguration realmConfiguration = new RealmConfiguration.Builder(this).build();
        Realm.setDefaultConfiguration(realmConfiguration);

        realm = Realm.getDefaultInstance();
    }

    public ServiceHelper getServiceHelper() {
        return serviceHelper;
    }

    public Realm getRealm() {
        return realm;
    }

    public RecyclerViewMode getRecyclerViewMode() {
        return recyclerViewMode;
    }

    public void setRecyclerViewMode(RecyclerViewMode recyclerViewMode) {
        this.recyclerViewMode = recyclerViewMode;
    }
}

Create RecyclerView Getters And Setters


package org.wildfly.swarm.container.runtime;

import java.net.URL;
import java.util.List;

import junit.framework.Assert;
import org.jboss.dmr.ModelNode;
import org.junit.BeforeClass;
import org.junit.Test;

/**
 * @author Heiko Braun
 * @since 26/11/15
 */
public class ParserTestCase {

    private static URL xml;

    @BeforeClass
    public static void init() {
        ClassLoader cl = ParserTestCase.class.getClassLoader();
        xml = cl.getResource("standalone.xml");
    }

    @Test
    public void testDelegatingParser() throws Exception {
        StandaloneXmlParser parser = new StandaloneXmlParser();
        List<ModelNode> operations = parser.parse(xml);
        Assert.assertEquals(28, operations.size());
    }
}

package org.wildfly.swarm.container.runtime;

import java.net.URL;
import java.util.List;

import org.junit.Assert;
import org.jboss.dmr.ModelNode;
import org.junit.BeforeClass;
import org.junit.Test;

/**
 * @author Heiko Braun
 * @since 26/11/15
 */
public class ParserTestCase {

    private static URL xml;

    @BeforeClass
    public static void init() {
        ClassLoader cl = ParserTestCase.class.getClassLoader();
        xml = cl.getResource("standalone.xml");
    }

    @Test
    public void testDelegatingParser() throws Exception {
        StandaloneXmlParser parser = new StandaloneXmlParser();
        List<ModelNode> operations = parser.parse(xml);
        Assert.assertEquals(28, operations.size());
    }
}

Replace deprecated API usage with non-deprecated for junit.Assert.


package org.ligoj.app.resource.welcome;

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

import org.ligoj.app.api.FeaturePlugin;
import org.ligoj.app.iam.model.DelegateOrg;
import org.ligoj.app.model.DelegateNode;
import org.ligoj.bootstrap.model.system.SystemAuthorization;
import org.ligoj.bootstrap.model.system.SystemRole;
import org.ligoj.bootstrap.model.system.SystemRoleAssignment;
import org.ligoj.bootstrap.model.system.SystemUser;
import org.springframework.stereotype.Component;

/**
 * Initialize during the RBAC data on installation.
 */
@Component
public class InitializeRbacDataResource implements FeaturePlugin {

	@Override
	public String getKey() {
		return "feature:welcome:data-rbac";
	}

	@Override
	public List<Class<?>> getInstalledEntities() {
		return Arrays.asList(SystemUser.class, SystemRole.class, SystemAuthorization.class, SystemRoleAssignment.class, DelegateOrg.class,
				DelegateNode.class);
	}

}

package org.ligoj.app.resource.welcome;

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

import org.ligoj.app.api.FeaturePlugin;
import org.ligoj.app.iam.model.DelegateOrg;
import org.ligoj.app.model.DelegateNode;
import org.ligoj.bootstrap.model.system.SystemAuthorization;
import org.ligoj.bootstrap.model.system.SystemRole;
import org.ligoj.bootstrap.model.system.SystemRoleAssignment;
import org.ligoj.bootstrap.model.system.SystemUser;
import org.springframework.stereotype.Component;

/**
 * Initialize during the RBAC data on installation.
 */
@Component
public class InitializeRbacDataResource implements FeaturePlugin {

	@Override
	public String getKey() {
		return "feature:welcome:data-rbac";
	}

	@Override
	public List<Class<?>> getInstalledEntities() {
		return Arrays.asList(SystemUser.class, SystemRole.class, SystemAuthorization.class, SystemRoleAssignment.class, DelegateOrg.class,
				DelegateNode.class);
	}

	@Override
	public String getName() {
		return "Welcome Data RBAC";
	}

}

Add plug-in name for welcome RBAC


package com.intellij.jsp.impl;

import com.intellij.xml.XmlElementDescriptor;
import com.intellij.j2ee.j2eeDom.web.WebModuleProperties;
import com.intellij.psi.xml.XmlTag;

import javax.servlet.jsp.tagext.TagExtraInfo;

/**
 * Created by IntelliJ IDEA.
 * User: Maxim.Mossienko
 * Date: Mar 11, 2005
 * Time: 8:57:52 PM
 * To change this template use File | Settings | File Templates.
 */
public interface JspElementDescriptor extends XmlElementDescriptor {
  TagExtraInfo getExtraInfo(WebModuleProperties moduleProperties);
  boolean isRequiredAttributeImplicitlyPresent(XmlTag tag,String attributeName);
  XmlTag findVariableWithName(String name);
}

package com.intellij.jsp.impl;

import com.intellij.xml.XmlElementDescriptor;
import com.intellij.psi.xml.XmlTag;
import com.intellij.openapi.module.Module;

import javax.servlet.jsp.tagext.TagExtraInfo;

import org.jetbrains.annotations.Nullable;

/**
 * Created by IntelliJ IDEA.
 * User: Maxim.Mossienko
 * Date: Mar 11, 2005
 * Time: 8:57:52 PM
 * To change this template use File | Settings | File Templates.
 */
public interface JspElementDescriptor extends XmlElementDescriptor {
  TagExtraInfo getExtraInfo(@Nullable Module module);
  boolean isRequiredAttributeImplicitlyPresent(XmlTag tag,String attributeName);
  XmlTag findVariableWithName(String name);
}

Resolve of the implicit variables should also work in java modules (IDEADEV-3688)


/*
 * Copyright 2005 Joe Walker
 *
 * 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 uk.ltd.getahead.dwr;

/**
 * A very basic IoC container
 * @author Joe Walker [joe at getahead dot ltd dot uk]
 */
public interface Container
{
    /**
     * Get an instance of a bean of a given type.
     * @param id The type to get an instance of
     * @return The object of the given type
     */
    Object getBean(String id);
}

/*
 * Copyright 2005 Joe Walker
 *
 * 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 uk.ltd.getahead.dwr;

/**
 * A very basic IoC container
 * @author Joe Walker [joe at getahead dot ltd dot uk]
 */
public interface Container
{
    /**
     * Get an instance of a bean of a given type.
     * @param id The type to get an instance of
     * @return The object of the given type
     * @throws IllegalArgumentException If the given id does not refer to a bean
     */
    Object getBean(String id) throws IllegalArgumentException;
}

Make the interface clear when it comes to what happens when the container can't find the bean


package com.vsahin.moneycim;

import android.app.Activity;
import android.app.Application;

import com.vsahin.moneycim.Di.DaggerAppComponent;

import javax.inject.Inject;

import dagger.android.AndroidInjector;
import dagger.android.DispatchingAndroidInjector;
import dagger.android.HasActivityInjector;

/**
 * Created by Volkan Şahin on 17.08.2017.
 */

public class MoneycimApp extends Application implements HasActivityInjector {

    @Inject
    DispatchingAndroidInjector<Activity> dispatchingAndroidInjector;

    @Override
    public void onCreate() {
        super.onCreate();

        DaggerAppComponent
                .builder()
                .create(this)
                .inject(this);
    }

    @Override
    public AndroidInjector<Activity> activityInjector() {
        return dispatchingAndroidInjector;
    }
}

package com.vsahin.moneycim;

import android.app.Activity;
import android.app.Application;

import com.vsahin.moneycim.Di.DaggerAppComponent;

import javax.inject.Inject;

import dagger.android.AndroidInjector;
import dagger.android.DispatchingAndroidInjector;
import dagger.android.HasActivityInjector;
import dagger.android.support.DaggerApplication;

/**
 * Created by Volkan Şahin on 17.08.2017.
 */

public class MoneycimApp extends DaggerApplication {
    @Override
    protected AndroidInjector<? extends DaggerApplication> applicationInjector() {
        return DaggerAppComponent.builder().create(this);
    }
}

Extend Application from DaggerApplication class


package replicant;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Annotation use to mark code as incompatible with GWT.
 * The Name of the annotation is all that matters.
 */
@Retention( RetentionPolicy.CLASS )
@Target( { ElementType.TYPE, ElementType.METHOD } )
@Documented
@interface GwtIncompatible
{
}

package replicant;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Annotation use to mark code as incompatible with GWT.
 * The Name of the annotation is all that matters.
 */
@Retention( RetentionPolicy.CLASS )
@Target( { ElementType.TYPE, ElementType.METHOD, ElementType.FIELD } )
@Documented
@interface GwtIncompatible
{
}

Make it possible to ignore fields


package leetcode;

/**
 * https://leetcode.com/problems/gas-station/
 */
public class Problem134 {
    public int canCompleteCircuit(int[] gas, int[] cost) {
        // TODO: to be implemented
        return 0;
    }
}

package leetcode;

/**
 * https://leetcode.com/problems/gas-station/
 */
public class Problem134 {
    public int canCompleteCircuit(int[] gas, int[] cost) {
        int totalGas = 0;
        int totalCost = 0;
        for (int g : gas) {
            totalGas += g;
        }
        for (int c : cost) {
            totalCost += c;
        }
        if (totalCost > totalGas) {
            return -1;
        }
        int[] diff = new int[gas.length];
        for (int i = 0; i < gas.length; i++) {
            int g = gas[i];
            int c = cost[i];
            int x = g - c;
            diff[i] = x;
        }
        int max = Integer.MIN_VALUE;
        int maxIdx = 0;
        for (int i = 0; i < diff.length; i++) {
            int sum = 0;
            for (int j = i; j < diff.length + i; j++) {
                int k = j;
                if (k >= diff.length) {
                    k = j - diff.length;
                }
                sum += diff[k];
                if (sum < 0) {
                    break;
                }
            }
            if (sum > max) {
                max = sum;
                maxIdx = i;
            }
        }
        return maxIdx;
    }

    public static void main(String[] args) {
        Problem134 prob = new Problem134();
        System.out.println(prob.canCompleteCircuit(
            new int[]{1, 2, 3, 3},
            new int[]{2, 1, 5, 1}));
        System.out.println(prob.canCompleteCircuit(
            new int[] {6, 1, 4, 3, 5},
            new int[] {3, 8, 2, 4,2}));
    }
}

Write something for problem 134 (it's still TLE)


package com.suse.salt.netapi.calls.modules;

import com.suse.salt.netapi.calls.LocalCall;

import com.google.gson.reflect.TypeToken;

import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;

/**
 * salt.modules.state
 */
public class State {

    private State() { }

    public static LocalCall<Map<String, Object>> apply(List<String> mods) {
        return apply(mods, Optional.empty(), Optional.empty());
    }

    public static LocalCall<Map<String, Object>> apply(String... mods) {
        return apply(Arrays.asList(mods), Optional.empty(), Optional.empty());
    }

    public static LocalCall<Map<String, Object>> apply(List<String> mods,
            Optional<Map<String, Object>> pillar, Optional<Boolean> queue) {
        Map<String, Object> kwargs = new LinkedHashMap<>();
        kwargs.put("mods", mods);
        if (pillar.isPresent()) {
            kwargs.put("pillar", pillar.get());
        }
        if (queue.isPresent()) {
            kwargs.put("queue", queue.get());
        }
        return new LocalCall<>("state.apply", Optional.empty(), Optional.of(kwargs),
                new TypeToken<Map<String, Object>>() { });
    }

    public static LocalCall<Object> showHighstate() {
        return new LocalCall<>("state.show_highstate", Optional.empty(), Optional.empty(),
                new TypeToken<Object>() { });
    }

}

package com.suse.salt.netapi.calls.modules;

import com.suse.salt.netapi.calls.LocalCall;

import com.google.gson.reflect.TypeToken;

import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;

/**
 * salt.modules.state
 */
public class State {

    private State() { }

    public static LocalCall<Map<String, Object>> apply(List<String> mods) {
        return apply(mods, Optional.empty(), Optional.empty());
    }

    public static LocalCall<Map<String, Object>> apply(String... mods) {
        return apply(Arrays.asList(mods), Optional.empty(), Optional.empty());
    }

    public static LocalCall<Map<String, Object>> apply(List<String> mods,
            Optional<Map<String, Object>> pillar, Optional<Boolean> queue) {
        Map<String, Object> kwargs = new LinkedHashMap<>();
        kwargs.put("mods", mods);
        pillar.ifPresent(p -> kwargs.put("pillar", p));
        queue.ifPresent(q -> kwargs.put("queue", q));
        return new LocalCall<>("state.apply", Optional.empty(), Optional.of(kwargs),
                new TypeToken<Map<String, Object>>() { });
    }

    public static LocalCall<Object> showHighstate() {
        return new LocalCall<>("state.show_highstate", Optional.empty(), Optional.empty(),
                new TypeToken<Object>() { });
    }

}

Use ifPresent() to avoid calling get()


/**
 *
 */
package mathsquared.resultswizard2;

import javax.swing.table.TableModel;

/**
 * Represents data that can be edited in one or more stages and then transformed into another object.
 *
 * @author MathSquared
 * @param <T> the type of data that can be obtained from this model using {@link #getResult()}
 *
 */
public interface EditorTableModel<T> extends TableModel {
	/**
	 * Returns the number of stages used by this editor.
	 *
	 * @return a number indicating the number of stages; this number must always be greater than or equal to 1
	 */
	public int numStages ();

	/**
	 * Returns the current stage.
	 *
	 * @return a zero-based index for the current stage; this is guaranteed to be >= 0 and < {@link #numStages()}
	 */
	public int currentStage ();

	/**
	 * Moves to the next stage.
	 *
	 * @throws IllegalStateException if we are at the last stage
	 */
	public void nextStage ();

	/**
	 * Moves to the previous stage.
	 *
	 * @throws IllegalStateException if we are at the first stage
	 */
	public void previousStage ();

	/**
	 * Obtains the current result of this model. This only works if we are at the last stage.
	 *
	 * @return an object representing the data stored in this model
	 * @throws IllegalStateException if we are not at the last stage
	 */
	public T getResult ();
}

/**
 *
 */
package mathsquared.resultswizard2;

import javax.swing.table.TableModel;

/**
 * Represents data that can be edited in one or more stages and then transformed into another object.
 *
 *
Note that these stages should not change the column headers or layout in this table. They should only change which columns are editable and which are not. This will help generate a consistent user experience.

 *
 * @author MathSquared
 * @param <T> the type of data that can be obtained from this model using {@link #getResult()}
 *
 */
public interface EditorTableModel<T> extends TableModel {
	/**
	 * Returns the number of stages used by this editor.
	 *
	 * @return a number indicating the number of stages; this number must always be greater than or equal to 1
	 */
	public int numStages ();

	/**
	 * Returns the current stage.
	 *
	 * @return a zero-based index for the current stage; this is guaranteed to be >= 0 and < {@link #numStages()}
	 */
	public int currentStage ();

	/**
	 * Moves to the next stage.
	 *
	 * @throws IllegalStateException if we are at the last stage
	 */
	public void nextStage ();

	/**
	 * Moves to the previous stage.
	 *
	 * @throws IllegalStateException if we are at the first stage
	 */
	public void previousStage ();

	/**
	 * Obtains the current result of this model. This only works if we are at the last stage.
	 *
	 * @return an object representing the data stored in this model
	 * @throws IllegalStateException if we are not at the last stage
	 */
	public T getResult ();
}

Add doc note that stages shouldn't change column headers


/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

package org.mozilla.javascript.drivers;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.TYPE;

/**
 * Intended to be used as an optional annotation for subclasses
 * of {@link org.mozilla.javascript.drivers.ScriptTestsBase}.
 * Sets the language version of test's script execution context.
 */
@Target(TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface LanguageVersion {
    int value();
}

Add copyright to new file.