text stringlengths 14 410k | label int32 0 9 |
|---|---|
private int defaultResultType(char convertCode) {
switch (convertCode) {
case 'i':
case 'o':
case 'd':
case 'x': {
return Record.LONG;
}
case 'c': {
return Record.CHAR;
}
case 'v':
case 'b': {
return Record.BOOLEAN;
}
case 'f'... | 9 |
public int getMaxProfit(ArrayList<Transaction> transByDate) {
int maxProfit = 0;
for (int i = 0; i < transByDate.size(); i++) {
if (transByDate.get(i).profit > maxProfit)
maxProfit = transByDate.get(i).profit;
}
return maxProfit;
} | 2 |
@RequestMapping(value = "/room-event-slides-list/{roomEventId}", method = RequestMethod.GET)
@ResponseBody
public CreativeMaterialListResponse roomEventSlidesList(
@PathVariable(value = "roomEventId") final String roomEventIdStr
) {
return typedCreativeMaterialList(roomEventIdStr, Creati... | 0 |
@Override
public void actionPerformed(ActionEvent e) {
if(e.getSource() == inicialView.getjButtonSair()) {
int fecha = JOptionPane.showConfirmDialog(null, "Deseja fechar o sistema?", null, JOptionPane.YES_NO_OPTION);
if(fecha == JOptionPane.YES_OPTION) {
System.exit(... | 4 |
static public final String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String s = Double.toString(d);
if (s.indexOf('.') > 0 && s.indexOf('e') < 0 && s.indexOf('E') < ... | 7 |
public void setStatustextFontsize(int fontsize) {
if (fontsize <= 0) {
this.statustextFontSize = UIFontInits.STATUS.getSize();
} else {
this.statustextFontSize = fontsize;
}
somethingChanged();
} | 1 |
public void createMonster(){
Random numGenerator = new Random();
int i = 0;
while(i < maxNumOfMonsters){
int xPos = numGenerator.nextInt(79);
int yPos = numGenerator.nextInt(23);
int n = (int)(Math.random()*monsterPieces.length);
if(floor[xPos][yPos]==null... | 9 |
public List<Position> getAlleEreichbarenNachbarn(Position position) {
List<Position> erreichbarePositionen = new ArrayList<Position>();
int[][] erreichbar = new int[7][7];
erreichbar[position.getRow()][position.getCol()] = 1;
erreichbar = getAlleErreichbarenNachbarnMatrix(position, erreichbar);
for (int i = 0... | 3 |
public void initialize() {
Debug.println("Cannon initialize()");
if (GameApplet.thisApplet != null)
{
Enumeration localEnumeration = getEnvironment().getObjects().elements();
while (localEnumeration.hasMoreElements())
{
PhysicalObject localPhysicalObject = (PhysicalObject)localEnu... | 3 |
@Override
public boolean equals(Object obj)
{
boolean res = false;
if (obj instanceof ProtectionEntry)
{
ProtectionEntry other = (ProtectionEntry) obj;
if ((this.propertyTableNameId == null && other.propertyTableNameId == null)
|| (this.propertyTableNameId != null
&& (this.propertyTableNameId.... | 6 |
@Id
@Column(name = "name")
public String getName() {
return name;
} | 0 |
public static boolean nullWrapperP(Stella_Object self) {
{ Surrogate testValue000 = Stella_Object.safePrimaryType(self);
if (Surrogate.subtypeOfP(testValue000, Logic.SGT_STELLA_THING)) {
{ Thing self000 = ((Thing)(self));
return (self000 == null);
}
}
else if (Surrogate... | 7 |
private Type type() {
Type t = null;
if(currentToken.type() == Token.Type.Int)
t = Type.INT;
else if(currentToken.type() == Token.Type.Bool)
t = Type.BOOL;
else if(currentToken.type() == Token.Type.Float)
t = Type.FLOAT;
else if(currentToken.type() == Token.Type.Char)
t = Type.CHAR;
else if(c... | 5 |
@Override
public Vehicule getVehicule(String vId) throws BadResponseException {
Vehicule v = null;
JsonRepresentation representation = null;
Representation repr = serv.getResource("intervention/" + interId
+ "/vehicule", vId);
try {
representation = new JsonRepresentation(repr);
} catch (IOException... | 3 |
public void libreta(int cc,Date min) throws IOException{
rLog.seek(0);
double tDeposito = 0,tRetiro=0,tInt=0,tAct=0;
boolean tiene1 = false;
while(rLog.getFilePointer() < rLog.length() ){
int cod = rLog.readInt();
double m = rLog.readDouble();
... | 7 |
@Override
public void keyPressed(KeyEvent e) {
// On fais tourner le bateau selectionner si c'est possible
if(e.getKeyCode() == KeyEvent.VK_RIGHT || e.getKeyCode() == KeyEvent.VK_LEFT) {
this._partie.rotationBateau();
}
} // keyPres... | 2 |
private void loadMouse()
{
mouseList.clear();
for (Class<?> clz : MouseLoader.load())
{
try
{
Constructor<?> struc = clz.getConstructor((Class<?>[])null);
Mouse mouse = (Mouse)struc.newInstance();
MouseController controller = new MouseController(mouse);
controller.setNumberOfBombs((int... | 5 |
public double evaluateState(StateObservation stateObs) {
boolean gameOver = stateObs.isGameOver();
Types.WINNER win = stateObs.getGameWinner();
double rawScore = stateObs.getGameScore();
if(gameOver && win == Types.WINNER.PLAYER_LOSES)
return HUGE_NEGATIVE;
if(gameO... | 4 |
private static float[][] generateSmoothNoise( float[][] baseNoise, int octave )
{
int width = baseNoise.length;
int height = baseNoise[0].length;
float[][] smoothNoise = new float[width][height];
int samplePeriod = 1 << octave; // calculates 2 ^ k
float sampleFrequency = 1.0f / samplePeriod;
for ( int i... | 2 |
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButton5ActionPerformed
{//GEN-HEADEREND:event_jButton5ActionPerformed
world.choiceMade("left");
}//GEN-LAST:event_jButton5ActionPerformed | 0 |
public static void cleanUp () {
ModPack pack = ModPack.getSelectedPack();
File tempFolder = new File(OSUtils.getCacheStorageLocation(), "ModPacks" + sep + pack.getDir() + sep);
for (String file : tempFolder.list()) {
if (!file.equals(pack.getLogoName()) && !file.equals(pack.getImageN... | 7 |
@Override
public boolean equals(Object obj) {
// TODO Auto-generated method stub
if(obj instanceof Edge)
{
Edge e=(Edge)obj;
if(e.u==u&&e.v==v&&e.weight==weight)
return true;
}
return false;
} | 4 |
public void test(){
assert state == State.OK;
// get the internal thread number
int i = getInternalThreadId();
// activate
setState(i, State.GUARD);
try{Thread.sleep(1+i);}catch(Throwable ignore){};
// guard
if( getState(i+1) != State.IDLE ){ setState(i, State.WAIT); }
else{ setS... | 7 |
private int randomSwitchDirection() {
int i;
i = (int) Math.floor(Math.random() * 10 + 1);
if (i > 5) {
return -1;
} else {
return 1;
}
} | 1 |
public Drawable findNearestClass(int x, int y) {
//Set the local variables required for the comparison
Drawable d = null;
double minDist = Double.MAX_VALUE;
int minDistIndex = -1;
//Loop through the vector
for(int i=0; i < getDrawable().size(); i++) {
//Set 'd' as the next 'Drawable' object
d = (Dr... | 7 |
public WellArchetype getWellManager(World world, Random random, int chunkX, int chunkZ) {
// get the list of wells
if (wells == null)
wells = new Hashtable<Long, WellArchetype>();
// find the origin for the well
int wellX = calcOrigin(chunkX);
int wellZ = calcOrigin(chunkZ);
// hex offset... finall... | 8 |
@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 Task)) {
return false;
}
if(object == this) {
return false;
}
Task other = (Task) object;
... | 6 |
public void doNextRound() {
sayRoundStatus();
if (!isStunned(player)) {
if (!multiRoundActionOnQueue(player)) {
if (playerHasAnotherAction()) {
choosePlayerAction();
} else {
System.out.println("You have no actions left!");
}
}
} else {
System.out.println("You are stunned and cannot... | 8 |
public void next()
{
// check for concurrent modification
if(expectedModCount != modCount)
throw new ConcurrentModificationException();
// go to next entry in chain, if it exists
current = current.nextEntry;
if (current == null)
{
// at end of chain; go to next cell containing an ent... | 5 |
private void parseArguments(String url,Processor processor) throws IllegalArgumentException{
//can be convert from string?
Class<?>[] parameterTypes = processor.getMethod().getParameterTypes();
for(Class<?> parameterType : parameterTypes){
if(!ConverterFactory.canConvert(parameterType)){
throw new IllegalA... | 7 |
public void readFrom(org.jdom.Element element) {
Element mainConfigElement = element.getChild(PREF_CHILD_ELEMENT);
if( mainConfigElement == null )
{
postUrl = "http://localhost/" ;
return ;
}
defaultChannel = mainConfigElement.getChildText(PREF_KEY_SLACK... | 7 |
public void qckSort(Card [] cardArray, int left, int right){
Card pivot = cardArray[left + (right - left) / 2];
int leftable = left;
int rightable = right;
while (leftable <= rightable){
while(cardArray[leftable].compareTo(pivot) < 0 ){
leftable++;
}
while(... | 6 |
public CafeRoot(String title) throws IOException {
// Frame-Initialisierung
super(title);
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
Properties spielstand = Spielstart.loadProperties("spielstand.txt");
int frameWidth = 600;//506
int frameHeight = 600;//434
setSize(frameWidt... | 3 |
final public IndexList IndexList() throws ParseException {
NodeList list = new NodeList();
Token implied_t;
Identifier identifier;
Token comma_t;
boolean implied;
implied = false;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case IMPLIED_T:
implied_t = jj_consume_token(IMPLIED_T);
... | 8 |
public Events getNotes(Events events) {
try {
crs = qb.selectFrom("notes").all().executeQuery();
String eventID = null;
String note = null;
boolean active = false;
while(crs.next()) {
eventID = crs.getString("eventID");
if(eventID == null) {
eventID = crs.getString("cbsEventID");
}
... | 8 |
public void visitLdcInsn(final Object cst) {
mv.visitLdcInsn(cst);
if (constructor) {
pushValue(OTHER);
if (cst instanceof Double || cst instanceof Long) {
pushValue(OTHER);
}
}
} | 3 |
private void connectButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_connectButtonActionPerformed
IP = ipField.getText();
nickname = "[" + nickNameField.getText() + "] ";
if ("".equals(IP) || "".equals(nickname)) {
displayMessage("You must enter a valid IP and... | 2 |
public Expr EqExpr() throws ParseException {
Token tok;
Expr e, er;
e = RelExpr();
label_8:
while (true) {
switch (jj_ntk == -1 ? jj_ntk() : jj_ntk) {
case 169:
case 170:
break;
default:
... | 7 |
public List<String> readStringSubKeys(String key) {
try {
List<String> results = new ArrayList<>();
OpenResult openResult = openKey(key, READ_ACCESS);
if (openResult.mSuccess) {
QueryResult queryResult = queryInfoKey(openResult.mHandle);
for (int i = 0; i < queryResult.mCount; i++) {
if (METHOD_... | 4 |
static String getPlatformFontFace(int index) {
if(SWT.getPlatform() == "win32") {
return new String [] {"Arial", "Impact", "Times", "Verdana"} [index];
} else if (SWT.getPlatform() == "motif") {
return new String [] {"URW Chancery L", "URW Gothic L", "Times", "qub"} [index];
} else if (SWT.getPlatform() == "... | 4 |
@Override
public String makeMobName(char gender, int age)
{
switch(age)
{
case Race.AGE_INFANT:
case Race.AGE_TODDLER:
return name().toLowerCase()+" pup";
case Race.AGE_CHILD:
switch(gender)
{
case 'M':
case 'm':
return "boy " + name().toLowerCase() + " pup";
case 'F':
ca... | 7 |
@Override
public void run() {
if (!Config.toxicEnabled) return;
World w = plugin.getServer().getWorld(Config.worldToUse);
if (w == null) return;
for (Player p : w.getPlayers()) {
PConfManager pcm = PConfManager.getPConfManager(p);
if (!pcm.getBoolean("toxicspr... | 7 |
private void moveColumn(Board b, int caller) {
int posNr = 0;
Position tmp = null;
int i, j;
int foundPos = -1;
i = j = 1;
while (i <= b.getWidth()) {
j = 1;
while (j + 1 <= b.getHeight()) {
if (b.isFree(i, j) && b.isFree(i, j + 1)) {
b.set(i, j);
b.set(i, j + 1);
foundPos = pos.sea... | 9 |
public void addFeatureVector(FeatureVector featureVector) throws Exceptions.FeatureTypeNotFoundException {
for (Entry<String, String> pair : featureVector.getFilteredPowerSet(FeatureTypes.getUsedFeatures()).entrySet()) {
incCount(pair.getKey(), pair.getValue());
totalCount++;
}
} | 1 |
public void setPWfieldMargin(int[] margin) {
if ((margin == null) || (margin.length != 4)) {
this.pwfield_Margin = UIMarginInits.PWFIELD.getMargin();
} else {
this.pwfield_Margin = margin;
}
somethingChanged();
} | 2 |
public void setItemCostPrice(BigDecimal itemCostPrice) {
this.itemCostPrice = itemCostPrice;
} | 0 |
public void getTest() {
try {
URL url = new URL(this.url);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setConnectTimeout(45000);
conn.setReadTimeout(45000);
Date d = new Date();
conn.connect();
getStatus = conn.getResponseCode... | 2 |
public void paint(GC gc, int width, int height) {
if (!example.checkAdvancedGraphics()) return;
Device device = gc.getDevice();
if (alphaImg1 == null) {
alphaImg1 = GraphicsExample.loadImage(device, GraphicsExample.class, "alpha_img1.png");
alphaImg2 = GraphicsExample.loadImage(device, GraphicsExample.clas... | 7 |
@Override
public void render(GameContainer container, StateBasedGame sbg, Graphics g) throws SlickException {
background.draw(0,0,Button.GAME_WIDTH,Button.GAME_HEIGHT);
ttf.drawString(600, 10, "SCORE : "+score);
ttf.drawString(300, 10, "TIME : "+(int) time);
if(count > 0 && time%10 >= 7){
bonusButton.draw(g... | 3 |
public void drawCenteredStringMoveY(String string, int x, int y, int color, int waveAmount) {
if (string == null) {
return;
}
x -= getTextWidth(string) / 2;
y -= baseHeight;
for (int index = 0; index < string.length(); index++) {
char c = string.charAt(index);
if (c != ' ') {
drawCharacter(charac... | 3 |
private void refreshDurationField() {
final Color defaultColor = Color.BLACK;
final Color errorColor = Color.RED;
if (startTimeDateChooser.getCalendar() == null) {
startTimeDateChooser.setCalendar(Calendar.getInstance());
}
if (endTimeDateChooser.getCalendar() == null) {
endTimeDateChooser.setCalen... | 3 |
public void paint(Graphics g) {
Dimension d = getSize();
g.drawImage(icons, border, border, iconW + border, iconH + border, 0, iconIndex * iconH, iconW, (iconIndex + 1)
* iconH, null);
if (mouseOver && !mousePressed) {
g.setColor(Color.orange);
} else if (selected || mousePressed) {
g.setColor(Color.... | 4 |
public void setPassword(String password)
{
password = password.trim();
if ( password.isEmpty() ) {
throw new RuntimeException( "'password' should not be empty" );
}
if ( password.length() < 6 ) {
throw new RuntimeException( "'password' cannot be of less than... | 2 |
public void setZoom(int zoom)
{
if (zoom == this.zoomLevel)
{
return;
}
TileFactoryInfo info = getTileFactory().getInfo();
// don't repaint if we are out of the valid zoom levels
if (info != null && (zoom < info.getMinimumZoomLevel() || zoom > info.getMaximumZoomLevel()))
{
return;
}
// if(zo... | 4 |
@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 Prioridade)) {
return false;
}
Prioridade other = (Prioridade) object;
if ((this.codprioridade == null && other... | 5 |
@SuppressWarnings("deprecation")
@EventHandler
public void onHit(EntityDamageByEntityEvent e)
{
if (((e.getEntity() instanceof Player)) && ((e.getDamager() instanceof Arrow)))
{
Arrow arrow = (Arrow)e.getDamager();
if ((arrow.getShooter() instanceof Player))
{
Player attac... | 7 |
public City(Civilization owner,Point start,int population,int id,int maxSize) {
LAND=new ArrayList<Point>();
LAND.add(start);
CENTER=start;
//growthRate=owner.growthRate;
//growth=owner.getPreference(start)*growthRate/100;
this.population=population;
this.owner=owner;
this.id=id;
startYear=owner.WORLD... | 3 |
public void next(int width, int height) {
if (nextIndex+2 < nextCoord.size()) {
nextIndex = (nextIndex+2)%nextCoord.size();
xcoord = ((Integer)nextCoord.get(nextIndex)).intValue();
ycoord = ((Integer)nextCoord.get(nextIndex+1)).intValue();
} else {
// stop animation
setAnimation(false);
isDone = true;
}... | 3 |
public ReplaceVisitor(final Node from, final Node to) {
this.from = from;
this.to = to;
if (Tree.DEBUG) {
System.out.println("replace " + from + " VN=" + from.valueNumber()
+ " in " + from.parent + " with " + to);
}
} | 1 |
private void addOwnerIfConfirm() {
if (isUserConfirm(getConfirm())) {
try {
new OwnerServiceImpl().add(model);
logger.info("New owner ({}) successfully inserted to table {}.owners", model,
JdbcInfo.getInstance().getDbName());
} catc... | 2 |
public void setCategoryId(int categoryId) {
this.categoryId = categoryId;
} | 0 |
@Override
public String toString(){
ArrayList<String> dep = new ArrayList<String>();
if(dependances != null){
for(Tache t : dependances){
dep.add(label);
}
}
if(datePlusTard == -1|| datePlusTot == -1){
return label+dep+"[ durée: "+d... | 4 |
public void testConstructor_int_int_int_Chronology() throws Throwable {
YearMonthDay test = new YearMonthDay(1970, 6, 9, GREGORIAN_PARIS);
assertEquals(GREGORIAN_UTC, test.getChronology());
assertEquals(1970, test.getYear());
assertEquals(6, test.getMonthOfYear());
assertEquals(9... | 7 |
@Override
public void actionPerformed(JTable table)
{
final MediaElement[] selected = getSelected(table);
if (table != null || selected.length > 1)
new FilePlayer(selected).execute();
else
new FilePlayer(media).execute();
} | 2 |
public void body()
{
// a loop that is looking for internal events only
Sim_event ev = new Sim_event();
while ( Sim_system.running() )
{
super.sim_get_next(ev);
// if the simulation finishes then exit the loop
if (ev.get_tag() == GridSimTags.END_O... | 4 |
void skipComment(final Input in) {
try {
final String rest = in.restOfLine();
if (rest.startsWith(lineCommentStart)) {
next(in, lineCommentStart.length());
while (in.unlessEof()) {
final char c0 = in.current();
if (c0 == CR) {
final char c1 = in.next();
if (c1 == LF) {
in.ne... | 9 |
public boolean validMove(int targetX, int targetY, boolean color) {
if (Board.onBoard(targetX, targetY)
&& ((curX == targetX)
&& ((targetY == curY + 1) || (targetY == curY - 1)) || ((curY == targetY) && ((targetX == curX + 1) || (targetX == curX - 1))))) {
return true;
}
return false;
} | 7 |
public static void compareFiles(String filePath1, String filePath2, List<String> messageDeliverOrder) {
System.out.println("Comparing " + filePath1 + " and " + filePath2 + " by thread " + Thread.currentThread().getName());
try {
BufferedReader bufferedReader = new BufferedReader(new FileRead... | 8 |
private void inviteToChannel(ChatChannel channel, ProxiedPlayer player, CommandSender sender) {
if (player != null) {
if (channel.containsMember(player.getName())) {
String msg = plugin.CHANNEL_IS_MEMBER;
msg = msg.replace("%player", player.getName());
msg = msg.replace("%channel", channel.getName());
... | 2 |
private boolean is_assigned(CPA cpa) throws Exception {
boolean assignmets_constraied = false;
int k = -1;
for (int i = 0; i < Domain.length; i++) {
k++;
k = find_next_possible_assignment(k);
if (k == -1) {
return false;
}
Assignment assignment = new Assignment(this._id, k);
for (int j = 0; ... | 6 |
@Override
public boolean equals(Object obj) {
return obj != null
&& obj instanceof ShopItem
&& ((ShopItem) obj).getSlot() == getSlot();
} | 2 |
public void compile(ClassFile cf) {
if ((code==17) || (code==18)) {
chi[0].compile(cf);
cf.code(code-(17 - 0xF4)); // logical_param AND/OR
chi[1].compile(cf);
cf.code(code-(17 - 0xF6)); // logical_end AND/OR
} else {
chi[0].compile(cf);
cf.code(0xFA); // ensure value;
... | 3 |
public String[] generateDeck(String args){
Random r = new Random();
int size = r.nextInt(31) + 60;
String[] deck = new String[size];
if(args.compareToIgnoreCase("random") == 0){
for(int i = 0; i < size; i++){
int num = r.nextInt(13);
if(num % 3 == 0){
switch(num){
case 0:
deck[i]... | 8 |
private static Object[] parseTask(StringTokenizer str) {
String taskName = str.nextToken();
Object[] task = null;
if (taskName.equals("get")) {
task = new Object[2];
task[0] = new Integer(0);
task[1] = str.nextToken();
} else if (taskName.equals("repl... | 4 |
public void run() {
while (true) {
try {
logger.debug("Waiting for new message");
permits.acquire();
Message msg = queue.poll();
if (msg == null) {
logger.error("Received null message from the queue, programming error??? Ignoring the message");
break;
}
if (msg == poison... | 5 |
public static void main(String[] args) throws IOException {
Reader.init(System.in);
int n = Reader.nextInt();
int k = Reader.nextInt();
int[] a = new int[n+1];
int[] pos = new int[n+1];
for (int i = 0; i < n; i++) {
int x = Reader.nextInt();
... | 9 |
public void setMusicType(MusicTypes musicType) {
this.musicType = musicType;
} | 0 |
private void drawBar() {
GL11.glColor3f(color2[0], color2[1], color2[2]);
GL11.glBegin(GL11.GL_QUADS);
if (isDouble != 1) {
switch (orientation) {
case Tile.UP:
GL11.glVertex2f(x,y);
GL11.glVertex2f(x + width,y);
GL11.glVertex2f(x + width,y + length - barLength);
GL11.glVer... | 5 |
private void refreshDialog() {
String nr = currentAccountNumber();
accountcombo.removeAllItems();
if (bank != null) {
try{
Set<String> s = bank.getAccountNumbers();
ArrayList<String> accnumbers = new ArrayList<String>(s);
Collections.sort(accnumbers);
ignoreItemChanges=true;
for(String ite... | 9 |
public List<T> getAllItems()
{
List<T> list = new ArrayList<>();
for(IAliasedItem<T> item : backingMap.values())
{
list.add(item.getItem());
}
return list;
} | 1 |
public static void toggleMoveable(Node currentNode, JoeTree tree, OutlineLayoutManager layout) {
CompoundUndoablePropertyChange undoable = new CompoundUndoablePropertyChange(tree);
JoeNodeList nodeList = tree.getSelectedNodes();
for (int i = 0, limit = nodeList.size(); i < limit; i++) {
toggleMoveableForSin... | 3 |
private void fineUser(Criteria criteria, AbstractDao dao) throws DaoException {
Criteria bean = new Criteria();
bean.addParam(DAO_ID_USER, criteria.getParam(DAO_ID_USER));
bean.addParam(DAO_USER_SELECT_FOR_UPDATE, true);
List<User> users = dao.findUsers(bean);
if (users.isEmpty()... | 1 |
private void setAdjacentNumbers()
{
//top two for loops iterate through the board and pass each cell into the second two for loops, which check each cell adjacent to the cell for a mine
for (int x = 0; x<boardSize; x++) { //this is to iterate through each cell
for (int y = 0; y<boardSize; y++) {
for (i... | 9 |
private void btnStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnStartActionPerformed
// nanoPosts.clear();
tabs.setSelectedIndex(1);
DefaultTableModel model = (DefaultTableModel) tableSync.getModel();
int rows = model.getRowCount();
for (int i = rows - ... | 3 |
public void clearConversations() {
for(String user : mMessageWindows.keySet()) {
mMessageWindows.get(user).setVisible(false);
}
mMessageWindows.clear();
} | 1 |
@Override
public void paint(Graphics windowGraphics) {
if (windowGraphics == null)
return;
windowWidth = getWidth();
windowHeight = getHeight();
if (frontImageBuffer == null) {
// no image to display
windowGraphics.clearRect(0, 0, windowWidth, windowHeight);
return;
}
synchronized (Zen.class) ... | 6 |
public static int firstEmptyPosition(Board board, int col) {
int row = Board.MINHEIGHT;
//Error-checking
if (!Util.isColumnValid(board, col)) {
//Column is out of bounds
row = Util.ERRORTHRESHOLD;
}
else {
while ((row <= board.getHeight()) &&
(board.getPosition(col, row) == Counter.EMPTY)) {
... | 4 |
@Override
public void updateBounty(Bounty bounty) throws DataStorageException {
try {
PreparedStatement ps = getFreshPreparedStatementColdFromTheRefrigerator("UPDATE bounties SET issuer = ?, hunted = ?, reward = ?, created = ?, hunter = ?, turnedin = ?, redeemed = ? WHERE id = ?");
p... | 4 |
@Test(expected = InstanceNotFoundException.class)
public void removeInexistentActivityTest() throws InstanceNotFoundException {
Activity activity = null;
try {
activity = activityService.find(0);
} catch (InstanceNotFoundException e1) {
fail("Activity not exist");
}
activityService.remove(activity);
... | 1 |
public boolean deleteDirOrFile(File dir) {
if (dir.isDirectory()) {
String[] children = dir.list();
for (int i = 0; i < children.length; i++) {
boolean success = deleteDirOrFile(new File(dir, children[i]));
if (!success)
return false;
}
}
boolean estSupprime = dir.delete();
System.out.p... | 3 |
void computeCubicCoefficients(int n, double[][] C) {
double[][] H = Geometry.Hermite;
for (int j = 0 ; j < dd[n].length ; j++)
vec[j] = dd[n+1][j] - dd[n][j];
double cordLength = norm(vec, dd[n].length);
double scale = 1.0;
if (isFunction())
scale = Math.max(0.25, Math.... | 8 |
private void tick() {
if (network.hasUnreadDTOs())
synchronizeEntities(network.getUnreadDTOs());
if (network.hasClientDisconnected())
removeDisconnectedClientEntities(network.getClientDisconnectedId());
List<Long> deletedEntities = new ArrayList<>();
for (Entity e : entityMap.values()) {
e.tick(this)... | 7 |
public int run(String[] arg) throws IOException, ClassNotFoundException, InterruptedException {
// //First Job, here the algorithm is ran
Configuration prefixconf = new Configuration();
String support = arg[1];
prefixconf.set("Support", support);
Job PrefixSpan = new Job(prefixc... | 9 |
@Override
public boolean activate() {
return (Bank.isOpen()
&& !Widgets.get(13, 0).isOnScreen()
&& Settings.usingFlask
);
} | 2 |
private void statement(Symbol function) throws ParserException {
enterRule(NonTerminal.STATEMENT);
if (have(NonTerminal.ASSIGNMENT)) assignment();
else if (have(NonTerminal.INPUT)) input();
else if (have(NonTerminal.OUTPUT)) output();
else if (have(NonTerminal.IF_STATEMENT)) ifStatement();
else... | 7 |
public Set<String> getBranches() {
return branches;
} | 0 |
public boolean getLeftKeyPressed() {
return leftKeyPressed;
} | 0 |
public void updateRecord(Record in) throws SQLException
{
// First get the format number
int formatNumber = in.getFormat().save();
// Get the new category number
int catNum = in.getCategory().save();
// Add the record itself
updateRecord.setString(1, in.getTitle());
update... | 4 |
public Integer[] nextIntArray() throws Exception {
String[] line = reader.readLine().trim().split(" ");
Integer[] out = new Integer[line.length];
for (int i = 0; i < line.length; i++) {
out[i] = Integer.valueOf(line[i]);
}
return out;
} | 1 |
public void paintComponent(Graphics g){
super.paintComponent(g);
// if(this.isFocusOwner()){
for( int i = 0; i < attachRods.size(); i++){
attachRods.get(i).paintComponent(g);
}
for( int i = 0; i < attachPoints.size(); i++){
attachPoints.get(i).paintComponent(g);
}
if(!placeRod){
Po... | 3 |
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.