package org.duckdns.raven.ttscallresponder.tts;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.telephony.TelephonyManager;
import android.util.Log;

public class StartAnsweringServiceReceiver extends BroadcastReceiver {
	private static final String TAG = "StartAnsweringServiceReceiver";

	@Override
	public void onReceive(Context context, Intent intent) {
		String state = intent.getStringExtra(TelephonyManager.EXTRA_STATE);
		Log.i(TAG, "Phone state changed: " + state);

		if (state.equals(TelephonyManager.EXTRA_STATE_RINGING)) {
			Log.i(TAG, "Ringing - preparing service");
			Intent startResponderService = new Intent(context, TtsAnsweringService.class);
			context.startService(startResponderService);
			Log.i(TAG, "Service started");
		}

		if (state.equals(TelephonyManager.EXTRA_STATE_OFFHOOK)) {
			Log.i(TAG, "InCall - answering");
		}
	}
}

package org.duckdns.raven.ttscallresponder.tts;

import org.duckdns.raven.ttscallresponder.domain.call.Call;
import org.duckdns.raven.ttscallresponder.domain.call.PersistentCallList;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.telephony.TelephonyManager;
import android.util.Log;

public class StartAnsweringServiceReceiver extends BroadcastReceiver {
	private static final String TAG = "StartAnsweringServiceReceiver";

	@Override
	public void onReceive(Context context, Intent intent) {
		String state = intent.getStringExtra(TelephonyManager.EXTRA_STATE);
		Log.i(TAG, "Phone state changed: " + state);

		if (state.equals(TelephonyManager.EXTRA_STATE_RINGING)) {
			Log.i(TAG, "Ringing - preparing service");
			Intent startResponderService = new Intent(context, TtsAnsweringService.class);
			context.startService(startResponderService);
			Log.i(TAG, "Service started");

			Log.i(TAG, "Adding to answered calls: " + intent.getStringExtra(TelephonyManager.EXTRA_INCOMING_NUMBER));
			PersistentCallList callList = new PersistentCallList(context.getFilesDir());
			callList.add(new Call(intent.getStringExtra(TelephonyManager.EXTRA_INCOMING_NUMBER)));
			callList.savePersistentList();
		}
	}
}

Add calls to list of answered calls.


package org.utplsql.cli;

import org.utplsql.api.JavaApiVersionInfo;

import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;

/** This class is getting updated automatically by the build process.
 * Please do not update its constants manually cause they will be overwritten.
 *
 * @author pesse
 */
public class CliVersionInfo {

    private static final String MAVEN_PROJECT_NAME = "utPLSL-cli";
    private static String MAVEN_PROJECT_VERSION = "unknown";

    static {
        try {
            MAVEN_PROJECT_VERSION = Files.readAllLines(
                    Paths.get(CliVersionInfo.class.getClassLoader().getResource("utplsql-cli.version").toURI())
                    , Charset.defaultCharset())
                    .get(0);
        }
        catch ( IOException | URISyntaxException e ) {
            System.out.println("WARNING: Could not get Version information!");
        }
    }

    public static String getVersion() { return MAVEN_PROJECT_VERSION; }
    public static String getInfo() { return MAVEN_PROJECT_NAME + " " + getVersion(); }

}

package org.utplsql.cli;

import org.utplsql.api.JavaApiVersionInfo;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URISyntaxException;

/** This class is getting updated automatically by the build process.
 * Please do not update its constants manually cause they will be overwritten.
 *
 * @author pesse
 */
public class CliVersionInfo {

    private static final String MAVEN_PROJECT_NAME = "utPLSL-cli";
    private static String MAVEN_PROJECT_VERSION = "unknown";

    static {
        try {
            try ( InputStream in = JavaApiVersionInfo.class.getClassLoader().getResourceAsStream("utplsql-cli.version")) {
                BufferedReader reader = new BufferedReader(new InputStreamReader(in));
                MAVEN_PROJECT_VERSION = reader.readLine();

                reader.close();
            }
        }
        catch ( IOException e ) {
            System.out.println("WARNING: Could not get Version information!");
        }
    }

    public static String getVersion() { return MAVEN_PROJECT_VERSION; }
    public static String getInfo() { return MAVEN_PROJECT_NAME + " " + getVersion(); }

}

Read the info from stream instead of NIO


package com.uwetrottmann.trakt5.enums;

/**
 * By default, all methods will return minimal info for movies, shows, episodes, and users. Minimal info is typically
 * all you need to match locally cached items and includes the title, year, and ids. However, you can request different
 * extended levels of information.
 */
public enum Extended implements TraktEnum {

    /** Default. Returns enough info to match locally. */
    DEFAULT_MIN("min"),
    /** Minimal info and all images. */
    IMAGES("images"),
    /** Complete info for an item. */
    FULL("full"),
    /** Complete info and all images. */
    FULLIMAGES("full,images");

    private final String value;

    private Extended(String value) {
        this.value = value;
    }

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

package com.uwetrottmann.trakt5.enums;

/**
 * By default, all methods will return minimal info for movies, shows, episodes, and users. Minimal info is typically
 * all you need to match locally cached items and includes the title, year, and ids. However, you can request different
 * extended levels of information.
 */
public enum Extended implements TraktEnum {

    /** Default. Returns enough info to match locally. */
    DEFAULT_MIN("min"),
    /** Minimal info and all images. */
    IMAGES("images"),
    /** Complete info for an item. */
    FULL("full"),
    /** Complete info and all images. */
    FULLIMAGES("full,images"),
    /** Only works with sync watchedShows. */
    NOSEASONS("noseasons"),
    /** Only works with sync watchedShows. */
    NOSEASONSIMAGES("noseasons,images");

    private final String value;

    Extended(String value) {
        this.value = value;
    }

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

Add support for noseasons extended flag.


package org.jaudiotagger.issues;

import org.jaudiotagger.AbstractTestCase;
import org.jaudiotagger.audio.AudioFile;
import org.jaudiotagger.audio.AudioFileIO;
import org.jaudiotagger.tag.FieldKey;

import java.io.File;

/**
 *File corrupt after write
 */
public class Issue290Test extends AbstractTestCase
{
    public void testSavingFile()
    {
        File orig = new File("testdata", "test59.mp4");
        if (!orig.isFile())
        {
            System.err.println("Unable to test file - not available");
            return;
        }

        File testFile = null;
        Exception exceptionCaught = null;
        try
        {
            testFile = AbstractTestCase.copyAudioToTmp("test59.mp4");
            AudioFile af = AudioFileIO.read(testFile);
            System.out.println("Tag is"+af.getTag().toString());
            af.getTag().setField(af.getTag().createField(FieldKey.ARTIST,"fred"));
            af.commit();

            af = AudioFileIO.read(testFile);
            assertEquals("fred",af.getTag().getFirst(FieldKey.ARTIST));
        }
        catch (Exception e)
        {
            e.printStackTrace();
            exceptionCaught = e;
        }

        assertNull(exceptionCaught);
    }

}

package org.jaudiotagger.issues;

import org.jaudiotagger.AbstractTestCase;
import org.jaudiotagger.audio.AudioFile;
import org.jaudiotagger.audio.AudioFileIO;
import org.jaudiotagger.tag.FieldKey;

import java.io.File;

/**
 *File corrupt after write
 */
public class Issue290Test extends AbstractTestCase
{
    public void testSavingFile()
    {
        File orig = new File("testdata", "test59.mp4");
        if (!orig.isFile())
        {
            System.err.println("Unable to test file - not available");
            return;
        }

        /* Issue still needs fixing
        File testFile = null;
        Exception exceptionCaught = null;
        try
        {
            testFile = AbstractTestCase.copyAudioToTmp("test59.mp4");
            AudioFile af = AudioFileIO.read(testFile);
            System.out.println("Tag is"+af.getTag().toString());
            af.getTag().setField(af.getTag().createField(FieldKey.ARTIST,"fred"));
            af.commit();

            af = AudioFileIO.read(testFile);
            assertEquals("fred",af.getTag().getFirst(FieldKey.ARTIST));
        }
        catch (Exception e)
        {
            e.printStackTrace();
            exceptionCaught = e;
        }

        assertNull(exceptionCaught);
        */
    }

}

Comment out test that fails locally because issue not resolved yet because preventing mvn deploy


package org.robockets.buttonmanger;

public class ButtonThread implements Runnable {
	private long startTime = 0;

	public void run() {
		while (true) {
			setTimeout();
			ButtonManager.checkButtons();
			waitUntilTimedOut();
		}
	}

	private void setTimeout() {
		startTime = System.nanoTime();
	}

	private void waitUntilTimedOut() {
		while (System.nanoTime() == startTime + 1000000000) { // 1000000000ns should be 1s
			// Just wait
		}
	}
}

package org.robockets.buttonmanger;

public class ButtonThread implements Runnable {
	private long startTime = 0;

	public void run() {
		while (true) {
			setTimeout();
			ButtonManager.checkButtons();
			waitUntilTimedOut();
		}
	}

	private void setTimeout() {
		startTime = System.nanoTime();
	}

	private void waitUntilTimedOut() {
		while (System.nanoTime() >= startTime + 1000000000) { // 1000000000ns should be 1s
			// Just wait
		}
	}
}

Make sure wait function catches everything


package com.speedment.runtime.core.internal.db;

import com.speedment.common.logger.Level;
import com.speedment.common.logger.Logger;

import java.util.List;
import java.util.stream.Collectors;

public final class SqlQueryLoggerUtil {

    public SqlQueryLoggerUtil() {}

