package org.ethereum.config.net;

import org.ethereum.config.blockchain.MordenConfig;

/**
 * Created by Anton Nashatyrev on 25.02.2016.
 */
public class MordenNetConfig extends AbstractNetConfig {
    public MordenNetConfig() {
        add(0, new MordenConfig.Frontier());
        add(494_000, new MordenConfig.Homestead());
    }
}

package org.ethereum.config.net;

import org.apache.commons.lang3.tuple.Pair;
import org.ethereum.config.blockchain.Eip150HFConfig;
import org.ethereum.config.blockchain.MordenConfig;
import org.spongycastle.util.encoders.Hex;

import java.util.Collections;
import java.util.List;

/**
 * Created by Anton Nashatyrev on 25.02.2016.
 */
public class MordenNetConfig extends AbstractNetConfig {
    private static final long EIP150_HF_BLOCK = 1_783_000;
    private static final byte[] EIP150_HF_BLOCK_HASH =
            Hex.decode("f376243aeff1f256d970714c3de9fd78fa4e63cf63e32a51fe1169e375d98145");

    public MordenNetConfig() {
        add(0, new MordenConfig.Frontier());
        add(494_000, new MordenConfig.Homestead());
        add(EIP150_HF_BLOCK, new Eip150HFConfig(new MordenConfig.Homestead()) {
            @Override
            public List<Pair<Long, byte[]>> blockHashConstraints() {
                return Collections.singletonList(Pair.of(EIP150_HF_BLOCK, EIP150_HF_BLOCK_HASH));
            }
        });
    }
}

Update for Morden EIP150 HF

Update for Morden EIP150 HF


package com.hjcubed.mysterytetris;

import org.andengine.engine.camera.Camera;
import org.andengine.engine.options.EngineOptions;
import org.andengine.engine.options.ScreenOrientation;
import org.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy;
import org.andengine.entity.scene.Scene;
import org.andengine.entity.scene.background.Background;
import org.andengine.ui.activity.SimpleBaseGameActivity;

import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.Menu;

public class MainGameActivity extends SimpleBaseGameActivity {
	Camera camera;
	Scene scene;

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

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

	@Override
	public EngineOptions onCreateEngineOptions() {
		DisplayMetrics metrics = getResources().getDisplayMetrics();
		int width  = metrics.widthPixels;
		int height = metrics.heightPixels;
		camera = new Camera(0, 0, width, height);

		return new EngineOptions(true, ScreenOrientation.PORTRAIT_FIXED,
		new RatioResolutionPolicy(width, height), camera);
	}

	@Override
	protected void onCreateResources() {
		// TODO Auto-generated method stub

	}

	@Override
	protected Scene onCreateScene() {
		scene = new Scene();
		scene.setBackground(new Background(0,0,0));
		return scene;
	}

}

package com.hjcubed.mysterytetris;

import org.andengine.engine.camera.Camera;
import org.andengine.engine.options.EngineOptions;
import org.andengine.engine.options.ScreenOrientation;
import org.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy;
import org.andengine.entity.scene.Scene;
import org.andengine.entity.scene.background.Background;
import org.andengine.ui.activity.SimpleBaseGameActivity;

import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.Menu;

public class MainGameActivity extends SimpleBaseGameActivity {
	Camera camera;
	Scene scene;

	@Override
	public EngineOptions onCreateEngineOptions() {
		DisplayMetrics metrics = getResources().getDisplayMetrics();
		int width  = metrics.widthPixels;
		int height = metrics.heightPixels;
		camera = new Camera(0, 0, width, height);

		return new EngineOptions(true, ScreenOrientation.PORTRAIT_FIXED,
		new RatioResolutionPolicy(width, height), camera);
	}

	@Override
	protected void onCreateResources() {
		// TODO Auto-generated method stub

	}

	@Override
	protected Scene onCreateScene() {
		scene = new Scene();
		scene.setBackground(new Background(0,0,0));
		return scene;
	}

}

Create a scene with black background

Create a scene with black background


/*
 *  Copyright (c) 2012 Malhar, Inc.
 *  All Rights Reserved.
 */
package com.malhartech.bufferserver;

import com.malhartech.bufferserver.util.SerializedData;
import org.jboss.netty.channel.Channel;

/**
 *
 * @author chetan
 */
public class PhysicalNode
{
  private final long starttime;
  private final Channel channel;
  private long processedMessageCount;

  public PhysicalNode(Channel channel)
  {
    this.channel = channel;
    starttime = System.currentTimeMillis();
    processedMessageCount = 0;
  }

  public long getstartTime()
  {
    return starttime;
  }

  public long getUptime()
  {
    return System.currentTimeMillis() - starttime;
  }

  public void send(SerializedData d)
  {
    getChannel().write(d);
    processedMessageCount++;
  }

  public final long getProcessedMessageCount()
  {
    return processedMessageCount;
  }

  @Override
  public boolean equals(Object o)
  {
    return o.hashCode() == this.hashCode();
  }

  public final int getId()
  {
    return getChannel().getId();
  }

  @Override
  public final int hashCode()
  {
    return getChannel().getId();
  }

  /**
   * @return the channel
   */
  public Channel getChannel()
  {
    return channel;
  }
}

/*
 *  Copyright (c) 2012 Malhar, Inc.
 *  All Rights Reserved.
 */
package com.malhartech.bufferserver;

import com.malhartech.bufferserver.util.SerializedData;
import org.jboss.netty.channel.Channel;

/**
 *
 * @author chetan
 */
public class PhysicalNode
{
  private final long starttime;
  private final Channel channel;
  private long processedMessageCount;

  public PhysicalNode(Channel channel)
  {
    this.channel = channel;
    starttime = System.currentTimeMillis();
    processedMessageCount = 0;
  }

  public long getstartTime()
  {
    return starttime;
  }

  public long getUptime()
  {
    return System.currentTimeMillis() - starttime;
  }

  public void send(SerializedData d)
  {
    getChannel().write(d);
    processedMessageCount++;
  }

  public final long getProcessedMessageCount()
  {
    return processedMessageCount;
  }

  @Override
  public boolean equals(Object o)
  {
    return o == this
           || o.getClass() == this.getClass() && o.hashCode() == this.hashCode();
  }

  public final int getId()
  {
    return getChannel().getId();
  }

  @Override
  public final int hashCode()
  {
    return getChannel().getId();
  }

  /**
   * @return the channel
   */
  public Channel getChannel()
  {
    return channel;
  }
}

Optimize and Properly implement equals method.


/*
 * Directory Entry Filler Implementation Class of JSFSFillDir for JSyndicateFS
 */
package JSyndicateFS;

import JSyndicateFSJNI.struct.JSFSFillDir;
import JSyndicateFSJNI.struct.JSFSStat;
import java.util.ArrayList;

/**
 *
 * @author iychoi
 */
public class DirFillerImpl extends JSFSFillDir {

    private ArrayList<String> entries = new ArrayList<String>();

    DirFillerImpl() {

    }

    @Override
    public void fill(String name, JSFSStat stbuf, long off) {
        entries.add(name);
    }

    public String[] getEntryNames() {
        String[] arr = new String[this.entries.size()];
        arr = entries.toArray(arr);
        return arr;
    }
}

/*
 * Directory Entry Filler Implementation Class of JSFSFillDir for JSyndicateFS
 */
package JSyndicateFS;

import JSyndicateFSJNI.struct.JSFSFillDir;
import JSyndicateFSJNI.struct.JSFSStat;
import java.util.ArrayList;

/**
 *
 * @author iychoi
 */
public class DirFillerImpl extends JSFSFillDir {

    private static final String[] SKIP_FILES = {".", ".."};

    private ArrayList<String> entries = new ArrayList<String>();

    DirFillerImpl() {

    }

    @Override
    public void fill(String name, JSFSStat stbuf, long off) {
        boolean skip = false;
        for(String skip_file : SKIP_FILES) {
            if(name.equals(skip_file)) {
                skip = true;
            }
        }

        if(!skip) {
            entries.add(name);
        }
    }

    public String[] getEntryNames() {
        String[] arr = new String[this.entries.size()];
        arr = entries.toArray(arr);
        return arr;
    }
}

Remove . and .. dirs from list result

Remove . and .. dirs from list result


package me.rkfg.xmpp.bot.plugins;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import me.rkfg.xmpp.bot.Main;

import org.jivesoftware.smack.packet.Message;

public class StdinPlugin implements MessagePlugin {

    @Override
    public Pattern getPattern() {
        return null;
    }

    @Override
    public String process(Message message, Matcher matcher) {
        return null;
    }

