package com.example;

import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import org.minijax.Minijax;
import org.minijax.json.JsonFeature;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@Path("/api")
@Produces(MediaType.APPLICATION_JSON)
@Api
public class HelloSwagger {

    @POST
    @Path("/shout")
    @Consumes(MediaType.TEXT_PLAIN)
    @ApiOperation("Shouts an input string")
    public static String shout(final String s) {
        return s.toUpperCase();
    }

    public static void main(final String[] args) {
        new Minijax()
                .register(io.swagger.jaxrs.listing.ApiListingResource.class)
                .register(io.swagger.jaxrs.listing.SwaggerSerializers.class)
                .register(JsonFeature.class)
                .register(HelloSwagger.class)
                .start();
    }
}

package com.example;

import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import org.minijax.Minijax;
import org.minijax.json.JsonFeature;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@Path("/api")
@Produces(MediaType.APPLICATION_JSON)
@Api
public class HelloSwagger {

    @POST
    @Path("/shout")
    @Consumes(MediaType.TEXT_PLAIN)
    @ApiOperation("Shouts an input string")
    public static String shout(final String s) {
        return s.toUpperCase();
    }

    public static void main(final String[] args) {
        new Minijax()
                .register(io.swagger.jaxrs.listing.ApiListingResource.class)
                .register(io.swagger.jaxrs.listing.SwaggerSerializers.class)
                .register(JsonFeature.class)
                .register(HelloSwagger.class)
                .allowCors("/")
                .start();
    }
}

Allow CORS in swagger example

Allow CORS in swagger example


package org.ovirt.engine.core.bll.provider;

import java.util.Collections;
import java.util.List;

import org.ovirt.engine.core.bll.CommandBase;
import org.ovirt.engine.core.bll.utils.PermissionSubject;
import org.ovirt.engine.core.common.VdcObjectType;
import org.ovirt.engine.core.common.action.ProviderParameters;
import org.ovirt.engine.core.common.businessentities.ActionGroup;
import org.ovirt.engine.core.compat.Guid;

/**
 * Allows to test that the provider definition allows connecting to the provider and accessing it's API.

 * In case of connection failure, an exception will be thrown.
 *
 * @param

 *            Parameter type.
 */
public class TestProviderConnectivityCommand
 extends CommandBase
 {

    public TestProviderConnectivityCommand(Guid commandId) {
        super(commandId);
    }

    public TestProviderConnectivityCommand(P parameters) {
        super(parameters);
    }

    @Override
    protected void executeCommand() {
        ProviderProxy proxy = ProviderProxyFactory.getInstance().create(getParameters().getProvider());

        proxy.testConnection();
        setSucceeded(true);
    }

    @Override
    public List<PermissionSubject> getPermissionCheckSubjects() {
        return Collections.singletonList(new PermissionSubject(Guid.SYSTEM,
                VdcObjectType.System,
                ActionGroup.CREATE_STORAGE_POOL));
    }

}

package org.ovirt.engine.core.bll.provider;

import java.util.Collections;
import java.util.List;

import org.ovirt.engine.core.bll.CommandBase;
import org.ovirt.engine.core.bll.NonTransactiveCommandAttribute;
import org.ovirt.engine.core.bll.utils.PermissionSubject;
import org.ovirt.engine.core.common.VdcObjectType;
import org.ovirt.engine.core.common.action.ProviderParameters;
import org.ovirt.engine.core.common.businessentities.ActionGroup;
import org.ovirt.engine.core.compat.Guid;

/**
 * Allows to test that the provider definition allows connecting to the provider and accessing it's API.

 * In case of connection failure, an exception will be thrown.
 *
 * @param

 *            Parameter type.
 */
@NonTransactiveCommandAttribute
public class TestProviderConnectivityCommand
 extends CommandBase
 {

    public TestProviderConnectivityCommand(Guid commandId) {
        super(commandId);
    }

    public TestProviderConnectivityCommand(P parameters) {
        super(parameters);
    }

    @Override
    protected void executeCommand() {
        ProviderProxy proxy = ProviderProxyFactory.getInstance().create(getParameters().getProvider());

        proxy.testConnection();
        setSucceeded(true);
    }

    @Override
    public List<PermissionSubject> getPermissionCheckSubjects() {
        return Collections.singletonList(new PermissionSubject(Guid.SYSTEM,
                VdcObjectType.System,
                ActionGroup.CREATE_STORAGE_POOL));
    }

}

engine: Make test connectivity non transactional

No reason for this command to be transactional as it doesn't alter the
DB.

Change-Id: I7423f4089d937f3094bf6054818390c3f26b1d9a
Signed-off-by: Mike Kolesnik <c6947eedc1b0e500810c3b3db45e5f4633b0ea7d@redhat.com>


package com.artemis.generator.strategy.supermapper;

import com.artemis.BaseSystem;
import com.artemis.generator.common.BuilderModelStrategy;
import com.artemis.generator.model.artemis.ArtemisModel;
import com.artemis.generator.model.type.AccessLevel;
import com.artemis.generator.model.type.MethodDescriptor;
import com.artemis.generator.model.type.TypeModel;
import com.artemis.generator.util.MethodBuilder;

/**
 * Generate basic scaffold for SuperMapper class.
 *
 * @author Daan van Yperen
 */
public class SuperMapperStrategy implements BuilderModelStrategy {

    @Override
    public void apply(ArtemisModel artemisModel, TypeModel model) {
        model.name = "SuperMapper";
        model.packageName = "com.artemis";
        model.superclass = BaseSystem.class;
        model.add(createInitializationMethod());
    }

    private MethodDescriptor createInitializationMethod() {
        return new MethodBuilder(void.class, "processSystem")
                .accessLevel(AccessLevel.PUBLIC)
                .statement("E._processingMapper=this")
                .build();
    }

}

package com.artemis.generator.strategy.supermapper;

import com.artemis.BaseSystem;
import com.artemis.generator.common.BuilderModelStrategy;
import com.artemis.generator.model.artemis.ArtemisModel;
import com.artemis.generator.model.type.AccessLevel;
import com.artemis.generator.model.type.MethodDescriptor;
import com.artemis.generator.model.type.TypeModel;
import com.artemis.generator.util.MethodBuilder;

/**
 * Generate basic scaffold for SuperMapper class.
 *
 * @author Daan van Yperen
 */
public class SuperMapperStrategy implements BuilderModelStrategy {

    @Override
    public void apply(ArtemisModel artemisModel, TypeModel model) {
        model.name = "SuperMapper";
        model.packageName = "com.artemis";
        model.superclass = BaseSystem.class;
        model.add(createInitializationMethod());
        model.add(createProcessingMethod());
    }

    private MethodDescriptor createProcessingMethod() {
        return new MethodBuilder(void.class, "processSystem")
                .accessLevel(AccessLevel.PUBLIC)
                .statement("E._processingMapper=this")
                .build();
    }

    private MethodDescriptor createInitializationMethod() {
        return new MethodBuilder(void.class, "initialize")
                .accessLevel(AccessLevel.PROTECTED)
                .statement("E._processingMapper=this")
                .build();
    }

}

Initialize SuperMapper as soon as possible to allow initialization() usage of E.


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

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

public class TimeUpdate extends MiddleTimeUpdate {

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

}

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

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

public class TimeUpdate extends MiddleTimeUpdate {

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

}

Use abs time in <= 1.5.2

Use abs time in <= 1.5.2


package model.formulas;

public class Equality extends Formula {
    public final Term lhs;
    public final Term rhs;

    public Equality(Term lhs, Term rhs){
        this.lhs = lhs;
        this.rhs = rhs;
        super.precedence = 3;
    }

    @Override
    public Formula replace(String newId,String oldId){
    	return new Equality(lhs.replace(newId, oldId), rhs.replace(newId, oldId));
    }

    @Override
    public Formula replace(Term newTerm,Term oldTerm){
    	Term lhsRet = this.lhs.equals(oldTerm) ? newTerm : oldTerm;
    	Term rhsRet = this.rhs.equals(oldTerm) ? newTerm : oldTerm;
    	return new Equality(lhsRet, rhsRet);
    }

    @Override
    public boolean equals(Object o){
    	if(o instanceof Equality){
    		Equality e = (Equality)o;
    		return this.lhs.equals(e.lhs) && this.rhs.equals(e.rhs);
    	}
    	return false;
    }

    @Override
    public String toString(){
    	return lhs+" = "+rhs;
    }
    @Override
    public String parenthesize() {
        return toString();
    }

        @Override
	public boolean containsFreeObjectId(String id) {
		return lhs.containsObjectId(id) ||  rhs.containsObjectId(id);
	}

}

package model.formulas;

public class Equality extends Formula {
    public final Term lhs;
    public final Term rhs;

    public Equality(Term lhs, Term rhs){
        this.lhs = lhs;
        this.rhs = rhs;
        super.precedence = 3;
    }

    @Override
    public Formula replace(String newId,String oldId){
    	return new Equality(lhs.replace(newId, oldId), rhs.replace(newId, oldId));
    }

    @Override
    public Formula replace(Term newTerm,Term oldTerm){
    	Term lhsRet = this.lhs.equals(oldTerm) ? newTerm : this.lhs;
    	Term rhsRet = this.rhs.equals(oldTerm) ? newTerm : this.rhs;
    	return new Equality(lhsRet, rhsRet);
    }

    @Override
    public boolean equals(Object o){
    	if(o instanceof Equality){
    		Equality e = (Equality)o;
    		return this.lhs.equals(e.lhs) && this.rhs.equals(e.rhs);
    	}
    	return false;
    }

    @Override
    public String toString(){
    	return lhs+" = "+rhs;
    }
    @Override
    public String parenthesize() {
        return toString();
    }

        @Override
	public boolean containsFreeObjectId(String id) {
		return lhs.containsObjectId(id) ||  rhs.containsObjectId(id);
	}

}

Fix replace bug in equality formula.

Fix replace bug in equality formula.


package hwo.kurjatturskat.core.message.gameinit;

public class TrackPieces {
    public final Double length;
    public final Double radius;
    public final Double angle;

    public TrackPieces(Double length, Double radius, Double angle) {
        this.length = length;
        this.radius = radius;
        this.angle = angle;
    }

    public boolean isCurve() {
        return this.angle != null;
    }
}

package hwo.kurjatturskat.core.message.gameinit;

import com.google.gson.annotations.SerializedName;

public class TrackPieces {
    public final Double length;
    public final Double radius;
    public final Double angle;

    @SerializedName("switch")
    public final boolean isSwitch;