    public static void logOperation(Logger logger, final String sql, final List<?> values) {
        if (logger.getLevel().isEqualOrLowerThan(Level.DEBUG)) {
            final String text = sql + " " + values.stream()
                    .map(o -> o.getClass().getSimpleName() + " " + o.toString())
                    .collect(Collectors.joining(", ", "[", "]"));
            logger.debug(text);
        }
    }
}

package com.speedment.runtime.core.internal.db;

import com.speedment.common.logger.Level;
import com.speedment.common.logger.Logger;

import java.util.List;
import java.util.stream.Collectors;

public final class SqlQueryLoggerUtil {

    public SqlQueryLoggerUtil() {}

    public static void logOperation(Logger logger, final String sql, final List<?> values) {
        if (logger.getLevel().isEqualOrLowerThan(Level.DEBUG)) {
            final String text = sql + " " + values.stream()
                    .map(o -> o == null
                            ? "null"
                            : o.getClass().getSimpleName() + " " + o.toString())
                    .collect(Collectors.joining(", ", "[", "]"));
            logger.debug(text);
        }
    }
}

Handle null values in query logger


package org.ethereum.datasource;

/**
 * Created by Anton Nashatyrev on 06.12.2016.
 */
public abstract class AbstractChainedSource<Key, Value, SourceKey, SourceValue> implements Source<Key, Value> {

    protected Source<SourceKey, SourceValue> source;
    protected boolean flushSource;

    protected AbstractChainedSource() {
    }

    public AbstractChainedSource(Source<SourceKey, SourceValue> source) {
        this.source = source;
    }

    protected void setSource(Source<SourceKey, SourceValue> src) {
        source = src;
    }

    public Source<SourceKey, SourceValue> getSource() {
        return source;
    }

    public void setFlushSource(boolean flushSource) {
        this.flushSource = flushSource;
    }

    @Override
    public final synchronized boolean flush() {
        if (flushSource) {
            getSource().flush();
        }
        return flushImpl();
    }

    protected abstract boolean flushImpl();
}

package org.ethereum.datasource;

/**
 * Abstract Source implementation with underlying backing Source
 * The class has control whether the backing Source should be flushed
 * in 'cascade' manner
 *
 * Created by Anton Nashatyrev on 06.12.2016.
 */
public abstract class AbstractChainedSource<Key, Value, SourceKey, SourceValue> implements Source<Key, Value> {

    private Source<SourceKey, SourceValue> source;
    private boolean flushSource;

    /**
     * Intended for subclasses which wishes to initialize the source
     * later via {@link #setSource(Source)} method
     */
    protected AbstractChainedSource() {
    }

    public AbstractChainedSource(Source<SourceKey, SourceValue> source) {
        this.source = source;
    }

    /**
     * Intended for subclasses which wishes to initialize the source later
     */
    protected void setSource(Source<SourceKey, SourceValue> src) {
        source = src;
    }

    public Source<SourceKey, SourceValue> getSource() {
        return source;
    }

    public void setFlushSource(boolean flushSource) {
        this.flushSource = flushSource;
    }

    /**
     * Invokes {@link #flushImpl()} and does backing Source flush if required
     * @return true if this or source flush did any changes
     */
    @Override
    public final synchronized boolean flush() {
        boolean ret = flushImpl();
        if (flushSource) {
            ret |= getSource().flush();
        }
        return ret;
    }

    /**
     * Should be overridden to do actual source flush
     */
    protected abstract boolean flushImpl();
}

Fix flush implementation: first own flush() should be performed. Add docs


package com.example.android.groupschedulecoordinator;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.Editable;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

import java.util.ArrayList;

public class ActivityCreateGroup extends AppCompatActivity {

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

    public void createGroup(View v) {
        EditText text =  (EditText) findViewById(R.id.tbGroupName);
        String groupName = text.getText().toString();
        if(groupName.isEmpty())
        {
            android.content.Context context = getApplicationContext();
            CharSequence warning = "Please enter a valid group name.";
            int duration = Toast.LENGTH_SHORT;

            Toast toast = Toast.makeText(context, warning, duration);
            toast.show();
        }
        else
        {
            Intent intent = new Intent(ActivityCreateGroup.this, MainActivity.class);

            Bundle extras = getIntent().getExtras();
            ArrayList<String> group_list = extras.getStringArrayList("groupList");
            group_list.add(groupName);

            //intent.putExtra("groupName", groupName);
            intent.putStringArrayListExtra("groupList", group_list);

            startActivity(intent);
        }

    }
}

package com.example.android.groupschedulecoordinator;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.Editable;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

import java.util.ArrayList;

public class ActivityCreateGroup extends AppCompatActivity {

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

    public void createGroup(View v) {
        EditText text =  (EditText) findViewById(R.id.tbGroupName);
        String groupName = text.getText().toString();
        if(groupName.isEmpty())
        {
            android.content.Context context = getApplicationContext();
            CharSequence warning = "Please enter a valid group name.";
            int duration = Toast.LENGTH_SHORT;

            Toast toast = Toast.makeText(context, warning, duration);
            toast.show();
        }
        else
        {
            Intent intent = new Intent(ActivityCreateGroup.this, MainActivity.class);

            Bundle extras = getIntent().getExtras();
            ArrayList<String> group_list = extras.getStringArrayList("groupList");

            if(group_list == null)
            {
                group_list = new ArrayList<>();
            }
            group_list.add(groupName);

            //intent.putExtra("groupName", groupName);
            intent.putStringArrayListExtra("groupList", group_list);

            startActivity(intent);
        }

    }
}

Fix crash when adding new group names


package io.github.lionell.lab1;

import com.google.common.base.Joiner;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;

import io.github.lionell.lab1.io.WordReader;

/**
 * Usage example: $ bazel run //java/util/github/lionell/lab1 --
 * /home/lionell/dev/labs/volohov/res/in.txt
 * /home/lionell/dev/labs/volohov/res/out.txt
 *
 * @author lionell
 */
public class Runner {
  public static void main(String[] args) throws IOException {
    WordReader reader = new WordReader(args[0]);
    System.out.println(args[0]);

    List<String> words = new ArrayList<>();
    while (reader.hasNext()) {
      words.add(reader.next());
    }

    reader.close();

    // FrequencySorter.sort(words);
    // System.out.println(Joiner.on(", ").join(words));

    Set<Set<String>> sets = new CliquesFinder(words).findCliques();

    PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter(args[1])));

    for (Set<String> set : sets) {
      writer.println("{" + Joiner.on(", ").join(set) + "}");
    }

    writer.close();
  }
}

package io.github.lionell.lab1;

import com.google.common.base.Joiner;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;

import io.github.lionell.lab1.io.WordReader;

/**
 * Usage example: $ bazel run //java/io/github/lionell/lab1 --
 * /home/lionell/dev/labs/volohov/res/in.txt
 * /home/lionell/dev/labs/volohov/res/out.txt
 *
 * @author lionell
 */
public class Runner {
  public static void main(String[] args) throws IOException {
    WordReader reader = new WordReader(args[0]);
    System.out.println(args[0]);

    List<String> words = new ArrayList<>();
    while (reader.hasNext()) {
      words.add(reader.next());
    }

    reader.close();

    // FrequencySorter.sort(words);
    // System.out.println(Joiner.on(", ").join(words));

    Set<Set<String>> sets = new CliquesFinder(words).findCliques();

    PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter(args[1])));

    for (Set<String> set : sets) {
      writer.println("{" + Joiner.on(", ").join(set) + "}");
    }

    writer.close();
  }
}

Fix minor bug in docs


package br.com.bloder.blormlib;

import android.content.Context;
import android.view.View;
import android.widget.Toast;

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

import br.com.bloder.blormlib.validation.Validate;
import br.com.bloder.blormlib.validation.Validation;

/**
 * Created by bloder on 05/06/16.
 */
public class Blorm {

  public static class Builder {

    private List<Validate> validations;
    private View field;

    public Builder() {
      validations = new ArrayList<>();
    }

    public Builder field(View field) {
      this.field = field;
      return this;
    }

    public Builder is(Validate validation) {
      this.validations.add(validation);
      return this;
    }

    public Builder is(Validation validation) {
      validation.field = this.field;
      this.validations.add(validation.validate());
      return this;
    }

    public void onSubmit(View submittedItem) {
      new Blorm(this.validations).onSubmitted();
    }
  }

  private List<Validate> validations;

  public Blorm(List<Validate> validations) {
    this.validations = validations;
  }

  private void onSubmitted() {
    for(Validate validate : validations) {
      if(validate.validate()) {
      } else {
      }
    }
  }
}

package br.com.bloder.blormlib;

import android.view.View;

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

import br.com.bloder.blormlib.validation.Validate;
import br.com.bloder.blormlib.validation.Validation;

/**
 * Created by bloder on 05/06/16.
 */
public class Blorm {

  public static class Builder {

    private List<Validate> validations;
    private View field;

    public Builder() {
      validations = new ArrayList<>();
    }

    public Builder field(View field) {
      this.field = field;
      return this;
    }

    public Builder is(Validate validation) {
      this.validations.add(validation);
      return this;
    }

    public Builder is(Validation validation) {
      validation.field = this.field;
      this.validations.add(validation.validate());
      return this;
    }

    public Builder is(String errorMessgae, Validation validation) {
      validation.field = this.field;
      validation.errorMessage = errorMessgae;
      this.validations.add(validation.validate());
      return this;
    }

    public void onSubmit(View submittedItem) {
      new Blorm(this.validations).onSubmitted();
    }
  }

  private List<Validate> validations;

  public Blorm(List<Validate> validations) {
    this.validations = validations;
  }

  private void onSubmitted() {
    for(Validate validate : validations) {
      if(!validate.validate()) {
        validate.onError();
      }
    }
  }
}

Add is function with error message in blorm class


package com.github.seratch.jslack.api.methods.response.oauth;

