package com.github.kennedyoliveira.pastebin4j.api;

import org.junit.Test;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.*;

/**
 * @author Kennedy Oliveira
 */
public class PasteUtilTest {

    @Test
    public void testGetPasteKeyFromUrl() throws Exception {

        final String pasteBinUrl = "http://pastebin.com/NCSQ6k9N";

        assertThat("NCSQ6k9N", is(equalTo(PasteUtil.getPasteKeyFromUrl(pasteBinUrl))));
    }

    @Test
    public void testGetPasteKeyFromUrlNullCase() throws Exception {
        assertThat(PasteUtil.getPasteKeyFromUrl(null), is(nullValue()));
    }

    @Test
    public void testGetPasteKeyFromInvalidUrl() throws Exception {
        try {
            PasteUtil.getPasteKeyFromUrl("http//google.com");
            fail("Should throwed IllegalArgumentException");
        } catch (Exception e) {
        }

    }
}

package com.github.kennedyoliveira.pastebin4j.api;

import org.junit.Test;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.*;

/**
 * @author Kennedy Oliveira
 */
public class PasteUtilTest {

    @Test
    public void testGetPasteKeyFromUrl() throws Exception {

        final String pasteBinUrl = "https://pastebin.com/NCSQ6k9N";

        assertThat("NCSQ6k9N", is(equalTo(PasteUtil.getPasteKeyFromUrl(pasteBinUrl))));
    }

    @Test
    public void testGetPasteKeyFromUrlNullCase() throws Exception {
        assertThat(PasteUtil.getPasteKeyFromUrl(null), is(nullValue()));
    }

    @Test
    public void testGetPasteKeyFromInvalidUrl() throws Exception {
        try {
            PasteUtil.getPasteKeyFromUrl("http//google.com");
            fail("Should throwed IllegalArgumentException");
        } catch (Exception e) {
        }

    }
}

Fix tests to use HTTPS.

Fix tests to use HTTPS.

PasteUtilTest.testGetPasteKeyFromUrl() used HTTP, not HTTPS.


package blade.cli;

import blade.cli.cmds.Build;
import blade.cli.cmds.IDE;
import blade.cli.cmds.Type;

import java.io.File;

import org.osgi.framework.Version;

import aQute.lib.getopt.Arguments;
import aQute.lib.getopt.Description;
import aQute.lib.getopt.Options;

@Arguments(arg = {"name", "[service]"})
@Description("Creates a new Liferay module project.")
public interface CreateOptions extends Options {

	@Description("If a class is generated in the project, " +
		"provide the name of the class to be generated." +
		" If not provided defaults to Project name.")
	public String classname();

	@Description("The build type of project to create.  "
			+ "Valid values are maven or gradle. Default: gradle")
	public Build build();

	@Description("The directory where to create the new project.")
	public File dir();

	@Description("The type of IDE metadata to create along side "
			+ "the new project.")
	public IDE ide();

	@Description("The type of Liferay module to create. ")
	public Type projectType();

	@Description("The version of Liferay to create the module for, "
			+ "by default its 7.0.0")
	public Version version();

}

package blade.cli;

import blade.cli.cmds.Build;
import blade.cli.cmds.IDE;
import blade.cli.cmds.Type;

import java.io.File;

import org.osgi.framework.Version;

import aQute.lib.getopt.Arguments;
import aQute.lib.getopt.Description;
import aQute.lib.getopt.Options;

@Arguments(arg = {"name", "[service]"})
@Description("Creates a new Liferay module project.")
public interface CreateOptions extends Options {

	@Description("If a class is generated in the project, " +
		"provide the name of the class to be generated." +
		" If not provided defaults to Project name.")
	public String classname();

	@Description("The build type of project to create.  "
			+ "Valid values are maven or gradle. Default: gradle")
	public Build build();

	@Description("The directory where to create the new project.")
	public File dir();

	@Description("The type of IDE metadata to create along side "
			+ "the new project.")
	public IDE ide();

	@Description("The type of Liferay module to create. "
            + "Valid values are service, jspportlet, or portlet.")
	public Type projectType();

	@Description("The version of Liferay to create the module for, "
			+ "by default its 7.0.0")
	public Version version();

}

Add valid values for projectType option of create command


package com.xmunch.atomspace.aux;

public enum VisualizationParams {

	SIZE {
		@Override
		public String get() {
			return "size";
		}
	},
	COLOR {
		@Override
		public String get() {
			return "color";
		}
	},
	FONT_COLOR {
		@Override
		public String get() {
			return "fontcolor";
		}
	},
	SHAPE {
		@Override
		public String get() {
			return "shape";
		}
	},
	LABEL {
		@Override
		public String get() {
			return "label";
		}
	},
	ARROW {
		@Override
		public String get() {
			return "arrow";
		}
	},
	STROKE {
		@Override
		public String get() {
			return "stroke";
		}
	},
	WIDTH {
		@Override
		public String get() {
			return "width";
		}
	},
	SPHERE {
		@Override
		public String get() {
			return "sphere";
		}
	},
	CONE {
		@Override
		public String get() {
			return "cone";
		}
	},
	DASHED {
		@Override
		public String get() {
			return "dashed";
		}
	};

	public abstract String get();
}

package com.xmunch.atomspace.aux;

public enum VisualizationParams {

	SIZE {
		@Override
		public String get() {
			return "size";
		}
	},
	COLOR {
		@Override
		public String get() {
			return "color";
		}
	},
	FONT_COLOR {
		@Override
		public String get() {
			return "fontcolor";
		}
	},
	SHAPE {
		@Override
		public String get() {
			return "shape";
		}
	},
	LABEL {
		@Override
		public String get() {
			return "label";
		}
	},
	ARROW {
		@Override
		public String get() {
			return "arrow";
		}
	},
	ARROW_POSITION {
		@Override
		public String get() {
			return "arrow_position";
		}
	},
	STROKE {
		@Override
		public String get() {
			return "stroke";
		}
	},
	STRENGTH {
		@Override
		public String get() {
			return "strength";
		}
	},
	WIDTH {
		@Override
		public String get() {
			return "width";
		}
	},
	SPHERE {
		@Override
		public String get() {
			return "sphere";
		}
	},
	CONE {
		@Override
		public String get() {
			return "cone";
		}
	},
	DASHED {
		@Override
		public String get() {
			return "dashed";
		}
	};

	public abstract String get();
}

Increase number of visualization params

Increase number of visualization params


package net.mcft.copy.betterstorage.inventory;

import net.mcft.copy.betterstorage.api.IKey;
import net.mcft.copy.betterstorage.misc.Constants;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;

public class InventoryKeyring extends InventoryItem {

	public InventoryKeyring(EntityPlayer player, String title) {
		super(player, 9, (title.isEmpty() ? Constants.containerKeyring : title), !title.isEmpty());
	}

	@Override
	public boolean isItemValidForSlot(int slot, ItemStack stack) {
		return ((stack != null) && (stack.getItem() instanceof IKey) &&
		        ((IKey)stack.getItem()).isNormalKey());
	}

	@Override
	public void onInventoryChanged() {
		updateStack();
	}

	@Override
	protected void updateStack() {
		int count = 0;
		for (ItemStack stack : allContents[0])
			if (stack != null) count++;
		stack.setItemDamage(count);
		super.updateStack();
	}

}

package net.mcft.copy.betterstorage.inventory;

import net.mcft.copy.betterstorage.api.IKey;
import net.mcft.copy.betterstorage.misc.Constants;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;

public class InventoryKeyring extends InventoryItem {

	public InventoryKeyring(EntityPlayer player, String title) {
		super(player, 9, (title.isEmpty() ? Constants.containerKeyring : title), !title.isEmpty());
	}

	@Override
	public boolean isItemValidForSlot(int slot, ItemStack stack) {
		return ((stack == null) || ((stack.getItem() instanceof IKey) &&
		                            ((IKey)stack.getItem()).isNormalKey()));
	}

	@Override
	public void onInventoryChanged() {
		updateStack();
	}

	@Override
	protected void updateStack() {
		int count = 0;
		for (ItemStack stack : allContents[0])
			if (stack != null) count++;
		stack.setItemDamage(count);
		super.updateStack();
	}

}

Fix keys being stuck in keyring container


package poussecafe.environment;

public class MessageListeners {

    public void include(MessageListener listener) {
        MessageListenerType priority = listener.priority();
        if(priority == MessageListenerType.FACTORY) {
            if(factoryListener == null) {
                factoryListener = listener;
            } else {
                throw new IllegalArgumentException("There is already a factory listener for message " + listener.messageClass().getName());
            }
        } else if(priority == MessageListenerType.AGGREGATE) {
            if(aggregateListener == null) {
                aggregateListener = listener;
            } else {
                throw new IllegalArgumentException("There is already a aggregate listener for message " + listener.messageClass().getName());
            }
        } else if(priority == MessageListenerType.REPOSITORY) {
            if(repositoryListener == null) {
                repositoryListener = listener;
            } else {
                throw new IllegalArgumentException("There is already a repository listener for message " + listener.messageClass().getName());
            }
        } else {
            throw new UnsupportedOperationException("Unsupported priority " + priority);
        }
    }

    private MessageListener factoryListener;

    private MessageListener aggregateListener;

    private MessageListener repositoryListener;
}

package poussecafe.environment;

public class MessageListeners {

    public void include(MessageListener listener) {
        MessageListenerType priority = listener.priority();
        if(priority == MessageListenerType.FACTORY) {
            if(factoryListener == null) {
                factoryListener = listener;
            } else {
                throw new IllegalArgumentException("There is already a factory listener in " + listener.aggregateRootClass().orElseThrow() + " for message " + listener.messageClass().getName());
            }
        } else if(priority == MessageListenerType.AGGREGATE) {
            if(aggregateListener == null) {
                aggregateListener = listener;
            } else {
                throw new IllegalArgumentException("There is already an aggregate listener in " + listener.aggregateRootClass().orElseThrow() + " for message " + listener.messageClass().getName());
            }
        } else if(priority == MessageListenerType.REPOSITORY) {
            if(repositoryListener == null) {
                repositoryListener = listener;
            } else {
                throw new IllegalArgumentException("There is already a repository listener in " + listener.aggregateRootClass().orElseThrow() + " for message " + listener.messageClass().getName());
            }
        } else {
            throw new UnsupportedOperationException("Unsupported priority " + priority);
        }
    }

    private MessageListener factoryListener;

    private MessageListener aggregateListener;

    private MessageListener repositoryListener;
}

Improve error message for message listeners consistency rules.