    public TrackPieces(Double length, Double radius, Double angle,
            boolean isSwitch) {
        this.length = length;
        this.radius = radius;
        this.angle = angle;
        this.isSwitch = isSwitch;
    }

    public boolean isCurve() {
        return this.angle != null;
    }
}

Add missing switch data field

Add missing switch data field


package com.getbase.android.autoprovider;

import com.google.common.collect.ImmutableBiMap;

import org.chalup.thneed.ModelGraph;
import org.chalup.thneed.ModelVisitor;
import org.chalup.thneed.models.DatabaseModel;
import org.chalup.thneed.models.PojoModel;

public class Utils {
  public static <TModel extends DatabaseModel & PojoModel> ImmutableBiMap<Class<?>, String> buildClassToTableMap(ModelGraph<TModel> modelGraph) {
    final ImmutableBiMap.Builder<Class<?>, String> classToTableMappingBuilder = ImmutableBiMap.builder();
    modelGraph.accept(new ModelVisitor<TModel>() {
      @Override
      public void visit(TModel model) {
        classToTableMappingBuilder.put(model.getModelClass(), model.getTableName());
      }
    });
    return classToTableMappingBuilder.build();
  }
}

package com.getbase.android.autoprovider;

import com.google.common.collect.ImmutableBiMap;

import org.chalup.thneed.ModelGraph;
import org.chalup.thneed.ModelVisitor;
import org.chalup.thneed.models.DatabaseModel;
import org.chalup.thneed.models.PojoModel;

public final class Utils {
  private Utils() {
  }

  public static <TModel extends DatabaseModel & PojoModel> ImmutableBiMap<Class<?>, String> buildClassToTableMap(ModelGraph<TModel> modelGraph) {
    final ImmutableBiMap.Builder<Class<?>, String> classToTableMappingBuilder = ImmutableBiMap.builder();
    modelGraph.accept(new ModelVisitor<TModel>() {
      @Override
      public void visit(TModel model) {
        classToTableMappingBuilder.put(model.getModelClass(), model.getTableName());
      }
    });
    return classToTableMappingBuilder.build();
  }
}

Use standard pattern for utility class

Use standard pattern for utility class


package org.cloudfoundry.community.servicebroker.config;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * Default main for spring boot
 * @author sgreenberg
 *
 */
@SpringBootApplication
public class DefaultApplication {

    public static void main(String[] args) {
        SpringApplication.run(DefaultApplication.class, args);
    }

}

package org.cloudfoundry.community.servicebroker.config;

import org.springframework.boot.SpringApplication;

/**
 * Default main for spring boot
 * @author sgreenberg
 *
 */
public class DefaultApplication {

    public static void main(String[] args) {
        SpringApplication.run(DefaultApplication.class, args);
    }

}

Undo jitpack changes. It seems to struggle with spring boot.


package internal.org.springframework.content.s3.boot.autoconfigure;

import com.amazonaws.services.s3.AmazonS3Client;

import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.cloud.aws.context.config.annotation.ContextResourceLoaderConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

@Configuration
@ConditionalOnClass(AmazonS3Client.class)
@Import({ContextResourceLoaderConfiguration.class, S3ContentAutoConfigureRegistrar.class})
public class S3ContentAutoConfiguration {

}

package internal.org.springframework.content.s3.boot.autoconfigure;

import com.amazonaws.services.s3.AmazonS3Client;

import internal.org.springframework.content.s3.config.S3ContentRepositoryConfiguration;

import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.cloud.aws.context.config.annotation.ContextResourceLoaderConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

@Configuration
@ConditionalOnClass(AmazonS3Client.class)
@Import({ContextResourceLoaderConfiguration.class, S3ContentRepositoryConfiguration.class, S3ContentAutoConfigureRegistrar.class})
public class S3ContentAutoConfiguration {

}

Add s3 configuration to boot starter auto configuration


package me.coley.recaf.ui.controls.text;

import javafx.scene.Node;
import javafx.scene.control.ListCell;
import javafx.scene.text.Text;
import me.coley.recaf.util.struct.Pair;
import org.fxmisc.richtext.CodeArea;

/**
 * Cell renderer.
 *
 * @author Matt
 */
public class ErrorCell extends ListCell<Pair<Integer, String>> {
	private final CodeArea codeArea;

	/**
	 * @param codeArea
	 * 		Code area containing the text with errors.
	 */
	public ErrorCell(CodeArea codeArea) {
		this.codeArea = codeArea;
	}

	@Override
	public void updateItem(Pair<Integer, String> item, boolean empty) {
		super.updateItem(item, empty);
		if(empty) {
			setText(null);
			setGraphic(null);
		} else {
			setText(item.getValue());
			int index = item.getKey();
			Node g = new Text(String.valueOf(index + 1));
			g.getStyleClass().addAll("bold", "error-cell");
			setGraphic(g);
			// on-click: go to line
			setOnMouseClicked(me -> {
				codeArea.moveTo(index, 0);
				codeArea.requestFollowCaret();
				codeArea.requestFocus();
			});
		}
	}
}

package me.coley.recaf.ui.controls.text;

import javafx.scene.Node;
import javafx.scene.control.ListCell;
import javafx.scene.text.Text;
import me.coley.recaf.util.struct.Pair;
import org.fxmisc.richtext.CodeArea;

/**
 * Cell renderer.
 *
 * @author Matt
 */
public class ErrorCell extends ListCell<Pair<Integer, String>> {
	private final CodeArea codeArea;

	/**
	 * @param codeArea
	 * 		Code area containing the text with errors.
	 */
	public ErrorCell(CodeArea codeArea) {
		this.codeArea = codeArea;
	}

	@Override
	public void updateItem(Pair<Integer, String> item, boolean empty) {
		super.updateItem(item, empty);
		if(empty) {
			setText(null);
			setGraphic(null);
		} else {
			setText(item.getValue());
			int index = item.getKey();
			Node g = new Text(String.valueOf(index + 1));
			g.getStyleClass().addAll("bold", "error-cell");
			setGraphic(g);
			// on-click: go to line
			if(index >= 0) {
				setOnMouseClicked(me -> {
					codeArea.moveTo(index, 0);
					codeArea.requestFollowCaret();
					codeArea.requestFocus();
				});
			} else {
				setText(getText() + "\n(Cannot resolve line number from error)");
			}
		}
	}
}

Fix non-resolved errors throwing errors on click


package org.algorithmprac.sort;

import com.google.common.base.Stopwatch;

import java.util.concurrent.TimeUnit;

public abstract class AbstractCostAwareSorter extends AbstractSorter implements CostAwareSorter {

    private final Stopwatch stopwatch = Stopwatch.createUnstarted();

    private int cmpCount = 0;

    private int swapCount = 0;

    @Override
    protected void preProcess(Comparable[] a) {
        resetStatistics();
        stopwatch.start();
    }

    private void resetStatistics() {
        stopwatch.reset();
        cmpCount = 0;
        swapCount = 0;
    }

    @Override
    protected void postProcess(Comparable[] a) {
        stopwatch.stop();
    }

    @Override
    public boolean less(Comparable v, Comparable w) {
        ++cmpCount;
        return super.less(v, w);
    }

    @Override
    public void swap(Comparable[] a, int i, int j) {
        ++swapCount;
        super.swap(a, i, j);
    }

    public String getReadableCost() {
        StringBuilder sb = new StringBuilder();
        sb.append("cost is ");
        sb.append(stopwatch.toString());
        sb.append(", compare count is ");
        sb.append(cmpCount);
        sb.append(", swap count is ");
        sb.append(swapCount);
        return sb.toString();
    }

    public long getCost(TimeUnit timeUnit) {
        return stopwatch.elapsed(timeUnit);
    }

    public int getCmpCount() {
        return cmpCount;
    }

    public int getSwapCount() {
        return swapCount;
    }
}

package org.algorithmprac.sort;

import com.google.common.base.Stopwatch;

import java.util.concurrent.TimeUnit;

public abstract class AbstractCostAwareSorter extends AbstractSorter implements CostAwareSorter {

    private final Stopwatch stopwatch = Stopwatch.createUnstarted();

    private long cmpCount = 0;

    private long swapCount = 0;

    @Override
    protected void preProcess(Comparable[] a) {
        resetStatistics();
        stopwatch.start();
    }

    private void resetStatistics() {
        stopwatch.reset();
        cmpCount = 0L;
        swapCount = 0L;
    }

    @Override
    protected void postProcess(Comparable[] a) {
        stopwatch.stop();
    }

    @Override
    public boolean less(Comparable v, Comparable w) {
        ++cmpCount;
        return super.less(v, w);
    }

    @Override
    public void swap(Comparable[] a, int i, int j) {
        ++swapCount;
        super.swap(a, i, j);
    }

    public String getReadableCost() {
        StringBuilder sb = new StringBuilder();
        sb.append("cost is ");
        sb.append(stopwatch.toString());
        sb.append(", compare count is ");
        sb.append(cmpCount);
        sb.append(", swap count is ");
        sb.append(swapCount);
        return sb.toString();
    }

    public long getCost(TimeUnit timeUnit) {
        return stopwatch.elapsed(timeUnit);
    }

    public long getCmpCount() {
        return cmpCount;
    }

    public long getSwapCount() {
        return swapCount;
    }
}

Change comp and swap count from int to long


package todomore.android.metawidget;

import java.util.Map;

import org.metawidget.android.widget.AndroidMetawidget;
import org.metawidget.widgetbuilder.iface.WidgetBuilder;

import android.content.Context;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

public class TodoMoreAndroidWidgetBuilder implements WidgetBuilder<View, AndroidMetawidget> {

	private static final String TAG = "TAWB";

	public TodoMoreAndroidWidgetBuilder() {
		Log.d(TAG, "TodoAndroidWidgetBuilder()");
		// empty
	}

	@Override
	public View buildWidget(String elementName,
			Map<String, String> attributes,
			AndroidMetawidget metaWidget) {
		// Log.d(TAG, String.format("buildWidget(%s, %s, %s)", elementName, attributes, metaWidget));
		Context context = metaWidget.getContext();
		String type = attributes.get("type");
		String readOnlyStr = attributes.get("read-only");
		boolean readOnly = Boolean.parseBoolean(readOnlyStr);
		if (elementName.equals("entity") && type.equals("com.darwinsys.todo.model.Date")) {
			return readOnly ? new TextView(context) : new EditText(context);
		}
		return null;
	}

}

package todomore.android.metawidget;

import java.util.Map;

import org.metawidget.android.widget.AndroidMetawidget;
import org.metawidget.widgetbuilder.iface.WidgetBuilder;