import com.github.seratch.jslack.api.methods.SlackApiResponse;
import lombok.Data;

import java.util.List;

@Data
public class OAuthAccessResponse implements SlackApiResponse {

    private boolean ok;
    private String warning;
    private String error;
    private String needed;
    private String provided;

    private String tokenType;
    private String accessToken;
    private String scope;
    private String enterpriseId;
    private String teamName;
    private String teamId;
    private String userId;
    private IncomingWebhook incomingWebhook;
    private Bot bot;

    private AuthorizingUser authorizingUser;
    private InstallerUser installerUser;
    @Deprecated // for workspace apps
    private Scopes scopes;

    @Data
    public static class IncomingWebhook {
        private String url;
        private String channel;
        private String channelId;
        private String configurationUrl;
    }

    @Data
    public static class Bot {
        private String botUserId;
        private String botAccessToken;
    }

    @Data
    public static class AuthorizingUser {
        private String userId;
        private String appHome;
    }

    @Data
    public static class InstallerUser {
        private String userId;
        private String appHome;
    }

    @Data
    public static class Scopes {
        private List<String> appHome;
        private List<String> team;
        private List<String> channel;
        private List<String> group;
        private List<String> mpim;
        private List<String> im;
        private List<String> user;
    }

}

package com.github.seratch.jslack.api.methods.response.oauth;

import com.github.seratch.jslack.api.methods.SlackApiResponse;
import lombok.Data;

import java.util.List;

@Data
public class OAuthAccessResponse implements SlackApiResponse {

    private boolean ok;
    private String warning;
    private String error;
    private String needed;
    private String provided;

    private String tokenType;
    private String accessToken;
    private String scope;
    private String enterpriseId;
    private String teamName;
    private String teamId;
    private String userId;
    private IncomingWebhook incomingWebhook;
    private Bot bot;

    @Data
    public static class IncomingWebhook {
        private String url;
        private String channel;
        private String channelId;
        private String configurationUrl;
    }

    @Data
    public static class Bot {
        private String botUserId;
        private String botAccessToken;
    }

    @Deprecated // for workspace apps
    private AuthorizingUser authorizingUser;
    @Deprecated // for workspace apps
    private InstallerUser installerUser;
    @Deprecated // for workspace apps
    private Scopes scopes;

    @Deprecated
    @Data
    public static class AuthorizingUser {
        private String userId;
        private String appHome;
    }

    @Deprecated
    @Data
    public static class InstallerUser {
        private String userId;
        private String appHome;
    }

    @Deprecated
    @Data
    public static class Scopes {
        private List<String> appHome;
        private List<String> team;
        private List<String> channel;
        private List<String> group;
        private List<String> mpim;
        private List<String> im;
        private List<String> user;
    }

}

Mark workspace app related properties as deprecated


/*
 * Copyright (C) 2009 The Guava 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 com.google.common.collect.testing;

import com.google.gwt.core.client.GwtScriptOnly;
import com.google.gwt.lang.Array;

/**
 * Version of {@link GwtPlatform} used in web-mode.  It includes methods in
 * {@link Platform} that requires different implementions in web mode and
 * hosted mode.  It is factored out from {@link Platform} because
 * {@literal @}GwtScriptOnly only supports public classes and methods.
 *
 * @author Hayward Chan
 */
@GwtScriptOnly
public final class GwtPlatform {

  private GwtPlatform() {}

  public static <T> T[] clone(T[] array) {
    return (T[]) Array.clone(array);
  }
}

/*
 * Copyright (C) 2009 The Guava 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 com.google.common.collect.testing;

import com.google.gwt.core.client.GwtScriptOnly;

import java.util.Arrays;

/**
 * Version of {@link GwtPlatform} used in web-mode.  It includes methods in
 * {@link Platform} that requires different implementions in web mode and
 * hosted mode.  It is factored out from {@link Platform} because
 * {@literal @}GwtScriptOnly only supports public classes and methods.
 *
 * @author Hayward Chan
 */
@GwtScriptOnly
public final class GwtPlatform {

  private GwtPlatform() {}

  public static <T> T[] clone(T[] array) {
    return (T[]) Arrays.copyOfRange(array, 0, array.length);
  }
}

Fix guava test breakage due to GWT internal changes.


package org.zalando.problem.spring.web.autoconfigure;

import org.apiguardian.api.API;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.WebSecurityConfigurer;
import org.zalando.problem.spring.web.advice.AdviceTrait;

import static org.apiguardian.api.API.Status.INTERNAL;

@API(status = INTERNAL)
@Configuration(proxyBeanMethods = false)
@ConditionalOnWebApplication
@ConditionalOnClass(WebSecurityConfigurer.class)
public class ProblemAutoConfiguration {

    @Bean
    @ConditionalOnMissingBean(AdviceTrait.class)
    public AdviceTrait exceptionHandling() {
        return new ExceptionHandling();
    }

}

package org.zalando.problem.spring.web.autoconfigure;

import org.apiguardian.api.API;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.zalando.problem.spring.web.advice.AdviceTrait;

import static org.apiguardian.api.API.Status.INTERNAL;

@API(status = INTERNAL)
@Configuration(proxyBeanMethods = false)
@ConditionalOnWebApplication
public class ProblemAutoConfiguration {

    @Bean
    @ConditionalOnMissingBean(AdviceTrait.class)
    public AdviceTrait exceptionHandling() {
        return new ExceptionHandling();
    }

}

Remove Spring Security class dependency


package com.philliphsu.bottomsheetpickers.view.numberpad;

import com.philliphsu.bottomsheetpickers.view.LocaleModel;

public class NumberPadTimePickerDialogPresenterTest extends NumberPadTimePickerPresenterTest {

    @Override
    INumberPadTimePicker.DialogView getView(int mode) {
        return (INumberPadTimePicker.DialogView) super.getView(mode);
    }

    @Override
    INumberPadTimePicker.DialogPresenter getPresenter(int mode) {
        return (INumberPadTimePicker.DialogPresenter) super.getPresenter(mode);
    }

    @Override
    Class<? extends INumberPadTimePicker.DialogView> getViewClass() {
        return INumberPadTimePicker.DialogView.class;
    }

    @Override
    INumberPadTimePicker.DialogPresenter createPresenter(INumberPadTimePicker.View view,
                                                   LocaleModel localeModel,
                                                   boolean is24HourMode) {
        return new NumberPadTimePickerDialogPresenter((INumberPadTimePicker.DialogView) view,
                localeModel, is24HourMode);
    }
}

package com.philliphsu.bottomsheetpickers.view.numberpad;

import com.philliphsu.bottomsheetpickers.view.LocaleModel;

import static org.mockito.Mockito.verify;

public class NumberPadTimePickerDialogPresenterTest extends NumberPadTimePickerPresenterTest {

    @Override
    public void verifyViewEnabledStatesForEmptyState() {
        super.verifyViewEnabledStatesForEmptyState();
        verify(getView(MODE_12HR)).setOkButtonEnabled(false);
        verify(getView(MODE_24HR)).setOkButtonEnabled(false);
    }

    @Override
    INumberPadTimePicker.DialogView getView(int mode) {
        return (INumberPadTimePicker.DialogView) super.getView(mode);
    }

    @Override
    INumberPadTimePicker.DialogPresenter getPresenter(int mode) {
        return (INumberPadTimePicker.DialogPresenter) super.getPresenter(mode);
    }

    @Override
    Class<? extends INumberPadTimePicker.DialogView> getViewClass() {
        return INumberPadTimePicker.DialogView.class;
    }

    @Override
    INumberPadTimePicker.DialogPresenter createPresenter(INumberPadTimePicker.View view,
                                                   LocaleModel localeModel,
                                                   boolean is24HourMode) {
        return new NumberPadTimePickerDialogPresenter((INumberPadTimePicker.DialogView) view,
                localeModel, is24HourMode);
    }
}

Add check to verify the 'ok' button is set disabled for Dialogs on empty-state initialization.


package swimmingpool.service;

import org.chtijbug.drools.platform.runtime.servlet.DroolsPlatformKnowledgeBaseJavaEE;
import org.chtijbug.drools.runtime.DroolsChtijbugException;
import org.chtijbug.drools.runtime.RuleBaseSession;
import org.chtijbug.example.swimmingpool.Abonnement;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.jws.WebParam;
import javax.jws.WebService;

@WebService(endpointInterface = "swimmingpool.service.IServiceCalculate")
public class ServiceCalculate implements IServiceCalculate {
    private static Logger logger = LoggerFactory.getLogger(ServiceCalculate.class);

    private DroolsPlatformKnowledgeBaseJavaEE platformKnowledgeBaseJavaEE;

    public void setRuleBasePackage(DroolsPlatformKnowledgeBaseJavaEE ruleBasePackage) {
        this.platformKnowledgeBaseJavaEE = ruleBasePackage;
    }

    @Override
    public Abonnement calculate(@WebParam(name = "abonnement") Abonnement abonnement) {
        RuleBaseSession sessionStatefull = null;
        try {
            sessionStatefull = platformKnowledgeBaseJavaEE.createRuleBaseSession();
            sessionStatefull.fireAllRulesAndStartProcess(abonnement, "P1.P1");
            sessionStatefull.dispose();
        } catch (DroolsChtijbugException e) {
            logger.error("Error in fireallrules", e);
        }
        return abonnement;
    }
}

package swimmingpool.service;

import org.chtijbug.drools.platform.runtime.servlet.DroolsPlatformKnowledgeBaseJavaEE;
import org.chtijbug.drools.runtime.DroolsChtijbugException;
import org.chtijbug.drools.runtime.RuleBaseSession;
import org.chtijbug.example.swimmingpool.Abonnement;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.jws.WebParam;
import javax.jws.WebService;

