package org.cryptonit;

import javacard.framework.APDU;
import javacard.framework.Applet;
import javacard.framework.ISO7816;
import javacard.framework.ISOException;

public class CryptonitApplet extends Applet {
    protected CryptonitApplet(byte[] bArray, short bOffset, byte bLength) {
        register();
    }

    public static void install(byte[] bArray, short bOffset, byte bLength) {
        new CryptonitApplet(bArray, bOffset, bLength);
    }

    @Override
    public void process(APDU apdu) {
        byte buffer[] = apdu.getBuffer();
		if (apdu.isISOInterindustryCLA()) {
            if (buffer[ISO7816.OFFSET_INS] == (byte) (0xA4)) {
                return;
            }
            ISOException.throwIt(ISO7816.SW_CLA_NOT_SUPPORTED);
        }
        ISOException.throwIt(ISO7816.SW_CLA_NOT_SUPPORTED);
    }
}

package org.cryptonit;

import javacard.framework.APDU;
import javacard.framework.Applet;
import javacard.framework.ISO7816;
import javacard.framework.ISOException;
import javacard.framework.OwnerPIN;

public class CryptonitApplet extends Applet {
    private OwnerPIN pin;

    private final static byte PIN_MAX_LENGTH = 8;
    private final static byte PIN_MAX_TRIES  = 5;

    protected CryptonitApplet(byte[] bArray, short bOffset, byte bLength) {
        register();
    }

    public static void install(byte[] bArray, short bOffset, byte bLength) {
        new CryptonitApplet(bArray, bOffset, bLength);
    }

    @Override
    public void process(APDU apdu) {
        byte buffer[] = apdu.getBuffer();
		if (apdu.isISOInterindustryCLA()) {
            if (buffer[ISO7816.OFFSET_INS] == (byte) (0xA4)) {
                return;
            }
            ISOException.throwIt(ISO7816.SW_CLA_NOT_SUPPORTED);
        }
        ISOException.throwIt(ISO7816.SW_CLA_NOT_SUPPORTED);
    }
}

Add PIN variables and constants


package de.innoaccel.wamp.server.message;

import java.util.List;

public class PublishMessage implements Message
{
    private String topicURI;

    private Object event;

    private boolean excludeMe;

    private List<String> exclude;

    private List<String> eligable;

    public PublishMessage(String topicURI, Object event)
    {
        this(topicURI, event, false);
    }

    public PublishMessage(String topicURI, Object event, boolean excludeMe)
    {
        this(topicURI, event, excludeMe, null, null);
    }

    public PublishMessage(String topicURI, Object event, List<String> exclude, List<String> eligable)
    {
        this(topicURI, event, false, exclude, eligable);
    }

    private PublishMessage(String topicURI, Object event, boolean excludeMe, List<String> exclude, List<String> eligable)
    {
        this.topicURI = topicURI;
        this.event = event;
        this.excludeMe = excludeMe;
        this.exclude = exclude;
        this.eligable = eligable;
    }

    @Override
    public int getMessageCode()
    {
        return Message.PUBLISH;
    }

    public String getTopicURI()
    {
        return this.topicURI;
    }

    public Object getEvent()
    {
        return event;
    }

    public boolean excludeMe()
    {
        return excludeMe;
    }

    public List<String> getExclude()
    {
        return exclude;
    }

    public List<String> getEligable()
    {
        return eligable;
    }
}

package de.innoaccel.wamp.server.message;

import java.util.List;

public class PublishMessage implements Message
{
    private String topicURI;

    private Object event;

    private boolean excludeMe;

    private List<String> exclude;

    private List<String> eligable;

    public PublishMessage(String topicURI, Object event)
    {
        this(topicURI, event, false);
    }

    public PublishMessage(String topicURI, Object event, boolean excludeMe)
    {
        this(topicURI, event, excludeMe, null, null);
    }

    public PublishMessage(String topicURI, Object event, List<String> exclude, List<String> eligable)
    {
        this(topicURI, event, false, exclude, eligable);
    }

    private PublishMessage(String topicURI, Object event, boolean excludeMe, List<String> exclude, List<String> eligable)
    {
        this.topicURI = topicURI;
        this.event = event;
        this.excludeMe = excludeMe;
        this.exclude = exclude;
        this.eligable = eligable;
    }

    @Override
    public int getMessageCode()
    {
        return Message.PUBLISH;
    }

    public String getTopicURI()
    {
        return this.topicURI;
    }

    public Object getEvent()
    {
        return event;
    }

    public boolean excludeMe()
    {
        return excludeMe;
    }

    public List<String> getExclude()
    {
        return exclude;
    }

    public List<String> getEligable()
    {
        return eligable;
    }

    public boolean isTargeted()
    {
        return (null != this.exclude || null != this.eligable);
    }
}

Add utility method to check between the two different publish message forms


package uk.co.uwcs.choob.support;

import java.io.*;
import org.mozilla.javascript.*;

public final class ObjectDBClassJSWrapper implements ObjectDBClass {
	private Function cls;

	public ObjectDBClassJSWrapper(Object obj) {
		if (!(obj instanceof Function)) {
			throw new RuntimeException("Trying to wrap a non-function type as a class!");
		}
		this.cls = (Function)obj;
	}

	public String getName() {
		Context cx = Context.enter();
		try {
			try {
				String ctorName = (String)JSUtils.getProperty((Scriptable)cls, "name");
				Scriptable scope = ((Scriptable)cls).getParentScope();

				// Get plugin name from scope (HACK)!
				String plugName = "<error>";
				while (scope != null) {
					try {
						plugName = (String)JSUtils.getProperty(scope, "__jsplugman_pluginName");
						scope = null;
					} catch (NoSuchFieldException e) {
						scope = scope.getParentScope();
					}
				}

				return "plugin." + plugName + "." + ctorName;
			} catch (NoSuchFieldException e) {
				// Do nothing.
			}
		} finally {
			cx.exit();
		}
		return "";
	}

	public Object newInstance() {
		Context cx = Context.enter();
		try {
			Scriptable scope = cls.getParentScope();
			return cls.construct(cx, scope, new Object[0]);
		} finally {
			cx.exit();
		}
	}
}

package uk.co.uwcs.choob.support;

import java.io.*;
import org.mozilla.javascript.*;

public final class ObjectDBClassJSWrapper implements ObjectDBClass {
	private Function cls;

	public ObjectDBClassJSWrapper(Object obj) {
		if (!(obj instanceof Function)) {
			throw new RuntimeException("Trying to wrap a non-function type as a class!");
		}
		this.cls = (Function)obj;
	}

	public String getName() {
		Context cx = Context.enter();
		try {
			try {
				String ctorName = (String)JSUtils.getProperty((Scriptable)cls, "name");
				Scriptable scope = ((Scriptable)cls).getParentScope();

				// Get plugin name from scope (HACK)!
				String plugName = "<error>";
				while (scope != null) {
					try {
						plugName = (String)JSUtils.getProperty(scope, "__jsplugman_pluginName");
						scope = null;
					} catch (NoSuchFieldException e) {
						scope = scope.getParentScope();
					}
				}

				return "plugins." + plugName + "." + ctorName;
			} catch (NoSuchFieldException e) {
				// Do nothing.
			}
		} finally {
			cx.exit();
		}
		return "";
	}

	public Object newInstance() {
		Context cx = Context.enter();
		try {
			Scriptable scope = cls.getParentScope();
			return cls.construct(cx, scope, new Object[0]);
		} finally {
			cx.exit();
		}
	}
}

Fix JS ObjectDB class wrapper to use format "plugins.Foo.Bar" not "plugin.Foo.Bar". Oops!


package hadoop;

import gsod.DataSet;

import java.io.IOException;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

public class MaxTemperatureMapper extends
		Mapper<LongWritable, Text, Text, IntWritable> {

	@Override
	public void map(LongWritable key, Text value,
			MaxTemperatureMapper.Context context) throws IOException,
			InterruptedException {
		String line = value.toString();

		if (line.startsWith("STN---"))
			return;

		String year = DataSet.getYear(line);
		int airTemperature = DataSet.getMax(line);

		if (airTemperature != DataSet.MISSING) {
			context.write(new Text(year), new IntWritable(airTemperature));
		}
	}

}

package hadoop;

import gsod.DataSet;

import java.io.IOException;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

public class MaxTemperatureMapper extends
		Mapper<LongWritable, Text, Text, IntWritable> {

	private String line;
	private String year;
	private int airTemperature;

	@Override
	public void map(LongWritable key, Text value,
			MaxTemperatureMapper.Context context) throws IOException,
			InterruptedException {
		line = value.toString();

		if (line.startsWith("STN---"))
			return;

		year = DataSet.getYear(line);
		airTemperature = DataSet.getMax(line);

		if (airTemperature != DataSet.MISSING) {
			context.write(new Text(year), new IntWritable(airTemperature));
		}
	}

}

Change yeat and temp to private class vars.


package eu.theunitry.fabula.launcher;

import javax.swing.*;
import java.awt.*;

public class UNLauncher extends JPanel
{

    private JLabel label;
    private JButton startBtn;

    public UNLauncher()
    {
        this.setBackground(new Color(255,82,44));
        this.setLayout(new BorderLayout());

        label = new JLabel("Fabula");
        label.setForeground(Color.white);
        label.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 40));
        label.setHorizontalAlignment(JLabel.CENTER);

        startBtn = new JButton("Start");
        startBtn.setPreferredSize(new Dimension(200,100));

        this.add(label, BorderLayout.CENTER);
        this.add(startBtn, BorderLayout.SOUTH);
    }

    public JPanel getPanel() {
        return this;
    }

}

package eu.theunitry.fabula.launcher;

import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.*;

public class UNLauncher extends JPanel
{

    private JLabel label;
    private JButton startBtn;

    public UNLauncher()
    {
        this.setBackground(new Color(255,82,44));
        this.setLayout(new BorderLayout());
        this.setBorder(new EmptyBorder(10, 10, 10, 10));

        label = new JLabel("Fabula");
        label.setForeground(Color.white);
        label.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 40));
        label.setHorizontalAlignment(JLabel.CENTER);

        startBtn = new JButton("Start");
        startBtn.setPreferredSize(new Dimension(200,100));

        /* Remove default styling */
        startBtn.setFocusPainted(false);
        startBtn.setBorderPainted(false);

        startBtn.setBackground(Color.white);
        startBtn.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 20));
        startBtn.setForeground(Color.white);

        this.add(label, BorderLayout.CENTER);
        this.add(startBtn, BorderLayout.SOUTH);
    }

    public JPanel getPanel() {
        return this;
    }

}