    @Override
    public void init() {
        new Thread(new Runnable() {

            @Override
            public void run() {
                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
                while (!Thread.interrupted()) {
                    try {
                        String line = bufferedReader.readLine();
                        Main.sendMUCMessage(line);
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
            }
        }, "Stdin handler").start();
    }

    @Override
    public String getManual() {
        return null;
    }

}

package me.rkfg.xmpp.bot.plugins;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import me.rkfg.xmpp.bot.Main;

import org.jivesoftware.smack.packet.Message;

public class StdinPlugin implements MessagePlugin {

    @Override
    public Pattern getPattern() {
        return null;
    }

    @Override
    public String process(Message message, Matcher matcher) {
        return null;
    }

    @Override
    public void init() {
        new Thread(new Runnable() {

            @Override
            public void run() {
                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
                while (!Thread.interrupted()) {
                    try {
                        String line = bufferedReader.readLine();
                        if (line == null) {
                            // stdin is not connected
                            break;
                        }
                        Main.sendMUCMessage(line);
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
            }
        }, "Stdin handler").start();
    }

    @Override
    public String getManual() {
        return null;
    }

}

Stop the stdin thread if stdin get detached or not connected.


package com.sdsmdg.kd.trianglify.models;

import android.graphics.Point;

public class Triangle {
    public Point a;
    public Point b;
    public Point c;

    public Triangle (Point a, Point b, Point c) {
        this.a = a;
        this.b = b;
        this.c = c;
    }

    private boolean isClockwise (Point p1, Point p2, Point p3) {
        return (p1.x - p3.x) * (p2.y - p3.y) - (p1.y - p3.y) * (p2.x - p3.x) < 0f;
    }

    public boolean contains (Point p) {
        return isClockwise(p, a, b) == isClockwise(p, b, c) == isClockwise(p, c, a);
    }
}

package com.sdsmdg.kd.trianglify.models;

import android.graphics.Point;

public class Triangle {
    public Point a;
    public Point b;
    public Point c;

    public Triangle (Point a, Point b, Point c) {
        this.a = a;
        this.b = b;
        this.c = c;
    }

    private boolean isClockwise (Point p1, Point p2, Point p3) {
        return (p1.x - p3.x) * (p2.y - p3.y) - (p1.y - p3.y) * (p2.x - p3.x) < 0;
    }

    public boolean contains (Point p) {
        return isClockwise(p, a, b) == isClockwise(p, b, c) == isClockwise(p, c, a);
    }

    public boolean isInCircumcircle (Point p) {
        int d11 = a.x - p.x;
        int d21 = b.x - p.x;
        int d31 = c.x - p.x;

        int d12 = a.y - p.y;
        int d22 = b.y - p.y;
        int d32 = c.y - p.y;

        int d13 = d11 * d11 + d12 * d12;
        int d23 = d21 * d21 + d22 * d22;
        int d33 = d31 * d31 + d32 * d32;

        int determinant = d11 * (d22 * d33 - d32 * d23)
                        - d12 * (d21 * d33 - d31 * d23)
                        + d13 * (d21 * d32 - d31 * d22);

        return isClockwise(a, b, c) ? determinant < 0 : determinant > 0;
    }
}

Add a method to check if point is in circumcircle of triangle.


package com.tinkerpop.gremlin.driver;

import com.tinkerpop.gremlin.driver.message.ResponseMessage;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.CompletableFuture;

/**
 * @author Stephen Mallette (http://stephen.genoprime.com)
 */
public class ResultSet implements Iterable<Item> {
    private final ResponseQueue responseQueue;

    public ResultSet(final ResponseQueue responseQueue) {
        this.responseQueue = responseQueue;
    }

    public boolean isFullyFetched() {
        return responseQueue.getStatus() == ResponseQueue.Status.COMPLETE;
    }

    public CompletableFuture<List<Item>> all() {
        return CompletableFuture.supplyAsync(() -> {
            final List<Item> list = new ArrayList<>();
            while (!isFullyFetched() || responseQueue.size() > 0) {
                final ResponseMessage msg = responseQueue.poll();
                if (msg != null)
                    list.add(new Item(msg.getResult()));
            }
            return list;
        });
    }

    @Override
    public Iterator<Item> iterator() {
        return new Iterator<Item>() {
            private Item current = null;

            @Override
            public boolean hasNext() {
                final ResponseMessage msg = responseQueue.poll();
                if (null == msg)
                    return false;

                // todo: wait??

                this.current = new Item(msg.getResult());
                return true;
            }

            @Override
            public Item next() {
                return current;
            }

            @Override
            public void remove() {
                throw new UnsupportedOperationException();
            }
        };
    }
}

package com.tinkerpop.gremlin.driver;

import com.tinkerpop.gremlin.driver.message.ResponseMessage;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.CompletableFuture;

/**
 * @author Stephen Mallette (http://stephen.genoprime.com)
 */
public class ResultSet implements Iterable<Item> {
    private final ResponseQueue responseQueue;

    public ResultSet(final ResponseQueue responseQueue) {
        this.responseQueue = responseQueue;
    }

    public boolean isFullyFetched() {
        return responseQueue.getStatus() == ResponseQueue.Status.COMPLETE;
    }

    public int fetchedCount() {
        return responseQueue.size();
    }

    public CompletableFuture<List<Item>> all() {
        return CompletableFuture.supplyAsync(() -> {
            final List<Item> list = new ArrayList<>();
            while (!isFullyFetched() || fetchedCount() > 0) {
                final ResponseMessage msg = responseQueue.poll();
                if (msg != null)
                    list.add(new Item(msg.getResult()));
            }
            return list;
        });
    }

    @Override
    public Iterator<Item> iterator() {
        return new Iterator<Item>() {
            private Item current = null;

            @Override
            public boolean hasNext() {
                final ResponseMessage msg = responseQueue.poll();
                if (null == msg)
                    return false;

                // todo: wait??

                this.current = new Item(msg.getResult());
                return true;
            }

            @Override
            public Item next() {
                return current;
            }

            @Override
            public void remove() {
                throw new UnsupportedOperationException();
            }
        };
    }
}

Add method to get current number of fetched items.


package com.andela.notelib.mapper;

import static org.junit.Assert.*;

/**
 * Created by andela on 2/13/16.
 */
public class NoteMapperTest {

    @org.junit.Before
    public void setUp() throws Exception {

    }

    @org.junit.After
    public void tearDown() throws Exception {

    }

    @org.junit.Test
    public void testReadNote() throws Exception {

    }

    @org.junit.Test
    public void testWriteNote() throws Exception {

    }
}

package com.andela.notelib.mapper;

import android.test.ApplicationTestCase;

import com.andela.notelib.note.PaperNote;

import junit.framework.TestCase;

/**
 * Created by andela on 2/13/16.
 */
public class NoteMapperTest extends TestCase {

    PaperNote paperNote;
    NoteMapper<PaperNote> noteMapper;

    @Override
    protected void setUp() throws Exception {
        paperNote = new PaperNote("Everybody","Beautiful people", "Arial", 23, 0);
        noteMapper = new NoteMapper<>();
        super.setUp();
    }

    @Override
    protected void tearDown() throws Exception {
        super.tearDown();
    }

    public void testReadNote() throws Exception {
        String strPaper = noteMapper.readNote(paperNote);
        assertNotNull(strPaper);
    }

    public void testWriteNote() throws Exception {
        String strPaper = noteMapper.readNote(paperNote);
        PaperNote newPaperNote = noteMapper.writeNote(strPaper, PaperNote.class);
        assertEquals(newPaperNote.getNote(), paperNote.getNote());
    }

}

Write Test to fail NoteMapper class

Write Test to fail NoteMapper class


package org.kumoricon.site.report.attendees;

import com.vaadin.navigator.View;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.spring.annotation.SpringView;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.Button;
import com.vaadin.ui.Label;
import org.kumoricon.site.report.ReportView;
import org.kumoricon.site.BaseView;
import org.springframework.beans.factory.annotation.Autowired;

import javax.annotation.PostConstruct;

@ViewScope
@SpringView(name = AttendeeReportView.VIEW_NAME)
public class AttendeeReportView extends BaseView implements View, ReportView {
    public static final String VIEW_NAME = "attendeeReport";
    public static final String REQUIRED_RIGHT = "view_attendee_report";
    @Autowired
    private AttendeeReportPresenter handler;

    private Button refresh = new Button("Refresh");
    private Label data = new Label();

    @PostConstruct
    public void init() {
        addComponent(refresh);
        refresh.addClickListener((Button.ClickListener) clickEvent -> handler.fetchReportData(this));
        addComponent(data);
        data.setContentMode(ContentMode.HTML);
        handler.fetchReportData(this);
        setExpandRatio(data, 1f);
        data.setSizeFull();
        data.setWidthUndefined();
    }

    @Override
    public void afterSuccessfulFetch(String data) {
        this.data.setValue(data);
    }

    public String getRequiredRight() {
        return REQUIRED_RIGHT;
    }
}

package org.kumoricon.site.report.attendees;

import com.vaadin.navigator.View;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.spring.annotation.SpringView;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.Button;
import com.vaadin.ui.Label;
import org.kumoricon.site.report.ReportView;
import org.kumoricon.site.BaseView;
import org.springframework.beans.factory.annotation.Autowired;

import javax.annotation.PostConstruct;

@ViewScope
@SpringView(name = AttendeeReportView.VIEW_NAME)
public class AttendeeReportView extends BaseView implements View, ReportView {
    public static final String VIEW_NAME = "attendeeReport";
    public static final String REQUIRED_RIGHT = "view_attendance_report";
    @Autowired
    private AttendeeReportPresenter handler;

    private Button refresh = new Button("Refresh");
    private Label data = new Label();

    @PostConstruct
    public void init() {
        addComponent(refresh);
        refresh.addClickListener((Button.ClickListener) clickEvent -> handler.fetchReportData(this));
        addComponent(data);
        data.setContentMode(ContentMode.HTML);
        handler.fetchReportData(this);
        setExpandRatio(data, 1f);
        data.setSizeFull();
        data.setWidthUndefined();
    }

    @Override
    public void afterSuccessfulFetch(String data) {
        this.data.setValue(data);
    }

    public String getRequiredRight() {
        return REQUIRED_RIGHT;
    }
}

Make attendance report verify the correct right.

Addresses issue #24.


package uk.org.mygrid.cagrid.servicewrapper.service.ncbiblast.invoker;

import uk.org.mygrid.cagrid.servicewrapper.serviceinvoker.InvokerException;
import uk.org.mygrid.cagrid.servicewrapper.serviceinvoker.ncbiblast.NCBIBlastInvoker;
import uk.org.mygrid.cagrid.servicewrapper.serviceinvoker.ncbiblast.NCBIBlastInvokerImpl;

public class InvokerFactory {
	private static NCBIBlastInvoker invoker;

	public static NCBIBlastInvoker getInvoker() {
		if (invoker == null) {
			synchronized (InvokerFactory.class) {
				if (invoker == null) {
					//invoker = new DummyNCBIBlastInvoker();
					try {
						invoker = new NCBIBlastInvokerImpl();
					} catch (InvokerException e) {
						throw new RuntimeException("Can't instantiate NCBIBlast invoker", e);
					}
				}
			}
		}
		return invoker;
	}
}

package uk.org.mygrid.cagrid.servicewrapper.service.ncbiblast.invoker;

import uk.org.mygrid.cagrid.servicewrapper.serviceinvoker.InvokerException;
import uk.org.mygrid.cagrid.servicewrapper.serviceinvoker.ncbiblast.DummyNCBIBlastInvoker;
import uk.org.mygrid.cagrid.servicewrapper.serviceinvoker.ncbiblast.NCBIBlastInvoker;
import uk.org.mygrid.cagrid.servicewrapper.serviceinvoker.ncbiblast.NCBIBlastInvokerImpl;

public class InvokerFactory {
	private static NCBIBlastInvoker invoker;

	public static NCBIBlastInvoker getInvoker() {
		if (invoker == null) {
			synchronized (InvokerFactory.class) {
				if (invoker == null) {
//					invoker = new DummyNCBIBlastInvoker();
					try {
						invoker = new NCBIBlastInvokerImpl();
					} catch (InvokerException e) {
						throw new RuntimeException("Can't instantiate NCBIBlast invoker", e);
					}
				}
			}
		}
		return invoker;
	}
}

Use real invoker by default

Use real invoker by default


package net.squanchy.contest;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import net.squanchy.R;
import net.squanchy.support.debug.DebugPreferences;

import io.reactivex.android.schedulers.AndroidSchedulers;

class ContestTester {

    private final Activity activity;
    private final DebugPreferences debugPreferences;

    ContestTester(Activity activity) {
        this.activity = activity;
        this.debugPreferences = new DebugPreferences(this.activity);
    }

    boolean testingEnabled() {
        return debugPreferences.contestTestingEnabled();
    }

    void appendDebugControls(ViewGroup viewGroup, ContestService contestService) {
        LayoutInflater factory = LayoutInflater.from(activity);
        View controlsContainer = factory.inflate(R.layout.view_contest_tester, viewGroup, false);
        viewGroup.addView(controlsContainer);

        controlsContainer.findViewById(R.id.contest_testing_add_one)
                .setOnClickListener(view -> unlockRandomAchievement(contestService));
    }

    private void unlockRandomAchievement(ContestService contestService) {
        contestService.addAchievement(String.valueOf(Math.random() * Integer.MAX_VALUE))
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe();
    }
}

package net.squanchy.contest;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import java.util.Random;

import net.squanchy.R;
import net.squanchy.support.debug.DebugPreferences;

import io.reactivex.android.schedulers.AndroidSchedulers;

class ContestTester {

    private static final int MAX_ACHIEVEMENT_ID = Integer.MAX_VALUE;

    private final Activity activity;
    private final DebugPreferences debugPreferences;
    private final Random random;

    ContestTester(Activity activity) {
        this.activity = activity;
        this.debugPreferences = new DebugPreferences(this.activity);
        this.random = new Random();
    }

    boolean testingEnabled() {
        return debugPreferences.contestTestingEnabled();
    }

    void appendDebugControls(ViewGroup viewGroup, ContestService contestService) {
        LayoutInflater factory = LayoutInflater.from(activity);
        View controlsContainer = factory.inflate(R.layout.view_contest_tester, viewGroup, false);
        viewGroup.addView(controlsContainer);

        controlsContainer.findViewById(R.id.contest_testing_add_one)
                .setOnClickListener(view -> unlockRandomAchievement(contestService));
    }

    private void unlockRandomAchievement(ContestService contestService) {
        contestService.addAchievement(generateRandomAchievementId())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe();
    }

    private String generateRandomAchievementId() {
        return String.valueOf(random.nextInt(MAX_ACHIEVEMENT_ID));
    }
}

Fix issues in achievement ID generation

Fix issues in achievement ID generation


package com.blocksolid.okrello.display;

import java.util.regex.Matcher;

/**
 * Created by Dan Buckland on 02/12/2015.
 */
public class Scores {
    public String extractScoreFromString(String string) {
        return "";
    }
}

package com.blocksolid.okrello.display;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created by Dan Buckland on 02/12/2015.
 */
public class Scores {
    public String extractScoreFromString(String string) {
        Pattern pattern = Pattern.compile("\\[(\\d{1}\\.\\d{1})\\]");
        Matcher m = pattern.matcher(string);
        if (m.find()) {
            return m.group(1);
        } else {
            return "";
        }
    }
}

Use basic regex matcher to capture and return a string in the format "d.d"


package zero.zd.zquestionnaire;

import android.os.Bundle;
import android.os.Environment;
import android.support.v7.app.AppCompatActivity;
import android.view.View;

import java.io.File;

public class MainActivity extends AppCompatActivity {

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

        // create a folder
        File folder = new File(Environment.getExternalStorageDirectory().getPath() + "/ZQuestionnaire/");
        if (!folder.exists()) folder.mkdirs();
    }

    public void onClickAnswer(View view) {
        startActivity(LoadQnaActivity.getStartIntent(MainActivity.this));
    }

    public void onClickBuilder(View view) {
        startActivity(QnaBuilderActivity.getStartIntent(MainActivity.this));
    }

}

package zero.zd.zquestionnaire;

import android.os.Bundle;
import android.os.Environment;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;

import java.io.File;

public class MainActivity extends AppCompatActivity {

    private static final String TAG = MainActivity.class.getSimpleName();

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

        // create a folder
        File folder = new File(Environment.getExternalStorageDirectory().getPath() + "/ZQuestionnaire/");
        if (!folder.exists()) {
            if (!folder.mkdirs()) {
                Log.e(TAG, "Failed on creating folders.");
            }
        }
    }

    public void onClickAnswer(View view) {
        startActivity(LoadQnaActivity.getStartIntent(MainActivity.this));
    }

    public void onClickBuilder(View view) {
        startActivity(QnaBuilderActivity.getStartIntent(MainActivity.this));
    }

}

Add Logs on Filed Creation of Folders

:speaker: Add Logs on Filed Creation of Folders


package net.minecraftforge.common;

import net.minecraft.src.*;
import net.minecraftforge.event.*;
import net.minecraftforge.event.entity.*;

public class ForgeInternalHandler
{
    @ForgeSubscribe(priority = EventPriority.HIGHEST)
    public void onEntityJoinWorld(EntityJoinWorldEvent event)
    {
        Entity entity = event.entity;
        if (entity instanceof EntityItem)
        {
            ItemStack item = ((EntityItem)entity).item;
            if (item.getItem().hasCustomEntity(item))
            {
                Entity newEntity = item.getItem().createEntity(event.world, entity, item);
                if (newEntity != null)
                {
                    entity.setDead();
                    event.setCanceled(true);
                    event.world.spawnEntityInWorld(entity);
                }
            }
        }
    }
}

package net.minecraftforge.common;

import net.minecraft.src.*;
import net.minecraftforge.event.*;
import net.minecraftforge.event.entity.*;

public class ForgeInternalHandler
{
    @ForgeSubscribe(priority = EventPriority.HIGHEST)
    public void onEntityJoinWorld(EntityJoinWorldEvent event)
    {
        Entity entity = event.entity;
        if (entity instanceof EntityItem)
        {
            ItemStack item = ((EntityItem)entity).item;
            if (item.getItem().hasCustomEntity(item))
            {
                Entity newEntity = item.getItem().createEntity(event.world, entity, item);
                if (newEntity != null)
                {
                    entity.setDead();
                    event.setCanceled(true);
                    event.world.spawnEntityInWorld(newEntity);
                }
            }
        }
    }
}

Fix recursion issue with new special item entity code.


package rod;

@SuppressWarnings("serial")
public class UnrecognizableObservationException extends Exception {

    public UnrecognizableObservationException(Observation observation) {
        super("Observation of ckass " + observation.getClass() + " is not recognizable by analyzer");
    }

}

package rod;

@SuppressWarnings("serial")
public class UnrecognizableObservationException extends Exception {

    public UnrecognizableObservationException(Observation observation) {
        super("Observation of class " + observation.getClass() + " is not recognizable by analyzer");
    }

}

Fix typo in exception message

Fix typo in exception message


/**
 * Copyright (c) Codice Foundation
 *
 * This is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser
 * General Public License as published by the Free Software Foundation, either version 3 of the
 * License, or 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
 * Lesser General Public License for more details. A copy of the GNU Lesser General Public License
 * is distributed along with this program and can be found at
 * <http://www.gnu.org/licenses/lgpl.html>.
 *
 **/
package org.codice.nitf.filereader;

public enum NitfSecurityClassification
{
    UNKNOWN (""),
    UNCLASSIFIED ("U"),
    RESTRICTED ("R"),
    CONFIDENTIAL ("C"),
    SECRET ("S"),
    TOP_SECRET ("T");

    private final String textEquivalent;
    NitfSecurityClassification(String abbreviation) {
        this.textEquivalent = abbreviation;
    }
    static public NitfSecurityClassification getEnumValue(String textEquivalent) {
        for (NitfSecurityClassification classification : values()) {
            if (textEquivalent.equals(classification.textEquivalent)) {
                return classification;
            }
        }
        return UNKNOWN;
    }
};

/**
 * Copyright (c) Codice Foundation
 *
 * This is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser
 * General Public License as published by the Free Software Foundation, either version 3 of the
 * License, or 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
 * Lesser General Public License for more details. A copy of the GNU Lesser General Public License
 * is distributed along with this program and can be found at
 * <http://www.gnu.org/licenses/lgpl.html>.
 *
 **/
package org.codice.nitf.filereader;

public enum NitfSecurityClassification
{
    UNKNOWN (""),
    UNCLASSIFIED ("U"),
    RESTRICTED ("R"),
    CONFIDENTIAL ("C"),
    SECRET ("S"),
    TOP_SECRET ("T");

    private final String textEquivalent;
    NitfSecurityClassification(String abbreviation) {
        this.textEquivalent = abbreviation;
    }
    static public NitfSecurityClassification getEnumValue(String textEquivalent) {
        for (NitfSecurityClassification classification : values()) {
            if (textEquivalent.equals(classification.textEquivalent)) {
                return classification;
            }
        }
        return UNKNOWN;
    }
    public String getTextEquivalent() {
        return textEquivalent;
    }
};

Add an accessor for the SecurityClassification enum.


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

package org.apache.cassandra.distributed.test;

import org.junit.Test;

import org.apache.cassandra.distributed.Cluster;

import static org.junit.Assert.assertEquals;

public class NodeToolTest extends DistributedTestBase
{
    @Test
    public void test() throws Throwable
    {
        try (Cluster cluster = init(Cluster.create(1)))
        {
            assertEquals(0, cluster.get(1).nodetool("help"));
            assertEquals(1, cluster.get(1).nodetool("not_a_legal_command"));
        }
    }
}

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

package org.apache.cassandra.distributed.test;

import org.junit.Test;

import org.apache.cassandra.distributed.Cluster;

import static org.junit.Assert.assertEquals;

public class NodeToolTest extends DistributedTestBase
{
    @Test
    public void test() throws Throwable
    {
        try (Cluster cluster = init(Cluster.create(1)))
        {
            assertEquals(0, cluster.get(1).nodetool("help"));
            assertEquals(0, cluster.get(1).nodetool("flush"));
            assertEquals(1, cluster.get(1).nodetool("not_a_legal_command"));
        }
    }
}

Add a test for a "real" nodetool command, not only "help"

Patch by Alex Petrov; reviewed by Yifan Cai for CASSANDRA-15429


package org.cbioportal.web.parameter;

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

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

public class PageSettingsIdentifier implements Serializable {

    @NotNull
    private SessionPage page;
    @Size(min = 1, max = PagingConstants.MAX_PAGE_SIZE)
    List<String> origin;

    public SessionPage getPage() {
        return page;
    }

    public void setPage(SessionPage page) {
        this.page = page;
    }

    public List<String> getOrigin() {
        return origin;
    }

    public void setOrigin(List<String> origin) {
        this.origin = origin;
    }

}

package org.cbioportal.web.parameter;

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

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

public class PageSettingsIdentifier implements Serializable {

    @NotNull
    private SessionPage page;
    @Size(min = 1, max = PagingConstants.MAX_PAGE_SIZE)
    // type of it should be similar to PageSettingsData -> origin
    Set<String> origin;

    public SessionPage getPage() {
        return page;
    }

    public void setPage(SessionPage page) {
        this.page = page;
    }

    public Set<String> getOrigin() {
        return origin;
    }

    public void setOrigin(Set<String> origin) {
        this.origin = origin;
    }

}

Fix error in fetching user settings for mutiple studies


/**
 * Copyright 2015 LinkedIn Corp. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 */
package wherehows.models.view;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor
@AllArgsConstructor
public class DatasetExportPolicy {
  private boolean containsUserGeneratedContent;

  private boolean containsUserActionGeneratedContent;

  private boolean containsUserDerivedContent;
}

/**
 * Copyright 2015 LinkedIn Corp. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 */
package wherehows.models.view;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor
@AllArgsConstructor
public class DatasetExportPolicy {
  private boolean containsUserGeneratedContent;

  private boolean containsUserActionGeneratedContent;

  private boolean containsUserDerivedContent;

  private String modifiedBy;

  private Long modifiedTime;
}

Add actor and modified time to export policy class


package com.ryanharter.auto.value.parcel;

import javax.lang.model.element.TypeElement;
import javax.lang.model.type.TypeKind;
import javax.lang.model.type.TypeMirror;
import javax.lang.model.util.Elements;
import javax.lang.model.util.Types;

public final class TypeSimplifier {

  private TypeSimplifier() {
  }

  static boolean isClassOfType(Types typeUtils, TypeMirror type, TypeMirror cls) {
    return type != null && typeUtils.isAssignable(cls, type);
  }

  static TypeMirror typeFromClass(Types types, Elements elements, Class<?> cls) {
    if (cls == void.class) {
      return types.getNoType(TypeKind.VOID);
    } else if (cls.isPrimitive()) {
      String primitiveName = cls.getName().toUpperCase();
      TypeKind primitiveKind = TypeKind.valueOf(primitiveName);
      return types.getPrimitiveType(primitiveKind);
    } else if (cls.isArray()) {
      TypeMirror componentType = typeFromClass(types, elements, cls.getComponentType());
      return types.getArrayType(componentType);
    } else {
      TypeElement element = elements.getTypeElement(cls.getCanonicalName());
      if (element == null) {
        throw new IllegalArgumentException("Unknown type: " + cls.getCanonicalName());
      }
      return element.asType();
    }
  }

}

package com.ryanharter.auto.value.parcel;

import javax.lang.model.type.TypeMirror;
import javax.lang.model.util.Types;

final class TypeSimplifier {

  private TypeSimplifier() {
  }

  static boolean isClassOfType(Types typeUtils, TypeMirror type, TypeMirror cls) {
    return type != null && typeUtils.isAssignable(cls, type);
  }
}

Remove unused code. Reduce util class visibility.


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

package net.openhft.chronicle.wire;

/**
 * Created by peter on 16/03/16.
 */
public abstract class AbstractMarshallable implements Marshallable {
    @Override
    public boolean equals(Object o) {
        return Marshallable.$equals(this, o);
    }

    @Override
    public int hashCode() {
        assert false;
        return Marshallable.$hashCode(this);
    }

    @Override
    public String toString() {
        return Marshallable.$toString(this);
    }
}

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

package net.openhft.chronicle.wire;

/**
 * Created by peter on 16/03/16.
 */
public abstract class AbstractMarshallable implements Marshallable {
    @Override
    public boolean equals(Object o) {
        return Marshallable.$equals(this, o);
    }

    @Override
    public int hashCode() {
        return Marshallable.$hashCode(this);
    }

    @Override
    public String toString() {
        return Marshallable.$toString(this);
    }
}

Add a custom hashCode and equals for performance.


package com.tmitim.twittercli.commands;

import com.github.rvesse.airline.annotations.Command;
import com.github.rvesse.airline.annotations.Option;
import com.tmitim.twittercli.TimeLiner;
import com.tmitim.twittercli.pojos.TimeLine;

import twitter4j.TwitterFactory;

/**
 * Get timeline
 */
@Command(name = "timeline", description = "Get your timeline")
public class TimeLineCommand implements Runnable {

	@Option(name = { "-u", "--user" }, description = "get the timeline for a specific username")
	private String username;

	@Option(name = { "-a", "--all" }, description = "get all tweets (defaults is only new tweets)")
	private boolean allStatuses;

	@Option(name = { "-c", "--clear" }, description = "clear last checked time")
	private boolean clearLast;

	@Override
	public void run() {

		TimeLiner tl = new TimeLiner(
				new TimeLine(TwitterFactory.getSingleton()).setAllStatuses(allStatuses).setUsername(username));

		tl.pullStatuses();

		if (username == null) {
			tl.updateLastCheck();
		}

		if (clearLast) {
			tl.clearLastCheck();
		}

		tl.printStatuses();
	}
}

package com.tmitim.twittercli.commands;

import com.github.rvesse.airline.annotations.Command;
import com.github.rvesse.airline.annotations.Option;
import com.tmitim.twittercli.TimeLiner;
import com.tmitim.twittercli.pojos.TimeLine;

import twitter4j.TwitterFactory;

/**
 * Get timeline
 */
@Command(name = "timeline", description = "Get your timeline")
public class TimeLineCommand implements Runnable {

	@Option(name = { "-u", "--user" }, description = "get the timeline for a specific username")
	private String username;

	@Option(name = { "-a", "--all" }, description = "get all tweets (defaults is only new tweets)")
	private boolean allStatuses;

	@Option(name = { "-c", "--clear" }, description = "clear last checked time before pulling timeline")
	private boolean clearLast;

	@Override
	public void run() {

		TimeLiner tl = new TimeLiner(
				new TimeLine(TwitterFactory.getSingleton()).setAllStatuses(allStatuses).setUsername(username));

		if (clearLast) {
			tl.clearLastCheck();
		}

		tl.pullStatuses();

		if (username == null) {
			tl.updateLastCheck();
		}

		tl.printStatuses();
	}
}

Move timeline check before t pull

Move timeline check before t pull


package com.pr0gramm.app.ui.fragments;

import com.google.common.collect.Lists;
import com.pr0gramm.app.ActivityComponent;
import com.pr0gramm.app.api.pr0gramm.response.Message;
import com.pr0gramm.app.feed.ContentType;
import com.pr0gramm.app.services.UserService;

import java.util.EnumSet;
import java.util.List;

import javax.inject.Inject;

/**
 */
public class WrittenCommentFragment extends MessageInboxFragment {
    @Inject
    UserService userService;

    @Override
    protected LoaderHelper<List<Message>> newLoaderHelper() {
        return LoaderHelper.of(() -> {
            String name = userService.getName().get();
            return getInboxService()
                    .getUserComments(name, EnumSet.allOf(ContentType.class))
                    .map(userComments -> {
                        //noinspection CodeBlock2Expr
                        return Lists.transform(userComments.getComments(),
                                comment -> Message.of(userComments.getUser(), comment));
                    });
        });
    }

    @Override
    protected void injectComponent(ActivityComponent activityComponent) {
        activityComponent.inject(this);
    }
}

package com.pr0gramm.app.ui.fragments;

import com.google.common.collect.Lists;
import com.pr0gramm.app.ActivityComponent;
import com.pr0gramm.app.api.pr0gramm.response.Message;
import com.pr0gramm.app.feed.ContentType;
import com.pr0gramm.app.services.UserService;

import java.util.EnumSet;
import java.util.List;

import javax.inject.Inject;

import rx.Observable;

/**
 */
public class WrittenCommentFragment extends MessageInboxFragment {
    @Inject
    UserService userService;

    @Override
    protected LoaderHelper<List<Message>> newLoaderHelper() {
        return LoaderHelper.of(() -> {
            if (!userService.getName().isPresent())
                return Observable.empty();

            String name = userService.getName().get();
            return getInboxService()
                    .getUserComments(name, EnumSet.allOf(ContentType.class))
                    .map(userComments -> {
                        //noinspection CodeBlock2Expr
                        return Lists.transform(userComments.getComments(),
                                comment -> Message.of(userComments.getUser(), comment));
                    });
        });
    }

    @Override
    protected void injectComponent(ActivityComponent activityComponent) {
        activityComponent.inject(this);
    }
}

Fix error when user is logged out.

Fix error when user is logged out.


package org.pdxfinder.accessionidtatamodel;

/**
 * Created by csaba on 03/07/2017.
 */
public class AccessionData {

    private String symbol;
    private String hgncId;
    private String ensemblId;

    public AccessionData(String symbol, String hgncId, String ensemblId) {
        this.symbol = symbol;
        this.hgncId = hgncId;
        this.ensemblId = ensemblId;
    }

    public String getSymbol() {
        return symbol;
    }

    public String getHgncId() {
        return hgncId;
    }

    public String getEnsemblId() {
        return ensemblId;
    }
}

package org.pdxfinder.accessionidtatamodel;

import java.util.HashSet;
import java.util.Set;

/**
 * Created by csaba on 03/07/2017.
 */
public class AccessionData {

    private String symbol;
    private String hgncId;
    private String entrezId;
    private String ensemblId;
    private Set<String> synonyms;
    private Set<String> prevSymbols;

    public AccessionData(String symbol, String hgncId, String entrezId, String ensemblId) {
        this.symbol = symbol;
        this.hgncId = hgncId;
        this.entrezId = entrezId;
        this.ensemblId = ensemblId;
        this.synonyms = new HashSet<>();
        this.prevSymbols = new HashSet<>();

    }

    public String getSymbol() {
        return symbol;
    }

    public void setSymbol(String symbol) {
        this.symbol = symbol;
    }

    public String getHgncId() {
        return hgncId;
    }

    public void setHgncId(String hgncId) {
        this.hgncId = hgncId;
    }

    public String getEntrezId() {
        return entrezId;
    }

    public void setEntrezId(String entrezId) {
        this.entrezId = entrezId;
    }

    public String getEnsemblId() {
        return ensemblId;
    }

    public void setEnsemblId(String ensemblId) {
        this.ensemblId = ensemblId;
    }

    public Set<String> getSynonyms() {
        return synonyms;
    }

    public Set<String> getPrevSymbols() {
        return prevSymbols;
    }

    public void addPrevSymbol(String symbol){
        this.prevSymbols.add(symbol);
    }

    public void addSynonym(String synonym){
        this.synonyms.add(synonym);
    }
}

Add placeholder for synonyms and prevSymbols


package com.koustuvsinha.benchmarker.utils;

import com.koustuvsinha.benchmarker.models.DbFactoryModel;

import java.util.ArrayList;

/**
 * Created by koustuv on 24/5/15.
 */
public class Constants {

    public static ArrayList<DbFactoryModel> DB_LIST = new ArrayList<DbFactoryModel>() {{
        add(new DbFactoryModel("Realm","v0.83.3","Realm",true));
        add(new DbFactoryModel("ORM Lite Android","v4.48","ORM Lite",true));
        add(new DbFactoryModel("Sugar ORM","v1.4","Satya Narayan",true));
        add(new DbFactoryModel("Green DAO","v1.3","Green DAO",true));
        add(new DbFactoryModel("Active Android","v3.0","Michael Pardo",true));
    }};
}

package com.koustuvsinha.benchmarker.utils;

import com.koustuvsinha.benchmarker.models.DbFactoryModel;

import java.util.ArrayList;

/**
 * Created by koustuv on 24/5/15.
 */
public class Constants {

    public static ArrayList<DbFactoryModel> DB_LIST = new ArrayList<DbFactoryModel>() {{
        add(new DbFactoryModel("Realm","v0.83.3","Realm",true));
        add(new DbFactoryModel("ORM Lite Android","v4.48","ORM Lite",true));
        add(new DbFactoryModel("Sugar ORM","v1.4","Satya Narayan",true));
        add(new DbFactoryModel("Green DAO","v1.3","Green DAO",true));
        add(new DbFactoryModel("Active Android","v3.0","Michael Pardo",true));
        add(new DbFactoryModel("Android SQLite","v1.0","Android",true));
    }};

    public static int DB_TYPE_REALM = 1;
    public static int DB_TYPE_ORMLITE = 2;
    public static int DB_TYPE_SUGARORM = 3;
    public static int DB_TYPE_GREENDAO = 4;
    public static int DB_TYPE_ACTIVEANDROID = 5;
    public static int DB_TYPE_DEFAULT = 6;

}

Update constants as per db list

Update constants as per db list


package org.pacey.dropwizardpebble;

import com.mitchellbosecke.pebble.PebbleEngine;
import com.mitchellbosecke.pebble.error.PebbleException;
import io.dropwizard.Configuration;
import io.dropwizard.lifecycle.setup.LifecycleEnvironment;

import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.util.Locale;

public class PebbleViewRenderer<T extends Configuration> implements ViewRenderer<T> {

	private final PebbleEngineConfigurable<T> pebbleEngineConfigurable;
	private final TemplateResolver templateResolver;
	private PebbleEngine pebbleEngine;

	public PebbleViewRenderer(PebbleEngineConfigurable<T> pebbleEngineConfigurable, TemplateResolver templateResolver) {
		this.pebbleEngineConfigurable = pebbleEngineConfigurable;
		this.templateResolver = templateResolver;
	}

	public void configure(LifecycleEnvironment lifecycleEnvironment, T configuration) {
		final PebbleEngine.Builder builder = new PebbleEngine.Builder();
		this.pebbleEngine = pebbleEngineConfigurable.configure(lifecycleEnvironment, configuration, builder);
	}

	public void render(PebbleView pebbleView, Locale locale, OutputStream output) throws IOException, PebbleException {
		try (final OutputStreamWriter outputStreamWriter = new OutputStreamWriter(output)) {
			pebbleEngine.getTemplate(templateResolver.resolve(pebbleView)).evaluate(outputStreamWriter, pebbleView.getContext(), locale);
		}
	}
}

package org.pacey.dropwizardpebble;

import com.mitchellbosecke.pebble.PebbleEngine;
import com.mitchellbosecke.pebble.error.PebbleException;
import io.dropwizard.Configuration;
import io.dropwizard.lifecycle.setup.LifecycleEnvironment;

import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.nio.charset.Charset;
import java.util.Locale;

public class PebbleViewRenderer<T extends Configuration> implements ViewRenderer<T> {

	private final PebbleEngineConfigurable<T> pebbleEngineConfigurable;
	private final TemplateResolver templateResolver;
	private PebbleEngine pebbleEngine;

	public PebbleViewRenderer(PebbleEngineConfigurable<T> pebbleEngineConfigurable, TemplateResolver templateResolver) {
		this.pebbleEngineConfigurable = pebbleEngineConfigurable;
		this.templateResolver = templateResolver;
	}

	public void configure(LifecycleEnvironment lifecycleEnvironment, T configuration) {
		final PebbleEngine.Builder builder = new PebbleEngine.Builder();
		this.pebbleEngine = pebbleEngineConfigurable.configure(lifecycleEnvironment, configuration, builder);
	}

	public void render(PebbleView pebbleView, Locale locale, OutputStream output) throws IOException, PebbleException {
		try (final OutputStreamWriter outputStreamWriter = new OutputStreamWriter(output, Charset.forName("UTF-8"))) {
			pebbleEngine.getTemplate(templateResolver.resolve(pebbleView)).evaluate(outputStreamWriter, pebbleView.getContext(), locale);
		}
	}
}

Fix the Charset to UTF-8

Fix the Charset to UTF-8


package seedu.task.alerts;

import java.util.Optional;

import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Alert.AlertType;

public class ChangeDirectoryCommandAlert extends Alert{

    public static final String CHANGE_DIRECTORY_COMMAND_TITLE = "Change task directory";
    public static final String CHANGE_DIRECTORY_COMMAND_HEADER_TEXT = "Task directory has been changed successfully, Never Forget must now restart.\nPlease launch the application again";

    public ChangeDirectoryCommandAlert(AlertType alertType) {
        super(alertType);
    }

    public static boolean changeDirectoryCommand(){

        try {
            Alert alert = new Alert(AlertType.WARNING);
            alert.setTitle(CHANGE_DIRECTORY_COMMAND_TITLE);
            alert.setHeaderText(CHANGE_DIRECTORY_COMMAND_HEADER_TEXT);
            Optional<ButtonType> result = alert.showAndWait();
            if (!alert.isShowing()) {
                return true;
            }
            else {
                return false;
            }

        } catch (ExceptionInInitializerError | IllegalStateException e) {
            return false;
        }

    }

}

package seedu.task.alerts;

import java.util.Optional;

import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Alert.AlertType;

public class ChangeDirectoryCommandAlert extends Alert{

    public static final String CHANGE_DIRECTORY_COMMAND_TITLE = "Change task directory";
    public static final String CHANGE_DIRECTORY_COMMAND_HEADER_TEXT = "Task directory has been changed successfully, Never Forget must now restart.\nPlease launch the application again";

    public ChangeDirectoryCommandAlert(AlertType alertType) {
        super(alertType);
    }

    public static boolean changeDirectoryCommand(){

        try {
            Alert alert = new Alert(AlertType.WARNING);
            alert.setTitle(CHANGE_DIRECTORY_COMMAND_TITLE);
            alert.setHeaderText(CHANGE_DIRECTORY_COMMAND_HEADER_TEXT);
            alert.showAndWait();
            if (!alert.isShowing()) {
                return true;
            }
            else {
                return false;
            }

        } catch (ExceptionInInitializerError | IllegalStateException e) {
            return false;
        }

    }

}

Change action after ChangeDirectoryCommand to be executed regardless of any user action to the command


package org.apidesign.demo.rubyjs.fromjava;

import com.oracle.truffle.api.source.Source;
import com.oracle.truffle.api.vm.PolyglotEngine;
import java.io.File;
import java.net.URL;

public final class Main {
    private Main() {
    }

    public static void main(String[] args) throws Exception {
        System.err.println("Setting up PolyglotEngine");
        PolyglotEngine vm = PolyglotEngine.newBuilder().
            build();

        URL url = Main.class.getProtectionDomain().getCodeSource().getLocation();
        File local = new File(url.toURI());
        for (;;) {
            File sieveInRuby = new File(local, "sieve.rb");
            if (sieveInRuby.exists()) {
                break;
            }
            local = local.getParentFile();
        }

        Source ruby = Source.fromFileName(new File(local, "sieve.rb").getPath());
        Source js = Source.fromFileName(new File(local, "sieve.js").getPath());

        vm.eval(ruby);
        vm.eval(js);
    }
}

package org.apidesign.demo.rubyjs.fromjava;

import com.oracle.truffle.api.source.Source;
import com.oracle.truffle.api.vm.PolyglotEngine;
import java.io.File;
import java.net.URL;

public final class Main {
    private Main() {
    }

    public static void main(String[] args) throws Exception {
        System.err.println("Setting up PolyglotEngine");
        PolyglotEngine vm = PolyglotEngine.newBuilder().
            build();

        URL url = Main.class.getProtectionDomain().getCodeSource().getLocation();
        File local = new File(url.toURI());
        for (;;) {
            File sieveInRuby = new File(local, "sieve.rb");
            if (sieveInRuby.exists()) {
                break;
            }
            local = local.getParentFile();
        }

        Source ruby = Source.newBuilder(new File(local, "sieve.rb")).build();
        Source js = Source.newBuilder(new File(local, "sieve.js")).build();

        vm.eval(ruby);
        vm.eval(js);
    }
}

Use builder to construct the source

Use builder to construct the source


/*
 *  Copyright 1999-2004 The Apache Software Foundation
 *
 *  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.apache.commons.collections.iterators;

import java.util.Iterator;

import org.apache.commons.collections.PredicateUtils;

/**
 * A FilterIterator which only returns "unique" Objects.  Internally,
 * the Iterator maintains a Set of objects it has already encountered,
 * and duplicate Objects are skipped.
 *
 * @since Commons Collections 2.1
 * @version $Revision: 1.8 $ $Date: 2004/02/18 00:59:50 $
 *
 * @author Morgan Delagrange
 */
public class UniqueFilterIterator extends FilterIterator {

    //-------------------------------------------------------------------------

    /**
     *  Constructs a new UniqueFilterIterator.
     *
     *  @param iterator  the iterator to use
     */
    public UniqueFilterIterator( Iterator iterator ) {
        super(iterator, PredicateUtils.uniquePredicate());
    }

}

/*
 *  Copyright 1999-2004 The Apache Software Foundation
 *
 *  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.apache.commons.collections.iterators;

import java.util.Iterator;

import org.apache.commons.collections.functors.UniquePredicate;

/**
 * A FilterIterator which only returns "unique" Objects.  Internally,
 * the Iterator maintains a Set of objects it has already encountered,
 * and duplicate Objects are skipped.
 *
 * @since Commons Collections 2.1
 * @version $Revision: 1.9 $ $Date: 2004/05/07 23:29:02 $
 *
 * @author Morgan Delagrange
 */
public class UniqueFilterIterator extends FilterIterator {

    //-------------------------------------------------------------------------

    /**
     *  Constructs a new UniqueFilterIterator.
     *
     *  @param iterator  the iterator to use
     */
    public UniqueFilterIterator( Iterator iterator ) {
        super(iterator, UniquePredicate.getInstance());
    }

}

Change to UniquePredicate to avoid indirect references via PredicateUtils

git-svn-id: b713d2d75405ee089de821fbacfe0f8fc04e1abf@131707 13f79535-47bb-0310-9956-ffa450edef68


package com.faforever.api.dto;

import com.faforever.api.elide.ElideEntity;
import com.github.jasminb.jsonapi.annotations.Id;
import com.github.jasminb.jsonapi.annotations.Relationship;
import com.github.jasminb.jsonapi.annotations.Type;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.jetbrains.annotations.Nullable;

import java.time.OffsetDateTime;

@Data
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
@Builder
@Type(GamePlayerStats.TYPE)
public class GamePlayerStats implements ElideEntity {
  public static final String TYPE = "game";

  @Id
  @EqualsAndHashCode.Include
  private String id;
  private boolean ai;
  private Faction faction;
  private byte color;
  private byte team;
  private byte startSpot;
  private Float beforeMean;
  private Float beforeDeviation;
  private Float afterMean;
  private Float afterDeviation;
  private byte score;
  @Nullable
  private OffsetDateTime scoreTime;

  @Relationship("game")
  private Game game;

  @Relationship("player")
  private Player player;
}

package com.faforever.api.dto;

import com.faforever.api.elide.ElideEntity;
import com.github.jasminb.jsonapi.annotations.Id;
import com.github.jasminb.jsonapi.annotations.Relationship;
import com.github.jasminb.jsonapi.annotations.Type;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.jetbrains.annotations.Nullable;

import java.time.OffsetDateTime;

@Data
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
@Builder
@Type(GamePlayerStats.TYPE)
public class GamePlayerStats implements ElideEntity {
  public static final String TYPE = "gamePlayerStats";

  @Id
  @EqualsAndHashCode.Include
  private String id;
  private boolean ai;
  private Faction faction;
  private byte color;
  private byte team;
  private byte startSpot;
  private Float beforeMean;
  private Float beforeDeviation;
  private Float afterMean;
  private Float afterDeviation;
  private byte score;
  @Nullable
  private OffsetDateTime scoreTime;

  @Relationship("game")
  private Game game;

  @Relationship("player")
  private Player player;
}

Fix wrong type mapping for game player stats


package com.codemonkeylabs.fpslibrary;

import android.app.Application;

/**
 * Created by brianplummer on 8/29/15.
 */
public class TinyDancer
{
    public static TinyDancerBuilder create(){
        return new TinyDancerBuilder();
    }

    public static void hide(Application context) {
        TinyDancerBuilder.hide(context);
    }

}

package com.codemonkeylabs.fpslibrary;

import android.app.Application;

/**
 * Created by brianplummer on 8/29/15.
 */
public class TinyDancer
{
    public static TinyDancerBuilder create(){
        return new TinyDancerBuilder();
    }

    public static void hide(Content context) {
        TinyDancerBuilder.hide(context.getApplicationContext());
    }

}

Change hide parameter to context

Change hide parameter to context

@brianplummer https://github.com/brianPlummer/TinyDancer/issues/21


package it.axant.axemas;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.ViewGroup;
import java.lang.ref.WeakReference;

public class AXMSectionController {
    private WeakReference<SectionFragment> section;

    public AXMSectionController(SectionFragment section) {
        this.section = new WeakReference<SectionFragment>(section);
    }

    protected SectionFragment getSection() {
        return this.section.get();
    }

    public void sectionDidLoad() {
        // web page finished loading
    }

    public void sectionWillLoad() {
        // web page has not yet started to load
    }

    public void sectionOnViewCreate(ViewGroup view) {
        // axemas view/fragment got created
    }

    public boolean isInsideWebView(MotionEvent ev) {
        return true;
    }

    /*
    The following methods are specific to Android as they follow the android excluside lifecycle.
     */
    public void sectionFragmentWillPause() { }
    public void sectionFragmentWillResume() { }
    public void sectionFragmentOnSaveInstanceState(Bundle outState) { }
    public void sectionFragmentOnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { }
    public void sectionFragmentOnActivityResult(int requestCode, int resultCode, Intent data) { }
    public void actionbarRightButtonAction() {}
}

package it.axant.axemas;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.ViewGroup;
import java.lang.ref.WeakReference;

public class AXMSectionController {
    private WeakReference<SectionFragment> section;

    protected AXMSectionController() {
        throw new UnsupportedOperationException("Section Controllers should never be created without a section");
    }

    public AXMSectionController(SectionFragment section) {
        this.section = new WeakReference<SectionFragment>(section);
    }

    protected SectionFragment getSection() {
        return this.section.get();
    }

    public void sectionDidLoad() {
        // web page finished loading
    }

    public void sectionWillLoad() {
        // web page has not yet started to load
    }

    public void sectionOnViewCreate(ViewGroup view) {
        // axemas view/fragment got created
    }

    public boolean isInsideWebView(MotionEvent ev) {
        return true;
    }

    /*
    The following methods are specific to Android as they follow the android excluside lifecycle.
     */
    public void sectionFragmentWillPause() { }
    public void sectionFragmentWillResume() { }
    public void sectionFragmentOnSaveInstanceState(Bundle outState) { }
    public void sectionFragmentOnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { }
    public void sectionFragmentOnActivityResult(int requestCode, int resultCode, Intent data) { }
    public void actionbarRightButtonAction() {}
}

Add unusable default constructor to section controllers, for convenience when subclassing


package org.commcare.dalvik.application;

import org.commcare.android.database.HybridFileBackedSqlStorage;
import org.commcare.android.database.HybridFileBackedSqlStorageMock;
import org.javarosa.core.services.storage.Persistable;

/**
 * @author Phillip Mates (pmates@dimagi.com).
 */
public class CommCareTestApplication extends CommCareApplication {
    @Override
    public <T extends Persistable> HybridFileBackedSqlStorage<T> getFileBackedAppStorage(String name, Class<T> c) {
        return getCurrentApp().getFileBackedStorage(name, c);
    }

    @Override
    public <T extends Persistable> HybridFileBackedSqlStorage<T> getFileBackedUserStorage(String storage, Class<T> c) {
        return new HybridFileBackedSqlStorageMock<>(storage, c, buildUserDbHandle(), getUserKeyRecordId());
    }

    @Override
    public CommCareApp getCurrentApp() {
        return new CommCareTestApp(super.getCurrentApp());
    }
}

package org.commcare.dalvik.application;

import org.commcare.android.database.HybridFileBackedSqlStorage;
import org.commcare.android.database.HybridFileBackedSqlStorageMock;
import org.javarosa.core.services.storage.Persistable;
import org.junit.Assert;

/**
 * @author Phillip Mates (pmates@dimagi.com).
 */
public class CommCareTestApplication extends CommCareApplication {
    @Override
    public void onCreate() {
        super.onCreate();

        Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
            @Override
            public void uncaughtException(Thread thread, Throwable ex) {
                Assert.fail(ex.getMessage());
            }
        });
    }

