/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2016 Vincent Zhang/PhoenixLAB
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

package co.phoenixlab.discord.api.request;

import co.phoenixlab.discord.api.entities.PresenceGame;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Builder;

@Builder
@Getter
@NoArgsConstructor
@AllArgsConstructor
public class UpdateStatusRequest {

    private PresenceGame game;
    private long idleSince;

}

/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2016 Vincent Zhang/PhoenixLAB
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

package co.phoenixlab.discord.api.request;

import co.phoenixlab.discord.api.entities.PresenceGame;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Builder;

@Builder
@Getter
@NoArgsConstructor
@AllArgsConstructor
public class UpdateStatusRequest {

    private PresenceGame game;
    private Long idleSince;

}

Switch to obj long for nullable field


package domain;

public class Contact {

	private long id;
	private String firstName;
	private String lastName;
	private String email;

	/**
	 * @return Email
	 */
	public String getEmail() {
	    return email;
	}

	/**
	 * @return First Name
	 */
	public String getFirstName() {
	  return firstName;
	}

	/**
     * @return Last name
     */
    public String getLastName() {
    	return lastName;
    }

    /**
     * @param string Sets the Email
     */
    public void setEmail(String string) {
    	email = string;
    }

    /**
     * @param string Sets the First Name
     */
    public void setFirstName(String string) {
    	firstName = string;
    }

    /**
     * @param string sets the Last Name
     */
    public void setLastName(String string) {
    	lastName = string;
    }

    /**
     * @return ID Returns ID
     */
    public long getId() {
    	return id;
    }

    /**
     * @param l Sets the ID
     */
    public void setId(long l) {
    	id = l;
    }
}

package domain;

import java.util.Set;

public class Contact {

	private long id;
	private String firstName;
	private String lastName;
	private String email;
	private Set<PhoneNumber> phones;
	private Address address;

	public Contact() {
		// TODO Auto-generated constructor stub
	}

	public Contact(long id, String firstName, String lastName, String email,
			Set<PhoneNumber> phones, Address address) {
		this.id = id;
		this.firstName = firstName;
		this.lastName = lastName;
		this.email = email;
		this.phones = phones;
		this.address = address;
	}

	public String getFullName() {
		return String.format("%s %s", firstName, lastName);
	}

	/**
	 * @return Email
	 */
	public String getEmail() {
	    return email;
	}

	/**
	 * @return First Name
	 */
	public String getFirstName() {
	  return firstName;
	}

	/**
     * @return Last name
     */
    public String getLastName() {
    	return lastName;
    }

    /**
     * @param string Sets the Email
     */
    public void setEmail(String string) {
    	email = string;
    }

    /**
     * @param string Sets the First Name
     */
    public void setFirstName(String string) {
    	firstName = string;
    }

    /**
     * @param string sets the Last Name
     */
    public void setLastName(String string) {
    	lastName = string;
    }

    /**
     * @return ID Returns ID
     */
    public long getId() {
    	return id;
    }

    /**
     * @param l Sets the ID
     */
    public void setId(long l) {
    	id = l;
    }
}

Add defautl constructor and getFullName method


/*
 * Copyright 2015 Michael Rozumyanskiy
 *
 * 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.michaelrocks.lightsaber.processor;

import com.beust.jcommander.Parameter;

public class LightsaberParameters {
    @Parameter(names = "--jar", description = "Jar file to process")
    public String jar;

    @Parameter(names = "--classes", description = "Classes directory to process")
    public String classes;

    @Parameter(names = "--stacktrace", description = "Print stack traces")
    public boolean printStacktrace = false;
}

/*
 * Copyright 2015 Michael Rozumyanskiy
 *
 * 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.michaelrocks.lightsaber.processor;

import com.beust.jcommander.Parameter;

public class LightsaberParameters {
    @Parameter(names = "--jar", description = "Jar file to process")
    public String jar;

    @Parameter(names = "--classes", description = "Classes directory to process")
    public String classes;

    @Parameter(names = { "-v", "--verbose" }, description = "Use verbose output")
    public boolean verbose = false;

    @Parameter(names = "--stacktrace", description = "Print stack traces")
    public boolean printStacktrace = false;
}

Add verbose flag to processor parameters


package seedu.address.storage;

import java.io.File;
import java.io.FileNotFoundException;

import javax.xml.bind.JAXBException;

import seedu.address.commons.exceptions.DataConversionException;
import seedu.address.commons.util.XmlUtil;

/**
 * Stores taskmanager data in an XML file
 */
public class XmlFileStorage {
    /**
     * Saves the given taskmanager data to the specified file.
     */
    public static void saveDataToFile(File file, XmlSerializableTaskManager addressBook)
            throws FileNotFoundException {
        try {
            XmlUtil.saveDataToFile(file, addressBook);
        } catch (JAXBException e) {
            assert false : "Unexpected exception " + e.getMessage();
        }
    }

    /**
     * Returns task manager in the file or an empty task manager
     */
    public static XmlSerializableTaskManager loadDataFromSaveFile(File file) throws DataConversionException,
                                                                            FileNotFoundException {
        try {
            return XmlUtil.getDataFromFile(file, XmlSerializableTaskManager.class);
        } catch (JAXBException e) {
            throw new DataConversionException(e);
        }
    }

}

package seedu.address.storage;

import java.io.File;
import java.io.FileNotFoundException;

import javax.xml.bind.JAXBException;

import seedu.address.commons.exceptions.DataConversionException;
import seedu.address.commons.util.XmlUtil;

/**
 * Stores taskmanager data in an XML file
 */
public class XmlFileStorage {
    /**
     * Saves the given taskmanager data to the specified file.
     */
    public static void saveDataToFile(File file, XmlSerializableTaskManager taskManager)
            throws FileNotFoundException {
        try {
            XmlUtil.saveDataToFile(file, taskManager);
        } catch (JAXBException e) {
            assert false : "Unexpected exception " + e.getMessage();
        }
    }

    /**
     * Returns task manager in the file or an empty task manager
     */
    public static XmlSerializableTaskManager loadDataFromSaveFile(File file) throws DataConversionException,
                                                                            FileNotFoundException {
        try {
            return XmlUtil.getDataFromFile(file, XmlSerializableTaskManager.class);
        } catch (JAXBException e) {
            throw new DataConversionException(e);
        }
    }

}

Rename Address Book to Task Manager


package utask.model.task;

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

import org.junit.Test;

public class DeadlineTest {

    @Test
    public void isValidDeadline() {
        // invalid Deadline
        assertFalse(Deadline.isValidDeadline("")); // empty string
        assertFalse(Deadline.isValidDeadline(" ")); // spaces only
        assertFalse(Deadline.isValidDeadline("jan")); // non-numeric
        assertFalse(Deadline.isValidDeadline("13jan17")); // alphabets within digits
        assertFalse(Deadline.isValidDeadline("13 01 17")); // spaces within digits
        assertFalse(Deadline.isValidDeadline("310417")); // no 31st day in April
        // valid phone numbers
        assertTrue(Deadline.isValidDeadline("300406"));  // support backdated
        assertTrue(Deadline.isValidDeadline("130117"));
        assertTrue(Deadline.isValidDeadline("090820"));
    }
}

package utask.model.task;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import org.junit.Test;

import utask.commons.exceptions.IllegalValueException;

public class DeadlineTest {

    @Test
    public void isValidDeadline() {
        // invalid Deadline
        assertFalse(Deadline.isValidDeadline("")); // empty string
        assertFalse(Deadline.isValidDeadline(" ")); // spaces only
        assertFalse(Deadline.isValidDeadline("jan")); // non-numeric
        assertFalse(Deadline.isValidDeadline("13jan17")); // alphabets within digits
        assertFalse(Deadline.isValidDeadline("13 01 17")); // spaces within digits
        assertFalse(Deadline.isValidDeadline("310417")); // no 31st day in April
        // valid phone numbers
        assertTrue(Deadline.isValidDeadline("300406"));  // support backdated
        assertTrue(Deadline.isValidDeadline("130117"));
        assertTrue(Deadline.isValidDeadline("090820"));
    }

    @Test
    public void testConstructor() {
        Deadline d;
        try {
            d = new Deadline("-"); // constructor with dash only
            assertEquals(d, null);

            d = Deadline.getEmptyDeadline(); // empty constructor
            assertEquals(d, null);

            assertEquals(d.toString(), ""); //checking toString() value when Deadline is Null
            assertEquals(d.hashCode(), "".hashCode()); //checking hashCode when Deadline is Null
        } catch (IllegalValueException e) {
            e.printStackTrace();
        }

    }
}

Add more test cases for Deadline


import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        printTitle();
        titleWait();
        System.out.println("You wake up on a beach.");
    }

    private static void printTitle() {
        String banner = "___________      .__     ___________              __   \n" +
                "\\_   _____/_____ |__| ___\\__    ___/___ ___  ____/  |_ \n" +
                " |    __)_\\____ \\|  |/ ___\\|    |_/ __ \\\\  \\/  /\\   __\\\n" +
                " |        \\  |_> >  \\  \\___|    |\\  ___/ >    <  |  |  \n" +
                "/_______  /   __/|__|\\___  >____| \\___  >__/\\_ \\ |__|  \n" +
                "        \\/|__|           \\/           \\/      \\/       ";
        System.out.println(banner);
    }

    private static void titleWait() {
        System.out.println("Press \"ENTER\" to continue...");
        Scanner scanner = new Scanner(System.in);
        scanner.nextLine();
        clearScreen();
    }

    private static void clearScreen() {

    }
}

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        printTitle();
        titleWait();
        System.out.println("You wake up on a beach.");
    }

    private static void printTitle() {
        String banner = "___________      .__     ___________              __   \n" +
                "\\_   _____/_____ |__| ___\\__    ___/___ ___  ____/  |_ \n" +
                " |    __)_\\____ \\|  |/ ___\\|    |_/ __ \\\\  \\/  /\\   __\\\n" +
                " |        \\  |_> >  \\  \\___|    |\\  ___/ >    <  |  |  \n" +
                "/_______  /   __/|__|\\___  >____| \\___  >__/\\_ \\ |__|  \n" +
                "        \\/|__|           \\/           \\/      \\/       ";
        System.out.println(banner);
    }

    private static void titleWait() {
        System.out.println("Press \"ENTER\" to continue...");
        Scanner scanner = new Scanner(System.in);
        scanner.nextLine();
        clearScreen();
    }

    private static void clearScreen() {
        System.out.println("\n\n\n\n\n\n\n\n\n\n");
    }
}

