package com.gh4a.model;

import io.reactivex.Single;
import retrofit2.Response;
import retrofit2.http.GET;
import retrofit2.http.Path;

public interface GitHubFeedService {
    @GET("{url}")
    Single<Response<GitHubFeed>> getFeed(@Path(value = "url", encoded = true) String url);

    @GET("https://github.blog/blog.atom")
    Single<Response<GitHubFeed>> getBlogFeed();
}

package com.gh4a.model;

import io.reactivex.Single;
import retrofit2.Response;
import retrofit2.http.GET;
import retrofit2.http.Path;

public interface GitHubFeedService {
    @GET("{url}")
    Single<Response<GitHubFeed>> getFeed(@Path(value = "url", encoded = true) String url);

    @GET("https://github.blog/all.atom")
    Single<Response<GitHubFeed>> getBlogFeed();
}

Fix Github blog feed URL.

Fix Github blog feed URL.


/*-------------------------------------------------------------------------
*
* Copyright (c) 2004-2005, PostgreSQL Global Development Group
*
* IDENTIFICATION
*   $PostgreSQL: pgjdbc/org/postgresql/util/PSQLDriverVersion.java,v 1.20 2006/12/01 12:02:39 jurka Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql.util;

import org.postgresql.Driver;

/**
 * This class holds the current build number and a utility program to print
 * it and the file it came from.  The primary purpose of this is to keep
 * from filling the cvs history of Driver.java.in with commits simply
 * changing the build number.  The utility program can also be helpful for
 * people to determine what version they really have and resolve problems
 * with old and unknown versions located somewhere in the classpath.
 */
public class PSQLDriverVersion {

    public static int buildNumber = 600;

    public static void main(String args[]) {
        java.net.URL url = Driver.class.getResource("/org/postgresql/Driver.class");
        System.out.println(Driver.getVersion());
        System.out.println("Found in: " + url);
    }

}

/*-------------------------------------------------------------------------
*
* Copyright (c) 2004-2005, PostgreSQL Global Development Group
*
* IDENTIFICATION
*   $PostgreSQL: pgjdbc/org/postgresql/util/PSQLDriverVersion.java,v 1.21 2006/12/01 12:06:21 jurka Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql.util;

import org.postgresql.Driver;

/**
 * This class holds the current build number and a utility program to print
 * it and the file it came from.  The primary purpose of this is to keep
 * from filling the cvs history of Driver.java.in with commits simply
 * changing the build number.  The utility program can also be helpful for
 * people to determine what version they really have and resolve problems
 * with old and unknown versions located somewhere in the classpath.
 */
public class PSQLDriverVersion {

    public final static int buildNumber = 601;

    public static void main(String args[]) {
        java.net.URL url = Driver.class.getResource("/org/postgresql/Driver.class");
        System.out.println(Driver.getVersion());
        System.out.println("Found in: " + url);
    }

}

Prepare for release for 8.3dev-601.

Prepare for release for 8.3dev-601.


package net.emphased.malle.template.servlet;

class Utils {

    public static final boolean JSTL_EXISTS = isClassExists("javax.servlet.jsp.jstl.core.Config");
    public static final String JSTL_FMT_LOCALE = "javax.servlet.jsp.jstl.fmt.locale";

    public static boolean isClassExists(String name) {
        try {
            Class.forName(name, false, Utils.class.getClassLoader());
            return true;
        } catch (ClassNotFoundException _) {
            return false;
        }
    }

    private Utils() {}
}

package net.emphased.malle.template.servlet;

class Utils {

    public static final boolean JSTL_EXISTS = isClassExists("javax.servlet.jsp.jstl.core.Config");
    public static final String JSTL_FMT_LOCALE = "javax.servlet.jsp.jstl.fmt.locale";

    public static boolean isClassExists(String name) {
        try {
            Class.forName(name, false, Utils.class.getClassLoader());
            return true;
        } catch (ClassNotFoundException unused) {
            return false;
        }
    }

    private Utils() {}
}

Fix 1.8 JavaDoc warning about '_' being a reserved identifier name


/**
 * Copyright 2012 The PlayN 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 playn.ios;

import playn.core.Log;

class IOSLog implements Log
{
  @Override
  public void error(String msg, Throwable e) {
    throw new RuntimeException("TODO");
  }

  @Override
  public void error(String msg) {
    throw new RuntimeException("TODO");
  }

  @Override
  public void info(String msg) {
    throw new RuntimeException("TODO");
  }

  @Override
  public void info(String msg, Throwable e) {
    throw new RuntimeException("TODO");
  }

  @Override
  public void debug(String msg) {
    throw new RuntimeException("TODO");
  }

  @Override
  public void debug(String msg, Throwable e) {
    throw new RuntimeException("TODO");
  }

  @Override
  public void warn(String msg) {
    throw new RuntimeException("TODO");
  }

  @Override
  public void warn(String msg, Throwable e) {
    throw new RuntimeException("TODO");
  }
}

/**
 * Copyright 2012 The PlayN 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 playn.ios;

import cli.System.Console;

import playn.core.Log;

class IOSLog implements Log
{
  // TODO: stack traces

  @Override
  public void debug(String msg) {
    Console.WriteLine("DEBUG: " + msg);
  }

  @Override
  public void debug(String msg, Throwable e) {
    debug(msg + ": " + e.getMessage());
  }

  @Override
  public void info(String msg) {
    Console.WriteLine(msg);
  }

  @Override
  public void info(String msg, Throwable e) {
    info(msg + ": " + e.getMessage());
  }

  @Override
  public void warn(String msg) {
    Console.WriteLine("WARN: " + msg);
  }

  @Override
  public void warn(String msg, Throwable e) {
    warn(msg + ": " + e.getMessage());
  }

  @Override
  public void error(String msg) {
    Console.WriteLine("ERROR: " + msg);
  }

  @Override
  public void error(String msg, Throwable e) {
    error(msg + ": " + e.getMessage());
  }
}

Implement simple logging to console.

Implement simple logging to console.


/*
 * Copyright 2018, TeamDev. All rights reserved.
 *
 * Redistribution and use in source and/or binary forms, with or without
 * modification, must retain the above copyright notice and the following
 * disclaimer.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package io.spine.server.aggregate.imports;

import io.spine.core.EventClass;
import io.spine.server.bus.MessageDispatcher;

import java.util.Set;

/**
 * Dispatches imported events to aggregates.
 *
 * @param <I> the type of aggregate IDs
 * @author Alexander Yevsyukov
 */
interface ImportDispatcher<I> extends MessageDispatcher<EventClass, ImportEnvelope, Set<I>> {
}

/*
 * Copyright 2018, TeamDev. All rights reserved.
 *
 * Redistribution and use in source and/or binary forms, with or without
 * modification, must retain the above copyright notice and the following
 * disclaimer.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package io.spine.server.aggregate.imports;

import io.spine.core.EventClass;
import io.spine.server.bus.MessageDispatcher;

/**
 * Dispatches imported events to aggregates.
 *
 * @param <I> the type of aggregate IDs
 * @author Alexander Yevsyukov
 */
interface ImportDispatcher<I> extends MessageDispatcher<EventClass, ImportEnvelope, I> {
}

Make import dispatcher return one ID

Make import dispatcher return one ID


package Functions;
import javax.swing.*;
import javax.swing.border.*;

import Elements.Element;

import java.awt.*;

public class ElementPanel extends JPanel
{
	private Element element;