@WebService(endpointInterface = "swimmingpool.service.IServiceCalculate")
public class ServiceCalculate implements IServiceCalculate {
    private static Logger logger = LoggerFactory.getLogger(ServiceCalculate.class);

    private DroolsPlatformKnowledgeBaseJavaEE platformKnowledgeBaseJavaEE;

    public void setRuleBasePackage(DroolsPlatformKnowledgeBaseJavaEE ruleBasePackage) {
        this.platformKnowledgeBaseJavaEE = ruleBasePackage;
    }

    @Override
    public Abonnement calculate(@WebParam(name = "abonnement") Abonnement abonnement) {
        RuleBaseSession sessionStatefull = null;
        try {
            sessionStatefull = platformKnowledgeBaseJavaEE.createRuleBaseSession();
            sessionStatefull.fireAllRulesAndStartProcess(abonnement, "P001");
            sessionStatefull.dispose();
        } catch (DroolsChtijbugException e) {
            logger.error("Error in fireallrules", e);
        }
        return abonnement;
    }
}

Use Correct Process Name for Swimming pool example


package com.github.jmchilton.blend4j.galaxy.beans;

import org.codehaus.jackson.annotate.JsonProperty;

public class User extends GalaxyObject {
  private String email;

  public String getEmail() {
    return email;
  }

  public void setEmail(final String email) {
    this.email = email;
  }

  @JsonProperty("nice_total_disk_usage")
  public void setNiceTotalDiskUsage(final String niceTotalDiskUsage) {

  }

  @JsonProperty("total_disk_usage")
  public void setTotalDiskUsage(final String totalDiskUsage) {

  }

  public void setUsername(final String username) {

  }

}

package com.github.jmchilton.blend4j.galaxy.beans;

import org.codehaus.jackson.annotate.JsonProperty;

public class User extends GalaxyObject {
  private String email;
  private String username;

  public String getEmail() {
    return email;
  }

  public void setEmail(final String email) {
    this.email = email;
  }

  @JsonProperty("nice_total_disk_usage")
  public void setNiceTotalDiskUsage(final String niceTotalDiskUsage) {

  }

  @JsonProperty("total_disk_usage")
  public void setTotalDiskUsage(final String totalDiskUsage) {

  }

  public void setUsername(final String username) {
    this.username = username;
  }

  public String getUsername() {
    return username;
  }

}

Include retrieval of username information


/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.commons.math3.optimization;

import java.io.Serializable;

/**
 * Goal type for an optimization problem.
 * @version $Id$
 * @since 2.0
 */
public enum GoalType implements Serializable {

    /** Maximization goal. */
    MAXIMIZE,

    /** Minimization goal. */
    MINIMIZE

}

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.commons.math3.optimization;

import java.io.Serializable;

/**
 * Goal type for an optimization problem.
 *
 * @version $Id$
 * @since 2.0
 */
public enum GoalType implements Serializable {

    /** Maximization goal. */
    MAXIMIZE,

    /** Minimization goal. */
    MINIMIZE

}

Fix id tags and svn:keywords for optimization package.


import java.util.*;
import org.xbill.DNS.*;

public class lookup {

public static void
printAnswer(String name, Lookup lookup) {
	System.out.print(name + ":");
	int result = lookup.getResult();
	if (result != Lookup.SUCCESSFUL)
		System.out.print(" " + lookup.getErrorString());
	System.out.println();
	if (lookup.getResult() == Lookup.SUCCESSFUL) {
		Record [] answers = lookup.getAnswers();
		for (int i = 0; i < answers.length; i++)
			System.out.println(answers[i]);
	}
}

public static void
main(String [] args) throws Exception {
	short type = Type.A;
	int start = 0;
	if (args.length > 2 && args[0].equals("-t")) {
		type = Type.value(args[1]);
		if (type < 0)
			throw new IllegalArgumentException("invalid type");
		start = 2;
	}
	for (int i = start; i < args.length; i++) {
		Lookup l = new Lookup(args[i], type);
		l.run();
		printAnswer(args[i], l);
	}
}

}

import java.util.*;
import org.xbill.DNS.*;

public class lookup {

public static void
printAnswer(String name, Lookup lookup) {
	System.out.print(name + ":");
	int result = lookup.getResult();
	if (result != Lookup.SUCCESSFUL)
		System.out.print(" " + lookup.getErrorString());
	System.out.println();
	Name [] aliases = lookup.getAliases();
	if (aliases.length > 0) {
		System.out.print("# aliases: ");
		for (int i = 0; i < aliases.length; i++) {
			System.out.print(aliases[i]);
			if (i < aliases.length - 1)
				System.out.print(" ");
		}
		System.out.println();
	}
	if (lookup.getResult() == Lookup.SUCCESSFUL) {
		Record [] answers = lookup.getAnswers();
		for (int i = 0; i < answers.length; i++)
			System.out.println(answers[i]);
	}
}

public static void
main(String [] args) throws Exception {
	short type = Type.A;
	int start = 0;
	if (args.length > 2 && args[0].equals("-t")) {
		type = Type.value(args[1]);
		if (type < 0)
			throw new IllegalArgumentException("invalid type");
		start = 2;
	}
	for (int i = start; i < args.length; i++) {
		Lookup l = new Lookup(args[i], type);
		l.run();
		printAnswer(args[i], l);
	}
}

}

Print a list of aliases, if any exist.


package de.danoeh.antennapod.core.util;

import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;

import java.util.List;

public class IntentUtils {

    public static boolean isCallable(final Context context, final Intent intent) {
        List<ResolveInfo> list = context.getPackageManager().queryIntentActivities(intent,
                PackageManager.MATCH_DEFAULT_ONLY);
        return list.size() > 0;
    }

}

package de.danoeh.antennapod.core.util;

import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;

import java.util.List;

public class IntentUtils {

    /*
     *  Checks if there is at least one exported activity that can be performed for the intent
     */
    public static boolean isCallable(final Context context, final Intent intent) {
        List<ResolveInfo> list = context.getPackageManager().queryIntentActivities(intent,
                PackageManager.MATCH_DEFAULT_ONLY);
        for(ResolveInfo info : list) {
            if(info.activityInfo.exported) {
                return true;
            }
        }
        return false;
    }

}

Check if there is an exported activity for the intent


package uk.co.alynn.games.ld30;

import java.util.HashMap;
import java.util.Map;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.audio.Sound;

public class AudioEngine {
    private final Map<String, Sound> m_fx = new HashMap<String, Sound>();
    private static AudioEngine s_sharedEngine = null;

    public AudioEngine() {
        loadEffect("shoot", "kick.wav");
        loadEffect("hit", "snare.wav");
        loadEffect("invader-warn", "meepmerp.wav");
        loadEffect("tractor", "tractor.wav");
        loadEffect("invader-shoot", "dink.wav");
        loadEffect("invader-hit-planet", "dop.wav");
        loadEffect("game-over", "tish.wav");
    }

    private void loadEffect(String name, String file) {
        Sound effect = Gdx.audio.newSound(Gdx.files.internal("sfx/" + file));
        m_fx.put(name, effect);
    }

    public void play(String effect) {
        Sound fx = m_fx.get(effect);
        if (effect.equals("tractor")) {
            fx.play(0.1f);
        } else {
            fx.play();
        }
    }

    public void stopAll(String effect) {
        Sound fx = m_fx.get(effect);
        fx.stop();
    }

    public static AudioEngine get() {
        if (s_sharedEngine == null) {
            s_sharedEngine = new AudioEngine();
        }
        return s_sharedEngine;
    }
}

package uk.co.alynn.games.ld30;

import java.util.HashMap;
import java.util.Map;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.audio.Sound;

public class AudioEngine {
    private final Map<String, Sound> m_fx = new HashMap<String, Sound>();
    private static AudioEngine s_sharedEngine = null;

    public AudioEngine() {
        loadEffect("shoot", "kick.wav");
        loadEffect("hit", "snare.wav");
        loadEffect("invader-warn", "meepmerp.wav");
        loadEffect("tractor", "tractor.wav");
        loadEffect("invader-shoot", "dink.wav");
        loadEffect("invader-hit-planet", "dop.wav");
        loadEffect("game-over", "tish.wav");
    }

    private void loadEffect(String name, String file) {
        Sound effect = Gdx.audio.newSound(Gdx.files.internal("sfx/" + file));
        m_fx.put(name, effect);
    }

    public void play(String effect) {
        Sound fx = m_fx.get(effect);
        if (effect.equals("tractor")) {
            fx.play(0.6f);
        } else {
            fx.play();
        }
    }

    public void stopAll(String effect) {
        Sound fx = m_fx.get(effect);
        fx.stop();
    }

    public static AudioEngine get() {
        if (s_sharedEngine == null) {
            s_sharedEngine = new AudioEngine();
        }
        return s_sharedEngine;
    }
}

Make the tractor beam louder


/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.jena.fuseki.server;

public enum OperationName {
    // Fixed names give the codebase some resilience.

    Query("SPARQL Query"),
    Update("SPARQL Update"),
    Upload("File Upload"),
    GSP("Graph Store Protocol"),
    GSP_R("Graph Store Protocol (Read)"),
    Quads("HTTP Quads")
    ;

    private final String description ;
    private OperationName(String description) { this.description = description ; }
    public String getDescription() { return description ; }

}

/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.jena.fuseki.server;

public enum OperationName {
    // Fixed names give the codebase some resilience.
    Query("SPARQL Query"),
    Update("SPARQL Update"),
    Upload("File Upload"),
    GSP_RW("Graph Store Protocol"),
    GSP_R("Graph Store Protocol (Read)"),
    Quads_RW("HTTP Quads"),
    Quads_R("HTTP Quads (Read)")
    ;