Add new line print to clearScreen()


/*
 * 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.apache.hadoop.hbase.client;

import static org.apache.hadoop.hbase.HConstants.CLIENT_CONNECTION_REGISTRY_IMPL_CONF_KEY;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.util.ReflectionUtils;
import org.apache.yetus.audience.InterfaceAudience;

/**
 * Factory class to get the instance of configured connection registry.
 */
@InterfaceAudience.Private
final class ConnectionRegistryFactory {

  private ConnectionRegistryFactory() {
  }

  /**
   * @return The connection registry implementation to use.
   */
  static ConnectionRegistry getRegistry(Configuration conf) {
    Class<? extends ConnectionRegistry> clazz = conf.getClass(
        CLIENT_CONNECTION_REGISTRY_IMPL_CONF_KEY, MasterRegistry.class,
        ConnectionRegistry.class);
    return ReflectionUtils.newInstance(clazz, conf);
  }
}

/*
 * 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.apache.hadoop.hbase.client;

import static org.apache.hadoop.hbase.HConstants.CLIENT_CONNECTION_REGISTRY_IMPL_CONF_KEY;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.util.ReflectionUtils;
import org.apache.yetus.audience.InterfaceAudience;

/**
 * Factory class to get the instance of configured connection registry.
 */
@InterfaceAudience.Private
final class ConnectionRegistryFactory {

  private ConnectionRegistryFactory() {
  }

  /**
   * @return The connection registry implementation to use.
   */
  static ConnectionRegistry getRegistry(Configuration conf) {
    Class<? extends ConnectionRegistry> clazz = conf.getClass(
        CLIENT_CONNECTION_REGISTRY_IMPL_CONF_KEY, ZKConnectionRegistry.class,
        ConnectionRegistry.class);
    return ReflectionUtils.newInstance(clazz, conf);
  }
}

Switch the default registry to ZK based


package org.qfox.jestful.client.nio.timeout;

import java.net.SocketTimeoutException;
import java.nio.channels.SelectionKey;

/**
 * Created by yangchangpei on 17/3/27.
 */
public abstract class TimeoutHandler implements Comparable<TimeoutHandler> {
    protected final SelectionKey key;
    protected final long timeInvalid;

    protected TimeoutHandler(SelectionKey key, long timeout) {
        this.key = key;
        this.timeInvalid = System.currentTimeMillis() + timeout;
    }

    public boolean isInvalid(long time) {
        return time > timeInvalid;
    }

    protected SocketTimeoutException wrapSocketTimeoutException() {
        return wrapSocketTimeoutException(null);
    }

    protected SocketTimeoutException wrapSocketTimeoutException(String msg) {
        try {
            throw msg == null ? new SocketTimeoutException() : new SocketTimeoutException(msg);
        } catch (SocketTimeoutException ste) {
            return ste;
        }
    }

    public abstract void doInvalid();

    public SelectionKey getKey() {
        return key;
    }

    public long getTimeInvalid() {
        return timeInvalid;
    }

    @Override
    public int compareTo(TimeoutHandler o) {
        return timeInvalid < o.timeInvalid ? -1 : 1;
    }
}

package org.qfox.jestful.client.nio.timeout;

import java.net.SocketTimeoutException;
import java.nio.channels.SelectionKey;

/**
 * Created by yangchangpei on 17/3/27.
 */
public abstract class TimeoutHandler implements Comparable<TimeoutHandler> {
    protected final SelectionKey key;
    protected final long timeInvalid;

    protected TimeoutHandler(SelectionKey key, long timeout) {
        this.key = key;
        this.timeInvalid = System.currentTimeMillis() + timeout;
    }

    public boolean isInvalid(long time) {
        return time > timeInvalid;
    }

    protected SocketTimeoutException wrapSocketTimeoutException(String msg) {
        try {
            throw msg == null ? new SocketTimeoutException() : new SocketTimeoutException(msg);
        } catch (SocketTimeoutException ste) {
            return ste;
        }
    }

    public abstract void doInvalid();

    public SelectionKey getKey() {
        return key;
    }

    public long getTimeInvalid() {
        return timeInvalid;
    }

    @Override
    public int compareTo(TimeoutHandler o) {
        return timeInvalid < o.timeInvalid ? -1 : 1;
    }
}

Set Default Timeouts For NIO Builder While Creation


package org.jenkinsci.plugins.gitclient;

import java.util.ArrayList;
import java.util.List;
import java.util.logging.Handler;
import java.util.logging.LogRecord;

/**
 * Recording log handler to allow assertions on logging. Not intended for use
 * outside this package. Not intended for use outside tests.
 *
 * @author Mark Waite
 */
public class LogHandler extends Handler {

    private List<String> messages = new ArrayList<>();

    @Override
    public void publish(LogRecord lr) {
        messages.add(lr.getMessage());
    }

    @Override
    public void flush() {
    }

    @Override
    public void close() throws SecurityException {
        messages = new ArrayList<>();
    }

    /* package */ List<String> getMessages() {
        return messages;
    }

    /* package */ boolean containsMessageSubstring(String messageSubstring) {
        for (String message : messages) {
            if (message.indexOf(messageSubstring) >= 0) {
                return true;
            }
        }
        return false;
    }

    /* package */ List<Integer> getTimeouts() {
        List<Integer> timeouts = new ArrayList<>();
        for (String message : getMessages()) {
            int start = message.indexOf(CliGitAPIImpl.TIMEOUT_LOG_PREFIX);
            if (start >= 0) {
                String timeoutStr = message.substring(start + CliGitAPIImpl.TIMEOUT_LOG_PREFIX.length());
                timeouts.add(Integer.parseInt(timeoutStr));
            }
        }
        return timeouts;
    }
}

package org.jenkinsci.plugins.gitclient;

import java.util.ArrayList;
import java.util.List;
import java.util.logging.Handler;
import java.util.logging.LogRecord;

/**
 * Recording log handler to allow assertions on logging. Not intended for use
 * outside this package. Not intended for use outside tests.
 *
 * @author Mark Waite
 */
public class LogHandler extends Handler {

    private List<String> messages = new ArrayList<>();

    @Override
    public void publish(LogRecord lr) {
        messages.add(lr.getMessage());
    }

    @Override
    public void flush() {
    }

    @Override
    public void close() throws SecurityException {
        messages = new ArrayList<>();
    }

    /* package */ List<String> getMessages() {
        return messages;
    }

    /* package */ boolean containsMessageSubstring(String messageSubstring) {
        for (String message : messages) {
            if (message.contains(messageSubstring)) {
                return true;
            }
        }
        return false;
    }

    /* package */ List<Integer> getTimeouts() {
        List<Integer> timeouts = new ArrayList<>();
        for (String message : getMessages()) {
            int start = message.indexOf(CliGitAPIImpl.TIMEOUT_LOG_PREFIX);
            if (start >= 0) {
                String timeoutStr = message.substring(start + CliGitAPIImpl.TIMEOUT_LOG_PREFIX.length());
                timeouts.add(Integer.parseInt(timeoutStr));
            }
        }
        return timeouts;
    }
}

Use 'contains' instead of indexOf to find substrings


package com.growingwiththeweb.algorithms.interviewquestions.dividewithoutdivide;

public class Program {
    public static void main(String[] args) {
        assert divide(10,4) == 2;
        assert divide(11,4) == 2;
        assert divide(12,4) == 3;
        assert divide(13,4) == 3;
        assert divide(130,3) == 43;

        System.out.println("Tests passed");
    }

    public static double divide(double a, double b) {
        int sign = 1;
        if (a < 0) {
            a = -a;
            sign = -sign;
        }
        if (b < 0) {
            b = -b;
            sign = -sign;
        }
        double result = 0;
        while (a >= 0) {
            a -= b;
            result++;
        }
        return (result - 1) * sign;
    }
}

package com.growingwiththeweb.algorithms.interviewquestions.dividewithoutdivide;

import java.lang.ArithmeticException;

public class Program {
    public static void main(String[] args) {
        assert divide(10, 4) == 2;
        assert divide(11, 4) == 2;
        assert divide(12, 4) == 3;
        assert divide(13, 4) == 3;
        assert divide(130,3 ) == 43;

        boolean threw = false;
        try {
            divide(1, 0);
        } catch (ArithmeticException ex) {
            threw = true;
        }
        assert threw;

        System.out.println("Tests passed");
    }

    public static double divide(double a, double b) {
        if (b == 0) {
            throw new ArithmeticException(
                    "Division by 0 is undefined: " + a + "/" + b);
        }
        int sign = 1;
        if (a < 0) {
            a = -a;
            sign = -sign;
        }
        if (b < 0) {
            b = -b;
            sign = -sign;
        }
        double result = 0;
        while (a >= 0) {
            a -= b;
            result++;
        }
        return (result - 1) * sign;
    }
}

Add exception for division by zero


package org.hcjf.layers;

import java.lang.reflect.InvocationHandler;

/**
 * @author javaito
 *
 */
public interface LayerInterface extends InvocationHandler {

    /**
     * Return the layer implementation name.
     * @return Layer implementation name.
     */
    String getImplName();

    /**
     * Returns true if the layer is stateful or false in the otherwise.
     * @return Stateful
     */
    boolean isStateful();

    /**
     * Returns true if the layer is a plugin or false in the otherwise.
     * @return Plugin status.
     */
    boolean isPlugin();

}

package org.hcjf.layers;

import org.hcjf.layers.distributed.DistributedLayer;

import java.lang.reflect.InvocationHandler;

/**
 * @author javaito
 *
 */
public interface LayerInterface extends InvocationHandler {

