package info.u_team.u_team_core.util.registry;

import java.util.function.Consumer;

import net.minecraftforge.eventbus.api.IEventBus;

public class BusRegistry {

	public static void register(IEventBus bus, Consumer<IEventBus> consumer) {
		consumer.accept(bus);
	}

}

package info.u_team.u_team_core.util.registry;

import java.util.function.Consumer;

import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;

public class BusRegistry {

	public static void registerMod(Consumer<IEventBus> consumer) {
		register(FMLJavaModLoadingContext.get().getModEventBus(), consumer);
	}

	public static void register(IEventBus bus, Consumer<IEventBus> consumer) {
		consumer.accept(bus);
	}

}

Add bus registry for mod

Add bus registry for mod


package org.robockets.stronghold.robot.highgoalshooter;

import org.robockets.stronghold.robot.flipper.FireShooter;
import org.robockets.stronghold.robot.hood.MoveHood;

import edu.wpi.first.wpilibj.command.CommandGroup;

/**
 *
 */
public class ShootPosition extends CommandGroup {

    public  ShootPosition() {
    	addSequential(new MoveHood(-70));
    	addSequential(new FireShooter()); // Unstick ball
    }
}

package org.robockets.stronghold.robot.highgoalshooter;

import org.robockets.stronghold.robot.flipper.FireShooter;
import org.robockets.stronghold.robot.hood.MoveHood;

import edu.wpi.first.wpilibj.command.CommandGroup;

/**
 *
 */
public class ShootPosition extends CommandGroup {

    public  ShootPosition() {
    	addSequential(new MoveHood(-70));
    	addSequential(new FireShooter()); // Unstick ball
    	addSequential(new MoveHood(-80));
    }
}

Move hood back down after shooting position


/*
Copyright 2007-2009 WebDriver committers
Copyright 2007-2009 Google Inc.

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.openqa.selenium;

import org.junit.Test;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;

public class TagNameTest extends AbstractDriverTestCase {

  @Test
  public void shouldReturnInput() {
    driver.get(pages.formPage);
    WebElement selectBox = driver.findElement(By.id("cheese"));
    assertThat(selectBox.getTagName(), is("input"));
  }

}

/*
Copyright 2007-2009 WebDriver committers
Copyright 2007-2009 Google Inc.

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.openqa.selenium;

import org.junit.Test;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;

public class TagNameTest extends AbstractDriverTestCase {

  @Test
  public void shouldReturnInput() {
    driver.get(pages.formPage);
    WebElement selectBox = driver.findElement(By.id("cheese"));
    assertThat(selectBox.getTagName().toLowerCase(), is("input"));
  }

}

Make a test case insensitive.

JasonLeyba: Make a test case insensitive.

git-svn-id: 4179480af2c2519a5eb5e1e9b541cbdf5cf27696@11860 07704840-8298-11de-bf8c-fd130f914ac9


package com.breadwallet.tools.util;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

/**
 * Created by byfieldj on 2/15/18.
 *

 *

 * Reusable class to quick check whether user is connect to Wifi or mobile data
 */

public class BRConnectivityStatus {

    private Context mContext;

    public BRConnectivityStatus(Context context) {
        this.mContext = context;
    }

    // Returns true if connected to wifi, false if connected to mobile data
    public boolean isWifiOrMobileDataConntect() {
        ConnectivityManager cm = (ConnectivityManager)
                mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo netinfo = cm.getActiveNetworkInfo();

        if (netinfo != null && netinfo.isConnectedOrConnecting()) {
            android.net.NetworkInfo wifi =
                    cm.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
            android.net.NetworkInfo mobile =
                    cm.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);

            if ((mobile != null && mobile.isConnectedOrConnecting()) || (wifi != null &&
                    wifi.isConnectedOrConnecting())) {
                return true;
            } else {
                return false;
            }
        } else {
            return false;
        }
    }

}

package com.breadwallet.tools.util;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

/**
 * Created by byfieldj on 2/15/18.
 *

 *

 * Reusable class to quick check whether user is connect to Wifi or mobile data
 */

public class BRConnectivityStatus {

    private Context mContext;

    public BRConnectivityStatus(Context context) {
        this.mContext = context;
    }

    // Returns true if connected to wifi, false if connected to mobile data
    public boolean isWifiOrMobileDataConntected() {
        ConnectivityManager cm = (ConnectivityManager)
                mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo netinfo = cm.getActiveNetworkInfo();

        if (netinfo != null && netinfo.isConnectedOrConnecting()) {
            android.net.NetworkInfo wifi =
                    cm.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
            android.net.NetworkInfo mobile =
                    cm.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);

            if ((mobile != null && mobile.isConnectedOrConnecting()) || (wifi != null &&
                    wifi.isConnectedOrConnecting())) {
                return true;
            } else {
                return false;
            }
        } else {
            return false;
        }
    }

}

Create reusable class to check for wifi or mobile data


package com.twu.biblioteca;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * Created by watsonarw on 16/04/15.
 */
public class MainMenu {

    public static MainMenu instance = new MainMenu();

    private MainMenu(){ }

    public void show() {
        System.out.print("------ Main Menu ------\n" +
                           "Select an option below:\n" +
                           " 1 | List Books\n");
    }