    private final String description ;
    private OperationName(String description) { this.description = description ; }
    public String getDescription() { return description ; }

}

Add name to differentiate R and RW on quads/datatset.


/*
 * Copyright (C) The Apache Software Foundation. All rights reserved.
 *
 * This software is published under the terms of the Apache Software License
 * version 1.1, a copy of which has been included with this distribution in
 * the LICENSE file.
 */
package org.apache.james.services;

import java.util.Iterator;

import org.apache.avalon.phoenix.Service;

/**
 * Interface for Phoenix blocks to access a store of Users. A UserStore
 * contains one or more UserRepositories. Multiple UserRepositories may or may
 * not have overlapping membership.
 *
 * @version 1.0.0, 24/04/1999
 * @author  Federico Barbieri <scoobie@pop.systemy.it>
 * @author Charles Benett
 */
public interface UsersStore
    extends Service {

    String ROLE = "org.apache.james.services.UsersStore";

    UsersRepository getRepository( String name );

    Iterator getRepositoryNames();
}

/*
 * Copyright (C) The Apache Software Foundation. All rights reserved.
 *
 * This software is published under the terms of the Apache Software License
 * version 1.1, a copy of which has been included with this distribution in
 * the LICENSE file.
 */
package org.apache.james.services;

import java.util.Iterator;

/**
 * Interface for Phoenix blocks to access a store of Users. A UserStore
 * contains one or more UserRepositories. Multiple UserRepositories may or may
 * not have overlapping membership.
 *
 * @version 1.0.0, 24/04/1999
 * @author  Federico Barbieri <scoobie@pop.systemy.it>
 * @author Charles Benett
 */
public interface UsersStore {

    String ROLE = UsersStore.class.getName();

    UsersRepository getRepository( String name );

    Iterator getRepositoryNames();
}

Remove reference to long deprecated Service interface.


/*
 * 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.facebook.presto.hive.util;

import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;

public final class Types
{
    private Types() {}

    public static <A, B extends A> B checkType(A value, Class<B> target, String name)
    {
        checkNotNull(value, "%s is null", name);
        checkArgument(target.isInstance(value),
                "%s must be of type %s, not %s",
                name,
                target.getName(),
                value.getClass().getName());
        return target.cast(value);
    }
}

/*
 * 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.facebook.presto.hive.util;

import com.facebook.presto.spi.ErrorCode;
import com.facebook.presto.spi.PrestoException;

import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;

public final class Types
{
    private Types() {}

    public static <A, B extends A> B checkType(A value, Class<B> target, String name)
    {
        checkNotNull(value, "%s is null", name);
        checkArgument(target.isInstance(value),
                "%s must be of type %s, not %s",
                name,
                target.getName(),
                value.getClass().getName());
        return target.cast(value);
    }

    public static <A, B extends A> B checkType(A value, Class<B> target, ErrorCode errorCode, String name)
    {
        checkNotNull(value, "%s is null", name);
        if (!target.isInstance(value)) {
            throw new PrestoException(errorCode, String.format(
                    "%s must be of type %s, not %s",
                    name,
                    target.getName(),
                    value.getClass().getName()));
        }
        return target.cast(value);
    }
}

Add checkType that takes an error code


package com.chaoticdawgsoftware.algorithms.providerutils;

import java.security.Provider;
import java.security.Security;
import java.util.*;

/**
 * ProviderAlgorithmRetrievingFactory.java
 * Created by ChaoticDawg on 1/20/17.
 */

public class ProviderAlgorithmRetrievingFactory {
    private static Provider[] providers = Security.getProviders();

    public static ArrayList<String> getAlgorithmList(String algorithm) {
        return getSortedAlgorithmList(buildAlgorithmList(algorithm));
    }

    private static ArrayList<String> buildAlgorithmList(String algorithm) {
        Set<String> keyNameSet = new HashSet<>();
        for (Provider provider : providers)
            ProviderKeyListCreator.getKeyList(algorithm, keyNameSet, provider);

        return new ArrayList<>(keyNameSet);
    }

    private static ArrayList<String> getSortedAlgorithmList(ArrayList<String> keyList) {
        Collections.sort(keyList);
        return keyList;
    }
}

package com.chaoticdawgsoftware.algorithms.providerutils;

import java.security.Provider;
import java.security.Security;
import java.util.*;

/**
 * ProviderAlgorithmRetrievingFactory.java
 * Created by ChaoticDawg on 1/20/17.
 */

public class ProviderAlgorithmRetrievingFactory {
    private static Provider[] providers = Security.getProviders();

    public static ArrayList<String> getAlgorithmList(String algorithm) {
        ArrayList<String> AlgorithmList = buildAlgorithmList(algorithm);
        Collections.sort(AlgorithmList);
        return AlgorithmList;
    }

    private static ArrayList<String> buildAlgorithmList(String algorithm) {
        Set<String> keyNameSet = new HashSet<>();
        for (Provider provider : providers)
            ProviderKeyListCreator.getKeyList(algorithm, keyNameSet, provider);

        return new ArrayList<>(keyNameSet);
    }
}

Remove getSortedAlgorithmList method add sort to getAlgorithmList


package net.openhft.chronicle.wire;

import org.junit.Test;

import java.io.IOException;

import static org.junit.Assert.assertEquals;

/**
 * Created by peter on 17/05/2017.
 */
public class TextMethodTesterTest {
    @Test
    public void run() throws IOException {
        TextMethodTester test = new TextMethodTester<>(
                "methods-in.yaml",
                MockMethodsImpl::new,
                MockMethods.class,
                "methods-in.yaml").run();
        assertEquals(test.expected(), test.actual());
    }
}

class MockMethodsImpl implements MockMethods {
    private final MockMethods out;

    public MockMethodsImpl(MockMethods out) {
        this.out = out;
    }

    @Override
    public void method1(MockDto dto) {
        out.method1(dto);
    }

    @Override
    public void method2(MockDto dto) {
        out.method2(dto);
    }
}

package net.openhft.chronicle.wire;

import org.junit.Test;

import java.io.IOException;

import static org.junit.Assert.assertEquals;

/**
 * Created by peter on 17/05/2017.
 */
public class TextMethodTesterTest {
    @Test
    public void run() throws IOException {
        TextMethodTester test = new TextMethodTester<>(
                "methods-in.yaml",
                MockMethodsImpl::new,
                MockMethods.class,
                "methods-in.yaml")
                .setup("methods-in.yaml") // calls made here are ignored.
                .run();
        assertEquals(test.expected(), test.actual());
    }
}

class MockMethodsImpl implements MockMethods {
    private final MockMethods out;

    public MockMethodsImpl(MockMethods out) {
        this.out = out;
    }

    @Override
    public void method1(MockDto dto) {
        out.method1(dto);
    }

    @Override
    public void method2(MockDto dto) {
        out.method2(dto);
    }
}

Add support for a setup phase which is not recorded.


/**
 * Copyright (C) 2009 - present by OpenGamma Inc. and the OpenGamma group of companies
 *
 * Please see distribution for license.
 */
package com.opengamma.financial.aggregation;

import java.util.Collection;
import java.util.Collections;

import com.opengamma.core.position.Position;
import com.opengamma.financial.security.FinancialSecurityUtils;
/**
 * Function to classify positions by Currency.
 *
 */
public class CurrencyAggregationFunction implements AggregationFunction<String> {

  private static final String NAME = "Currency";

  @Override
  public String classifyPosition(Position position) {
    try {
      return FinancialSecurityUtils.getCurrency(position.getSecurity()).toString();
    } catch (UnsupportedOperationException ex) {
      return "No or multiple currencies";
    }
  }

  public String getName() {
    return NAME;
  }

  @Override
  public Collection<String> getRequiredEntries() {
    return Collections.emptyList();
  }
}

/**
 * Copyright (C) 2009 - present by OpenGamma Inc. and the OpenGamma group of companies
 *
 * Please see distribution for license.
 */
package com.opengamma.financial.aggregation;

import java.util.Collection;
import java.util.Collections;

import com.opengamma.core.position.Position;
import com.opengamma.financial.security.FinancialSecurityUtils;
import com.opengamma.util.money.Currency;
/**
 * Function to classify positions by Currency.
 *
 */
public class CurrencyAggregationFunction implements AggregationFunction<String> {

  private static final String NAME = "Currency";
  private static final String NO_CURRENCY = "No or multiple currencies";

  @Override
  public String classifyPosition(Position position) {
    try {
      Currency currency = FinancialSecurityUtils.getCurrency(position.getSecurity());
      if (currency == null) {
        return NO_CURRENCY;
      }
      return currency.toString();
    } catch (UnsupportedOperationException ex) {
      return NO_CURRENCY;
    }
  }

  public String getName() {
    return NAME;
  }

  @Override
  public Collection<String> getRequiredEntries() {
    return Collections.emptyList();
  }
}

Handle no currency properly, as well as multiple currency


package org.jvnet.hudson.plugins.triggers.startup;

import hudson.model.Node;

import java.io.Serializable;

/**
 * @author Gregory Boissinot
 */
public class HudsonStartupService implements Serializable {

    public boolean has2Schedule(HudsonStartupTrigger startupTrigger, Node jobNode) {

        if (startupTrigger == null) {
            throw new NullPointerException("A startupTrigger object has to be set.");
        }
        if (jobNode == null) {
            throw new NullPointerException("A node object has to be set.");
        }

        String triggerLabel = startupTrigger.getLabel();

        return has2Schedule(triggerLabel, jobNode);
    }