    /**
     * Return the layer implementation name.
     * @return Layer implementation name.
     */
    String getImplName();

    /**
     * Returns true if the layer is stateful or false in the otherwise.
     * @return Stateful
     */
    boolean isStateful();

    /**
     * Returns true if the layer is a plugin or false in the otherwise.
     * @return Plugin status.
     */
    boolean isPlugin();

    /**
     * Returns true if the layer implementation is instance of {@link DistributedLayer}.
     * @return True if the layer implementation is instance of {@link DistributedLayer} and false in the otherwise.
     */
    default boolean isDistributed() {
        return this instanceof DistributedLayer;
    }

}

Add in the layer interface the capability of knows if the implementation is distributed or not.


package src;

import java.io.File;
import java.io.IOException;

import org.ini4j.Wini;

public class Tournament {
    String _userName;
    String _game;

    //много параметров, может, их в отдельный класс?
    String _fullPath;
    String _tempPath;
    String _tableCaption;
    String _judgePath;

    public Tournament(String userName, String game){
        _userName = _userName;
        _game = game;

        try {
            LoadIni();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    private void LoadIni() throws IOException {
        Wini ini = new Wini(new File("tournamentset.ini"));
        _fullPath = ini.get("Paths", "FullPath");
        _tempPath = ini.get("Paths", "TempPath");
        _tableCaption = ini.get("DBSettings", "TableCaption");
        _judgePath = ini.get("ExternalLinks", "JudgePath");
    }
}

package src;

import java.io.File;
import java.io.IOException;

import org.ini4j.Wini;

public class Tournament {
    String _userName;
    String _game;

    public Tournament(String userName, String game){
        _userName = _userName;
        _game = game;
    }
}

Remove old unnesessary code (load ini file). Now this operations is in FileWorker.


package config;

import android.content.Context;

import cl_toolkit.Logger;
import cl_toolkit.Storage;

/**
 * Run-time data
 * @author Chris Lewis
 */
public class Runtime {

	private static Logger getLogger(Context context) {
		return new Logger(Storage.getStorage() + "/" + Build.DEBUG_LOG_NAME, Build.DEBUG_LOG_MAX_SIZE_BYTES);
	}

    public static void log(Context context, String TAG, String message, String level) {
        getLogger(context).log(TAG, message, level);
    }

    public static void logStackTrace(Context context, Exception e) {
        getLogger(context).logStackTrace(e);
    }

    public static void startNewSession(Context context) {
        getLogger(context).startNewSession();
    }

}

package config;

import android.content.Context;

import cl_toolkit.Logger;
import cl_toolkit.Storage;

/**
 * Run-time data
 * @author Chris Lewis
 */
public class Runtime {

	private static Logger getLogger(Context context) {
		return new Logger(Storage.getAppStorage(context) + "/" + Build.DEBUG_LOG_NAME, Build.DEBUG_LOG_MAX_SIZE_BYTES);
	}

    public static void log(Context context, String TAG, String message, String level) {
        getLogger(context).log(TAG, message, level);
    }

    public static void logStackTrace(Context context, Exception e) {
        getLogger(context).logStackTrace(e);
    }

    public static void startNewSession(Context context) {
        getLogger(context).startNewSession();
    }

}

Write logs to Application Storage to avoid permission problem on Android 6+


package com.gentics.mesh.core.data.group;

import com.gentics.mesh.core.data.HibCoreElement;
import com.gentics.mesh.core.data.HibNamedElement;
import com.gentics.mesh.core.data.user.HibUserTracking;
import com.gentics.mesh.core.rest.group.GroupReference;

public interface HibGroup extends HibCoreElement, HibUserTracking, HibNamedElement {

	GroupReference transformToReference();

	void removeElement();

	String getElementVersion();

}

package com.gentics.mesh.core.data.group;

import static com.gentics.mesh.core.rest.MeshEvent.GROUP_CREATED;
import static com.gentics.mesh.core.rest.MeshEvent.GROUP_DELETED;
import static com.gentics.mesh.core.rest.MeshEvent.GROUP_UPDATED;

import com.gentics.mesh.ElementType;
import com.gentics.mesh.core.TypeInfo;
import com.gentics.mesh.core.data.HibCoreElement;
import com.gentics.mesh.core.data.HibNamedElement;
import com.gentics.mesh.core.data.user.HibUserTracking;
import com.gentics.mesh.core.rest.group.GroupReference;

public interface HibGroup extends HibCoreElement, HibUserTracking, HibNamedElement {

	TypeInfo TYPE_INFO = new TypeInfo(ElementType.GROUP, GROUP_CREATED, GROUP_UPDATED, GROUP_DELETED);

	@Override
	default TypeInfo getTypeInfo() {
		return TYPE_INFO;
	}

	GroupReference transformToReference();

	void removeElement();

	String getElementVersion();

}

Move group type info to interface


// Copyright 2014, Kevin Ko <kevin@faveset.com>

package com.faveset.khttp;

import java.nio.channels.Selector;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.Executor;

/**
 * A SelectTaskQueue is meant to be used with a Selector.  Submitted
 * tasks will wake up the associated Selector for immediate execution.
 * Because of this, all tasks should be short and non-blocking.
 *
 * This is intended for waking up (i.e., rescheduling select operations)
 * a sleeping connection.
 *
 * All tasks are placed in an unbounded queue.  Thus, it is best to schedule
 * just O(1) tasks per connection.
 */
class SelectTaskQueue implements Executor {
    private Selector mSelector;

    private BlockingQueue<Runnable> mTaskQueue;

    public SelectTaskQueue(Selector selector) {
        mSelector = selector;
        // We want an unbounded queue, since we never want a task to block.
        mTaskQueue = new LinkedBlockingQueue<Runnable>();
    }

    public void execute(final Runnable r) {
        mTaskQueue.offer(r);

        mSelector.wakeup();
    }

    /**
     * @return the head of the queue or null if empty.  This is thread-safe.
     */
    public Runnable poll() {
        return mTaskQueue.poll();
    }
}

// Copyright 2014, Kevin Ko <kevin@faveset.com>

package com.faveset.khttp;

import java.nio.channels.Selector;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.Executor;

/**
 * A SelectTaskQueue is meant to be used with a Selector.  Submitted
 * tasks will wake up the associated Selector for immediate execution.
 * Because of this, all tasks should be short and non-blocking.
 *
 * This is intended for waking up (i.e., rescheduling select operations)
 * a sleeping connection.
 *
 * All tasks are placed in an unbounded queue.  Thus, it is best to schedule
 * just O(1) tasks per connection.
 */
class SelectTaskQueue implements Executor {
    private Selector mSelector;

    private BlockingQueue<Runnable> mTaskQueue;

    public SelectTaskQueue(Selector selector) {
        mSelector = selector;
        // We want an unbounded queue, since we never want a task to block.
        mTaskQueue = new LinkedBlockingQueue<Runnable>();
    }

    public void execute(final Runnable r) {
        mTaskQueue.add(r);

        mSelector.wakeup();
    }

    /**
     * @return the head of the queue or null if empty.  This is thread-safe.
     */
    public Runnable poll() {
        return mTaskQueue.poll();
    }
}

Use add instead of offer with the unbounded blocking queue to guarantee successful add.


package info.u_team.u_team_test;

import org.apache.logging.log4j.*;

import info.u_team.u_team_core.integration.IntegrationManager;
import info.u_team.u_team_core.util.verify.JarSignVerifier;
import info.u_team.u_team_test.init.*;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.common.Mod;

@Mod(TestMod.MODID)
public class TestMod {

	public static final String MODID = "uteamtest";
	public static final Logger LOGGER = LogManager.getLogger("UTeamTest");

	public TestMod() {
		JarSignVerifier.checkSigned(MODID);

		LOGGER.info("--------------------------------------- LOADING TEST MOD ---------------------------------------");

		TestCommonBusRegister.register();
		DistExecutor.safeRunWhenOn(Dist.CLIENT, () -> TestClientBusRegister::register);

		IntegrationManager.constructIntegrations(MODID);
	}
}

package info.u_team.u_team_test;

import org.apache.logging.log4j.*;

import info.u_team.u_team_core.construct.ConstructManager;
import info.u_team.u_team_core.integration.IntegrationManager;
import info.u_team.u_team_core.util.verify.JarSignVerifier;
import net.minecraftforge.fml.common.Mod;

@Mod(TestMod.MODID)
public class TestMod {

	public static final String MODID = "uteamtest";
	public static final Logger LOGGER = LogManager.getLogger("UTeamTest");

	public TestMod() {
		JarSignVerifier.checkSigned(MODID);

		LOGGER.info("--------------------------------------- LOADING TEST MOD ---------------------------------------");

//		TestCommonBusRegister.register();
//		DistExecutor.safeRunWhenOn(Dist.CLIENT, () -> TestClientBusRegister::register);

		ConstructManager.constructConstructs(MODID);

		IntegrationManager.constructIntegrations(MODID);
	}
}

Add call to construct manager in test mod


package com.simplerecipemanager.resources;

import java.util.Map;
import java.util.Map.Entry;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;

import com.codahale.metrics.health.HealthCheck.Result;
import com.codahale.metrics.health.HealthCheckRegistry;

@Path("/healthcheck")
public class HealthCheckResource {

	private HealthCheckRegistry registry;

	public HealthCheckResource(HealthCheckRegistry hcr) {

	}

	@GET
	public Response returnHealthCheck() {
		Map<String, Result> hcResults = registry.runHealthChecks();
		for (Entry<String, Result> r : hcResults.entrySet()) {
			if (!r.getValue().isHealthy()) {
				return Response.serverError().entity(r.getValue().getMessage())
						.build();
			}
		}
		return Response.ok().build();
	}

}

package com.simplerecipemanager.resources;

import java.util.Map;
import java.util.Map.Entry;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import com.codahale.metrics.annotation.Timed;
import com.codahale.metrics.health.HealthCheck.Result;
import com.codahale.metrics.health.HealthCheckRegistry;

@Path("/healthcheck")
public class HealthCheckResource {

	private HealthCheckRegistry registry;

	public HealthCheckResource(HealthCheckRegistry hcr) {
		this.registry = hcr;
	}

	@GET
	@Produces(MediaType.TEXT_PLAIN)
	@Timed
	public Response returnHealthCheck() {
		Map<String, Result> hcResults = registry.runHealthChecks();
		int fails = 0;
		StringBuilder failureMessage = new StringBuilder();
				for (Entry<String, Result> r : hcResults.entrySet()) {
			if (!r.getValue().isHealthy()) {
				failureMessage.append(String.format("%s message was %s", r.getKey(), r.getValue().getMessage()));
			}
		}
		if (fails == 0) {
			return Response.ok().entity("OK").build();
		} else {
			return Response.serverError().entity(failureMessage.toString()).build();
		}
	}

}

Use better health check details


/* $Id$ */

/**
* 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.apache.lcf.core.interfaces;

/** This is a class which uniquely identifiers a time marker, for the database layer.
*/
public class TimeMarker
{
  public static final String _rcsid = "@(#)$Id$";

  long timeValue;

  /** Constructor.
  *@param timeValue is the time value.
  */
  public TimeMarker(long timeValue)
  {
    this.timeValue = timeValue;
  }

  public long longValue()
  {
    return timeValue;
  }
}

/* $Id$ */

/**
* 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.apache.lcf.core.interfaces;

/** This is a class which uniquely identifiers a time marker, for the database layer.
*/
public class TimeMarker
{
  public static final String _rcsid = "@(#)$Id$";

  long timeValue;

  /** Constructor.
  *@param timeValue is the time value.
  */
  public TimeMarker(long timeValue)
  {
    this.timeValue = timeValue;
  }

  public long longValue()
  {
    return timeValue;
  }

  public String toString()
  {
    return new Long(timeValue).toString();
  }

}

Fix issue with time field string conversion (there wasn't any).


package de.papke.cloud.portal.auth;

import org.springframework.context.annotation.Bean;
import org.springframework.session.data.mongo.JdkMongoSessionConverter;
import org.springframework.session.data.mongo.config.annotation.web.http.EnableMongoHttpSession;

@EnableMongoHttpSession
public class HttpSessionConfig {

	@Bean
    public JdkMongoSessionConverter jdkMongoSessionConverter() {
            return new JdkMongoSessionConverter();
    }
}

package de.papke.cloud.portal.auth;

import org.springframework.context.annotation.Bean;
import org.springframework.session.data.mongo.JdkMongoSessionConverter;
import org.springframework.session.data.mongo.config.annotation.web.http.EnableMongoHttpSession;

@EnableMongoHttpSession(maxInactiveIntervalInSeconds = HttpSessionConfig.SESSION_TIMEOUT)
public class HttpSessionConfig {

	public static final int SESSION_TIMEOUT = 28800;

	@Bean
	public JdkMongoSessionConverter jdkMongoSessionConverter() {
		return new JdkMongoSessionConverter();
	}
}

Increase session timeout for mongo http sessions


package gov.nih.nci.calab.service.workflow;

/**
 * Generalizes Mask functionality for masking Aliquot, File, etc.
 * @author doswellj
 * @param strType Type of Mask (e.g., aliquot, file, run, etc.)
 * @param strId	  The id associated to the type
 * @param strDescription The mask description associated to the mask type and Id.
 *
 */
public class MaskService
{
    public void setMask(String strType, String strId, String strDescription)
    {
        if (strType.equals("aliquot"))
        {
            //TODO Find Aliquot record based on the its id and set the status to "Masked" and its Description
        }
        if (strType.equals("file"))
        {
        	//TODO Find File record based on the its id and set the status to "Masked" and its Description
        }

    }

}

package gov.nih.nci.calab.service.workflow;

/**
 * Generalizes Mask functionality for masking Aliquot, File, etc.
 * @author doswellj
 * @param strType Type of Mask (e.g., aliquot, file, run, etc.)
 * @param strId	  The id associated to the type
 * @param strDescription The mask description associated to the mask type and Id.
 *
 */
public class MaskService
{

	//This functionality is pending the completed Object Model
	public void setMask(String strType, String strId, String strDescription)
    {
        if (strType.equals("aliquot"))
        {
            //TODO Find Aliquot record based on the strID

        	//TODO Set File Status record to "Masked".

        }
        if (strType.equals("file"))
        {
        	//TODO Find File record based on the its strID

        	//TODO Set File Status record to "Masked".
        }

    }

}

Mask Service is pending the completed object model


package io.sigpipe.sing.graph;

import java.io.IOException;

import io.sigpipe.sing.serialization.SerializationInputStream;
import io.sigpipe.sing.serialization.SerializationOutputStream;

public class CountContainer extends DataContainer {

    long a;
    long b;

    public CountContainer() {

    }

    public CountContainer(long a, long b) {
        this.a = a;
        this.b = b;
    }

    public void merge(DataContainer container) {
        CountContainer cc = (CountContainer) container;
        this.a += cc.a;
        this.b += cc.b;
    }

    public void clear() {
        this.a = 0;
        this.b = 0;
    }

    @Deserialize
    public CountContainer(SerializationInputStream in)
    throws IOException {
        this.a = in.readLong();
        this.b = in.readLong();
    }

    @Override
    public void serialize(SerializationOutputStream out)
    throws IOException {
        out.writeLong(a);
        out.writeLong(b);
    }

}

package io.sigpipe.sing.graph;

import java.io.IOException;

import io.sigpipe.sing.serialization.SerializationInputStream;
import io.sigpipe.sing.serialization.SerializationOutputStream;

public class CountContainer extends DataContainer {

    public long a;
    public long b;

    public CountContainer() {

    }

    public CountContainer(long a, long b) {
        this.a = a;
        this.b = b;
    }

    public void merge(DataContainer container) {
        CountContainer cc = (CountContainer) container;
        this.a += cc.a;
        this.b += cc.b;
    }

    public void clear() {
        this.a = 0;
        this.b = 0;
    }

    @Deserialize
    public CountContainer(SerializationInputStream in)
    throws IOException {
        this.a = in.readLong();
        this.b = in.readLong();
    }

    @Override
    public void serialize(SerializationOutputStream out)
    throws IOException {
        out.writeLong(a);
        out.writeLong(b);
    }

}

Make countcontainer members public for now


package com.elderstudios.controller;

import com.elderstudios.domain.GuestBookEntry;
import com.elderstudios.service.GuestBookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.persistence.criteria.CriteriaBuilder;
import java.util.List;

/**
 * Created by tony on 04/07/17.
 */

@RestController
public class GuestBookRestController {

    private static final String prefix = "api";

    @Autowired
    private GuestBookService guestBookService;

    @GetMapping (prefix + "/comments")
    public List <GuestBookEntry> apiAllComments () {
        return this.guestBookService.findAllEntries ();
    }

    @GetMapping (prefix + "/find/{id}")
    public List <GuestBookEntry> apiCommentById (@PathVariable ("id") Integer id) {
        return this.guestBookService.getGuestBookEntryById (id);
    }

    @GetMapping (prefix + "/users")
    public List <String> apiGetDistinctUsers () {
        return this.guestBookService.findDistinctUsers ();
    }

    @GetMapping (prefix + "/comment_count")
    public Integer getNumberOfComments () {
        return this.guestBookService.getNumberOfComments ();
    }

    @GetMapping (prefix + "/average_length")
    public Double getAverageCommentLength () {
        return this.guestBookService.getAverageCommentLength ();
    }

    @GetMapping (prefix + "/longest_comment")
    public List <String> getLongestComment () {
        return this.guestBookService.getLongestComment ();
    }
}

package com.elderstudios.controller;

import com.elderstudios.domain.GuestBookEntry;
import com.elderstudios.service.GuestBookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.persistence.criteria.CriteriaBuilder;
import java.util.List;

/**
 * Created by tony on 04/07/17.
 */

@RestController
@RequestMapping ("/api")
public class GuestBookRestController {

    //private static final String prefix = "api";

    @Autowired
    private GuestBookService guestBookService;

    @GetMapping ("/comments")
    public List <GuestBookEntry> apiAllComments () {
        return this.guestBookService.findAllEntries ();
    }

    @GetMapping ("/find/{id}")
    public List <GuestBookEntry> apiCommentById (@PathVariable ("id") Integer id) {
        return this.guestBookService.getGuestBookEntryById (id);
    }

    @GetMapping ("/users")
    public List <String> apiGetDistinctUsers () {
        return this.guestBookService.findDistinctUsers ();
    }

    @GetMapping ("/comment_count")
    public Integer getNumberOfComments () {
        return this.guestBookService.getNumberOfComments ();
    }

    @GetMapping ("/average_length")
    public Double getAverageCommentLength () {
        return this.guestBookService.getAverageCommentLength ();
    }

    @GetMapping ("/longest_comment")
    public List <String> getLongestComment () {
        return this.guestBookService.getLongestComment ();
    }

}

Refactor REST controller to use overall @RequestMapping


package io.github.hcoona.utils;

import org.junit.Assert;
import org.junit.Test;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;

public class NamedMutexTest {

  @Test
  public void testCannotWaitOne() throws Exception {
    final String name = "test_named-mutex_cannot-wait-one";
    try (NamedMutex ignored = NamedMutex.newInstance(true, name)) {
      ExecutorService executor = Executors.newSingleThreadExecutor();

      Future<Boolean> waitOneFuture = executor.submit(() -> {
        try (NamedMutex mutex2 = NamedMutex.newInstance(true, name)) {
          return mutex2.waitOne(500, TimeUnit.MILLISECONDS);
        }
      });

      Assert.assertFalse(waitOneFuture.get());
    }
  }

  @Test
  public void testCanWaitOne() throws Exception {
    final String name = "test_named-mutex_can-wait-one";
    try (NamedMutex mutex_owned = NamedMutex.newInstance(true, name)) {
      mutex_owned.release();
      ExecutorService executor = Executors.newSingleThreadExecutor();

      Future<Boolean> waitOneFuture = executor.submit(() -> {
        try (NamedMutex mutex2 = NamedMutex.newInstance(true, name)) {
          return mutex2.waitOne(5, TimeUnit.SECONDS);
        }
      });

      Assert.assertTrue(waitOneFuture.get());
    }
  }

}

package io.github.hcoona.utils;

import com.sun.jna.Platform;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.BeforeClass;
import org.junit.Test;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;

public class NamedMutexTest {

  @BeforeClass
  public static void beforeClass() throws Exception {
    Assume.assumeTrue(Platform.isWindows());
  }

  @Test
  public void testCannotWaitOne() throws Exception {
    final String name = "test_named-mutex_cannot-wait-one";
    try (NamedMutex ignored = NamedMutex.newInstance(true, name)) {
      ExecutorService executor = Executors.newSingleThreadExecutor();

      Future<Boolean> waitOneFuture = executor.submit(() -> {
        try (NamedMutex mutex2 = NamedMutex.newInstance(true, name)) {
          return mutex2.waitOne(500, TimeUnit.MILLISECONDS);
        }
      });

      Assert.assertFalse(waitOneFuture.get());
    }
  }

  @Test
  public void testCanWaitOne() throws Exception {
    final String name = "test_named-mutex_can-wait-one";
    try (NamedMutex mutex_owned = NamedMutex.newInstance(true, name)) {
      mutex_owned.release();
      ExecutorService executor = Executors.newSingleThreadExecutor();

      Future<Boolean> waitOneFuture = executor.submit(() -> {
        try (NamedMutex mutex2 = NamedMutex.newInstance(true, name)) {
          return mutex2.waitOne(5, TimeUnit.SECONDS);
        }
      });

      Assert.assertTrue(waitOneFuture.get());
    }
  }

}

Mark it Windows only before Linux implement ready.


package ca.cumulonimbus.pressurenetsdk;

public class CbWeather {

}

package ca.cumulonimbus.pressurenetsdk;

/**
 * Parent class for all Weather
 * @author jacob
 *
 */
public class CbWeather {

	private int animateGroupNumber = 0;

	public int getAnimateGroupNumber() {
		return animateGroupNumber;
	}
	public void setAnimateGroupNumber(int animateGroupNumber) {
		this.animateGroupNumber = animateGroupNumber;
	}
}

Support map positioning in time with slider


package com.phsshp;

import com.phsshp.testutils.matchers.MetricsMatcher;
import org.junit.Test;

import java.io.File;
import java.util.Arrays;
import java.util.List;

import static com.phsshp.testutils.matchers.MetricsMatcher.metricsMatching;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;

public class MetricsReporterTest {

    @Test
    public void reportMetricsForJavaFiles() throws Exception {
        // TODO: crappy test for now
        List<File> files = Arrays.asList(
                new File("src/test/resources/test-project/SomeFile.java"),
                new File("src/test/resources/test-project/pkg1/AnotherInPackage1.java"));

        List<Metrics> metrics = new MetricsReporter().report(files);

        assertThat(metrics.size(), is(2));
        assertThat(metrics.get(0).getFile().getName(), equalTo("SomeFile.java"));
        assertThat(metrics.get(0).getValue(), equalTo(1));
        assertThat(metrics.get(1).getFile().getName(), equalTo("AnotherInPackage1.java"));
        assertThat(metrics.get(1).getValue(), equalTo(3));
        assertThat(metrics.get(0), metricsMatching("SomeFile.java", 1));
    }

}

package com.phsshp;

import org.junit.Test;

import java.io.File;
import java.util.Arrays;
import java.util.List;

import static com.phsshp.testutils.matchers.MetricsMatcher.metricsMatching;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;

public class MetricsReporterTest {

    @Test
    public void reportMetricsForJavaFiles() throws Exception {
        List<File> files = Arrays.asList(
                new File("src/test/resources/test-project/SomeFile.java"),
                new File("src/test/resources/test-project/pkg1/AnotherInPackage1.java"));

        List<Metrics> metrics = new MetricsReporter().report(files);

        assertThat(metrics, contains(
                metricsMatching("SomeFile.java", 1),
                metricsMatching("AnotherInPackage1.java", 3)));
    }

}

Refactor test to use matchers


package model.ea.operators;

import helper.ConfigurationHelper;
import model.ea.Population;

@SuppressWarnings("unused")
public class BestSelectionOperator implements IEnvironmentSelectionOperator {
	 private int numberOfSelections = ConfigurationHelper.getInstance().getPropertyInteger("IndividualsPerPopulation", 10);

	/**
	 * Takes the population after Recombination and Mutation selects
	 * the number of needed best individuals from parents and children.
	 * @param population Population instance
	 */
	@Override
	public void select(Population population) {
		population.sortByFitness();
		int poolSize = population.getPool().size();
		for (int i = poolSize-1; i >= numberOfSelections; i--) {
			population.getPool().remove(i);
		}
	}
}

package model.ea.operators;

import helper.ConfigurationHelper;
import model.ea.Population;

public class BestEnvironmentSelection implements IEnvironmentSelection {
	 private int numberOfSelections = ConfigurationHelper.getInstance().getPropertyInteger("IndividualsPerPopulation", 10);

	/**
	 * Takes the population after Recombination and Mutation selects
	 * the number of needed best individuals from parents and children.
	 * @param population Population instance
	 */
	@Override
	public void select(Population population) {
		population.sortByFitness();
		int poolSize = population.getPool().size();
		for (int i = poolSize-1; i >= numberOfSelections; i--) {
			population.getPool().remove(i);
		}
	}
}

Comment was added to this operator.


package com.bookbase.app.utils;

import android.arch.persistence.room.TypeConverter;

import com.bookbase.app.mainscreen.HomeScreen;
import com.bookbase.app.database.AppDatabase;
import com.bookbase.app.model.entity.Author;
import com.bookbase.app.model.entity.Genre;

import java.sql.Date;
import java.util.Calendar;

public class Converters {

    private static AppDatabase db = AppDatabase.getDatabase(HomeScreen.getContext());

    @TypeConverter
    public static Long dateToLong(Date date){
        return date == null ? null : date.getTime();
    }

    @TypeConverter
    public static Calendar toCalendar(String date){
        // TODO: Complete implementation.
        return Calendar.getInstance();
    }

    @TypeConverter
    public static String calendarToLong(Calendar calendar){
        // TODO: Finish implementation.
        return "";
    }

    @TypeConverter
    public static int authorAsId(Author author){
        return author.getAuthorId();
    }

    @TypeConverter
    public static Author intToAuthor(int id){
        return db.authorDao().getAuthorById(id);
    }

    @TypeConverter
    public static int genreAsId(Genre genre){
        return genre.getGenreId();
    }

    @TypeConverter
    public static Genre intToGenre(int id){
        return db.genreDao().getGenreById(id);
    }

}

package com.bookbase.app.utils;

import android.arch.persistence.room.TypeConverter;

import com.bookbase.app.mainscreen.HomeScreen;
import com.bookbase.app.database.AppDatabase;
import com.bookbase.app.model.entity.Author;
import com.bookbase.app.model.entity.Genre;

import java.sql.Date;
import java.util.Calendar;

public class Converters {

    private static AppDatabase db = AppDatabase.getDatabase(HomeScreen.getContext());

    @TypeConverter
    public static Long dateToLong(Date date){
        return date == null ? null : date.getTime();
    }

    @TypeConverter
    public static Calendar toCalendar(String date){
        // TODO: Complete implementation.
        return Calendar.getInstance();
    }

    @TypeConverter
    public static String calendarToString(Calendar calendar){
        // TODO: Finish implementation.
        return "";
    }

    @TypeConverter
    public static int authorAsId(Author author){
        return author.getAuthorId();
    }

    @TypeConverter
    public static Author intToAuthor(int id){
        return db.authorDao().getAuthorById(id);
    }

    @TypeConverter
    public static int genreAsId(Genre genre){
        return genre.getGenreId();
    }

    @TypeConverter
    public static Genre intToGenre(int id){
        return db.genreDao().getGenreById(id);
    }

}

Fix type in method name


package com.google.research.bleth.simulator;

import com.google.auto.value.AutoValue;

/** A location on board. */
@AutoValue
public abstract class Location {
    public static Location create(int row, int col) {
        return new AutoValue_Location(row, col);
    }

    public abstract int row();
    public abstract int col();

    /**
     * Calculate and return the new location based on the current location and the given direction.
     * @param direction is the direction to move to it, one of the four directions: up, down, right and left.
     * @return new Location, differ from the original location in one step, according the given direction.
     */
    public Location moveInDirection(Direction direction) {
        return Location.create(row() + direction.getRowDelta(), col() + direction.getColDelta());
    }
}

package com.google.research.bleth.simulator;

import com.google.auto.value.AutoValue;

/** A location on board. */
@AutoValue
public abstract class Location {
    public static Location create(int row, int col) {
        return new AutoValue_Location(row, col);
    }

    public abstract int row();
    public abstract int col();

    /**
     * Calculate and return the new location based on the current location and the given direction.
     * @param direction is the direction to move to it, one of the four directions: up, down, right and left.
     * @return new Location, differ from the original location in one step, according the given direction.
     */
    public Location moveInDirection(Direction direction) {
        return create(row() + direction.getRowDelta(), col() + direction.getColDelta());
    }
}

Fix a call to method.


package com.dyhpoon.fodex.data;

import android.content.ContentResolver;
import android.content.Context;
import android.database.Cursor;
import android.provider.MediaStore;

/**
 * Created by darrenpoon on 28/1/15.
 */
public class FodexCursor {

    public static Cursor allPhotosCursor(Context context) {
        ContentResolver resolver = context.getContentResolver();
        String[] projection = new String[]{
                MediaStore.Images.Media._ID,
                MediaStore.Images.Media.DATA,
                MediaStore.Images.Media.DATE_TAKEN,
        };
        Cursor cursor = resolver.query(
                MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
                projection,
                null,
                null,
                MediaStore.Images.Media.DATE_ADDED + " DESC"
        );
        return cursor;
    }

}

package com.dyhpoon.fodex.data;

import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.provider.MediaStore;

/**
 * Created by darrenpoon on 28/1/15.
 */
public class FodexCursor {

    public static Cursor allPhotosCursor(Context context) {
        ContentResolver resolver = context.getContentResolver();
        String[] projection = new String[]{
                MediaStore.Images.Media._ID,
                MediaStore.Images.Media.DATA,
                MediaStore.Images.Media.DATE_TAKEN,
        };
        Cursor cursor = resolver.query(
                MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
                projection,
                null,
                null,
                MediaStore.Images.Media.DATE_ADDED + " DESC"
        );
        return cursor;
    }

    public static Uri getThumbnail(Context context, int imageId) {
        ContentResolver resolver = context.getContentResolver();
        String[] projection = new String[] {
                MediaStore.Images.Thumbnails._ID
        };
        Cursor cursor = MediaStore.Images.Thumbnails.queryMiniThumbnail(
                resolver,
                imageId,
                MediaStore.Images.Thumbnails.MINI_KIND,
                projection);
        final int idColumn = cursor.getColumnIndexOrThrow(MediaStore.Images.Thumbnails._ID);
        if (cursor.moveToFirst()) {
            final String id = cursor.getString(idColumn);
            cursor.close();
            return ContentUris.withAppendedId(
                    MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI,
                    Long.parseLong(id));
        } else {
            return null;
        }
    }

}

Add function to get thumbnail's url with image id.


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.yao.oa.domains.user;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

/**
 *
 * @author 世宁
 */
@Embeddable
public class GroupAuthoritiesPK implements Serializable {

    @ManyToOne
    @JoinColumn(name = "group_id",nullable = false)
    private Groups group_;
    @Column(nullable = false)
    private String authority;

    public Groups getGroup_() {
        return group_;
    }

    public void setGroup_(Groups group_) {
        this.group_ = group_;
    }

    public String getAuthority() {
        return authority;
    }

    public void setAuthority(String authority) {
        this.authority = authority;
    }

}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.yao.oa.domains.user;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

/**
 *
 * @author 世宁
 */
@Embeddable
public class GroupAuthoritiesPK implements Serializable {

    @ManyToOne
    @JoinColumn(name = "group_id",nullable = false)
    private Groups group_;
    @Column(nullable = false)
    private String authority;

    public Groups getGroup_() {
        return group_;
    }

    public void setGroup_(Groups group_) {
        this.group_ = group_;
    }

    public String getAuthority() {
        return authority;
    }

    public void setAuthority(String authority) {
        this.authority = authority;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == this) return true;
        if (!(obj instanceof GroupAuthoritiesPK)) {
            return false;
        }
        GroupAuthoritiesPK pk = (GroupAuthoritiesPK)obj;
        if (!(this.group_ == pk.group_)) return false;
        if (!this.authority.equals(pk.getAuthority())) return false;
        return true;
    }
    @Override
    public int hashCode( )
    {
        return this.group_.hashCode( ) + this.authority.hashCode();
    }
}

Add basic authorization to restful webservices controller.


package org.ambraproject.rhino.view.asset;

import com.google.common.collect.ImmutableList;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonSerializationContext;
import org.ambraproject.models.ArticleAsset;
import org.ambraproject.rhino.identity.AssetIdentity;
import org.ambraproject.rhino.view.JsonOutputView;

import java.util.Collection;
import java.util.List;

public class AssetsAsFigureView implements JsonOutputView {

  private final ImmutableList<ArticleAsset> assets;

  public AssetsAsFigureView(Collection<ArticleAsset> assets) {
    this.assets = ImmutableList.copyOf(assets);
  }

  @Override
  public JsonElement serialize(JsonSerializationContext context) {
    List<Figure> figures = Figure.listFigures(assets);
    if (figures.size() != 1) {
      throw new RuntimeException("Expected exactly one figure among supplied assets");
    }
    Figure figure = figures.get(0);
    AssetIdentity assetId = figure.getId();
    ArticleAsset original = figure.getOriginal();

    JsonObject serialized = new JsonObject();
    serialized.addProperty("doi", assetId.getIdentifier());
    serialized.addProperty("contextElement", original.getContextElement());
    serialized.addProperty("title", original.getTitle());
    serialized.addProperty("description", original.getDescription());

    serialized.add("assetfiles", context.serialize(new AssetFileCollectionView(assets)));

    return serialized;
  }

}

package org.ambraproject.rhino.view.asset;

import com.google.common.collect.ImmutableList;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonSerializationContext;
import org.ambraproject.models.ArticleAsset;
import org.ambraproject.rhino.identity.AssetIdentity;
import org.ambraproject.rhino.view.JsonOutputView;

import java.util.Collection;
import java.util.List;

public class AssetsAsFigureView implements JsonOutputView {

  private final ImmutableList<ArticleAsset> assets;
  private final Figure figure;

  public AssetsAsFigureView(Collection<ArticleAsset> assets) {
    this.assets = ImmutableList.copyOf(assets);

    List<Figure> figures = Figure.listFigures(this.assets);
    if (figures.size() != 1) {
      String message = "ArticleAsset objects passed to AssetsAsFigureView must all have one DOI in common";
      throw new IllegalArgumentException(message);
    }
    this.figure = figures.get(0);
  }

  @Override
  public JsonElement serialize(JsonSerializationContext context) {
    AssetIdentity assetId = figure.getId();
    ArticleAsset original = figure.getOriginal();

    JsonObject serialized = new JsonObject();
    serialized.addProperty("doi", assetId.getIdentifier());
    serialized.addProperty("contextElement", original.getContextElement());
    serialized.addProperty("title", original.getTitle());
    serialized.addProperty("description", original.getDescription());

    serialized.add("assetfiles", context.serialize(new AssetFileCollectionView(assets)));

    return serialized;
  }

}

Move check to constructor for faster failure


package seedu.doist.testutil;

import java.util.Date;

import seedu.doist.commons.exceptions.IllegalValueException;
import seedu.doist.model.tag.Tag;
import seedu.doist.model.tag.UniqueTagList;
import seedu.doist.model.task.Description;
import seedu.doist.model.task.Priority;

/**
 *
 */
public class TaskBuilder {

    private TestTask task;

    public TaskBuilder() {
        this.task = new TestTask();
    }

    /**
     * Initializes the TaskBuilder with the data of {@code personToCopy}.
     */
    public TaskBuilder(TestTask taskToCopy) {
        this.task = new TestTask(taskToCopy);
    }

    public TaskBuilder withName(String name) throws IllegalValueException {
        this.task.setName(new Description(name));
        return this;
    }

    public TaskBuilder withPriority(String priority) throws IllegalValueException {
        this.task.setPriority(new Priority(priority));
        return this;
    }

    public TaskBuilder withTags(String ... tags) throws IllegalValueException {
        task.setTags(new UniqueTagList());
        for (String tag: tags) {
            task.getTags().add(new Tag(tag));
        }
        return this;
    }

    public TaskBuilder withDates(Date startDate, Date endDate) throws IllegalValueException {
        this.task.setStartDate(startDate);
        this.task.setEndDate(endDate);
        return this;
    }

    public TestTask build() {
        return this.task;
    }

}

package seedu.doist.testutil;

import java.util.Date;

import seedu.doist.commons.exceptions.IllegalValueException;
import seedu.doist.model.tag.Tag;
import seedu.doist.model.tag.UniqueTagList;
import seedu.doist.model.task.Description;
import seedu.doist.model.task.Priority;

/**
 *
 */
public class TaskBuilder {

    private TestTask task;

    public TaskBuilder() {
        this.task = new TestTask();
    }

    /**
     * Initializes the TaskBuilder with the data of {@code personToCopy}.
     */
    public TaskBuilder(TestTask taskToCopy) {
        this.task = new TestTask(taskToCopy);
    }

    public TaskBuilder withName(String name) throws IllegalValueException {
        this.task.setName(new Description(name));
        return this;
    }

    public TaskBuilder withPriority(String priority) throws IllegalValueException {
        this.task.setPriority(new Priority(priority));
        return this;
    }

    public TaskBuilder withTags(String ... tags) throws IllegalValueException {
        task.setTags(new UniqueTagList());
        for (String tag: tags) {
            task.getTags().add(new Tag(tag));
        }
        return this;
    }

    public TaskBuilder withDates(Date startDate, Date endDate) throws IllegalValueException {
        this.task.getDates().setStartDate(startDate);
        this.task.getDates().setEndDate(endDate);
        return this;
    }

    public TestTask build() {
        return this.task;
    }

}

Change class to use new TaskDate


/*
 * Copyright (c) Joachim Ansorg, mail@ansorg-it.com
 *
 * 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.ansorgit.plugins.bash.lang.psi.stubs.index;

/**
 * Configures the versions of the available Bash indexes.
 */
public final class BashIndexVersion {
    private static final int BASE = 41;
    public static final int CACHES_VERSION = BASE + 9;
    public static final int STUB_INDEX_VERSION = BASE + 31;
    public static final int ID_INDEX_VERSION = BASE + 19;

    private BashIndexVersion() {
    }
}

/*
 * Copyright (c) Joachim Ansorg, mail@ansorg-it.com
 *
 * 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.ansorgit.plugins.bash.lang.psi.stubs.index;

/**
 * Configures the versions of the available Bash indexes.
 */
public final class BashIndexVersion {
    private static final int BASE = 42;
    public static final int CACHES_VERSION = BASE + 9;
    public static final int STUB_INDEX_VERSION = BASE + 31;
    public static final int ID_INDEX_VERSION = BASE + 19;

    private BashIndexVersion() {
    }
}

Increment index version for 1.6.13


/*******************************************************************************
 * Copyright (c) 2015 Stichting Yona Foundation
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
 *******************************************************************************/
package nu.yona.server.analysis.rest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseStatus;

import nu.yona.server.analysis.service.AnalysisEngineService;
import nu.yona.server.analysis.service.PotentialConflictDTO;

@Controller
public class AnalysisEngineController {
	@Autowired
	private AnalysisEngineService analysisEngineService;

	@RequestMapping(value = "/analysisEngine", method = RequestMethod.POST)
	@ResponseStatus(value = HttpStatus.OK)
	public void analyze(@RequestBody PotentialConflictDTO potentialConflictPayload) {
		analysisEngineService.analyze(potentialConflictPayload);
	}
}

/*******************************************************************************
 * Copyright (c) 2015 Stichting Yona Foundation
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
 *******************************************************************************/
package nu.yona.server.analysis.rest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseStatus;

import nu.yona.server.analysis.service.AnalysisEngineService;
import nu.yona.server.analysis.service.PotentialConflictDTO;

@Controller
@RequestMapping(value = "/analysisEngine/")
public class AnalysisEngineController {
	@Autowired
	private AnalysisEngineService analysisEngineService;

	@RequestMapping(method = RequestMethod.POST)
	@ResponseStatus(value = HttpStatus.OK)
	public void analyze(@RequestBody PotentialConflictDTO potentialConflictPayload) {
		analysisEngineService.analyze(potentialConflictPayload);
	}
}

Add a trailing slash to the analysis engine URL


package devopsdistilled.operp.client.main;

import javax.inject.Inject;
import javax.swing.JComponent;
import javax.swing.JScrollPane;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.DefaultMutableTreeNode;

import devopsdistilled.operp.client.abstracts.TaskPane;
import devopsdistilled.operp.client.abstracts.ViewPane;

public class NavigationPane extends ViewPane implements TreeSelectionListener {

	@Inject
	private NavigationTree navigationTree;

	@Inject
	private MainWindow mainWindow;

	@Override
	public JComponent getPane() {
		navigationTree.setListener(this);
		return new JScrollPane(navigationTree.getTree());
	}

	@Override
	public void valueChanged(TreeSelectionEvent event) {

		DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) event
				.getPath().getLastPathComponent();

		DefaultMutableTreeNode prevNode = (DefaultMutableTreeNode) event
				.getOldLeadSelectionPath().getLastPathComponent();

		TaskPane newTaskPane = (TaskPane) selectedNode.getUserObject();

		TaskPane oldTaskPane = (TaskPane) prevNode.getUserObject();

		mainWindow.getController().changeTaskPane(newTaskPane, oldTaskPane);
	}

}

package devopsdistilled.operp.client.main;

import javax.inject.Inject;
import javax.swing.JComponent;
import javax.swing.JScrollPane;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.DefaultMutableTreeNode;

import devopsdistilled.operp.client.abstracts.TaskPane;
import devopsdistilled.operp.client.abstracts.ViewPane;

public class NavigationPane extends ViewPane implements TreeSelectionListener {