    public void handleResponse() {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        try {
            int response = br.read();
            System.out.print(BibliotecaApp.getLibrary().getBookList());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

package com.twu.biblioteca;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * Created by watsonarw on 16/04/15.
 */
public class MainMenu {

    public static MainMenu instance = new MainMenu();

    public static final String INVALID_INPUT_MESSAGE = "The input you've entered is invalid, please try again.\n";

    private MainMenu(){ }

    public void show() {
        System.out.print("------ Main Menu ------\n" +
                           "Select an option below:\n" +
                           " 1 | List Books\n");
    }

    public void handleResponse() {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        try {
            String response = br.readLine();
            switch (Integer.parseInt(response)) {
                case 1:
                    System.out.print(BibliotecaApp.getLibrary().getBookList());
                    break;
                default:
                    System.out.print(INVALID_INPUT_MESSAGE);
            }
        } catch (IOException e) {
            e.printStackTrace();
        } catch (NumberFormatException e) {
            System.out.print(INVALID_INPUT_MESSAGE);
        }
    }
}

Implement invalid input message when input is invalid


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

public class ReadForbidden {
	public static void main(String args[]) throws Exception {
		if(args.length != 1) {
			System.err.println("missing class argument");
			System.exit(-1);
		}
		String tcln = args[0];
		ClassLoader cl = ClassLoader.getSystemClassLoader();
		Class newClass = cl.loadClass(tcln);
		Forbidden forbidden = (Forbidden) newClass.getAnnotation(Forbidden.class);

		String grep = "egrep '(java/lang/ClassLoader|java\\.lang\\.ClassLoader|java/lang/reflect|java\\.lang\\.reflect";
		for (String s : forbidden.value()) {
			String escape = s.replaceAll("\\.", "\\\\.");
			grep += "|" + escape;
			escape = s.replaceAll("\\.", "/");
			grep += "|" + escape;
		}
		grep += ")'";
		System.out.println(grep);
	}
}

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

public class ReadForbidden {
	public static void main(String args[]) throws Exception {
		if(args.length != 1) {
			System.err.println("missing class argument");
			System.exit(-1);
		}

		String grep = "egrep '(java/lang/ClassLoader|java\\.lang\\.ClassLoader|java/lang/reflect|java\\.lang\\.reflect";

		ClassLoader cl = ClassLoader.getSystemClassLoader();
		for (String tcln : args) {
			Class newClass = cl.loadClass(tcln);
			Forbidden forbidden = (Forbidden) newClass.getAnnotation(Forbidden.class);
			for (String s : forbidden.value()) {
				String escape = s.replaceAll("\\.", "\\\\.");
				grep += "|" + escape;
				escape = s.replaceAll("\\.", "/");
				grep += "|" + escape;
			}
		}

		grep += ")'";
		System.out.println(grep);
	}
}

Allow more than one test class (at least for annotation reading).


package org.nuxeo.intellij.ui;

import com.intellij.openapi.fileChooser.FileChooser;
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;

/**
 * Utility class to show a
 * {@link com.intellij.openapi.fileChooser.FileChooserDialog} to select only
 * Nuxeo SDKs.
 */
public final class NuxeoSDKChooser {

    public static final String NXSERVER_FOLDER_NAME = "nxserver";

    public static final String SDK_FOLDER_NAME = "sdk";

    public static final String COMPONENTS_INDEX_NAME = "components.index";

    private static final NuxeoSDKChooserDescriptor descriptor = new NuxeoSDKChooserDescriptor();

    private NuxeoSDKChooser() {
        // utility class
    }

    public static VirtualFile chooseNuxeoSDK(Project project) {
        return FileChooser.chooseFile(descriptor, project, null);
    }

    public static class NuxeoSDKChooserDescriptor extends FileChooserDescriptor {

        public NuxeoSDKChooserDescriptor() {
            super(false, true, false, false, false, false);
            setTitle("Choose a Nuxeo SDK Folder");
        }

        @Override
        public boolean isFileSelectable(VirtualFile file) {
            return file.isDirectory() && file.isValid()
                    && file.findChild(NXSERVER_FOLDER_NAME) != null
                    && file.findChild(SDK_FOLDER_NAME) != null
                    && file.findChild(COMPONENTS_INDEX_NAME) != null;
        }
    }
}

package org.nuxeo.intellij.ui;

import com.intellij.openapi.fileChooser.FileChooser;
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;

/**
 * Utility class to show a
 * {@link com.intellij.openapi.fileChooser.FileChooserDialog} to select only
 * Nuxeo SDKs.
 */
public final class NuxeoSDKChooser {

    public static final String NXSERVER_FOLDER_NAME = "nxserver";

    public static final String SDK_FOLDER_NAME = "sdk";

    public static final String COMPONENTS_INDEX_NAME = "components.index";

    private static final NuxeoSDKChooserDescriptor descriptor = new NuxeoSDKChooserDescriptor();

    private NuxeoSDKChooser() {
        // utility class
    }

    public static VirtualFile chooseNuxeoSDK(Project project) {
        return FileChooser.chooseFile(descriptor, project, null);
    }

    public static class NuxeoSDKChooserDescriptor extends FileChooserDescriptor {

        public NuxeoSDKChooserDescriptor() {
            super(false, true, false, false, false, false);
            setTitle("Choose a Nuxeo SDK Folder");
        }

        @Override
        public boolean isFileSelectable(VirtualFile file) {
            VirtualFile nxserverFolder = file.findChild(NXSERVER_FOLDER_NAME);
            VirtualFile sdkFolder = file.findChild(SDK_FOLDER_NAME);
            return file.isDirectory() && file.isValid()
                    && nxserverFolder != null && sdkFolder != null
                    && sdkFolder.findChild(COMPONENTS_INDEX_NAME) != null;
        }
    }
}

Fix detection of Nuxeo SDK folder

Fix detection of Nuxeo SDK folder


package net.f4fs.util;

import java.util.Random;

/**
 * RandomDevice for global usage of pseudo-random numbers.
 *
 * Usage:
 *
 *  RandomDevice.INSTANCE.nextLong
 *
 * Created by samuel on 31.03.15.
 */
public enum RandomDevice {
    // To provide reproducible outcomes.
    INSTANCE(new Random(4568321548855l));

    private Random rand;

    private RandomDevice(Random rand) {
        this.rand = rand;
    }

    /**
     * Returns a pseudorandom, uniformly distributed int value between 0 (inclusive)
     * and the specified value (exclusive), drawn from this random number generator's sequence.
     *
     * @param n Bound
     * @return 0 <= value < n
     */
    public synchronized int nextInt(int n) {
        return rand.nextInt(n);
    }

    /**
     * Returns a pseudorandom, uniformly distributed int value between 0 (inclusive)
     * and the specified value (exclusive), drawn from this random number generator's sequence.
     *
     * @param n Bound
     * @return 0 <= value < n
     */
    public synchronized long nextLong(long n) {
        return rand.nextLong();
    }

    public Random getRand() {
        return rand;
    }
}

package net.f4fs.util;

import java.util.Random;

/**
 * RandomDevice for global usage of pseudo-random numbers.
 *
 * Usage:
 *
 *  RandomDevice.INSTANCE.nextLong
 *
 * Created by samuel on 31.03.15.
 */
public enum RandomDevice {
    // To provide reproducible outcomes.
    INSTANCE(new Random(System.currentTimeMillis()));

    private Random rand;

    private RandomDevice(Random rand) {
        this.rand = rand;
    }

    /**
     * Returns a pseudorandom, uniformly distributed int value between 0 (inclusive)
     * and the specified value (exclusive), drawn from this random number generator's sequence.
     *
     * @param n Bound
     * @return 0 <= value < n
     */
    public synchronized int nextInt(int n) {
        return rand.nextInt(n);
    }

    /**
     * Returns a pseudorandom, uniformly distributed int value between 0 (inclusive)
     * and the specified value (exclusive), drawn from this random number generator's sequence.
     *
     * @param n Bound
     * @return 0 <= value < n
     */
    public synchronized long nextLong(long n) {
        return rand.nextLong();
    }

    public Random getRand() {
        return rand;
    }
}

Fix random instanciation with milliseconds as seeds


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

package com.facebook.buck.cxx;

import com.facebook.buck.util.Escaper;
import com.facebook.buck.util.immutables.BuckStyleImmutable;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;

import org.immutables.value.Value;

@BuckStyleImmutable
@Value.Immutable
abstract class AbstractClangCxxCompilationDatabaseEntry implements CxxCompilationDatabaseEntry {

  @Value.Parameter
  public abstract String getDirectory();

  @Override
  @Value.Parameter
  public abstract String getFile();

  @JsonIgnore
  @Value.Parameter
  public abstract ImmutableList<String> getArgs();

  @Override
  @Value.Derived
  public String getCommand() {
    return Joiner.on(' ').join(
        Iterables.transform(
            getArgs(),
            Escaper.SHELL_ESCAPER));
  }

}

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

package com.facebook.buck.cxx;

import com.facebook.buck.util.Escaper;
import com.facebook.buck.util.immutables.BuckStyleImmutable;
import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;

import org.immutables.value.Value;

@BuckStyleImmutable
@Value.Immutable
abstract class AbstractClangCxxCompilationDatabaseEntry implements CxxCompilationDatabaseEntry {

  @Value.Parameter
  public abstract String getDirectory();

  @Override
  @Value.Parameter
  public abstract String getFile();

  @Value.Parameter
  public abstract ImmutableList<String> getArguments();

  @Override
  @Value.Derived
  public String getCommand() {
    return Joiner.on(' ').join(
        Iterables.transform(
            getArguments(),
            Escaper.SHELL_ESCAPER));
  }

}

Add arguments to clang entries.

Add arguments to clang entries.

Summary:
http://reviews.llvm.org/rL245036 added a new attribute to clang
compilation database entries, `arguments`.

Test Plan:
CI
create a compilation database with clang format, see it has `arguments`


package com.janosgyerik.utils.algorithm.sort;

public class MergeSort {

    private MergeSort() {
        // utility class, forbidden constructor
    }

    public static void sort(int[] arr) {
        mergeSort(arr, 0, arr.length);
    }

    protected static void mergeSort(int[] arr, int from, int to) {
        int diff = to - from;
        if (diff < 2) {
            return;
        }
        int mid = from + diff / 2;
        mergeSort(arr, from, mid);
        mergeSort(arr, mid, to);
        merge(arr, from, mid, to);
    }

    protected static void merge(int[] arr, int from, int mid, int to) {
        int[] sorted = new int[to - from];
        for (int i = 0, pos1 = from, pos2 = mid; i < sorted.length; ++i) {
            if (pos1 < mid && (pos2 >= to || arr[pos1] <= arr[pos2])) {
                sorted[i] = arr[pos1++];
            } else {
                sorted[i] = arr[pos2++];
            }
        }
        System.arraycopy(sorted, 0, arr, from, sorted.length);
    }
}

package com.janosgyerik.utils.algorithm.sort;

public class MergeSort {

    private MergeSort() {
        // utility class, forbidden constructor
    }

    public static void sort(int[] arr) {
        mergeSort(arr, 0, arr.length);
    }

    protected static void mergeSort(int[] arr, int from, int to) {
        int diff = to - from;
        if (diff < 2) {
            return;
        }
        int mid = from + diff / 2;
        mergeSort(arr, from, mid);
        mergeSort(arr, mid, to);
        merge(arr, from, mid, to);
    }

    static void merge(int[] arr, int from, int mid, int to) {
        int[] sorted = new int[to - from];
        int i = 0;
        int pos1 = from;
        int pos2 = mid;

        while (pos1 < mid && pos2 < to) {
            if (arr[pos1] <= arr[pos2]) {
                sorted[i++] = arr[pos1++];
            } else {
                sorted[i++] = arr[pos2++];
            }
        }
        while (pos1 < mid) {
            sorted[i++] = arr[pos1++];
        }
        while (pos2 < to) {
            sorted[i++] = arr[pos2++];
        }
        System.arraycopy(sorted, 0, arr, from, sorted.length);
    }
}

Refactor mergeSort to more readable form


package com.rehivetech.beeeon;

import android.text.TextUtils;

import java.util.Comparator;

public class IdentifierComparator implements Comparator<IIdentifier> {

	@Override
	public int compare(IIdentifier lhs, IIdentifier rhs) {
		return compareNumericIds(lhs, rhs);
	}

	public static int compareNumericIds(IIdentifier lhs, IIdentifier rhs) {
		String lhsId = lhs.getId();
		String rhsId = rhs.getId();

		if (TextUtils.isDigitsOnly(lhsId) && TextUtils.isDigitsOnly(rhsId)) {
			// Numeric comparison
			return Long.valueOf(lhsId).compareTo(Long.valueOf(rhsId));
		} else {
			// String comparison
			return lhsId.compareTo(rhsId);
		}
	}

}

package com.rehivetech.beeeon;

import android.text.TextUtils;

import java.math.BigInteger;
import java.util.Comparator;

public class IdentifierComparator implements Comparator<IIdentifier> {

	@Override
	public int compare(IIdentifier lhs, IIdentifier rhs) {
		return compareNumericIds(lhs, rhs);
	}

	public static int compareNumericIds(IIdentifier lhs, IIdentifier rhs) {
		String lhsId = lhs.getId();
		String rhsId = rhs.getId();

		if (TextUtils.isDigitsOnly(lhsId) && TextUtils.isDigitsOnly(rhsId)) {
			// Numeric comparison
			return new BigInteger(lhsId).compareTo(new BigInteger(rhsId));
		} else {
			// String comparison
			return lhsId.compareTo(rhsId);
		}
	}

}

Fix 64bit EUID conversion from String and comparing in Comparator


/**
 *
 */
package hudson.plugins.selenium.callables.hub;

import hudson.plugins.selenium.HubHolder;
import hudson.remoting.Callable;

/**
 * @author Richard Lavoie
 *
 */
public class StopHubCallable implements Callable<Void, Exception> {

    /*
     * (non-Javadoc)
     * @see hudson.remoting.Callable#call()
     */
    public Void call() throws Exception {
        HubHolder.hub.getRegistry().stop();
        HubHolder.hub.stop();
        HubHolder.hub = null;
        return null;
    }

}

/**
 *
 */
package hudson.plugins.selenium.callables.hub;

import java.util.logging.Logger;

import hudson.plugins.selenium.HubHolder;
import hudson.remoting.Callable;

/**
 * @author Richard Lavoie
 *
 */
public class StopHubCallable implements Callable<Void, Exception> {

	private static final Logger LOGGER = Logger.getLogger(StopHubCallable.class.getName());
    /*
     * (non-Javadoc)
     * @see hudson.remoting.Callable#call()
     */
    public Void call() throws Exception {
	    if (HubHolder.hub == null){
		    LOGGER.warning("Hub is not running. Nothing to stop.");
		    return null;
	    }

        HubHolder.hub.getRegistry().stop();
        HubHolder.hub.stop();
        HubHolder.hub = null;
        return null;
    }

}

Fix Exception when trying to restart hub while it is not running


/*
 * Copyright 2009 Mike Cumings
 *
 * 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.igniterealtime.jbosh;

/**
 * Data type representing the getValue of the {@code wait} attribute of the
 * {@code bosh} element.
 */
final class AttrWait extends AbstractIntegerAttr {

    /**
     * Creates a new attribute object.
     *
     * @param val attribute getValue
     * @throws BOSHException on parse or validation failure
     */
    private AttrWait(final String val) throws BOSHException {
        super(val);
        checkMinValue(1);
    }

    /**
     * Creates a new attribute instance from the provided String.
     *
     * @param str string representation of the attribute
     * @return attribute instance or {@code null} if provided string is
     *  {@code null}
     * @throws BOSHException on parse or validation failure
     */
    static AttrWait createFromString(final String str)
    throws BOSHException {
        if (str == null) {
            return null;
        } else {
            return new AttrWait(str);
        }
    }

}

/*
 * Copyright 2009 Mike Cumings
 *
 * 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.igniterealtime.jbosh;

/**
 * Data type representing the getValue of the {@code wait} attribute of the
 * {@code bosh} element.
 */
final class AttrWait extends AbstractIntegerAttr {

    /**
     * Creates a new attribute object.
     *
     * @param val attribute getValue
     * @throws BOSHException on parse or validation failure
     */
    private AttrWait(final String val) throws BOSHException {
        super(val);
        checkMinValue(0);
    }

    /**
     * Creates a new attribute instance from the provided String.
     *
     * @param str string representation of the attribute
     * @return attribute instance or {@code null} if provided string is
     *  {@code null}
     * @throws BOSHException on parse or validation failure
     */
    static AttrWait createFromString(final String str)
    throws BOSHException {
        if (str == null) {
            return null;
        } else {
            return new AttrWait(str);
        }
    }

}

Allow 0 for WAIT attribute

Allow 0 for WAIT attribute

WAIT attribute value could be used in the polling mode to make
the CM return the response immediately.


/*
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

package com.mpalourdio.html5;

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

import java.util.Arrays;

@SpringBootApplication
public class SpringBootAngularHTML5Application {

    public static void main(final String[] args) {
        final ApplicationContext ctx = SpringApplication.run(SpringBootAngularHTML5Application.class, args);
        final String[] beanNames = ctx.getBeanDefinitionNames();
        Arrays.sort(beanNames);
        Arrays.stream(beanNames).forEach(System.out::println);
    }
}

/*
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

package com.mpalourdio.html5;

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

import java.util.Arrays;

@SpringBootApplication
public class SpringBootAngularHTML5Application {

    public static void main(final String ...args) {
        final ApplicationContext ctx = SpringApplication.run(SpringBootAngularHTML5Application.class, args);
        final String[] beanNames = ctx.getBeanDefinitionNames();
        Arrays.sort(beanNames);
        Arrays.stream(beanNames).forEach(System.out::println);
    }
}

Use variadic args in main method

Use variadic args in main method


package com.passel;

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

import com.passel.R;

public class LogInActivity extends Activity {

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

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

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

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

        return super.onOptionsItemSelected(item);
    }
}

package com.passel;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

public class LogInActivity extends Activity {

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

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.menu_log_in, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        if (R.id.action_settings == item.getItemId()) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }
}

Clean up login and signup screens to prep for functionality infusion.


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

package com.facebook.buck.features.python.toolchain;

import com.facebook.buck.core.rulekey.AddToRuleKey;
import com.facebook.buck.core.rulekey.AddsToRuleKey;
import com.facebook.buck.core.util.immutables.BuckStyleImmutable;
import org.immutables.value.Value;

@Value.Immutable(builder = false, copy = false)
@BuckStyleImmutable
public abstract class AbstractPythonVersion implements AddsToRuleKey {

  // TODO(cjhopman): This should add the interpreter name to the rulekey.
  @Value.Parameter
  public abstract String getInterpreterName();

  @Value.Parameter
  @AddToRuleKey
  public abstract String getVersionString(); // X.Y

  @Override
  public String toString() {
    return getInterpreterName() + " " + getVersionString();
  }
}

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

package com.facebook.buck.features.python.toolchain;

import com.facebook.buck.core.rulekey.AddToRuleKey;
import com.facebook.buck.core.rulekey.AddsToRuleKey;
import com.facebook.buck.core.util.immutables.BuckStyleImmutable;
import org.immutables.value.Value;

@Value.Immutable(builder = false, copy = false)
@BuckStyleImmutable
public abstract class AbstractPythonVersion implements AddsToRuleKey {

  @Value.Parameter
  @AddToRuleKey
  public abstract String getInterpreterName();

  @Value.Parameter
  @AddToRuleKey
  public abstract String getVersionString(); // X.Y

  @Override
  public String toString() {
    return getInterpreterName() + " " + getVersionString();
  }
}

Include python interpreter implementation name in rule keys

Reviewed By: andrewjcg

fbshipit-source-id: 16e4503cb9


package org.helioviewer.jhv.data.lock;

public class JHVEventContainerLocks {
    public static final Object dateLock = new Object();

    public static final Object intervalLock = new Object();

    public static final Object cacheLock = new Object();

    public static final Object eventHandlerCacheLock = new Object();
}

package org.helioviewer.jhv.data.lock;

public class JHVEventContainerLocks {
    public static final Object dateLock = new Object();

    public static final Object intervalLock = new Object();

    public static final Object cacheLock = new Object();

    public static final Object eventHandlerCacheLock = new Object();

    public static final Object requestHandlerLock = new Object();
}

Add a request handler lock

Add a request handler lock

git-svn-id: 4e353c0944fe8da334633afc35765ef362dec675@1863 b4e469a2-07ce-4b26-9273-4d7d95a670c7


package hackerrank;

import java.util.Scanner;

/**
 * https://www.hackerrank.com/challenges/insertionsort2
 */
public class InsertionSortPart2 {
    public static void insertionSortPart2(int[] ar) {

    }

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

    }

    private static void printArray(int[] ar) {
        for (int n : ar) {
            System.out.print(n + " ");
        }
        System.out.println("");
    }
}

package hackerrank;

import java.util.Scanner;

/**
 * https://www.hackerrank.com/challenges/insertionsort2
 */
public class InsertionSortPart2 {
    public static void insertionSortPart2(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--;
            }
            printArray(ar);
        }
    }

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

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

    }

    private static void printArray(int[] ar) {
        for (int n : ar) {
            System.out.print(n + " ");
        }
        System.out.println("");
    }
}

