/*
 * Copyright (C) 2008 XStream Committers.
 * All rights reserved.
 *
 * The software in this package is published under the terms of the BSD
 * style license a copy of which has been included with this distribution in
 * the LICENSE.txt file.
 *
 * Created on 13. October 2008 by Joerg Schaible
 */
package com.thoughtworks.xstream.core.util;

public final class FastField {
    private final String name;
    private final Class declaringClass;

    public FastField(Class definedIn, String name) {
        this.name = name;
        this.declaringClass = definedIn;
    }

    public String getName() {
        return this.name;
    }

    public Class getDeclaringClass() {
        return this.declaringClass;
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (this == null) {
            return false;
        }
        if (obj.getClass() == FastField.class) {
            final FastField field = (FastField)obj;
            return name.equals(field.getName())
                && declaringClass.equals(field.getDeclaringClass());
        }
        return false;
    }

    public int hashCode() {
        return name.hashCode() ^ declaringClass.hashCode();
    }

    public String toString() {
        return declaringClass.getName() + "[" + name + "]";
    }
}

/*
 * Copyright (C) 2008, 2010 XStream Committers.
 * All rights reserved.
 *
 * The software in this package is published under the terms of the BSD
 * style license a copy of which has been included with this distribution in
 * the LICENSE.txt file.
 *
 * Created on 13. October 2008 by Joerg Schaible
 */
package com.thoughtworks.xstream.core.util;

public final class FastField {
    private final String name;
    private final Class declaringClass;

    public FastField(Class definedIn, String name) {
        this.name = name;
        this.declaringClass = definedIn;
    }

    public String getName() {
        return this.name;
    }

    public Class getDeclaringClass() {
        return this.declaringClass;
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (this == null) {
            return false;
        }
        if (obj.getClass() == FastField.class) {
            final FastField field = (FastField)obj;
            if ((declaringClass == null && field.declaringClass != null)
                || (declaringClass != null && field.declaringClass == null)) {
                return false;
            }
            return name.equals(field.getName())
                && (declaringClass == null || declaringClass.equals(field.getDeclaringClass()));
        }
        return false;
    }

    public int hashCode() {
        return name.hashCode() ^ (declaringClass == null ? 0 : declaringClass.hashCode());
    }

    public String toString() {
        return (declaringClass == null ? "" : declaringClass.getName() + ".") + name;
    }
}

Allow null as defining class.

Allow null as defining class.

git-svn-id: fe6d842192ccfb78748eb71580d1ce65f168b559@1736 9830eeb5-ddf4-0310-9ef7-f4b9a3e3227e


package net.honeybadgerlabs.adventurequest;

import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.GridView;
import android.widget.TextView;

public class ProfileFragment extends Fragment {
  private GridView listView;
  private TextView button;
  private StatAdapter adapter;

  @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.profile, container, false);

    listView = (GridView) view.findViewById(R.id.attribute_list);
    button = (TextView) view.findViewById(R.id.spend_points);

    return view;
  }

  @Override public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    adapter = ((TitleActivity) getActivity()).getStatAdapter();
    listView.setAdapter(adapter);
    updateButton();
  }

  public void updateButton() {
    try {
      int points = ((TitleActivity) getActivity()).getCharLevel() - adapter.totalPoints() - 1;

      if (points > 0) {
        String message = getResources().getQuantityString(R.plurals.points, points, points);
        button.setText(message);
        button.setVisibility(View.VISIBLE);
      } else {
        button.setVisibility(View.GONE);
      }
    } catch (NullPointerException e) {
    }
  }
}

package net.honeybadgerlabs.adventurequest;

import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.GridView;
import android.widget.TextView;

public class ProfileFragment extends Fragment {
  private GridView listView;
  private TextView button;
  private StatAdapter adapter;

  @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.profile, container, false);

    listView = (GridView) view.findViewById(R.id.attribute_list);
    button = (TextView) view.findViewById(R.id.spend_points);

    return view;
  }

  @Override public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    adapter = ((TitleActivity) getActivity()).getStatAdapter();
    listView.setAdapter(adapter);
    updateButton();
  }

  public void updateButton() {
    TitleActivity activity = (TitleActivity) getActivity();

    if (activity != null) {
      int points = ((TitleActivity) getActivity()).getCharLevel() - adapter.totalPoints() - 1;

      if (points > 0) {
        String message = getResources().getQuantityString(R.plurals.points, points, points);
        button.setText(message);
        button.setVisibility(View.VISIBLE);
      } else {
        button.setVisibility(View.GONE);
      }
    }
  }
}

Fix issue with updating button before activity loaded


package com.hubspot.jinjava.lib.tag;

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

import com.hubspot.jinjava.BaseInterpretingTest;
import org.junit.Test;

public class CycleTagTest extends BaseInterpretingTest {

  @Test
  public void itDefaultsNullToImage() {
    String template = "{% for item in [0,1] %}{% cycle {{item}} %}{% endfor %}";
    assertThat(interpreter.render(template)).isEqualTo("{{item}}{{item}}");
  }
}

package com.hubspot.jinjava.lib.tag;

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

import com.hubspot.jinjava.BaseInterpretingTest;
import org.junit.Test;

public class CycleTagTest extends BaseInterpretingTest {

  @Test
  public void itDefaultsNullToImage() {
    String template = "{% for item in [0,1] %}{% cycle {{item}} %}{% endfor %}";
    assertThat(interpreter.render(template)).isEqualTo("{{item}}{{item}}");
  }

  @Test
  public void itDefaultsMultipleNullToImage() {
    String template = "{% for item in [0,1] %}{% cycle {{foo}},{{bar}} %}{% endfor %}";
    assertThat(interpreter.render(template)).isEqualTo("{{foo}}{{bar}}");
  }

  @Test
  public void itDefaultsNullToImageUsingAs() {
    String template =
      "{% for item in [0,1] %}{% cycle {{item}} as var %}{% cycle var %}{% endfor %}";
    assertThat(interpreter.render(template)).isEqualTo("{{item}}{{item}}");
  }

  @Test
  public void itDefaultsMultipleNullToImageUsingAs() {
    String template =
      "{% for item in [0,1] %}{% cycle {{foo}},{{bar}} as var %}{% cycle var %}{% endfor %}";
    assertThat(interpreter.render(template)).isEqualTo("{{foo}}{{bar}}");
  }
}

Add more null handling cycle tag tests

Add more null handling cycle tag tests


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

//
// This source code implements specifications defined by the Java
// Community Process. In order to remain compliant with the specification
// DO NOT add / change / or delete method signatures!
//

package javax.persistence;

public interface TupleElement<X> {
    Class<X> getJavaType();

    String getAlias();
}

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

//
// This source code implements specifications defined by the Java
// Community Process. In order to remain compliant with the specification
// DO NOT add / change / or delete method signatures!
//

package javax.persistence;

public interface TupleElement<X> {
    Class<? extends X> getJavaType();

    String getAlias();
}

Update Geronimo JPA 2.0 specs EA7

Update Geronimo JPA 2.0 specs EA7

git-svn-id: 60e751271f50ec028ae56d425821c1c711e0b018@807373 13f79535-47bb-0310-9956-ffa450edef68


package fr.neamar.kiss.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

class DB extends SQLiteOpenHelper {

    private final static int DB_VERSION = 1;
    private final static String DB_NAME = "summon.s3db";

    public DB(Context context) {
        super(context, DB_NAME, null, DB_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase database) {
        database.execSQL("CREATE TABLE history ( _id INTEGER PRIMARY KEY AUTOINCREMENT, query TEXT NOT NULL, record TEXT NOT NULL)");
    }

    @Override
    public void onUpgrade(SQLiteDatabase arg0, int arg1, int arg2) {
        // See
        // http://www.drdobbs.com/database/using-sqlite-on-android/232900584
    }
}

package fr.neamar.kiss.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

class DB extends SQLiteOpenHelper {

    private final static int DB_VERSION = 1;
    private final static String DB_NAME = "kiss.s3db";

    public DB(Context context) {
        super(context, DB_NAME, null, DB_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase database) {
        database.execSQL("CREATE TABLE history ( _id INTEGER PRIMARY KEY AUTOINCREMENT, query TEXT, record TEXT NOT NULL)");
    }

    @Override
    public void onUpgrade(SQLiteDatabase arg0, int arg1, int arg2) {
        // See
        // http://www.drdobbs.com/database/using-sqlite-on-android/232900584
    }
}

Store empty queries in history

Store empty queries in history


package at.ac.tuwien.inso.service;

import at.ac.tuwien.inso.entity.Semester;
import at.ac.tuwien.inso.repository.SemesterRepository;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class SemesterService {

    @Autowired
    private SemesterRepository semesterRepository;

    public Semester getCurrentSemester() {
        return semesterRepository.findFirstByOrderByIdDesc();
    }

    public Iterable<Semester> getAllSemesters() {
        return semesterRepository.findAllByOrderByIdDesc();
    }
}

package at.ac.tuwien.inso.service;

import at.ac.tuwien.inso.entity.Semester;
import at.ac.tuwien.inso.repository.SemesterRepository;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class SemesterService {

    @Autowired
    private SemesterRepository semesterRepository;

    public Semester create(Semester semester) {
        return semesterRepository.save(semester);
    }

    public Semester getCurrentSemester() {
        return semesterRepository.findFirstByOrderByIdDesc();
    }

    public Iterable<Semester> getAllSemesters() {
        return semesterRepository.findAllByOrderByIdDesc();
    }
}

Add create() to semeser service

Add create() to semeser service


/*
       Licensed to the Apache Software Foundation (ASF) under one
       or more contributor license agreements.  See the NOTICE file
       distributed with this work for additional information
       regarding copyright ownership.  The ASF licenses this file
       to you under the Apache License, Version 2.0 (the
       "License"); you may not use this file except in compliance
       with the License.  You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0

       Unless required by applicable law or agreed to in writing,
       software distributed under the License is distributed on an
       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
       KIND, either express or implied.  See the License for the
       specific language governing permissions and limitations
       under the License.
 */

package __ID__;

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

public class __ACTIVITY__ extends DroidGap
{
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        Config.init(this);
        super.loadUrl("file:///android_asset/www/index.html");
    }
}

/*
       Licensed to the Apache Software Foundation (ASF) under one
       or more contributor license agreements.  See the NOTICE file
       distributed with this work for additional information
       regarding copyright ownership.  The ASF licenses this file
       to you under the Apache License, Version 2.0 (the
       "License"); you may not use this file except in compliance
       with the License.  You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0

       Unless required by applicable law or agreed to in writing,
       software distributed under the License is distributed on an
       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
       KIND, either express or implied.  See the License for the
       specific language governing permissions and limitations
       under the License.
 */

package __ID__;

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

public class __ACTIVITY__ extends DroidGap
{
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        Config.init(this);
        super.loadUrl(Config.getStartUrl());
        //super.loadUrl("file:///android_asset/www/index.html")
    }
}