import android.content.Context;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import com.darwinsys.todo.model.Date;

public class TodoMoreAndroidWidgetBuilder implements WidgetBuilder<View, AndroidMetawidget> {

	private static final String TAG = "TAWB";

	public TodoMoreAndroidWidgetBuilder() {
		Log.d(TAG, "TodoAndroidWidgetBuilder()");
		// empty
	}

	@Override
	public View buildWidget(String elementName,
			Map<String, String> attributes,
			AndroidMetawidget metaWidget) {
		// Log.d(TAG, String.format("buildWidget(%s, %s, %s)", elementName, attributes, metaWidget));
		Context context = metaWidget.getContext();
		String type = attributes.get("type");
		String readOnlyStr = attributes.get("read-only");
		boolean readOnly = Boolean.parseBoolean(readOnlyStr);
		if (type.equals(Date.class.getName())) {
			return readOnly ? new TextView(context) : new EditText(context);
		}
		return null;
	}

}

Remove duplicate labels from Date fields.


/*-
 * Copyright 2015 Diamond Light Source Ltd.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 */
package org.eclipse.dawnsci.analysis.api;

public interface EventTracker {

	/**
	 * This method is used to track events (log, action, exception etc) in the application.
	 *
	 * @param name
	 *            Unique name (human readable without space) of event to be tracked
	 *            Example: Data_Browsing_Perspective_launch
	 * @throws Exception
	 */
	public void track(String name) throws Exception;

}

/*-
 * Copyright 2015 Diamond Light Source Ltd.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 */
package org.eclipse.dawnsci.analysis.api;

public interface EventTracker {

	/**
	 * This method is used to track events (log, action, exception etc) in the application.
	 *
	 * @param name
	 *            Unique name (human readable without space) of event to be tracked
	 *            Example: Data_Browsing_Perspective_launch
	 * @throws Exception
	 */
	public void track(String name) throws Exception;

	/**
	 * This method is used to track events given an id and a label.
	 *
	 * @param id
	 *            Unique id
	 * @param label
	 *            Name
	 */
	public void track(String id, String label) throws Exception;
}

Add track method with id and label parameter


package org.synyx.urlaubsverwaltung.workingtime.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.util.List;

@Component
@ConfigurationProperties("uv.workingtime")
@Validated
public class WorkingTimeProperties {

    @NotNull
    private List<@Min(1) @Max(7) Integer> defaultWorkingDays = List.of(1, 2, 3, 4, 5);

    public List<Integer> getDefaultWorkingDays() {
        return defaultWorkingDays;
    }

    public void setDefaultWorkingDays(List<Integer> defaultWorkingDays) {
        this.defaultWorkingDays = defaultWorkingDays;
    }
}

package org.synyx.urlaubsverwaltung.workingtime.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.util.List;

@Component
@ConfigurationProperties("uv.workingtime")
@Validated
public class WorkingTimeProperties {

    /**
     * Define the default working days that will be configured for
     * every newly created person.
     *
     * Default values: Monday, Tuesday, Wednesday, Thursday, Friday
     */
    @NotNull
    private List<@Min(1) @Max(7) Integer> defaultWorkingDays = List.of(1, 2, 3, 4, 5);

    public List<Integer> getDefaultWorkingDays() {
        return defaultWorkingDays;
    }

    public void setDefaultWorkingDays(List<Integer> defaultWorkingDays) {
        this.defaultWorkingDays = defaultWorkingDays;
    }
}

Add Javadoc to working time properties

Add Javadoc to working time properties


package com.gitrekt.resort.controller;

import java.net.URL;
import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;

/**
 * FXML Controller class for reports home screen.
 */
public class ReportsHomeScreenController implements Initializable {

    @FXML
    private Button backButton;

    @FXML
    private Button bookingPercentagesReportButton;

    @FXML
    private Button feedbackReportButton;

    /**
     * Initializes the controller class.
     */
    @Override
    public void initialize(URL url, ResourceBundle rb) {
        // TODO
    }

    public void onBackButtonClicked() {
        ScreenManager.getInstance().switchToScreen(
            "/fxml/StaffHomeScreen.fxml"
        );
    }

    public void onBookingPercentagesReportButtonClicked() {
        ScreenManager.getInstance().switchToScreen(
            "/fxml/BookingReportScreen.fxml"
        );
    }

     public void onFeedbackReportButtonClicked() {
        ScreenManager.getInstance().switchToScreen(
            "/fxml/FeedbackReportScreen.fxml"
        );
    }
}

package com.gitrekt.resort.controller;

import java.net.URL;
import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;

/**
 * FXML Controller class for reports home screen.
 */
public class ReportsHomeScreenController implements Initializable {

    @FXML
    private Button backButton;

    @FXML
    private Button bookingPercentagesReportButton;

    @FXML
    private Button feedbackReportButton;

    /**
     * Initializes the controller class.
     */
    @Override
    public void initialize(URL url, ResourceBundle rb) {
        // TODO
    }

    public void onBackButtonClicked() {
        ScreenManager.getInstance().switchToScreen(
            "/fxml/StaffHomeScreen.fxml"
        );
    }

    public void onBookingPercentagesReportButtonClicked() {
        ScreenManager.getInstance().switchToScreen(
            "/fxml/BookingsReportScreen.fxml"
        );
    }

     public void onFeedbackReportButtonClicked() {
        ScreenManager.getInstance().switchToScreen(
            "/fxml/FeedbackReportScreen.fxml"
        );
    }
}

Fix typo in FXML file name

Fix typo in FXML file name


import org.junit.*;

import play.mvc.*;
import play.test.*;
import play.libs.F.*;

import static play.test.Helpers.*;
import static org.junit.Assert.*;

import static org.fluentlenium.core.filter.FilterConstructor.*;

public class IntegrationTest {

    /**
     * add your integration test here
     * in this example we just check if the welcome page is being shown
     */
    @Test
    public void test() {
        running(testServer(3333, fakeApplication(inMemoryDatabase())), HTMLUNIT, new Callback<TestBrowser>() {
            public void invoke(TestBrowser browser) {
                browser.goTo("http://localhost:3333");
                assertTrue(browser.pageSource().contains("Your new application is ready."));
            }
        });
    }

}

import org.junit.*;

import play.mvc.*;
import play.test.*;
import play.libs.F.*;

import static play.test.Helpers.*;
import static org.junit.Assert.*;

import static org.fluentlenium.core.filter.FilterConstructor.*;

public class IntegrationTest {

    /**
     * add your integration test here
     * in this example we just check if the welcome page is being shown
     */
    @Test
    public void test() {
        running(testServer(3333, fakeApplication(inMemoryDatabase())), HTMLUNIT, new Callback<TestBrowser>() {
            public void invoke(TestBrowser browser) {
                browser.goTo("http://localhost:3333");
                assertTrue(browser.pageSource().contains("Welcome to Breakout API. Nothing to see here by now"));
            }
        });
    }

}

Fix Integration Test after changing response for index


package uk.org.sappho.kmymoney.data;

import uk.org.sappho.kmymoney.rawdata.DataNode;
import uk.org.sappho.kmymoney.rawdata.DataNodeException;

public abstract class AbstractItemWithIdAndName extends AbstractItemWithId {

    private final String name;

    protected AbstractItemWithIdAndName(DataNode node) throws DataNodeException {

        super(node);
        name = node.getAttribute("name").getValue();
        if (name.length() == 0)
            throw new DataNodeException("Payee " + getId() + " has a blank name");
    }

    public String getName() {
        return name;
    }
}

package uk.org.sappho.kmymoney.data;

import uk.org.sappho.kmymoney.rawdata.DataNode;
import uk.org.sappho.kmymoney.rawdata.DataNodeException;
import uk.org.sappho.kmymoney.rawdata.Value;

public abstract class AbstractItemWithIdAndName extends AbstractItemWithId {

    private final Value name;

    protected AbstractItemWithIdAndName(DataNode node) throws DataNodeException {

        super(node);
        name = node.getAttribute("name");
    }

    public String getName() {

        return name.getValue();
    }
}

Set up basics of kmymonet4j.

SAPPHO-2: Set up basics of kmymonet4j.


/*
 * Copyright (C) 2014 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 android.support.design.widget;

import android.content.Context;
import android.support.v7.widget.AppCompatImageButton;
import android.util.AttributeSet;

class VisibilityAwareImageButton extends AppCompatImageButton {

    private int mUserSetVisibility;

    public VisibilityAwareImageButton(Context context) {
        this(context, null);
    }

    public VisibilityAwareImageButton(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public VisibilityAwareImageButton(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        mUserSetVisibility = getVisibility();
    }

    @Override
    public void setVisibility(int visibility) {
        internalSetVisibility(visibility, true);
    }

    final void internalSetVisibility(int visibility, boolean fromUser) {
        super.setVisibility(visibility);
        if (fromUser) {
            mUserSetVisibility = visibility;
        }
    }

    final int getUserSetVisibility() {
        return mUserSetVisibility;
    }
}

/*
 * Copyright (C) 2015 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 android.support.design.widget;

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

class VisibilityAwareImageButton extends ImageButton {

    private int mUserSetVisibility;

    public VisibilityAwareImageButton(Context context) {
        this(context, null);
    }

    public VisibilityAwareImageButton(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public VisibilityAwareImageButton(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        mUserSetVisibility = getVisibility();
    }

    @Override
    public void setVisibility(int visibility) {
        internalSetVisibility(visibility, true);
    }

    final void internalSetVisibility(int visibility, boolean fromUser) {
        super.setVisibility(visibility);
        if (fromUser) {
            mUserSetVisibility = visibility;
        }
    }

    final int getUserSetVisibility() {
        return mUserSetVisibility;
    }
}

Fix crash in FAB background tint am: 9d42ab847a
am: 3b28559aa3

* commit '3b28559aa396a40992b1c9e7e1e8af215340cd05':
  Fix crash in FAB background tint

GitOrigin-RevId=84921ceb7940a7ce40affb58f22b4a11b35a3e60

PiperOrigin-RevId: 140551245


package beaform.events;

import java.text.SimpleDateFormat;
import java.util.Date;

import beaform.utilities.SystemTime;

public class FormulaCreatedEvent implements Event {
	private static final String EVENT_TYPE = "FormulaCreated";
	private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SS");
	private final String name;
	private final long timestamp;

	public FormulaCreatedEvent(String name) {
		this.name = name;
		this.timestamp = SystemTime.getAsLong();
	}

	@Override
	public String toEventString() {
		final String formattedTimeStamp = dateFormat.format(new Date(this.timestamp));
		return "[" + formattedTimeStamp + "] " + EVENT_TYPE + " " + this.name;
	}

}

package beaform.events;

import java.text.SimpleDateFormat;
import java.util.Date;

import beaform.utilities.SystemTime;

public class FormulaCreatedEvent implements Event {
	private static final String EVENT_TYPE = "FormulaCreated";
	private static final String TIMESTAMP_FORMAT = "yyyy-MM-dd HH:mm:ss.SS";
	private final String name;
	private final long timestamp;

	public FormulaCreatedEvent(String name) {
		this.name = name;
		this.timestamp = SystemTime.getAsLong();
	}

	@Override
	public String toEventString() {
		final SimpleDateFormat dateFormat = new SimpleDateFormat(TIMESTAMP_FORMAT);
		final String formattedTimeStamp = dateFormat.format(new Date(this.timestamp));
		return "[" + formattedTimeStamp + "] " + EVENT_TYPE + " " + this.name;
	}

}

Improve thread safety by not using a static instance of SimpleDateFormat


package com.yahoo.vespa.hosted.node.admin.util;

/**
 * Utility class for creating iptables commands
 *
 * @author mpolden
 */