Remove styling from start button


package com.namelessdev.mpdroid.tools;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

public class NetworkHelper {

    public static final int MAX_RETRY = 5;

    public static boolean isNetworkConnected(Context context) {
        return isNetworkConnected(context, new int[0]);
    }

    public static Boolean isLocalNetworkConnected(Context context) {
        return isNetworkConnected(context, new int[]{ConnectivityManager.TYPE_WIFI, ConnectivityManager.TYPE_ETHERNET});
    }

    public static Boolean isNetworkConnected(Context context, int... allowedNetworkTypes) {

        for (int attempt = 0; attempt < MAX_RETRY; attempt++) {
            if (innerIsNetworkConnected(context, allowedNetworkTypes)) {
                return true;
            } else {
                try {
                    Thread.sleep(500);
                } catch (InterruptedException e) {
                    //Nothing to do
                }
            }
        }
        return false;
    }

    public static Boolean innerIsNetworkConnected(Context context, int... allowedNetworkTypes) {

        NetworkInfo networkInfo;
        boolean networkConnected = false;
        ConnectivityManager cm = (ConnectivityManager) context
                .getSystemService(Context.CONNECTIVITY_SERVICE);

        if (cm == null) {
            networkConnected = false;
        } else {
            networkInfo = cm.getActiveNetworkInfo();
            if (networkInfo == null) {
                networkConnected = false;
            } else if (!networkInfo.isAvailable() || !networkInfo.isConnected()) {
                networkConnected = false;
            } else if (allowedNetworkTypes.length == 0) {
                networkConnected = true;
            } else {
                for (int networkType = 0; networkType < allowedNetworkTypes.length && !networkConnected; networkType++) {
                    if (allowedNetworkTypes[networkType] == networkInfo.getType()) {
                        networkConnected = true;
                    }
                }
            }
        }
        return networkConnected;
    }
}

package com.namelessdev.mpdroid.tools;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

public class NetworkHelper {

	public static boolean isNetworkConnected(Context context) {
		ConnectivityManager cm = (ConnectivityManager) context
				.getSystemService(Context.CONNECTIVITY_SERVICE);
		if (cm.getActiveNetworkInfo() == null)
			return false;
		return (cm.getActiveNetworkInfo().isAvailable() && cm
				.getActiveNetworkInfo().isConnected());
	}

	public static Boolean isLocalNetworkConnected(Context context) {
		ConnectivityManager cm = (ConnectivityManager) context
				.getSystemService(Context.CONNECTIVITY_SERVICE);
		if (cm == null) {
			return false;
		}
		NetworkInfo netWorkinfo = cm.getActiveNetworkInfo();
		return (netWorkinfo != null
				&& (netWorkinfo.getType() == ConnectivityManager.TYPE_WIFI || netWorkinfo
						.getType() == ConnectivityManager.TYPE_ETHERNET) && netWorkinfo
					.isConnected());
	}
}

Revert "Improve robustness to temporary network problems."


package eu.rekawek.coffeegb.memory;

import eu.rekawek.coffeegb.AddressSpace;
import eu.rekawek.coffeegb.cpu.SpeedMode;

public class Dma implements AddressSpace {

    private final AddressSpace addressSpace;

    private final AddressSpace oam;

    private final SpeedMode speedMode;

    private boolean transferInProgress;

    private boolean restarted;

    private int from;

    private int ticks;

    public Dma(AddressSpace addressSpace, AddressSpace oam, SpeedMode speedMode) {
        this.addressSpace = addressSpace;
        this.speedMode = speedMode;
        this.oam = oam;
    }

    @Override
    public boolean accepts(int address) {
        return address == 0xff46;
    }

    public void tick() {
        if (transferInProgress) {
            if (++ticks >= 648 / speedMode.getSpeedMode()) {
                transferInProgress = false;
                restarted = false;
                ticks = 0;
                for (int i = 0; i < 0xa0; i++) {
                    oam.setByte(0xfe00 + i, addressSpace.getByte(from + i));
                }
            }
        }
    }

    @Override
    public void setByte(int address, int value) {
        from = value * 0x100;
        restarted = isOamBlocked();
        ticks = 0;
        transferInProgress = true;
    }

    @Override
    public int getByte(int address) {
        return 0;
    }

    public boolean isOamBlocked() {
        return restarted || (transferInProgress && ticks >= 5);
    }
}

package eu.rekawek.coffeegb.memory;

import eu.rekawek.coffeegb.AddressSpace;
import eu.rekawek.coffeegb.cpu.SpeedMode;

public class Dma implements AddressSpace {

    private final AddressSpace addressSpace;

    private final AddressSpace oam;

    private final SpeedMode speedMode;

    private boolean transferInProgress;

    private boolean restarted;

    private int from;

    private int ticks;

    private int regValue = 0xff;

    public Dma(AddressSpace addressSpace, AddressSpace oam, SpeedMode speedMode) {
        this.addressSpace = addressSpace;
        this.speedMode = speedMode;
        this.oam = oam;
    }

    @Override
    public boolean accepts(int address) {
        return address == 0xff46;
    }

    public void tick() {
        if (transferInProgress) {
            if (++ticks >= 648 / speedMode.getSpeedMode()) {
                transferInProgress = false;
                restarted = false;
                ticks = 0;
                for (int i = 0; i < 0xa0; i++) {
                    oam.setByte(0xfe00 + i, addressSpace.getByte(from + i));
                }
            }
        }
    }

    @Override
    public void setByte(int address, int value) {
        from = value * 0x100;
        restarted = isOamBlocked();
        ticks = 0;
        transferInProgress = true;
        regValue = value;
    }

    @Override
    public int getByte(int address) {
        return regValue;
    }

    public boolean isOamBlocked() {
        return restarted || (transferInProgress && ticks >= 5);
    }
}

Return the written value of DMA register.


package de.eightbitboy.ecorealms.control;

import java.util.ArrayList;
import java.util.List;

public class ControlActionMapping {

	enum Action {
		LMB,
		RMB
	}

	public interface ActionListener {
		void action(Action action);
	}

	private static final ControlActionMapping INSTANCE = new ControlActionMapping();

	private List<ActionListener> listeners = new ArrayList<ActionListener>();

	private ControlActionMapping() {
	}

	public static ControlActionMapping getInstance() {
		return INSTANCE;
	}

	public static void subscribe(ActionListener listener) {
		INSTANCE.listeners.add(listener);
	}

	public void fireAction(Action action) {
		for (ActionListener listener : listeners) {
			listener.action(action);
		}
	}
}

package de.eightbitboy.ecorealms.control;

import java.util.ArrayList;
import java.util.List;

public class ControlActionMapping {

	enum Action {
		LMB,
		RMB;

		public ActionInformation info() {
			return ControlActionMapping.getActionInformation();
		}
	}

	public class ActionInformation {

	}

	public interface ActionListener {
		void action(Action action);
	}

	private static final ControlActionMapping INSTANCE = new ControlActionMapping();

	private List<ActionListener> listeners = new ArrayList<ActionListener>();

	private ActionInformation actionInformation = new ActionInformation();

	private ControlActionMapping() {
	}

	public static ControlActionMapping getInstance() {
		return INSTANCE;
	}

	public static void subscribe(ActionListener listener) {
		INSTANCE.listeners.add(listener);
	}

	public static ActionInformation getActionInformation() {
		return INSTANCE.actionInformation;
	}

	public void fireAction(Action action) {
		for (ActionListener listener : listeners) {
			listener.action(action);
		}
	}
}

Prepare adding information to actions


/**
 *    Copyright 2016-2017 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 examples.groupby;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Select;
import org.mybatis.dynamic.sql.select.render.SelectStatement;

public interface GroupByMapper {

    @Select({
        "${selectStatement}"
    })
    List<Map<String, Object>> generalSelect(SelectStatement selectStatement);
}

/**
 *    Copyright 2016-2017 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 examples.groupby;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.SelectProvider;
import org.mybatis.dynamic.sql.select.render.SelectStatement;
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;

public interface GroupByMapper {

    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    List<Map<String, Object>> generalSelect(SelectStatement selectStatement);
}

Update test to use new adapter


package it.near.sdk.Utils;

import android.content.Intent;

import it.near.sdk.Reactions.Content.Content;
import it.near.sdk.Reactions.Coupon.Coupon;
import it.near.sdk.Reactions.CustomJSON.CustomJSON;
import it.near.sdk.Reactions.Feedback.Feedback;
import it.near.sdk.Reactions.Poll.Poll;
import it.near.sdk.Reactions.SimpleNotification.SimpleNotification;

/**
 * Interface for being notified of core content types.
 *
 * @author cattaneostefano
 */
public interface CoreContentsListener {
    void getPollNotification(Intent intent, Poll notification, String recipeId);
    void getContentNotification(Intent intent, Content notification, String recipeId);
    void getCouponNotification(Intent intent, Coupon notification, String recipeId);
    void getCustomJSONNotification(Intent intent, CustomJSON notification, String recipeId);
    void getSimpleNotification(Intent intent, SimpleNotification s_notif, String recipeId);
    void getFeedbackNotification(Intent intent, Feedback s_notif, String recipeId);
}

package it.near.sdk.Utils;

import android.content.Intent;
import android.support.annotation.Nullable;

import it.near.sdk.Reactions.Content.Content;
import it.near.sdk.Reactions.Coupon.Coupon;
import it.near.sdk.Reactions.CustomJSON.CustomJSON;
import it.near.sdk.Reactions.Feedback.Feedback;
import it.near.sdk.Reactions.Poll.Poll;
import it.near.sdk.Reactions.SimpleNotification.SimpleNotification;

/**
 * Interface for being notified of core content types.
 *
 * @author cattaneostefano
 */
public interface CoreContentsListener {
    void getPollNotification(@Nullable Intent intent, Poll notification, String recipeId);
    void getContentNotification(@Nullable Intent intent, Content notification, String recipeId);
    void getCouponNotification(@Nullable Intent intent, Coupon notification, String recipeId);
    void getCustomJSONNotification(@Nullable Intent intent, CustomJSON notification, String recipeId);
    void getSimpleNotification(@Nullable Intent intent, SimpleNotification s_notif, String recipeId);
    void getFeedbackNotification(@Nullable Intent intent, Feedback s_notif, String recipeId);
}

