text
stringlengths
14
410k
label
int32
0
9
@EventHandler(priority = EventPriority.NORMAL) public void onPlayerChat(PlayerChatEvent event) { Player p = event.getPlayer(); for (String pl : this.getPlugin().list.keySet()) { //remove chat from all players applying event.getRecipients().remove(this.getPlugin().getServer()....
7
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) public void onPlayerDamageEvent (EntityDamageEvent event) { if(event.getEntity() instanceof Player) { Player p = (Player) event.getEntity(); if(playersInSM.contains(p.getName())) //check if player is in ServiceMo...
2
private String getVmRef( String vmName) throws ConnectorException{ String vmSearch = doGet(apiLink + Utils.VMS_QUERY_SUFFIX); Document doc = RestClient.stringToXmlDocument(vmSearch); NodeList list = doc.getElementsByTagName(Constants.VM_RECORD); for(int i=0; i < list.getLength(); i++){ if(list.item(i)....
2
@Test public void stessTest() { try { Server server = new Server(4445, debug); server.start(); String address = "localhost"; int number = 1000; Socket user[] = new Socket[number]; ObjectInputStream in[] = new ObjectInputStream[number]; ObjectOutputStream out[] = new ObjectOutputStrea...
9
public synchronized void handleFailure(NodeId nodeId) { if (nodeId == null) { return; } // This should never happen if(nodeId.equals(localNode.getNodeId())) { //throw new IllegalArgumentException("Can't handle a failure for local node"...
8
public void update(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); Dimension dim = getSize(); int width = dim.width; int height = d...
9
protected void init(int size) { id = new int[size]; for (int i = 0; i < size; i++) { id[i] = i; } }
1
public NFAToDFAAction(FiniteStateAutomaton automaton, Environment environment) { super("Convert to DFA", null); this.automaton = automaton; this.environment = environment; /* * putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke (KeyEvent.VK_R, * MAIN_MENU_MASK+InputEvent.SHIFT_MASK)); */ }
0
private List<Class<?>> getTypeHierarchy(Class<?> type) { if (type.isPrimitive()) { type = primitiveTypeToWrapperMap.get(type); } Set<Class<?>> typeHierarchy = new LinkedHashSet<Class<?>>(); collectTypeHierarchy(typeHierarchy, type); if (type.isArray()) { typeHierarchy.add(Object[].class); } ...
7
public static void firstPalindrome(int num) { int forward = num; int backward = num; int countf = 0; int countb = 0; while (!isPalindrome(forward) && !isPalindrome(backward)) { countf++; countb++; forward++; backward--; } if (isPalindrome(forward)) { countb++; } if (isPalindrome(backwar...
7
public void removeed(Watcher watcher) { list.remove(watcher); }
0
private static GtfsSchemaCreationImpl ommitShapeColumn(GtfsSchemaCreationImpl beforeSchema){ GtfsSchemaCreationImpl afterSchema = new GtfsSchemaCreationImpl(beforeSchema); ArrayList<Integer> afterTypes = new ArrayList<Integer>(); afterTypes.addAll(afterSchema.getTypes()); for(int i=0; i<afterTypes.size(); i+...
2
private static byte[] scanPrivateKey(CryptobyConsole console) { byte[] retKey = null; do { scanner = new Scanner(System.in); String keyText = ""; // Input Private Key for decryption System.out.println("\nEnter the private Key (Type '" + quit + "' to Escape...
7
public void updateSize() { int gw = fm.stringWidth(name); for (int i = 0; i < sizeInformation(); i++) gw = fm.stringWidth((String) (data.getValue(getCodeInformation(i), DictionnaireTable.NAME))) < gw ? gw : fm .stringWidth((String) (data.getValue(...
2
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jSplitPane1 = new javax.swing.JSplitPane(); jPanel1 = new javax.swing.JPanel(); jLabelTitre = new javax.swing.JLabel(); jLabel...
0
public MenuPrincipal() { //sérialisation lors du lancement de la frame try { FileInputStream f = new FileInputStream("sauvegarde.csv"); ObjectInputStream s = new ObjectInputStream(f); MainProjet.lesEntreprises = (ArrayList<Entreprise>) s.readOb...
2
public Pesquisador() { File f = new File(Arquivo.ARQ_ARVOREB); if(!f.exists()){ arvoreB = new ArvoreB<String, ArrayList<String>>(); TrataArquivo arqLivro = new TrataArquivo(Arquivo.ARQ_LIVRO, Arquivo.LIVRO); ArrayList livros = arqLivro.leArquivo(); ComparadorLivro comparador = new ComparadorLivr...
4
private void btn_GuardarPreguntasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_GuardarPreguntasActionPerformed btn_guardarOpcion.setEnabled(true); if(txt_DescripcionPregunta.equals("")){ JOptionPane.showMessageDialog(null, "Debe ingresar una descripción"); ...
9
static final int method244(int i) { anInt8622++; if ((double) Class75.aFloat1249 == 3.0) return 37; if (i != 37) return 11; if ((double) Class75.aFloat1249 == 4.0) return 50; if ((double) Class75.aFloat1249 == 6.0) return 75; if ((double) Class75.aFloat1249 == 8.0) return 100; return 200...
5
public void setSeatsInRow(int rowNumber, int numOfSeatsInRow){ if (numOfSeatsInRow <= MAX_SEATS_PER_ROW) { ArrayList<Seat> tmpList = new ArrayList<>(); for (int i = 0; i < numOfSeatsInRow; i++) { Seat tmp = new Seat(rowNumber + ":" + i); tmpList.add(tmp); ...
2
private void invokePopupMenu(int x, int y) { selectedAnnotationHostAtom = getAnnotationHost(Attachment.ATOM_HOST, x, y); selectedAnnotationHostBond = getAnnotationHost(Attachment.BOND_HOST, x, y); if (selectedAnnotationHostAtom < 0 && selectedAnnotationHostBond < 0) { selectedAtom = findNearestAtomIndex(x, y);...
7
public static int addConnectionThread(Thread con) { boolean added = false; int num = 0; for(int k = 0;k<=5;k++) { if(MainThread.uploadConnectionThreads[k] == null && added == false) { MainThread.uploadConnectionThreads[k] = con; added = true; } } if(added = false) { return 99; ...
4
private boolean isLabelIncluded( final String sampleLabel ) { // check if label is included boolean included = true; if( includedRegEx != null && ! includedRegEx.isEmpty() ) { included = false; for( Pattern regEx : includedRegEx ) { if( regEx.matcher( sampleLabel ).matches() ) { ...
9
public static Interval negExpr(Interval i1) { /* -[a,b] = [-b, -a] */ if (i1 != null && i1.isBottom()) return Interval.BOTTOM; if (i1 == null) return new Interval(NEGATIVE_INF, POSITIVE_INF); long lower = -i1.getUpperBound(); long upper = -i1.getLowerBound(); if (i1.getUpperBound() == POSITIVE_INF) lower =...
7
public String toString() { StringBuffer sb = new StringBuffer(super.toString()); sb.append(" : tokens("); sb.append(tokens); sb.append(") at "); sb.append(center); sb.append(" with "); sb.append(Arrays.asList(results)); return sb.toString(); }
0
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; SearchGenre other = (SearchGenre) obj; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) ...
6
public ArrayList<String> createUsernameArrayList() { ArrayList<String> usernames = new ArrayList<String>(); ResultSet rs = null; PreparedStatement statement = null; try { statement = conn.prepareStatement("select Username from Accounts"); rs = statement.executeQuery(); while (rs.next()) { user...
6
public double readDouble() throws IOException { mark(DEFAULT_READ_LIMIT); int cfaslOpcode = read(); switch (cfaslOpcode) { case CFASL_P_FLOAT: return readFloatBody(false); case CFASL_N_FLOAT: return readFloatBody(true); default: reset(); throw new ...
2
void extractPages(Page page) { if (cancelled) return; // Unterseiten hinzufügen (sofern welche vorhanden sein könnten) if (page.containsPages()) { for (PageExtractor pe : Extractors.getInstance().getPageExtractors()) { if (!pe.isSelected() || !pe.isApplicable(page)) ...
7
@Override public void bind(float dt) { if (mIsPaused || mCurrentFrame == mStopAt) { mFrames[mCurrentFrame].bind(dt); return; } mCurrentTime += dt; while (mCurrentTime >= mFrameSwapTimes[mCurrentFrame]) { mCurrentTime -= mFrameSwapTimes[mCurrentFra...
7
@Override public void update(News news) { System.out.println(name + ", was informed about - News(" + news.getHeading() + ")"); }
0
@Test public void singleInsertSizeAndContent() { a.insert(v); assertEquals(v, a.get(0)); assertEquals(1, a.getSize()); }
0
public float getMaxGain() { float gainMax = -9999.0f; if (audioDevice instanceof JavaSoundAudioDevice) { JavaSoundAudioDevice jsAudio = (JavaSoundAudioDevice) audioDevice; gainMax = jsAudio.getMaxGain(); } return gainMax; }
1
public Card disproveSuggestion(String person, String room, String weapon) { ArrayList<Card> solutions = new ArrayList<Card>(); // If player has one or more of the cards, return one of the ones they have randomly for( Card card : cards ) { if( card.getName().equalsIgnoreCase(person) && card.getType() == Card....
8
private Object getAndTick(Keep keep, BitReader bitreader) throws JSONException { try { int width = keep.bitsize(); int integer = bitreader.read(width); Object value = keep.value(integer); if (JSONzip.probe) { JSONzip.log("\"" + value + ...
3
private void execute() { if(sourceFile == null) { printError("-i : No source file specified"); } if(assembler == null || computer == null) { printError("-f : No format specified"); } if(assembler.hasErrors()) { printError("Una...
5
private void handleCancelReservation(Sim_event ev) { int src = -1; // sender id boolean success = false; int tag = -1; try { // id[0] = gridletID, [1] = reservID, [2] = transID, [3] = sender ID int[] obj = ( int[] ) ev.get_data(); // ge...
9
@Override public boolean setFromString(String value) { this.clear(); String[] values=value.split("\\x00"); for(String v : values) { // handle id3v2.2/2.3 genre lists "(xx)(xx)text" if(v.matches("\\(\\d{1,3}\\).*")) { int endParen=v.indexOf(")"); if(!addNumericId(v.substring(1,endParen))) { // ...
6
public int getNumberLocY(int number) { for (int y = 0; y < map.length; y++) { for (int x = 0; x < map[0].length; x++) { if (map[y][x] == number) return y; } } Logger.log("Can't find number " + number + " in map", Logger.ERROR); Game.exit(1); return -1; }
3
public void RetrieveSalt(RequestPacket request, DBCollection coll, User user) { try { // Use cursor to find query -> password DBCursor cursor = coll.find(new BasicDBObject("user_name", request.getUser_name())); if(cursor.hasNext()) { String stored_salt = cursor.next().get("salt").toString(); user...
2
private void parseAdobeDate(String date) { // total offset count int totalOffset = 0; int currentOffset = 0; // start peeling of values from string if (totalOffset + OFFSET_YYYY <= date.length()) { currentOffset = (totalOffset + OFFSET_YYYY); year = date...
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; WhileStatementNode other = (WhileStatementNode) obj; if (exp1 == null) { if (other.exp1 != null) return false; } else if (!exp1.equals(o...
9
public void addEdge(Value v1, Value v2) { HashSet<Value> v1Edges = adjacencyList.get(v1); HashSet<Value> v2Edges = adjacencyList.get(v2); if(v1Edges == null) { v1Edges = new HashSet<Value>(); adjacencyList.put(v1, v1Edges); } if(v2Edges == null) { ...
2
public static void flush() { clearBuffer(); try { out.flush(); } catch (IOException e) { e.printStackTrace(); } }
1
public Object getValueAt(int row, int column) { return ((Object[]) data.get(row))[column]; }
0
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof Component)) return false; Component other = (Component) obj; return id == other.id && title.equals(other.title) && producer.equals(other.producer) && description.eq...
6
public String getName(ConnectionWrapper cw, Integer number) throws SQLException { if(number == null) { return null; } String res = numberToName.get(number); if (res == null) { // a new name has popped up in the database, load it loadData(cw); res = numberToName.get(number); } return res; }
2
@Override public void render() { textPath = (SVGOMTextPathElement) text.getElementsByTagName("textPath").item(0); if(isMarked()){ textPath.setAttribute("style", "fill:red"); } else { textPath.setAttribute("style", ""); } textPath.setAttribute("startOffset", percentage+"%"); Node pathClone = textPath....
1
public String ElectionSetTurnHolder(int newTurnHolder) { synchronized (peer) { assert peer.isReady(); if (peer.getTurnHolder().getOrd() != newTurnHolder) { System.out.println("Stavo ancora aspettando un word ack, ma è cambiato il turno. Faccio come se l'avessi ricevuto, cancello lastWordTask."); if (pe...
4
@Override public JSONObject main(Map<String, String> params, Session session) throws Exception { String username = params.get("username"); String passwordClear = params.get("password"); User u = User.findOne("username", username); JSONObject rtn = new JSONObject(); if(u == null) { rtn.put("rtnCode", t...
2
public static void demo_BFS() { System.out.println("------------------ Breadth First Search ------------------"); String[] search_types = { "array-locked", "lock-free" }; int max_threads = 7; int max_reps = 1; int n_graphs_to_evaluate = 1; String[] paths = { "src/data/soc-pokec-relationships.txt" }; boole...
9
public CreateAndSendInvoiceResponse(Map<String, String> map, String prefix) { if( map.containsKey(prefix + "responseEnvelope" + ".timestamp") ) { String newPrefix = prefix + "responseEnvelope" + '.'; this.responseEnvelope = new ResponseEnvelope(map, newPrefix); } if( map.containsKey(prefix + "invoiceID") ...
6
public void visiteurQuitter() { this.getCtrlPrincipal().action(EnumAction.VISITEUR_QUITTER); }
0
public boolean isMatchGreedy(String s, String p) { int n = s.length(); int m = p.length(); int i = 0; int j = 0; int star = -1; int sp = 0; while (i < n) { //one * and multiple *, same effect while (j <...
9
public void setIsFaceUp(boolean faceUp) { this.isFaceUp = faceUp; }
0
protected boolean simpleEval(Environmental scripted, String arg1, String arg2, String cmp, String cmdName) { final long val1=CMath.s_long(arg1.trim()); final long val2=CMath.s_long(arg2.trim()); final Integer SIGN=signH.get(cmp); if(SIGN==null) { logError(scripted,cmdName,"Syntax",val1+" "+cmp+" "+val2); ...
9
protected void copySelectedComponent() { if (selectedComponent instanceof ImageComponent) { try { pasteBuffer = new ImageComponent(((ImageComponent) selectedComponent).toString()); } catch (Exception e) { // ignore } } else if (selectedComponent instanceof TextBoxComponent) { pasteBuffer = new T...
7
private void play() { game.updateP1(getPlayerStats(p1) + getPlayerSkills(p1)); game.updateP2(getPlayerStats(p2) + getPlayerSkills(p2)); while (p1.isAlive() && p2.isAlive()) { if (!states.isWaiting()) { game.updateP1(getPlayerStats(p1) + getPlayerSkills(p1)); game.updateP2(getPlayerStats(p...
7
public void run() { for (The5zigModUser user : The5zigMod.getApi().getOnlineModUsers()) { Iterator<The5zigModTimer> it = user.getTimers().iterator(); while (it.hasNext()) { The5zigModTimer timer = it.next(); if (timer.isOver()) it.remove(); } } }
3
public void addCacheListenerImpl(CacheListener listener) { List keys = listener.getInterestedFields(); Iterator i = keys.iterator(); while (i.hasNext()) { String key = (String) i.next(); // Peer.column names are the fields if (validFields != null && validFields.containsKey(key)) { ...
8
private void parseVariables() { int previousSize = 0; Map<String, String> unresolved = new HashMap<>(); for (Entry<String, String> entry : configuration.entrySet()) if (isSubstitution(entry.getValue())) unresolved.put(entry.getKey(), getSubstitution(entry.getValue())); while (previousSize != unresolved.s...
7
public Transition copy(State from, State to) { return new FSATransition(from, to, myLabel); }
0
private void processCall(final Call call, final int count) { println();println();println(); String callName = "| Starting call '" + call.getName() + "' |"; println(pad('-', callName.length())); println(callName); println(pad('-', callName.length())); HttpURLConnection connection = null; final CallReport...
4
public int distanceBetweenFile(Field otherField) { return otherField.file - this.file; }
0
public void actionPerformed(ActionEvent event) { String str; int n; while (true){ // str = JOptionPane.showInputDialog(null, "Please type the number of Undos:", "How many undo?", ""+Universe.curProfile.undo_num, JOptionPane.PLAIN_MESSAGE); str = JOptionPane.showInputDialog("Pl...
3
public void mouseReleased(MouseEvent e){ mouse = false; }
0
public String getParkAddress() { return parkAddress; }
0
public void setCustomTablist(Player player, List<String> slots) { if (!this.playerCustomTablists.containsKey(player)) { List<String> tablist = new ArrayList<String>(); for (String string : slots) { tablist.add(string); } for (int i = 0; i < tablist.size(); i++) { String slot = tabl...
8
public static int findPossibleDecoding(String s) { if(s.length()==0 || s.length() ==1) { return 1; } int count = 0; //very smart approach .. 0 at any digit will not increase a count.. it will be the part of earlier count if(s.charAt(s.length()-1) >'0') { co...
6
public LivingParticipantBox getParticipantAt(StringBounder stringBounder, NotePosition position) { final int direction = getDirection(stringBounder); if (direction == 1 && position == NotePosition.RIGHT) { return p2; } if (direction == 1 && position == NotePosition.LEFT) { return p1; } if (direction =...
8
private Object[] getTokens(Object context) { if ((this.contextClass != null) && (this.contextClass.isInstance(context))) { try { int numChildren = ((Integer)this.contextClass.getMethod("getChildCount", new Class[0]).invoke(context, new Object[0])).intValue(); Object[] children = new Object[num...
5
@Override public boolean mover(int xIn, int yIn, int xFin, int yFin) { if ((xIn == xFin) && ((yFin == yIn +1)||(yFin == yIn-1))) return true; if (((yIn == 1) || (yIn == 6)) && ((yFin == yIn+2)||yFin == yIn-2)) return true; return false; }
7
private static void Fileout(ArrayList<classifiedData> Data, String FileOutLoc){ PrintWriter writer = null; int CEDDSize = 144; int FCTHSize = 192; //write to the data file try { writer = new PrintWriter(FileOutLoc, "UTF-8"); } catch (FileNotFoundException e) { System.err.println("Could not open dat...
5
public ExternalUser getExternalUserByEmailAndMeetingID(int meetingID, String email){ for(ExternalUser externalUser : externalUsers){ if(meetingID == externalUser.getMeetingID() && email.equals(externalUser.getEmail())) return externalUser; } return null; }
3
public void asignarRespuestas(String respuesta, int numeroRespuesta){ switch(numeroRespuesta){ case 0: _jtf1.setText(respuesta); break; case 1: _jtf2.setText(respuesta); break; case 2: _jtf3.setText(respuesta); break; ...
5
public ResultSet getResult(String sql){ try{ // Execute SQL query result = statement.executeQuery(sql); }catch(SQLException se){ //Handle errors for JDBC se.printStackTrace(); } return result; }
1
public void validate(Map<String, ValidationRule> refRules, Map<String, Atdl4jWidget<?>> targets) throws ValidationException { // get the widget from context using field name Atdl4jWidget<?> target = targets.get( field ); if ( target == null ) { // -- Handle "FIX_fieldname" of "NX" -- if ( ( field != ...
7
public LinkedList<Light> getCurrentLights(Vector2 pos) { int i = 0; for (GroupedRooms room : rooms) { for (Room r : room.getRooms()) { if (r.contains(pos.X, pos.Y)) return rooms.get(i).getLights(); } i++; } return null; }
3
private void setState(String name) throws NullPointerException { if (possibleStates.containsKey(name)) { currentState = possibleStates.get(name); } else { throw new NullPointerException(Helpers.concat("Name ", name, " not found within states for the state manager ", getName())); } }
1
@EventHandler public void SilverfishResistance(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.getSilverfishConfig().getDouble("Sil...
6
static ArrayList<Artist>[] kmeans(Artist[] artists,double[][] dist,int k){ int N=dist.length; int[] centerPoints=new int[k]; ArrayList<Integer>[] clusters=new ArrayList[k]; for(int i=0;i<k;i++){ clusters[i]=new ArrayList<Integer>(); clusters[i].add(i); } for(int j=0;j<20;j++){ // We compute the ce...
8
public void setPrpCcResponsable(Integer prpCcResponsable) { this.prpCcResponsable = prpCcResponsable; }
0
private void readFields(final DataInputStream in) throws IOException { final int numFields = in.readUnsignedShort(); fields = new Field[numFields]; for (int i = 0; i < numFields; i++) { fields[i] = new Field(in, this); } }
1
private static String getWebSite(){ HttpClient httpClient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://itunes.apple.com/en/rss/customerreviews/id=565993818/page=1/xml"); System.out.println("executing request "+httppost.getURI()); ResponseHandler<String> responseHandler = new ResponseHand...
5
private ArrayList<Integer> findWinner() throws Exception { PowerRanking powerRanking = new PowerRanking(); ArrayList<CardPower> cardPowers = new ArrayList<CardPower>(); for (int i = 0; i < playerList.size(); i++) { if (!playerList.get(i).hasFolded()) { ArrayList<Card> playersHoleAndSharedCards = new ArrayL...
4
@Override public void execute(Runnable command) { //command.run(); new Thread(command).start(); }
0
public void setPath(Vertex path) { this.path = path; }
0
public synchronized void renderMap(int xScroll, int yScroll, Screen screen) { screen.setOffset(xScroll, yScroll); int x0 = xScroll >> 4; int x1 = (xScroll + screen.width + 16) >> 4; int y0 = yScroll >> 4; int y1 = (yScroll + screen.height + 16) >> 4; for (int y = y0; y < y1; y++) { for (int x = x0; x < x1; ...
7
public void dumpRegion(String line) { String parens = "{\010{}\010}<\010<>\010>[\010[]\010]`\010`'\010'" .substring(options * 6, options * 6 + 6); pw.print(parens.substring(0, 3)); Enumeration enum_ = childBPs.elements(); int cur = startPos; BreakPoint child = (BreakPoint) enum_.nextElement(); if...
3
static void solve( ){ // print(); for(int i = 0 ; i < clave.length; i++ ){ if(clave[i]==hint[i]){ strong++; usados[i]=true; isMatched[i]=true; } } for(int i = 0 ; i < clave.length; i++ ){ boolean found = false; if( !isMatched[i] ) for (int j = 0; j < hint.length && !found; j++) { ...
8
private void setRootID(PhraseStructure phraseStructure) throws MaltChainedException { useVROOT = false; PhraseStructureNode root = phraseStructure.getPhraseStructureRoot(); for (ColumnDescription column : dataFormatInstance.getPhraseStructureNodeLabelColumnDescriptionSet()) { if (root.hasLabel(column.getSymbol...
7
public static ArrayList<Object> selectSortArrayList(double[] aa){ int index = 0; int lastIndex = -1; int n = aa.length; double holdb = 0.0D; int holdi = 0; double[] bb = new double[n]; int[] indices = new int[n]; for(int i=0...
4
private boolean branch_format() { int rs, rt; try { rs = register_file.get_register(inst.get_rs()); rt = register_file.get_register(inst.get_rt()); register_file.validate_index(inst.get_rd()); } catch (RegisterOutOfBoundsException e) { e.printStackTrace(); return false; } switch (inst....
5
public void drawMaze(Graphics g) { g.setColor(Color.white); for (Edge edge : this.maze.mst) { Point p = this.drawMazeHelper(edge.to, edge.from); g.fillRect(p.x, p.y, this.cellWidth - 1, this.cellWidth - 1); } }
1
private static final void handleDataDoubleEscapeTag(Tokeniser t, CharacterReader r, TokeniserState primary, TokeniserState fallback) { if (r.matchesLetter()) { String name = r.consumeLetterSequence(); t.dataBuffer.append(name.toLowerCase()); t.emit(name); return; ...
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; School other = (School) obj; if (id != other.id) return false; return true; }
4
private BigDecimal getOperand(CalculatorReader expressionReader) { DecimalFormatSymbols decimalFormatSymbols = new DecimalFormatSymbols(); decimalFormatSymbols.setDecimalSeparator('.'); NumberFormat NUMBER_FORMAT = new DecimalFormat("0,0", decimalFormatSymbols); ParsePosition position = ...
1
private void deleteFile(String path) { File file = new File(path); if(file.exists()) { String folder = file.getParent(); if(folder.equals("temp")) { file.delete(); } } }
2
private int getArrayIndexOfFirstBall(int frameNumber) { int currentFrame = 1; int currentRollCount = rollCount; if (frameNumber > getCurrentFrame()) { return ++currentRollCount; } for (int i = 0; i < rollCount; i++) { if (currentFrame == frameNumber) { return i; } int pinsKnockedDow...
6
private void analyseDataFirstPass(String assemblyLine) throws AssemblerException { boolean legitIntDataLine = Pattern.matches( "[A-Za-z0-9]+\\s+[0-9]+MAU\\s+[^\\s]+", assemblyLine); boolean legitAsciiDataLine = Pattern.matches( "[A-Za-z0-9]+\\s+.ascii\\s+\".+\"", assemblyLine); boolean legitUninitializ...
9