public class IpTables {

    private static final String COMMAND = "ip6tables";

    public static String[] allowFromAddress(String ipAddress) {
        return new String[]{COMMAND, "-A", "INPUT", "-s", ipAddress, "-j", "ACCEPT"};
    }

    public static String[] chainPolicy(Policy policy) {
        return new String[]{COMMAND, "-P", "INPUT", policy.target};
    }

    public static String[] flushChain() {
        return new String[]{COMMAND, "-F", "INPUT"};
    }

    public enum Policy {
        DROP("DROP"),
        ACCEPT("ACCEPT");

        private final String target;

        Policy(String target) {
            this.target = target;
        }
    }
}

package com.yahoo.vespa.hosted.node.admin.util;

/**
 * Utility class for creating iptables commands
 *
 * @author mpolden
 */
public class IpTables {

    private static final String COMMAND = "ip6tables";

    public static String[] allowFromAddress(String ipAddress) {
        return new String[]{COMMAND, "-A", Chain.INPUT.name, "-s", ipAddress, "-j", Action.ACCEPT.target};
    }

    public static String[] chainPolicy(Action action) {
        return new String[]{COMMAND, "-P", Chain.INPUT.name, action.target};
    }

    public static String[] flushChain() {
        return new String[]{COMMAND, "-F", Chain.INPUT.name};
    }

    public enum Action {
        DROP("DROP"),
        ACCEPT("ACCEPT");

        private final String target;

        Action(String target) {
            this.target = target;
        }
    }

    public enum Chain {
        INPUT("INPUT");

        private final String name;

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

Add enum for chain names

Add enum for chain names


package fr.insee.eno.main;

import java.io.File;

import fr.insee.eno.GenerationService;
import fr.insee.eno.generation.PoguesXML2DDIGenerator;
import fr.insee.eno.postprocessing.DDIPostprocessor;
import fr.insee.eno.preprocessing.PoguesXMLPreprocessor;

public class DummyTestPoguesXML2DDI {

