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

package org.springframework.cloud.cli.compiler;

import org.codehaus.groovy.control.CompilePhase;
import org.codehaus.groovy.transform.GroovyASTTransformation;
import org.springframework.boot.cli.compiler.DependencyManagementBomTransformation;
import org.springframework.boot.cli.compiler.GenericBomAstTransformation;

/**
 * @author Dave Syer
 *
 */
@GroovyASTTransformation(phase = CompilePhase.CONVERSION)
public class SpringCloudBomAstTransformation extends GenericBomAstTransformation {

	private static final String SPRING_CLOUD_VERSION = "Brixton.BUILD-SNAPSHOT";

	@Override
	protected String getBomModule() {
		return "org.springframework.cloud:spring-cloud-starter-parent:" + SPRING_CLOUD_VERSION;
	}

	@Override
	public int getOrder() {
		return DependencyManagementBomTransformation.ORDER - 50;
	}

}

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

package org.springframework.cloud.cli.compiler;

import org.codehaus.groovy.control.CompilePhase;
import org.codehaus.groovy.transform.GroovyASTTransformation;
import org.springframework.boot.cli.compiler.DependencyManagementBomTransformation;
import org.springframework.boot.cli.compiler.GenericBomAstTransformation;

/**
 * @author Dave Syer
 *
 */
@GroovyASTTransformation(phase = CompilePhase.CONVERSION)
public class SpringCloudBomAstTransformation extends GenericBomAstTransformation {

	private static final String SPRING_CLOUD_VERSION = "Camden.BUILD-SNAPSHOT";

	@Override
	protected String getBomModule() {
		return "org.springframework.cloud:spring-cloud-starter-parent:" + SPRING_CLOUD_VERSION;
	}

	@Override
	public int getOrder() {
		return DependencyManagementBomTransformation.ORDER - 50;
	}

}

Change from Brixton to Camden

Change from Brixton to Camden


/*
 * Copyright Myrrix Ltd
 *
 * 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 net.myrrix.online.partition;

import java.util.List;

import org.apache.mahout.common.Pair;

/**
 * Does nothing; not applicable in local mode.
 *
 * @author Sean Owen
 */
public final class PartitionLoaderImpl implements PartitionLoader {

  /**
   * @throws UnsupportedOperationException
   */
  @Override
  public List<List<Pair<String, Integer>>> loadPartitions(int defaultPort, String bucket, String instanceID) {
    throw new UnsupportedOperationException();
  }

}

/*
 * Copyright Myrrix Ltd
 *
 * 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 net.myrrix.online.partition;

import java.util.List;

import com.google.common.net.HostAndPort;

/**
 * Does nothing; not applicable in local mode.
 *
 * @author Sean Owen
 */
public final class PartitionLoaderImpl implements PartitionLoader {

  /**
   * @throws UnsupportedOperationException
   */
  @Override
  public List<List<HostAndPort>> loadPartitions(int defaultPort, String bucket, String instanceID) {
    throw new UnsupportedOperationException();
  }

}

Use some Guava .net classes to clean up code a little

git-svn-id: f7ac9ee3e7208fd97c9a3deb5e52ce295d20494a@481 0d189622-dca1-7e23-9e30-e8815eb7bd2f


package com.yahoo.vespa.hosted.controller.api.integration.configserver;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

/**
 * @author ogronnesby
 */
@JsonIgnoreProperties(ignoreUnknown = true)
public class QuotaUsage {
    public double rate;
}

package com.yahoo.vespa.hosted.controller.api.integration.configserver;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

/**
 * @author ogronnesby
 */
@JsonIgnoreProperties(ignoreUnknown = true)
public class QuotaUsage {
    public static final QuotaUsage zero = new QuotaUsage() {{ this.rate = 0; }};

    public double rate;
}

Create a static zero quota usage

Create a static zero quota usage


package org.gdg.frisbee.android.about;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import org.gdg.frisbee.android.R;

public class AboutPagerAdapter extends FragmentStatePagerAdapter {
    private Context mContext;

    public AboutPagerAdapter(Context ctx, FragmentManager fm) {
        super(fm);
        mContext = ctx;
    }

    @Override
    public int getItemPosition(Object object) {
        return POSITION_NONE;
    }

    @Override
    public int getCount() {
        return mContext.getResources().getStringArray(R.array.about_tabs).length;
    }

    @Override
    public Fragment getItem(int position) {
        switch (position) {
            case 0:
                return new AboutFragment();
            case 1:
                return new ContributorsFragment();
            case 2:
                return new TranslatorsFragment();
            case 3:
                return new ChangelogFragment();
            case 4:
                return new GetInvolvedFragment();
            case 5:
                return new ExtLibrariesFragment();
        }
        return null;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return mContext.getResources().getStringArray(R.array.about_tabs)[position];
    }
}

package org.gdg.frisbee.android.about;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import org.gdg.frisbee.android.R;

class AboutPagerAdapter extends FragmentStatePagerAdapter {
    private Context mContext;

    public AboutPagerAdapter(Context ctx, FragmentManager fm) {
        super(fm);
        mContext = ctx;
    }

    @Override
    public int getItemPosition(Object object) {
        return POSITION_NONE;
    }

    @Override
    public int getCount() {
        return mContext.getResources().getStringArray(R.array.about_tabs).length;
    }

    @Override
    public Fragment getItem(int position) {
        switch (position) {
            case 0:
                return new AboutFragment();
            case 1:
                return new ContributorsFragment();
            case 2:
                return new TranslatorsFragment();
            case 3:
                return new ChangelogFragment();
            case 4:
                return new GetInvolvedFragment();
            case 5:
                return new ExtLibrariesFragment();
        }
        return null;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return mContext.getResources().getStringArray(R.array.about_tabs)[position];
    }
}

Reduce visibility from public to package


package br.com.bloder.blormlib.validation;

/**
 * Created by bloder on 05/06/16.
 */
public interface Validate {

  boolean validate();
}

package br.com.bloder.blormlib.validation;

/**
 * Created by bloder on 05/06/16.
 */
public interface Validate {

  boolean validate();
  void onError();
}

Add new function to a validation

Add new function to a validation


/*
 * Copyright 2012-2013 Continuuity,Inc. All Rights Reserved.
 */

package com.continuuity.api.procedure;

import com.continuuity.api.data.DataSet;

/**
 * This interface represents the Procedure context, which consists of set of methods for
 * acquiring instance of {@link DataSet}
 */
public interface ProcedureContext {
  /**
   * Given a name of dataset, returns an instance of {@link DataSet}
   * @param name of the {@link DataSet}
   * @return An instance of {@link DataSet}
   */
  DataSet getDataSet(String name);
}

/*
 * Copyright 2012-2013 Continuuity,Inc. All Rights Reserved.
 */

package com.continuuity.api.procedure;

import com.continuuity.api.data.DataSet;

/**
 * This interface represents the Procedure context, which consists of set of methods for
 * acquiring instance of {@link DataSet}
 */
public interface ProcedureContext {
  /**
   * Given a name of dataset, returns an instance of {@link DataSet}.
   * @param name of the {@link DataSet}.
   * @param <T> The specific {@link DataSet} type requested for.
   * @return An instance of {@link DataSet}.
   */
  <T extends DataSet> T getDataSet(String name);
}

Make it consistent with FlowletContext

Make it consistent with FlowletContext


package com.thoughtworks.acceptance;

import javax.swing.DefaultListModel;
import javax.swing.JList;
import javax.swing.JTable;
import javax.swing.LookAndFeel;
import javax.swing.plaf.synth.SynthLookAndFeel;

public class SwingTest extends AbstractAcceptanceTest {

    // JTable is one of the nastiest components to serialize. If this works, we're in good shape :)

    public void testJTable() {
        // Note: JTable does not have a sensible .equals() method, so we compare the XML instead.
        JTable original = new JTable();
        String originalXml = xstream.toXML(original);

        JTable deserialized = (JTable) xstream.fromXML(originalXml);
        String deserializedXml = xstream.toXML(deserialized);

        assertEquals(originalXml, deserializedXml);
    }

    public void testDefaultListModel() {
        final DefaultListModel original = new DefaultListModel();
        final JList list = new JList();
        list.setModel(original);

        String originalXml = xstream.toXML(original);

        DefaultListModel deserialized = (DefaultListModel) xstream.fromXML(originalXml);
        String deserializedXml = xstream.toXML(deserialized);

        assertEquals(originalXml, deserializedXml);

        list.setModel(deserialized);
    }

    public void testSynthLookAndFeel() {
        LookAndFeel plaf = new SynthLookAndFeel();
        String originalXml = xstream.toXML(plaf);
        assertBothWays(plaf, originalXml);
    }
}

package com.thoughtworks.acceptance;

import javax.swing.DefaultListModel;
import javax.swing.JList;
import javax.swing.JTable;
import javax.swing.LookAndFeel;
import javax.swing.plaf.metal.MetalLookAndFeel;

public class SwingTest extends AbstractAcceptanceTest {

    // JTable is one of the nastiest components to serialize. If this works, we're in good shape :)

    public void testJTable() {
        // Note: JTable does not have a sensible .equals() method, so we compare the XML instead.
        JTable original = new JTable();
        String originalXml = xstream.toXML(original);

        JTable deserialized = (JTable) xstream.fromXML(originalXml);
        String deserializedXml = xstream.toXML(deserialized);

        assertEquals(originalXml, deserializedXml);
    }

    public void testDefaultListModel() {
        final DefaultListModel original = new DefaultListModel();
        final JList list = new JList();
        list.setModel(original);

        String originalXml = xstream.toXML(original);

        DefaultListModel deserialized = (DefaultListModel) xstream.fromXML(originalXml);
        String deserializedXml = xstream.toXML(deserialized);

        assertEquals(originalXml, deserializedXml);

        list.setModel(deserialized);
    }

    public void testMetalLookAndFeel() {
        LookAndFeel plaf = new MetalLookAndFeel();
        String originalXml = xstream.toXML(plaf);
        assertBothWays(plaf, originalXml);
    }
}