/**
 * Licensed to jclouds, Inc. (jclouds) under one or more
 * contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  jclouds 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.jclouds.karaf.recipe;

import com.google.common.base.Predicate;
import org.jclouds.util.Preconditions2;

public class RecipeProviderPredicates {

    public static Predicate<RecipeProvider> id(final String id) {
        Preconditions2.checkNotEmpty(id, "id must be defined");
        return new Predicate<RecipeProvider>() {
            /**
             * {@inheritDoc}
             */
            @Override
            public boolean apply(RecipeProvider recipeProvider) {
                return recipeProvider.getId().equals(id);
            }

            /**
             * {@inheritDoc}
             */
            @Override
            public String toString() {
                return "id(" + id + ")";
            }
        };
    }
}

/**
 * Licensed to jclouds, Inc. (jclouds) under one or more
 * contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  jclouds 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.jclouds.karaf.recipe;

import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Strings.emptyToNull;

import com.google.common.base.Predicate;

public class RecipeProviderPredicates {

    public static Predicate<RecipeProvider> id(final String id) {
        checkNotNull(emptyToNull(id), "id must be defined");
        return new Predicate<RecipeProvider>() {
            /**
             * {@inheritDoc}
             */
            @Override
            public boolean apply(RecipeProvider recipeProvider) {
                return recipeProvider.getId().equals(id);
            }

            /**
             * {@inheritDoc}
             */
            @Override
            public String toString() {
                return "id(" + id + ")";
            }
        };
    }
}

Replace reference to non-existent Precondtions2

Removed in jclouds 1.6.


package us.feras.mdv.demo;

import us.feras.mdv.MarkdownView;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class MarkdownDataActivity extends Activity {

	EditText markdownEditText;
	MarkdownView markdownView;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.markdown_view);
		markdownEditText = (EditText) findViewById(R.id.markdownText);
		markdownView = (MarkdownView) findViewById(R.id.markdownView);
		String text = "## This is a demo of MarkdownView" + "\n" + "* * *" + "\n" + "### Edit the text and hit update to see the changes on the view.";
		markdownEditText.setText(text);
		updateMarkdownView();

		Button updateView = (Button) findViewById(R.id.updateButton);
		updateView.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				updateMarkdownView();
			}
		});

	}

	void updateMarkdownView() {
		markdownView.loadMarkDownData(markdownEditText.getText().toString());
	}
}

package us.feras.mdv.demo;

import us.feras.mdv.MarkdownView;
import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class MarkdownDataActivity extends Activity {

	EditText markdownEditText;
	MarkdownView markdownView;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.markdown_view);
		markdownEditText = (EditText) findViewById(R.id.markdownText);
		markdownView = (MarkdownView) findViewById(R.id.markdownView);
		String text = "## This is a demo of MarkdownView" + "\n" + "* * *" + "\n" + "### Edit the text and hit update to see the changes on the view.";
		markdownEditText.setText(text);
		markdownView.setBackgroundColor(Color.parseColor("#EED8AE"));
		updateMarkdownView();

		Button updateView = (Button) findViewById(R.id.updateButton);
		updateView.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				updateMarkdownView();
			}
		});

	}

	void updateMarkdownView() {
		markdownView.loadMarkDownData(markdownEditText.getText().toString());
	}
}

Change the background color for an example.


package net.sf.jabref;

import org.junit.Assert;
import org.junit.Test;

import java.util.Arrays;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

public class JabRefCLITest {

    @Test
    public void testCLIParsingLongOptions() {
        JabRefCLI cli = new JabRefCLI(new String[] {"--nogui", "--import=some/file", "--output=some/export/file"});

        Assert.assertEquals("[]", Arrays.toString(cli.getLeftOver()));
        Assert.assertEquals("some/file", cli.getFileImport());
        Assert.assertTrue(cli.isDisableGui());
        Assert.assertEquals("some/export/file", cli.getFileExport());
    }

    @Test
    public void testCLIParsingShortOptions() {
        JabRefCLI cli = new JabRefCLI(new String[] {"-n", "-i=some/file", "-o=some/export/file"});

        Assert.assertEquals("[]", Arrays.toString(cli.getLeftOver()));
        Assert.assertEquals("some/file", cli.getFileImport());
        Assert.assertTrue(cli.isDisableGui());
        Assert.assertEquals("some/export/file", cli.getFileExport());
    }

}

package net.sf.jabref;

import org.junit.Assert;
import org.junit.Test;

import java.util.Arrays;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

public class JabRefCLITest {

    @Test
    public void testCLIParsingLongOptions() {
        JabRefCLI cli = new JabRefCLI(new String[] {"--nogui", "--import=some/file", "--output=some/export/file"});

        Assert.assertEquals("[]", Arrays.toString(cli.getLeftOver()));
        Assert.assertEquals("some/file", cli.getFileImport());
        Assert.assertTrue(cli.isDisableGui());
        Assert.assertEquals("some/export/file", cli.getFileExport());
    }

    @Test
    public void testCLIParsingShortOptions() {
        JabRefCLI cli = new JabRefCLI(new String[] {"-n", "-i=some/file", "-o=some/export/file"});

        Assert.assertEquals("[]", Arrays.toString(cli.getLeftOver()));
        Assert.assertEquals("some/file", cli.getFileImport());
        Assert.assertTrue(cli.isDisableGui());
        Assert.assertEquals("some/export/file", cli.getFileExport());
    }

    @Test
    public void testPreferencesExport() {
        JabRefCLI cli = new JabRefCLI(new String[] {"-n", "-x=some/file"});

        Assert.assertEquals("[]", Arrays.toString(cli.getLeftOver()));
        Assert.assertEquals("some/file", cli.getPreferencesExport());
        Assert.assertTrue(cli.isDisableGui());
    }

}

Add test for export command line option

Add test for export command line option


package game;

import static com.google.common.base.Preconditions.checkArgument;

import java.util.Optional;

/**
 * Created by Dimitry on 14.05.2016.
 */
public class Board
{
  private Player startingPlayer;
  private final int numberOfRows;
  private final int numberOfColumns;
  private Player[][] occupiers;

  public Board(final int numberOfRows, final int numberOfColumns) {
    this.numberOfRows = numberOfRows;
    this.numberOfColumns = numberOfColumns;
    occupiers = new Player[numberOfRows][numberOfColumns];
  }

  public Optional<Player> slotOwner(final int row, final int column) {
    if (occupiers[row][column] == null) {
      return Optional.empty();
    } else {
      return Optional.of(occupiers[row][column]);
    }
  }

  public void insertChip(final int columnNumber, final Player player) {
    int index = numberOfRows - 1;
    while (index >= 0 && occupiers[index][columnNumber] != null) {
      index--;
    }
    checkArgument(index >= 0);
    occupiers[index][columnNumber] = player;
  }

  public int getNumberOfRows() {
    return numberOfRows;
  }

  public int getNumberOfColumns() {
    return numberOfColumns;
  }

  public void setStartingPlayer(final Player player) {
    this.startingPlayer = player;
  }

  public Player getStartingPlayer() {
    return startingPlayer;
  }
}

package game;

import static com.google.common.base.Preconditions.checkArgument;

import java.util.Optional;

/**
 * Created by Dimitry on 14.05.2016.
 */
public class Board
{
  private final int numberOfRows;
  private final int numberOfColumns;
  private Player[][] occupiers;

  public Board(final int numberOfRows, final int numberOfColumns) {
    this.numberOfRows = numberOfRows;
    this.numberOfColumns = numberOfColumns;
    occupiers = new Player[numberOfRows][numberOfColumns];
  }

  public Optional<Player> slotOwner(final int row, final int column) {
    if (occupiers[row][column] == null) {
      return Optional.empty();
    } else {
      return Optional.of(occupiers[row][column]);
    }
  }

  public void insertChip(final int columnNumber, final Player player) {
    int index = numberOfRows - 1;
    while (index >= 0 && occupiers[index][columnNumber] != null) {
      index--;
    }
    checkArgument(index >= 0);
    occupiers[index][columnNumber] = player;
  }

  public int getNumberOfRows() {
    return numberOfRows;
  }

  public int getNumberOfColumns() {
    return numberOfColumns;
  }
}

Revoke starting player from the board.

Revoke starting player from the board.


package com.naba.url.shortner;

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

@Controller
public class UrlShortnerController {

    @RequestMapping("/greeting")
    public String greeting(@RequestParam(value="name", required = false, defaultValue = "World") String name, Model model) {
        model.addAttribute("name", name);
        return "greeting";
    }
}

package com.naba.url.shortner;

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

@Controller
public class UrlShortnerController {

    @RequestMapping("/")
    public String landingPage() {
        return "index";
    }

    @RequestMapping("/url-shortner/{url}")
    public String urlShortner(@PathVariable String url, Model model) {
        model.addAttribute("name", url);
        return "gretting";
    }
}

Update controller * Add mapping for index page * Update mapping to url-shortner html page


import java.util.List;

class C005_ArrayInitialization {
    {
        String[] names = {"Reinier", "Roel"};
        String[] names2 = new String[]{"Reinier", "Roel"};
        String[] names3 = new java.lang.String[]{"Reinier", "Roel"};
        List[] list1 = new List[0];
        List<String>[] list2 = new List<String>[0];
        List<String>[] list3 = new java.util.List<String>[0];
        int[] sized = new int[0];
        int[][] sizedTwoDimensions = new int[0][0];
        int[][] sizedTwoDimensions2 = new int[0][];
        int[][][] sizedThreeDimensions = new int[0][][];
        int[][] empty = {{}};
        int[][] ints = new int[][] {{}};
        int[] singleInts = new int[] {};
        int more[] = {};
        int[] more2[] = {{}};
    }
}

class C005_ArrayInitialization {
    {
        String[] names = {"Reinier", "Roel"};
        String[] names2 = new String[] {"Reinier", "Roel"};
        String[] names3 = new java.lang.String[] {"Reinier", "Roel"};
        int[] sized = new int[0];
        int[][] sizedTwoDimensions = new int[0][0];
        int[][] sizedTwoDimensions2 = new int[0][];
        int[][][] sizedThreeDimensions = new int[0][][];
        int[][] empty = {{}};
        int[][] ints = new int[][] {{}};
        int[] singleInts = new int[] {};
        int more[] = {};
        int[] more2[] = {{}};
    }
}

Make the ArrayInitialization test also compile...


package org.jvirtanen.parity.match;

public enum Side {
    BUY,
    SELL
}

package org.jvirtanen.parity.match;

/**
 * The order side.
 */
public enum Side {
    BUY,
    SELL
}

Add documentation for side in matching engine


package com.openxc.measurements.serializers;

import java.io.IOException;
import java.io.StringWriter;

import java.text.DecimalFormat;