	public ElementPanel(Element element)
	{
		this.element = element;
		if(element != null)
		{
			String name = element.getSymbol();
			if(element.getName().equals("Lanthanum"))
			{
				name = "*" + name;
			}
			if(element.getName().equals("Barium"))
			{
				name += "*";
			}
			if(element.getName().equals("Actinium"))
			{
				name = "**" + name;
			}
			if(element.getName().equals("Radium"))
			{
				name += "**";
			}

			this.setLayout(new GridBagLayout());
			GridBagConstraints c = new GridBagConstraints();
			c.ipady = -5;
			c.gridy = 0;
			add(new JLabel("" + element.getNum()), c);

			c.gridy = 1;
			add(new JLabel("
" + name + "
"), c);

			c.gridy = 2;
			c.ipady = 0;
			add(new JLabel("" + element.getName() + ""), c);

			setBorder(new CompoundBorder(new LineBorder(Color.BLACK, 1), new EmptyBorder(3, 3, 3, 3)));

			/*add(new JLabel("" + element.getNum() + "

" + name + "

" + element.getName() + ""));
			setBorder(new CompoundBorder(new LineBorder(Color.BLACK, 1), new EmptyBorder(6, 6, 6, 6)));
			setSize(50, 50);*/
		}
	}

	public Element getElement()
	{
		return element;
	}
}

package Functions;
import javax.swing.*;
import javax.swing.border.*;

import Elements.Element;

import java.awt.*;

public class ElementPanel extends JPanel
{
	private Element element;

	public ElementPanel(Element element)
	{
		this.element = element;
		if(element != null)
		{
			String name = element.getSymbol();
			if(element.getName().equals("Lanthanum"))
			{
				name = "*" + name;
			}
			if(element.getName().equals("Barium"))
			{
				name += "*";
			}
			if(element.getName().equals("Actinium"))
			{
				name = "**" + name;
			}
			if(element.getName().equals("Radium"))
			{
				name += "**";
			}

			add(new JLabel(name));
			setBorder(new CompoundBorder(new LineBorder(Color.BLACK, 1), new EmptyBorder(6, 6, 6, 6)));
		}
	}

	public Element getElement()
	{
		return element;
	}
}

Revert "Made the  periodic table different"

This reverts commit 62a32dec0d500ab8de44148074d8406911c894c2.


package org.apache.tuscany.sdo.test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

public class AllTests extends TestCase {

  public static TestSuite suite() {

        TestSuite suite = new TestSuite();

        // suite.addTestSuite(ChangeSummaryOnDataObjectTestCase.class);
        suite.addTestSuite(ChangeSummaryGenTestCase.class);
        suite.addTestSuite(GenPatternsTestCase.class);
        suite.addTestSuite(org.apache.tuscany.sdo.test.StaticSequenceNoEmfTestCase.class);

        return suite;
    }

    /**
     * Runs the test suite using the textual runner.
     */
    public static void main(String[] args) {
        junit.textui.TestRunner.run(suite());
    }
}

package org.apache.tuscany.sdo.test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

public class AllTests extends TestCase {

  public static TestSuite suite() {

        TestSuite suite = new TestSuite();

        // suite.addTestSuite(ChangeSummaryOnDataObjectTestCase.class);
        suite.addTestSuite(ChangeSummaryGenTestCase.class);
        suite.addTestSuite(GenPatternsTestCase.class);
        //suite.addTestSuite(org.apache.tuscany.sdo.test.StaticSequenceNoEmfTestCase.class);

        return suite;
    }

    /**
     * Runs the test suite using the textual runner.
     */
    public static void main(String[] args) {
        junit.textui.TestRunner.run(suite());
    }
}

Fix build break related to TUSCANY-1102

Fix build break related to TUSCANY-1102

git-svn-id: d03bf258fa706134e13af30ae75b879a77d8986d@508535 13f79535-47bb-0310-9956-ffa450edef68


/*
 * Copyright 2014 Red Hat, Inc.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * and Apache License v2.0 which accompanies this distribution.
 *
 * The Eclipse Public License is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * The Apache License v2.0 is available at
 * http://www.opensource.org/licenses/apache2.0.php
 *
 * You may elect to redistribute this code under either of these licenses.
 */

package io.vertx.ext.embeddedmongo.test;

import io.vertx.core.VertxOptions;
import io.vertx.test.core.VertxTestBase;
import org.junit.Test;

/**
 * @author Tim Fox
 */
public class EmbeddedMongoVerticleTest extends VertxTestBase {

  @Override
  public VertxOptions getOptions() {
    // It can take some time to download the first time!
    return new VertxOptions().setMaxWorkerExecuteTime(30 * 60 * 1000);
  }

  @Test
  public void testEmbeddedMongo() {
    // Not really sure what to test here apart from start and stop
    vertx.deployVerticle("service:io.vertx:vertx-mongo-embedded-db", onSuccess(deploymentID -> {
      assertNotNull(deploymentID);
      vertx.undeployVerticle(deploymentID, onSuccess(v -> {
        assertNull(v);
        testComplete();
      }));
    }));
    await();
  }
}

/*
 * Copyright 2014 Red Hat, Inc.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * and Apache License v2.0 which accompanies this distribution.
 *
 * The Eclipse Public License is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * The Apache License v2.0 is available at
 * http://www.opensource.org/licenses/apache2.0.php
 *
 * You may elect to redistribute this code under either of these licenses.
 */

package io.vertx.ext.embeddedmongo.test;

import io.vertx.core.VertxOptions;
import io.vertx.test.core.VertxTestBase;
import org.junit.Test;

/**
 * @author Tim Fox
 */
public class EmbeddedMongoVerticleTest extends VertxTestBase {

  @Override
  public VertxOptions getOptions() {
    // It can take some time to download the first time!
    return new VertxOptions().setMaxWorkerExecuteTime(30 * 60 * 1000);
  }

  @Test
  public void testEmbeddedMongo() {
    // Not really sure what to test here apart from start and stop
    vertx.deployVerticle("service:io.vertx:vertx-mongo-embedded-db", onSuccess(deploymentID -> {
      assertNotNull(deploymentID);
      vertx.undeploy(deploymentID, onSuccess(v -> {
        assertNull(v);
        testComplete();
      }));
    }));
    await();
  }
}

Update to latest api change

Update to latest api change


package hackerrank;

import java.util.Scanner;

/**
 * https://www.hackerrank.com/challenges/quicksort4
 */
public class RunningTimeOfQuicksort {
    private static int quicksort(int[] array) {
        // TODO:
        return 0;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] array = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = in.nextInt();
        }
    }
}

package hackerrank;

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

/**
 * https://www.hackerrank.com/challenges/quicksort4
 */
public class RunningTimeOfQuicksort {
    private static int quicksortSwaps;
    private static int insertionSortShifts;

    private static int runningTime(int[] array) {
        int[] copy = Arrays.copyOf(array, array.length);
        quicksort(array);
        insertionSort(copy);
        return insertionSortShifts - quicksortSwaps;
    }

    public static void insertionSort(int[] ar) {
        for (int i = 1; i < ar.length; i++) {
            int j = i;
            while (j >= 1 && ar[j] < ar[j - 1]) {
                swap(ar, j, j - 1);
                j--;
                insertionSortShifts++;
            }
        }
    }

    private static void quicksort(int[] array) {
        quicksort(array, 0, array.length - 1);
    }

    private static void quicksort(int[] array, int begin, int end) {
        if (begin >= end) {
            return;
        }
        int p = partition(array, begin, end);
        quicksort(array, begin, p - 1);
        quicksort(array, p + 1, end);
    }

    private static int partition(int[] array, int begin, int end) {
        int pivot = array[end];
        int i = begin;
        for (int j = begin; j <= end - 1; j++) {
            if (array[j] <= pivot) {
                swap(array, i, j);
                quicksortSwaps++;
                i++;
            }
        }
        quicksortSwaps++;
        swap(array, i, end);
        return i;
    }

    private static void swap(int[] array, int i, int j) {
        int tmp = array[i];
        array[i] = array[j];
        array[j] = tmp;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] array = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = in.nextInt();
        }
        System.out.println(runningTime(array));
    }
}

Solve Running Time of Quicksort

Solve Running Time of Quicksort


package com.metroveu.metroveu;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.util.Log;

import com.google.android.gms.wearable.DataEvent;
import com.google.android.gms.wearable.DataEventBuffer;
import com.google.android.gms.wearable.DataMap;
import com.google.android.gms.wearable.DataMapItem;
import com.google.android.gms.wearable.WearableListenerService;

public class WearConnector extends WearableListenerService {

    @Override
    public void onDataChanged(DataEventBuffer dataEvents) {
        for (DataEvent dataEvent : dataEvents) {
            if (dataEvent.getType() == DataEvent.TYPE_CHANGED) {
                DataMap dataMap = DataMapItem.fromDataItem(dataEvent.getDataItem()).getDataMap();
                String path = dataEvent.getDataItem().getUri().getPath();
                if (path.equals("/lines")) {
                    int number = dataMap.getInt("number");
                    Log.v("wear", Integer.toString(number));
                }
            }
        }
    }
}

package com.metroveu.metroveu;

import android.util.Log;

import com.google.android.gms.wearable.DataEvent;
import com.google.android.gms.wearable.DataEventBuffer;
import com.google.android.gms.wearable.DataMap;
import com.google.android.gms.wearable.DataMapItem;
import com.google.android.gms.wearable.MessageEvent;
import com.google.android.gms.wearable.WearableListenerService;

public class WearConnector extends WearableListenerService {

    public void onMessageReceived(MessageEvent messageEvent) {
        System.out.println("Message Received on Phone on launch of wear homepage");
        if(messageEvent.getPath().equals("/lines")) {
            //sendSavedDeals(); //fetch from db and make a datamap object using PutDataRequest
            Log.v("JOAN", "Message received");
        }
        else {
            Log.v("JOAN", "Wrong path");
        }

    }

    @Override
    public void onDataChanged(DataEventBuffer dataEvents) {
        for (DataEvent dataEvent : dataEvents) {
            if (dataEvent.getType() == DataEvent.TYPE_CHANGED) {
                DataMap dataMap = DataMapItem.fromDataItem(dataEvent.getDataItem()).getDataMap();
                String path = dataEvent.getDataItem().getUri().getPath();
                if (path.equals("/lines")) {
                    int number = dataMap.getInt("number");
                    Log.v("JOAN", Integer.toString(number));
                }
            }
        }
    }
}

Change WeareableListener tag and implement onMessageReceived


package hudson.plugins.git;

import java.io.Serializable;

import hudson.Extension;
import hudson.model.AbstractDescribableImpl;
import hudson.model.Descriptor;
import hudson.util.FormValidation;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.export.Exported;
import org.kohsuke.stapler.export.ExportedBean;

@ExportedBean
public class UserRemoteConfig extends AbstractDescribableImpl<UserRemoteConfig> implements Serializable {

    private String name;
    private String refspec;
    private String url;

    @DataBoundConstructor
    public UserRemoteConfig(String url, String name, String refspec) {
        this.url = url;
        this.name = name;
        this.refspec = refspec;
    }

    @Exported
    public String getName() {
        return name;
    }

    @Exported
    public String getRefspec() {
        return refspec;
    }

    @Exported
    public String getUrl() {
        return url;
    }

    @Extension
    public static class DescriptorImpl extends Descriptor<UserRemoteConfig> {
        public FormValidation doCheckUrl(@QueryParameter String value) {
            if (value == null || value.isEmpty()) {
                return FormValidation.error("Please enter Git repository.");
            } else {
                return FormValidation.ok();
            }
        }

        @Override
        public String getDisplayName() {
            return "";
        }
    }
}

package hudson.plugins.git;

import java.io.Serializable;

import hudson.Extension;
import hudson.model.AbstractDescribableImpl;
import hudson.model.Descriptor;
import hudson.util.FormValidation;

import org.apache.commons.lang.StringUtils;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.export.Exported;
import org.kohsuke.stapler.export.ExportedBean;

@ExportedBean
public class UserRemoteConfig extends AbstractDescribableImpl<UserRemoteConfig> implements Serializable {

    private String name;
    private String refspec;
    private String url;

    @DataBoundConstructor
    public UserRemoteConfig(String url, String name, String refspec) {
        this.url = StringUtils.trim(url);
        this.name = name;
        this.refspec = refspec;
    }

    @Exported
    public String getName() {
        return name;
    }

    @Exported
    public String getRefspec() {
        return refspec;
    }

    @Exported
    public String getUrl() {
        return url;
    }

    @Extension
    public static class DescriptorImpl extends Descriptor<UserRemoteConfig> {
        public FormValidation doCheckUrl(@QueryParameter String value) {
            if (value == null || value.isEmpty()) {
                return FormValidation.error("Please enter Git repository.");
            } else {
                return FormValidation.ok();
            }
        }

