method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
df0a4b2a-e8c3-4bb4-8a09-9cc3e23fbfd0
0
public static void main(String[] args) { // TODO code application logic here //dit werkt }
9707dac4-c688-4505-8721-eecf38116e70
5
public static void copySignLine(Player p, String line) { if (line == null) { copyLineEnabled = false; copiedLine = 0; copiedTextLine = null; MessageManager.getInstance().info(p, t.get("t_disabledSignLineCopy")); return; } int l = 0; try { l = Integer.parseInt(line); } catch (Exception e) { ...
cc73e0ef-13ee-4c50-b612-25b99444f411
7
@Override public void saveMod(ModInfo modInfo) { if(IDs.getModel().getSize() > 0) { for (int i = 0; i < IDs.getModel().getSize(); i++) { //System.out.println("ID: "+IDs.getModel().getElementAt(i)+" Shortname: "+modInfo.shortName); Globals.getModPack().addShortName(modInfo.shortName, (String) IDs.getModel(...
e5669a75-4468-4709-bba3-26bce23f4c41
8
public Grid transform(final Grid in) { final int width = in.getWidth(); final int height = in.getHeight(); final Grid out = new Grid(new Cell[width][height]); for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { final Cell cell = in.getCellAtP...
170d3a05-ef1b-4c04-9743-16033bd4729f
4
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final CanDDeliveryOrderItemDiscPK other = (CanDDeliveryOrderItemDiscPK) obj; if (!Objects.equals(this.szDocId, ...
84ecad01-6219-44bb-b691-c6095035c42d
7
public static Hashtable sortClassesByRoot(String classes) { Hashtable roots; Hashtable result; Enumeration enm; int i; StringTokenizer tok; String clsname; Vector list; Hie...
54a1f84a-a17f-4b54-a8ce-fa02a3031693
7
private JSONWriter append(String string) throws JSONException { if (string == null) { throw new JSONException("Null pointer"); } if (this.mode == 'o' || this.mode == 'a') { try { if (this.comma && this.mode == 'a') { this.writer.write('...
2018d377-9793-4755-af37-617567b39757
0
@Test public void notNullPizzaBuilders() { Waiter waiter = new Waiter(); PizzaBuilder hawaiian_pizzabuilder = new HawaiianPizzaBuilder(); PizzaBuilder spicy_pizzabuilder = new SpicyPizzaBuilder(); waiter.setPizzaBuilder( hawaiian_pizzabuilder ); waiter.constructPizza(); ...
60b99881-9813-47a4-b89e-5157c2f74ab4
5
public String readDomainName() throws IOException { if (pos >= count) { throw new EOFException("EOF reading domain name"); } if ((buf[pos] & 0xc0) == 0) { String label = readString(); if (label.length() > 0) { String tail = readDomainName(); ...
88f5b8e6-357d-4205-89e8-be9f843c82da
9
private void draw(Graphics g) { synchronized(pt){ log.logln(LogL.GUI_SEQ, "GraphPanel.draw(): draw imgSize=(" + imageSizeX + "," + imageSizeY + ")"); if(defaultViewOnNextDraw) { defaultViewWithoutRedraw(); defaultViewOnNextDraw = false; } g.clearRect(0, 0, imageSizeX, imageSizeY); pt.drawBa...
41b43176-f028-4b87-b824-0568fed2bbae
4
public static int getPilotWeightUnit() throws ClassNotFoundException { int weightUnit = 0; try{ //Class derbyClass = RMIClassLoader.loadClass("lib/", "derby.jar"); Class.forName(driverName); Class.forName(clientDriverName); }catch(java.lang.ClassNotFoundExcept...
a2c7f4df-5ddc-4ad9-994c-e42c594dbf5a
2
private void afficherVisiteurs(){ if (ctrlMenu == null) { VueMenu vueM = new VueMenu(ctrlA); ctrlMenu = new CtrlMenu(vueM, vueA); } if (ctrlVisiteurs == null) { VueVisiteurs vueV = new VueVisiteurs(ctrlA); ctrlVisiteurs = new CtrlVisiteurs(vueV, vu...
1fc1dc7b-40ca-4dee-b098-452f1aa700a2
7
@Override public byte[] read(DataInputStream in, PassthroughConnection ptc, KillableThread thread, boolean serverToClient, DownlinkState linkState) { length = lengthUnit.read(in, ptc, thread, serverToClient, linkState); if(length == null) { return null; } length *= 3; if(length > 16384) { ptc.pr...
96c6e257-4992-4b39-a342-b9c16aa5fe0a
5
public static void solveNearestNeighbor() { //Parse file Parser p = new Parser(); p.parse(); long startTime = System.nanoTime(); Graph g = new Graph(); //All cities g.cities = p.out; //Copy of cities LinkedList<Double[]> linkCities = new LinkedList<Double[]>(); g.bestTour = null; ...
7b69ee8a-a8e7-46f1-8e40-9a95aa1e6927
6
* @param concept * @param module * @param environment * @return LogicObject */ public static LogicObject createObject(String name, LogicObject concept, Module module, Environment environment) { { Module mdl000 = module; Context cxt000 = mdl000; if (mdl000 == null) { mdl000 = ((Mod...
9619bd1c-a8ae-4073-b258-f9b2a60a1bed
7
public static String computeUnitsForInteger(int value, boolean negateExponentP) { { StringBuffer buffer = Stella.makeRawMutableString(128); int i = 0; int p = 1; int e = 0; boolean previousNoExponentP = false; { IntegerWrapper prime = null; Cons iter000 = Utilities.$PRIME_NUMB...
1205589e-b427-4bf1-94ab-73afb056bc05
8
public static void main(String[] arg){ long timeTaken; int lineSize = 31; long fileSize; int numLines; int initialbBufferSize = lineSize; int[] positions = {0,2,5,13,29,31}; //sorted list of positions of the lines that are to be removed //int[] positions = {89,94,...
acd11fb0-4502-4c4b-8d0b-aae1fea0ea82
9
public static void createTermFrequencyVectors(Path input, Path output, String tfVectorsFolderName, Configuration baseConf, int m...
c6b6574a-44c6-488b-97c4-8c8bd92e4900
5
private List<Path> findShortestPaths(String start, List<Path> listOfPaths, Path currentPath) { Vertex vStart = getVertex(start); vStart.setVisited(true); int row = getVertexIndex(start); for (int col = 0; col < COLS; col++) { Vertex tempVertex = getVertex(col); if (graph[row][col] > 0 && !tempVertex....
38d42cc4-114a-40e5-89c6-639d514bbd92
9
public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); n = Integer.parseInt(st.nextToken()); m = Integer.parseInt(st.nextToken()); t = Integer.par...
8b7f9843-03df-41a3-b869-7de37af7e131
5
private void throwPaynovaHttpException(HttpEvent httpEvent, boolean connectionStatusOk) { JsonParser parser = new JsonParserImpl(); StatusWrapper sw = null; try{ sw = parser.fromJson(httpEvent.getResponseBody(), StatusWrapper.class); }catch(Exception e){} if(sw!=null ...
986e1f60-b0bb-4d3a-abe1-c75ce4e4f8f3
0
public Ant(AntBrain brain, boolean colour, int id) { this.brain = brain; this.colour = colour; this.id = id; this.hasFood = false; this.resting = 0; this.state = 0; this.direction = 0; this.alive = true; this.position[0] = -1; this.position...
4bd741d9-997d-4d32-b727-11037687c652
2
public void run() { //sets size of window setSize((BRICK_WIDTH * (BRICKS_IN_BASE + 1)), (BRICK_HEIGHT * (BRICKS_IN_BASE + 2))); for (int i = BRICKS_IN_BASE; i > 0; i--) { rowStartPositionX += BRICK_WIDTH / 2; for (int j = 0; j < i; j++) { GRect brick = new GRect( (rowStartPositionX + (j * ...
f7dac301-9f9a-46dc-b440-bf9a970b4b8d
3
public void push(Element element) { if (reversed) { reverse(); } if (firstElement != null) { Element tmp = firstElement; while (tmp.getNextElement() != null) { tmp = tmp.getNextElement(); } tmp.setNextElement(element); ...
071d894f-913f-46ce-b406-a70d4a52f7dc
3
public boolean handleMove(int x, int y) { //Get where karel wants to move int newX = x + karel.GetX(); int newY = y + karel.GetY(); if (karel.isWallCollision(newX, newY, walls)) { //collided with wall - do not move karel return true; // return...
7e865b13-881e-4e96-9ce1-b2337025cefd
7
public void setupAttribLists() { String [] tempAttribNames = new String[m_data.numAttributes()]; String type; m_classAttrib.removeAllItems(); for(int i=0; i<tempAttribNames.length; i++) { switch (m_data.attribute(i).type()) { case Attribute.NOMINAL: type = " (Nom)"; break; case Attr...
9b4ce8af-db42-41e1-b7e4-85c487f65c8a
6
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ModelModel that = (ModelModel) o; if (idModel != that.idModel) return false; if (model != null ? !model.equals(that.model) : that.model != null...
49707537-c09e-48c8-9d4e-ded299f08795
7
public void read(FileReader dbfFile) throws IOException, InvalidDbfFileException { // Type of reader int fileType = dbfFile.readByte(); if (fileType != 0x03) { throw new InvalidDbfFileException("Unsupported DBF reader Type " + fileType); } // Update date int ...
e8b2003c-88f3-4228-a3a4-29170d1840ed
1
private void doCoding_to_tree() { myDataList temp1 = ((myDataList) arrList.get(arrList.size() - 1)); myDataList temp2; ((data) temp1.get(0)).setBinary_Code("1"); ((data) temp1.get(1)).setBinary_Code("0"); for (int i = arrList.size() - 1; i > 0; i--) { temp1 = ((myData...
a8f7fb5e-c554-4a2b-9ea7-b68005d045cc
9
private void loadFile(Reader reader) throws IOException { this.sections = new ArrayList<Section>(); BufferedReader bufferedReader = new BufferedReader(reader); int unnamedSectionCounter = 0; Section currentSection = null; Entry currentEntry = null; String line = bufferedReader.readLine(); while (line ...
556f2706-2bce-4b65-9c9e-eb85dc5ecc86
1
public String getChatText() { String chatText = ""; String latestMessage; IMessage msg; for(int k=0; k<history.size(); ++k) { msg = history.get(k); latestMessage = msg.getMessageTextAsHTML(); chatText += latestMessage + "<br><br>"; } return chatText; }
65e602e3-62f8-4dc3-8611-adce12e9eab4
1
@RequestMapping(value = "/speciality-speaker-list/{specialityId}", method = RequestMethod.GET) @ResponseBody public SpeakerListResponse specialitySpeakerList( @PathVariable(value = "specialityId") final String specialityIdStr ) { Boolean success = true; String errorMessage = null...
92a64f6f-c848-47c4-857e-04988bf6a1b0
9
@SuppressWarnings("SpellCheckingInspection") private void printMostActiveActorInSingleYear(final List<Movie> movies, final Set<Actor> actors) { // Java 7 style. final Map<Actor, Map<Long, Long>> actorToMoviePerYearCount = new HashMap<>(); for (final Movie movie : movies) for (fin...
835cbc2f-ccaa-44f4-b7a5-255102a9104f
6
public static double expt(double x, int n) { int i = n; boolean odd = (n % 2 == 1); double temp = x; // deal with special cases if (n == 0) return 1; if (n == 1) return x; //if n is odd, cheat: //make it even and deal with the consequences later if (odd) i--; ...
cc536631-ecde-4e1a-ba1c-ef17d6b5a072
7
public static String romanNumeral(int i){ String ret = ""; while(i > 1000){ ret += "M"; i -= 1000; } while(i > 500){ ret += "D"; i-=500; } while(i > 100){ ret += "C"; i-=100; } while(i > 50){ ret += "L"; i-=50; } while(i > 10){ ret += "X"; i-=10; } while(i > 5){ ...
c4c96b79-3310-4493-8bc3-cf8482e335c5
2
public Grammar exportGrammar() { // Are any yet unconverted? if (objectToProduction.keySet().size() != alreadyDone.size()) { highlightUntransformed(); JOptionPane .showMessageDialog( convertPane, "Conversion unfinished! Objects to convert are highlighted.", "Conversion Unfinished", ...
57f1330a-eb06-4d19-a3e0-b567a0df3a1d
6
@EventHandler public void EnderDragonNightVision(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.getEnderDragonConfig().getDouble("...
b6542972-9693-448c-b869-c9710542e766
6
@Override public void packetIncoming(Packet packet) { if(packet.channel.equals(References.CHANNEL_PLAYER_UPDATE)) { this.updatePlayer(packet); }else if(packet.channel.equals(References.CHANNEL_PLAYER_DC)) { this.playerDC(packet); }else if(packet.channel.equals(References.CHANNEL_SPAWNPLAYER)) { this.spa...
fd38e70c-64ce-4047-b30f-f8dbbea0fb10
7
public static int[][] houseItems(Direction side, int amount,int xLoc, int yLoc, int size) { int yOffSet = 0; int xOffSet = 0; switch (side) { case UP: yOffSet = -(size * 20); break; case LEFT: xOffSet = -(size * 20); ...
734ef6c3-0d43-48f6-b49b-11bb3e1cf3fd
8
private static byte encodeMessageType(MessageType messageType) { switch(messageType) { case APPLICATION: return Packet.MESSAGE_TYPE_APPLICATION; case PING: return Packet.MESSAGE_TYPE_PING; case PING_RESPONSE: return Packet.MESSAGE_TYPE_PING_RESPONSE; case CONNECT_REQUEST: return Packet.MES...
677a70ee-b619-4e72-abfd-e2edc85578a6
0
@Override public String getName() { return super.getName(); }
02a996b7-fd0f-470f-a16b-6105373b347f
6
public String parseCommands(String[] args) { if (args.length > 0) { if (args[0].equalsIgnoreCase("-update")) { internalUpdater.lookForUpdates(); return "noload"; } else if (args[0].equalsIgnoreCase("-debug")) { if (args.length > 1) { if (args[1].equalsIgnoreCase("on")) { settings.set(show...
fc54ab44-dc4d-474d-8dc8-d2a70ce63d38
1
private static UmlDiagram tryRead( UmlDiagramRepository repository ) throws IOException { Path path = Paths.get( "diagram.xml" ); if( Files.isReadable( path ) ) { return repository.read( Format.XML, path ); } else { return null; } }
65df2ba1-9050-4adb-a17b-068a65367df5
6
private String getByline(StringBuilder sbByline, StringBuilder sbTitle, StringBuilder sbEmail, StringBuilder sbTwitter) { // person string: [name1], [email1], [twitter1], [title1] | [name2], [email2], [twitter2], [title2] | ... String value = ""; String tmpValue = ""; ...
24172ef5-9261-4343-8a86-5c0c4443944a
4
private void closeFile() { if (status_) { try { if (writer_ != null) { writer_.close(); writer_ = null; } if (reader_ != null) { reader_.close(); reader_ = null; } } catch (IOException e) { JOptionPane.showMessageDialog(this, e.getMessage()); } status_ = false; }...
7a1d66d1-6e30-4f83-825e-7ff4efa18de5
9
@Override public String getCVSArguments() { final StringBuffer toReturn = new StringBuffer(""); // NOI18N if (isDefaultBranch()) { toReturn.append("-b "); // NOI18N } if (isHeaderAndDescOnly()) { toReturn.append("-t "); // NOI18N } if (isHeader...
7df5065d-73f0-4605-95ea-fc97374b4a70
9
public void save() { String savePath = new Control_GetPath().getStreamRipStarPath(); XMLOutputFactory outputFactory = XMLOutputFactory.newInstance(); try { XMLEventWriter writer = outputFactory.createXMLEventWriter( new FileOutputStream(savePath+"/Settings-StreamRipStar.xml" ) ); XMLEventFactory e...
6836be83-dfee-4934-b165-a906b41834bf
0
private static void marshal() throws JAXBException, PropertyException { AtomicValidator<Employee_ToBeRemoved> validator1 = new AtomicValidator<Employee_ToBeRemoved>(); validator1.setField("id"); validator1.setValue("3"); validator1.setOperator(new UnaryLogicalNotOperator<Boolean>()); AtomicValidator<Employee...
119351f2-cc8d-448f-9e95-4faf904ce679
6
public static String[] readSQL () { String[] Array = new String [5]; try { BufferedReader in = new BufferedReader(new FileReader("database.txt")); String Host = in.readLine(); Matcher host = Pattern.compile("Host:\"[.[^\"]]+\"").matcher(Host); M...
4956c49a-b221-4da4-b255-c527df7c4358
2
public Board(String[][] board, int size) { this.boardSize=size; for(int i=0;i<boardSize;i++){ for(int j=0;j<boardSize;j++){ board[i][j]="-"; } } this.boardArray = board; }
f630feda-1467-4079-b6e4-a245af65d8f1
8
public void handleRequest(HttpRequest req) { HttpRequestHeader hdr = (HttpRequestHeader) req.getHeader(); if (Cache.isCachable(hdr)) { CachableHttpObject obj = proxy.cache.get(hdr); if (obj == null) { // object not in cache try { obj = new CachableHttpObject(hdr, proxy); obj.setCache(proxy.c...
24eb0b39-d1e7-436e-b160-530fc875ba22
5
public void placerTousLesBateaux() { Scanner sc = new Scanner(System.in); System.out.println("Bateau : TORPILLEUR \n"); System.out.println("Veuillez saisir les coordonnées de la proue : \n"); int coordonneeX = sc.nextInt(); int coordonneeY = sc.nextInt(); System.out .println("Veuillez saisir l'orientati...
5eb81e65-1a42-4e7c-9730-e6570f71e92c
4
public final boolean canRenderSide(Level level, int x, int y, int z, int side) { if(this != SLAB) { super.canRenderSide(level, x, y, z, side); } return side == 1?true:(!super.canRenderSide(level, x, y, z, side)?false:(side == 0?true: level.getTile(x, y, z) != this.id)); }
1e31178a-132a-4f83-85c1-5fd82ac79603
7
public static int[] getPrimes(int max) { int[] primes = new int[max+1]; // populate with all number between 2 to max for (int i = 2; i <= max; i++) { primes[i] = i; } int total = max-1; for (int i = 2; i <= Math.sqrt(max); i++) { // remove the succeeding multiples of a base number for (int j = ...
0bbaf71b-1b56-4eef-bf07-0adc093af568
1
public List<Note> noteList(int courseId) throws SQLException { NoteDatabaseManager dm = new NoteDatabaseManager(); String s_courseId = Integer.toString(courseId); String sql = "select * from note where course_id = " + s_courseId + ";"; ResultSet rs = dm.sqlQuery(sql); List<Note> nList = new ArrayList<Note>()...
f0d77c8b-d7e6-4f68-af28-5a56199b69b1
9
* @param tile The <code>Tile</code> to claim. * @param claimant The <code>Unit</code> or <code>Colony</code> claiming. * @param price The price required. * @param offer An offer to pay. * @return True if the claim succeeded. */ private boolean claimTile(Player player, Tile tile, ...
a63492fd-3ca1-4b3b-9748-7ed284bcca85
6
private LEVEL convertLv(String lv){ if(lv.equalsIgnoreCase("VSB")) return LEVEL.VSB; if(lv.equalsIgnoreCase("VSI")) return LEVEL.VSI; if(lv.equalsIgnoreCase("VSE")) return LEVEL.VSE; if(lv.equalsIgnoreCase("PSB")) return LEVEL.PSB; if(lv.equalsIgnoreCase("PSI")) return LEVEL.PSI; if(lv.equalsIgnoreCase("PSE...
085019c3-a29f-427d-83be-c92a85ad06d1
1
public Double getRandom() { double rand = Math.random() * 15; return rand > 5 ? rand : getRandom(); }
f0c8609d-8015-4a16-832b-3405117f6615
5
@Override public double determinant() throws IncompatibleOperandException { //determinantu je moguće izračunati kod kvadratnih matrica //ukoliko treba podržati i za ne kvadratne, poogledati Penrose-Mooreov //pseudoinverz if (this.getColsCount() != this.getRowsCount()) { throw new IncompatibleOperandExceptio...
685289bb-97ae-4ca4-9377-9b281085f865
7
public static boolean inneholdt(String a, String b){ a =a.toUpperCase(); b = b.toUpperCase(); boolean sammeord = false; char[] alfabet = {'A','B','C','D','E','F','G','H','I','J', 'K','L','M','N','O','P','Q','R','S','T', 'U','V','W','...
ffb1a18d-dd22-4b67-8846-81bbba387fc1
0
public void setEventType(EventTypes eventType) { this.eventType = eventType; }
9f7485e1-1b19-45aa-bfe6-68b67f0a05bb
7
public void analysePotentialOffers(List<Formula> potentialOffer) { if (potentialOffer.size() == 0) return; System.out.println("---+++Analysing Offers"); System.out.println("---+++Number of potential offers: " + potentialOffer.size()); Random rnd = new Random(); double total = 0; double debugTota...
32f600e6-0c2f-4e57-b0c8-eb78eef6c9e4
7
public static void testValidity(Object o) throws JSONException { if (o != null) { if (o instanceof Double) { if (((Double)o).isInfinite() || ((Double)o).isNaN()) { throw new JSONException( "JSON does not allow non-finite numbers."); ...
b732937c-f3e6-48a5-8b5b-4de8c95a1a28
5
private void saveUsers() { try { if (!getDataFolder().exists()) getDataFolder().mkdir(); File dir = new File(getDataFolder(), "usertmp"); if (!dir.exists()) dir.mkdir(); for (int i = 0; i < users.size(); i++) { if (users.get(i).getPlayer().isOnline()) { GsonBuilder gsonBuilder = new GsonBuilder()...
846787ea-deb5-4ee3-9a7f-ff35ea4c9e91
2
private static void repopulateList() { final TreeSet<CButton> files = FileWalker.getInstance().getSetButtons(); jPanel.removeAll(); for (CButton cButton : files) if (cButton.isVisible()) { jPanel.add(new ButtonHolder(cButton)); jPanel.add(Box.createRigidArea(new Dimension(1, 50...
fad4122a-98e5-4d73-b132-13709673b28b
2
public Expression simplify() { for (int i = 0; i < subExpressions.length; i++) { if (subExpressions[i] != null) subExpressions[i] = subExpressions[i].simplify(); } return this; }
fd9b0332-04b6-48db-83b9-6d953ccbf249
3
public void method554(boolean flag) { int j = mapIndices1.length; for (int k = 0; k < j; k++) { if (flag || mapIndices4[k] != 0) { method563((byte) 2, 3, mapIndices3[k]); method563((byte) 2, 3, mapIndices2[k]); } } }
d05576dc-9a37-4954-8e17-08de1c78029f
7
private void closeRequest(OnDemandRequest onDemandRequest) { try { if (socket == null) { long l = System.currentTimeMillis(); if (l - openSocketTime < 4000L) { return; } openSocketTime = l; socket = c...
c4025019-93bc-4be8-8c5f-c7263b880ff2
6
private boolean isBranch(String string) { if(string.replace(" ", "").equals("breq") || string.replace(" ", "").equals("brneq") || string.replace(" ", "").equals("brlt") || string.replace(" ", "").equals("brgt") || string.replace(" ", "").equals("brgeq") || string.replace(" ", "").equals("brleq")) return tru...
4a8c2338-fd3b-48cb-96c2-f385936d7501
8
public String toString(){ StringBuffer sb = new StringBuffer(); switch(type){ case TYPE_VALUE: sb.append("VALUE(").append(value).append(")"); break; case TYPE_LEFT_BRACE: sb.append("LEFT BRACE({)"); break; case TYPE_RIGHT_BRACE: sb.append("RIGHT BRACE(})"); break; case TYPE_LEFT_SQUARE: ...
895c2c49-112b-48a6-8041-a20da952ef0d
6
@Override public void run() { // convert the rxPacket's payload to a string String payload = new String(rxPacket.getData(), 0, rxPacket.getLength()).trim(); // dispatch request handler functions based on the payload's prefix if (payload.startsWith("REGISTER")) { onRegisterRequested(payload. substri...
08bb0021-66e8-4f15-b2ce-a6c002d22ba9
6
@EventHandler public void SnowmanWeakness(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.getsnowgolemConfig().getDouble("Snowman.W...
6450aff5-c0fe-491f-b117-6c63a3c9d274
9
protected String createPrepend(LogEvent e) { StringBuffer pre = new StringBuffer(80); String code = "??"; switch (e.getType()) { case LogEvent.DEBUG_TYPE: code = " D"; break; case LogEvent.INFO_TYPE: code = " I"; break; cas...
832e2092-0861-400b-8aa0-01b3c29ba42d
6
public static boolean hasPermission(Player player, String perm) { if (player.isOp()) return true; else if(SignURLs.permission != null) { if (SignURLs.permission.has(player, "*")) return true; else if (SignURLs.permission.has(player, perm)) return true; } else { if (player.hasPermission("*")) ret...
c90db9c9-b80e-43de-ae28-64dfd9a10d6b
5
public String getHtml(String url, String charSet) { DefaultHttpClient httpClient = new DefaultHttpClient(); String p = proxy.get(((int) (10000 * Math.random())) % proxy.size()); String proxy = p.split(":")[0]; Integer port = Integer.parseInt(p.split(":")[1]); HttpHost Proxy = new...
2438c386-7607-4e6b-b3eb-88183147cff2
1
@Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; HttpSession session = req.getSession(); ClientType type = (ClientType)ses...
6b95f7fe-a9f0-43aa-8bc5-f45d71739fb7
9
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if(!(affected instanceof MOB)) return super.okMessage(myHost,msg); final MOB mob=(MOB)affected; if((msg.amITarget(mob)) &&(CMath.bset(msg.targetMajor(),CMMsg.MASK_MALICIOUS)) &&(msg.targetMinor()==CMMsg.TYP_CAST_SPELL) &...
66761731-d105-4502-b248-bd48b8df6d46
6
public void drawKeyFrame(AnimationKeyframeData kf){ if(kf == null){ return; } CHRTile spr = new CHRTile(modelRef.getCHRModel().getPatternTableBytesForTile(getSpriteBank(), kf.spriteIndex), PPUConstants.SPRITE_PALETTE_TYPE, modelRef, kf.oamIndex); int pix[] = spr.getPix(); ...
feedb266-8707-470a-804b-3164da4785ab
2
public void dump_stack() { if (stack == null) { debug_message("# Stack dump requested, but stack is null"); return; } debug_message("============ Parse Stack Dump ============"); /* dump the stack */ for (int i=0; i<stack.size(); i++) { debug_message("Symbol: " + ((Symbol)stack...
3632d36d-1097-42bb-bfa8-87aa4f1bc770
8
public BugReportWindow(Throwable e) { _instance = this; _instance.setSize(450, 360); // 394 x 297 (inner) _instance.setResizable(false); _instance.setLayout(null); _instance.setBackground(new Color(0xF0F0F0)); _instance.setTitle("Bug Reporter"); _instance.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOS...
fb7a6216-adc1-420d-a0f3-e34601306ec4
9
public void reloadApplicationDescriptions(String applicationDescriptionsConfigFile) throws IOException { applicationsMap = new ConcurrentHashMap<String, Application>(); classLoaderMap = new ConcurrentHashMap<String, ClassLoader>(); applicationPathMap = new ConcurrentHashMap<String, String>(); ...
809d782b-e125-4525-aa2b-8ced0678a326
2
public void testFixedWidthMultipleRecordElementsInMapping() { DataSet ds; final String xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?> \r\n" + "<!DOCTYPE PZMAP SYSTEM \"pzfilereader.dtd\" > \r\n" + " <PZMAP>\r\n" + " <RECORD id=\"header\" startPosition=\"1\" endPosition=\"1\" ind...
e610e9b8-8030-4f95-ac18-7e784e6d774b
7
public void sort(int[] arr, int b, int e){ if(b>=e)return; int i = b, j = e, m = arr[(b+e)/2]; do{ while(arr[i] < m)i++; while(arr[j] > m)j--; if(i<=j){ int tmp = arr[i]; arr[i++] = arr[j]; arr[j--] = tmp; } } while(i<=j); if(i<e) sort(arr, i, e); if(j>b) sort(arr, b, j); }
1dad97d6-2d53-4ce5-bde6-5fbc14734337
1
private void processMoveToTopRow(MouseEvent e) { if (activeMove != null) { int col = findCol(e.getX()); activeMove.cardReleased(col, true); String result = activeMove.makeMove(game); processMoveResult(result, activeMove); } }
79dad6b5-a402-4504-9b7a-73247515b822
1
public boolean isClear(int index) { /* * Similar to the is set only flip the mask and use the NOR function. */ if(index >= 32){ return true; } int mask = 0x1; mask = mask << index; mask = ~mask; return (~(mask | bits) != 0x0); }
3f5570b5-6709-470a-b92c-7b6535e0534b
4
public static boolean parseBoolean(String valueStr) { return valueStr.equalsIgnoreCase("true") || valueStr.equalsIgnoreCase("on") || valueStr.equalsIgnoreCase("yes") || valueStr.equalsIgnoreCase("y") || valueStr.equalsIgnoreCase("1"); }
51056660-811c-4bb2-97ca-b20106835bd2
1
public void propertyChange(PropertyChangeEvent evt) { log.entering(getClass().getSimpleName(), "propertyChange(PropertyChangeEvent)"); if(CheatManager.getInstance().getMoneyToAdd() > 0) { // If the CheatManager indicates that it wants us to deposit money, then do so... bank.deposit(CheatManager.getInstance()....
e642c8e4-29fa-40b5-9aa6-f1c47282367b
8
protected EARMARKChildNode getNextSibling(EARMARKChildNode node) { EARMARKChildNode result = null; Iterator<EARMARKHierarchicalNode> ite = parentMap.get(node).iterator(); while (result == null && ite.hasNext()) { Collection collection = childMap.get(ite.next()); if ( collection.getCollectionType() =...
313decac-a0f6-4835-bb02-0690764ddf9b
7
private void parse(byte[] compressedData) throws IncorrectFileVersion, EOFException { String name; int cid; ChunkID chunkName; SaveGameReader compressedBuffer = new SaveGameReader(compressedData); SaveGameReader saveData; CompressionType ct = CompressionType.valueOf(compressedBuffer.readString(4)); ...
53809019-ec7f-488b-b7cb-7fbfa5dc4b88
1
public DragButton(final String optionF) { super(optionF); text = optionF; this.addClickHandler(new ClickHandler(){ @Override public void onClick(ClickEvent event) { if (enableClicks) { inputAppend(optionF); updateInputArea(); sou...
2a53cca4-4264-4b28-b494-57dbac9c9904
1
static public Mantenimiento_Horario instancia() { if (UnicaInstancia == null) { UnicaInstancia = new Mantenimiento_Horario(); } return UnicaInstancia; }
60a629ed-7618-457b-b7c8-cded71afb094
7
public TileImage getImageForTooltip(Coordinate pPosition, int pZoom, String pTileSource) { TileSource tileSource = FreeMindMapController.changeTileSource( pTileSource, null); if (tileSource != null) { mTileSource = tileSource; ...
1489de12-bcd1-4e13-b072-7c197f1b96e4
6
public static List<Graph.Edge> minimumSpanningTree(Graph g, int sourceVertex) { Set<Integer> mould = new HashSet<>(); Set<Integer> universe = new HashSet<>(); universe.addAll(g.getAllVertex()); List<Graph.Edge> minimumSpanningTree = new ArrayList<>(); mould.add(sourceVertex); ...
634566bb-5643-4cc6-b8b3-88f86c09b67e
5
public int hash(byte[] data, int length, int seed) { int m = 0x5bd1e995; int r = 24; int h = seed ^ length; int len_4 = length >> 2; for (int i = 0; i < len_4; i++) { int i_4 = i << 2; int k = data[i_4 + 3]; k = k << 8; k = k | (data[i_4 + 2] & 0xff); k = k << 8; ...
075b226c-d56d-4d4a-b965-029a2a11fef6
7
private void configModifPan() { modifPan.setHeight("585px"); modifPan.setWidth("805px"); modifPan.setStyleName("modifPan"); // Wrap the contents in a DecoratorPanel DecoratorPanel dec2Panel = new DecoratorPanel(); dec2Panel.setWidget(modifPan); add(dec2Panel, 480, 10); modifPan.add(new HeaderPanels("Mo...
8e027392-0568-4e48-b5f1-742146b63b86
3
public static String[] testAjoutCaddie (String numS, String dateRep, String zone) throws BDException { String requete = "select nomS from lesspectacles, lesrepresentations where lesspectacles.numS=lesrepresentations.numS and lesspectacles.numS="+numS+" and dateRep = to_date('"+dateRep+"','dd/mm/yyyy hh24:mi')"; Sta...
a65a35e7-c892-4c5b-a7f7-301929f9c3e7
0
@Override @Transactional public <T extends PersistentObject> T update(T entity) { return em.merge(entity); }
8fecb1cb-36a7-47da-a0ad-00679d88577a
6
public int start(int populationSize){ initPopulation(populationSize); int fitness = 0; int mutationCounter = 0; Random random = new Random(); while(fitness < Individual.targetString.length()){ /* Choose 1st parent */ Individual parentA = population[random.nextInt(populationSize)]; Individual pa...
c6e17bb6-e536-46cd-b7cc-f29c5b82ba21
0
protected void onVersion(String sourceNick, String sourceLogin, String sourceHostname, String target) { this.sendRawLine("NOTICE " + sourceNick + " :\u0001VERSION " + _version + "\u0001"); }
24b045e0-94a8-42bb-8b8e-f154a74f93ed
4
public void removeRow(int startRow) { for (int col = 0; col < getWidth(); col++) { board[startRow][col] = 0; } for (int row = startRow - 1; row >= 0; row--) { for (int col = 0; col < getWidth(); col++) { if (row == 0) { // the most highest rows board[row][col] = 0; } else { board[row + 1][...