Solve Insertion Sort: Part 2

Solve Insertion Sort: Part 2


/*
 * Copyright (C) 2012 The Dagger 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 dagger;

import dagger.internal.Beta;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Annotates a class that contributes to the object graph.
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface Module {
  /**
   * Additional {@code @Module}-annotated classes from which this module is
   * composed. The de-duplicated contributions of the modules in
   * {@code includes}, and of their inclusions recursively, are all contributed
   * to the object graph.
   */
  Class<?>[] includes() default {};

  /**
   * Any {@link Subcomponent}- or {@link dagger.producers.ProductionSubcomponent}-annotated classes
   * which should be children of the component in which this module is installed. A subcomponent may
   * be listed in more than one module in a component.
   */
  @Beta
  Class<?>[] subcomponents() default {};
}

/*
 * Copyright (C) 2012 The Dagger 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 dagger;

import dagger.internal.Beta;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Annotates a class that contributes to the object graph.
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface Module {
  /**
   * Additional {@code @Module}-annotated classes from which this module is
   * composed. The de-duplicated contributions of the modules in
   * {@code includes}, and of their inclusions recursively, are all contributed
   * to the object graph.
   */
  Class<?>[] includes() default {};

  /**
   * Any {@link Subcomponent}- or {@code @ProductionSubcomponent}-annotated classes which should be
   * children of the component in which this module is installed. A subcomponent may be listed in
   * more than one module in a component.
   */
  @Beta
  Class<?>[] subcomponents() default {};
}

Fix a javadoc bug: maven can't @link a producers class in javadoc for core-dagger.

Also run `mvn javadoc:jar` in the opensource tests - this happens as part of
the release script, but not as part of javadoc:aggregate. This should help diagnose the problem earlier on.

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


/*
 * Copyright (C) 2014,2015 The Cat Hive Developers.
 *
 * 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.cathive.sass;

/**
 * @author Benjamin P. Jung
 */
public enum SassTag {
    SASS_BOOLEAN,
    SASS_NUMBER,
    SASS_COLOR,
    SASS_STRING,
    SASS_LIST,
    SASS_MAP,
    SASS_NULL,
    SASS_ERROR,
    SASS_WARNING
}

/*
 * Copyright (C) 2014,2015 The Cat Hive Developers.
 *
 * 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.cathive.sass;

/**
 * @author Benjamin P. Jung
 */
public enum SassTag {
    SASS_BOOLEAN(0),
    SASS_NUMBER(1),
    SASS_COLOR(2),
    SASS_STRING(3),
    SASS_LIST(4),
    SASS_MAP(5),
    SASS_NULL(6),
    SASS_ERROR(7),
    SASS_WARNING(8);

    /** Sass tag primitive int value. */
    private final int intValue;

    private SassTag(final int intValue) {
        this.intValue = intValue;
    }

    public int getIntValue() {
        return this.intValue;
    }

}

Add primitive int value to enum.

Add primitive int value to enum.


package com.crowdin.cli.commands.functionality;