        @Override
        public String getDisplayName() {
            return "";
        }
    }
}

Trim repository URL when copied/pasted from a repo hoster (google code) the URL may include trailing spaces that make the clone command fail


package com.md_5.fondue.protocol;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.Arrays;
import org.junit.Test;
import static org.junit.Assert.*;

public class HandlerTest {

    /**
     * Method to test each handler type defines everything it requires
     */
    @Test
    public void doTest() throws NoSuchMethodException {
        checkImplements(new ServerHandler());
    }

    /**
     * Checks that the specified handler DOES implement the required methods
     */
    public void checkImplements(PacketHandler handler) throws NoSuchMethodException {
        for (Method m : PacketHandler.class.getDeclaredMethods()) {
            if (m.isAnnotationPresent(handler.getType())) {
                getOther(m, handler.getClass());
            }
        }
    }

    private Method getOther(Method method, Class other) throws NoSuchMethodException {
        return other.getDeclaredMethod(method.getName(), method.getParameterTypes());
    }
}

package com.md_5.fondue.protocol;

import java.lang.reflect.Method;
import static org.junit.Assert.*;
import org.junit.Test;

public class HandlerTest {

    /**
     * Method to test each handler type defines everything it requires
     */
    @Test
    public void doTest() throws NoSuchMethodException {
        check(new ServerHandler());
    }

    private void check(PacketHandler handler) throws NoSuchMethodException {
        checkImplements(handler);
        checkExcludes(handler);
    }

    /**
     * Checks that the specified handler DOES implement the required methods
     */
    public void checkImplements(PacketHandler handler) throws NoSuchMethodException {
        for (Method m : PacketHandler.class.getDeclaredMethods()) {
            if (m.isAnnotationPresent(handler.getType())) {
                getOther(m, handler.getClass());
            }
        }
    }

    /**
     * Checks that the specified handler DOES NOT implement methods from other
     * handler types
     */
    public void checkExcludes(PacketHandler handler) throws NoSuchMethodException {
        for (Method m : handler.getClass().getDeclaredMethods()) {
            Method parent = getOther(m, PacketHandler.class);
            if (parent.getAnnotations().length > 0) {
                assertTrue(m + " includes type not suitable for " + handler.getType().getSimpleName(), parent.isAnnotationPresent(handler.getType()));
            }
        }
    }

    private Method getOther(Method method, Class other) throws NoSuchMethodException {
        return other.getDeclaredMethod(method.getName(), method.getParameterTypes());
    }
}

Add additional test to ensure the wrong methods are not implemented.


package edu.kit.iti.formal.pse.worthwhile.prover;

import java.util.Arrays;
import java.util.List;

/**
 * Caller for the Z3 Prover by Microsoft Research.
 */
public class Z3Prover extends StdProver {
	/**
	 * Construct a new prover caller with the default Z3 command line.
	 *
	 * The default Z3 command line is z3 -in -smt2.
	 */
	public Z3Prover() {
		/* we will assume that z3 is in the PATH */
		this(Arrays.asList("z3", "-in", "-smt2"));
	}

	/**
	 * Construct a new {@link Z3Prover} with the given command line.
	 *
	 * @param command
	 *                the command line that is executed to run the Z3 prover binary
	 */
	public Z3Prover(final String command) {
		/* we will use SMTLib as the input format */
		super(command, new SMTLIBStrategy());
	}

	/**
	 * Construct a new {@link Z3Prover} with the given command line.
	 *
	 * @param command
	 *                the command line that is executed to run the Z3 prover binary
	 */
	public Z3Prover(final List<String> command) {
		/* we will use SMTLib as the input format */
		super(command, new SMTLIBStrategy());
	}

	@Override
	public final ProverResult getResult(final String output) {
		return new Z3ProverResult(output);
	}
}

package edu.kit.iti.formal.pse.worthwhile.prover;

import java.util.Arrays;
import java.util.List;

/**
 * Caller for the Z3 Prover by Microsoft Research.
 */
public class Z3Prover extends StdProver {
	/**
	 * Construct a new prover caller with the default Z3 command line.
	 *
	 * The default Z3 command line is z3 -in -smt2.
	 */
	public Z3Prover() {
		/* we will assume that z3 is in the PATH */
		this(Arrays.asList("z3", "-in", "-smt2", "-nw"));
	}

	/**
	 * Construct a new {@link Z3Prover} with the given command line.
	 *
	 * @param command
	 *                the command line that is executed to run the Z3 prover binary
	 */
	public Z3Prover(final String command) {
		/* we will use SMTLib as the input format */
		super(command, new SMTLIBStrategy());
	}

	/**
	 * Construct a new {@link Z3Prover} with the given command line.
	 *
	 * @param command
	 *                the command line that is executed to run the Z3 prover binary
	 */
	public Z3Prover(final List<String> command) {
		/* we will use SMTLib as the input format */
		super(command, new SMTLIBStrategy());
	}

	@Override
	public final ProverResult getResult(final String output) {
		return new Z3ProverResult(output);
	}
}

Disable warning messages in Z3

[prover] Disable warning messages in Z3


package org.xcolab.view.pages.proposals.view.contest;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import org.xcolab.view.pages.proposals.utils.context.ProposalContext;
import org.xcolab.view.pages.proposals.view.proposal.BaseProposalsController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Controller

public class ContestDiscussionController extends BaseProposalsController {

    @GetMapping("/contests/{contestYear}/{contestUrlName}/discussion")
    public String showContestProposals(HttpServletRequest request, HttpServletResponse response,
            Model model, ProposalContext proposalContext) {

        model.addAttribute("discussionId",  proposalContext.getContest().getDiscussionGroupId());
        setBasePageAttributes(proposalContext, model);
        return "proposals/contestDiscussion";
    }
}

package org.xcolab.view.pages.proposals.view.contest;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import org.xcolab.client.admin.pojo.ContestType;
import org.xcolab.client.contest.pojo.Contest;
import org.xcolab.client.members.pojo.Member;
import org.xcolab.view.errors.AccessDeniedPage;
import org.xcolab.view.pages.proposals.permissions.ContestPermissions;
import org.xcolab.view.pages.proposals.utils.context.ProposalContext;
import org.xcolab.view.pages.proposals.view.proposal.BaseProposalsController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Controller

public class ContestDiscussionController extends BaseProposalsController {

    @GetMapping("/contests/{contestYear}/{contestUrlName}/discussion")
    public String showContestProposals(HttpServletRequest request, HttpServletResponse response,
            Model model, ProposalContext proposalContext, Member loggedInMember) {

        final Contest contest = proposalContext.getContest();
        final ContestType contestType = contest.getContestType();
        if (contestType.isRestrictedAccess() && !new ContestPermissions(loggedInMember)
                .getCanAccessContest(contest)) {
            return new AccessDeniedPage(loggedInMember).toViewName(response);
        }

        model.addAttribute("discussionId",  proposalContext.getContest().getDiscussionGroupId());
        setBasePageAttributes(proposalContext, model);
        return "proposals/contestDiscussion";
    }
}

Add permissions to contest discussion

[COLAB-2820] Add permissions to contest discussion


/*
 * Copyright 2000-2012 JetBrains s.r.o.
 *
 * 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.jetbrains.plugins.github;

import org.jetbrains.annotations.NotNull;

/**
 * Information about a user on GitHub.
 *
 * @author Kirill Likhodedov
 */
class GithubUser {

  enum Plan {
    FREE,
    MICRO,
    SMALL,
    MEDIUM,
    BRONZE,
    SILVER,
    GOLD,
    PLATINUM;

    public boolean isPrivateRepoAllowed() {
      return this != FREE;
    }

    public static Plan fromString(String name) {
      for (Plan plan : values()) {
        if (plan.name().equalsIgnoreCase(name)) {
          return plan;
        }
      }
      return defaultPlan();
    }

    private static Plan defaultPlan() {
      return FREE;
    }
  }

  @NotNull private final Plan myPlan;

  GithubUser(@NotNull Plan plan) {
    myPlan = plan;
  }

  @NotNull
  Plan getPlan() {
    return myPlan;
  }

}

/*
 * Copyright 2000-2012 JetBrains s.r.o.
 *
 * 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.jetbrains.plugins.github;

import org.jetbrains.annotations.NotNull;

/**
 * Information about a user on GitHub.
 *
 * @author Kirill Likhodedov
 */
class GithubUser {

  enum Plan {
    FREE,
    MICRO,
    SMALL,
    MEDIUM,
    BRONZE,
    SILVER,
    GOLD,
    PLATINUM,
    ENTERPRISE;

    public boolean isPrivateRepoAllowed() {
      return this != FREE;
    }

    public static Plan fromString(String name) {
      for (Plan plan : values()) {
        if (plan.name().equalsIgnoreCase(name)) {
          return plan;
        }
      }
      return defaultPlan();
    }

    private static Plan defaultPlan() {
      return FREE;
    }
  }

  @NotNull private final Plan myPlan;

  GithubUser(@NotNull Plan plan) {
    myPlan = plan;
  }

  @NotNull
  Plan getPlan() {
    return myPlan;
  }

}

[github] Add "Enterprise" to the list of possible user plans.

It fixes IDEA-101433, since unknown plan is treated as "free".


package fr.free.nrw.commons.nearby;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import butterknife.BindView;
import butterknife.ButterKnife;
import fr.free.nrw.commons.R;
import fr.free.nrw.commons.ViewHolder;
import fr.free.nrw.commons.utils.ResourceUtils;

public class NearbyViewHolder implements ViewHolder<Place> {
    @BindView(R.id.tvName) TextView tvName;
    @BindView(R.id.tvDesc) TextView tvDesc;
    @BindView(R.id.distance) TextView distance;
    @BindView(R.id.icon) ImageView icon;

    public NearbyViewHolder(View view) {
        ButterKnife.bind(this, view);
    }

    @Override
    public void bindModel(Context context, Place place) {
        // Populate the data into the template view using the data object
        tvName.setText(place.name);
        tvDesc.setText(place.description);
        distance.setText(place.distance);

        icon.setImageResource(ResourceUtils.getDescriptionIcon(place.description));
    }
}