import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonGenerator;

import android.util.Log;

public class JsonSerializer implements MeasurementSerializer {
    private static final String TAG = "JsonSerializer";
    public static final String NAME_FIELD = "name";
    public static final String VALUE_FIELD = "value";
    public static final String EVENT_FIELD = "event";
    public static final String TIMESTAMP_FIELD = "timestamp";
    private static DecimalFormat sTimestampFormatter =
            new DecimalFormat("##########.000000");

    public static String serialize(String name, Object value, Object event,
            Double timestamp) {
        StringWriter buffer = new StringWriter(64);
        JsonFactory jsonFactory = new JsonFactory();
        try {
            JsonGenerator gen = jsonFactory.createJsonGenerator(buffer);

            gen.writeStartObject();
            gen.writeStringField(NAME_FIELD, name);

            if(value != null) {
                gen.writeObjectField(VALUE_FIELD, value);
            }

            if(event != null) {
                gen.writeObjectField(EVENT_FIELD, event);
            }

            if(timestamp != null) {
                gen.writeNumberField(TIMESTAMP_FIELD, timestamp);
            }

            gen.writeEndObject();
            gen.close();
        } catch(IOException e) {
            Log.w(TAG, "Unable to encode all data to JSON -- " +
                    "message may be incomplete", e);
        }
        return buffer.toString();
    }
}

package com.openxc.measurements.serializers;

import java.io.IOException;
import java.io.StringWriter;

import java.text.DecimalFormat;

import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonGenerator;

import android.util.Log;

public class JsonSerializer implements MeasurementSerializer {
    private static final String TAG = "JsonSerializer";
    public static final String NAME_FIELD = "name";
    public static final String VALUE_FIELD = "value";
    public static final String EVENT_FIELD = "event";
    public static final String TIMESTAMP_FIELD = "timestamp";
    private static DecimalFormat sTimestampFormatter =
            new DecimalFormat("##########.000000");

    public static String serialize(String name, Object value, Object event,
            Double timestamp) {
        StringWriter buffer = new StringWriter(64);
        JsonFactory jsonFactory = new JsonFactory();
        try {
            JsonGenerator gen = jsonFactory.createJsonGenerator(buffer);

            gen.writeStartObject();
            gen.writeStringField(NAME_FIELD, name);

            if(value != null) {
                gen.writeObjectField(VALUE_FIELD, value);
            }

            if(event != null) {
                gen.writeObjectField(EVENT_FIELD, event);
            }

            if(timestamp != null) {
                gen.writeFieldName(TIMESTAMP_FIELD);
                gen.writeRawValue(sTimestampFormatter.format(timestamp));
            }

            gen.writeEndObject();
            gen.close();
        } catch(IOException e) {
            Log.w(TAG, "Unable to encode all data to JSON -- " +
                    "message may be incomplete", e);
        }
        return buffer.toString();
    }
}

Use correct timestamp format in serialized JSON.


package org.codehaus.plexus.util;

import junit.framework.TestCase;

import java.util.Map;
import java.util.HashMap;
import java.io.StringReader;
import java.io.StringWriter;

import org.codehaus.plexus.context.DefaultContext;

/**
 * Generated by JUnitDoclet, a tool provided by ObjectFab GmbH under LGPL.
 * Please see www.junitdoclet.org, www.gnu.org and www.objectfab.de for
 * informations about the tool, the licence and the authors.
 */
public class ContextMapAdapterTest
    extends TestCase
{
    public ContextMapAdapterTest( String name )
    {
        super( name );
    }

    public void testInterpolation()
        throws Exception
    {
        DefaultContext context = new DefaultContext();

        context.put( "name", "jason" );

        context.put( "occupation", "exotic dancer" );

        ContextMapAdapter adapter = new ContextMapAdapter( context );

        assertEquals( "jason", (String) adapter.get( "name" ) );

        assertEquals( "exotic dancer", (String) adapter.get( "occupation" ) );

        assertNull( adapter.get( "foo") );
    }
}

package org.codehaus.plexus.util;

import java.io.StringReader;
import java.io.StringWriter;

import junit.framework.TestCase;

import org.codehaus.plexus.context.DefaultContext;

/**
 * Generated by JUnitDoclet, a tool provided by ObjectFab GmbH under LGPL.
 * Please see www.junitdoclet.org, www.gnu.org and www.objectfab.de for
 * informations about the tool, the licence and the authors.
 */
public class ContextMapAdapterTest
    extends TestCase
{
    public ContextMapAdapterTest( String name )
    {
        super( name );
    }

    public void testInterpolation()
        throws Exception
    {
        DefaultContext context = new DefaultContext();

        context.put( "name", "jason" );

        context.put( "occupation", "exotic dancer" );

        ContextMapAdapter adapter = new ContextMapAdapter( context );

        assertEquals( "jason", (String) adapter.get( "name" ) );

        assertEquals( "exotic dancer", (String) adapter.get( "occupation" ) );

        assertNull( adapter.get( "foo") );
    }

    public void testInterpolationWithContext()
        throws Exception
    {
        DefaultContext context = new DefaultContext();
        context.put( "name", "jason" );
        context.put( "noun", "asshole" );

        String foo = "${name} is an ${noun}. ${not.interpolated}";

        InterpolationFilterReader reader =
            new InterpolationFilterReader( new StringReader( foo ), new ContextMapAdapter( context ) );

        StringWriter writer = new StringWriter();
        IOUtil.copy( reader, writer );

        String bar = writer.toString();
        assertEquals( "jason is an asshole. ${not.interpolated}", bar );
    }
}

Add test from InterpolationFilterReaderTest, removing circular dependency.


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

import com.facebook.presto.operator.scalar.ScalarOperator;
import com.facebook.presto.spi.type.StandardTypes;
import io.airlift.slice.Slice;

import static com.facebook.presto.metadata.OperatorType.CAST;

public class HyperLogLogOperators
{
    private HyperLogLogOperators()
    {
    }

    @ScalarOperator(CAST)
    @SqlType(StandardTypes.VARBINARY)
    public static Slice castToBinary(@SqlType(StandardTypes.HYPER_LOG_LOG) Slice slice)
    {
        return slice;
    }
}

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

import com.facebook.presto.operator.scalar.ScalarOperator;
import com.facebook.presto.spi.type.StandardTypes;
import io.airlift.slice.Slice;

import static com.facebook.presto.metadata.OperatorType.CAST;

public class HyperLogLogOperators
{
    private HyperLogLogOperators()
    {
    }

    @ScalarOperator(CAST)
    @SqlType(StandardTypes.VARBINARY)
    public static Slice castToBinary(@SqlType(StandardTypes.HYPER_LOG_LOG) Slice slice)
    {
        return slice;
    }

    @ScalarOperator(CAST)
    @SqlType(StandardTypes.HYPER_LOG_LOG)
    public static Slice castFromVarbinary(@SqlType(StandardTypes.VARBINARY) Slice slice)
    {
        return slice;
    }
}

Add cast from varbinary to HLL

Add cast from varbinary to HLL


package com.fedorvlasov.lazylist;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class LazyAdapter extends BaseAdapter {

    private Activity activity;
    private String[] data;
    private static LayoutInflater inflater=null;
    public ImageLoader imageLoader;

    public LazyAdapter(Activity a, String[] d) {
        activity = a;
        data=d;
        inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        imageLoader=new ImageLoader(activity);
    }

    public int getCount() {
        return data.length;
    }

    public Object getItem(int position) {
        return position;
    }

    public long getItemId(int position) {
        return position;
    }

    public View getView(int position, View convertView, ViewGroup parent) {
        View vi=convertView;
        if(convertView==null)
            vi = inflater.inflate(R.layout.item, null);

        TextView text=(TextView)vi.findViewById(R.id.text);;
        ImageView image=(ImageView)vi.findViewById(R.id.image);
        text.setText("item "+position);
        imageLoader.DisplayImage(data[position], image);
        return vi;
    }
}

package com.fedorvlasov.lazylist;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class LazyAdapter extends BaseAdapter {

    private Activity activity;
    private String[] data;
    private static LayoutInflater inflater=null;
    public ImageLoader imageLoader;

    public LazyAdapter(Activity a, String[] d) {
        activity = a;
        data=d;
        inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        imageLoader=new ImageLoader(activity.getApplicationContext());
    }

    public int getCount() {
        return data.length;
    }

    public Object getItem(int position) {
        return position;
    }

    public long getItemId(int position) {
        return position;
    }

    public View getView(int position, View convertView, ViewGroup parent) {
        View vi=convertView;
        if(convertView==null)
            vi = inflater.inflate(R.layout.item, null);

        TextView text=(TextView)vi.findViewById(R.id.text);;
        ImageView image=(ImageView)vi.findViewById(R.id.image);
        text.setText("item "+position);
        imageLoader.DisplayImage(data[position], image);
        return vi;
    }
}

Revert "Use activity context not application context"

This reverts commit e5ef5b32fc6592df810815226c0297485c4a83c3.


package com.visenze.visearch;

import java.util.Map;

public class ImageResult {

    private final String imName;
    private final Map<String, Object> metadata;
    private final Float score;

    public ImageResult(String imName, Map<String, Object> metatdata, Float score) {
        this.imName = imName;
        this.metadata = metatdata;
        this.score = score;
    }

    public String getImName() {
        return imName;
    }

    public Map<String, Object> getMetadata() {
        return metadata;
    }

    public Float getScore() {
        return score;
    }

}

package com.visenze.visearch;

import java.util.Map;

public class ImageResult {

    private final String imName;
    private final Map<String, String> metadata;
    private final Float score;

    public ImageResult(String imName, Map<String, String> metatdata, Float score) {
        this.imName = imName;
        this.metadata = metatdata;
        this.score = score;
    }

    public String getImName() {
        return imName;
    }

    public Map<String, String> getMetadata() {
        return metadata;
    }

    public Float getScore() {
        return score;
    }

}

Use string value for metadata map in image result for now


package linenux.control;

import java.nio.file.Paths;

import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import linenux.command.result.CommandResult;
import linenux.model.Schedule;
import linenux.storage.XmlScheduleStorage;

/**
 * Controls data flow for the entire application.
 */
public class ControlUnit {
    private Schedule schedule;
    private XmlScheduleStorage scheduleStorage;
    private CommandManager commandManager;
    private ObjectProperty<CommandResult> lastCommandResult = new SimpleObjectProperty<>();

    public ControlUnit() {
        this.scheduleStorage = new XmlScheduleStorage(getDefaultFilePath());
        this.schedule = (hasExistingSchedule()) ? getExistingSchedule() : new Schedule();
        this.commandManager = new CommandManager(schedule);
    }

