package jfdi.storage;

import java.nio.file.InvalidPathException;

import jfdi.storage.exceptions.ExistingFilesFoundException;

/**
 * This class serves as the facade of the Storage component.
 *
 * @author Thng Kai Yuan
 */
public class FileStorage implements IStorage {

    // The singleton instance of FileStorage
    private static FileStorage instance = null;

    // Boolean indicating if storage has been initialized
    private boolean isInitialized = false;

    /**
     * This private constructor prevents itself from being called by other
     * components. An instance of FileStorage should be initialized using the
     * getInstance method.
     */
    private FileStorage() {
    }

    /**
     * @return the singleton instance of FileStorage
     */
    public static FileStorage getInstance() {
        if (instance == null) {
            instance = new FileStorage();
        }

        return instance;
    }

    @Override
    public void load(String storageFolderPath) throws InvalidPathException, ExistingFilesFoundException {
        FileManager.prepareDirectory(storageFolderPath);
        RecordManager.setAllFilePaths(storageFolderPath);
        RecordManager.loadAllRecords();
        isInitialized = true;
    }

    @Override
    public void changeDirectory(String newStorageFolderPath) throws InvalidPathException,
            ExistingFilesFoundException, IllegalAccessException {

        if (!isInitialized) {
            throw new IllegalAccessException(Constants.MESSAGE_UNINITIALIZED_STORAGE);
        }

        FileManager.prepareDirectory(newStorageFolderPath);
        FileManager.moveFilesToDirectory(newStorageFolderPath);
        RecordManager.setAllFilePaths(newStorageFolderPath);
        RecordManager.loadAllRecords();
    }

}

package jfdi.storage;

import java.nio.file.InvalidPathException;

import jfdi.storage.exceptions.ExistingFilesFoundException;

/**
 * This class serves as the facade of the Storage component.
 *
 * @author Thng Kai Yuan
 */
public class FileStorage implements IStorage {

    // The singleton instance of FileStorage
    private static FileStorage instance = null;

    // Boolean indicating if storage has been initialized
    private boolean isInitialized = false;

    /**
     * This private constructor prevents itself from being called by other
     * components. An instance of FileStorage should be initialized using the
     * getInstance method.
     */
    private FileStorage() {
    }

    /**
     * @return the singleton instance of FileStorage
     */
    public static FileStorage getInstance() {
        if (instance == null) {
            instance = new FileStorage();
        }

        return instance;
    }

    @Override
    public void load(String storageFolderPath) throws InvalidPathException, ExistingFilesFoundException {
        FileManager.prepareDirectory(storageFolderPath);
        RecordManager.setAllFilePaths(storageFolderPath);
        RecordManager.loadAllRecords();
        isInitialized = true;
    }

    @Override
    public void changeDirectory(String newStorageFolderPath) throws InvalidPathException,
            ExistingFilesFoundException, IllegalAccessException {

        if (!isInitialized) {
            throw new IllegalAccessException(Constants.MESSAGE_UNINITIALIZED_STORAGE);
        }

        FileManager.prepareDirectory(newStorageFolderPath);
        FileManager.moveFilesToDirectory(newStorageFolderPath);
        RecordManager.setAllFilePaths(newStorageFolderPath);
        RecordManager.loadAllRecords();
    }

    /**
     * This method sets the existing instance to null. It should only be used
     * for testing/debugging purposes only.
     */
    public void removeInstance() {
        instance = null;
    }

}

Add removeInstance API for tests


/*
// Licensed to Julian Hyde under one or more contributor license
// agreements. See the NOTICE file distributed with this work for
// additional information regarding copyright ownership.
//
// Julian Hyde licenses this file to you under the Modified BSD License
// (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at:
//
// http://opensource.org/licenses/BSD-3-Clause
*/
package sqlline;

import java.sql.*;

import sun.misc.*;

/**
 * A signal handler for SqlLine which interprets Ctrl+C as a request to cancel
 * the currently executing query. Adapted from <a
 * href="http://www.smotricz.com/kabutz/Issue043.html">TJSN</a>.
 */
class SunSignalHandler
    implements SqlLineSignalHandler,
        SignalHandler
{
    private DispatchCallback dispatchCallback;

    SunSignalHandler()
    {
        Signal.handle(new Signal("INT"), this);
    }

    @Override
    public void setCallback(DispatchCallback dispatchCallback)
    {
        this.dispatchCallback = dispatchCallback;
    }

    @Override
    public void handle(Signal sig)
    {
        try {
            synchronized (this) {
                if (dispatchCallback != null) {
                    dispatchCallback.forceKillSqlQuery();
                    dispatchCallback.setToCancel();
                }
            }
        } catch (SQLException ex) {
            throw new RuntimeException(ex);
        }
    }
}

/*
// Licensed to Julian Hyde under one or more contributor license
// agreements. See the NOTICE file distributed with this work for
// additional information regarding copyright ownership.
//
// Julian Hyde licenses this file to you under the Modified BSD License
// (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at:
//
// http://opensource.org/licenses/BSD-3-Clause
*/
package sqlline;

import java.sql.*;

import sun.misc.*;

/**
 * A signal handler for SqlLine which interprets Ctrl+C as a request to cancel
 * the currently executing query. Adapted from <a
 * href="http://www.smotricz.com/kabutz/Issue043.html">TJSN</a>.
 */
class SunSignalHandler
    implements SqlLineSignalHandler,
        SignalHandler
{
    private DispatchCallback dispatchCallback;

    SunSignalHandler()
    {
        Signal.handle(new Signal("INT"), this);
    }

    public void setCallback(DispatchCallback dispatchCallback)
    {
        this.dispatchCallback = dispatchCallback;
    }

    public void handle(Signal sig)
    {
        try {
            synchronized (this) {
                if (dispatchCallback != null) {
                    dispatchCallback.forceKillSqlQuery();
                    dispatchCallback.setToCancel();
                }
            }
        } catch (SQLException ex) {
            throw new RuntimeException(ex);
        }
    }
}

Remove '@Override', to fix compile on JDK 1.5.


package dk.aau.kah.bits.evaluation;

import da.aau.kah.bits.exceptions.InvalidDatabaseConfig;
import dk.aau.kah.bits.database.DatabaseConfig;
import dk.aau.kah.bits.database.DatabaseHandler;

public class ExperimentFactory {

	public ExperimentFactory() {

	}

	public AbstractEvaluationHandler makeEvaluation(DatabaseHandler databaseHandle, DatabaseConfig databaseConfig) throws InvalidDatabaseConfig {
		String datasetType = databaseConfig.getDatasetType();
		AbstractEvaluationHandler evaluationhandler;

		if (datasetType.equals("TPC-H")) {
			evaluationhandler = new EvaluationHandlerTPCH(databaseHandle);
		} else {
			throw new InvalidDatabaseConfig("The Dataset Type "+databaseConfig.getDatasetType()+" is not known, implementation is missing.");
		}
		return evaluationhandler;
	}

}

package dk.aau.kah.bits.evaluation;

import da.aau.kah.bits.exceptions.InvalidDatabaseConfig;
import dk.aau.kah.bits.database.DatabaseConfig;
import dk.aau.kah.bits.database.DatabaseHandler;

public class ExperimentFactory {

	public ExperimentFactory() {

	}

	public AbstractExperimentHandler makeEvaluation(DatabaseHandler databaseHandle, DatabaseConfig databaseConfig) throws InvalidDatabaseConfig {
		String datasetType = databaseConfig.getDatasetType();
		AbstractExperimentHandler evaluationhandler;

		if (datasetType.equals("TPC-H")) {
			evaluationhandler = new ExperimentHandlerTPCH(databaseHandle);
		} else {
			throw new InvalidDatabaseConfig("The Dataset Type "+databaseConfig.getDatasetType()+" is not known, implementation is missing.");
		}
		return evaluationhandler;
	}

}

Rename some functions to experiment instead of evaluation


package com.telus.training.ex1;

public class ClockNeedles {

	public double calculateAngle(int hours, int minutes) {
		double hoursAngle = hours*30;
		double minutesAngle = minutes*6;

		double angle = Math.abs(hoursAngle - minutesAngle);
		if(angle > 180.0) angle = angle - 180.0;
		return angle;
	}
}

package com.telus.training.ex1;

public class ClockNeedles {

	public double calculateAngleBetween(int hours, int minutes) {
		double hoursAngle = convertHoursToAngle(hours);
		double minutesAngle = convertMinutesToAngle(minutes);

		double angle = Math.abs(hoursAngle - minutesAngle);
		return (angle > 180.0) ? (angle - 180.0) : angle;
	}

	private int convertMinutesToAngle(int minutes) {
		if (minutes < 0 || minutes > 60) {
			throw new IllegalArgumentException("Minutes must be between 0 and 60");
		}
		return minutes*6;
	}

	private int convertHoursToAngle(int hours) {
		if(hours < 0 || hours > 12) {
			throw new IllegalArgumentException("Hours must be between 0 and 12");
		}
		return hours*30;
	}
}

Add checks for hours and minutes


package wissolsoft.porada.webapp.model;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.appfuse.model.User;

@Entity
@Table(name="vote")
public class Vote {

    public enum Value {

    }

    @Id
    @GeneratedValue
    private long id;

    @ManyToOne
    private Law law;

    @ManyToOne
    private User user;

    private Value value;

    public long getId() {
        return id;
    }

    public Law getLaw() {
        return law;
    }

    public User getUser() {
        return user;
    }

    public Value getValue() {
        return value;
    }

    public void setLaw(Law law) {
        this.law = law;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public void setValue(Value value) {
        this.value = value;
    }

}

package wissolsoft.porada.webapp.model;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.appfuse.model.User;

@Entity
@Table(name="vote")
public class Vote {

    public enum Value {
        /** Утримався */
        ABSTAIN,

        /** За */
        FOR,

        /** Проти  */
        AGAINST
    }

    @Id
    @GeneratedValue
    private long id;

    @ManyToOne
    private Law law;

    @ManyToOne
    private User user;

    private Value value;

    public long getId() {
        return id;
    }

    public Law getLaw() {
        return law;
    }

    public User getUser() {
        return user;
    }

    public Value getValue() {
        return value;
    }