Use L&F that is available on JDK 1.3

Use L&F that is available on JDK 1.3


package com.github.aureliano.verbum_domini.dao;

import java.io.Serializable;
import java.util.List;

import com.github.aureliano.verbum_domini.web.ServiceParams;

public interface IDao<T> {

	public abstract List<Pagination<T>> list();

	public abstract List<Pagination<T>> list(T filter);

	public abstract List<Pagination<T>> list(T filter, ServiceParams params);

	public abstract T load(Serializable id);
}

package com.github.aureliano.verbum_domini.dao;

import java.io.Serializable;

import com.github.aureliano.verbum_domini.web.ServiceParams;

public interface IDao<T> {

	public static final Integer PAGE_ELEMENTS = 50;

	public abstract Pagination<T> list();

	public abstract Pagination<T> list(T filter);

	public abstract Pagination<T> list(T filter, ServiceParams params);

	public abstract T load(Serializable id);
}

Use pagination object as return type for collection returning methods.


package com.vackosar.searchbasedlauncher.entity;

import com.google.gson.annotations.Expose;

public class App implements Comparable<App> {

    @Expose private final String name;
    @Expose private String nick;
    @Expose private final String activity;

    public App(String name, String nick, String activity) {
        this.name = name;
        this.nick = nick;
        this.activity = activity;
    }

    public String getName() {
        return name;
    }

    public String getActivity() {
        return activity;
    }

    public String getNick() {
        return nick;
    }

    public void setNick(String nick) {
        this.nick = nick;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        App app = (App) o;

        return activity.equals(app.activity);

    }

    @Override
    public int hashCode() {
        return activity.hashCode();
    }

    @Override
    public int compareTo(App another) {
        if (another == null) {
            return nick.compareTo(null);
        }
        return nick.compareTo(another.getNick());
    }
}

package com.vackosar.searchbasedlauncher.entity;

import com.google.gson.annotations.Expose;

public class App implements Comparable<App> {

    @Expose private final String name;
    @Expose private String nick;
    @Expose private final String activity;

    public App(String name, String nick, String activity) {
        this.name = name;
        this.nick = nick;
        this.activity = activity;
    }

    public String getName() {
        return name;
    }

    public String getActivity() {
        return activity;
    }

    public String getNick() {
        return nick;
    }

    public void setNick(String nick) {
        this.nick = nick;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        App app = (App) o;

        if (name != null ? !name.equals(app.name) : app.name != null) return false;
        return activity != null ? activity.equals(app.activity) : app.activity == null;

    }

    @Override
    public int hashCode() {
        int result = name != null ? name.hashCode() : 0;
        result = 31 * result + (activity != null ? activity.hashCode() : 0);
        return result;
    }

    @Override
    public int compareTo(App another) {
        if (another == null) {
            return nick.compareTo(null);
        }
        return nick.compareTo(another.getNick());
    }
}

Fix not-showing apps with similar activities.


package mondocommand.dynamic;

import static org.junit.Assert.*;
import mondocommand.CallInfo;
import mondocommand.MockCommandSender;
import mondocommand.MondoCommand;
import mondocommand.MondoFailure;

import org.bukkit.ChatColor;
import org.junit.Test;

public class DynamicSubcommandsTest {

    @Test
    public void testMondoFailureWithDynamicSubcommands() {
        MondoCommand cmd = new FailingCommand();
        MockCommandSender sender = new MockCommandSender();
        cmd.onCommand(sender, null, "test", new String[] { "fail" });
        assertEquals(1, sender.messages.size());
        assertEquals(sender.messages.get(0), ChatColor.RED + "fail");
    }

    public static class FailingCommand extends MondoCommand {

        public FailingCommand() {
            this.autoRegisterFrom(this);
        }

        @Sub
        public void fail(CallInfo call) throws MondoFailure {
            throw new MondoFailure("fail");
        }
    }

}

package mondocommand.dynamic;

import static org.junit.Assert.*;
import mondocommand.CallInfo;
import mondocommand.MockCommandSender;
import mondocommand.MondoCommand;
import mondocommand.MondoFailure;

import org.bukkit.ChatColor;
import org.junit.Test;

public class DynamicSubcommandsTest {

    @Test
    public void testMondoFailureWithDynamicSubcommands() {
        MondoCommand cmd = new DynamicCommand();
        MockCommandSender sender = new MockCommandSender();
        cmd.onCommand(sender, null, "test", new String[] { "fail" });
        assertEquals(1, sender.messages.size());
        assertEquals(sender.messages.get(0), ChatColor.RED + "fail");
    }

    @Test
    public void testWorkingDynamicSubcommand() {
        MondoCommand cmd = new DynamicCommand();
        MockCommandSender sender = new MockCommandSender();
        cmd.onCommand(sender, null, "test", new String[] {"success"});
        assertEquals(1, sender.messages.size());
        assertEquals(sender.messages.get(0), ChatColor.GREEN + "success");
    }

    public static class DynamicCommand extends MondoCommand {

        public DynamicCommand() {
            this.autoRegisterFrom(this);
        }

        @Sub
        public void fail(CallInfo call) throws MondoFailure {
            throw new MondoFailure("fail");
        }

        @Sub
        public void success(CallInfo call) {
            call.reply("{GREEN}success");
        }
    }

}

Add another Test for working dynamically registered Subcommands, just to be safe


import interfaces.*;

import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;

/**
 * Chat Server for various clients
 */
public class MultiUserChatServer implements IChatServer {
    private List<IChatClient> clients = new ArrayList<>();
    private ServerSocket ss;