    private boolean has2Schedule(String triggerLabel, Node jobNode) {

        String jobNodeName = jobNode.getNodeName();

        if (triggerLabel == null) { //Jobs on master has to schedule
            return isMaster(jobNodeName);
        }

        if (triggerLabel.equalsIgnoreCase("master")) { //User set 'master' string, Jobs on master has to schedule
            return isMaster(jobNodeName);
        }

        if (triggerLabel.equalsIgnoreCase(jobNodeName)) { //Match exactly node name
            return true;
        }

        return triggerLabel.equalsIgnoreCase(jobNode.getLabelString());  //Match node label
    }

    private boolean isMaster(String nodeName) {
        //Master node name is "", slave node name is never empty
        return nodeName.equals("");
    }

}

package org.jvnet.hudson.plugins.triggers.startup;

import hudson.model.Node;

import java.io.Serializable;

/**
 * @author Gregory Boissinot
 */
public class HudsonStartupService implements Serializable {

    public boolean has2Schedule(HudsonStartupTrigger startupTrigger, Node jobNode) {

        if (startupTrigger == null) {
            throw new NullPointerException("A startupTrigger object has to be set.");
        }
        if (jobNode == null) {
            throw new NullPointerException("A node object has to be set.");
        }

        String triggerLabel = startupTrigger.getLabel();

        return has2Schedule(triggerLabel, jobNode);
    }

    private boolean has2Schedule(String triggerLabel, Node jobNode) {

        String jobNodeName = jobNode.getNodeName();

        if (triggerLabel == null) { //Jobs on master has to schedule
            return isMaster(jobNodeName);
        }

        if (triggerLabel.equalsIgnoreCase("master")) { //User set 'master' string, Jobs on master has to schedule
            return isMaster(jobNodeName);
        }

        if (triggerLabel.equalsIgnoreCase(jobNodeName)) { //Match exactly node name
            return true;
        }

        String labelString = jobNode.getLabelString();
        if (labelString == null) {
            return false;
        }

        if (triggerLabel.equalsIgnoreCase(labelString)) { //Match node label
            return true;
        }

        return labelString.contains(triggerLabel);
    }

    private boolean isMaster(String nodeName) {
        //Master node name is "", slave node name is never empty
        return nodeName.equals("");
    }

}

Enable to specify a string for the trigger label as a substring of the node label. For example a node label with "WinXP Acceptance London" and 'Restricted node Label = London'


package org.realityforge.jeo.geolatte.jpa.eclipselink;

import java.util.Properties;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public class DatabaseTestUtil
{
  static Properties initDatabaseProperties()
  {
    final Properties properties = new Properties();
    properties.put( "javax.persistence.jdbc.driver", "org.postgis.DriverWrapperAutoprobe" );
    final String databaseUrl = "jdbc:postgresql_autogis://127.0.0.1:5432/geolatte_test";
    setProperty( properties, "javax.persistence.jdbc.url", "test.db.url", databaseUrl );
    setProperty( properties, "javax.persistence.jdbc.user", "test.db.user", "geolatte" );
    setProperty( properties, "javax.persistence.jdbc.password", "test.db.password", null );
    properties.put( "eclipselink.session-event-listener", GeolatteExtension.class.getName() );
    return properties;
  }

  private static void setProperty( final Properties properties,
                                   final String key,
                                   final String systemPropertyKey, final String defaultValue )
  {
    final String value = System.getProperty( systemPropertyKey, defaultValue );
    if ( null != value )
    {
      properties.put( key, value );
    }
  }

  public static EntityManager createEntityManager( final String persistenceUnitName )
  {
    final Properties properties = initDatabaseProperties();
    final EntityManagerFactory factory = Persistence.createEntityManagerFactory( persistenceUnitName, properties );
    return factory.createEntityManager();
  }
}

package org.realityforge.jeo.geolatte.jpa.eclipselink;

import java.util.Properties;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public class DatabaseTestUtil
{
  static Properties initDatabaseProperties()
  {
    final Properties properties = new Properties();
    properties.put( "javax.persistence.jdbc.driver", "org.postgresql.Driver" );
    final String databaseUrl = "jdbc:postgresql://127.0.0.1:5432/geolatte_test";
    setProperty( properties, "javax.persistence.jdbc.url", "test.db.url", databaseUrl );
    setProperty( properties, "javax.persistence.jdbc.user", "test.db.user", "geolatte" );
    setProperty( properties, "javax.persistence.jdbc.password", "test.db.password", null );
    properties.put( "eclipselink.session-event-listener", GeolatteExtension.class.getName() );
    return properties;
  }

  private static void setProperty( final Properties properties,
                                   final String key,
                                   final String systemPropertyKey, final String defaultValue )
  {
    final String value = System.getProperty( systemPropertyKey, defaultValue );
    if ( null != value )
    {
      properties.put( key, value );
    }
  }

  public static EntityManager createEntityManager( final String persistenceUnitName )
  {
    final Properties properties = initDatabaseProperties();
    final EntityManagerFactory factory = Persistence.createEntityManagerFactory( persistenceUnitName, properties );
    return factory.createEntityManager();
  }
}

Revert to using the base postgres driver in tests


package net.md_5.bungee.api.plugin;

import java.util.Set;
import lombok.AllArgsConstructor;
import lombok.Data;

/**
 * POJO representing the plugin.yml file.
 */
@Data
@AllArgsConstructor
public class PluginDescription
{

    /**
     * Friendly name of the plugin.
     */
    private String name;
    /**
     * Plugin main class. Needs to extend {@link Plugin}.
     */
    private String main;
    /**
     * Plugin version.
     */
    private String version;
    /**
     * Plugin author.
     */
    private String author;
    /**
     * Plugin hard dependencies.
     */
    private Set<String> depends;

    public PluginDescription()
    {
    }
}

package net.md_5.bungee.api.plugin;

import java.util.HashSet;
import java.util.Set;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * POJO representing the plugin.yml file.
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class PluginDescription
{

    /**
     * Friendly name of the plugin.
     */
    private String name;
    /**
     * Plugin main class. Needs to extend {@link Plugin}.
     */
    private String main;
    /**
     * Plugin version.
     */
    private String version;
    /**
     * Plugin author.
     */
    private String author;
    /**
     * Plugin hard dependencies.
     */
    private Set<String> depends = new HashSet<>();
}

Initialize depends set to an empty set to prevent a NPE when no depends given.


package com.davidmogar.njc.ast.types;

import com.davidmogar.njc.ast.AbstractAstNode;

import java.util.List;

public class FunctionType extends AbstractAstNode implements Type {

    public List<Type> parameters;
    public Type returnType;

    public FunctionType(int line, int column, List<Type> parameters, Type returnType) {
        super(line, column);
        this.parameters = parameters;
        this.returnType = returnType;
    }
}

package com.davidmogar.njc.ast.types;

import com.davidmogar.njc.ast.AbstractAstNode;
import com.davidmogar.njc.ast.statements.definitions.VariableDefinition;

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

public class FunctionType extends AbstractAstNode implements Type {

    public List<VariableDefinition> parameters;
    public Type returnType;

    public FunctionType(int line, int column, Type returnType) {
        this(line, column, new ArrayList<>(), returnType);
    }

    public FunctionType(int line, int column, List<VariableDefinition> parameters, Type returnType) {
        super(line, column);
        this.parameters = parameters;
        this.returnType = returnType;
    }
}

Add facility constructor to function type


package cloud.swiftnode.kspam.util;

import java.net.MalformedURLException;
import java.net.URL;
import java.text.MessageFormat;

/**
 * Created by EntryPoint on 2017-01-05.
 */
public enum URLs {
    COMMUNITY_API("http://kspam.swiftnode.cloud/mcbanip/community.php?ip={0}"),
    SHROOMERY_API("http://www.shroomery.org/ythan/proxycheck.php?ip={0}"),
    STOPFORUM_API("http://www.stopforumspam.com/api?ip={0}"),
    BOTSCOUT_API("http://www.botscout.com/test/?ip={0}"),
    MCBLACKLIST_API("http://api.mc-blacklist.kr/API/check/{0}"),
    MOJANG_UUID_API("https://api.mojang.com/users/profiles/minecraft/{0}?at={1}"),
    GRADLE("https://raw.githubusercontent.com/EntryPointKR/K-SPAM/master/build.gradle"),
    CACHE("https://github.com/EntryPointKR/K-SPAM/blob/master/K-Spam.cache?raw=true");
    private final String addr;

    URLs(String addr) {
        this.addr = addr;
    }

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

    public URL toUrl() throws MalformedURLException {
        return toUrl("");
    }

    public URL toUrl(Object... value) throws MalformedURLException {
        String addr = MessageFormat.format(this.addr, value);
        return new URL(addr);
    }
}

package cloud.swiftnode.kspam.util;

import java.net.MalformedURLException;
import java.net.URL;
import java.text.MessageFormat;

/**
 * Created by EntryPoint on 2017-01-05.
 */
public enum URLs {
    COMMUNITY_API("http://kspam.swiftnode.cloud/mcbanip/community.php?ip={0}"),
    SHROOMERY_API("http://www.shroomery.org/ythan/proxycheck.php?ip={0}"),
    STOPFORUM_API("http://www.stopforumspam.com/api?ip={0}"),
    BOTSCOUT_API("http://www.botscout.com/test/?ip={0}"),
    MCBLACKLIST_API("http://api.mc-blacklist.kr/API/check/{0}"),
    MOJANG_UUID_API("https://api.mojang.com/users/profiles/minecraft/{0}?at={1}"),
    CACHE("https://github.com/EntryPointKR/K-SPAM/blob/master/K-Spam.cache?raw=true");
    private final String addr;

    URLs(String addr) {
        this.addr = addr;
    }

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

    public URL toUrl() throws MalformedURLException {
        return toUrl("");
    }