	@Inject
	private NavigationTree navigationTree;

	@Inject
	private MainWindow mainWindow;

	@Override
	public JComponent getPane() {
		navigationTree.getTree().expandRow(0);
		navigationTree.setListener(this);
		return new JScrollPane(navigationTree.getTree());
	}

	@Override
	public void valueChanged(TreeSelectionEvent event) {

		DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) event
				.getPath().getLastPathComponent();

		DefaultMutableTreeNode prevNode = (DefaultMutableTreeNode) event
				.getOldLeadSelectionPath().getLastPathComponent();

		TaskPane newTaskPane = (TaskPane) selectedNode.getUserObject();

		TaskPane oldTaskPane = (TaskPane) prevNode.getUserObject();

		mainWindow.getController().changeTaskPane(newTaskPane, oldTaskPane);
	}

}

Make NavigationTree expand by default


/*
 * This file is part of the Yildiz-Engine project, licenced under the MIT License  (MIT)
 *
 * Copyright (c) 2017 Grégory Van den Borre
 *
 * More infos available: https://www.yildiz-games.be
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
 * documentation files (the "Software"), to deal in the Software without restriction, including without
 * limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
 * of the Software, and to permit persons to whom the Software is furnished to do so,
 * subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies or substantial
 * portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
 * OR COPYRIGHT  HOLDERS BE LIABLE FOR ANY CLAIM,
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE  SOFTWARE.
 */