package fr.free.nrw.commons.nearby;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import butterknife.BindView;
import butterknife.ButterKnife;
import fr.free.nrw.commons.R;
import fr.free.nrw.commons.ViewHolder;
import fr.free.nrw.commons.utils.ResourceUtils;

public class NearbyViewHolder implements ViewHolder<Place> {
    @BindView(R.id.tvName) TextView tvName;
    @BindView(R.id.tvDesc) TextView tvDesc;
    @BindView(R.id.distance) TextView distance;
    @BindView(R.id.icon) ImageView icon;

    public NearbyViewHolder(View view) {
        ButterKnife.bind(this, view);
    }

    @Override
    public void bindModel(Context context, Place place) {
        // Populate the data into the template view using the data object
        tvName.setText(place.name);
        String description = place.description;
        if ( description == null || description.isEmpty() || description.equals("?")) {
            description = "No Description Found";
        }
        tvDesc.setText(description);
        distance.setText(place.distance);
        icon.setImageResource(ResourceUtils.getDescriptionIcon(place.description));
    }
}

Set default text when no description found


/**
 * 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.
 */

package com.google.devtools.cdbg.debuglets.java;

/**
 * Defines the version of the Java Cloud Debugger agent.
 */
public final class GcpDebugletVersion {
  /**
   * Major version of the debugger.

   * All agents of the same major version are compatible with each other. In other words an
   * application can mix different agents with the same major version within the same debuggee.
   */
  public static final int MAJOR_VERSION = 2;

  /**
   * Minor version of the agent.
   */
  public static final int MINOR_VERSION = 6;

  /**
   * Debugger agent version string in the format of MAJOR.MINOR.
   */
  public static final String VERSION = String.format("%d.%d", MAJOR_VERSION, MINOR_VERSION);

  /**
   * Main function to print the version string.
   */
  public static void main(String[] args) {
    System.out.println(VERSION);
  }
}

/**
 * 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.
 */

package com.google.devtools.cdbg.debuglets.java;

/**
 * Defines the version of the Java Cloud Debugger agent.
 */
public final class GcpDebugletVersion {
  /**
   * Major version of the debugger.

   * All agents of the same major version are compatible with each other. In other words an
   * application can mix different agents with the same major version within the same debuggee.
   */
  public static final int MAJOR_VERSION = 2;

  /**
   * Minor version of the agent.
   */
  public static final int MINOR_VERSION = 7;

  /**
   * Debugger agent version string in the format of MAJOR.MINOR.
   */
  public static final String VERSION = String.format("%d.%d", MAJOR_VERSION, MINOR_VERSION);

  /**
   * Main function to print the version string.
   */
  public static void main(String[] args) {
    System.out.println(VERSION);
  }
}

Increment the Java debugger minor version to 2.7

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138825830


/**
 * Copyright (c) 2018, RTE (http://www.rte-france.com)
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */
package com.powsybl.action.simulator.loadflow;

import com.powsybl.iidm.network.Network;

import java.util.Objects;

/**
 * @author Teofil Calin BANC <teofil-calin.banc at rte-france.com>
 */
interface NetworkCopyStrategy {

    Network createState(String id);

    void removeState();

    static NetworkCopyStrategy getInstance(CopyStrategy strategy, Network network) {
        Objects.requireNonNull(strategy);

        return (strategy == CopyStrategy.DEEP) ? new DeepCopyStrategy(network) : new CopyStateStrategy(network);
    }
}

/**
 * Copyright (c) 2018, RTE (http://www.rte-france.com)
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */
package com.powsybl.action.simulator.loadflow;

import com.powsybl.iidm.network.Network;

import java.util.Objects;

/**
 * @author Teofil Calin BANC <teofil-calin.banc at rte-france.com>
 */
public interface NetworkCopyStrategy {

    Network createState(String id);

    void removeState();

    static NetworkCopyStrategy getInstance(CopyStrategy strategy, Network network) {
        Objects.requireNonNull(strategy);

        return (strategy == CopyStrategy.DEEP) ? new DeepCopyStrategy(network) : new CopyStateStrategy(network);
    }
}

Make network copy strategy public

Make network copy strategy public


package org.cyclops.cyclopscore.config.configurabletypeaction;

import net.minecraftforge.registries.IForgeRegistryEntry;
import org.cyclops.cyclopscore.config.extendedconfig.ExtendedConfigForge;

/**
 * The action used for {@link ExtendedConfigForge}.
 * @author rubensworks
 * @see ConfigurableTypeAction
 */
public class ConfigurableTypeActionForge<C extends ExtendedConfigForge<C, I>, I extends IForgeRegistryEntry<? super I>>
        extends ConfigurableTypeAction<C, I> {

    @Override
    public void onRegisterForge(C eConfig) {
        register(eConfig);
    }
}

package org.cyclops.cyclopscore.config.configurabletypeaction;

import net.minecraftforge.registries.IForgeRegistryEntry;
import org.cyclops.cyclopscore.config.extendedconfig.ExtendedConfigForge;

/**
 * The action used for {@link ExtendedConfigForge}.
 * @author rubensworks
 * @see ConfigurableTypeAction
 */
public class ConfigurableTypeActionForge<C extends ExtendedConfigForge<C, I>, I extends IForgeRegistryEntry<? super I>>
        extends ConfigurableTypeAction<C, I> {

    @Override
    public void onRegisterForgeFilled(C eConfig) {
        register(eConfig);
    }
}

Fix forge entries being registered too early


package org.adaptlab.chpir.android.survey.QuestionFragments;

import org.adaptlab.chpir.android.survey.QuestionFragment;
import org.adaptlab.chpir.android.survey.R;

import android.text.Editable;
import android.text.TextWatcher;
import android.view.ViewGroup;
import android.widget.EditText;

public class FreeResponseQuestionFragment extends QuestionFragment {
    private String mText = "";
    private EditText mFreeText;

    // This is used to restrict allowed input in subclasses.
    protected void beforeAddViewHook(EditText editText) {
    }

    @Override
	public void createQuestionComponent(ViewGroup questionComponent) {
        mFreeText = new EditText(getActivity());
        mFreeText.setHint(R.string.free_response_edittext);
        mFreeText.addTextChangedListener(new TextWatcher() {
            public void onTextChanged(CharSequence s, int start, int before,
                    int count) {
                mText = s.toString();
                saveResponse();
            }

            // Required by interface
            public void beforeTextChanged(CharSequence s, int start,
                    int count, int after) { }
            public void afterTextChanged(Editable s) { }
        });
        beforeAddViewHook(mFreeText);
        questionComponent.addView(mFreeText);
    }

    @Override
    protected String serialize() {
        return mText;
    }

    @Override
    protected void deserialize(String responseText) {
        mFreeText.setText(responseText);
    }

}

package org.adaptlab.chpir.android.survey.QuestionFragments;

import org.adaptlab.chpir.android.survey.QuestionFragment;
import org.adaptlab.chpir.android.survey.R;

import android.text.Editable;
import android.text.TextWatcher;
import android.view.ViewGroup;
import android.widget.EditText;

public class FreeResponseQuestionFragment extends QuestionFragment {
    private String mText = "";
    private EditText mFreeText;

    // This is used to restrict allowed input in subclasses.
    protected void beforeAddViewHook(EditText editText) {
    }

    @Override
	public void createQuestionComponent(ViewGroup questionComponent) {
        mFreeText = new EditText(getActivity());
        beforeAddViewHook(mFreeText);
        mFreeText.setHint(R.string.free_response_edittext);
        mFreeText.addTextChangedListener(new TextWatcher() {
            public void onTextChanged(CharSequence s, int start, int before,
                    int count) {
                mText = s.toString();
                saveResponse();
            }

            // Required by interface
            public void beforeTextChanged(CharSequence s, int start,
                    int count, int after) { }
            public void afterTextChanged(Editable s) { }
        });
        questionComponent.addView(mFreeText);
    }

    @Override
    protected String serialize() {
        return mText;
    }

    @Override
    protected void deserialize(String responseText) {
        mFreeText.setText(responseText);
    }

}

Fix delete free response subclass response deletion on rotation bug


package com.autonomy.abc.selenium.find.filters;

import com.autonomy.abc.selenium.indexes.tree.IndexNodeElement;
import com.hp.autonomy.frontend.selenium.element.CheckboxBase;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;

class FindIndexLeafNode implements IndexNodeElement {
    private final CheckboxBase checkbox;
    private final WebElement container;

    FindIndexLeafNode(final WebElement element) {
        container = element;
        checkbox = new FindIndexCheckbox(element);
    }

    @Override
    public void select() {
        checkbox.check();
    }

    @Override
    public void deselect() {
        checkbox.uncheck();
    }

    @Override
    public boolean isSelected() {
        return checkbox.isChecked();
    }

    @Override
    public String getName() {
        return container.findElement(By.className("database-name")).getText();
    }
}

package com.autonomy.abc.selenium.find.filters;

import com.autonomy.abc.selenium.indexes.tree.IndexNodeElement;
import com.hp.autonomy.frontend.selenium.element.CheckboxBase;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;

class FindIndexLeafNode implements IndexNodeElement {
    private final CheckboxBase checkbox;
    private final WebElement container;

    FindIndexLeafNode(final WebElement element) {
        container = element;
        checkbox = new FindIndexCheckbox(element.findElement(By.tagName("span")));
    }

    @Override
    public void select() {
        checkbox.check();
    }

    @Override
    public void deselect() {
        checkbox.uncheck();
    }

    @Override
    public boolean isSelected() {
        return checkbox.isChecked();
    }

    @Override
    public String getName() {
        return container.findElement(By.className("database-name")).getText();
    }
}

Fix finding the checkbox for the index filters

Broken either by actual change or updating Checkboxes to extend CheckBoxBase.
Could not click on 'All' in tests.


/*
 * 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.sandrlab.listcase.presentation.repos_list.view;

import android.support.annotation.NonNull;
import android.support.annotation.StringRes;

import com.arellomobile.mvp.MvpView;
import com.sandrlab.listcase.models.GitRepoModel;

import java.util.List;

/**
 * @author Alexander Bilchuk (a.bilchuk@sandrlab.com)
 */