import com.crowdin.cli.properties.PropertiesBean;
import com.crowdin.cli.utils.CommandUtils;
import com.crowdin.cli.utils.PlaceholderUtil;
import org.apache.commons.lang3.StringUtils;

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

public class DryrunTranslations extends Dryrun {

    private PropertiesBean pb;
    private PlaceholderUtil placeholderUtil;

    public DryrunTranslations(PropertiesBean pb, PlaceholderUtil placeholderUtil) {
        this.pb = pb;
        this.placeholderUtil = placeholderUtil;
    }

    @Override
    protected List<String> getFiles() {
        return pb.getFiles()
            .stream()
            .flatMap(file -> CommandUtils.getFileSourcesWithoutIgnores(file, pb.getBasePath(), placeholderUtil)
                .stream()
                .map(source -> placeholderUtil.replaceFileDependentPlaceholders(file.getTranslation(), source))
                .flatMap(translation -> ((file.getLanguagesMapping() != null)
                    ? placeholderUtil.replaceLanguageDependentPlaceholders(translation, file.getLanguagesMapping())
                    : placeholderUtil.replaceLanguageDependentPlaceholders(translation)).stream()))
            .map(source -> StringUtils.removeStart(source, pb.getBasePath()))
            .collect(Collectors.toList());
    }
}

package com.crowdin.cli.commands.functionality;

import com.crowdin.cli.properties.PropertiesBean;
import com.crowdin.cli.utils.CommandUtils;
import com.crowdin.cli.utils.PlaceholderUtil;
import com.crowdin.cli.utils.Utils;
import org.apache.commons.lang3.StringUtils;

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

public class DryrunTranslations extends Dryrun {

    private PropertiesBean pb;
    private PlaceholderUtil placeholderUtil;

    public DryrunTranslations(PropertiesBean pb, PlaceholderUtil placeholderUtil) {
        this.pb = pb;
        this.placeholderUtil = placeholderUtil;
    }

    @Override
    protected List<String> getFiles() {
        return pb.getFiles()
            .stream()
            .flatMap(file -> CommandUtils.getFileSourcesWithoutIgnores(file, pb.getBasePath(), placeholderUtil)
                .stream()
                .map(source -> placeholderUtil.replaceFileDependentPlaceholders(file.getTranslation(), source))
                .flatMap(translation -> ((file.getLanguagesMapping() != null)
                    ? placeholderUtil.replaceLanguageDependentPlaceholders(translation, file.getLanguagesMapping())
                    : placeholderUtil.replaceLanguageDependentPlaceholders(translation)).stream())
                .map(translation -> (file.getTranslationReplace() != null ? file.getTranslationReplace() : Collections.<String, String>emptyMap())
                    .keySet()
                    .stream()
                    .reduce(translation, (trans, k) -> StringUtils.replace(
                        trans,
                        k.replaceAll("[\\\\/]+", Utils.PATH_SEPARATOR_REGEX),
                        file.getTranslationReplace().get(k)))
                )
            )
            .map(source -> StringUtils.removeStart(source, pb.getBasePath()))
            .collect(Collectors.toList());
    }
}

Fix translation_replace for translations dryrun


package com.github.vlsi.mat.calcite.functions;

import org.eclipse.mat.SnapshotException;
import org.eclipse.mat.snapshot.model.IClass;
import org.eclipse.mat.snapshot.model.IObject;

@SuppressWarnings("unused")
public interface IClassMethods {
  static IClass getSuper(IObject clazz) {
    if (clazz instanceof IClass) {
      return ((IClass) clazz).getSuperClass();
    }
    return null;
  }

  static IObject getClassLoader(IObject clazz) {
    if (!(clazz instanceof IClass)) {
      return null;
    }
    int classLoaderId = ((IClass) clazz).getClassLoaderId();
    try {
      return clazz.getSnapshot().getObject(classLoaderId);
    } catch (SnapshotException e) {
      throw new IllegalArgumentException(
          "Unable to retrieve classloader of class " + clazz + " in heap " + clazz.getSnapshot(), e);
    }
  }

  static String getClassName(IObject clazz) {
    if (clazz instanceof IClass) {
      return ((IClass) clazz).getName();
    }
    return null;
  }
}

package com.github.vlsi.mat.calcite.functions;

import org.eclipse.mat.SnapshotException;
import org.eclipse.mat.snapshot.model.IClass;
import org.eclipse.mat.snapshot.model.IObject;

@SuppressWarnings("unused")
public abstract class IClassMethods {
  public static IClass getSuper(IObject clazz) {
    if (clazz instanceof IClass) {
      return ((IClass) clazz).getSuperClass();
    }
    return null;
  }

  public static IObject getClassLoader(IObject clazz) {
    if (!(clazz instanceof IClass)) {
      return null;
    }
    int classLoaderId = ((IClass) clazz).getClassLoaderId();
    try {
      return clazz.getSnapshot().getObject(classLoaderId);
    } catch (SnapshotException e) {
      throw new IllegalArgumentException(
          "Unable to retrieve classloader of class " + clazz + " in heap " + clazz.getSnapshot(), e);
    }
  }

  public static String getClassName(IObject clazz) {
    if (clazz instanceof IClass) {
      return ((IClass) clazz).getName();
    }
    return null;
  }
}

Use abstract classs instead of interface for static methods

This is to workaround https://github.com/janino-compiler/janino/issues/69


package controllers;

import java.util.ArrayList;

import com.feth.play.module.pa.PlayAuthenticate;
import com.feth.play.module.pa.user.AuthUser;

import models.User;

import play.Logger;
import play.mvc.Http.Context;
import play.mvc.Result;
import play.mvc.Security;

public class Secured extends Security.Authenticator {

	@Override
	public String getUsername(final Context ctx) {
        Logger.debug("Secured::getUsername " + ctx);
		final AuthUser u = PlayAuthenticate.getUser(ctx.session());

		if (u != null) {
            User the_user = User.findByAuthUserIdentity(u);
            if (the_user == null) {
                return null;
            }

            return u.getId();
        }

        return null;
	}

	@Override
	public Result onUnauthorized(final Context ctx) {
		return redirect(com.feth.play.module.pa.controllers.routes.Authenticate.logout());
	}
}

package controllers;

import java.util.ArrayList;

import com.feth.play.module.pa.PlayAuthenticate;
import com.feth.play.module.pa.user.AuthUser;

import models.User;

import play.Logger;
import play.mvc.Http.Context;
import play.mvc.Result;
import play.mvc.Security;

public class Secured extends Security.Authenticator {

	@Override
	public String getUsername(final Context ctx) {
        Logger.debug("Secured::getUsername " + ctx);
		final AuthUser u = PlayAuthenticate.getUser(ctx.session());

		if (u != null) {
            User the_user = User.findByAuthUserIdentity(u);
            if (the_user == null) {
                return null;
            }

            return u.getId();
        }

        PlayAuthenticate.storeOriginalUrl(ctx);

        return null;
	}

	@Override
	public Result onUnauthorized(final Context ctx) {
		return redirect(controllers.routes.Public.index());
	}
}

Store original URL before logging in so that user is properly redirected on login.


/*
    Input array: 8 7 9 2 1 10
                  < > < > <

                7 9 2 8 1 10
*/

import java.util.*;
import java.lang.*;

class Solution{

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

        zigZagSort(arr,n);
        print(arr,n);
    }

    public static void zigZagSort(int[] arr, int n){
        boolean toggle = true;
        int temp = 0;
        for(int i=0;i<n-1;i++){
            if(toggle){
                // should be a < b
                if(arr[i]>arr[i+1]){
                    temp=arr[i];
                    arr[i]=arr[i+1];
                    arr[i+1]=temp;
                }
            }
            else{
                // should be a < b
                if(arr[i]<arr[i+1]){
                    temp=arr[i];
                    arr[i]=arr[i+1];
                    arr[i+1]=temp;
                }
            }
            toggle=!toggle;
        }
    }

    public static void print(int[] arr,int n){
        for(int i=0;i<n;i++)
            System.out.print(arr[i]+" ");
        System.out.println();
    }
}
// Complexity of the algorithm is O(n), where n is number of elements in the array

Add time complexity for zigzagArray problem


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package nl.meg.propertiesutility;

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

/**
 *
 * @author meine
 */
public class Properties {
    private final Map<String, String> properties = new HashMap<>();

    public Properties(){

    }

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

    public String getProperty(String property){
        return properties.get(property);
    }

    public String getProperty(String property, String defaultValue){
        if(properties.containsKey(property)){
            return properties.get(property);
        }else{
            return defaultValue;
        }
    }
}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package nl.meg.propertiesutility;

import java.io.InputStream;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.Map;

/**
 *
 * @author meine
 */
public class Properties {
    private final Map<String, String> properties = new HashMap<>();

    public Properties(){

    }

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

    public String getProperty(String property){
        return properties.get(property);
    }

    public String getProperty(String property, String defaultValue){
        if(properties.containsKey(property)){
            return properties.get(property);
        }else{
            return defaultValue;
        }
    }

    public void load(InputStream in){

    }

    public void store (OutputStream out, String comments){

    }
}

Store and load methods (stubs)

Store and load methods (stubs)


/*
 * Copyright 2012 GitHub Inc.
 *
 * 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.github.mobile.util;

import static android.text.format.DateUtils.MINUTE_IN_MILLIS;
import android.text.format.DateUtils;

import java.util.Date;

/**
 * Utilities for dealing with dates and times
 */
public class TimeUtils {

    /**
     * Get relative time for date
     *
     * @param date
     * @return relative time
     */
    public static CharSequence getRelativeTime(final Date date) {
        long now = System.currentTimeMillis();
        if (Math.abs(now - date.getTime()) > 60000)
            return DateUtils.getRelativeTimeSpanString(date.getTime(), now,
                    MINUTE_IN_MILLIS);
        else
            return "just now";
    }
}

