method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
4a5ad28e-394b-4b12-840d-f1f17090ac5a
8
@Override public void spring(MOB target) { if(target.location()!=null) { if((!invoker().mayIFight(target)) ||(isLocalExempt(target)) ||(invoker().getGroupMembers(new HashSet<MOB>()).contains(target)) ||(target==invoker()) ||(doesSaveVsTraps(target))) target.location().show(target,null,null,CMMs...
20e0b608-cc2f-4692-b2a5-de68fe22244e
8
public File getFile(String IPAddress, String fileName) { PrintWriter pw = null; Socket ftSoc = null; BufferedReader br = null; PrintWriter pwFile = null; File newFile = null; try { ftSoc = new Socket(getInetAddress(IPAddress), ConfigurationManager .getInstance().getFileTransferPort()); pw = new ...
c574d41b-70d1-4b83-8dde-3390788ef80a
0
public void onNamesChanged(String leftName, String rightName) { setNames(leftName, rightName); }
eb51a2d6-7e0e-4305-8f6b-a34a55b8b7b9
1
public static MainImagePanel getInstance() { if (instance_ == null) instance_ = new MainImagePanel(); return instance_; }
71e6b5d1-3cdb-4689-93f7-60d1ea73016d
8
private int getTypeCode(Object obj){ int code = 0; if(obj instanceof Byte){ code = 1; } else{ if(obj instanceof Short){ code = 2; } else{ ...
ade4d830-41f0-4896-b36d-18d59f5f2a5d
4
public static byte[] decode(String input) { try { ByteArrayOutputStream out = new ByteArrayOutputStream(); StringReader in = new StringReader(input); for (int i = 0; i < input.length(); i += 4) { int a[] = {mapCharToInt(in), mapCharToInt(in), mapCharToInt(in),...
7e64af39-b937-4b34-b747-b1340501d3ba
2
public StdImage createImage() { StdImage offscreen = null; synchronized (getTreeLock()) { Graphics2D g2d = null; try { int width = mHeaderBounds.width; int height = mHeaderBounds.height + mContentBounds.height; offscreen = StdImage.createTransparent(getGraphicsConfiguration(), width, height); ...
3ba46961-a553-4fd5-88be-be7c6bdeda19
6
public static String escape(String string) { StringBuffer sb = new StringBuffer(); for (int i = 0, length = string.length(); i < length; i++) { char c = string.charAt(i); switch (c) { case '&': sb.append("&amp;"); break; cas...
58ebcd44-4dd8-47ca-b2b3-7064dea69dd5
5
private void btnFinalizarFuncionarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFinalizarFuncionarioActionPerformed if(JOptionPane.showConfirmDialog(rootPane, "Deseja Salvar?") == 0){ try { //Setando os dados e convertendo de text para seus...
d6cb0d17-afa4-492e-b3cf-2fea98b36ec6
1
public boolean executeBan(Ban ban) { OfflinePlayer player = ban.getPlayer(); String reason = ban.getReason(); player.setBanned(true); if (player.isOnline()) { Bukkit.getPlayer(player.getName()).kickPlayer(reason); } bans.put(player.getName(), ban); r...
0a120995-65b1-4580-a66f-c8728d2f7bbd
2
protected void calcDIR_FstClusFULL() { byte[] bTemp = new byte[4]; for (int i = 26;i < 28; i++) { bTemp[i-26] = bytesOfFAT32Element[i]; } for (int i = 20;i < 22; i++) { bTemp[i-18] = bytesOfFAT32Element[i]; } DIR_FstClusFULL = byteArrayToInt(bTem...
9108950b-38f4-4a37-9cba-c20c2c6a37a1
5
public ParabolaAlgorithm(int _p){ _X = new ArrayList<Integer>(); _Y = new ArrayList<Integer>(); Coordinates.isCoordinates = false; int x2 = 0; int y2 = 0; double Sh, Sv, Sd, p=_p; Sd = Math.pow(y2+1, 2) - 2*p*(x2+1); Sv = Math.pow(y2+1, 2) - 2*p*x2; Sh = Math.pow(y2, 2) - 2*p*(x2+1); ...
23e97970-3855-47a2-804a-257bb77fd2e9
9
public static Keyword sumOfUnitsSpecialist(ControlFrame frame, Keyword lastmove) { { Proposition proposition = frame.proposition; Stella_Object listarg = (proposition.arguments.theArray)[0]; Stella_Object listskolem = Logic.argumentBoundTo(listarg); Stella_Object sumarg = (proposition.arguments.th...
3a79d58f-fe10-4b64-80e7-0ac13d1916ff
1
public void addLast(DNode z){ try { addAfter(z,trailer); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }
d7ee4dbe-9ecf-4ea2-b296-3934ec841baf
7
boolean recombine(Atom atom, Electron electron) { if (!electron.readyToGo(model.getModelTime())) // the electron is just ionized return false; if (!atom.isExcitable()) return false; a1 = atom; // the electron will recombine with a1 with the assistance of a2 e = electron; double rxij, ryij, rijsq, sig; ...
b77c69ce-a8e4-45f3-9a77-fbffde80c948
9
BooleanScorer(BooleanWeight weight, boolean disableCoord, int maxCoord, Collection<BulkScorer> scorers, int minShouldMatch, boolean needsScores) { if (minShouldMatch < 1 || minShouldMatch > scorers.size()) { throw new IllegalArgumentException("minShouldMatch should be within 1..num_scorers. Got " + minShouldM...
fb802fd4-29d1-49d0-b0db-bf8d364a3158
1
public static double nbias(double[] sim, double[] obs) { sameArrayLen(sim, obs); double sum = 0; for (int i = 0; i < sim.length; i++) { sum += sim[i] - obs[i]; } return sum / sum(sim); }
872f2d7d-11d5-4244-b2ed-52a7db2f6b58
5
@Override public double getIntersectionValue(Ray ray) { //hyperbola: r^2 = (x - x1)^2 - (y - y1)^2 + (z - z1)^2 //Line: x = at + b // y = ct + d // z = et + g LinearEquation combinedX = LinearEquation.Add(ray.xEquation, -center.x); LinearEquation combinedY = LinearEquation.Add(ray.yEquation,...
e3085cfb-9892-4217-b45e-7255da7dd355
3
public static void main(String args[]) { double JD, jdFixed; double jdstart, jdfinish, jdstep; if (args.length < 3) { System.err .println("Usage: TestIAUEarthRotationModel start-date end-date step [fixed-epoch]"); return; } jdstart = Double.parseDouble(args[0]); jdfinish = Double.parseDouble(a...
bb495dd2-b5fc-4f9c-ad21-adf086d50c0a
6
public static void minMaxBonus(Manager[] managers, Pair<? super Manager> result) { if (managers == null || managers.length == 0) { return; } Manager min = managers[0]; Manager max = managers[0]; for(int i = 1; i < managers.length; i++) { Manager c...
09eb64f5-3a0b-45f9-ba86-9a4bbb0f9da0
8
private int doTraceback() { int score; // First, do the actual traceback. score = doTracebackAt(matrix.length-1, matrix[0].length-1); if (false) { int diag = matrix.length < matrix[0].length ? matrix.length : matrix[0].length; int count = 0; for (int slice = 0; slice < diag; slice++) { int localCount ...
b81bb04b-d883-4b6f-89f6-ec6e12610f4c
2
public CycLeaseManagerReason(final String reason) { //// Preconditions if (reason == null || reason.length() == 0) { throw new InvalidParameterException("reason must be a non-empty string"); } this.reason = reason; }
a7bd3144-a035-4dc9-b18b-af462e7a43a3
3
public int minCost(int i, int j) throws Exception { if (i > j) throw new Exception("Invalid Matrix sequence"); if (i > n || j > n) throw new Exception("Non existent matrix specified"); return m[i][j]; }
0bc8a723-8875-4700-8f7e-2e00f67236cc
8
public AbstractLocator(String abstractPath, Form queryForm, ClientInfo clientInfo) { this.abstractPath = abstractPath.endsWith("/") ? abstractPath.substring(0, abstractPath.length()-1) : abstractPath; this.queryString = URLDecoder.decode(queryForm.getQueryString()); this.queryForm = queryForm; this.clientInfo =...
364275d1-ddf5-4a5e-b317-aaa2710cfc5e
8
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof TimePeriodValues)) { return false; } if (!super.equals(obj)) { return false; } TimePeriodValues that = (TimePeriodValues) o...
09d19e8a-90ae-48cc-b357-98850c78ebdc
3
public void setWorld(GameMap gmap){ if(theWorldsWindow != null){ this.remove(theWorldsWindow); } theWorldsWindow = new WorldWindow(gmap, cellWidth, cellHeight); if(inventoryPanel != null){ this.add(inventoryPanel); } this.add(theWorldsWindow); if(player != null){ theWorldsWindow.setPersp...
b1b573f4-d5cc-4e47-906d-5d851082afe2
4
@SuppressWarnings("rawtypes") private static List<Class> findClasses(File directory, String packageName) throws ClassNotFoundException { List<Class> classes = new ArrayList<Class>(); if (!directory.exists()) { return classes; } File[] files = directory.listFiles(); for (File file : files) { if (file.is...
4315259e-6465-4b0f-b31c-1b7920828d8c
8
@SuppressWarnings("rawtypes") private String prepareText(String sHtml) { sHtml = this.sanitize(sHtml); List<String> lWords; lWords = new ArrayList<String>(Arrays.asList(sHtml.split(" "))); Iterator i; i = lWords.iterator(); /* * Usuń zbyt krótkie i zbyt długie elemenety */ String element = null...
3ed57e23-3f84-4634-9b55-6b8acac451ea
7
public void mouseWheelMoved(MouseWheelEvent event) { int rotation = event.getWheelRotation(); handleInterfaceScrolling(event); if(mouseX > 0 && mouseX < 512 && mouseY > 503 - 165 && mouseY < 503 - 25) { int scrollPos = client.anInt1089; scrollPos -= rotation * 30; if(scrollPos < 0) scrollPos = 0; ...
c005a344-35c7-4ac9-ae57-c5e75d2a41b1
0
public String getLogin() { return _login; }
fa779931-9ff5-4752-a696-4ee79696fd5a
5
public static String htmlq(String html) { if(html == null) return("(null)"); StringBuilder buf = new StringBuilder(); for(int i = 0; i < html.length(); i++) { char c = html.charAt(i); if(c == '&') buf.append("&amp;"); else if(c == '<') buf.append("&lt;"); else if(c == '>') buf.append("...
7ffd6d43-12b3-43e2-90d0-e9a2fcbd26d9
5
private static void loadQueues(FileWriter usersQueue, HashSet<Long> vis) throws Exception { System.out.println("\nInitiate queue: "); ArrayList<File> idList = new ArrayList<File>(Arrays.asList(new File("./UserIds/").listFiles())); int cnt = 0; float sum = 0; for (File file : idList) { BufferedReader buff ...
4fdfa0bc-58c9-41cc-a9cb-938e8b4c7945
9
private void copyOriginalResources(File dir) { new GuiMessage("Copying from "+dir.getAbsolutePath()).create(); List<File> dirs = new LinkedList<File>(); dirs.add(dir); while (!dirs.isEmpty()) { File f = dirs.remove(0); if (f.isDirectory()) { if (f.getName().matches("\\.{1,2}")) continue; for...
7fb0ce29-af07-4a93-bf1f-19e4884a9c10
2
private void writeTilesetReference(TileSet set, XMLWriter w, String wp) throws IOException { String source = set.getSource(); if (source == null) { writeTileset(set, w, wp); } else { w.startElement("tileset"); w.writeAttribute("firstgid", getFirstGid...
08c74067-5f37-4f45-9c41-ab751acd5c16
3
public void scrollHorizontally(ScrollBar scrollBar) { if (image == null) return; if (imageWidth > visibleWidth) { final int oldOffset = displayFDC.xOffset; final int newOffset = Math.min(scrollBar.getSelection(), imageWidth - visibleWidth); if (oldOffset != newOffset) { paintCanvas.update(); displa...
7571008d-1b3f-4679-bbd9-ee91a1e14190
0
@Override public void removeServerStartListener(ServerStartListener listener) { serverStartListenerList.remove(ServerStartListener.class, listener); }
4af9309f-ee51-4dfb-ae21-49ff44db0565
6
protected String tnorm(String name) { if ("min".equals(name)) { return Minimum.class.getSimpleName(); } if ("prod".equals(name)) { return AlgebraicProduct.class.getSimpleName(); } if ("bounded_difference".equals(name)) { return BoundedDifferenc...
e1330e97-c380-4355-9788-0a93bcc15af3
3
public static String toString(Object array) { int len = Array.getLength(array); StringBuilder sb = new StringBuilder(); for (int i = 0; i < len; i++) { Object obj = Array.get(array, i); if (obj == null) { sb.append("null"); } else { sb.append(obj.toString().replace(";", ";;")); } if (i != l...
612f07ea-49dc-407b-adb1-e6e71536c0dc
0
public boolean getWrapAround() { return this.wrapAround; }
0fa307d7-1ae5-4a23-a5d7-aaae33b85c12
2
protected BufferedImage getImage() { if ((System.currentTimeMillis() - systemTime) > frameSpeed) { systemTime = System.currentTimeMillis(); if (animationFrame == animation.length) { animationFrame = 0; } BufferedImage crop =...
e7e063e3-1cf0-4d71-b2e7-26bb2c28e368
6
public ArrayList<Forecast> requestForecast() { URL url; HttpURLConnection conn; BufferedReader rd; String line; String result = ""; try { url = new URL("http://api.openweathermap.org/data/2.5/forecast/daily?lat=55.681589&lon=12.529092&cnt=14&mo...
03735aeb-0668-4b07-96c4-04f0f0b148fa
2
public Type simple() { if (isIntegral()) { return Type.INTEGER; } if (isReference()) { return Type.OBJECT; } return this; }
0c875ded-33cc-4be1-8f82-bf243c0807d5
1
public int getAgentsAlive() { if (sim != null) { return sim.getWorld().getConfiguration().getAgentCount() - sim.getWorld().getDead().size(); } else return 0; }
374d13cb-5ddc-4846-b768-712599a8c3e0
9
public void switchPanel(String token){ getContentPane().removeAll(); if( token.equals("sceneCreate")){ if( this.scenePanel == null ) this.scenePanel = new SceneCreatPanel(this); getContentPane().add(scenePanel);//切换成游戏场景面板 Game.switchPanelStatus("sceneCreate");//切换游戏面板状态 }else if( token.equals("sc...
1467fc38-dca6-4bc4-afdc-46ecaf03e6a3
9
public GravityEditor(Frame owner) { super(owner, "Change Gravity", false); String s = MDView.getInternationalText("ChangeGravity"); if (s != null) setTitle(s); setResizable(false); setSize(160, 240); setDefaultCloseOperation(DISPOSE_ON_CLOSE); Container container = getContentPane(); container.setLa...
1547d177-f5a1-4b2c-97e1-2082a91125c4
8
static public ParseException generateParseException() { jj_expentries.clear(); boolean[] la1tokens = new boolean[26]; if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } for (int i = 0; i < 6; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { ...
4520dcad-f21b-436e-b452-b69f34e777af
3
public boolean unload100OldestChunks() { for(int var1 = 0; var1 < 100; ++var1) { if(!this.droppedChunksSet.isEmpty()) { Integer var2 = (Integer)this.droppedChunksSet.iterator().next(); Chunk var3 = (Chunk)this.chunkMap.get(var2); var3.onChunkUnload(); this....
14d7c29d-94fa-415f-be90-64f745bcd704
9
int insertKeyRehash(double val, int index, int hash, byte state) { // compute the double hash final int length = _set.length; int probe = 1 + (hash % (length - 2)); final int loopIndex = index; int firstRemoved = -1; /** * Look...
b1365496-bd03-4167-a67e-0dab57d59492
7
private static Boolean iswhitekey(int note){ int mn = note%12; if( (mn == 0) || (mn == 2) || (mn == 4) || (mn == 5) || (mn == 7) || (mn == 9) || (mn == 11)) return(true); return(false); }
1e001304-e429-4b13-af93-dc059d556680
4
public int searchUpDown() { if (y % BOX_SIZE != 0) { for (int a = 0; a < MOVEMENT_SMOOTHING; a++) { if ((y + a) % BOX_SIZE == 0) { return y + a; } if ((y - a) % BOX_SIZE == 0) { return y - a; } ...
78959580-32f6-426f-a64e-e3b39d54b69e
1
public void removeVertex(Object vertex) { Set others = adjacent(vertex); Iterator it = others.iterator(); while (it.hasNext()) adjacent(it.next()).remove(vertex); verticesToNeighbors.remove(vertex); verticesToPoints.remove(vertex); }
64007329-cd73-46fe-8e2a-f462dd6509bf
4
private void step3Recursiv(String usedEdge, int delta, String target) { if (usedEdge != null && usedEdge.length() > 0 && delta > 0) { int flowAtEdge = this.graph.getValE(usedEdge, this.attrEdgeFlow); //Bin ich Source oder Target String source = this.graph.getSource(usedEdge); if (!source.equals(target...
548bf6ee-005c-4eee-9040-f7f19a4d431f
9
private void setCalibration() { if (matrix==null) return; //fit failed ImageProcessor ip = imp.getProcessor(); /* Calibrate the image to reflect zero level (8-bit and 16-bit only) */ if (!(ip instanceof FloatProcessor) && !(ip instanceof ColorProcessor)) { Calibrati...
dff12e20-35df-4bb8-9ff9-f2a2268b1b09
5
public ResponseHeader(final String header) { this.header = header; final BufferedReader buff = new BufferedReader(new StringReader(this.header)); String line; boolean isfirstLine = true; try { line = buff.readLine(); while (line != null) { if (!line.trim().isEmpty()) { if (!isfirstLine) {...
6ca22554-aa2f-4c7e-bcaa-1cc329548fef
8
@Override public void actionPerformed(ActionEvent e) { Object o = e.getSource(); if (o instanceof JButton) { if (((JButton) o).equals(adauga_absenta)) { String nume_prenume = elev_selectat.getNume() + " " + elev_selectat.getPrenume(); getElevAndClasa(nume_prenume, profesor.getSelectedClasa() ...
6459af57-20aa-4a73-bdf5-160226046348
6
public static Message convertBencodeToMessage (Value<?> value) { try { StringValue tVal = Bencode.getChildValue(value, StringValue.class, "t"); StringValue yVal = Bencode.getChildValue(value, StringValue.class, "y"); byte[] trid = tVal.getValue(); MessageType typ...
d5fcb98f-a884-4072-9572-a352ffce2200
3
public static void main(String[] args){ CreditCard wallet[] = new CreditCard[10]; wallet[0] = new CreditCard("5391", "John", "Bof", 0.0, 2500); wallet[1] = new CreditCard("5391", "ABe", "Bof", 0.0, 2500); wallet[2] = new CreditCard("5391", "Lal", "Bof", 0.0, 2500); for (int i=1;i<=16;i++){ wallet...
afb8e6bc-4d20-45aa-89fa-dc61f2303a21
3
@Override public String getColumnName(int coluna) { switch (coluna) { case 0: return "Tipo"; case 1: return "Lexema"; case 2: return "Posição"; default: return ""; } }
3b9e129a-37d4-49d0-b717-1688871fc4f6
8
private static String getNumber(String text, boolean borne, int min, int max) { int nombre = 0; // contient le nombre entré String choix = ""; // contient le texte entré par l'utilisateur do { choix = JOptionPane.showInputDialog(text); // s'assurer que la réponse ent...
c08434a3-dd6c-4727-8ddd-a484ae2446b4
6
public void addSamples(int[] samples, int length) { int distToEnd; if (mPointer + length >= raw_data.length) { distToEnd = raw_data.length-mPointer; System.arraycopy(samples, 0, raw_data, mPointer, distToEnd); System.arraycopy(samples, distToEnd, raw_data, 0, length-distToEnd); } else { System.ar...
4217f728-1537-40da-9885-b455d47e627e
4
final void removeSuccs() { if (succs == null) return; if (succs instanceof Instruction[]) { Instruction[] ss = (Instruction[]) succs; for (int i = 0; i < ss.length; i++) if (ss[i] != null) ss[i].removePredecessor(this); } else ((Instruction) succs).removePredecessor(this); succs = null; }
1567cf83-b056-4378-b6eb-7622193fd14b
8
public void run() { try { byte[] buffer = new byte[BUFFER_SIZE]; while (true) { final int bytesRead = m_in.read(buffer, 0, BUFFER_SIZE); if (bytesRead == -1) { break; } final byte[] newBytes = m_filter.handle(m_connectionDetails, buffer, bytesRead); m_outputWriter.flush(); if (n...
692bf890-6a24-4fec-b947-0624d25ad260
1
public void visitFieldInsn( final int opcode, final String owner, final String name, final String desc) { buf.setLength(0); buf.append(tab2).append(OPCODES[opcode]).append(' '); appendDescriptor(INTERNAL_NAME, owner); buf.append('.').append(name).appen...
6a76c63c-f48b-4a71-8d4c-980d37700f2c
2
@Override public List<DirectionStayHotel> load(Criteria criteria, GenericLoadQuery loadGeneric, Connection conn) throws DaoQueryException { int pageSize = 50; List paramList = new ArrayList<>(); StringBuilder sb = new StringBuilder(WHERE); String queryStr = new QueryMapper() { ...
8be9de3e-46d1-439b-8c49-a572e46b7cdf
5
public ACTION matches(Message message) { ACTION result = ACTION.NOTHING; if (itemMatches(this.src, message.getSrc()) && itemMatches(this.id, message.getId()) && itemMatches(this.kind, message.getKind()) && itemMatches(this.dest, message.getDest())) { ...
3466d1ba-1774-4fe5-82c1-0ebf37233f91
7
public int getPrice(){ int price; if (dimensions.ordinal() == 0){ price = 4; if(size.ordinal() == 0) price += 1; else if (size.ordinal() == 1) price += 2; else if (size.ordinal() == 2) price += 3; } ...
7fb27bf8-d0ac-436b-8de7-96465767c5a9
2
public void stop() { if (sequencer != null && sequencer.isOpen()) { sequencer.stop(); sequencer.setMicrosecondPosition(0); } }
1aaea575-5101-448e-9978-b87f20316f4f
3
private static void dfs(boolean[][] nabomatrise, int start, int len) { noderMed[start] = true; for (int i = 0; i < len; i++) { if (nabomatrise[start][i] && !noderMed[i]) { dfs(nabomatrise, i, len); } } }
8f6e09f1-8fce-4688-b3fc-49fe8a384850
1
private void showLivePane() { if (isAncestorOf(livePanel)) { remove(livePanel); } else { add(livePanel,java.awt.BorderLayout.WEST); } revalidate(); repaint(); }
404666f9-c103-4294-ac69-673c33cfa7b8
3
public void removePagina() { List<Layer> lrs = new LinkedList<Layer>(); for (Layer l : layers) { if (l instanceof Pagina) { lrs.add(l); } } for (Layer l : lrs) layers.remove(l); }
8304d38a-758f-4ac5-9330-c66b36cb47df
4
@Override public void shutDown() throws RemoteException { for (IJobProcessingService service : services) { service.shutDown(); } try { if (registry != null) { registry.unbind(JobUtility.getDispatcherRegistrationName()); registry.unbind(JobUtility.getDispatcherExecutionName()); try { Unica...
c200bfd4-c02d-4bc2-93a0-1b893dffada7
0
protected Icon getIcon() { java.net.URL url = getClass().getResource("/ICON/arrow.gif"); return new javax.swing.ImageIcon(url); }
ce74b00a-1cbd-42f9-89ae-8c4e42d2bc24
6
public final boolean equals(Object obj) { if(this == obj) return true; if(obj == null) return false; if(getClass() != obj.getClass()) return false; Z z = (Z)obj; if(KKLI != z.KKLI) return false; if(s != z.s) ...
f3fd3c3b-447d-4ef9-9c91-a7aa118cf87f
0
public void ding() { class temp2 implements Runnable { int screen_width = Toolkit.getDefaultToolkit().getScreenSize().width; int screen_height = Toolkit.getDefaultToolkit().getScreenSize().height; @Override public void run() ...
5cfd69ab-dc8f-423d-a275-7fa309750936
0
public Chromo(List<T> genes, double fitness){ setGenes(genes); setFitness(fitness); }
7713dabe-5d0d-4ec3-9a37-b0390a4dd686
3
@Override public void ParseIn(Connection Main, Server Environment) { Environment.InitPacket(13, Main.ClientMessage); Environment.Append(0, Main.ClientMessage); // categories.. Environment.Append(Main.Data.FriendsUpdateNeeded.size(), Main.ClientMessage); for(int id : Main.Data.Fri...
1332fe94-536f-440f-a830-a92785d49271
6
private String getActions(int par, int chi) { String actionLine = ""; String[] actions = c.widgets.get(par, chi).getActions(); if (actions != null) { for (int i = 0; i < actions.length; i++) { if (actions[i] != null) { if (!actions[i].startsWith(" ...
3e8934e4-69a1-47f5-a367-74516e174f0e
3
public void paint(Graphics g) { Graphics2D g2d = (Graphics2D)g; // Draw the maze for(Edge e: maze.grid){ g2d.drawLine(e.c1.x, e.c1.y, e.c2.x, e.c2.y); } // Draw the borders if(maze.borders!=null){ for(Edge e: maze.borders){ g2d.drawLine(e.c1.x, e.c1.y, e.c2.x, e.c2.y); } } }
b6a820ad-15e1-4826-90c4-e581b1760de8
5
@Override public void run() { if(world==null) if((world = Bukkit.getWorld(eCore.worldName))==null) return; world.setTime(18000L); if(world.getWeatherDuration()<40 || !world.hasStorm() || !world.isThundering()){ world.setStorm(true); world.setThundering(true); } }
36fbc875-7af0-4805-a67f-2ae4bdcbfc65
1
public void analyze() { while (!toAnalyze.isEmpty()) { Identifier ident = (Identifier) toAnalyze.iterator().next(); toAnalyze.remove(ident); ident.analyze(); } }
c29a2d50-0585-41a2-8018-abec61abe3a1
9
private void rehashTable() { if (keys == null) { if (check && keyCount != 0) Kit.codeBug(); if (check && occupiedCount != 0) Kit.codeBug(); int N = 1 << power; keys = new Object[N]; values = new int[2 * N]; } else { // Check...
8e54c65f-c31b-48d9-a70a-db83922cffed
0
public void eat(SimpleCreature food) { foodLevel += food.foodLevel; food.die(); }
713c9e25-b2b2-4cb4-91fb-c7c82c215fb3
4
public static Map<Object, Object> javabeanToMap(Object javaBean) { Map<Object, Object> result = new HashMap<Object, Object>(); Method[] methods = javaBean.getClass().getDeclaredMethods(); for (Method method : methods) { try { if (method.getName().startsWith("get")) { String field = method.getName(); ...
1d1c3037-cabf-42ce-bd06-0dfd22cb7681
0
public static void main(String[] args) { ClientFrame frame = new ClientFrame(); frame.setVisible(true); }
faa78c29-416f-4290-b49d-5714014d8383
2
@Override public final boolean equals(Object other) { return other == null || other == this || other instanceof JsonNull; }
1636d7e6-f088-49e4-bc8c-a2cd3cd73ddf
7
public double getAsDouble(final String key) { final Object v = burst.get(key); if(v==null) { return Double.NaN; } if(v instanceof Number) { return ((Number)v).doubleValue(); } final String vstr; if(v instanceof String) { vstr = ((String)v).trim();; } else { vstr = v.toString().trim(); } ...
f72e0b1c-1178-4cea-8071-2ca64f132e54
8
protected void setFieldValueWithAccessor(Object obj, Field field, Object value) { if (field != null) { try { Method method = getAccessor(obj, field, false); if (method != null) { Class<?> type = method.getParameterTypes()[0]; value = convertValueFromXml(type, value); // Conver...
fd4a9d82-b648-4b7b-9fe2-95539d672f96
5
private void setupRandPartB() throws IOException { if (this.su_ch2 != this.su_chPrev) { this.currentState = RAND_PART_A_STATE; this.su_count = 1; setupRandPartA(); } else if (++this.su_count >= 4) { this.su_z = (char) (this.data.ll8[this.su_tPos] & 0xff); ...
b872e3b4-e7fd-4427-b8d1-bd90da46c7fa
5
public void makeDefaultGrid() { for (int i = 0; i < 101; i++) { for (int j = 0; j < 25; j++) { GridSpace d = new GridSpace(new ArrayList<Thing>()); if (i == 100) { d.add(new Terrain(false, Color.BLACK)); } else if (j >= 22) { d.add(new Terrain(true, Color.GREEN)); } else if (j > 2) { ...
80fbf8b5-bf9d-4beb-af70-119417fb2343
4
public Animation getAnimationStill(Animation animation){ if(dead){ return death; } if (type == Type.CAT){ if (animation == catAnimLeftWalking){ return catAnimLeftStatic; } else { return catAnimRightStatic; } } else { if (animation == dogAnimLeftWalking){ return dogAnimL...
e2451a4f-8d99-48dd-b5b8-d5fd5b9e483f
9
public static Cons cppFlattenStatements(Cons statements) { if ((statements != null) && (!(statements == Stella.NIL))) { { Surrogate testValue000 = Stella_Object.safePrimaryType(statements.value); if (testValue000 == Stella.SGT_STELLA_CONS) { { Cons flattenedsubtree = Stella.NIL; ...
cffbed20-9b55-41fd-a79e-b44bec0d01a8
6
public ListNode rotateRight(ListNode head, int n) { if (n == 0) return head; if (head == null) return head; ListNode slow = head; ListNode fast = head; while (n > 0) { if (fast == null) { fast = head; } fast = fast.next; n--; } if (fast == null) ...
d2e7644b-30d4-4c2b-9a69-9e67015b9462
7
private static void getAllInfo(String commandInfo) { String command; String withoutCommand; Scanner in = new Scanner(commandInfo); in.useDelimiter(" \\\\"); String next = in.next(); dataPacket[LOCATION_TASK_NAME] = next; while(in.hasNext()) { next = in.next(); command = getFirstWord(next); w...
f9071d00-7a04-4d93-b071-57fc6542949a
4
public void recuperaMosse(AlberoMosse am, Mossa m, TabellaScelta tabsc){ //Se l'albero da analizzare non è null if(am!=null){ //Aggiungo la mia posizione alla mossa m.addNewPos(am.getPosizione()); //Se l'albero mosse è di una mossa di arrivo di mangiata ho concluso la mossa if(am.isSAMNull()){ ...
913f75e4-28bd-4370-885c-aae0c96c378c
2
@Override public Object execute(HttpServletRequest request, HttpServletResponse response) throws Exception { Contexto oContexto = (Contexto) request.getAttribute("contexto"); oContexto.setVista("jsp/mensaje.jsp"); EmpresaBean oEmpresaBean = new EmpresaBean(); EmpresaDao oEmp...
5f5b46dc-1101-457a-9024-04fcded49d19
3
public Organism getOrganismByID(int id) { for (int i = 0; i < getSpecies().size(); i++) { for (int j = 0; j < getSpecies().get(i).getNumberOrganisms(); j++) { if (getSpecies().get(i).getOrganism(j).getOrganism_id() == id) { return getSpecies().get(i).getOrganism(j...
6468df5f-937f-4ab7-9882-38abeaabd198
2
@Override public int mover() { Partida.Pantalla pantalla = Partida.getPantalla(); if (x + xv < pantalla.getX()){//izq xv = Math.abs(xv); } if (x + xv + width > pantalla.getX() + pantalla.getWidth()){//derecha xv = -Math.abs(xv); }...
b0bb225d-4e0a-419f-9e1d-153cb183d217
2
public static boolean createBash() { File f = new File(FILENAME); if (f.exists()) { f.delete(); } try { BufferedWriter bw = new BufferedWriter(new FileWriter(f)); bw.write("#!/bin/bash\n"); bw.write("\n"); bw.write("export CHEDDAR_PATH=" + CHEDDAR_ROOT + "\n"); bw.write("export CHEDDAR_INSTA...
a89fb6cc-b0dc-4b37-9fc4-3495ff5067bd
5
public boolean setBestOrganism() { boolean flag = false; if (this.bestOrganism == null) { this.bestOrganism = getSpecies().get(0).getOrganism(0); flag = true; } for (int i = 0; i < getSpecies().size(); i++) { for (int j = 0; j < getSpecies().get(i).get...
035a4530-4281-40f3-9683-2bc8a65d43ac
3
@Override public void caseAAvalieExplogSenaoComando(AAvalieExplogSenaoComando node) { inAAvalieExplogSenaoComando(node); { List<PComando> copy = new ArrayList<PComando>(node.getSenao()); Collections.reverse(copy); for(PComando e : copy) { ...