public interface GitReposListView extends MvpView {

    void addTopAndroidReposListItems(@NonNull List<GitRepoModel> gitRepoModelsToAdd);
    void refreshListItems(@NonNull List<GitRepoModel> newGitRepoModels);
    void enableSwipeToRefresh();
    void disableSwipeToRefresh();
    void hideSwipeToRefreshLoading();
    void showLoading();
    void hideLoading();
    void showMessage(@StringRes int stringResId);
}

/*
 * 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.sandrlab.listcase.presentation.repos_list.view;

import android.support.annotation.NonNull;
import android.support.annotation.StringRes;

import com.arellomobile.mvp.MvpView;
import com.arellomobile.mvp.viewstate.strategy.SkipStrategy;
import com.arellomobile.mvp.viewstate.strategy.StateStrategyType;
import com.sandrlab.listcase.models.GitRepoModel;

import java.util.List;

/**
 * @author Alexander Bilchuk (a.bilchuk@sandrlab.com)
 */
public interface GitReposListView extends MvpView {

    void addTopAndroidReposListItems(@NonNull List<GitRepoModel> gitRepoModelsToAdd);
    void refreshListItems(@NonNull List<GitRepoModel> newGitRepoModels);
    void enableSwipeToRefresh();
    void disableSwipeToRefresh();
    void hideSwipeToRefreshLoading();
    void showLoading();
    void hideLoading();

    @StateStrategyType(SkipStrategy.class)
    void showMessage(@StringRes int stringResId);
}

Add Moxy StrategyType for showMessage

Add Moxy StrategyType for showMessage


package org.openlmis.stockmanagement;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
public class CustomWebMvcConfigurerAdapter extends WebMvcConfigurerAdapter {

  @Value("${service.url}")
  private String serviceUrl;

  @Override
  public void addViewControllers(ViewControllerRegistry registry) {
    registry.addViewController("/stockmanagement/docs")
            .setViewName("redirect:" + serviceUrl + "/stockmanagement/docs/");
    registry.addViewController("/stockmanagement/docs/")
            .setViewName("forward:/stockmanagement/docs/index.html");
    super.addViewControllers(registry);
  }

  @Override
  public void addResourceHandlers(ResourceHandlerRegistry registry) {
    registry.addResourceHandler("/stockmanagement/webjars/**")
            .addResourceLocations("classpath:/META-INF/resources/webjars/");
    super.addResourceHandlers(registry);
  }
}

package org.openlmis.stockmanagement;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.CacheControl;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import java.util.concurrent.TimeUnit;

@Configuration
public class CustomWebMvcConfigurerAdapter extends WebMvcConfigurerAdapter {

  @Value("${service.url}")
  private String serviceUrl;

  @Override
  public void addViewControllers(ViewControllerRegistry registry) {
    registry.addViewController("/stockmanagement/docs")
            .setViewName("redirect:" + serviceUrl + "/stockmanagement/docs/");
    registry.addViewController("/stockmanagement/docs/")
            .setViewName("forward:/stockmanagement/docs/index.html");
    super.addViewControllers(registry);
  }

  @Override
  public void addResourceHandlers(ResourceHandlerRegistry registry) {
    registry.addResourceHandler("/stockmanagement/webjars/**")
            .addResourceLocations("classpath:/META-INF/resources/webjars/")
            .setCacheControl(CacheControl.maxAge(7, TimeUnit.DAYS));
    super.addResourceHandlers(registry);
  }
}

Enable cache for swagger ui web jar so that it's faster to load in test/uat envs


package org.hummingbirdlang.nodes;

import com.oracle.truffle.api.frame.FrameDescriptor;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.RootNode;
import com.oracle.truffle.api.source.SourceSection;

import org.hummingbirdlang.HBLanguage;
import org.hummingbirdlang.types.realize.InferenceVisitor;
import org.hummingbirdlang.types.realize.Visitable;

public class HBSourceRootNode extends RootNode implements Visitable {
  @Child private HBBlockNode bodyNode;

  public HBSourceRootNode(SourceSection sourceSection, FrameDescriptor frameDescriptor, HBBlockNode bodyNode) {
    super(HBLanguage.class, sourceSection, frameDescriptor);
    this.bodyNode = bodyNode;
  }

  public void accept(InferenceVisitor visitor) {
    visitor.enter(this);
    this.bodyNode.accept(visitor);
    visitor.leave(this);
  }

  @Override
  public Object execute(VirtualFrame frame) {
    return null;
  }

  @Override
  public String toString() {
    StringBuilder result = new StringBuilder("HBSourceRootNode(");
    result.append(bodyNode.toString());
    result.append(")");
    return result.toString();
  }
}

package org.hummingbirdlang.nodes;

import com.oracle.truffle.api.frame.FrameDescriptor;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.RootNode;
import com.oracle.truffle.api.source.SourceSection;

import org.hummingbirdlang.HBLanguage;
import org.hummingbirdlang.types.realize.InferenceVisitor;
import org.hummingbirdlang.types.realize.Visitable;

public class HBSourceRootNode extends RootNode implements Visitable {
  @Child private HBBlockNode bodyNode;

  public HBSourceRootNode(SourceSection sourceSection, FrameDescriptor frameDescriptor, HBBlockNode bodyNode) {
    super(HBLanguage.class, sourceSection, frameDescriptor);
    this.bodyNode = bodyNode;
  }

  public void accept(InferenceVisitor visitor) {
    visitor.enter(this);
    this.bodyNode.accept(visitor);
    visitor.leave(this);
  }

  @Override
  public Object execute(VirtualFrame frame) {
    this.bodyNode.executeVoid(frame);
    return null;
  }

  @Override
  public String toString() {
    StringBuilder result = new StringBuilder("HBSourceRootNode(");
    result.append(bodyNode.toString());
    result.append(")");
    return result.toString();
  }
}

Make root node able to execute itself

Make root node able to execute itself


package devopsdistilled.operp.server.data.service.account.impl;

import java.util.Date;

import javax.inject.Inject;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import devopsdistilled.operp.server.data.entity.account.PaidTransaction;
import devopsdistilled.operp.server.data.repo.account.PaidTransactionRepository;
import devopsdistilled.operp.server.data.service.account.PaidTransactionService;
import devopsdistilled.operp.server.data.service.account.PayableAccountService;

@Service
public class PaidTransactionServiceImpl extends
		TransactionServiceImpl<PaidTransaction, PaidTransactionRepository>
		implements PaidTransactionService {

	private static final long serialVersionUID = 8946536638729817665L;

	@Inject
	private PaidTransactionRepository repo;

	@Inject
	private PayableAccountService payableAccountService;

	@Override
	protected PaidTransactionRepository getRepo() {
		return repo;
	}

	@Override
	@Transactional
	public <S extends PaidTransaction> S save(S transaction) {
		transaction.setTransactionDate(new Date());
		transaction = super.save(transaction);

		Double initBalance = transaction.getAccount().getBalance();
		Double afterTranBalance = initBalance + transaction.getAmount();
		transaction.getAccount().setBalance(afterTranBalance);
		payableAccountService.save(transaction.getAccount());
		return transaction;
	}

}

package devopsdistilled.operp.server.data.service.account.impl;

import java.util.Date;

import javax.inject.Inject;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import devopsdistilled.operp.server.data.entity.account.PaidTransaction;
import devopsdistilled.operp.server.data.repo.account.PaidTransactionRepository;
import devopsdistilled.operp.server.data.service.account.PaidTransactionService;
import devopsdistilled.operp.server.data.service.account.PayableAccountService;

@Service
public class PaidTransactionServiceImpl extends
		TransactionServiceImpl<PaidTransaction, PaidTransactionRepository>
		implements PaidTransactionService {

	private static final long serialVersionUID = 8946536638729817665L;

	@Inject
	private PaidTransactionRepository repo;

	@Inject
	private PayableAccountService payableAccountService;

	@Override
	protected PaidTransactionRepository getRepo() {
		return repo;
	}

	@Override
	@Transactional
	public <S extends PaidTransaction> S save(S transaction) {
		transaction.setTransactionDate(new Date());
		transaction = super.save(transaction);

		Double initBalance = transaction.getAccount().getBalance();
		Double afterTranBalance = initBalance - transaction.getAmount();
		transaction.getAccount().setBalance(afterTranBalance);
		payableAccountService.save(transaction.getAccount());
		return transaction;
	}

}

Correct Balance update logic upon transaction


package me.izstas.rfs.client;

public class RfsClient {
    public static void main(String[] args) {
    }
}

package me.izstas.rfs.client;

import javax.swing.JFrame;
import javax.swing.UIManager;

import me.izstas.rfs.client.ui.ServerForm;

public class RfsClient {
    public static void main(String[] args) {
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        }
        catch (Exception e) {
            // Should not really hurt, but we probably want to handle it properly later
        }

        JFrame frame = ServerForm.createFrame();
        frame.setVisible(true);
    }
}

Make main method open ServerForm

Make main method open ServerForm


package org.cyclops.integrateddynamics.core.item;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.cyclops.cyclopscore.helper.L10NHelpers;
import org.cyclops.integrateddynamics.IntegratedDynamics;

import java.util.List;

/**
 * Base implementation of {@link IVariableFacade}
 * @author rubensworks
 */
public abstract class VariableFacadeBase implements IVariableFacade {

    private final int id;

    public VariableFacadeBase(boolean generateId) {
        this.id = generateId ? IntegratedDynamics.globalCounters.getNext("variable") : -1;
    }

    public VariableFacadeBase(int id) {
        this.id = id;
    }

    @Override
    public final int getId() {
        return this.id;
    }

    @SideOnly(Side.CLIENT)
    @Override
    public void addInformation(List<String> list, EntityPlayer entityPlayer) {
        list.add(L10NHelpers.localize("item.items.integrateddynamics.variable.id", getId() > -1 ? "..." : getId()));
    }

}

package org.cyclops.integrateddynamics.core.item;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.cyclops.cyclopscore.helper.L10NHelpers;
import org.cyclops.integrateddynamics.IntegratedDynamics;

