method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
e10654e1-cc3f-4cd7-beba-7e37fcb3409a
8
public int writeUTF(String str) throws UTFDataFormatException { int strlen = str.length(); int utflen = utfSizeOf(str); int c = 0; if (utflen > 65535) throw new UTFDataFormatException( "encoded string too long: " + utflen + " bytes"); //writeByte((byte) ((utflen >>> 8) & 0xFF)); //writeByte((byte...
206b95a0-ac53-4700-9aba-81137c1f7337
9
public void mouseReleased(MouseEvent e) { if (e.isPopupTrigger()) { MyPopupMenu.show(this,e.getX(),e.getY()); return; } if (ImgDragStarted) ImgDragStarted=false; if (myPanel.DraggedMarker != null) // successfully finished dragging { my3ddata.UpdateMarker(myPane...
d2edb499-833e-480f-a15f-10c7cbd03b30
0
public Query<T> skipWhile(Predicate<T> predicate) { return new Query<T>(new SkipWhileIterable(this._source, predicate)); }
59fbef0d-d0e2-4520-bbff-1229234ec26a
4
@Override public void read(String path) { long startTime = System.currentTimeMillis(); try { Scanner in = new Scanner(new FileReader(path)); rows = in.nextInt(); cols = in.nextInt(); in.useLocale(Locale.US); for (int i = 0; i < rows; i++...
7a3038cc-aec8-4c3b-bd34-b5df32ba932a
3
public final String generateUsage(CommandInvocation invocation, CommandDescriptor descriptor, String... labels) { List<String> labelList; if (labels != null && labels.length > 0) { labelList = Arrays.asList(labels); } else if (invocation == null) { ...
44477fae-a06f-4385-9166-601d8ed58f24
0
public static void int2byte3(int n, byte buf[], int offset) { //buf[offset] = (byte)(n >> 8); buf[offset] = (byte)n; }
9bb4e09c-987a-432e-a7b3-de0901bed279
8
void download(int arg){ //arg--; if(((arg-1)>=0 && (arg-1)<Connection.list_IP.size()) && Connection.list_IP.size()!=0) { System.out.println("Initiating download...please wait"); int proceed=1; if(downloadArg.contains(arg-1)) { long prev=Connection.download.get(arg-1); try { Thread.sleep(5...
0eca33eb-6d1a-4564-ab5e-de0a3cf4f29a
3
public boolean isEmpty(){ int i = 0; int i2 = 0; while(i < 32){ while(i2 < 32){ if(chunks[i][i2] != null)return false; i2++; } i2 = 0; i++; } return true; }
f9274c18-90af-4639-978d-e56256a714f2
9
public void fill(int n, int tx, int ty, int oldval, int newval) { int[][] map; map = maps.get(n).tiles; if (isTileInMap(tx, ty, map)) { // mark tiles as belonging to area map[ty][tx] = FILL_TEMP_VAL; boolean foundOne; do { foundOne = false; for (int xi = 0; xi < map[0].length; xi++) { f...
1ff8cdf3-efab-4397-9d2d-55baeeb66b5c
7
private void btSalvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btSalvarActionPerformed Fornecedor f = new Fornecedor(); if (!(txCodigo.getText().equals("")) || (txCodigo.getText().equals(null))){ f.setId_fornecedor(Integer.parseInt(txCodigo.getText())); } ...
b05ed8ec-0985-4347-a0df-5fc97710d699
5
@Override public void paint(Graphics graphics) { if (graph == null) return; Graphics2D g =(Graphics2D) graphics; g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON); Dimension d = getSize(); double xFact = d.width / (maxX - minX + x...
af59d6a5-6810-449f-935d-18d039f5b847
5
private TypeAdapter<?> getFieldAdapter(Gson gson, Field field, TypeToken<?> fieldType) { TypeAdapter<?> adapter = gson.getAdapter(fieldType); boolean generatedAdapter = Gson.$$Internal.isGeneratedTypeAdapter(gson, adapter); if (generatedAdapter && field.isAnnotationPresent(JsonAdapter.class)) { JsonAd...
6156626b-204b-46c8-b38d-ee954a5db37a
8
private String parserIn(final String message) { float resultat = 0; String id = null; if (message != null) { final String[] split = message.split(ProtocolCommandes.SEP .toString()); Operation operation = null; if (split.length >= 6) { int i = 0; id = split[i]; final String operande...
00d68d3c-ae2b-4558-8f10-1cf31f57dfd2
7
public static void rsaCrypterText(CryptobyConsole console) { scanner = new Scanner(System.in); do { System.out.println("\n"); System.out.println("RSA Text Cryption"); System.out.println("-----------------\n"); System.out.println("1 - Encryption and genera...
700e6805-885e-459a-8ef1-b3a6682f04d3
1
void addCapturedPlayerFlag(PlayerInfo playerInfo) { if (playerInfo == null) throw new IllegalArgumentException("The given playerInfo is invalid!"); capturedPlayerFlags.add(playerInfo); checkIfWon(); }
d94235b4-f82d-4d02-be70-4c690325d7f2
7
@Override public void keyTyped(KeyEvent keyEvent) { if (this.isActive()) { char c = keyEvent.getKeyChar(); String text = this.label.getText(); if (c > 31 && c != KeyEvent.VK_DELETE && text.length() < this.getSize()) { this.label.setText(text + c); ...
48668b46-9c89-4d18-a969-01fa6dc80628
0
public int fight() { return (int) this.getStrength(); }
f4512992-554a-4a3b-823e-38279069c59a
7
void placePiece(Space space, Piece piece) { if (!space.isValid()) { invalidMove = true; } else if (space.getPiece() == N) { space.setPiece(piece); invalidMove = false; } else { invalidMove = true; } if (!invalidMove) { lastSpaceMoved = space; if (piece == X) lastXMoved = lastSpaceMoved; ...
82aef2f7-adca-4e56-8145-1e5548d66e42
9
double calculatescore() { total = 0; for (int i = 0; i < seedlist.size(); i++) { double score; double chance = 0.0; double totaldis = 0.0; double difdis = 0.0; for (int j = 0; j < seedlist.size(); j++) { if (j != i) { totaldis = totaldis + Math.pow( distanceseed(seedlist.g...
110e72ed-adce-42ad-a64f-a9effe931825
5
public void run() { System.out.println("Catcher listening on port " + port_); Socket sock = null; done_ = false; try { ServerSocket ss = new ServerSocket(port_); ss.setSoTimeout(500); // milliseconds of timeout for (int i=60; i>0; i--) { if (done_) { ...
79144fe5-a661-42b1-81fe-7e160b0ee119
3
private void HandleWarp(PlayerCommandPreprocessEvent event, String[] args, Location warploc, String Cvalue) { Player p = event.getPlayer(); int Cost = parseLocation.getDistanceCost(p.getLocation(), warploc); if(Playerwarpdata.get(p) == null) { Messenger.playermessage("Warping to " + args[1] + " will cost " + C...
33d70fef-2cbd-486f-a315-f6b444fe0d46
0
public void removeBlackMarker(int markerNum) { // As red this.markersBlack[markerNum] = false; }
aa735382-1288-4b1f-9eba-4dfee5edf126
6
public static void main(String[] args) throws IOException { // TODO Auto-generated method stub String afile=args[0];//"/home/dharmesh/aditya/mallet-2.0.7/enage10.out"; String afile2=args[1];//"/home/dharmesh/aditya/mallet-2.0.7/enage20.out"; String afile3=args[2];//"/home/dharmesh/aditya/mallet-2.0.7/enage30.ou...
b692aceb-44a2-4266-b89e-a31fa6c5f0fb
7
public static void main(String[] args) { CmdOptions options = new CmdOptions(args); Command command = null; if(options.isConverter) { command = new ConvertCommand(); } else if(options.isParser) { command = new ParseCommand(); } else if(options.isLister) { command = new ListCommand(); } if(optio...
e9a29b3e-708f-479a-b135-01b217aa4da7
6
private void setLookAndFeel() { //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/...
1276c4d8-08a0-421a-a261-3e6f7ddad525
0
public Boolean isSupported() { return supported; }
31326db8-294e-4f32-9457-a0f21599cc8b
1
synchronized public static org.omg.CORBA.TypeCode type () { if (__typeCode == null) { __typeCode = org.omg.CORBA.ORB.init ().create_interface_tc (pgrid.service.corba.simulation.SimulationHandleHelper.id (), "SimulationHandle"); } return __typeCode; }
e802d9d0-e601-48f9-b380-93505ac21aed
0
@Basic @Column(name = "PRP_TERMINAL") public String getPrpTerminal() { return prpTerminal; }
f53ae3db-2b60-4562-8e91-47bb250d1241
1
public int getTotal() { int result = freqTable.getTotal(); if (result < 0) throw new IllegalStateException("Negative total frequency"); return result; }
e5ce67c8-9c54-4c3b-940e-4317dbfe4d26
1
private GenericDAO<Project> getProjectsDAO() { if (_projectsDAO == null) { _projectsDAO = new GenericDAO<Project>(Project.class); } return _projectsDAO; }
5fd32d15-2f58-4b07-8a1c-c7dcffa6d286
8
public void test(DistanceMetricMethod method, List<Instance> testInstances, File sysOutputFile, String dataType) throws IOException { Map<String, Frequency<String>> confusionMatrix = new HashMap<String, Frequency<String>>(); SysOutput output = new SysOutput(sysOutputFile); output.printHeader(dataType); fo...
23b1c852-9c45-4f8e-96f5-2332a703d923
2
public ConsoleCurrencyDialog() { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); while (currency == null) { System.out.println("Insert currency:"); String readCurrency = " "; try { readCurrency = reader.readLine(); ...
945fc573-6646-449b-8f23-e615a9459f12
3
boolean isRecordStart(byte buffer[], int idx) { int next = findNl(buffer, idx); // Find next line if (next < 0) return false; // Not found? => Fail // Did we find a '\n@'? => The previous one was NOT a record start next++; if ((next < buffer.length) && (buffer[next] != '@')) return true; return false; }
0906430a-8b2f-4052-9ef7-1e96241d4428
4
public boolean detonate(int x, int y) { // Fire trap keycode: 'F'. if (isTrap(x, y)) { // TODO // graphics.blowUp(x, y); // Check adjacent squares for chainable traps to detonate. for (int xOff = -1; xOff <= 1; x++) { for (int ...
7307b882-334e-4f15-9161-0ecfe1872ffa
4
@Test @DatabaseSetup(value="classpath:databaseEntries.xml", type=DatabaseOperation.CLEAN_INSERT) public void testListStudents() { List<StudentImpl> studentList = studentJT.listStudents(); assertEquals(2, studentList.size()); for(StudentImpl l : studentList){ String fn = l.getFirstName(); String ...
aece9250-c2c4-4baa-8ac3-ad2f54de1a30
1
private double good_bowl_score(int rest, int total) { System.out.println("Ex = " + bowl_expectation()); System.out.println("SD = " + bowl_SD()); double thresholdShift = 0.0; // choose different parameter setting // according to different bowlSize and number of players th...
fe83ad8c-c47b-4857-aff0-b63359fc96be
4
public void addFunction() { Class superClazz = SQLASTOutputVisitor.class; Method[] mms = superClazz.getDeclaredMethods(); for(Method method : mms) { if(method.getParameterTypes().length == 0) { continue; } System.out.print("public "); ...
18b291fa-6fdb-42a3-9370-b50a4edd7664
5
char[] getVersion( int version ) { Node temp = start; int len=0; while ( temp != null && temp != end ) { Arc a = temp.pickOutgoingArc( version ); len += a.dataLen(); temp = a.to; } char[] versionData = new char[len]; temp = start; int j = 0; while ( temp != null && temp != end ) { Arc a...
3f519998-2b57-4d02-b8a4-634d6b12282a
2
@Override public void render() { String textX = Double.toString(position.getX()); text.setAttribute("x", textX); text.setAttribute("y", Double.toString(position.getY())); NodeList lines = text.getElementsByTagName("tspan"); for (int i=0; i<lines.getLength(); i++) { Element line = (Element) lines.item(i); ...
0016aa63-3938-49db-aff0-de38a7df318e
3
@Override public void rotateXPlus() { if(orientation == X) return; //so it doesn't rotate orientation = (orientation == Y ? Z : Y); for(int i = 0; i < others.length; i++) { IntPoint p = others[i]; others[i] = new IntPoint(p.getX(), -p.getZ(), p.getY()); } }
edb3c6f2-25c5-431b-a24c-cef2adff6c17
1
private boolean jj_3_35() { if (jj_3R_52()) return true; return false; }
62bb603a-7144-45ee-b526-9b80eb06cd29
1
public void visitCastExpr(final CastExpr expr) { if (expr.expr == from) { expr.expr = (Expr) to; ((Expr) to).setParent(expr); } else { expr.visitChildren(this); } }
052c773e-279d-4234-948d-ff6f8b5882e2
6
void renderTilemap(final Bitmap tileMap) { // Finds the bounds (in world space) of the pixels that are both visible and are on the tile map final int startX = (xOffset < 0) ? 0 : xOffset; final int endX = (xOffset + imageWidth > tileMap.width<<tileSize) ? tileMap.width<<tileSize :imageWidth + xOffset; final...
ad79eead-49ea-48a2-a86e-ae266d2908db
2
public static String byteToString(byte[] byteArray) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < byteArray.length; i++) { String hex = Integer.toHexString(byteArray[i] & 0xFF); if (hex.length() == 1) { hex = '0' + hex; } sb.append(hex.toUpperCase()); } return sb.toString(); }
38ba48f9-5a5f-4656-8c2a-cd2784964ee5
1
@Override public void actionPerformed(ActionEvent e) { if (e.getSource().equals(ok)){ ajastinpaneeli.setAjastus(); } }
72dea4b2-2869-452d-af47-9edccfe354ad
9
public void markNode(Node current, boolean covered) { if (covered) { publish(new HighlightPoint(layer, current, coveredPoint)); cover.add(current); reachable.remove(current); //remove if present unreachable.remove(current); for (Node to : current.expan...
00d08556-ae7a-4bb8-96d2-2d6cdf05da52
8
private void selectBreach() { squareSelector.reset(); squareSelector.setCriteria(new SquareCriteria() { private final String desc = "Select: Breach"; public String getDescription() { return desc; } public boolean isSquareValid( SquareSelector squareSelector, int roomId, int squareId ) { if ( roomId <...
b8ca4fd2-4129-48a7-96f8-8e35bf2715d0
6
public static int getMaxArea(int[] histogram) { LinkedList<Integer> stack = new LinkedList<>(); int maxArea = 0; int i = 0; while(i < histogram.length) { if(stack.isEmpty() || histogram[stack.peek()] < histogram[i]) { stack.push(i++); } else { ...
20a78d96-4267-424a-a037-25243bd2ae2a
9
protected final boolean initTcp() { boolean successful = true; //if the custom reader/writer are null, create default boolean hasDataReader = this.dataReader != null; boolean hasDataWriter = this.dataWriter != null; if (!hasDataReader && !hasDataWriter) { ...
89a453c1-14a2-4e28-bf6e-939ce753b679
4
@Override public V put(K key, V value) { V oldValue = null; int index = Math.abs(key.hashCode()) % SIZE; if(buckets[index] == null) { buckets[index] = new ArrayList<MapEntry<K, V>>(); } ArrayList<MapEntry<K, V>> bucket = buckets[index]; MapEntry<K, V> pa...
0fc3f57e-4643-4de9-a47f-0ac366dc0f04
0
@Override public String getDesc() { return "Default"; }
9575e41d-c004-4188-a652-904d863de8a2
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...
9bbf065f-7187-4f06-ad6e-66bd50fb6600
7
protected void findRoomsByDesc(MOB mob, Enumeration<Room> rooms, List<Room> foundRooms, String srchStr, boolean returnFirst, long maxTime) { final long startTime=System.currentTimeMillis(); try { srchStr=srchStr.toUpperCase(); final boolean useTimer=maxTime>1; for(;rooms.hasMoreElements();) { fin...
f89556b3-a4f4-4b94-9342-b04754e3be6c
0
public TpServer(int port){ _port = port; _channels = new DefaultChannelGroup("ticket-pool"); }
6e2b6c57-9a37-4f4d-9bca-4a7353f20f4f
5
private void boutonDomaineDesMortMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_boutonDomaineDesMortMouseClicked // TODO add your handling code here: if (partie.getDm().isActif()) { if (!partie.getDieuActuel().isaJouerEnDomaineDesMorts() || ((partie.getDie...
9f3655b0-fd27-4595-b534-10e7d0a91bab
9
@SuppressWarnings("unchecked") private void loadTypes(HGHandleFactory handleFactory, ArrayList<String> L) { for (String line : L) { String [] A = line.split("\\s+"); HGPersistentHandle handle = handleFactory.makeHandle(A[0]); String typeClassName = A[1]; ...
e1c3e702-824c-4290-a37e-4c2b7833fe05
3
private void removeCheckersAt(int x, int y) { List<Checker> cList = getWorld().getObjectsAt(x, y, Checker.class); for(Checker c : cList) { if(c != null && c.team != this.team) { getWorld().removeObject(c); Greenfoot.playSound("coin-jump.wav"); } ...
df01e4d2-0ac2-4dc8-8c94-5566e8207538
8
public static String unquote(String s) { if (s==null) return null; if (s.length()<2) return s; char first=s.charAt(0); char last=s.charAt(s.length()-1); if (first!=last || (first!='"' && first!='\'')) return s; StringBuffe...
0e7c2058-6090-4d16-ae87-8a309e43246c
6
@Override public void train(List<Instance> instances) { // TODO Auto-generated method stub for (int i = 0 ; i < clustering_training_iterations ; i++) { int insIndex = 0; ArrayList <Integer> newAssignments = new ArrayList <Integer>(); for (Instance instance : instances) { // get the closest cluster. ...
e533d1da-6a36-4316-9fcf-7e57ede9df74
5
private void arrayString(J_PositionTrackingPushbackReader var1, J_JsonListener var2) throws J_InvalidSyntaxException, IOException { char var3 = (char)this.readNextNonWhitespaceChar(var1); if(var3 != 91) { throw new J_InvalidSyntaxException("Expected object to start with [ but got [" + var3 + "].", ...
6c39ce25-1430-49e7-9ef6-fc54bb0f6e8d
8
private static void runQueryOnClass(List<ConstraintViolation> results, Query arq, org.topbraid.spin.model.Query spinQuery, String label, Model model, Resource cls, Map<String,RDFNode> initialBindings, boolean thisUnbound, Resource source, List<SPINStatistics> stats, ProgressMonitor monitor, SPINModuleRegistry registry)...
f50da5f3-c112-4006-8179-a877cb282bd3
6
@Override public void visitFieldInsn(final int opcode, final String owner, final String name, final String desc) { if (opcode == PUTSTATIC && active && lastName != null && owner.equals(className) && desc.equals(classDescriptor) && name.equals(lastName)) { // Finish the current state machine active = false; ...
6ebb45ed-a27a-48f3-b8e9-0398f408accf
4
public String Ordenar (String pal, String pal2, String pal3, String pal4, String pal5){ for (int i = 0; i < pal.charAt(i); i++) { for (int j = 0; j < minusculas.length; j++) { if(pal!=pal2){ if(i==j){ ordenar=pal; } ...
3691d522-41c8-4bcc-a0b5-cc0ef1162716
8
public void renderBasicObjects() { for (BasicObject bo : basic) { int[] image = bo.getPixles(); for (int y = 0; y < bo.getHeight(); y++) { for (int x = 0; x < bo.getWidth(); x++) { if(x < 0 || x + bo.getX() > width-1 || y < 0 || y + bo.getY() > height-1)break; if (image[x + y * bo.getWi...
7aa6220f-85e1-44f5-8cb5-904f545d25f5
1
public static void main(String[] args) { Scanner s = new Scanner(System.in); System.out.print("Enter your integer here: "); int yourInt = s.nextInt(); int factorial = 1; for(int i = 1; i < yourInt; i++){ factorial += factorial * i; } ...
815f835e-a65a-4d9c-92ba-062acc6306ea
9
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub String checkFunc=request.getParameter("checkFunc"); HttpSession session = request.getSession(); if(checkFunc.equals("login")){ String username=request.g...
3fd5bf47-ff13-419b-ab42-88b0c32fc417
6
public ICodec getInstance() { if (iCodecClass == null) return null; Object o = null; try { o = iCodecClass.newInstance(); } catch (InstantiationException ie) { instantiationErrorMessage(); return null; } catch (IllegalAccessException iae) { instantiationErrorMessage(); return nul...
dd0702d3-c3db-4070-9bb9-5859d7c430c4
8
static final int get(Item type, Token token) { switch(token) { case PhysicCombat: switch(type) { case Shotgun: return 4; case Tommygun: return 6; case Axe: return 2; default: return 0; } case Hands: switch(type) { case Shotgun: case Tommygun: return 2; case Axe: retur...
b097d390-d1c6-4afb-a7d3-786fb0f764e7
2
public void drawLevel( Graphics g ) { int x = 0, y = 0; for ( String[] row : field ) { for ( String cell_name : row ) { g.drawImage( images.get( cell_name ), x, y, CELL_SIZE, CELL_SIZE, null); x += CELL_SIZE; } ...
8bd3de30-8a13-447c-9db4-4e67aca833e5
6
@EventHandler public void SilverfishHunger(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("Silverf...
0e7089b7-fef4-441b-9286-55d8201d4533
6
public org.icepdf.core.pobjects.actions.Action getAction() { Object tmp = library.getDictionary(entries, ACTION_KEY.getName()); // initial parse will likely have the action as a dictionary, so we // create the new action object on the fly. However it is also possible // that we are pars...
ff7b0f6f-c6f4-4e2d-8cb8-de07dc58735e
3
public static CMap createMap (short format, short language) { CMap outMap = null; switch (format) { case 0: // CMap format 0 - single byte codes outMap = new CMapFormat0 (language); break; case 4: // CMap format 4 - two byte encoding ...
22d591c8-3212-4eb9-81b8-efa73a51dc3b
6
public void acceder(String usuario, String pass){ String sql="SELECT * FROM usuarios WHERE usuario='"+usuario+"' && contraseña='"+pass+"' "; String cap=""; conectar cc = new conectar(); Connection cn = cc.conexion(); try { Statement st = cn.createSta...
bb5c6b0b-d448-41bd-9da5-9d0fe165271c
9
private void drawLine(int x1, int y1, int x2, int y2, int c) { if (x2 - x1 == 0) { for (int y = Math.min(y1, y2); y <= Math.max(y1, y2); y++) { drawPoint(x1, y, c); } } else { float m = (float) (y2 - y1) / (float...
58c07542-db3f-4550-8e0a-9434db8cc802
8
public static ItemStack makeItem(Material material, int count, String name, String lore1, String lore2, String lore3, Enchantment enchant1, int enchant1LV, Enchantment enchant2, int enchant2LV, Enchantment enchant3, int enchant3LV) { ItemStack is = new ItemStack(material, count); ItemMeta im = is.getItemMeta(...
c73d246e-de6c-476e-ab00-ed96fe232580
4
@Override public Boolean[] segment(Utterance utterance, boolean training, boolean trace) { // Get info about the utterance. Since the segmentation is a copy, // don't worry about modifying it Boolean[] segmentation = utterance.getBoundariesCopy(); String[] units = utterance.getUnits(); // Track probabilitie...
64403e5e-de04-4671-a7d0-50638e1eb04f
2
public boolean deletePrev(IntegerNode n){ if (this.next == null){ return false; } else if (this.next.n == n.n){ this.next = next.next; this.prev = prev.prev; return true; } else { return this.next.deletePrev(n); } }
69cd65ee-0006-4bdf-8d88-9e4fb0c267cc
5
public void unZip(){ byte[] buffer = new byte[1024]; try{ folder = new File(outputFolder); if(folder.exists()) { File [] fileList = folder.listFiles(); for(int i=0;i<fileList.length;i++) { fileList[i].delete(); } folder.delete(); } ...
3605b877-e242-43e2-833b-aa03b5b70f24
0
public synchronized String peekUnsearchList(){ final String url = this.unsearchSitesList.poll().toString(); return url; }
913663fa-ea78-4905-bb7b-bae670bef990
1
@Test public void generarEquiposPorHandicap() { System.out.println("******************************************"); System.out.println("ordenamiento por handicap"); List<Jugador> jugadores=partido1.ordenarEquipos(); for (Jugador jugador : jugadores) { System.out.println("Jugador: " + jugador + " - calificacio...
f9f2b884-9a53-4080-8727-ac1e3ccefa64
4
public Skill(String name, Tier tier, SkillType type) { super(name, tier, 0, 0, 0, "/res/skills/S_Fire05.png"); this.type = type; String texturePath = "/res/skills/"; switch (type) { case PROJECTILE: effectTexture = texturePath + "S_Fire05.png"; texturePath += "S_Fire05.png"; damage = 10; spe...
6abf60a6-69a6-4b61-8b8f-a18d0f269920
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...
16fdfb4d-dfc5-49c5-9ac1-fbace2128ac8
5
public void newSummonedNPC(int npcType, int x, int y, int heightLevel, int rangex1, int rangey1, int rangex2, int rangey2, int WalkingType, int HP, boolean Respawns, int summonedBy) { // first, search for a free slot int slot = -1; for (int i = 1; i < maxNPCs; i++) { if (npcs[i] == null) { slot = i; br...
5f60278a-732e-4084-931d-c18767db23a3
4
private void writeByte(int x) { assert x >= 0 && x < 256; // optimized if byte-aligned if (N == 0) { try { out.write(x); } catch (IOException e) { e.printStackTrace(); } return; } // otherwise write one bit at a time for (int i = 0; i...
13f87389-ea09-415f-97ed-d017a10055ed
7
public void setEntrada(int ren, int col, double valor) throws IndexOutOfBoundsException { if (indiceValido(ren, col)) { switch (tipocod) { case 1: mat[((col * (col + 1)) / 2) + ren] = valor; // sd break; case 2: mat[((col * (col - 1)) / 2) + r...
a6b4f6dd-a69f-453a-8f13-68ed4e1d0d94
4
public static void passivelyRequestGameObjectModels(Buffer stream, OnDemandFetcher onDemandFetcher) { start: { int objectId = -1; do { int objectIdOffset = stream.getSmartB(); if (objectIdOffset == 0) break start; objectId += objectIdOffset; GameObjectDefinition definition = GameObjectDe...
a036a341-4189-4303-ad04-a903213f4ee4
3
@Override public Object execute(HttpServletRequest request, HttpServletResponse response) throws Exception { Contexto oContexto = (Contexto) request.getAttribute("contexto"); switch (oContexto.getSearchingFor()) { case "usuario": { oContexto.setVista("jsp/usuario/list.jsp...
826d8136-ca5b-4962-9c08-b047bed7081c
8
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { MOB target=mob; if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB)) target=(MOB)givenTarget; if(target.fetchEffect(this.ID())!=null) { target.tell(L("The moonbeam is already with...
628e9a74-fcd2-469d-bedf-4c18d806be8a
9
protected void genWeaponRanges(MOB mob, Weapon W, int showNumber, int showFlag) throws IOException { if((showFlag>0)&&(showFlag!=showNumber)) return; mob.tell(L("@x1. Minimum/Maximum Ranges: @x2/@x3.",""+showNumber,""+W.minRange(),""+W.maxRange())); if((showFlag!=showNumber)&&(showFlag>-999)) return; f...
3dec9653-ee02-4aed-9fdb-7afc271dcd68
9
private RunAutomaton processChemicalGrammar(boolean reversed) throws IOException { XMLStreamReader reader = resourceGetter.getXMLStreamReader("regexes.xml"); Map<String, StringBuilder> regexDict = new HashMap<String, StringBuilder>(); Pattern matchRegexReplacement = Pattern.compile("%.*?%"); try { while (rea...
8724e618-9d99-4f78-88a7-20d8f17b0077
0
public void setKey(Object key) { this.key = key; }
d3060af3-9afc-4f36-a33c-f22be2436da5
5
private static ArrayList<Triangle> readList() { ArrayList<Triangle> torturn = null; FileInputStream fin = null; ObjectInputStream ois = null; try { fin = new FileInputStream("triangle.ser"); ois = new ObjectInputStream(fin); torturn = (Arra...
e5384cdb-f256-4510-b599-df12568c80c5
9
public boolean newerVersion(String version, String testv){ //You are testing if arg0 is higher than arg1 if(testSameVersion(version,testv)) return false; //if its the same version, its not new. String[] str1 = version.split("\\."); String[] str2 = testv.split("\\."); if(str1.length==3 && str2.length==3){ ...
572b96db-80d7-4ea3-b5b9-34efbcc741b3
5
public boolean isToggleEvent(MouseEvent event) { // NOTE: IsMetaDown always returns true for right-clicks on the Mac, so // toggle selection for left mouse buttons requires CMD key to be pressed, // but toggle for right mouse buttons requires CTRL to be pressed. return (event != null) ? ((mxUtils.IS_MAC) ? ((S...
1475d5e8-8d03-4008-9ee2-dc2afe6a90c1
5
public void printUtilities() { for(int i = 0; i < this.States.length; i++) { for(int j = 0; j < this.States[0].length; j++) { if(this.States[i][j].IsWall) { System.out.print("( WALL )"); }else if(this.States[i][j].GetReward() == 1 || this.States[i][j].GetReward() == -1) { System....
768549c2-f05e-4611-8838-ad108abf2aa9
3
private void createTSPFile(int dimension) throws IOException { FileWriter writer = new FileWriter(path, false); PrintWriter printer = new PrintWriter(writer); printer.printf("%s" + "%n", "NAME: " + path); printer.printf("%s" + "%n", "TYPE: TSP"); printer.printf("%s" + "%n", "...
e613af39-32e3-4631-ad45-a094da5450ba
6
private boolean verifyCurConf() { boolean blnOut = true; String strHostAddress = ((InetAddress) this.jcbLocalAddress.getSelectedItem()) .getHostAddress(); String strMcGroup = this.jtfdMcGroup.getText(); if ( ( strHostAddress.matches(EzimNetwork.regexpIPv4) && ! strMcGroup.matches(EzimNetwo...
e418b83c-2cc5-4a2f-ba6b-06f05d0c5918
6
public CellRange getCellRange() { for( Object subRec : subRecs ) { BiffRec br = (BiffRec) subRec; if( br.getOpcode() == SXVS ) { if( ((SxVS) br).getSourceType() != SxVS.TYPE_SHEET ) { log.error( "SXSTREAMID.getCellRange: Pivot Table Data Sources other than Sheet are not supported" ); re...
224f27f7-bbd7-4afe-823d-b77caf15f136
8
public double[] distributionForInstance(Instance instance) throws Exception { if (!m_isLeaf) { // value of split attribute is missing if (instance.isMissing(m_Attribute)) { double[] returnedDist = new double[m_ClassProbs.length]; for (int i = 0; i < m_Successors.length; i++) { double[] help = ...
2986bc9b-ae6a-4920-9c57-ecfb1ef2c303
4
public static void yesOrNo() { Console console = System.console(); String input = console.readLine("type Y to confirm or N to exit:"); if(input.contains("Y")||input.contains("y")) { TracksList.writeImages(); }else if(input.contains("N")||input.contains("n")) { System.exit(0); }else { System.ou...