    public void setLaw(Law law) {
        this.law = law;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public void setValue(Value value) {
        this.value = value;
    }

}

Add values to vote enum


package squeek.veganoption.integration.magicalcrops;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import squeek.veganoption.content.registry.CompostRegistry;
import squeek.veganoption.content.registry.CompostRegistry.FoodSpecifier;
import squeek.veganoption.integration.IntegratorBase;

public class MagicalCrops extends IntegratorBase
{
	@Override
	public void init()
	{
		super.init();

		CompostRegistry.blacklist(new FoodSpecifier()
		{
			private final Set<String> itemNameBlacklist = new HashSet<String>(
					Arrays.asList(
									fullItemName("magicalcrops_PotionPetals"),
									fullItemName("magicalcrops_FoodJuice"),
									fullItemName("magicalcrops_FoodStew")
							)
					);

			@Override
			public boolean matches(ItemStack itemStack)
			{
				// meat and diamonds are bad for composting
				String itemName = Item.itemRegistry.getNameForObject(itemStack.getItem());
				return itemNameBlacklist.contains(itemName);
			}
		});
	}
}

package squeek.veganoption.integration.magicalcrops;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import squeek.veganoption.content.ContentHelper;
import squeek.veganoption.content.registry.CompostRegistry;
import squeek.veganoption.content.registry.CompostRegistry.FoodSpecifier;
import squeek.veganoption.integration.IntegratorBase;

public class MagicalCrops extends IntegratorBase
{
	@Override
	public void oredict()
	{
		if (getItem("magicalcrops_SeedsGrape") != null)
			OreDictionary.registerOre(ContentHelper.grapeSeedOreDict, new ItemStack(getItem("magicalcrops_SeedsGrape")));
	}

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

		CompostRegistry.blacklist(new FoodSpecifier()
		{
			private final Set<String> itemNameBlacklist = new HashSet<String>(
					Arrays.asList(
									fullItemName("magicalcrops_PotionPetals"),
									fullItemName("magicalcrops_FoodJuice"),
									fullItemName("magicalcrops_FoodStew")
							)
					);

			@Override
			public boolean matches(ItemStack itemStack)
			{
				// meat and diamonds are bad for composting
				String itemName = Item.itemRegistry.getNameForObject(itemStack.getItem());
				return itemNameBlacklist.contains(itemName);
			}
		});
	}
}

Add magical crops grape seeds to grape seed oredict


/*
 * Copyright (c) 2016 Owen Bennett.
 *  You may use, distribute and modify this code under the terms of the MIT licence.
 *  You should have obtained a copy of the MIT licence with this software,
 *  if not please obtain one from https://opensource.org/licences/MIT
 *
 *
 *
 */

package org.frostbite.karren.listeners;

import org.frostbite.karren.Karren;
import org.knowm.yank.Yank;
import sx.blah.discord.api.events.IListener;
import sx.blah.discord.handle.impl.events.ReadyEvent;

import java.util.Properties;

import static org.frostbite.karren.Karren.conf;

public class ConnectCommand implements IListener<ReadyEvent>{

    @Override
    public void handle(ReadyEvent event){
        //Initialize database connection pool
        Karren.log.info("Initializing Yank database pool");
        Properties dbSettings = new Properties();
        dbSettings.setProperty("jdbcUrl", "jdbc:mysql://" + conf.getSqlhost() + ":" + conf.getSqlport() + "/" + conf.getSqldb() + "?useUnicode=true&characterEncoding=UTF-8");
        dbSettings.setProperty("username", Karren.conf.getSqluser());
        dbSettings.setProperty("password", Karren.conf.getSqlpass());

        Yank.setupDefaultConnectionPool(dbSettings);
    }
}

/*
 * Copyright (c) 2016 Owen Bennett.
 *  You may use, distribute and modify this code under the terms of the MIT licence.
 *  You should have obtained a copy of the MIT licence with this software,
 *  if not please obtain one from https://opensource.org/licences/MIT
 *
 *
 *
 */

package org.frostbite.karren.listeners;

import org.frostbite.karren.Karren;
import org.knowm.yank.Yank;
import sx.blah.discord.api.events.IListener;
import sx.blah.discord.handle.impl.events.ReadyEvent;

import java.util.Properties;

import static org.frostbite.karren.Karren.conf;

public class ConnectCommand implements IListener<ReadyEvent>{

    @Override
    public void handle(ReadyEvent event){
        //Initialize database connection pool
        Karren.log.info("Initializing Yank database pool");
        Properties dbSettings = new Properties();
        dbSettings.setProperty("jdbcUrl", "jdbc:mysql://" + conf.getSqlhost() + ":" + conf.getSqlport() + "/" + conf.getSqldb() + "?useUnicode=true&characterEncoding=UTF-8");
        dbSettings.setProperty("username", Karren.conf.getSqluser());
        dbSettings.setProperty("password", Karren.conf.getSqlpass());

        Yank.setupDefaultConnectionPool(dbSettings);

        event.getClient().online("KarrenSama Ver." + Karren.botVersion);
    }
}

Set status line to display current version


package water;

import org.junit.BeforeClass;
import org.junit.Test;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;

import static org.junit.Assert.*;

public class TypeMapTest extends TestUtil {

    @BeforeClass()
    public static void setup() { stall_till_cloudsize(1); }

    @Test
    public void testPrintTypeMap() {
        TypeMap.printTypeMap(System.out);
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        try (PrintStream ps = new PrintStream(os)) {
            TypeMap.printTypeMap(ps);
        }
        String output = os.toString();
        String[] lines = output.split("\n");
        String[] bootstrapClasses = TypeMap.bootstrapClasses();
        assertTrue(bootstrapClasses.length >= lines.length);
        for (int i = 0; i < bootstrapClasses.length; i++) {
            assertEquals(i + " -> " + bootstrapClasses[i] + " (map: " + i + ")", lines[i]);
        }
    }

}

package water;

import org.junit.BeforeClass;
import org.junit.Test;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;

import static org.junit.Assert.*;

public class TypeMapTest extends TestUtil {

    @BeforeClass()
    public static void setup() { stall_till_cloudsize(1); }

    @Test
    public void testPrintTypeMap() {
        TypeMap.printTypeMap(System.out);
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        try (PrintStream ps = new PrintStream(os)) {
            TypeMap.printTypeMap(ps);
        }
        String output = os.toString();
        String[] lines = output.split("\n");
        String[] bootstrapClasses = TypeMap.bootstrapClasses();
        assertTrue(bootstrapClasses.length <= lines.length);
        for (int i = 0; i < bootstrapClasses.length; i++) {
            assertEquals(i + " -> " + bootstrapClasses[i] + " (map: " + i + ")", lines[i]);
        }
    }

}

Fix an assertion in test


package org.pentaho.ui.xul.components;

import java.util.List;

import org.pentaho.ui.xul.XulComponent;
import org.pentaho.ui.xul.binding.InlineBindingExpression;
import org.pentaho.ui.xul.util.ColumnType;

public interface XulTreeCol extends XulComponent {

  public void setEditable(boolean edit);
  public boolean isEditable();

  public void setFixed(boolean fixed);
  public boolean isFixed();

  public void setHidden(boolean hide);
  public boolean isHidden();

  public void setLabel(String label);
  public String getLabel();

  public void setPrimary(boolean primo);
  public boolean isPrimary();

  public void setSortActive(boolean sort);
  public boolean isSortActive();

  public void setSortDirection(String dir);
  public String getSortDirection();

  public void setSrc(String srcUrl);
  public String getSrc();

  public void setType(String type);
  public String getType();
  public ColumnType getColumnType();

  public void setWidth(int width);
  public int getWidth();

  public void autoSize();

  public String getCustomeditor();
  public void setCustomeditor(String customClass);

  public void setBinding(String binding);
  public String getBinding();
  public List<InlineBindingExpression> getBindingExpressions();

}

package org.pentaho.ui.xul.components;

import java.util.List;

import org.pentaho.ui.xul.XulComponent;
import org.pentaho.ui.xul.binding.InlineBindingExpression;
import org.pentaho.ui.xul.util.ColumnType;

public interface XulTreeCol extends XulComponent {

  public void setEditable(boolean edit);
  public boolean isEditable();

  public void setFixed(boolean fixed);
  public boolean isFixed();

  public void setHidden(boolean hide);
  public boolean isHidden();

  public void setLabel(String label);
  public String getLabel();

  public void setPrimary(boolean primo);
  public boolean isPrimary();

  public void setSortActive(boolean sort);
  public boolean isSortActive();

  public void setSortDirection(String dir);
  public String getSortDirection();

  public void setSrc(String srcUrl);
  public String getSrc();

  public void setType(String type);
  public String getType();
  public ColumnType getColumnType();

  public void setWidth(int width);
  public int getWidth();

  public void autoSize();

  public String getCustomeditor();
  public void setCustomeditor(String customClass);

  public void setBinding(String binding);
  public String getBinding();

  public void setChildrenbinding(String childProperty);
  public String getChildrenbinding();

  public String getCombobinding();
  public void setCombobinding(String property);

  public List<InlineBindingExpression> getBindingExpressions();

}

Support for Hierarchical trees added.


// Copyright 2020 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package ai.vespa.metricsproxy.service;

import ai.vespa.metricsproxy.metric.Metrics;

import java.io.IOException;

/**
 * Fetch metrics for a given vespa service
 *
 * @author Jo Kristian Bergum
 */
public class RemoteMetricsFetcher extends HttpMetricFetcher {

    final static String METRICS_PATH = STATE_PATH + "metrics";

    RemoteMetricsFetcher(VespaService service, int port) {
        super(service, port, METRICS_PATH);
    }

    /**
     * Connect to remote service over http and fetch metrics
     */
    public Metrics getMetrics(int fetchCount) {
        String data = "{}";
        try {
            data = getJson();
        } catch (IOException e) {
            logMessageNoResponse(errMsgNoResponse(e), fetchCount);
        }

        return createMetrics(data, fetchCount);
    }

    Metrics createMetrics(String data, int fetchCount) {
        Metrics remoteMetrics = new Metrics();
        try {
            remoteMetrics = MetricsParser.parse(data);
        } catch (Exception e) {
            handleException(e, data, fetchCount);
        }

        return remoteMetrics;
    }
}

// Copyright 2020 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package ai.vespa.metricsproxy.service;

import ai.vespa.metricsproxy.metric.Metrics;

import java.io.IOException;

/**
 * Fetch metrics for a given vespa service
 *
 * @author Jo Kristian Bergum
 */
public class RemoteMetricsFetcher extends HttpMetricFetcher {