import java.util.List;

/**
 * Base implementation of {@link IVariableFacade}
 * @author rubensworks
 */
public abstract class VariableFacadeBase implements IVariableFacade {

    private final int id;

    public VariableFacadeBase(boolean generateId) {
        this.id = generateId ? IntegratedDynamics.globalCounters.getNext("variable") : -1;
    }

    public VariableFacadeBase(int id) {
        this.id = id;
    }

    @Override
    public final int getId() {
        return this.id;
    }

    @SideOnly(Side.CLIENT)
    @Override
    public void addInformation(List<String> list, EntityPlayer entityPlayer) {
        list.add(L10NHelpers.localize("item.items.integrateddynamics.variable.id", getId() == -1 ? "..." : getId()));
    }

}

Fix incorrect display of variable id in tooltip


/*
       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 __ID__;

import android.os.Bundle;
import org.apache.cordova.*;

public class __ACTIVITY__ extends CordovaActivity
{
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        super.init();
        // Set by <content src="index.html" /> in config.xml
        super.loadUrl(Config.getStartUrl());
        //super.loadUrl("file:///android_asset/www/index.html");
    }
}

/*
       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 __ID__;

import android.os.Bundle;
import org.apache.cordova.*;

public class __ACTIVITY__ extends CordovaActivity
{
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        // Set by <content src="index.html" /> in config.xml
        loadUrl(launchUrl);
    }
}

Refactor: Use ConfigXmlParser in activity. Adds CordovaWebView.init()

This does subtly change the API surface due to CordovaWebView.init(),
but only minimally, and is backwards compatibly with the default
generated projects from prior versions.


package se.ericthelin.fractions;

import org.junit.Test;

import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;

public class GreatestCommonDivisorTest {

	@Test
	public void returnsFirstWhenSecondIsZero() {
		assertThat(GreatestCommonDivisor.of(6, 0), is(6));
	}

	@Test
	public void returnsSecondWhenFirstIsZero() {
		assertThat(GreatestCommonDivisor.of(0, 4), is(4));
	}

	@Test
	public void returnsGreatestCommonDivisorOfFirstAndSecond() {
		assertThat(GreatestCommonDivisor.of(6, 4), is(2));
	}

	@Test
	public void acceptsArgumentsInReverseOrder() {
		assertThat(GreatestCommonDivisor.of(4, 6), is(2));
	}

	@Test
	public void acceptsNegativeFirstArgument() {
		assertThat(GreatestCommonDivisor.of(-6, 4), is(-2));
	}
}

package se.ericthelin.fractions;

import org.junit.Test;

import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;

public class GreatestCommonDivisorTest {

	@Test
	public void returnsFirstWhenSecondIsZero() {
		assertThat(GreatestCommonDivisor.of(6, 0), is(6));
	}

	@Test
	public void returnsSecondWhenFirstIsZero() {
		assertThat(GreatestCommonDivisor.of(0, 4), is(4));
	}

	@Test
	public void returnsGreatestCommonDivisorOfFirstAndSecond() {
		assertThat(GreatestCommonDivisor.of(6, 4), is(2));
	}

	@Test
	public void acceptsArgumentsInReverseOrder() {
		assertThat(GreatestCommonDivisor.of(4, 6), is(2));
	}

	@Test
	public void acceptsNegativeFirstArgument() {
		assertThat(GreatestCommonDivisor.of(-6, 4), is(-2));
	}

	@Test
	public void acceptsNegativeSecondArgument() {
		assertThat(GreatestCommonDivisor.of(6, -4), is(2));
	}
}

Check that GreatestCommonDivisor accepts negative second argument


/*
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

package net.localizethat.actions;

import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import net.localizethat.Main;
import net.localizethat.gui.GlossaryGuiManager;

/**
 * Opens a tab with the Glossary manager in the main window
 * @author rpalomares
 */
public class GlossaryManagerAction extends AbstractAction {
    private static final String TITLE = "Glossary Manager";
    private static final String DESCRIPTION = "Opens " + TITLE;
    private static final int MNEMONIC = java.awt.event.KeyEvent.VK_G;
    private GlossaryGuiManager glossaryGuiMgr;

    /**
     * Action representing the launching of the Main panel as a tab in main window
     */
    public GlossaryManagerAction() {
        super(TITLE);
        putValue(SHORT_DESCRIPTION, DESCRIPTION);
        putValue(MNEMONIC_KEY, MNEMONIC);
        putValue(ACCELERATOR_KEY, javax.swing.KeyStroke.getKeyStroke(MNEMONIC, java.awt.event.InputEvent.CTRL_MASK));
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        if (glossaryGuiMgr == null) {
            glossaryGuiMgr = new GlossaryGuiManager();
        }
        Main.mainWindow.addTab(glossaryGuiMgr, TITLE);
    }

}

/*
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

package net.localizethat.actions;

import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import net.localizethat.Main;
import net.localizethat.gui.tabpanels.GlossaryGuiManager;

/**
 * Opens a tab with the Glossary manager in the main window
 * @author rpalomares
 */
public class GlossaryManagerAction extends AbstractAction {
    private static final String TITLE = "Glossary Manager";
    private static final String DESCRIPTION = "Opens " + TITLE;
    private static final int MNEMONIC = java.awt.event.KeyEvent.VK_G;
    private GlossaryGuiManager glossaryGuiMgr;

    /**
     * Action representing the launching of the Main panel as a tab in main window
     */
    public GlossaryManagerAction() {
        super(TITLE);
        putValue(SHORT_DESCRIPTION, DESCRIPTION);
        putValue(MNEMONIC_KEY, MNEMONIC);
        putValue(ACCELERATOR_KEY, javax.swing.KeyStroke.getKeyStroke(MNEMONIC, java.awt.event.InputEvent.CTRL_MASK));
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        if (glossaryGuiMgr == null) {
            glossaryGuiMgr = new GlossaryGuiManager();
        }
        Main.mainWindow.addTab(glossaryGuiMgr, TITLE);
    }

}

Move GlossaryManager to tabpanels package (leftover)


package uk.ac.ic.wlgitbridge.snapshot.getsavedvers;

import uk.ac.ic.wlgitbridge.util.Util;

/**
 * Created by Winston on 06/11/14.
 */
public class SnapshotInfo implements Comparable<SnapshotInfo> {

    private int versionId;
    private String comment;
    private WLUser user;
    private String createdAt;

    public SnapshotInfo(int versionID, String createdAt, String name, String email) {
        this(versionID, "Update on " + Util.getServiceName() + ".", email, name, createdAt);
    }

    public SnapshotInfo(int versionID, String comment, String email, String name, String createdAt) {
        versionId = versionID;
        this.comment = comment;
        user = new WLUser(name, email);
        this.createdAt = createdAt;
    }

    public int getVersionId() {
        return versionId;
    }

    public String getComment() {
        return comment;
    }

    public WLUser getUser() {
        return user;
    }

    public String getCreatedAt() {
        return createdAt;
    }

    @Override
    public boolean equals(Object obj) {
        if (!(obj instanceof SnapshotInfo)) {
            return false;
        }
        SnapshotInfo that = (SnapshotInfo) obj;
        return versionId == that.versionId;
    }

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

package uk.ac.ic.wlgitbridge.snapshot.getsavedvers;

import uk.ac.ic.wlgitbridge.util.Util;

/**
 * Created by Winston on 06/11/14.
 */
public class SnapshotInfo implements Comparable<SnapshotInfo> {

    private int versionId;
    private String comment;
    private WLUser user;
    private String createdAt;

    public SnapshotInfo(int versionID, String createdAt, String name, String email) {
        this(versionID, "Update on " + Util.getServiceName() + ".", email, name, createdAt);
    }

    public SnapshotInfo(int versionID, String comment, String email, String name, String createdAt) {
        versionId = versionID;
        this.comment = comment;
        user = new WLUser(name, email);
        this.createdAt = createdAt;
    }

    public int getVersionId() {
        return versionId;
    }

    public String getComment() {
        return comment;
    }

    public WLUser getUser() {
        return user != null ? user : new WLUser();
    }

    public String getCreatedAt() {
        return createdAt;
    }

    @Override
    public boolean equals(Object obj) {
        if (!(obj instanceof SnapshotInfo)) {
            return false;
        }
        SnapshotInfo that = (SnapshotInfo) obj;
        return versionId == that.versionId;
    }

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

Support for anonymous saved versions

Support for anonymous saved versions

This fixes a case when de API sends a version without user. There was a
bug allowing to create anonymous versions in the application and we
have to support the old data.

The problem here is that SnapshotInfo classes are inflated from json
via Gson. This method does not call any constructor and, since the json
does not include the ‘user’ key, the bridge crashes because we’re not
expecting null users.

I’m not happy with this fix, but is the minimum solution that does not
affect anything else.


/*
 * Copyright 2015 IBM Corp. 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.
 */
package com.ibm.watson.developer_cloud.personality_insights.v2.model;

import com.google.gson.annotations.SerializedName;

/**
 * Personality Insights supported languages for {@link Profile}s.
 */
public enum AcceptLanguage {

  /** english. */
  @SerializedName("en") ENGLISH("en"),

  /** spanish. */
  @SerializedName("es") SPANISH("es");

  private final String text;

  /**
   * @param text
   */
  private AcceptLanguage(final String text) {
    this.text = text;
  }

  /*
   * (non-Javadoc)
   *
   * @see java.lang.Enum#toString()
   */
  @Override
  public String toString() {
    return text;
  }
}

/*
 * Copyright 2015 IBM Corp. 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.
 */
package com.ibm.watson.developer_cloud.personality_insights.v2.model;

import com.google.gson.annotations.SerializedName;

/**
 * Personality Insights supported languages for {@link Profile}s.
 */
public enum AcceptLanguage {

  /** english. */
  @SerializedName("en") ENGLISH("en"),

  /** spanish. */
  @SerializedName("es") SPANISH("es"),

  /** arabic. */
  @SerializedName("ar") ARABIC("ar"),

  /** japanese */
  @SerializedName("ja") JAPANESE("ja");

  private final String text;

  /**
   * @param text
   */
  private AcceptLanguage(final String text) {
    this.text = text;
  }