Add nullable to corecontentlistner methods parameters


package data;

import util.UserAuthUtil;

/** Class to build Login/Logout response objects in JSON format */
public class ResponseBuilder {
  /**
   * @param isLoggedIn user login status
   * @param redirectURL URL to redirect after login/logout
   * @return JSON string with login/logout URL
   *         e.g., logged in: { "isLoggedIn":{"/_ah/logout?continue=%2FLogin"}, "isLoggedOut":{""}}
   *         logged out: { "isLoggedIn":{""}, "isLoggedOut":{"/_ah/login?continue=%2FLogin"}}
   */
  public static String toJson(boolean isLoggedIn, String redirectURL) {
    return "{ \"isLoggedIn\":{\"" + buildLogout(isLoggedIn, redirectURL) + "\"}, " +
            "\"isLoggedOut\":{\"" + buildLogin(isLoggedIn, redirectURL) + "\"}}";
  }

  private static String buildLogin(boolean isLoggedIn, String redirectURL) {
    return isLoggedIn ? "" : UserAuthUtil.getLoginURL(redirectURL);
  }

  private static String buildLogout(boolean isLoggedIn, String redirectURL) {
    return isLoggedIn ? UserAuthUtil.getLogoutURL(redirectURL) : "";
  }
}

package data;

import util.UserAuthUtil;

/** Class to build Login/Logout response objects in JSON format */
public class ResponseBuilder {
  /**
   * @param isLoggedIn user login status
   * @param redirectURL URL to redirect after login/logout
   * @return JSON string with login/logout URL
   *         e.g., logged in: { "isLoggedIn":{"loginURL" : "/_ah/logout?continue=%2FLogin"}, "isLoggedOut":{""}}
   *         logged out: { "isLoggedIn":{""}, "isLoggedOut":{"logoutURL" : "/_ah/login?continue=%2FLogin"}}
   */
  public static String toJson(boolean isLoggedIn, String redirectURL) {
    return "{ \"isLoggedIn\":{\"" + buildLogout(isLoggedIn, redirectURL) + "\"}, " +
            "\"isLoggedOut\":{\"" + buildLogin(isLoggedIn, redirectURL) + "\"}}";
  }

  private static String buildLogin(boolean isLoggedIn, String redirectURL) {
    return isLoggedIn ? "" : "\"loginURL\" :" + UserAuthUtil.getLoginURL(redirectURL);
  }

  private static String buildLogout(boolean isLoggedIn, String redirectURL) {
    return isLoggedIn ? "\"logoutURL\" :" + UserAuthUtil.getLogoutURL(redirectURL) : "";
  }
}

Add key for JSON string


public enum Operator {
	PLUS,MINUS,MULT,DIV,LOW_STRICT,UP_STRICT,LOW_EGAL,UP_EGAL,EGAL,DIFF,AND,OR;
}

public enum Operator {
	PLUS,MINUS,MULT,DIV,LOW_STRICT,UP_STRICT,LOW_EGAL,UP_EGAL,EGAL,DIFF,AND,OR,NOT,OPP;
}

Add 2 operators for the 'not' function


package com.xtremelabs.robolectric.res;

import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.HashMap;
import java.util.Map;

public class ResourceExtractor {
    private Map<String, Integer> resourceStringToId = new HashMap<String, Integer>();
    private Map<Integer, String> resourceIdToString = new HashMap<Integer, String>();

    public void addRClass(Class rClass) throws Exception {
        for (Class innerClass : rClass.getClasses()) {
            for (Field field : innerClass.getDeclaredFields()) {
                if (field.getType().equals(Integer.TYPE) && Modifier.isStatic(field.getModifiers())) {
                    String name = innerClass.getSimpleName() + "/" + field.getName();
                    int value = field.getInt(null);
                    resourceStringToId.put(name, value);
                    resourceIdToString.put(value, name);
                }
            }
        }
    }

    public int resourceIdOrZero(String resourceName) {
        Integer resId = getResourceId(resourceName);
        return (resId == null) ? 0 : resId;
    }

    public Integer getResourceId(String resourceName) {
        if (resourceName == null) {
            return null;
        }
        if (resourceName.startsWith("@+id")) {
            resourceName = resourceName.substring(2);
        } else if (resourceName.startsWith("@")) {
            resourceName = resourceName.substring(1);
        }
        return resourceStringToId.get(resourceName);
    }

    public String getResourceName(int resourceId) {
        return resourceIdToString.get(resourceId);
    }
}

package com.xtremelabs.robolectric.res;

import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.HashMap;
import java.util.Map;

public class ResourceExtractor {
    private Map<String, Integer> resourceStringToId = new HashMap<String, Integer>();
    private Map<Integer, String> resourceIdToString = new HashMap<Integer, String>();

    public void addRClass(Class rClass) throws Exception {
        for (Class innerClass : rClass.getClasses()) {
            for (Field field : innerClass.getDeclaredFields()) {
                if (field.getType().equals(Integer.TYPE) && Modifier.isStatic(field.getModifiers())) {
                    String name = innerClass.getSimpleName() + "/" + field.getName();
                    int value = field.getInt(null);
                    resourceStringToId.put(name, value);
                    resourceIdToString.put(value, name);
                }
            }
        }
    }

    public int resourceIdOrZero(String resourceName) {
        Integer resId = getResourceId(resourceName);
        return (resId == null) ? 0 : resId;
    }

    public Integer getResourceId(String resourceName) {
        if (resourceName == null) {
            return null;
        }
        if (resourceName.startsWith("@+id")) {
            resourceName = resourceName.substring(2);
        } else if (resourceName.startsWith("@")) {
            resourceName = resourceName.substring(1);
        }
        return resourceStringToId.get(resourceName);
    }

    public String getResourceName(int resourceId) {
        String ret = resourceIdToString.get(resourceId);
        if (ret == null)
            throw new RuntimeException("Can't find resource "+resourceId);
        return ret;
    }
}

Throw RuntimeException if getResourceName() fails


/* This should be a file
*/

public class Example {

	public int i;
	public String test = "TEST";
}
// some new code

Change in file in submodule


package com.iluwatar.generic;

public interface Observer<S extends Observable<S, O, A>, O extends Observer<S, O, A>, A> {
    public void update(S subject, A argument);
}

package com.iluwatar.generic;

public interface Observer<S extends Observable<S, O, A>, O extends Observer<S, O, A>, A> {

    void update(S subject, A argument);
}

Remove unnecessary declarations in observer pattern.


package io.sigpipe.sing.stat;

public class SummaryStatistics {

    private double min;
    private double max;
    private double mean;
    private double std;
    private double var;

    public SummaryStatistics(RunningStatistics rs) {
        this.min = rs.min();
        this.max = rs.max();
        this.mean = rs.mean();
        this.var = rs.var();
        this.std = rs.std();
    }

    public double min() {
        return this.min;
    }

    public double max() {
        return this.max;
    }

    public double mean() {
        return this.mean;
    }

    public double std() {
        return this.std;
    }

    public double var() {
        return this.var;
    }
}

package io.sigpipe.sing.stat;

public class SummaryStatistics {

    private long num;
    private double min;
    private double max;
    private double mean;
    private double std;
    private double var;

    public SummaryStatistics(RunningStatistics rs) {
        this.num = rs.n();
        this.min = rs.min();
        this.max = rs.max();
        this.mean = rs.mean();
        this.var = rs.var();
        this.std = rs.std();
    }

    public double num() {
        return this.num;
    }

    public double min() {
        return this.min;
    }

    public double max() {
        return this.max;
    }

    public double mean() {
        return this.mean;
    }

    public double std() {
        return this.std;
    }

    public double var() {
        return this.var;
    }
}

Maintain number of samples observed


/*
 * Minecraft Dev for IntelliJ
 *
 * https://minecraftdev.org
 *
 * Copyright (c) 2016 minecraft-dev
 *
 * MIT License
 */

package com.demonwav.mcdev.update;

import com.google.common.collect.ImmutableList;
import com.intellij.openapi.updateSettings.impl.UpdateSettings;
import org.jetbrains.annotations.Nullable;

import java.util.List;

public enum Channels {
    SCOTLIN("Kotlin And Scala Support", "https://plugins.jetbrains.com/plugins/kotlin%20and%20scala%20support/8327", 1);

    private final String title;
    private final String url;
    private final int index;

    Channels(final String title, final String url, final int index) {
        this.title = title;
        this.url = url;
        this.index = index;
    }

    public String getTitle() {
        return title;
    }

    public String getUrl() {
        return url;
    }

    public int getIndex() {
        return index;
    }

    @Nullable
    public static Channels getChannel(int index) {
        for (Channels channels : values()) {
            if (channels.getIndex() == index) {
                return channels;
            }
        }

        return null;
    }

    public static List<Channels> orderedList() {
        return ImmutableList.of(SCOTLIN);
    }

    public boolean hasChannel() {
        return UpdateSettings.getInstance().getPluginHosts().contains(url);
    }
}

/*
 * Minecraft Dev for IntelliJ
 *
 * https://minecraftdev.org
 *
 * Copyright (c) 2016 minecraft-dev
 *
 * MIT License
 */

package com.demonwav.mcdev.update;

import com.google.common.collect.ImmutableList;
import com.intellij.openapi.updateSettings.impl.UpdateSettings;
import org.jetbrains.annotations.Nullable;

import java.util.List;

public enum Channels {
    ;

    private final String title;
    private final String url;
    private final int index;

    Channels(final String title, final String url, final int index) {
        this.title = title;
        this.url = url;
        this.index = index;
    }

    public String getTitle() {
        return title;
    }

    public String getUrl() {
        return url;
    }

    public int getIndex() {
        return index;
    }

    @Nullable
    public static Channels getChannel(int index) {
        for (Channels channels : values()) {
            if (channels.getIndex() == index) {
                return channels;
            }
        }

        return null;
    }

    public static List<Channels> orderedList() {
        return ImmutableList.of();
    }

    public boolean hasChannel() {
        return UpdateSettings.getInstance().getPluginHosts().contains(url);
    }
}

Remove Kotlin and Scala support channel, as it's diverged too far


package seedu.doist.logic.parser;

import java.util.regex.Pattern;

import seedu.doist.logic.parser.ArgumentTokenizer.Prefix;