    public void setupServer() {
        try {
            ss = new ServerSocket(8200);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void waitForClients() {
        try {
            while (true) {
                Socket socketNovoCliente = ss.accept();
                ConnectedClient novoCliente = new ConnectedClient(socketNovoCliente, this);
                clients.add(novoCliente);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public List<IChatClient> getClients() {
        return clients;
    }
}

import interfaces.*;

import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;

/**
 * Chat Server for various clients
 */
public class MultiUserChatServer implements IChatServer {
    private List<IChatClient> clients = new ArrayList<>();
    private ServerSocket ss;

    private static int PORT = 8200;

    public void setupServer() {
        try {
            ss = new ServerSocket(PORT);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void waitForClients() {
        try {
            while (true) {
                Socket socketNovoCliente = ss.accept();
                ConnectedClient novoCliente = new ConnectedClient(socketNovoCliente, this);
                clients.add(novoCliente);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public List<IChatClient> getClients() {
        return clients;
    }
}

Set server port in a static prop

Set server port in a static prop


package com.supinfo.jva.geocar;

import android.content.Intent;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class About extends ActionBarActivity {

    private TextView version = null;
    private Button gitButton = null;

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

        version = (TextView) findViewById(R.id.version);
        gitButton = (Button) findViewById(R.id.button_git);

        Resources res = getResources();
        String actualVersion = res.getString(R.string.version, "1.0.0");
        version.setText(actualVersion);

        gitButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String urlProject = "https://github.com/Carmain/Geocar";
                Intent intent = new Intent(Intent.ACTION_VIEW);
                intent.setData(Uri.parse(urlProject));
                startActivity(intent);
            }
        });

    }
}

package com.supinfo.jva.geocar;

import android.content.Intent;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class About extends ActionBarActivity {

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

        TextView version = (TextView) findViewById(R.id.version);
        Button gitButton = (Button) findViewById(R.id.button_git);

        Resources res = getResources();
        String actualVersion = res.getString(R.string.version, "1.0.0");
        version.setText(actualVersion);

        gitButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String urlProject = "https://github.com/Carmain/Geocar";
                Intent intent = new Intent(Intent.ACTION_VIEW);
                intent.setData(Uri.parse(urlProject));
                startActivity(intent);
            }
        });

    }
}

Use local vars instead of global

Use local vars instead of global


package com.kickstarter.models;

import android.os.Parcel;
import android.os.Parcelable;

import com.hannesdorfmann.parcelableplease.annotation.ParcelablePlease;

import org.joda.time.DateTime;

@ParcelablePlease
public class Comment implements Parcelable {
  public String body = null;
  public DateTime created_at = null;
  public Author author = null;

  public String body() {
    return body;
  }
  public DateTime createdAt() {
    return created_at;
  }
  public Author author() {
    return author;
  }

  @ParcelablePlease
  public static class Author implements Parcelable {
    public String name = null;
    public Avatar avatar = null;

    public String name() {
      return name;
    }
    public Avatar avatar () {
      return avatar;
    }

    @Override
    public int describeContents() { return 0; }
    @Override
    public void writeToParcel(Parcel dest, int flags) {com.kickstarter.models.AuthorParcelablePlease.writeToParcel(this, dest, flags);}
    public static final Creator<Author> CREATOR = new Creator<Author>() {
      public Author createFromParcel(Parcel source) {
        Author target = new Author();
        com.kickstarter.models.AuthorParcelablePlease.readFromParcel(target, source);
        return target;
      }
      public Author[] newArray(int size) {return new Author[size];}
    };
  }

  @Override
  public int describeContents() { return 0; }
  @Override
  public void writeToParcel(Parcel dest, int flags) {CommentParcelablePlease.writeToParcel(this, dest, flags);}
  public static final Creator<Comment> CREATOR = new Creator<Comment>() {
    public Comment createFromParcel(Parcel source) {
      Comment target = new Comment();
      CommentParcelablePlease.readFromParcel(target, source);
      return target;
    }
    public Comment[] newArray(int size) {return new Comment[size];}
  };
}

package com.kickstarter.models;

import android.os.Parcel;
import android.os.Parcelable;

import com.hannesdorfmann.parcelableplease.annotation.ParcelablePlease;

import org.joda.time.DateTime;

@ParcelablePlease
public class Comment implements Parcelable {
  public String body = null;
  public DateTime created_at = null;
  public User author = null;
  public Integer id = null;

  public String body() {
    return body;
  }
  public DateTime createdAt() {
    return created_at;
  }
  public User author() {
    return author;
  }
  public Integer id() {
    return id;
  }

  @Override
  public int describeContents() { return 0; }
  @Override
  public void writeToParcel(Parcel dest, int flags) {CommentParcelablePlease.writeToParcel(this, dest, flags);}
  public static final Creator<Comment> CREATOR = new Creator<Comment>() {
    public Comment createFromParcel(Parcel source) {
      Comment target = new Comment();
      CommentParcelablePlease.readFromParcel(target, source);
      return target;
    }
    public Comment[] newArray(int size) {return new Comment[size];}
  };
}

Change Author to User model

Change Author to User model

they're the same


package alotoc.graphics.view;

import java.awt.Point;

import javax.swing.JFrame;

/**
 * This is an abstract class for all the frames in the program.
 *
 * @author Kazeheki
 *
 */
@SuppressWarnings("serial")
public abstract class AbstractAlotocFrame extends JFrame {

	/**
	 * Ctor.
	 *
	 * @param x
	 *            X position of frame.
	 * @param y
	 *            Y position of frame.
	 * @param w
	 *            Width of frame.
	 * @param h
	 *            Height of frame.
	 * @param title
	 *            Title of frame.
	 */
	public AbstractAlotocFrame(final int x, final int y, final int w, final int h, final String title) {
		this.setTitle(title);
		this.setAlwaysOnTop(true);
		this.setBounds(x, y, w, h);
		this.setUndecorated(true);
		this.setLayout(null);
	}

	/**
	 * Ctor.
	 *
	 * @param p
	 *            Postion Point of frame.
	 * @param w
	 *            Width of frame.
	 * @param h
	 *            Height of frame.
	 * @param title
	 *            Title of frame.
	 */
	public AbstractAlotocFrame(final Point p, final int w, final int h, final String title) {
		this(p.x, p.y, w, h, title);
	}
}

package alotoc.graphics.view;

import java.awt.Point;

import javax.swing.JFrame;

/**
 * This is an abstract class for all the frames in the program.
 *
 * @author Kazeheki
 *
 */
@SuppressWarnings("serial")
public abstract class AbstractAlotocFrame extends JFrame {

	/**
	 * Ctor.
	 *
	 * @param x
	 *            X position of frame.
	 * @param y
	 *            Y position of frame.
	 * @param w
	 *            Width of frame.
	 * @param h
	 *            Height of frame.
	 * @param title
	 *            Title of frame.
	 */
	public AbstractAlotocFrame(final int x, final int y, final int w, final int h, final String title) {
		this.setTitle(title);
		this.setAlwaysOnTop(true);
		this.setBounds(x, y, w, h);
		this.setUndecorated(true);
		this.setLayout(null);
		this.setResizable(false);
	}

	/**
	 * Ctor.
	 *
	 * @param p
	 *            Postion Point of frame.
	 * @param w
	 *            Width of frame.
	 * @param h
	 *            Height of frame.
	 * @param title
	 *            Title of frame.
	 */
	public AbstractAlotocFrame(final Point p, final int w, final int h, final String title) {
		this(p.x, p.y, w, h, title);
	}
}

Set frames to be not resizable

Set frames to be not resizable


package org.muml.psm.allocation.algorithm.ilp.tests;

import org.eclipse.emf.common.EMFPlugin;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
import org.muml.psm.allocation.ilp.lpsolve.xtext.LPSolveStandaloneSetup;
import org.muml.psm.allocation.language.xtext.AllocationSpecificationLanguageStandaloneSetup;

@RunWith(Suite.class)
@SuiteClasses({
	OclContext2ILPTest.class
})
public class AllTestsSuite {
	@BeforeClass
	public static void setup() {
		if (!EMFPlugin.IS_ECLIPSE_RUNNING) {
			LPSolveStandaloneSetup.doSetup();
			AllocationSpecificationLanguageStandaloneSetup.doSetup();
		}
	}
}

package org.muml.psm.allocation.algorithm.ilp.tests;

import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
import org.muml.psm.allocation.ilp.lpsolve.xtext.LPSolveStandaloneSetup;
import org.muml.psm.allocation.language.xtext.AllocationSpecificationLanguageStandaloneSetup;

@RunWith(Suite.class)
@SuiteClasses({
	OclContext2ILPTest.class
})
public class AllTestsSuite {
	@BeforeClass
	public static void setup() {
		LPSolveStandaloneSetup.doSetup();
		AllocationSpecificationLanguageStandaloneSetup.doSetup();
	}
}

Revert "Only call the standalone setups if eclipse is not running"

This reverts commit 4b5d0349506182d3e1be1d331c1c053faedd1b54.


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

package org.wso2.carbon.device.mgt.common;

public enum Platform {
    ANDROID, IOS, WINDOWS;
}

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

package org.wso2.carbon.device.mgt.common;

public enum Platform {
    android, ios, windows;
}

Change platforms to lower case

Change platforms to lower case


package tv.rocketbeans.supermafiosi.core;

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

import com.badlogic.gdx.InputAdapter;

import tv.rocketbeans.supermafiosi.i18n.Bundle;

public class DialogManager extends InputAdapter {

	private List<Dialog> dialogs = new ArrayList<Dialog>();

	private Dialog currentDialog;

	public void addDialog(String dialogKey, String avatarKey) {
		dialogs.add(new Dialog(Bundle.translations.get(dialogKey), avatarKey));
	}

	@Override
	public boolean touchDown(int screenX, int screenY, int pointer, int button) {
		if (dialogs.size() > 0) {
			currentDialog = dialogs.remove(0);
			return true;
		} else {
			currentDialog = null;
		}
		return false;
	}

	public Dialog getCurrentDialog() {
		return currentDialog;
	}
}

package tv.rocketbeans.supermafiosi.core;

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

import com.badlogic.gdx.InputAdapter;

import tv.rocketbeans.supermafiosi.i18n.Bundle;

public class DialogManager extends InputAdapter {

	private List<Dialog> dialogs = new ArrayList<Dialog>();

	private Dialog currentDialog;

	public void addDialog(String dialogKey, String avatarKey) {
		dialogs.add(new Dialog(Bundle.translations.get(dialogKey), avatarKey));
	}

	@Override
	public boolean touchDown(int screenX, int screenY, int pointer, int button) {
		return nextDialog();
	}

	public boolean nextDialog() {
		if (dialogs.size() > 0) {
			currentDialog = dialogs.remove(0);
			return true;
		} else {
			currentDialog = null;
		}
		return false;
	}

	public Dialog getCurrentDialog() {
		return currentDialog;
	}
}

Add manual method to trigger dialogs

Add manual method to trigger dialogs


/**
 * Copyright OPS4J
 *
 * 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.ops4j.pax.wicket.samples.blueprint.filter.internal;

import javax.servlet.Filter;

import org.ops4j.pax.wicket.api.ConfigurableFilterConfig;
import org.ops4j.pax.wicket.api.FilterFactory;

public class SampleFilterFactory implements FilterFactory {

    public int compareTo(FilterFactory o) {
        if (o.getPriority() < 1) {
            return 1;
        }
        if (o.getPriority() > 1) {
            return -1;
        }
        return 0;
    }

    public Integer getPriority() {
        return 1;
    }

    public String getApplicationName() {
        return "blueprint.filter.paxwicket";
    }

    public Filter createFilter(ConfigurableFilterConfig filterConfig) {
        return new IAmASysoutFilter();
    }

}

/**
 * Copyright OPS4J
 *
 * 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.ops4j.pax.wicket.samples.blueprint.filter.internal;

import javax.servlet.Filter;

import org.ops4j.pax.wicket.api.ConfigurableFilterConfig;
import org.ops4j.pax.wicket.api.FilterFactory;

public class SampleFilterFactory implements FilterFactory {

    public Integer getPriority() {
        return 1;
    }

    public String getApplicationName() {
        return "blueprint.filter.paxwicket";
    }

    public Filter createFilter(ConfigurableFilterConfig filterConfig) {
        return new IAmASysoutFilter();
    }

}

Adjust for changes made by PAXWICKET-399


package com.royalrangers.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonView;
import com.royalrangers.enums.UserAgeGroup;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import javax.validation.constraints.NotNull;

@Getter
@Setter
@Entity
public class Section extends BaseModel{

    @JsonView(Views.Profile.class)
    @NotNull
    private String name;

    @JsonView(Views.Profile.class)
    private UserAgeGroup userAgeGroup;

    @JsonIgnore
    @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
    @JoinColumn(name = "platoon_id")
    private Platoon platoon;

    public Section() {}

    public Section(Platoon platoon, String name) {
        this.platoon = platoon;
        this.name = name;
    }

}

package com.royalrangers.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonView;
import com.royalrangers.enums.UserAgeGroup;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import javax.validation.constraints.NotNull;

@Getter
@Setter
@Entity
public class Section extends BaseModel{

    @JsonView(Views.Profile.class)
    @NotNull
    private String name;

    @JsonView(Views.Public.class)
    private UserAgeGroup userAgeGroup;

    @JsonIgnore
    @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
    @JoinColumn(name = "platoon_id")
    private Platoon platoon;

    public Section() {}

    public Section(Platoon platoon, String name) {
        this.platoon = platoon;
        this.name = name;
    }

}

Change JsonView to Public for userAgeGroup


package framework.util;

import framework.util.RingBuffer;
import framework.generators.Generator;

/**
 * Models a guitar string using the Karplus-Strong algorithm.
 */
public class GuitarString {
    /**
     * Create a GuitarString of the given frequency.
     * @param  f the frequency
     */
    public GuitarString(Double f) {
        N = (int) (Generator.SAMPLE_RATE / f);

        buffer = new RingBuffer(N);

        // Guitar string at rest
        for(int i = 0; i < N; i++)
            buffer.enqueue(0.);
    }

    /**
     * Models the plucking of the string.
     */
    public void pluck() {
        for(int i = 0; i < N; i++) {
            // Enqueue random value between -0.5 and 0.5 (noise)
            buffer.enqueue(Math.random() - 0.5);
        }
    }

    /**
     * Apply the Karplus-Strong update.
     */
    public void tic() {
        Double first = buffer.dequeue();
        buffer.enqueue((first * buffer.peek()) * 0.5 * ENERGY_DECAY_FACTOR);
    }

    /**
     * Get the value at the front of the buffer.
     * @return the value at the front of the buffer
     */
    public Double sample() {
        return buffer.peek();
    }

    RingBuffer      buffer;
    int             N;
    final Double    ENERGY_DECAY_FACTOR = 0.996;
}

package framework.util;

import framework.util.RingBuffer;
import framework.generators.Generator;

/**
 * Models a guitar string using the Karplus-Strong algorithm.
 */
public class GuitarString {
    /**
     * Create a GuitarString of the given frequency.
     * @param  f the frequency
     */
    public GuitarString(Double f) {
        N = (int) (Generator.SAMPLE_RATE / f);

        buffer = new RingBuffer(N);

        // Guitar string at rest
        for(int i = 0; i < N; i++)
            buffer.enqueue(0.);
    }

    /**
     * Models the plucking of the string.
     */
    public void pluck() {
        for(int i = 0; i < N; i++) {
            // Enqueue random value between -0.5 and 0.5 (noise)
            buffer.enqueue(Math.random() - 0.5);
        }
    }

    /**
     * Apply the Karplus-Strong update.
     */
    public void tic() {
        buffer.enqueue((buffer.dequeue() + buffer.peek()) / 2 * ENERGY_DECAY_FACTOR);
    }

    /**
     * Get the value at the front of the buffer.
     * @return the value at the front of the buffer
     */
    public Double sample() {
        return buffer.peek();
    }

    RingBuffer      buffer;
    int             N;
    final Double    ENERGY_DECAY_FACTOR = 0.996;
}

Correct THE stupid mistake. Now we have a string!


package seedu.ezdo.model.todo;

import com.joestelmach.natty.Parser;

/**
 * Represents the date associated with tasks.
 */
public abstract class TaskDate {

    public final String value;

    public static final String TASKDATE_VALIDATION_REGEX =
        "^$|([12][0-9]|3[01]|0?[1-9])/(0?[1-9]|1[012])/((?:19|20)\\d\\d)";;

    public TaskDate(String taskDate) {
    	Parser parser = new Parser();
        this.value = parser.parse(taskDate).get(0).getDates().get(0).toString();
    }

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

    @Override
    public boolean equals(Object other) {
        return other == this // short circuit if same object
                || (other instanceof TaskDate // instanceof handles nulls
                && this.value.equals(((TaskDate) other).value)); // state check
    }

    @Override
    public int hashCode() {
        return value.hashCode();
    }

    /**
     * Returns true if a given string is a valid task date.
     */
    public static boolean isValidTaskDate(String test) {
        return test.matches(TASKDATE_VALIDATION_REGEX);
    }
}

package seedu.ezdo.model.todo;

import com.joestelmach.natty.Parser;

/**
 * Represents the date associated with tasks.
 */
public abstract class TaskDate {

    public final String value;

    public static final String TASKDATE_VALIDATION_REGEX =
        "^$|([12][0-9]|3[01]|0?[1-9])/(0?[1-9]|1[012])/((?:19|20)\\d\\d)";

    public TaskDate(String taskDate) {
    	Parser parser = new Parser();
        this.value = parser.parse(taskDate).get(0).getDates().get(0).toString();
    }

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

    @Override
    public boolean equals(Object other) {
        return other == this // short circuit if same object
                || (other instanceof TaskDate // instanceof handles nulls
                && this.value.equals(((TaskDate) other).value)); // state check
    }

    @Override
    public int hashCode() {
        return value.hashCode();
    }

    /**
     * Returns true if a given string is a valid task date.
     */
    public static boolean isValidTaskDate(String test) {
        return test.matches(TASKDATE_VALIDATION_REGEX);
    }
}

Remove extra semi-colon in line 13

Remove extra semi-colon in line 13


package com.react.rnspinkit;

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

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * Created by suzuri04x2 on 2016/5/10.
 */
public class RNSpinkitPackage implements ReactPackage{
    @Override
    public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
        return Collections.emptyList();
    }

    @Override
    public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
        List<ViewManager> list = new ArrayList<>();
        list.add(new RNSpinkit(reactContext));
        return list;
    }
}