    final static String METRICS_PATH = STATE_PATH + "metrics";

    RemoteMetricsFetcher(VespaService service, int port) {
        super(service, port, METRICS_PATH);
    }

    /**
     * Connect to remote service over http and fetch metrics
     */
    public Metrics getMetrics(int fetchCount) {
        try {
            return createMetrics(getJson(), fetchCount);
        } catch (IOException e) {
            return new Metrics();
        }
    }

    Metrics createMetrics(String data, int fetchCount) {
        Metrics remoteMetrics = new Metrics();
        try {
            remoteMetrics = MetricsParser.parse(data);
        } catch (Exception e) {
            handleException(e, data, fetchCount);
        }

        return remoteMetrics;
    }
}

Reduce logging noise when metric fetching fails


// Copyright (C) 2009 The Android Open Source Project
//
// 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.google.gerrit.server;

/** How the {@link CurrentUser} is accessing Gerrit. */
public enum AccessPath {
  /** An unknown access path, probably should not be special. */
  UNKNOWN,

  /** Access through the REST API. */
  REST_API,

  /** Access through the old JSON-RPC interface. */
  JSON_RPC,

  /** Access by a web cookie. This path is not protected like REST_API. */
  WEB_BROWSER,

  /** Access through an SSH command that is not invoked by Git. */
  SSH_COMMAND,

  /** Access from a Git client using any Git protocol. */
  GIT
}

// Copyright (C) 2009 The Android Open Source Project
//
// 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.google.gerrit.server;

/** How the {@link CurrentUser} is accessing Gerrit. */
public enum AccessPath {
  /** An unknown access path, probably should not be special. */
  UNKNOWN,

  /** Access through the REST API. */
  REST_API,

  /** Access through the old JSON-RPC interface. */
  JSON_RPC,

  /** Access through an SSH command that is not invoked by Git. */
  SSH_COMMAND,

  /** Access from a Git client using any Git protocol. */
  GIT
}

Remove unused WEB_BROWSER access path


package liquibase.datatype.core;

import liquibase.database.Database;
import liquibase.database.core.*;
import liquibase.datatype.DataTypeInfo;
import liquibase.datatype.DatabaseDataType;
import liquibase.datatype.LiquibaseDataType;

@DataTypeInfo(name="double", aliases = {"java.sql.Types.DOUBLE", "java.lang.Double"}, minParameters = 0, maxParameters = 2, priority = LiquibaseDataType.PRIORITY_DEFAULT)
public class DoubleType  extends LiquibaseDataType {
    @Override
    public DatabaseDataType toDatabaseDataType(Database database) {
        if (database instanceof MSSQLDatabase) {
            return new DatabaseDataType("FLOAT");
        }
        if (database instanceof DB2Database || database instanceof DerbyDatabase || database instanceof HsqlDatabase || database instanceof MySQLDatabase) {
            return new DatabaseDataType("DOUBLE");
        }
        if (database instanceof OracleDatabase) {
            return new DatabaseDataType("FLOAT", 24);
        }
        if (database instanceof PostgresDatabase) {
            return new DatabaseDataType("DOUBLE PRECISION");
        }
        if (database instanceof InformixDatabase) {
            return new DatabaseDataType("DOUBLE PRECISION");
        }
        return super.toDatabaseDataType(database);
    }
}

package liquibase.datatype.core;

import liquibase.database.Database;
import liquibase.database.core.*;
import liquibase.datatype.DataTypeInfo;
import liquibase.datatype.DatabaseDataType;
import liquibase.datatype.LiquibaseDataType;

@DataTypeInfo(name="double", aliases = {"java.sql.Types.DOUBLE", "java.lang.Double"}, minParameters = 0, maxParameters = 2, priority = LiquibaseDataType.PRIORITY_DEFAULT)
public class DoubleType  extends LiquibaseDataType {
    @Override
    public DatabaseDataType toDatabaseDataType(Database database) {
        if (database instanceof MSSQLDatabase) {
            return new DatabaseDataType("FLOAT");
        }
        if (database instanceof DB2Database || database instanceof DerbyDatabase || database instanceof HsqlDatabase || database instanceof MySQLDatabase) {
            return new DatabaseDataType("DOUBLE");
        }
        if (database instanceof OracleDatabase) {
            return new DatabaseDataType("FLOAT", 24);
        }
        if (database instanceof PostgresDatabase) {
            return new DatabaseDataType("DOUBLE PRECISION");
        }
        if (database instanceof InformixDatabase) {
            return new DatabaseDataType("DOUBLE PRECISION");
        }
        if (database instanceof FirebirdDatabase) {
            return new DatabaseDataType("DOUBLE PRECISION");
        }
        return super.toDatabaseDataType(database);
    }
}

Use double precision for double with Firebird


/*
 * Copyright (c) 2016 Nextiva, Inc. to Present.
 * All rights reserved.
 */
package org.apache.logging.log4j.spi;

/**
 * Interface to be implemented by LoggerContext's that provide a shutdown method.
 * @since 2.6
 */
public interface Terminable {

    /**
     * Requests that the logging implementation shut down.
     */
    void terminate();
}

/*
 * Copyright (c) 2016 Nextiva, Inc. to Present.
 * All rights reserved.
 */
package org.apache.logging.log4j.spi;

/**
 * Interface to be implemented by LoggerContext's that provide a shutdown method.
 * @since 2.6
 */
public interface Terminable {

    /**
     * Requests that the logging implementation shut down.
     *
     * This call is synchronous and will block until shut down is complete.
     * This may include flushing pending log events over network connections.
     */
    void terminate();
}

Document that the terminate method is blocking.


package mafiaclient;

/**
 * MafiaClient.java
 * Contains the MafiaClient class
 * @author Cory Gehr (cmg5573)
 */
public class MafiaClient {

    public static String HOST_NAME;
    public static int PORT_NUMBER = 65004;

    /**
     * main()
     * Entry point for the MafiaClient application
     * @param args Command Line arguments
     */
    public static void main(String[] args) {

        if(args.length > 0) {
            // Host name set
            HOST_NAME = args[0];
        } else {
            // Host name not set, run on localhost
            HOST_NAME = "localhost";
        }

        // Start client connection
        ClientServerConnectionStarter connection =
                new ClientServerConnectionStarter(HOST_NAME, PORT_NUMBER);
        connection.start();

    }
}

package mafiaclient;

/**
 * MafiaClient.java
 * Contains the MafiaClient class
 * @author Cory Gehr (cmg5573)
 */
public class MafiaClient {

    public static String HOST_NAME;
    public static int PORT_NUMBER = 65004;

    /**
     * main()
     * Entry point for the MafiaClient application
     * @param args Command Line arguments
     */
    public static void main(String[] args) {

        if(args.length == 2) {
            // Host name set
            HOST_NAME = args[0];
            PORT_NUMBER = Integer.parseInt(args[1]);
        } else {
            // Host name not set, run on localhost
            HOST_NAME = "localhost";
            PORT_NUMBER = 65004;
        }

        // Start client connection
        ClientServerConnectionStarter connection =
                new ClientServerConnectionStarter(HOST_NAME, PORT_NUMBER);
        connection.start();

    }
}

Use CLI for arguments in client


/**
 * redpen: a text inspection tool
 * Copyright (c) 2014-2015 Recruit Technologies Co., Ltd. and contributors
 * (see CONTRIBUTORS.md)
 *
 * 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 cc.redpen.validator.section;

import cc.redpen.model.Section;
import cc.redpen.validator.Validator;

/**
 * Validate paragraph number. If a section has paragraphs more than specified,
 * This validator reports it.
 */
final public class ParagraphNumberValidator extends Validator {
    public ParagraphNumberValidator() {
        super("max_num", 5); // Default maximum number of paragraphs in a section.
    }

    @Override
    public void validate(Section section) {
        int paragraphNumber = section.getNumberOfParagraphs();
        if (getInt("max_num") < paragraphNumber) {
            addLocalizedError(section.getJoinedHeaderContents(), paragraphNumber);
        }
    }
}

/**
 * redpen: a text inspection tool
 * Copyright (c) 2014-2015 Recruit Technologies Co., Ltd. and contributors
 * (see CONTRIBUTORS.md)
 *
 * 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 cc.redpen.validator.section;

import cc.redpen.model.Section;
import cc.redpen.validator.Validator;

/**
 * Validate paragraph number. If a section has paragraphs more than specified,
 * This validator reports it.
 */
final public class ParagraphNumberValidator extends Validator {
    public ParagraphNumberValidator() {
        super("max_num", 5); // Default maximum number of paragraphs in a section.
    }

    @Override
    public void validate(Section section) {
        int paragraphNumber = section.getNumberOfParagraphs();
        if (getInt("max_num") < paragraphNumber) {
            addLocalizedError(section.getJoinedHeaderContents(), getInt("max_num"));
        }
    }
}

Fix error mssage of ParagraphNumber


/*
 * 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.peta2kuba.sample_data;

import java.io.IOException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

/**
 *
 * @author skornok
 */
@Component
@Transactional //transactions are handled on facade layer
public class SampleDataLoadingFacadeImpl implements SampleDataLoadingFacade {

    final static Logger log = LoggerFactory.getLogger(SampleDataLoadingFacadeImpl.class);

    @Override
    @SuppressWarnings("unused")
    public void loadData() throws IOException {
        log.info("Loaded Haunted Houses.");

        createPeople();
        createHouses();
        createAbilities();
        createHaunters();
    }

    private void createPeople() {

    }

    private void createHouses() {

    }

    private void createAbilities() {

    }

    private void createHaunters() {

    }

}

/*
 * 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.peta2kuba.sample_data;

import java.io.IOException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

/**
 *
 * @author skornok
 */
@Component
@Transactional //transactions are handled on facade layer
public class SampleDataLoadingFacadeImpl implements SampleDataLoadingFacade {

    final static Logger log = LoggerFactory.getLogger(SampleDataLoadingFacadeImpl.class);

