method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
81dea93e-09f7-487d-a33b-296bbc4fbd83
1
public AdminClient() { this.getContentPane().setPreferredSize(new Dimension(width, height)); this.setBackground(Color.BLACK); if(System.getProperty("os.name").startsWith("Mac")) { System.setProperty("apple.laf.useScreenMenuBar", "true"); acceleratorKey = ActionEvent.META_MASK; } else { accelerato...
051aab19-b357-4b6a-97cc-51a64ca0e02a
3
protected boolean isImageFlavor(DataFlavor flavor) { int nFlavors = (imageFlavors != null) ? imageFlavors.length : 0; for (int i = 0; i < nFlavors; i++) { if (imageFlavors[i].equals(flavor)) { return true; } } return false; }
baf80289-af26-4ce8-8f6c-29183c9db524
6
public void getInput() { if (Keyboard.isKeyDown(Keyboard.KEY_W) || Keyboard.isKeyDown(Keyboard.KEY_UP)) { if (player.yPos < ((Display.getHeight() - topWall.getSizeY()) - player.sizeY)) player.move(1); } else if (Keyboard.isKeyDown(Keyboard.KEY_S) || Keyboard.isKeyDown(Keyboar...
08adab29-c968-4a31-9386-efe5a1cb8407
3
@Test public void getMaxDiagonal2Product() { String expected = "[0, 0][1, 1] [0, 1][1, 2] [1, 0][2, 1] [1, 1][2, 2] "; int numbers = 2; String actual = ""; for (int x = 0; x + numbers <= DATA.length; x++) { for (int y = 0; y + numbers <= DATA.length; y++) { ...
c8371e74-6b2e-4fba-82c4-3c254bf0d06b
9
public void close () { Connection[] connections = this.connections; if (INFO && connections.length > 0) info("kryonet", "Closing server connections..."); for (int i = 0, n = connections.length; i < n; i++) connections[i].close(); connections = new Connection[0]; ServerSocketChannel serverChannel = this.se...
649d4897-4a97-428b-bd7f-da662c674b27
2
private ArrayList<Integer> factor(long n) { ArrayList<Integer> ret = new ArrayList<>(); int i = 0; while (n > 1) { int prime = nthPrime(i); while (n % prime == 0) { ret.add(prime); n /= prime; } ++i; } ...
dd729559-190b-4c85-81f5-eafdb8f24994
1
public void keyPressed(KeyEvent e) { if (e.getKeyCode() == 10) { setVisible(false); } }
adf4869a-d7d3-4463-960a-6e9a8dac1f7b
3
public void deleteElement(int value) { ListElement current = head.next; ListElement previous = head; if (previous.value == value) { head = head.next; count--; } else { while (current != tail.next) { if (current.value == value) { ...
42e5114b-639f-467d-a1ea-20b1cdfb37c2
9
public void move(Room r, int deltaTime) { if (tl.isLocked() == false) { randomizeDirection(); } switch (getDirection()) { case LEFT: if (moveX(-1, r, false, deltaTime) == -1) { randomizeDirection(); } break; case RIGHT: if (moveX(1, r, true, deltaTime) == -1) { randomizeDirection(); ...
60f502f7-e18a-4d80-9814-bb0475e61d9c
8
public static void dcopy_f77 (int n, double dx[], int incx, double dy[], int incy) { double dtemp; int i,ix,iy,m; if (n <= 0) return; if ((incx == 1) && (incy == 1)) { // both increments equal to 1 m = n%7; for (i = 1; i <= m; i++) { d...
b0a043fc-7128-465a-b498-565ecb45e42b
7
public boolean isImpassable(Position position, double radius) { double step = 0.1 * radius; //scale = meter per pixel => row&column = pixels double startRow = (position.getY() - radius); double startColumn = (position.getX() - radius); double endRow = (position.getY() + radius); double endColumn = (position...
8cb04927-e976-4f12-9b72-d9e841fe4417
8
public static void main(String[] args) { int contCandidate = 0, contEntry = 0, contReserved = 0, contReject = 0, contDisputed = 0, contEqual = 0; String last = ""; try { File csvData = new File("dataset/bas...
2ddbd56a-d829-44ad-84ad-f86d9cc52668
0
public static void main(String[] args) { Node1 node1 = new Node1("node1"); Node1 node2 = new Node1("node2"); Node1 node3 = new Node1("node3"); node1.next = node2; node2.previous = node1; node2.next = node3; node3.previous = node2; node3.next = node1; node1.previous = node3; System.out....
65f4d127-29c0-4b7f-9d89-d05619a2b23e
1
public boolean encryptSerializedTable(){ //In a real world application, we could use a smartcard as the source of the pass, this is a just a proof of concept String smartcard="verysecurepassword"; try { File f = new File(TABLE_FILE); File fe = new File(ENCRYPTED_TABLE_FILE); f.createNewFile(); f...
9bd5e73b-2fb6-4286-9b74-6c508bc34994
2
public void addParticleEffect(String effectName, ParticleEffect effect) { if (effectName == null || effect == null) { throw new IllegalArgumentException("Cannot add a null ParticleEffect!"); } particleEffects.put(effectName, effect); }
1372371e-5325-4184-8fde-ba91a377922e
1
public AnnotationVisitor visitAnnotationDefault() { if (!ClassReader.ANNOTATIONS) { return null; } annd = new ByteVector(); return new AnnotationWriter(cw, false, annd, null, 0); }
e16892a1-4007-4545-a304-48c8dca46bc4
2
public ArrayList<Ticket> getTicket(Ticket tic_in) throws SQLException{ Statement stm = getConnection().createStatement(); String campos = "id,pnr,num_file,ticket,old_ticket,cod_emd,convert(varchar, fecha_emision, 103) as fecha_emisionb,convert(varchar, fecha_anula, 103) as fecha_anula ,convert(varchar, ...
50644ac4-4674-434c-91c9-ceb2c8785acf
5
public Edge getEdge(int i) { Edge retval; if (i < 0 || i > 5) throw new IllegalArgumentException( "Requested hex edge must be in range [0,5], was " + i); else if (myEdge[i] != null) { retval = myEdge[i]; } else { Edge cur; boo...
4f350fbc-d781-4c5a-a307-1890e02ef43b
9
private int maxLength() { HashMap <Integer,Integer> lengths = new HashMap<Integer,Integer>(); SimpleQueue<Node> queue = new SimpleQueue<Node>(); HashSet<Node> printed = new HashSet<Node>(); queue.add( start ); while ( !queue.isEmpty() ) { Node node = queue.poll(); ListIterator<Arc> iter = node.outgoi...
ed4d7d86-64db-48ef-9ce4-1e9be2540fbe
2
public int getPriParkChargeByPID(Statement statement,String PID)//根据PID获取优惠后停车费用 { int result = -1; sql = "select priparkcharge from Park where PID = '" + PID +"'"; try { ResultSet rs = statement.executeQuery(sql); while (rs.next()) { result = rs.getInt("priparkcharge"); } } catch (SQLExcept...
ee1fc103-fd86-47bd-b892-5349e4b60710
2
public static void botones(int valor){ switch(valor){ case 1: Interfaz.delD.setEnabled(true); Interfaz.bajar.setEnabled(false); Interfaz.del.setEnabled(false); break; case 2: Interfaz.delD.setEnabled(false); ...
6692331f-43c7-41cf-afe5-706fed4be001
7
public void stopNPCGather(Player p) { if (registry.getGameController().multiplayerMode != registry.getGameController().multiplayerMode.CLIENT) { Resource resource = null; try { for (String key : resources.keySet()) { resource = (Resource) resources.get...
683b90b1-a4fd-4dc0-a502-37c4e391d1b0
7
public void loadArenas() { XMLConfig arenaConfig = new XMLConfig("plugins/lmsArenas.xml"); XMLNode node = arenaConfig.getRootNode(); if (!node.nodeExists("defaults")) { XMLNode defaults = new XMLNode("defaults"); XMLNode cubePadding = new XMLNode("option"); cubePadding.addAttribute("name", "cubePadding")...
310daa0a-4a65-4bb4-8d38-c5592a914e5b
4
@Override public void execute() { String msg = Widgets.get(13, 28).getText(); if (msg.contains("FIRST")) { Widgets.get(13, Character.getNumericValue(Settings.pin[0]) + 6).click(true); Task.sleep(750, 1200); } if (msg.contains("SECOND")) { Widgets.get(13, Character.getNumericValue...
ebc25194-97d0-4037-8aff-83e8539e8c3e
3
public static void main(String[] args) { try { Display.setDisplayMode(new DisplayMode(800, 600)); Display.create(); Display.setTitle("TWL Login Panel Demo"); Display.setVSyncEnabled(true); TestGui demo = new TestGui(); LWJGLRe...
561ff012-0c6b-4556-98f1-237f4269d42f
8
public static HashSet<Point> getAnthillPoints() { /* * The first part of the algorithm traces the outline of a hexagon on * the grid */ // Pull out side length int sideLength = AntGame.CONFIG.CONTEST_MAP_ANTHILL_SIDE_LENGTH; // Height of hexagon = (2n - 1) where n = side length int height = ( 2 ...
14dd84c1-236e-4cec-85dc-cbf2cd02d56b
1
public ArrayList<String> lista() throws RemoteException, NenhumServidorDisponivelException { ArrayList<String> list = new ArrayList<String>(); Set<String> objs = objects.keySet(); //Add all object names into 'list' for(String s: objs) { list.add(s); } return list; }
3b0d2e26-53f2-411e-b853-5b839652deb2
2
public static void endAllWithName(String name){ for(ScheduleData data : schedules){ if(data.getName().equalsIgnoreCase(name)) endSchedule(data.getScheduleID()); } }
6ba1a34c-fe25-4668-a9bb-cdaed049382a
4
void a1(int p1, int p2) { boolean invite = false; if (p1 + p2 > 120 || p1 + p2 < 15 || p1 > 85 || p2 > 85) { invite = true; } }
752483cf-2480-4c75-ad4e-e03493232f8a
2
public static int readInt() { String line = null; int value = 0; try { BufferedReader is = new BufferedReader(new InputStreamReader( System.in)); line = is.readLine(); value = Integer.parseInt(line); } catch (NumberFormatException e...
28378270-47eb-4d92-beec-9f414407fc85
8
public void displayRoomInfo(Player player) { RoomType roomType = grid[player.getLocationX()][player.getLocationY()] .getRoomType(); if (roomType.equals(RoomType.entrance)) { System.out .println("This is the entrance. You leaving already? Head inside!"); ...
2f002e15-d1c5-445e-b524-02e210c145dd
8
private static String treat(final String line) { int cpt = 0; int cpt2 = line.length() - 1; char prov; //System.out.println(line); prov = line.charAt(cpt); while ((prov == ' ' || prov == '\t') && cpt != cpt2) { prov = line.charAt(++cpt); } ...
be93f7ae-3955-4900-a5f3-610f790f9f98
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 feel. * For details see http://down...
eb35f50a-8328-4829-a4d1-3a7dea178f3c
2
private void setImage(String name) { BufferedImage im = registry.getImageLoader().getImage(name); if (im != null) { AffineTransform tx = null; AffineTransformOp op = null; if (direction == Direction.LEFT) { //rotate the image based on where you're sho...
53323b45-4090-4a6d-82a7-4b3f54e02737
1
public void draw(GOut g) { super.draw(g); if(busy) { g.chcolor(busycolor); g.frect(Coord.z, sz); g.chcolor(); } }
27b0e0a8-61cf-469f-9dd9-01536dcc24d6
5
public static void savePomo() throws DataFileNotFoundException { File dataStore = new File("PomoData"); try { if(dataStore.exists()) { String line; FileReader fileReader = new FileReader(dataStore); BufferedReader bufferedReader = new Buffered...
19a05577-227e-421f-9577-d7539b0c15fb
5
public boolean onCommand(Player player, String[] args) { File fichier_language = new File(OneInTheChamber.instance.getDataFolder() + File.separator + "Language.yml"); FileConfiguration Language = YamlConfiguration.loadConfiguration(fichier_language); if(player.hasPermission(getPermission())){ if(args.length ...
2eeea8b4-f765-4898-a054-b8e7e10854a3
7
@Override public void update(float dt) { if (speed.x > 0) { speed.x -= drag; } else if (speed.x < 0) { speed.x += drag; } if (Math.abs(speed.x) <= drag / 2f) { speed.x = 0; } speed.y -= universe.gravity; if (Math.abs(spee...
459600c4-9875-4a5a-bfb9-3b7cbae4ebb1
8
private static Integer createPostingList(long featureId, StringTokenizer tokenizer, File postingFile, File compressedPostingFile) { TreeMap<Integer, Integer> postingInput = new TreeMap<Integer, Integer>(); BasicPostingList posting = new BasicPostingList(featureId); CompressedPostingList compressedPosting = n...
d1940984-d86e-45c3-86ad-51fe14e01baf
3
public int posMax() { int MaxValPos = -1; //position of maximum value char MaxVal; //maximum value char []SeqArray; //array of chars for looping through if(SeqValue.length() == 0) //if sequence is empty return MaxValPos; SeqArray= SeqValue.toCharArray(); MaxVal = SeqArray[0]; //...
8cddd4b5-fb71-4e08-81d1-6b3814706015
0
public HandlerList getHandlers() { return handlers; }
3a93277d-a415-4deb-96f1-893b37c1e58b
3
private void isGreaterThanEqualsToDate(Date param, Object value) { if (value instanceof Date) { if (!(param.after((Date) value) || param.equals(value))) { throw new IllegalStateException("Given Date does not lie after the supplied date."); } } else { throw new IllegalArgumentException(); } }
428c76b4-52c4-44f5-82db-262f09c4846c
7
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ProcDescriptor other = (ProcDescriptor) obj; if (labelInAssembler != other.labelInAssembler) return false; if (lokal == null) { if (other...
05032a3d-8992-4c9b-b75b-3968b14693ff
3
void iterateArrayList() { try { System.out.println("starting iterate"); Iterator b= al.iterator(); while(b.hasNext()) { try { Thread.sleep(5000); b.next(); } catch (InterruptedException e) { System.out.println(e); } } System.out.println("ending iterate"); }...
f375706c-64a7-4dd1-ac11-bb6a2d73cc59
4
public void putScenery(Scenery scenery, int x, int y) { if ((x < width && y < height) && (x >= 0 && y >= 0)) { data[y][x] = scenery; } else { throw new AssertionError("placed a scenery off the map"); } }
6051cc9b-6a4d-4483-9811-d239688f2c5c
5
public boolean subsEquals(Operator other) { if (this == other) return true; if (other.subExpressions == null) return (subExpressions == null); if (subExpressions.length != other.subExpressions.length) return false; for (int i = 0; i < subExpressions.length; i++) { if (!subExpressions[i].equals(oth...
f2577d03-39ba-4f9c-9b43-48b4acc79db2
7
final private boolean jj_3R_95() { if (jj_3R_42()) return true; Token xsp; xsp = jj_scanpos; if (jj_3R_130()) { jj_scanpos = xsp; if (jj_3R_131()) return true; } if (jj_3R_44()) return true; xsp = jj_scanpos; if (jj_3R_180()) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_3R_...
cb7f9e46-84a5-40e4-8c13-409c69c17601
3
private boolean isWinner() { Player[][] locations = this.board.getBoardLocations(); for (int row = 0; row < locations.length; row++) { Player[] rowLocations = locations[row]; for (int col = 0; col < rowLocations.length; col++) { if (fourInARow(row, col, location...
6dc7a9b6-5675-405b-b8b7-1578153d0db2
4
public static void main(String[] args) { ExecutorService exec = Executors.newCachedThreadPool(); ArrayList<Future<String>> results = new ArrayList<Future<String>>(); for (int i = 0; i < 10; i++) results.add(exec.submit(new TaskWithResult(i))); for (Future<String> fs : results...
232cb75a-03d1-463a-b8a1-15f82ba8289d
7
public static File getAppDir(String dirname) { String s = System.getProperty("user.home", "."); File file; switch (getOs()) { case linux: case solaris: file = new File(s, "." + dirname + '/'); break; case windows: String s1 = System.getenv("APPDATA"); if (s1 != null) { file = new ...
28fe98d9-09b8-4b19-bbab-657731272c30
5
@Override public void motorsCommand(boolean sideBrush, boolean sideBrushClockwise, boolean mainBrush, boolean mainBrushOutward, boolean vacuum) throws RoombaIFException { checkIsOpened("driveCommand"); byte d = 0; d += ((sideBrush) ? 0 : 1); d += ((vacuum) ? 0...
15c1ea02-9d9e-4df0-a903-fc0d25f8bee0
5
String getMissingChannelsMsg() { if (MissingChannels.isEmpty()) { return null; } String msg = null; if (MissingChannels.size() == 1) { msg = "Channel " + MissingChannels.first() + " is"; } else { msg = "Channels "; for (Integer i : MissingChannels) { if (i == MissingChannels.last()) ...
b0679071-0f7d-4949-8b02-2053fddde6a0
8
public void extendTreeHeight() { //build the alloweChars array String[] allowedChars = new String[Oracle.allowedChars.length - globalPrefix.length()]; int index = 0; for (String e : Oracle.allowedChars) { if (!globalPrefix.contains(e)) { allowedChars[index++] ...
b494e862-7c33-43f9-8b90-989bd2485690
4
protected static String getListTagForString(String str) { char chr = str.charAt(0); switch (chr) { case '#': return "ol"; case '*': return "ul"; case ':': case ';': return "dl"; } return null;...
b6396967-22eb-47ee-a5dc-2e66cfce4ab1
5
public void update(int delta) { if(switchedWaypoints) { if(targetWaypoint == null) { //done finished = true; return; } else { //recalculate dx and dy float diffX, diffY; diffX = targetWaypoint.getX() - this.x; diffY = targetWaypoint.getY() - this.y; float magnitude = (float)Ma...
8705bbb9-e738-4891-a369-9e9cc1cc7813
8
public static final void main( String[] args ) throws Exception { try { String output_file = "mets.zip"; String metadata_file = "metadata.txt"; Vector input_filenames = new Vector(); Vector input_filetypes = new Vector(); Vector archive_filenames = new Vector(); Hashtable metadata = new Hashtable(); for( in...
b10e3863-a80a-4cb8-aa58-521caf230992
8
private void jButton_ExchangeActionPerformed1(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_ExchangeActionPerformed1 try { if(true){ JOptionPane.showMessageDialog(null, "Exchange is currently not supported","Error",JOptionPane.ERROR_MESSAGE); return; ...
d8f85d6a-789e-4a7f-8982-00137ee4348a
9
public static AbstractEvent parse(ObjectNode node) { final String method = node.get("method").getTextValue(); final ObjectNode params = (ObjectNode)node.get("params"); if (method.equals(PlayerEvent.Play.METHOD)) { return new PlayerEvent.Play(params); } else if (method.equals(PlayerEvent.Pause.METHOD)) { r...
5fc4499b-7936-4823-9bc3-3c952e551407
8
public Shell[] getShells() { checkWidget(); int count = 0; Shell[] shells = display.getShells(); for (int i = 0; i < shells.length; i++) { Control shell = shells[i]; do { shell = shell.getParent(); } while (shell != null && shell != this); if (shell == this) count++; } int index = 0; S...
a52b63e4-b042-4103-ad3b-c1ef07168cc2
8
public void uploadImage(){ try { //Print out the image path when debugging if(debug){ System.out.println("Image path: "+image_path); } //Initialize the string name to null String fileName =""; //Get the file na...
ae648520-47de-478d-bd1e-790a29184c99
6
public String getMobName(LivingEntity entity) { if (showMobName) { String name = entity.getCustomName(); if (name != null) return name; if (entity instanceof Player) return ((Player) entity).getName(); } if (showAbilitySetName && MMComponent.getAbilities().isEnabled()) { String name = Abi...
7b0f38de-567f-443a-821a-17593c2a3391
5
private synchronized void dropPacketFIFO(Packet pnp) { // If the queue is full, we have to drop a packet, giving priority to the control packets // Control packets will be those packets sent between the broker or the GIS. // Normal packets are those belonging to a gridlet. // Control...
c3694ca1-1d38-492d-926e-ee666a12e7b5
4
@Override public void run() { while (!stopped && worker.isAlive()) { int nextLen = list.size(); if (lastLen != nextLen) { model.refreshDisplay(lastLen); lastLen = nextLen; } try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } model.refreshDispla...
c2bcbd9d-0c96-48ce-9e3e-8ea778c7c2bb
5
@Test public void testServerSetQueueTimeoutErrorIndividualHashEx() { LOGGER.log(Level.INFO, "----- STARTING TEST testServerSetQueueTimeoutErrorIndividualHashEx -----"); boolean exception_other = false; String client_hash = ""; try { server2.setUseMessageQueues(true); ...
5c659fec-a51d-485b-afe9-0398f5b418e5
3
public void zipIt(String zipFile) { byte[] buffer = new byte[1024]; try { FileOutputStream fos = new FileOutputStream(zipFile); ZipOutputStream zos = new ZipOutputStream(fos); System.out.println("[ZIP] Output to Zip : " + zipFile); for (String file : this.fileList) { //System.out.println("[ZIP] Fi...
a4116a16-2aad-4c3e-87ae-34c4e545b5ad
6
public void checkReproduce() { int currFishsSize = fishies.size(); //you may want to add additional new baby reproduction limits for (int i = 0; i < currFishsSize; i++) { for (int j = i + 1; j < currFishsSize; j++) { //don't want double reproduction if (fi...
29270dea-793f-4821-9f97-97bcecb9719d
9
public void exportItems(EDCHARACTER edCharakter, File outFile) throws IOException { CharacterContainer character = new CharacterContainer(edCharakter); PrintStream out = new PrintStream(new FileOutputStream(outFile), false, encoding); int pursecounter=0; String[] header = {"Name","Location","Weight","In Use","K...
001e05bc-549e-4123-952e-731bfb7c6795
8
@Override public BasicValue naryOperation(AbstractInsnNode insn, List<? extends BasicValue> values) throws AnalyzerException { BasicValue value = super.naryOperation(insn, values); int opcode = insn.getOpcode(); if (opcode == Opcodes.INVOKESTATIC && isClassBox(((MethodInsnN...
79efc248-6072-47d8-848a-84a350257ee8
2
public static boolean isFactorial(int n) { int i, j; i=1; j=1; do { if (i==n) return true; j++; i = i*j; } while (i<=n); return false; }
2acac7a0-7afa-4c52-8f8b-cb4b4e9e181a
8
public static int angleFromDirection(Utility.Direction direction){ switch(direction){ case NORTH: return 0; case NORTHEAST: return 45; case EAST: return 90; case SOUTHEAST: return 135; cas...
4f16d096-5160-461b-aaff-124f57a39766
2
public float getY(float x) { if (isVertical) { return Float.NaN; } else if (isHorizontal) { return value; } else { return this.k * x + b; } }
dfe5d4d5-f0dc-4219-ae71-8c33e918329f
9
private String getLine(int index) { // get the line that contains input[index]. Assume input[index] is at a // token, not // a white space or newline int i; if (input.length <= 1) { return ""; } i = index; if (i <= 0) { i = 1; ...
2a6fba68-5feb-4db5-9dbd-169bef65bb13
4
@Override public boolean containsAll(Collection<?> c) { Iterator<?> iterator = c.iterator(); while (iterator.hasNext()) { if (!contains(iterator.next())) { return false; } } return true; }
625584d7-1a1a-4d67-8b1a-3c58a502aa3f
3
public void remove(int id) throws SQLException { Session session = null; try { session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); session.delete(this.getById(id)); session.getTransaction().commit(); } catch (Exce...
78571d25-30c3-4564-9841-c52629deef7d
5
private void boutonMondeDesTenebresMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_boutonMondeDesTenebresMouseClicked // TODO add your handling code here: if (partie.getMdt().isActif()) { if (!partie.getDieuActuel().isaJouerEnMondeDesTenebres() || ((partie....
526b25f6-1e0a-4017-9faa-b430bb962783
1
private void loadImage(String path) { try { Image img = new Image(path); img.setFilter(Image.FILTER_NEAREST); spriteSheet = new SpriteSheet(img, x, y); } catch (SlickException e) { System.out.println("Cannot find Image for SpriteMap!...or maybe there's a ...
002f0863-9692-47c8-b80d-ad34de6ac2cd
9
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final Set<MOB> h=properTargets(mob,givenTarget,false); if(h==null) { mob.tell(L("There doesn't appear to be anyone here worth speeding up.")); return false; } if(!super.invoke(mob,comman...
2a319549-18c4-4928-850e-3a890e93deb2
7
private static Map<String, Field> commontField(Cg cg, Map<String, Field> fieldMap){ Pattern commentPattern = Pattern.compile("\\s*COMMENT\\s+?ON\\s+?COLUMN\\s+?.*\\.(.*) IS '(.*)'\\s*;"); String tableSql = formartSql(cg.getTableSql()); String[] temps=tableSql.split("\r|\n"); List<String> tempList = new Array...
6f9e7612-0ff7-4600-8841-49219cf0ef9d
0
private void writeObject(ObjectOutputStream stream) throws IOException { stream.defaultWriteObject(); stream.writeObject(execCommand); stream.writeObject(remoteCallObjectType); }
ae468ec7-79f3-49b0-b706-575e4d2667d0
4
@Override public void run() { ResultSet ids = GetCitedIDS(); String insert = "insert into citedList(paperid,citedlist) values(?,?)"; int num = 0; try { PreparedStatement statement = sqLconnection.conn .prepareStatement(insert); while (ids.next()) { int id = ids.getInt("citationid"); if(!isID...
cccc856f-f117-4ac1-a89e-0a726bb786ad
2
public void deleteItem(int slot) { if(slot >= 0 && slot < items.length) items[slot] = null; }
9af76934-4880-4f5e-8d2d-6ba61b0a1e57
7
public void setSID(int sid) { switch (sid) { case RESID_6581: case RESID_8580: if (!(sidChip instanceof RESIDChip)) { if (sidChip != null) sidChip.stop(); sidChip = new RESIDChip(cpu, audioDriver); } ((RESIDChip) sidChip).setChipVersion(sid); break; case JACSID: if...
7072a6c5-cd3b-4bcb-8d81-6e4911111aee
4
@Override public ArrayList<STTPoint> getWrappedData() { ArrayList<STTPoint> pointList = new ArrayList<STTPoint>(); try{ URL url = new URL(getWrapperParams().getSource()); BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream())); String fileLine; whil...
f3993324-5329-41e2-b75c-c2be70aaaa11
0
public static void main(String[] args) { new Run(); }
129295d8-5b15-4158-9941-f283286682b5
2
public Item dequeue() { if (isEmpty()) throw new NoSuchElementException(); if (size() < N / 2) q = resize(N / 2); // Remove from the front. Item t = q[front]; front = (front + 1) % N; nItems--; return t; }
272ccf9b-9251-404d-ba62-f22de2c18328
5
@Override public final void mouseReleased(final MouseEvent e) { synchronized (this.abcMapPlugin.state) { if (this.abcMapPlugin.state.loadingMap) { return; } while (this.abcMapPlugin.state.running) { try { this.abcMapPlugin.state.wait(); } catch (final InterruptedException ie) { ie.prin...
a3217498-c87c-4fe8-9bc8-bb8933e38c19
0
public void giveWarning(Account account){ account.giveWarning(); }
f33a3b12-7d64-4ba1-95a7-02cf83d997f3
1
@Test public void branchInstrInvalidFormatSKZ() { //Tests SKZ won't accept fields try { instr = new BranchInstr(Opcode.SKZ, 70); } catch (IllegalStateException e) { System.out.println(e.getMessage()); } assertNull(instr); //Instruction should not be instantiated with invalid arguments }
b8c7c3f3-1848-4329-8eb0-16d761503bba
1
public static ArrayList<QuizTakenAchievement> getAllAchievements() { if (allAchievements.isEmpty()) loadAllAchievements(); return allAchievements; }
06eda4f0-f7a7-4c1a-ad94-d2b72abe2163
0
public Dictionary(String path) { this.path = path; this.trie = new Trie(); this.sortedTrie = new Trie(); }
9e2c807d-a24a-40d3-8d7f-7bf7a2ec2615
1
private void fireIOException(IOException ioe) { for (PeerActivityListener listener : this.listeners) { listener.handleIOException(this, ioe); } }
8abf5fca-d8cf-49e2-ac19-28f05165471a
8
public void simulateOneStep() { Random randomgetal = new Random(); step++; if(randomgetal.nextDouble() <= getHunterCreationProb()) { createHunter(); } createHunter(); // Provide space for newborn animals. List<Actor> newActors = new Array...
d0c108fe-6b0a-4dc3-9685-fb9bebe5e399
2
private static Integer getNextInstanceOfNegation(LinkedList<Token> tokens, int startingAtIndex) { for(int i=startingAtIndex; i<tokens.size();i++) { Token t = tokens.get(i); if(t.getUnderlyingObject()==Operation.NEGATION) { return i; } } return null; }
0476d5b2-d222-4844-986c-dd8af854601a
1
private void readbuttonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_readbuttonMouseClicked // TODO add your handling code here: int address=dec.NumberParser(readaddress.getText()); if(address!=-100000){ readvalue.setText(""+mm.readMemory(address)); reada...
a9f67adb-227a-4b25-b5e1-523e19f35ba9
1
public boolean equals(Object configuration) { Configuration config = (Configuration) configuration; if (parent != config.parent) return false; return config.myCurrentState == myCurrentState; }
672d8d81-6752-4498-bc4d-d2dde62ac207
5
public double calculateProbability(String s) { int stringLength = s.length(); double probability = 1; for (int i = 0; i < stringLength; i++) { Character character = s.charAt(i); switch (character) { case 'A': probability = probability ...
22a219eb-e812-45cc-ad03-8468c346b1ce
8
@Override public Problem parse(String URL) throws ParserException, InterruptedException { URL = URL.trim(); FilterBean fb = new FilterBean(); fb.setURL(URL); // extract problem name fb.setFilters(new NodeFilter[] { new CssSelectorNodeFilter("div...
0dead3d8-78cb-4eb7-9356-cc5d4cbf4114
1
public void visit_ifnull(final Instruction inst) { stackHeight -= 1; if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } }
63d887b1-8611-4b37-a684-5ff0c1df27a1
0
@Before public void setUp() throws Exception { createInjector( new QuartzModule() { @Override protected void schedule() { scheduleJob( TimedTask.class ); } } ).getMembersInjector( GuartzTimerTestCase.class ).inject...
b981868e-dcc6-45b1-9832-f9b411dcf771
5
public String toString() { String res = this.a==0? "": ""+this.a; switch(this.b) { case 0: return res; case 1: return res + "+w"; case -1: return res + "-w"; default: return res + (this.b>0? "+": "") + this.b + "w"; } }