Add configurable start location to config.xml and template

Still possible to hardcode, there's a comment in the template showing
how that can be done.


package com.conveyal.geom2gtfs;

import org.onebusaway.gtfs.model.AgencyAndId;
import org.onebusaway.gtfs.model.Stop;

import com.vividsolutions.jts.geom.Coordinate;

import java.util.concurrent.atomic.AtomicInteger;

public class ProtoRouteStop {
        // TODO: this is kind of hacky, we should really be using a separate ID space for each feed.
        private AtomicInteger createdStopId = new AtomicInteger();

        public ProtoRouteStop (Coordinate coord, double dist) {
            this.coord = coord;
            this.dist = dist;
            this.stop = new Stop();
            stop.setLat(coord.y);
            stop.setLon(coord.x);
            int stopId = createdStopId.incrementAndGet();
            stop.setName("Stop " + stopId);
            stop.setId(new AgencyAndId(Main.DEFAULT_AGENCY_ID, "created_stop_" + stopId));
        }

        public ProtoRouteStop (Stop stop, double dist) {
            this.stop = stop;
            this.coord = new Coordinate(stop.getLon(), stop.getLat());
            this.dist = dist;
        }

	public Coordinate coord;
	public double dist;
	public Stop stop;
}

package com.conveyal.geom2gtfs;

import org.onebusaway.gtfs.model.AgencyAndId;
import org.onebusaway.gtfs.model.Stop;

import com.vividsolutions.jts.geom.Coordinate;

import java.util.concurrent.atomic.AtomicInteger;

public class ProtoRouteStop {
        // TODO: this is kind of hacky, we should really be using a separate ID space for each feed.
        private static AtomicInteger createdStopId = new AtomicInteger();

        public ProtoRouteStop (Coordinate coord, double dist) {
            this.coord = coord;
            this.dist = dist;
            this.stop = new Stop();
            stop.setLat(coord.y);
            stop.setLon(coord.x);
            int stopId = createdStopId.incrementAndGet();
            stop.setName("Stop " + stopId);
            stop.setId(new AgencyAndId(Main.DEFAULT_AGENCY_ID, "created_stop_" + stopId));
        }

        public ProtoRouteStop (Stop stop, double dist) {
            this.stop = stop;
            this.coord = new Coordinate(stop.getLon(), stop.getLat());
            this.dist = dist;
        }

	public Coordinate coord;
	public double dist;
	public Stop stop;
}

Make sure stops get unique IDs.

Make sure stops get unique IDs.


package com.decentralizeddatabase.reno;

import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.spec.SecretKeySpec;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.NoSuchAlgorithmException;

/*Initialize and use this class to deal with block encryption and decryption*/
public class CryptoBlock {

    private Cipher cipher;

    public CryptoBlock() throws NoSuchPaddingException, NoSuchAlgorithmException {
        this.cipher = Cipher.getInstance("AES");
    }

    /*
        Inputs: String (data block), String (16 byte secret key)
        Outputs: byte[] (encrypted data block)
     */
    public byte[] encrypt(String block, String key) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException {
        Key aesKey = new SecretKeySpec(key.getBytes(), "AES");
        cipher.init(Cipher.ENCRYPT_MODE, aesKey);
        byte[] encrypted = cipher.doFinal(block.getBytes());
        return encrypted;
    }

    /*
        Inputs: byte[] (encrypted data block), String (16 byte secret key)
        Outputs: String (decrypted data block)
     */
    public String decrypt(byte[] block, String key) throws InvalidKeyException, BadPaddingException, IllegalBlockSizeException {
        Key aesKey = new SecretKeySpec(key.getBytes(), "AES");
        cipher.init(Cipher.DECRYPT_MODE, aesKey);
        String decrypted = new String(cipher.doFinal(block));
        return decrypted;
    }
}

package com.decentralizeddatabase.reno;

import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.spec.SecretKeySpec;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.NoSuchAlgorithmException;

public class CryptoBlock {

    private final Cipher cipher;

    public CryptoBlock() throws NoSuchPaddingException, NoSuchAlgorithmException {
        this.cipher = Cipher.getInstance("AES");
    }

    /**
     *  Inputs: String (data block), String (16 byte secret key)
     *  Outputs: byte[] (encrypted data block)
     */
    public byte[] encrypt(final byte[] block, final String key) throws NoSuchPaddingException,
							   NoSuchAlgorithmException,
							   InvalidKeyException,
							   BadPaddingException,
							   IllegalBlockSizeException {
        final Key aesKey = new SecretKeySpec(key.getBytes(), "AES");
        cipher.init(Cipher.ENCRYPT_MODE, aesKey);
        final byte[] encrypted = cipher.doFinal(block);
        return encrypted;
    }

    /**
     *   Inputs: byte[] (encrypted data block), String (16 byte secret key)
     *   Outputs: String (decrypted data block)
     */
    public String decrypt(final byte[] block, final String key) throws InvalidKeyException,
							   BadPaddingException,
							   IllegalBlockSizeException {
        Key aesKey = new SecretKeySpec(key.getBytes(), "AES");
        cipher.init(Cipher.DECRYPT_MODE, aesKey);
        String decrypted = new String(cipher.doFinal(block));
        return decrypted;
    }
}

Change encrypt to use byte array

Change encrypt to use byte array

Also cleaned up some code


package pl.com.chodera.myweather.common;

/**
 * Created by Adam Chodera on 2016-03-15.
 */
public class Commons {

    public static final String BASE_URL = "http://api.openweathermap.org/data/2.5/";

    public static final String OPEN_WEATHER_APP_ID = "6fc006e6b8cbdd1bc3fa490b467a1692";

    public static final int CHART_NUMBER_OF_X_VALUES = 8;

    public static final String PASCAL_UNIT = "hPa";

    public interface Chars {

        char SPACE = ' ';
        char COLON = ':';
        String NEW_LINE = System.getProperty("line.separator");
        char PLUS = '+';
        char H = 'h';
        char CELSIUS_UNIT = 'C';
        char PERCENT = '%';
    }

    public interface IntentKeys {

        String LOCATION_NAME = "key_ADVERTISEMENT";
    }

    public interface Animations {

        int DRAW_CHART_DATA = 1800;
    }
}

package pl.com.chodera.myweather.common;

/**
 * Created by Adam Chodera on 2016-03-15.
 */
public interface Commons {

    String BASE_URL = "http://api.openweathermap.org/data/2.5/";

    String OPEN_WEATHER_APP_ID = "6fc006e6b8cbdd1bc3fa490b467a1692";

    int CHART_NUMBER_OF_X_VALUES = 8;

    String PASCAL_UNIT = "hPa";

    interface Chars {

        char SPACE = ' ';
        char COLON = ':';
        String NEW_LINE = System.getProperty("line.separator");
        char PLUS = '+';
        char H = 'h';
        char CELSIUS_UNIT = 'C';
        char PERCENT = '%';
    }

    interface IntentKeys {

        String LOCATION_NAME = "key_ADVERTISEMENT";
    }

    interface Animations {

        int DRAW_CHART_DATA = 1800;
    }
}

Change class with static variables into interface


import java.lang.System;

public class Test {
        static {
                System.loadLibrary("react_render");
        }

        public static void main(String[] args) {
                System.out.println("Hello, Java!");

                react_render.set_debug(1);
                react_render.initialize("../bundle.js");
                react_render.render_path("Homepage");
        }
}

import java.lang.System;

public class Test {
        static {
                System.loadLibrary("react_render");
        }

        public static void main(String[] args) {
                System.out.println("Hello, Java!");

                react_render.set_debug(1);
                react_render.initialize("../bundle.js");
                react_render.render_path("/");
        }
}

Fix Java testcase to work

Fix Java testcase to work


package beaform.gui.main;

import java.awt.BorderLayout;
import java.awt.Component;

import javax.swing.JPanel;
import javax.swing.JScrollPane;

import beaform.gui.debug.DebugUtilities;

/**
 * This class represents the main panel where all views will work in.
 *
 * @author Steven Post
 *
 */
public final class MainPanel extends JPanel {

	private static final long serialVersionUID = 1207348877338520359L;

	/** An inner panel for the actual content */
	private final JPanel panel = new JPanel(new BorderLayout());
	private final JScrollPane scrollPane = new JScrollPane(this.panel);

	public MainPanel() {
		super(new BorderLayout());
		this.add(this.scrollPane);
	}

	public void replaceActiveWindow(final Component comp) {
		if (this.panel.getComponentCount() > 0) {
			this.panel.remove(0);
		}
		this.panel.add(comp);
		this.panel.revalidate();
	}

	public void enableDebugBorders() {
		DebugUtilities.drawBorders(this.panel);
	}

}

package beaform.gui.main;

import java.awt.BorderLayout;
import java.awt.Component;

import javax.swing.JPanel;
import javax.swing.JScrollPane;

import beaform.gui.InterchangableWindowDisplayer;
import beaform.gui.debug.DebugUtilities;

/**
 * This class represents the main panel where all views will work in.
 *
 * @author Steven Post
 *
 */
public final class MainPanel extends JPanel implements InterchangableWindowDisplayer {

	private static final long serialVersionUID = 1207348877338520359L;

	/** An inner panel for the actual content */
	private final JPanel panel = new JPanel(new BorderLayout());
	private final JScrollPane scrollPane = new JScrollPane(this.panel);

	public MainPanel() {
		super(new BorderLayout());
		this.add(this.scrollPane);
	}

	@Override
	public void replaceActiveWindow(final Component comp) {
		if (this.panel.getComponentCount() > 0) {
			this.panel.remove(0);
		}
		this.panel.add(comp);
		this.panel.revalidate();
	}

	public void enableDebugBorders() {
		DebugUtilities.drawBorders(this.panel);
	}

}

Implement the ICWD interface in the main panel


package de.centerdevice.classcleaner.core.model;

public class CodeReference {

	private CodeElement src;
	private CodeElement dst;

	public CodeReference(CodeElement src, CodeElement dst) {
		this.src = src;
		this.dst = dst;
	}