/**
 * Contains Command Line Interface (CLI) syntax definitions common to multiple commands
 */
public class CliSyntax {

    /* Prefix definitions */
    public static final Prefix PREFIX_PHONE = new Prefix("p/");
    public static final Prefix PREFIX_EMAIL = new Prefix("e/");
    public static final Prefix PREFIX_ADDRESS = new Prefix("a/");
    public static final Prefix PREFIX_TAG = new Prefix("t/");

    /* Patterns definitions */
    public static final Pattern KEYWORDS_ARGS_FORMAT =
            Pattern.compile("(?<keywords>\\S+(?:\\s+\\S+)*)"); // one or more keywords separated by whitespace

}

package seedu.doist.logic.parser;

import java.util.regex.Pattern;

import seedu.doist.logic.parser.ArgumentTokenizer.Prefix;

/**
 * Contains Command Line Interface (CLI) syntax definitions common to multiple commands
 */
public class CliSyntax {

    /* Prefix definitions */
    public static final Prefix PREFIX_FROM = new Prefix("\\from");
    public static final Prefix PREFIX_TO = new Prefix("\\to");
    public static final Prefix PREFIX_REMIND = new Prefix("\\remind_at");
    public static final Prefix PREFIX_EVERY = new Prefix("\\every");
    public static final Prefix PREFIX_AS = new Prefix("\\as");
    public static final Prefix PREFIX_UNDER = new Prefix("\\under");
    public static final Prefix PREFIX_BY = new Prefix("\\by");
    public static final Prefix PREFIX_DESCRIPTION = new Prefix("\\desc");
    public static final Prefix PREFIX_IN = new Prefix("\\in");

    /* Patterns definitions */
    public static final Pattern KEYWORDS_ARGS_FORMAT =
            Pattern.compile("(?<keywords>\\S+(?:\\s+\\S+)*)"); // one or more keywords separated by whitespace

}

Create new keywords for commands


/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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.commonwl.view.cwl;

/**
 * Enum for possible CWL processes
 */
public enum CWLProcess {
    WORKFLOW,
    COMMANDLINETOOL,
    EXPRESSIONTOOL;

    @Override
    public String toString() {
        switch (this) {
            case WORKFLOW:
                return "Workflow";
            case COMMANDLINETOOL:
                return "CommandLineTool";
            case EXPRESSIONTOOL:
            default:
                return "ExpressionTool";
        }
    }
}

/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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.commonwl.view.cwl;

/**
 * Enum for possible CWL processes
 */
public enum CWLProcess {
    WORKFLOW("Workflow"),
    COMMANDLINETOOL("CommandLineTool"),
    EXPRESSIONTOOL("ExpressionTool");

    private final String name;

    CWLProcess(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return name;
    }
}

Update enum to pass name to constructor


/*
 * JBoss, Home of Professional Open Source
 * Copyright 2014 Red Hat Inc. and/or its affiliates and other contributors
 * as indicated by the @authors tag. All rights reserved.
 */

package org.searchisko.doap.model;

import com.viceversatech.rdfbeans.annotations.RDF;
import com.viceversatech.rdfbeans.annotations.RDFBean;
import com.viceversatech.rdfbeans.annotations.RDFNamespaces;

import java.net.URI;

/**
 * FOAF Person model.
 *
 * @author Lukas Vlcek (lvlcek@redhat.com)
 */

@RDFNamespaces({
	"foaf = http://xmlns.com/foaf/0.1/"
})
@RDFBean("foaf:Person")
public class Person {

	private String name;
	private URI mbox;

	@RDF("foaf:name")
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@RDF("foaf:mbox")
	public URI getMbox() {
		return this.mbox;
	}

	public void setMbox(URI mbox) {
		this.mbox = mbox;
	}

}

/*
 * JBoss, Home of Professional Open Source
 * Copyright 2014 Red Hat Inc. and/or its affiliates and other contributors
 * as indicated by the @authors tag. All rights reserved.
 */

package org.searchisko.doap.model;

import com.viceversatech.rdfbeans.annotations.RDF;
import com.viceversatech.rdfbeans.annotations.RDFBean;
import com.viceversatech.rdfbeans.annotations.RDFNamespaces;

import java.net.URI;

/**
 * FOAF Person model.
 * See http://xmlns.com/foaf/spec/.
 *
 * @author Lukas Vlcek (lvlcek@redhat.com)
 */

@RDFNamespaces({
		"foaf = http://xmlns.com/foaf/0.1/"
})
@RDFBean("foaf:Person")
public class Person {

	private String name;
	private URI mbox;

	/**
	 * See foaf:name
	 *
	 * @return name value
	 */
	@RDF("foaf:name")
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	/**
	 * See foaf:mbox
	 *
	 * @return mbox valueAdd
	 */
	@RDF("foaf:mbox")
	public URI getMbox() {
		return this.mbox;
	}

	public void setMbox(URI mbox) {
		this.mbox = mbox;
	}

}

Add reference to foaf spec.


package io.undertow.server.handlers;

import io.undertow.server.HttpHandler;
import io.undertow.server.HttpServerExchange;
import io.undertow.util.HeaderValues;
import io.undertow.util.Headers;
import io.undertow.util.Methods;

/**
 * A handler that handles HTTP trace requests
 *
 * @author Stuart Douglas
 */
public class HttpTraceHandler implements HttpHandler {

    private final HttpHandler handler;

    public HttpTraceHandler(final HttpHandler handler) {
        this.handler = handler;
    }

    @Override
    public void handleRequest(final HttpServerExchange exchange) throws Exception {
        if(exchange.getRequestMethod().equals(Methods.TRACE)) {
            exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, "message/http");
            StringBuilder body = new StringBuilder("TRACE ");
            body.append(exchange.getRequestURI());
            if(!exchange.getQueryString().isEmpty()) {
                body.append('?');
                body.append(exchange.getQueryString());
            }
            body.append(exchange.getProtocol().toString());
            body.append("\r\n");
            for(HeaderValues header : exchange.getRequestHeaders()) {
                for(String value : header) {
                    body.append(header.getHeaderName());
                    body.append(": ");
                    body.append(value);
                    body.append("\r\n");
                }
            }
            body.append("\r\n");
        } else {
            handler.handleRequest(exchange);
        }
    }
}

package io.undertow.server.handlers;

import io.undertow.server.HttpHandler;
import io.undertow.server.HttpServerExchange;
import io.undertow.util.HeaderValues;
import io.undertow.util.Headers;
import io.undertow.util.Methods;

/**
 * A handler that handles HTTP trace requests
 *
 * @author Stuart Douglas
 */
public class HttpTraceHandler implements HttpHandler {

    private final HttpHandler handler;

    public HttpTraceHandler(final HttpHandler handler) {
        this.handler = handler;
    }

    @Override
    public void handleRequest(final HttpServerExchange exchange) throws Exception {
        if(exchange.getRequestMethod().equals(Methods.TRACE)) {
            exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, "message/http");
            StringBuilder body = new StringBuilder("TRACE ");
            body.append(exchange.getRequestURI());
            if(!exchange.getQueryString().isEmpty()) {
                body.append('?');
                body.append(exchange.getQueryString());
            }
            body.append(exchange.getProtocol().toString());
            body.append("\r\n");
            for(HeaderValues header : exchange.getRequestHeaders()) {
                for(String value : header) {
                    body.append(header.getHeaderName());
                    body.append(": ");
                    body.append(value);
                    body.append("\r\n");
                }
            }
            body.append("\r\n");
            exchange.getResponseSender().send(body.toString());
        } else {
            handler.handleRequest(exchange);
        }
    }
}

Fix bug in trace handler


package com.s24.redjob.worker;

/**
 * Wrapper for job runners which do not implement {@link Runnable}.
 */
public abstract class WrappingRunnable implements Runnable {
   /**
    * Job runner.
    */
   private final Object runner;

   /**
    * Constructor.
    *
    * @param runner
    *           Job runner.
    */
   public WrappingRunnable(Object runner) {
      this.runner = runner;
   }

   /**
    * Job runner.
    */
   public Object unwrap() {
      return runner;
   }
}

package com.s24.redjob.worker;

/**
 * Wrapper for job runners which do not implement {@link Runnable}.
 */
public abstract class WrappingRunnable implements Runnable {
   /**
    * Job runner.
    */
   private final Object runner;

   /**
    * Constructor.
    *
    * @param runner
    *           Job runner.
    */
   public WrappingRunnable(Object runner) {
      this.runner = runner;
   }

   /**
    * Job runner.
    */
   public <R> R unwrap() {
      return (R) runner;
   }
}

Make return value more flexible


package uk.co.eggsylife.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HomeController {

    @RequestMapping(value = "/", method = RequestMethod.GET)
    public String showHomePage() {
        return "Welcome to v0.0.2 of the application";
    }
}

package uk.co.eggsylife.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HomeController {

    @RequestMapping(value = "/", method = RequestMethod.GET)
    public String showHomePage() {
        return "Welcome to v0.0.1 of the application";
    }
}

Revert version number back for demo


package content;

import java.util.Comparator;

/**
 * @author john
 *
 */
class FileInfoComparator implements Comparator<FileInfo> {
	/* (non-Javadoc)
	 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
	 */
	@Override
	public int compare(FileInfo arg0, FileInfo arg1) {
		return arg0.name.compareTo(arg1.name);
	}
}

package content;

import java.util.Comparator;

/**
 * @author john
 *
 */
class FileInfoComparator implements Comparator<FileInfo> {
	/*
	 * (non-Javadoc)
	 *
	 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
	 */
	@Override
	public int compare(FileInfo arg0, FileInfo arg1) {
		return arg0.name.compareTo(arg1.name);
	}
}

Standardize formatting for file comparison


/***********************************************
 * Filename       : HibernateUserDao.java
 * Copyright      : Copyright (c) 2014
 * Company        : Innovaee
 * Created        : 11/27/2014
 ************************************************/
package com.innovaee.eorder.dao.hibernate;

import com.innovaee.eorder.dao.UserDao;
import com.innovaee.eorder.entity.User;

import java.util.List;

/**
 * @Title: HibernateUserDao
 * @Description: 用户数据访问对象实现类
 *
 * @version V1.0
 */
public class HibernateUserDao extends HibernateBaseDao<User> implements UserDao {