package com.react.rnspinkit;

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

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * Created by suzuri04x2 on 2016/5/10.
 */
public class RNSpinkitPackage implements ReactPackage{
    @Override
    public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
        return Collections.emptyList();
    }

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

    @Override
    public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
        List<ViewManager> list = new ArrayList<>();
        list.add(new RNSpinkit(reactContext));
        return list;
    }
}

Fix backward compatibility for RN < 0.47


package com.fourlastor.dante.html;

import android.graphics.drawable.Drawable;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.style.ImageSpan;

import com.fourlastor.dante.parser.Block;
import com.fourlastor.dante.parser.BlockListener;

class ImgListener implements BlockListener {

    private static final String UNICODE_REPLACE = "\uFFFC";
    private static final String IMG = "img";

    private final ImgLoader imgLoader;

    ImgListener(ImgLoader imgLoader) {
        this.imgLoader = imgLoader;
    }

    @Override
    public void start(Block block, SpannableStringBuilder text) {
        String src = ((HtmlBlock) block).getAttributes().get("src");
        if (src == null) {
            return;
        }

        int len = text.length();
        text.append(UNICODE_REPLACE);
        Drawable image = imgLoader.loadImage(src);
        text.setSpan(
                new ImageSpan(image, src),
                len,
                text.length(),
                Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
        );
    }

    @Override
    public void end(Block block, SpannableStringBuilder text) {
        // nothing to do here
    }

    @Override
    public boolean match(Block block) {
        return block instanceof HtmlBlock
                && IMG.equalsIgnoreCase(((HtmlBlock) block).getName());
    }
}

package com.fourlastor.dante.html;

import android.graphics.drawable.Drawable;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.style.ImageSpan;

import com.fourlastor.dante.parser.Block;
import com.fourlastor.dante.parser.BlockListener;

class ImgListener implements BlockListener {

    private static final String UNICODE_REPLACE = "\uFFFC";
    private static final String IMG = "img";

    private final ImgLoader imgLoader;

    ImgListener(ImgLoader imgLoader) {
        this.imgLoader = imgLoader;
    }

    @Override
    public void start(Block block, SpannableStringBuilder text) {
        String src = ((HtmlBlock) block).getAttributes().get("src");
        if (src == null) {
            return;
        }

        int originalLength = text.length();
        text.append(UNICODE_REPLACE);
        Drawable image = imgLoader.loadImage(src);
        text.setSpan(
                new ImageSpan(image, src),
                originalLength,
                text.length(),
                Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
        );
    }

    @Override
    public void end(Block block, SpannableStringBuilder text) {
        // nothing to do here
    }

    @Override
    public boolean match(Block block) {
        return block instanceof HtmlBlock
                && IMG.equalsIgnoreCase(((HtmlBlock) block).getName());
    }
}

Rename var to more meaningful name

Rename var to more meaningful name


package com.jenjinstudios.io.concurrency;

import com.jenjinstudios.io.ExecutionContext;
import com.jenjinstudios.io.Message;

import java.util.Collection;
import java.util.List;
import java.util.function.Consumer;

/**
 * Executes ExecutableMessage objects which have been read.
 *
 * @author Caleb Brinkman
 */
public class ExecutionTask implements Runnable
{
    private final MessageQueue messageQueue;
    private final ExecutionContext executionContext;
    private final Collection<Consumer<ExecutionContext>> contextualTasks;

    /**
     * Construct a new ExecuteTask that will execute messages from the given MessageQueue.
     *
     * @param messageQueue The MessageQueue.
     * @param executionContext The context in which messages should execute.
     * @param contextualTasks Tasks which should be invoked in synchronous fashion with the execution context.
     */
    public ExecutionTask(
          MessageQueue messageQueue,
          ExecutionContext executionContext,
          Collection<Consumer<ExecutionContext>> contextualTasks
    )
    {
        this.messageQueue = messageQueue;
        this.executionContext = executionContext;
        this.contextualTasks = contextualTasks;
    }

    @Override
    public void run() {
        final List<Message> incoming = messageQueue.getIncomingAndClear();
        incoming.forEach(message -> {
            Message response = message.execute(executionContext);
            if (response != null) {
                messageQueue.queueOutgoing(response);
            }
        });
        contextualTasks.forEach(consumer -> consumer.accept(executionContext));
    }
}

package com.jenjinstudios.io.concurrency;

import com.jenjinstudios.io.ExecutionContext;
import com.jenjinstudios.io.Message;

import java.util.Collection;
import java.util.List;
import java.util.function.Consumer;

/**
 * Executes ExecutableMessage objects which have been read.
 *
 * @author Caleb Brinkman
 */
public class ExecutionTask implements Runnable
{
    private final MessageQueue messageQueue;
    private final ExecutionContext executionContext;
    private final Collection<Consumer<ExecutionContext>> contextualTasks;

    /**
     * Construct a new ExecuteTask that will execute messages from the given MessageQueue.
     *
     * @param messageQueue The MessageQueue.
     * @param executionContext The context in which messages should execute.
     * @param contextualTasks Tasks which should be invoked in synchronous fashion with the execution context.
     */
    public ExecutionTask(
          MessageQueue messageQueue,
          ExecutionContext executionContext,
          Collection<Consumer<ExecutionContext>> contextualTasks
    )
    {
        this.messageQueue = messageQueue;
        this.executionContext = executionContext;
        this.contextualTasks = contextualTasks;
    }

    @Override
    public void run() {
        final List<Message> incoming = messageQueue.getIncomingAndClear();
        incoming.forEach(message -> {
            Message response = message.execute(executionContext);
            if (response != null) {
                messageQueue.queueOutgoing(response);
            }
            contextualTasks.forEach(consumer -> consumer.accept(executionContext));
        });
    }
}

