method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
f3833fe2-01a5-4043-a615-4115b3331c20
8
public ArrayList getConnectedNeurons(int neuronNumber) { ArrayList connectedNeurons = new ArrayList(); if ((neuronNumber < colNumber * rowNumber) && (neuronNumber > 0)){ if (neuronNumber - colNumber > 0) { connectedNeurons.add(neuronNumber - colNumber); } ...
6e52909d-5251-4299-ae94-76e5e0b26529
1
public Map<String, String> getFilteredPowerSet(Set<String> usedFeatures) throws FeatureTypeNotFoundException { Map<String, String> newFeatures = new HashMap<String, String>(); for (String usedFeature : usedFeatures) { newFeatures.put(usedFeature, getFeatureValue(usedFeature)); } return newFeatures; }
aaae79cc-77de-4869-b043-d7c2222afa3b
4
private int[] varintencode(int value) { int count = 1; for(int i = 3 ; i >= 1 ; i--) { if(((value)&(127<<(7*i))) != 0) { count = i + 1; break; } } int[] ret = new int[count]; for(int i = 0 ; i < count ; i++) { int hasNext = 0; if(i != count-1){ hasNext = 1; } ret[i] = h...
970eb9b3-7647-48d3-9985-f2cb4fbbf87b
5
public static void main(String[] args) { Collection<Integer> c = new ArrayList<>(); SortedSet<Integer> set = new TreeSet<>(); for (int i = 0; i < 10; i++) { int num = new Random().nextInt(100); c.add(num); set.add(num); } for (Integer i : c) { System.out.println("foreach: " +i); } ...
2f028574-de23-46cb-b574-8153f3d397e2
4
@Override public String toString(){ if(polynomial.isEmpty()){ return "0"; } String polString=""; for(int i=0; i<polynomial.size(); i++){ if(i!=0 && polynomial.get(i).getCoefficient()[0]>0){ polString+="+"; } polString+=p...
77656be0-f42d-4eb2-970d-d059b8a93129
8
public Property and(final Property p) { return fromGen(gen().bind(p.gen(), new F<Result, F<Result, Result>>() { public F<Result, Result> f(final Result res1) { return new F<Result, Result>() { public Result f(final Result res2) { return res1.isException() || res1.isFalsified() ? ...
0710671a-5383-4d7f-88e1-fbac297116fe
5
private void jBCadastrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBCadastrarActionPerformed if(jTEmailCadastro.getText().contains("@") && !jTEmailCadastro.getText().contains(" ") && jTEmailCadastro.getText().contains(".")){ try { // TODO add your handling code h...
c9a26283-bff3-4454-9973-d843bb7c8957
8
public Label rot(long v, int i) { long m = (long)Math.sqrt(this.dim()); long x = v/m; // The first coordinate of the m*m graph long y = v%m; // The second coordinate long v_out; long v_out_x = 0; long v_out_y = 0; long i_out = 0; switch(i) { case 0: v_out_x = (x + y)%m; v_out_y = y; i_out = 1...
f9daec2c-11b0-4803-9535-262f24e58cc7
1
public void listen(Observer co) { if (co instanceof ColorObserver) wantsToKnow.add((ColorObserver)co); }
7d1460c3-48b8-4b15-8f20-d60a23dd6f2d
0
public static Filter isPublic() { return new IsPublic(); }
6d8b30fb-7789-4bf6-817a-2b1f6a920ad6
6
public void render(Graphics g) { g.setColor(Color.white); if (dir == LEFT) { if (!enabled) return; else if (hover) g.drawImage(arrowBtnLeftON, x, y, null); else g.drawImage(arrowBtnLeftOFF, x, y, null); } else if (dir == RIGHT) { if (!enabled) return; else if (hover) g.drawImage(arrowBtnRightON, x,...
e12f5791-1c32-4561-bb69-ee73b127903b
1
private void addBranch(final Label label) { if (branches.containsKey(label)) { return; } branches.put(label, new ArrayList(stackFrame)); }
e94c4037-f5ef-474b-99fc-d5c4ab3c0540
7
@Override public void destroy() throws Exception { log.info(sm.getString("http11protocol.stop", getName())); if (canDestroy) { endpoint.destroy(); } else { log.warn(sm.getString("http11protocol.cannotDestroy", getName())); try { RequestInfo[] states = cHandler.global.getRequestProcessors(); for ...
e408622f-51e7-4b6f-a07b-317becc82839
1
public void clear(){ for(int i = 0; i < pixels.length; i++){ pixels[i] = 0; } }
4e71e1e5-9ff8-42a4-9751-c345c62c7620
5
public static MapleInventoryType getByWZName(String name) { if (name.equals("Install")) return SETUP; else if (name.equals("Consume")) return USE; else if (name.equals("Etc")) return ETC; else if (name.equals("Cash")) return CASH; else if (name.equals("Pet")) return CASH; return UNDEFINED; }
b28178ed-f8bd-46e3-b42d-0997d06a2002
4
private void send(Event event) { try { TreeMap<Integer, IEventHandler> map = listeners.get(event .getClass()); if (map == null) { return; } for (int i : map.keySet()) { IEventHandler handler = map.get(i); Method method = handler.getClass().getDeclaredMethod( "on" + event.getEventNam...
5fea7011-6337-4a70-a569-745e74e99625
2
@RequestMapping("adicionarListaDeDesejos") public ModelAndView adicionarListaDeDesejos(Long produtoId) { ModelAndView mav = new ModelAndView(); if (loginController.isLogado() || adminController.isLogado()) { mav.setViewName("redirect:listaDeDesejos"); UsuarioProduto usuarioProduto = buildUsuarioProduto(p...
425d236a-445d-4dbc-92fe-b0bb61406135
0
@Basic @Column(name = "POP_NIT_PROVEEDOR") public Integer getPopNitProveedor() { return popNitProveedor; }
3b9a4fbb-943a-47cb-ac41-368210c75f80
7
@Override public int[] getInts(int par1, int par2, int par3, int par4) { int[] aint = IntCache.getIntCache(par3 * par4); for (int i1 = 0; i1 < par4; ++i1) { for (int j1 = 0; j1 < par3; ++j1) { this.initChunkSeed(par1 + j1, par2 + i1); ...
113ac9f3-6589-4cc6-9875-8bd56079a9ee
4
int min_expand(int soff, int poff, int ep) { for (;;) { int res = match(soff, ep + 1); if (res != -1) return res; else if (soff < s.length() && singlematch(s.luaByte(soff), poff, ep)) soff++; else return -1; } }
01e297a5-330b-4fd0-9362-691772a8d181
0
public static int fetchRandInt(int min, int max){ return RAND_GENERATOR.nextInt(max-min+1) + min; }
b30985ba-c5db-4e63-abe0-7e157dc4f7d5
0
@Override public void windowActivated(WindowEvent arg0) { // TODO Auto-generated method stub }
ecc12f03-cd8e-41ce-ada1-9a399ea52ac0
3
static public char readChar() throws java.io.IOException { if (inBuf > 0) { --inBuf; if (++bufpos == bufsize) bufpos = 0; return buffer[bufpos]; } if (++bufpos >= maxNextCharInd) FillBuff(); char c = buffer[bufpos]; UpdateLineColumn(c); return c; }
bb3fff94-ac23-47a9-b2f7-8b148049a0bb
1
@SuppressWarnings("deprecation") public void testFactoryFieldDifference3() throws Throwable { YearMonthDay start = new YearMonthDay(2005, 4, 9); TimeOfDay endTime = new TimeOfDay(12, 30, 40, 0); try { Period.fieldDifference(start, endTime); fail(); } catch (Il...
f65dae49-c76f-46c6-b100-9fa436c52153
1
public Configuration[] getInitialConfigurations(String input) { /** The stack should contain the bottom of stack marker. */ State init = myAutomaton.getInitialState(); State[] closure = ClosureTaker.getClosure(init, myAutomaton); Configuration[] configs = new Configuration[closure.length]; for (int k = 0; k <...
ffa8c4eb-1a1e-439c-806d-48ae5f07f6b4
4
public static void invert(TreeNode tr){ if(tr.left==null && tr.right==null){ return; } // if((tr.left==null && tr.right!=null )||(tr.right==null && tr.left!=null)){ // isSy=false; // return; // } TreeNode tmp = tr.left; tr.left = tr.right; tr.right = tmp; if(tr.left!=null){ invert( tr.left ); ...
2c691687-e68f-4049-a912-43b1c593b1d7
6
public void cross(Equation other) { //Pick random Nodes from both equations to serve as the roots of the cross Node swap = getRandomNode(); Node swapOther = other.getRandomNode(); //Get the parents of the swap Nodes in order Node parent, parentOther; parent = swap.getPar...
184eac60-f4d8-4bf3-967f-1144cde8891e
2
public Gui(boolean twoPlayer, int x, int y, int width, int height) { super("Hivolts"); p2 = twoPlayer; if(width == 0 || height == 0) { WIDTH = x*50 + 100; HEIGHT = y*50 + 100; } else { WIDTH = width; HEIGHT = height; } rows = x; cols = y; setPreferredSize(new Dimension(WIDTH, HEIGHT)); g...
b2ee5177-8f1b-4cde-80a1-0987a2939268
1
static private float[] load_d() { try { Class elemType = Float.TYPE; Object o = JavaLayerUtils.deserializeArrayResource("sfd.ser", elemType, 512); return (float[])o; } catch (IOException ex) { throw new ExceptionInInitializerError(ex); } }
e3f74aac-b329-40a8-b2e5-77d4d152561a
2
public void setButtonsWRTSelection(SelectionManager selectionManager) { if(selectionManager.isBuilding()) { Building selectedBuilding = (Building)selectionManager.getFirst(); for(Unit unit : selectedBuilding.getProductionUnits()) { System.out.println("update!"); addButton(new ProductionButton(unit)); ...
e7c54350-dad5-4840-a3e8-ca7de453a6f8
1
void setTextName(int code, String name, int slots, int group){ this.code = code; this.name = name; this.slots = slots; this.group = group; if(code == 0) this.setText("\n " + this.name); else this.setText(this.name + "\nCódigo: " + this.code + "\nCup...
ec5c9864-5a0d-4a71-9f38-b1680a211b2a
3
public void goToBottom(){ if(endOfGame) return; Tetromino pieceToMove = currentPieces.get(0); while(pieceToMove == currentPieces.get(0) && !endOfGame){ movePieceDown(); } this.fireStateChangeListeners(); }
0247d55d-bdce-4cc5-a82e-f3ca1f88c1c7
2
@Override public boolean onCommand(CommandSender sender, org.bukkit.command.Command cmd, String[] args) { if(!(Commands.isPlayer(sender))) return false; if (args.length > 0) return false; ChannelsConfig.reloadChannels(); NicknamesConfig.reloadNicknames(); PlayerChat.plugin.reloadConfig(); Messenger.t...
f5354caa-40cd-4cb9-becd-43574d7f743b
8
public int coinChange(int[] coins, int amount) { if(amount<0 || coins==null || coins.length==0) return -1; if(amount==0) return 0; int[]aux=new int[amount+1]; Arrays.fill(aux,amount+1); for(int i=1;i<=amount;++i){ for(int j=0;j<coins.length;++j){ if(co...
cc657b42-369c-4559-9763-d2290f7db9a1
7
final void renderHermiteRibbon(boolean doFill, int i, boolean thisTypeOnly) { setNeighbors(i); short colix = getLeadColix(i); if (doFill && aspectRatio != 0) { if (setMads(i, thisTypeOnly)) { try { if (meshes[i] == null || !meshReady[i]) createMeshCylinder(i, madBeg, madMid, madEnd, aspectRatio)...
f2688137-9e9f-472f-a8f4-d1a4c609bc88
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."); ...
21245b73-88e4-48b5-a0dd-affda88a94e5
2
public Teacher(ResultSet rs) throws Exception{ rs.beforeFirst(); if(rs.next()){ setPersonID(rs.getInt("personid")); setLastName(rs.getString("lastname")); setFirstName(rs.getString("firstname")); setEmail(rs.getString("email")); setPersonType(r...
71fe8ce7-edcb-453c-8a6b-9841618e1b58
9
private void wmedian(int iteration) { int maxRank = graph.getMaxRank(); if (maxRank == GraphLayoutParameters.MIN_RANK) { return; } if (iteration % 2 == 0) { for (int rank = 1; rank <= maxRank; rank++) { for (LayoutNode v : graph.getRankOrder(rank)) { vertexMedianValues.put(v, medianValue(v, rank...
8770275b-2a05-473e-a218-1088e4c600ed
4
@Test public void equalsTest() { //trueTests for (int i = 0; i < TESTS; i++) { double x = rand.nextInt(); double y = rand.nextInt(); assertTrue(new Vector(x, y).equals(new Vector(x, y))); } //falseTests for (int i = 0; i < TESTS; i++) { double x1 = rand.nextInt(); double y1 = rand.nextInt()...
011d48e8-fd1b-4247-9b8a-6bd131c9ab4b
5
PropMapper findOrCreateMapper(final Class<?> type, final String prop) throws NoSuchFieldException { List<PropMapper> pms = propMappers.computeIfAbsent(type, c -> new ArrayList<>()); Optional<PropMapper> existing = pms.stream() .filter(pm -> pm.prop.equals(prop)) .findAny(); if (exis...
009d2094-2ab7-4248-81cc-a694258db677
0
public void mousePressed(MouseEvent e){ mouse = true; }
a01ead2f-8939-4383-9a8a-f88a05b40f63
5
public void extractLib(String path, File to) { InputStream stream = this.getClass().getResourceAsStream(path); if (stream == null) return; int readBytes; byte[] buffer = new byte[4096]; try { if (!to.getParentFile().exists()) to.getParentFile().mkdirs(); if (to.exists()) to.delete(); to.createNewF...
825cecb4-f1a6-48be-8910-7ed58f661338
6
public LineNumberList(final JTextComponent textComponent) { // Super-class (JList) constructor super(new LineNumberListModel(textComponent.getDocument())); // Set list ui setFocusable(false); setFont(EditorStyles.getFont()); setFixedCellWidth(25); setFixe...
0eadfa1a-c6af-4a34-81fe-edbbf6cf93cc
4
public void actionPerformed(ActionEvent e) { boolean valid = true; //used to keep track of whether all conditions are still valid String errorString = "";//used to keep track of all errors int ssNb = -1; try { ssNb = Integer.parseInt(snTextField.getText()); //read age from its text field, check if...
a0a1a053-8366-4af0-8653-8565dcbdad2b
0
@Basic @Column(name = "desc_lang_key") public String getDescLangKey() { return descLangKey; }
b5b0bea7-d75e-4f6e-bd7b-b462fba59da2
1
public double[] getXY(double[] result, double t) { double x = (h + a * Math.cos(t)); double y = (k + b * Math.sin(t)); if (result == null) { result = new double[2]; } result[0] = x; result[1] = y; return result; }
2942935f-bdbd-41bd-b37a-b7015d3524f7
7
public String convertCodetoString() { String result = ""; for (int c = 0; c < elements.length; c++) { if (elements[c].getColor().equals(Colors.BLUE)) result += "B"; else if (elements[c].getColor().equals(Colors.GREEN)) result += "G"; else if (elements[c].getColor().equals(Colors.ORANGE)) result...
c83696ff-417f-42ef-ba65-fdcf5bc3be5d
3
public String mostrarDatosEstudiante(Estudiante es) { String informacion = "\n Nombre:\t " + es.getNombre() + " " + es.getApellido() + "\n " + "Cédula:\t " + es.getCedula() + "\n Teléfono1:\t " + es.getTelefono1() + "\n " + "Teléfono2:\t " + es.getTelefono2() + "\...
2240854c-2eb5-4385-b1e7-0d0ba5a9afbc
7
public void update() throws MaltChainedException { AddressValue a = addressFunction.getAddressValue(); if (a.getAddress() != null && a.getAddressClass() == org.maltparserx.core.syntaxgraph.node.DependencyNode.class) { DependencyNode node = (DependencyNode)a.getAddress(); try { int index = Integer.parseInt...
ddd181af-4333-4668-bc3a-0cf20e4e4d8e
1
public void remplissageComboBox(List<Praticien> lesPraticiens /*LieuExercice*/) { Praticien premierPraticien = lesPraticiens.get(0); this.vue.getjComboBoxSearch().addItem(premierPraticien.getNom() + " " + premierPraticien.getPrenom()); for (int i = 1; i < lesPraticiens.size(); i++) { ...
10285fa3-f1ed-4282-a1c8-7a702503710d
9
protected void saveConsensus() { if (Globals.REFINE || Globals.CONSENSUS) { StringBuilder sb = new StringBuilder(); sb.append(">CONSENSUS\n"); Map<String, String> wobbles = new HashMap<>(); wobbles.put("A", "A"); wobbles.put("C", "C"); wob...
83312336-8880-4f9f-8dcb-64aabd215985
0
public boolean GetInputBufferConnectionStatus(int buffer) { return inputConnectedToBus.contains((Object)buffer); }
48c5a0c9-ae5f-4bf6-a7ff-9a676ded3ef9
5
private double calcErrorRate() { int error = 0; for (Tea tea : teaClassifier.getTrainingSet()) { int intResult = queryTea(tea.getTeaType(), tea.getAddition(), tea.getSugar()); boolean result = false; if(intResult == 1 && tea.isDrinkable()) { result = true; } else if (intResult == 0 && !te...
9e8ebb6e-6971-4bab-bcb4-18acef9bf747
8
public void calibrate() { LCD.clearDisplay(); System.out.println("Calibrate T2"); for (byte i = 0; i < 3; i++) { while (0 == Button.readButtons())//wait for press { LCD.drawInt(leftEye.getLightValue(), 4, 6, 1 + i); LCD.drawInt(rightEye.getLightValue(), 4,...
69909708-b918-4dff-b5ac-d32be00245bf
5
private void setListener() { refreshBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { showTable(); } }); fBtn[0].addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { new AddCommonCourseUI("common_course"); } }); ...
692031e6-9bac-4968-9f79-1be057f6b5ed
6
public int getBlockId(int var1, int var2, int var3) { return var1 >= -32000000 && var3 >= -32000000 && var1 < 32000000 && var3 <= 32000000 ? (var2 < 0 ? 0 : (var2 >= 128 ? 0 : this.getChunkFromChunkCoords(var1 >> 4, var3 >> 4).getBlockID(var1 & 15, var2, var3 & 15))) : 0; }
0bc86750-0dba-4998-aa40-4d9e3ba1ab07
3
@Override public boolean done() { if(done) { String[] agents = new String[3]; agents[0] = "Agent1"; agents[1] = "Agent2"; agents[2] = "Agent3"; for(String a : agents) { ACLMessage msg = new ACLMessage(ACLMessage.INFORM); msg.setContent("Beaucoup de sang."); msg.addReceiver( new AI...
459cc468-1481-4231-bd4b-2c7e86032c9d
5
@Override public void collide(Entity entity, double xa, double ya) { if (entity instanceof Mob) { Mob mobEnt = (Mob) entity; if (entity instanceof Bomb) { ((Bomb)entity).hit(); } else if (mobEnt.isNotFriendOf(owner) || (entity instanceof RailDroid)) { mobEnt.hurt(this,damage); hit = true; } ...
9a436110-12bf-44b4-8c11-aa9a47215ba3
2
public void loadData() throws SQLException { // load data into table // NOTE: filepath has to be local to the hive server // NOTE: /tmp/a.txt is a ctrl-A separated file with two fields per line String filepath = "/tmp/a.txt"; String sql = "load data local inpath '" + filepath + "...
904d6124-41d0-42e9-a957-3e68a518e38f
3
public ArrayList<Coordinate> getCoveredCoordinatesAfterMove(Move move) { ArrayList<Coordinate> c = new ArrayList<Coordinate>(); if (horizontal) { for (int i = 0; i < length; i++) { c.add(new Coordinate(position.x + i + move.getSteps(), position.y)); } } else { for (int i = 0; i < length; i++) { c...
c1598f9d-5c38-4375-8b72-fe429b48e450
9
public void create(PypAdmAgend pypAdmAgend) { if (pypAdmAgend.getPypAdmAsistConList() == null) { pypAdmAgend.setPypAdmAsistConList(new ArrayList<PypAdmAsistCon>()); } EntityManager em = null; try { em = getEntityManager(); em.getTransaction().begin(); ...
b35408b5-f7b4-419d-b00a-48d87313f7e9
9
public Link(HtmlMidNode parent, HtmlAttributeToken[] attrs){ super(parent, attrs); for(HtmlAttributeToken attr:attrs){ String v = attr.getAttrValue(); switch(attr.getAttrName()){ case "charset": charset = Charset.parse(this, v); break; case "href": href = Href.parse(this, v); brea...
6d759cf0-ad0c-4440-9a6a-1b16134dedac
6
public static void normalizeParentModules(Module self) { if (!self.multipleParentsP()) { return; } { List parents = self.parentModules; boolean recomputefullnameP = false; { Module supermodule = null; Cons iter000 = parents.theConsList; for (;!(iter000 == Stella.NIL); ite...
c6f6013d-1f30-4484-8e83-c7f7048770fc
1
public FlowerMenu(Coord c, Widget parent, String... options) { super(c, Coord.z, parent); menuOptions = new Petal[options.length]; for (int i = 0; i < options.length; i++) { menuOptions[i] = new Petal(options[i]); menuOptions[i].num = i; } organize(menuOptions); ui.grabmouse(this); ui.grabkeys(this)...
a0323fac-cc89-4c07-9a16-b3576a895db4
8
protected void getChallengeDetail(String title) { if (title != null) { for (int i = 0; i < challengeList.size(); i++) { if (challengeList.get(i).getTitle().equals(title)) { if (!(challengeList.get(i).getDescription() == null || challengeList.get(i).getDescription().equals("null"))) { descrip...
edbb053f-cef6-4018-a930-95f42d1c0f5d
0
@Override public void destroy() { node = null; oldText = null; newText = null; }
d1bcf542-db94-4f2b-af00-c71fee921b45
4
@Override public void update() { if(isKeyDown(KEY_DOWN)){ mainCharacter.update(KEY_DOWN); } if(isKeyDown(KEY_UP)){ mainCharacter.update(KEY_UP); } if(isKeyDown(KEY_LEFT)){ mainCharacter.update(KEY_LEFT); } if(isKeyDown(K...
8e512a9e-9ee1-44db-a1c2-dd01d13b0c2a
4
public int compareTo(Domino d) { int compare = 0; if (d.major > major) { compare = -1; } else if (d.major < major) { compare = 1; } else { if (d.minor > minor) { compare = -1; } else if (d.minor < minor) { compare = 1; } } return compare; }
2edd70be-7133-4c84-b5d0-ed7a367e5916
2
@EventHandler public void onServerDisconnect(ServerDisconnectEvent event) { if (IRC.sock.isConnected() && BungeeRelay.getConfig().getString("server.channel").isEmpty()) IRC.out.println(":" + IRC.uids.get(event.getPlayer()) + " PART " + BungeeRelay.getConfig().getString("server.chanprefix") + event.getTarget...
51257a88-ef85-46f3-b68e-457c85e245e2
9
public synchronized boolean preTurn() { if (!isStarted) { return false; } int currentTurn = turnSequence % turnInfo.length; if (turnInfo[currentTurn].isDone || playerCommands.isAllDone(turnSequence)) { turnInfo[currentTurn].isDone = true; if (!turnInfo[currentTurn].isCommandsPopped) { turnIn...
e8f7da91-c125-4f1d-a5cf-0b7cd4dd4de8
6
public static void closeConn(){ if(rs!=null){ try { rs.close(); } catch (SQLException e) { logger.error(e); } } if(psmt !=null){ try { psmt.close(); } catch (SQLException e) { ...
49f190b3-d660-46b0-9ef8-3406e50cb517
5
public void draw(Graphics g, ImageObserver io){ if(waittime > 0){ waittime = waittime - 1; return; } g.drawImage(bimage1, char_x, char_y, io); char_x = char_x - 4; if(char_x < -48){ syutsugen(); } if(spkey == true){ speed = speed - 0.15; }else{ speed = speed + 0.15; } if(speed >...
24bdca75-3bec-4ec6-af89-4c394a62e914
6
private void doDamageTo( Element e, float maxDamage, float radiation, float maxRange ) { final float dist = Spacing.distance(this, e) / maxRange ; final float damage = maxDamage * (1 - dist) ; if (e instanceof Wreckage) return ; else if (e instanceof Installation) { I.say("Doing "+damage+" ...
2aa652a1-bbbd-4696-abb1-2595e9d65fae
9
protected void updateGraph() { if( CommonState.getTime() != GraphObserver.time || (CDState.isCD() && (CDState.getCycleT() != GraphObserver.ctime)) || CommonState.getPhase() != GraphObserver.phase || pid != GraphObserver.lastpid ) { // we need to update the graphs GraphObserver.lastpid = pid; ...
6d560f26-7f5b-40c2-aa62-c90f39cda471
5
public String decrypt(String word){ String result = ""; String wordLower = word.toLowerCase(); if(MathUtil.coPrime(this.keyA, 26)==false) throw new IllegalArgumentException(); for(int i=0; i<wordLower.length(); i++){ if(wordLower.charAt(i)<97 || wordLower.charAt(i)>122) throw new IllegalArgumentExceptio...
006b4f8a-1c30-426f-97ef-ab66d612ada3
7
private static Relation<Production, Production> getProductionDependencies(Set<Production> prods) { Relation<Production, Production> dep = new Relation<Production, Production>(); for (Production p : prods) { for (int i = 0; i < p.getLength(); i++) { Symbol s = p.getSymbolAt(i); if (s instanceof NonTerm...
7ed467ac-c87a-4182-8858-5cf6d94a54a3
5
public static List<List<Integer>> levelOrderBottom(TreeNode root) { List<List<Integer>> res = new ArrayList<List<Integer>>(); List<TreeNode> stack = new ArrayList<TreeNode>(); int start = 0; int end = 0; if (null != root) {stack.add(root);end = 1;} while (end > start) { ...
9dfc64cd-a867-4677-8df3-e07aeebaa913
4
public void move() { collision(); ball.x += xDirection; ball.y += yDirection; // Bounce the Ball When the Edge is Detected if(ball.x <= 0) { setXDirection(+1); p2Score++; } if(ball.x >= 385) { setXDirection(-1); ...
26a725c8-6ade-47b7-a842-b1b808ee19e2
6
public void exportarTicket(JTable table, ArrayList<Ticket> ticket, String ruta, String desde, String hasta) throws IOException { this.nombreArchivo = "Tickets "+desde+" hasta "+hasta+".xls"; File file = new File(ruta+"/"+nombreArchivo); new File(ruta).mkdirs(); if (!file.ex...
7bcd0f4d-4ccb-4ada-a29e-6b8795e1cd04
7
private void splitTreeNode(RandForestNode currentNode, Set<Node> curCandidates, boolean isTrueChild) { Set<Integer> sampleList = null; if (isTrueChild) { sampleList = currentNode.sampleSetTrue; } else { sampleList = currentNode.sampleSetFalse; } // System.o...
a60236e8-dd78-4541-8081-d36854576355
4
public void logParticipants(String[] userList) { if (participants.length == 0) { Arrays.sort(userList); participants = userList; } else { String[] tmp = new String[participants.length + userList.length]; System.arraycopy(participants, 0, tmp, 0, participants.length); System.arraycopy(userList, 0, tmp...
bf1cc167-1ef6-4870-be14-ea3de858e9ac
3
public void findUnflaggedChildren(ArrayList<Molecule> unflagged){ if(children!=null){ if(!children.get(0).getFlag()){ unflagged.add(children.get(0)); children.get(0).flag(); children.get(0).flagChildren(); } if(!children.get(1).getFlag()){ unflagged.add(childre...
85cd4850-2e35-4790-b230-9bd342623bcd
1
public void setLocation(Location newLocation) { if(location != null) { field.clear(location); } location = newLocation; field.place(this, newLocation); }
119998b6-ba32-46f7-bf9d-835a60177a9b
3
private OggPage getCurrentPage(boolean forceNew) { if(buffer.size() == 0 || forceNew) { OggPage page = new OggPage(sid, sequenceNumber++); if(currentGranulePosition > 0) { page.setGranulePosition(currentGranulePosition); } buffer.add( page ); ...
e3d4f724-ac30-4cf2-b074-a9042f6097d9
2
public Priorities() { switch (curPriority) { case 1: task = "Eat"; break; case 2: task = "Socialize"; break; default: break; } }
127d4836-3b38-4e77-930d-a76bceabe4b2
9
final public int Modifiers() throws ParseException { int ret = MOD_NONE; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case NOT: case PLUS: case MINUS: switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case PLUS: jj_consume_token(PLUS); ret = MOD_REQ; break; case MINUS:...
6039a743-2478-435b-95f1-a47f455dcbbf
8
public void run() { try { boolean eos=false; byte[] buffer=new byte[8192]; while(!eos) { OggPage op=OggPage.create(source); synchronized (drainLock) { pageCache.add(op); } if(!op.isBos()) { ...
dd1c8df6-320b-4dc3-97fd-c44ba0683df7
5
public static void setDirectorio(String directorioBase){ File dirBase = new File(directorioBase); if(dirBase.isDirectory()){ String[] ficheros = dirBase.list(); if (ficheros == null){ System.out.println("No hay ficheros en el directorio especificado"); ...
caaadcd1-a7dd-416d-ba3f-c1b017ea5238
7
private void expParamChanged() { if (m_Exp == null) return; if (m_ExperimentTypeCBox.getSelectedItem() == TYPE_CROSSVALIDATION_TEXT) { try { m_numFolds = Integer.parseInt(m_ExperimentParameterTField.getText()); } catch (NumberFormatException e) { return; } } else { try { m_train...
ba0ab757-2de9-4f61-95d4-d9d10e8ae50f
0
@Override public void documentAdded(DocumentRepositoryEvent e) {}
ba8525aa-40d0-4f96-a4af-816fd391947c
4
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; StartEndPair other = (StartEndPair) obj; if (dimensionOrderNumber != other.dimensionO...
9e9e3fd5-0486-48ad-8510-c63b3e892df0
7
public void close() throws IOException { if (merged) throw new IllegalStateException( "Merge already performed"); if (entries.isEmpty()) throw new IllegalStateException( "No entries to merge have been defined"); merged = true; //...
5e882488-6bd7-4f23-a6d0-3810782e2ffd
0
private static void usage() { System.out.println("usage: client <-f torrent> [-o directory] [--force | --disable]"); System.out.println("\ttorrent\t\t-\tTorrent-file the client uses to share."); System.out.println("\tdirectory\t-\tOutput directory where file is put. Default: /tmp."); System.out.println("\t--for...
c5806947-b445-4df6-91d7-7051b2020e41
3
public ErrorWarningType sanityCheck(Variant seqChange) { if (isErrorProteinLength()) return ErrorWarningType.WARNING_TRANSCRIPT_INCOMPLETE; else if (isErrorStopCodonsInCds()) return ErrorWarningType.WARNING_TRANSCRIPT_MULTIPLE_STOP_CODONS; else if (isErrorStartCodon()) return ErrorWarningType.WARNING_TRANSCRIPT_N...
5225ad3b-2376-4580-822c-78bf48c52874
9
public String getUnitName(UnitType type, Random random) { String name; if (!type.isNaval()) return null; // Collect all the names of existing naval units. List<String> navalNames = new ArrayList<String>(); for (Unit u : getUnits()) { if (u.isNaval() && u.getName() !...
d8909174-de7e-4d67-9245-371e48b26fed
8
public void create(Perifericos perifericos) throws PreexistingEntityException, RollbackFailureException, Exception { if (perifericos.getItItemCollection() == null) { perifericos.setItItemCollection(new ArrayList<ItItem>()); } EntityManager em = null; try { em = ge...
6ad963dc-438e-42ba-b069-527281e41beb
5
public LekkerlandMenu(final TrayIcon trayIcon, String label) { super(label); try { InputStream file = new FileInputStream(new File( "lekkerland.properties")); Properties props = new Properties(); props.load(file); dispatchNotificationsFolder = props .getProperty("dispatchNotifications"); ...
5ffa88e3-e9fd-4679-a3bc-f47fa0df914c
6
private static void deal_with_ret(Contact this_contact, String field, Object ret_value) { // the return value might be a composite type i.e // name=X, id=Y // in this case we add both the name and id (important for Places) //System.out.println(ret_value.getClass()+""); if(unmodlistclass.isInstance(ret_value)){...
7df7efae-0770-4914-8c67-f2e3ce82e306
1
private void addMeetingtoContacts(Set<Contact> contacts, Meeting newMeeting) { ContactImpl[] theContacts = contacts.toArray(new ContactImpl[0]); for (int i = 0; i < theContacts.length; i++) { theContacts[i].addMeetings(newMeeting); } }
6d669cdc-0707-4847-987b-d0556f7db29d
9
@Reflectable public static String getAllFields(String pkg, String clazz) throws ClassNotFoundException { Annotation[] annotations = null; StringBuilder sb = new StringBuilder(); Class<?> c = Class.forName(pkg + "." + clazz); Class<?> interfaces[] = c.getInterfaces(); while( c != null ) { annotations...