    @Override
    public <T extends Persistable> HybridFileBackedSqlStorage<T> getFileBackedAppStorage(String name, Class<T> c) {
        return getCurrentApp().getFileBackedStorage(name, c);
    }

    @Override
    public <T extends Persistable> HybridFileBackedSqlStorage<T> getFileBackedUserStorage(String storage, Class<T> c) {
        return new HybridFileBackedSqlStorageMock<>(storage, c, buildUserDbHandle(), getUserKeyRecordId());
    }

    @Override
    public CommCareApp getCurrentApp() {
        return new CommCareTestApp(super.getCurrentApp());
    }
}

Add top-level exception handler that just fails test


package to.etc.testutil;

/**
 * @author Frits Jalvingh
 * Created on 15-04-22.
 */
final public class TestUtil {
	private TestUtil() {}

	public static void nonTestPrintln(String text) {
		if(! inTest())
			System.out.println(text);
	}

	static public boolean inTest() {
		return System.getProperty("surefire.real.class.path") != null || System.getProperty("surefire.test.class.path") != null;
	}

}

package to.etc.testutil;

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

/**
 * @author Frits Jalvingh
 * Created on 15-04-22.
 */
final public class TestUtil {
	private TestUtil() {
	}

	public static void nonTestPrintln(String text) {
		if(!inTest())
			System.out.println(text);
	}