Move contextual task execution to make more sense


package com.sitdh.master.eaa.main;

import java.util.Vector;

public class A5Department {

	public String name;

	public String departmentDescription;

	public Vector<B5Professor> professors;

	public A5Department() {
		professors = new Vector<B5Professor>();
	}

	public void addProfessor(B5Professor professor) {
		professors.addElement(professor);
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDepartmentDescription() {
		return departmentDescription;
	}

	public void setDepartmentDescription(String departmentDescription) {
		this.departmentDescription = departmentDescription;
	}

	public Vector<B5Professor> getProfessors() {
		return professors;
	}

	public void setProfessors(Vector<B5Professor> professors) {
		this.professors = professors;
	}

}

package com.sitdh.master.eaa.main;

public class A5Department {

	public String name;

	public String departmentDescription;

	public B5Professor headOfDepartment;

	public A5Department() {
		headOfDepartment = new B5Professor();
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDepartmentDescription() {
		return departmentDescription;
	}

	public void setDepartmentDescription(String departmentDescription) {
		this.departmentDescription = departmentDescription;
	}

	public B5Professor getHeadOfDepartment() {
		return headOfDepartment;
	}

	public void setHeadOfDepartment(B5Professor headOfDepartment) {
		this.headOfDepartment = headOfDepartment;
	}

	public void displayDepartmentInformation() {

	}

}

Add new method for display information

Add new method for display information


package rewbot.minecraft.tutorial.blocks;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import rewbot.minecraft.tutorial.MmaGlobal;

/**
 * Created by ashepherd on 5/12/2016.
 */
public class AdventureBlock extends Block {

    public AdventureBlock(String unlocalizedName, Material material, float hardness, float resistance) {
        super(material);

        this.setUnlocalizedName(unlocalizedName);
        this.setHardness(hardness);
        this.setResistance(resistance);
        setCreativeTab(MmaGlobal.mmaCreativeTab);
    }
}

package rewbot.minecraft.tutorial.blocks;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import rewbot.minecraft.tutorial.MmaGlobal;
import rewbot.minecraft.tutorial.items.AdventureItems;

import java.util.Random;

/**
 * Created by ashepherd on 5/12/2016.
 */
public class AdventureBlock extends Block {

    public AdventureBlock(String unlocalizedName, Material material, float hardness, float resistance) {
        super(material);

        this.setUnlocalizedName(unlocalizedName);
        this.setHardness(hardness);
        this.setResistance(resistance);
        setCreativeTab(MmaGlobal.mmaCreativeTab);
    }

    public Item getItemDropped(IBlockState state, Random rand, int fortune) {
        return this == AdventureBlocks.topazOre ? AdventureItems.topazStone : Item.getItemFromBlock(this);
    }

    public int quantityDropped(Random rand) {
        return this == AdventureBlocks.topazOre ? 1 + rand.nextInt(5) : 1;
    }
}

Drop random number of topaz stones on topaz ore break


package org.jboss.resteasy.reactive.common.providers.serialisers;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import javax.ws.rs.core.MediaType;

public class MessageReaderUtil {

    public static final String UTF8_CHARSET = StandardCharsets.UTF_8.name();

    public static String charsetFromMediaType(MediaType mediaType) {
        if (mediaType == null) {
            return UTF8_CHARSET;
        }
        String charset = mediaType.getParameters().get(MediaType.CHARSET_PARAMETER);
        if (charset != null) {
            return charset;
        }
        return UTF8_CHARSET;
    }

    public static byte[] readBytes(InputStream entityStream) throws IOException {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        byte[] buf = new byte[1024]; //TODO: fix, needs a pure vert.x async read model
        int r;
        while ((r = entityStream.read(buf)) > 0) {
            out.write(buf, 0, r);
        }
        return out.toByteArray();
    }

    public static String readString(InputStream entityStream, MediaType mediaType) throws IOException {
        return new String(readBytes(entityStream), charsetFromMediaType(mediaType));
    }
}

package org.jboss.resteasy.reactive.common.providers.serialisers;

import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import javax.ws.rs.core.MediaType;

public class MessageReaderUtil {

    public static final String UTF8_CHARSET = StandardCharsets.UTF_8.name();

    public static String charsetFromMediaType(MediaType mediaType) {
        if (mediaType == null) {
            return UTF8_CHARSET;
        }
        String charset = mediaType.getParameters().get(MediaType.CHARSET_PARAMETER);
        if (charset != null) {
            return charset;
        }
        return UTF8_CHARSET;
    }

    public static byte[] readBytes(InputStream entityStream) throws IOException {
        return entityStream.readAllBytes();
    }

    public static String readString(InputStream entityStream, MediaType mediaType) throws IOException {
        return new String(readBytes(entityStream), charsetFromMediaType(mediaType));
    }
}

Replace InputStream bytes with InputStream.readAllBytes in RESTEasy Reactive

This not only is less code, but it's also more efficient as
it generally results in less array copying


package musician101.itembank.commands.ibcommand;

import musician101.itembank.ItemBank;
import musician101.itembank.lib.Constants;

import org.bukkit.command.CommandSender;

/**
 * The code used when the Help argument is used in the ItemBank command.
 *
 * @author Musician101
 */
public class HelpCommand
{
	public static boolean execute(ItemBank plugin, CommandSender sender, String[] args)
	{
		if (args.length == 1)
			sender.sendMessage(Constants.HELP_LIST);
		else
		{
			String cmd = args[1].toLowerCase();
			if (cmd == Constants.ACCOUNT_CMD)
				sender.sendMessage(Constants.ACCOUNT_HELP);
			else if (cmd == Constants.DEPOSIT_CMD)
				sender.sendMessage(Constants.DEPOSIT_HELP);
			else if (cmd == Constants.IA_CMD)
				sender.sendMessage(Constants.IA_HELP);
			else if (cmd == Constants.PURGE_CMD)
				sender.sendMessage(Constants.PURGE_HELP);
			else if (cmd == Constants.WITHDRAW_CMD)
				sender.sendMessage(Constants.WITHDRAW_HELP);
			else
				sender.sendMessage(Constants.PREFIX + "Error: Command not recognized.");
		}
		return true;
	}
}

package musician101.itembank.commands.ibcommand;

import musician101.itembank.ItemBank;
import musician101.itembank.lib.Constants;

import org.bukkit.command.CommandSender;

/**
 * The code used when the Help argument is used in the ItemBank command.
 *
 * @author Musician101
 */
public class HelpCommand
{
	public static boolean execute(ItemBank plugin, CommandSender sender, String[] args)
	{
		if (args.length == 1)
			sender.sendMessage(Constants.HELP_LIST);
		else
		{
			String cmd = args[1].toLowerCase();
			if (cmd.equals(Constants.ACCOUNT_CMD))
				sender.sendMessage(Constants.ACCOUNT_HELP);
			else if (cmd.equals(Constants.DEPOSIT_CMD))
				sender.sendMessage(Constants.DEPOSIT_HELP);
			else if (cmd.equals(Constants.IA_CMD))
				sender.sendMessage(Constants.IA_HELP);
			else if (cmd.equals(Constants.PURGE_CMD))
				sender.sendMessage(Constants.PURGE_HELP);
			else if (cmd.equals(Constants.WITHDRAW_CMD))
				sender.sendMessage(Constants.WITHDRAW_HELP);
			else
				sender.sendMessage(Constants.PREFIX + "Error: Command not recognized.");
		}
		return true;
	}
}

Fix Help not recognizing user input.

Fix Help not recognizing user input.


package org.eclipse.incquery.examples.cps.m2t.proto.distributed.generator.utils;

import org.eclipse.incquery.examples.cps.m2t.proto.distributed.generator.exceptions.CPSGeneratorException;
import org.eclipse.jdt.core.ToolFactory;
import org.eclipse.jdt.core.formatter.CodeFormatter;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.IDocument;
import org.eclipse.text.edits.MalformedTreeException;
import org.eclipse.text.edits.TextEdit;

public class FormatterUtil {

	public static String formatCode(CharSequence code) throws CPSGeneratorException{
		CodeFormatter formatter = ToolFactory.createCodeFormatter(null);

		TextEdit textEdit = formatter.format(CodeFormatter.K_COMPILATION_UNIT, code.toString(), 0, code.length(), 0, null);
		IDocument doc = new Document(code.toString());
		try {
			textEdit.apply(doc);
		} catch (MalformedTreeException e) {
			throw new CPSGeneratorException("Cannot complete codeformatting", e);
		} catch (BadLocationException e) {
			throw new CPSGeneratorException("Cannot complete codeformatting", e);
		}

		return doc.get();
	}
}

package org.eclipse.incquery.examples.cps.m2t.proto.distributed.generator.utils;

import org.eclipse.incquery.examples.cps.m2t.proto.distributed.generator.exceptions.CPSGeneratorException;
import org.eclipse.jdt.core.ToolFactory;
import org.eclipse.jdt.core.formatter.CodeFormatter;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.IDocument;
import org.eclipse.text.edits.MalformedTreeException;
import org.eclipse.text.edits.TextEdit;

public class FormatterUtil {

	public static String formatCode(CharSequence code) throws CPSGeneratorException{
		CodeFormatter formatter = ToolFactory.createCodeFormatter(null);

		TextEdit textEdit = formatter.format(CodeFormatter.K_COMPILATION_UNIT, code.toString(), 0, code.length(), 0, null);

		if(textEdit == null){
			// TODO handle...
			return code.toString();
		}

		IDocument doc = new Document(code.toString());
		try {
			textEdit.apply(doc);
		} catch (MalformedTreeException e) {
			throw new CPSGeneratorException("Cannot complete codeformatting", e);
		} catch (BadLocationException e) {
			throw new CPSGeneratorException("Cannot complete codeformatting", e);
		}

		return doc.get();
	}
}

Fix bug: if code cannot be formatted the format returns null


package net.i2p.router.web;

/** set the theme */
public class ConfigUIHandler extends FormHandler {
    private boolean _shouldSave;
    private String _config;