/*
 * Copyright 2012 GitHub Inc.
 *
 * 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.github.mobile.util;

import static android.text.format.DateUtils.FORMAT_NUMERIC_DATE;
import static android.text.format.DateUtils.FORMAT_SHOW_DATE;
import static android.text.format.DateUtils.FORMAT_SHOW_YEAR;
import static android.text.format.DateUtils.MINUTE_IN_MILLIS;
import android.text.format.DateUtils;

import java.util.Date;

/**
 * Utilities for dealing with dates and times
 */
public class TimeUtils {

    /**
     * Get relative time for date
     *
     * @param date
     * @return relative time
     */
    public static CharSequence getRelativeTime(final Date date) {
        long now = System.currentTimeMillis();
        if (Math.abs(now - date.getTime()) > 60000)
            return DateUtils.getRelativeTimeSpanString(date.getTime(), now,
                    MINUTE_IN_MILLIS, FORMAT_SHOW_DATE | FORMAT_SHOW_YEAR
                            | FORMAT_NUMERIC_DATE);
        else
            return "just now";
    }
}

Use FORMAT_NUMERIC_DATE when creating relative time string

This removes casing problems when the relative time has a
suffix but the first part of it is the month name which
was previously being lower-cased.


package javax.jmi.reflect;

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

public interface RefPackage extends RefBaseObject {
    public RefClass refClass(RefObject type);
    public RefClass refClass(String typeName);
    public RefPackage refPackage(RefObject nestedPackage);
    public RefPackage refPackage(String nestedPackageName);
    public RefAssociation refAssociation(RefObject association);
    public RefAssociation refAssociation(String associationName);
    public Collection refAllPackages();
    public Collection refAllClasses();
    public Collection refAllAssociations();
    public RefStruct refCreateStruct(RefObject struct, List params);
    public RefStruct refCreateStruct(String structName, List params);
    public RefEnum refGetEnum(RefObject enum, String name);
    public RefEnum refGetEnum(String enumName, String name);
    public void refDelete();
}

package javax.jmi.reflect;

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

public interface RefPackage extends RefBaseObject {
    public RefClass refClass(RefObject type);
    public RefClass refClass(String typeName);
    public RefPackage refPackage(RefObject nestedPackage);
    public RefPackage refPackage(String nestedPackageName);
    public RefAssociation refAssociation(RefObject association);
    public RefAssociation refAssociation(String associationName);
    public Collection refAllPackages();
    public Collection refAllClasses();
    public Collection refAllAssociations();
    public RefStruct refCreateStruct(RefObject struct, List params);
    public RefStruct refCreateStruct(String structName, List params);
    public RefEnum refGetEnum(RefObject enum_, String name);
    public RefEnum refGetEnum(String enumName, String name);
    public void refDelete();
}

Fix 'enum' keyword warning in JDK 1.5.

MONDRIAN: Fix 'enum' keyword warning in JDK 1.5.

[git-p4: depot-paths = "//open/mondrian/": change = 3418]


package org.motechproject.tama.api.model;

/**
 * Created by IntelliJ IDEA.
 * User: rob
 * Date: 4/25/11
 * Time: 8:48 PM
 * To change this template use File | Settings | File Templates.
 */
public class AppointmentSchedule
{
	public static enum Followup {
		REGISTERED("Registered",7),
		WEEK4("4 week follow-up",4*7),
		WEEK12("12 week follow-up",4*12),
		WEEK24("24 week follow-up",4*24),
		WEEK36("36 week follow-up",4*36),
		WEEK48("48 week follow-up",4*48);

		final String value;
		final int days;

		Followup(String value, int days) {
			this.value=value;
			this.days=days;
		}

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

		public String getKey(){
			return name();
		}

		public int getDays() {
			return this.days;
		}
	}
}

package org.motechproject.tama.api.model;

/**
 * Created by IntelliJ IDEA.
 * User: rob
 * Date: 4/25/11
 * Time: 8:48 PM
 * To change this template use File | Settings | File Templates.
 */
public class AppointmentSchedule
{
	public static enum Followup {
		REGISTERED("Registered",7),
		WEEK4("4 week follow-up",7*4),
		WEEK12("12 week follow-up",7*12),
		WEEK24("24 week follow-up",7*24),
		WEEK36("36 week follow-up",7*36),
		WEEK48("48 week follow-up",7*48);

		final String value;
		final int days;

		Followup(String value, int days) {
			this.value=value;
			this.days=days;
		}

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

		public String getKey(){
			return name();
		}

		public int getDays() {
			return this.days;
		}
	}
}

Fix 4->7 days week in the Care Schedule

Fix 4->7 days week in the Care Schedule


package com.jmonad.seq;

import com.jmonad.seq.lambda.Function;

import org.junit.Test;

public class SeqSomeTest {

    private Integer[] numbers = {100, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};

    private Function trueFunc = new Function<Boolean, Integer>() {
        @Override public Boolean call(Integer param) {
            return param > 10;
        }
    };

    private Function falseFunc = new Function<Boolean, Integer>() {
        @Override public Boolean call(Integer param) {
            return param > 100;
        }
    };

    @Test public void expectTrueFromSomeFunctionTest() {
        assert new Seq<>(numbers).some(trueFunc);
    }

    @Test public void expectFalseFromSomeFunctionTest() {
        assert !new Seq<>(numbers).some(falseFunc);
    }
}

Fix checkList problem in seq test class

Fix checkList problem in seq test class


public class Plane extends Shape
{
	public Vector Normal ;
	public Point3D P ;

	float t ;
	private float EPS = 0.00001f ;

	public Plane(){} ;

	public Plane ( Vector Normal , Point3D P , Material material )
	{
		this.Normal = Normal ;
		this.P = P ;
		this.material = material ;
	};

	@Override
	public boolean Intersect(Ray ray)
	{
		ray.normalize();
		Vector v = new Vector ( this.P  , ray.getPos() ) ;

		// Check if parallel
		if ( ray.getDir().dot(Normal)  < EPS ) return false ;

		t = v.dot( Normal ) / ray.getDir().dot( Normal ) ;

		return true ;

		/*
		Vector v = new Vector ( this.P  , ray.getPos() ) ;
		t = v.dot( Normal ) / ray.getDir().dot( Normal ) ;
		//System.out.println( t );
		return ( ray.getDir().dot(this.Normal) < EPS ) ;
		*/
	};

	@Override
	public Vector getNormal(Point3D p)
	{
		 return this.Normal ;
	};

	@Override
	public float getInter()
	{
		return this.t ;
	};

	@Override
	public Material getMaterial()
	{
		return this.material;
	};

}

public class Plane extends Shape
{
	public Vector Normal ;
	public Point3D P ;

	float t ;
	private float EPS = 0.00001f ;

	public Plane(){} ;

	public Plane ( Vector Normal , Point3D P , Material material )
	{
		this.Normal = Normal ;
		this.P = P ;
		this.material = material ;
	};

	@Override
	public boolean Intersect(Ray ray)
	{
		Vector v = new Vector (  ray.getPos() , this.P  ) ;
		ray.normalize();
		//v.norm() ;
		this.Normal.normalize();

		float den = ray.getDir().dot(this.Normal) ;

		// Check if crossing the plane
		if ( den < EPS )
		{
			this.t = v.dot(this.Normal ) / den ;
			return ( this.t >= 0 ) ;
		}

		return false ;
	};

	@Override
	public Vector getNormal(Point3D p)
	{
		 return this.Normal ;
	};

	@Override
	public float getInter()
	{
		return this.t ;
	};

	@Override
	public Material getMaterial()
	{
		return this.material;
	};

}

Change the ray - plane intersection function


package retrofit;

/** Intercept every request before it is executed in order to add additional data. */
public interface RequestInterceptor {
  /** Called for every request. Add data using methods on the supplied {@link RequestFacade}. */
  void intercept(RequestFacade request);

  interface RequestFacade {
    /** Add a header to the request. This will not replace any existing headers. */
    void addHeader(String name, String value);

    /**
     * Add a path parameter replacement. This works exactly like a {@link retrofit.http.Path
     * @Path}-annotated method argument.
     */
    void addPathParam(String name, String value);

    /**
     * Add a path parameter replacement without first URI encoding. This works exactly like a
     * {@link retrofit.http.EncodedPath @EncodedPath}-annotated method argument.
     */
    void addEncodedPathParam(String name, String value);

    /** Add an additional query parameter. This will not replace any existing query parameters. */
    void addQueryParam(String name, String value);

    /**
     * Add an additional query parameter without first URI encoding. This will not replace any
     * existing query parameters.
     */
    void addEncodedQueryParam(String name, String value);
  }

  /** A {@link RequestInterceptor} which does no modification of requests. */
  RequestInterceptor NONE = new RequestInterceptor() {
    @Override public void intercept(RequestFacade request) {
      // Do nothing.
    }
  };
}

package retrofit;

/** Intercept every request before it is executed in order to add additional data. */
public interface RequestInterceptor {
  /** Called for every request. Add data using methods on the supplied {@link RequestFacade}. */
  void intercept(RequestFacade request);

  interface RequestFacade {
    /** Add a header to the request. This will not replace any existing headers. */
    void addHeader(String name, String value);

    /**
     * Add a path parameter replacement. This works exactly like a {@link retrofit.http.Path
     * @Path}-annotated method argument.
     */
    void addPathParam(String name, String value);

    /**
     * Add a path parameter replacement without first URI encoding. This works exactly like a
     * {@link retrofit.http.Path @Path}-annotated method argument with {@code encode=false}.
     */
    void addEncodedPathParam(String name, String value);

    /** Add an additional query parameter. This will not replace any existing query parameters. */
    void addQueryParam(String name, String value);

    /**
     * Add an additional query parameter without first URI encoding. This will not replace any
     * existing query parameters.
     */
    void addEncodedQueryParam(String name, String value);
  }

  /** A {@link RequestInterceptor} which does no modification of requests. */
  RequestInterceptor NONE = new RequestInterceptor() {
    @Override public void intercept(RequestFacade request) {
      // Do nothing.
    }
  };
}

Fix annotation link. EncodedPath is gone.