    @Override
    @SuppressWarnings("unused")
    public void loadData() throws IOException {
        log.info("Loaded Haunted Houses.");
    }

}

Revert "sample data structure for multithread working"


package org.yukung.sandbox.http;

import static org.yukung.sandbox.http.HttpRequest.CRLF;

import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * @author yukung
 */
public class Main {
    public static void main(String[] args) throws IOException {
        System.out.println("start >>>");

        try (
            ServerSocket ss = new ServerSocket(8080);
            Socket socket = ss.accept();
            InputStream in = socket.getInputStream();
            BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()))
        ) {
            HttpRequest request = new HttpRequest(in);

            System.out.println(request.getHeaderText());
            System.out.println(request.getBodyText());

            bw.write("HTTP/1.1 200 OK" + CRLF);
        }

        System.out.println("<<< end");
    }
}

package org.yukung.sandbox.http;

import static org.yukung.sandbox.http.HttpRequest.*;

import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * @author yukung
 */
public class Main {
    public static void main(String[] args) throws IOException {
        System.out.println("start >>>");

        try (
            ServerSocket ss = new ServerSocket(8080);
            Socket socket = ss.accept();
            InputStream in = socket.getInputStream();
            BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()))
        ) {
            HttpRequest request = new HttpRequest(in);

            System.out.println(request.getHeaderText());
            System.out.println(request.getBodyText());

            bw.write("HTTP/1.1 200 OK" + CRLF);
            bw.write("Content-Type: text/html" + CRLF);
            bw.write(CRLF);
            bw.write("
Hello World!
");
        }

        System.out.println("<<< end");
    }
}

Return the simple response header and response body.


package com.smartdragons.interactivestory;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

public class MainActivity extends AppCompatActivity {

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

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }
}

package com.smartdragons.interactivestory;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

    private EditText mNameField;
    private Button mStartButton;

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

        mNameField = (EditText) findViewById(R.id.nameEditText);
        mStartButton = (Button) findViewById(R.id.startButton);

        mStartButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String name = mNameField.getText().toString();
                Toast.makeText(MainActivity.this, name, Toast.LENGTH_LONG).show();
            }
        });
    }
}

Set click listener to button and show name in a toast


// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.security.tls;

import java.util.Arrays;

/**
 * @author bjorncs
 */
public enum MixedMode {
    PLAINTEXT_CLIENT_MIXED_SERVER("plaintext_client_mixed_server"),
    TLS_CLIENT_MIXED_SERVER("tls_client_mixed_server");

    final String configValue;

    MixedMode(String configValue) {
        this.configValue = configValue;
    }

    public String configValue() {
        return configValue;
    }

    static MixedMode fromConfigValue(String configValue) {
        return Arrays.stream(values())
                .filter(v -> v.configValue.equals(configValue))
                .findFirst()
                .orElseThrow(() -> new IllegalArgumentException("Unknown value: " + configValue));
    }
}

// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.security.tls;

import java.util.Arrays;

/**
 * @author bjorncs
 */
public enum MixedMode {
    PLAINTEXT_CLIENT_MIXED_SERVER("plaintext_client_mixed_server"),
    TLS_CLIENT_MIXED_SERVER("tls_client_mixed_server"),
    DISABLED("tls_client_tls_server");

    final String configValue;

    MixedMode(String configValue) {
        this.configValue = configValue;
    }

    public String configValue() {
        return configValue;
    }

    /**
     * @return Default value when mixed mode is not explicitly specified
     */
    public static MixedMode defaultValue() {
        return DISABLED;
    }

    static MixedMode fromConfigValue(String configValue) {
        return Arrays.stream(values())
                .filter(v -> v.configValue.equals(configValue))
                .findFirst()
                .orElseThrow(() -> new IllegalArgumentException("Unknown value: " + configValue));
    }
}

Add 'tls_client_tls_server' as tls mixed mode option


/*
 * Copyright (C) 2008 XStream Committers.
 * All rights reserved.
 *
 * The software in this package is published under the terms of the BSD
 * style license a copy of which has been included with this distribution in
 * the LICENSE.txt file.
 *
 * Created on 13. October 2008 by Joerg Schaible
 */
package com.thoughtworks.xstream.core.util;

public final class FastField {
    private final String name;
    private final Class declaringClass;

    public FastField(Class definedIn, String name) {
        this.name = name;
        this.declaringClass = definedIn;
    }

    public String getName() {
        return this.name;
    }

    public Class getDeclaringClass() {
        return this.declaringClass;
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (this == null) {
            return false;
        }
        if (obj.getClass() == FastField.class) {
            final FastField field = (FastField)obj;
            return name.equals(field.getName())
                && declaringClass.equals(field.getDeclaringClass());
        }
        return false;
    }

    public int hashCode() {
        return name.hashCode() ^ declaringClass.hashCode();
    }

    public String toString() {
        return declaringClass.getName() + "[" + name + "]";
    }
}

/*
 * Copyright (C) 2008, 2010 XStream Committers.
 * All rights reserved.
 *
 * The software in this package is published under the terms of the BSD
 * style license a copy of which has been included with this distribution in
 * the LICENSE.txt file.
 *
 * Created on 13. October 2008 by Joerg Schaible
 */
package com.thoughtworks.xstream.core.util;

public final class FastField {
    private final String name;
    private final Class declaringClass;

    public FastField(Class definedIn, String name) {
        this.name = name;
        this.declaringClass = definedIn;
    }

    public String getName() {
        return this.name;
    }

    public Class getDeclaringClass() {
        return this.declaringClass;
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (this == null) {
            return false;
        }
        if (obj.getClass() == FastField.class) {
            final FastField field = (FastField)obj;
            if ((declaringClass == null && field.declaringClass != null)
                || (declaringClass != null && field.declaringClass == null)) {
                return false;
            }
            return name.equals(field.getName())
                && (declaringClass == null || declaringClass.equals(field.getDeclaringClass()));
        }
        return false;
    }

    public int hashCode() {
        return name.hashCode() ^ (declaringClass == null ? 0 : declaringClass.hashCode());
    }

    public String toString() {
        return (declaringClass == null ? "" : declaringClass.getName() + ".") + name;
    }
}

Allow null as defining class.


package ru.sfwt.mt.addressbook.tests;

import org.testng.Assert;
import org.testng.annotations.Test;
import ru.sfwt.mt.addressbook.model.GroupData;

import java.util.HashSet;
import java.util.List;

public class GroupCreationTests extends TestBase{

  @Test
  public void testGroupCreation() {
    app.getNavigationHelper().gotoGroupPage();
    List<GroupData> before = app.getGroupHelper().getGroupList();
    GroupData group = new GroupData("test1", null, null);
    app.getGroupHelper().createGroup(group);
    List<GroupData> after = app.getGroupHelper().getGroupList();
    Assert.assertEquals(after.size(), before.size() +1);

    int max = 0;
    for (GroupData g : after) {
      if (g.getId() > max) {
        max = g.getId();
      }
    }
    group.setId(max);
    before.add(group);
    Assert.assertEquals(new HashSet<Object>(before), new HashSet<Object>(after));
  }
}

package ru.sfwt.mt.addressbook.tests;

import org.testng.Assert;
import org.testng.annotations.Test;
import ru.sfwt.mt.addressbook.model.GroupData;

import java.util.Comparator;
import java.util.HashSet;
import java.util.List;

public class GroupCreationTests extends TestBase{

  @Test
  public void testGroupCreation() {
    app.getNavigationHelper().gotoGroupPage();
    List<GroupData> before = app.getGroupHelper().getGroupList();
    GroupData group = new GroupData("test5", null, null);
    app.getGroupHelper().createGroup(group);
    List<GroupData> after = app.getGroupHelper().getGroupList();
    Assert.assertEquals(after.size(), before.size() +1);

  //  int max = 0;
  //  for (GroupData g : after) {
  //    if (g.getId() > max) {
  //      max = g.getId();
  //    }
  //  }

    group.setId(after.stream().max((Comparator<GroupData>) (o1, o2) -> Integer.compare(o1.getId(), o2.getId())).get().getId());
    before.add(group);
    Assert.assertEquals(new HashSet<Object>(before), new HashSet<Object>(after));
  }
}

Create lambda instead of IF in GroupCreationTest


/*
 * 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 com.sun.jini.constants;

/**
 * Interface that holds the version string for the current release
 *
 * @author Sun Microsystems, Inc.
 *
 */
public interface VersionConstants {
    /** Current version of the Apache River release */
    String SERVER_VERSION = "2.1.1";
}

/*
 * 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 com.sun.jini.constants;

/**
 * Interface that holds the version string for the current release
 *
 * @author Sun Microsystems, Inc.
 *
 */
public interface VersionConstants {
    /** Current version of the Apache River release */
    String SERVER_VERSION = "2.1.2";
}

Change River release version to v2.1.2 from v2.1.1


package com.woopra.java.sdk;

import java.util.HashMap;

public class WoopraVisitor {

	public static String EMAIL = "email";
	public static String UNIQUE_ID = "uniqueId";

	protected HashMap<String, Object> properties = new HashMap<String, Object>();
	private String ipAddress = "";
	private String cookieValue = "";
	private String userAgent = "";

	public WoopraVisitor(String identifier, String value) {
		if (identifier.equals(WoopraVisitor.EMAIL)) {
			properties.put(WoopraVisitor.EMAIL, value);
			this.cookieValue = String.valueOf(Math.abs(value.hashCode()));
		} else if (identifier.equals(WoopraVisitor.UNIQUE_ID)) {
			this.cookieValue = value;
		}
	}

	public void setIpAddress(String ipAddress) {
		this.ipAddress = ipAddress;
	}

	public void setUserAgent(String userAgent) {
		this.userAgent = userAgent;
	}

	public void setProperty(String key, Object value) {
		this.properties.put(key, value);
	}

	public String toString() {
		return this.properties.toString();
	}
}

package com.woopra.java.sdk;

import java.util.HashMap;

public class WoopraVisitor {

	public static String EMAIL = "email";
	public static String UNIQUE_ID = "uniqueId";

	protected HashMap<String, Object> properties = new HashMap<String, Object>();
	private String ipAddress = "";
	private String cookieValue = "";
	private String userAgent = "";

	public WoopraVisitor(String identifier, String value) {
		if (identifier.equals(WoopraVisitor.EMAIL)) {
			properties.put(WoopraVisitor.EMAIL, value);
			this.cookieValue = String.valueOf(Math.abs(value.hashCode()));
		} else if (identifier.equals(WoopraVisitor.UNIQUE_ID)) {
			this.cookieValue = value;
		}
	}