    public URL toUrl(Object... value) throws MalformedURLException {
        String addr = MessageFormat.format(this.addr, value);
        return new URL(addr);
    }
}

Remove unnecessary constructor 쓰이지 않는 생성자


package ganglia;

import ganglia.gmetric.GMetricSlope;
import ganglia.gmetric.GMetricType;

import java.lang.management.ManagementFactory;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.management.MBeanServer;
import javax.management.ObjectName;
import javax.management.openmbean.CompositeData;

public abstract class GSampler implements Runnable {

    private static Logger log =
            Logger.getLogger(GSampler.class.getName());
    /*
     * The internal data structure is a hashmap of key=mbean name
     */
    private int delay;
    private int initialDelay;
    private Publisher publisher = null;
    private String process = null ;

    /**
     * Creates a GSampler
     * @param delay the sample interval in seconds
     * @param process the process name that is appended to metrics
     */
    public GSampler(int initialDelay, int delay, String process ) {
    	this.initialDelay = initialDelay ;
        this.delay = delay;
        this.process = process;
    }

    /**
     * Returns the sample interval
     * @return the sample interval in seconds
     */
    public int getDelay() {
        return delay;
    }
    /**
     * Returns the initial delay before sampling begins
     * @return the delay in seconds
     */
    public int getInitialDelay() {
        return initialDelay;
    }

    public Publisher getPublisher() {
        return publisher;
    }

    public void setPublisher(Publisher publisher) {
        this.publisher = publisher;
    }

}

package ganglia;

import ganglia.gmetric.GMetricSlope;
import ganglia.gmetric.GMetricType;

import java.lang.management.ManagementFactory;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.management.MBeanServer;
import javax.management.ObjectName;
import javax.management.openmbean.CompositeData;

public abstract class GSampler implements Runnable {

    private static Logger log =
            Logger.getLogger(GSampler.class.getName());
    /*
     * The internal data structure is a hashmap of key=mbean name
     */
    private int delay;
    private int initialDelay;
    private Publisher publisher = null;
    protected String process = null ;

    /**
     * Creates a GSampler
     * @param delay the sample interval in seconds
     * @param process the process name that is appended to metrics
     */
    public GSampler(int initialDelay, int delay, String process ) {
    	this.initialDelay = initialDelay ;
        this.delay = delay;
        this.process = process;
    }

    /**
     * Returns the sample interval
     * @return the sample interval in seconds
     */
    public int getDelay() {
        return delay;
    }
    /**
     * Returns the initial delay before sampling begins
     * @return the delay in seconds
     */
    public int getInitialDelay() {
        return initialDelay;
    }

    public Publisher getPublisher() {
        return publisher;
    }

    public void setPublisher(Publisher publisher) {
        this.publisher = publisher;
    }

}

Make the GSample field protected for use by sub classes


/*
 * Copyright 2015 Red Hat, Inc. and/or its affiliates.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 *
 *      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.drools.benchmarks.session;

import java.util.concurrent.TimeUnit;
import org.drools.benchmarks.common.AbstractBenchmark;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.OutputTimeUnit;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.Warmup;

@Warmup(iterations = 4000)
@Measurement(iterations = 2000)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public abstract class AbstractEmptySessionBenchmark extends AbstractBenchmark {

    @Setup
    @Override
    public void setup() {
        createEmptyKieBase();
    }
}

/*
 * Copyright 2015 Red Hat, Inc. and/or its affiliates.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 *
 *      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.drools.benchmarks.session;

import java.util.concurrent.TimeUnit;
import org.drools.benchmarks.common.AbstractBenchmark;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.OutputTimeUnit;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.Warmup;

@Warmup(iterations = 200000)
@Measurement(iterations = 100000)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public abstract class AbstractEmptySessionBenchmark extends AbstractBenchmark {

    @Setup
    @Override
    public void setup() {
        createEmptyKieBase();
    }
}

Raise the number of iterations in empty session benchmarks


package net.srcdemo.userfs;

import java.io.File;

final class UnconsequentialFiles {
	private static final String[] unconsequential = { "Thumbs.db", ".DS_STORE" };

	static final boolean clearUnconsequentialFiles(final File directory) {
		if (!directory.isDirectory()) {
			return false;
		}
		boolean returnValue = false;
		File f;
		for (final String s : unconsequential) {
			f = new File(directory, s);
			if (f.exists()) {
				returnValue = f.delete() || returnValue;
			}
		}
		return returnValue;
	}
}

package net.srcdemo.userfs;

import java.io.File;

final class UnconsequentialFiles {
	private static final String[] unconsequential = { "Thumbs.db", ".DS_STORE", ".Trash", ".Trash-1000", ".xdg-volume-info",
		".directory" };

	static final boolean clearUnconsequentialFiles(final File directory) {
		if (!directory.isDirectory()) {
			return false;
		}
		boolean returnValue = false;
		File f;
		for (final String s : unconsequential) {
			f = new File(directory, s);
			if (f.exists()) {
				returnValue = f.delete() || returnValue;
			}
		}
		return returnValue;
	}
}

Add some more unconsequential files


/**
 * Defines the keys for the well known labels used by the cloud debugger.
 *
 * DO NOT EDIT - This file is auto-generated
 */
package com.google.devtools.clouddebugger.v2;

public final class Labels {
  public static final class Debuggee {

    public static final String MINOR_VERSION = "minorversion";
    public static final String DOMAIN = "domain";
    public static final String VERSION = "version";
    public static final String MODULE = "module";
    public static final String PROJECT_ID = "projectid";

    private Debuggee() {}
  }

  public static final class Breakpoint {

    public static final String REQUEST_LOG_ID = "requestlogid";

    private Breakpoint() {}
  }

  private Labels() {}
}

/**
 * Copyright 2015 Google Inc. All Rights Reserved.
 *
 * 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.
 */

/**
 * Defines the keys for the well known labels used by the cloud debugger.
 *
 * DO NOT EDIT - This file is auto-generated
 */
package com.google.devtools.clouddebugger.v2;

public final class Labels {
  public static final class Debuggee {

    public static final String DOMAIN = "domain";
    public static final String PROJECT_ID = "projectid";
    public static final String MODULE = "module";
    public static final String MINOR_VERSION = "minorversion";
    public static final String VERSION = "version";

    private Debuggee() {}
  }

  public static final class Breakpoint {

    public static final String REQUEST_LOG_ID = "requestlogid";

    private Breakpoint() {}
  }

  private Labels() {}
}

Clean moe_db.txt with direct equivalence mapping for the version 2.6 of Java Agent.


package org.spacehq.mc.protocol.packet.ingame.server.entity;

import org.spacehq.packetlib.io.NetInput;
import org.spacehq.packetlib.io.NetOutput;
import org.spacehq.packetlib.packet.Packet;

import java.io.IOException;

public class ServerEntityHeadLookPacket implements Packet {

	protected int entityId;
	protected float headYaw;

	@SuppressWarnings("unused")
	private ServerEntityHeadLookPacket() {
	}

	public ServerEntityHeadLookPacket(int entityId, float headYaw) {
		this.entityId = entityId;
		this.headYaw = headYaw;
	}

	public int getEntityId() {
		return this.entityId;
	}

	public float getHeadYaw() {
		return this.headYaw;
	}

	@Override
	public void read(NetInput in) throws IOException {
		this.entityId = in.readVarInt();
		this.headYaw = in.readByte() * 360 / 256f;
	}

	@Override
	public void write(NetOutput out) throws IOException {
		out.writeVarInt(this.entityId);
		out.writeByte((byte) (this.headYaw * 256 / 360));
	}

	@Override
	public boolean isPriority() {
		return false;
	}

}

package org.spacehq.mc.protocol.packet.ingame.server.entity;

import org.spacehq.packetlib.io.NetInput;
import org.spacehq.packetlib.io.NetOutput;
import org.spacehq.packetlib.packet.Packet;

import java.io.IOException;

public class ServerEntityHeadLookPacket implements Packet {

	private int entityId;
	private float headYaw;

	@SuppressWarnings("unused")
	private ServerEntityHeadLookPacket() {
	}

	public ServerEntityHeadLookPacket(int entityId, float headYaw) {
		this.entityId = entityId;
		this.headYaw = headYaw;
	}

	public int getEntityId() {
		return this.entityId;
	}

	public float getHeadYaw() {
		return this.headYaw;
	}

	@Override
	public void read(NetInput in) throws IOException {
		this.entityId = in.readVarInt();
		this.headYaw = in.readByte() * 360 / 256f;
	}

	@Override
	public void write(NetOutput out) throws IOException {
		out.writeVarInt(this.entityId);
		out.writeByte((byte) (this.headYaw * 256 / 360));
	}

	@Override
	public boolean isPriority() {
		return false;
	}

}

Fix visibility in head look packet.


package edu.wpi.first.wpilibj;

public class PWMObserver {
	private int channel;
	private boolean inverted = false;
	public PWMObserver(int channel) {
		this.channel = channel;
	}

	public double get() {
		double ret = 0;

		PWM temp = PWMStore.getPWM(channel);

		if (temp != null) {
			ret = temp.getSpeed() * (inverted ? -1.0 : 1.0);
		}

		return ret;

	}

	public void setInvertedMotor(boolean inverted) {
		this.inverted = inverted;
	}

	public boolean exists() {
		return PWMStore.exists(channel);
	}
}

package edu.wpi.first.wpilibj;

public class PWMObserver {
	private int channel;
	private boolean inverted = false;
	public PWMObserver(int channel) {
		this.channel = channel;
	}

	public double get() {
		double ret = 0;

		if (!DriverStation.getInstance().isEnabled()) {
			return 0;
		}

		PWM temp = PWMStore.getPWM(channel);

		if (temp != null) {
			ret = temp.getSpeed() * (inverted ? -1.0 : 1.0);
		}

		return ret;

	}