    public CommandResult execute(String userInput) {
        CommandResult result = commandManager.delegateCommand(userInput);
        lastCommandResult.setValue(result);
        scheduleStorage.saveScheduleToFile(schedule);
        return result;
    }

    private boolean hasExistingSchedule() {
        return scheduleStorage.getFile().exists();
    }

    private Schedule getExistingSchedule() {
        return scheduleStorage.loadScheduleFromFile();
    }

    private String getDefaultFilePath() {
        return Paths.get(".").toAbsolutePath().toString();
    }

    public Schedule getSchedule() {
        return this.schedule;
    }

    public ObjectProperty<CommandResult> getLastCommandResultProperty() {
        return this.lastCommandResult;
    }
}

package linenux.control;

import java.nio.file.Paths;

import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import linenux.command.result.CommandResult;
import linenux.model.Schedule;
import linenux.storage.XmlScheduleStorage;

/**
 * Controls data flow for the entire application.
 */
public class ControlUnit {
    private Schedule schedule;
    private XmlScheduleStorage scheduleStorage;
    private CommandManager commandManager;
    private ObjectProperty<CommandResult> lastCommandResult = new SimpleObjectProperty<>();

    public ControlUnit() {
        this.scheduleStorage = new XmlScheduleStorage(getDefaultFilePath());

        if (this.hasExistingSchedule() && getSchedule() != null) {
            this.schedule = getSchedule();
        } else {
            this.schedule = new Schedule();
        }

        this.commandManager = new CommandManager(schedule);
    }

    public CommandResult execute(String userInput) {
        CommandResult result = commandManager.delegateCommand(userInput);
        lastCommandResult.setValue(result);
        scheduleStorage.saveScheduleToFile(schedule);
        return result;
    }

    private boolean hasExistingSchedule() {
        return scheduleStorage.getFile().exists();
    }

    private Schedule getExistingSchedule() {
        return scheduleStorage.loadScheduleFromFile();
    }

    private String getDefaultFilePath() {
        return Paths.get(".").toAbsolutePath().toString();
    }

    public Schedule getSchedule() {
        return this.schedule;
    }

    public ObjectProperty<CommandResult> getLastCommandResultProperty() {
        return this.lastCommandResult;
    }
}

Fix loading schedule from file

Fix loading schedule from file


/*
 * Copyright 2015 Red Hat, Inc. and/or its affiliates.
 *
 * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
 */
package org.wildfly.swarm.examples.transactions;

import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.wildfly.swarm.container.Container;
import org.wildfly.swarm.jaxrs.JAXRSArchive;
import org.wildfly.swarm.transactions.TransactionsFraction;

/**
 * @author nmcl
 */

public class Main {
    public static void main(String[] args) throws Exception {
        Container container = new Container();

	/*
     * Use specific TransactionFraction even though it doesn't do
	 * any more than the default one - for now.
	 */

        container.subsystem(new TransactionsFraction(4712, 4713));

        // Start the container

        container.start();

	/*
     * Now register JAX-RS resource class.
	 */

        JAXRSArchive appDeployment = ShrinkWrap.create(JAXRSArchive.class);
        appDeployment.addResource(MyResource.class);

        container.deploy(appDeployment);
    }
}

/*
 * Copyright 2015 Red Hat, Inc. and/or its affiliates.
 *
 * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
 */
package org.wildfly.swarm.examples.transactions;

import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.wildfly.swarm.container.Container;
import org.wildfly.swarm.jaxrs.JAXRSArchive;
import org.wildfly.swarm.transactions.TransactionsFraction;

/**
 * @author nmcl
 */

public class Main {
    public static void main(String[] args) throws Exception {
        Container container = new Container();

	/*
     * Use specific TransactionFraction even though it doesn't do
	 * any more than the default one - for now.
	 */

        container.fraction(new TransactionsFraction(4712, 4713));

        // Start the container

        container.start();

	/*
     * Now register JAX-RS resource class.
	 */

        JAXRSArchive appDeployment = ShrinkWrap.create(JAXRSArchive.class);
        appDeployment.addResource(MyResource.class);

        container.deploy(appDeployment);
    }
}

Remove subsystem() usage in favor of fraction()


package com.janosgyerik.tools.util;

import java.util.Arrays;

public class MatrixUtils {

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

    public static String toString(int[][] matrix) {
        StringBuilder builder = new StringBuilder();
        builder.append("[");
        if (matrix.length > 0) {
            builder.append(Arrays.toString(matrix[0]));
            for (int i = 1; i < matrix.length; ++i) {
                builder.append(", ").append(Arrays.toString(matrix[i]));
            }
        }
        builder.append("]");
        return builder.toString();
    }
}

package com.janosgyerik.tools.util;

import java.util.Arrays;

/**
 * Utility class to work with matrices
 */
public class MatrixUtils {

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

    /**
     * Format matrix as String, by joining Arrays.toString of each row
     * @param matrix the matrix to format
     * @return the matrix String
     */
    public static String toString(int[][] matrix) {
        StringBuilder builder = new StringBuilder();
        builder.append("[");
        if (matrix.length > 0) {
            builder.append(Arrays.toString(matrix[0]));
            for (int i = 1; i < matrix.length; ++i) {
                builder.append(", ").append(Arrays.toString(matrix[i]));
            }
        }
        builder.append("]");
        return builder.toString();
    }
}

Add documentation for public class and method


package com.spiddekauga.utils;

/**
 * Various time methods
 */
public class Time {
/**
 * Causes the currently executing thread to sleep (temporarily cease
 * execution) for the specified number of milliseconds, subject to
 * the precision and accuracy of system timers and schedulers. The thread
 * does not lose ownership of any monitors.
 * @param millis the length of time to sleep in milliseconds
 * @throws IllegalArgumentException if the value of {@code millis} is negative
 */
public static void sleep(long millis) {
	try {
		Thread.sleep(millis);
	} catch (InterruptedException e) {
		e.printStackTrace();
	}
}
}

package com.spiddekauga.utils;

import java.text.SimpleDateFormat;
import java.util.Locale;

/**
 * Various time methods
 */
public class Time {
/** ISO Date */
public static final String ISO_DATE = "yyyy-MM-dd'T'HH:mm:ss.SSSX";

/**
 * Create a simple date format from the ISO date
 * @return simple date format with ISO date
 */
public static SimpleDateFormat createIsoDateFormat() {
	return new SimpleDateFormat(ISO_DATE, Locale.ENGLISH);
}

/**
 * Causes the currently executing thread to sleep (temporarily cease execution) for the specified
 * number of milliseconds, subject to the precision and accuracy of system timers and schedulers.
 * The thread does not lose ownership of any monitors.
 * @param millis the length of time to sleep in milliseconds
 * @throws IllegalArgumentException if the value of {@code millis} is negative
 */
public static void sleep(long millis) {
	try {
		Thread.sleep(millis);
	} catch (InterruptedException e) {
		e.printStackTrace();
	}
}
}

Add default ISO time formatter

Add default ISO time formatter


package com.emc.ecs.serviceBroker.config;

import java.net.URL;

import org.cloudfoundry.community.servicebroker.model.BrokerApiVersion;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

import com.emc.ecs.managementClient.Connection;
import com.emc.ecs.serviceBroker.repository.EcsRepositoryCredentials;

@Configuration
@ComponentScan(basePackages = "com.emc.ecs.serviceBroker")
public class BrokerConfig {

	@Value("${endpoint}")
	private String endpoint;

	@Value("${port}")
	private String port;

	@Value("${username}")
	private String username;

	@Value("${password}")
	private String password;

	@Value("${replicationGroup}")
	private String replicationGroup;

	@Value("${namespace}")
	private String namespace;

	@Bean
	public Connection ecsConnection() {
		URL certificate = getClass().getClassLoader().getResource("localhost.pem");
		return new Connection("https://" + endpoint + ":" + port, username, password, certificate);
	}

	@Bean
	public BrokerApiVersion brokerApiVersion() {
		return new BrokerApiVersion("2.7");
	}

	@Bean
	public EcsRepositoryCredentials getRepositoryCredentials() {
		return new EcsRepositoryCredentials(null, null, namespace, replicationGroup);
	}
}

package com.emc.ecs.serviceBroker.config;

import java.net.URL;

import org.cloudfoundry.community.servicebroker.model.BrokerApiVersion;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

import com.emc.ecs.managementClient.Connection;
import com.emc.ecs.serviceBroker.repository.EcsRepositoryCredentials;

@Configuration
@ComponentScan(basePackages = "com.emc.ecs.serviceBroker")
public class BrokerConfig {

	@Value("${endpoint}")
	private String endpoint;

	@Value("${port}")
	private String port;

	@Value("${username}")
	private String username;

	@Value("${password}")
	private String password;

	@Value("${replicationGroup}")
	private String replicationGroup;

	@Value("${namespace}")
	private String namespace;

	@Value("${repositoryUser}")
	private String repositoryUser;

	@Value("${repositoryBucket}")
	private String repositoryBucket;

	@Bean
	public Connection ecsConnection() {
		URL certificate = getClass().getClassLoader().getResource("localhost.pem");
		return new Connection("https://" + endpoint + ":" + port, username, password, certificate);
	}

	@Bean
	public BrokerApiVersion brokerApiVersion() {
		return new BrokerApiVersion("2.7");
	}

	@Bean
	public EcsRepositoryCredentials getRepositoryCredentials() {
		return new EcsRepositoryCredentials(repositoryBucket, repositoryUser, namespace, replicationGroup);
	}
}

Add repository user & broker vars

Add repository user & broker vars


package org.tsugi;

/**
 * This is a class to provide access to the data for the logged-in user
 *
 * This data comes from the LTI launch from the LMS.
 * If this is an anonymous launch the User will be null.
 */
public interface User {

    public final int LEARNER_ROLE = 0;
    public final int INSTRUCTOR_ROLE = 1000;
    public final int TENANT_ADMIN_ROLE = 5000;
    public final int ROOT_ADMIN_ROLE = 10000;

    /**
     * Get the launch associated with this object
     */
    public Launch getLaunch();

    /**
     * The integer primary key for this user in this instance of Tsugi.
     */
    public Long getId();

    /**
     * The user's email
     */
    public String getEmail();

    /**
     * The user's display name
     */
    public String getDisplayname();

    /**
     * Is the user a Mentor? (TBD)
     */
    public boolean isMentor();

    /**
     * Is the user an instructor?
     */
    public boolean isInstructor();

    /**
     * Is the user a Tenant Administrator?
     */
    public boolean isTenantAdmin();

    /**
     * Is the user a Tsugi-wide Administrator?
     */
    public boolean isRootAdmin();

}