    protected void processForm() {
        if (_shouldSave)
            saveChanges();
    }

    public void setShouldsave(String moo) { _shouldSave = true; }

    public void setTheme(String val) {
        _config = val;
    }

    private void saveChanges() {
        if (_config == null)
            return;
        if (_config.equals("default"))
            _context.router().removeConfigSetting(CSSHelper.PROP_THEME_NAME);
        else
            _context.router().setConfigSetting(CSSHelper.PROP_THEME_NAME, _config);
        if (_context.router().saveConfig())
            addFormNotice("Configuration saved successfully");
        else
            addFormNotice("Error saving the configuration (applied but not saved) - please see the error logs");
    }
}

package net.i2p.router.web;

/** set the theme */
public class ConfigUIHandler extends FormHandler {
    private boolean _shouldSave;
    private String _config;

    protected void processForm() {
        if (_shouldSave)
            saveChanges();
    }

    public void setShouldsave(String moo) { _shouldSave = true; }

    public void setTheme(String val) {
        _config = val;
    }

    private void saveChanges() {
        if (_config == null)
            return;
        if (_config.equals("default"))
            _context.router().removeConfigSetting(CSSHelper.PROP_THEME_NAME);
        else
            _context.router().setConfigSetting(CSSHelper.PROP_THEME_NAME, _config);
        if (_context.router().saveConfig())
            addFormNotice("Theme change successfully saved (refresh page to view)");
        else
            addFormNotice("Error saving the configuration (applied but not saved) - please see the error logs");
    }
}

Refresh successful theme change message; make more context specific, indicate page refresh needed .


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

package org.spine3.server.storage.datastore;

import org.junit.Test;

import static org.spine3.test.Tests.assertHasPrivateParameterlessCtor;

/**
 * @author Dmytro Dashenkov
 */
public class IndexesShould {

    @Test
    public void have_private_utility_ctor() {
        assertHasPrivateParameterlessCtor(Indexes.class);
    }
}

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

package org.spine3.server.storage.datastore;

import com.google.common.testing.NullPointerTester;
import org.junit.Test;

import static org.mockito.Mockito.mock;
import static org.spine3.test.Tests.assertHasPrivateParameterlessCtor;

/**
 * @author Dmytro Dashenkov
 */
public class IndexesShould {

    @Test
    public void have_private_utility_ctor() {
        assertHasPrivateParameterlessCtor(Indexes.class);
    }

    @Test
    public void not_accept_nulls() {
        new NullPointerTester()
                .setDefault(Kind.class, Kind.of("arbitrary-kind"))
                .setDefault(DatastoreWrapper.class, mock(DatastoreWrapper.class))
                .testStaticMethods(Indexes.class, NullPointerTester.Visibility.PACKAGE);
    }
}

Add null tolerance test of `Indexes`.

Add null tolerance test of `Indexes`.


package info.u_team.u_team_test.init;

import info.u_team.u_team_core.item.armor.*;
import info.u_team.u_team_core.item.tool.*;
import info.u_team.u_team_core.util.registry.BaseRegistryUtil;
import info.u_team.u_team_test.TestMod;
import info.u_team.u_team_test.item.*;
import net.minecraft.item.Item;
import net.minecraft.item.Item.Properties;
import net.minecraftforge.event.RegistryEvent.Register;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;

@EventBusSubscriber(modid = TestMod.MODID, bus = Bus.MOD)
public class TestItems {

	public static final Item BASIC = new BasicItem("basicitem");

	public static final Item BETTER_ENDERPEARL = new BetterEnderPearlItem("better_enderpearl");

	public static final Item BASIC_FOOD = new BasicFoodItem("basicfood");

	public static final ToolSet BASIC_TOOL = ToolSetCreator.create("basictool", TestItemGroups.GROUP, new Properties(), TestToolMaterial.BASIC);
	public static final ArmorSet BASIC_ARMOR = ArmorSetCreator.create("basicarmor", TestItemGroups.GROUP, new Properties(), TestArmorMaterial.BASIC);

	@SubscribeEvent
	public static void registerBlockItem(Register<Item> event) {
		BaseRegistryUtil.getAllRegistryEntriesAndApplyNames(TestMod.MODID, Item.class).forEach(event.getRegistry()::register);
	}

}

package info.u_team.u_team_test.init;

import info.u_team.u_team_core.item.armor.*;
import info.u_team.u_team_core.item.tool.*;
import info.u_team.u_team_test.TestMod;
import info.u_team.u_team_test.item.*;
import net.minecraft.item.Item;
import net.minecraft.item.Item.Properties;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.*;

public class TestItems {

	public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, TestMod.MODID);

	public static final Item BASIC = new BasicItem("basicitem");

	public static final Item BETTER_ENDERPEARL = new BetterEnderPearlItem("better_enderpearl");

	public static final Item BASIC_FOOD = new BasicFoodItem("basicfood");

	public static final ToolSet BASIC_TOOL = ToolSetCreator.create("basictool", TestItemGroups.GROUP, new Properties(), TestToolMaterial.BASIC);
	public static final ArmorSet BASIC_ARMOR = ArmorSetCreator.create("basicarmor", TestItemGroups.GROUP, new Properties(), TestArmorMaterial.BASIC);

	public static void register(IEventBus bus) {
		ITEMS.register(bus);
	}
}

Add deferred register to items

Add deferred register to items


package com.hubspot.jinjava.interpret;

import static org.assertj.core.api.Assertions.assertThat;

import org.junit.Before;
import org.junit.Test;

public class ContextTest {
  private static final String RESOLVED_EXPRESSION = "exp" ;
  private static final String RESOLVED_FUNCTION = "func" ;
  private static final String RESOLVED_VALUE = "val" ;

  private Context context;

  @Before
  public void setUp() {
    context = new Context();
  }

  @Test
  public void itAddsResolvedValuesFromAnotherContextObject() {
    Context donor = new Context();
    donor.addResolvedValue(RESOLVED_VALUE);
    donor.addResolvedFunction(RESOLVED_FUNCTION);
    donor.addResolvedExpression(RESOLVED_EXPRESSION);

    assertThat(context.getResolvedValues()).doesNotContain(RESOLVED_VALUE);
    assertThat(context.getResolvedFunctions()).doesNotContain(RESOLVED_FUNCTION);
    assertThat(context.getResolvedExpressions()).doesNotContain(RESOLVED_EXPRESSION);

    context.addResolvedFrom(donor);

    assertThat(context.getResolvedValues()).contains(RESOLVED_VALUE);
    assertThat(context.getResolvedFunctions()).contains(RESOLVED_FUNCTION);
    assertThat(context.getResolvedExpressions()).contains(RESOLVED_EXPRESSION);
  }
}

package com.hubspot.jinjava.interpret;

import static org.assertj.core.api.Assertions.assertThat;

import org.junit.Before;
import org.junit.Test;

public class ContextTest {
  private static final String RESOLVED_EXPRESSION = "exp" ;
  private static final String RESOLVED_FUNCTION = "func" ;
  private static final String RESOLVED_VALUE = "val" ;

  private Context context;

  @Before
  public void setUp() {
    context = new Context();
  }

  @Test
  public void itAddsResolvedValuesFromAnotherContextObject() {
    Context donor = new Context();
    donor.addResolvedValue(RESOLVED_VALUE);
    donor.addResolvedFunction(RESOLVED_FUNCTION);
    donor.addResolvedExpression(RESOLVED_EXPRESSION);

    assertThat(context.getResolvedValues()).doesNotContain(RESOLVED_VALUE);
    assertThat(context.getResolvedFunctions()).doesNotContain(RESOLVED_FUNCTION);
    assertThat(context.getResolvedExpressions()).doesNotContain(RESOLVED_EXPRESSION);

    context.addResolvedFrom(donor);

    assertThat(context.getResolvedValues()).contains(RESOLVED_VALUE);
    assertThat(context.getResolvedFunctions()).contains(RESOLVED_FUNCTION);
    assertThat(context.getResolvedExpressions()).contains(RESOLVED_EXPRESSION);
  }

  @Test
  public void itRecursivelyAddsValuesUpTheContextChain() {
    Context child = new Context(context);
    child.addResolvedExpression(RESOLVED_EXPRESSION);

    assertThat(context.getResolvedExpressions().contains(RESOLVED_EXPRESSION));
  }
}

Add unit test for recursive expressions

Add unit test for recursive expressions


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

package com.google.android.as.oss.fl.federatedcompute.config;

/** Interface to add and override PCS-specific flags. */
public abstract class PcsFcFlags {

  /** Whether to read FC flags from DeviceConfig. */
  public abstract boolean enableDeviceConfigOverrides();

  /** Percentage of messages to be logged. */
  public int logSamplingPercentage() {
    return 0;
  }

  /** Maximum size of serialized atoms logged by PCS. */
  public int maxSerializedAtomSize() {
    return 0;
  }

  /** Whether or not PCS should log error message strings from federated compute. */
  public boolean allowLoggingErrorMessage() {
    return false;
  }

  /** Whether or not SecAggClientLogEvents should be logged. */
  public boolean allowLoggingSecAggClientEvent() {
    return false;
  }

  @Override
  public boolean selectorContextIncludeRunId() {
    return true;
  }
}

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

package com.google.android.as.oss.fl.federatedcompute.config;

/** Interface to add and override PCS-specific flags. */
public abstract class PcsFcFlags {

  /** Whether to read FC flags from DeviceConfig. */
  public abstract boolean enableDeviceConfigOverrides();

  /** Percentage of messages to be logged. */
  public int logSamplingPercentage() {
    return 0;
  }

  /** Maximum size of serialized atoms logged by PCS. */
  public int maxSerializedAtomSize() {
    return 0;
  }

  /** Whether or not PCS should log error message strings from federated compute. */
  public boolean allowLoggingErrorMessage() {
    return false;
  }

