text stringlengths 14 410k | label int32 0 9 |
|---|---|
@Override
@MethodInfo(author = "Pankaj", comments = "Main method", date = "Nov 17 2012", revision = 1)
public String toString() {
return "Overriden toString method";
} | 0 |
@Override
public boolean takeControl() {
double distance = Sputnik.opp.getPose().distanceTo(new Point(0, 0));
Thread.yield();
// System.out.println("distance: " + distance);
if (Localizing.cornerCount != 2) {
return false;
}
if (Sputnik.robotMap.getHeading() == 0
|| Sputnik.robotMap.getHeading() ==... | 9 |
private void applyBackgrounds(Human actor) {
Background root = vocation ;
if (birth == null) {
final Batch <Float> weights = new Batch <Float> () ;
for (Background v : Background.OPEN_CLASSES) {
weights.add(ratePromotion(root, actor)) ;
}
birth = (Background) Rand.pickFrom(
... | 4 |
private void createMenuOptions() {
String gameFontName = Configuration.GUI.Fonts.BUTTON_FONT;
// Load all of the game graphics from the GUI congfiguration
GameGraphic normalGraphic = GameAssetManager.getInstance().getObject(GameGraphic.class, Configuration.GUI.Graphics.GRAPHIC_BUTTON_NORMAL);
GameGraphic hoverG... | 1 |
private Object getMenu(Object component, Object part,
boolean forward, boolean popup) {
Object previous = null;
for (int i = 0; i < 2; i++) { // 0: next to last, 1: first to previous
for (Object item = (i == 0) ? get(part, ":next") :
get(popup ? get(component, "menu") : component, ":comp");
(i == 0... | 8 |
@Test
public void testEmptyArray() {
Conversions.debug = debug;
double[] arr = Conversions.convert("{}", double[].class);
Assert.assertTrue(arr != null && arr.length == 0);
arr = Conversions.convert(" { } ", double[].class);
Assert.assertTrue(arr != null && arr.length == 0);
... | 4 |
public void run() {
try {
InetAddress ipAddress = clientSocket.getInetAddress();
String remoteIP = ipAddress.getHostAddress();
player.setIPAddress(remoteIP);
if (!(player.getIPAddress().equals(null))) {
System.out.println("Player IP is: " + player.getIPAddress());
}
OutputStream register... | 6 |
public static String encodeFromFile( String filename )
{
String encodedData = null;
Base64.InputStream bis = null;
try
{
// Set up some useful variables
java.io.File file = new java.io.File( filename );
byte[] buffer = new byte[ Math.max((int)(file... | 3 |
public static String cppUnpointerizeNativeType(String nativetype) {
{ int length = nativetype.length();
{ int i = Stella.NULL_INTEGER;
int iter000 = 1;
int upperBound000 = length;
boolean unboundedP000 = upperBound000 == Stella.NULL_INTEGER;
loop000 : for (;unboundedP000 ||
... | 7 |
public NewVariableEditor() {
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
setTitle("Create new variable");
setBounds(100, 100, 450, 235);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel, BorderLayout.CENTER);
con... | 4 |
public CodeMap42 set(final int index, final int value) {
int[][] map2;
if ((index >>> 16) != 0) {
if (map == null)
map = new int[MAX_INDEX][][][];
final int i0 = index >>> 24;
int[][][] map1 = map[i0];
if (map1 == null)
map[i0] = map1 = new int[MAX_INDEX][][];
final int i1 = (index >>> 16)... | 6 |
@EventHandler
public void onInventoryClose( InventoryCloseEvent e ){
Player p = (Player) e.getPlayer();
if( p.getInventory().getChestplate() != null ){
if (String.valueOf(p.getInventory().getChestplate().getItemMeta().getLore()).contains("Life Touch III")) {
p.setHealthSc... | 4 |
private void merge(T[] arValues, int left, int middle, int right) {
//
int nrTimes = (right - left) + 1;
//
int leftMoves = left;
T leftValue = null;
//
int middleMoves = middle + 1;
T middleValue = null;
Vector<T> arTemp = new Vector<T>(nrTimes);
for (int i = 0; i < nrTimes; i... | 9 |
public boolean hasChanged()
{
if(parent != null && parent.hasChanged())
return true;
if(!pos.equals(oldPos))
return true;
if(!rot.equals(oldRot))
return true;
if(!scale.equals(oldScale))
return true;
return false;
} | 5 |
public Move makeMove()
{
Move move;
//Keep looping and getting moves 'till we get a valid move
while (true)
{
move = getMove();
System.out.println("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
//If we're trying to move from positions that are actually in the board
if (!(move.getA().isOutOfBounds() || move.... | 6 |
public static boolean isValid(JsonNode track) {
LOG.debug("Checking validity of track : \n" + track);
boolean result = false;
if (track == null)
LOG.warn("Track is invalid: null.");
else if (!track.hasNonNull(ARTIST))
LOG.warn("Track is invalid: no artist attribute.");
else if (!track.get(ARTIST).has(TE... | 6 |
public void addIload(int n) {
if (n < 4)
addOpcode(26 + n); // iload_<n>
else if (n < 0x100) {
addOpcode(ILOAD); // iload
add(n);
}
else {
addOpcode(WIDE);
addOpcode(ILOAD);
addIndex(n);
}
... | 2 |
public NodeInfoDialog(GUI p, Node n){
super(p, "Edit Node "+n.ID, true);
GuiHelper.setWindowIcon(this);
parent = p;
node = n;
node.highlight(true);
this.setLayout(new BorderLayout());
JPanel nodeSelAndPosition = new JPanel();
nodeSelAndPosition.setLayout(new BorderLayout());
JPanel nodeSel... | 7 |
public void addRulesInTable() {
try {
RulesManager.getInstance().loadRules(MainClass.RULES_DIR);
} catch (Exception ex) {
Logger.getLogger(NBFrame.class.getName()).log(Level.SEVERE, null, ex);
return;
}
DefaultTableModel model = (DefaultTableModel) ta... | 3 |
public int sum (List<Integer> a){
if (a.size() > 0) {
int sum = 0;
for (Integer i : a) {
sum += i;
}
return sum;
}
return 0;
} | 2 |
@Override
public void keyReleased(KeyEvent event) {
int key = event.getKeyCode();
if(key == KeyEvent.VK_UP){
if(screen.checkRotate(current, currentCol, currentRow, orientation)) {
screen.removePiece(current, currentCol, currentRow, orientation);
orientation = (orientation+1)%4;
screen.addPiece(curre... | 8 |
public static void IfCheatMessage() {
for (int i = 0; i < playerInventory.length; i++) {
Item playerInventoryVariable = playerInventory[i];
if (playerInventoryVariable != null) {
if (playerInventory[i].getId() == 5) {
System.out
.println(" How to Become Immortal");
Sys... | 3 |
@Override
public void tick(PlayField field) {
// super.tick(field);
xVel = xVel + xAcc / 10.F;
x += xVel;
if (x < width / 2) {
x = width / 2;
}
if (x > Game.WIDTH - width / 2) {
x = Game.WIDTH - width / 2;
}
y += yVel;
xVel = xVel / friction;
yVel = yVel / friction;
if (x <= 0 || x >= Game.... | 5 |
public double calcMoment(String whichMoment){
Stack<Point> blob_copy = new Stack<Point>();
blob_copy.addAll(blob);
double moment = 0;
// NOTE: This code will only work with Java SE 7. Strings in
// switch statements were not supported in JDK<=6, apparently.... | 7 |
private String calc(String input) {
//Person 2 put your implementation here
StringBuilder sb = new StringBuilder();
for (int i = 0; i < input.length(); i++) {
int num = Math.abs(rand.nextInt()%input.length());
sb.append(input.charAt(num));
}
retu... | 1 |
public void StartCallTime()
{
callTimeTask = new TimerTask() {
@SuppressWarnings("deprecation")
public void run() {
second++;
if(second==60) {minute++;second=0;}
if(minute==60) {hour++;minute=0;}
time.setHours(hour);
... | 2 |
public void createLifeForm(int x, int y, LifeForms lifeForm)
{
//System.out.println("Creating " + lifeForm.name());
boolean[][] pattern = PATTERNS[lifeForm.ordinal()];
int patternHeight = pattern.length,
patternWidth = pattern[0].length;
for (int i = 0; i < patternHeight; i++)
{
if ... | 7 |
public int generateTreshold(){
Collections.sort(valuesFaces);
int[] treshold = new int[2];
int countDownToUp = 0;
int countUpToDown = 0;
for(int i = 0; i < valuesFaces.size(); i++){
if(valuesFaces.get(i).face){
countDownToUp++;
} else {
if(i > 0){
treshold[0] = (valuesFaces.get(i).value - v... | 7 |
public GeneratorWebClient() {
isRunning = false;
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 800, 600);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
contentPane.setLayout(new BorderLayout(0, 0));
setContentPane(contentPane);
JPanel p... | 2 |
public void setAppPackageName(String appPackageName) {
this.appPackageName = appPackageName;
} | 0 |
private Node<T> setToNext(Node<T> node, T item) {
if (node.next != null) {
setToNext(node.next, item);
}
Node<T> nextNode = new Node<T>(null, item);
node.next = nextNode;
return nextNode;
} | 1 |
@Override
public Set<int[]> threshold(int thresh) throws IllegalStateException {
if(!isDone) throw new IllegalStateException("accumulate() must be called before threshold(int)");
Set<int[]> circles = new HashSet<int[]>();
for(int r = 0; r < acc.length; ++r) {
for(int x = 0; x < acc[r].length; ++x) {
for(i... | 5 |
private int valorMax( Partida partida, EstatPartida estat_partida, int alfa, int beta, EstatCasella estat_casella,
int profunditat, int profunditat_maxima, EstatCasella fitxa_jugador )
{
Tauler tauler = partida.getTauler();
if ( profunditat == profunditat_maxima || estat_partida == EstatPart... | 8 |
@Override
public Object execute(HttpServletRequest request, HttpServletResponse response) throws Exception {
Contexto oContexto = (Contexto) request.getAttribute("contexto");
oContexto.setVista("jsp/mensaje.jsp");
HiloBean oHiloBean = new HiloBean();
HiloDao oHiloDao = new HiloDao(oC... | 2 |
public String execute() throws CitysearchException {
log.info("Start review action");
reviewRequest.setAdUnitName(CommonConstants.AD_UNIT_NAME_REVIEW);
if (reviewRequest.getAdUnitSize() == null
|| reviewRequest.getAdUnitSize().trim().length() == 0) {
reviewRequest.setAdUnitSize(CommonConstants.MANTLE_AD_SI... | 8 |
public void refresh() {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
content.removeAllChildren();
Enumeration<TreePath> paths = tree.getExpandedDescendants(tree.getPathForRow(0));
for(DialogCategory category : editor.controller.categories.values()){
DefaultMutableT... | 5 |
public static String[] removeDuplicateStrings(String[] array) {
if (isEmpty(array)) {
return array;
}
Set<String> set = new TreeSet<String>();
for (String element : array) {
set.add(element);
}
return toStringArray(set);
} | 2 |
void doRun() throws InterruptedException {
ExecutorService threadPool = Executors.newFixedThreadPool(THREAD_NUM);
for (int i = 0; i < THREAD_NUM; i++) {
Node n = new Node(threadPool);
threadPool.submit(n);
}
} | 1 |
public Node search(Problem problem, State initialState) {
// Make a node with the initial problem state
Node firstNode= new Node(initialState);
// Insert node into the frontier data structure
List<Node> frontier= new ArrayList<Node>();
frontier.add(firstNode);
// (Variables needed later on)
List<Node> su... | 6 |
public void visitNewMultiArrayExpr(final NewMultiArrayExpr expr) {
print("new " + expr.elementType());
if (expr.dimensions() != null) {
for (int i = 0; i < expr.dimensions().length; i++) {
print("[" + expr.dimensions()[i] + "]");
}
}
} | 2 |
public boolean maximumHuntersReached() {
if (world.getHunterList().size()<=10)
return false;
else
return true;
} | 1 |
@Override
public void build(String dictName) {
BufferedReader reader = null;
StringBuffer stringBuffer = null;
String string = null;
try {
reader = new BufferedReader(new FileReader(new File(dictName)));
string = reader.readLine();
while (string != null) {
stringBuffer = new StringBuffer(string);
... | 4 |
public synchronized int setTemplateDirectory(File dir) {
if (dir!=null && dir.isDirectory()) {
this.directory = dir;
File[] files = dir.listFiles(new XMLFileFilter());
int newCount = files==null ? 0 : files.length;
int oldCount = templates.size();
List temp = new ArrayList(oldCount+newCount);
te... | 6 |
public void addBlocks(int b) {
debug("Adding " + b + " blocks to the game");
if (reset) {
debug("Blocks not added, middle of reset");
return;
}
int bS;
int rS;
int c = 0;
for (int i = 0; i < b; i++) {
bS = this.getBlueScoreFromB... | 5 |
public void calcAdjacencies() {
adjMtx = new HashMap<Integer, LinkedList<Integer>>();
for(int i = 0; i < NUMBEROFSPACES; i++) {
LinkedList<Integer> temp = new LinkedList<Integer>();
if(i > 3) {
temp.add(i - 4);
}
if(i % 4 != 0) {
temp.add(i - 1);
}
if(i % 4 != 3) {
temp.add(i + 1);
... | 5 |
public void imprimir(Object[][] h) {
for (int i = 0; i < h.length; i++) {
for (int j = 0; j < h[0].length; j++) {
System.out.print(h[i][j] + " ");
}
System.out.println("");
}
} | 2 |
public void affiche(){
if(this.catalogue.size() < 1)
System.out.println("Aucune questions...");
else{
for(int i=0; i < this.catalogue.size(); i++){
System.out.print("["+i+"] => ");
this.catalogue.get(i).affiche()... | 2 |
@SuppressWarnings({ "rawtypes", "unchecked" })
public JList getFontSizeList()
{
if (fontSizeList == null)
{
fontSizeList = new JList(this.fontSizeStrings);
fontSizeList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
fontSizeList.addListSelectionListener(
... | 1 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ServicePK other = (ServicePK) obj;
if (client == null) {
if (other.client != null)
return false;
} else if (!client.equals(other.client)... | 9 |
public static int[] getShortestEdge(int[][] nabomatrise, ArrayList<Integer> noder) {
int[] shortest = new int[] {-1, INF};
for (int fra = 0; fra < noder.size() ;fra++ ) {
for (int til = 0; til < nabomatrise.length; til++) {
int w = nabomatrise[noder.get(fra)][til];
if(w != INF && w < shortest[1] && !node... | 5 |
public void putAll( Map<? extends Byte, ? extends Integer> map ) {
Iterator<? extends Entry<? extends Byte,? extends Integer>> it =
map.entrySet().iterator();
for ( int i = map.size(); i-- > 0; ) {
Entry<? extends Byte,? extends Integer> e = it.next();
this.put( e.get... | 8 |
public static Connection connection(Server server, String dbName) {
Connection result = null;
try {
result = DriverManager.getConnection(server.getUrl(dbName), server.getUser(), server.getPassword());
logger.debug(result);
} catch (SQLException e) {
logger.error("Error in get connection fo... | 1 |
public static int randomized_partiton(int[] array, int start, int end){
Random r = new Random();
int a = r.nextInt(end);
while(a < start){
a = r.nextInt(end);
}
exchange(array,a,end);
return partition(array,start,end);
} | 1 |
public static boolean joinGuild(String[] args, CommandSender s){
//Various checks
if(Util.isBannedFromGuilds(s) == true){
//Checking if they are banned from the guilds system
s.sendMessage(ChatColor.RED + "You are currently banned from interacting with the Guilds system. Talk to your server admin if you be... | 7 |
public String getText() {
return text;
} | 0 |
public void setString() {
// An input window asking for a string
String txt = JOptionPane.showInputDialog("Ange en text med bokstäver, siffror och tecken");
// An array of Array7x7 object to hold characters.
// The size of the array must be at least 5.
if (txt.length() < 4) {
txtArray = new Array7x7[5];
... | 6 |
public String toString() {
if (instance == null)
return "new " + type;
else
return instance.toString();
} | 1 |
public boolean getButton(int which, int id){
switch(which){
case 1:
return leftDriveJoy.getRawButton(id);
case 2:
return rightDriveJoy.getRawButton(id);
case 3:
return leftJoy.getRawButton(id);
case 4:
... | 4 |
private void handleProcessClear(){
for(int i:processesMap.keySet()){
if((processesMap.get(i).getStatus() == Status.FINISHED.toString()) ||
(processesMap.get(i).getStatus() == Status.FAILED.toString())){
Message msg = new Message(Message.msgType.COMMAND);
... | 4 |
public void lastStep(Context ctx) {
ctx.setState(new FirstState());
} | 0 |
@Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!(myHost instanceof MOB))
return super.okMessage(myHost,msg);
final MOB myChar=(MOB)myHost;
if((msg.amISource(myChar))
&&(msg.sourceMinor()==CMMsg.TYP_CAST_SPELL)
&&(!CMLib.flags().isGood(myChar))
&&((msg.tool()==null)... | 8 |
@Override
public void actionPerformed(ActionEvent e) {
if (e == null || e.getSource() == clearButton) {
currState = game.getInitialState();
currState.rollDice();
}
else if (!game.isTerminal(currState)) {
if (e.getSource() == pro... | 7 |
public static TreeSet<IdInt> topListInt(String baseFilename, int numVertices, final int topN) throws IOException{
final TreeSet<IdInt> topList = new TreeSet<IdInt>(new Comparator<IdInt>() {
public int compare(IdInt a, IdInt b) {
if (a.vertexId == b.vertexId) return 0;
... | 6 |
private void resize(int n) {
Type[] newArray = (Type[]) new Object[n];
for (int i = 0; i < size; i++) {
newArray[i] = stack[i];
}
stack = newArray;
} | 1 |
public boolean isBlocked(Location l, boolean playersBlock){
if (playersBlock)
{
//Return true if occupied by any player
for (Player player : players)
{
if (l.equals(player.getLocation()))
return true;
}
}
//Return true if the location is beyond the edge of the map
if(l.getX() >= MAX_X ||... | 9 |
public static String changeExtension(String fileName, String extension,
boolean gzipped) {
extension = (extension.startsWith(".")) ? extension : String.format(
"%s%s", ".", extension);
String rgxOne = "^(.+?)(?=((\\.tar)?\\.gz)$)";
String rgxTwo = "^(.+?)(?=\\.(.*)$)";
Matcher m = Pattern.compile(rgxOne... | 5 |
void TryToCookFood(Order o) {
print("Doing TryToCookFood");
log.add(new LoggedEvent("Doing TryToCookFood"));
int foodAmount = mRole.mItemInventory.get(Item.stringToEnum(o.choice));
if(foodAmount <= 0) {
o.waiter.msgOutOfFood(o.table, o.choice);
orders.remove(o);
return;
}
mRole.decreaseInventory(It... | 7 |
private void start()
{
TcpCon con = new TcpCon();
if((login.getText().trim().length()==0)||passwd.getText().trim().length()==0)
{
login.setBorder(BorderFactory.createMatteBorder(2,2,2,2,Color.red));
passwd.setBorder(BorderFactory.createMatteBorder(2,2,2,2,Color.red));
}
else
{
... | 4 |
public void setName(String name) {
this.name = name;
} | 0 |
public void sort(int[] array)
{
int length = array.length,
gap = length;
boolean swapped = false;
while (gap > 1 || swapped)
{
gap = (int)((double)gap / SHRINK_FACTOR);
if (gap < 0)
gap = 1;
swapped = false;
for (int i = 0; (gap + i) < length; i++)
... | 5 |
public void highlightLine(final int lineNum) {
final Highlighter high = getHighlighter();
final Document d = getDocument();
int line = 0;
int posStart = 0;
int pos = 0;
int lineTermLength = 0;
try {
while ( line < lineNum ) {
posStart = pos;
lineTermLength = 0;
// Find the end of a... | 7 |
private boolean AT3x04PilotToneHunt (double spectrum[]) {
int a,pbin;
// Look if a particular bin in startCarrierList1 also exists in startCarrierList2 and startCarrierList3
for (a=startCarrierList1.size()-1;a>=0;a--) {
pbin=startCarrierList1.get(a).getBinFFT();
if (checkBinExists(startCarrierList2,pbin)==t... | 3 |
private void writeIntAMF0(List<Byte> ret, int val)
{
ret.add((byte)0x00);
byte[] temp = new byte[8];
ByteBuffer.wrap(temp).putDouble((double)val);
for (byte b : temp)
ret.add(b);
} | 1 |
@Override
public int getPartition(Text key, DoubleWritable value,
int numberOfPartitions) {
String newSchemaStr = conf.get(SystemConf
.getNewSchemaForConfSetString());
if (null == newSchemaStr || "".equals(newSchemaStr)) {
try {
... | 5 |
private void addButtons() {
JPanel buttonHolder = new JPanel();
buttonHolder.setLayout(new BoxLayout(buttonHolder, BoxLayout.X_AXIS));
JButton process = new JButton("Create map");
final Gui gui = this;
process.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) ... | 5 |
public Currency[] search(String token){
ArrayList<Currency> list = new ArrayList<>();
for (Currency currency : this){
if (currency.getCode().equalsIgnoreCase(token))
list.add(currency);
else if (currency.getSymbol().equalsIgnoreCase(token))
list.ad... | 4 |
public RainFall(String record, BufferedWriter out, String fn)
{
try {
String[] fields = record.split(",");
//System.out.println(record);
_stationId = fields[1];
_year = "" + Integer.parseInt(fields[2]);
_month = "" + Integer.parseInt(fields[3]);
_day = "" + Integer.parseInt(fields[4]);
... | 2 |
public MainFrame(final String title) throws IOException {
super(title);
JPanel mainPanel = new JPanel();
mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
mainPanel.setAlignmentX(Component.CENTER_ALIGNMENT);
JPanel csvPanel = new JPanel();//new FlowLayout());
csvPanel.... | 8 |
@Test
public void complicatedTest() throws Exception {
for (int i = 1; i <= 20; i++) {
heap.enqueue(i);
}
for (int i = 1; i <= 20; i++) { //heap should be 1 ... 20
assertIntWithObject(i, heap.dequeue());
}
for (int i = 1; i <= 20; i++) {
he... | 8 |
@Override
public AudienceVotingResult vote(List<Answer> allAnswers, List<Answer> possibleAnswers, QuestionDifficulty difficulty) {
int answersCount = possibleAnswers.size();
if (answersCount != 2 && answersCount != 4) {
throw new RuntimeException("Unable to vote for " + possibleAnswers.s... | 8 |
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
String actionCh = request.getParameter("Change");
String actionDel = request.getParameter("Delete");
if(actionCh != null) {
RequestDispatcher view = request.getRequestDispatcher("ChangeRec.js... | 2 |
int guess(String solution) {
int count = 0;
count++;
int a = getA(solution, "1234");
if (a == 4) {
return count;
}
int b = getB(solution, "1234");
reduce("1234", a, b);
for (int i = 0; i < validSet.length; i++) {
if (!validSet[i... | 4 |
public int compareTo(Object o) {
if (o instanceof ArgPosition) {
ArgPosition other = (ArgPosition) o;
int i = 0;
while (this.path.size() > i && other.path.size() > i) {
final int result = this.path.get(i).compareTo(other.path.get(i));
if (result != 0) {
return result;
... | 6 |
private static Character createCharacter(String type, Scanner console) {
if(type.toLowerCase().startsWith("war")) {
Warrior character = new Warrior();
return character;
} else if(type.toLowerCase().startsWith("mag")) {
Mage character = new Mage();
return character;
} else if(type.toLowerCase().startsW... | 3 |
public void checkBananas(ArrayList<EntityBanana> ba){
for(int i = 0; i < ba.size(); i++){
EntityBanana b = ba.get(i);
if(flying){
if(
b.getx() > x &&
b.getx() < x + (cwidth / 2) &&
b.gety() > y - height / 2 &&
b.gety() < y + height / 2
){
b.hit(1);
}
}
if(intersect... | 9 |
public static byte[] toByte(String str){
if(str != null){
try {
return str.getBytes(UTF8);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
return null;
}
}
return null;
} | 2 |
public void processEvent(Event event) {
try {
if (event.getType() == EventType.CLASS_OPEN || event.getType() == EventType.CLASS_REPARSE) {
this.cf = event.getClassFile();
}
if (event.getType() == EventType.CLASS_PARSE_ERROR) {
this.tree.setModel(new DefaultT... | 8 |
public void updateReduceOutputPerMap(String jobID, String taskID, int mapId, int[] stat) {
Boolean retry = false;
int backoff = 1000;
String domainName;
if ( taskID.hashCode()<0 )
domainName = dbManagerDomain + (-taskID.hashCode())%Global.numSDBDomain;
else
domainName = dbManagerDomain + (taskID.hash... | 8 |
@Test
public void findHandFromCardSet_whenFourJacks_returnsFourOfaKind() {
Hand hand = findHandFromCardSet(quadsJacksWithTenKicker());
assertEquals(HandRank.FourOfAKind, hand.handRank);
assertEquals(Rank.Jack, hand.ranks.get(0));
assertEquals(Rank.Ten, hand.ranks.get(1));
} | 0 |
private void playVote() {
Vector<Integer> hasNotVoted = votes2.notVoted(2);
for (Integer player : hasNotVoted) {
if (!players2.isDead(player)) {
players2.kill(player);
bot.sendMessage(gameChan, getFromFile("NOT-VOTED", players2.get(player), NARRATION));
sendNotice(players2.get(player), getFromFile("... | 3 |
public OverwriteDialog(final JFrame parent) {
super(parent, "", true);
bundle = Application.getResourceBundle();
this.setTitle(bundle.getString("overwrite_title"));
// Closing the window is equal to pressing the No-Button
WindowListener windowListener = (new WindowAdapter() {
@Overr... | 4 |
private void experiment() {
//wait for all the entities to register
super.gridSimHold(50.0);
int location;
File f1 = null;
File f2 = null;
//1. create new files
try {
f1 = new File("file1", 5);
f2 = new File("file2", 1);
} catch (P... | 4 |
public static String buildOutputCalendar(Calendar calendar) {
String res = " " + calendar.getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.getDefault()) + " " +
calendar.get(Calendar.YEAR) + '\n' +
(argsAnalizer.getIsWeekNumber() ? " " : "") + "Mo Tu We Th Fr Sa Su" + '\n'... | 9 |
@Override
public void caseAProgramas(AProgramas node)
{
inAProgramas(node);
if(node.getIdentificador() != null)
{
node.getIdentificador().apply(this);
}
{
List<PDeclaracao> copy = new ArrayList<PDeclaracao>(node.getDeclaracao());
for(PD... | 3 |
public void dbConnect(String db_connect_string,
String db_userid,
String db_password) {
try {
Class.forName("net.sourceforge.jtds.jdbc.Driver");
Connection conn = DriverManager.getConnection(db_connect_string, db_userid, db_password);
System.out.printl... | 2 |
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Townshipbusiness)) {
return false;
}
Townshipbusiness other = (Townshipbusiness) object;
if ((this.townshipBusi... | 5 |
private void outputHelper() throws IOException
{
miscInfo = new PrintWriter(new FileWriter(JPEGFileName.replace(".JPG", "_miscInfo.txt")));
outline = new PrintWriter(new FileWriter(JPEGFileName.replace(".JPG", "_outline.txt")));
controlPoints = new PrintWriter(new FileWriter(JPEGFileName.rep... | 4 |
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... | 6 |
public static HashMap<String, HashMap<String, Integer>> getMap(String filePath) throws Exception
{
HashMap<String, HashMap<String, Integer>> map =
new HashMap<String, HashMap<String,Integer>>();
BufferedReader reader = filePath.toLowerCase().endsWith("gz") ?
new BufferedReader(new InputStreamReader(
... | 6 |
@Override
public void unInvoke()
{
final Physical affected=super.affected;
// undo the affects of this spell
if(affected==null)
return;
if(canBeUninvoked())
{
if((invoker()!=null)
&&((targetM == null)||(!CMLib.flags().isInTheGame(targetM, true))||(targetM.location()!=invoker().location())))
inv... | 9 |
Subsets and Splits
SQL Console for giganticode/java-cmpx-v1
The query retrieves a limited number of text entries within a specific length range, providing basic filtering but minimal analytical insight.