package org.tsugi;

/**
 * This is a class to provide access to the data for the logged-in user
 *
 * This data comes from the LTI launch from the LMS.
 * If this is an anonymous launch the User will be null.
 */
public interface User {

    public final int LEARNER_ROLE = 0;
    public final int INSTRUCTOR_ROLE = 1;
    public final int TENANT_ADMIN_ROLE = 1000;
    public final int ROOT_ADMIN_ROLE = 10000;

    /**
     * Get the launch associated with this object
     */
    public Launch getLaunch();

    /**
     * The integer primary key for this user in this instance of Tsugi.
     */
    public Long getId();

    /**
     * The user's email
     */
    public String getEmail();

    /**
     * The user's display name
     */
    public String getDisplayname();

    /**
     * Is the user a Mentor? (TBD)
     */
    public boolean isMentor();

    /**
     * Is the user an instructor?
     */
    public boolean isInstructor();

    /**
     * Is the user a Tenant Administrator?
     */
    public boolean isTenantAdmin();

    /**
     * Is the user a Tsugi-wide Administrator?
     */
    public boolean isRootAdmin();

}

Change the instructor value to be the same as other impls


package org.usfirst.frc.team997.robot.commands;

import org.usfirst.frc.team997.robot.RobotMap;

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

/**
 *
 */
public class AutoGearStraight extends CommandGroup {
    public AutoGearStraight() {
    	addSequential(new DriveToDistance(-112 + RobotMap.Values.robotLength)); // drive backwards into gear deposit
    	addSequential(new AutoDepositGear());
    }
}

package org.usfirst.frc.team997.robot.commands;

import org.usfirst.frc.team997.robot.RobotMap;

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

/**
 *
 */
public class AutoGearStraight extends CommandGroup {
    public AutoGearStraight() {
    	addSequential(new DriveToDistance(-110 + RobotMap.Values.robotLength)); // drive backwards into gear deposit
    	addSequential(new AutoDepositGear());
    }
}

Adjust values for Autonomous Straight routine


package org.commonmark.test;

import org.junit.Test;

public class SpecialInputTest extends RenderingTestCase {

