text
stringlengths
14
410k
label
int32
0
9
public LocalInfo getLocalInfo() { if (shadow != null) { while (shadow.shadow != null) { shadow = shadow.shadow; } return shadow; } return this; }
2
public MeasureKitInteger(DataStructures inData){ this.inData = inData; outData = new DataArrays<Integer[]>(); }
0
public boolean interact(Level level, int xt, int yt, Player player, Item item, int attackDir) { if (item instanceof ToolItem) { ToolItem tool = (ToolItem) item; if (tool.type == ToolType.shovel) { if (player.payStamina(4 - tool.level)) { level.setTile(xt, yt, Tile.dirt, 0); return true; } }...
3
private void update(DocumentEvent e) { try { int value = Integer.valueOf(textField.getText()); if (value < 0 || value > 255) { throw new NumberFormatException(); } if (value != slider.getValue()) { slider.setValue(value); ...
4
protected void addPossibleMovesInDirection(final List<Move> result, final int fileStep, final int fileBorder, final int rankStep, final int rankBorder) { // Catch the condition for infinite loops. // IMPROVE add additional sanity checking if necessary if (fileStep == 0 &&...
6
private boolean parseDay() { boolean parsingSuccessful = true; d = new Day(); if(existing) { d.setDayID(id); } try { d.setDate(StrUtil.dateParser(dateF.getText())); } catch (Exception ex) { parsingSuccessful = false; ...
9
public void listWhispers(){ ChannelTree tmp; Channel chan; String str; for(long id : channelManager.getTree().keySet()){ tmp = channelManager.getChannel(id); if(tmp instanceof Channel){ str = ""; if(((Channel) tmp).isWhisper()){ chan = (Channel)tmp; str += " " + id + " - " + chan.getName...
4
@Override protected void runChild(final FrameworkMethod method, RunNotifier notifier) { Description description = describeChild(method); CompilationUnit compilationUnit = getCompilationUnit(description); if(compilationUnit == null){ throw new KoanError("Failed to load Koan"); ...
7
@Override public void mouseMoved(MouseEvent e) { positionMouse = new Point2D.Float(e.getX() - offset, e.getY() - offset); if (selectedObject != null) { DragDirection cursorDir = selectedObject.isInsideBorder(positionMouse); if (cursorDir == DragDirection.EAST) { this.setCursor(Cursor.getPredefinedC...
9
public void getNeighbours(final ArrayList<Space> spaces, final Space center, final Criterion criterion) { if(intersects(center)) { if(!criterion.permitDiagonal) { final float epsilon = 0.01f; Rectangle i = intersection(center); if(i.width < epsilon &...
8
public void run(){ try { String response; this.write("NEW " + user); if(this.read().equals("OK")){ while (! isInterrupted()) { this.write("INFO"); response = this.read(); ...
8
private Vector<Utils.Identifier> getIdentifiers(Vector<Utils.Identifier> v1, Vector<Utils.Identifier> v2) { Vector<Utils.Identifier> res = new Vector<Utils.Identifier>(); if (v1.isEmpty()) { for (Utils.Identifier iden : v2) { Vector<Utils.Identifier> vect = new V...
6
public void setGeometries(List<GeoJsonObject> geometries) { this.geometries = geometries; }
0
protected void dataAttributeChanged(final BPKeyWords keyWord, final Object value) { if (value != null) { if (keyWord == BPKeyWords.UNIQUE_NAME) { this.uniqueNameTf.setText((String) value); } else if (keyWord == BPKeyWords.NAME) { this.nameTf.setText((Strin...
5
public static boolean adjustOutputPath(File outputDir, Object comp, Logger log) { boolean adjusted = false; ComponentAccess cp = new ComponentAccess(comp); for (Access in : cp.inputs()) { String fieldName = in.getField().getName(); Class fieldType = in.getField().getType(...
8
@Override public final boolean equals(Object obj) { if (obj == this) { return true; } if (obj instanceof UniqueID) { UniqueID other = (UniqueID) obj; return mSubID == other.mSubID && mTimeStamp == other.mTimeStamp; } return false; }
3
public void visit_ior(final Instruction inst) { stackHeight -= 2; if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } stackHeight += 1; }
1
private void setBombs() { int x, y; final Random random = new Random(); final Tiles tiles = mField.getTiles(); final byte bombId = tiles.getBomb().getId(); for (int i = 0; i < mBombs; i++ ) { x = random.nextInt(mWidth); y = random.nextInt(mHeight); if (mField.getTileValue(x, y).isBomb()) i-- ; ...
3
private void addTypeAdaptersForDate(String datePattern, int dateStyle, int timeStyle, List<TypeAdapterFactory> factories) { DefaultDateTypeAdapter dateTypeAdapter; if (datePattern != null && !"".equals(datePattern.trim())) { dateTypeAdapter = new DefaultDateTypeAdapter(datePattern); } else if (d...
4
@Override public void removerIntNota(ItensNota intensNot) throws ClassNotFoundException, SQLException,Exception { dados.removerIntNota(intensNot); if(intensNot.getQtdComprada()<=0){ throw new ItensNotaException("Quantidade Comprada nao pode ser menor ou igual zero"); } if(...
3
public static MessageQueue getInstance() { if (uniqueInstance == null) { synchronized (MessageQueue.class) { if (uniqueInstance == null) { uniqueInstance = new MessageQueue(); } } } return uniqueInstance; }
2
private void init(){ // Focus on the screen automatically requestFocus(); BufferedImageLoader loader = new BufferedImageLoader(); try{ BufferedImage headers_image = loader.loadImage("/sprite_sheet_header.png"); header_ss = new SpriteSheet(headers_image); b...
1
static final void method2181(long l, int i, int i_13_, int i_14_, int i_15_, Widget class46, int i_16_, int i_17_, aa var_aa) { try { anInt3686++; int i_18_ = i_14_ * i_14_ + i_16_ * i_16_; if (((long) i_18_ ^ 0xffffffffffffffffL) >= (l ^ 0xffffffffffffffffL)) { if (i_13_ > -49) meth...
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 feel. * For details see http://down...
6
public static void main(String[] args) { MaxSubArray msa = new MaxSubArray(); int[] msa1 = { 2, 6, -5, 7, -9, -3 }; System.out.println(msa.maxSubArray(msa1)); System.out.println(msa.maxSubArray2(msa1)); System.out.println(msa.maxSubArray3(msa1)); BestTimeToBuyAndSell bttbas = new BestTimeToBuyAndSell(); ...
2
@Override protected Interactable.Result unhandledKeyboardEvent(Key key) { if(getSelectedIndex() == -1) return Interactable.Result.DO_NOTHING; if(key.getKind() == Key.Kind.Enter || key.getCharacter() == ' ') { checkedIndex = getSelectedIndex(); } retur...
3
public boolean analyze(String str){ if(!stack.isEmpty()){ stack = new Stack(stackSize); } for (int i = 0; i < str.length(); i++){ if (str.charAt(i) == '('){ stack.push('('); } if (str.charAt(i) == ')') { ...
6
@Override public Move[] getMoves(Location l, Peice[][] board) { Location[] loc = new Location[8]; loc[0]= new Location(l.x-1,l.y-2); loc[1]= new Location(l.x-2,l.y-1); loc[2]= new Location(l.x+1,l.y-2); loc[3]= new Location(l.x+2,l.y-1); loc[4]= new Location(l.x-1,l.y+2); loc[5]= new Location(l.x-2,l.y+1...
9
public int libraryUpdate(Network A, Molecule Asub, Molecule Bsub){ int index=-1; int i = 0; while (index==-1 && i<library.size()){ index = (A.equals(library.get(i))) ? i : -1; i++; } if(index == -1){ library.add(A); index = library.size()-1; library.get(inde...
4
public static void main(String[] args) { Connection dbConnection = null; try { // Establish connection and display information about the database System.out.println("Database Information\n-----------------------------"); dbConnection = ConnectionManager.getConnection(); ConnectionManager.displayDatab...
6
@Override public void keyPressed(KeyEvent e) { //To change body of implemented methods use File | Settings | File Templates. switch (e.getKeyCode()) { case KeyEvent.VK_UP: snake.setDirection(Direction.Up); break; case KeyEvent.VK_DOWN: ...
4
public static void main(String[] args){ int a = -1; int b = 1; int c = 1; int d = -1; CyberusAI ai = new CyberusAI(); for(a = -1; a > -11; a --){ for(b = 1; b < 11; b++){ for(c = 1; c < 11; c++){ for(d = -1; d > -11; d--){ int average = 0; for(int i = 0; i < 200; i ++){ ...
7
public void UpdateGame(long gameTime, Point mousePosition) { // adds a new duck to a random position if, enough time has past between the last duck if(System.nanoTime() - Duck.lastDuckTime >= Duck.timeBetweenDucks) { ducks.add(new Duck(Duck.duckLines[Duck.nextDuc...
9
@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 Student)) { return false; } Student other = (Student) object; if ((this.id == null && other.id != null) || (thi...
5
public static String successOrFailure(boolean b) { if (b) return "Success"; return "Failure"; }
1
private final long ktol(final K key) { long k; if (key instanceof Long) k = (Long)key; else if (key instanceof Number) k = ((Number)key).longValue(); else if (key instanceof String) k = new BigInteger(((String)key).getBytes()).longValue(); else { ByteArrayOutputStream byteout = new ByteArrayOutputStream()...
4
public static void main(String args[]) { BitSet bits1 = new BitSet(16); BitSet bits2 = new BitSet(16); // set some bits for(int i=0; i<16; i++) { if((i%2) == 0) bits1.set(i); if((i%5) != 0) bits2.set(i); } System.out.println("Initial pattern in bi...
3
@Override protected Object doTaskImpl(TaskMonitor monitor, ObjectRepository repository) { InstanceStream stream = (InstanceStream) getPreparedClassOption(this.streamOption); Instances cache = new Instances(stream.getHeader(), 0); monitor.setCurrentActivity("Caching instances...", -1.0); ...
7
@Override public void actionPerformed(ActionEvent e) { Object source=e.getSource(); while(((Case) source).getEstOccupe()){ this.actionPerformed(e); //genere erreur dans le console mais fonctionne } ArrayList<ArrayList<Case>> tabLignes = cartePan.getTabLignes(); Chevalier chev=cartePan...
4
public static void main(String[] args){ Player pl = null; try { pl = Manager.createRealizedPlayer(new URL("file:///D:\\Muzyka\\05.Pray!.mp3")); pl.getGainControl().setLevel(0.0f); } catch (NoPlayerException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (CannotRealizeExcepti...
5
public void update(double dt, int x, int y, Input ip, Vector2 camPos) throws SlickException { level.Update(camPos); if (inEditor) { if (level.UpdateEditor(new Vector2(x + camPos.X, y + camPos.Y), ip)) lightManager.init(level.getAllRooms()); } player.HandleInput(ip, dt); player.Update(); // ennem...
6
private Boolean getConsoleNodeValue(final Document doc) { Node outputsNode = this.getFirstLevelNodeByTag(doc, OUTPUTS_TAG); if (outputsNode == null) { return DEFAULT_CONSOLE; } Node consoleNode = this.getNodeByTagInNode(outputsNode, CONSOLE_TAG); if (consoleNode == null) { return DEFAULT_CONSOLE; } ...
3
public void poistaTiedote(Tiedote t) throws DAOPoikkeus { try { TiedoteDAO tDao = new TiedoteDAO(); // Kutsutaan daoluokan poistaTiedote-metodia tDao.poistaTiedote(t.getTiedoteId()); } catch (DAOPoikkeus p) { throw new DAOPoikkeus("Tietokannasta poistamin...
1
private void readPreferences(final BufferedReader reader) throws IOException, InvalidPreferencesFormatException { final String kvPid = _application.getConnection().getLocalConfigurationAuthority().getPid(); final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); final BufferedWriter writ...
7
public Object clone() { try { return super.clone(); } catch (CloneNotSupportedException ex) { throw new IncompatibleClassChangeError(getClass().getName()); } }
1
public synchronized static void writeStockValues(ArrayList<Stock> stocks) { File f = new File("stocks.txt"); FileWriter fr = null; try { fr = new FileWriter(f); BufferedWriter br = new BufferedWriter(fr); String s = ""; for (Stock e : stocks) { s += e.getTickername() + " " + e.getNo() + " " + e...
2
private void inhibitAdjacentOtherShapeRecognizers(int shape,int otherShape){ //System.out.println(" inhibadgy " + shape); int shapeOffset = 2500 * shape; for (int neuron = 0; neuron < 2500; neuron += 5) { int fromNeuron = neuron + shapeOffset; int fromRow = neuron / 50; if ((fromRow % 10) ...
8
private void gripperDragged(MouseEvent e) { // where are we ? @SuppressWarnings("unused") Component gripper = e.getComponent(); ToolBarPanel panel = (ToolBarPanel) this.getParent(); if(! (panel.getParent() instanceof ToolBarContainer)) { //2006/12/01 // this is a safety for users willing to include toolbar...
7
public void setFrontLeftTrim(int frontLeftTrim) { this.frontLeftTrim = frontLeftTrim; if ( ccDialog != null ) { ccDialog.getTrim1().setText( Integer.toString(frontLeftTrim) ); } }
1
private static void extractGrid(String recurso, File destino) throws IOException { if (destino.exists()){ return; } InputStream inputStream = Config.class.getClassLoader().getResourceAsStream("cat2osm/grids/"+recurso); OutputStream outputStream = new FileOutputStream(destino); IOUtils.copy(inputStream, out...
1
public static boolean userOK(String input) { /* * Funktion som kollar om nickname som är angivet är ok. * Null, Server eller något som redan finns är dåligt. */ boolean svar = false; for(int i = 0; i < Main.users.size(); i++) { if(input.equalsIgnoreCase(Main.users.get(i).getNickname()) || input.equ...
5
public Map<Point, List<Point>> cluster() { // 随即选取k个点作为中心点 List<Point> keys = Random.choice(points, k); while (true) { // 根据中心点对属性点聚类 clusters = clusterPoints(keys); // 根据聚类结果计算中心点 ArrayList<Point> tmpKeys = new ArrayList<Point>(); for...
3
private void copyToClipboard(String selectString){ if (selectString != null){ StringSelection stringSelection = new StringSelection (selectString); Clipboard clipboard = Toolkit.getDefaultToolkit ().getSystemClipboard (); clipboard.setContents (stringSelection, null); ...
1
private void print(Employee[] e) { for (int i = 0; i < e.length; i++) System.out.println(e[i].surName + "," + e[i].givenName); }
1
private void set(String type, int id_tank, int id) throws Exception{ int tankTypeID = garage.getTankID(id_tank); if(type == null){ close(); }else if(type.equals("$armor$")){ if(tankTypeID == dataBaseConnector.getTankIDForArmor(id)){ ...
9
@Override public void run() { options.status = "Open bank"; for (Item item : ctx.equipment.select().id(Banking.ALWAYS_DEPOSIT)) { if (ctx.backpack.isFull()) { break; } ctx.equipment.unequip(item.id()); } if (!ctx.bank.open()) { final Locatable nearest = ctx.bank.nearest(); if (nearest inst...
5
protected NoDiscountStrategy(double price, int copies) { super(price, copies); }
0
private EnumSoundLoadError getALErrorAsErrorEnum(int err) { switch (err) { case AL_NO_ERROR: return EnumSoundLoadError.ERROR_NULL; case AL_INVALID_NAME: return EnumSoundLoadError.ERROR_INVALID_NAME; case AL_INVALID_ENUM: ...
6
public String getExportEncoding() { return (String) exportEncodingComboBox.getSelectedItem(); }
0
public static void main(String[ ] args) { String[ ][ ] animals = { { "DanaDog", "WallyDog", "JessieDog", "AlexisDog", "LuckyDog" }, { "BibsCat", "DoodleCat", "MillieCat", "SimonCat" }, { "ElyFish", "CloieFish", "GoldieFi...
2
public boolean looseEquals(Object keyObj) { boolean isEqual = false; if (key != null) { // Checks a compound key (ObjectKey[] or String[] // based) with the delimited String created by the // toString() method. Slightly expensive, but should be less // than parsing the String into its...
8
public static List<Presente> corte(List<Presente> p1, List<Presente> p2, int posCorteInicial, int posCorteFinal, int tamanho) { System.out.println("----"); System.out.println(posCorteInicial + " " + posCorteFinal); imprimirPresentes(new Cromossomo(p1)); imprimirPresentes(new Cromossomo(p...
7
@Override public void update(int delta) { if (!active) { return; } // calculate x x = entity.getX() - (Globals.APP_WIDTH / 2); if (x < 0) { x = 0; } if (x >= Engine.getMap().getWidth() - Globals.APP_WIDTH) { x = Engine.getMap().getWidth() - Globals.APP_WIDTH; } // calculate y y = entity....
7
public static int getCopies(PrintService service, PrintRequestAttributeSet set) { Copies copies = (Copies) PrintUtilities.getSetting(service, set, Copies.class, false); return copies == null ? 1 : copies.getValue(); }
1
public static char nine(int r, int c, int f) { if (s1(r, c, f) || s4(r, c, f) || s5(r, c, f)) return '|'; else if (s3(r, c, f) || s6(r, c, f) || s7(r, c, f)) return '_'; return '.'; }
6
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final Item target=getTarget(mob,mob.location(),givenTarget,commands,Wearable.FILTER_ANY); if(target==null) { final String str=CMParms.combine(commands,0).toUpperCase(); if(str.equals("MONEY")...
9
public void setItemId(int itemId) { this.itemId = itemId; }
0
public static String dump(Object comp) throws Exception { StringBuilder b = new StringBuilder(); b.append("//" + comp.toString() + ":\n"); b.append("// In\n"); ComponentAccess cp = new ComponentAccess(comp); for (Access in : cp.inputs()) { String name = in.getField()....
2
public static Res combine (Res l, Res r, char op) { int total = ( l.cTrue + l.cFalse ) * (r.cTrue + r.cFalse); int t = 0; int f = 0; if ( op == '^' ){ t = l.cFalse * r.cTrue + l.cTrue * r.cFalse; f = total - t; } else if ( op == '&' ) { t = l.cTrue * r.cTrue; f = total - t; ...
2
private Task getResponse(HttpURLConnection connection) throws Exception { int responseCode = connection.getResponseCode(); if (responseCode == 200) { InputStream inputStream = connection.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader( inputStream)); return new Task(...
4
public static boolean containsAtLeastOneNonBlank(List<String> list){ for(String str : list){ if(StringUtils.isNotBlank(str)){ return true; } } return false; }
2
public static void main(String[] args) { String s2 = "Akroma, Angel of Wrath"; System.out.println(s2.replaceAll("[',]", "")); String s = "2 Pack Rat [RTR] "; Matcher m = linePattern.matcher(s); System.out.println(m.matches()); System.out.println(Integer.parseInt(m.group(1))); for(int i = 0; i < 4; i++)...
1
public void mapRender(int scale, int xOff, int yOff){ if(texture == null) texture = tile.getTexture(); texture.bind(); // or GL11.glBind(texture.getTextureID()); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0, 1); GL11.glVertex2f(x/scale + Game.PLAYER.getCameraX() + xOff, y/scale + Game.PLAYER.getCameraY...
1
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 void setAsset_id(String asset_id) { this.asset_id = asset_id; }
0
void lisaaKentalle(List<Palikka> palikat) { for (int i = 0; i < palikat.size(); i++) { this.pelipalikat[palikat.get(i).getY()][palikat.get(i).getX()] = palikat.get(i); } }
1
public List<String> query(String st) { List<String> returnList = new ArrayList<>(); //System.out.println("SQL: "+st); try { PreparedStatement statement = conn.prepareStatement(st); ResultSet rs = statement.executeQuery(); if (rs == null) { ...
4
@Override public int hashCode() { int hash = 0; hash += (idHospital != null ? idHospital.hashCode() : 0); return hash; }
1
@Override public void render() { for (int i = 0; i < pixels.length; i++) { pixels[i] = i + ticks; } renderSprite(Assets.GRASS, x, y, 0, false); }
1
private static boolean[] primeBoolArray(int limit) { boolean[] nums = new boolean[limit]; for (int i = 2; i < nums.length; i++) nums[i] = true; int nextPrime = 2; while (nextPrime < nums.length / 2) { int i = nextPrime; for (; i < nums.length; i += nextPrime) nums[i] = false; nums[nextPrime] = t...
5
protected String getRequirementsDescription(String values) { if(values==null) return ""; if(values.equalsIgnoreCase("integer")||values.equalsIgnoreCase("int")) return " as an integer or integer expression"; else if(values.equalsIgnoreCase("double")||values.equalsIgnoreCase("#")||values.equalsIgnoreCase("...
9
public void SetLampColorAndMessage(String s, int c) { switch( c ) { case 0: IluminationColor = Color.black; break; case 1: IluminationColor = Color.green; break; case 2: IluminationColor = Color.yellow; break; case 3: IluminationColor = Color.red; break; } // switc...
4
public IVPBoolean greaterThan(IVPNumber num, Context c, HashMap map, DataFactory factory) { IVPBoolean result = factory.createIVPBoolean(); map.put(result.getUniqueID(), result); boolean resultBoolean = false; if(getValueType().equals(IVPValue.INTEGER_TYPE) && num.getValueType().equals(IVPValue.INTEGER_TYPE)){ ...
5
public void generateInitialPopulation(int size){ population = new String[size][]; prevPopulation = new String[size][]; fitness = new Double[size]; for(int i = 0; i < size; i++){ population[i] = this.generateDeck("random"); fitness[i] = 0.0; } }
1
public static Property getPropertyByName(String name) { Property p=null; try { p=MediaProperty.valueOf(name); } catch (IllegalArgumentException e) { p=extendedProperties.get(name.toUpperCase()); } return p; }
1
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
public void addView(AbstractView view) { if ("CONNECTION".equals(view.getType())){ this.getContentPane().add(view.getPanel()); } else { this.getContentPane().add(contentPanel); String type = view.getType(); if (type.equals("WEST")) { conten...
8
protected void randomizeFolders(String romId, ByteStream rom, ChipLibrary library) { // Randomize Folder ItemProducer chipProducer = new BN456RewardProducer(library); FolderProducer producer = new FolderProducer(chipProducer); FolderProvider provider = new FolderProvider(this, producer); Pointe...
7
public void addText(String text) { combatLog = combatLog + "\n" + text; updateLog(combatLog); }
0
private static void buildTimelineBackward(List<SmaliBlock> blockList, SmaliMethod method) { //TODO: implement backward timeline scanning SmaliBlock block = null; RegisterTimeline timeline = null; List<SmaliBlock> sortedList = new LinkedList<SmaliBlock>(); List<SmaliBlock> tmpList = new LinkedList<SmaliBloc...
8
public static void main(String[] args){ while(true){ AvgCyberusAI tetris = new AvgCyberusAIHelper(); tetris.startGame(); while(tetris.tc.gameOn){ System.out.print(""); } } }
2
public static ArrayList<Student> loadStu() { ArrayList<Student> list = new ArrayList<>(); Student stu = new Student(); FileReader fr = null; BufferedReader br = null; try { fr = new FileReader("d:/object.txt"); br = new BufferedReader(fr); int ch = 0; String tmp = ""; while (true) { while (...
8
public List<Aplicacion> ObtenerAplicacion(String consulta){ List<Aplicacion> lista=new ArrayList<Aplicacion>(); if (!consulta.equals("")) { lista=cx.getObjects(consulta); }else { lista=null; } return lista; }
1
public int readInt() { int ch1 = readByte(); int ch2 = readByte(); int ch3 = readByte(); int ch4 = readByte(); if(ch1 < 0) ch1 = BYTE_MAX + ch1; if(ch2 < 0) ch2 = BYTE_MAX + ch2; if(ch3 < 0) ch3 = BYTE_MAX + ch3; if(ch4 < 0) ch4 = BYTE_MAX + ch4; //position += INT_SIZE; return ((c...
4
public Move promoteSelf(boolean color) { Move m = null; for (Entry<Point, ChessSquare> e : potentialMoves.entrySet()) { if (e.getKey().getY() == 0 && color) { for (Entry<Point, Piece> f : e.getValue().getInbound(color).entrySet()) { if (f.getValue().toString().equals("WP")) { m = new Move(f.ge...
9
public int getCharTextureID(char c) { if (c < FIRST_STANDARD_CHAR || c > FIRST_STANDARD_CHAR + NUM_STANDARD_CHARS) { System.out.println("Unsupported character: " + c + " (\\u" + Integer.toHexString(c) + ")"); return -1; } return TextureManager.getTextureID(name + "." + c)...
2
public static void loadAllAchievements() { String statement = new String("SELECT * FROM " + DBTable + " WHERE type = ?"); PreparedStatement stmt; try { stmt = DBConnection.con.prepareStatement(statement); stmt.setInt(1, QUIZ_CREATED_TYPE); ResultSet rs = stmt.executeQuery(); while (rs.next()) { Qu...
2
public Nutzer setUser(String name, String password, String password_repeat) throws Exception { if (password == null || password.equals("")) throw new PasswordEmptyException("Bitte ein Passwort eingeben"); if (password_repeat == null || password_repeat.equals("")) ...
9
public boolean ajouterSignalisation(Signalisation s) { if (s instanceof Feu && this.getNbFeu() <= NOMBRE_MAX_FEUX) { return signalisations.add(s); } else if (s instanceof PanneauCedezLePassage && this.getNbCedezLePassage() <= NOMBRE_MAX_CEDEZLEPASSAGE) { return signalisations.add...
6
private boolean newEntry() { try { rs.moveToInsertRow(); return true; } catch (SQLException ex) { System.out.println(ex.getMessage()); } return false; }
1