	static public boolean inTest() {
		return System.getProperty("surefire.real.class.path") != null || System.getProperty("surefire.test.class.path") != null;
	}

	static public String getGitBranch() {
		try {
			Process process = Runtime.getRuntime().exec("git rev-parse --abbrev-ref HEAD");
			process.waitFor();
			BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
			return reader.readLine();
		} catch(Exception x) {
			return null;
		}
	}

	static public void main(String[] args) {
		System.out.println("branch: " + getGitBranch());
	}

}

Add code to detect a git branch

[test] Add code to detect a git branch


package br.com.bloder.better_migrations.migrations;

import br.com.bloder.migration.Migration;
import io.realm.DynamicRealm;

/**
 * Created by bloder on 25/09/16.
 */
public class VersionOne extends Migration {

  @Override
  public void up(DynamicRealm realm) {
    realm.getSchema().get("User").addField("age", Integer.class);
  }

  @Override
  public void down(DynamicRealm realm) {
    realm.getSchema().get("User").removeField("age");
  }
}

package br.com.bloder.better_migrations.migrations;

import br.com.bloder.migration.Migration;
import br.com.bloder.migration.schema.BetterSchema;
import io.realm.DynamicRealm;

/**
 * Created by bloder on 25/09/16.
 */
public class VersionOne extends Migration {

