method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
adec0d73-fc8b-4d54-b019-d555bfb62421
2
private static JPanel getPanel() { JPanel p = new JPanel(); p.setLayout(new GridLayout(0, 1, MenuLookAndFeel.getGap(), MenuLookAndFeel.getGap())); p.add(getCombinedPanel(new MenuLabel(Translator.getMenuString("playerName")+ ":"), nameField)); nameField.setFont(MenuLookAndFeel.getLargeFont()); nameF...
0cb4210f-f22a-4ed2-99b0-bec652e9223d
7
public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException { final javax.servlet.jsp.PageContext pageContext; javax.servlet.http.HttpSession session = null; final java...
e6fe554e-cad3-498d-95e8-19000a4f3a40
6
public void render(int xOffset, int yOffset){ for(int y=0;y<height;y++){ int yy = y+yOffset; if(yy< 0 || yy>=height) continue; for(int x=0;x<width;x++){ int xx= x+xOffset; if(xx<0 || xx>=width) continue; int tileIndex = ((xx>>4)&MAP_SIZE_MASK)+((yy>>4)&MAP_SIZE_MASK)*MAP_SIZE; pixels[xx+yy*wi...
5c6869a7-ca1c-4206-b33f-f1a13aa28547
0
public void setTelefono(String telefono) { this.telefono = telefono; }
33d40c85-06e0-4edf-8f57-bbe06962af8f
6
public void removeAll(int length) { if (numElements == 0) { return; } SingleNode cursor = head; SingleNode temp; while (cursor != null && cursor.next != null) { temp = cursor.next; /* remove nodes until data's length doen't equal length */ while (temp != null && temp.data.length() == length) { ...
9417bbe0-85c6-4047-a6c0-39092b8b5e44
5
public void set(int index, Object o) { if(index + 1 > array.length) { resizeArray(index + 1); } if( array[index] != null && o == null) { numElements -= 1; } if( array[index] == null && o != null) { numElements += 1; } array[index] = o; }
f66aec59-2fea-4ca8-be5f-01d98796298c
4
public int leftShift(int c, int i){ if(i==0 || i==1 || i==8 || i==15){ c = (((int)c >> 27) | ((int)c << 1)) & ~((int)1 << 28); } else{ c = (((int)c >> 27) | ((int)c << 1)) & ~((int)1 << 28); c = (((int)c >> 27) | ((int)c << 1)) & ~((int)1 << 28); ...
6e07ee27-a0c0-44a0-94bb-960e488e2167
6
public static void main(final String[] args) { DefaultSubLWorker.startProfiling(); final int BASE_PORT = 3600; try { final CycAccess access = new CycAccess("localhost", BASE_PORT); SubLWorkerSynch worker = new DefaultSubLWorkerSynch("(+ 1 1)", access); Object work = worker.getWork(); ...
a0f3398c-5df5-4bdb-8683-8a2fb1441bb6
2
public boolean hasElement(T a) { if(this.a.equals(a)) { return true;} else if(this.next!=null) { return this.next.hasElement(a); } else { return false; } }
ee1788dc-92a4-4ce5-accb-c5252c899da6
7
public static boolean isReservedIf(String candidate) { int START_STATE = 0; int TERMINAL_STATE = 2; char next; if (candidate.length()!=2){ return false; } int state = START_STATE; for (int i = 0; i < candidate.length(); i++) ...
92d42bb5-4aad-448e-8ff5-36b0c0815584
4
private TreeNode rotateLeft(TreeNode rotatingNode) { TreeNode rotatedTreeRootNode = rotatingNode.right; rotatedTreeRootNode.parent = rotatingNode.parent; rotatingNode.right = rotatedTreeRootNode.left; if (rotatingNode.right != null) { rotatingNode.right.parent = rotatingNode; } rotatedTreeRootNode....
e36c7240-437b-43f5-b8fb-ee44dd1417d6
7
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://...
69c0a989-54b5-4129-a96d-1fb6ac84ee27
3
public MySQLRecordingManager() { _recordings = new ArrayList<Recording>(); try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException ex){ return; } try { conn = DriverManager.getConnection("jdbc:mysql://" + DBHOST + ":" + DBPORT + "/" + DB, DBUSER, DBPASSWORD); con...
e10c04c9-39fc-495a-acfa-634f14156791
7
public static java.lang.reflect.Method chooseSortPredicate(Stella_Object firstelement) { if (firstelement == null) { return (null); } { Surrogate testValue000 = Stella_Object.safePrimaryType(firstelement); if (Surrogate.subtypeOfP(testValue000, Stella.SGT_STELLA_GENERALIZED_SYMBOL)) { {...
378ee31b-f8e1-4e5f-b69a-70309aa6d16d
6
public boolean isErrorStopCodonsInCds() { if (!Config.get().isTreatAllAsProteinCoding() && !isProteinCoding()) return false; // Get protein sequence String prot = protein(); if (prot == null) return false; // Any STOP codon before the end? char bases[] = prot.toCharArray(); int max = bases.length - 1; ...
5f15310d-2058-462f-8207-a73177c4244e
7
public void setOptions(String[] options) throws Exception { String tmpStr; super.setOptions(options); tmpStr = Utils.getOption('a', options); if (tmpStr.length() != 0) setNumAttributes(Integer.parseInt(tmpStr)); else setNumAttributes(defaultNumAttributes()); tmpStr = Utils.ge...
f6a04b0f-be7b-4618-a398-4168b39730b5
7
public void resize() { try { if (imageType == 0) { if (facing == 1) img = ImageIO.read(new File("pics/plrL.png")); else img = ImageIO.read(new File("pics/plrR.png")); } else if(imageType == 1) { if (facing == 1) img = ImageIO.read(new File("pics/plrLCube.png")); else img = Im...
3ad7967f-7e19-4e34-8ac6-1c9a3f10ec92
6
SoundEffect(String file) { try { URL url = SoundEffect.class.getResource("/sfx/" + file); if (file == "Shoot1.wav" || file == "Shoot2.wav") clips = new Clip[5]; else clips = new Clip[2]; for (int i = 0; i < clips.length; i++) { AudioInputStream ais = AudioSystem.getAudioInputStream(url); ...
db2bb544-8ec1-416b-904a-71165b912599
0
public static Font getQuestionFont() { return questionFont; }
9496b909-ee68-4a06-bc69-64b6fda13236
2
@SuppressWarnings("unchecked") public <T> TaskResult<T> process(TaskParameters parameters) { MongoFindTaskParameters taskParameters = (MongoFindTaskParameters) parameters; DBCollection collection = taskParameters.getCollection(); DBObject queryDbObject = taskParameters.getQueryDbObject(); BeanMapper<?> mapper...
f400304e-1100-4e9d-8965-26b5caeb1415
2
public synchronized void exitServer () { for (int i = 0 ; i < flexclients.size () ; i++) { try { TcpThread currclient = (TcpThread) flexclients.get (i); currclient.Soutput.close (); currclient.Sinput.close (); currclient.socket.close (); } catch (Exception e) { } } flexclie...
3500d4a3-1cde-412a-9a69-cd95391e107d
4
public void hit(int damage){ health -= damage; if(dx > 0){ setImage("enemy_Sprites/goblin/gethitGobR.gif"); }else{ setImage("enemy_Sprites/goblin/gethitGobL.gif"); } if(health <= 0){ if(dx > 0){ setImage("enemy_Sprites/goblin/de...
fb2b68ea-c503-4fe9-8855-3e6effe9164f
1
public ConnectionEstablishment(String host, int port) { log.entering(this.getClass().toString(),"ConnectionEstablishment"); try { SSLContext sc = SSLContext.getInstance("TLS"); sc.init(null, null, null); SSLSocketFactory ssf = sc.getSocketFactory(); SSLSocket s = (SSLSocket) ssf.createSocket(host, port...
df7accc6-5b91-4154-b50c-1e751877a8e4
4
public int stcmp(StackTraceElement a, StackTraceElement b) { int sc = equals(a.getFileName(), b.getFileName()); if(sc != 0) return(sc); sc = equals(a.getClassName(), b.getClassName()); if(sc != 0) return(sc); sc = equals(a.getMethodName(), b.getMethodName()); if(sc != 0) ...
8c269b8a-6d54-490a-8f12-2dcdbadb39bd
8
protected void processFormation(List<MOB>[] done, MOB leader, int level) { for (final List<MOB> element : done) { if((element!=null)&&(element.contains(leader))) return; } if(level>=done.length) return; if(done[level]==null) done[level]=new Vector<MOB>(); done[level].add(leader); for(int f=0...
ab525f93-3de4-4574-b0d3-ddaea8c68192
9
public int compareTo(Object o) { DurationComparable other; if (o instanceof DurationComparable) { other = (DurationComparable)o; } else if (o instanceof YearMonthDurationValue) { other = (DurationComparable)getSchemaComparable((YearMonthDurationValue)o...
b6144163-67d2-4ff5-bdbb-920c0089725b
8
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((created == null) ? 0 : created.hashCode()); result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + ((modified == null) ? 0 : modified.hashCode()); result = prime * result...
898d1deb-a0ba-4a45-a164-c5abb60c437c
8
private static Level strToLevel(String level) { if (level == null) return null; level = level.toLowerCase().trim(); if (level.equals("fatal")) return Level.FATAL; if (level.equals("error")) return Level.ERROR; if (level.equals("warn")) ...
be5064f6-1ae7-45d7-a7fd-0339bd5aa705
2
public void addPath(final Block callerBlock, final Block returnBlock) { for (int i = 0; i < paths.size(); i++) { final Block[] path = (Block[]) paths.get(i); if (path[0] == callerBlock) { path[1] = returnBlock; return; } } paths.add(new Block[] { callerBlock, returnBlock }); }
d261b6fc-22dc-4c92-a06a-45dae42803c8
7
@Override public void execute(String inputFile, String outputFile) throws IOException { final String dir = FilenameUtils.getFullPath(outputFile); final String baseName = FilenameUtils.getBaseName(outputFile); FileInputStream in = new FileInputStream(inputFile); Workbook wb = new HSSFWorkbook(in); Sh...
18730e9c-4273-44de-8d5f-3ba797f403b9
6
private static int vivants(boolean[][] actuel,int i,int j){ //requires i \in [|1;h-1|], j \in [|1;w-1|] (actuel "elargi") int count=0; for(int k=0;k<3;k++){if (actuel[i-1][j-1+k]) count++;} if (actuel[i][j-1]) count++; if (actuel[i][j+1]) count++; for(int k=0;k<3;k++){if (actuel[i+1][j-1+k]) count++;} ...
043a79ae-2bb8-42ed-bdf0-7dcc30bff008
3
@Override protected void paintComponent(Graphics g) { Operator op = Application.mediator.parser.start; while(op != null){ if(!op.isConnection()){ op.panel.drawPanel(g); if(op.next() != null){ op.panel.drawConnection(g); ...
bce4fc37-a3c6-40d8-a0e1-61fe02af4435
2
public void logIn(String username, String password) throws SQLException { PreparedStatement statement = connection.prepareStatement("SELECT Password, IsManager FROM Users " + "WHERE Username = ?"); statement.setString(1, username); ResultSet result = statement.executeQuery(); if (!result.next() ...
0c1f64b6-c797-4c5d-ade9-8a4f7325b6a4
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Sucursal)) { return false; } Sucursal other = (Sucursal) object; if ((this.sucursalidSucursal == null && other....
10f99821-b0b8-403f-81f8-673409c124c8
3
public void setSafeArguments(String[] args_) { for (int i = 0; i < MAX_ARGS_TO_PARSE; i++) args[i] = ""; for (int i = 0; i < args_.length; i++) { if (args_[i] != null) args[i] = args_[i]; else args[i] = ""; } }
02bd7839-a519-4d0e-bd67-4ada24a78913
0
public Long getOsobaId() { return osobaId; }
58491fa1-66c7-4cdd-817b-af61aae28781
2
public void removeValueVisitor(Class<?> targetClass) { if (visitors != null) { visitors.remove(targetClass); } }
7e56251b-6cc1-4e5e-8364-c105c0cd3db6
6
public void setMultipleState (String name, int state) { int k; for (k = 0; k < Left.size(); k++) { IconBarElement i = (IconBarElement)Left.elementAt(k); if (i.getName().equals(name) && i instanceof MultipleIcon) { ((MultipleIcon)i).setSelected(state); } } for (k = 0; k < Right.size(); k++) ...
f6286b68-9abd-407a-bd84-cd8bf28bc70c
9
private void attack() { if (LocationManager.getLoc(cursor).isEmpty()) { JOptionPane.showMessageDialog(gui, "No Unit Present"); return; } if (LocationManager.getLoc(cursor).getUnit().getTeam() != turn) { JOptionPane.showMessageDialog(gui, "Cannot Control this u...
5318eb99-69e4-40b7-a1b7-daf1bc1aa8b8
9
@Override public void executeTest() { synchronized (Stress8txn.class) { if (!_consistencyCheckDone) { _consistencyCheckDone = true; try { if (totalConsistencyCheck()) { System.out.println("Consistency check completed suc...
1770e6d1-0dfa-4aa4-b9e6-741fa965b289
5
public static Image fill(Image img, int xSeed, int ySeed, Color col) { BufferedImage bi = new BufferedImage(img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_ARGB); bi.getGraphics().drawImage(img, 0, 0, null); int x = xSeed; int y = ySeed; int width = bi.getWidth(); int height = bi.getHeig...
5a26f4ab-bac6-43ed-b0be-7fbd145a5b89
9
public void draw(Graphics g, boolean fill, boolean vertices) { g.setColor(color); Graphics2D g2 = (Graphics2D) g; g2.setStroke(new BasicStroke(7.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f)); // Polygon is incomplete if (poly == null) { Point prev = null...
ea9e064c-1240-43a5-9e17-9f1b30296c09
7
public CodeSampleElement GetOrBuildCodeSample(ClassElem klass, PostElement parent, List<LinkSpan> spans) { CodeSampleElement codeSample = null; if( !ClassIndex.getInstance().SampleMap.containsKey(parent.Id) ) { codeSample = new CodeSampleElement(); codeSample.Parent = parent; Hashtable<Integer,Code...
5094cf07-afac-4557-b1f6-8b7e064a7257
4
@Override public void keyReleased(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { dispose(); } if (e.getKeyCode() == KeyEvent.VK_ENTER|| e.getKeyCode() == KeyEvent.VK_SPACE) { for (int i = 0; i < 4; i++) { rand.chageStat(i, checkbox[i].isSelected()); } scrr.setStrats(checkbox[4].isSele...
d122fbda-0f82-4ddf-8781-bc3280e6d7ef
5
public static String capitalize(String text) { if (text == null) return null; if (text.length() == 1) return text.toUpperCase(); String s = ""; for (int i = 0; i < text.length(); i++) if (i - 1 < 0 || text.charAt(i - 1) == ' ') s += ("" + text....
0597f992-fc0b-4e87-9911-590f4139d4c9
6
@Override public ArrayList<Task> findByExecutor(int id) { ArrayList taskList = new ArrayList(); try { connection = getConnection(); ptmt = connection.prepareStatement(QUERY_SELECT + " WHERE id_executor=?;"); ptmt.setInt(1, id); resultSet = ptmt.execute...
2a695e8a-cafe-4af1-b42b-e22df77812fa
0
public int getWeight() { return weight; }
92479c21-0d83-4acb-9f2e-43b44a256898
0
public String getDesc() { return desc; }
8415e03e-b2c4-4ad4-a8bc-1799169146bb
3
private int pickFruit(int [] platter) { // generate a prefix sum int[] prefixsum = new int[NUM_FRUITS]; prefixsum[0] = platter[0]; for (int i = 1; i != NUM_FRUITS; ++i) prefixsum[i] = prefixsum[i-1] + platter[i]; int currentFruitCount = prefixsum[NUM_FRUITS-1]; ...
25de12eb-14f5-46c6-8e3c-24ea43fbe638
5
@Override public void starting() { // Load defaults final ConfigurationSection config = plugin.getConfig(); // LinkedHashmap of defaults final Map<String, Object> defaults = new LinkedHashMap<String, Object>(); defaults.put("formatter.use", true); defaults.put("format...
564c6ecf-8c31-4462-9aea-9fb5360a968b
0
public void bufferReset(boolean state) { buffer.clear(); buffer.setPaintListenerState(state); gameWorld.renderScene(buffer); gameWorld.draw(buffer); buffer.update(); gameWorld.drawGraphForm(buffer, camera); buffer.displayGLOnly(); }
fd7e241c-5d9e-45f2-80bd-4f5975eb5118
0
public JLabel getjLabelSecteur() { return jLabelSecteur; }
c910d819-9a58-4cf8-9ac0-de76def0b126
1
public static boolean isRotation(String s1, String s2) { if(s1.length() != s2.length()) { return false; } String s1s1 = s1 + s1; int index = s1s1.indexOf(s2); return index > -1; }
121ca956-93fc-4384-a070-53162cf4bac1
3
public static URL buildURL(DTRequest domainToolsRequest){ String uri = getURI(domainToolsRequest); uri = DTConstants.PATH+"/"+uri; String stringUrl = ""; Boolean parameters = false; if(domainToolsRequest.getDomainTools().isUseFreeAPI()) stringUrl = DTConstants.SCHEME+DTConstants.HOSTFREE+uri; else stringUrl...
d8fcf62c-df67-4a97-910a-9291c1a6ac4d
7
public String toString() { String s = "<block " + label + " hdr="; if (header != null) { s += header.label(); } else { s += "null"; } switch (blockType) { case NON_HEADER: break; case IRREDUCIBLE: s += " irred"; break; case REDUCIBLE: s += " red"; break; } if (this == graph.s...
313d1cf0-fdb1-4518-9d69-20f9ade77588
7
private void recalculateBarGradient() { double angleFactor = 1d / 360d; double emptyRange = 360d - getSkinnable().getAngleRange(); double offset = angleFactor * ((360 - getSkinnable().getStartAngle() + 180 - emptyRange * 0.5) % 360); List<Stop> stops = new LinkedList<>(); ...
227aebbe-500c-49e3-beef-58463db8bf44
8
private void doMovement() { /** * The first part handles the "physics", i.e. it allows the player to fall down. */ SimpleVector camPos=camera.getPosition(); camPos.add(new SimpleVector(0, PLAYER_HEIGHT/2f, 0)); SimpleVector dir=new SimpleVector(0, GRAVITY, 0); dir=theWorld....
0d974f4d-5984-4678-854c-034bb9223ad8
6
public void run() { for (final Entry<String, Long> player : tgym.afkTimer.entrySet()) { if (tgym.getServer().getPlayer(player.getKey()) == null) continue; final String group = tgym.Vault.GetGroup(tgym.getServer().getPlayer( player.getKey())); Object val = tgym.Settings._("Group...
962622ac-f8f2-454c-bbdc-4372057325fe
8
public List<LogMessage> search( String query ) { String[] pcs = query.split( " +" ); List<LogMessage> lst = new ArrayList<LogMessage>(); try { DBObject cmd = new BasicDBObject(); cmd.put( "fts" , _logs.getName() ); cmd.put( "search" , query ); ...
2e4bb1a2-6d1d-411b-9c42-7f43efc4e2a2
1
public String login() { boolean success = loginDelegate.login(login, Encryptor.encrypt(password)); if (success) { return "index.xhtml"; } else { FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Wrong login or password")); return "login.x...
3fc38030-2db4-40a8-bdc2-229e0540a320
5
public static boolean createAssignExpression(InstructionContainer ic, StructuredBlock last) { /* * Situation: sequBlock: dup_X(lvalue_count) store(POP) = POP */ SequentialBlock sequBlock = (SequentialBlock) last.outer; StoreInstruction store = (StoreInstruction) ic.getInstruction(); if (sequBlock.subB...
6b33a528-208f-4021-a5cf-2b2a3c857b6c
4
public boolean validateLotto(Player player, String name, String amount) { try { double a = Double.parseDouble(amount); if(a < 0) { //Cannot have negative lottery return false; } List<String> lottos = plugin.getConfig().getStringList("list"); ListIterator<String> iterator = lottos.listIter...
5fac269e-8cd4-4da5-9815-a7353e419c9c
9
public static void TrieStrTreeDemo() { TrieTreeAPI<Character> api = new TrieTreeAPI<Character>() { @Override public Character[] toArray(Object s) { String str = s.toString(); Character[] cArray = new Character[str.length()]; for(int i = 0; i < cArray.length; i++) { cArray[i] = str.charAt(i); ...
3e2fb277-5556-4994-9bed-caabaa6ba121
9
private float guessDiameter(){ //Read user defined environment variable if exists try { String dia = System.getenv("FILAMENT_DIAMETER"); if(dia != null){ //System.out.println("Use env value FILAMENT_DIAMETER="+dia); return Float.parseFloat(dia); } } catch (NumberFormatException e1) { } //g...
6b2cbcfe-1284-4a71-a344-2cb3f6fe54ed
4
public static boolean isAllUpperCase(String str) { if (str == null || isEmpty(str)) { return false; } int sz = str.length(); for (int i = 0; i < sz; i++) { if (Character.isUpperCase(str.charAt(i)) == false) { return ...
e7dc0954-62cc-4f3a-ab03-bd076c5f8a80
0
@Override public Preference getPreference() { return this.pref; }
17529f60-0246-450e-b5a4-94e657ff9c98
4
public AState getGoalState() { if(this.goalState == null) { for(int i = 0; i < this.map.length; i++) { for(int j = 0; j < this.map[0].length; j++) { if(this.map[i][j].isGoal()) { this.goalState = this.map[i][j]; return this.goalState; } } } } return this.goalS...
b94b5837-c116-451f-aa37-33fa37943e74
9
@Override public ArrayList<ProtocolUnit> read(DataInputStream in, PassthroughConnection ptc, KillableThread thread, boolean serverToClient, DownlinkState linkState) { UnitByte temp; value = new ArrayList<ProtocolUnit>(); while(true) { temp = new UnitByte(); if(temp.read(in, ptc, thread, serverToClient,...
f65f9939-a27d-443a-bc78-ef4058e800f1
7
@Override public void OutputTweets(TreeMap<String, User> users, HashMap<User, ArrayList<Tweet>> tweets) { for (Map.Entry<String, User> entry: users.entrySet()) { HashMap<User, ArrayList<Tweet>> unsortedUserTweetMap = new HashMap<User, ArrayList<Tweet>>(); User user = entry.getValue(); System.out.println(use...
e9ac3579-e236-4d8d-97da-e95ebcdcb3f2
0
@Override public int hashCode() { int hash = 7; hash = 89 * hash + Objects.hashCode(this.vis_matricule); hash = 89 * hash + Objects.hashCode(this.rap_num); hash = 89 * hash + Objects.hashCode(this.med_depotLegal); return hash; }
a4c3e38a-f0f9-4da7-802b-add4bb160563
7
private void findPrimes () { myPrimes = new ArrayList<Integer> (); // Create two threads Thread t1, t2; t1 = new Thread () { @Override public void run() { while (!myInputs.isEmpty()) { Integer input; ...
24e84f26-3498-48cd-b4b8-6c5a1812ce2c
6
private boolean lineMayContainPreProcessor(String line) { if (this.isCheckEveryLine()) { return true; } return line != null && (line.startsWith("//") || line.startsWith("/*") || line.startsWith("#") || line.startsWith("<!") || line.startsWith...
66409660-12b9-4fe1-9642-f85b7d74fa13
8
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Generic_XYNumericalData other = (Generic_XYNumericalData) obj; if (this.x != other.x && (this.x == null |...
653d8c7b-a222-4895-8cda-7defe765695a
5
public void showError(int error) { String errorMessage = "Unknown"; if (error == 1) { errorMessage = "The surface must be atleast 3x3 large."; } else if (error == 2) { errorMessage = "There must be more than one timestep"; } else if (error == 3) { erro...
5b48bc10-cd3f-402e-8567-a67f74f1103b
4
public void zoneEventOccurred(String eventZone, int eventType){ // If within the bounds of the text, go to the link if(eventType==ZoneEvents.ENTER && eventZone.equals("TextPane")){ Gui.changeCursor(Cursor.HAND_CURSOR); } else if (eventType==ZoneEvents.CLICK && eventZone.equals("TextPane")) gotoLi...
d2c6144e-ced8-4c38-af48-299d095a25ac
4
public static Map populateMap(Map popMap){ int locationX = (int) (Math.random()*popMap.tileMap.length); int locationY = (int) (Math.random()*popMap.tileMap[0].length); int partType = (int) (Math.random()*allMapParts.size()); if(partType != 0){ MapPart temp = allMapParts.get(partType); boolean preChe...
7f2da5ba-53e0-4623-b919-64db73dacca1
7
private HashMap<GameState, String> allPreacherDay(GameState state, Card card) { Color faction = card.getFaction(); HashMap<GameState, String> choiceMap = new HashMap<GameState, String>(); Loot bag = state.getPlayer(faction).getLoot(); boolean allEmpty = true; for(String s : Treasure.allTreasures()) //list...
297ddeea-6590-4ac5-8f26-31e1becf82ba
0
public static void main(String[] args) { EvenChecker.test(new _8_MutexEvenGenerator()); }
7a2b62e3-4c0a-4f26-8f63-e4eda08ee02d
9
public void runGameTimedSpeedOptimised(Controller<MOVE> pacManController,Controller<EnumMap<GHOST,MOVE>> ghostController,boolean fixedTime,boolean visual) { Game game=new Game(0); GameView gv=null; if(visual) gv=new GameView(game).showGame(); if(pacManController instanceof HumanController)...
30e255a7-0df3-4f32-9d17-1a2ae069c1ee
6
public void paintComponent(Graphics gx) { Graphics2D g = (Graphics2D) gx; //For a better graphics, enable this: (be aware this could bring performance issues depending on your HW & OS). g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); //g.setC...
89d559e9-3002-4d39-8896-e4eb36923cd3
1
public final void addLowMoney(Opponent opponent) { lowMoney[lowMoneyPointer] = opponent; lowMoneyPointer++; if (lowMoneyPointer == lowMoney.length) { lowMoneyPointer = 0; } }
045250a3-8f95-4114-8504-ef80614c2cfc
7
public PixelMap and(PixelMap rhs) { int width = pixels.length; int height = pixels[0].length; int rhsWidth = rhs.pixels.length; int rhsHeight = rhs.pixels[0].length; int maxWidth = Math.max(pixels.length, rhs.pixels.length); int maxHeight = Math.max(pixels[0].length, rhs.pixels[0].length); boolean[]...
3628e0e5-102c-4e65-ba5d-cd48218fbea0
1
@Override public void run() { Loader loader = new Loader(); try { loader.setUrl(url); loader.load(); } catch (Exception e) { e.printStackTrace(); } }
08799f83-bf77-43bd-bce1-b99e367f5b66
0
public void testApp() { assertTrue( true ); }
83549242-1d9c-4a63-b737-fa828b3bd28a
1
private void prepareBits(int[] circleBits) { for(int i = 0; i < circleBits.length; i++){ circleBits[i] = GUIStandarts.backgroundColor; } }
7f25509b-a3f3-4027-8b36-42a3371ba072
9
@Override public V put( K key, V value ) { V existingValue = null; // Check for key in map, else check for value if( mapKV.containsKey( key ) ) { // Get existing value for key existingValue = mapKV.get( key ); ...
a1dd4ccf-f6bd-4531-b997-faf17f0a4295
0
@Test public void unMarshal() throws JAXBException { String input="<row Id=\"22\" PostId=\"47626\" " + "Text=\"concat infact doesn't do that. I've edited my post with a decompilation of the concat method\" " + "CreationDate=\"2008-09-06T16:46:31.450\" UserId=\"292\" />"; ...
c45d9969-d915-4a7c-a8c6-27308bbc7b20
6
@Override public void nominateCandidate(String electionID, HashMap<String, Set<User>> electorateMap, User nominator, User nominee) { DnDElection el = (DnDElection) electionMap.get(electionID); if (el.getElectionState() == ElectionState.NOMINATIONS_OPEN && electorateMap.containsKey(el.getElectoratelectio...
a4f2c8b0-2a7d-49fe-9d20-b06bf74f6898
8
@Override public void keyPressed(KeyEvent evt) { int keyCode = evt.getKeyCode(); switch( keyCode ) { case KeyEvent.VK_UP: Drawer.moveCamera(0, 0, -0.02f, 0, 0); break; case KeyEvent.VK_DOWN: Drawer.moveCamera(0, 0, 0.02f, 0, 0); break; ...
84267415-eb2f-4337-8b6b-6b0571221a63
6
static final short[][] method2699(int i, short[][] is, float[][] fs) { try { if (i != 16383) return null; for (int i_1_ = 0; (i_1_ ^ 0xffffffff) > (fs.length ^ 0xffffffff); i_1_++) { for (int i_2_ = 0; i_2_ < is[i_1_].length; i_2_++) is[i_1_][i_2_] = (short) (int) (16383.0F * fs[i_1_][i_2_]); ...
dd95ddb7-f092-4831-833c-01ca63836169
8
@Override public void enter() { if(tutorialEnd && hero.isPaused()) { if(tutorialX > -10) tutorialMoved ++; } int x = (int) hero2D.getPosition().getX(); int y = (int) hero2D.getPosition().getY(); if(x > 400 && x < 500) { if(y > 410 && y < 510) { if(world.getGameHints() == 2) { ...
29ba35b3-6ca1-485b-ac49-5871914b322e
7
public void set(int key, int value) { Node n; if(!map.containsKey(key)){ n=new Node(key,value,null,null); if(dll.size!=dll.count){ n.next=dll.first; if(dll.count!=0){ dll.first.prev=n; }else{ ...
1c1b66cc-2229-42f1-82ea-67d1d6ec18ca
6
private void loadFileActions() throws ParserConfigurationException, SAXException, IOException, InstantiationException, IllegalAccessException, ClassNotFoundException, DOMException { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder documentBuilder = documentBuilde...
48772623-40b6-404a-8066-ea1f2d5cdf60
5
public void destroy(String id) throws NonexistentEntityException, RollbackFailureException, Exception { EntityManager em = null; try { em = getEntityManager(); em.getTransaction().begin(); Software software; try { software = em.getReference...
5d0e1f2a-50a7-434c-a72c-07dbabd519d2
1
public static final void configure(MenuProvider... providers) { MENU_PROVIDERS = new MenuProvider[providers.length]; System.arraycopy(providers, 0, MENU_PROVIDERS, 0, providers.length); TreeSet<Command> set = new TreeSet<>(); for (MenuProvider provider : providers) { set.addAll(provider.getModifiableCommands...
7b1ae7c8-9afc-4da8-b8d0-47c6bb59d655
9
public vector2d foraging(ArrayList<Food> jedzonko,double kat_widzenia) { vector2d jedziem=new vector2d(0,0); double s; Random randGen; double kat; Food target; ArrayList<Food> seeFood; if(this.hungry) { seeFood=new ArrayList<>(); ...
54f8388a-477f-475b-8113-3a2c33733331
5
public boolean isPerfect(Comparable[] flatTree) { boolean answer = false; for (int i = 1; i < flatTree.length; i++) { Comparable current = flatTree[i]; Comparable left = getLeftKid(i,flatTree); Comparable right = getRightKid(i,flatTree); ...
aa09db55-fe00-413d-b7ab-4dfa0e68db35
8
public void lookForConstructorCall() { type01Count = cons.length; for (int i = 0; i < type01Count;) { MethodAnalyzer current = cons[i]; FlowBlock header = cons[i].getMethodHeader(); /* Check that code block is fully analyzed */ if (header == null || !header.hasNoJumps()) return; StructuredBlock ...
6d1c1fb6-f7e9-4769-9fb3-c2b695f6e391
8
@Override public Net.NetState computeState(Net net) { if (!initialized) { String fileName = "test_cases/" + name; File file = new File(fileName); file.delete(); try { out = new PrintStream(file); } catch (FileNotFoundException e) { throw new RuntimeException(); } out.println(pins.size())...
4c671e4c-b150-4436-acd7-cfff0b6ca6b9
8
public String[] check(String passage) { // No misspelled words for an empty string. if ((passage == null) || (passage.length() == 0)) { return null; } ArrayList errorList = new ArrayList(); // Tokenize the passage using spaces and punctionation. StringTokenizer st = new StringTokenizer(passage, " ,.!?;...