package jenkins.advancedqueue;

import hudson.model.Job;
import hudson.model.Queue;
import jenkins.advancedqueue.sorter.ItemInfo;
import jenkins.advancedqueue.sorter.QueueItemCache;
import jenkins.model.Jenkins;
import org.jenkinsci.plugins.workflow.support.steps.ExecutorStepExecution;

class PriorityConfigurationPlaceholderTaskHelper {

    boolean isPlaceholderTask(Queue.Task task) {
        return isPlaceholderTaskUsed() && task instanceof  ExecutorStepExecution.PlaceholderTask;
    }

    PriorityConfigurationCallback getPriority(ExecutorStepExecution.PlaceholderTask task, PriorityConfigurationCallback priorityCallback) {
        Job<?, ?> job = (Job<?, ?>) task.getOwnerTask();
        ItemInfo itemInfo = QueueItemCache.get().getItem(job.getName());
        itemInfo.getPriority();
        priorityCallback.setPrioritySelection(itemInfo.getPriority());
        return priorityCallback;
    }

    static boolean isPlaceholderTaskUsed() {
        return Jenkins.getInstance().getPlugin("workflow-durable-task-step") != null;
    }

}

package jenkins.advancedqueue;

import hudson.Plugin;
import hudson.model.Job;
import hudson.model.Queue;
import jenkins.advancedqueue.sorter.ItemInfo;
import jenkins.advancedqueue.sorter.QueueItemCache;
import jenkins.model.Jenkins;
import org.jenkinsci.plugins.workflow.support.steps.ExecutorStepExecution;

class PriorityConfigurationPlaceholderTaskHelper {

    boolean isPlaceholderTask(Queue.Task task) {
        return isPlaceholderTaskUsed() && task instanceof  ExecutorStepExecution.PlaceholderTask;
    }

    PriorityConfigurationCallback getPriority(ExecutorStepExecution.PlaceholderTask task, PriorityConfigurationCallback priorityCallback) {
        Job<?, ?> job = (Job<?, ?>) task.getOwnerTask();
        ItemInfo itemInfo = QueueItemCache.get().getItem(job.getName());
        itemInfo.getPriority();
        priorityCallback.setPrioritySelection(itemInfo.getPriority());
        return priorityCallback;
    }

    static boolean isPlaceholderTaskUsed() {
        Plugin plugin = Jenkins.getInstance().getPlugin("workflow-durable-task-step");
        return plugin != null && plugin.getWrapper().isActive();
    }

}

Add checking if workflow-durable-task-step plugin is active


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

public class Rules {
	private static List<Fact> rules = new ArrayList<Fact>();

	public Rules() {
	}

	public void addRule(Fact f) {
		rules.add(f);
	}

	public Boolean is(Fact f, List<Term> head) {
		for(Fact rule: rules) {
			if ((rule.equals(f)) && (f.getHead().equals(head))) {
				return true;
			}
		}
		return false;
	}

}

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

public class Rules {
	private static List<Fact> rules = new ArrayList<Fact>();

	public Rules() {
	}

	public void addRule(Fact f) {
		rules.add(f);
	}

	public boolean is(Fact f, List<Term> head) {
		boolean result = false;
		for(Fact rule: rules) {
			if ((rule.equals(f)) && (f.getHead().equals(head))) {
				Term first = f.getHead().get(0);
				if (first instanceof Variable) {
					System.out.println(first.getName() + " = " + rule.getHead().get(0).getName());
				}
				result = true;
			}
		}
		return result;
	}

}

Allow variables when checking rules

Allow variables when checking rules


import java.rmi.Remote;

public interface MetaDataInterface extends Remote {
    // CALLS FROM STORAGE SERVER
    void addStorageServer(String hostname, String top_dir) throws Exception;

    void delStorageServer(String hostname, String top_dir) throws Exception;

    void addStorageItem(String item, NodeType nodeType) throws Exception;

    void delStorageItem(String item) throws Exception;

    // CALLS FROM CLIENT
    String find(String item) throws Exception;

    Stat lstat(String item) throws Exception;

    boolean checkExists(String item) throws Exception;

    boolean isDir(String item) throws Exception;

    boolean isFile(String item) throws Exception;
}

import java.rmi.Remote;

public interface MetaDataInterface extends Remote {
    // CALLS FROM STORAGE SERVER
    void addStorageServer(String hostname, String top_dir) throws Exception;

    void delStorageServer(String hostname, String top_dir) throws Exception;

    void addStorageItem(String item, NodeType type) throws Exception;

    void delStorageItem(String item) throws Exception;

    // CALLS FROM CLIENT
    String find(String item) throws Exception;

    Stat lstat(String item) throws Exception;

    boolean isDir(String item) throws Exception;

    boolean isFile(String item) throws Exception;

    boolean checkExists(String item) throws Exception;
}

Reorder methods, change argument name

Reorder methods, change argument name

Signed-off-by: Nuno Azevedo <7b5d26f0698b3f6c15a9789c87d309f80e3742b1@movvo.com>


// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.admin;

import com.yahoo.config.model.deploy.DeployState;
import com.yahoo.config.model.producer.AbstractConfigProducer;
import com.yahoo.container.handler.ThreadpoolConfig;
import com.yahoo.search.config.QrStartConfig;
import com.yahoo.vespa.model.container.ContainerCluster;
import com.yahoo.vespa.model.container.component.Handler;

/**
 * @author hmusum
 */
public class LogserverContainerCluster extends ContainerCluster<LogserverContainer> {

    public LogserverContainerCluster(AbstractConfigProducer<?> parent, String name, DeployState deployState) {
        super(parent, name, name, deployState);

        addDefaultHandlersWithVip();
        addLogHandler();
    }

    @Override
    protected void doPrepare(DeployState deployState) { }

    @Override
    public void getConfig(ThreadpoolConfig.Builder builder) {
        builder.maxthreads(10);
    }

    @Override
    public void getConfig(QrStartConfig.Builder builder) {
        super.getConfig(builder);
        builder.jvm.heapsize(384);
    }

    protected boolean messageBusEnabled() { return false; }

    private void addLogHandler() {
        Handler<?> logHandler = Handler.fromClassName(ContainerCluster.LOG_HANDLER_CLASS);
        logHandler.addServerBindings("http://*/logs");
        addComponent(logHandler);
    }

}

// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.admin;

import com.yahoo.config.model.deploy.DeployState;
import com.yahoo.config.model.producer.AbstractConfigProducer;
import com.yahoo.container.handler.ThreadpoolConfig;
import com.yahoo.search.config.QrStartConfig;
import com.yahoo.vespa.model.container.ContainerCluster;
import com.yahoo.vespa.model.container.component.Handler;

/**
 * @author hmusum
 */
public class LogserverContainerCluster extends ContainerCluster<LogserverContainer> {

    public LogserverContainerCluster(AbstractConfigProducer<?> parent, String name, DeployState deployState) {
        super(parent, name, name, deployState);

        addDefaultHandlersWithVip();
        addLogHandler();
    }

    @Override
    protected void doPrepare(DeployState deployState) { }

    @Override
    public void getConfig(ThreadpoolConfig.Builder builder) {
        builder.maxthreads(10);
    }

    @Override
    public void getConfig(QrStartConfig.Builder builder) {
        super.getConfig(builder);
        builder.jvm.heapsize(512);
    }

    protected boolean messageBusEnabled() { return false; }

    private void addLogHandler() {
        Handler<?> logHandler = Handler.fromClassName(ContainerCluster.LOG_HANDLER_CLASS);
        logHandler.addServerBindings("http://*/logs");
        addComponent(logHandler);
    }

}

Increase JVM heap for logserver-container


/*
 * Copyright (c) 2014-present, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 */

package com.facebook.yoga;

import com.facebook.proguard.annotations.DoNotStrip;

/**
 * Inteface for recieving logs from native layer. Use by setting YogaNode.setLogger(myLogger);
 * See YogaLogLevel for the different log levels.
 */
@DoNotStrip
public interface YogaLogger {
  @DoNotStrip
  void log(YogaNode node, YogaLogLevel level, String message);
}

/*
 * Copyright (c) 2014-present, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 */

package com.facebook.yoga;

import com.facebook.proguard.annotations.DoNotStrip;

/**
 * Interface for receiving logs from native layer. Use by setting YogaNode.setLogger(myLogger);
 * See YogaLogLevel for the different log levels.
 */
@DoNotStrip
public interface YogaLogger {
  @DoNotStrip
  void log(YogaNode node, YogaLogLevel level, String message);
}

Fix Android comment and docblock typos

Fix Android comment and docblock typos

Summary:
:wave: Hello! Thanks for react-native, it’s a great project.

