text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void run() {
if (logic.getEnemyState(0) == false && currente == 1) {
currente = 2;
}
if (logic.getEnemyState(1) == false && currente == 2) {
currente = 3;
}
if (logic.getEnemyState(2) == false && currente == 3) {
currente = 1;
}
repaint();
} | 6 |
public Roster getRosterByID (int id) {
for (Roster r: rosters)
if (r.getRosterID() == id)
return r;
return null;
} | 2 |
private void parse( String directory )
{
// Go through each directory and get the java source
// files for this dir.
log.debug( "Scanning " + directory );
DirectoryScanner directoryScanner = new DirectoryScanner();
File baseDir = new File( directory );
directoryScann... | 6 |
public void recordContinueFrom(FlowContext innerFlowContext, FlowInfo flowInfo) {
if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0) {
if ((initsOnContinue.tagBits & FlowInfo.UNREACHABLE) == 0) {
initsOnContinue = initsOnContinue.
mergedWith(flowInfo.unconditionalInitsWithoutSideEffect());
}
else {
initsOnC... | 7 |
@Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == btnNewButton) {
String usernameText = usernameField.getText();
Staff user = null;
for (Person person : staffList) {
if (person.getName().equals(usernameText)) {
user = (Staff) person;
break;
}
}
if (user != n... | 6 |
public static boolean LoadTest(Path p) {
try {
BufferedReader reader = Files.newBufferedReader(p, cSet);
String readL = "";
GlobalFuncs.loadMapCharacteristics(reader);
GlobalFuncs.scenMap.loadMap(reader);
GlobalFuncs.allCOAs = new Vector<COA>();
// Load units
while(readL != null) {
... | 7 |
private void jButton12ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton12ActionPerformed
if (jTable5.getSelectedRow() < 0) {
JOptionPane.showMessageDialog(this, "Please select contact to delete", "Error", JOptionPane.ERROR_MESSAGE);
return;
}
int... | 3 |
private static int getOpcode(int sort, int opcode) {
if (sort == TYPE.BOOLEAN.sort || sort == TYPE.CHAR.sort
|| sort == TYPE.BYTE.sort || sort == TYPE.SHORT.sort
|| sort == TYPE.INT.sort) {
opcode -= 4;
} else if (sort == TYPE.LONG.sort) {
... | 9 |
public static void main(String[] args) throws InterruptedException, RemoteException, UnknownHostException, NotBoundException {
try {
Parser.dataNodeConf();
if (Hdfs.Core.DEBUG) {
Parser.printConf(new ConfOpt[] {ConfOpt.HDFSCORE, ConfOpt.DATANODE});
}
} catch (Exception e) {
e.printStackTrace()... | 4 |
protected Icon getIcon() {
java.net.URL url = getClass().getResource("/ICON/de-expressionify.gif");
return new ImageIcon(url);
} | 0 |
public List<Utr3prime> get3primeUtrs() {
ArrayList<Utr3prime> list = new ArrayList<Utr3prime>();
for (Utr utr : utrs)
if (utr instanceof Utr3prime) list.add((Utr3prime) utr);
return list;
} | 2 |
public void accept() {
PluginVars.removeRequest(this);
if(!this.requester.isOnline() || !this.requested.isOnline())
return;
if(PluginVars.isDueling(this.requester) || PluginVars.isDueling(this.requested)) {
this.requested.sendMessage(this.requester.getName() + " is in a duel.");
return;
}
try {
if... | 7 |
private Set<Class<?>> add(final Class<?> cls, final Set<Class<?>> s) {
if (cls.isInterface()) {
s.add(cls);
}
for (final Class<?> iface : cls.getInterfaces()) {
add(iface, s);
}
final Class<?> superclass = cls.getSuperclass();
if (superclass != nul... | 8 |
@Override
public void happens() {
Character character = Game.getInstance().getCurrentCharacter();
Character exp1 = null;
int index = 0;
ArrayList<Character> players = Game.getInstance().getCharacters();
search: for (int i = 0; i < players.size(); i++){
if(players.get(i).getItemHand().size() > 0){
Arra... | 5 |
public int reductionColonne() {
int sommeRegret = 0;
int min;
for(int j = 0; j < this.getTaille(); j++) {
min = this.getValue(0, j);
if(j == 0) {
min = this.getValue(1, j);
}
for(int i = 0; i < this.getTaille(); i++) {
if(this.getValue(i, j) != -1) {
min = (this.getValue(i, j) < min... | 7 |
public static void dehoist_all(Node currentNode) {
currentNode.getTree().getDocument().hoistStack.dehoistAll();
return;
} | 0 |
public synchronized void stop()
{
if (!running)
return;
running = false;
try
{
thread.join();
} catch (InterruptedException e)
{
e.printStackTrace();
}
} | 2 |
private static String compareFields(String texto, String[] fields) {
String fieldFound = "null";
for (String field : fields) {
if (texto.contains(field)) {
String linea = texto;
fieldFound = linea;
}
}
return fieldFound;
} | 2 |
private static void addEntry(Hashtable entries, String name) {
String dir = "";
int pathsep = name.lastIndexOf("/");
if (pathsep != -1) {
dir = name.substring(0, pathsep);
name = name.substring(pathsep + 1);
}
Vector dirContent = (Vector) entries.get(dir);
if (dirContent == null) {
dirContent = ne... | 3 |
void takeTour() throws TooHotException, TooColdException {
int temperature = (int) (Math.random() * 100);
System.out.println("temperature = " + temperature);
if (temperature > 60) {
throw new TooHotException("Too hot here");
} else if (temperature < 10) {
throw new TooColdException("Too cold here");
}
... | 2 |
public String getContent() {
return content;
} | 0 |
public final Map<Integer, String> titles() {
synchronized (this) {
while ((this.lock > 0) || (this.lockRead > 0)) {
try {
wait();
} catch (final InterruptedException e) {
Thread.currentThread().interrupt();
return null;
}
}
++this.lockRead;
}
try {
parseIfNeeded();
return... | 4 |
public static void main(String[] args) {
try {
if (args == null || args.length < 1 || args[0] == null) {
// If no arguments passed we exit. We need 1 parameter
// containing the path of the configuration file
System.out.println(ERROR_NO_CONF);
... | 9 |
private void stats(Graphics g) {
Player player = game.getPlayer();
int rows = 5;
int width = per * 128;
int height = per * 16 * rows;
int x = (getWidth() - width) / 2;
int y = getHeight() - height;
g.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, per * 12));
... | 4 |
private void showSaveDialog() {
//TODO: Prevent saving (grey out this option) when the game is over.
if (matchFileChooser.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) {
try {
String filePath = matchFileChooser.getSelectedFile().getPath();
if (!filePath.endsWith("." + MatchSaveData.SAVE_FILE_EXTEN... | 5 |
@Override
public void generate(Tile[][] tiles, Random random) throws ArrayIndexOutOfBoundsException {
Vec2D lt = Vec2D.get(8, 8);
for (int x = 0; x < tiles.length; x++) {
for (int y = 0; y < tiles.length; y++) {
tiles[x][y] = Tile.grass;
}
}
try {
for (int i = 0; i < 96; i++) {
tiles[lt.getX... | 7 |
public void spread(){
if(direction != null && tailleRestante > 0){
switch(direction){
case N :
plateau.createFlamme(this.getHauteur(), this.getLargeur()-1, this.tailleRestante-1, this.direction, this.dateFin);
break;
case S :
plateau.createFlamme(this.getHauteur(), this.getLargeur()+1, this.taill... | 6 |
private int computeSkyLightValue(int par1, int par2, int par3, int par4, int par5, int par6)
{
int var7 = 0;
if (this.canBlockSeeTheSky(par2, par3, par4))
{
var7 = 15;
}
else
{
if (par6 == 0)
{
par6 = 1;
... | 8 |
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 fe... | 6 |
double[][] lhsu(double[] xmin, double[] xmax, int nsample) {
int nvar = xmin.length;
double s[][] = new double[nsample][nvar];
for (int j = 0; j < nvar; j++) {
int[] idx = randperm(nsample);
for (int i = 0; i < nsample; i++) {
double P = (idx[i] - random()... | 2 |
@EventHandler(ignoreCancelled = true)
public void onInventoryClick(InventoryClickEvent event) {
if (!event.getInventory().getType().equals(InventoryType.CRAFTING)) // Survival inventory
return;
Arena arena = OITG.instance.getArenaManager().getArena((Player) event.getWhoClicked());
... | 4 |
public void moveWest() throws InterruptedException{
if (isDoor[3] && !isLocked[3]){
currentX--;
currentRoom = rooms[currentY][currentX];
currentRoom.playerVisits();
setAdjacentRooms();
Game.printMessage("You walk through the western door\n");
} else if (!isDoor[3])
Game.printMessage("There is no d... | 4 |
public static Coordinates readMoveFromKeyboard() {
Coordinates result = null;
while (result == null) {
System.out.print(">");
String str = null;
int row = 0, column = 0;
BufferedReader d = new BufferedReader(new InputStreamReader(
Syst... | 8 |
public boolean[] getSubDivideMask(CSVColumn sdi, Date start, Date end, File folder) {
if (sdi != null) {
try {
File fname = ObjFunc.resolve(sdi.getFile(), folder);
CSTable sdt = DataIO.table(fname, sdi.getTable());
String column = sdi.getColumn();
... | 7 |
public void moveNoAnimate(int xa, int ya) {
if(xa != 0 && ya != 0) {
move(xa,0);
move(0,ya);
return;
}
xas = xa;
yas = ya;
LastDir = dir;
if (xa < 0) dir = 1; // 0 - north| 1- east | 2 - south | 3 - west |
if (xa > 0) dir = 3;
if (ya < 0) dir = 2;
if (ya > 0) dir = 0;
if(!collision(0,y... | 8 |
public boolean isEmpty() {
return (!this.player.isEmpty() && !this.reason.isEmpty());
} | 1 |
private void addDirectoryToParentEntriesFile(final File CVSdir) throws IOException {
synchronized (ksEntries) {
final File parentCVSEntries = seekEntries(CVSdir.getParentFile().getParentFile());
// only update if the file exists. The file will not exist in the
// case where ... | 9 |
private void destroy(Map<K, List<ObjectTimestampPair<V>>> m, KeyedPoolableObjectFactory<K, V> factory) {
for (Iterator<Entry<K, List<ObjectTimestampPair<V>>>> entries = m.entrySet().iterator(); entries.hasNext();) {
Entry<K, List<ObjectTimestampPair<V>>> entry = entries.next();
K key ... | 7 |
public boolean isResizable(Component c) {
boolean resizable = true;
if (c instanceof JDialog) {
JDialog dialog = (JDialog) c;
resizable = dialog.isResizable();
} else if (c instanceof JInternalFrame) {
JInternalFrame frame = (JInternalF... | 5 |
private void sink(int i) {
while (2 * i + 1 <= N) {
int index = 2 * i + 1;
if (index + 1 <= N && pq[index].compareTo(pq[index + 1]) > 0) {
index = index + 1;
}
if (pq[i].compareTo(pq[index]) > 0) {
T temp = pq[index];
... | 4 |
public static void cleanUpTable()
{
//Loop through every row in the table
for(int k = 0;k<=5;k++)
{
if(clientsTable.getModel().getValueAt(k, 0) == null)
{
System.out.println("Found Null Value at: " + k);
if(k != 5)
{
if(clientsTable.getModel().getValueAt(k+1, 0) != null)
{
Syst... | 4 |
private void addLines(Document doc, Element linesElement, FileData fileData) {
int maxLines = fileData.getLines().size();
if (fileData.getBranchData().size() > 0)
maxLines = Math.max(fileData.getLines().size(), Collections.max(fileData.getBranchData().keySet())+1);
for (int i = 0; i ... | 2 |
public void destroyScreen() {
isRunning = false;
try {
gameThread.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
// game.setScreen(null);
} | 1 |
public Net clone () {
Net newNet = new Net();
//clone all the nodes...
for (Node node : this._nodes) {
Node newNode = node.clone();
newNet.addNode(newNode);
// if it's an input or an output, put it in the right place
if (newNode instanceof InputNo... | 5 |
public static Promotion addPromotion(Promotion p) {
if (p == null)
return null;
// We check if the promotion doesn't still exist in the Professor List.
boolean exist = false;
int pos = 0;
for (int i = 0; i < FileReadService.pList.size(); i++) {
if (FileReadService.pList.get(i).equals(p)) {
exist = ... | 4 |
protected void finishModification() {
try {
courseModel.saveModelFile();
} catch (IOException e) {
JOptionPane.showMessageDialog(this,
"Cannot save static data file:\n" + e);
}
try {
courseModel.saveStatusFile();
} catch (IOException e) {
JOptionPane.showMessageDialog(this, "Cannot save statu... | 3 |
private boolean r_shortv() {
int v_1;
// (, line 49
// or, line 51
lab0: do {
v_1 = limit - cursor;
lab1: do {
// (, line 50
if (!(out_grouping_b(g_v_WXY, 89, 121))) {
break lab1;
}
if (!(in_grouping_b(g_v, 97, 121))) {
break lab1;
}
if (!(out_grouping_b(g_v, 97, 121))) {... | 8 |
public void removeSelfFromGrid()
{
if (grid == null)
throw new IllegalStateException(
"This actor is not contained in a grid.");
if (grid.get(location) != this)
throw new IllegalStateException(
"The grid contains a different actor at lo... | 2 |
public boolean buildProduct(String productName){
for(ManufacturedProduct mfp : this.inventory.getManufacturedProductList()){
if(mfp.getProductName().equals(productName)){
for(String rm : mfp.getRawMaterialList()){
for(RawMaterial rm1 : this.inventory.getRawMateria... | 5 |
public void addDownloadFromFileName(String fileName) {
try {
byte[] content = FileReader.readByteArray(fileName);
// TODO: Maybe, need real (but simple) check of file format
if (content.length < 3) {
throw new RuntimeException("Wrong file format");
... | 4 |
private double addColumnsFromGeometry(RoadGeometry roadGeometry, int beginning, int end, double columns) {
if (geometryFitsInside(roadGeometry, beginning, end)) {
columns += roadGeometry.length() / (double) roadGeometry.getSmax();
} else if (geometryEndIsOutside(roadGeometry, beginning, end)) {
columns += (en... | 4 |
public static void computePaths(Station source) {
source.setMinDistance(0.0);
System.out.println("source = " + source);
// Using PriorityQueue class with minDistance as a priority (see the comparator of Station)
PriorityQueue<Station> vertexQueue = new PriorityQueue<Station>();
vertexQueue.add(sour... | 5 |
public int numDistinct(String S, String T) {
// Note: The Solution object is instantiated only once and is reused by
// each test case.
int ls = S.length();
int lt = T.length();
int[][] DP = new int[lt + 1][ls + 1];
for (int i = 0; i <= ls; ++i) {
DP[0][i] = 1;
}
DP[1][0] = 0;
for (int i = 1; i <= ... | 4 |
private void updateBoards(List<Clients> clientsList, Character[][] board, int playerNum){
Iterator itr = clientsList.iterator();
int i=0, j=0;
while(itr.hasNext()){
Clients client = (Clients) itr.next();
if(playerNum == PLAYER1){
//copy board of player1
for(i=0; i<4; i++){
for(j=0; j<5; j++){
... | 7 |
public static void main (String argv[]) {
// create scanner that reads from standard input
Scanner scanner = new Scanner(System.in);
if (argv.length > 2) {
System.err.println("Usage: java Main " + "[-d]");
System.exit(1);
}
// if commandline option -d is provided, debug the scanner
if (argv.le... | 8 |
private void printResults(ChessGameConfiguration[] results){
String errorMsg;
if (results.length == 0){
errorMsg = messages.getString("noSolutionsFound");
System.out.println(errorMsg);
}else{
String msg = results.length + " "+ messages.getString("solu... | 2 |
private HttpHeader getHttpHeader(int length){
len = len + length;
splitbyte = findHeaderEnd(bytes, len);
if(splitbyte > 0){//find http header end
findHttpHeader = true;
httpHeader = new HttpHeader();
// Create a BufferedReader for parsing the header.
ByteArrayInputStream hbis = new ByteArrayInputStrea... | 7 |
private static Map<Character, Integer> addToMap(String text) {
Map<Character, Integer> map = new HashMap<>();
for (int i = 0; i < text.length(); i++) {
char character = text.charAt(i);
if (map.get(character) == null) {
map.put(character, 0);
}
... | 2 |
@Override
public void run()
{ System.out.println("Input run");
this.window.setEditable(true);
try
{
OutputStreamWriter os;
os = new OutputStreamWriter(out);
while (this.open) {
System.out.println("input loop");
... | 4 |
public boolean checkDot(char c, boolean allowDot) {
return (c == '.' && allowDot) && (c == '.' && Utils.getCountOf(getText(), ".") < 1) && (c == '.' && !getText().isEmpty());
} | 5 |
@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 Campus)) {
return false;
}
Campus other = (Campus) object;
if ((this.id == null && other.id != null) || (this.i... | 5 |
final static Options createInstance( final Configuration configuration ) {
final Options instance = createDefaultInstance();
if ( configuration != null ) {
instance.setAntialiasScreen( configuration.isAntialiasScreen() );
instance.setShowScale( configuration.isShowScale() );
... | 9 |
private void mainLoop() {
screen = new ScreenSprites();
screen.init();
timer = new Timer(Constants.FPS_UPDATE);
fpsMeter = new FpsMeter();
while (!Display.isCloseRequested()) {
glLoadIdentity();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
int j = timer.ticksMissed;
if (j > 1) fpsMeter... | 4 |
public void dostuff(HashMap<Integer,GameData> g,Vector<Integer> index,CalculatingConsole c,HashMap<String,PlayerData> p)
{
game=g;
con=c;
players=p;
LinkedList<Moneys> tem=new LinkedList<Moneys>();
tem.add(new Moneys("Correct",TOURNY));
correction=new Player("Correct",25000,tem,this);
con.everyone.put... | 7 |
public Object nextValue() throws JSONException {
char c = this.nextClean();
String string;
switch (c) {
case '"':
case '\'':
return this.nextString(c);
case '{':
this.back();
return new JSONObject(this);
... | 7 |
public void compExecTime() {
double newExeTime;
double newCost;
dEval = 0;
dTime = 0;
dCost = 0;
for (int i = 0; i < iClass; i++) {
newExeTime = 0;
// System.out.print("Cost[" + i + "]");
for (int j = 0; j < iSite; j++) {
if (dmAlloc[i][j] != -1) {
if (dmAlloc[i][j] < 1) {
newExeTime... | 8 |
public String getId() {
return id;
} | 0 |
public void saveImage(ActionEvent e){
int returnVal = fc.showSaveDialog(Paintimator.this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File savedPane = fc.getSelectedFile();
String ext = Utils.getExtension(savedPane);
ImageFilter imgfltr = new ImageFilter();
if (imgfltr.accept(savedPane)) {
tr... | 3 |
public static void main(String args[]) throws IOException {
Scanner in = new Scanner(System.in);
String password = "star";
System.out.println(">Enter the database password:");
String passIn = in.nextLine();
if(passIn.equals(password)) {
System.out.println(">Enter menu selection:\n1 Create File\n2 Open F... | 7 |
public void writeData(final DataOutputStream out) throws IOException {
out.writeShort(locals.length);
for (int i = 0; i < locals.length; i++) {
out.writeShort(locals[i].startPC());
out.writeShort(locals[i].length());
out.writeShort(locals[i].nameIndex());
out.writeShort(locals[i].typeIndex());
out.w... | 1 |
public double evaluateState(StateObservationMulti stateObs, int playerID) {
boolean gameOver = stateObs.isGameOver();
Types.WINNER win = stateObs.getMultiGameWinner()[playerID];
Types.WINNER oppWin = stateObs.getMultiGameWinner()[(playerID + 1) % stateObs.getNoPlayers()];
double rawScore... | 6 |
public double obtenerMinimo(int columna, String csvFile){
String line = "";
String cvsSplitBy = ",";
BufferedReader br = null;
double minimo = 0;
boolean primera = true;
try {
br = new BufferedReader(new FileReader(csvFile));
while ((line = br.readLine()) != null) {
St... | 7 |
public BlockMap(int var1, int var2, int var3) {
this.width = var1 / 16;
this.depth = var2 / 16;
this.height = var3 / 16;
if(this.width == 0) {
this.width = 1;
}
if(this.depth == 0) {
this.depth = 1;
}
if(this.height == 0) {
this.height = 1;
... | 6 |
public boolean cadastrar() {
EntityManager em = conexao();
try {
if (em != null) {
Paciente paciente = new Paciente();
paciente.setIdPaciente(null);
paciente.setNome(nome);
paciente.setDataNasc(dataNasc);
pacient... | 3 |
@Test
public void testGetAllCouriers()throws Exception{
List<Courier> couriers = connection.getAllCouriers();
//check first courier
Assert.assertEquals("First courier slug", firstCourier.get("slug"), couriers.get(0).getSlug());
Assert.assertEquals("First courier name", firstCourier... | 1 |
public static void main(String[] args) throws ClassNotFoundException {
int[] sched = {1,2};
DbHelper db = new DbHelper();
for(int schedule : sched)
{
List<Group> groups = fillRooms(db, schedule);
System.out.println("Schedule: " + schedule + "-------------");
for(Group g : groups) {
... | 3 |
@Override
public Command createCommand(Context context, String... args) {
HttpCommand.Operation operation;
String path = null;
MediaType mediaType = null;
Map<String, String> parameters = new HashMap<String, String>();
Map<String, String> headers = new HashMap<String, String>... | 9 |
public static void question9b() {
/*
QUESTION PANEL SETUP
*/
questionLabel.setText("Which of these below do you like the most?");
questionNumberLabel.setText("9b");
/*
ANSWERS PANEL SETUP
*/
//resetting
radioButton1.setSelected(false);
... | 0 |
static public ParseException generateParseException() {
jj_expentries.clear();
boolean[] la1tokens = new boolean[18];
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
}
for (int i = 0; i < 4; i++) {
if (jj_la1[i] == jj_gen) {
for (int j = 0; j < 32; j++) {
... | 8 |
public static List<Laureate> filterByDeathYear(
List<Laureate> inputList, List<String> ListOfTerms) {
List<Laureate> outputList = new ArrayList<Laureate>();
// parse input, keep what matchs the terms.
for (Laureate Awinner : inputList) {
if (ListOfTerms.contains(Awinner.... | 2 |
public void run()
{
boolean var27 = false;
label183:
{
label184:
{
label185:
{
label186:
{
label187:
{
try
... | 6 |
public String toString()
{
return "x = " + this.x + ",y = " + this.y + ";";
} | 0 |
public FloorItem getGroundItem(int id, WorldTile tile, Player player) {
if (floorItems == null)
return null;
for (FloorItem item : floorItems) {
if ((item.isInvisible() || item.isGrave())
&& player != item.getOwner())
continue;
if (item.getId() == id && tile.getX() == item.getTile().getX()
&&... | 9 |
public byte[] populate(byte[] frameData) {
logger.debug("populate..");
boolean readingState=false;
int bytesRead=0;
//boolean frameCompleted=false;
ByteBuffer payloadBuffer = ByteBuffer.allocate(frameData.length);
for (byte newestByte:frameData){
bytesRead++;
if (newestByte == START_OF_FRAME && !readi... | 7 |
TreeNode rightNext(){
TreeNode head = queue.poll();
if (head.right != null)
queue.offer(head.right);
if (head.left != null)
queue.offer(head.left);
return head;
} | 2 |
@Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == btnSave) {
saveUpdateSubProcess();
closedByOk = false;
}
if (e.getSource() == btnClose) {
if (saveUpdateSubProcess()) {
closedByOk = true;
SubProcessCUDialog.this.setVisible(false);
}
}
if (e.getSource... | 6 |
private void insertAVL(TreeNode currentNode, TreeNode newNode) {
if (currentNode == null) {
this.root = newNode;
} else {
if (newNode.value.compareTo(currentNode.value) < 0) {
if (currentNode.left == null) {
currentNode.left = newNode;
... | 5 |
public double evaluate(Tree<Board> tree, boolean maxPlayer) {
Board b = tree.getRoot();
if (tree.getLeaves().isEmpty()) {
this.isFinished = true;
return getBoardValue(b);
} else {
double bestValue;
if (maxPlayer) {
bestValue = Integer.MIN_VALUE;
List<Tree<Board>> t = tree.getLeaves();
for(... | 6 |
private static void executeCmd(String... cmd) {
System.out.println("spawning" + Arrays.toString(cmd));
try {
ProcessBuilder pb = new ProcessBuilder(cmd);
Process p = pb.start();
if (true) {
InputStream in = p.getInputStream();
BufferedI... | 3 |
@Override
public void tick(MainGame game, Person person) {
if(person.storedWood.getAmount() >person. maxResource || person.storedFood.getAmount() > person.maxResource ||
person.storedMetal.getAmount() > person.maxResource || person.storedStone.getAmount() > person.maxResource) {
//Make the player go to t... | 6 |
public static Image loadImage(String name, int type)
{
switch(type)
{
case BMP:
return loadBMP(name);
case PNG:
return loadPNG(name);
case JPG:
return loadJPG(name);
case GIF:
return loadGIF(name);
default:
throw new UnsupportedOperationException("Not a supported image type. [" ... | 4 |
public int largestRectangleArea(int[] height) {
Stack<Integer> s = new Stack<Integer>();
int len = height.length;
int [] left = new int[len];
int [] right = new int[len];
int index =0;
for (int i=0;i<len;i++) {
while (!s.isEmpty() && height[s.peek()]>=height[i]) s.pop();
left[i]= i- ... | 9 |
public static void caida() {
if (terminocaida){
terminocaida = false;
file = new File(".");
ruta = file.getAbsolutePath();
Thread hilo = new Thread() {
@Override
public void run() {
try {
... | 3 |
public static List<TrialGroup> createTrialGroups(List<Trial> trials) throws IncorrectNumberOfTrialsException {
List<TrialGroup> trialGroups = new ArrayList<TrialGroup>();
while (!trials.isEmpty()) {
List<Trial> trialsInThisGroup = new ArrayList<Trial>();
for (int iTrial = 0; iTrial < Opt... | 3 |
private static void merge(ConllSentence sen, ConllSentence mwe,
String[] originalpositions) {
ArrayList<Integer> op = new ArrayList<Integer>();
for(String s: originalpositions){
op.add(Integer.parseInt(s));
}
int orignalMWEHeadPostion = op.get(0);
int headOfMWE = Integer.parseInt(((sen.lines.get(orignal... | 9 |
public void actionPerformed(ActionEvent evt) {
/** if save configuration button is clicked */
if (evt.getActionCommand().equals("Save Configurations")) {
/** copy new keys back to glocal variables */
for (int i = 0; i < 4; i++) for (int j = 0; j < 5; j++)
BomberKe... | 9 |
public static boolean helpMostSpecificMethodP(Stella_Class renamed_Class, MethodSlot method) {
if (renamed_Class == null) {
return (true);
}
{ boolean testValue000 = false;
{ boolean foundP000 = false;
{ Slot slot = null;
Cons iter000 = renamed_Class.classLocalSlots.theConsLi... | 6 |
@Override
public List<ECollisionType> getCollisions(Long id, Long lecturerId,
List<Long> roomIds, List<Long> studentGroupIds,
int numberOfAppointments, Date startDate, Date endDate) {
if (id != null) {
return new ArrayList<ECollisionType>();
}
// The set with all found collionsTypes
Set<ECollisionType... | 9 |
public void move(boolean max, int m) {
int start = m;
int finish = m + this.board[m];
int loops = (finish - start) / 13;
if (max) {
if (finish == 13) { finish++; }
if (finish <= 12) {
fillBeans(start + 1, finish);
} else {
... | 8 |
public static void print(Collection<? extends Object> collection) {
Iterator<? extends Object> it = collection.iterator();
collection.getClass();
System.out.print(collection.getClass().getSimpleName() + ": " +
(it.hasNext() ? it.next() : null));
while(it.hasN... | 4 |
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.