  /*
   * (non-Javadoc)
   *
   * @see java.lang.Enum#toString()
   */
  @Override
  public String toString() {
    return text;
  }
}

Add Arabic and Japanese support for Personality Insights


package org.icij.extract;

import java.util.Locale;

/**
 * An enumerated list of implemented queue types.
 *
 * @author Matthew Caruana Galizia <mcaruana@icij.org>
 * @since 1.0.0-beta
 */
public enum DocumentQueueType {
	NONE, ARRAY, REDIS;

	/**
	 * Return the name of the queue type.
	 *
	 * @return The name of the queue type.
	 */
	public String toString() {
		return name().toLowerCase(Locale.ROOT);
	}

	/**
	 * Parse the given string representation of the type into an instance.
	 *
	 * @param queueType the type of queue as a string value
	 * @return The type of queue as a {@link DocumentQueueType} instance.
	 */
	public static DocumentQueueType parse(final String queueType) {
		if (null == queueType) {
			return NONE;
		}

		try {
			return valueOf(queueType.toUpperCase(Locale.ROOT));
		} catch (IllegalArgumentException e) {
			throw new IllegalArgumentException(String.format("\"%s\" is not a valid queue type.", queueType));
		}
	}
}

package org.icij.extract;

import java.util.Locale;

/**
 * An enumerated list of implemented queue types.
 *
 * @author Matthew Caruana Galizia <mcaruana@icij.org>
 * @since 1.0.0-beta
 */
public enum DocumentQueueType {
	ARRAY, REDIS;

	/**
	 * Return the name of the queue type.
	 *
	 * @return The name of the queue type.
	 */
	public String toString() {
		return name().toLowerCase(Locale.ROOT);
	}

	/**
	 * Parse the given string representation of the type into an instance.
	 *
	 * @param queueType the type of queue as a string value
	 * @return The type of queue as a {@link DocumentQueueType} instance.
	 */
	public static DocumentQueueType parse(final String queueType) {
		try {
			return valueOf(queueType.toUpperCase(Locale.ROOT));
		} catch (IllegalArgumentException e) {
			throw new IllegalArgumentException(String.format("\"%s\" is not a valid queue type.", queueType));
		}
	}
}

Remove unused queue type 'none'

Remove unused queue type 'none'


package protocolsupport.injector.network;

import net.minecraft.server.v1_8_R3.MinecraftServer;
import net.minecraft.server.v1_8_R3.ServerConnection;
import protocolsupport.ProtocolSupport;
import protocolsupport.utils.Utils;
import protocolsupport.utils.Utils.Converter;

public class NettyInjector {

	private static final boolean useNonBlockingServerConnection = Utils.getJavaPropertyValue("protocolsupport.nonblockingconection", false, Converter.STRING_TO_BOOLEAN);

	public static void inject() throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException {
		ServerConnection connection = MinecraftServer.getServer().getServerConnection();
		if (connection == null && useNonBlockingServerConnection) {
			NonBlockingServerConnection.inject();
			ProtocolSupport.logInfo("Using NonBlockingServerConnection");
		} else {
			BasicInjector.inject();
			ProtocolSupport.logInfo("Using injected ServerConnection");
		}
	}

}

package protocolsupport.injector.network;

import net.minecraft.server.v1_8_R3.MinecraftServer;
import net.minecraft.server.v1_8_R3.ServerConnection;
import protocolsupport.ProtocolSupport;
import protocolsupport.utils.Utils;
import protocolsupport.utils.Utils.Converter;

public class NettyInjector {

	private static final boolean allowUseEpollChannel = Utils.getJavaPropertyValue("protocolsupport.allowepoll", false, Converter.STRING_TO_BOOLEAN);
	private static final boolean useNonBlockingServerConnection = Utils.getJavaPropertyValue("protocolsupport.nonblockingconection", false, Converter.STRING_TO_BOOLEAN);

	public static void inject() throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException {
		ServerConnection connection = MinecraftServer.getServer().getServerConnection();
		if (!allowUseEpollChannel) {
			MinecraftServer.getServer().getPropertyManager().setProperty("use-native-transport", false);
		}
		if (connection == null && useNonBlockingServerConnection) {
			NonBlockingServerConnection.inject();
			ProtocolSupport.logInfo("Using NonBlockingServerConnection");
		} else {
			BasicInjector.inject();
			ProtocolSupport.logInfo("Using injected ServerConnection");
		}
	}

}

Disable native transport by default unless allowed by system property.


package flg.rendering;

import java.awt.Color;
import java.awt.Graphics;

import javax.swing.JPanel;

public class HeatMap
extends JPanel {

    private static final long serialVersionUID = 1L;

    public final static int   PIXEL_SIZE       = 5;

    private float[][]         heights;

    public HeatMap(float[][] heights) {
        super();
        this.heights = heights;
    }

    @Override
    public void paint(Graphics g) {

        // draw the grid
        for (int i = 0; i < this.heights[0].length; i++) {
            for (int j = 0; j < this.heights[i].length; j++) {
                float height = this.heights[i][j];

                if (height <= -2) {
                    g.setColor(Color.BLUE);
                } else if (height > -2 && height < 2) {
                    g.setColor(Color.GREEN);
                } else if (height >= 2) {
                    g.setColor(Color.WHITE);
                }

                int x = PIXEL_SIZE * i;
                int y = PIXEL_SIZE * j;

                g.fillRect(x, y, PIXEL_SIZE, PIXEL_SIZE);
            }
        }
    }
}

package flg.rendering;

import java.awt.Color;
import java.awt.Graphics;

import javax.swing.JPanel;

public class HeatMap
extends JPanel {

    private static final long serialVersionUID = 1L;

    public final static int   PIXEL_SIZE       = 3;

    private float[][]         heights;

    public HeatMap(float[][] heights) {
        super();
        this.heights = heights;
    }

    @Override
    public void paint(Graphics g) {

        // draw the grid
        for (int i = 0; i < this.heights[0].length; i++) {
            for (int j = 0; j < this.heights[i].length; j++) {
                float height = this.heights[i][j];

                if (height <= -2) {
                    g.setColor(Color.decode("#06109a")); // dark blue
                } else if (height > -2 && height <= -1.5) {
                    g.setColor(Color.decode("#414df6")); // brighter blue
                } else if (height > -1.5 && height <= 0.5) {
                    g.setColor(Color.decode("#10b223")); // dark green
                } else if (height > 0.5 && height <= 1.6) {
                    g.setColor(Color.decode("#2eea1c")); // brighter green
                } else if (height > 1.6 && height <= 2.75) {
                    g.setColor(Color.GRAY);
                } else if (height > 2.75) {
                    g.setColor(Color.WHITE);
                }

                int x = PIXEL_SIZE * i;
                int y = PIXEL_SIZE * j;

                g.fillRect(x, y, PIXEL_SIZE, PIXEL_SIZE);
            }
        }
    }
}

Extend heat map with better color scale.


package uk.ac.ebi.quickgo.geneproduct.common.common;

import uk.ac.ebi.quickgo.geneproduct.common.document.GeneProductDocument;

import java.util.Arrays;
import java.util.Collections;

/**
 * Class to create mocked objects of type {@link GeneProductDocument}.
 */
public final class GeneProductDocMocker {
    private GeneProductDocMocker() {}

    public static GeneProductDocument createDocWithId(String id) {
        GeneProductDocument doc = new GeneProductDocument();
        doc.id = id;
        doc.type = "protein";
        doc.taxonId = 35758;
        doc.symbol = "Streptomyces ghanaensis - symbol";
        doc.parentId = "UniProtKB:OK0206";
        doc.database = "UniProt";
        doc.databaseSubsets = Arrays.asList("RRR","QQQ");
        doc.isAnnotated = true;
        doc.isIsoform = true;
        doc.isCompleteProteome = true;
        doc.name = "moeA5";
        doc.referenceProteome = "AAAA";
        doc.synonyms = Collections.singletonList("3SSW23");
        return doc;
    }
}

package uk.ac.ebi.quickgo.geneproduct.common.common;

import uk.ac.ebi.quickgo.geneproduct.common.document.GeneProductDocument;

import java.util.Arrays;
import java.util.Collections;

/**
 * Class to create mocked objects of type {@link GeneProductDocument}.
 */
public final class GeneProductDocMocker {
    private GeneProductDocMocker() {}

    public static GeneProductDocument createDocWithId(String id) {
        GeneProductDocument doc = new GeneProductDocument();
        doc.id = id;
        doc.type = "protein";
        doc.taxonId = 35758;
        doc.taxonName = "Streptomyces ghanaensis";
        doc.symbol = "Streptomyces ghanaensis - symbol";
        doc.parentId = "UniProtKB:OK0206";
        doc.database = "UniProt";
        doc.databaseSubsets = Arrays.asList("RRR","QQQ");
        doc.isAnnotated = true;
        doc.isIsoform = true;
        doc.isCompleteProteome = true;
        doc.name = "moeA5";
        doc.referenceProteome = "AAAA";
        doc.synonyms = Collections.singletonList("3SSW23");
        return doc;
    }
}

Add taxon name example to gene product stub.

See issue: https://www.ebi.ac.uk/panda/jira/browse/GOA-2398


package openmods.igw.impl.client;

import net.minecraft.client.gui.GuiMainMenu;
import net.minecraftforge.client.event.GuiOpenEvent;

import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

import openmods.igw.OpenModsIGW;

@SideOnly(Side.CLIENT)
public class GuiOpenEventHandler {

	@SubscribeEvent
	@SideOnly(Side.CLIENT)
	@SuppressWarnings("unused")
	//@Explain("Called by Forge, not by us")
	// TODO Move to API
	public void onMainMenuOpen(final GuiOpenEvent event) {
		if (!(event.gui instanceof GuiMainMenu)) return;

		if (WarningGui.shallShow()) {
			event.gui = new WarningGui();
			return;
		}

		if (MismatchingVersionsGui.shouldShow()) {
			event.gui = new MismatchingVersionsGui(OpenModsIGW.proxy().getMismatchingMods());
		}
	}
}

package openmods.igw.impl.client;

import com.google.common.base.Preconditions;

import net.minecraft.client.gui.GuiMainMenu;
import net.minecraftforge.client.event.GuiOpenEvent;

import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

import openmods.igw.api.OpenModsIGWApi;
import openmods.igw.api.service.IClassProviderService;
import openmods.igw.api.service.IGuiService;

@SideOnly(Side.CLIENT)
public class GuiOpenEventHandler {