	public CodeElement getDestination() {
		return dst;
	}

	public CodeElement getSource() {
		return src;
	}

	@Override
	public String toString() {
		return getClassNameWithFallback(src) + " -> " + getClassNameWithFallback(dst);
	}

	protected String getClassNameWithFallback(CodeElement element) {
		if (element == null) {
			return "none";
		}
		return element.getClassName();
	}
}

package de.centerdevice.classcleaner.core.model;

public class CodeReference {

	private final CodeElement src;
	private final CodeElement dst;

	public CodeReference(CodeElement src, CodeElement dst) {
		this.src = src;
		this.dst = dst;
	}

	public CodeElement getDestination() {
		return dst;
	}

	public CodeElement getSource() {
		return src;
	}

	@Override
	public String toString() {
		return getClassNameWithFallback(src) + " -> " + getClassNameWithFallback(dst);
	}

	protected String getClassNameWithFallback(CodeElement element) {
		if (element == null) {
			return "none";
		}
		return element.toString();
	}
}

Return full names of references in toString


package test.ccn.security.access;

import java.util.SortedSet;

import junit.framework.Assert;

import org.junit.BeforeClass;
import org.junit.Test;

import com.parc.ccn.data.ContentName;
import com.parc.ccn.library.CCNLibrary;
import com.parc.ccn.library.EnumeratedNameList;
import com.parc.ccn.library.io.repo.RepositoryOutputStream;

public class SampleTestRepo {
	static final String base = "/parc.com/csl/ccn/repositories";
	static final String file_name = "simon.txt";
	static final String txt =  "Sample text file from Simon.";
	static final String UTF8 = "UTF-8";

	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
		ContentName name = ContentName.fromNative(base + "/" + file_name);
		RepositoryOutputStream os = new RepositoryOutputStream(name, CCNLibrary.getLibrary());

		os.write(txt.getBytes(UTF8));
		os.close();
	}

	@Test
	public void readWrite() throws Exception {
		EnumeratedNameList l = new EnumeratedNameList(ContentName.fromNative(base), null);
		SortedSet<ContentName> r = l.getNewData();
		Assert.assertNotNull(r);
		Assert.assertEquals(1, r.size());
		Assert.assertEquals(file_name.getBytes(UTF8), r.first().lastComponent());
	}
}

package test.ccn.security.access;

import java.util.SortedSet;

import junit.framework.Assert;

import org.junit.BeforeClass;
import org.junit.Test;

import com.parc.ccn.data.ContentName;
import com.parc.ccn.library.CCNLibrary;
import com.parc.ccn.library.EnumeratedNameList;
import com.parc.ccn.library.io.repo.RepositoryOutputStream;

public class SampleTestRepo {
	static final String base = "/parc.com/csl/ccn/repositories/SampleTestRepo";
	static final String file_name = "simon.txt";
	static final String txt =  "Sample text file from Simon.";
	static final String UTF8 = "UTF-8";

	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
		ContentName name = ContentName.fromNative(base + "/" + file_name);
		RepositoryOutputStream os = new RepositoryOutputStream(name, CCNLibrary.getLibrary());

		os.write(txt.getBytes(UTF8));
		os.close();
	}

	@Test
	public void readWrite() throws Exception {
		EnumeratedNameList l = new EnumeratedNameList(ContentName.fromNative(base), null);
		SortedSet<ContentName> r = l.getNewData();
		Assert.assertNotNull(r);
		Assert.assertEquals(1, r.size());
		Assert.assertEquals(file_name.getBytes(UTF8), r.first().lastComponent());
	}
}

Make name more specific to avoid clash in repo


package net.openhft.chronicle.wire;

import net.openhft.chronicle.bytes.Bytes;
import net.openhft.chronicle.bytes.BytesUtil;
import org.junit.Test;

import java.io.IOException;

import static junit.framework.TestCase.assertFalse;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

interface MockMethods {
    void method1(MockDto dto);

    void method2(MockDto dto);
}

/**
 * Created by peter on 17/05/2017.
 */
public class MethodReaderTest {
    @Test
    public void readMethods() throws IOException {
        Wire wire = new TextWire(BytesUtil.readFile("methods-in.yaml"));
        Wire wire2 = new TextWire(Bytes.allocateElasticDirect());
        // expected
        Bytes expected = BytesUtil.readFile("methods-in.yaml");
        MockMethods writer = wire2.methodWriter(MockMethods.class);
        MethodReader reader = wire.methodReader(writer);
        for (int i = 0; i < 2; i++) {
            assertTrue(reader.readOne());
            while (wire2.bytes().peekUnsignedByte(wire2.bytes().writePosition() - 1) == ' ')
                wire2.bytes().writeSkip(-1);
            wire2.bytes().append("---\n");
        }
        assertFalse(reader.readOne());
        assertEquals(expected.toString().trim().replace("\r", ""), wire2.toString().trim());
    }
}

class MockDto extends AbstractMarshallable {
    String field1;
    double field2;
}

package net.openhft.chronicle.wire;

import net.openhft.chronicle.bytes.Bytes;
import net.openhft.chronicle.bytes.BytesUtil;
import org.junit.Test;

import java.io.IOException;

import static junit.framework.TestCase.assertFalse;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

interface MockMethods {
    void method1(MockDto dto);

    void method2(MockDto dto);
}

/**
 * Created by peter on 17/05/2017.
 */
public class MethodReaderTest {
    @Test
    public void readMethods() throws IOException {
        Wire wire = new TextWire(BytesUtil.readFile("methods-in.yaml")).useTextDocuments();
        Wire wire2 = new TextWire(Bytes.allocateElasticDirect());
        // expected
        Bytes expected = BytesUtil.readFile("methods-in.yaml");
        MockMethods writer = wire2.methodWriter(MockMethods.class);
        MethodReader reader = wire.methodReader(writer);
        for (int i = 0; i < 2; i++) {
            assertTrue(reader.readOne());
            while (wire2.bytes().peekUnsignedByte(wire2.bytes().writePosition() - 1) == ' ')
                wire2.bytes().writeSkip(-1);
            wire2.bytes().append("---\n");
        }
        assertFalse(reader.readOne());
        assertEquals(expected.toString().trim().replace("\r", ""), wire2.toString().trim());
    }
}

class MockDto extends AbstractMarshallable {
    String field1;
    double field2;
}

Allow TextWire to write binary headers as well as plain text.


package io.vertx.example.core.http.simple;

import io.vertx.core.AbstractVerticle;
import io.vertx.example.util.Runner;

/*
 * @author Tim Fox
 */
public class Server extends AbstractVerticle {

  // Convenience method so you can run it in your IDE
  public static void main(String[] args) {
    Runner.runExample(Server.class);
  }

  @Override
  public void start() throws Exception {
    vertx.createHttpServer().requestHandler(req -> {
      req.response().putHeader("content-type", "text/html").end("
Hello from vert.x!
");
    }).listen(8081);
  }
}

package io.vertx.example.core.http.simple;

import io.vertx.core.AbstractVerticle;
import io.vertx.example.util.Runner;

/*
 * @author Tim Fox
 */
public class Server extends AbstractVerticle {

  // Convenience method so you can run it in your IDE
  public static void main(String[] args) {
    Runner.runExample(Server.class);
  }

  @Override
  public void start() throws Exception {
    vertx.createHttpServer().requestHandler(req -> {
      req.response().putHeader("content-type", "text/html").end("
Hello from vert.x!
");
    }).listen(8080);
  }
}

Fix simple http server example wrong port


package com.github.games647.flexiblelogin.tasks;

import com.github.games647.flexiblelogin.FlexibleLogin;

import java.util.UUID;

import org.spongepowered.api.text.Texts;
import org.spongepowered.api.text.format.TextColors;
import org.spongepowered.api.util.command.CommandSource;

public class UnregisterTask implements Runnable {

    private final FlexibleLogin plugin;
    private final CommandSource src;

    private final Object accountIndentifer;

    public UnregisterTask(FlexibleLogin plugin, CommandSource src, UUID uuid) {
        this.plugin = plugin;
        this.src = src;

        this.accountIndentifer = uuid;
    }

    public UnregisterTask(FlexibleLogin plugin, CommandSource src, String playerName) {
        this.plugin = plugin;
        this.src = src;

        this.accountIndentifer = playerName;
    }

    @Override
    public void run() {
        boolean accountFound;
        if (accountIndentifer instanceof String) {
            accountFound = plugin.getDatabase().deleteAccount((String) accountIndentifer);
        } else {
            accountFound = plugin.getDatabase().deleteAccount((UUID) accountIndentifer);
        }

        if (accountFound) {
            src.sendMessage(Texts.of(TextColors.DARK_GREEN, "Deleted account of: " + accountIndentifer));
        } else {
            src.sendMessage(Texts.of(TextColors.DARK_RED, "Error executing command. See console"));
        }
    }
}

package com.github.games647.flexiblelogin.tasks;

import com.github.games647.flexiblelogin.FlexibleLogin;

import java.util.UUID;

import org.spongepowered.api.text.Texts;
import org.spongepowered.api.text.format.TextColors;
import org.spongepowered.api.util.command.CommandSource;

public class UnregisterTask implements Runnable {

    private final FlexibleLogin plugin;
    private final CommandSource src;

    private final Object accountIndentifer;

    public UnregisterTask(FlexibleLogin plugin, CommandSource src, UUID uuid) {
        this.plugin = plugin;
        this.src = src;

        this.accountIndentifer = uuid;
    }

    public UnregisterTask(FlexibleLogin plugin, CommandSource src, String playerName) {
        this.plugin = plugin;
        this.src = src;

        this.accountIndentifer = playerName;
    }