    /**
     * 根据手机号码得到用户
     *
     * @param cellphone
     *            手机号码
     * @return 用户
     */
    public User getUserByCellphone(String cellphone) {
        String hql = "from User as user where user.cellphone = ?";
        Object[] paras = { cellphone };
        List<User> users = getPage(0, 1, hql, paras);
        if (0 != users.size()) {
            return users.get(0);
        }

        return null;
    }

}

/***********************************************
 * Filename       : HibernateUserDao.java
 * Copyright      : Copyright (c) 2014
 * Company        : Innovaee
 * Created        : 11/27/2014
 ************************************************/
package com.innovaee.eorder.dao.hibernate;

import com.innovaee.eorder.dao.UserDao;
import com.innovaee.eorder.entity.User;

import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;
import org.springframework.orm.hibernate3.HibernateCallback;

/**
 * @Title: HibernateUserDao
 * @Description: 用户数据访问对象实现类
 *
 * @version V1.0
 */
public class HibernateUserDao extends HibernateBaseDao<User> implements UserDao {

    /**
     * 根据手机号码得到用户
     *
     * @param cellphone
     *            手机号码
     * @return 用户
     */
    public User getUserByCellphone(final String cellphone) {
//        String hql = "from User as user where user.cellphone = ?";
//        Object[] paras = { cellphone };
//        List<User> users = getPage(0, 1, hql, paras);
//        if (0 != users.size()) {
//            return users.get(0);
//        }
//
//        return null;

        return getHibernateTemplate().execute(new HibernateCallback<User>(){

            public User doInHibernate(Session session) {
                Criteria criteria = session.createCriteria(User.class);

                criteria.add(Restrictions.eq("cellphone", cellphone));

                return (User)(criteria.list().iterator().next());
            }
        });

    }

}

Use Hibernate Criteria to query User by cellphone


package org.hexpresso.elm327.commands.filters;

import org.hexpresso.elm327.commands.Response;
import org.hexpresso.elm327.commands.ResponseFilter;

import java.util.ArrayList;
import java.util.ListIterator;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created by Pierre-Etienne Messier <pierre.etienne.messier@gmail.com> on 2015-10-25.
 */
public class RegularExpressionResponseFilter implements ResponseFilter {
    private Pattern mPattern = null;

    public RegularExpressionResponseFilter(String regularExpression) {
        mPattern = Pattern.compile(regularExpression);
    }

    public RegularExpressionResponseFilter(Pattern pattern) {
        mPattern = pattern;
    }

    @Override
    public void onResponseReceived(Response response) {
        ArrayList<String> lines = response.getLines();

        ListIterator<String> it = lines.listIterator();
        while(it.hasNext()) {
            String line = it.next();

            Matcher m = mPattern.matcher(line);
            if(m.matches()) {
                final int groupCount = m.groupCount();
                if( groupCount == 1) {
                    it.set(m.group(1));
                }
                else if( groupCount > 1) {
                    throw new RuntimeException("Unsupported pattern match with more than one group");
                }
            }
            else {
                it.remove();
            }
        }
    }
}

package org.hexpresso.elm327.commands.filters;

import org.hexpresso.elm327.commands.Response;
import org.hexpresso.elm327.commands.ResponseFilter;

import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created by Pierre-Etienne Messier <pierre.etienne.messier@gmail.com> on 2015-10-25.
 */
public class RegularExpressionResponseFilter implements ResponseFilter {
    private Pattern mPattern = null;

    public RegularExpressionResponseFilter(String regularExpression) {
        mPattern = Pattern.compile(regularExpression);
    }

    public RegularExpressionResponseFilter(Pattern pattern) {
        mPattern = pattern;
    }

    @Override
    public void onResponseReceived(Response response) {
        List<String> lines = response.getLines();

        ListIterator<String> it = lines.listIterator();
        while(it.hasNext()) {
            String line = it.next();

            Matcher m = mPattern.matcher(line);
            if(m.matches()) {
                final int groupCount = m.groupCount();
                if( groupCount == 1) {
                    it.set(m.group(1));
                }
                else if( groupCount > 1) {
                    throw new RuntimeException("Unsupported pattern match with more than one group");
                }
            }
            else {
                it.remove();
            }
        }
    }
}

Fix build error (my fault)


// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.config.server.maintenance;

import com.yahoo.vespa.config.server.ApplicationRepository;
import com.yahoo.vespa.curator.Curator;

import java.time.Duration;

/**
 * Removes inactive sessions
 * <p>
 * Note: Unit test is in ApplicationRepositoryTest
 *
 * @author hmusum
 */
public class SessionsMaintainer extends ConfigServerMaintainer {
    private final boolean hostedVespa;

    SessionsMaintainer(ApplicationRepository applicationRepository, Curator curator, Duration interval) {
        // Start this maintainer immediately. It frees disk space, so if disk goes full and config server
        // restarts this makes sure that cleanup will happen as early as possible
        super(applicationRepository, curator, Duration.ZERO, interval);
        this.hostedVespa = applicationRepository.configserverConfig().hostedVespa();
    }

    @Override
    protected void maintain() {
        applicationRepository.deleteExpiredLocalSessions();

        // Expired remote sessions are sessions that belong to an application that have external deployments that
        // are no longer active
        if (hostedVespa) {
            Duration expiryTime = Duration.ofDays(7);
            applicationRepository.deleteExpiredRemoteSessions(expiryTime);
        }
    }
}

// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.config.server.maintenance;

import com.yahoo.vespa.config.server.ApplicationRepository;
import com.yahoo.vespa.curator.Curator;

import java.time.Duration;

/**
 * Removes inactive sessions
 * <p>
 * Note: Unit test is in ApplicationRepositoryTest
 *
 * @author hmusum
 */
public class SessionsMaintainer extends ConfigServerMaintainer {
    private final boolean hostedVespa;

    SessionsMaintainer(ApplicationRepository applicationRepository, Curator curator, Duration interval) {
        // Start this maintainer immediately. It frees disk space, so if disk goes full and config server
        // restarts this makes sure that cleanup will happen as early as possible
        super(applicationRepository, curator, Duration.ZERO, interval);
        this.hostedVespa = applicationRepository.configserverConfig().hostedVespa();
    }

    @Override
    protected void maintain() {
        applicationRepository.deleteExpiredLocalSessions();

        // Expired remote sessions are not expected to exist, they should have been deleted when
        // a deployment happened or when the application was deleted. We still see them from time to time,
        // probably due to some race or another bug
        if (hostedVespa) {
            Duration expiryTime = Duration.ofDays(30);
            applicationRepository.deleteExpiredRemoteSessions(expiryTime);
        }
    }
}

Revert "Reduce the time we keep expired remotes sessions and fix comment"


package com.awesometickets.config;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse;

/**
 * Cross-Origin Resource Sharing filter.
 */
public class CORSFilter implements Filter {

    public void init(FilterConfig filterConfig) throws ServletException {}

    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
        throws IOException, ServletException {
        HttpServletResponse res = (HttpServletResponse)response;
        res.setHeader("Access-Control-Allow-Origin", "*");
        res.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
        res.setHeader("Access-Control-Max-Age", "3600");
        res.setHeader("Access-Control-Allow-Headers", "x-requested-with");
        res.setHeader("Access-Control-Allow-Credentials", "true");
        chain.doFilter(request, response);
    }

    public void destroy() {}

}

package com.awesometickets.config;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse;

/**
 * Cross-Origin Resource Sharing filter.
 */
public class CORSFilter implements Filter {

    public void init(FilterConfig filterConfig) throws ServletException {}

    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
        throws IOException, ServletException {
        HttpServletResponse res = (HttpServletResponse)response;
        res.setHeader("Access-Control-Allow-Origin", "http://119.29.152.169");
        res.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
        res.setHeader("Access-Control-Max-Age", "3600");
        res.setHeader("Access-Control-Allow-Headers", "x-requested-with");
        res.setHeader("Access-Control-Allow-Credentials", "true");
        chain.doFilter(request, response);
    }

    public void destroy() {}

}

Update CORS: fix cross-source cookie


package br.com.bloder.blorm;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import br.com.bloder.blormlib.Blorm;
import br.com.bloder.blormlib.validation.Action;

import static br.com.bloder.blormlib.validation.Validations.*;

public class MainActivity extends AppCompatActivity {

  private EditText editTextFilled;
  private Button submit;

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

    editTextFilled = (EditText) findViewById(R.id.edit_text_filled);
    submit = (Button) findViewById(R.id.submit);

    editTextFilled.setText("Hello");

      new Blorm.Builder()
              .field(editTextFilled).is(filled)
              .onSuccess(new Action() {
          @Override
          public void call() { onSuccess();
          }})
              .submitOn(submit);
  }

  private void onSuccess() {
    editTextFilled.setError(null);
    Toast.makeText(this, "Success", Toast.LENGTH_SHORT).show();
  }
}

package br.com.bloder.blorm;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import br.com.bloder.blormlib.Blorm;
import br.com.bloder.blormlib.validation.Action;

import static br.com.bloder.blormlib.validation.Validations.*;

public class MainActivity extends AppCompatActivity {

  private EditText editTextFilled;
  private Button submit;

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

    editTextFilled = (EditText) findViewById(R.id.edit_text_filled);
    submit = (Button) findViewById(R.id.submit);

    editTextFilled.setText("Hello");

      new Blorm.Builder()
              .field(editTextFilled).is(filled)
              .onSuccess(new Action() {
          @Override
          public void call() { onSuccess();
          }})
              .onError(new Action() {
                @Override
                public void call() {
                  onError();
                }
              })
              .submitOn(submit);
  }

  private void onSuccess() {
    editTextFilled.setError(null);
    Toast.makeText(this, "Success", Toast.LENGTH_SHORT).show();
  }

  private void onError() {
    Toast.makeText(this, "Error", Toast.LENGTH_SHORT).show();
  }
}

Add onError example in main activity


package src;

public class Main {

    public static void main(String[] args) {

        if(args.length != 2)
            return;

        Tournament tournament = new Tournament(args[0], args[1]);

        return;
    }
}

package src;

public class Main {

    public static void main(String[] args) {

        if(args.length != 2)    // принимаем 3 аргумента - имя пользователя, игру и имя файла кода
            return;

        Tournament tournament = new Tournament(args[0], args[1], args[2]);

        int gameResult = tournament.Game();

        return;
    }
}

Add 1 argument - file name. When user load new source code, system can copy it anywhere and our program get this path.


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