  /** Whether or not SecAggClientLogEvents should be logged. */
  public boolean allowLoggingSecAggClientEvent() {
    return false;
  }
}

Delete cleaned up default true selectorContextIncludeRunId flag

PiperOrigin-RevId: 461172350


package org.helioviewer.jhv.data.container;

import java.util.List;

import org.helioviewer.jhv.data.datatype.JHVEvent;

/**
 * Interface should be implemented by a class that handles received events by
 * the JHVEventContainer.
 *
 * @author Bram Bourgoignie (Bram.Bourgoignie)
 */
public interface JHVEventHandler {
    /**
     * New Events were received by the JHVEventContainer.
     *
     * @param eventList
     *            the list of events that were received
     */
    public abstract void newEventsReceived(List<JHVEvent> eventList);
}

package org.helioviewer.jhv.data.container;

import java.util.List;

import org.helioviewer.jhv.data.datatype.JHVEvent;

/**
 * Interface should be implemented by a class that handles received events by
 * the JHVEventContainer.
 *
 * @author Bram Bourgoignie (Bram.Bourgoignie)
 */
public interface JHVEventHandler {
    /**
     * New Events were received by the JHVEventContainer.
     *
     * @param eventList
     *            the list of events that were received
     */
    public abstract void newEventsReceived(List<JHVEvent> eventList);

    /**
     * Informs the JHVEventHandler the cache was changed.
     *
     */
    public abstract void cacheUpdated();
}

Extend the JHVEventHandelr with a cacheUpdate function

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


package sagan.docs.support;

import sagan.projects.Project;
import sagan.projects.support.ProjectMetadataService;
import sagan.support.nav.NavSection;

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

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import static org.springframework.web.bind.annotation.RequestMethod.*;

@Controller
@RequestMapping("/docs")
@NavSection("docs")
class DocsController {

    private ProjectMetadataService service;

    @Autowired
    public DocsController(ProjectMetadataService service) {
        this.service = service;
    }

    @RequestMapping(value = "", method = { GET, HEAD })
    public String listProjects(Model model) {
        model.addAttribute("activeProjects", nonAggregatorsForCategory("active"));
        model.addAttribute("atticProjects", nonAggregatorsForCategory("attic"));
        model.addAttribute("incubatorProjects", nonAggregatorsForCategory("incubator"));
        return "docs/index";
    }

    private List<Project> nonAggregatorsForCategory(String category) {
        return service.getProjectsForCategory(category).stream()
                .filter(project -> !project.isAggregator())
                .sorted((p1, p2) -> p1.getId().compareToIgnoreCase(p2.getId()))
                .collect(Collectors.toList());
    }
}

package sagan.docs.support;

import sagan.projects.Project;
import sagan.projects.support.ProjectMetadataService;
import sagan.support.nav.NavSection;

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

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import static org.springframework.web.bind.annotation.RequestMethod.*;

@Controller
@RequestMapping("/docs")
@NavSection("docs")
class DocsController {

    private ProjectMetadataService service;

    @Autowired
    public DocsController(ProjectMetadataService service) {
        this.service = service;
    }

    @RequestMapping(value = "", method = { GET, HEAD })
    public String listProjects(Model model) {
        model.addAttribute("activeProjects", nonAggregatorsForCategory("active"));
        model.addAttribute("atticProjects", nonAggregatorsForCategory("attic"));
        model.addAttribute("incubatorProjects", nonAggregatorsForCategory("incubator"));
        return "docs/index";
    }

    private List<Project> nonAggregatorsForCategory(String category) {
        return service.getProjectsForCategory(category).stream()
                .filter(project -> !project.isAggregator())
                .sorted((p1, p2) -> p1.getName().compareToIgnoreCase(p2.getName()))
                .collect(Collectors.toList());
    }
}

Sort projects on /docs page by name vs. id

Allows for a more natural, intuitive ordering.

See #367


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

import static com.google.common.truth.Truth.assertThat;

import android.net.Uri;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;

@RunWith(AndroidJUnit4.class)
public final class ParcelablesTest {

  @Test
  public void testForceParcel() throws Exception {
    Uri value = Uri.parse("content://foo/bar");
    Uri newValue = Parcelables.forceParcel(value, Uri.CREATOR);
    assertThat(newValue).isNotSameAs(value);
    assertThat(newValue).isEqualTo(value);
  }
}

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

import static com.google.common.truth.Truth.assertThat;

import android.net.Uri;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;

@RunWith(AndroidJUnit4.class)
public final class ParcelablesTest {

  @Test
  public void testForceParcel() throws Exception {
    Uri value = Uri.parse("content://foo/bar");
    Uri newValue = Parcelables.forceParcel(value, Uri.CREATOR);
    assertThat(newValue).isNotSameInstanceAs(value);
    assertThat(newValue).isEqualTo(value);
  }
}

Migrate from isNotSameAs to isNotSameInstanceAs.

The two behave identically, and isNotSameAs is being removed.

PiperOrigin-RevId: 245310006


package com.github.alexvictoor.proxy;

import java.io.File;

public class FileSystemRoute {

    private final String uriPrefix;
    private final File directory;

    private FileSystemRoute(String uriPrefix, File directory) {
        this.uriPrefix = uriPrefix;
        this.directory = directory;
    }

    public static FileSystemRoute create(String uriPrefix, String path) {
        File directory = new File(path);
        if (!directory.exists() || !directory.canRead() || !directory.isDirectory()) {
            throw new RuntimeException(path + " is not a path to a readable directory");
        }
        return new FileSystemRoute(uriPrefix, directory);
    }

    public static FileSystemRoute parse(String input) {
        String[] tokens = input.split("\\|");
        return create(tokens[0], tokens[1]);
    }

    public File findFile(String uri) {
        if (uri ==null || !uri.startsWith(uriPrefix)) {
            return null;
        }
        String relativePath = uri.substring(uriPrefix.length() + 1).replace('/', File.separatorChar);
        File file = new File(directory, relativePath);
        return file;
    }
}

package com.github.alexvictoor.proxy;

import java.io.File;

public class FileSystemRoute {

    private final String uriPrefix;
    private final File directory;

    private FileSystemRoute(String uriPrefix, File directory) {
        this.uriPrefix = uriPrefix;
        this.directory = directory;
    }

    public static FileSystemRoute create(String uriPrefix, String path) {
        File directory = new File(path);
        if (!directory.exists() || !directory.canRead() || !directory.isDirectory()) {
            throw new RuntimeException(path + " is not a path to a readable directory");
        }
        return new FileSystemRoute(uriPrefix, directory);
    }

    public static FileSystemRoute parse(String input) {
        String[] tokens = input.split("\\|");
        String prefix = tokens[0].trim();
        String path = tokens[1].trim();
        return create(prefix, path);
    }

    public File findFile(String uri) {
        if (uri ==null || !uri.startsWith(uriPrefix)) {
            return null;
        }
        String relativePath = uri.substring(uriPrefix.length() + 1).replace('/', File.separatorChar);
        File file = new File(directory, relativePath);
        return file;
    }
}

Fix conf parsing on linux

Fix conf parsing on linux


package org.mustangproject.ZUGFeRD;

public class CustomXMLProvider implements IXMLProvider {

	protected byte[] zugferdData;

	@Override
	public byte[] getXML() {
		return zugferdData;
	}

	public void setXML(byte[] newData) {
		zugferdData=newData;
	}

	@Override
	public void generateXML(IZUGFeRDExportableTransaction trans) {
		// TODO Auto-generated method stub

	}

	@Override
	public void setTest() {
		// TODO Auto-generated method stub

	}

}

package org.mustangproject.ZUGFeRD;

public class CustomXMLProvider implements IXMLProvider {

	protected byte[] zugferdData;

	@Override
	public byte[] getXML() {
		return zugferdData;
	}

	public void setXML(byte[] newData) {
		String zf=new String(newData);
		if (!zf.contains("<rsm:CrossIndustry")) {
			throw new RuntimeException("ZUGFeRD XML does not contain <rsm:CrossIndustry and can thus not be valid");
		}

		zugferdData=newData;
	}

	@Override
	public void generateXML(IZUGFeRDExportableTransaction trans) {
		// TODO Auto-generated method stub

	}

	@Override
	public void setTest() {
		// TODO Auto-generated method stub

	}

}

Make sure custom XML provided by some anonymous developer is at least halfway valid ;-)


package se.jaitco.queueticketapi.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import se.jaitco.queueticketapi.model.Roles;
import se.jaitco.queueticketapi.model.User;

import java.util.Arrays;
import java.util.Optional;

@Slf4j
@Component
public class UserService {

    public Optional<User> getUser(String username) {
        Optional<User> user = Optional.empty();
        if ("Aschan".equals(username)) {
            User aschan = User.builder()
                    .username("Aschan")
                    .password("Fotboll")
                    .grantedRoles(Arrays.asList(Roles.CUSTOMER, Roles.ADMIN))
                    .build();
            user = Optional.of(aschan);
        } else if ("Lmar".equals(username)) {
            User lmar = User.builder()
                    .username("Lmar")
                    .password("Book")
                    .grantedRoles(Arrays.asList(Roles.ADMIN))
                    .build();
            user = Optional.of(lmar);
        }
        return user;
    }
}

package se.jaitco.queueticketapi.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import se.jaitco.queueticketapi.model.Roles;
import se.jaitco.queueticketapi.model.User;

import java.util.Arrays;
import java.util.Optional;

@Slf4j
@Component
public class UserService {

    public Optional<User> getUser(String username) {
        Optional<User> user = Optional.empty();
        if ("Aschan".equals(username)) {
            User aschan = User.builder()
                    .username("Aschan")
                    .password("{noop}Fotboll")
                    .grantedRoles(Arrays.asList(Roles.CUSTOMER, Roles.ADMIN))
                    .build();
            user = Optional.of(aschan);
        } else if ("Lmar".equals(username)) {
            User lmar = User.builder()
                    .username("Lmar")
                    .password("{noop}Book")
                    .grantedRoles(Arrays.asList(Roles.ADMIN))
                    .build();
            user = Optional.of(lmar);
        }
        return user;
    }
}