package be.yildiz.shared.entity;

/**
 * @author Grégory Van den Borre
 */
public interface EntityCreator<T extends Entity> {

    T create(EntityToCreate e);
}

/*
 * This file is part of the Yildiz-Engine project, licenced under the MIT License  (MIT)
 *
 * Copyright (c) 2017 Grégory Van den Borre
 *
 * More infos available: https://www.yildiz-games.be
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
 * documentation files (the "Software"), to deal in the Software without restriction, including without
 * limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
 * of the Software, and to permit persons to whom the Software is furnished to do so,
 * subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies or substantial
 * portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
 * OR COPYRIGHT  HOLDERS BE LIABLE FOR ANY CLAIM,
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE  SOFTWARE.
 */

package be.yildiz.shared.entity;

/**
 * @author Grégory Van den Borre
 */
@FunctionalInterface
public interface EntityCreator<T extends Entity> {

    T create(EntityToCreate e);
}

Fix sonar: add functional interface.


package com.tuvistavie.meetup;

/**
 * Created by daniel on 9/4/13.
 */
public final class Config {
    public static final String PROTOCOL = "http";
    public static final String HOST = "192.168.100.103";
    public static final int PORT = 3000;
}

package com.tuvistavie.meetup;

/**
 * Created by daniel on 9/4/13.
 */