/**
 * API for associating tags with scoped operations.
 *
 * <p>This package manages a set of tags in the {@code io.grpc.Context}. The tags can be used to
 * label anything that is associated with a specific operation. For example, the {@link
 * io.opencensus.stats} package labels all measurements with the current tags.
 *
 * <p>{@link io.opencensus.tags.Tag Tags} are key-value pairs. The {@link io.opencensus.tags.TagKey
 * keys} are wrapped {@code String}s, but the values can have multiple types, such as {@code
 * String}, {@code long}, and {@code boolean}. They are stored as a map in a {@link
 * io.opencensus.tags.TagContext}.
 */
// TODO(sebright): Add code examples after the API is updated to use a TagContext factory.
package io.opencensus.tags;

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

/**
 * API for associating tags with scoped operations.
 *
 * <p>This package manages a set of tags in the {@code io.grpc.Context}. The tags can be used to
 * label anything that is associated with a specific operation. For example, the {@code
 * io.opencensus.stats} package labels all measurements with the current tags.
 *
 * <p>{@link io.opencensus.tags.Tag Tags} are key-value pairs. The {@link io.opencensus.tags.TagKey
 * keys} are wrapped {@code String}s, but the values can have multiple types, such as {@code
 * String}, {@code long}, and {@code boolean}. They are stored as a map in a {@link
 * io.opencensus.tags.TagContext}.
 */
// TODO(sebright): Add code examples after the API is updated to use a TagContext factory.
package io.opencensus.tags;

Remove a Javadoc link from the 'tags' package to the 'stats' package.


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

import java.util.List;

import com.google.common.collect.ImmutableList;

public class Result<T> {

    private final ImmutableList<T> records;
    private final boolean moreAvailable;

    public Result(List<T> records, boolean moreAvailable) {
        this.records = ImmutableList.copyOf(records);
        this.moreAvailable = moreAvailable;
    }

    public List<T> records() {
        return records;
    }

    public boolean moreAvailable() {
        return moreAvailable;
    }

    public static <T extends /*@NonNull*/Object> Result<T> from(List<T> records, int limit) {
        if (limit == 0) {
            return new Result<T>(records, false);
        } else if (records.size() > limit) {
            return new Result<T>(records.subList(0, limit), true);
        } else {
            return new Result<T>(records, false);
        }
    }
}

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

import java.util.List;

import com.google.common.collect.ImmutableList;

public class Result<T extends /*@NonNull*/Object> {

    private final ImmutableList<T> records;
    private final boolean moreAvailable;

    public Result(List<T> records, boolean moreAvailable) {
        this.records = ImmutableList.copyOf(records);
        this.moreAvailable = moreAvailable;
    }

    public List<T> records() {
        return records;
    }

    public boolean moreAvailable() {
        return moreAvailable;
    }

    public static <T extends /*@NonNull*/Object> Result<T> from(List<T> records, int limit) {
        if (limit == 0) {
            return new Result<T>(records, false);
        } else if (records.size() > limit) {
            return new Result<T>(records.subList(0, limit), true);
        } else {
            return new Result<T>(records, false);
        }
    }
}

Fix travis build checker framework error


package com.saintsrobotics.frc;

import edu.wpi.first.wpilibj.Relay;

/**
 * The RobotMap is a mapping from the ports sensors and actuators are wired into
 * to a variable name. This provides flexibility changing wiring, makes checking
 * the wiring easier and significantly reduces the number of magic numbers
 * floating around.
 */
public class RobotMap {
    // Motors
    public static final int LEFT_MOTOR_1 = 1;
    public static final int LEFT_MOTOR_2 = 2;

    public static final int RIGHT_MOTOR_1 = 3;
    public static final int RIGHT_MOTOR_2 = 4;

    // Relays
    public static final int PICKUP_RELAY = 5;
    public static final Relay.Direction PICKUP_RELAY_DIRECTION = Relay.Direction.kBoth;

    public static final int SHOOTER_RELAY = 6;
    public static final Relay.Direction SHOOTER_RELAY_DIRECTION = Relay.Direction.kBoth;
}

package com.saintsrobotics.frc;

import edu.wpi.first.wpilibj.Relay;

/**
 * The RobotMap is a mapping from the ports sensors and actuators are wired into
 * to a variable name. This provides flexibility changing wiring, makes checking
 * the wiring easier and significantly reduces the number of magic numbers
 * floating around.
 */
public class RobotMap {
    // Motors
    public static final int LEFT_MOTOR_1 = 1;
    public static final int LEFT_MOTOR_2 = 2;

    public static final int RIGHT_MOTOR_1 = 3;
    public static final int RIGHT_MOTOR_2 = 4;

    // Relays
    public static final int PICKUP_RELAY = 1;
    public static final Relay.Direction PICKUP_RELAY_DIRECTION =
            Relay.Direction.kBoth;

    public static final int SHOOTER_RELAY = 2;
    public static final Relay.Direction SHOOTER_RELAY_DIRECTION =
            Relay.Direction.kBoth;

    public static final int GEAR_SHIFTER_RELAY = 3;
    public static final Relay.Direction GEAR_SHIFTER_RELAY_DIRECTION =
            Relay.Direction.kBoth;
}

Create relay for gear shifter, set relay values


package com.wkovacs64.mtorch;

import android.app.Application;
import android.os.Build;
import android.os.StrictMode;

import timber.log.Timber;

public final class CustomApplication extends Application {

    @Override
    public void onCreate() {
        if (BuildConfig.DEBUG) {
            // Initialize Timber logging library
            Timber.plant(new Timber.DebugTree());

            // Enable StrictMode for debug builds
            enabledStrictMode();
        }

        super.onCreate();
    }

    private void enabledStrictMode() {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
            StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
                    .detectAll()
                    .penaltyLog()
                    .penaltyDialog()
                    .build());
            StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
                    .detectAll()
                    .penaltyLog()
                    .build());
        }
    }
}

package com.wkovacs64.mtorch;

import android.app.Application;
import android.os.StrictMode;

import timber.log.Timber;

public final class CustomApplication extends Application {

    @Override
    public void onCreate() {
        if (BuildConfig.DEBUG) {
            // Initialize Timber logging library
            Timber.plant(new Timber.DebugTree());

            // Enable StrictMode for debug builds
            enabledStrictMode();
        }

        super.onCreate();
    }

    private void enabledStrictMode() {
        StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
                .detectAll()
                .penaltyLog()
                .penaltyDialog()
                .build());
        StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
                .detectAll()
                .penaltyLog()
                .build());
    }
}

Remove unnecessary Gingerbread check around strict mode


package fr.alecharp.picshare.resource;

import fr.alecharp.picshare.domain.Event;
import fr.alecharp.picshare.service.EventService;
import net.codestory.http.annotations.Get;
import net.codestory.http.templating.Model;
import net.codestory.http.templating.ModelAndView;

import javax.inject.Inject;
import java.util.Optional;

/**
 * @author Adrien Lecharpentier
 */
public class EventResource {
    private final EventService eventService;

    @Inject
    public EventResource(EventService eventService) {
        this.eventService = eventService;
    }

    @Get("/event/:id")
    public ModelAndView dashboard(String id) {
        Optional<Event> event = eventService.get(id);
        return event.isPresent() ?
                ModelAndView.of("event/display.html", "event", event.get()) :
                ModelAndView.of("404.html");
    }
}

package fr.alecharp.picshare.resource;

import fr.alecharp.picshare.domain.Event;
import fr.alecharp.picshare.service.EventService;
import fr.alecharp.picshare.service.PictureService;
import net.codestory.http.Response;
import net.codestory.http.annotations.Get;
import net.codestory.http.annotations.Prefix;
import net.codestory.http.templating.Model;
import net.codestory.http.templating.ModelAndView;

import javax.inject.Inject;
import java.io.IOException;
import java.nio.file.Files;
import java.util.Optional;

/**
 * @author Adrien Lecharpentier
 */
@Prefix("/event")
public class EventResource {
    private final EventService eventService;
    private final PictureService pictureService;

    @Inject
    public EventResource(EventService eventService, PictureService pictureService) {
        this.eventService = eventService;
        this.pictureService = pictureService;
    }

    @Get("/:id")
    public ModelAndView dashboard(String id) {
        Optional<Event> event = eventService.get(id);
        return event.isPresent() ?
                ModelAndView.of("event/display.html", "event", event.get()) :
                ModelAndView.of("404.html");
    }

    @Get("/:id/:picture")
    public void download(String id, String picture, Response resp) throws IOException {
        resp.setHeader("Content-Type", "application/octet-stream");
        Files.copy(pictureService.getPicture(id, picture), resp.outputStream());
    }
}

Create HTTP API to download the file


package org.hummingbirdlang.types.composite;

import org.hummingbirdlang.types.CompositeType;
import org.hummingbirdlang.types.Property;
import org.hummingbirdlang.types.PropertyNotFoundException;
import org.hummingbirdlang.types.Type;

/**
 * Disjoint union type (aka. sum type): it is composed of members A and B.
 * Eventually the union is discriminated into either A or B.
 */
public class SumType extends CompositeType {
  public final Type[] subTypes;

  public SumType(Type[] subTypes) {
    this.subTypes = subTypes;
  }

  @Override
  public Property getProperty(String name) throws PropertyNotFoundException {
    throw new PropertyNotFoundException("Not yet implemented");
  }
}

package org.hummingbirdlang.types.composite;

import org.hummingbirdlang.types.CompositeType;
import org.hummingbirdlang.types.Property;
import org.hummingbirdlang.types.PropertyNotFoundException;
import org.hummingbirdlang.types.Type;

/**
 * Disjoint union type (aka. sum type): it is composed of members A and B.
 * Eventually the union is discriminated into either A or B.
 */
public class SumType extends CompositeType {
  public final Type[] subTypes;

  public SumType(Type[] subTypes) {
    this.subTypes = subTypes;
  }

  @Override
  public Property getProperty(String name) throws PropertyNotFoundException {
    throw new PropertyNotFoundException("Not yet implemented");
  }

  @Override
  public String toString() {
    StringBuilder result = new StringBuilder();
    boolean bar = false;
    for (Type subType : this.subTypes) {
      if (bar) {
        result.append(" | ");
      } else {
        bar = true;
      }
      result.append(subType.toString());
    }
    return result.toString();
  }
}

Improve debug `toString` for sum type