	public void setIpAddress(String ipAddress) {
		this.ipAddress = ipAddress;
	}

	public void setUserAgent(String userAgent) {
		this.userAgent = userAgent;
	}

	public void setProperty(String key, Object value) {
		this.properties.put(key, value);
	}

	public String toString() {
		return this.properties.toString();
	}

        public String getCookieValue() {
            return this.cookieValue;
        }

        public String getIpAddress() {
            return this.ipAddress;
        }

        public String getUserAgent() {
            return this.userAgent;
        }
}

Add getters for visitor/visit properties.


/*
 * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
 * Use of this file is governed by the BSD 3-clause license that
 * can be found in the LICENSE.txt file in the project root.
 */

package org.antlr.v4.runtime;

import org.antlr.v4.runtime.misc.Pair;

/** The default mechanism for creating tokens. It's used by default in Lexer and
 *  the error handling strategy (to create missing tokens).  Notifying the parser
 *  of a new factory means that it notifies it's token source and error strategy.
 */
public interface TokenFactory<Symbol extends Token> {
	/** This is the method used to create tokens in the lexer and in the
	 *  error handling strategy. If text!=null, than the start and stop positions
	 *  are wiped to -1 in the text override is set in the CommonToken.
	 */
	Symbol create(Pair<TokenSource, CharStream> source, int type, String text,
				  int channel, int start, int stop,
				  int line, int charPositionInLine);

	/** Generically useful */
	Symbol create(int type, String text);
}

/*
 * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
 * Use of this file is governed by the BSD 3-clause license that
 * can be found in the LICENSE.txt file in the project root.
 */

package org.antlr.v4.runtime;

import org.antlr.v4.runtime.misc.Pair;

/** The default mechanism for creating tokens. It's used by default in Lexer and
 *  the error handling strategy (to create missing tokens).  Notifying the parser
 *  of a new factory means that it notifies its token source and error strategy.
 */
public interface TokenFactory<Symbol extends Token> {
	/** This is the method used to create tokens in the lexer and in the
	 *  error handling strategy. If text!=null, than the start and stop positions
	 *  are wiped to -1 in the text override is set in the CommonToken.
	 */
	Symbol create(Pair<TokenSource, CharStream> source, int type, String text,
				  int channel, int start, int stop,
				  int line, int charPositionInLine);

	/** Generically useful */
	Symbol create(int type, String text);
}

Fix minor typo: possessive "its"


package com.github.aureliano.edocs.app;

import javax.swing.SwingUtilities;

import com.github.aureliano.edocs.app.gui.AppFrame;

public class EdocsApp {

	private AppFrame frame;

	public EdocsApp() {
		this.frame = new AppFrame();
	}

	public AppFrame getFrame() {
		return this.frame;
	}

	public static void main(String[] args) {
		final EdocsApp application = new EdocsApp();

		SwingUtilities.invokeLater(new Runnable() {

			@Override
			public void run() {
				application.getFrame().showFrame();
			}
		});
	}
}

package com.github.aureliano.edocs.app;

import javax.swing.SwingUtilities;

import com.github.aureliano.edocs.app.gui.AppFrame;

public class EdocsApp {

	private static EdocsApp instance;
	private AppFrame frame;

	public static void main(String[] args) {
		final EdocsApp application = new EdocsApp();

		SwingUtilities.invokeLater(new Runnable() {

			@Override
			public void run() {
				application.getFrame().showFrame();
			}
		});
	}

	public static EdocsApp instance() {
		if (instance == null) {
			instance = new EdocsApp();
		}

		return instance;
	}

	public EdocsApp() {
		this.frame = new AppFrame();
	}

	public AppFrame getFrame() {
		return this.frame;
	}
}

Make main frame visible by other components.


package edu.agh.tunev.model.cellular.agent;

import java.awt.geom.Point2D;

import edu.agh.tunev.model.AbstractPerson;

public final class Person extends AbstractPerson {

	public enum Orientation{
		E, NE, N, NW, W, SW, S, SE
	}

	public Person(Point2D.Double position) {
		super(position);
	}

	public static Double orientToAngle(Orientation orient) throws WrongOrientationException{
		//starting at east
		Double angle = 0.0;
		Person.Orientation[] orientValues = Person.Orientation.values();

		//TODO: more sensible error handling
		for(int i = 0; i < orientValues.length && orient != orientValues[i]; ++i){
			angle += 45.0;
		}

		if(angle > 315)
			throw new WrongOrientationException();
		else
			return angle;
	}

}

package edu.agh.tunev.model.cellular.agent;

import java.awt.geom.Point2D;

import edu.agh.tunev.model.AbstractPerson;

public final class Person extends AbstractPerson {

	public static final class WrongOrientationException extends Exception {

		private static final long serialVersionUID = 1L;

	}

	public enum Orientation{
		E, NE, N, NW, W, SW, S, SE
	}

	public Person(Point2D.Double position) {
		super(position);
	}

	public static Double orientToAngle(Orientation orient) throws WrongOrientationException{
		//starting at east
		Double angle = 0.0;
		Person.Orientation[] orientValues = Person.Orientation.values();

		//TODO: more sensible error handling
		for(int i = 0; i < orientValues.length && orient != orientValues[i]; ++i){
			angle += 45.0;
		}

		if(angle > 315)
			throw new WrongOrientationException();
		else
			return angle;
	}

}

Throw WrongOrientationException (resolving compile-time issues)


package lejos.mf.common;

public enum UnitMessageType {
	Command, Debug
}

package lejos.mf.common;

public enum UnitMessageType {
	Command, Debug, Stop, Touch, Rfid, UltraSound,
}

Add Stop, Touch, Rfid, UltraSound types for UnitMessages


package org.bouncycastle.asn1;

import java.io.IOException;

/**
 * A NULL object.
 */
public abstract class ASN1Null
    extends ASN1Object
{
    public ASN1Null()
    {
    }

    public int hashCode()
    {
        return 0;
    }

    boolean asn1Equals(
        DERObject o)
    {
        if (!(o instanceof ASN1Null))
        {
            return false;
        }

        return true;
    }

    abstract void encode(DEROutputStream out)
        throws IOException;

    public String toString()
    {
         return "NULL";
    }
}

package org.bouncycastle.asn1;

import java.io.IOException;

/**
 * A NULL object.
 */
public abstract class ASN1Null
    extends ASN1Object
{
    public ASN1Null()
    {
    }

    public int hashCode()
    {
        return -1;
    }

    boolean asn1Equals(
        DERObject o)
    {
        if (!(o instanceof ASN1Null))
        {
            return false;
        }

        return true;
    }

    abstract void encode(DEROutputStream out)
        throws IOException;

    public String toString()
    {
         return "NULL";
    }
}

Use -1 for hashCode, since 0 has the same effect as "no object" in typical cases (e.g. sequences/sets)


package benjamin.groehbiel.ch;

import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertNotNull;

@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = ApplicationTest.class)
public class JedisTest {

    @Autowired
    private JedisConnectionFactory jedisConnectionFactory;

    @Autowired
    private StringRedisTemplate redisTemplate;

    @After
    public void tearDown() {
        redisTemplate.getConnectionFactory().getConnection().flushDb();
    }

    @Test
    public void testJedisConnectionFactory() {
        assertNotNull(jedisConnectionFactory);
    }

    @Test
    public void testRedisTemplate() {
        assertNotNull(redisTemplate);
    }

    @Test
    public void addEntry() {
        Long index = redisTemplate.opsForList().rightPush("ben", "grohbiel");
        assertThat(index, equalTo(1L));
    }

    @Test
    public void getEntry() {
        redisTemplate.opsForList().rightPush("ben", "grohbiel");
        String s = redisTemplate.opsForValue().get("ben");
        Assert.assertThat(s, equalTo("grohbiel"));
    }

}

package benjamin.groehbiel.ch;

import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertNotNull;

@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = ApplicationTest.class)
public class JedisTest {

    @Autowired
    private JedisConnectionFactory jedisConnectionFactory;

    @Autowired
    private StringRedisTemplate redisTemplate;

    @After
    public void tearDown() {
        redisTemplate.getConnectionFactory().getConnection().flushDb();
    }

    @Test
    public void testJedisConnectionFactory() {
        assertNotNull(jedisConnectionFactory);
    }

    @Test
    public void testRedisTemplate() {
        assertNotNull(redisTemplate);
    }

    @Test
    public void addEntry() {
        Long index = redisTemplate.opsForList().rightPush("key", "value");
        assertThat(index, equalTo(1L));
    }

}

Add value to key-value store


package cs437.som.neighborhood;

import cs437.som.NeightborhoodWidthFunction;

/**
 * Neighborhood width strategy for self-organizing maps that decays the width
 * linearly as the iterations progress.
 */
public class LinearDecayNeighborhoodWidthFunction implements NeightborhoodWidthFunction {
    private final double initialNeighborhoodWidth;
    private double expectedIterations;

    public LinearDecayNeighborhoodWidthFunction(double initialWidth) {
        initialNeighborhoodWidth = initialWidth;
    }

    public void setExpectedIterations(int expectedIterations) {
        this.expectedIterations = expectedIterations;
    }

    public double neighborhoodWidth(int iteration) {
        return initialNeighborhoodWidth * (1.0 - (iteration / expectedIterations));
    }

    @Override
    public String toString() {
        return "LinearDecayNeighborhoodWidthFunction";
    }
}

package cs437.som.neighborhood;

import cs437.som.NeightborhoodWidthFunction;

/**
 * Neighborhood width strategy for self-organizing maps that decays the width
 * linearly as the iterations progress.
 *
 * The exact behavior follows the formula:
 *      w_i * (1 - (-t / t_max))
 *  where
 *      w_i   is the initial width of the neighborhood
 *      e     is the base of the natural logarithm
 *      t     is the current iteration
 *      t_max is the maximum expected iteration
 */
public class LinearDecayNeighborhoodWidthFunction implements NeightborhoodWidthFunction {
    private final double initialNeighborhoodWidth;
    private double expectedIterations = 0.0;

    public LinearDecayNeighborhoodWidthFunction(double initialWidth) {
        initialNeighborhoodWidth = initialWidth;
    }