public final class Config {
    public static final String PROTOCOL = "http";
    public static final String HOST = "www16179ui.sakura.ne.jp";
    public static final int PORT = 80;
}

Fix configuration to use prod sever.


package dgcj;

public class TemplateDgcjMain {
	static final Object PROBLEM = new TemplateDgcjProblem(); // PROBLEM NAME goes here

	public String run() {
//		long n = ;
//		long from = 1L * n * ID / NODES;
//		long to = 1L * n * (ID + 1) / NODES;

		return null;
	}

	static int NODES;
	static int ID;

	/**
	 * Arguments:
	 * ""	= as for submit
	 * "0"	= run multi node infrastructure
	 * "1"	= run single node
	 */
	public static void main(String[] args) {
		PROBLEM.equals(args); // Local testing framework invocation
		boolean single = args != null && args.length == 1 && "1".equals(args[0]);
		NODES = single ? 1 : message.NumberOfNodes();
		ID = single ? 0 : message.MyNodeId();
		String ans = new TemplateDgcjMain().run();
		if (ans != null) {
			System.out.println(ans);
		}
	}

	public void log(String msg) {
		PROBLEM.equals(ID + ": " + msg); // Local testing framework log
	}
}

package dgcj;

public class TemplateDgcjMain { // RENAME to Main
	static final Object PROBLEM = new TemplateDgcjProblem(); // PROBLEM NAME goes here