    @Override
    public void run() {
        boolean accountFound;
        if (accountIndentifer instanceof String) {
            accountFound = plugin.getDatabase().deleteAccount((String) accountIndentifer);
        } else {
            accountFound = plugin.getDatabase().deleteAccount((UUID) accountIndentifer);
        }

        if (accountFound) {
            src.sendMessage(Texts.of(TextColors.DARK_GREEN, "Deleted account of: " + accountIndentifer));
        } else {
            src.sendMessage(Texts.of(TextColors.DARK_RED, "User account not found"));
        }
    }
}

Fix command message if the account wasn't found on deleting.


package jp.satorufujiwara.binder.recycler;

import android.content.Context;
import android.support.annotation.LayoutRes;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;

import jp.satorufujiwara.binder.Binder;
import jp.satorufujiwara.binder.ViewType;

public abstract class RecyclerBinder<V extends ViewType>
        implements Binder<V, RecyclerView.ViewHolder> {

    private final V mViewType;
    private Context mContext;

    protected RecyclerBinder(final Context context, final V viewType) {
        mContext = context;
        mViewType = viewType;
    }

    @LayoutRes
    public abstract int layoutResId();

    public abstract RecyclerView.ViewHolder onCreateViewHolder(final View v);

    @Override
    public final RecyclerView.ViewHolder onCreateViewHolder(final ViewGroup parent) {
        return onCreateViewHolder(View.inflate(mContext, layoutResId(), null));
    }

    @Override
    public void onViewRecycled(RecyclerView.ViewHolder holder) {
        // no op
    }

    @Override
    public void onRemoved() {
        mContext = null;
    }

    @Override
    public V getViewType() {
        return mViewType;
    }

    public final Context getContext() {
        return mContext;
    }

}

package jp.satorufujiwara.binder.recycler;

import android.content.Context;
import android.support.annotation.LayoutRes;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import jp.satorufujiwara.binder.Binder;
import jp.satorufujiwara.binder.ViewType;

public abstract class RecyclerBinder<V extends ViewType>
        implements Binder<V, RecyclerView.ViewHolder> {

    private final V mViewType;
    private Context mContext;

    protected RecyclerBinder(final Context context, final V viewType) {
        mContext = context;
        mViewType = viewType;
    }

    @LayoutRes
    public abstract int layoutResId();

    public abstract RecyclerView.ViewHolder onCreateViewHolder(final View v);

    @Override
    public final RecyclerView.ViewHolder onCreateViewHolder(final ViewGroup parent) {
        return onCreateViewHolder(LayoutInflater.from(mContext).inflate(layoutResId(), parent, false));
    }

    @Override
    public void onViewRecycled(RecyclerView.ViewHolder holder) {
        // no op
    }

    @Override
    public void onRemoved() {
        mContext = null;
    }

    @Override
    public V getViewType() {
        return mViewType;
    }

    public final Context getContext() {
        return mContext;
    }

}

Fix inflated view using parent view.

Fix inflated view using parent view.


package com.connect_group.urlshortener;

import org.junit.Test;

import java.net.MalformedURLException;
import java.net.URL;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsEqual.equalTo;

public class ShortenerServiceImplTest {

    @Test
    public void shouldConvertUrlToToken() throws MalformedURLException {
        ShortenerServiceImpl service = new ShortenerServiceImpl();
        String shortUrl = service.shorten(new URL("http://test.com/url?param=value"));
        assertThat(shortUrl, equalTo("-"));
    }

    @Test
    public void shouldConvertTokenToUrl() throws UnrecognisedTokenException, MalformedURLException {
        String url = "http://test.com/url?param=value";
        ShortenerServiceImpl service = new ShortenerServiceImpl();
        String token = service.shorten(new URL(url));
        assertThat(service.expand(token), equalTo(url));
    }

}

package com.connect_group.urlshortener;

import org.junit.Test;

import java.net.MalformedURLException;
import java.net.URL;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsEqual.equalTo;

public class ShortenerServiceImplTest {

    @Test
    public void shouldConvertUrlToToken() throws MalformedURLException {
        ShortenerServiceImpl service = new ShortenerServiceImpl();
        String shortUrl = service.shorten(new URL("http://test.com/url?param=value"));
        assertThat(shortUrl, equalTo("-"));
    }

    @Test
    public void shouldConvertTokenToUrl() throws UnrecognisedTokenException, MalformedURLException {
        String url = "http://test.com/url?param=value";
        ShortenerServiceImpl service = new ShortenerServiceImpl();
        String token = service.shorten(new URL(url));
        assertThat(service.expand(token), equalTo(url));
    }

    @Test(expected=UnrecognisedTokenException.class)
    public void shouldThrowException_WhenNullToken() throws UnrecognisedTokenException {
        new ShortenerServiceImpl().expand(null);
    }

}

Test for invalid token when expanding token


package seedu.tasklist.logic.commands;

//@@author A0141993X
public class SortCommand extends Command {

    public static final String COMMAND_WORD = "sort";
    private final String parameter;

    public static final String MESSAGE_USAGE = COMMAND_WORD
            + ":Sorts task according to the parameter specified. "
            + "Only 1 of the 5. "
            + "Name:n"
            + "Priority:p or StartDate: sd or EndDate:ed or Deadline:d\n"
            + "Parameters: n, p, sd, ed\n"
            + "Example: " + COMMAND_WORD + " n";
    public static final String MESSAGE_FAILURE = "Invalid sorting parameter used!" + MESSAGE_USAGE;
    public static final String MESSAGE_SUCCESS = "Task sorted according to given parameter.";

    public SortCommand(String parameter) {
        switch (parameter) {
        case "d":
            this.parameter = "Date";
            break;
        case "n":
            this.parameter = "Name";
            break;
        case "p":
            this.parameter = "Priority";
            break;
        default:
            this.parameter = null;
            break;
        }
    }

    @Override
    public CommandResult execute() {

        if (parameter == null) {
            return new CommandResult(MESSAGE_FAILURE);
        }
        model.sortTaskList(parameter);
        return new CommandResult(MESSAGE_SUCCESS);
    }

}

package seedu.tasklist.logic.commands;

//@@author A0141993X
public class SortCommand extends Command {

    public static final String COMMAND_WORD = "sort";
    private final String parameter;

    public static final String MESSAGE_USAGE = COMMAND_WORD
            + ":Sorts task according to the parameter specified. "
            + "Only 1 of the 5. "
            + "Name:n "
            + "Priority:p or StartDate: sd or EndDate:ed or Deadline:d\n"
            + "Parameters: n, p, sd, ed\n"
            + "Example: " + COMMAND_WORD + " n";
    public static final String MESSAGE_FAILURE = "Invalid sorting parameter used!" + MESSAGE_USAGE;
    public static final String MESSAGE_SUCCESS = "Task sorted according to given parameter.";

    public SortCommand(String parameter) {
        switch (parameter) {
        case "d":
            this.parameter = "Date";
            break;
        case "n":
            this.parameter = "Name";
            break;
        case "p":
            this.parameter = "Priority";
            break;
        default:
            this.parameter = null;
            break;
        }
    }

    @Override
    public CommandResult execute() {

        if (parameter == null) {
            return new CommandResult(MESSAGE_FAILURE);
        }
        model.sortTaskList(parameter);
        return new CommandResult(MESSAGE_SUCCESS);
    }

}

Edit format of sort command

Edit format of sort command


package com.haxademic.core.system;

import processing.core.PApplet;
import processing.opengl.PGL;

import com.haxademic.core.app.P;

public class SystemUtil {

	public static String getJavaVersion() {
		return System.getProperty("java.version");
	}

	public static String getTimestamp( PApplet p ) {
		// use P.nf to pad date components to 2 digits for more consistent ordering across systems
		return  String.valueOf( P.year() ) + "-" +
				P.nf( P.month(), 2 ) + "-" +
				P.nf( P.day(), 2 ) + "-" +
				P.nf( P.hour(), 2 ) + "-" +
				P.nf( P.minute(), 2 ) + "-" +
				P.nf( P.second(), 2 );
	}

	public static String getTimestampFine( PApplet p ) {
		return SystemUtil.getTimestamp(p) + "-" + P.nf( p.frameCount, 8 );
	}

	// Patch TAB capture ability - Processing 2.0 broke this in 3D rendering contexts
	public static void p2TabKeyInputPatch() {
		if(PGL.canvas != null) { PGL.canvas.setFocusTraversalKeysEnabled(false); }
	}
}

package com.haxademic.core.system;

import processing.core.PApplet;

import com.haxademic.core.app.P;

public class SystemUtil {

	public static String getJavaVersion() {
		return System.getProperty("java.version");
	}

	public static String getTimestamp( PApplet p ) {
		// use P.nf to pad date components to 2 digits for more consistent ordering across systems
		return  String.valueOf( P.year() ) + "-" +
				P.nf( P.month(), 2 ) + "-" +
				P.nf( P.day(), 2 ) + "-" +
				P.nf( P.hour(), 2 ) + "-" +
				P.nf( P.minute(), 2 ) + "-" +
				P.nf( P.second(), 2 );
	}

	public static String getTimestampFine( PApplet p ) {
		return SystemUtil.getTimestamp(p) + "-" + P.nf( p.frameCount, 8 );
	}

	// Patch TAB capture ability - Processing 2.0 broke this in 3D rendering contexts
	public static void p2TabKeyInputPatch() {
//		if(PJOGL.canvas != null) { PJOGL.canvas.setFocusTraversalKeysEnabled(false); }
	}
}

Remove hack for tab-key handling in Processing 2.0 - This is now fixed in Processing 2.1


package dmax.words.domain;

/**
 * Created by Maxim Dybarsky | maxim.dybarskyy@gmail.com
 * on 10.12.14 at 13:46
 */
public enum Language {
    POLISH,
    UKRAINIAN
}

package dmax.words.domain;

/**
 * Created by Maxim Dybarsky | maxim.dybarskyy@gmail.com
 * on 10.12.14 at 13:46
 */
public enum Language {
    POLISH("Polish"),
    UKRAINIAN("Ukrainian");

    private String codeName;

    Language(String codeName) {
        this.codeName = codeName;
    }

    public String getCodeName() {
        return codeName;
    }
}

Add method setWord(word) into Link class


package br.com.bloder.blormlib.validation;

import br.com.bloder.blormlib.validation.validations.Checked;
import br.com.bloder.blormlib.validation.validations.Email;
import br.com.bloder.blormlib.validation.validations.Filled;
import br.com.bloder.blormlib.validation.validations.Number;

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

  public static Validation filled = new Filled();
  public static Validation checked = new Checked();
  public static Validation email = new Email();
  public static Validation number = new Number();
}

package br.com.bloder.blormlib.validation;

import br.com.bloder.blormlib.validation.validations.Checked;
import br.com.bloder.blormlib.validation.validations.Email;
import br.com.bloder.blormlib.validation.validations.Filled;
import br.com.bloder.blormlib.validation.validations.Number;

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

  public static Validation filled = new Filled();
  public static Validation checked = new Checked();
  public static Validation email = new Email();
  public static Number number = new Number();
}

Change number validation field type

Change number validation field type


package mb.nabl2.spoofax.analysis;

import java.io.Serializable;
import java.util.Optional;
import java.util.Set;