    public void setExpectedIterations(int expectedIterations) {
        this.expectedIterations = expectedIterations;
    }

    public double neighborhoodWidth(int iteration) {
        return initialNeighborhoodWidth * (1.0 - (iteration / expectedIterations));
    }

    @Override
    public String toString() {
        return "LinearDecayNeighborhoodWidthFunction";
    }
}

Add formula comment to lin. decay NW class.


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".
        }

    }

}

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

import gov.nih.nci.calab.db.DataAccessProxy;
import gov.nih.nci.calab.db.IDataAccess;
import gov.nih.nci.calab.domain.Aliquot;
import gov.nih.nci.calab.domain.DataStatus;
import gov.nih.nci.calab.service.util.CalabConstants;

import java.util.List;

/**
 * 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) throws Exception
    {
        IDataAccess ida = (new DataAccessProxy()).getInstance(IDataAccess.HIBERNATE);

		try {
	        ida.open();

	        if (strType.equals("aliquot"))
	        {
	            //TODO Find Aliquot record based on the strID
				List aliquots = ida.search("from Aliquot aliquot where aliquot.name='" + strId + "'");
				Aliquot aliquot = (Aliquot)aliquots.get(0);
				DataStatus maskStatus = new DataStatus();
				maskStatus.setReason(strDescription);
				maskStatus.setStatus(CalabConstants.MASK_STATUS);

				aliquot.setDataStatus(maskStatus);
				ida.store(aliquot);
	        }
	        if (strType.equals("file"))
	        {
	        	//TODO Find File record based on the its strID

	        	//TODO Set File Status record to "Masked".
	        }
			ida.close();
		}catch (Exception e) {

			ida.rollback();
			ida.close();

			e.printStackTrace();
			throw new RuntimeException(e.getMessage());
		}

    }

}

Implement the mask aliquot section.


package com.example.tests;

import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import com.example.fw.ApplicationManager;

public class TestBase {

	public ApplicationManager app;

	@BeforeTest
	public void setUp() throws Exception {
		app = new ApplicationManager();
	  }

	@AfterTest
	public void tearDown() throws Exception {
		app.stop();
	  }

}

package com.example.tests;

import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import com.example.fw.ApplicationManager;

public class TestBase {

	public static ApplicationManager app;

	@BeforeTest
	public void setUp() throws Exception {
		app = new ApplicationManager();
	  }

	@AfterTest
	public void tearDown() throws Exception {
		app.stop();
	  }

}

Define app link as static


package peergos.server.tests;

import org.junit.runner.*;
import org.junit.runners.*;

import java.util.*;

@RunWith(Parameterized.class)
public class RamUserTests extends UserTests {

    public RamUserTests(Random rnd) throws Exception {
        super("RAM", rnd);
    }

    @Parameterized.Parameters()
    public static Collection<Object[]> parameters() {
        return Arrays.asList(new Object[][] {
                {new Random(1)}
        });
    }
}

package peergos.server.tests;

import org.junit.*;
import org.junit.runner.*;
import org.junit.runners.*;
import peergos.server.storage.*;

import java.util.*;

@RunWith(Parameterized.class)
public class RamUserTests extends UserTests {

    public RamUserTests(Random rnd) throws Exception {
        super("RAM", rnd);
    }

    @After
    public void clearRamIpfs() {
        RAMStorage.getSingleton().clear();
    }

    @Parameterized.Parameters()
    public static Collection<Object[]> parameters() {
        return Arrays.asList(new Object[][] {
                {new Random(1)}
        });
    }
}

Clear Ram storage between tests


package de.danoeh.antennapod.core.glide;

import android.content.Context;

import android.support.annotation.NonNull;
import com.bumptech.glide.Glide;
import com.bumptech.glide.GlideBuilder;
import com.bumptech.glide.Registry;
import com.bumptech.glide.annotation.GlideModule;
import com.bumptech.glide.load.DecodeFormat;
import com.bumptech.glide.load.engine.cache.InternalCacheDiskCacheFactory;
import com.bumptech.glide.module.AppGlideModule;

import java.io.InputStream;

import com.bumptech.glide.request.RequestOptions;
import de.danoeh.antennapod.core.preferences.UserPreferences;

/**
 * {@see com.bumptech.glide.integration.okhttp.OkHttpGlideModule}
 */
@GlideModule
public class ApGlideModule extends AppGlideModule {

    @Override
    public void applyOptions(@NonNull Context context, @NonNull GlideBuilder builder) {
        builder.setDefaultRequestOptions(new RequestOptions().format(DecodeFormat.PREFER_ARGB_8888));
        builder.setDiskCache(new InternalCacheDiskCacheFactory(context,
                UserPreferences.getImageCacheSize()));
    }

    @Override
    public void registerComponents(@NonNull Context context, @NonNull Glide glide, @NonNull Registry registry) {
        registry.append(String.class, InputStream.class, new ApOkHttpUrlLoader.Factory());
    }
}

package de.danoeh.antennapod.core.glide;

import android.content.Context;

import android.support.annotation.NonNull;
import com.bumptech.glide.Glide;
import com.bumptech.glide.GlideBuilder;
import com.bumptech.glide.Registry;
import com.bumptech.glide.annotation.GlideModule;
import com.bumptech.glide.load.DecodeFormat;
import com.bumptech.glide.load.engine.cache.InternalCacheDiskCacheFactory;
import com.bumptech.glide.module.AppGlideModule;

import java.io.InputStream;

import com.bumptech.glide.request.RequestOptions;
import de.danoeh.antennapod.core.preferences.UserPreferences;

/**
 * {@see com.bumptech.glide.integration.okhttp.OkHttpGlideModule}
 */
@GlideModule
public class ApGlideModule extends AppGlideModule {

    @Override
    public void applyOptions(@NonNull Context context, @NonNull GlideBuilder builder) {
        builder.setDefaultRequestOptions(new RequestOptions().format(DecodeFormat.PREFER_ARGB_8888));
        builder.setDiskCache(new InternalCacheDiskCacheFactory(context,
                UserPreferences.getImageCacheSize()));
    }

    @Override
    public void registerComponents(@NonNull Context context, @NonNull Glide glide, @NonNull Registry registry) {
        registry.replace(String.class, InputStream.class, new ApOkHttpUrlLoader.Factory());
    }
}

Use ApOkHttpUrlLoader for all images


import javax.annotation.Generated;
import javax.annotation.Nonnull;
import org.realityforge.arez.ArezContext;
import org.realityforge.arez.Observable;

@Generated( "org.realityforge.arez.processor.ArezProcessor" )
public final class Arez_BasicObservableModel
  extends BasicObservableModel
{
  @Nonnull
  private final ArezContext $$arez$$_context;

  @Nonnull
  private final Observable $$arez$$_time;

  public Arez_BasicObservableModel( @Nonnull final ArezContext $$arez$$_context )
  {
    super();
    this.$$arez$$_context = $$arez$$_context;
    this.$$arez$$_time =
      $$arez$$_context.createObservable( this.$$arez$$_context.areNamesEnabled() ? "BasicObservableModel.time" : null );
  }

  @Override
  public long getTime()
  {
    this.$$arez$$_time.reportObserved();
    return super.getTime();
  }

  @Override
  public void setTime( final long time )
  {
    if ( time != super.getTime() )
    {
      super.setTime( time );
      this.$$arez$$_time.reportObserved();
    }
  }
}

import javax.annotation.Generated;
import javax.annotation.Nonnull;
import org.realityforge.arez.ArezContext;
import org.realityforge.arez.Observable;

@Generated( "org.realityforge.arez.processor.ArezProcessor" )
public final class Arez_BasicObservableModel
  extends BasicObservableModel
{
  private static volatile long $$arez$$_nextId;

  private final long $$arez$$_id;

  @Nonnull
  private final ArezContext $$arez$$_context;

  @Nonnull
  private final Observable $$arez$$_time;

  public Arez_BasicObservableModel( @Nonnull final ArezContext $$arez$$_context )
  {
    super();
    this.$$arez$$_id = $$arez$$_nextId++;
    this.$$arez$$_context = $$arez$$_context;
    this.$$arez$$_time =
      $$arez$$_context.createObservable( this.$$arez$$_context.areNamesEnabled() ? $$arez$$_id() + "time" : null );
  }

  private String $$arez$$_id()
  {
    return "BasicObservableModel." + $$arez$$_id + ".";
  }

  @Override
  public long getTime()
  {
    this.$$arez$$_time.reportObserved();
    return super.getTime();
  }

  @Override
  public void setTime( final long time )
  {
    if ( time != super.getTime() )
    {
      super.setTime( time );
      this.$$arez$$_time.reportObserved();
    }
  }
}

Update code to match current generation format


package com.fruit.launcher.theme;

import android.net.Uri;

public class ThemeUtils {

	public final static String THEME_MANAGER_PACKAGE = "com.fruit.thememanager";
	public final static String THEME_PACKAGE_TOKEN = "com.fruit.launcher.theme.";
	public final static String DEFAULT_THEME_PACKAGENAME = "theme_defalt";

	public static final String AUTHORITY = THEME_MANAGER_PACKAGE + ".Settings";
	public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY
			+ "/theme");
	public static final String PACKAGE_NAME = "package_name";

	public static final String SLECTION_LAUNCHER = "category='launcherIcon'";
	public static final String SLECTION_WALLPAPER = "category='wallpaper'";

	public final static int APP_ICON_BG_MAX_COUNT = 10;
}

package com.fruit.launcher.theme;

import android.net.Uri;

public class ThemeUtils {

	public final static String THEME_MANAGER_PACKAGE = "com.fruit.thememanager";
	public final static String THEME_PACKAGE_TOKEN = "com.fruit.launcher.theme.";
	public final static String DEFAULT_THEME_PACKAGENAME = "theme_defalt";

	public static final String AUTHORITY = THEME_MANAGER_PACKAGE + ".Settings";
	public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY
			+ "/theme");
	public static final String PACKAGE_NAME = "package_name";

	public static final String SLECTION_LAUNCHER = "category='launcherIcon'";
	public static final String SLECTION_WALLPAPER = "category='wallpaper'";

	public final static int APP_ICON_BG_MAX_COUNT = 20;
}

Enlarge background icon from 10 to 20.