	public void setInvertedMotor(boolean inverted) {
		this.inverted = inverted;
	}

	public boolean exists() {
		return PWMStore.exists(channel);
	}
}

Disable PWMs when robot is disabled


package roart.iclij.verifyprofit;

import static org.junit.jupiter.api.Assertions.assertEquals;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.junit.jupiter.api.Test;

import roart.testdata.TestData;

public class VerifyProfitTest {
    @Test
    public void test() {
        TestData testData = new TestData();
        Map<String, List<List<Double>>> categoryValueMap = testData.getAbnormCatValMap();
        List<String> stockDates = testData.getStockDates(LocalDate.now(), 3, false);
        int firstidx = 2;
        int lastidx = 0;
        Double margin = 9.0;
        Set<String> excluded = new VerifyProfit().getTrend(categoryValueMap, stockDates, firstidx, lastidx, margin);
        assertEquals(1, excluded.size());
        margin = 0.0;
        excluded = new VerifyProfit().getTrend(categoryValueMap, stockDates, firstidx, lastidx, margin);
        assertEquals(1, excluded.size());
    }
}

package roart.iclij.verifyprofit;

import static org.junit.jupiter.api.Assertions.assertEquals;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.junit.jupiter.api.Test;

import roart.testdata.TestData;

public class VerifyProfitTest {
    @Test
    public void test() {
        TestData testData = new TestData();
        Map<String, List<List<Double>>> categoryValueMap = testData.getAbnormCatValMap();
        List<String> stockDates = testData.getStockDates(LocalDate.now(), 3, false);
        int firstidx = 2;
        int lastidx = 0;
        Double margin = 9.0;
        Set<String> excluded = new VerifyProfit().getTrend(categoryValueMap, stockDates, firstidx, lastidx, margin);
        assertEquals(1, excluded.size());
        margin = 0.0;
        excluded = new VerifyProfit().getTrend(categoryValueMap, stockDates, firstidx, lastidx, margin);
        assertEquals(1, excluded.size());
    }

    @Test
    public void testWithHoles() {
        TestData testData = new TestData();
        Map<String, List<List<Double>>> categoryValueMap = testData.getAbnormWithHolesCatValMap();
        List<String> stockDates = testData.getStockDates(LocalDate.now(), 4, false);
        int firstidx = 3;
        int lastidx = 0;
        Double margin = 9.0;
        Set<String> excluded = new VerifyProfit().getTrend(categoryValueMap, stockDates, firstidx, lastidx, margin);
        assertEquals(1, excluded.size());
        margin = 0.0;
        excluded = new VerifyProfit().getTrend(categoryValueMap, stockDates, firstidx, lastidx, margin);
        assertEquals(1, excluded.size());
    }
}

Change for remove stocks with abnormal change due to splits etc (I288).


/*
 * 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 org.tb.sundtektvinput;

import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.webkit.WebViewClient;

/**
 * Fragment that shows a web page for Sample TV Input introduction.
 */
public class MainFragment extends Fragment {
    private static final String URL =
            "http://github.com/googlesamples/androidtv-sample-inputs/blob/master/README.md";

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        return inflater.inflate(R.layout.main_fragment, null);
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

        WebView webView = (WebView) getView();
        webView.setWebViewClient(new WebViewClient());
        webView.loadUrl(URL);
    }
}

/*
 * 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 org.tb.sundtektvinput;

import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.webkit.WebViewClient;

/**
 * Fragment that shows a web page for Sample TV Input introduction.
 */
public class MainFragment extends Fragment {
    private static final String URL =
            "https://github.com/tam1m/androidtv-sample-inputs";

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        return inflater.inflate(R.layout.main_fragment, null);
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

        WebView webView = (WebView) getView();
        webView.setWebViewClient(new WebViewClient());
        webView.loadUrl(URL);
    }
}

Change github url in WebView


Change github url in WebView


#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package}.core;

import static playn.core.PlayN.*;

import playn.core.Game;
import playn.core.Image;
import playn.core.ImageLayer;

public class ${JavaGameClassName} implements Game {
  @Override
  public void init() {
    // create and add background image layer
    Image bgImage = assets().getImage("images/bg.png");
    ImageLayer bgLayer = graphics().createImageLayer(bgImage);
    graphics().rootLayer().add(bgLayer);
  }

  @Override
  public void paint(float alpha) {
    // the background automatically paints itself, so no need to do anything here!
  }

  @Override
  public void update(float delta) {
  }

  @Override
  public int updateRate() {
    return 25;
  }
}

#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package}.core;

import static playn.core.PlayN.*;

import playn.core.Game;
import playn.core.Image;
import playn.core.ImageLayer;

public class ${JavaGameClassName} extends Game.Default {

  public ${JavaGameClassName}() {
    super(33); // call update every 33ms (30 times per second)
  }

  @Override
  public void init() {
    // create and add background image layer
    Image bgImage = assets().getImage("images/bg.png");
    ImageLayer bgLayer = graphics().createImageLayer(bgImage);
    graphics().rootLayer().add(bgLayer);
  }

  @Override
  public void update(int delta) {
  }

  @Override
  public void paint(float alpha) {
    // the background automatically paints itself, so no need to do anything here!
  }
}

Update archetype to use Game.Default.


/**
 * Copyright 2011-2012 eBusiness Information, Groupe Excilys (www.excilys.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.excilys.ebi.gatling.recorder.http.event;

public class PauseEvent {

	private long durationMillis;

	public PauseEvent(long durationMillis) {
		this.durationMillis = durationMillis;
	}

	public long getDurationMillis() {
		return durationMillis;
	}

	public String toString() {
		return "PAUSE " + durationMillis  + " ms";
	}
}

/**
 * Copyright 2011-2012 eBusiness Information, Groupe Excilys (www.excilys.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.excilys.ebi.gatling.recorder.http.event;

public class PauseEvent {

	private long durationMillis;

	public PauseEvent(long durationMillis) {
		this.durationMillis = durationMillis;
	}

	public long getDuration() {
		if (durationMillis < 1000)
			return durationMillis;
		else
			return Math.round((float) durationMillis / 1000);
	}

	public String getDurationUnit() {
		if (durationMillis < 1000)
			return "MILLISECONDS";
		else
			return "SECONDS";
	}

	public long getDurationMillis() {
		return durationMillis;
	}

	public String toString() {
		return "PAUSE " + getDuration() + " " + getDurationUnit();
	}
}

Convert pauses longer than 1000 millis into secs


/*
 * Copyright 2015 Red Hat, Inc. and/or its affiliates
 * and other contributors as indicated by the @author tags.
 *
 * 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.hawkular.alerts.api.model.data;

/**
 * Severity set for a {@link org.hawkular.alerts.api.model.trigger.Trigger} and assigned to an
 * {@link org.hawkular.alerts.api.model.condition.Alert} it generates.
 *
 * @author jay shaughnessy
 * @author lucas ponce
 */
public enum AvailabilityType {
    UP, DOWN, UNAVAILABLE
}

/*
 * Copyright 2015 Red Hat, Inc. and/or its affiliates
 * and other contributors as indicated by the @author tags.
 *
 * 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.hawkular.alerts.api.model.data;

import org.hawkular.alerts.api.model.event.Alert;

/**
 * Severity set for a {@link org.hawkular.alerts.api.model.trigger.Trigger} and assigned to an
 * {@link Alert} it generates.
 *
 * @author jay shaughnessy
 * @author lucas ponce
 */
public enum AvailabilityType {
    UP, DOWN, UNAVAILABLE
}

Move Alert into events package


// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.integration.organization;

import com.google.common.collect.ImmutableList;

import java.util.Collection;
import java.util.Objects;

/**
 * A message with a subject and a nonempty set of recipients.
 *
 * @author jonmv
 */
public class Mail {

    private final Collection<String> recipients;
    private final String subject;
    private final String message;

    public Mail(Collection<String> recipients, String subject, String message) {
        if (recipients.isEmpty())
            throw new IllegalArgumentException("Empty recipient list is not allowed.");
        recipients.forEach(Objects::requireNonNull);
        this.recipients = ImmutableList.copyOf(recipients);
        this.subject = Objects.requireNonNull(subject);
        this.message = Objects.requireNonNull(message);
    }

    public Collection<String> recipients() { return recipients; }
    public String subject() { return subject; }
    public String message() { return message; }

}

// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.integration.organization;

import com.google.common.collect.ImmutableList;

import java.util.Collection;
import java.util.Objects;
import java.util.Optional;

/**
 * A message with a subject and a nonempty set of recipients.
 *
 * @author jonmv
 */
public class Mail {

    private final Collection<String> recipients;
    private final String subject;
    private final String message;
    private final Optional<String> htmlMessage;

    public Mail(Collection<String> recipients, String subject, String message) {
        this(recipients, subject, message, Optional.empty());
    }

    public Mail(Collection<String> recipients, String subject, String message, String htmlMessage) {
        this(recipients, subject, message, Optional.of(htmlMessage));
    }

    Mail(Collection<String> recipients, String subject, String message, Optional<String> htmlMessage) {
        if (recipients.isEmpty())
            throw new IllegalArgumentException("Empty recipient list is not allowed.");
        recipients.forEach(Objects::requireNonNull);
        this.recipients = ImmutableList.copyOf(recipients);
        this.subject = Objects.requireNonNull(subject);
        this.message = Objects.requireNonNull(message);
        this.htmlMessage = Objects.requireNonNull(htmlMessage);
    }

    public Collection<String> recipients() { return recipients; }
    public String subject() { return subject; }
    public String message() { return message; }
    public Optional<String> htmlMessage() { return htmlMessage; }

}

Add support for html content