  @Override
  public void up(DynamicRealm realm) {
    BetterSchema betterSchema = new BetterSchema();
    betterSchema.setSchema(realm);
    betterSchema.addField("age", Integer.class).inClass("User");
  }

  @Override
  public void down(DynamicRealm realm) {
    BetterSchema betterSchema = new BetterSchema();
    betterSchema.setSchema(realm);
    betterSchema.removeField("age").inClass("User");
  }
}

Change better migration example actions

Change better migration example actions


package com.github.vlsi.mat.optiq;

public class HeapFunctions {
    public static int get_id(Object r) {
        if (r == null || !(r instanceof HeapReference)) return -1;
        return ((HeapReference) r).getIObject().getObjectId();
    }

    public static String toString(Object r) {
        if (r == null) return null;
        return r.toString();
    }
}

package com.github.vlsi.mat.optiq;

import org.eclipse.mat.SnapshotException;
import org.eclipse.mat.snapshot.ISnapshot;
import org.eclipse.mat.snapshot.model.*;

public class HeapFunctions {
    public static int get_id(Object r) {
        HeapReference ref = ensureHeapReference(r);
        return ref == null ? -1 : ref.getIObject().getObjectId();
    }

    public static String toString(Object r) {
        if (r == null) return null;
        return r.toString();
    }

