text
stringlengths
14
410k
label
int32
0
9
private void preprocessDataOne(){ // Check row and column lengths this.numberOfRows = this.values.length; this.numberOfColumns = this.values[0].length; for(int i=1; i<this.numberOfRows; i++){ if(this.values[i].length!=this.numberOfColumns)throw new IllegalArgumentExceptio...
7
public static boolean inRange(Range range, double val) { return val >= range.min() && val <= range.max(); }
1
public static void f(int i) { System.out.println("Initialization that requires cleanup"); try { System.out.println("Point 1"); if (i == 1) return; System.out.println("Point 2"); if (i == 2) return; System.out.println("Point 3"); if (i == 3) return; System.out.println("End"); retu...
3
@Override public boolean equals(Object o) { if (!(o instanceof Duration)) { return false; } if (o == this) { return true; } Duration d = (Duration) o; if (d.getDurationValue() != this.getDurationValue()) { return false; }...
5
public void leaveAllChannels(User user){ try { Class.forName("org.apache.derby.jdbc.EmbeddedDriver"); String url = "jdbc:derby:" + DBName; Connection connection = DriverManager.getConnection(url); Statement statement = connection.createStatement(); String deleteStatement = "DELETE FROM userchatrela...
1
public static boolean isApplicable(Object object) { if (object instanceof Grammar) { Grammar g=(Grammar) object; if (g.isConverted()) { // System.out.println("false"); return false; } // System.out.println("true"); return true; } return false; }
2
public static void writeBytesToFile(File theFile, byte[] bytes) throws IOException { BufferedOutputStream bos = null; try { FileOutputStream fos = new FileOutputStream(theFile); bos = new BufferedOutputStream(fos); bos.write(bytes); } finally { if...
2
@Override public void doPlayCard(UIDataInterface data, List<CardInterface> cards, PacketFactoryInterface pf, Status status) { for (CardInterface c : cards) { try { pf.sendPlayCardPacket(c.getNation(), c.getValue()); switch (status.waitForStatus()) { ...
6
public int trap(int[] height) { //skip zeros int cur = 0; while (cur < height.length && height[cur] == 0) ++cur; int volume = 0; Stack<Integer> stack = new Stack<>(); while (cur < height.length) { while (!stack.isEmpty() && height[cur] >= height[...
6
@Override public void buttonB(boolean pressed) { if(enabled) { if(ses2 != null) { setFlagsFalse(); if(future != null) { future.cancel(true); } } if(pressed == true) { bFlag = true; dllProc.dll_keyPressed(container.xgetCurrentPreset().xgetBAssignedKeyCode()); if(...
9
public double[] train(double[] scans){ double value; getNext(scans); for(int i = 0; i < _output.length; i++){ _outputDelta[i] = dTransfer(_output[i]) * (scans[i + _inputCount] - _output[i]); } for(int i = 0; i < _hiddenLayer.length; i++){ value = 0; for(int j = 0; j < _output.length; j++)...
7
@Override public boolean updateBook(Book book) { if (doc == null) return false; Element currRoot = doc.getRootElement(); Element parentBooks = currRoot.getChild("books"); for (Element currBook : parentBooks.getChildren()) { String isbn = currBook.getChild("isbn").getText(); if (book.getIsbn().equals(...
3
static Number toNumber(Object value, Class targetClass) throws ConversionException { if (value instanceof Number) { return (Number)value; } else { String str = value.toString(); if (str.startsWith(HEX_PREFIX)) { try { ...
5
private static long readInteger(long min, long max) { // read long integer, limited to specified range long x=0; while (true) { String s = readIntegerString(); if (s == null){ errorMessage("Integer value not found in input.", "Integer in t...
5
public Pizza getPizza() { return pizzaBuilder.getPizza(); }
0
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Result other = (Result) obj; if (data == null) { if (other.data != null) return false; } else if (!data.equals(other.data)) return fa...
7
static Method[] getMethodList(Class<?> clazz) { Method[] methods = null; try { // getDeclaredMethods may be rejected by the security manager // but getMethods is more expensive if (!sawSecurityException) methods = clazz.getDeclaredMethods(); } ...
9
private boolean validacion(Punto p) { return !(p.x < 0 || p.y < 0 || p.x > Tablero.columnas - 1 || p.y > Tablero.filas - 1 || esVibora(p)); }
4
public JMenuBar createMenuBar() { // Create the menu bar JMenuBar menuBar = new JMenuBar(); menuBar.putClientProperty("jgoodies.headerStyle", "Both"); // Menu for all beans to demo JMenu componentsMenu = new JMenu("Components"); componentsMenu.setMnemonic('C'); ...
7
public String CalculateReversePolishExpression(String subStr) { List<String> suffix = createReversePolishExpression(subStr); Stack<Double> stack = new Stack<Double>(); for (int i = 0; i < suffix.size(); i++) { if (!isOperatorType(suffix.get(i))) { stack.push(Double.valueOf(suffix.get(i))); } else if (is...
4
@Override public int getMetricInternal() { if(initialMove != 0) Util.runToNextInputFrame(); Util.runToAddressNoLimit(0, initialMove, curGb.pokemon.afterDVGenerationAddress); int bc = curGb.getRegister(Register.BC); int atk = (bc >> 12) & 0xF; int def = (bc >> 8) & 0xF; int spd = (bc >> 4) & 0xF; int s...
7
public void setLayer(Layer layer) { this.layer = layer; }
0
public void showVertragsMenu() { //Menüoptionen final int NEW_LEASING_CONTRACT = 0; final int NEW_SALE_CONTRACT = 1; final int SHOW_CONTRACTS = 2; final int BACK = 3; //Vertragsverwaltung Menu maklerMenu = new Menu("Vertrags-Verwaltung"); maklerMenu.addEntry("Neuer Mietvertrag", NEW_LEASING_CONTRACT)...
5
public void jouerPartie() { int x = this._parametre.getNbCaseX(); int y = this._parametre.getNbCaseY(); this.casesBateaux = new HashMap(); for (int i = 0; i < x; i++) { for (int j = 0; j < y; j++) { if (this._j1.getCases().get(i + j * x).getBateau() !...
3
public void recursiveGetCategory(List<String> list, SecuredTaskBean pro) throws GranException { SecuredUDFValueBean contentFAQ = pro.getUDFValues().get(PRODUCT_CATEGORY_UDFID); if (contentFAQ != null) { Object cFaq = contentFAQ.getValue(); if (cFaq != null) { Stri...
6
public double[] standardizedItemMeans(){ if(!this.dataPreprocessed)this.preprocessData(); if(!this.variancesCalculated)this.meansAndVariances(); return this.standardizedItemMeans; }
2
public synchronized long getLongID( int whichID ) { if( whichID < 0 && whichID > 3 ) return -1; try { ResultSet result = SQL_SEARCH[ whichID ].executeQuery(); if( result.first() ) { return result.getLong( 1 ); } else { return -1; } } catch ( Exception e ) { e.printStackTrace(); return...
4
@Override public void addEdge(N from, N to) { if(containsNode(from) && containsNode(to) && !containsEdge(from, to)) { nodes.get(from).add(new Edge<N>(from, to)); if(!isDirected) { nodes.get(to).add(new Edge<N>(to, from)); } } }
4
public void removeUser(User user) { try { GameManager.getInstance().removeUserFromGame(user); users.remove(user); authenticatedUsers.remove(user); if(user.getUser_name() != null) System.out.println("User " + user.getUser_name() + " disconnected"); else System.out.println("User " + user.getPort(...
2
public void dbInsert(String SDA, String DN) { try { //System.err.println("DBThread Runs"); Class.forName("com.mysql.jdbc.Driver"); connect = DriverManager.getConnection("jdbc:mysql://localhost/cdr_data?user=root&password=root"); preparedStatement = connect.prepare...
1
protected void incrementTime() { currentTime = MathUtils.clamp(currentTime + Theater.getDeltaSpeed(0.025f), 0, duration); if(currentTime >= duration) { if(loop) { processLoop(); return; } complete(); } }
2
public boolean mentir(int probabilidad){ int probMentira = (int) (Math.random() * 100); if(probabilidad == 20){ if(probMentira < 21){ return true; }else{ return false; } }else if (probMentira == 50){ if(probMentira < 51){ return true; }else{ return false; } }else{ if(probMen...
5
@Override public void run(){ try{ /* while(cc.Alive()){ Thread.sleep(10000); if(lastStoredMessage.equals(lastSentMessage)){ lastSentMessage = getPingMessage(); cc.getDataTransfer().sendMessage(lastSentMessage); }else{ try{ cc.getDataTransfer().sendMessage("You Don't Have A Prope...
9
private void applyHTTPSettings( Environment<String,BasicType> httpConfig ) throws ConfigurationException, IOException { Environment<String,BasicType> httpSettings = httpConfig.getChild( Constants.KEY_HTTPCONFIG_SETTINGS ); if( httpSettings == null ) { this.getLogger().log( Level.INFO, getClass...
4
private void showCharacterAttributes(final AttributeSet a) { String name = StyleConstants.getFontFamily(a); int k = 0; for (int i = 0; i < ModelerUtilities.FONT_FAMILY_NAMES.length; i++) { if (name.equals(ModelerUtilities.FONT_FAMILY_NAMES[i])) { k = i; break; } } fontNameComboBox.removeActionLi...
7
protected synchronized int getPrimaryKeyId() { if (primaryKeyId == -1) { ResultSet rs = null; Statement stat = null; try { stat = db.getConnection().createStatement(); rs = stat.executeQuery("SELECT MAX(" + getTableIdCol() + ") FROM " + getTableName()); primaryKeyId = rs.next() ? rs.getInt(1) : 0...
6
@Override public void executeMsg(Environmental host, CMMsg msg) { if((affected instanceof Armor)&&(msg.source()==((Armor)affected).owner())) { if((msg.targetMinor()==CMMsg.TYP_REMOVE) ||(msg.sourceMinor()==CMMsg.TYP_WEAR) ||(msg.sourceMinor()==CMMsg.TYP_WIELD) ||(msg.sourceMinor()==CMMsg.TYP_HOLD) ...
7
@Override public int pulse() { int digit = getDigitToTypeIndex(); if (digit != -1) { Widget click = getEnterDigit(bankPin[digit]); if (click.isValid()) { click.click(); sleep(1000, 1500); } else { requestExit(); ...
3
@EventHandler public void BlazeBlindness(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getBlazeConfig().getDouble("Blaze.Blindnes...
6
public void run() { try { URL var1 = new URL("http://s3.amazonaws.com/MinecraftResources/"); DocumentBuilderFactory var2 = DocumentBuilderFactory.newInstance(); DocumentBuilder var3 = var2.newDocumentBuilder(); Document var4 = var3.parse(var1.openStrea...
6
public int jump(int[] A) { if(A == null || A.length == 0 || A.length == 1) return 0; int i = 0;// i keeps the index that can reach the max position int res = 0; while(i < A.length-1){ ++res; if(i + A[i] >= A.length - 1) return res; int k = i; ...
8
public long getElapsedTime() { long elapsed; if (running) { elapsed = (System.currentTimeMillis() - startTime); } else { elapsed = (stopTime - startTime); } return elapsed; }
1
public List<OrgaEinheit> getOrgaEinheiten(){ ResultSet resultSet; List<OrgaEinheit> rueckgabe = new ArrayList<OrgaEinheit>(); try { resultSet = db .executeQueryStatement("SELECT * FROM OrgaEinheiten ORDER BY OrgaEinheitBez"); while(resultSet.next()){ rueckgabe.add(new OrgaEinheit(resultSet, db, this...
2
private void startOutput(String fileName){ leavesNodeFile = new File(fileName + ".leavesNode.txt"); try { leavesNodeFileWriter = new FileWriter(leavesNodeFile); leavesNodeFileWriter.write("開始時間: " + getRightNowTimeStr("/", ":", " ") + "\r\n"); } catch (IOException e1) { // TODO Auto-generated catch block...
1
private void testClear() { thePuzzle.reset(); boolean answer = true; int row = 0; int column = 0; while (column != 9 && answer == true) { while (row != 9 && answer == true) { if (thePuzzle.getValueAtPosition(row, column) != 0) { System.out.println("Clearing tests failed"); answer = fals...
8
public static void appendStringToFile(File file, String string) { FileWriter fw = null; BufferedWriter bw = null; PrintWriter pw = null; try { fw = new FileWriter(file, true); bw = new BufferedWriter(fw); pw = new PrintWriter(bw); pw.printl...
5
public void updateImage() { //we will update animation when delay counter reaches delay, then reset delay counter delayCounter++; if(delayCounter>delay) { delayCounter=0; frameNumber--;//updates frame to next frame if(frameNumber < totalFrame-12) { frameNumber=11;// if surpass 12th frame, back ...
2
public double area() { double area = 0; for(int i=1; i<this.corners.length; i++) area += this.corners[i-1].cross(this.corners[i]); return area; }
1
public ArrayList<String> getPrimaryKeys(String tn, boolean caps){ ArrayList<String> pkList=new ArrayList<String>(); try { Connection conn; ResultSet pks; Class.forName("oracle.jdbc.driver.OracleDriver"); conn = DriverManager.getConnection(dbUrl, un, pwd); ...
5
public static void printCurrentDirectMemory(StringBuilder store) { long totalHeld = 0; long heapMem = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory(); boolean printStout = store == null; if (store == null) { store = new StringBuilder(); } ...
9
public static HashMap<String, Integer> rareCounter(String countFile, String dataFile) throws IOException { HashMap<String, Integer> wordToCount = new HashMap<String, Integer>(); FileReader in = new FileReader(countFile); BufferedReader br = new BufferedReader(in); StringTokenizer stk; String input; St...
6
public Object getValueAt(int rowIndex, int columnIndex) { Proceso aux; // Se obtiene la persona de la fila indicada aux = (Proceso)(datos.get(rowIndex)); // Se obtiene el campo apropiado según el valor de columnIndex switch (columnIndex) { ca...
4
private void rot13(CharBuffer cb) { for (int pos = cb.position(); pos < cb.limit(); pos++) { char c = cb.get(pos); char a = '\u0000'; // Is it lowercase alpha? if ((c >= 'a') && (c <= 'z')) { a = 'a'; } // Is it uppercase alpha? if ((c >= 'A') && (c <= 'Z')) { a = 'A'; } // If eith...
6
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((birthday == null) ? 0 : birthday.hashCode()); result = prime * result + ((email == null) ? 0 : email.hashCode()); result = prime * result + ((password == null) ? 0 : password.hashCode()); return resu...
3
protected String getJarName(URL url) { String fileName = url.getFile(); if (fileName.contains("?")) { fileName = fileName.substring(0, fileName.indexOf("?")); } if (fileName.endsWith(".pack.lzma")) fileName = fileName.replaceAll(".pack.lzma", ""); else if (fileName.e...
4
public void testUnmatchedClosedWithOtherValidParensParenthesis() throws Exception { String openParenString = "(3) + 5)"; try { new Expression(openParenString); fail("Did not throw exception"); } catch (MalformedParenthesisException mpe) {} }
1
static final void method2403(int i, int i_7_, int i_8_, int i_9_, int i_10_, int i_11_, int i_12_) { anInt9977++; if (i_10_ != 19206) method2402(-3, (byte) 46); Class302[] class302s = Class348_Sub27.aClass302Array6897; for (int i_13_ = 0; (class302s.length ^ 0xffffffff) < (i_13_ ^ 0xffffffff); i_13_...
6
@Override public String toString() { return super.toString().concat(" - Live States: " + liveStates); }
0
private static void thirdStrategy() { Semaphore MReading = new Semaphore(1); Semaphore MWriting = new Semaphore(1); Semaphore MPrio = new Semaphore(1); Random r = new Random(); while(true) { if(r.nextDouble() > 0.5) new Lecteur2(MReading,MWriting,MPrio).run(); else new Redacteur2(MWriting...
2
private int[] goalPosition(int number) { switch(number) { case 1: return new int[] {0, 0}; case 2: return new int[] {0, 1}; case 3: return new int[] {0, 2}; case 4: return new int[] {1, 0}; case 5: return new int[] {1, 1}; case 6: return new int[] {1, 2}; case 7: return new int[] {2, 0}; ...
9
public void setUpComboBoxes(Set<Card> cards) { for (Card card : cards) { String name = card.getName(); if (card.getType().equals(CardType.PERSON)) { peoplePossibilities.addItem(name); } else if (card.getType().equals(CardType.WEAPON)) { weaponsPossibilities.addItem(name); } } personGuess.ad...
3
public static void main(String[] args) { // TODO code application logic here // 3. Mira esta serie: 60, 30, 20, 15, 12 ... la semilla de esta serie fue el número 60. //Cree una función que recibe dos enteros: x, y y. Si alguno de ellos es 0 o negativo, o si son mayores que 255, la función debe devolver -...
5
public String Dump() { if (rend != null) { return rend.Dump(); } return ""; }
1
public boolean equals(Object obj) { if (obj == null) return false; if (!(obj instanceof PlaceUI)) return false; PlaceUI p = (PlaceUI) obj; if (p == this) return true; if ((this.getX() == p.getX()) && (this.getY() == p.getY()) && (this.getTokens() == p.getTokens()) && (this.getId() == p.get...
9
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; DbObject dbObject = (DbObject) o; if (!name.equals(dbObject.name)) return false; return true; }
4
@SuppressWarnings("static-access") private void showDocument(Document doc) { StringBuffer content = new StringBuffer(); Node node = doc.getChildNodes().item(0); newFirmNode firmNode = new newFirmNode(node); content.append("Название фирмы \n"); List<officeNode> offices = firmNode.getOffices(); //инициализ...
2
private StringBuffer Get10kContent(String urlStr) { int chByte = 0; URL url = null; HttpURLConnection httpConn = null; InputStream in = null; StringBuffer sb = new StringBuffer(""); try { // int len = 0; url = new URL(urlStr); httpConn = (HttpURLConnection) url.openConnection(); HttpURLConn...
4
private void preencherCampos() { ArrayList<String> telefones; ArrayList<Premiacao> premiacoes; jTextFieldAltura.setText(Double.toString(piloto.getAltura())); jTextFieldBairro.setText(piloto.getEndereco().getBairro()); jTextFieldCategoriaPeso.setText(Double.toString(piloto.getPes...
7
@Override public boolean runWithoutCheats() { return true; }
0
@Override public void run() { while (this.running) { try { //listen Socket socket = this.serverSocket.accept(); //handle Transaction transaction = new Transaction(this, socket); transaction.handle(); } catch (IOException ioException) { } } }
2
protected String getCanonicalName(String name) { for (String[] aTYPE1_FONT_NAME : TYPE1_FONT_NAME) { for (String anATYPE1_FONT_NAME : aTYPE1_FONT_NAME) { if (name.startsWith(anATYPE1_FONT_NAME)) { return aTYPE1_FONT_NAME[0]; } } ...
3
@Override public int castingQuality(MOB mob, Physical target) { if(mob!=null) { final Room R=mob.location(); if(R!=null) { if((R.domainType()!=Room.DOMAIN_INDOORS_CAVE) &&(R.domainType()!=Room.DOMAIN_OUTDOORS_CITY) &&(R.domainType()!=Room.DOMAIN_OUTDOORS_MOUNTAINS) &&(R.domainType()!=Room...
7
public List<DeliveryOption> getFeasible(Cart rx) { Set<DeliveryOption> ret = new HashSet<>(getAll()); log.info("Filtering total {} options", ret.size()); List<Set<DeliveryOption>> options = new ArrayList<>(); for(Class<? extends AbstractConstraint> clazz : constraintClasses) try { AbstractConstraint ...
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 boolean doesPortalExist( String name ) { for ( ArrayList<Portal> list : portals.values() ) { for ( Portal p : list ) { if ( p.getName().equalsIgnoreCase( name ) ) { return true; } } } return false; }
3
public int[] getAvailable() { int[] unavailable = getUnavailableSpots(); int[] available = new int[maxSpots]; for(int i = 0; i < maxSpots; i++) { available[i] = i+1; } for(int i = 0; i < unavailable.length; i++) { for(...
8
public HashMap vectorMap (String query) throws SQLException { Connection connection = null; Statement statement = null; ResultSet result = null; String key = ""; String val = ""; HashMap hashedList = new HashMap(); Vector value = new Vector(); try { Class.forName(driver); connection = Drive...
7
public static int shortLength(short n) { return n < 0 ? n < -99 ? n < -9999 ? 6 : n < -999 ? 5 : 4 : n < -9 ? 3 : 2 : n < 100 ? n < 10 ? 1 : 2 : n < 1000 ? 3 : n < 10000 ? 4 : 5; }
9
private Node atom() { // NUMBER // | TRUE | FALSE // | LPAREN^ sumExpr RPAREN! // | variable TokenType type = lookAhead(1); if (type == TokenType.NUMBER) { Token t = match(TokenType.NUMBER); return new NumberNode(t.getPosition(), t.getText()); } else if (type == TokenType.TRUE) { return new TrueN...
4
protected void calcDIR_CrtTime() { byte[] bTemp = new byte[2]; for (int i = 14;i < 16; i++) { bTemp[i-14] = bytesOfFAT32Element[i]; } Integer temp = byteArrayToInt(bTemp); DIR_CrtTime = ((temp & 0b111110000000000) >> 10) + ":" + ((temp & 0b1111110000) >> 5) +...
1
public void prepar() { while (notReadyToPlay()) { score += somme(); deleteTheSame(); gravity(); fillGaps(); } }
1
public void testToStandardMinutes() { Days test = Days.days(2); Minutes expected = Minutes.minutes(2 * 24 * 60); assertEquals(expected, test.toStandardMinutes()); try { Days.MAX_VALUE.toStandardMinutes(); fail(); } catch (ArithmeticException ex) {...
1
public int getSize() { return size; }
0
private void visualizeBestAndWorstSystemsW() { String reliability = isWReliable ? "" : "but some consumption parameters were missing"; String results = "BEST SYSTEMS:\nEVALUATING WATT CONSUMPTION:\n" + bestSoftwareSystemW.bestWToString() + "\nBEST OF BESTS: " + bestSoftwareSystemW.getSystemConsumptionW() + "KW " + ...
1
private Volume(int conversionFactor, String name) { super(conversionFactor, name); }
0
public void failout(String paramString1, String paramString2, Throwable paramThrowable) { System.err.println(paramString2); if (paramThrowable != null) { paramThrowable.printStackTrace(); } Frame localFrame = null; Object localObject = GameApplet.thisApplet; while ((loca...
5
@Override public void process(Class<?> serviceClass) throws ESBBaseCheckedException { if (ClassUtils.isAbstract(serviceClass)) { return; } // 初始化临时服务池 if (this.tempServicePool == null || this.tempServiceContainerManager == null) { synchronized (this) { ...
9
public void setCellsFromLoad(String input) { grid.reset(); if (player.getPlayer() != 1) { player.changePlayer(); } player.resetPlayer(); turn.resetTurn(); int tmp = gv.getRowSize()-1; String inputWithoutWhitespaces = input.replaceAll("\\s+", ""); ...
4
public static void update() { if (KeyHandler.getKey(Keys.F3) && !debugMode && count == 0) { debugMode = true; Util.enableWireframe(); System.out.println("Debug Mode enabled"); count++; } else if (KeyHandler.getKey(Keys.F3) && debugMode && count == 0) { ...
7
public void showtab(Tab tab) { Tab old = curtab; if(old != null) old.hide(); if((curtab = tab) != null) curtab.show(); changed(old, tab); }
2
public void printAccounts() { System.out.println("Bank: "+this.name); for(Konto k:accountList) { k.print(); } }
1
public Obstacle(Vector2 position, Vector2 scale, float boundingRadius) { this.position = position; this.scale = scale; this.boundingRadius = boundingRadius; try { this.image = new Image("res/sprites/birdminigame/obstacle.png"); } catch (SlickException e) { // TODO Auto-generated catch block e.printSt...
1
public void setProperPositions() { for (LevelSegment seg : _layer1) { seg.setX(seg.getSegmentColumn()*_defWidth); seg.setY(1); seg.setZ(seg.getSegmentRow()*_defThick-4); } for (LevelSegment seg : _layer0) { seg.setX(seg.getSegmentColumn()*_defWidth); seg.setY(0); seg.setZ(seg.getSegmentRow()*_de...
3
private void remove(RemoveRequest req) { StyledDocument doc = pane.getStyledDocument(); AbstractDocument aDoc = (AbstractDocument) doc; int blob_ndx = Integer.MAX_VALUE; try { int difference = 0; for (int ii = 0; ii < blobs.size(); ii++) { if (ii...
8
@Test public void testRemove() throws IOException { List<Class<?>> types = new ArrayList<>(); types.add(String.class); types.add(Integer.class); Table table = provider.createTable("simple", types); Assert.assertNotNull(table); Assert.assertNotNull(provider.getTable("...
1
public Object opt(int index) { return (index < 0 || index >= length()) ? null : this.myArrayList.get(index); }
2
public static Polylinje returnShortestYellow(Polylinje[] polylinje) throws NoYellowPolylinjeException { // Hitta dem gula. int antalGula = 0; for(Polylinje p : polylinje) { if(p.getFarg().equals("gul")) { antalGula++; } } Polylinje[] gulaPolylinjer = new Polylinje[antalGula]; System.out.pri...
7
@Override /** * Currently just used to move a mob to a certain vector */ public void update() { if (moveToVector != null) { double dx = v.getX() - moveToVector.getX(); double dy = v.getY() - moveToVector.getY(); v.setX(dx < 0 ? v.getX() - Math.min(dx, speed)...
5
private void resetPosition(Tile current, int row, int col) { if (current == null) return; int x = getTileX(col); int y = getTileY(row); int distX = current.getX() - x; int distY = current.getY() - y; if (Math.abs(distX) < Tile.SLIDE_SPEED) { current.setX(current.getX() - distX); } if (Math.abs(dis...
7
private static double intrinsicValue(String attribute, ArrayList<HashMap<String, String>> examples, HashMap<String, String[]> attributeValues) { double out = 0; for (String attrValue : attributeValues.get(attribute)) { ArrayList<HashMap<String, String>> examplesWValue = new ArrayList<HashMap<String, String...
3