import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JFrame;
import javax.swing.JPanel;

public class PlayerApplication {
  public static final String title = "Sixes Wild";

  protected JFrame frame;
  protected JPanel view;

  public PlayerApplication() {
    frame = new JFrame(title);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    /*frame.addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent e) {
        System.exit(0);
      }
    });*/

    frame.pack();
    frame.setVisible(true);
  }

  public void setView(JPanel panel)
  {
    view = panel;
    frame.setContentPane(panel);
    frame.pack();
  }

  public JPanel getView()
  {
    return view;
  }

  /**
   * Creates the splash screen, loads resources, then initializes the main
   * window (PlayerApplication).
   */
  public static void main(String[] args) {
    PlayerApplication app = new PlayerApplication();

  }
}

import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JFrame;
import javax.swing.JPanel;

public class PlayerApplication {
  public static final String title = "Sixes Wild";

  protected JFrame frame;
  protected JPanel view;

  public PlayerApplication() {
    frame = new JFrame(title);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    /*frame.addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent e) {
        System.exit(0);
      }
    });*/

    frame.pack();
    frame.setVisible(true);
  }

  public void setView(JPanel panel)
  {
    view = panel;
    frame.setContentPane(panel);
    frame.pack();
  }

  public JPanel getView()
  {
    return view;
  }

  /**
   * Creates the splash screen, loads resources, then initializes the main
   * window (PlayerApplication).
   */
  public static void main(String[] args) {
    // start splash screen
    SplashScreen splash = new SplashScreen();

    // load resources

    // close splash screen

    // start main app
    PlayerApplication app = new PlayerApplication();
  }
}

Add outline for splash screen usage


package peergos.server.sql;

public class PostgresCommands implements SqlSupplier {

    @Override
    public String listTablesCommand() {
        return "SELECT tablename FROM pg_catalog.pg_tables " +
                "WHERE schemaname != 'pg_catalog' AND schemaname != 'information_schema';";
    }

    @Override
    public String tableExistsCommand() {
        return "SELECT table_name FROM information_schema.tables WHERE table_schema LIKE 'public' AND table_type LIKE 'BASE TABLE' AND table_name = '?';";
    }

    @Override
    public String createFollowRequestsTableCommand() {
        return "CREATE TABLE IF NOT EXISTS followrequests (id serial primary key, " +
                "name text not null, followrequest text not null);";
    }

    @Override
    public String insertTransactionCommand() {
        return "INSERT INTO transactions (tid, owner, hash) VALUES(?, ?, ?) ON CONFLICT DO NOTHING;";
    }

    @Override
    public String insertOrIgnoreCommand(String prefix, String suffix) {
        return prefix + suffix + " ON CONFLICT DO NOTHING;";
    }

    @Override
    public String getByteArrayType() {
        return "BYTEA";
    }

    @Override
    public String getSerialIdType() {
        return "SERIAL";
    }

    @Override
    public String sqlInteger() {
        return "BIGINT";
    }
}

package peergos.server.sql;

public class PostgresCommands implements SqlSupplier {

    @Override
    public String listTablesCommand() {
        return "SELECT tablename FROM pg_catalog.pg_tables " +
                "WHERE schemaname != 'pg_catalog' AND schemaname != 'information_schema';";
    }

    @Override
    public String tableExistsCommand() {
        return "SELECT table_name FROM information_schema.tables WHERE table_schema LIKE 'public' AND table_type LIKE 'BASE TABLE' AND table_name = ?;";
    }

    @Override
    public String createFollowRequestsTableCommand() {
        return "CREATE TABLE IF NOT EXISTS followrequests (id serial primary key, " +
                "name text not null, followrequest text not null);";
    }

    @Override
    public String insertTransactionCommand() {
        return "INSERT INTO transactions (tid, owner, hash) VALUES(?, ?, ?) ON CONFLICT DO NOTHING;";
    }

    @Override
    public String insertOrIgnoreCommand(String prefix, String suffix) {
        return prefix + suffix + " ON CONFLICT DO NOTHING;";
    }

    @Override
    public String getByteArrayType() {
        return "BYTEA";
    }

    @Override
    public String getSerialIdType() {
        return "SERIAL";
    }

    @Override
    public String sqlInteger() {
        return "BIGINT";
    }
}

Fix postgres table exists command


package org.spoofax.jsglr2.recovery;

public class RecoveryJob {

    public int backtrackChoicePointIndex;
    public int offset;
    public int iteration;
    final int iterationsQuota;
    public int quota;

    public RecoveryJob(int backtrackChoicePointIndex, int offset, int iterationsQuota) {
        this.backtrackChoicePointIndex = backtrackChoicePointIndex;
        this.offset = offset;
        this.iteration = -1;
        this.iterationsQuota = iterationsQuota;
    }

    boolean hasNextIteration() {
        return iteration < iterationsQuota;
    }

    int nextIteration() {
        quota = (++iteration + 1);

        return iteration;
    }

    public int iterationBacktrackChoicePointIndex() {
        return Math.max(backtrackChoicePointIndex - iteration, 0);
    }

}

package org.spoofax.jsglr2.recovery;

public class RecoveryJob {

    public int backtrackChoicePointIndex;
    public int offset;
    public int iteration;
    final int iterationsQuota;
    public int quota;

    public RecoveryJob(int backtrackChoicePointIndex, int offset, int iterationsQuota) {
        this.backtrackChoicePointIndex = backtrackChoicePointIndex;
        this.offset = offset;
        this.iteration = -1;
        this.iterationsQuota = iterationsQuota;
    }

    boolean hasNextIteration() {
        return iteration + 1 < iterationsQuota;
    }

    int nextIteration() {
        quota = (++iteration + 1);

        return iteration;
    }

    public int iterationBacktrackChoicePointIndex() {
        return Math.max(backtrackChoicePointIndex - iteration, 0);
    }

}

Fix recovery iterations quota checking


package org.apache.jmeter.protocol.http.util;

import java.net.URLEncoder;

import org.apache.oro.util.Cache;
import org.apache.oro.util.CacheLRU;

/**
 * @author Administrator
 *
 * To change this generated comment edit the template variable "typecomment":
 * Window>Preferences>Java>Templates.
 */
public class EncoderCache
{
    Cache cache;

    public EncoderCache(int cacheSize)
    {
       cache = new CacheLRU(cacheSize);
    }

    public String getEncoded(String k)
    {
        Object encodedValue = cache.getElement(k);
        if(encodedValue != null)
        {
            return (String)encodedValue;
        }
        encodedValue = URLEncoder.encode(k);
        cache.addElement(k,encodedValue);
        return (String)encodedValue;
    }

}

package org.apache.jmeter.protocol.http.util;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

import org.apache.oro.util.Cache;
import org.apache.oro.util.CacheLRU;

/**
 * @author Administrator
 *
 * To change this generated comment edit the template variable "typecomment":
 * Window>Preferences>Java>Templates.
 */
public class EncoderCache
{
    Cache cache;

    public EncoderCache(int cacheSize)
    {
       cache = new CacheLRU(cacheSize);
    }

    public String getEncoded(String k)
    {
        Object encodedValue = cache.getElement(k);
        if(encodedValue != null)
        {
            return (String)encodedValue;
        }
        try
        {
            encodedValue = URLEncoder.encode(k, "utf8");
        }
        catch (UnsupportedEncodingException e)
        {
            // This can't happen (how should utf8 not be supported!?!),
            // so just throw an Error:
            throw new Error(e);
        }
        cache.addElement(k,encodedValue);
        return (String)encodedValue;
    }
}

Use utf8 to encode URLs.


package org.marsik.elshelves.backend.test.config;

import org.marsik.elshelves.backend.app.spring.NoAutoscan;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@EnableAutoConfiguration
@NoAutoscan
public class EmptyApplication {
}

package org.marsik.elshelves.backend.test.config;

import org.marsik.elshelves.backend.app.spring.NoAutoscan;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@NoAutoscan
public class EmptyApplication {
}

Disable autoconfiguration for basic unit tests


package com.openxc.remote.sources;

import org.json.JSONException;
import org.json.JSONObject;

import android.util.Log;

public abstract class JsonVehicleDataSource
        extends AbstractVehicleDataSource {
    private static final String TAG = "JsonVehicleDataSource";

    public JsonVehicleDataSource() {
        super();
    }

    public JsonVehicleDataSource(VehicleDataSourceCallbackInterface callback) {
        super(callback);
    }

    protected void parseJson(String json) {
        final JSONObject message;

        try {
            message = new JSONObject(json);
        } catch(JSONException e) {
            Log.i(TAG, "Couldn't decode JSON from: " + json);
            return;
        }

        try {
            Log.d("FRING", message.toString());
            handleMessage(message.getString("name"),
                    message.getDouble("value"));
            return;
        } catch(JSONException e) {
        }
        try {
            handleMessage(message.getString("name"),
                    message.getString("value"));
        } catch(JSONException e) {
            Log.w(TAG, "JSON value wasn't a double or string -- couldn't parse",
                    e);
        }
    }
}

package com.openxc.remote.sources;

import org.json.JSONException;
import org.json.JSONObject;

import android.util.Log;

public abstract class JsonVehicleDataSource
        extends AbstractVehicleDataSource {
    private static final String TAG = "JsonVehicleDataSource";

    public JsonVehicleDataSource() {
        super();
    }

    public JsonVehicleDataSource(VehicleDataSourceCallbackInterface callback) {
        super(callback);
    }

    protected void parseJson(String json) {
        final JSONObject message;

        try {
            message = new JSONObject(json);
        } catch(JSONException e) {
            Log.i(TAG, "Couldn't decode JSON from: " + json);
            return;
        }

        try {
            handleMessage(message.getString("name"),
                    message.getDouble("value"));
            return;
        } catch(JSONException e) {
        }
        try {
            handleMessage(message.getString("name"),
                    message.getString("value"));
        } catch(JSONException e) {
            Log.w(TAG, "JSON value wasn't a double or string -- couldn't parse",
                    e);
        }
    }
}

Remove stray debug log statement.


package me.august.lumen.compile.parser.ast.expr;

import me.august.lumen.compile.scanner.Op;

public class AssignmentExpr extends BinaryExpression {

    public AssignmentExpr(IdentExpr right, Expression left) {
        super(right, left, Op.ASSIGN);
    }

}

