method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
c28fbda4-07cc-4eb9-a9e9-cb4707d744cb
4
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { JCheckBox checkbox = (JCheckBox) value; checkbox.setBackground(isSelected ? getSelectionBackground() : getBackground()); chec...
766eff22-3b70-433d-81cc-960f8990b4fc
8
@Override public void deserialize(Buffer buf) { modelId = buf.readInt(); if (modelId < 0) throw new RuntimeException("Forbidden value on modelId = " + modelId + ", it doesn't respect the following condition : modelId < 0"); ownerName = buf.readString(); ownerConnected = b...
080d7d6c-e4ec-4e5f-aea5-a977c56e0b92
3
public void faillite(){ for(Compagnie c : this.compagnies){ c.setProprietaire(null); } for(Gare g : this.gares){ g.setProprietaire(null); } for(ProprieteAConstruire p : this.proprietesAConstruire){ p.setProprietaire(null); } this.getMonopol...
ca01a345-fa96-4669-b105-38a5590be103
5
protected TrieEntry<K,V> lowerEntry(K key) { // Basically: // Follow the steps of adding an entry, but instead... // // - If we ever encounter a situation where we found an equal // key, we return it's previousEntry immediately. // // - If we hit root (empty or ...
c2655674-33c3-43ec-b4d2-87599841ad85
7
private void selectLeftToRight(LineText pageLine, AffineTransform pageTransform) { GlyphText fistGlyph = null; Rectangle2D pageRectToDraw = convertRectangleToPageSpace(rectToDraw, pageTransform); ArrayList<WordText> lineWords = pageLine.getWords...
7c0bf277-cd0c-4206-b55f-584bde94571c
7
protected LoginResult loginPassStart(final LoginSessionImpl loginObj, final Session session) { if(loginObj.player==null) { if(CMProps.isUsingAccountSystem()) { if(newAccountsAllowed(loginObj.login,session,loginObj.acct)) { session.promptPrint(L("\n\r'@x1' does not exist.\n\rIs this a new account...
ccd87117-7513-4674-a6c8-4aa0f1c6d8de
5
private HaploStruct fillGamete(HaploStruct pattern) throws Exception { HaploStruct gamete; if (pattern.segmentCount()==1) { gamete = (HaploStruct) haplostruct[pattern.getFounder().get(0)].clone(); } else { gamete = new HaploStruct(getChrom(),pattern.getFounder().g...
5e2c2bee-a889-4ca4-baff-09a5cc687497
7
public void loadRoomCards(String legend){ // reads rooms and adds to cards cards = new HashMap <String, Card>(); try{ FileReader legendReader = new FileReader(legend); Scanner legendIn = new Scanner(legendReader); int lineNumber = 0; while (legendIn.hasNextLine()) { lineNumber = lineNumber + 1; ...
9e8d2f21-d89c-471e-8561-2052d5a3f45c
1
public void playerDeath(Player player) { livingplayers.remove(player); if (livingplayers.size() == 0) endGame(EndReason.END_REASON_NOPLAYER); }
34a209ed-7718-4207-9347-874a82c945c7
7
public static String contentToString(String s) { if (s == null) { return ""; } StringBuffer result = new StringBuffer( s.length() ); for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); switch (c) { case '<': resul...
13a51232-e35c-4fb5-bbbd-d7da553ef23b
9
private boolean jj_scan_token(int kind) { if (jj_scanpos == jj_lastpos) { jj_la--; if (jj_scanpos.next == null) { jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); } else { jj_lastpos = jj_scanpos = jj_scanpos.next; } } else { jj_scanpos = jj_...
dc2de5c9-49dd-448c-9b6a-ee59197f2fc5
3
@Test public void test_solvable_matrix_size_2_solve() throws ImpossibleSolutionException,UnsquaredMatrixException, ElementOutOfRangeException{ int height=2; int width=2; float[] result; try{ test_matrix = new Determinant(height,width); ...
47890103-bc53-4e97-9273-dc6446f86d2b
1
public boolean matches( Class<?> clazz ) { return Modifier.isStatic( clazz.getModifiers() ); }
b52a42d6-ec9a-41ae-9a22-6f781f80d6ff
6
@Override public void fill() { nb_neurons = rowNumber * colNumber; for(int k=0;k<rowNumber;k++) { neurons.add(new ArrayList<Neuron>()); for(int k1=0;k1<colNumber;k1++){ neurons.get(k).add(new Neuron(2, k, neurons.get(k).size(), getAleatory())); } } // We create the topology ...
a80b0ec2-a21f-476f-943a-b62cc87dd8bc
3
public boolean estadoSeriales(entidadPrestamo datosPrestmo) { conectarse(); boolean retornarObj = false; String devo_estado = "update tbl_seriales set Estado = ? where Seriales = ?"; ResultSet seriales_devo = consultarSeriales(datosPrestmo); String estado = datosPrestmo.getEsta...
e188b1f6-3882-4d70-9d07-9358f8457c15
9
@Override protected void paintComponent(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.setBackground(this.getBackground()); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); int radius = (int) Math.round(getWidth() * 10 / 100.); boolean dark = (getBackground()...
dac72b9d-3f2c-4548-bc88-feb41120fa96
6
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...
c29f25e0-3121-4c81-984b-885b1de9e43a
8
public void textProcess( List<String> textList ) { for ( String textLine:textList ) { this.textList.add(textLine); } Headers = textList.remove(0).split(","); for ( int i = 0; i < Headers.length-1; i ++ ) { Attribute objAttr = new Attribute(); objAttr.AttributeName = Headers[i]; objAttributeList.add(...
fe90b51f-34de-41ec-9f14-cdae00d524c9
6
public void analyzeSuperClasses(ClassInfo superclass) { while (superclass != null) { ClassIdentifier superident = Main.getClassBundle() .getClassIdentifier(superclass.getName()); if (superident != null) { superident.addSubClass(this); } else { // all virtual methods in superclass are reachable ...
2f9d509c-ebaa-4d9e-8f3a-fea2213c50d4
5
public boolean parseCommandLineArg( String arg, Iterator<String> moreArgs ) { final String name; final int colonIdx = arg.indexOf(':'); if( colonIdx != -1 ) { name = arg.substring(colonIdx+1); arg = arg.substring(0, colonIdx); } else { name = null; } if( "-repo".equals(arg) ) { primaryRepo = new...
64340123-91dc-40d2-b6be-cb58b35513df
7
public CommandExecutionResult execute(List<String> lines) { final Context context = new Context(); final Matcher mStart = getStartingPattern().matcher(lines.get(0).trim()); if (mStart.find() == false) { throw new IllegalStateException(); } if (mStart.group(1) != null) { context.push(mStart.group(1)); ...
9b29080b-ae1a-4f8d-bd3d-0c729027a965
9
@Override public void iterate() { try { if (isAllyControlled()) { targets = renderer.getEnemyShips(); } else { targets = renderer.getAllyShips(); } } catch (NullPointerException ex) { this.setRemovable(); } ...
63182fbf-861a-4a72-840d-7380226842ac
2
@Override public String toString() { String name = getName(); String append = ""; if(name != null && !name.equals("")) { append = "(\"" + this.getName() + "\")"; } return "TAG_Short" + append + ": " + value; }
f489a03a-4f1b-4de6-a4c2-db92caa72d96
3
public void calculcate() { Rectangle r = this.getBounds(); float width = (float) r.getWidth(); float height = (float) r.getHeight(); // System.out.println("Width : " + width + " Height : " + height); float xScale = width / (bX + sX); float yScale = height / (bY + sY); scale = 0.0F; if (xScale > y...
cc1f147c-b60d-4c71-a109-c0e1fc7d5eef
3
@Override public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); switch (cmd) { case CMD_ADD_ACTION: User curUser = logicSystem.getCurrentUser(); String accountName = accountNameField.getText(); Double balance = new...
bfed1f6a-2514-4d31-800d-fd45fa25a0c3
0
@Override public void mouseClicked(MouseEvent e) { }
00f0542e-0929-4e16-8a0f-9472046f4699
2
public Time getTime(String key) { byte[] dba = null; Time t = new Time(); try { dba = Utils.object2Bytes(new Time(0, 0, 0)); t = (Time) Utils.bytes2Object(prefs.getByteArray(key, dba)); } catch (IOException ex) { Logger.getLogger(Ti...
bc84cbb0-f836-4a38-8a1f-1525579a339f
9
@Override public void actionPerformed(ActionEvent e) { // causes the screen to be redrawn this.repaint(); if (e.getSource() == meteorTimer) { spawnMeteor(); spawnDestroyer(); meteorTimer.restart(); } if (e.getSource() == spaceMoveTimer) { Iterator<Enemy> iterator = enemyList.iterator(); while...
db892f9d-5baf-45bb-aada-c43c8823f0d3
5
public void flush() throws IOException { for (MappedFileChannel mfc : mfChannels) { try { mfc.flush(); } catch (IOException ignored) { } } for (Field f : getClass().getDeclaredFields()) { if (!FieldModel.class.isAssignableFrom(f.getType())) continue; f.setAccessible(tru...
19cd9970-aebd-4766-a1f2-e7d59a7e8ee7
3
public static void main(String[] args) { String name = "ch16.ex16_11.BoldPlayer";//class name Game game = new Game(); for(int i = 0; i < 7; i++){ try{ PlayerLoader loader = new PlayerLoader(); Class<? extends Player> classOf = loader.loadClass(name).asSubclass(Player.class); Player player = clas...
91126dac-c99a-43f3-86cf-d48e0ff27831
2
@Override public Float validate(String fieldName, String value) throws ValidationException { if (value == null) { return null; } try { return Float.parseFloat(value); } catch (NumberFormatException e) { throw new ValidationException(fieldName, value, "not a valid float", e); } ...
59ec89cf-bc33-4ce6-af08-a44665f23656
2
@Override public void update(PositionChangedObservable observable) { if(observable != this && observable.getPositions().contains(position)) observable.accept(new CollideWithPlayerVisitor(this)); }
36efc1fa-c995-4072-9a8c-34687d8e0370
7
public static Vector<String> parsePipes(String s, boolean ignoreNulls) { final Vector<String> V = new Vector<String>(); if ((s == null) || (s.length() == 0)) return V; int x = s.indexOf('|'); while (x >= 0) { final String s2 = s.substring(0, x).trim(); s = s.substring(x + 1).trim(); if ((!ignoreN...
a2bc9dd2-15f1-4c5c-a3e8-b423dd946e14
0
public static String uuidBaseRandom() { return UUID.randomUUID().toString(); }
6a22d20c-f853-4507-a213-0a4f9e5d23c6
4
public void asetaKuva(String vaihe) { if (noppa == 1){ ImageIcon tyhjaikoni = new ImageIcon(new ImageIcon(getClass().getResource("/tyhja.jpg")).getImage()); setIcon(tyhjaikoni); } else if (vaihe.equals("Vihollisnopat")) { asetaVKuva(); } else if (vaihe.equals(...
98945293-5d97-4abc-bbae-ed2698befbd8
8
@Override public void endElement(String uri, String localName, String qName) throws SAXException { if (qName.equals("currentTQTime")) response.setCurrentTQTime(getDate()); else if (qName.equals("trainingEndTime")) response.setTrainingEndTime(getDate()); else if (qName.equals("trainingStartTime")) respon...
79f4022e-e568-4a4f-b6f5-5d393e6f61a8
1
public void setUnsafeButtonGap(int unsafeGap) { if (this.unsafeButtonGap == unsafeGap) { return; } this.unsafeButtonGap = unsafeGap; installGUI(); }
1f0b9b52-7897-4169-b223-4309ce8107bd
6
public static void htmlWriteUrl(org.powerloom.PrintableStringWriter stream, String action, StandardObject renamed_Object) { { String objecttype = null; { Surrogate testValue000 = Stella_Object.safePrimaryType(renamed_Object); if (Surrogate.subtypeOfP(testValue000, OntosaurusUtil.SGT_LOGIC_LOGIC_OBJE...
aa78d18f-5105-4b85-8463-dabbfd66c53e
2
private void removeSpaces() { while (handler.hasChars() && dfa.isInSpaceState()) processNextChar(); }
05d3d842-46f1-458f-977e-5034d3f23bdb
6
public String getHtmlSource(URL url){ String htmlSource = null; try { StringBuilder builder = new StringBuilder(); connection = (HttpURLConnection) url.openConnection(); connection.addRequestProperty("User-Agent", userAgent); connection.addRequestProperty("encoding", charset); connection.setConnectT...
2f6a3cca-60aa-408f-941c-eb9ba93b58ca
2
private void closeSession() { if (session != null && session.isOpen()) session.close(); }
226dbf71-8c9e-4736-9d37-ebdae6594fc0
9
public void updateMaxes() { try{ String maxTweetQuery = "select max(retweetCount) from tweets"; String maxUserQuery = "select max(accountAge),max(favorites),max(friends),max(statusCount),max(followers) from users"; Statement maxTweetStmt = con.createStatement(); Statement maxUserStmt = con.createStatement();...
a19ed896-cdad-43ea-9791-eb4a19f6e62f
7
public ArrayList<Vertex> maxFlowMinCut() { Edge[] path = findPath(source, target); this.maxFlow = 0; while (path != null && path[0].getTarget().equals(target)) { // find the minimum edge weight float weight = Float.MAX_VALUE; for (int i = 0; i < path.length; ...
63f6281a-92f8-416a-9909-bab272e3df54
8
public void write(JsonWriter out, Map<K, V> map) throws IOException { if (map == null) { out.nullValue(); return; } if (!complexMapKeySerialization) { out.beginObject(); for (Map.Entry<K, V> entry : map.entrySet()) { out.name(String.valueOf(entry.getKey())); ...
2935c501-fdb2-4faa-b62b-4f4529f5fa3e
9
private int jjMoveStringLiteralDfa0_3() { switch(curChar) { case 40: return jjStopAtPos(0, 13); case 41: return jjStopAtPos(0, 14); case 42: return jjStartNfaWithStates_3(0, 16, 36); case 43: return jjStopAtPos(0, 11); case 45: return jjSt...
4a5b9aa0-2ee5-42ca-8355-004fe34514cb
8
@Override public void start() { type = (Integer) parameters[0]; npcId = (Integer) parameters[1]; fightKiln = (FightKiln) parameters[2]; if(type == 0) sendNPCDialogue(npcId, 9827, "Let us talk..." ); else if (type == 1) sendNPCDialogue(npcId, 9827, "So...you accept our challenge. Let our sport be glori...
d10abd1e-172d-4baf-9973-8cc5b572bbe2
4
public static Measurement newMeasurementDialog() { JTextField measurementWeight = new JTextField(12); JTextField measurementDate = new JTextField(12); SimpleDateFormat formatter = new SimpleDateFormat("dd.MM.yyyy"); JPanel measurementWeightPanel = new JPanel(); measurementWeightPanel.add(new JLabel("Gewicht...
89662c01-bedd-4672-aeec-47c7cd9f3708
6
@SuppressWarnings("unused") public void put(long key, long value) { // Get reference to 'values' int bucketNumber = getBucketNumber(key); if( bucketNumber == 0 ) { // Not found? bucketNumber = bucketsUsed++; hash.put(key, bucketNumber); // No more buckets available? => Resize if( bucketsUsed > buck...
ecfd401d-9ac0-4705-91ad-7d5453ca92d5
8
private int readBytesFormBuffer(byte[] buffer, int start, int bytesToRead) throws IOException { int sample = 0; int bytesRead = 0; while(bytesRead < bytesToRead) { //read left channel sample = readSample(); if(reduceChannels) { //there are two channe...
5e5991ae-c7fd-4df4-87ad-50f20567fea3
0
public static ArrayList<Excel> rotateY(int angle, ArrayList<Excel> toScale) { return Rotate.rotateY(angle, toScale); }
34a68ea0-e9d8-4c2c-8b54-7f9863e70009
5
public final void mInt() throws RecognitionException { try { int _type = Int; int _channel = DEFAULT_TOKEN_CHANNEL; // SQL.g:172:2: ( ( '0' .. '9' )+ ) // SQL.g:172:4: ( '0' .. '9' )+ { // SQL.g:172:4: ( '0' .. '9' )+ int cnt8=0...
92a17091-0876-4b9d-98fc-386e9cf6b373
0
private QuestionManager() { }
8ab2bd71-0765-406d-892f-fb0bc6f86c55
5
public static String stripTrailing(final String string, final char ch) { //// Preconditons if (string == null) throw new InvalidParameterException("string cannot be null"); int index = string.length(); if (index == 0) return string; while (true) { if (index == 0) break...
98b47d83-de4f-4795-a5d1-f0b24ba9fcc8
9
public ArrayList<NetworkMessage> receiveNetworkMessages() { //get network message: ArrayList<NetworkMessage> ret = new ArrayList<NetworkMessage>(); //initialize receivedMessage when not done already: if ( receivedMessages.isEmpty() ) { for ( int i=0; i<remoteClients.size(); ++i ) { receivedMessa...
ff4e76a4-9f45-4e18-94b8-0f5725bec120
0
public void setSku(String sku) { this.sku = sku; }
edfedc63-c71b-4d91-99ad-6d8b6b92c0f6
1
void detectDataAccessMethod(Class<?> clazz, final DataAccessInterceptor interceptor) throws Exception { ReflectionUtils.doWithMethods(clazz, new ReflectionUtils.MethodCallback() { @Override public void doWith(Method method) throws Exception { DataAccessExecutor executor = createDataAccessExecutor(method);...
2e5d9d2f-cc87-4c03-bf2b-b2fd6a77d67b
9
private static void collectUserData(String userPath, String split_Sign) throws IOException { File file = new File(userPath); BufferedReader buffRead = new BufferedReader(new InputStreamReader(new FileInputStream(file))); boolean flag = true; int tmp = 0, count = 0; int[] userIndex = new int[DataInfo....
8b446c38-6f90-4416-8f27-e9b219e0d7ee
3
public String[] playList(int n) { String ans1[] = new String[n]; int a; if(n > 51){ a = 50; }else{ a = n; } String ans2[] = new String[a]; for(int i = 0;i < n;i++){ ans1[i] = i + 1 +".mp3"; } Arrays.sort(ans1); for(int i = 0;i < a;i++){ ans2[i] = ans1[i]; } return ans2; }
5ab4241f-1d82-4d94-bc1c-3ae61060b521
5
public ZemObject get(ZemObject index){ int ind = -1; if(! (index instanceof ZemNumber)){ return null; } ind = ((ZemNumber)index).intValue(); if(ind < 0 || ind >= elements.size()){ return null; } Iterator<ZemObject> iter = elements.iterator(); while(ind > 0){ if(iter.hasNext()){ iter.next();...
ece09228-2d9a-44e5-9976-cb93ce2ea9a3
6
private boolean validMove() { boolean test = false; if (test || m_test) { System.out.println("ConnectFour::validMove() BEGIN"); } if (getTurnCount() == GAME_WIDTH * GAME_HEIGHT) { if (test) System.out.println("ConnectFour::validMove() - No more valid " ...
f19f9afc-1801-4145-99f0-c2211610b965
0
public Location getLoc() { return this.location; }
2fdcdf13-af80-4fce-a148-3d78cce1e32a
5
private void countClass(Class<?> type) { Integer quantity = get(type); put(type, quantity == null ? 1 : quantity + 1); Class<?> superClass = type.getSuperclass(); if(superClass != null && baseType.isAssignableFrom(superClass)) countClass(superClass); }
a98e5de4-8e0a-498d-9a88-e4a4af342550
3
public static void settAutoCommit(Connection forbindelse) { try { if (forbindelse != null && !forbindelse.getAutoCommit()) { forbindelse.setAutoCommit(true); } } catch (SQLException e) { skrivMelding(e, "settAutoCommit()"); } }
aecdfa9e-df6c-4f31-91bb-bbb29332117f
1
public void start_logging() { for (ConnectionProcessor pipe : pipes) { pipe.start_logging(); } }
4b7c748d-1b1c-4565-a893-7f674443031e
0
public Tile getParent() { return parent; }
47680020-b90a-437b-b86f-57481131ab70
8
public void backwardEliminate(Instances instances, int metric) throws Exception { // Find the best model to remove. I.e., model for which removal improves // performance the most (or hurts it least), and remove it. if (m_numChosen <= 1) { // If we only have one model left, keep it, as a bag ...
79ff2785-c964-4761-a95a-beea22c9d4f7
6
private void room(Rectangle rec) { int sx = rec.x; int sy = rec.y; int ex = rec.x + rec.width; int ey = rec.y + rec.height; for (int x = sx; x < ex; x++) { for (int y = sy; y < ey; y++) { if (y == sy || y == ey - 1 || x == sx || x == ex - 1) { ...
097c9a0b-55b5-4f54-976f-43b7ffb9287e
0
public static void main(String[] args) { Minecraft mc = new Minecraft(); mc.start(); }
313ad0d9-4889-4735-b7a7-49f5e3300521
5
private static boolean isWord( String string ) { if ( string == null || string.length() == 0 ) { return false; } for ( int i = 0; i < string.length(); ++i ) { char c = string.charAt( i ); if ( !Character.isJavaIdentifierPart( c ) && c ...
0147ddff-e85e-405e-a2f0-9da569c59cfb
2
public double[] getTurningPointResponses(){ double[] ret = null; if(this.nTurningPoints>0){ ret = new double[this.nTurningPoints]; for(int i=0; i<this.nTurningPoints; i++)ret[i] = this.calculatedResponses[this.turnIndices[i]]; } return ret; }
7615e0c9-7bff-4f05-ab32-7fb9ea4097d7
0
public Person getPerson() { return person; }
2e9e0ace-caab-429c-b3d1-6fe8d514cb8e
5
public static int binarySearch(int i, int[] vals) throws Exception { int lb = 0; int ub = vals.length-1; int index = -1; while (lb <= ub) { int mid = (lb + ub) / 2; if (vals[mid] == i) { return index = mid; } // if else if (vals[mid]...
938ae680-0748-40a6-a07c-424c1b28bada
4
public void setGrid(Game.PlayerTurn[][] grid) { boolean test = false; if (test || m_test) { System.out.println("Grid :: setGrid() BEGIN"); } m_Grid = grid; if (test || m_test) { System.out.println("Grid :: setGrid() END"); } }
54da1480-b79f-44f8-b95d-bda83115cbfb
6
private void nextSnapshot(List<SnapshotFile> files) { int count = 0; for (SnapshotFile file : files) { if (file.getSize() >= 4194304 && file.getState() instanceof New) { // Files >= 4MB and NEW state change to UNMODIFIED Unmodified unmodified = new Unmodified(); file.setState(unmodified); c...
522c82a6-1b1c-45da-9f99-d7630ab8e543
2
private boolean bsGetBit() throws IOException { int bsLiveShadow = this.bsLive; int bsBuffShadow = this.bsBuff; if (bsLiveShadow < 1) { int thech = this.in.read(); if (thech < 0) { throw new IOException("unexpected end of stream"); } ...
188509c0-5a4f-43a3-80df-d8b90a15a70e
0
public Population (int size, double crossoverRate, int numElite, Function<Random, Chromo<T>> makeRandomChromo, Function<Chromo<T>, Double> computeFitness, BiFunction<Random, Chromo<T>, Chromo<T>> mutateGenes){ this.CROSSOVER_RATE = crossoverRate; this.NUM_ELITE = numElite; this.size = size; individual...
9ba803f2-55e5-4fdf-a785-a7d98fc7eb9b
5
private SimpleExpression parseSimpleExpression() { //System.out.println("parseSimpleExpression"); SimpleExpression node = new SimpleExpression(); SignedTerm sTerm = new SignedTerm(); if(nextIs("plus") || nextIs("minus")){ sTerm.setOp(new Operator(acceptIt())); } sTerm.setTerm(parseTerm()); node.getTerm...
6574a667-e960-4a8a-b6c8-1ea2954db29c
1
public void update() { yLocation+=velocity; if (yLocation >= oceanHeight) { yLocation=-1*oceanHeight; } updateLocation(xLocation, yLocation); }
dacd8db5-138c-430c-b07d-1d7436e49096
1
public static MatchSaveData load(String filePath) throws IOException, ClassNotFoundException { ObjectInputStream objectInputStream = new ObjectInputStream(new FileInputStream(filePath)); Object loadedObject = objectInputStream.readObject(); objectInputStream.close(); if (loadedObject instanceof MatchSaveD...
39aa690e-5f26-4c46-a88e-0adc926bd121
1
private boolean jj_3_11() { if (jj_3R_29()) return true; return false; }
4624cad1-5a04-4a2a-8e4c-098905d0c0c8
2
@Override public void unExecute() { try { int i, j; for (i = startFrom, j = 0; i <= this.endAt; i++, j++) { this.document.insert(this.buffer.get(j), i); } } catch (Exception ex) { ex.printStackTrace(); } }
16fc4a57-8975-48e1-bed0-2b5f590b0744
3
protected int[] mapColumnsToProperties(ResultSetMetaData rsmd, PropertyDescriptor[] props) throws SQLException { int cols = rsmd.getColumnCount(); int columnToProperty[] = new int[cols + 1]; Arrays.fill(columnToProperty, PROPERTY_NOT_FOUND); for (int col = 1; col <= cols; c...
036a359c-83e3-4cc9-b741-24b2e9e1b8ed
7
@Override public final String toString(String f) { StringBuilder buffer = new StringBuilder(); if (!field.equals(f)) { buffer.append(field); buffer.append(":"); } buffer.append("\""); Iterator<Term[]> i = termArrays.iterator(); while (i.hasNext()) { Term[] terms = i.next(); ...
c341b6a1-74dd-4ab7-ab03-38d112607345
7
@Override public void addMessengerPlayer(MapleMessenger messenger, String namefrom, int fromchannel, int position) throws RemoteException { for (MapleMessengerCharacter messengerchar : messenger.getMembers()) { if (messengerchar.getChannel() == server.getChannel() && !(messengerchar.getName().equals(namefrom)...
71ce15d4-0c2f-4f58-892d-2d3a9eaf3bed
1
public static double scaleEDA(final int port, final int raw) { // need to round maximum value that otherwise is 1.05496875 final double ohm = 1 - ( (double)raw /(double)1023); double result = 1/ohm; if (result != Double.POSITIVE_INFINITY) result = new BigDecimal(result).setScale...
dc8accbc-e15b-4714-81ec-27564e749778
7
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; LocalizedString other = (LocalizedString) obj; if (locale != other.locale) return false; if (text == null) { if (other.text != null) ...
d7bd094a-ed48-496d-9b4a-bff6a91e671b
7
public static ChunkCoordinates getNearestEmptyChunkCoordinates(World par0World, int par1, int par2, int par3, int par4) { int i = par0World.getBlockMetadata(par1, par2, par3); int j = BlockDirectional.getDirection(i); for (int k = 0; k <= 1; k++) { int l = par1 - headBlo...
6150e957-42e1-40b6-ade3-7a0855a7e671
3
private static boolean isNumberAPrimeNumber(int userInput) { boolean isPrimeNumber = true; // check if userInput is divisible by 2 (which would make the value an even number) if (userInput % 2 == 0) return false; // prime number must be greater than 1, therefore int is assigned the s...
b4e8a809-8b95-4a45-b8be-22de90d34bf7
8
public boolean restoreStringArray(String[] stringArray) { if (stringArray.length < 6) { return false; } buttonText = stringArray[0]; buttonToolTip = stringArray[1]; if (stringArray[2] != null && stringArray[2].length() > 0) { mnemonic = stringArray[2].charAt(0); } else { mnemonic = null; } if (...
97913cfb-ac41-4642-afe0-879f7f4e929f
3
private Inventory solveSmartlyRecursively(int indexOfNextItem, int remainingCapacity, ArrayList<Double> result, int value) { if (indexOfNextItem >= items.size()) { return new Inventory(this, result, value); } Item nextItem = items.get(indexOfNextItem); result.add(0....
2b002100-1711-4b67-8170-a7bc8f25ef56
6
private void calculateWeights() { double tlVar; double tlSum=0; double pcMean; double pcVar; double pcSum=0; double pcSD; double tlSD; double coefficientOfVariationPC; //measure of variability of playcounts double coefficientOfVariationTL; //measure of variability of time length for(int i=0; ...
049a44e1-0abe-4ef9-90a7-f3604436f067
6
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Version other = (Version) obj; if (major != othe...
c261755a-8de8-4e57-b5ca-5b2aaa2b96bf
3
private void clearLines(JTextArea field) { String fieldData = new String(""); for(int i = 0; i < field.getText().length(); i++) { if(field.getText().charAt(i) != '\n' || field.getText().charAt(i) != '\t') { fieldData += field.getText().charAt(i); } } field.setText(fieldData); }
565ea657-a477-46c0-9d37-e22f3caec0d9
5
public void purchase(String name, double price, SaleItemType type, boolean isImported) { switch (type) { case Food: case Book: case MedicalProduct: saleItems.add(new SaleItem.SaleItemBuilder(name, price) .isImported(isImported) ...
4ada9bdf-fb21-4c34-88bc-86ae8798c9b7
9
public String toGetSourceString(OgnlContext context, Object target) { String result = ""; String first = _children[0].toGetSourceString(context, target); String second = ""; if (ASTProperty.class.isInstance(_children[1])) { second += "((" + OgnlRuntime.getCompil...
bbe067b2-0472-4c2a-83a3-c504239302ed
4
public List<Case> getCasesAutourDe(Case pos){ List<Case> a= new ArrayList<>(); if(!horsPlateau(pos.getX()-1, pos.getY())){ a.add(cases[pos.getX()-1][pos.getY()]); } if(!horsPlateau(pos.getX()+1, pos.getY())){ a.add(cases[pos.getX()+1][pos.getY()]); } ...
421d5e7e-0293-4fcf-ab3c-528457f435df
9
public void run(){ boolean gameFound = false; boolean searching = true; while(!gameFound && searching){ try { jlblMessage.setText("Searching for a game."); int gameID = gameCon.getGameinformation(user); if(gameID != -1){ gameFound = true; jlblMessage.setText("Game found"); ...
ea3d1136-fa0b-4746-b172-4662f748ec6c
2
@Override public boolean equals(Object obj) { boolean equalA = a == ((BucketForCircles) obj).a; boolean equalB = b == ((BucketForCircles) obj).b; boolean equalR = r == ((BucketForCircles) obj).r; return equalA && equalB && equalR; }
d1363857-0eee-4a98-a8f2-fe89b212323f
4
public void guardarListaUsuarios(){ FileOutputStream archivo=null; ObjectOutputStream flujo=null; Usuario usuario; //Se crean los elementos necesarios try{ archivo=new FileOutputStream("listaUsuarios"); flujo=new ObjectOutputStream(archivo); }c...
94ad91d6-c0fc-4979-811b-46b1d68afc87
0
public void SetTimeDelivered(int timeDelivered) { this.timeDelivered = timeDelivered; }