    public static Object get_by_key(Object r, String value) {
        HeapReference ref = ensureHeapReference(r);
        if (ref == null) {
            return null;
        }
        IObject iObject = ref.getIObject();
        ISnapshot snapshot = iObject.getSnapshot();
        String className = iObject.getClazz().getName();

        if (!"java.util.HashMap".equals(className))
        {
            throw new RuntimeException("Unsupported map type: "+className);
        }

        try
        {
            IObjectArray table = (IObjectArray)iObject.resolveValue("table");
            long[] referenceArray = table.getReferenceArray();
            for (long entryAddress : referenceArray)
            {
                if (entryAddress != 0)
                {
                    int entryId = snapshot.mapAddressToId(entryAddress);
                    IObject entry = snapshot.getObject(entryId);
                    while (entry != null)
                    {
                        IObject keyObject = (IObject) entry.resolveValue("key");
                        if (value.equals(toString(keyObject)))
                        {
                            IObject valueObject = (IObject) entry.resolveValue(("value"));
                            if (valueObject != null)
                            {
                                return new HeapReference(snapshot, valueObject);
                            }
                            else
                            {
                                return null;
                            }
                        }

                        entry = (IObject)entry.resolveValue("next");
                    }
                }
            }
        } catch (SnapshotException e)
        {
            throw new RuntimeException(e);
        }

        return null;
    }