import mb.nabl2.constraints.IConstraint;
import mb.nabl2.solver.Fresh;
import mb.nabl2.solver.ISolution;

public interface IScopeGraphUnit extends Serializable {

    String resource();

    Set<IConstraint> constraints();

    Optional<ISolution> solution();

    Optional<CustomSolution> customSolution();

    Fresh fresh();

    /**
     * Check if the solution returned is for this resource exactly,
     * or if this unit is just a part of it.
     */
    boolean isPrimary();

}

package mb.nabl2.spoofax.analysis;

import java.io.Serializable;
import java.util.Optional;
import java.util.Set;

import mb.nabl2.constraints.IConstraint;
import mb.nabl2.solver.Fresh;
import mb.nabl2.solver.ISolution;

public interface IScopeGraphUnit extends Serializable {

    String resource();

    Set<IConstraint> constraints();

    Optional<ISolution> solution();

    Optional<CustomSolution> customSolution();

    Fresh fresh();

    /**
     * Check if the solution returned is for this resource exactly,
     * or if this unit is just a part of it.
     */
    boolean isPrimary();

    IScopeGraphUnit withSolution(ISolution solution);

}

Add helper for FlowSpec to add the CFG at a later time


package com.uwetrottmann.trakt.v2.services;

import com.uwetrottmann.trakt.v2.BaseTestCase;
import com.uwetrottmann.trakt.v2.exceptions.OAuthUnauthorizedException;
import com.uwetrottmann.trakt.v2.entities.Movie;
import com.uwetrottmann.trakt.v2.entities.Show;
import com.uwetrottmann.trakt.v2.enums.Extended;
import org.junit.Test;

import java.util.List;

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

public class RecommendationsTest extends BaseTestCase {

    @Test
    public void test_movies() throws OAuthUnauthorizedException {
        List<Movie> movies = getTrakt().recommendations().movies(Extended.DEFAULT_MIN);
        assertThat(movies).isNotEmpty();
    }

    @Test
    public void test_shows() throws OAuthUnauthorizedException {
        List<Show> shows = getTrakt().recommendations().shows(Extended.DEFAULT_MIN);
        assertThat(shows).isNotEmpty();
    }

}

package com.uwetrottmann.trakt.v2.services;

import com.uwetrottmann.trakt.v2.BaseTestCase;
import com.uwetrottmann.trakt.v2.TestData;
import com.uwetrottmann.trakt.v2.exceptions.OAuthUnauthorizedException;
import com.uwetrottmann.trakt.v2.entities.Movie;
import com.uwetrottmann.trakt.v2.entities.Show;
import com.uwetrottmann.trakt.v2.enums.Extended;
import org.junit.Test;
import retrofit.client.Response;

import java.util.List;

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

public class RecommendationsTest extends BaseTestCase {

    @Test
    public void test_movies() throws OAuthUnauthorizedException {
        List<Movie> movies = getTrakt().recommendations().movies(Extended.DEFAULT_MIN);
        assertThat(movies).isNotEmpty();
    }

    @Test
    public void test_dismissMovie() throws OAuthUnauthorizedException {
        Response response = getTrakt().recommendations().dismissMovie(String.valueOf(TestData.MOVIE_TRAKT_ID));
        assertThat(response).isNotNull();
    }

    @Test
    public void test_shows() throws OAuthUnauthorizedException {
        List<Show> shows = getTrakt().recommendations().shows(Extended.DEFAULT_MIN);
        assertThat(shows).isNotEmpty();
    }

    @Test
    public void test_dismissShow() throws OAuthUnauthorizedException {
        Response response = getTrakt().recommendations().dismissShow(String.valueOf(TestData.SHOW_TRAKT_ID));
        assertThat(response).isNotNull();
    }

}

Add tests for hide recommendation endpoints.


package net.ripe.db.whois.common.domain;

import com.google.common.collect.Sets;
import net.ripe.db.whois.common.etree.Interval;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.util.Set;

@Component
public class IpRanges {
    private static final Logger LOGGER = LoggerFactory.getLogger(IpRanges.class);

    private Set<Interval> ripeRanges;

    @Value("${ipranges.trusted}")
    public void setRipeRanges(final String... ripeRanges) {
        final Set<Interval> ipResources = Sets.newLinkedHashSetWithExpectedSize(ripeRanges.length);
        for (final String ripeRange : ripeRanges) {
            ipResources.add(IpInterval.parse(ripeRange));
        }

        this.ripeRanges = ipResources;
        LOGGER.info("Using ripe ranges: {}", ripeRanges);
    }

    public boolean isInRipeRange(final Interval ipResource) {
        for (final Interval resource : ripeRanges) {
            if (resource.getClass().equals(ipResource.getClass()) && resource.contains(ipResource)) {
                return true;
            }
        }

        return false;
    }
}

package net.ripe.db.whois.common.domain;

import com.google.common.collect.Sets;
import net.ripe.db.whois.common.etree.Interval;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.util.Set;

@Component
public class IpRanges {
    private static final Logger LOGGER = LoggerFactory.getLogger(IpRanges.class);

    private Set<Interval> ripeRanges;

    @Value("${ipranges.trusted}")
    public void setRipeRanges(final String... ripeRanges) {
        final Set<Interval> ipResources = Sets.newLinkedHashSetWithExpectedSize(ripeRanges.length);
        for (final String ripeRange : ripeRanges) {
            ipResources.add(IpInterval.parse(ripeRange));
        }

        this.ripeRanges = ipResources;
        LOGGER.info("Using ripe ranges: {}", ripeRanges);
    }

    public boolean isInRipeRange(final Interval ipResource) {
        for (final Interval resource : ripeRanges) {
            if (resource.getClass().equals(ipResource.getClass()) && resource.contains(ipResource)) {
                return true;
            }
        }

        LOGGER.info("{} is not in RIPE range", ipResource.toString());

        return false;
    }
}

Check integration test source address.

Check integration test source address.


package de.uni_stuttgart.vis.vowl.owl2vowl.constants;

public class Node_Types {
	public static final String TYPE_CLASS = "owl:Class";
	public static final String TYPE_RDFSCLASS = "rdfs:Class";
	public static final String TYPE_EQUIVALENT = "owl:equivalentClass";
	public static final String TYPE_EXTERNALCLASS = "externalclass";
	public static final String TYPE_DEPRECTAEDCLASS = "owl:DeprecatedClass";
	public static final String TYPE_THING = "owl:Thing";
	public static final String TYPE_NOTHING = "owl:Nothing";
	public static final String TYPE_RDFSRESOURCE = "rdfs:Resource";
	public static final String TYPE_UNION = "owl:unionOf";
	public static final String TYPE_INTERSECTION = "owl:intersectionOf";
	public static final String TYPE_COMPLEMENT = "owl:complementOf";
	public static final String TYPE_DATATYPE = "rdfs:Datatype";
	public static final String TYPE_LITERAL = "rdfs:Literal";
}

package de.uni_stuttgart.vis.vowl.owl2vowl.constants;

public class Node_Types {
	public static final String TYPE_CLASS = "owl:Class";
	public static final String TYPE_RDFSCLASS = "rdfs:Class";
	public static final String TYPE_EQUIVALENT = "owl:equivalentClass";
	public static final String TYPE_EXTERNALCLASS = "externalclass";
	public static final String TYPE_DEPRECTAEDCLASS = "owl:DeprecatedClass";
	public static final String TYPE_THING = "owl:Thing";
	public static final String TYPE_NOTHING = "owl:Nothing";
	public static final String TYPE_RDFSRESOURCE = "rdfs:Resource";
	public static final String TYPE_UNION = "owl:unionOf";
	public static final String TYPE_INTERSECTION = "owl:intersectionOf";
	public static final String TYPE_COMPLEMENT = "owl:complementOf";
	public static final String TYPE_DATATYPE = "rdfs:Datatype";
	public static final String TYPE_LITERAL = "rdfs:Literal";
	public static final String KEY_TYPE_DATA_ONE_OF = "DATA_ONE_OF";
}

Add type constant for data one of.

Add type constant for data one of.


package info.u_team.u_team_test.screen;

import info.u_team.u_team_core.gui.elements.EnergyStorageWidget;
import info.u_team.u_team_core.screen.UBasicContainerScreen;
import info.u_team.u_team_test.TestMod;
import info.u_team.u_team_test.container.BasicEnergyCreatorContainer;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.*;
import net.minecraftforge.energy.CapabilityEnergy;

@OnlyIn(Dist.CLIENT)
public class BasicEnergyCreatorScreen extends UBasicContainerScreen<BasicEnergyCreatorContainer> {

	public BasicEnergyCreatorScreen(BasicEnergyCreatorContainer container, PlayerInventory playerInventory, ITextComponent title) {
		super(container, playerInventory, title, new ResourceLocation(TestMod.MODID, "textures/gui/energy_creator.png"), 176, 173);
	}

	@Override
	protected void func_231160_c_() {
		super.func_231160_c_();
		func_230480_a_(new EnergyStorageWidget(guiLeft + 9, guiTop + 20, 54, container.getTileEntity().getCapability(CapabilityEnergy.ENERGY)));
	}
}

package info.u_team.u_team_test.screen;

import info.u_team.u_team_core.gui.elements.EnergyStorageWidget;
import info.u_team.u_team_core.screen.UBasicContainerScreen;
import info.u_team.u_team_test.TestMod;
import info.u_team.u_team_test.container.BasicEnergyCreatorContainer;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.*;
import net.minecraftforge.energy.CapabilityEnergy;

@OnlyIn(Dist.CLIENT)
public class BasicEnergyCreatorScreen extends UBasicContainerScreen<BasicEnergyCreatorContainer> {

	private static final ResourceLocation BACKGROUND = new ResourceLocation(TestMod.MODID, "textures/gui/energy_creator.png");

	public BasicEnergyCreatorScreen(BasicEnergyCreatorContainer container, PlayerInventory playerInventory, ITextComponent title) {
		super(container, playerInventory, title, BACKGROUND, 176, 173);
	}

	@Override
	protected void func_231160_c_() {
		super.func_231160_c_();
		func_230480_a_(new EnergyStorageWidget(guiLeft + 9, guiTop + 20, 54, container.getTileEntity().getCapability(CapabilityEnergy.ENERGY)));
	}
}

Add static field for texture in basic energy creator


package org.libvirt.jna;

import com.sun.jna.Structure;

/**
 * JNA mapping for the virSchedParameterValue structure
 */