package pl.tomaszdziurko.jvm_bloggers;

public class TimeConstants {

    public static final String FIVE_MINUTES_AFTER_EACH_HOUR = "0 5 * * * *";
    public static final String TEN_MINUTES_AFTER_EACH_HOUR = "0 10 * * * *";

    public static final String EVERY_FRIDAY_AT_12_OCLOCK = "0 0 13 * * FRI";

}

package pl.tomaszdziurko.jvm_bloggers;

public class TimeConstants {

    public static final String FIVE_MINUTES_AFTER_EACH_HOUR = "0 5 * * * *";
    public static final String TEN_MINUTES_AFTER_EACH_HOUR = "0 10 * * * *";

    public static final String EVERY_FRIDAY_AT_12_OCLOCK = "0 0 12 * * FRI";

}

Return time when newsletter is sent to the original 12am


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.stuy.commands;

/**
 * Shoots from key at 2 point hoop
 * @author admin
 */
import edu.stuy.subsystems.Flywheel;
import edu.wpi.first.wpilibj.command.CommandGroup;

public class AutonSetting6 extends CommandGroup {
    public AutonSetting6 () {
        double distanceInches = Flywheel.distances[Flywheel.KEY_MIDDLE_HOOP_INDEX];
        addParallel(new FlywheelRun(distanceInches, Flywheel.speedsTopHoop));
        addSequential(new ConveyAutomatic(Autonomous.CONVEY_AUTO_TIME));
    }
}

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.stuy.commands;

/**
 * Shoots from key at 2 point hoop
 * @author admin
 */
import edu.stuy.subsystems.Flywheel;
import edu.wpi.first.wpilibj.command.CommandGroup;

public class AutonSetting6 extends CommandGroup {
    public AutonSetting6 () {
        double distanceInches = Flywheel.distances[Flywheel.KEY_MIDDLE_HOOP_INDEX];
        addParallel(new FlywheelRun(distanceInches, Flywheel.speedsMiddleHoop));
        addSequential(new ConveyAutomatic(Autonomous.CONVEY_AUTO_TIME));
    }
}

Make AutonSettin6 use middle hoop to match is intended purpose


package com.kogimobile.android.baselibrary.navigation;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;

public class FragmentNavigator {

    public static void navigateTo(FragmentManager manager, Fragment fragment, int containerId){
        navigateTo(
                manager,
                fragment,
                containerId,
                fragment.getClass().getSimpleName(),
                false,
                false
        );
    }

    public static void navigateTo(FragmentManager manager, Fragment fragment, int containerId,boolean addToBackStack){
        navigateTo(
                manager,
                fragment,
                containerId,
                fragment.getClass().getSimpleName(),
                addToBackStack,
                false
        );
    }

    public static void navigateTo(FragmentManager manager,
                                  Fragment fragment,
                                  int containerId,
                                  String fragmentTag,
                                  boolean addToBackStack,
                                  boolean allowCommitStateLoss){
        FragmentTransaction ft = manager.beginTransaction();
        ft.addToBackStack(fragmentTag);
        ft.replace(containerId, fragment,fragmentTag);
        if(allowCommitStateLoss){
            ft.commitAllowingStateLoss();
        }
        else {
            ft.commit();
        }
        if(addToBackStack) {

        }
    }

    public static void cleanFragmentStack(FragmentManager fm) {
        fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
    }

}

package com.kogimobile.android.baselibrary.navigation;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;

public class FragmentNavigator {

    public static void navigateTo(FragmentManager manager, Fragment fragment, int containerId){
        navigateTo(
                manager,
                fragment,
                containerId,
                fragment.getClass().getSimpleName(),
                false,
                false
        );
    }

    public static void navigateTo(FragmentManager manager, Fragment fragment, int containerId,boolean addToBackStack){
        navigateTo(
                manager,
                fragment,
                containerId,
                fragment.getClass().getSimpleName(),
                addToBackStack,
                false
        );
    }

    public static void navigateTo(FragmentManager manager,
                                  Fragment fragment,
                                  int containerId,
                                  String fragmentTag,
                                  boolean addToBackStack,
                                  boolean allowCommitStateLoss){
        FragmentTransaction ft = manager.beginTransaction();
        ft.replace(containerId, fragment,fragmentTag);

        if(addToBackStack) {
            ft.addToBackStack(fragmentTag);
        }

        if(allowCommitStateLoss){
            ft.commitAllowingStateLoss();
        }
        else {
            ft.commit();
        }
    }

    public static void cleanFragmentStack(FragmentManager fm) {
        fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
    }

}

Fix problem with fragment backstack


package pw.scho.battleship.model;

public class Position {

    private static String[] digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
    private final int x;
    private final int y;

    public Position(int x, int y) {
        this.x = x;
        this.y = y;
    }

    public int getX() {
        return x;
    }

    public int getY() {
        return y;
    }

    public String toString() {
        return digits[x] + String.valueOf(y + 1);
    }

    public double distanceTo(Position otherPosition) {
        return Math.sqrt(Math.pow(Math.abs(x - otherPosition.x), 2) + Math.pow(Math.abs(y - otherPosition.y), 2));
    }
}

package pw.scho.battleship.model;

public class Position {

    private static String[] digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
    private final int x;
    private final int y;

    public Position(int x, int y) {
        this.x = x;
        this.y = y;
    }

    public int getX() {
        return x;
    }

    public int getY() {
        return y;
    }

    public String toString() {
        return digits[x] + String.valueOf(y + 1);
    }

    public double distanceTo(Position otherPosition) {
        return Math.sqrt(Math.pow(x - otherPosition.x, 2) + Math.pow(y - otherPosition.y, 2));
    }
}

Remove unnecessary Math.abs from distance calculation


/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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.commonwl.viewer.domain;

/**
 * Represents the submission form on the main page to create a new workflow
 * Currently just contains a github URL
 */
public class WorkflowForm {

    public WorkflowForm() {}

    public WorkflowForm(String githubURL) {
        this.githubURL = githubURL;
    }

    private String githubURL;

    public String getGithubURL() {
        return githubURL;
    }

    public void setGithubURL(String githubURL) {
        this.githubURL = githubURL;
    }
}

/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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.commonwl.viewer.domain;

/**
 * Represents the submission form on the main page to create a new workflow
 * Currently just contains a github URL
 */
public class WorkflowForm {

    private String githubURL;

    public WorkflowForm() {}

    public WorkflowForm(String githubURL) {
        if (githubURL != null) {
            this.githubURL = trimTrailingSlashes(githubURL);
        }
    }

    public String getGithubURL() {
        return githubURL;
    }

    public void setGithubURL(String githubURL) {
        if (githubURL != null) {
            this.githubURL = trimTrailingSlashes(githubURL);
        }
    }

    /**
     * Cuts any trailing slashes off a string
     * @param url The string to cut the slashes off
     * @return The same string without trailing slashes
     */
    private String trimTrailingSlashes(String url) {
        return url.replaceAll("\\/+$", "");
    }
}

Remove trailing slashes from submitted URLs


package uk.ac.ebi.quickgo.annotation.download.converter.helpers;

import java.util.List;
import java.util.Objects;
import java.util.function.Function;

/**
 * A holder for general helper code.
 *
 * @author Tony Wardell
 * Date: 09/04/2018
 * Time: 15:02
 * Created with IntelliJ IDEA.
 */
public class Helper {
    private Helper() {}

    public static final Function<String, String> nullToEmptyString = s -> s == null ? "" : s;

    public static String nullToEmptyString(String reference){
        return Objects.nonNull(reference) ? reference : "";
    }

    public static String nullOrEmptyListToEmptyString(List reference, Function<List, String> mapper){
        return Objects.nonNull(reference) || !reference.isEmpty() ? mapper.apply(reference) : "";
    }

}

package uk.ac.ebi.quickgo.annotation.download.converter.helpers;

import java.util.Objects;

/**
 * A holder for general helper code.
 *
 * @author Tony Wardell
 * Date: 09/04/2018
 * Time: 15:02
 * Created with IntelliJ IDEA.
 */
public class Helper {
    private Helper() {}

    /**
     * Return the reference if it is no null or empty, otherwise return an empty string.
     * @param reference a string value.
     * @return the reference or empty string.
     */
    public static String nullToEmptyString(String reference){
        return Objects.nonNull(reference) ? reference : "";
    }
}

Remove functional version of nullToEmptyString, add javadoc.


package io.quarkus.flyway.runtime.graal;

import java.nio.charset.Charset;
import java.util.Collection;

import org.flywaydb.core.api.Location;
import org.flywaydb.core.internal.scanner.LocationScannerCache;
import org.flywaydb.core.internal.scanner.ResourceNameCache;

import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;

/**
 * Needed to get rid of some Android related classes
 */
@TargetClass(className = "org.flywaydb.core.internal.scanner.Scanner")
public final class ScannerSubstitutions {

    @Substitute
    public ScannerSubstitutions(Class<?> implementedInterface, Collection<Location> locations, ClassLoader classLoader,
            Charset encoding,
            boolean stream,
            ResourceNameCache resourceNameCache, LocationScannerCache locationScannerCache) {
        throw new IllegalStateException("'org.flywaydb.core.internal.scanner.Scanner' is never used in Quarkus");
    }
}

package io.quarkus.flyway.runtime.graal;

import java.nio.charset.Charset;
import java.util.Collection;

import org.flywaydb.core.api.Location;
import org.flywaydb.core.internal.scanner.LocationScannerCache;
import org.flywaydb.core.internal.scanner.ResourceNameCache;

import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;

/**
 * Needed to get rid of some Android related classes
 */
@TargetClass(className = "org.flywaydb.core.internal.scanner.Scanner")
public final class ScannerSubstitutions {

    @Substitute
    public ScannerSubstitutions(Class<?> implementedInterface, Collection<Location> locations, ClassLoader classLoader,
            Charset encoding,
            boolean detectEncoding,
            boolean stream,
            ResourceNameCache resourceNameCache, LocationScannerCache locationScannerCache,
            boolean throwOnMissingLocations) {
        throw new IllegalStateException("'org.flywaydb.core.internal.scanner.Scanner' is never used in Quarkus");
    }
}

Fix Scanner constructor substitution for Flyway 7.9.0


package scala.tools.eclipse;