Upgrade to spring boot 2 and java 9

Upgrade to spring boot 2 and java 9


package arez.integration;

import arez.annotations.ArezComponent;
import arez.annotations.Feature;
import arez.annotations.Observable;
import java.lang.reflect.Modifier;
import javax.annotation.Nonnull;
import org.testng.annotations.Test;
import static org.testng.Assert.*;

public class TypeVisibilityTest
  extends AbstractArezIntegrationTest
{
  @ArezComponent( dagger = Feature.ENABLE )
  public static abstract class PersonModel
  {
    PersonModel()
    {
    }

    @Observable
    @Nonnull
    String getFirstName()
    {
      return "";
    }

    void setFirstName( @Nonnull final String firstName )
    {
    }
  }

  @ArezComponent( dagger = Feature.ENABLE )
  public static abstract class PersonModel2
  {
    @Observable
    @Nonnull
    String getFirstName()
    {
      return "";
    }

    void setFirstName( @Nonnull final String firstName )
    {
    }
  }

  @Test
  public void typeVisibilities()
  {
    assertFalse( Modifier.isPublic( TypeVisibilityTest_Arez_PersonModel.class.getModifiers() ) );
    assertTrue( Modifier.isPublic( TypeVisibilityTest_Arez_PersonModel2.class.getModifiers() ) );
    assertTrue( Modifier.isPublic( TypeVisibilityTest_PersonModelDaggerModule.class.getModifiers() ) );
    assertTrue( Modifier.isPublic( TypeVisibilityTest_PersonModel2DaggerModule.class.getModifiers() ) );
  }
}

package arez.integration;

import arez.annotations.ArezComponent;
import arez.annotations.Feature;
import arez.annotations.Observable;
import java.lang.reflect.Modifier;
import javax.annotation.Nonnull;
import org.testng.annotations.Test;
import static org.testng.Assert.*;

public class TypeVisibilityTest
  extends AbstractArezIntegrationTest
{
  @ArezComponent( dagger = Feature.ENABLE )
  public static abstract class PersonModel
  {
    PersonModel()
    {
    }

    @Observable
    @Nonnull
    String getFirstName()
    {
      return "";
    }

    void setFirstName( @Nonnull final String firstName )
    {
    }
  }

  @ArezComponent( dagger = Feature.ENABLE )
  public static abstract class PersonModel2
  {
    @Observable
    @Nonnull
    String getFirstName()
    {
      return "";
    }

    void setFirstName( @Nonnull final String firstName )
    {
    }
  }

  @Test
  public void typeVisibilities()
  {
    assertFalse( Modifier.isPublic( TypeVisibilityTest_Arez_PersonModel.class.getModifiers() ) );
    assertFalse( Modifier.isPublic( TypeVisibilityTest_Arez_PersonModel2.class.getModifiers() ) );
    assertTrue( Modifier.isPublic( TypeVisibilityTest_PersonModelDaggerModule.class.getModifiers() ) );
    assertTrue( Modifier.isPublic( TypeVisibilityTest_PersonModel2DaggerModule.class.getModifiers() ) );
  }
}

Fix test to reflect chages in the library


package edu.northwestern.bioinformatics.studycalendar.dao;

import org.springframework.transaction.annotation.Transactional;
import edu.northwestern.bioinformatics.studycalendar.domain.Study;
import edu.northwestern.bioinformatics.studycalendar.domain.StudyParticipantAssignment;

import java.util.List;

/**
 * @author Rhett Sutphin
 */
@Transactional(readOnly = true)
public class StudyDao extends StudyCalendarGridIdentifiableDao<Study> {
    public Class<Study> domainClass() {
        return Study.class;
    }

    @Transactional(readOnly = false)
    public void save(Study study) {
        getHibernateTemplate().saveOrUpdate(study);
    }

    public List<Study> getAll() {
        return getHibernateTemplate().find("from Study");
    }

    public List<StudyParticipantAssignment> getAssignmentsForStudy(Integer studyId) {
        return getHibernateTemplate().find(
            "select a from StudyParticipantAssignment a inner join a.studySite ss inner join a.participant p where ss.study.id = ? order by p.lastName, p.firstName",
            studyId);
    }

    public Study getById(int id) {
        return (Study) getHibernateTemplate().get(Study.class, new Integer(id));
    }
}

package edu.northwestern.bioinformatics.studycalendar.dao;

import org.springframework.transaction.annotation.Transactional;
import edu.northwestern.bioinformatics.studycalendar.domain.Study;
import edu.northwestern.bioinformatics.studycalendar.domain.StudyParticipantAssignment;

import java.util.List;

/**
 * @author Rhett Sutphin
 */
@Transactional(readOnly = true)
public class StudyDao extends StudyCalendarGridIdentifiableDao<Study> {
    @Override
    public Class<Study> domainClass() {
        return Study.class;
    }

    @Transactional(readOnly = false)
    public void save(Study study) {
        getHibernateTemplate().saveOrUpdate(study);
    }

    @SuppressWarnings({ "unchecked" })
    public List<Study> getAll() {
        return getHibernateTemplate().find("from Study");
    }

    @SuppressWarnings({ "unchecked" })
    public List<StudyParticipantAssignment> getAssignmentsForStudy(Integer studyId) {
        return getHibernateTemplate().find(
            "select a from StudyParticipantAssignment a inner join a.studySite ss inner join a.participant p where ss.study.id = ? order by p.lastName, p.firstName",
            studyId);
    }
}

Remove unnecessary override of getById

Remove unnecessary override of getById


package net.md_5.bungee.api.event;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import net.md_5.bungee.api.connection.Connection;
import net.md_5.bungee.api.plugin.Cancellable;

/**
 * Event called when a player sends a message to a server, or a server sends a
 * message to a player.
 */
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class ChatEvent extends TargetedEvent implements Cancellable
{

    /**
     * Cancelled state.
     */
    private boolean cancelled;
    /**
     * Text contained in this chat.
     */
    private String message;

    public ChatEvent(Connection sender, Connection receiver, String message)
    {
        super( sender, receiver );
        this.message = message;
    }

    /**
     * Checks whether this message is valid as a command
     *
     * @return if this message is a command
     */
    public boolean isCommand()
    {
        return message.charAt( 0 ) == '/';
    }
}

package net.md_5.bungee.api.event;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import net.md_5.bungee.api.connection.Connection;
import net.md_5.bungee.api.plugin.Cancellable;

/**
 * Event called when a player sends a message to a server, or a server sends a
 * message to a player.
 */
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class ChatEvent extends TargetedEvent implements Cancellable
{

    /**
     * Cancelled state.
     */
    private boolean cancelled;
    /**
     * Text contained in this chat.
     */
    private String message;

    public ChatEvent(Connection sender, Connection receiver, String message)
    {
        super( sender, receiver );
        this.message = message;
    }

    /**
     * Checks whether this message is valid as a command
     *
     * @return if this message is a command
     */
    public boolean isCommand()
    {
        return message.length() > 0 && message.charAt( 0 ) == '/';
    }
}

Check length before checking if command.


package totemic_commons.pokefenn.event;

import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import totemic_commons.pokefenn.ModBlocks;
import totemic_commons.pokefenn.block.tipi.BlockTipi;

/**
 * Created by Pokefenn.
 * Licensed under MIT (If this is one of my Mods)
 */
public class EntityRightClick
{

    @SubscribeEvent
    public void entityInteracti(PlayerInteractEvent event)
    {
        if(event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK)
        {
            Block block = event.world.getBlock(event.x, event.y, event.z);
            if(block != null)
            {
                if(block.getMaterial() == Material.ground || block.getUnlocalizedName().contains("dirt") || block.getUnlocalizedName().contains("grass"))
                {
                    if(event.world.getBlock(event.x, event.y + 1, event.z) == ModBlocks.tipi)
                    {
                        ((BlockTipi) event.world.getBlock(event.x, event.y + 1, event.z)).tipiSleep(event.world, event.x, event.y + 1, event.z, event.entityPlayer);
                    }
                }
            }
        }
    }
}

package totemic_commons.pokefenn.event;

import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import totemic_commons.pokefenn.ModBlocks;
import totemic_commons.pokefenn.block.tipi.BlockTipi;

/**
 * Created by Pokefenn.
 * Licensed under MIT (If this is one of my Mods)
 */
public class EntityRightClick
{

    @SubscribeEvent
    public void entityInteracti(PlayerInteractEvent event)
    {
        if(event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK)
        {
            if(event.world.getBlock(event.x, event.y + 1, event.z) == ModBlocks.tipi)
            {
                Block block = event.world.getBlock(event.x, event.y, event.z);
                if(block != null)
                {
                    if(block.getMaterial() == Material.ground || block.getUnlocalizedName().contains("dirt") || block.getUnlocalizedName().contains("grass"))
                    {
                        ((BlockTipi)ModBlocks.tipi).tipiSleep(event.world, event.x, event.y + 1, event.z, event.entityPlayer);
                    }
                }
            }
        }
    }
}

Change order of checks on Tipi PlayerInteractEvent


package cvut.fit.borrowsystem.web.API;

import cvut.fit.borrowsystem.service.UserManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Created by Jakub Tuček on 11.6.2016.
 */
public class UserRestController {
    private static final Logger log = LoggerFactory.getLogger(UserRestController.class);

    @Autowired
    UserManager userManager;

}

package cvut.fit.borrowsystem.web.API;

import cvut.fit.borrowsystem.service.UserManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by Jakub Tuček on 11.6.2016.
 */

@RestController
@RequestMapping("/api/users")
public class UserRestController {
    private static final Logger log = LoggerFactory.getLogger(UserRestController.class);

    @Autowired
    UserManager userManager;

}

Add user rest api controller annotation

Add user rest api controller annotation