	public String run() {
//		long n = ;
//		long from = 1L * n * ID / NODES;
//		long to = 1L * n * (ID + 1) / NODES;

		return null;
	}

	static int NODES;
	static int ID;

	/**
	 * Arguments:
	 * ""	= as for submit
	 * "0"	= run multi node infrastructure
	 * "1"	= run single node
	 */
	public static void main(String[] args) {
		PROBLEM.equals(args); // Local testing framework invocation
		boolean single = args != null && args.length == 1 && "1".equals(args[0]);
		NODES = single ? 1 : message.NumberOfNodes();
		ID = single ? 0 : message.MyNodeId();
		String ans = new TemplateDgcjMain().run();
		if (ans != null) {
			System.out.println(ans);
		}
	}

	public void log(String msg) {
		PROBLEM.equals(ID + ": " + msg); // Local testing framework log
	}
}

Fix template to remind about Main filename


package mytown.test.config.json;

import mytown.config.json.FlagsConfig;
import myessentials.json.JsonConfig;
import mytown.config.json.WildPermsConfig;
import mytown.entities.Wild;
import mytown.entities.flag.Flag;
import mytown.test.TestMain;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

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

/**
 *
 */
public class JsonConfigTest {

    private List<JsonConfig> jsonConfigs;

    @Before
    public void shouldInitConfigs() {

        TestMain.main();

        jsonConfigs = new ArrayList<JsonConfig>();
        //jsonConfigs.add(new RanksConfig(path + "/DefaultRanks.json"));
        jsonConfigs.add(new WildPermsConfig(TestMain.path + "/WildPerms.json"));
        jsonConfigs.add(new FlagsConfig(TestMain.path + "/DefaultFlags.json"));
    }

    @Test
    public void shouldLoadConfigs() {
        for (JsonConfig jsonConfig : jsonConfigs) {
            jsonConfig.init();
        }
    }

    @Test
    public void shouldWildHaveProperValues() {
        for(Flag flag : Wild.instance.flagsContainer) {
            Assert.assertEquals(flag.value, flag.flagType.defaultValue);
        }
    }
}

package mytown.test.config.json;

import mytown.config.json.FlagsConfig;
import myessentials.json.JsonConfig;
import mytown.config.json.WildPermsConfig;
import mytown.entities.Wild;
import mytown.entities.flag.Flag;
import mytown.test.TestMain;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

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

/**
 *
 */
public class JsonConfigTest {

    private List<JsonConfig> jsonConfigs;

    @Before
    public void shouldInitConfigs() {

        TestMain.main();

        jsonConfigs = new ArrayList<JsonConfig>();
        //jsonConfigs.add(new RanksConfig(path + "/DefaultRanks.json"));
        jsonConfigs.add(new WildPermsConfig(TestMain.path + "/WildPerms.json"));
        jsonConfigs.add(new FlagsConfig(TestMain.path + "/DefaultFlags.json"));
    }

    @Test
    public void shouldLoadConfigs() {
        for (JsonConfig jsonConfig : jsonConfigs) {
            jsonConfig.init();
        }
    }

    @Test
    public void shouldWildHaveProperValues() {
        for(Flag flag : Wild.instance.flagsContainer) {
            Assert.assertEquals(flag.value, flag.flagType.defaultWildValue);
        }
    }
}

Fix test of Wild defaults.


package com.sarality.app.datastore;

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

import android.content.ContentResolver;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.util.Log;

import com.sarality.app.data.DataObject;
import com.sarality.app.datastore.extractor.CursorDataExtractor;