    private static HeapReference ensureHeapReference(Object r) {
        return (r == null || !(r instanceof HeapReference)) ?
                null :
                (HeapReference) r;
    }

    private static String toString(IObject o) {
        String classSpecific = o.getClassSpecificName();
        if (classSpecific != null)
            return classSpecific;
        return o.getDisplayName();
    }
}

Add get_by_key function to extract value by key from HashMaps


/****************************************************************************
 * Copyright (C) 2017-2018 ecsec GmbH.
 * All rights reserved.
 * Contact: ecsec GmbH (info@ecsec.de)
 *
 * This file is part of the Open eCard App.
 *
 * GNU General Public License Usage
 * This file may be used under the terms of the GNU General Public
 * License version 3.0 as published by the Free Software Foundation
 * and appearing in the file LICENSE.GPL included in the packaging of
 * this file. Please review the following information to ensure the
 * GNU General Public License version 3.0 requirements will be met:
 * http://www.gnu.org/copyleft/gpl.html.
 *
 * Other Usage
 * Alternatively, this file may be used in accordance with the terms
 * and conditions contained in a signed written agreement between
 * you and ecsec GmbH.
 *
 ***************************************************************************/

package org.openecard.gui.android.eac.types;

/**
 *
 * @author Tobias Wich
 */
public enum PinStatus {

    RC3,
    RC2,
    CAN,
    BLOCKED,
    DEACTIVATED;

    public boolean isBlocked() {
	return BLOCKED == this;
    }

    public boolean isOperational() {
	return ! isBlocked();
    }

    public boolean needsCan() {
	return CAN == this;
    }

}

/****************************************************************************
 * Copyright (C) 2017-2018 ecsec GmbH.
 * All rights reserved.
 * Contact: ecsec GmbH (info@ecsec.de)
 *
 * This file is part of the Open eCard App.
 *
 * GNU General Public License Usage
 * This file may be used under the terms of the GNU General Public
 * License version 3.0 as published by the Free Software Foundation
 * and appearing in the file LICENSE.GPL included in the packaging of
 * this file. Please review the following information to ensure the
 * GNU General Public License version 3.0 requirements will be met:
 * http://www.gnu.org/copyleft/gpl.html.
 *
 * Other Usage
 * Alternatively, this file may be used in accordance with the terms
 * and conditions contained in a signed written agreement between
 * you and ecsec GmbH.
 *
 ***************************************************************************/

package org.openecard.gui.android.eac.types;

/**
 *
 * @author Tobias Wich
 */
public enum PinStatus {

    RC3,
    RC2,
    CAN,
    BLOCKED,
    DEACTIVATED;

    public boolean isBlocked() {
	return BLOCKED == this;
    }

    public boolean isOperational() {
	return ! isBlocked() && DEACTIVATED != this;
    }

    public boolean needsCan() {
	return CAN == this;
    }

}

Check PIN deactivated status when checking for card operationality


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

import org.gradle.api.Describable;
import org.gradle.api.Incubating;

/**
 * Captures user-provided information about a version control system.
 *
 * @since 4.4
 */
@Incubating
public interface VersionControlSpec extends Describable {
    /**
     * Returns a {@link String} identifier which will be unique to this version
     * control specification among other version control specifications.
     */
    String getUniqueId();

    /**
     * Returns the name of the repository.
     */
    String getRepoName();

    /**
     * Returns the relative path to the root of the build within the repository.
     */
    String getRootDir();

    /**
     * Sets the relative path to the root of the build within the repository.
     * <p>
     * Defaults to an empty relative path, meaning the root of the repository.
     */
    void setRootDir(String rootDir);
}

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

import org.gradle.api.Describable;
import org.gradle.api.Incubating;

/**
 * Captures user-provided information about a version control system.
 *
 * @since 4.4
 */
@Incubating
public interface VersionControlSpec extends Describable {
    /**
     * Returns a {@link String} identifier which will be unique to this version
     * control specification among other version control specifications.
     */
    String getUniqueId();

    /**
     * Returns the name of the repository.
     */
    String getRepoName();

    /**
     * Returns the relative path to the root of the build within the repository.
     *
     * @since 4.5
     */
    String getRootDir();

    /**
     * Sets the relative path to the root of the build within the repository.
     * <p>
     * Defaults to an empty relative path, meaning the root of the repository.
     *
     * @since 4.5
     */
    void setRootDir(String rootDir);
}

Annotate new methods with since 4.5

Annotate new methods with since 4.5

Part of gradle/gradle-native#191


package cpw.mods.fml.common.network;

import net.minecraft.src.NetHandler;
import net.minecraft.src.NetworkManager;

public class ModMissingPacket extends FMLPacket
{

    public ModMissingPacket()
    {
        super(Type.MOD_MISSING);
    }

