text
stringlengths
14
410k
label
int32
0
9
public JPanel CreatGui(){ int NumberOfServer = serverlist.size(); tabbedPane = new JTabbedPane(); ImageIcon icon = createImageIcon("glorous28.png"); for(int i =0; i < NumberOfServer; i++){ TABID[CurrentTab] = i; CurrentTab += 1; ArrayList<JTextArea>...
4
public static void printTruthTable(String [][] results, int propagationTime){ for(int i = 0; i < results.length; i++){ for(int j = 0; j < results[0].length; j++){ if(i == 0 || results[0][j].length() == 1) System.out.print("|" + results[i][j]); else System.out.print("|" + results[i][j] + String.fo...
4
final public void Function_declaration() throws ParseException { /*@bgen(jjtree) Function_declaration */ SimpleNode jjtn000 = new SimpleNode(JJTFUNCTION_DECLARATION); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { Functi...
8
public void matchTexture() { if (getAssociatedPlayer() instanceof ComputerPlayer && !Game.madHax) { this.setTextureID(TextureManager.getTextureID("card_back")); } else { this.setTextureID(TextureManager.getCardTextureID(card.value, card.suite)); } }
2
protected int partition(int attIndex, int l, int r) { double pivot = instance((l + r) / 2).value(attIndex); while (l < r) { while ((instance(l).value(attIndex) < pivot) && (l < r)) { l++; } while ((instance(r).value(attIndex) > pivot) && (l < r)) { ...
8
public static void main(String[] args) throws IOException { while (true) { System.out.println("Choose option for HomeWork to be done with...\n 1 - BufferedReader\n 2 - Scanner\n 3 - JOptionPane\n 4 - Exit"); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System....
8
public Instances defineDataFormat() throws Exception { // initialize setOptions(getOptions()); checkCoverage(); Random random = new Random (getSeed()); setRandom(random); Instances dataset; FastVector attributes = new FastVector(3); Attribute attribute; boolean classFlag = getClas...
9
public static <T> boolean swapArray(T[] array, int i, int j) { int size = array.length; if (size < 2 || i == j || i < 0 || i >= size || j < 0 || j >= size) { return false; } T temp = array[i]; array[i] = array[j]; array[j] = temp; return true; }
6
private Vector<TrieNode> fetch(TrieNode parent) { int prev = 0; Vector<TrieNode> siblings = new Vector<TrieNode>(); for (int i = parent.left; i < parent.right; i++) { if (this.keys[i].length() < parent.depth) { continue; } String tmp = this.keys[i]; int cur = 0; if (this.keys[i].length() !...
8
public void mouseReleased(MouseEvent e) { }
0
public void drawBoard(Graphics g) { g.drawImage(boardSizer.getBoardImage(), 0, 0, null); int radius = boardSizer.getPieceRadius(); for (int x = 0; x < board.boardSize; ++x) { for (int y = 0; y < board.boardSize; ++y) { int move = board.intersections[x][y]; if (move == Board.PLAYER_1 || move == Board.P...
5
public Offset readOffset(XMLStreamReader2 streamReader) throws XMLStreamException { Integer periodMultiplier = null; PeriodEnum period = null; DayTypeEnum dayType = null; int startingDepth = streamReader.getDepth(); while(streamReader.hasNext()) { switch(streamReader.next()) { case XML...
8
protected void debugOutput(int topK, String filePrefix) { File parentTopicFolder = new File(filePrefix + "parentTopicAssignment"); File childTopicFolder = new File(filePrefix + "childTopicAssignment"); if (!parentTopicFolder.exists()) { System.out.println("creating directory" + parentTopicFolder); parentTo...
5
@EventHandler public void PigZombieHarm(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.getPigZombieConfig().getDouble("PigZombie.H...
6
public Line2D.Double getClippedLine(Line2D.Double line) { if (isInside(line.x1, line.y1) && isInside(line.x2, line.y2)) { return line; } if (isInside(line.x1, line.y1) == false && isInside(line.x2, line.y2) == false) { return null; } if (line.x1 != line.x2 && line.y1 != line.y2) { return null; } ...
9
* @return a set of actual versions in bitset form */ BitSet getSelectedVersions( String spec ) { BitSet bs; if ( spec != null && spec.length()>0 ) bs = convertVersions( spec ); else { bs = new BitSet(); for ( int i=1;i<=versions.size();i++...
3
public static void main(String[] args) { // read names from file List<String> names = new ArrayList<String>(); BufferedReader reader = null; try { reader = new BufferedReader(new FileReader("/home/nagasaki45/code/cattle_drive/names.txt")); String line; while((line = reader.readLine()) != null) { n...
5
public static ObjectDefinitions getObjectDefinitions(int id) { ObjectDefinitions def = objectDefinitions.get(id); if (def == null) { def = new ObjectDefinitions(); def.id = id; byte[] data = Cache.STORE.getIndexes()[16].getFile( getArchiveId(id), id & 0xff); if (data == null) System.out.println...
9
public Person retrieve() { if (personArray.length == 0) { return null; } Person result = personArray[0]; for (int position = 0; position < personArray.length-1; position++) { if (personArray[position+1] != null) { personArray[position] = personArra...
4
public GameData(int numInitialContestants) { // check if within parameters if (numInitialContestants > 15 || numInitialContestants < 6) return; // if not, do not create GameData item weeksRem = numInitialContestants - 2; weeksPassed = 0; setBetAmount(0); this.numInitialContestants = numInitialContestant...
2
public void togglefs() { if (prefs == null) setfs(); else setwnd(); }
1
public String readLine() { if (input != null) { if (input.hasNext()) { return input.next(); } else { return null; } } else { return null; } }
2
@Override public PropertyFilter removeFilterByName(String name) { for (int i = 0; i < filters.size(); i++) { PropertyFilter filter = (PropertyFilter) filters.get(i); String filter_name = filter.getName(); if (filter_name == null && name == null) { filters.remove(i); return filter; } else if (filt...
4
public void recieveCmd(){ int cmd; try { cmd = input.read(); } catch (IOException ioe) { System.out.println("failed to read from serial"); ioe.printStackTrace(); return; } System.out.printf("cmd = %x: ", cmd); if((cmd & 0x80) == 0) return; switch(cmd){ case 0xC0: // start left click Syste...
8
public boolean poistaRuutu(int a, int b) { for (int i = 0; i < reuna; i++) { for (int j = 0; j < reuna; j++) { if (i == a && j == b) { ruudukko[i][j] = ""; return true; } } } return false; }
4
public static void main(String[] unused) { Machine M; BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); M = null; boolean firstline = true; try { while (true) { String line = input.readLine(); if...
6
public String reportByMark(){ preReportByMark(); boolean check = true; if(stdo.getStrMark().isEmpty()){ check = false; addFieldError("stdo.strMark", "You must a value to mark"); } else { try { stdo.setMark(Float.parseFloat(stdo...
8
public void setUserKey(String key) { if (key.isEmpty()) { return; } userKeyTextField.setText(key); BmLog.debug("Setting user key " + key); }
1
public Reminder() { super(Reminder.class.getSimpleName()); }
0
public void displayandSearchContents() { // Output Scriptures that match System.out.println("Topic References"); for (int i = 0; i < topicsList.size(); i++) { String tempTopic = topicsList.get(i).getTopic(); System.out.println(tempTopic); for (int ...
8
private void validate(byte[] bytes) { for (byte b : bytes) { if (b == Utils.RECORD_SEPARATOR) { throw new RuntimeException("Key contains a Record Separator 0x1E"); } } }
2
public void handlePark(Park park) { park.setManaged(true); this.park = park; }
0
@Override public boolean disInvokeEffects(Environmental E) { if(E==null) return false; if(E instanceof Affectable) { final Affectable aE=(Affectable)E; final LinkedList<Ability> affects=new LinkedList<Ability>(); for(int a=aE.numEffects()-1;a>=0;a--) // personal affects { final Ability A=aE.f...
7
public static void startupDateTimeParser() { { Object old$Module$000 = Stella.$MODULE$.get(); Object old$Context$000 = Stella.$CONTEXT$.get(); try { Native.setSpecial(Stella.$MODULE$, Stella.$STELLA_MODULE$); Native.setSpecial(Stella.$CONTEXT$, ((Module)(Stella.$MODULE$.get()))); ...
6
public static void main(String[] args) { BufferedOutputStream stream = null; try { stream = new BufferedOutputStream(new FileOutputStream("out.txt")); stream.write("Hello, World!".getBytes()); stream.write(System.getProperty("line.separator").getBytes()); stream.write("I am writting into a file using Bu...
3
private void getNextPosition() { // movement if(left) { dx -= moveSpeed; if(dx < -maxSpeed) { dx = -maxSpeed; } } else if(right) { dx += moveSpeed; if(dx > maxSpeed) { dx = maxSpeed; } } // falling if(falling) { dy += fallSpeed; } }
5
public static void main(String[] args) { User u = null; try { u = new User("bob", "builder", "bbuilde"); } catch (InvalidFieldException e) { } Contestant c = new Contestant(); Contestant ul = new Contestant(); try { c.setID("aa"); ul.setID("ab"); u.setWeeklyPick(c); u.setUltimatePick(ul); ...
3
public void testPropertyCompareToDay() { LocalDateTime test1 = new LocalDateTime(TEST_TIME1); LocalDateTime test2 = new LocalDateTime(TEST_TIME2); assertEquals(true, test1.dayOfMonth().compareTo(test2) < 0); assertEquals(true, test2.dayOfMonth().compareTo(test1) > 0); assertEqual...
2
public static void addOL(Gob obj) { if(obj != null) { Integer newId = Integer.valueOf(obj.id); if(!iObj.contains(newId)) iObj.add(newId); } }
2
@Override public void run() throws Exception { // TODO Auto-generated method stub try { // Eclipse doesn't support System.console() BufferedReader console = new BufferedReader(new InputStreamReader(System.in)); ConfigManager config = NetBase.theNetBase().config(); try { String targetIP = config.g...
9
public void redrawAllOpenDocuments() { for (int i = 0, limit = openDocuments.size(); i < limit; i++) { OutlinerDocument doc = (OutlinerDocument) getDocument(i); // Only request focus for the current document. if (doc == getMostRecentDocumentTouched()) { doc.panel.layout.redraw(); } else { doc....
2
@Override public String getHTTPStatusCode(HTTPStatusCodes httpStatusCodes) { return getPatchMap().containsKey(etag) ? httpStatusCodes.getStatus(204) : httpStatusCodes.getStatus(200); }
1
public static void main(String[] args) { w = new Worker(); }
0
private void initNeedParseLangList() { if (null == needParseLangList) { needParseLangList = new ArrayList<>(); if (langEnUsjCheckBox.isSelected()) { needParseLangList.add("en_us"); } if (langDeDejCheckBox.isSelected()) { needParseLa...
7
private static void expandAllSubheads(OutlinerDocument doc) { try { if (doc.tree.getComponentFocus() == OutlineLayoutManager.TEXT) { TextKeyListener.expandAllSubheads(doc.tree.getEditingNode()); } else if (doc.tree.getComponentFocus() == OutlineLayoutManager.ICON) { IconKeyListener.expandAllSubheads(doc...
3
*/ public void iniciar() { /* 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://download.ora...
6
public void addLeft() { int rows[] = types.getSelectedIndices(); if (rows.length != 0) { for(int i : rows) { AccountType type = allTypes.get(i); if (!debitTypes.contains(type)) { debitTypes.add(type); debitModel.addElement(type); } } } }
3
@Override public void stateChanged(ChangeEvent ce) { System.out.println("you changed the state of the program...:P"); if(((JTabbedPane)(ce.getSource())).getSelectedIndex()==0) { if((Student.studentListAudio.size()-Integer.parseInt(studentNumberComboBox.getSelectedItem().toString()))>=0) waitingButton.se...
4
private static Animacion crearAnimacionCanasta() { Animacion anim = new Animacion(); for (int i = 0; i <= 8; i++) { anim.sumaCuadro (Toolkit.getDefaultToolkit ().getImage (Canasta.class.getResource ("Images/basket/net" + i + ".png")), 200); } return anim; }
1
private void createContenedoresGraphic() { horizontalContenedoresBarModel = new HorizontalBarChartModel(); horizontalContenedoresBarModel.setStacked(true); horizontalContenedoresBarModel.setBarMargin(40); Axis xAxis = horizontalContenedoresBarModel.getAxis(AxisType.X); xAxis.setLabel("Espacio del Conten...
7
public void setAnimState(AnimState state) { if (state != null) resetAnimState(); getPrivates(); stateColor = g.getColor(); stateNew = new AnimState(state); g.setColor(state.color); state.color.bind(); if (state.pos.x != 0 || state.pos.y != 0) g.translate(-state.pos.x,-state.pos.y); if (state.angle !...
6
@Override public boolean setChartOption( String op, String val ) { boolean bHandled = false; if( op.equalsIgnoreCase( "Stacked" ) ) { fStacked = val.equals( "true" ); bHandled = true; } else if( op.equalsIgnoreCase( "PercentageDisplay" ) ) { f100 = val.equals( "true" ); bHandled = true; } ...
5
Point computeSize(Control control, int wHint, int hHint, boolean flushCache) { if (flushCache) flushCache(); if (wHint == SWT.DEFAULT && hHint == SWT.DEFAULT) { if (defaultWidth == -1 || defaultHeight == -1) { Point size = control.computeSize(wHint, hHint, flushCache); defaultWidth = size.x; defau...
9
public ModelState(final boolean score, final int level, final int theme) { this.ifScore = score; this.difficulty = level; this.theme = theme; endOfTheGame = false; //назначаем стартовые очки if (level == 8) { bricks = new boolean[4]...
4
public void guardarArchivo(String path){ try { Configuracion c = principal.configuraciones.buscar(principal.getCurrentServer()); if(c==null){ c = principal.configuraciones.getConfigLocal(); } FileOutputStream fileOut = new FileOutputStream(c.getStr...
2
private static void calculateUsersTopTenMatches(HashMap<Integer, User> userMap) { /* * Note: Currently this function is hovering at a runtime of O(N^2). All possible combinations of users are computed, with no cashing, i.e. * user 1's potential relationship with user 2 is calculated, and later user 2's potenti...
8
private static void parseCriteria(Element attrElem, ChartData chartData, AttributeData parentAttr, HashMap<String, Color> colorMap) throws IOException { try { if (attrElem.getAttribute("type").equals("abstract")) { AttributeAbstractData attr = new AttributeAbstractDa...
6
public void init(){ initialized = true; int i = 0; while(i < content.size()){ content.get(i).PreInit(this,new Config(new File(""))); i++; } while(i < content.size()){ content.get(i).Init(this); i++; } while(i < con...
3
public boolean move(int direction) { if (this.movingState >= 0) { return false; } this.direction = direction; Point nextPosition = this.getNextTile(direction); if (nextPosition.x < 0 || nextPosition.y < 0 || nextPosition.x >= Constants.ENVIRONMENT_WIDTH || nextPosition.y >= Constants.ENVIRONMENT_HEIG...
5
@Override public void caseAConstanteDeclaracao(AConstanteDeclaracao node) { inAConstanteDeclaracao(node); if(node.getValor() != null) { node.getValor().apply(this); } if(node.getIdentificador() != null) { node.getIdentificador().apply(this)...
3
private void paintJogo(Graphics g) { // Desenhar for(int x=0; x<Engine.NUM_COLUMNS; x++) { for(int y=0; y<Engine.NUM_LINES; y++) { int drawY = Engine.NUM_LINES-1-y; if( getEngine().getCobra().isPosTrue(x,y) ) // Cobra { rectanguloJogo(g, Color.BLUE, x, drawY); } else if( getEngine...
6
public void inicio(Curso curso) throws Exception { salvar = new JButton("Salvar"); id = new JTextInt(curso.getId()); id.setEditable(false); id.setEnabled(false); nome = new JTextField(curso.getNome() == null ? "" : curso.getNome()); JPanel pp = new JPanel(); DesignGridLayout layout = new DesignGridLayou...
1
private boolean isTitleGood() { boolean titleGood = false; int start = -1; for (int i = 0; i < this.currentTitle.length(); i++) { if (!Trie.isASCIIAlpha(this.currentTitle.charAt(i))) { if (-1 != start) { Str...
6
public NewRDPNode(String taxaName, String scoreString) throws Exception { this.taxaName = stripQuotes( taxaName); scoreString = scoreString.trim(); if( scoreString.equals("1") || scoreString.equals("1.0")) { this.score = 100; } else if ( scoreString.equals("0")) { this.score = 0; } else ...
7
public static Color convertToEnum(String color_name) { switch(color_name.toUpperCase()) { case "YELLOW" : return Color.YELLOW; case "WHITE" : return Color.WHITE; case "BROWN" : return Color.BROWN; case "BLUE" : return Color.BLUE; case "RED" : return Color.RED; case "GREEN" ...
6
public String getAllFarmAnimals(){ Player[] p = Bukkit.getOnlinePlayers(); for(Player player : p){ if(plugin.getAnimalData().contains("Farmer." + player.getUniqueId().toString())){ String farmer = player.getUniqueId().toString(); Set<String> animals = plugin.getAnimalData().getConfigurationSection("Farm...
3
public String[] getOptions() { int i; Vector result; String[] options; File file; result = new Vector(); options = super.getOptions(); for (i = 0; i < options.length; i++) result.add(options[i]); if (getOutputClassification()) result.add("-classification"); if (getRe...
7
public int getNorth(){ return this.north; }
0
public void merge(int[] arrayA, int sizeA, int[] arrayB, int sizeB) { if (sizeB == 0) return; if (sizeA == 0) System.arraycopy(arrayB, 0, arrayA, 0, sizeB); int tailA = sizeA - 1; int tailB = sizeB - 1; int lastA = tailA + tailB + 1; while (tail...
6
public void close() { try { if (fileOutputStream != null) { fileOutputStream.close(); } if (fileInputStream != null) { fileInputStream.close(); } if (byteArrayInputStream != null) { byteArrayInputStream.c...
5
public int linearRegInterceptLookback( int optInTimePeriod ) { if( (int)optInTimePeriod == ( Integer.MIN_VALUE ) ) optInTimePeriod = 14; else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) ) return -1; return optInTimePeriod-1; }
3
public int overlapStart(Interval interval) { int i = 0; while (i < size() - 1 && !get(i).overlaps(interval)) { i++; } if (i >= size()) { return -1; } return i; }
3
private void getInfo() { infoTextArea.setText(""); infoTextArea.append(" Тип FAT: " + extractor.getTypeOfFileSystem()); infoTextArea.append("\n BS_OEMNAME: " + extractor.getBS_OEMNAme()); infoTextArea.append("\n FAT таблиц: " + extractor.getBPB_NumFATs().toString()); infoTextArea...
2
private static final boolean isDelimiter(char c) { return ((c == '[') || (c == ']') || (c == '(') || (c == ')') || (c == '<') || (c == '>') || (c == '{') || (c == '}') || (c == '/') || (c == '%')); }
9
public static ProtocolException throwInaccessibleTileException(String direction, Tile theTile){ if(theTile == null){ return new ProtocolException("Invalid move: tile " + direction + " is not accessible (outside of map)"); } else { return new ProtocolException("Invalid move: " + theTile.tileType + " t...
1
public static void fail(){ if (round < 6) { currentPlayer.setScore(MrVago.getPrizes()[0]); } if (round >= 6 && round < 11) { currentPlayer.setScore(MrVago.getPrizes()[5]); } if (round >= 11) { currentPlayer.setScore(MrVago.getPrizes()[10]); } saveCurrentPlayer(prevPlayerFile); LOGG.logInf...
4
public static File createRandomFile(File dir, String ext) { if (!dir.isDirectory()) return null; File[] files = dir.listFiles(); while (true) { String fileName = String.valueOf((int) (Math.random() * 1e10)) + '.' + ext; boolean found = false; if (files != nu...
6
public void testSubsetUnion() throws Exception { for (int i = 0; i < 100; i++) { int len = (int)(Math.random() * (10 - 1) + 1); RBtree a = randomRB( len ); RBtree b = randomRB( len ); RBtree ab = a.union( b ); if (!(a.subset( ab )) && !(b.subset( ab )) ) { throw new Exception("FAILURE A SET WAS ...
3
public StringSelection getStringSelection() { StringSelection result; int[] indices; int i; int n; StringBuffer tmp; result = null; // nothing selected? -> all if (getSelectedRow() == -1) { // re...
8
public void sortColumns() { //remove all columns first for( int i=browseTable.getColumnCount(); i > 0 ;i-- ) { browseTable.removeColumn(browseTable.getColumnModel().getColumn(i-1)); } //and now set up only the columns witch should be visible for(int j=0 ; j < isColumnShow.length; j++) { if(isColumnSh...
3
public static void sendPrivateMessageToSpies( BSPlayer sender, BSPlayer receiver, String message ) { for ( BSPlayer p : getChatSpies() ) { if ( !( p.equals( sender ) || p.equals( receiver ) ) ) { p.sendMessage( Messages.PRIVATE_MESSAGE_SPY.replace( "{sender}", sender.getName() ).repl...
3
public Document getDoc() { return doc; }
0
@Override public void documentAdded(DocumentRepositoryEvent e) {}
0
private int findSingleBranchMaxPathSum(TreeNode root) { int leftMaxPathSum=0; int rightMaxPathSum=0; if(root.left != null){ leftMaxPathSum = findSingleBranchMaxPathSum(root.left); } if(root.right != null){ rightMaxPathSum = findSingleBranchMaxPathSum(root....
7
public static void init() { if (weightList == null) { try { weightList = new ArrayList<Algorithm>(); HashMap<Integer, ArrayList<String>> listJp = CSVReaderUtils .csvToListJp(); if (listJp != null && listJp.size() > 0) { for (Entry<Integer, ArrayList<String>> entry : listJp .entrySet(...
8
public static final boolean isHTML(String fileName) { for (String file : HTML) { if (file.equals(fileName)) { return true; } } return false; }
2
public void analyzeInnerClasses(ProgressListener pl, double done, double scale) { double subScale = scale / innerComplexity; // If output should be immediate, we delay analyzation to output. // Note that this may break anonymous classes, but the user // has been warned. if ((Options.options & Options.OPTIO...
5
private static void copyfile(String srFile, String dtFile) { try { File f1 = new File(srFile); File f2 = new File(dtFile); InputStream in = new FileInputStream(f1); //For Overwrite the file. OutputStream out = new FileOutputStream(f2); by...
2
final void method3956(byte i, Class310 class310) { ((DirectxToolkit) this).anIDirect3DDevice9810.SetTexture (((DirectxToolkit) this).anInt8175, class310.method2314(17723)); if (i <= -53) { if (aClass209Array9795[((DirectxToolkit) this).anInt8175] == ((Class310) class310).aClass209_389...
7
public void copyAlphaFrom(CPColorBmp bmp, CPRect r) { r.clip(getSize()); for (int j = r.top; j < r.bottom; j++) { for (int i = r.left; i < r.right; i++) { data[j * width + i] = (data[j * width + i] & 0xffffff) | (bmp.data[j * width + i] & 0xff000000); } } }
2
public TGetResponse postRequest(String URL, String request) throws IOException { HttpPost hp = new HttpPost(URL); //StringEntity ent = new StringEntity(request, "UTF-8"); StringEntity ent = new StringEntity(request, HTTP.UTF_8); hp.setEntity(ent); hp.addHeader("Authorization",...
4
public static void main(String[] args) { long number = 600851475143L; for(int i = 2; i < Math.sqrt(number); i++) { if((number / i) * i == number) number = number / i; } System.out.println(number); }
2
@Id @Column(name = "PRP_MOA_TIPO") public String getPrpMoaTipo() { return prpMoaTipo; }
0
private void fileChoose() { JFileChooser fc = new JFileChooser(); fc.setFileSelectionMode(JFileChooser.FILES_ONLY); fc.setCurrentDirectory(new File(System.getProperty("user.dir"))); fc.setFileFilter(new FileNameExtensionFilter("20 Questions Files", "q20", "txt")); fc.setAcceptAllFileFilterUsed(false); i...
4
public MovingSquares(ArrayList<Point> ms) { movingSquares = new Vector<MovingSquare>(); for (Point point : ms) { movingSquares.add(new MovingSquare(point)); } }
1
@Override public void keyPressed(int key, char c) { if(!inputEnabled) return; ArrayList<GameKeyListener> keyListenersCopy = new ArrayList<GameKeyListener>(keyListeners); //Create a copy because scripts can register keypress components. System.out.println("Pressed key: " + key); Iterator<GameKeyListener> ...
2
public Data parse(byte[] bytes) { String input = getString(bytes).trim(); String s; if (input.length() < 1) { s = null; }else if (getSignPosition() == LEADING) { char c = input.charAt(0); s = (isPositive(c) ? "" : "-") + getNumber(c) ...
9
private void addNode(CharNode node) { int charData = 0xFFFF & node.data; if (charData > 254) { dict[dictSize++] = (byte) 255; dict[dictSize++] = (byte) ((node.data >> 8) & 0xFF); dict[dictSize++] = (byte) (node.data & 0xFF); } else { dict[dictSize+...
4
public void initTableHandlers(String decisionSettings, SymbolTableHandler symbolTableHandler) throws MaltChainedException { transitionTableHandler = new TransitionTableHandler(); tableHandlers = new HashMap<String, TableHandler>(); final String[] decisionElements = decisionSettings.split(",|#|;|\\+"); in...
8
public void update() { if (followList.size() == 0) return; // FINDING THE BOUNDING RECTANGLE { Rectangle bound = new Rectangle(Integer.MAX_VALUE, Integer.MAX_VALUE, 0, 0); // Finding the minimum position for (GameObject toFollow : followList) { if (toFollow.pos.x < bound.x) { bound.x = (int) (toFoll...
9