	@SubscribeEvent
	@SideOnly(Side.CLIENT)
	@SuppressWarnings("unused")
	//@Explain("Called by Forge, not by us")
	public void onMainMenuOpen(final GuiOpenEvent event) {
		if (!(event.gui instanceof GuiMainMenu)) return;

		final IGuiService it = Preconditions.checkNotNull(OpenModsIGWApi.get().serviceManager()
				.obtainAndCastService(IGuiService.class));

		if (it.shouldShow(IGuiService.GUIs.WARNING)) {
			event.gui = it.construct(IGuiService.GUIs.WARNING);
			return;
		}

		if (it.shouldShow(IGuiService.GUIs.MISMATCHING_MODS)) {
			event.gui = it.construct(IGuiService.GUIs.MISMATCHING_MODS, Preconditions.checkNotNull(
					Preconditions.checkNotNull(
							OpenModsIGWApi.get().serviceManager().obtainAndCastService(IClassProviderService.class)
					).proxy()
			).getMismatchingMods());
		}
	}
}

Use API instead of direct calls in GUI event handler

Sorry for no GPG signature, but Git doesn't want to run GPG nor any
other software. Reason: unknown

Signed-off-by: TheSilkMiner <7e811527e53179cd216d0ac71740b4760bead5b2@outlook.com>


package openmods.network.targets;

import java.util.Collection;
import java.util.Set;

import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.WorldServer;
import openmods.network.DimCoord;
import openmods.network.IPacketTargetSelector;
import openmods.utils.NetUtils;

import com.google.common.base.Preconditions;

import cpw.mods.fml.common.network.handshake.NetworkDispatcher;
import cpw.mods.fml.relauncher.Side;

public class SelectChunkWatchers implements IPacketTargetSelector {

	public static final IPacketTargetSelector INSTANCE = new SelectChunkWatchers();

	@Override
	public boolean isAllowedOnSide(Side side) {
		return side == Side.SERVER;
	}

	@Override
	public void listDispatchers(Object arg, Collection<NetworkDispatcher> result) {
		Preconditions.checkArgument(arg instanceof DimCoord, "Argument must be DimCoord");
		DimCoord coord = (DimCoord)arg;

		WorldServer server = MinecraftServer.getServer().worldServers[coord.dimension];

		Set<EntityPlayerMP> players = NetUtils.getPlayersWatchingBlock(server, coord.x, coord.z);

		for (EntityPlayerMP player : players) {
			NetworkDispatcher dispatcher = NetUtils.getPlayerDispatcher(player);
			result.add(dispatcher);
		}
	}

}

package openmods.network.targets;

import java.util.Collection;
import java.util.Set;

import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.DimensionManager;
import openmods.network.DimCoord;
import openmods.network.IPacketTargetSelector;
import openmods.utils.NetUtils;

import com.google.common.base.Preconditions;

import cpw.mods.fml.common.network.handshake.NetworkDispatcher;
import cpw.mods.fml.relauncher.Side;

public class SelectChunkWatchers implements IPacketTargetSelector {

	public static final IPacketTargetSelector INSTANCE = new SelectChunkWatchers();

	@Override
	public boolean isAllowedOnSide(Side side) {
		return side == Side.SERVER;
	}

	@Override
	public void listDispatchers(Object arg, Collection<NetworkDispatcher> result) {
		Preconditions.checkArgument(arg instanceof DimCoord, "Argument must be DimCoord");
		DimCoord coord = (DimCoord)arg;

		WorldServer server = DimensionManager.getWorld(coord.dimension);

		Set<EntityPlayerMP> players = NetUtils.getPlayersWatchingBlock(server, coord.x, coord.z);

		for (EntityPlayerMP player : players) {
			NetworkDispatcher dispatcher = NetUtils.getPlayerDispatcher(player);
			result.add(dispatcher);
		}
	}

}

Fix invalid method used to get worlds

Fix invalid method used to get worlds


/**
 * 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.crypto.random;

import java.util.Properties;

public class TestOsCryptoRandom extends AbstractRandomTest {

    @Override
    public CryptoRandom getCryptoRandom() {
        return new OsCryptoRandom(new Properties());
    }
}

/**
 * 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.crypto.random;

import static org.junit.Assert.fail;

import java.security.GeneralSecurityException;
import java.util.Properties;

import org.apache.commons.crypto.conf.ConfigurationKeys;

public class TestOsCryptoRandom extends AbstractRandomTest {

    @Override
    public CryptoRandom getCryptoRandom() throws GeneralSecurityException {
        Properties props = new Properties();
        props.setProperty(
                ConfigurationKeys.SECURE_RANDOM_CLASSES_KEY,
                OsCryptoRandom.class.getName());
        CryptoRandom random = CryptoRandomFactory.getCryptoRandom(props);
        if (!(random instanceof OsCryptoRandom)) {
            fail("The CryptoRandom should be: "
                    + OsCryptoRandom.class.getName());
        }
        return random;
    }
}

Check that class is instantiated correctly


package gov.nih.nci.ncia.util;

import java.text.DecimalFormat;
import java.text.NumberFormat;

/**
 * Util class for Ultrasound process
 *
 * @author zhoujim
 *
 */
public class UltrasoundUtil {

public static final int[] MASKS = {0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020,0x0040, 0x0100, 0x0200};

	public static String getMultiModalityByCode(String code)
	{
		NumberFormat nf = new DecimalFormat("#0000");
	    int intCode = Integer.valueOf(code, 16);
	    StringBuffer buff = new StringBuffer();
	    for(int i=0; i< MASKS.length;i++) {
	         if((MASKS[i] & intCode) > 0) {
	        	 String s = Integer.toString(MASKS[i],16);
	        	 long l = Long.parseLong(s);
	        	 buff.append(nf.format(l));
	        	 buff.append(',');
	         }
	   }
	   String result = buff.toString();
	   return result.substring(0,result.length()-1);
	}

	public static void main(String[] args) {
		String result = getMultiModalityByCode("0011");
		System.out.println("result: " + result );
	}
}

package gov.nih.nci.ncia.util;

import java.text.DecimalFormat;
import java.text.NumberFormat;

/**
 * Util class for Ultrasound process
 *
 * @author zhoujim
 *
 */
public class UltrasoundUtil {

public static final int[] MASKS = {0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020,0x0040, 0x0100, 0x0200};

	public static String getMultiModalityByCode(String code) throws Exception
	{
		NumberFormat nf = new DecimalFormat("#0000");
	    int intCode = Integer.valueOf(code, 16);
	    StringBuffer buff = new StringBuffer();
	    for(int i=0; i< MASKS.length;i++) {
	         if((MASKS[i] & intCode) > 0) {
	        	 String s = Integer.toString(MASKS[i],16);
	        	 long l = Long.parseLong(s);
	        	 buff.append(nf.format(l));
	        	 buff.append(',');
	         }
	   }
	   String result = buff.toString();
	   return result.substring(0,result.length()-1);
	}

	public static void main(String[] args) {
		String result = getMultiModalityByCode("Utltr");
		System.out.println("result: " + result );
	}
}

Use exception if the image is not Ultrasound image.


/*
 * Copyright 2014 Codenvy, S.A.
 *
 * 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.codenvy.ide.ext.datasource.shared;

/**
 * Explore mode, to tell which table types are returned.
 *
 * @author "Mickaël Leduque"
 */
public enum ExploreTableType {

    /** Explore simplest mode. Only tables and views. */
    SIMPLE,
    /** Default explore mode. Adds materialized views, alias and synonyms toSIMPLE. */
    STANDARD,
    /** Explore mode with STANDARD tables plus system tables and views. */
    SYSTEM,
    /** Explore mode for all table/entities types. */
    ALL
}

/*
 * Copyright 2014 Codenvy, S.A.
 *
 * 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.codenvy.ide.ext.datasource.shared;

/**
 * Explore mode, to tell which table types are returned.
 *
 * @author "Mickaël Leduque"
 */
public enum ExploreTableType {

    /** Explore simplest mode. Only tables and views. */
    SIMPLE(0),
    /** Default explore mode. Adds materialized views, alias and synonyms toSIMPLE. */
    STANDARD(1),
    /** Explore mode with STANDARD tables plus system tables and views. */
    SYSTEM(2),
    /** Explore mode for all table/entities types. */
    ALL(3);

    private final int index;

    private ExploreTableType(final int index) {
        this.index = index;
    }

    /**
     * Returns the index of the enum.
     *
     * @return the index
     */
    public int getIndex() {
        return this.index;
    }

    /**
     * Retrieve the enum value that has this index.
     *
     * @param searchedIndex the index
     * @return the enum value or null if there is none
     */
    public static ExploreTableType fromIndex(final int searchedIndex) {
        for (final ExploreTableType type : values()) {
            if (type.getIndex() == searchedIndex) {
                return type;
            }
        }
        return null;
    }
}

Add index to table categories

Add index to table categories


package net.kleinhaneveld.fn.validations;

import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;

public abstract class Validations {
    public static <T> T notNull(@CheckForNull T item) {
        if (item == null) {
            throw new NullPointerException();
        }
        return item;
    }

    public static <T> T notNull(@CheckForNull T item, @Nonnull String message) {
        if (item == null) {
            throw new NullPointerException(message);
        }
        return item;
    }
}

package net.kleinhaneveld.fn.validations;

import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;

public abstract class Validations {
    public static <T> T notNull(@CheckForNull T item) {
        if (item == null) {
            throw new NullPointerException();
        }
        return item;
    }

    public static <T> T notNull(@CheckForNull T item, @Nonnull String message, @Nonnull String... args) {
        if (item == null) {
            throw new NullPointerException(String.format(message, args));
        }
        return item;
    }
}

Allow formatting of error message for null check.