I was digging into the Android implementation in _ReactAndroid_ and noticed a couple typos in the documentation. I went through and tried to fix all the typos I could find using [aspell](http://aspell.net).

Not applicable: these changes are only to comments, and CI should be skipped.

[ANDROID][ENHANCEMENT][*] - Correct comment and docblock typos
Closes https://github.com/facebook/react-native/pull/17049

Differential Revision: D6472182

Pulled By: shergin

fbshipit-source-id: 7e62cab118609596b483d1cf16c3abf651d6753b


/*
 * Copyright (C) 2011 The University of Manchester
 *
 * See the file "LICENSE.txt" for license terms.
 */
package org.taverna.server.input_description;

import static org.taverna.server.input_description.Namespaces.RDF;
import static org.taverna.server.input_description.Namespaces.XLINK;

import java.net.URI;

import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType;

@XmlRootElement
public class Input {
	@XmlAttribute(namespace = XLINK)
	@XmlSchemaType(name = "anyURI")
	public URI href;
	@XmlAttribute(namespace = RDF)
	public String about;
	@XmlElement(required = true)
	public String name;
	@XmlElement
	public Integer depth;
}

/*
 * Copyright (C) 2011 The University of Manchester
 *
 * See the file "LICENSE.txt" for license terms.
 */
package org.taverna.server.input_description;

import static org.taverna.server.input_description.Namespaces.RDF;
import static org.taverna.server.input_description.Namespaces.XLINK;

import java.net.URI;

import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType;

@XmlRootElement
public class Input {
	@XmlAttribute(namespace = XLINK)
	@XmlSchemaType(name = "anyURI")
	public URI href;
	@XmlAttribute(namespace = RDF)
	public String about;
	@XmlAttribute(required = true)
	public String name;
	@XmlAttribute
	public Integer depth;
}

Fix TAVSERV-176; elements -> attributes in inpt description


package org.museautomation.builtins.step.userinput;

import org.museautomation.core.*;
import org.museautomation.core.events.*;

/**
 * @author Christopher L Merrill (see LICENSE.txt for license details)
 */
public class UserContinueEventType extends EventType
    {
    public UserContinueEventType()
        {
        super(TYPE_ID, "User Continue");
        }

    public static MuseEvent create(String message)
        {
        MuseEvent event = new MuseEvent(TYPE_ID);
        event.setAttribute(MuseEvent.DESCRIPTION, message);
        return event;
        }

    public static MuseEvent createAbort(String message)
        {
        MuseEvent event = new MuseEvent(TYPE_ID);
        event.setAttribute(MuseEvent.DESCRIPTION, message);
        event.addTag(MuseEvent.TERMINATE);
        return event;
        }

    public final static String TYPE_ID = "user-continue";
    }

package org.museautomation.builtins.step.userinput;

import org.museautomation.core.*;
import org.museautomation.core.events.*;

/**
 * @author Christopher L Merrill (see LICENSE.txt for license details)
 */
public class UserContinueEventType extends EventType
    {
    public UserContinueEventType()
        {
        super(TYPE_ID, "User Continue");
        }

    public static MuseEvent create(String message)
        {
        MuseEvent event = new MuseEvent(TYPE_ID);
        event.setAttribute(MuseEvent.DESCRIPTION, message);
        return event;
        }

    public static MuseEvent createAbort(String message)
        {
        MuseEvent event = new MuseEvent(TYPE_ID);
        event.setAttribute(MuseEvent.DESCRIPTION, message);
        event.addTag(MuseEvent.TERMINATE);
        event.addTag(MuseEvent.ERROR);
        return event;
        }

    public final static String TYPE_ID = "user-continue";
    }

[core] FIX: Add ERROR tag to UserCOntinueEventType when aborting. This also forces pause in the UI.


/*************************************************************************
 *                                                                       *
 * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith.       *
 * All rights reserved.  Email: russ@q12.org   Web: www.q12.org          *
 *                                                                       *
 * This library is free software; you can redistribute it and/or         *
 * modify it under the terms of EITHER:                                  *
 *   (1) The GNU Lesser General Public License as published by the Free  *
 *       Software Foundation; either version 2.1 of the License, or (at  *
 *       your option) any later version. The text of the GNU Lesser      *
 *       General Public License is included with this library in the     *
 *       file LICENSE.TXT.                                               *
 *   (2) The BSD-style license that is included with this library in     *
 *       the file LICENSE-BSD.TXT.                                       *
 *                                                                       *
 * This library is distributed in the hope that it will be useful,       *
 * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files    *
 * LICENSE.TXT and LICENSE-BSD.TXT for more details.                     *
 *                                                                       *
 *************************************************************************/

module ord.ode4j.cpp {
    requires transitive org.ode4j;

    exports org.ode4j.cpp.internal;
    exports org.ode4j.cpp;
}

/*************************************************************************
 *                                                                       *
 * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith.       *
 * All rights reserved.  Email: russ@q12.org   Web: www.q12.org          *
 *                                                                       *
 * This library is free software; you can redistribute it and/or         *
 * modify it under the terms of EITHER:                                  *
 *   (1) The GNU Lesser General Public License as published by the Free  *
 *       Software Foundation; either version 2.1 of the License, or (at  *
 *       your option) any later version. The text of the GNU Lesser      *
 *       General Public License is included with this library in the     *
 *       file LICENSE.TXT.                                               *
 *   (2) The BSD-style license that is included with this library in     *
 *       the file LICENSE-BSD.TXT.                                       *
 *                                                                       *
 * This library is distributed in the hope that it will be useful,       *
 * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files    *
 * LICENSE.TXT and LICENSE-BSD.TXT for more details.                     *
 *                                                                       *
 *************************************************************************/

module org.ode4j.cpp {
    requires transitive org.ode4j;

    exports org.ode4j.cpp.internal;
    exports org.ode4j.cpp;
}

Correct module name (ord.ode4j -> org.ode4j)


package ch.hevs.aislab.magpie.debs.retrofit;

import ch.hevs.aislab.magpie.debs.model.RequestSubscriptionResult;
import retrofit.http.Body;
import retrofit.http.POST;
import retrofit.http.Path;

public interface SubscriberSvcApi {

    String SUBSCRIBER_ID = "subId";

    String SUBSCRIBER_SVC = "/subscriber";
    String SUBSCRIBER_SUBSCRIBE_SVC = SUBSCRIBER_SVC + "/{" + SUBSCRIBER_ID + "}/subscribe";

    @POST(SUBSCRIBER_SUBSCRIBE_SVC)
    RequestSubscriptionResult doSubscriptionByUsername(
            @Path(SUBSCRIBER_ID) long subId, @Body String pubUsername);
}

package ch.hevs.aislab.magpie.debs.retrofit;

import java.util.Collection;

import ch.hevs.aislab.magpie.debs.model.GlucoseAlert;
import ch.hevs.aislab.magpie.debs.model.RequestSubscriptionResult;
import retrofit.http.Body;
import retrofit.http.GET;
import retrofit.http.POST;
import retrofit.http.Path;
import retrofit.http.Query;

public interface SubscriberSvcApi {

    String SUBSCRIBER_ID = "subId";
    String PUBLISHER_ID = "pubId";

    String SUB_SVC = "/subscriber";
    String SUB_SUBSCRIBE_SVC = SUB_SVC + "/{" + SUBSCRIBER_ID + "}/subscribe";
    String SUB_ALERTS_SVC = SUB_SVC + "/{" + SUBSCRIBER_ID + "}/alertsByUser";

    @POST(SUB_SUBSCRIBE_SVC)
    RequestSubscriptionResult doSubscriptionByUsername(
            @Path(SUBSCRIBER_ID) long subId, @Body String pubUsername);

    @GET(SUB_ALERTS_SVC)
    Collection<GlucoseAlert> getAlertsByUser(
            @Path(SUBSCRIBER_ID) long subId, @Query(PUBLISHER_ID) long pubId);
}

Add method to get alerts

Add method to get alerts


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

import com.google.inject.Injector;

/**
 * @author Henrique Prange
 */
public class Interceptor {
    public static Object injectMembers(Object object) {
	Injector injector = InjectableApplication.application().injector();

	if (injector == null) {
	    return object;
	}

	injector.injectMembers(object);

	return object;
    }

    // public static Object intercept(Class<?> clazz, Object[] parameters) {
    // System.out.println("\tClass: " + clazz + " Parameters: " +
    // java.util.Arrays.toString(parameters));
    //
    // if (WOSession.class.isAssignableFrom(clazz)) {
    // System.out.println("Creating an instace of " + clazz.getName());
    //
    // Object instance = injector().getInstance(clazz);
    //
    // return instance;
    // }
    //
    // if (EOEnterpriseObject.class.isAssignableFrom(clazz)) {
    // System.out.println("Creating an instace of " + clazz.getName());
    //
    // Object instance = injector().getInstance(clazz);
    //
    // return instance;
    // }
    //
    // return null;
    // }
}

Add the missing license header

Add the missing license header


package avs.models;

public class ZombieSummoner implements Runnable{
	private Thread thread;
	private boolean isHugeWave;

	public ZombieSummoner(){
		this.thread = new Thread(this);
	}

	public void run(){
		try {
            Thread.sleep(30000);
            while (true) {
            	if(!isHugeWave){
            		Game.getInstance().createZombie();
               		Thread.sleep(10000);
            	}else{
            		Thread.sleep(3000);
            		for(int i = 0; i < 10; i++){
            			Game.getInstance().createZombie();
               			Thread.sleep(5000);
            		}
            		isHugeWave = false;
            	}
            }
        } catch (InterruptedException e) {
            System.out.println(e.getMessage());
            e.printStackTrace();
        }
	}

	public void start(){
		this.thread.start();
	}

	public void setIsHugeWave(boolean isHugeWave){
		this.isHugeWave = isHugeWave;
	}

	public boolean getIsHugeWave(){
		return this.isHugeWave;
	}
}

package avs.models;

public class ZombieSummoner implements Runnable{
	private Thread thread;
	private boolean isHugeWave;

	public ZombieSummoner(){
		this.thread = new Thread(this);
	}

	public void run(){
		try {
            Thread.sleep(30000);
            while (true) {
            	if(!isHugeWave){
            		Game.getInstance().createZombie();
               		Thread.sleep(10000);
            	}else{
            		Thread.sleep(3000);
            		for(int i = 0; i < 10; i++){
            			Game.getInstance().createZombie();
               			Thread.sleep(3000);
            		}
            		isHugeWave = false;
            	}
            }
        } catch (InterruptedException e) {
            System.out.println(e.getMessage());
            e.printStackTrace();
        }
	}

	public void start(){
		this.thread.start();
	}

	public void setIsHugeWave(boolean isHugeWave){
		this.isHugeWave = isHugeWave;
	}

	public boolean getIsHugeWave(){
		return this.isHugeWave;
	}
}

Update huge wave zombie spawn delay.

Update huge wave zombie spawn delay.


package org.globus.swift.data.policy;

import java.util.List;

public class Local extends Policy {

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

    @Override
    public void settings(List<String> tokens) {
    }
}

package org.globus.swift.data.policy;

import java.util.List;

public class Local extends Policy {

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

    @Override
    public void settings(List<String> tokens) {
    }
}

Change the toString() name of CDM LOCAL from "PULL" to "LOCAL"

git-svn-id: 6ee47c8665bf46900d9baa0afb711c5b4a0eafac@3741 e2bb083e-7f23-0410-b3a8-8253ac9ef6d8


package com.moyinoluwa.makeupsearch.presentation.search;

/**
 * Created by moyinoluwa on 2/8/17.
 */

public interface MakeUpSearchContract {
}

package com.moyinoluwa.makeupsearch.presentation.search;

import com.moyinoluwa.makeupsearch.data.remote.model.MakeUpList;
import com.moyinoluwa.makeupsearch.presentation.base.MvpPresenter;
import com.moyinoluwa.makeupsearch.presentation.base.MvpView;
import com.moyinoluwa.makeupsearch.presentation.select_product.SelectProductContract;

import java.util.List;

/**
 * Created by moyinoluwa on 2/8/17.
 */

public interface MakeUpSearchContract {

    interface View extends MvpView {
        void showSearchResults(List<MakeUpList> makeUpListList);

        void showError(String message);

        void showLoading();

        void hideLoading();
    }

    interface Presenter extends MvpPresenter<SelectProductContract.View> {
        void search(String term);
    }
}

Create Make Up Search contract

feat: Create Make Up Search contract


package net.mueller_martin.turirun;

import java.util.HashMap;
import java.util.ArrayList;
import net.mueller_martin.turirun.gameobjects.GameObject;

/**
 * Created by DM on 06.11.15.
 */
public class ObjectController {

	private static int next_id = 0;
	private HashMap<Integer,GameObject> objs_map = new HashMap<Integer,GameObject>();
	private ArrayList<GameObject> objs = new ArrayList<GameObject>();

	public void addObject(GameObject obj) {
		this.next_id++;

		int id = next_id;
		obj.id = next_id;

		objs_map.put(id, obj);
		objs.add(obj);
	}

	public void removeObject(GameObject obj) {
		objs_map.remove(obj.id);
		objs.remove(obj);
	}

	public ArrayList<GameObject> getObjects() {
		return objs;
	}

	public GameObject getObject(int id) {
		return objs_map.get(id);
	}
}

package net.mueller_martin.turirun;

import java.util.HashMap;
import java.util.ArrayList;
import net.mueller_martin.turirun.gameobjects.GameObject;

/**
 * Created by DM on 06.11.15.
 */
public class ObjectController {

	private HashMap<Integer,GameObject> objs_map = new HashMap<Integer,GameObject>();
	private ArrayList<GameObject> objs = new ArrayList<GameObject>();

	public void addObject(GameObject obj) {
		objs.add(obj);
	}

	public void addObject(int id, GameObject obj) {
		obj.id = id;

		objs_map.put(id, obj);
		objs.add(obj);
	}

	public void removeObject(GameObject obj) {
		objs_map.remove(obj.id);
		objs.remove(obj);
	}

	public ArrayList<GameObject> getObjects() {
		return objs;
	}

	public GameObject getObject(int id) {
		return objs_map.get(id);
	}
}

Remove ID from default GameObjects

Remove ID from default GameObjects


package water.api;

import water.Key;
import water.ValueArray;

import com.google.gson.JsonObject;

public class SetColumnNames extends Request {

  protected final H2OHexKey _tgtKey = new H2OHexKey("target");

  private class HeaderKey extends H2OHexKey {
    public HeaderKey(){super("source");}
    @Override protected ValueArray parse(String input) throws IllegalArgumentException {
      ValueArray res = super.parse(input);
      if(res.numCols() != _tgtKey.value().numCols())
        throw new IllegalArgumentException("number of columns don't match!");
      return res;
    }
  }
  protected final HeaderKey _srcKey = new HeaderKey();

  @Override protected Response serve() {
    ValueArray tgt = _tgtKey.value();
    tgt.setColumnNames(_srcKey.value().colNames());
    return Inspect.redirect(new JsonObject(), tgt._key);
  }
  public static String link(Key k, String s){
    return "" + s + "";
  }
}

package water.api;

import water.*;

import com.google.gson.JsonObject;

public class SetColumnNames extends Request {

  protected final H2OHexKey _tgtKey = new H2OHexKey("target");

  private class HeaderKey extends H2OHexKey {
    public HeaderKey(){super("source");}
    @Override protected ValueArray parse(String input) throws IllegalArgumentException {
      ValueArray res = super.parse(input);
      if(res.numCols() != _tgtKey.value().numCols())
        throw new IllegalArgumentException("number of columns don't match!");
      return res;
    }
  }
  protected final HeaderKey _srcKey = new HeaderKey();

  @Override protected Response serve() {
    ValueArray tgt = _tgtKey.value();
    tgt.setColumnNames(_srcKey.value().colNames());
    // Must write in the new header.  Must use DKV instead of UKV, because do
    // not want to delete the underlying data.
    Futures fs = new Futures();
    DKV.put(tgt._key,tgt,fs);
    fs.blockForPending();
    return Inspect.redirect(new JsonObject(), tgt._key);
  }
  public static String link(Key k, String s){
    return "" + s + "";
  }
}

Fix header names not getting written back


/*
 * Copyright (c) Microsoft Corporation. All rights reserved.
 *
 * This program is made available under the terms of the MIT License.
 * See the LICENSE file in the project root for more information.
 */
package com.microsoft.dhalion.detector;

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

import com.microsoft.dhalion.metrics.ComponentMetrics;

/**
 * A {@link Symptom} identifies an anomaly or a potential health issue in a specific component of a
 * distributed application. For e.g. identification of irregular processing latency.
 */
public class Symptom {
  private String name;
  private Map<String, ComponentMetrics> metrics = new HashMap<>();

  public Symptom(String symptomName, ComponentMetrics metrics) {
    this.name = symptomName;
    addComponentMetrics(metrics);
  }

  public synchronized void addComponentMetrics(ComponentMetrics metrics) {
    this.metrics.put(metrics.getName(), metrics);
  }

  public String getName() {
    return name;
  }

  public Map<String, ComponentMetrics> getComponents() {
    return metrics;
  }

  /**
   * @return the only component exhibiting this symptom
   */
  public synchronized ComponentMetrics getComponent() {
    if (metrics.size() > 1) {
      throw new IllegalStateException();
    }

    return metrics.values().iterator().next();
  }

  @Override
  public String toString() {
    return "Symptom{" +
        "name=" + name +
        ", metrics=" + metrics +
        '}';
  }
}

/*
 * Copyright (c) Microsoft Corporation. All rights reserved.
 *
 * This program is made available under the terms of the MIT License.
 * See the LICENSE file in the project root for more information.
 */
package com.microsoft.dhalion.detector;

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

import com.microsoft.dhalion.metrics.ComponentMetrics;

/**
 * A {@link Symptom} identifies an anomaly or a potential health issue in a specific component of a
 * distributed application. For e.g. identification of irregular processing latency.
 */
public class Symptom {
  private String name;
  private Map<String, ComponentMetrics> metrics = new HashMap<>();

  public Symptom(String symptomName) {
    this.name = symptomName;
  }

  public Symptom(String symptomName, ComponentMetrics metrics) {
    this.name = symptomName;
    addComponentMetrics(metrics);
  }

  public synchronized void addComponentMetrics(ComponentMetrics metrics) {
    this.metrics.put(metrics.getName(), metrics);
  }

  public String getName() {
    return name;
  }

  public Map<String, ComponentMetrics> getComponents() {
    return metrics;
  }

  /**
   * @return the only component exhibiting this symptom
   */
  public synchronized ComponentMetrics getComponent() {
    if (metrics.size() > 1) {
      throw new IllegalStateException();
    }

    return metrics.values().iterator().next();
  }

  @Override
  public String toString() {
    return "Symptom{" +
        "name=" + name +
        ", metrics=" + metrics +
        '}';
  }
}

Allow creation of a no metric symptom

Allow creation of a no metric symptom


package com.github.sormuras.bach.internal;

import static java.lang.ModuleLayer.defineModulesWithOneLoader;
import static java.lang.module.Configuration.resolveAndBind;

import com.github.sormuras.bach.Bach;
import java.lang.module.ModuleFinder;
import java.util.List;
import java.util.Set;

public interface ModuleLayerSupport {
  static ModuleLayer layer(ModuleFinder finder, boolean assertions, String... roots) {
    var parentClassLoader = Bach.class.getClassLoader();
    var parentModuleLayer = ModuleLayer.boot();
    var parents = List.of(parentModuleLayer.configuration());
    var configuration = resolveAndBind(ModuleFinder.of(), parents, finder, Set.of(roots));
    var layers = List.of(parentModuleLayer);
    var controller = defineModulesWithOneLoader(configuration, layers, parentClassLoader);
    var layer = controller.layer();
    if (assertions) for (var root : roots) layer.findLoader(root).setDefaultAssertionStatus(true);
    return layer;
  }
}

package com.github.sormuras.bach.internal;

import static java.lang.ModuleLayer.defineModulesWithOneLoader;
import static java.lang.module.Configuration.resolveAndBind;

import java.lang.module.ModuleFinder;
import java.util.List;
import java.util.Set;

public interface ModuleLayerSupport {
  static ModuleLayer layer(ModuleFinder finder, boolean assertions, String... roots) {
    var parentClassLoader = ModuleLayerSupport.class.getClassLoader();
    var parentModuleLayer = ModuleLayer.boot();
    var parents = List.of(parentModuleLayer.configuration());
    var configuration = resolveAndBind(ModuleFinder.of(), parents, finder, Set.of(roots));
    var layers = List.of(parentModuleLayer);
    var controller = defineModulesWithOneLoader(configuration, layers, parentClassLoader);
    var layer = controller.layer();
    if (assertions) for (var root : roots) layer.findLoader(root).setDefaultAssertionStatus(true);
    return layer;
  }
}

Use local class to determine parent loader