public class virSchedParameterValue extends Structure {
    public int i; /* data for integer case */
    public int ui; /* data for unsigned integer case */
    public long l; /* data for long long integer case */
    public long ul; /* data for unsigned long long integer case */
    public double d; /* data for double case */
    public byte b; /* data for char case */
}

package org.libvirt.jna;

import com.sun.jna.Union;

/**
 * JNA mapping for the virSchedParameterValue structure
 */
public class virSchedParameterValue extends Union {
    public int i; /* data for integer case */
    public int ui; /* data for unsigned integer case */
    public long l; /* data for long long integer case */
    public long ul; /* data for unsigned long long integer case */
    public double d; /* data for double case */
    public byte b; /* data for char case */
}

Make the parameters a Union based on the comments from Frederic Ddangtran


/*******************************************************************************
 * Copyright 2016, 2017 vanilladb.org contributors
 *
 * 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.vanilladb.core.server.task;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import org.vanilladb.core.util.CoreProperties;

/**
 * The task manager of VanillaCore. This manager is responsible for maintaining
 * the thread pool of worker thread.
 */
public class TaskMgr {

	public final static int THREAD_POOL_SIZE;

	static {
		THREAD_POOL_SIZE = CoreProperties.getLoader().getPropertyAsInteger(
				TaskMgr.class.getName() + ".THREAD_POOL_SIZE", 150);
	}

	private ExecutorService executor;

	public TaskMgr() {
		executor = Executors.newFixedThreadPool(THREAD_POOL_SIZE);
	}

	public void runTask(Task task) {
		executor.execute(task);
	}
}

/*******************************************************************************
 * Copyright 2016, 2017 vanilladb.org contributors
 *
 * 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.vanilladb.core.server.task;

import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;

import org.vanilladb.core.util.CoreProperties;

/**
 * The task manager of VanillaCore. This manager is responsible for maintaining
 * the thread pool of worker thread.
 */
public class TaskMgr {

	public final static int THREAD_POOL_SIZE;

	static {
		THREAD_POOL_SIZE = CoreProperties.getLoader().getPropertyAsInteger(
				TaskMgr.class.getName() + ".THREAD_POOL_SIZE", 150);
	}

	private ThreadPoolExecutor executor;

	public TaskMgr() {
		executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(THREAD_POOL_SIZE);
	}

	public void runTask(Task task) {
		executor.execute(task);
	}

	public int getActiveCount() {
		return executor.getActiveCount();
	}
}

Return active thread count from the threadpool


package net.folab.fo.runtime;

import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;

import java.lang.reflect.Field;

import net.folab.fo.runtime._fo._lang.Boolean;
import net.folab.fo.runtime._fo._lang.Integer;

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

public class GeneratedCodeTest {

    private Class<?> genClass;

    @Before
    public void setUp() throws ClassNotFoundException {
        genClass = Class.forName("net.folab.fo.runtime._");
    }

    @Test
    public void test() throws SecurityException, NoSuchFieldException,
            IllegalArgumentException, IllegalAccessException {

        test("_a", Integer.valueOf(1));
        test("_b", Integer.valueOf(2));
        test("_c", Integer.valueOf(3));
        test("_d", Integer.valueOf(4));
        test("_e", Integer.valueOf(5));
        test("_f", Boolean.FALSE);
        test("_t", Boolean.TRUE);
        test("_nt", Boolean.FALSE);

    }

    public <T extends Evaluable<T>> void test(String name, Evaluable<T> expected)
            throws NoSuchFieldException, IllegalAccessException {
        Field field = genClass.getField(name);
        @SuppressWarnings("unchecked")
        Evaluable<T> value = (Evaluable<T>) field.get(null);
        assertThat(value.evaluate(), is(expected));
    }

}

package net.folab.fo.runtime;

import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;

import java.lang.reflect.Field;

import net.folab.fo.runtime._fo._lang.Boolean;
import net.folab.fo.runtime._fo._lang.Integer;

import org.junit.Test;

public class GeneratedCodeTest {

    private Class<?> genClass;

    public void setup(String className) throws ClassNotFoundException {
        ClassLoader classLoader = new ClassLoader(getClass().getClassLoader()) {
        };
        genClass = classLoader.loadClass(className);
    }

    @Test
    public void test__() throws SecurityException, NoSuchFieldException,
            IllegalArgumentException, IllegalAccessException, ClassNotFoundException {
        setup("net.folab.fo.runtime._");
        test();
    }

    public void test() throws SecurityException, NoSuchFieldException,
            IllegalArgumentException, IllegalAccessException {

        test("_a", Integer.valueOf(1));
        test("_b", Integer.valueOf(2));
        test("_c", Integer.valueOf(3));
        test("_d", Integer.valueOf(4));
        test("_e", Integer.valueOf(5));
        test("_f", Boolean.FALSE);
        test("_t", Boolean.TRUE);
        test("_nt", Boolean.FALSE);

    }

    public <T extends Evaluable<T>> void test(String name, Evaluable<T> expected)
            throws NoSuchFieldException, IllegalAccessException {
        Field field = genClass.getField(name);
        @SuppressWarnings("unchecked")
        Evaluable<T> value = (Evaluable<T>) field.get(null);
        assertThat(value.evaluate(), is(expected));
    }

}

Split class loading code to compare static class & generated class


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

package io.quarkus.deployment.steps;

import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.HotDeploymentConfigFileBuildItem;

class DevModeBuildStep {

    @BuildStep
    HotDeploymentConfigFileBuildItem config() {
        return new HotDeploymentConfigFileBuildItem("META-INF/microprofile-config.properties");
    }
}

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

package io.quarkus.deployment.steps;

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

import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.HotDeploymentConfigFileBuildItem;

class DevModeBuildStep {

    @BuildStep
    List<HotDeploymentConfigFileBuildItem> config() {
        return Arrays.asList(new HotDeploymentConfigFileBuildItem("META-INF/microprofile-config.properties"),
                new HotDeploymentConfigFileBuildItem("application.properties"));
    }
}

Add application.properties to hot reload


package com.annimon.jecp;

/**
 *
 * @author aNNiMON
 */
public interface ApplicationListener {

    public void onCreate();

    public void onPause();

    public void onExit();
}

package com.annimon.jecp;

/**
 *
 * @author aNNiMON
 */
public interface ApplicationListener {

    public void onStartApp();

    public void onPauseApp();

    public void onDestroyApp();
}

Change method names to remove collision with Android methods


package info.u_team.u_team_test.screen;

import info.u_team.u_team_core.screen.UBasicContainerScreen;
import info.u_team.u_team_test.TestMod;
import info.u_team.u_team_test.container.BasicFluidInventoryContainer;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.*;

@OnlyIn(Dist.CLIENT)
public class BasicFluidInventoryScreen extends UBasicContainerScreen<BasicFluidInventoryContainer> {

	public BasicFluidInventoryScreen(BasicFluidInventoryContainer container, PlayerInventory playerInventory, ITextComponent title) {
		super(container, playerInventory, title, new ResourceLocation(TestMod.MODID, "textures/gui/fluid_inventory.png"));
	}
}

package info.u_team.u_team_test.screen;

import info.u_team.u_team_core.screen.UBasicContainerScreen;
import info.u_team.u_team_test.TestMod;
import info.u_team.u_team_test.container.BasicFluidInventoryContainer;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.*;

@OnlyIn(Dist.CLIENT)
public class BasicFluidInventoryScreen extends UBasicContainerScreen<BasicFluidInventoryContainer> {

	private static final ResourceLocation BACKGROUND = new ResourceLocation(TestMod.MODID, "textures/gui/fluid_inventory.png");

	public BasicFluidInventoryScreen(BasicFluidInventoryContainer container, PlayerInventory playerInventory, ITextComponent title) {
		super(container, playerInventory, title, BACKGROUND);
	}
}

Add static field in basic fluiid inventory screen


package com.yammer.dropwizard.db;

import org.apache.tomcat.dbcp.dbcp.PoolingDataSource;
import org.apache.tomcat.dbcp.pool.ObjectPool;

import java.sql.SQLFeatureNotSupportedException;
import java.util.logging.Logger;

public class ManagedPooledDataSource extends PoolingDataSource implements ManagedDataSource {
    private final ObjectPool pool;

    public ManagedPooledDataSource(ObjectPool pool) {
        super(pool);
        this.pool = pool;
    }

    @Override
    public Logger getParentLogger() throws SQLFeatureNotSupportedException {
        throw new SQLFeatureNotSupportedException("Doesn't use java.util.logging");
    }

    @Override
    public void start() throws Exception {
        // already started
    }

    @Override
    public void stop() throws Exception {
        pool.close();
    }
}

package com.yammer.dropwizard.db;

import org.apache.tomcat.dbcp.dbcp.PoolingDataSource;
import org.apache.tomcat.dbcp.pool.ObjectPool;

import java.sql.SQLFeatureNotSupportedException;
import java.util.logging.Logger;

public class ManagedPooledDataSource extends PoolingDataSource implements ManagedDataSource {
    private final ObjectPool pool;

    public ManagedPooledDataSource(ObjectPool pool) {
        super(pool);
        this.pool = pool;
    }

    // JDK6 has JDBC 4.0 which doesn't have this -- don't add @Override
    @SuppressWarnings("override")
    public Logger getParentLogger() throws SQLFeatureNotSupportedException {
        throw new SQLFeatureNotSupportedException("Doesn't use java.util.logging");
    }

    @Override
    public void start() throws Exception {
        // already started
    }

    @Override
    public void stop() throws Exception {
        pool.close();
    }
}

Fix JDBC 4.0 source compatibility.

Fix JDBC 4.0 source compatibility.

Closes #186.


/*++

NASM Assembly Language Plugin
Copyright (c) 2017-2018 Aidan Khoury. All rights reserved.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

--*/

package com.nasmlanguage.psi;

import com.intellij.psi.tree.IElementType;
import com.nasmlanguage.NASMLanguage;
import org.jetbrains.annotations.*;

public class NASMTokenType extends IElementType {

    public NASMTokenType(@NotNull @NonNls String debugName) {
        super(debugName, NASMLanguage.INSTANCE);
    }

    @Override
    public String toString() {
        return "NASMTokenType." + super.toString();
    }
}

/*++

NASM Assembly Language Plugin
Copyright (c) 2017-2018 Aidan Khoury

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

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

--*/

package com.nasmlanguage.psi;

import com.intellij.psi.tree.IElementType;
import com.nasmlanguage.NASMLanguage;
import org.jetbrains.annotations.*;