    @Override
    public byte[] generatePacket(Object... data)
    {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public FMLPacket consumePacket(byte[] data)
    {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public void execute(NetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
    {
        // TODO Auto-generated method stub

    }

}

package cpw.mods.fml.common.network;

import java.util.List;

import net.minecraft.src.NetHandler;
import net.minecraft.src.NetworkManager;

public class ModMissingPacket extends FMLPacket
{

    public ModMissingPacket()
    {
        super(Type.MOD_MISSING);
    }

    @Override
    public byte[] generatePacket(Object... data)
    {
        // TODO
        List<String> missing = (List<String>) data[0];
        List<String> badVersion = (List<String>) data[1];

        return new byte[0];
    }

    @Override
    public FMLPacket consumePacket(byte[] data)
    {
        // TODO
        return this;
    }

    @Override
    public void execute(NetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
    {
        // TODO
    }

}

Fix NPE on missing mods - still need to actually handle missing mods properly on client


package forklift.integration;

import forklift.Forklift;
import forklift.connectors.ConnectorException;
import forklift.consumer.Consumer;
import forklift.exception.StartupException;
import forklift.producers.ForkliftProducerI;
import forklift.producers.ProducerException;
import org.junit.Test;

public class ConsumerActionTests extends BaseIntegrationTest {

    /**
     * Test subscribing to a topic, unsubscribing, then resubscribing to the topic.
     */
    @Test
    public void topicTurnoverTest() throws StartupException, ConnectorException, InterruptedException, ProducerException {
        Forklift forklift = serviceManager.newManagedForkliftInstance();
        ForkliftProducerI producer = forklift.getConnector().getQueueProducer("forklift-string-topic");
        sentMessageIds.add(producer.send("message1"));
        final Consumer c1 = new Consumer(StringConsumer.class, forklift);
        // Shutdown the consumer after all the messages have been processed.
        c1.setOutOfMessages((listener) -> {
            listener.shutdown();
        });
        // Start the consumer.
        c1.listen();
        Thread.sleep(3000);
        sentMessageIds.add(producer.send("message2"));
        final Consumer c2 = new Consumer(StringConsumer.class, forklift);
        // Shutdown the consumer after all the messages have been processed.
        c2.setOutOfMessages((listener) -> {
            listener.shutdown();
        });
        // Start the consumer.
        c2.listen();
        messageAsserts();
    }

}

package forklift.integration;

import forklift.Forklift;
import forklift.connectors.ConnectorException;
import forklift.consumer.Consumer;
import forklift.exception.StartupException;
import forklift.producers.ForkliftProducerI;
import forklift.producers.ProducerException;
import org.junit.Test;

public class ConsumerActionTests extends BaseIntegrationTest {

    /**
     * Test subscribing to a topic, unsubscribing, then resubscribing to the topic.
     */
    @Test
    public void topicTurnoverTest() throws StartupException, ConnectorException, InterruptedException, ProducerException {
        Forklift forklift = serviceManager.newManagedForkliftInstance();
        ForkliftProducerI producer = forklift.getConnector().getQueueProducer("forklift-string-topic");
        sentMessageIds.add(producer.send("message1"));
        final Consumer c1 = new Consumer(StringConsumer.class, forklift);

        // Shutdown the consumer after all the messages have been processed.
        c1.setOutOfMessages((listener) -> {
            timeouts++;

            if (sentMessageIds.equals(consumedMessageIds) || timeouts > maxTimeouts) {
                listener.shutdown();
            }
        });
        // Start the consumer.
        c1.listen();

        sentMessageIds.add(producer.send("message2"));
        final Consumer c2 = new Consumer(StringConsumer.class, forklift);

        // Shutdown the consumer after all the messages have been processed.
        timeouts = 0;
        c2.setOutOfMessages((listener) -> {
            timeouts++;

            if (sentMessageIds.equals(consumedMessageIds) || timeouts > maxTimeouts) {
                listener.shutdown();
            }
        });
        // Start the consumer.
        c2.listen();
        messageAsserts();
    }

}

Fix a test that should've been fixed long ago with the others


package com.varunvats.practice.sorting;

public class MergeTopDown extends MergeBase {

    public static <T extends Comparable<T>> void sort(T[] a) {
        final int N = a.length;
        aux = new Comparable[N];
        sort(a, 0, N - 1);
    }

    private static <T extends Comparable<T>> void sort(T[] a, int low, int high) {
        if (low >= high)
            return;
        final int mid = (low + high) / 2;
        sort(a, low, mid);
        sort(a, mid + 1, high);
        if (!less(a[mid], a[mid + 1]))
            merge(a, low, mid, high);
    }

}

package com.varunvats.practice.sorting;

public class MergeTopDown extends MergeBase {

    /**
     * Sorts an array in-place using the top-down merge-sort algorithm.
     *
     * @param a The array to be sorted.
     */
    public static <T extends Comparable<T>> void sort(T[] a) {
        final int N = a.length;
        aux = new Comparable[N];
        sort(a, 0, N - 1);
    }

    private static <T extends Comparable<T>> void sort(T[] a, int low, int high) {
        if (low >= high)
            return;
        final int mid = (low + high) / 2;
        sort(a, low, mid);
        sort(a, mid + 1, high);
        if (!less(a[mid], a[mid + 1]))
            merge(a, low, mid, high);
    }

}

Add doc comment for top-down Merge sort.


package org.basinmc.faucet.event;

import org.basinmc.faucet.internal.warn.Volatile;

/**
 * Marks the annotated type as an event which may be passed to the local event bus.
 *
 * @author Johannes Donath
 */
public interface Event<STATE extends Enum<STATE>> {

  /**
   * Retrieves the default state for this event's execution context.
   *
   * @return an arbitrary state.
   */
  @Volatile
  default STATE getDefaultState() {
    return null;
  }
}

package org.basinmc.faucet.event;

import javax.annotation.Nullable;

/**
 * Marks the annotated type as an event which may be passed to the local event bus.
 *
 * @author Johannes Donath
 */
public interface Event<STATE extends Enum<STATE>> {

  /**
   * Retrieves the default state for this event's execution context.
   *
   * @return an arbitrary state.
   */
  @Nullable
  default STATE getDefaultState() {
    return null;
  }
}

Mark the default state getter nullable in case no state is desired.


package me.devsaki.hentoid.collection.mikan;

import com.google.gson.annotations.Expose;

import me.devsaki.hentoid.database.domains.Attribute;
import me.devsaki.hentoid.enums.AttributeType;
import me.devsaki.hentoid.enums.Site;

public class MikanAttribute {
    // Published by both Collection and Attributes endpoints
    @Expose
    public String name;

    // Published by Collection (book search, recent) endpoints
    @Expose
    public String url;

    // Published by Attributes endpoints
    @Expose
    public int id;
    @Expose
    public int count;
    @Expose
    public String type;

    Attribute toAttribute() {
        AttributeType type;
        switch (this.type) {
            case "language":
                type = AttributeType.LANGUAGE;
                break;
            case "character":
                type = AttributeType.CHARACTER;
                break;
            case "artist":
                type = AttributeType.ARTIST;
                break;
            case "group":
                type = AttributeType.CIRCLE;
                break;
            default:
                type = AttributeType.TAG;
        }
        Attribute result = new Attribute(type, name, url, Site.HITOMI);
        result.setCount(count);
        result.setExternalId(id);

        return result;
    }
}

package me.devsaki.hentoid.collection.mikan;

import com.google.gson.annotations.Expose;

import me.devsaki.hentoid.database.domains.Attribute;
import me.devsaki.hentoid.enums.AttributeType;
import me.devsaki.hentoid.enums.Site;

public class MikanAttribute {
    // Published by both Collection and Attributes endpoints
    @Expose
    public String name;

    // Published by Collection (book search, recent) endpoints
    @Expose
    public String url;

    // Published by Attributes endpoints
    @Expose
    public int id;
    @Expose
    public int count;
    @Expose
    public String type;

    Attribute toAttribute() {
        AttributeType attrType;
        switch (type) {
            case "language":
                attrType = AttributeType.LANGUAGE;
                break;
            case "character":
                attrType = AttributeType.CHARACTER;
                break;
            case "artist":
                attrType = AttributeType.ARTIST;
                break;
            case "group":
                attrType = AttributeType.CIRCLE;
                break;
            default:
                attrType = AttributeType.TAG;
        }
        Attribute result = new Attribute(attrType, name, url, Site.HITOMI);
        result.setCount(count);
        result.setExternalId(id);

        return result;
    }
}

Fix issues reported by Sonar

Fix issues reported by Sonar


package com.github.kratorius.cuckoohash;

public class ViewsTest {
}

package com.github.kratorius.cuckoohash;

import junit.framework.TestCase;

import java.util.AbstractMap;
import java.util.Map;
import java.util.Set;

/**
 * Tests for entrySet(), keySet() and values().
 */
public class ViewsTest extends TestCase {
  @SuppressWarnings("MismatchedQueryAndUpdateOfCollection")
  public void testEmptyEntrySet() {
    CuckooHashMap<String, Integer> m = new CuckooHashMap<>();
    assertTrue(m.entrySet().isEmpty());
  }

  public void testSimpleEntrySet() {
    CuckooHashMap<String, Integer> m = new CuckooHashMap<>();

    m.put("key1", 1);
    assertEquals(1, m.entrySet().size());

    Map.Entry<String, Integer> item = m.entrySet().iterator().next();
    assertEquals(1, (int) item.getValue());
  }

  public void testLargeEntrySet() {
    final int size = 1024;
    CuckooHashMap<String, Integer> m = new CuckooHashMap<>();

    for (int i = 0; i < size; i++){
      m.put("key-" + i, 100);
    }

    Set<Map.Entry<String, Integer>> entrySet = m.entrySet();
    assertEquals(size, entrySet.size());
    assertEquals(size, m.size());

    for (int i = 0; i < size; i++) {
      assertTrue(entrySet.contains(new AbstractMap.SimpleEntry<>("key-" + i, 100)));
    }
  }

  // TODO keySet() and values()
}

Add thorough tests for entrySet()

Add thorough tests for entrySet()


package com.msgilligan.peerlist.config;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableAutoConfiguration
@ComponentScan(basePackages="com.msgilligan.peerlist")
public class Application {

    public static void main(String[] args) {
        SpringApplication app = new SpringApplication(Application.class);
        app.setShowBanner(false);
        ApplicationContext ctx = app.run();
    }

    @Bean
    public ServerProperties myServerProperties() {
        ServerProperties p = new ServerProperties();
        String portStr = System.getProperty("app.port");  // CloudBees Environment Variable for local port
        int port = (portStr != null) ? Integer.parseInt(portStr) : 8080;
        p.setPort(port);
        return p;
    }
}

package com.msgilligan.peerlist.config;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableAutoConfiguration
@ComponentScan(basePackages="com.msgilligan.peerlist")
public class Application {

    public static void main(String[] args) {
        SpringApplication app = new SpringApplication(Application.class);
        app.setShowBanner(false);
        ApplicationContext ctx = app.run();
    }
}

Remove CloudBees port setting method

Remove CloudBees port setting method


package org.javarosa.core.services.storage;

public class StorageModifiedException extends RuntimeException {

}

package org.javarosa.core.services.storage;

public class StorageModifiedException extends RuntimeException {
	public StorageModifiedException() {
		super();
	}

	public StorageModifiedException(String message) {
		super(message);
	}
}

Support Messages in storage modified exceptions