public abstract class AbstractContentResolverDataStore<T extends DataObject<T>>
    extends AbstractDataStore<T> implements DataStore<T> {

  public AbstractContentResolverDataStore(Context context, List<Column> columnList, CursorDataExtractor<T> extractor) {
    super(context, columnList, extractor);
  }

  public abstract Uri getQueryUri(Query query);

  @Override
  public List<T> query(Query query) {
    Uri uri = getQueryUri(query);
    ContentResolver contentResolver = getApplicationContext().getContentResolver();

    // TODO(abhideep): Add Query support here
    Cursor cursor = contentResolver.query(uri, null, null, null, null);
    CursorDataExtractor<T> extractor = getCursorDataExtractor();
    List<T> dataList = new ArrayList<T>();

    cursor.moveToFirst();
    for (String columnName : cursor.getColumnNames()) {
      Log.w(getLoggerTag(), "Column Name " + columnName);
    }

    while (!cursor.isAfterLast()) {
      T data = extractor.extract(cursor, query);
      dataList.add(data);
      cursor.moveToNext();
    }

    // Close the cursor to perform cleanup
    cursor.close();
    return dataList;
  }
}

package com.sarality.app.datastore;

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

import android.content.ContentResolver;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;

import com.sarality.app.data.DataObject;
import com.sarality.app.datastore.extractor.CursorDataExtractor;

public abstract class AbstractContentResolverDataStore<T extends DataObject<T>>
    extends AbstractDataStore<T> implements DataStore<T> {

  public AbstractContentResolverDataStore(Context context, List<Column> columnList, CursorDataExtractor<T> extractor) {
    super(context, columnList, extractor);
  }

  public abstract Uri getQueryUri(Query query);

  @Override
  public List<T> query(Query query) {
    Uri uri = getQueryUri(query);
    ContentResolver contentResolver = getApplicationContext().getContentResolver();

    // TODO(abhideep): Add Query support here
    Cursor cursor = contentResolver.query(uri, null, null, null, null);
    CursorDataExtractor<T> extractor = getCursorDataExtractor();
    List<T> dataList = new ArrayList<T>();

    cursor.moveToFirst();
    while (!cursor.isAfterLast()) {
      T data = extractor.extract(cursor, query);
      dataList.add(data);
      cursor.moveToNext();
    }

    // Close the cursor to perform cleanup
    cursor.close();
    return dataList;
  }
}

Remove Logs that printed all Column in DataStore every time it was queried.


package org.vaadin.viritin.util;

import java.util.*;
import java.util.Locale.LanguageRange;

import org.vaadin.viritin.util.VaadinLocale.LocaleNegotiationStrategey;

import com.vaadin.server.VaadinRequest;

/**
 * Implementation of {@link LocaleNegotiationStrategey} which uses java 1.8
 * {@link Locale#lookup(List, Collection)} to negotiate the best locale.
 *
 * @author Daniel Nordhoff-Vergien
 *
 */
public class Java8LocaleNegotiationStrategy implements
        LocaleNegotiationStrategey {

    @Override
    public Locale negotiate(List<Locale> supportedLocales,
            VaadinRequest vaadinRequest) {
        String languages = vaadinRequest.getHeader("Accept-Language");
        List<LanguageRange> priorityList = Locale.LanguageRange
                .parse(languages);
        return Locale.lookup(priorityList, supportedLocales);
    }
}

package org.vaadin.viritin.util;

import java.lang.reflect.Method;
import java.util.*;

import org.vaadin.viritin.util.VaadinLocale.LocaleNegotiationStrategey;

import com.vaadin.server.VaadinRequest;

/**
 * Implementation of {@link LocaleNegotiationStrategey} which uses java 1.8
 * {@link Locale#lookup(List, Collection)} to negotiate the best locale.
 *
 * @author Daniel Nordhoff-Vergien
 *
 */
public class Java8LocaleNegotiationStrategy implements
        LocaleNegotiationStrategey {

    @Override
    public Locale negotiate(List<Locale> supportedLocales,
            VaadinRequest vaadinRequest) {
        String languages = vaadinRequest.getHeader("Accept-Language");
        try {
            // Use reflection here, so the code compiles with jdk 1.7
            Class<?> languageRange = Class
                    .forName("java.util.Locale$LanguageRange");
            Method parse = languageRange.getMethod("parse", String.class);
            Object priorityList = parse.invoke(null, languages);
            Method lookup = Locale.class.getMethod("lookup", List.class,
                    Collection.class);
            return (Locale) lookup.invoke(null, priorityList, supportedLocales);
        } catch (Exception e) {
            throw new RuntimeException(
                    "Java8LocaleNegotiontionStrategy need java 1.8 or newer.",
                    e);
        }

    }
}

Use reflection for java 1.8 classes


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

import org.apache.commons.collections.Predicate;

import java.lang.reflect.ParameterizedType;

/**
 * A class that provides for a typed predicat
 *
 * @author Andre Azzolini (apazzolini)
 *
 * @param <T> the type of object the predicate uses
 */
@SuppressWarnings("unchecked")
public abstract class TypedPredicate<T> implements Predicate {

    protected Class<T> clazz;

    public TypedPredicate() {
        clazz = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];
    }

    public boolean evaluate(Object value) {
        if (clazz.isAssignableFrom(value.getClass())) {
            return eval((T) value);
        }
        return false;
    }

    public abstract boolean eval(T value);

}

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

import org.apache.commons.collections.Predicate;

import java.lang.reflect.ParameterizedType;

/**
 * A class that provides for a typed predicat
 *
 * @author Andre Azzolini (apazzolini)
 *
 * @param <T> the type of object the predicate uses
 */
@SuppressWarnings("unchecked")
public abstract class TypedPredicate<T> implements Predicate {

    protected Class<T> clazz;

    public TypedPredicate() {
        clazz = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];
    }

    public boolean evaluate(Object value) {
        if (value == null || clazz.isAssignableFrom(value.getClass())) {
            return eval((T) value);
        }
        return false;
    }

    public abstract boolean eval(T value);

}

Allow typed predicate to handle nulls


package pw.scho.battleship.model;

import java.util.UUID;

public class Game {

    private Board firstBoard;
    private Board secondBoard;
    private UUID firstPlayerId;
    private UUID secondPlayerId;
    private UUID id;

    public Game() {
        this.id = UUID.randomUUID();
    }

    public UUID getId() {
        return id;
    }

    public Board getFirstBoard() {
        return firstBoard;
    }

    public void setFirstBoard(Board firstBoard) {
        this.firstBoard = firstBoard;
    }

    public Board getSecondBoard() {
        return secondBoard;
    }

    public void setSecondBoard(Board secondBoard) {
        this.secondBoard = secondBoard;
    }

    public UUID getFirstPlayerId() {
        return firstPlayerId;
    }

    public void setFirstPlayerId(UUID firstPlayerId) {
        this.firstPlayerId = firstPlayerId;
    }

    public UUID getSecondPlayerId() {
        return secondPlayerId;
    }

    public void setSecondPlayerId(UUID secondPlayerId) {
        this.secondPlayerId = secondPlayerId;
    }
}

package pw.scho.battleship.model;

import java.util.UUID;

public class Game {

    private Board firstBoard;
    private Board secondBoard;
    private Player firstPlayer;
    private Player secondPlayer;
    private UUID id;

    public Game() {
        this.id = UUID.randomUUID();
    }

    public Player getSecondPlayer() {
        return secondPlayer;
    }

    public void setSecondPlayer(Player secondPlayer) {
        this.secondPlayer = secondPlayer;
    }

    public Player getFirstPlayer() {
        return firstPlayer;
    }

    public void setFirstPlayer(Player firstPlayer) {
        this.firstPlayer = firstPlayer;
    }

    public UUID getId() {
        return id;
    }

    public Board getFirstBoard() {
        return firstBoard;
    }

    public void setFirstBoard(Board firstBoard) {
        this.firstBoard = firstBoard;
    }

    public Board getSecondBoard() {
        return secondBoard;
    }

    public void setSecondBoard(Board secondBoard) {
        this.secondBoard = secondBoard;
    }
}

Replace player ids with player objects


package test;

import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import javax.script.ScriptException;
import org.clafer.ast.AstModel;
import org.clafer.collection.Triple;
import org.clafer.compiler.ClaferCompiler;
import org.clafer.compiler.ClaferSolver;
import org.clafer.javascript.Javascript;
import org.clafer.objective.Objective;
import org.clafer.scope.Scope;
import static org.junit.Assert.*;
import org.junit.Test;

/**
 *
 * @author jimmy
 */
public class PositiveTest {

    @Test
    public void testPositives() throws IOException, ScriptException, URISyntaxException {
        File dir = new File(PositiveTest.class.getResource("/positive").toURI());
        assertTrue(dir.isDirectory());

        for (File test : dir.listFiles()) {
            Triple<AstModel, Scope, Objective[]> p = Javascript.readModel(test);
            ClaferSolver s = ClaferCompiler.compile(p.getFst(), p.getSnd());

            assertTrue(test + " failed", s.find());
        }
    }
}

package test;

import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import javax.script.ScriptException;
import org.clafer.ast.AstModel;
import org.clafer.collection.Triple;
import org.clafer.compiler.ClaferCompiler;
import org.clafer.compiler.ClaferSolver;
import org.clafer.javascript.Javascript;
import org.clafer.objective.Objective;
import org.clafer.scope.Scope;
import static org.junit.Assert.*;
import org.junit.Test;

/**
 *
 * @author jimmy
 */
public class PositiveTest {

    @Test
    public void testPositives() throws IOException, ScriptException, URISyntaxException {
        File dir = new File(PositiveTest.class.getResource("/positive").toURI());
        assertTrue(dir.isDirectory());

        for (File test : dir.listFiles()) {
            Triple<AstModel, Scope, Objective[]> p = Javascript.readModel(test);
            ClaferSolver s = ClaferCompiler.compile(p.getFst(), p.getSnd());

            assertTrue(test + " failed", s.find());
            for (int i = 0; i < 10 && s.find(); i++) {
            }
        }
    }
}

Test more upto 11 instances for the positive tests.