public class NASMTokenType extends IElementType {

    public NASMTokenType(@NotNull @NonNls String debugName) {
        super(debugName, NASMLanguage.INSTANCE);
    }

    @Override
    public String toString() {
        return "NASMTokenType." + super.toString();
    }
}

Update copyright notice with MIT license


/*
 * Kurento Android Media: Android Media Library based on FFmpeg.
 * Copyright (C) 2011  Tikal Technologies
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 3
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.kurento.kas.media.rx;

public interface VideoRx {

	/**
	 * Receive a video frame.
	 *
	 * @param videoFrame
	 */
	public void putVideoFrameRx(VideoFrame videoFrame);

}

/*
 * Kurento Android Media: Android Media Library based on FFmpeg.
 * Copyright (C) 2011  Tikal Technologies
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 3
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.kurento.kas.media.rx;

public interface VideoRx {

	/**
	 * Receive a video frame.
	 *
	 * @param videoFrame
	 */
	public void putVideoFrameRx(VideoFrame videoFrame);

	/**
	 *
	 * @param size
	 *            in bytes. Must be multiple of (Integer.SIZE / 8).
	 * @return a int array (int[]) with length size/(Integer.SIZE / 8).
	 */
	public int[] getFrameBuffer(int size);

}

Add getFrameBuffer method to get a int array as frame buffer.


package com.kdemo.jooq.dao.impl;

import static com.kdemo.jooq.domain.Tables.USERS;

import java.util.List;

import org.jooq.DSLContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import com.kdemo.jooq.dao.UserDAO;
import com.kdemo.jooq.domain.tables.pojos.Users;
import com.kdemo.jooq.domain.tables.records.UsersRecord;

@Repository
@Transactional
public class UserDAOImpl implements UserDAO {

	@Autowired
	private DSLContext dsl;

	@Override
	public List<Users> getUsers() {
			return dsl
				.select(USERS.fields())
				.from(USERS)
				.fetchInto(Users.class);
	}

	@Override
	public int insert(Users user) {

		// option 1 : with fetch auto ID
		UsersRecord newRecord = dsl.newRecord(USERS, user);
		int store = newRecord.store();
		if(store > 0) {
			user.setId(newRecord.getId());
		}
		return store;

		// Otion 2
/*		return dsl.insertInto(USERS, USERS.NAME, USERS.GENDER)
			.values(user.getName(), user.getGender())
			.execute();*/

	}

}

package com.kdemo.jooq.dao.impl;

import static com.kdemo.jooq.domain.Tables.USERS;

import java.util.List;

import org.jooq.DSLContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import com.kdemo.jooq.dao.UserDAO;
import com.kdemo.jooq.domain.tables.pojos.Users;
import com.kdemo.jooq.domain.tables.records.UsersRecord;

@Repository
@Transactional
public class UserDAOImpl implements UserDAO {

	@Autowired
	private DSLContext dsl;

	@Override
	public List<Users> getUsers() {
			return dsl
				.select(USERS.fields())
				.from(USERS)
				.fetchInto(Users.class);
	}

	@Override
	public int insert(Users user) {

		// option 1 : with fetch auto ID
		UsersRecord newRecord = dsl.newRecord(USERS, user);
		int store = newRecord.insert();
		if(store > 0) {
			user.setId(newRecord.getId());
		}
		return store;

		// Otion 2
/*		return dsl.insertInto(USERS, USERS.NAME, USERS.GENDER)
			.values(user.getName(), user.getGender())
			.execute();*/

	}

}

Use insert instead store (update or insert)


package com.facebook.presto.sql.compiler;

import com.facebook.presto.sql.tree.Node;
import com.facebook.presto.sql.tree.NodeRewriter;
import com.facebook.presto.sql.tree.QualifiedNameReference;
import com.facebook.presto.sql.tree.TreeRewriter;
import com.google.common.collect.Iterables;

import java.util.List;
import java.util.Map;

public class NameToSymbolRewriter
        extends NodeRewriter<Void>
{
    private final TupleDescriptor descriptor;
    private final Map<Symbol, Type> symbols;

    public NameToSymbolRewriter(TupleDescriptor descriptor)
    {
        this.descriptor = descriptor;
        this.symbols = descriptor.getSymbols();
    }

    @Override
    public Node rewriteQualifiedNameReference(QualifiedNameReference node, Void context, TreeRewriter<Void> treeRewriter)
    {
        // try to resolve name
        List<Field> fields = descriptor.resolve(node.getName());

        if (fields.isEmpty() && symbols.containsKey(Symbol.fromQualifiedName(node.getName()))) {
            // if the name is not a valid field, is it a known symbol?
            return node;
        }

        Symbol symbol = Iterables.getOnlyElement(descriptor.resolve(node.getName())).getSymbol();
        return new QualifiedNameReference(symbol.toQualifiedName());
    }
}

package com.facebook.presto.sql.compiler;

import com.facebook.presto.sql.tree.Node;
import com.facebook.presto.sql.tree.NodeRewriter;
import com.facebook.presto.sql.tree.QualifiedNameReference;
import com.facebook.presto.sql.tree.TreeRewriter;
import com.google.common.collect.Iterables;

import java.util.List;
import java.util.Map;

public class NameToSymbolRewriter
        extends NodeRewriter<Void>
{
    private final TupleDescriptor descriptor;
    private final Map<Symbol, Type> symbols;

    public NameToSymbolRewriter(TupleDescriptor descriptor)
    {
        this.descriptor = descriptor;
        this.symbols = descriptor.getSymbols();
    }

    @Override
    public Node rewriteQualifiedNameReference(QualifiedNameReference node, Void context, TreeRewriter<Void> treeRewriter)
    {
        // is this a known symbol?
        if (!node.getName().getPrefix().isPresent() && symbols.containsKey(Symbol.fromQualifiedName(node.getName()))) { // symbols can't have prefixes
            return node;
        }

        // try to resolve name
        Symbol symbol = Iterables.getOnlyElement(descriptor.resolve(node.getName())).getSymbol();
        return new QualifiedNameReference(symbol.toQualifiedName());
    }
}

Fix issue with symbols vs attribute name disambiguation

See if the name is a valid symbol before trying to resolve it as a tuple attribute


package com.coreoz.plume.admin.webservices.security;

import java.util.Set;

import com.coreoz.plume.admin.jersey.WebSessionPermission;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

/**
 * Contains secure data of a user
 */
@Getter
@Setter
@Accessors(chain = true)
@ToString
public class WebSessionAdmin implements WebSessionPermission {

	private long idUser;
	private String userName;
	private String fullName;
	private Set<String> permissions;
	private long expirationTime;

}

package com.coreoz.plume.admin.webservices.security;

import java.util.Set;

import com.coreoz.plume.admin.jersey.WebSessionPermission;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

/**
 * Contains secure data of a user
 */
@Getter
@Setter
@Accessors(chain = true)
@ToString
public class WebSessionAdmin implements WebSessionPermission {

	@JsonSerialize(using = ToStringSerializer.class)
	private long idUser;
	private String userName;
	private String fullName;
	private Set<String> permissions;
	@JsonSerialize(using = ToStringSerializer.class)
	private long expirationTime;

}

Fix session serialization for Js

Fix session serialization for Js


package com.hubspot.blazar.base;

import com.google.common.collect.SetMultimap;

import java.util.HashSet;
import java.util.Map.Entry;
import java.util.Set;

public class DependencyGraph {
  private final SetMultimap<Integer, Integer> transitiveReduction;

  public DependencyGraph(SetMultimap<Integer, Integer> transitiveReduction) {
    this.transitiveReduction = transitiveReduction;
  }

  public Set<Integer> incomingVertices(int moduleId) {
    Set<Integer> incomingVertices = new HashSet<>();
    for (Entry<Integer, Integer> path : transitiveReduction.entries()) {
      if (path.getValue() == moduleId) {
        incomingVertices.add(path.getKey());
      }
    }

    return incomingVertices;
  }

  public Set<Integer> reachableVertices(int moduleId) {
    Set<Integer> reachableVertices = new HashSet<>();
    for (int vertex : outgoingVertices(moduleId)) {
      reachableVertices.add(vertex);
      reachableVertices.addAll(reachableVertices(vertex));
    }

    return reachableVertices;
  }

  public Set<Integer> outgoingVertices(int moduleId) {
    return transitiveReduction.get(moduleId);
  }

  @Override
  public String toString() {
    return transitiveReduction.toString();
  }
}

package com.hubspot.blazar.base;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.SetMultimap;

import java.util.HashSet;
import java.util.Map.Entry;
import java.util.Set;

public class DependencyGraph {
  private final SetMultimap<Integer, Integer> transitiveReduction;

  @JsonCreator
  public DependencyGraph(@JsonProperty("transitiveReduction") SetMultimap<Integer, Integer> transitiveReduction) {
    this.transitiveReduction = transitiveReduction;
  }

  public SetMultimap<Integer, Integer> getTransitiveReduction() {
    return transitiveReduction;
  }

  public Set<Integer> incomingVertices(int moduleId) {
    Set<Integer> incomingVertices = new HashSet<>();
    for (Entry<Integer, Integer> path : transitiveReduction.entries()) {
      if (path.getValue() == moduleId) {
        incomingVertices.add(path.getKey());
      }
    }

    return incomingVertices;
  }

  public Set<Integer> reachableVertices(int moduleId) {
    Set<Integer> reachableVertices = new HashSet<>();
    for (int vertex : outgoingVertices(moduleId)) {
      reachableVertices.add(vertex);
      reachableVertices.addAll(reachableVertices(vertex));
    }

    return reachableVertices;
  }

  public Set<Integer> outgoingVertices(int moduleId) {
    return transitiveReduction.get(moduleId);
  }

  @Override
  public String toString() {
    return transitiveReduction.toString();
  }
}

Make it work with Jackson

Make it work with Jackson


package jp.ne.naokiur.design.pattern.composite;

public class App {

    public static void main(String[] args) {
        Carbon firstCarbon = new Carbon();
        firstCarbon.bond(new Hydrogen());
        firstCarbon.bond(new Hydrogen());
        firstCarbon.bond(new Hydrogen());

        Carbon secondCarbon = new Carbon();
        secondCarbon.bond(new Hydrogen());
        secondCarbon.bond(new Hydrogen());
        secondCarbon.bond(new Hydrogen());
        secondCarbon.bond(firstCarbon);

        System.out.println(secondCarbon.createChemicalFormula());
    }
}