package me.august.lumen.compile.parser.ast.expr;

import me.august.lumen.compile.codegen.BuildContext;
import me.august.lumen.compile.scanner.Op;
import org.objectweb.asm.MethodVisitor;

public class AssignmentExpr extends BinaryExpression {

    // BinaryExpression only defines left as general expression
    IdentExpr left;

    public AssignmentExpr(IdentExpr left, Expression right) {
        super(left, right, Op.ASSIGN);
        this.left = left;
    }

    @Override
    public void generate(MethodVisitor visitor, BuildContext context) {
        left.getRef().generateSetCode(visitor, (m) -> right.generate(visitor, context));
    }
}

Add assignment expression bytecode generation


package com.rnfs;

import java.util.*;

import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;

public class RNFSPackage implements ReactPackage {

  @Override
  public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
    List<NativeModule> modules = new ArrayList<>();
    modules.add(new RNFSManager(reactContext));
    return modules;
  }

  @Override
  public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
    return Arrays.<ViewManager>asList();
  }
}

package com.rnfs;

import java.util.*;

import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;

public class RNFSPackage implements ReactPackage {

  @Override
  public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
    List<NativeModule> modules = new ArrayList<>();
    modules.add(new RNFSManager(reactContext));
    return modules;
  }

  @Override
  public List<Class<? extends JavaScriptModule>> createJSModules() {
    return Collections.emptyList();
  }

  @Override
  public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
    return Arrays.<ViewManager>asList();
  }
}

Add `createJSModules()` to be compatible with latest React.


package ijx.plugin;

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

import org.openide.util.lookup.ServiceProvider;

import imagej2.plugin.PluginEntry;
import imagej2.plugin.PluginFinder;

@ServiceProvider(service=PluginFinder.class)
public class IjxPluginFinder implements PluginFinder {

	@Override
	public void findPlugins(List<PluginEntry> plugins) {
		// TODO add real implementation here.
		String pluginClass = "ijx.plugin.FooBar";
		ArrayList<String> parentMenu = new ArrayList<String>();
		parentMenu.add("Plugins");
		parentMenu.add("Foo");
		String label = "Bar";
		PluginEntry entry = new PluginEntry(pluginClass, parentMenu, label);
		plugins.add(entry);
	}

}

package ijx.plugin;

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

import org.openide.util.lookup.ServiceProvider;

import imagej2.plugin.PluginEntry;
import imagej2.plugin.PluginFinder;

@ServiceProvider(service=PluginFinder.class)
public class IjxPluginFinder implements PluginFinder {

	@Override
	public void findPlugins(List<PluginEntry> plugins) {
		// TODO -- add real implementation here
		String pluginClass = "ijx.plugin.FooBar";
		ArrayList<String> parentMenu = new ArrayList<String>();
		parentMenu.add("Plugins");
		parentMenu.add("Foo");
		String label = "Bar";
		PluginEntry entry = new PluginEntry(pluginClass, parentMenu, label);
		plugins.add(entry);
	}

	/**
	 * Tests the IJX plugin discovery mechanism,
	 * printing a list of all discovered plugins.
	 */
	public static void main(String[] args) {
		System.out.println("Finding plugins...");
		List<PluginEntry> plugins = new ArrayList<PluginEntry>();
		new IjxPluginFinder().findPlugins(plugins);
		System.out.println("Discovered plugins:");
		for (PluginEntry plugin : plugins) {
			System.out.println("\t" + plugin);
		}
		System.exit(0);
	}

}

Add main method for testing.


package org.fluentd.logger.sender;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Deque;
import java.util.LinkedList;

/**
 * Calculate exponential delay for reconnecting
 */
public class ConstantDelayReconnector implements Reconnector {
    private static final Logger LOG = LoggerFactory.getLogger(ExponentialDelayReconnector.class);

    private double wait = 50; // Default wait to 50 ms

    private int maxErrorHistorySize = 100;

    private Deque<Long> errorHistory = new LinkedList<Long>();

    public ConstantDelayReconnector() {
        errorHistory = new LinkedList<Long>();
    }

    public ConstantDelayReconnector(int wait) {
        this.wait = wait;
        errorHistory = new LinkedList<Long>();
    }

    public void addErrorHistory(long timestamp) {
        errorHistory.addLast(timestamp);
        if (errorHistory.size() > maxErrorHistorySize) {
            errorHistory.removeFirst();
        }
    }

    public boolean isErrorHistoryEmpty() {
        return errorHistory.isEmpty();
    }

    public void clearErrorHistory() {
        errorHistory.clear();
    }

    public boolean enableReconnection(long timestamp) {
        int size = errorHistory.size();
        if (size == 0) {
            return true;
        }

        return (!(timestamp - errorHistory.getLast() < wait));
    }

}

package org.fluentd.logger.sender;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Deque;
import java.util.LinkedList;

/**
 * Calculate exponential delay for reconnecting
 */
public class ConstantDelayReconnector implements Reconnector {
    private static final Logger LOG = LoggerFactory.getLogger(ConstantDelayReconnector.class);

    private double wait = 50; // Default wait to 50 ms

    private int maxErrorHistorySize = 100;

    private Deque<Long> errorHistory = new LinkedList<Long>();

    public ConstantDelayReconnector() {
        errorHistory = new LinkedList<Long>();
    }

    public ConstantDelayReconnector(int wait) {
        this.wait = wait;
        errorHistory = new LinkedList<Long>();
    }

    public void addErrorHistory(long timestamp) {
        errorHistory.addLast(timestamp);
        if (errorHistory.size() > maxErrorHistorySize) {
            errorHistory.removeFirst();
        }
    }

    public boolean isErrorHistoryEmpty() {
        return errorHistory.isEmpty();
    }

    public void clearErrorHistory() {
        errorHistory.clear();
    }

    public boolean enableReconnection(long timestamp) {
        int size = errorHistory.size();
        if (size == 0) {
            return true;
        }

        return (!(timestamp - errorHistory.getLast() < wait));
    }

}

Fix the name of the logger


import java.io.*;

class BadFloatTest {
    public static void main(String[] args)
           throws FileNotFoundException, IOException {
        float x = 1.2345f;
        double y = 9.8765;

        File inputFile = new File("example");

        System.out.println(x + " " + y);
    }
}

/* Expected Output:
1.2345 9.8765
*/

import java.io.*;

class BadFloatTest {
    public static void main(String[] args)
           throws FileNotFoundException, IOException {
        float x = 1.2545f;
        double y = 9.8544;

        File inputFile = new File("example");

        System.out.println(x + " " + y);
    }
}

/* Expected Output:
1.2545 9.8544
*/

Adjust test for new float/double printing routines.


package com.example.julian.locationservice;

import android.content.Context;

import com.meedamian.info.BasicData;

import org.json.JSONException;
import org.json.JSONObject;

public class DataUploader {

    private Context c;
    private String phone;
    private String vanity;
    private String county;
    private String city;

    public DataUploader(Context context) {
        c = context;
    }

    public void upload() {
        String key = BasicData.getPrivateId(c);

        JSONObject jo = new JSONObject();
        try {
            jo.put("key", key);

            if (phone != null)
                jo.put("phone", phone);

            // TODO: ifs

        } catch (JSONException ignored) {}
        finally {

            // send `jo`
            // as POST body
            // to https://basic-data.parseapp.com/update
        }
    }

    public DataUploader setLocation(String country, String city) {
        this.county = country;
        this.city = city;
        return this;
    }

    public DataUploader setPhone(String phone) {
        this.phone = phone;
        return this;
    }

    public DataUploader setVanity(String vanity) {
        this.vanity = vanity;
        return this;
    }
}

package com.example.julian.locationservice;

import android.content.Context;

import com.meedamian.info.BasicData;

import org.json.JSONException;
import org.json.JSONObject;

public class DataUploader {

    private Context c;
    private String phone;
    private String vanity;
    private String country;
    private String city;

    public DataUploader(Context context) {
        c = context;
    }

    public void upload() {
        String key = BasicData.getPrivateId(c);

        JSONObject jo = new JSONObject();
        try {
            jo.put("key", key);

            if (phone != null)
                jo.put("phone", phone);

            else if(vanity != null)
                jo.put("vanity", vanity);

            else if(country != null)
                jo.put("country", country);

            else if(city != null)
                jo.put("city", city);

        } catch (JSONException ignored) {}
        finally {

            // send `jo`
            // as POST body
            // to https://basic-data.parseapp.com/update
        }
    }

    public DataUploader setLocation(String country, String city) {
        this.country = country;
        this.city = city;
        return this;
    }

    public DataUploader setPhone(String phone) {
        this.phone = phone;
        return this;
    }

    public DataUploader setVanity(String vanity) {
        this.vanity = vanity;
        return this;
    }
}

Add conditions in upload method


package com.example.profbola.bakingtime.ui;

import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;

import com.example.profbola.bakingtime.R;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                        .setAction("Action", null).show();
            }
        });
    }

}

package com.example.profbola.bakingtime.ui;

import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;

import com.example.profbola.bakingtime.R;

public class MainActivity extends AppCompatActivity {

    public static final String RECIPE = "recipe";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                        .setAction("Action", null).show();
            }
        });
    }

}

Add String Constant for Recipe key in Bundle


package techreborn.compat.opencomputers;

import li.cil.oc.api.Driver;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import techreborn.compat.ICompatModule;

public class CompatOpenComputers implements ICompatModule {
	@Override
	public void preInit(FMLPreInitializationEvent event) {

	}

	@Override
	public void init(FMLInitializationEvent event) {

	}

	@Override
	public void postInit(FMLPostInitializationEvent event) {
		Driver.add(new DriverMachine());
	}

	@Override
	public void serverStarting(FMLServerStartingEvent event) {

	}
}

package techreborn.compat.opencomputers;

import li.cil.oc.api.Driver;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import techreborn.compat.ICompatModule;

public class CompatOpenComputers implements ICompatModule {
	@Override
	public void preInit(FMLPreInitializationEvent event) {

	}

	@Override
	public void init(FMLInitializationEvent event) {
		Driver.add(new DriverMachine());
	}

	@Override
	public void postInit(FMLPostInitializationEvent event) {

	}

	@Override
	public void serverStarting(FMLServerStartingEvent event) {

	}
}

Fix crash with OC compat