	public static void main(String[] args) {

		String basePath = "src/test/resources/pogues-xml-to-ddi";
		GenerationService genService = new GenerationService(new PoguesXMLPreprocessor(), new PoguesXML2DDIGenerator(),
				new DDIPostprocessor());
		File in = new File(String.format("%s/in.xml", basePath));
		try {
			File output = genService.generateQuestionnaire(in, "test");
			System.out.println(output.getAbsolutePath());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}

package fr.insee.eno.main;

import java.io.File;

import fr.insee.eno.GenerationService;
import fr.insee.eno.generation.PoguesXML2DDIGenerator;
import fr.insee.eno.postprocessing.DDIPostprocessor;
import fr.insee.eno.preprocessing.PoguesXMLPreprocessor;
import fr.insee.eno.preprocessing.PoguesXMLPreprocessorGoToTreatment;

public class DummyTestPoguesXML2DDI {

	public static void main(String[] args) {

		String basePath = "src/test/resources/pogues-xml-to-ddi";
		GenerationService genService = new GenerationService(new PoguesXMLPreprocessorGoToTreatment(), new PoguesXML2DDIGenerator(),
				new DDIPostprocessor());
		File in = new File(String.format("%s/in.xml", basePath));
		try {
			File output = genService.generateQuestionnaire(in, "test");
			System.out.println(output.getAbsolutePath());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}

Update dummy test with with new goto treatment version


package com.thanglequoc.aqicalculator;

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

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;

public class PollutantsBreakpointGenerator {
	private PollutantsBreakpoint pollutantsBreakpoint;
	private PollutantBreakpointParser pollutantBreakpointParser;
	private static String breakpointFilePath = "./src/main/resources/AQIresource/aqi-breakpoint.json";

	private File breakpointFile;

	public PollutantsBreakpointGenerator() throws JsonProcessingException, IOException{
		pollutantBreakpointParser = new PollutantBreakpointParser();
		pollutantsBreakpoint = new PollutantsBreakpoint();
		File breakpointFile = new File(breakpointFilePath);
		setBreakpointFile(breakpointFile);

		ObjectMapper mapper = new ObjectMapper();

		JsonNode root = mapper.readTree(breakpointFile);

		for(JsonNode pollutantNode: root){
			PollutantBreakpoint pollutantBreakpoint = pollutantBreakpointParser.parseNode(pollutantNode);
			this.pollutantsBreakpoint.addPollutantBreakpoint(pollutantBreakpoint);
		}

	}

	public PollutantsBreakpoint getPollutantsBreakpoint() {
		return pollutantsBreakpoint;
	}

	public void setPollutantsBreakpoint(PollutantsBreakpoint pollutantsBreakpoint) {
		this.pollutantsBreakpoint = pollutantsBreakpoint;
	}

	public File getBreakpointFile() {
		return breakpointFile;
	}

	public void setBreakpointFile(File breakpointFile) {
		this.breakpointFile = breakpointFile;
	}

}

package com.thanglequoc.aqicalculator;

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

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;

public class PollutantsBreakpointGenerator {
	private PollutantsBreakpoint pollutantsBreakpoint;
	private PollutantBreakpointParser pollutantBreakpointParser;
	private static String breakpointFilePath = "./src/main/resources/AQIresource/aqi-breakpoint.json";

	public PollutantsBreakpointGenerator() throws JsonProcessingException, IOException{
		pollutantBreakpointParser = new PollutantBreakpointParser();
		pollutantsBreakpoint = new PollutantsBreakpoint();

		ObjectMapper mapper = new ObjectMapper();

		ClassLoader classLoader = PollutantsBreakpointGenerator.class.getClassLoader();

		try (InputStream inputStream = classLoader.getResourceAsStream("AQIresource/aqi-breakpoint.json")) {
			JsonNode root = mapper.readTree(inputStream);

			for(JsonNode pollutantNode: root){
				PollutantBreakpoint pollutantBreakpoint = pollutantBreakpointParser.parseNode(pollutantNode);
				this.pollutantsBreakpoint.addPollutantBreakpoint(pollutantBreakpoint);
			}
		}

	}

	public PollutantsBreakpoint getPollutantsBreakpoint() {
		return pollutantsBreakpoint;
	}

	public void setPollutantsBreakpoint(PollutantsBreakpoint pollutantsBreakpoint) {
		this.pollutantsBreakpoint = pollutantsBreakpoint;
	}

}

Read breakpoint file from classpath

Read breakpoint file from classpath


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

import java.util.concurrent.TimeUnit;

/**
 * This is an implementation of {@link Timer} that is backed by an actual system timer.
 *
 * @author Simon Thoresen Hult
 */
public enum SystemTimer implements Timer {

    INSTANCE;

    private volatile long millis;

    private SystemTimer() {
        millis = TimeUnit.NANOSECONDS.toMillis(System.nanoTime());
        Thread thread = new Thread() {

            @Override
            public void run() {
                while (true) {
                    millis = TimeUnit.NANOSECONDS.toMillis(System.nanoTime());
                    try {
                        Thread.sleep(1);
                    } catch (InterruptedException e) {
                        break;
                    }
                }
            }
        };
        thread.setDaemon(true);
        thread.start();
    }

    @Override
    public long milliTime() {
        return millis;
    }
}

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

import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * This is an implementation of {@link Timer} that is backed by an actual system timer.
 *
 * @author Simon Thoresen Hult
 */
public enum SystemTimer implements Timer {

    INSTANCE;

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

    private volatile long millis;

    private static int detectHz() {
        String hzEnv = System.getenv("VESPA_TIMER_HZ");
        int hz = 1000;
        if ((hzEnv != null) && !hzEnv.isBlank()) {
            try {
                hz = Integer.parseInt(hzEnv);
            } catch (NumberFormatException e) {
                log.log(Level.WARNING, "Failed parsing VESPA_TIMER_HZ='" + hzEnv + "'", e);
            }
        };
        hz = Math.min(1000, Math.max(1, hz)); // Capping to valid range [1...1000]hz
        log.fine("vespa-system-timer running at " + hz + "hz. VESPA_TIMER_HZ='" + hzEnv + "'");
        return hz;
    }

    SystemTimer() {
        int napTime = 1000 / detectHz();
        millis = TimeUnit.NANOSECONDS.toMillis(System.nanoTime());
        Thread thread = new Thread() {

            @Override
            public void run() {
                while (true) {
                    millis = TimeUnit.NANOSECONDS.toMillis(System.nanoTime());
                    try {
                        Thread.sleep(napTime);
                    } catch (InterruptedException e) {
                        break;
                    }
                }
            }
        };
        thread.setDaemon(true);
        thread.setName("vespa-system-timer");
        thread.start();
    }

    @Override
    public long milliTime() {
        return millis;
    }
}

Allow control of vespa-system-timer frequency in the range [1...1000] hz with environment variable VESPA_TIMER_HZ.


package edu.chalmers.sankoss.java;

import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;

/**
 * Class to start the application from.
 * Creates a application window with initial
 * size, title and GL20 support.
 *
 * @author Mikael Malmqvist
 * @date 3/23/14
 */
public class SankossDesktop {
    public static void main(String[] args) {

        /**
         * Load settings from ini file
         */
        Settings.loadSettings();

        LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();

        cfg.title = "Battleships";
        cfg.vSyncEnabled = true;
        cfg.width = 800;
        cfg.height = 600;
        LwjglApplication application = new LwjglApplication(SankossGame.getInstance(), cfg);
    }
}

package edu.chalmers.sankoss.java;

import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;

/**
 * Class to start the application from.
 * Creates a application window with initial
 * size, title and GL20 support.
 *
 * @author Mikael Malmqvist
 * @date 3/23/14
 */
public class SankossDesktop {
    public static void main(String[] args) {

        /**
         * Load settings from ini file
         */
        Settings.loadSettings();

        if (args.length > 0) {
            if (args[0].equals("debug")) {
                Settings.HOSTNAME = "localhost";
            } else {
                Settings.HOSTNAME = "sodapop.se";
            }
        } else {
            Settings.HOSTNAME = "sodapop.se";
        }

        LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();

        cfg.title = "Battleships";
        cfg.vSyncEnabled = true;
        cfg.width = 800;
        cfg.height = 600;
        LwjglApplication application = new LwjglApplication(SankossGame.getInstance(), cfg);
    }
}

Connect to sodapop.se if debug is not found in the startup arguments


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

import actuator.IMotor;
import core.GRTLoggedProcess;

/**
 * Standard 4 motor drivetrain.
 * @author ajc
 */
public class GRTDriveTrain extends GRTLoggedProcess {

    private final IMotor leftFront;
    private final IMotor leftBack;
    private final IMotor rightFront;
    private final IMotor rightBack;

    /**
     *
     * @param leftFront left front motor
     * @param leftBack left back motor
     * @param rightFront right front motor
     * @param rightBack right back motor
     */
    public GRTDriveTrain(IMotor leftFront, IMotor leftBack,
            IMotor rightFront, IMotor rightBack, String name) {
        super(name);
        this.leftFront = leftFront;
        this.leftBack = leftBack;
        this.rightFront = rightFront;
        this.rightBack = rightBack;
    }

    /**
     * TankDrive uses differential steering.
     * @param leftVelocity
     * @param rightVelocity
     */
    public void tankDrive(double leftVelocity, double rightVelocity) {
//        System.out.println("left:" + (-leftVelocity) + "\tright:" + -rightVelocity);
        leftFront.setSpeed(-leftVelocity);
        leftBack.setSpeed(-leftVelocity);
        log(100, leftVelocity);
        rightFront.setSpeed(-rightVelocity);
        rightBack.setSpeed(-rightVelocity);
        log(101, rightVelocity);
    }
}

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

import actuator.IMotor;
import core.GRTLoggedProcess;

/**
 * Standard 4 motor drivetrain.
 * @author ajc
 */
public class GRTDriveTrain extends GRTLoggedProcess {

    private final IMotor leftFront;
    private final IMotor leftBack;
    private final IMotor rightFront;
    private final IMotor rightBack;

    /**
     *
     * @param leftFront left front motor
     * @param leftBack left back motor
     * @param rightFront right front motor
     * @param rightBack right back motor
     */
    public GRTDriveTrain(IMotor leftFront, IMotor leftBack,
            IMotor rightFront, IMotor rightBack, String name) {
        super(name);
        this.leftFront = leftFront;
        this.leftBack = leftBack;
        this.rightFront = rightFront;
        this.rightBack = rightBack;
    }

    /**
     * TankDrive uses differential steering.
     * @param leftVelocity
     * @param rightVelocity
     */
    public void tankDrive(double leftVelocity, double rightVelocity) {
//        System.out.println("left:" + (-leftVelocity) + "\tright:" + -rightVelocity);
        leftFront.setSpeed(-leftVelocity);
        leftBack.setSpeed(leftVelocity);
        log(100, leftVelocity);
        rightFront.setSpeed(-rightVelocity);
        rightBack.setSpeed(rightVelocity);
        log(101, rightVelocity);
    }
}

Switch rear DT to move in opposite direction of front DT


package net.floodlightcontroller.prediction;

import org.json.JSONObject;
import org.restlet.resource.Get;
import org.restlet.resource.Post;
import org.restlet.resource.ServerResource;

public class BehaviourManagerResource extends ServerResource {

    @Get("json")
    public String retrieve() {
        INetTopologyService pihr = (INetTopologyService)getContext().getAttributes().get(INetTopologyService.class.getCanonicalName());
        return "{ \"timeout\" : \"" + pihr.getBehaviourStructure().getSleepTime() + "\"}\n";
    }

    @Post
    public String store(String in) {
        INetTopologyService service = (INetTopologyService)getContext().getAttributes().get(INetTopologyService.class.getCanonicalName());
        try {
            JSONObject jp = new JSONObject(in);
            String time = jp.getString("time");
            service.setTimeout(Integer.parseInt(time));
        }
        catch(Exception e){
            System.out.println(e.getMessage());
            return "{ \"status\" : \"err\" }\n";
        }
        return "{ \"status\" : \"ok\" }\n";

    }
}

package net.floodlightcontroller.prediction;

import org.json.JSONObject;
import org.restlet.resource.Get;
import org.restlet.resource.Post;
import org.restlet.resource.ServerResource;

public class BehaviourManagerResource extends ServerResource {

    @Get("json")
    public String retrieve() {
        INetTopologyService pihr = (INetTopologyService)getContext().getAttributes().get(INetTopologyService.class.getCanonicalName());
        return "{ \"timeout\" : \"" + pihr.getBehaviourStructure().getSleepTime() + "\"}\n";
    }

    @Post
    public String store(String in) {
        INetTopologyService service = (INetTopologyService)getContext().getAttributes().get(INetTopologyService.class.getCanonicalName());
        try {
            JSONObject jp = new JSONObject(in);
            String time = jp.getString("time");
            service.getBehaviourStructure().setSleepTime(Integer.parseInt(time));
        }
        catch(Exception e){
            System.out.println(e.getMessage());
            return "{ \"status\" : \"err\" }\n";
        }
        return "{ \"status\" : \"ok\" }\n";

    }
}

Fix REST interface of the Behaviour Timeout


package com.laytonsmith.abstraction.enums;

import com.laytonsmith.annotations.MEnum;

@MEnum("com.commandhelper.SpawnReason")
public enum MCSpawnReason {
	BREEDING,
	BUILD_IRONGOLEM,
	BUILD_SNOWMAN,
	BUILD_WITHER,
	/**
	 * Deprecated as of 1.14, no longer used.
	 */
	CHUNK_GEN,
	/**
	 * Spawned by plugins
	 */
	CUSTOM,
	/**
	 * Missing spawn reason
	 */
	DEFAULT,
	/**
	 * The kind of egg you throw
	 */
	EGG,
	JOCKEY,
	LIGHTNING,
	NATURAL,
	REINFORCEMENTS,
	SHOULDER_ENTITY,
	SLIME_SPLIT,
	SPAWNER,
	SPAWNER_EGG,
	VILLAGE_DEFENSE,
	VILLAGE_INVASION,
	NETHER_PORTAL,
	DISPENSE_EGG,
	INFECTION,
	CURED,
	OCELOT_BABY,
	SILVERFISH_BLOCK,
	MOUNT,
	TRAP,
	ENDER_PEARL,
	DROWNED,
	SHEARED,
	EXPLOSION
}

package com.laytonsmith.abstraction.enums;

import com.laytonsmith.annotations.MEnum;

@MEnum("com.commandhelper.SpawnReason")
public enum MCSpawnReason {
	BREEDING,
	BUILD_IRONGOLEM,
	BUILD_SNOWMAN,
	BUILD_WITHER,
	/**
	 * Deprecated as of 1.14, no longer used.
	 */
	CHUNK_GEN,
	/**
	 * Spawned by plugins
	 */
	CUSTOM,
	/**
	 * Missing spawn reason
	 */
	DEFAULT,
	/**
	 * The kind of egg you throw
	 */
	EGG,
	JOCKEY,
	LIGHTNING,
	NATURAL,
	PATROL,
	RAID,
	REINFORCEMENTS,
	SHOULDER_ENTITY,
	SLIME_SPLIT,
	SPAWNER,
	SPAWNER_EGG,
	VILLAGE_DEFENSE,
	VILLAGE_INVASION,
	NETHER_PORTAL,
	DISPENSE_EGG,
	INFECTION,
	CURED,
	OCELOT_BABY,
	SILVERFISH_BLOCK,
	MOUNT,
	TRAP,
	ENDER_PEARL,
	DROWNED,
	SHEARED,
	EXPLOSION
}

Add PATROL and RAID entity spawn reasons


package hackerrank;

import java.util.Scanner;

/**
 * https://www.hackerrank.com/challenges/jim-and-the-orders
 */
public class JimAndTheOrders {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // TODO
    }
}

package hackerrank;

import java.util.Arrays;
import java.util.Scanner;

/**
 * https://www.hackerrank.com/challenges/jim-and-the-orders
 */
public class JimAndTheOrders {
    private static class IdxTime implements Comparable<IdxTime> {
        private final int idx;
        private final int time;

        public IdxTime(int idx, int time) {
            this.idx = idx;
            this.time = time;
        }

        @Override
        public int compareTo(IdxTime o) {
            return Integer.compare(time, o.time);
        }
    }

    private static void jimAndTheOrders(IdxTime[] idxTimes) {
        Arrays.sort(idxTimes);
        for (int i = 0; i < idxTimes.length; i++) {
            System.out.print(idxTimes[i].idx + " ");
        }
        System.out.println();
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        IdxTime[] idxTimes = new IdxTime[n];
        for (int i = 0; i < n; i++) {
            int t = in.nextInt();
            int d = in.nextInt();
            idxTimes[i] = new IdxTime(i + 1, t + d);
        }
        jimAndTheOrders(idxTimes);
    }
}

Solve Jim and the Orders

Solve Jim and the Orders


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

package org.springframework.asm;

/**
 * Utility class exposing constants related to Spring's internal repackaging
 * of the ASM bytecode manipulation library (currently based on version 6.2).
 *
 *
See package-level javadocs for more
 * information on {@code org.springframework.asm}.
 *
 * @author Chris Beams
 * @since 3.2
 */
public final class SpringAsmInfo {

	/**
	 * The ASM compatibility version for Spring's ASM visitor implementations:
	 * currently {@link Opcodes#ASM6}.
	 */
	public static final int ASM_VERSION = Opcodes.ASM6;

}

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

package org.springframework.asm;

/**
 * Utility class exposing constants related to Spring's internal repackaging
 * of the ASM bytecode library: currently based on ASM 6.2 plus minor patches.
 *
 *
See package-level javadocs for more
 * information on {@code org.springframework.asm}.
 *
 * @author Chris Beams
 * @author Juergen Hoeller
 * @since 3.2
 */
public final class SpringAsmInfo {

	/**
	 * The ASM compatibility version for Spring's ASM visitor implementations:
	 * currently {@link Opcodes#ASM7_EXPERIMENTAL}.
	 */
	public static final int ASM_VERSION = Opcodes.ASM7_EXPERIMENTAL;

}

Declare ASM7_EXPERIMENTAL for full compatibility with JDK 11 bytecode

Issue: SPR-17096


package com.aemreunal.exception;

/*
 ***************************
 * Copyright (c) 2014      *
 *                         *
 * This code belongs to:   *
 *                         *
 * @author Ahmet Emre Ünal *
 * S001974                 *
 *                         *
 * aemreunal@gmail.com     *
 * emre.unal@ozu.edu.tr    *
 *                         *
 * aemreunal.com           *
 ***************************
 */
public class MalformedRequestException extends NullPointerException {

    public MalformedRequestException() {
        super("Your request is malformed. Please try again.");
    }
}

package com.aemreunal.exception;

/*
 ***************************
 * Copyright (c) 2014      *
 *                         *
 * This code belongs to:   *
 *                         *
 * @author Ahmet Emre Ünal *
 * S001974                 *
 *                         *
 * aemreunal@gmail.com     *
 * emre.unal@ozu.edu.tr    *
 *                         *
 * aemreunal.com           *
 ***************************
 */
public class MalformedRequestException /*extends Throwable*/ extends RuntimeException {

    // http://normanmaurer.me/blog/2013/11/09/The-hidden-performance-costs-of-instantiating-Throwables/
//    public MalformedRequestException() {
//        super("Your request is malformed. Please try again.", null, true, false);
//    }

    public MalformedRequestException() {
        super("Your request is malformed. Please try again.");
    }
}

Add exception throwing performance comment


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

package com.gitblit.transport.ssh.commands;

import org.kohsuke.args4j.Option;

import com.gitblit.Constants;
import com.gitblit.transport.ssh.CommandMetaData;

@CommandMetaData(name="version", description = "Print Gitblit version")
public class VersionCommand extends SshCommand {

  @Option(name = "--verbose", aliases = {"-v"},  metaVar = "VERBOSE", usage = "Print verbose versions")
  private boolean verbose;

  @Override
  public void run() {
	  stdout.println(String.format("Version: %s", Constants.getGitBlitVersion(),
        verbose));
  }
}

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

package com.gitblit.transport.ssh.commands;

import com.gitblit.Constants;
import com.gitblit.transport.ssh.CommandMetaData;

@CommandMetaData(name="version", description = "Display the Gitblit version")
public class VersionCommand extends SshCommand {

  @Override
  public void run() {
	  stdout.println(Constants.getGitBlitVersion());
  }
}

Simplify version command and output

Simplify version command and output


package org.jenkinsci.plugins.radargun;

/**
 * Represents remote login programs like ssh
 *
 * @author vjuranek
 *
 */
public enum RemoteLoginProgram {

    SSH("ssh", new String[] {"/usr/bin/ssh", "-q", "-o", "StrictHostKeyChecking=no"}),
    MRSH("mrsh", new String[] {"/usr/bin/mrsh"});

    private final String name;
    private final String[] cmd;

    private RemoteLoginProgram(String name, String[] cmd) {
        this.name = name;
        this.cmd = cmd;
    }

    public String getName() {
        return name;
    }

    public String[] getCmd() {
        return cmd;
    }
}

package org.jenkinsci.plugins.radargun;

/**
 * Represents remote login programs like ssh
 *
 * @author vjuranek
 *
 */
public enum RemoteLoginProgram {

    SSH("ssh", new String[] {"/usr/bin/ssh", "-q", "-o", "StrictHostKeyChecking=no"}),
    MRSH("mrsh", new String[] {"/usr/bin/mrsh"});

    private final String name;
    private final String[] cmd;

    private RemoteLoginProgram(String name, String[] cmd) {
        this.name = name;
        this.cmd = cmd;
    }

    public String getName() {
        return name;
    }

    public String[] getCmd() {
        return cmd.clone();
    }
}

Fix FindBugs issues: don't expose internal objects


package com.amazonaws.service.apigateway.importer.config;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;

public class AwsConfig {
    private String region = "us-east-1";
    private String profile = "default";

    public String getRegion() {
        return region;
    }

    public String getProfile() {
        return profile;
    }

    public void load() {

        String home = System.getProperty("user.home");
//        ProfilesConfigFile file = new ProfilesConfigFile(home + "/.aws/config");

        Properties awsConfigProperties = new Properties();

        // todo: use profile
        try {
            awsConfigProperties.load(new FileInputStream(home + "/.aws/config"));
        } catch (IOException e) {
            throw new RuntimeException("Could not load configuration. Please run 'aws configure'");
        }

        region = awsConfigProperties.getProperty("region");
    }

}

package com.amazonaws.service.apigateway.importer.config;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;

public class AwsConfig {
    private static final Log LOG = LogFactory.getLog(AwsConfig.class);

    private String region = "us-east-1";
    private String profile = "default";

    public String getRegion() {
        return region;
    }

    public String getProfile() {
        return profile;
    }

    public void load() {
        String home = System.getProperty("user.home");

        Properties awsConfigProperties = new Properties();

        try {
            // todo: use default profile
            awsConfigProperties.load(new FileInputStream(home + "/.aws/config"));
        } catch (IOException e) {
            throw new RuntimeException("Could not load configuration. Please run 'aws configure'");
        }

        String region = awsConfigProperties.getProperty("region");

        if (region != null) {
            this.region = region;
        } else {
            LOG.warn("Could not load region configuration. Please ensure AWS CLI is configured via 'aws configure'. Will use default region of " + this.region);
        }

    }

}

Use default region if region settings not configured


import httpserver.WebServer;
import requests.CiphersuiteRequest;
import requests.Ecrypt2LevelRequest;
import requests.OpenPortRequest;

import java.util.Random;

public class Client {
    public static void main(String[] args) {
        WebServer ws = new WebServer();

        Random r = new Random();
        for (int i = 0; i < 10; i++) {
            switch (r.nextInt(3)) {
                case 0: new Thread(new CiphersuiteRequest()).start();
                        break;
                case 1: new Thread(new Ecrypt2LevelRequest()).start();
                        break;
                case 2: new Thread(new OpenPortRequest()).start();
                        break;
            }
        }
    }
}

import httpserver.WebServer;
import requests.CiphersuiteRequest;
import requests.Ecrypt2LevelRequest;
import requests.OpenPortRequest;

public class Client {
    public static void main(String[] args) {
        WebServer ws = new WebServer();

        /*
        Random r = new Random();
        for (int i = 0; i < 10; i++) {
            switch (r.nextInt(3)) {
                case 0: new Thread(new CiphersuiteRequest()).start();
                        break;
                case 1: new Thread(new Ecrypt2LevelRequest()).start();
                        break;
                case 2: new Thread(new OpenPortRequest()).start();
                        break;
            }
        }
        */

        for (int i = 0; i < 334; i++ ) {
            new Thread(new CiphersuiteRequest()).start();
        }

        for (int i = 0; i < 333; i++) {
            new Thread(new Ecrypt2LevelRequest()).start();
        }

        for(int i = 0; i < 333; i++ ) {
            new Thread(new OpenPortRequest()).start();
        }
    }
}

Remove random execution of requests.

Remove random execution of requests.


package com.andela.webservice;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import com.andela.webservice.model.Flower;

import java.util.List;

/**
 * Created by Spykins on 11/06/16.
 */
public class FlowerAdapter extends ArrayAdapter<Flower> {
    private Context context;
    @SuppressWarnings("unused")
    private List<Flower> flowerList;

    public FlowerAdapter(Context context, int resource, List<Flower> objects) {
        super(context, resource, objects);
        this.context = context;
        this.flowerList = objects;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        LayoutInflater inflater =
                (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
        View view = inflater.inflate(R.layout.item_flower, parent, false);

        //Display flower name in the TextView widget
        Flower flower = flowerList.get(position);
        TextView tv = (TextView) view.findViewById(R.id.textView1);
        tv.setText(flower.getName());
        return view;
    }
}

package com.andela.webservice;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.andela.webservice.model.Flower;

import java.util.List;

/**
 * Created by Spykins on 11/06/16.
 */
public class FlowerAdapter extends ArrayAdapter<Flower> {
    private Context context;
    @SuppressWarnings("unused")
    private List<Flower> flowerList;

    public FlowerAdapter(Context context, int resource, List<Flower> objects) {
        super(context, resource, objects);
        this.context = context;
        this.flowerList = objects;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        LayoutInflater inflater =
                (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
        View view = inflater.inflate(R.layout.item_flower, parent, false);

        //Display flower name in the TextView widget
        Flower flower = flowerList.get(position);
        TextView tv = (TextView) view.findViewById(R.id.textView1);
        tv.setText(flower.getName());

        ImageView img = (ImageView) view.findViewById(R.id.imageView1);
        img.setImageBitmap(flower.getBitmap());
        return view;
    }
}

Set up the view to use the ImageView created in the getView


package ch.jalu.injector.annotationhandlers;

import javax.annotation.Nullable;
import java.lang.annotation.Annotation;

/**
 * .
 */
public abstract class TypeSafeAnnotationHandler<T extends Annotation> implements AnnotationHandler {

    @Override
    public final Object resolveValue(Annotation... annotations) {
        final Class<T> type = getAnnotationType();
        for (Annotation annotation : annotations) {
            if (type.isInstance(annotation)) {
                return resolveValueSafely(type.cast(annotation));
            }
        }
        return null;
    }

    protected abstract Class<T> getAnnotationType();

    @Nullable
    protected abstract Object resolveValueSafely(T annotation);
}

package ch.jalu.injector.annotationhandlers;

import javax.annotation.Nullable;
import java.lang.annotation.Annotation;

/**
 * Type safe annotation handler base, which will fire the resolve method only if
 * an annotation of the given type is present.
 */
public abstract class TypeSafeAnnotationHandler<T extends Annotation> implements AnnotationHandler {

    @Override
    public final Object resolveValue(Class<?> clazz, Annotation... annotations) throws Exception {
        final Class<T> type = getAnnotationType();
        for (Annotation annotation : annotations) {
            if (type.isInstance(annotation)) {
                return resolveValueSafely(clazz, type.cast(annotation));
            }
        }
        return null;
    }

    /**
     * Returns the class of the annotation the handler can process.
     *
     * @return the annotation type
     */
    protected abstract Class<T> getAnnotationType();

    /**
     * Resolves the value with the matched annotation, guaranteed to never be null.
     *
     * @param clazz the dependency's type
     * @param annotation the matched annotation
     * @return the resolved value, or null if none applicable
     */
    @Nullable
    protected abstract Object resolveValueSafely(Class<?> clazz, T annotation) throws Exception;
}

Revert code changes from bea7cd1

Revert code changes from bea7cd1


package totemic_commons.pokefenn.ceremony;

import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import totemic_commons.pokefenn.api.ceremony.Ceremony;
import totemic_commons.pokefenn.api.music.MusicInstrument;
import totemic_commons.pokefenn.entity.boss.EntityBaykok;
import totemic_commons.pokefenn.util.EntityUtil;

public class CeremonyBaykok extends Ceremony
{
    public CeremonyBaykok(String name, int musicNeeded, int maxStartupTime, MusicInstrument... instruments)
    {
        super(name, musicNeeded, maxStartupTime, instruments);
    }

    @Override
    public void effect(World world, BlockPos pos, int time)
    {
        if(world.isRemote || time != getEffectTime() - 1)
            return;

        world.playBroadcastSound(1013, pos, 0); //Wither spawn sound
        BlockPos spos = pos.offset(EnumFacing.getHorizontal(world.rand.nextInt(4)));
        EntityUtil.spawnEntity(world, spos.getX() + 0.5, spos.getY(), spos.getZ() + 0.5, new EntityBaykok(world));
    }

    @Override
    public int getEffectTime()
    {
        return 3 * 20;
    }
}

package totemic_commons.pokefenn.ceremony;

import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import totemic_commons.pokefenn.api.ceremony.Ceremony;
import totemic_commons.pokefenn.api.music.MusicInstrument;
import totemic_commons.pokefenn.entity.boss.EntityBaykok;

public class CeremonyBaykok extends Ceremony
{
    public CeremonyBaykok(String name, int musicNeeded, int maxStartupTime, MusicInstrument... instruments)
    {
        super(name, musicNeeded, maxStartupTime, instruments);
    }

    @Override
    public void effect(World world, BlockPos pos, int time)
    {
        if(world.isRemote || time != getEffectTime() - 1)
            return;

        world.playBroadcastSound(1013, pos, 0); //Wither spawn sound
        BlockPos spos = pos.offset(EnumFacing.getHorizontal(world.rand.nextInt(4)));
        EntityBaykok baykok = new EntityBaykok(world);
        baykok.setPosition(spos.getX() + 0.5, spos.getY(), spos.getZ() + 0.5);
        baykok.onInitialSpawn(world.getDifficultyForLocation(spos), null);
        world.spawnEntityInWorld(baykok);
    }

    @Override
    public int getEffectTime()
    {
        return 4 * 20;
    }
}

Fix Baykok spawning without his bow

Fix Baykok spawning without his bow

Increase time between finishing the ceremony and spawning Baykok


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

import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;

public class ControllableViewPager extends ViewPager {

    private boolean mPagingEnabled;

    public ControllableViewPager(final Context context, final AttributeSet attrs) {
        super(context, attrs);
        mPagingEnabled = true;
    }

    @Override
    public boolean onTouchEvent(final MotionEvent event) {
        if (mPagingEnabled) {
            return super.onTouchEvent(event);
        }

        return true;
    }

    @Override
    public boolean onInterceptTouchEvent(final MotionEvent event) {
        if (mPagingEnabled) {
            return super.onInterceptTouchEvent(event);
        }

        return true;
    }

    public void setPagingEnabled(final boolean enabled) {
        mPagingEnabled = enabled;
    }
}

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

import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;

public class ControllableViewPager extends ViewPager {

    private boolean mPagingEnabled;

    public ControllableViewPager(final Context context, final AttributeSet attrs) {
        super(context, attrs);
        mPagingEnabled = true;
    }

    @Override
    public boolean onTouchEvent(final MotionEvent event) {
        if (mPagingEnabled) {
            return super.onTouchEvent(event);
        }

        return false;
    }

    @Override
    public boolean onInterceptTouchEvent(final MotionEvent event) {
        if (mPagingEnabled) {
            return super.onInterceptTouchEvent(event);
        }

        return false;
    }

    public void setPagingEnabled(final boolean enabled) {
        mPagingEnabled = enabled;
    }
}

Fix vertical scrolling on race details activity on older devices

When the Google Maps workaround is needed on older devices, the
vertical scrolling was also inadvertently disabled.

Signed-off-by: Greg Meiste <8a8f45e57c045ec63dc7e56e5eda862ea8c7cd4f@gmail.com>


package scratch;

import com.ettrema.httpclient.ReportMethod;
import java.io.IOException;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.StringRequestEntity;

/**
 *
 * @author brad
 */
public class PrincipalsReport {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {
        HttpClient client = new HttpClient();
        ReportMethod rm = new ReportMethod( "http://localhost:9080/webdav-caldav/principals");
        rm.setRequestHeader( "depth", "0");
        rm.setRequestEntity( new StringRequestEntity( "<x0:principal-search-property-set xmlns:x0=\"DAV:\"/>", "text/xml", "UTF-8"));
        int result = client.executeMethod( rm );
        System.out.println( "result: " + result );
        String resp = rm.getResponseBodyAsString();
        System.out.println( "response--" );
        System.out.println( resp );
    }

}

package scratch;

import com.ettrema.httpclient.ReportMethod;
import java.io.IOException;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.StringRequestEntity;

/**
 *
 * @author brad
 */
public class PrincipalsReport {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {
        HttpClient client = new HttpClient();
        ReportMethod rm = new ReportMethod( "http://localhost:9080/principals");
        rm.setRequestHeader( "depth", "0");
        rm.setRequestEntity( new StringRequestEntity( "<x0:principal-search-property-set xmlns:x0=\"DAV:\"/>", "text/xml", "UTF-8"));
        int result = client.executeMethod( rm );
        System.out.println( "result: " + result );
        String resp = rm.getResponseBodyAsString();
        System.out.println( "response--" );
        System.out.println( resp );
    }

}

Change context to / to support OS X and Windows


/*******************************************************************************
 * Copyright (c) 2011 itemis AG (http://www.itemis.eu) and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *******************************************************************************/
package org.eclipse.xtext.generator;

import static com.google.common.collect.Sets.*;

import java.util.Set;

import com.google.inject.Singleton;

/**
 * @author Sven Efftinge - Initial contribution and API
 * @since 2.1
 */
@Singleton
public class OutputConfigurationProvider implements IOutputConfigurationProvider {
	private Set<OutputConfiguration> outputConfigurations;

	/**
	 * @return a set of {@link OutputConfiguration} available for the generator
	 */
	public Set<OutputConfiguration> getOutputConfigurations() {
		if (outputConfigurations == null) {
			outputConfigurations = newHashSet();
			OutputConfiguration defaultOutput = new OutputConfiguration(IFileSystemAccess.DEFAULT_OUTPUT);
			defaultOutput.setDescription("Output Folder");
			defaultOutput.setOutputDirectory("./src-gen");
			defaultOutput.setOverrideExistingResources(true);
			defaultOutput.setCreateOutputDirectory(true);
			defaultOutput.setCleanUpDerivedResources(true);
			defaultOutput.setSetDerivedProperty(true);
			outputConfigurations.add(defaultOutput);
		}
		return outputConfigurations;
	}

	/**
	 * @since 2.5
	 */
	public void setOutputConfigurations(Set<OutputConfiguration> outputConfigurations) {
		this.outputConfigurations = outputConfigurations;
	}
}

/*******************************************************************************
 * Copyright (c) 2011 itemis AG (http://www.itemis.eu) and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *******************************************************************************/
package org.eclipse.xtext.generator;

import static com.google.common.collect.Sets.*;

import java.util.Set;

/**
 * @author Sven Efftinge - Initial contribution and API
 * @since 2.1
 */
public class OutputConfigurationProvider implements IOutputConfigurationProvider {

	/**
	 * @return a set of {@link OutputConfiguration} available for the generator
	 */
	public Set<OutputConfiguration> getOutputConfigurations() {
		OutputConfiguration defaultOutput = new OutputConfiguration(IFileSystemAccess.DEFAULT_OUTPUT);
		defaultOutput.setDescription("Output Folder");
		defaultOutput.setOutputDirectory("./src-gen");
		defaultOutput.setOverrideExistingResources(true);
		defaultOutput.setCreateOutputDirectory(true);
		defaultOutput.setCleanUpDerivedResources(true);
		defaultOutput.setSetDerivedProperty(true);
		return newHashSet(defaultOutput);
	}
}

Revert "[generator] allow overwriting default output configuration"

This reverts commit 256b013e2cd00d0a51350f9aa18e118b6c72dfe8.


package info.u_team.u_team_test.dimension;

import info.u_team.u_team_test.init.TestBiomes;
import net.minecraft.world.World;
import net.minecraft.world.biome.provider.*;
import net.minecraft.world.dimension.*;
import net.minecraft.world.gen.*;

public class BasicDimension extends OverworldDimension {

	public BasicDimension(World world, DimensionType type) {
		super(world, type);
	}

	@Override
	public ChunkGenerator<? extends GenerationSettings> createChunkGenerator() {
		final ChunkGeneratorType<OverworldGenSettings, OverworldChunkGenerator> chunkgenerator = ChunkGeneratorType.SURFACE;
		final BiomeProviderType<SingleBiomeProviderSettings, SingleBiomeProvider> biomeprovidertype = BiomeProviderType.FIXED;

		final OverworldGenSettings overworldgensettings = chunkgenerator.createSettings();
		final SingleBiomeProviderSettings overworldbiomeprovidersettings = biomeprovidertype.func_226840_a_(world.getWorldInfo()).setBiome(TestBiomes.BASIC);
		return chunkgenerator.create(this.world, biomeprovidertype.create(overworldbiomeprovidersettings), overworldgensettings);
	}

}

package info.u_team.u_team_test.dimension;

import info.u_team.u_team_test.init.TestBiomes;
import net.minecraft.world.World;
import net.minecraft.world.biome.provider.*;
import net.minecraft.world.dimension.*;
import net.minecraft.world.gen.*;

public class BasicDimension extends OverworldDimension {

	public BasicDimension(World world, DimensionType type) {
		super(world, type);
	}

	@Override
	public ChunkGenerator<? extends GenerationSettings> createChunkGenerator() {
		final ChunkGeneratorType<OverworldGenSettings, OverworldChunkGenerator> chunkgenerator = ChunkGeneratorType.SURFACE;
		final BiomeProviderType<SingleBiomeProviderSettings, SingleBiomeProvider> biomeprovidertype = BiomeProviderType.FIXED;

		final OverworldGenSettings overworldgensettings = chunkgenerator.createSettings();
		final SingleBiomeProviderSettings overworldbiomeprovidersettings = biomeprovidertype.createSettings(world.getWorldInfo()).setBiome(TestBiomes.BASIC);
		return chunkgenerator.create(this.world, biomeprovidertype.create(overworldbiomeprovidersettings), overworldgensettings);
	}

}

Fix new name in test mod

Fix new name in test mod


package com.example.examplemod;

import net.minecraft.block.Block;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;

@Mod(modid = ExampleMod.MODID, version = ExampleMod.VERSION)
public class ExampleMod
{
    public static final String MODID = "examplemod";
    public static final String VERSION = "1.0";

    @EventHandler
    public void init(FMLInitializationEvent event)
    {
		// some example code
        System.out.println("DIRT BLOCK >> "+Block.dirt.getUnlocalizedName());
    }
}

package com.example.examplemod;

import net.minecraft.init.Blocks;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;

@Mod(modid = ExampleMod.MODID, version = ExampleMod.VERSION)
public class ExampleMod
{
    public static final String MODID = "examplemod";
    public static final String VERSION = "1.0";

    @EventHandler
    public void init(FMLInitializationEvent event)
    {
		// some example code
        System.out.println("DIRT BLOCK >> "+Blocks.dirt.func_149739_a());
    }
}

Fix example mod code for 1.7

Fix example mod code for 1.7


package com.crawljax.util;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

import java.io.File;

import org.junit.Ignore;

public class PrettyHTMLTest {

	private static final String TESTFILE = "src/test/java/com/crawljax/util/tuduDombefore.html";
	private static final String CONTROLFILE =
	        "src/test/java/com/crawljax/util/tuduDombefore.html.tidy";

	@Ignore
	public void prettifyHTML() {
		String testdom = Helper.getContent(new File(TESTFILE));
		String controldom = Helper.getContent(new File(CONTROLFILE));

		assertNotNull("File should be read", testdom);
		assertNotNull("File should be read", controldom);

		testdom = PrettyHTML.prettyHTML(testdom);

		assertEquals(controldom, testdom);
	}
}

package com.crawljax.util;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

import java.io.File;

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

public class PrettyHTMLTest {

	private static final String TESTFILE = "src/test/java/com/crawljax/util/tuduDombefore.html";
	private static final String CONTROLFILE =
	        "src/test/java/com/crawljax/util/tuduDombefore.html.tidy";

	@Ignore
	@Test
	public void prettifyHTML() {
		String testdom = Helper.getContent(new File(TESTFILE));
		String controldom = Helper.getContent(new File(CONTROLFILE));

		assertNotNull("File should be read", testdom);
		assertNotNull("File should be read", controldom);

		testdom = PrettyHTML.prettyHTML(testdom);

		assertEquals(controldom, testdom);
	}
}

Add test annotation again, ignore overrides this.


package com.kickstarter.libs.gcm;

import android.content.Intent;

import com.google.android.gms.iid.InstanceIDListenerService;

import timber.log.Timber;

/**
 * Handle the creation, rotation, and updating of registration tokens.
 */
public class TokenListenerService extends InstanceIDListenerService {
  /**
   * Called if InstanceID token is updated. This may occur if the security of
   * the previous token had been compromised. This call is initiated by the
   * InstanceID provider.
   */
  @Override
  public void onTokenRefresh() {
    // Fetch updated Instance ID token and notify our app's server of any changes (if applicable).
    Timber.d("Token refreshed, creating new RegistrationService intent");
    final Intent intent = new Intent(this, RegistrationService.class);
    startService(intent);
  }
}

package com.kickstarter.libs.gcm;

import android.content.Intent;

import com.google.android.gms.iid.InstanceIDListenerService;

import timber.log.Timber;

public class TokenListenerService extends InstanceIDListenerService {
  /**
   * Called if the InstanceID token is updated. This can occur in a variety of scenarios - the
   * InstanceID service might periodically request that we refresh a token every 6 months, or
   * it could force a refresh if a token is invalidated (e.g. security issues, device information
   * is no longer valid.
   *
   * This call is generated by the InstanceID service, not by the app.
   */
  @Override
  public void onTokenRefresh() {
    // Fetch updated Instance ID token and notify our app's server of any changes (if applicable).
    Timber.d("Token refreshed, creating new RegistrationService intent");
    final Intent intent = new Intent(this, RegistrationService.class);
    startService(intent);
  }
}

Clarify role of token listener service

Clarify role of token listener service


/**
 *
 */
package at.porscheinformatik.seleniumcomponents;

import java.util.Locale;

/**
 * @author Daniel Furtlehner
 */
public final class LocaleUtils
{

    private LocaleUtils()
    {
        super();
    }

    /**
     * Parses the locale from the specified string. Expects the locale in the form of: language [SEPARATOR country
     * [SEPARATOR variant]]. The SEPARATOR may be '-' or '_'. If the string is empty or null it returns null.
     *
     * @param value the string
     * @return the locale
     */
    public static Locale toLocale(String value)
    {
        if (value == null || value.isBlank())
        {
            return Locale.ROOT;
        }

        String[] values = value.split("[_-]");

        if (values.length >= 3)
        {
            return new Locale(values[0], values[1], values[2]);
        }

        if (values.length == 2)
        {
            return new Locale(values[0], values[1]);
        }

        return new Locale(values[0]);
    }
}

/**
 *
 */
package at.porscheinformatik.seleniumcomponents;

import java.util.Locale;

/**
 * @author Daniel Furtlehner
 */
public final class LocaleUtils
{

    private LocaleUtils()
    {
        super();
    }

    /**
     * Parses the locale from the specified string. Expects the locale in the form of: language [SEPARATOR country
     * [SEPARATOR variant]]. The SEPARATOR may be '-' or '_'. If the string is empty or null it returns null.
     *
     * @param value the string
     * @return the locale
     */
    public static Locale toLocale(String value)
    {
        if (value == null || value.trim().length() == 0)
        {
            return Locale.ROOT;
        }

        String[] values = value.split("[_-]");

        if (values.length >= 3)
        {
            return new Locale(values[0], values[1], values[2]);
        }

        if (values.length == 2)
        {
            return new Locale(values[0], values[1]);
        }

        return new Locale(values[0]);
    }
}

Fix usage of java 11 API

Fix usage of java 11 API


package org.skife.jdbi.v2.logging;

import org.skife.jdbi.v2.tweak.SQLLog;
import org.skife.jdbi.v2.Handle;

/**
 * Default SQLLog implementation, does nothing
 */
public final class NoOpLog implements SQLLog
{

    final static BatchLogger batch = new BatchLogger() {

        public final void add(String sql)
        {
        }

        public final void log()
        {
        }
    };

    public void logBeginTransaction(Handle h)
    {
    }

    public void logCommitTransaction(Handle h)
    {
    }

    public void logRollbackTransaction(Handle h)
    {
    }

    public void logObtainHandle(Handle h)
    {
    }

    public void logReleaseHandle(Handle h)
    {
    }

    public void logSQL(String sql)
    {
    }

    public void logPreparedBatch(String sql, int count)
    {
    }

    public BatchLogger logBatch()
    {
        return null;
    }

    public void logCheckpointTransaction(Handle h, String name)
    {
    }

    public void logReleaseCheckpointTransaction(Handle h, String name)
    {
    }

    public void logRollbackToCheckpoint(Handle h, String checkpointName)
    {
    }
}

package org.skife.jdbi.v2.logging;

import org.skife.jdbi.v2.tweak.SQLLog;
import org.skife.jdbi.v2.Handle;

/**
 * Default SQLLog implementation, does nothing
 */
public final class NoOpLog implements SQLLog
{

    final static BatchLogger batch = new BatchLogger() {

        public final void add(String sql)
        {
        }

        public final void log()
        {
        }
    };

    public void logBeginTransaction(Handle h)
    {
    }

    public void logCommitTransaction(Handle h)
    {
    }

    public void logRollbackTransaction(Handle h)
    {
    }

    public void logObtainHandle(Handle h)
    {
    }

    public void logReleaseHandle(Handle h)
    {
    }

    public void logSQL(String sql)
    {
    }

    public void logPreparedBatch(String sql, int count)
    {
    }

    public BatchLogger logBatch()
    {
        return batch;
    }

    public void logCheckpointTransaction(Handle h, String name)
    {
    }

    public void logReleaseCheckpointTransaction(Handle h, String name)
    {
    }

    public void logRollbackToCheckpoint(Handle h, String checkpointName)
    {
    }
}

Change logging api to incldue handle

Change logging api to incldue handle


package devopsdistilled.operp.client;

import javax.swing.UIManager;
import javax.swing.UIManager.LookAndFeelInfo;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import devopsdistilled.operp.client.context.AppContext;
import devopsdistilled.operp.client.main.MainWindow;

public class ClientApp {

	public static void main(String[] args) {

		try {
			for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
				if ("Nimbus".equals(info.getName())) {
					UIManager.setLookAndFeel(info.getClassName());
					break;
				}
			}
		} catch (Exception e) {
			System.err
					.println("Nimbus Look and Feel not available.\nReverting to default");
		}

		if (args.length > 0)
			System.setProperty("server.rmi.host.address", args[0]);
		else
			System.setProperty("server.rmi.host.address", "127.0.1.1");

		ApplicationContext context = new AnnotationConfigApplicationContext(
				AppContext.class);

		MainWindow window = context.getBean(MainWindow.class);
		window.init();

		System.out.println(context);
	}
}

package devopsdistilled.operp.client;

import javax.swing.UIManager;
import javax.swing.UIManager.LookAndFeelInfo;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import devopsdistilled.operp.client.context.AppContext;
import devopsdistilled.operp.client.main.MainWindow;

public class ClientApp {

	public static void main(String[] args) {

		try {
			for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
				if ("Nimbus".equals(info.getName())) {
					UIManager.setLookAndFeel(info.getClassName());
					break;
				}
			}
		} catch (Exception e) {
			System.err
					.println("Nimbus Look and Feel not available.\nReverting to default");
		}

		if (args.length > 0)
			System.setProperty("server.rmi.host.address", args[0]);
		else
			System.setProperty("server.rmi.host.address", "localhost");

		ApplicationContext context = new AnnotationConfigApplicationContext(
				AppContext.class);

		MainWindow window = context.getBean(MainWindow.class);
		window.init();

		System.out.println(context);
	}
}

Set default server address to localhost

Set default server address to localhost

Was 127.0.1.1 before