package jp.ne.naokiur.design.pattern.composite;

public class App {

    public static void main(String[] args) {
        Carbon carbon = new Carbon();
        carbon.bond(new Hydrogen());
        carbon.bond(new Hydrogen());
        carbon.bond(new Hydrogen());

        Carbon basicCarbon = new Carbon();
        basicCarbon.bond(new Hydrogen());
        basicCarbon.bond(new Hydrogen());
        basicCarbon.bond(new Hydrogen());
        basicCarbon.bond(carbon);

        System.out.println(basicCarbon.createChemicalFormula());
    }
}

Optimize name. Structual Formula need circulation but Composite pattern is not suitable.


package com.canoo.dolphin.integration;

import com.canoo.platform.remoting.client.ClientContext;
import org.testng.Assert;
import org.testng.annotations.Test;

/**
 * Created by hendrikebbers on 25.08.17.
 */
public class ClientIdTest extends AbstractIntegrationTest {

    @Test(dataProvider = ENDPOINTS_DATAPROVIDER)
    public void testThatClientIdIsNotNull(String containerType, String endpoint) {
        ClientContext context = connect(endpoint);
        Assert.assertNotNull(context.connect());
    }

}

package com.canoo.dolphin.integration;

import com.canoo.platform.remoting.client.ClientContext;
import org.testng.Assert;
import org.testng.annotations.Test;

/**
 * Created by hendrikebbers on 25.08.17.
 */
public class ClientIdTest extends AbstractIntegrationTest {

    @Test(dataProvider = ENDPOINTS_DATAPROVIDER)
    public void testThatClientIdIsNotNull(String containerType, String endpoint) {
        ClientContext context = connect(endpoint);
        Assert.assertNotNull(context.getClientId());
    }

}

Test added bugfix - Danke Jochen :D

Test added
bugfix - Danke Jochen :D


package org.nusco.narjillos.views.utilities;

public class PetriDishState {
	private volatile Light light = Light.ON;
	private volatile Speed speed = Speed.REALTIME;

	public Light getLight() {
		return light;
	}

	public Speed getSpeed() {
		return speed;
	}

	public void toggleLight() {
		if (light == Light.INFRARED)
			this.light = Light.ON;
		else if (light == Light.ON) {
			this.light = Light.OFF;
			this.speed = Speed.HIGH;
		}
		else {
			this.light = Light.ON;
			this.speed = Speed.REALTIME;
		}
	}

	public void toggleInfrared() {
		if (light == Light.OFF) {
			this.light = Light.INFRARED;
			this.speed = Speed.REALTIME;
		}
		else if (light == Light.INFRARED)
			this.light = Light.ON;
		else
			this.light = Light.INFRARED;
	}

	public void toggleSpeed() {
		if (speed == Speed.REALTIME)
			this.speed = Speed.HIGH;
		else
			this.speed = Speed.REALTIME;
	}
}

package org.nusco.narjillos.views.utilities;

public class PetriDishState {
	private volatile Light light = Light.ON;
	private volatile Speed speed = Speed.REALTIME;

	public Light getLight() {
		return light;
	}

	public Speed getSpeed() {
		return speed;
	}

	public void toggleLight() {
		switch (light) {
		case INFRARED:
			this.light = Light.ON;
			break;
		case ON:
			this.light = Light.OFF;
			this.speed = Speed.HIGH;
			break;
		case OFF:
			this.light = Light.ON;
			this.speed = Speed.REALTIME;
			break;
		}
	}

	public void toggleInfrared() {
		switch (light) {
		case INFRARED:
			this.light = Light.ON;
			break;
		case ON:
			this.light = Light.INFRARED;
			break;
		case OFF:
			this.light = Light.INFRARED;
			this.speed = Speed.REALTIME;
			break;
		}
	}

	public void toggleSpeed() {
		switch (speed) {
		case REALTIME:
			this.speed = Speed.HIGH;
			break;
		case HIGH:
			this.speed = Speed.REALTIME;
			break;
		}
	}
}

Refactor Petri Dish state machine

Refactor Petri Dish state machine


/*
 *
 * 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.ohdsi.webapi.cohortdefinition;

import java.io.Serializable;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.EntityGraph;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.Repository;

/**
 *
 * @author cknoll1
 */
public interface CohortDefinitionRepository extends CrudRepository<CohortDefinition, Integer> {
  Page<CohortDefinition> findAll(Pageable pageable);

  // Bug in hibernate, findById should use @EntityGraph, but details are not being feched. Workaround: mark details Fetch.EAGER,
  // but means findAll() will eager load definitions (what the @EntityGraph was supposed to solve)
  @EntityGraph(value = "CohortDefinition.withDetail", type = EntityGraph.EntityGraphType.LOAD)
  CohortDefinition findById(Integer id);

}

/*
 *
 * 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.ohdsi.webapi.cohortdefinition;

import java.io.Serializable;
import javax.transaction.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.EntityGraph;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.Repository;

/**
 *
 * @author cknoll1
 */
public interface CohortDefinitionRepository extends CrudRepository<CohortDefinition, Integer> {
  Page<CohortDefinition> findAll(Pageable pageable);

  // Bug in hibernate, findById should use @EntityGraph, but details are not being feched. Workaround: mark details Fetch.EAGER,
  // but means findAll() will eager load definitions (what the @EntityGraph was supposed to solve)
  @EntityGraph(value = "CohortDefinition.withDetail", type = EntityGraph.EntityGraphType.LOAD)
  @Transactional
  CohortDefinition findById(Integer id);

}

Test setting @Transactional on findById repository method.


public class Widget {
    private boolean primitive;
    private Widget simpleObject;
    private Pair<? extends Pair<? extends Widget, ? super Widget>, ?> nestedGenerics;
    private Pair<Widget, ?>[] arrayOfGeneric;
    private int[][] multiDimensionalArray;

    public Widget() {
    }

    public boolean isPrimitive() {
        return primitive;
    }

    public Widget getSimpleObject() {
        return simpleObject;
    }

    public Pair<? extends Pair<? extends Widget, ? super Widget>, ?> getNestedGenerics() {
        return nestedGenerics;
    }

    public Pair<Widget, ?>[] getArrayOfGeneric() {
        return arrayOfGeneric;
    }

    public int[][] getMultiDimensionalArray() {
        return multiDimensionalArray;
    }

    public class Pair<U, V> {
    }
}

public class Widget {
    private boolean primitive;
    private Widget recursiveType;
    private Final finalType;
    private Pair<? extends Widget, ? super Widget> generics;
    private int[][] multiDimensionalArray;

    public Widget() {
    }

    public boolean isPrimitive() {
        return primitive;
    }

    public Widget getRecursiveType() {
        return recursiveType;
    }

    public Widget getFinalType() {
        return recursiveType;
    }

    public Pair<? extends Widget, ? super Widget> getGenerics() {
        return generics;
    }

    public int[][] getMultiDimensionalArray() {
        return multiDimensionalArray;
    }

    public class Pair<U, V> {
    }

    public final class Final {
    }
}

Update property-types test case with more realistic types.


/*
 * Copyright 2016 Hewlett-Packard Development Company, L.P.
 * Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
 */

package com.hp.autonomy.frontend.find.core.savedsearches;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.util.Set;
import java.util.UUID;

@Entity
@Table(name = "users")
@Data
@EqualsAndHashCode(exclude = {"searches", "userId"})
@NoArgsConstructor
public class UserEntity {

    @Id
    @Column(name = "user_id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long userId;
    private String domain;

    @Column(name = "user_store")
    private String userStore;

    private UUID uuid;
    private Long uid;

    @JsonIgnore
    @OneToMany(mappedBy = "user", fetch = FetchType.EAGER)
    private Set<SavedSearch> searches;
}

/*
 * Copyright 2016 Hewlett-Packard Development Company, L.P.
 * Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
 */

package com.hp.autonomy.frontend.find.core.savedsearches;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.util.Set;
import java.util.UUID;

/**
 * Single entity that defines multiple types of user for our various implementations.
 *
 * We cannot use inheritance in this case because it would mean we would have to employ the
 * {@link org.hibernate.annotations.Any} annotation on the user entity of {@link SavedSearch}.
 *
 * This annotation requires you to define in place all the possible concrete types the field could
 * take at runtime.  This in turn would mean we have to define implementation-specific children of
 * {@link SavedSearch}, but then we would lose the centralisation of {@link SavedQuery} and other search types.
 */
@Entity
@Table(name = "users")
@Data
@EqualsAndHashCode(exclude = {"searches", "userId"})
@NoArgsConstructor
public class UserEntity {

    @Id
    @Column(name = "user_id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long userId;
    private String domain;

    @Column(name = "user_store")
    private String userStore;

    private UUID uuid;
    private Long uid;

    @JsonIgnore
    @OneToMany(mappedBy = "user", fetch = FetchType.EAGER)
    private Set<SavedSearch> searches;
}

Add comment for user entity justifying lack of inheritance [rev: trivial]


/*
 * 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.jctools.queues;

import static org.jctools.util.UnsafeLongArrayAccess.*;

public abstract class ConcurrentSequencedCircularArrayQueue<E> extends ConcurrentCircularArrayQueue<E>
{
    protected final long[] sequenceBuffer;

    public ConcurrentSequencedCircularArrayQueue(int capacity)
    {
        super(capacity);
        int actualCapacity = (int) (this.mask + 1);
        // pad data on either end with some empty slots. Note that actualCapacity is <= MAX_POW2_INT
        sequenceBuffer = allocateLongArray(actualCapacity);
        for (long i = 0; i < actualCapacity; i++)
        {
            soLongElement(sequenceBuffer, calcCircularLongElementOffset(i, mask), i);
        }
    }
}

/*
 * 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.jctools.queues;

import static org.jctools.util.UnsafeLongArrayAccess.*;

abstract class ConcurrentSequencedCircularArrayQueue<E> extends ConcurrentCircularArrayQueue<E>
{
    protected final long[] sequenceBuffer;

    public ConcurrentSequencedCircularArrayQueue(int capacity)
    {
        super(capacity);
        int actualCapacity = (int) (this.mask + 1);
        // pad data on either end with some empty slots. Note that actualCapacity is <= MAX_POW2_INT
        sequenceBuffer = allocateLongArray(actualCapacity);
        for (long i = 0; i < actualCapacity; i++)
        {
            soLongElement(sequenceBuffer, calcCircularLongElementOffset(i, mask), i);
        }
    }
}

Reduce visibility of internal class

Reduce visibility of internal class