method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
8424c17b-7ff3-4b4d-837e-2ef8d79df41b
3
public static boolean isMoving(ACTIONS value){ return value == ACTIONS.ACTION_UP || value == ACTIONS.ACTION_DOWN || value == ACTIONS.ACTION_LEFT || value == ACTIONS.ACTION_RIGHT; }
e93d10bb-4d1d-4dae-895f-04eb07a1688e
6
@Override public void run() { HashMap <PocsagMessage, Integer> numTimesProccesed = new HashMap<PocsagMessage, Integer>(); while (running) { //try { PocsagMessage pocsagMessage = PocsagQueue.pollMessageQueue(); if (pocsagMessage == null) { // Timeout. // Generates a idle message // ...
b8af3ed5-64d8-435e-bc20-17192d40e73c
2
public final Quaternion interpolate(Quaternion q, float alpha) { // From "Advanced Animation and Rendering Techniques" // by Watt and Watt pg. 364, function as implemented appeared to be // incorrect. Fails to choose the same quaternion for the float // covering. Resulting in change of direction for rot...
23fc51b6-4acc-47ff-ad33-926f166392d0
4
private static void removeFromList(List<MutableTypes> list, Runnable setSize) { gcPrintUsed(); long start = System.currentTimeMillis(); do { System.out.println("Updating"); long startWrite = System.nanoTime(); setSize.run(); populate(list); int i; long timeWrite = System...
3dab057f-2544-43e3-b459-dadeec1653eb
4
private String buscarPor(){ String buscar=""; if(RNombre.isSelected()){ buscar="nombre"; }else{ if(RApellidos.isSelected()){ buscar="apellidos"; }else{ if(RApodo.isSelected()){ buscar="apodo"; ...
c4110596-d86a-484b-963c-df6dd4181a89
2
@Override public void addNewContact(String name, String notes) { if(name != null && notes != null) { Contact newContact = new ContactImpl(generateContactId(), name); allContacts.add(newContact); } else { throw new NullPointerException(); } ...
a108018f-d35b-44dc-8e5a-41c1f8e03500
5
private void handleModifyReservation(Sim_event ev) { int src = -1; // the sender id boolean success = false; int tag = -1; try { // get the data ARObject obj = (ARObject) ev.get_data(); // get the unique tag to send back to recepient ...
534b3267-fa6f-4d42-a24a-462cb50c001c
7
void setLayoutData () { Control [] children = layoutComposite.getChildren (); TableItem [] items = table.getItems (); GridData data; int hSpan, vSpan, hIndent, vIndent; String vAlign, hAlign, vGrab, hGrab, exclude; for (int i = 0; i < children.length; i++) { data = new GridData (); /* Set widthHint an...
7529f2cd-dd17-499f-8107-7484ef660f3e
5
public void packetReceived( DatagramPacket pack ) throws IOException { try { RCMessage mess = CrappyCodec.decode(pack.getData(), 0, pack.getLength(), RCMessage.class); switch( mess.messageType ) { case OPEN_SUBSCRIPTION: clientAddress = pack.getSocketAddress(); System.err.println("Client's at "+clien...
0ba4d0d9-cf24-4ffc-9fc5-bca14c6e7ecc
0
public final Integer[] getLut() { return lut; }
14bf6b0c-4327-43ad-a82c-7a6677bee07d
4
@Override public Tipo validarSemantica() throws Exception { Tipo izq,der; izq=izquierdo.validarSemantica(); der=derecho.validarSemantica(); if (izq instanceof TipoInt || der instanceof TipoFloat){ if (der instanceof TipoInt || der instanceof TipoFloat ){ r...
fb100ede-be46-4c51-97d0-2a8f659b778e
8
private static void clearClosedConnection() { long time = System.currentTimeMillis(); if (time < lastClearClosedConnection) return;//如果用户改了系统时间,那么直接返回 if (time - lastClearClosedConnection < checkClosedConnectionTime) return; lastClearClosedConnection = time; //begin check ...
b07ded47-0f9a-4ed8-b165-0bdf798cea33
7
@Override public byte[] encrypt(byte[] plainInput, byte[] publicKey) { BigInteger n = new BigInteger(publicKey); int keySize = publicKey.length; int dataBlockSize = keySize + 2 * (keySize / 128); int plainBlockSize = keySize - 2; int wholeLen = plainInput.length; int...
d251d6a4-a52b-4e43-89e8-2f736bcf53e9
1
public static void main(String[] args) throws Exception { SAXReader saxreader = new SAXReader(); Document doc = saxreader.read(new File("jdom.xml")); Element root = doc.getRootElement(); System.out.println("root element :" + root.getName()); @SuppressWarnings("rawtypes") List childList = r...
56c498c7-a8fe-46de-9fb9-9c7989f7ad53
5
public JSONObject increment(String key) throws JSONException { Object value = this.opt(key); if(value == null) { this.put(key, 1); } else if(value instanceof Integer) { this.put(key, ((Integer) value).intValue() + 1); } else if(value instanceof Long) { this.put(key, ((Long) value).longValue() + 1); }...
47c3fc32-2a87-4af7-9225-01987ec0edcf
7
@SuppressWarnings("unchecked") @Override public boolean testPermissionSilent(CommandSender sender) { if (permissions == null || permissions.length == 0) { return true; } if (registeredWith instanceof CommandsManager<?>) { try { for (String permiss...
d3e31497-f796-40bb-93a9-47092ca6c04c
0
@After public void tearDown() { }
457340a1-45c0-426d-9cd9-ca7a7d12c8e2
7
@Override public void affectPhyStats(Physical host, PhyStats affectableStats) { if(processing) return; if((affected instanceof MOB) ||(affected instanceof Item)) { try { processing=true; if((lastMOB!=null) &&(host!=lastMOB)) removeMyAffectsFrom(lastMOB); if((lastMOB==null)&&...
8782ab74-0fd0-4c94-a0ee-611ba3fbd91a
0
public ArenaState getArenaState() { return this.arenastate; }
51ea2b4d-7ec6-4c68-a25b-7c51ee480155
6
static final public MessageHandler msg_handler_clause() throws ParseException { MessageHandler result; CreateActorStatement createStmt; SendMessageStatement sendStmt; ValueExpression pattern; jj_consume_token(ON); pattern = value_spec(); ...
a68810f1-b691-47f5-91e3-1b6f0ea35d44
5
void update() { if (PApplet.abs(pos.x) > p5.lmt[0] || PApplet.abs(pos.y) > p5.lmt[1] || PApplet.abs(pos.z) > p5.lmt[2]) alive = false; Vec3D acc = new Vec3D(); Vec3D trac = new Vec3D(); Vec3D wand = new Vec3D(); wand = wander(); if (p5.random(1) < 0.01f) freetime += p5.random(10, 20); if (freet...
439712af-9c57-408e-9a3d-4914e1c01699
0
@Transient public Integer getFunNitCxc() { return funNitCxc; }
c7d61e42-4f2a-4e2c-9fe6-2b477857cb82
0
@Override public void setCalle(String calle) { super.setCalle(calle); }
047856b4-4687-4f08-98b9-ee2a173d8e36
2
public static void main(String[] args) { try { Gui gui = new Gui(); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { // using fallback >> crossplatform look and feel. } finally { SwingUtilities.updateComponentTreeUI(gui); } config(args, g...
06b14ee2-dc5d-4d62-af56-c40fab3a149b
3
private String nodeString(Integer depth) { String tree = new String(); for (int i=0; i<depth; i++) { tree += "--"; } tree += "(" + this.symbol + "," + this.frequency + ")\n"; if (left!=null) { tree += left.nodeString(depth+1); } if (right!=null) { tree += right.nodeString(depth+1); } return ...
27f4f4b3-14f9-4b20-90c7-8e7fbc7509cd
3
private static void testAccess(ArrayList<Access> accessRights, Departments userDepartment, Departments departmentBeingAccessed) { if (testAllAccess(accessRights) || (testOwnAccess(accessRights) && testSameDepartment(userDepartment, departmentBeingAccessed))) { System.out.printf("The user with depart...
1bc55839-e07f-4fe7-a09b-298b3eea1bcc
6
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Student)) { return false; } Student other = (Student) obj; if (name == null) { if (other.name != null) { return false; } } else if (!name.equal...
5373cc24-0543-457b-8795-eb247a68d38a
7
public static List<IItem> inventory(int size, List<IItem> excludedItems){ List<IItem> itemBase = getItemList(); if(size > itemBase.size()){ try{ throw new Exception("Inventory too large (" + size + "), itembase" + "holds " + itemBase.size() + " items")...
a3c75ce2-7466-478e-853d-e3f00f1e46ae
3
private boolean isKuchen(Item item) { return item == Item.IGiftkuchen || item == Item.UGiftkuchen || item == Item.IKuchen || item == Item.UKuchen; }
aef041ad-c412-49f4-a280-646a2e8c38a4
5
public void placeRobotar() { for(int i = 0;i < robotar.size();i++) { robotar.get(i).setPunkt2D(new Punkt2D(Math.random()*Consts.FRAMESIZEX,Math.random()*Consts.FRAMESIZEY)); for(int j = 0;j < block.length;j++) { if(robotar.get(i).touches(block[j]))...
6cc32aa2-6303-4503-b817-ce6ebd5da18b
2
public void moveMissiles(){ if(fireMissile){ for(int i = 0; i<missiles.size(); i++){ missiles.get(i).move(initials.get(0).getxCoord(), initials.get(0).getyCoord()); } } }
abf22407-2c14-4f01-ae26-02d299497649
5
@Override public String toString() { String res = " QuestionEquation"; res = res + "\n Text: " + this.text; res = res + "\n Difficulty: " + this.difficulty; res = res + "\n Operands: " + this.operands; res = res + "\n Operators: " + this.operators; res = res ...
f699b638-4936-4562-aae7-8072992d7a47
0
public void setName(String name) { this.name = name; }
9aaccc8f-66e8-42c0-a44f-a39b0aaee9cb
3
@Override public void menuSelected(MenuEvent event) { JMenu menu = (JMenu) event.getSource(); for (Component component : menu.getMenuComponents()) { if (component instanceof JMenuItem) { JMenuItem item = (JMenuItem) component; Action action = item.getAction(); if (action instanceof Command) { (...
f89455a9-2397-46ae-b99f-db12e94f7ecb
8
private void processBidEvent(BidEvent event) { // max global Bit if (event.getType().equals(BidEvent.BID_PLACED) || event.getType().equals(BidEvent.BID_OVERBID)) { if (maxBidEvent == null) { Timestamp currentTimestamp = new Timestamp( System.currentTimeMillis()); long timestamp = currentTimest...
8f8f34c3-cb55-4155-b5a5-7f77bf21b2d1
9
private List<String> copyOrMoveObj(ArrayList<String> messageAsArray) { FileSystemObj objToCopy = checkPath(messageAsArray.get(0)); FileSystemObj objToPaste = checkPath(messageAsArray.get(1)); if((objToCopy == null) || (objToPaste == null) || !objToPaste.isFlagingNew()) return answer("Bad path")...
d5e94267-31a3-49f7-90c8-b1c767c0f826
8
public static void main(String[] args) { Scanner sc = new Scanner(System.in); StringBuffer sb = new StringBuffer(); for (int i = 0, N = sc.nextInt(); i < N; i++) { int A = sc.nextInt(), F = sc.nextInt(); for (int k = 0; k < F; k++) { for (int j = 1; j <= A; j++) { for (int j2 = 0; j2 < j; j2++) ...
5b783da8-1c57-4bde-ac61-fb6f96eeac7b
0
public void setHoraEncargo(String horaEncargo) { this.horaEncargo = horaEncargo; }
46cc3c66-359a-4b49-a6fb-d489b784cb48
9
public Object execIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { if (!f.hasTag(BOOLEAN_TAG)) { return super.execIdCall(f, cx, scope, thisObj, args); } int id = f.methodId(); if (id == Id_construc...
d5b3db41-3eae-4edb-a764-4432564cd11d
1
@Override public void startElement (String uri, String localName, String qName, Attributes attributes) { if(qName.equalsIgnoreCase("conversation")){ bconverse = true; } }
f0808ecb-d20f-4684-861e-988ee0a01572
9
public ArrayList<Object> getNextTestCase() { ArrayList<Object> result = new ArrayList<Object>(); if(currTestCasePos < this.listCon.size()*2-1) currTestCasePos ++; if(currTestCasePos % 2 == 0) { testcase = this.listCon.get(currTestCasePos/2).getTruetc(); } else { testcase = this.listCon.get(currT...
97c27247-dbe8-4004-8819-ce904e1b9530
2
public int getMaximum(final String callName) { int max = Integer.MIN_VALUE; final List<CallData> callDataList = getCallData(callName); for (final CallData callDataEntry : callDataList) { if (callDataEntry.getDuration() > max) { max = callDataEntry.getDuration(); } } return max; }
8f03cf18-6762-4427-883b-c9295a8649ba
1
public static void drawHex(int i, int j, Graphics2D g2) { //int x = i * (s + t); //int y = j * h + (i % 2) * h / 2; int x; if (i % 2 != 0) { x = j * h + r; } else { x = j * h; } int y = i * (h - (t / 2)); Polygon poly = hex(x, y); ...
0b07cc3e-e676-46dd-a2e4-8249161d0046
8
public static String reverseWords(char[] s) { if(s == null || s.length == 0){ return null; } //step one is to reverse the string reverse(s, 0, s.length -1); int start = 0; int end = 0; while(end < s.length && start < s.length) { // move to...
77d1ae6c-8ead-4a0f-adc6-086298f5ad83
9
@Override public boolean mayISeeResults(MOB mob) { if (mob == null) return false; if (!CMLib.masking().maskCheck(qualZapper, mob, true)) return false; if (CMath.bset(bitmap, FLAG_HIDERESULTS) && (!CMSecurity.isAllowedAnywhere(mob, CMSecurity.SecFlag.POLLS))) return false; if (CMath.bset(bitmap, FLAG_...
cb35743e-642a-40eb-b739-694a67c5ff6e
8
public void showFurthest(Tile startingTile) { //show the minions possible movements // System.out.println("Show Furthest"); // System.out.println(maxLength); int negMaxLength = -1 * maxLength; // System.out.println(negMaxLength); for (int i = negMaxLength; i <= maxLength; i++) { for (int j = negMaxLength; ...
871a3f1e-4b77-445d-a44e-2ae949a4d48c
1
private static void swapFromJtoI(char[] n, int i, int j){ for(int k=j;k>i;k--){ char tmp = n[k-1]; n[k-1]=n[k]; n[k]=tmp; } }
f8ec0f4b-d146-4566-9624-1963d3e17d76
6
public static void resetOverLoadEffect(Player player) { if (!player.isDead()) { int actualLevel = player.getSkills().getLevel(Skills.ATTACK); int realLevel = player.getSkills().getLevelForXp(Skills.ATTACK); if (actualLevel > realLevel) player.getSkills().set(Skills.ATTACK, realLevel); actualLevel = pl...
c3c5b34a-305e-46a9-b949-f911568ef896
1
@Test public void updateHousehold(){ Household h = familyService.getHousehold().get(0); h.setRepresentative("Pablo"); try { familyService.updateHousehold(h); } catch (InstanceNotFoundException e) { fail("Household to update no found"); } }
1f9abe96-9780-45c6-bc64-bede34e9a822
8
public void usePluginVersionsFromRepository() { repository.scanOnce(); for (POMInfo pom : repository.getResolvedPoms().values()) { if (pom.getThisPom().isPlugin()) { Set<DependencyRule> pomRules = pom.getPublishedRules(); depRules.get(RULES).add(MAVEN_PLUGINS_...
a61e8aa0-d306-451d-883a-c74699beac98
1
public List<BinaryNode<K,V>> inOrder(BinaryNode<K,V> root) { if(root != null) { inOrder(root.left); System.out.print(root.key + " "); inOrder(root.right); li.add(root); } return (li); }
0de4b61b-a5d7-4c4c-bb61-84085ecde626
6
public static void updateExtendedPort(ExtendedPort ePrt){ ExtendedPortData extData = ePrt.getPort(); //Recover the port object (from the Rest Interface) attributes (extended attributes only if they are present) String name = extData.getName(); String n = extData.getId(); FixedIps fixed = extData.getFi...
f7ca3e85-427d-441e-bb54-786192f92f9d
6
int endIndexOfCommentsAndQuotes(char[] expressionChars, int i, int position) { String[] startSkip = getStartSkip(); String[] stopSkip = getStopSkip(); int offset = startSkip[i].length(); for (int m = position + offset; m < expressionChars.length; m++) { // 由于注释起始标识在getStartSkip()中index为i,所以结束标识必然是getStopSki...
baf689dc-850f-42cd-8396-5eb94591bd3a
3
private ImageIcon selectImage(Piece piece){ if (piece instanceof King) return piece.getColor() ? whiteKing : blackKing; else return piece.getColor() ? whitePiece : blackPiece; }
93f329e3-ef01-4b2a-a76e-1f519b109f11
5
public void ajouterLivraison(Livraison livraison, NoeudItineraire noeudPrec, PlageHoraire plage) { if(this.testItineraireCharger()){ if(plage == null){ if(noeudPrec == this.entrepot){ plage = this.plagesHoraire.get(0); } else{ Pair<Livraison, PlageHoraire> pairTmp = this.rechercheLivraisonPa...
e1e4319c-3af6-40ae-b0b0-b690b9bc863a
3
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed PrintWriter settings = null; try { settings = new PrintWriter(System.getProperty("user.home")+"/Documents/AcerX/settingsYM.txt", "UTF-8"); settings.println(jTextField1....
7db12711-ab16-401b-82a8-badca63d454a
3
public static void setStaticFinalField(Field field, Object value) { FieldAccessor accessor = accessors.get(field); if (accessor == null) { try { field.setAccessible(true); int modifiers = MODIFIERS_FIELD.getInt(field); modifiers &= ~Modifier.FI...
36dfd968-ce5f-45d4-a1cd-bb09c9ee8bb4
6
public static Color makeHSBColor( double hue, double saturation, double brightness) { float h = (float)hue; float s = (float)saturation; float b = (float)brightness; h = (h < 0)? 0 : ( (h > 1)? 1 : h ); s = (s < 0)? 0 : ( (s > 1)? 1 : s ); b = (b < 0)? 0 : ( (b > 1)? 1 : b )...
8d6a70db-3a72-4bd4-a694-8bc1f9696742
9
public final void setStudent(final Unit newStudent) { Unit oldStudent = this.student; if(oldStudent == newStudent){ return; } if (newStudent == null) { this.student = null; if(oldStudent != null && oldStudent.getTeacher() == this){ old...
2c5596b0-c72c-489f-9efc-e7afb39c8ee3
0
public int value() { return i; }
dc85c371-12a2-4058-9f3d-06f2b6ea2612
0
public AddTrapStateToDFAAction(AutomatonEnvironment environment) { super("Add Trap State to DFA", null); this.environment = environment; this.automaton=environment.getAutomaton(); }
c39fac44-6a14-4166-887a-b589214e6005
7
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; TwoPoints other = (TwoPoints) obj; if (!((p1.equals(other.p1) && p2.equals(other.p2)) || (p1.equals(other.p2) && p2.equals(other.p1)))) re...
92addfb3-528e-4841-b3a9-21856c067f51
7
public boolean notifyImpl(ByteBuffer b, Object passthrough) throws IOException { if (log.isLoggable(Level.FINEST)) log.log(Level.FINEST, "processing stream"); if(b == null) throw new IllegalArgumentException("evt cannot be null"); boolean notified = false; while(b.remaining() > 0) { switch(state) {...
d7ccbe6e-90aa-4c96-969a-0ff9300ed458
4
public Move randomMove(boolean color) { HashMap<Integer, Entry<Point, ChessSquare>> numberedMovesList = new HashMap<Integer, Entry<Point, ChessSquare>>(); HashMap<Integer, Entry<Point, Piece>> numberedMoves = new HashMap<Integer, Entry<Point, Piece>>(); int listCounter = 0; int counter = 0; Random r = new ...
57026079-73e9-4a35-ab4b-87a007de325d
0
public AutomatonAction(String string, Icon icon) { super(string, icon); }
8d593a2c-931a-4f1e-b381-038e69720f95
8
public final FileContext file() throws RecognitionException { FileContext _localctx = new FileContext(_ctx, getState()); enterRule(_localctx, 0, RULE_file); int _la; try { enterOuterAlt(_localctx, 1); { setState(226); _errHandler.sync(this); _la = _input.LA(1); while ((((_la) & ~0x3f) == 0 && ...
961ecf80-75f3-49bf-8340-f6461a6ef68d
8
private int negxB(int dest) { clearFlags(SR_X, SR_N, SR_V, SR_C); int result = -dest - (isExtendedSet() ? 1 : 0); if (msbSetB(result)) setFlag(SR_N); if (!isZeroB(result)) clearFlag(SR_Z); if (msbSetB(dest) && msbSetB(result)) setFlag(SR_V); if (msbSetB(dest) || msbSetB(result)) setFlag(SR_C); ...
5583a5c5-aa19-45a9-803a-35085e7b41e6
8
protected void readFrame() { readInputStream(); if (receiveError) { // EatAnError receiveError = false; eventCount++; state = ReadFrameState.idle; activity = true; } if (!receivedValidFrame) { if (state == ReadFram...
3013cb97-73c1-411f-9379-730e2a9f0336
7
final public java.util.Map.Entry < FtanString, FtanValue > FirstKeyValuePair() throws ParseException { FtanString key; FtanValue value = null; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case SQ_STRING_START: case DQ_STRING_START: key = String(); break; case NAME: key = Name(); b...
bd3cf424-c181-46d8-9568-5a6af0ecfb04
7
public void eleccion() { if (texto.getText().length() > 15 || texto.getText().length() < 11) { x = 1; } else if (texto.getText().length() == 15) { x = 2; } else if (texto.getText().length() == 14) { x = 3; } else if (texto.getText().length() == 13) { ...
edec4cf2-5882-4ecb-a462-4057bf3b3e74
6
public void paint(Graphics g) { super.paint(g); Graphics2D g2d = (Graphics2D) g; if (inGame) { for (Alien a : aliens) { if (a.isVisible()) g2d.drawImage(a.getImage(), a.getX(), a.getY(), this); } ArrayList<Missile> ms = ...
10b64908-7003-4b9d-8abf-206c6d25bb6e
9
public static File getFile(Component parent, String title, boolean write) { JFileChooser fc = new JFileChooser(); fc.setDialogTitle(title); if (write) { fc.showSaveDialog(parent); } else { fc.showOpenDialog(parent); } File f = fc.getSelectedFile(); if (f == null || (!write && !f.exists()) || (f.exis...
ae33b3c0-1698-442c-aa68-d873d164560c
0
@Test public void testPlayer() { // use knowledge given in constructer-comment in Player. // win-count is 0 at the start: assertEquals(0, _underTest.getNumberOfWins()); // name is "tester" as defined in the setUp(): assertEquals("Tester", _underTest.getName()); }
2fccec0d-e281-4f91-9f80-34a6f02bef97
9
private static KVPair ReadLineData(String line) throws KVException, IOException { if (line.isEmpty() || line.startsWith("//")) { return null; } if (!isValidStarter(line.charAt(0))) { throw new KVException("Line " + currentLine + " is invalid"); } line = line.substring(1); int keyEndIndex = line...
3568308e-3a31-41c3-abbe-f47fbbfc0f20
3
private void applyConfigChanges(String deviceOldName) { model.changeDeviceName(device, deviceOldName); Host host = model.getHost(device.getHost()); Client client; if ((host != null) && ((client = ClientConnectionManager.getInstance().getClient( host.getHostname(), host.getPort())) != null)) { if (...
c1aad2d6-21c4-4a7f-a1c0-2899958deac5
6
protected void UpdateLineColumn(char c) { column++; if (prevCharIsLF) { prevCharIsLF = false; line += (column = 1); } else if (prevCharIsCR) { prevCharIsCR = false; if (c == '\n') { prevCharIsLF = true; } else line += (column = 1); ...
fa1b06f4-e60e-473c-8573-19365301a849
5
private static int assignSeat(int min, int max) { int choix; // contient la réponse à une boîte de dialog multiple int i, j; // contient des compteurs String libre[]; // contient le tableau des sièges disponibles // compter le nombre de siège libre dans l'intervalle for(i = mi...
5b5bbd7c-cbe9-4e40-aa6d-9c2f01882cb3
4
public void addTagToTree(String newTagID, String newTag) { boolean addToRoot = false; DefaultTreeModel model; DefaultMutableTreeNode nodeAddTo = null; DefaultMutableTreeNode nodeToAdd = null; IDTitle nodeAddToObject = null; // Find the currently selected node in the tree ...
119da3d3-19a6-498b-a91e-2674a2f95129
2
public void addNeuron(Integer layer, Integer count, ENeuronType type, ActivationCalculation calculator) { if (layer >= neurons.size()) { throw new IndexOutOfBoundsException("This Perceptron stores only " + (neurons.size()) + " Layers!"); } for (int i = 0; i < count; i++) { this.neurons.get(layer).ad...
e8b1fc65-12dd-4125-8020-bfa92ee8a16b
5
private static String generateShortName( String longname ) { // assume that it is actually long, don't check it again longname = longname.replaceAll( "\\.$|^\\.", "" ); int dotIdx = longname.lastIndexOf( '.' ); String baseName = dotIdx == -1 ? longname : longname.substring( 0, dotIdx ); String ext = dotIdx ...
9d7c73c8-7e70-46c0-bd3d-6c0a64e2664f
2
public static void setInitalStyleSheet(Scene scene) { Date currentTime = new Date(); Calendar cal = new GregorianCalendar(); cal.setTime(currentTime); cal.set(Calendar.HOUR_OF_DAY, 13); cal.set(Calendar.MINUTE, 0); if(cal.getTime().after(currentTime)) { cal.s...
a168c54c-ab35-4cb5-8ced-fdaa61be7c5c
0
public static void main(String[] args) { Tank t1 = new Tank(); Tank t2 = new Tank(); t1.level = 15; t2.level = 15; System.out.println(t1.equals(t2)); }
3e3898c3-c473-4954-8611-2a711ca9cbc1
3
public Controller() { model = new Model(this); view = new Frame(this); view.setInstructionList(model.getInstructions()); view.setProgramCode(this.getDefaultInput()); sendToIO = false; usingRPi = System.getProperty("os.name").toLowerCase().equals("linux") && System.getProperty("os.arch").toLowerCase...
c6039613-7167-46f2-9e9b-42edfdfd03d6
5
private void AjoutFiliereActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AjoutFiliereActionPerformed // TODO add your handling code here: FiliereController tmpFiliere= new FiliereController (); int resultatAjoutFiliere=tmpFiliere.AddFiliere(nouvfiliere.getText()); swit...
81c06aef-30d1-4f60-968f-b0404b30ba7c
2
public static Configuration getConfigurationFrom(final ItemStack itemStack) { AttributeStorage storage = AttributeStorage.newTarget(itemStack, BackpacksPlugin.BACKPACKS_UUID); YamlConfiguration configuration = new YamlConfiguration(); try { String data = storage.getData(""); ...
9ee42cfb-cd71-47f7-acf0-9af3e80e2078
2
public static float calculateMarketChange(float start, float end) { int change = Integer.MAX_VALUE; int tries = 0; while (change > 10000 && tries++ < 4) { change = (int) (100 * ((Database.SUM_MARKET_PRICE_DATA.floorEntry( end).getValue()[6]) - Database.SUM_MARKET_PRICE_DATA .ceilingEntry(start).getVa...
043d5462-6203-47cd-b23c-a3026ac00469
2
public ArrayList<FonteFinanciamento> listar(String condicao) throws Exception { String sql = "SELECT * FROM fontefinanciamento " + condicao; ArrayList<FonteFinanciamento> listaFonteFinanciamento = new ArrayList<FonteFinanciamento>(); try { PreparedStatement stmt = ConnectionFactory.getConnection().prepar...
5bd8937c-11c0-40d5-82c8-c01b218c31f8
8
private RDFNode createFunctionCall(Expr expr) { ExprFunction function = expr.getFunction(); Resource f = getFunction(function); FunctionCall call = SPINFactory.createFunctionCall(model, f); if(addPrefixes) { String ns = f.getNameSpace(); if(ns != null && model.getNsURIPrefix(ns) == null) { Map<String,...
01ce0ab7-fc3b-41a2-b3ed-afe27cf6b4e1
7
public void setOptions(String[] options) throws Exception { String tmpStr; String[] tmpOptions; // numeric generator tmpStr = Utils.getOption("num", options); if (tmpStr.length() != 0) { tmpOptions = Utils.splitOptions(tmpStr); tmpStr = tmpOptions[0]; tmpOptions[0] = ""...
d0fef9d7-2cc5-42c6-bb84-c37023d3a7ec
2
public ArrayList<String> getAllCategorys() { ArrayList<String> categorys = new ArrayList<String>(); try { Connection conn = openConnection(); Statement stat = conn.createStatement(); ResultSet rs = stat.executeQuery("select name from " + DB_CATEGORY_TABLE + ";"); while (rs.next()) { categorys.a...
d3cb1e71-9f1d-4f42-97b0-10c15b659127
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 Course)) { return false; } Course other = (Course) object; if ((this.id == null && other.id != null) || (this.i...
8456d99c-cb16-4618-9f84-aab5543a35a2
6
private static int partition(Comparable[] a, int lo, int hi) { int i = lo; int j = hi + 1; Comparable v = a[lo]; while (true) { // find item on lo to swap while (less(a[++i], v)) if (i == hi) break; // find item on hi to swap ...
523b70f5-0605-4694-a0b8-e8037842f6fe
7
public void cambiarEstacion(boolean masMenos){ if (masMenos){ //Si masMenos (aumentar/disminuir) es true ambas frecuencias aumentarán if(frecuencia){ if(estacion<1610){ estacion=estacion+10; } else{ ...
67bb92f7-34b2-4e1e-b4a7-6551002d31f5
0
public AppTest( String testName ) { super( testName ); }
a014f27b-5882-47b2-aefd-9b879d509ad6
4
private static boolean launcherUpdateRequired() { // Obtain path to our jar and get checksum of it String[] mainCommand = System.getProperty(SUN_JAVA_COMMAND).split(" "); if (mainCommand.length == 0) { return false; } String jarPath = mainCommand[0]; if (!ja...
e9d70bac-199f-420b-b341-911667eea208
7
public synchronized StickyWebResponse execute() throws StickyWebNotInCacheException, StickyWebInternetException, StickyWebInvalidQueryString, StickyWebInvalidPostArguments { if (this.online) { Callable<StickyWebResponse> thunk = new Callable<StickyWebResponse>() { public StickyWebResponse call() ...
5abbfda3-a95f-4bb4-b04f-114a6a0fb8e8
9
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if(!(affected instanceof MOB)) return true; final MOB mob=(MOB)affected; if((msg.amITarget(mob)) &&(CMath.bset(msg.targetMajor(),CMMsg.MASK_MALICIOUS)) &&(msg.targetMinor()==CMMsg.TYP_CAST_SPELL) &&(msg.tool() instanceof...
f411c7ac-3f17-416d-a847-227c3764fc2c
9
private void chars() { if (true == this.inTitle) { this.currentTitle += (char)this.p.getLastChar(); } if (true == this.foundTitle && true == this.inText) { int c = p.getLastChar(); try { /* write the text to the xml file */...
0ae675e0-d488-4f0c-9856-07094290172d
7
public void setHeader(File file, String[] header) { if(!file.exists()) { return; } try { String currentLine; StringBuilder config = new StringBuilder(""); BufferedReader reader = new BufferedReader(new FileReader(file)); while((cu...
2791aac6-c73d-4fd9-8a09-0ac03ea45316
5
@Override public void actionPerformed(ActionEvent e) { tipo = e.getActionCommand().toString(); if (tipo.equals("limpiar")) { l.limpiar(); l.repaint(); } if (tipo.equals("circulo")) { l.setOpcion(2); } if (tipo.equals("cuadrado")) {...