    @Test
    public void nullCharacterShouldBeReplaced() {
        assertRendering("foo\0bar", "
foo\uFFFDbar
\n");
    }

    @Test
    public void nullCharacterEntityShouldBeReplaced() {
        assertRendering("foo�bar", "
foo\uFFFDbar
\n");
    }

    @Test
    public void crLfAsLineSeparatorShouldBeParsed() {
        assertRendering("foo\r\nbar", "
foo\nbar
\n");
    }

    @Test
    public void crLfAtEndShouldBeParsed() {
        assertRendering("foo\r\n", "
foo
\n");
    }

    @Test
    public void surrogatePair() {
        assertRendering("surrogate pair: \uD834\uDD1E", "
surrogate pair: \uD834\uDD1E
\n");
    }

    @Test
    public void surrogatePairInLinkDestination() {
        assertRendering("[title](\uD834\uDD1E)", "
title
\n");
    }

}

package org.commonmark.test;

import org.junit.Test;

public class SpecialInputTest extends RenderingTestCase {

    @Test
    public void nullCharacterShouldBeReplaced() {
        assertRendering("foo\0bar", "
foo\uFFFDbar
\n");
    }

    @Test
    public void nullCharacterEntityShouldBeReplaced() {
        assertRendering("foo�bar", "
foo\uFFFDbar
\n");
    }

    @Test
    public void crLfAsLineSeparatorShouldBeParsed() {
        assertRendering("foo\r\nbar", "
foo\nbar
\n");
    }

    @Test
    public void crLfAtEndShouldBeParsed() {
        assertRendering("foo\r\n", "
foo
\n");
    }

    @Test
    public void mixedLineSeparators() {
        assertRendering("- a\n- b\r- c\r\n- d", "
\n
a
\n
b
\n
c
\n
d
\n
\n");
    }

    @Test
    public void surrogatePair() {
        assertRendering("surrogate pair: \uD834\uDD1E", "
surrogate pair: \uD834\uDD1E
\n");
    }

    @Test
    public void surrogatePairInLinkDestination() {
        assertRendering("[title](\uD834\uDD1E)", "
title
\n");
    }

}

Add test for mixed line separators

Add test for mixed line separators


package org.aksw.kbox.kibe;

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

import org.aksw.kbox.kns.CustomKNSServerList;
import org.aksw.kbox.kns.KNSServerListVisitor;

public class DefaultKNSServerList extends URLKNSServerList {

	// Default KNS table URL
	private final static String DEFAULT_KNS_TABLE_URL = "https://raw.github.com/AKSW/kbox/master";

	private CustomKNSServerList customKNSServerList = new CustomKNSServerList();

	public DefaultKNSServerList() throws MalformedURLException {
		super(new URL(DEFAULT_KNS_TABLE_URL));
	}

	@Override
	public boolean visit(KNSServerListVisitor visitor) throws Exception {
		boolean next = super.visit(visitor);
		if(next) {
			next = customKNSServerList.visit(visitor);
		}
		return next;
	}
}

package org.aksw.kbox.kibe;

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

import org.aksw.kbox.kns.CustomKNSServerList;
import org.aksw.kbox.kns.KNSServerListVisitor;

public class DefaultKNSServerList extends URLKNSServerList {

	// Default KNS table URL
	private final static String DEFAULT_KNS_TABLE_URL = "https://raw.githubusercontent.com/AKSW/KBox/master/kns/2.0/";

	private CustomKNSServerList customKNSServerList = new CustomKNSServerList();

	public DefaultKNSServerList() throws MalformedURLException {
		super(new URL(DEFAULT_KNS_TABLE_URL));
	}

	@Override
	public boolean visit(KNSServerListVisitor visitor) throws Exception {
		boolean next = super.visit(visitor);
		if(next) {
			next = customKNSServerList.visit(visitor);
		}
		return next;
	}
}

Change the default kns table

Change the default kns table


package com.zello.apitest;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

	private APITest apiTest;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		setContentView(R.layout.activity_main);

		apiTest = new APITest("", "", "", "");
	}

}

package com.zello.apitest;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

	private APITest apiTest;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		setContentView(R.layout.activity_main);

		// Input your host url or IP address, your API key, and the administrative username/password combination.
		apiTest = new APITest("", "", "", "");
	}

}

Add instructions to test api

Add instructions to test api


package org.cryptonit.cloud;

/**
 * @author Mathias Brossard
 */
public class Database {

    public Database(String url, String user, String password) {
    }
}

package org.cryptonit.cloud;

import java.sql.Connection;
import java.sql.DriverManager;

/**
 * @author Mathias Brossard
 */
public class Database {

    public Database(String url, String user, String password) {
        Connection c = null;
        try {
            Class.forName("org.postgresql.Driver");
            c = DriverManager.getConnection(url, user, password);
        } catch (Exception e) {
        }
    }
}

Load postgresql driver and attempt connection


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

import com.streamsets.pipeline.api.GenerateResourceBundle;
import com.streamsets.pipeline.api.Label;

import java.io.Serializable;

@GenerateResourceBundle
public enum PipelineState implements Label, Serializable {
  RUNNING("Running"),
  START_ERROR("Start Error"),
  RUN_ERROR("Run Error"),
  STOPPED("Stopped"),
  FINISHED("Finished"),
  DISCONNECTED("Disconnected"),
  CONNECTING("Connecting"),
  STOP_ERROR("Stop Error"),

  ;

  private final String label;

  PipelineState(String label) {
    this.label = label;
  }

  @Override
  public String getLabel() {
    return label;
  }

}

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

import com.streamsets.pipeline.api.GenerateResourceBundle;
import com.streamsets.pipeline.api.Label;

import java.io.Serializable;

@GenerateResourceBundle
public enum PipelineState implements Label, Serializable {
  RUNNING("Running"),
  START_ERROR("Start Error"),
  RUN_ERROR("Run Error"),
  RUNNING_ERROR("Running Error"),
  STOPPED("Stopped"),
  FINISHED("Finished"),
  DISCONNECTED("Disconnected"),
  CONNECTING("Connecting"),
  STOP_ERROR("Stop Error"),

  ;

  private final String label;

  PipelineState(String label) {
    this.label = label;
  }

  @Override
  public String getLabel() {
    return label;
  }

}

SDC-9109: Add RUNNING_ERROR to pipeline states available for notifications.

Change-Id: Idb02918672c1057a1bb94653c6f100374373cd89
Reviewed-on: https://review.streamsets.net/14850
Reviewed-by: Jarcec Cecho <df2d427dacaa504f2ede0aed47c4cdf043778b95@streamsets.com>
Tested-by: StreamSets CI <809627f37325a679986bd660c7713476a56d59cd@streamsets.com>


package org.mtransit.android.commons;

import java.util.concurrent.Executor;

import org.mtransit.android.commons.MTLog;
import org.mtransit.android.commons.task.MTAsyncTask;

public final class TaskUtils implements MTLog.Loggable {

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

	@Override
	public String getLogTag() {
		return TAG;
	}

	public static final Executor THREAD_POOL_EXECUTOR = MTAsyncTask.THREAD_POOL_EXECUTOR;

	@SuppressWarnings("unchecked")
	public static <Params, Progress, Result> void execute(MTAsyncTask<Params, Progress, Result> asyncTask, Params... params) {
		if (asyncTask == null) {
			return;
		}
		asyncTask.executeOnExecutor(THREAD_POOL_EXECUTOR, params);
	}
}

package org.mtransit.android.commons;

import java.util.concurrent.Executor;

import org.mtransit.android.commons.MTLog;
import org.mtransit.android.commons.task.MTAsyncTask;

public final class TaskUtils implements MTLog.Loggable {

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

	@Override
	public String getLogTag() {
		return TAG;
	}

	public static final Executor THREAD_POOL_EXECUTOR = MTAsyncTask.THREAD_POOL_EXECUTOR;

	@SuppressWarnings("unchecked")
	public static <Params, Progress, Result> void execute(MTAsyncTask<Params, Progress, Result> asyncTask, Params... params) {
		if (asyncTask == null) {
			return;
		}
		asyncTask.executeOnExecutor(THREAD_POOL_EXECUTOR, params);
	}

	public static <Params, Progress, Result> boolean cancelQuietly(MTAsyncTask<Params, Progress, Result> asyncTask, boolean mayInterruptIfRunning) {
		try {
			if (asyncTask == null) {
				return false;
			}
			return asyncTask.cancel(mayInterruptIfRunning);
		} catch (Exception e) {
			MTLog.w(TAG, e, "Error while cancelling task!");
			return false;
		}
	}
}

Add utility method to cancel AsyncTasks quietly.


package cal;

public abstract class TrigoOperator extends Operator{

	public TrigoOperator(String sign) {
		super(sign);
	}
}

package cal;

/**
 *
 * @author huiming
 *
 */
public abstract class TrigoOperator extends Operator{

	public TrigoOperator(String sign) {
		super(sign);
	}
}

Create a new branch for Java Doc

[Add] Create a new branch for Java Doc


package com.genymobile.gnirehtet;

import android.net.VpnService;

import java.io.IOException;

/**
 * Provide a valid {@link RelayTunnel}, creating a new one if necessary.
 */
public class RelayTunnelProvider {

    private final VpnService vpnService;
    private RelayTunnel tunnel;
    private boolean first;

    public RelayTunnelProvider(VpnService vpnService) {
        this.vpnService = vpnService;
    }

    public synchronized RelayTunnel getCurrentTunnel() throws IOException, InterruptedException {
        if (!first) {
            // add delay between attempts
            Thread.sleep(5000);
            first = true;
        }
        if (tunnel == null) {
            tunnel = RelayTunnel.open(vpnService);
        }
        return tunnel;
    }

    public synchronized void invalidateTunnel() {
        if (tunnel != null) {
            tunnel.close();
            tunnel = null;
        }
    }
}

package com.genymobile.gnirehtet;

import android.net.VpnService;

import java.io.IOException;

/**
 * Provide a valid {@link RelayTunnel}, creating a new one if necessary.
 */
public class RelayTunnelProvider {

    private final VpnService vpnService;
    private RelayTunnel tunnel;
    private boolean first = true;

    public RelayTunnelProvider(VpnService vpnService) {
        this.vpnService = vpnService;
    }

    public synchronized RelayTunnel getCurrentTunnel() throws IOException, InterruptedException {
        if (tunnel == null) {
            if (!first) {
                // add delay between attempts
                Thread.sleep(5000);
            } else {
                first = false;
            }
            tunnel = RelayTunnel.open(vpnService);
        }
        return tunnel;
    }

    public synchronized void invalidateTunnel() {
        if (tunnel != null) {
            tunnel.close();
            tunnel = null;
        }
    }
}

Fix tunnel provider connection temporization

The mechanism to wait several seconds between connection attempts to
provide a tunnel to PersistentRelayTunnel was totally broken.

Fix it to wait 5 seconds only before creating a new tunnel, except the
very first time.


/*
 * Created on 28-Jan-2006
 */
package uk.org.ponder.htmlutil;

public class HTMLConstants {

  public static final String JS_BLOCK_START = "\n//<![CDATA[\n";
  public static final String JS_BLOCK_END = "\n//]]>\n";

  public static String[][] tagtoURL = {
    {"href", "<a ", "<link "},
    {"src", "<img ", "<frame ", "<script ", "<iframe ", "<style "},
    {"action", "<form "}
  };
// Every tag may have a "background" attribute holding a URL
  public static String[] ubiquitousURL = {"background"};
}

/*
 * Created on 28-Jan-2006
 */
package uk.org.ponder.htmlutil;

public class HTMLConstants {

  public static final String JS_BLOCK_START = "\n//<![CDATA[\n";
  public static final String JS_BLOCK_END = "\n//]]>\n";

  public static String[][] tagtoURL = {
    {"href", "<a ", "<link "},
    {"src", "<img ", "<frame ", "<script ", "<iframe ", "<style ", "<input ", "<embed "},
    {"action", "<form "}
  };
// Every tag may have a "background" attribute holding a URL
  public static String[] ubiquitousURL = {"background"};
}

Support for rewriting of collateral URLs for components, support for <embed>


package com.lyubenblagoev.postfixrest;

import java.io.File;

import org.assertj.core.util.Files;

public final class FileUtils {

	private FileUtils() {
		// Prevent class instantiation
	}

	public static boolean renameFolder(File parentFolder, String oldName, String newName) {
		File oldFolder = new File(parentFolder, oldName);
		File newFolder = new File(parentFolder, newName);
		return oldFolder.renameTo(newFolder);
	}

	public static void deleteFolder(File parentFolder, String name) {
		File folder = new File(parentFolder, name);
		Files.delete(folder);
	}

}

package com.lyubenblagoev.postfixrest;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public final class FileUtils {

	private static final Logger log = LoggerFactory.getLogger(FileUtils.class);

	private FileUtils() {
		// Prevent class instantiation
	}

	public static void renameFolder(File parentFolder, String oldName, String newName) {
		String parentPath = parentFolder.getPath();
		Path oldPath = Paths.get(parentPath, oldName);
		if (!Files.exists(oldPath)) {
			log.info("The path specified doesn't exist: {}", oldPath);
			return;
		}
		Path newPath = Paths.get(parentPath, newName);
		try {
			Files.move(oldPath, newPath);
		} catch (IOException e) {
			log.error("Failed to rename {} to {}", oldName, newName);
		}
	}

	public static void deleteFolder(File parentFolder, String name) {
		Path path = Paths.get(parentFolder.getPath(), name);
		try {
			Files.delete(path);
		} catch (IOException e) {
			log.error("Failed to delete {}", path);
		}
	}

}

Use java.nio.files.Files to rename and delete folders


package me.ycdev.androidlib.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

public class DateTimeUtils {
    /**
     * Generate file name from system time in the format "yyyyMMdd-HHmmss-SSS",
     * @param sysTime System time in milliseconds
     */
    public static String generateFileName(long sysTime) {
        return new SimpleDateFormat("yyyyMMdd-HHmmss-SSS", Locale.US).format(new Date(sysTime));
    }
}

package me.ycdev.androidlib.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

public class DateTimeUtils {
    /**
     * Generate file name from system time in the format "yyyyMMdd-HHmmss-SSS",
     * @param sysTime System time in milliseconds
     */
    public static String generateFileName(long sysTime) {
        return new SimpleDateFormat("yyyyMMdd-HHmmss-SSS", Locale.US).format(new Date(sysTime));
    }

    /**
     * Format the time usage to string like "1d17h37m3s728ms"
     * @param timeUsageMs
     * @return
     */
    public static String getReadeableTimeUsage(long timeUsageMs) {
        long millisecondsLeft = timeUsageMs % 1000;
        if (timeUsageMs == millisecondsLeft) {
            return millisecondsLeft + "ms";
        }

        long seconds = timeUsageMs / 1000;
        long secondsLeft = seconds % 60;
        if (secondsLeft == seconds) {
            return secondsLeft + "s" + millisecondsLeft + "ms";
        }

        long minutes = seconds / 60;
        long minutesLeft = minutes % 60;
        if (minutesLeft == minutes) {
            return minutesLeft + "m" + secondsLeft + "s" + millisecondsLeft + "ms";
        }

        long hours = minutes / 60;
        long hoursLeft = hours % 24;
        if (hoursLeft == hours) {
            return hoursLeft + "h" + minutesLeft + "m" + secondsLeft + "s" + millisecondsLeft + "ms";
        }

        long days = hours / 24;
        return days + "d" + hoursLeft + "h" + minutesLeft + "m" + secondsLeft + "s" + millisecondsLeft + "ms";
    }
}

Add time usage string utils

[master] change: Add time usage string utils

Change-Id: I6778b09355b4611a3ca61fe66108fa4ec0a455e4


package com.wyverngame.rmi.api.method;

import java.rmi.RemoteException;
import java.util.Map;

import com.wyverngame.rmi.api.RMIClient;
import com.wyverngame.rmi.api.http.Request;
import com.wyverngame.rmi.api.response.BattleRanksResponse;

public final class GetBattleRanksMethod extends Method<BattleRanksResponse> {
	@Override
	public BattleRanksResponse process(RMIClient client, Request request) throws RemoteException {
		int limit = Integer.parseInt(request.getOrDefault("limit", Integer.toString(Integer.MAX_VALUE)));
		Map<String, Integer> ranks = client.getWebInterface().getBattleRanks(limit);
		return new BattleRanksResponse(ranks);
	}
}

package com.wyverngame.rmi.api.method;

import java.rmi.RemoteException;
import java.util.Map;

import com.wyverngame.rmi.api.RMIClient;
import com.wyverngame.rmi.api.http.Request;
import com.wyverngame.rmi.api.response.BattleRanksResponse;

public final class GetBattleRanksMethod extends Method<BattleRanksResponse> {
	@Override
	public BattleRanksResponse process(RMIClient client, Request request) throws RemoteException {
		int limit = Integer.parseInt(request.getOrDefault("limit", Integer.toString(10)));
		Map<String, Integer> ranks = client.getWebInterface().getBattleRanks(limit);
		return new BattleRanksResponse(ranks);
	}
}

Update battle ranks cap to 10.

Update battle ranks cap to 10.


package com.alexstyl.specialdates.images;

public final class DecodedImage {

    public static final DecodedImage EMPTY = new DecodedImage(null);

    private final byte[] bytes;

    DecodedImage(byte[] bytes) {
        this.bytes = bytes;
    }

    public byte[] getBytes() {
        return bytes;
    }
}

package com.alexstyl.specialdates.images;

public final class DecodedImage {

    public static final DecodedImage EMPTY = new DecodedImage(null);

    private final byte[] bytes;

    DecodedImage(byte[] bytes) {
        this.bytes = bytes;
    }

    public byte[] getBytes() {
        return bytes.clone();
    }
}

Return copy of array on the getter

Return copy of array on the getter


package com.thoughtworks.xstream.core.util;

public final class FastStack {

    private Object[] stack;
    private int pointer;

    public FastStack(int initialCapacity) {
        stack = new Object[initialCapacity];
    }

    public Object push(Object value) {
        if (pointer + 1 >= stack.length) {
            resizeStack(stack.length * 2);
        }
        stack[pointer++] = value;
        return value;
    }

    public void popSilently() {
        pointer--;
    }

    public Object pop() {
        return stack[--pointer];
    }

    public Object peek() {
        return pointer == 0 ? null : stack[pointer - 1];
    }

    public int size() {
        return pointer;
    }

    public boolean hasStuff() {
        return pointer > 0;
    }

    public Object get(int i) {
        return stack[i];
    }

    private void resizeStack(int newCapacity) {
        Object[] newStack = new Object[newCapacity];
        System.arraycopy(stack, 0, newStack, 0, Math.min(stack.length, newCapacity));
        stack = newStack;
    }

    public String toString() {
        StringBuffer result = new StringBuffer("[");
        for (int i = 0; i < pointer; i++) {
            if (i > 0) {
                result.append(", ");
            }
            result.append(stack[i]);
        }
        result.append(']');
        return result.toString();
    }
}

package com.thoughtworks.xstream.core.util;

public final class FastStack {

    private Object[] stack;
    private int pointer;

    public FastStack(int initialCapacity) {
        stack = new Object[initialCapacity];
    }

    public Object push(Object value) {
        if (pointer + 1 >= stack.length) {
            resizeStack(stack.length * 2);
        }
        stack[pointer++] = value;
        return value;
    }

    public void popSilently() {
        stack[--pointer] = null;
    }

    public Object pop() {
        final Object result = stack[--pointer];
        stack[pointer] = null;
        return result;
    }

    public Object peek() {
        return pointer == 0 ? null : stack[pointer - 1];
    }

    public int size() {
        return pointer;
    }

    public boolean hasStuff() {
        return pointer > 0;
    }

    public Object get(int i) {
        return stack[i];
    }

    private void resizeStack(int newCapacity) {
        Object[] newStack = new Object[newCapacity];
        System.arraycopy(stack, 0, newStack, 0, Math.min(stack.length, newCapacity));
        stack = newStack;
    }

    public String toString() {
        StringBuffer result = new StringBuffer("[");
        for (int i = 0; i < pointer; i++) {
            if (i > 0) {
                result.append(", ");
            }
            result.append(stack[i]);
        }
        result.append(']');
        return result.toString();
    }
}

Drop unnecessary reference to popped elements to allow finalization through GC (XSTR-264).


/**
 * File: ConstantExpression.java
 *
 * Author: David Hay (dhay@localmatters.com)
 * Creation Date: Apr 22, 2010
 * Creation Time: 4:11:11 PM
 *
 * Copyright 2010 Local Matters, Inc.
 * All Rights Reserved
 *
 * Last checkin:
 *  $Author$
 *  $Revision$
 *  $Date$
 */
package org.lesscss4j.model.expression;

import org.lesscss4j.model.AbstractElement;
import org.lesscss4j.transform.EvaluationContext;

public class LiteralExpression extends AbstractElement implements Expression {
    /** Textual value of the literal expression */
    private String _value;

    /** The token type of this literal as defined in {@link org.lesscss4j.parser.antlr.LessCssLexer} */
    private int _type;

    public LiteralExpression() {
    }

    public LiteralExpression(LiteralExpression copy) {
        super(copy);
        _value = copy._value;
    }

    public LiteralExpression(String value) {
        _value = value;
    }

    public String getValue() {
        return _value;
    }

    public void setValue(String value) {
        _value = value;
    }

    public int getType() {
        return _type;
    }

    public void setType(int type) {
        _type = type;
    }

    public Expression evaluate(EvaluationContext context) {
        return this;
    }

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

    public LiteralExpression clone() {
        return new LiteralExpression(this);
    }
}

/**
 * File: ConstantExpression.java
 *
 * Author: David Hay (dhay@localmatters.com)
 * Creation Date: Apr 22, 2010
 * Creation Time: 4:11:11 PM
 *
 * Copyright 2010 Local Matters, Inc.
 * All Rights Reserved
 *
 * Last checkin:
 *  $Author$
 *  $Revision$
 *  $Date$
 */
package org.lesscss4j.model.expression;

import org.lesscss4j.model.AbstractElement;
import org.lesscss4j.transform.EvaluationContext;

public class LiteralExpression extends AbstractElement implements Expression {
    /** Textual value of the literal expression */
    private String _value;

    /** The token type of this literal as defined in {@link org.lesscss4j.parser.antlr.LessCssLexer} */
    private int _type;

    public LiteralExpression() {
    }

    public LiteralExpression(LiteralExpression copy) {
        super(copy);
        _value = copy._value;
        _type = copy._type;
    }

    public LiteralExpression(String value) {
        _value = value;
    }

    public String getValue() {
        return _value;
    }

    public void setValue(String value) {
        _value = value;
    }

    public int getType() {
        return _type;
    }

    public void setType(int type) {
        _type = type;
    }

    public Expression evaluate(EvaluationContext context) {
        return this;
    }

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

    public LiteralExpression clone() {
        return new LiteralExpression(this);
    }
}

Copy the type in the copy constructor.

Copy the type in the copy constructor.

git-svn-id: 2eebe84b5b32eb059849d530d3c549d0da009da8@126243 cb919951-1609-0410-8833-993d306c94f7


package org.genericsystem.reactor.gs;

import org.genericsystem.reactor.Tag;
import org.genericsystem.reactor.gs.GSSubcellDisplayer.TagConstructor;

public class GSHeader extends GSDiv {

	public GSHeader(Tag parent, String string, TagConstructor tag1, String string1, TagConstructor tag2, String string2) {
		super(parent, FlexDirection.ROW);
		addStyle("justify-content", "space-around");
		addStyle("padding", "10px");
		if (tag1 != null) {
			Tag leftTag = tag1.build(this);
			leftTag.setText(string1);
			leftTag.addStyle("flex", "1");
		} else {
			Tag leftTag = new GSDiv(this, FlexDirection.COLUMN);
			leftTag.addStyle("flex", "1");
		}
		new GenericH2Section(this, string) {
			{
				addStyle("flex", "3");
				addStyle("align-items", "center");
				addStyle("color", "White");
			}
		};
		if (tag2 != null) {
			Tag rightTag = tag2.build(this);
			rightTag.setText(string2);
			rightTag.addStyle("flex", "1");
		} else {
			Tag rightTag = new GSDiv(this, FlexDirection.COLUMN);
			rightTag.addStyle("flex", "1");
		}
	};

}

package org.genericsystem.reactor.gs;

import org.genericsystem.reactor.Tag;
import org.genericsystem.reactor.gs.GSSubcellDisplayer.TagConstructor;

public class GSHeader extends GSDiv {

	public GSHeader(Tag parent, String string, TagConstructor tag1, String string1, TagConstructor tag2, String string2) {
		super(parent, FlexDirection.ROW);
		addStyle("justify-content", "space-around");
		addStyle("padding", "10px");
		if (tag1 != null) {
			Tag leftTag = tag1.build(this);
			leftTag.setText(string1);
			leftTag.addStyle("flex", "1");
		} else {
			Tag leftTag = new GSDiv(this, FlexDirection.COLUMN);
			leftTag.addStyle("flex", "1");
		}
		new GenericH2Section(this, string) {
			{
				addStyle("flex", "3");
				addStyle("align-items", "center");
				addStyle("color", "White");
				addStyle("text-shadow", "1px 1px 2px black, 0 0 25px blue, 0 0 5px darkblue");
			}
		};
		if (tag2 != null) {
			Tag rightTag = tag2.build(this);
			rightTag.setText(string2);
			rightTag.addStyle("flex", "1");
		} else {
			Tag rightTag = new GSDiv(this, FlexDirection.COLUMN);
			rightTag.addStyle("flex", "1");
		}
	};

}

Add shadow to application title

Add shadow to application title


package net.mueller_martin.turirun.screens;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.ScreenAdapter;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector3;
import net.mueller_martin.turirun.Turirun;
import net.mueller_martin.turirun.WorldController;

public class GameScreen extends ScreenAdapter {
	Turirun game;
	WorldController world;

	public GameScreen (Turirun game) {
		this.game = game;
		this.world = new WorldController(game);
	}

	public void draw() {
		Gdx.gl.glClearColor(1, 0, 0, 1);
		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
		world.draw(game.batch);
	}

	public void update(float deltaTime) {
		world.update(deltaTime);
	}

	@Override
	public void render (float delta) {
		update(delta);
		draw();
	}
}

package net.mueller_martin.turirun.screens;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.ScreenAdapter;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector3;
import net.mueller_martin.turirun.Turirun;
import net.mueller_martin.turirun.WorldController;

public class GameScreen extends ScreenAdapter {
	Turirun game;
	WorldController world;

	public GameScreen (Turirun game) {
		this.game = game;
		this.world = new WorldController(game);
	}

	public void draw() {
		Gdx.gl.glClearColor(0, 0, 0, 1);
		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
		world.draw(game.batch);
	}

	public void update(float deltaTime) {
		world.update(deltaTime);
	}

	@Override
	public void render (float delta) {
		update(delta);
		draw();
	}
}

Set clear color to black

Set clear color to black


package amu.zhcet;

import amu.zhcet.email.EmailProperties;
import amu.zhcet.firebase.FirebaseProperties;
import amu.zhcet.security.SecureProperties;
import amu.zhcet.storage.StorageProperties;
import io.sentry.Sentry;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.data.jpa.datatables.repository.DataTablesRepositoryFactoryBean;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.web.servlet.resource.ResourceUrlEncodingFilter;

import javax.servlet.DispatcherType;

@SpringBootApplication
@EnableJpaRepositories(repositoryFactoryBeanClass = DataTablesRepositoryFactoryBean.class)
@EnableConfigurationProperties({ApplicationProperties.class, SecureProperties.class,
        EmailProperties.class, StorageProperties.class, FirebaseProperties.class})
public class CoreApplication {

    public static void main(String[] args) {
        Sentry.init();
        SpringApplication.run(CoreApplication.class, args);
    }

}

package amu.zhcet;

import amu.zhcet.email.EmailProperties;
import amu.zhcet.firebase.FirebaseProperties;
import amu.zhcet.security.SecureProperties;
import amu.zhcet.storage.StorageProperties;
import io.sentry.Sentry;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.data.jpa.datatables.repository.DataTablesRepositoryFactoryBean;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.data.repository.config.BootstrapMode;
import org.springframework.web.servlet.resource.ResourceUrlEncodingFilter;

import javax.servlet.DispatcherType;

@SpringBootApplication
@EnableJpaRepositories(
        repositoryFactoryBeanClass = DataTablesRepositoryFactoryBean.class,
        bootstrapMode = BootstrapMode.DEFERRED)
@EnableConfigurationProperties({ApplicationProperties.class, SecureProperties.class,
        EmailProperties.class, StorageProperties.class, FirebaseProperties.class})
public class CoreApplication {

    public static void main(String[] args) {
        Sentry.init();
        SpringApplication.run(CoreApplication.class, args);
    }

}

Enable deferred bootstrap mode for JPA

feat: Enable deferred bootstrap mode for JPA

Fixes #250


package seedu.address.ui;

import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Region;
import seedu.address.model.task.ReadOnlyTask;

public class TaskCard extends UiPart<Region> {

    private static final String FXML = "TaskListCard.fxml";

    @FXML
    private HBox cardPane;
    @FXML
    private Label name;
    @FXML
    private Label id;
    @FXML
    private Label date;
    @FXML
    private Label info;
    @FXML
    private Label priority;
    @FXML
    private FlowPane tags;

    public TaskCard(ReadOnlyTask task, int displayedIndex) {
        super(FXML);
        name.setText(task.getTaskName().taskName);
        id.setText(displayedIndex + ". ");
        date.setText("Deadline: " + task.getDate().value);
        info.setText("Information : " + task.getInfo().value);
        priority.setText("Priority Level : " + task.getPriority().value);
        initTags(task);
    }

    private void initTags(ReadOnlyTask task) {
        task.getTags().forEach(tag -> tags.getChildren().add(new Label(tag.tagName)));
    }
}

package seedu.address.ui;

import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Region;
import seedu.address.model.task.ReadOnlyTask;

public class TaskCard extends UiPart<Region> {

    private static final String FXML = "TaskListCard.fxml";

    @FXML
    private HBox cardPane;
    @FXML
    private Label name;
    @FXML
    private Label id;
    @FXML
    private Label date;
    @FXML
    private Label info;
    @FXML
    private Label priority;
    @FXML
    private FlowPane tags;

    public TaskCard(ReadOnlyTask task, int displayedIndex) {
        super(FXML);
        name.setText(task.getTaskName().taskName);
        id.setText(displayedIndex + ". ");
        date.setText(task.getDate().value);
        info.setText(task.getInfo().value);
        priority.setText(task.getPriority().value);
        initTags(task);
    }

    private void initTags(ReadOnlyTask task) {
        task.getTags().forEach(tag -> tags.getChildren().add(new Label(tag.tagName)));
    }
}

Fix junit - By removing retarded stuffs from taskcard class


package nl.ekholabs.nlp.controller;

import java.io.IOException;

import nl.ekholabs.nlp.client.ElsieDeeSightFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import static org.springframework.http.MediaType.MULTIPART_FORM_DATA_VALUE;

@RestController
public class FaceClassifierController {

  private final ElsieDeeSightFeignClient elsieDeeSightFeignClient;

  @Autowired
  public FaceClassifierController(final ElsieDeeSightFeignClient elsieDeeSightFeignClient) {
    this.elsieDeeSightFeignClient = elsieDeeSightFeignClient;
  }

  @PostMapping(consumes = MULTIPART_FORM_DATA_VALUE)
  public ResponseEntity<byte[]> processImage(final @RequestParam(value = "image") MultipartFile face) throws IOException {
    return elsieDeeSightFeignClient.process(face);
  }

}

package nl.ekholabs.nlp.controller;

import java.io.IOException;

import nl.ekholabs.nlp.client.ElsieDeeSightFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import static org.springframework.http.MediaType.MULTIPART_FORM_DATA_VALUE;

@RestController
public class FaceClassifierController {

  private final ElsieDeeSightFeignClient elsieDeeSightFeignClient;

  @Autowired
  public FaceClassifierController(final ElsieDeeSightFeignClient elsieDeeSightFeignClient) {
    this.elsieDeeSightFeignClient = elsieDeeSightFeignClient;
  }

  @PostMapping(consumes = MULTIPART_FORM_DATA_VALUE)
  public ResponseEntity<byte[]> processImage(final @RequestParam(value = "image") MultipartFile image) throws IOException {
    return elsieDeeSightFeignClient.process(image);
  }

}

Rename face parameter to image.

Rename face parameter to image.


package com.alexstyl.specialdates.events;

import android.support.annotation.ColorRes;
import android.support.annotation.StringRes;

import com.alexstyl.specialdates.R;

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

public enum EventType {
    BIRTHDAY(EventColumns.TYPE_BIRTHDAY, R.string.birthday, R.color.birthday_red),
    NAMEDAY(EventColumns.TYPE_NAMEDAY, R.string.nameday, R.color.nameday_blue);

    private static final Map<Integer, EventType> map;

    static {
        map = new HashMap<>();
        for (EventType eventType : values()) {
            map.put(eventType.id, eventType);
        }
    }

    private final int id;
    private final int eventNameRes;
    private final int eventColorRes;

    EventType(@EventTypeId int id, @StringRes int nameResId, @ColorRes int colorResId) {
        this.id = id;
        this.eventNameRes = nameResId;
        this.eventColorRes = colorResId;
    }

    @StringRes
    public int nameRes() {
        return eventNameRes;
    }

    @ColorRes
    public int getColorRes() {
        return eventColorRes;
    }

    public static EventType fromId(@EventTypeId int eventTypeId) {
        if (map.containsKey(eventTypeId)) {
            return map.get(eventTypeId);
        }
        throw new IllegalArgumentException("No event type with id " + eventTypeId);
    }
}

package com.alexstyl.specialdates.events;

import android.support.annotation.ColorRes;
import android.support.annotation.StringRes;

import com.alexstyl.specialdates.R;

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

public enum EventType {
    BIRTHDAY(EventColumns.TYPE_BIRTHDAY, R.string.birthday, R.color.birthday_red),
    NAMEDAY(EventColumns.TYPE_NAMEDAY, R.string.nameday, R.color.nameday_blue);

    private static final Map<Integer, EventType> map;

    private final int eventTypeId;
    private final int eventNameRes;
    private final int eventColorRes;

    static {
        map = new HashMap<>();
        for (EventType eventType : values()) {
            map.put(eventType.eventTypeId, eventType);
        }
    }

    public static EventType fromId(@EventTypeId int eventTypeId) {
        if (map.containsKey(eventTypeId)) {
            return map.get(eventTypeId);
        }
        throw new IllegalArgumentException("No event type with eventTypeId " + eventTypeId);
    }

    EventType(@EventTypeId int eventTypeId, @StringRes int nameResId, @ColorRes int colorResId) {
        this.eventTypeId = eventTypeId;
        this.eventNameRes = nameResId;
        this.eventColorRes = colorResId;
    }

    @StringRes
    public int nameRes() {
        return eventNameRes;
    }

    @ColorRes
    public int getColorRes() {
        return eventColorRes;
    }
}

Move fields to top and give explicit name to id


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

import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.openqa.selenium.opera.OperaDriver;

import io.github.bonigarcia.seljup.SeleniumExtension;

public class ForcedOperaJupiterTest {

    @RegisterExtension
    static SeleniumExtension seleniumExtension = new SeleniumExtension();

    @BeforeEach
    void setup() {
        seleniumExtension.getConfig().setExceptionWhenNoDriver(false);
    }

    @Test
    public void operaTest(OperaDriver driver) {
        assertThat(driver, nullValue());
    }

}

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

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.openqa.selenium.opera.OperaDriver;

import io.github.bonigarcia.seljup.SeleniumExtension;

public class ForcedOperaJupiterTest {

    @RegisterExtension
    static SeleniumExtension seleniumExtension = new SeleniumExtension();

    @BeforeEach
    void setup() {
        seleniumExtension.getConfig().setExceptionWhenNoDriver(false);
    }

    @Test
    public void operaTest(OperaDriver driver) {
        // Even if Opera is not installed, test should reach this point
    }

}

Remove assertion in forced Opera test

Remove assertion in forced Opera test


package com.alexstyl.specialdates.search;

import android.content.Context;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.widget.EditText;

public class BackKeyEditText extends android.support.v7.widget.AppCompatEditText {
    public BackKeyEditText(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    private OnBackKeyPressedListener listener;

    public void setOnBackKeyPressedListener(OnBackKeyPressedListener listener) {
        this.listener = listener;
    }

    @Override
    public boolean onKeyPreIme(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK && listener.onBackButtonPressed()) {
            return true;
        }
        return super.onKeyPreIme(keyCode, event);
    }
}

package com.alexstyl.specialdates.search;

import android.content.Context;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.widget.EditText;

public class BackKeyEditText extends EditText {
    public BackKeyEditText(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    private OnBackKeyPressedListener listener;

    public void setOnBackKeyPressedListener(OnBackKeyPressedListener listener) {
        this.listener = listener;
    }

    @Override
    public boolean onKeyPreIme(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK && listener.onBackButtonPressed()) {
            return true;
        }
        return super.onKeyPreIme(keyCode, event);
    }
}

Extend EditText instead of AppCompatEditText


package com.activeandroid.widget;

import java.util.List;

import android.content.Context;
import android.widget.ArrayAdapter;

import com.activeandroid.Model;

public class ModelAdapter<T extends Model> extends ArrayAdapter<T> {

	public ModelAdapter(Context context, int textViewResourceId) {
		super(context, textViewResourceId);
	}

	public ModelAdapter(Context context, int resource,
			int textViewResourceId) {
		super(context, resource, textViewResourceId);
	}

	public ModelAdapter(Context context, int textViewResourceId,
			List<T> objects) {
		super(context, textViewResourceId, objects);
	}

	public ModelAdapter(Context context, int resource,
			int textViewResourceId, List<T> objects) {
		super(context, resource, textViewResourceId, objects);
	}

	/**
	 * Clears the adapter and, if data != null, fills if with new Items.
	 *
	 * @param data A List<T> which members get added to the adapter.
	 */
	public void setData(List<T> data) {
	    clear();
	    if (data != null) {
	        for (T t : data) {
				add(t);
			}
	    }
	}

	/**
	 * @throws RuntimeException If no record is found.
	 * @return The Id of the record at position.
	 */
	@Override
	public long getItemId(int position) {
		T t = this.getItem(position);
		if (t!=null)
			return t.getId();
		else
			throw new RuntimeException("ItemNotfound");
	}

}

package com.activeandroid.widget;

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

import android.content.Context;
import android.widget.ArrayAdapter;

import com.activeandroid.Model;

public class ModelAdapter<T extends Model> extends ArrayAdapter<T> {
	public ModelAdapter(Context context, int textViewResourceId) {
		super(context, textViewResourceId);
	}

	public ModelAdapter(Context context, int resource, int textViewResourceId) {
		super(context, resource, textViewResourceId);
	}

	public ModelAdapter(Context context, int textViewResourceId, List<T> objects) {
		super(context, textViewResourceId, objects);
	}

	public ModelAdapter(Context context, int resource, int textViewResourceId, List<T> objects) {
		super(context, resource, textViewResourceId, objects);
	}

	/**
	 * Clears the adapter and, if data != null, fills if with new Items.
	 *
	 * @param collection A Collection<? extends T> which members get added to the adapter.
	 */
	public void setData(Collection<? extends T> collection) {
		clear();

		if (collection != null) {
			for (T item : collection) {
				add(item);
			}
		}
	}

	/**
	 * @return The Id of the record at position.
	 */
	@Override
	public long getItemId(int position) {
		T item = getItem(position);

		if (item != null) {
			return item.getId();
		}
		else {
			return -1;
		}
	}
}

Format police. getItemId() fails silently. setData conforms to Android standard.