method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
564f17cd-6368-408f-97e2-59bd102cd073
3
public String GetNpcName(int NpcID) { for (int i = 0; i < server.npcHandler.maxListedNPCs; i++) { if (server.npcHandler.NpcList[i] != null) { if (server.npcHandler.NpcList[i].npcId == NpcID) { return server.npcHandler.NpcList[i].npcName; } } } return "!! NOT EXISTING NPC !!! - ID:"+NpcID; }
09c4b337-cf95-447a-9363-aea9b3e2d5b8
8
public void shortestPath(int vertex){ for(int i = 0; i < gSize; i++) smallestWeight[i] = weights[vertex][i]; boolean[]weightFound = new boolean[maxSize]; for(int i = 0; i < gSize - 1; i++){ double minWeight = Integer.MAX_VALUE; int v =0; ...
d7eadff1-212d-4f15-b2a0-07dd56a34c8d
4
public double getDiversity(List<Map<Integer, Double>> resourceTopics) { double diversity = 0.0; if (this.predictionData == null || this.predictionData.size() == 0) { return diversity; } List<Integer> predictionIDs = new ArrayList<Integer>(); for (String res : this.predictionData) { predictionIDs.add...
39e07db3-b892-4851-b181-6b77e7464101
9
public void place(Vector[][] paramArrayOfVector) { int i = this.location.x; for (int j = 0; j < this.shape.length; j++) { int k = this.location.y; for (int m = 0; m < this.shape[0].length; m++) { if (this.shape[j][m] != null) { if ((i >= 0) && (i < paramArrayOfVector.length) ...
4a96512c-8211-4536-b36f-25794e61462e
0
public void stop_logging() { ++stop_logging_count; }
9aaf7177-2680-4ae3-80bc-3b3d6c8a8a6a
7
public QueryMetaData getMetaData(HyperGraph graph, HGQueryCondition condition) { QueryMetaData x = QueryMetaData.ORACCESS.clone(condition); // assume we have ORACCESS, but check below boolean ispredicate = true; x.predicateCost = 0; for (HGQueryCondition sub : ((And)condition)) { ConditionToQuery transfor...
ad40be45-585d-468d-a0cd-a735ebecf4b1
8
private int[] getTarget() { // find the best target based on distance and current rotation of my tank // return rotation to hit the target InfoDetail chosen = null; int distX, distY; double dX, dY; double angle; double distance, minDistance; int c...
c17ceb96-b31c-4627-9f39-6e07e9ac2892
9
static final void method2936(GraphicsToolkit graphicstoolkit, int i) { anInt7525++; int i_1_ = 0; int i_2_ = 0; if (Class71.aBoolean967) { i_1_ = Class67.method733(-82); i_2_ = Class226.method2112(256); } graphicstoolkit.KA(i_1_, i_2_, Class360.screenWidth - -i_1_, i_2_ + 350); graphicstoolkit.aa(i_...
31fc3e20-2e93-4436-9502-efe7d13e3e9b
1
@Override public void onDisable(){ if(enable){ dm.shutdown(); logger.info("[StarDoor] Plugin disabled!"); } }
0d309318-1b40-466f-867d-1bd8c43969af
8
public void playCard(IServerPlayer p, CardInterface c) throws IOException { if (!order.isCurrentPlayer(p)) { pm.sendErrorPacket(p.getName(), "It is not your turn!", ErrorReason.NOT_YOUR_TURN); return; } if (!stats.allForecastsMade()) { pm.sendErrorPacket(p.get...
1df9216f-bcd3-412f-8c9a-6c0a51a0cd1a
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Producto)) { return false; } Producto other = (Producto) object; if ((this.idProducto == null && other.idProduc...
592dea20-4c3c-4252-a4ed-ac0d0d47cf28
5
@Override public void mousePressed(final MouseEvent e) { final Point p = e.getPoint(); final Element element = getGraphicPanel().getElementAt(p); if (element instanceof Vertex) { final Vertex vertex = (Vertex) element; if (this.edge == null) { this.edg...
34e905b7-524e-4c4b-ab2d-f7be44605a87
8
private Result unpackRe() throws ApiDataException, ApiConnectionException { nextLine(); int l = 0; Result res = new Result(); while (!line.startsWith(("!"))) { l++; if (line.startsWith(("="))) { String parts[] = line.spl...
3b12fa4a-6ad8-4638-a9e7-38b3d04db6d7
5
private static void jeu(mode type) { int i; int erreur; int faute; int resultat; erreur = 0; faute = 0; for(i=0; i<PARTIE; i++) { //jouer une partie et récupérer le nombre d'erreur resultat = partie(type); faute += resultat; if(resultat == CHANCE) erreur++; } JOptionPane.showMessa...
29d5841a-7cb8-4178-9c34-a753695c5f50
6
public JMenu loadMenu(String title, String[] menutitles) { JMenu menu = new JMenu(title); add(menu); boolean radioButtonMode = false; boolean checkBoxButtonMode = false; ButtonGroup group = new ButtonGroup(); for (int i = 0; i < menutitles.length; i++) { if (menutitles[i].equals("***")) { menu.add(n...
e9f01cc3-0d35-4224-a2ae-830317f22dc2
0
public PlayerAbs(Player name){ this.name = name; }
6ad9d77a-4f74-4c41-b108-d33674f163d2
2
@Override public void play() throws IOException, InterruptedException { List<BufferedImage> frames = new ArrayList<>(); BufferedImage frame = null; for (int i=0;i<500;i++) { frame = grab.getFrame(); frames.add(frame); } // while ((frame = grab.getFrame(...
edeb9839-204a-40cd-b66d-002b4991e93e
2
public int Obtener_Secuencia() { try { int id1 = 0; String sql = "select count(*) from mamas"; ResultSet rs; if ((rs = conn.consultar(sql)).next()) { id1 = Integer.parseInt(rs.getString(1)); } return id1; } catch (SQ...
ae9d820b-1db4-4875-a03a-bb852e699408
8
@Override public boolean tick(Tickable ticking, int tickID) { if(!super.tick(ticking,tickID)) return false; if(affected==null) return false; if(!(affected instanceof MOB)) return true; final MOB mob=(MOB)affected; if((!mob.amDead())&&((--diseaseTick)<=0)) { MOB diseaser=invoker; if(disease...
70b26dd3-9acf-4375-bed6-b09521d07e9a
8
private double findSplitNumericNominal(int index) throws Exception { double bestVal = Double.MAX_VALUE, currVal, currCutPoint; int numMissing = 0; double[] sum = new double[m_Instances.numClasses()]; double[][] bestDist = new double[3][m_Instances.numClasses()]; // Compute counts for all the value...
365b6be8-fc5b-4d76-bd49-4185b6977dd8
7
public String longestCommonSubstring(String s, String t) { int[][] matrix = new int[s.length()][t.length()]; int maxLen = 0; int lastSubStart = 0; int currentSubStart = 0; StringBuilder sb = new StringBuilder(); for (int i = 0; i < s.length(); i++) { for (int j = 0; j < t.length(); j++) { if (s.charA...
7c04fa9c-cf90-43e2-bdb6-115e0459c1cf
8
public static Matrix4D computeTransform(double[] extrusion, double[] coord) { Vector3D Ax = null; if(extrusion[0] == 0d && extrusion[1] == 0d && extrusion[2] > 0d && coord[2] == 0d) return null; if((extrusion[0] >= 0f ? extrusion[0]:-extrusion[0]) < 0.015625F && ...
20008235-5ad5-48b7-9f63-01e1f6999bfd
8
public EnumSettingContainer(Class<?> enumClass, List<?> objectList, String missingEnumError) { if (objectList == null) return; this.contains = new ArrayList<String>(); Object[] enumValues = enumClass.getEnumConstants(); for (Object obj : objectList) { if (obj instanceof String == false) co...
99051f2c-4f5f-4d4d-b122-835f137b0db6
1
private boolean isPageToRedirect(String page) { return page.contains(HOME_PAGE) || page.contains(ERROR_PAGE); }
779d7be2-8e2f-4c70-95f8-8d3f3924c929
8
public boolean isCollision(Sprite s1, Sprite s2) { // if the Sprites are the same, return false if (s1 == s2) { return false; } // if one of the Sprites is a dead Creature, return false if (s1 instanceof Creature && !((Creature)s1).isAlive()) { return fal...
f3432323-b504-40c5-a7e3-e695301351af
8
public static void main(String args[]) { try { // create the lp_solver RampMeteringSolver solver = new RampMeteringSolver(config, K_dem_seconds, K_cool_seconds, eta, sim_dt_in_seconds,solver_type,true); // populate state link ids ml_link_ids.addAll(solver.get_m...
9cd6a8e8-b77d-4b8c-a5c2-56a193277c41
7
@Override @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) public void addComponent(Product product, Component component) { // Check arguments // TODO: contracts checking is better to check with AOP if (product == null || product.getName() == null || prod...
083762d3-a1b8-4a0a-bf00-4792cc689ad5
3
public boolean updatingLighting() { if (this.lightingUpdatesCounter >= 50) { return false; } else { ++this.lightingUpdatesCounter; try { int var1 = 500; boolean var2; while (this.lightingToUpdate.size() > 0) { ...
c66967c2-c9ce-499e-83a8-282b32b401a7
4
private static boolean testCommandSig(Method method, Class<?> returnType) { Class<?>[] paramTypes = method.getParameterTypes(); return (paramTypes.length == 1 && paramTypes[0] == CommandContext.class && method.getReturnType() == returnType); }
2223dec2-321f-4414-9cc9-4763b6baef71
2
public void setPlayers(ArrayList<Player> players) { int i = 0; while (i < players.size()) { ((PlayerComponent) this.getSubComponent(i)).linkPlayer(players.get(i)); this.getSubComponent(i).animateColor(new AlphaColorAnimation(1000, Animation.PACE_LINEAR, false, this.getSubComponen...
65c08bb6-c51b-434c-be26-e33a2409f01f
6
@Override public Handler createHandler(Class<?> type) { if (type == World.class) { return new WorldHandler(); } else if (type == Country.class) { return new CountryHandler(); } else if (type == Continent.class) { return new ContinentHandler(); } else if (type == Neighbour.class) { return new Neighb...
134e93b2-7224-486a-9505-818631886b57
4
private void initComponents() { this.setLayout(new GridLayout(view.getHeight(), view.getWidth())); this.vakjes = new Vakje[view.getHeight()][view.getWidth()]; for (Tile t : view.getTiles()) { vakjes[t.getY()][t.getX()] = new Vakje(); this.add(vakjes[t.getY()][t.getX()])...
a2b6049b-3a28-4c72-9d77-4d70ced4da40
9
public void runRandomTest(File f, AI ai) throws FileNotFoundException, UnsupportedEncodingException, IOException { FileWriter out = new FileWriter(f, true); int wins = 0; int ties = 0; int loss = 0; for (int g = 0; g < numGames; g++) { double[...
478976c6-718f-4204-b057-1d957f590539
0
@XmlAttribute public void setId(int id) { this.id = id; }
4f63f57e-7a3b-4f52-b971-7821238616a7
3
public boolean isNeedRead() { return inData.hasRemaining() || ( inCrypt.hasRemaining() && engineResult.getStatus() != Status.BUFFER_UNDERFLOW && engineResult.getStatus() != Status.CLOSED ); }
50a2cedb-6934-405d-a6e4-5a3a8c4c050b
3
private static boolean isNumeric(String attr) { attr = attr.toLowerCase(); return attr.equals("integer") || attr.equals("numeric") || attr.equals("real") || attr.equals("continuous"); }
be15a7c4-3d68-4b10-aa9a-ea055e9e9407
7
public String getRawResultOutput() { StringBuffer result = new StringBuffer(); if (m_Classifier == null) { return "<null> classifier"; } result.append(toString()); result.append("Classifier model: \n"+m_Classifier.toString()+'\n'); // append the performance statistics if (m_result !=...
98d13715-01fc-47f8-8455-f7b397d584ad
9
@Override public void run() { try { DHCPPacket dhcp_recv = DHCPPacket.getPacket(this.packet); DHCPPacket dhcp_send = null; if(!dhcp_recv.isDhcp()) return; Byte messageType = dhcp_recv.getDHCPMessageType(); if (dhcp_recv.getOp() == BOOTREQUEST) { switch (messageType) { case DHCPDISCOV...
22cd9058-b3c6-4201-aefe-844c3249306d
8
public String interpretCommand(ClientCommand clientQuery) throws ServiceException { if(clientQuery == null) throw new ServiceException("Client Query object not initialized"); if(clientQuery.getCmd().isEmpty()) throw new ServiceException("Client Query object not properly initi...
98c6e358-e5aa-47e6-9a14-83a7e03c0cdd
2
@Override public final synchronized void paintComponent(Graphics g) { if (background != null) { background.render(g, 0, 0); } for (RenderItem item : renderlist) { item.render(g, 0, 0); } renderlist.clear(); }
c5b674cf-1790-4f36-b7e2-d00feae7ed6b
0
public OperatingSystem getOperatingSystem() { return operatingSystem; }
1d14fd60-85af-4a68-97fc-97fbdb40f026
8
private void validate() { if (isDense() && isPattern()) throw new IllegalArgumentException( "Matrix cannot be dense with pattern storage"); if (isReal() && isHermitian()) throw new IllegalArgumentException( "Data cannot be real with hermiti...
674f6f01-5bf9-4fc0-8653-cc12ebeda18e
6
private void initComponents() { addWindowListener(new WindowAdapter() { @Override public void windowClosed(WindowEvent e) { if (!startPressed) { if (script != null) { script.ctx.controller.stop(); } } } }); for (Summoning.Familiar familiar : familiars) { familiarMap.put(String...
6de7c173-8fab-49cf-914f-2a573140aec8
5
@Override protected void read(InputBuffer b) throws IOException, ParsingException { VariableLengthIntegerMessage i = getMessageFactory().parseVariableLengthIntegerMessage(b); b = b.getSubBuffer(i.length()); encoding = MessageEncoding.getEncoding(i.getLong()); i = getMessageFactory().parseVariableLengthInteger...
197087a2-7de8-4a49-83c3-4610472760bc
1
@Override public void update (float delta) { if(!boosted){ sprite.setColor(nonBoostedColor); } else sprite.setColor(boostedColor); }
49f92744-c6d2-40ea-82db-259d400fba93
8
public seg segIntersect(seg segptr1,seg segptr2){ seg newsegptr = null; double begin, end; seg firstseg, secondseg, tempseg; if (segptr1 == null || segptr2 == null) { System.out.println("stop! you did something wrong. null seg in seg intersect\n"); } if (segptr1.begin < segptr2.begin) { ...
7ddae930-e331-483c-971d-9cab5c65f85f
5
public void tick() { double speed = 0.1; if (open) openness += speed; else openness -= speed; if (openness > 1) openness = 1; if (openness < 0) openness = 0; if (level.player.x == x && level.player.z == y) { openness = 1; open = tr...
9f8077e7-3cde-4d85-8739-31bdd724fa80
2
public String outCar(String ticketnum) { if(ticketnum.equals("")){ return "请输入你的取车票据号"; } if(!contain(new Ticket(ticketnum))) { return "我们这没有停你的车。"; } Car car = out(new Ticket(ticketnum)); return "OK,车牌是[" + car.getCode() + "],欢迎下次光临。"; }
c58ad03a-5432-4be1-9e5f-544370986fae
1
public void testFactory_FromCalendarFields() throws Exception { GregorianCalendar cal = new GregorianCalendar(1970, 1, 3, 4, 5, 6); cal.set(Calendar.MILLISECOND, 7); YearMonthDay expected = new YearMonthDay(1970, 2, 3); assertEquals(expected, YearMonthDay.fromCalendarFields(cal)); ...
93dc5373-ea35-4b49-8544-e04db2ac22a9
6
public Class getType(ELContext context, Object base, Object property) { if ((base == null) || (property == null)) { return null; } context.setPropertyResolved(true); FacesContext fcontext = (FacesContext) context.getContext(FacesContext.class); ELContext elContext =...
ee28d626-4ca4-4288-b8fd-71f7fced7a8a
8
public void generateButtons(int x, int y) { if (!tileLocations[x - 1][y] && getButton(x-1, y) == null) { TilePlacementButton button = new TilePlacementButton(x - 1, y); activeButtons.add(button); add(button, new GBC(x - 1, y)); button.addActionListener(new AddTileAction(x - 1, y)); } if (!tileLocation...
5bbb0ebb-24b2-43ce-95b7-8b1ab55ccff0
0
public void setjLabelTitre(JLabel jLabelTitre) { this.jLabelTitre = jLabelTitre; }
90e387f4-98de-4617-b68b-e40f9780315a
6
public void tick() { // x = randomX(xMin, xMax); // y = randomY(yMin, yMax); // System.out.println(xMin+"< "+x+" <"+(xMax+xMin)+" , "+yMin+"< "+y+" <"+(yMax+yMin)); // System.out.println("Vector("+vec.x+","+vec.y+")"); if(hitMiddle()) { vec.y *= -1; x = nextX(); y = nextY(); } // if ...
380d03ce-b1d0-4564-a350-36f422c700a9
7
public void pauze() { for (int i = 0; i < level.length; i++) { for (int j = 0; j < level[0].length; j++) { Iterator<GameObject> it = level[i][j].getGameObjects().iterator(); while(it.hasNext()) { GameObjec...
0f666d67-8b0e-4560-843e-a1f9ae926304
1
@RequestMapping(value = "/find", method = RequestMethod.POST, consumes = "application/json") public @ResponseBody ResponseTO findById(@RequestParam(value = "id") Integer id) { DocumentDTO documentDTO = null; try { documentDTO = documentService.findById(id); return new ResponseTO("success", documentDTO); }...
62e3719d-7f7a-409c-b9f5-1e7ddc5587b6
7
public void saveScoreStats () { File file = new File("Scores.txt"); boolean flag = false; FileWriter writer; ArrayList<String> scoreData = new ArrayList<String>(); ListIterator<String> iterator; /* Uses a try statement to catch any exceptions */ try { Scanner s = new Scanner(file); while (s.h...
d2ee3755-1c80-4d0f-8469-b8239b878316
7
public void setSettings() { StringBuilder font = new StringBuilder(); if (fontType == 0){ font.append("Arial"); } else if (fontType == 1){ font.append("Courier_New"); } else if (fontType == 2){ font.append("Georgia"); } else if (fontType == 2){ font.append("Times_New_Roman"); } else{ ...
d95eadf8-e859-42aa-927f-aff82f2d9f08
9
@Override public void run() { this.lastRun = System.currentTimeMillis(); this.timeBetweenRuns = this.props.getReleaserInterval(); log.debug("Time between runs: " + this.timeBetweenRuns); while (!this.shouldClose) { // pool is closed, join pool manager if (this...
3e10f3b2-6d13-43a5-b8f2-6c242377f6b0
0
public void setVelocityX(float dx) { this.dx = dx; }
373d1ac9-e69d-4afb-9cf2-d3235193b5b2
4
public Board loadBoard(){ ArrayList<Integer> numArray = new ArrayList<Integer>(); Board b = new Board(); File f = new File("savedBoard.txt"); int numero; Scanner entrada = null; try { entrada = new Scanner(f); while (entrada.hasNextInt()) { ...
b53b29eb-c673-4d56-b40f-a0f74bc97ba6
6
public boolean getBoolean(int index) throws JSONException { Object object = this.get(index); if (object.equals(Boolean.FALSE) || (object instanceof String && ((String) object) .equalsIgnoreCase("false"))) { return false; } else if (object.equal...
e9b976cd-a2a9-4cf1-aa3b-4cf61a74a958
9
private void stateDraw(int x,int y){ if(!sedna.getSelected() ||sedna.getSelection(x,y)){ if(statefillflag){ switch(sft){ case 0: mainBrain.setCellState(x,y,1);viewer.setAState(x,y,1); break; case 1: mainBrain.getCell(x, y).setOption(toolstring[1], opval[1]); break; cas...
18ab782f-6f8c-467a-aeab-ac276ae303fb
4
public void animationStep(int i) { for (duration += i; duration > animation.sequences .getFrameLength(elapsedFrames);) { duration -= animation.sequences.getFrameLength(elapsedFrames) + 1; elapsedFrames++; if (elapsedFrames >= animation.sequences.frameCount && (elapsedFrames < 0 || elapsedFrames >= a...
8d76ec6f-a195-4135-b591-64f8425e1018
4
public void draw(Graphics g){ if(initial == false){ for(int i = 0 ; i < images.length ; i++){ g.drawImage(images[i],-100,-100,null); } initial = true; } if(!isLive){ tc.explosions.remove(this); return ; } if(step == images.length){ isLive = false; step = 0; return ; } g.drawIma...
1bccc4ea-f3fd-4693-b308-0fe0575037ef
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...
4a83ac53-9289-4fa1-88a3-a6ea8a514a0d
4
public ViewSummaryReportView(PayrollSystemModel model) { this.model = model; // searchTxtFld = new CustomTextField("Enter search keyword here.", "/images/effects/in.png", "/images/effects/out.png", 180, 41); categoryLbl = new JLabel("Select Category to search: "); categoryCBox = new JComboBox<Object>(...
c9db18c6-dc30-4b6b-b4fb-140482de2157
2
public static Integer parseNumericString(String string) throws InvalidRpcDataException { try { return Integer.parseInt(string); } catch (NumberFormatException e) { if (string == null) { return null; } else { throw new InvalidRpcDataExc...
4a416224-653c-4e32-a071-293e9d7c410e
6
public boolean validateNewData(int x, int y, int width, int height, int iWidth, int iHeight) { // Check positive values. if (x < 0 || y < 0 || width < 0 || height < 0) { return false; } // Check sizes. if (x + width > iWidth || y + height > iHeight) { return false; } return true; }
f235a493-90f4-4f79-b646-45c29a86f0a5
4
public int MovePacket(int inputBufferNumber, int outputBufferNumber,int TIME) { //ONLY ONE BUS PRESENT IN THIS FABRIC //if Active status was successful and the flag is true for having //control of the bus //set packet moved default packetMoved = false; ...
25ef93a3-a26f-4dd9-8568-d7aea9a8631d
0
protected double getPeriod(){ return _period; }
005572b1-35b8-4b60-bc14-30ab751b5682
3
public void setCustomNameVisible(boolean display) { if ((Byte) getValue(6) != (display ? 1 : 0)) { setValue(6, (byte) (display ? 1 : 0)); sendData(6); } }
70b9f063-5156-4b8a-9242-a90e1bfb261a
0
public SplitAction(Being b) { being = b; }
a48f7ab4-c386-4e3e-96c8-ac909ab0c558
2
public void move() { PhysicsComponent ownPC = (PhysicsComponent)getOwningActor().getComponent("PhysicsComponent"); if(ownPC.getAngleRad() < ownPC.getTargetAngle() + 0.1 && ownPC.getAngleRad() > ownPC.getTargetAngle() - 0.1) { ownPC.applyAcceleration(1.0f); } }
2783c8c8-aa5d-40ac-8e9d-b212c9030397
2
static public String graphToString(TreeMap<Integer, TreeSet<Integer> > noeuds) { String strGraph = ""; for(Map.Entry<Integer,TreeSet<Integer>> entry : noeuds.entrySet()) { Integer key = entry.getKey(); TreeSet<Integer> set = entry.getValue(); for(Integer value : set) { strGraph += key + ...
7617507c-dd84-4cd5-9e6a-88a3c25d9019
8
public Iterator<SecPath> paths() { return new Iterator<SecPath>() { Iterator<SecPath> p=null; Iterator<SecGroup> g=null; private boolean doNext() { if(p==null) p=paths.iterator(); if(p.hasNext()) return true; if(g==null) g=groups.iterator(); while(!p.hasNex...
ca9a915f-cf75-478b-847c-61a343aa4aa5
3
public Component getListCellRendererComponent ( JList jlstIn , Object objIn , int iIdx , boolean blnSelected , boolean blnCellHasFocus ) { EzimContact ecTmp = (EzimContact) objIn; Color clrSelf = new Color(EzimConf.UI_COLOR_SELF); // state icon if (ecTmp.getSysState() != EzimContact.SYSSTATE_DEFAU...
788b6461-3d55-4276-b31a-0270e842254a
8
public static void main(String[] args) throws Throwable{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); for (String line; (line=in.readLine())!=null ; ) { int anthills = Integer.parseInt(line); if(anthills==0) break; con = new ArrayList[...
61345b67-b561-408a-8870-373f6cdee482
4
private boolean checkDiagonalAscending(CellState player, int col, int row) { // diagonal-/ // check winLength-in-a-row int winCounter = 0; int x = 0; int y = 0; for (int i = -model.getWinLength() - 1; i < model.getWinLength(); ++i) { x = col + i; // FIXME wtf?? i+1?? y = row - i + 1; if (isIns...
c1c72be9-dd49-4be7-8b5b-63a2d26dd39a
5
public static void main(String[] args) { int c=0,longi; String Cadena_1; Cadena_1=JOptionPane.showInputDialog("Ingrese una Frase"); Cadena_1=" "+ Cadena_1; char[] frase1 =Cadena_1.toCharArray(); for (int i = 0; i< Cadena_1.length() ; i++) { ...
c90b9474-09e1-48d8-b827-f69e5e4203e9
6
@EventHandler public void onPlayerMove(PlayerMoveEvent event) { SpoutPlayer sp = (SpoutPlayer) event.getPlayer(); boolean doMultiply = false; org.bukkit.block.Block below = sp.getLocation().subtract(0, 1, 0).getBlock(); //Block below = event.getPlayer().getWorld().getBlockAt(event.getPlayer().getLocation()...
6d797791-e1a4-48a6-be83-671019500bfe
6
public void mouseReleased(MouseEvent event) { transitionInFlux = false; if (event.isPopupTrigger()) showPopup(event); State[] states = getView().getDrawer().getAutomaton().getStates(); int count = 0; for(int k = 0; k < states.length; k++){ if(states[k].isSelected()){ count++; } ...
3440e357-2053-426a-bf6d-86eac154a167
8
String[] countWords(String sentence, int returnWordCount) { // check input parameter if (sentence == null || sentence.isEmpty()) { System.out.println("Sentence not defined"); return null; } // check input parameter if (returnWordCount <= 0) { System.out.println("Return Words must be greater tha...
1bd227e0-e17b-4198-be5c-51338b347994
8
@Override public boolean tick(Tickable ticking, int tickID) { if(tickID==Tickable.TICKID_MOB) { if(affected instanceof MOB) { final MOB mob=(MOB)affected; if((mob.location()==null) ||(mob.amDead()) ||((invoker!=null) &&((mob.location()!=invoker.location())||(!CMLib.flags().isInTheGame(i...
f44db19a-873b-42fe-8e8b-5e79a4a10492
8
@Override public QueryResult execQuery(Query q) { Statement st = null; ArrayList<HashMap<String, String>> data = new ArrayList<HashMap<String, String>>(); if(!q.isParsed()) { q.parse(); } try { st = con.createStatement(); ResultSet res = st.executeQuery(q.getParsedQuery()); while(res.nex...
61b6a2ad-8868-4708-88d1-b4dae8dbaf81
5
private void advancedStrategy(Agent a) {// afstand wordt bevoordeeld tov padlengte omwille van complexiteit if (a.getCarrying() > -1) { a.calcPath(calcXFromCoor(a.getCampLocation()), calcYFromCoor(a.getCampLocation())); // if carrying a Tilia, go to camp } else { // go pick up a tilia closest to position ...
69be5c40-6b46-4a9e-8d9a-ad3fb253dbab
8
private void btnSalvarMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnSalvarMouseClicked dao = new ProdutoDAO(); produto = new Produto(); produto.setNome(txtNome.getText()); produto.setValorcompra(Double.parseDouble(txtValorCompra.getText())); produto.setValorve...
0adb095a-aedf-448f-abe0-41525d195c81
4
public Ghost matchGhost(Element e, Model m) { final Vec3D p = e.sprite().position ; final Section section = world.sections.sectionAt((int) p.x, (int) p.y) ; List <Ghost> SG = ghosts.get(section) ; Ghost match = null ; if (SG != null) for (Ghost g : SG) { if (g.tracked == e && g.sprite.model() ...
32c9ba7d-b7da-4220-a9a4-669751017522
0
public List<Car> getCars(int idEvent){ return manager.createQuery("SELECT e.cars FROM Event e WHERE e.id='"+idEvent+"'").getResultList(); }
1f3ef597-ccef-4574-8597-263142a9e907
0
public String getLabel() { return myLabel; }
2bd38ad2-5c01-4362-906e-e676fff30e61
8
public List<BeanDefinition> sort() { List<Class<?>> allTypes = getTypesFrom(beans); List<BeanDefinition> sortedBeans = new ArrayList<>(); assertAllSatisfiable(beans, allTypes); List<Holder> holders = getGreedyConstructorsFrom(beans, allTypes); Iterator<Holder> iter = holders.iter...
362a874f-8c7f-4be7-b9a7-7fa9791ad9b9
7
public static void main(String[] args) throws Exception { BufferedWriter writer = new BufferedWriter(new FileWriter(new File( ConfigReader.getBurkholderiaDir() + File.separator + "summary" + File.separator + "summary.txt"))); writer.write("fileA\tfileB\tnumInCommon\tkey\ttime\n"); BufferedWriter...
9e171b58-635a-4d20-9cc3-55af624a044f
1
public boolean rebuildStats(){ for(int idx = 1 ; idx < NB_STATS; idx++){ maxStats[idx] = getMaxStats(idx); stats[idx] = maxStats[idx]; } return true; }
d6e39422-b28e-49ea-92f6-90df4d0df854
9
public static int unitScoreWithUnits(GameEntity en, ArrayList<BaseEntity> enemies, ArrayList<BaseEntity> rivals) //Calculates score of a unit. Adaptive. { float sum = 0; if (en.name.equals("Settler")) sum = 10; else if (en.mode == 0) return 0; else if (en.mode == 1) sum = en.offensiveStr + en.defensiv...
ad48655a-42ca-42b8-b771-18942e0e8786
3
public static List<PatchScript> getUpdatePatches() { List<PatchScript> lPatchList = new ArrayList<PatchScript>(); //Loop through all available update patches for(String lPatchFileName : PATCH_FILES){ String lUpdatePatchString; String lFileHash; //Read file contents try...
31eecb34-e7b7-40f2-98a6-c370b05c4069
5
public final List<ITileType> returnTileList() { ITileType tmpFirst = null; ITileType tmpLast = null; for (ITileType tile : tileList) { if (tile.getName() != null && tile.getName().equals("Town-Center")) { tmpFirst = tile; } else if (tile.getName() != null...
e13cfdad-e8c6-4d50-a9c6-4671528df8d5
0
public void stats(HashMap<Color, Counter> stats) { this.stats = stats; }
cda25ced-db54-466c-a4c7-db9dd7706984
9
public String removePunctuation(String anEntry){ StringBuffer sb=new StringBuffer(); for (int i=0;i<anEntry.length();i++){ if ((anEntry.charAt(i) >= 64 && anEntry.charAt(i) <= 90) //UPPERCASE and @ || (anEntry.charAt(i) >= 97 &&anEntry.charAt(i) <= 122) //lowercase || (anEntry.charAt(i) >= 48 &&anEntry....
d283d083-86a6-4c94-9dad-0926e62e57c8
5
protected Message handleMessage(Message msg) throws IOException { if (msg instanceof JoinMessage) { player = ((JoinMessage) msg).getPlayer(); server.addPlayer(this); } else if (msg instanceof UpdateMessage) { UpdateMessage update = (UpdateMessage) msg; Pla...
42b63108-704f-42ee-9659-8020189eb219
7
public void Solve() { BigInteger largestX = BigInteger.ZERO; int largestD = 0; for (int d = 2; d <= _max; d++) { List<Integer> fractions = Euler.GetSqrtContinuedFraction(d); if (fractions.size() <= 1) { System.out.println("Skipped D=" + d); ...
06630056-596d-437a-91bf-6f8c669f341e
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...