import scala.tools.eclipse.lexical.ScalaDocumentPartitionerTest;
import scala.tools.eclipse.lexical.ScalaPartitionTokeniserTest;
import scala.tools.eclipse.ui.TestScalaIndenter;
import scala.tools.eclipse.wizards.*;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;

/**
 * To run this class DO NOT FORGET to set the config.ini in the  "configuration" tab.
 * @author ratiu
 */
@RunWith(Suite.class)
@Suite.SuiteClasses({
  ScalaDocumentPartitionerTest.class,
  ScalaPartitionTokeniserTest.class,
  TestScalaIndenter.class,
  ImportSupportTest.class,
  QualifiedNameSupportTest.class
})
class TestsSuite { }

package scala.tools.eclipse;

import scala.tools.eclipse.lexical.ScalaDocumentPartitionerTest;
import scala.tools.eclipse.lexical.ScalaPartitionTokeniserTest;
import scala.tools.eclipse.ui.TestScalaIndenter;
import scala.tools.eclipse.wizards.*;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;

/**
 * To run this class DO NOT FORGET to set the config.ini in the  "configuration" tab.
 * @author ratiu
 */
@RunWith(Suite.class)
@Suite.SuiteClasses({
  ScalaDocumentPartitionerTest.class,
  ScalaPartitionTokeniserTest.class,
  ImportSupportTest.class,
  QualifiedNameSupportTest.class
})
class TestsSuite { }

Remove UI test from the default test suite (Jenkins runs headless).


package org.kohsuke.github;

/**
 * Hook event type.
 *
 * See http://developer.github.com/v3/events/types/
 *
 * @author Kohsuke Kawaguchi
 */
public enum GHEvent {
    COMMIT_COMMENT,
    CREATE,
    DELETE,
    DOWNLOAD,
    FOLLOW,
    FORK,
    FORK_APPLY,
    GIST,
    GOLLUM,
    ISSUE_COMMENT,
    ISSUES,
    MEMBER,
    PUBLIC,
    PULL_REQUEST,
    PUSH,
    TEAM_ADD,
    WATCH
}

package org.kohsuke.github;

/**
 * Hook event type.
 *
 * See http://developer.github.com/v3/events/types/
 *
 * @author Kohsuke Kawaguchi
 */
public enum GHEvent {
    COMMIT_COMMENT,
    CREATE,
    DELETE,
    DOWNLOAD,
    FOLLOW,
    FORK,
    FORK_APPLY,
    GIST,
    GOLLUM,
    ISSUE_COMMENT,
    ISSUES,
    MEMBER,
    PUBLIC,
    PULL_REQUEST,
    PULL_REQUEST_REVIEW_COMMENT,
    PUSH,
    TEAM_ADD,
    WATCH
}

Add support for PULL_REQUEST_REVIEW_COMMENT event types.


package sg.ncl.adapter.deterlab.dtos.entities;

import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

/**
 * Created by Tran Ly Vu on 10/3/2016.
 */

public class DeterLabProjectEntityTest {
    private DeterLabProjectEntity deterLabUserEntity;

    @Before
    public void setup(){
        deterLabUserEntity=new DeterLabProjectEntity();
    }

    @Test
    public void getterAndSetterTest(){
        deterLabUserEntity.setId("test1");
        deterLabUserEntity.setNclTeamId("test2");
        deterLabUserEntity.setDeterProjectId("test3");

        String actual1=deterLabUserEntity.getId();
        String actual2=deterLabUserEntity.getNclTeamId();
        String actual3=deterLabUserEntity.getDeterProjectId();

        assertEquals("test1",actual1);
        assertEquals("test2",actual2);
        assertEquals("test3",actual3);
    }

}

package sg.ncl.adapter.deterlab.dtos.entities;

import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.assertj.core.api.Assertions.assertThat;

/**
 * Created by Tran Ly Vu on 10/3/2016.
 */

public class DeterLabProjectEntityTest {
    private DeterLabProjectEntity deterLabUserEntity;

    @Before
    public void setup(){
        deterLabUserEntity=new DeterLabProjectEntity();
    }

    @Test
    public void getterAndSetterTest(){
        deterLabUserEntity.setId("test1");
        deterLabUserEntity.setNclTeamId("test2");
        deterLabUserEntity.setDeterProjectId("test3");

        String actual1=deterLabUserEntity.getId();
        String actual2=deterLabUserEntity.getNclTeamId();
        String actual3=deterLabUserEntity.getDeterProjectId();

        assertThat(actual1).isNotNull();
        assertThat(actual2).isNotNull();
        assertThat(actual3).isNotNull();

        assertEquals("test1",actual1);
        assertEquals("test2",actual2);
        assertEquals("test3",actual3);
    }

}

Update test for DeterLabProjectEntity in adapter-deterlab


/*
 * Copyright 2016 Martijn van der Woud - The Crimson Cricket Internet Services
 *
 *    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.crimsoncricket.ddd.domain.model;

import javax.persistence.MappedSuperclass;
import javax.persistence.Version;

@MappedSuperclass
public class AggregateRoot<I extends Id> extends Entity<I> {

    @Version
    private Integer version;

    protected AggregateRoot() {}

    public AggregateRoot(I id) {
        super(id);
    }

    public Integer version() {
        return version;
    }

    protected void ensureVersionIs(int expectedVersion) throws OutdatedEntityVersionException {
        if (version != expectedVersion)
            throw new OutdatedEntityVersionException(
                    "Attempted to executed a command on an outdated entity of type " + this.getClass().getSimpleName(),
                    expectedVersion,
                    version);

    }

}

/*
 * Copyright 2016 Martijn van der Woud - The Crimson Cricket Internet Services
 *
 *    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.crimsoncricket.ddd.domain.model;

import javax.persistence.MappedSuperclass;
import javax.persistence.Version;

@MappedSuperclass
public class AggregateRoot<I extends Id> extends Entity<I> {

    @Version
    private Integer version;

    protected AggregateRoot() {}

    public AggregateRoot(I id) {
        super(id);
    }

    public Integer version() {
        return version;
    }

    protected void ensureVersionIs(int expectedVersion) throws OutdatedEntityVersionException {
        if (version != expectedVersion)
            throw new OutdatedEntityVersionException(
                    "Attempted to execute a command on an outdated entity of type " + this.getClass().getSimpleName(),
                    expectedVersion,
                    version);

    }

}

Fix typo in error message


package com.edinarobotics.zeke.commands;

import edu.wpi.first.wpilibj.command.CommandGroup;
import edu.wpi.first.wpilibj.command.WaitCommand;

public class AutonomousCommand extends CommandGroup {

    public AutonomousCommand(boolean twoBallAuto) {
        if (twoBallAuto) {
            this.addSequential(new ShootingSequenceCommand(true));
            this.addSequential(new RunCollectorCommand(2.0, true));
            this.addSequential(new ShootingSequenceCommand(false));
            this.addParallel(new LowerShooterAfterWaitCommand(1.5));
            this.addSequential(new WaitCommand(0.5));
            this.addSequential(new DriveXTimeCommand(3.5, 0.35));
        } else {
            this.addSequential(new ShootingSequenceCommand(false));
            this.addParallel(new LowerShooterAfterWaitCommand(1.5));
            this.addSequential(new WaitCommand(0.5));
            this.addSequential(new DriveXTimeCommand(3.5, 0.35));
        }
    }
}

package com.edinarobotics.zeke.commands;

import edu.wpi.first.wpilibj.command.CommandGroup;
import edu.wpi.first.wpilibj.command.WaitCommand;

public class AutonomousCommand extends CommandGroup {

    public AutonomousCommand(boolean twoBallAuto) {
        if (twoBallAuto) {
            CommandGroup driveSubsequence = new CommandGroup();
            driveSubsequence.addSequential(new WaitCommand(0.75));
            driveSubsequence.addSequential(new DriveXTimeCommand(0.5, 0.35));

            this.addSequential(new ShootingSequenceCommand(false));
            this.addParallel(new LowerShooterAfterWaitCommand(1.5));
            this.addParallel(driveSubsequence);
            this.addSequential(new RunCollectorCommand(3.5, true));
            this.addSequential(new ShootingSequenceCommand(false));
            this.addParallel(new LowerShooterAfterWaitCommand(1.5));
            this.addSequential(new WaitCommand(0.5));
            this.addSequential(new DriveXTimeCommand(3.5, 0.35));
        } else {
            this.addSequential(new ShootingSequenceCommand(false));
            this.addParallel(new LowerShooterAfterWaitCommand(1.5));
            this.addSequential(new WaitCommand(0.5));
            this.addSequential(new DriveXTimeCommand(3.5, 0.35));
        }
    }
}

Change two ball autonomous to drive forward while collection.


package com.github.cstroe.svndumpgui.internal;

import com.github.cstroe.svndumpgui.api.SvnNode;

public class SvnNodeImpl implements SvnNode {
    private String path;
    private String kind;
    private String Action;
    private String md5;
    private String sha1;
    private String content;

    @Override
    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    @Override
    public String getKind() {
        return kind;
    }

    public void setKind(String kind) {
        this.kind = kind;
    }

    @Override
    public String getAction() {
        return Action;
    }

    public void setAction(String action) {
        Action = action;
    }

    @Override
    public String getMd5() {
        return md5;
    }

    public void setMd5(String md5) {
        this.md5 = md5;
    }

    @Override
    public String getSha1() {
        return sha1;
    }

    public void setSha1(String sha1) {
        this.sha1 = sha1;
    }

    @Override
    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }
}

package com.github.cstroe.svndumpgui.internal;

import com.github.cstroe.svndumpgui.api.SvnNode;

public class SvnNodeImpl implements SvnNode {
    private String path;
    private String kind;
    private String action;
    private String md5;
    private String sha1;
    private String content;

    @Override
    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    @Override
    public String getKind() {
        return kind;
    }

    public void setKind(String kind) {
        this.kind = kind;
    }

    @Override
    public String getAction() {
        return action;
    }

    public void setAction(String action) {
        this.action = action;
    }

    @Override
    public String getMd5() {
        return md5;
    }

    public void setMd5(String md5) {
        this.md5 = md5;
    }

    @Override
    public String getSha1() {
        return sha1;
    }

    public void setSha1(String sha1) {
        this.sha1 = sha1;
    }

    @Override
    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    @Override
    public String toString() {
        return String.valueOf(action) + " " + String.valueOf(kind) + " " + String.valueOf(path);
    }
}

Make it easier to see information in the debugger.