method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
52e90380-b34c-44dc-a6a3-acaa13a6dc8b
4
private Compiler(URLClassLoader parent) { // If not running on JDK, compiler will be null if (compiler == null) { throw new Error("Compiler not available. This may happen if " + "running on JRE instead of JDK. Please use a full JDK 1.6." + "javax.tools.ToolProvider.getSystemJavaCompi...
532872ea-dc08-4899-9e30-c7f0a34b0d42
8
private void createWalls() { for (int i = 140; i <= 200; i += Object.size) { for (int j = 100; j <= 160; j += Object.size) { gameObjects.put(createCoordinateKey(new Coordination(j, i)), new Brick(j, i)); } } for (int i = 140; i...
b5aadea2-4aac-4f8c-b5b5-1ff6f4ad27ca
5
private static boolean checkTile(Level level, int x, int y) { // get the tile at the location Tile t = level.getTile(x >> 3, y >> 3); // trees can't grow on solids or water if (t instanceof BasicSolidTile || t instanceof AnimatedTile) { return false; } // don't place a tree in a building for (Entity...
1c9615d5-d7a7-4790-a388-c87cb9fbcdd2
7
static void dradf2(int ido,int l1,float[] cc, float[] ch, float[] wa1, int index){ int i,k; float ti2,tr2; int t0,t1,t2,t3,t4,t5,t6; t1=0; t0=(t2=l1*ido); t3=ido<<1; for(k=0;k<l1;k++){ ch[t1<<1]=cc[t1]+cc[t2]; ch[(t1<<1)+t3-1]=cc[t1]-cc[t2]; t1+=ido; t2+=ido; } ...
a1752bb9-4fdb-42b1-8853-716a40dfe9cd
2
@Override public void Consultar() throws SQLException { try { Conexion.GetInstancia().Conectar(); ResultSet rs = Conexion.GetInstancia().EjecutarConsulta(""); while(rs.next()) { // ObProducto.setProductoBodega(null); // ...
1f4fa1e7-4216-4c68-a7eb-1034ee0a39a0
0
public Boolean contains(DrawableItem di, Point p) { return di.getShape().contains(p); }
d1c4618c-4573-4e27-bddc-f3f6da2fe9b3
6
private static boolean b4(int i, int j, BufferedImage image) { Boolean right = ((image.getRGB(i+1, j-1) == BLACK) || (image.getRGB(i+1, j ) == BLACK) || (image.getRGB(i+1, j+1) == BLACK)); Boolean with = ((image.getRGB(i-1, j-1) == WHITE) && ...
66f71438-0dc4-4194-b3c7-73a1b4721a06
9
private void thermallyDeexciteAtoms() { if (thermalDeexcitor == null) thermalDeexcitor = new ThermalDeexcitor(this); double sig; for (int i = 0; i < numberOfAtoms - 1; i++) { rxi = atom[i].rx; ryi = atom[i].ry; for (int j = i + 1; j < numberOfAtoms; j++) { if (atom[i].isExcitable() || atom[j].isEx...
a1a98413-96bf-4961-8067-6fd73ad14deb
7
private Posicion probarPorFila(int filaTerreno, int[][] terreno, int[][] casa, Orientacion orientacion) { // asumo que entra boolean entra = true; // variables auxiliares int anchoTerreno = terreno[0].length; int altoCasa = casa.length; int anchoCasa = casa[0].length; for (int columnaTerreno = 0; colu...
91ec8ba6-be5e-41e3-bc0c-1042d88642f9
9
@Override public String List_file_url(String id) { String texto_html = ""; try { this.conn = FactoryConnectionDB.open(FactoryConnectionDB.ORACLE); String sql = "select a.NO_FILE,a.NO_ORIGINAL from RHTV_ARCHIVO_DOCUMENTO a , RHTV_DOCUMENTO_ADJUNTO d where d.ID_DOCUMENTO_ADJU...
514db470-4003-4cad-9f1c-489aedf2c8e1
1
Message receive() { try { return this.logs.remove(0); } catch (Exception e) { return null; } }
25a4b226-3f52-46be-9f2d-b251c0a2cdc2
5
private void validateTime(String t) { try{ timeInt = Integer.parseInt(t); }catch(NumberFormatException e){ throw new IllegalArgumentException("Input("+ t + ") Time-String must be a valid time 0000-2359"); } if(Integer.parseInt(t.substring(2,4)) >= 60){ throw new IllegalArgumentException("Input("+ t ...
b6f4af14-041d-4584-a6e5-9e1307d0ba05
0
public static ModelClassDesc tableParseToMode(TableDesc tableDesc) { ModelClassDesc modelClassDesc = new ModelClassDesc(); modelClassDesc.setClassName(getClassName(tableDesc.getTableName())); modelClassDesc.setFileds(getModelFiledByTableColumn(tableDesc)); return modelClassDesc; }
c8a5e638-6891-4f7c-b0fa-f352aeba9843
7
File[] getRoots() { /* * On JDK 1.22 only... */ // return File.listRoots(); /* * On JDK 1.1.7 and beyond... * -- PORTABILITY ISSUES HERE -- */ if (System.getProperty ("os.name").indexOf ("Windows") != -1) { Vector /* of File */<File> list = new Vector<File>(); list.add(new File(DRIVE_A)); ...
5c46d731-a157-4581-b07b-84afcb7a862d
6
public static boolean is_array(Object object) { // OK if (object == null) return false; if (object instanceof Map) return true; if (object instanceof LinkedHashMap) return true; if (object instanceof HashMap) return true; if (object instanceof ArrayList) return true; if (object instanceof List) return tru...
61f7b41f-4eab-4db6-a76b-46cffecfa1d1
3
public void handleRemoveTapeAlphabetButton() { Object alphabet = startView.getTapeAlphabetList().getSelectedValue(); if(startView.getTapeAlphabetList().getSelectedIndex() > 0){ startView.getTapeAlphabetItems().removeElement(alphabet); if(startView.getInputAlphabetItems().contains(alphabet...
9c46e002-467c-43a2-a029-1bae61d3ea6e
1
public void setMaxBill(double maxBill) { if(maxBill < 0) { throw new IllegalArgumentException( "error: bill max must be greater than or equal to zero"); } this.maxBill = maxBill; }
6e6f20aa-9808-461d-84b2-34d04d70ab76
7
public void draw(Graphics g) { View view = this.getView(); int point[] = view.getTilePosition(tower.getTile()); MagicGem gem = tower.getMagicGem(); if (gem!=null) { if (gem.getType().equals("hobbit")) this.setImage("/textures/constructs/tower/tower_hobbit.png"); else if (gem.getType().equals("human")) t...
5d74bd29-615d-497a-999e-05b096c89470
4
public synchronized void setWindowPosition(int x, int y) { if (this.visible == false) { throw new MinuetoWindowInvalidStateException("Window is invisible"); } if(this.isClosed()) { throw new MinuetoWindowInvalidStateException("Window is closed!"); } if ( x < 0 ) throw new MinuetoOutOfBoundEx...
22f3ab00-fee0-41ae-86c3-38c63794f351
5
private boolean versionCheck(String title) { if (this.type != UpdateType.NO_VERSION_CHECK) { final String version = this.plugin.getDescription().getVersion(); if (title.split(" v").length == 2) { final String remoteVersion = title.split(" v")[1].split(" ")[0]; // Get the ...
bc1883fb-9d19-458f-8451-28e9ea4b889d
0
@Test public void testMultipleFilters() throws Exception { final Properties[] configs = new Properties[] { new Properties(), new Properties() }; configs[0].setProperty("type", "Zero"); configs[1].setProperty("type", "Wan"); configs[1].setProperty("median_latency", "250"); fin...
a66f6288-7b89-4cc0-9cda-376461bc5300
5
public Wave22(){ super(); MobBuilder m = super.mobBuilder; for(int i = 0; i < 550; i++){ if(i % 5 == 0) add(m.buildMob(MobID.ODDISH)); else if(i % 4 == 0) add(m.buildMob(MobID.BELLSPROUT)); else if(i % 3 == 0) add(m.buildMob(MobID.MEOWTH)); else if(i % 2 == 0) add(m.buildMob(MobID.MANK...
edf2ddcc-761d-457b-a558-f408c278fb1c
2
public static boolean isGameSytstemPath(String path) { path = path.trim().toLowerCase(); return path.endsWith(DataConstants.GAME_SYSTEM_FILE_EXTENSION) || path.endsWith(DataConstants.GAME_SYSTEM_COMPRESSED_FILE_EXTENSION) || path.endsWith(DataConstants.GAME_SYSTEM_COMPRES...
f8dd5002-14b4-485c-ab57-14c5078e4192
1
public void remove(int index) { RangeCheck(index); int numMoved = size - index - 1; if (numMoved > 0) { System.arraycopy(data, index + 1, data, index, numMoved); } data[--size] = null; }
d79eb485-b7b1-45bd-b5cc-6e1406eeb706
0
@Override public int attack(double agility, double luck) { System.out.println("I tried to do a special attack but I haven't set it so I failed at this turn..."); return 0; }
21cfecdb-910a-4a30-b54d-7c20cb883daf
4
protected void updateDrillYard() { if (drillYard == null || drillYard.destroyed()) { final DrillYard newYard = new DrillYard(this) ; final Tile o = origin() ; final int S = this.size ; for (int n : TileConstants.N_ADJACENT) { n = (n + 2) % 8 ; newYard.setPosition(o.x +...
60b272b1-b0e3-49cc-93b2-9bf900f49334
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...
4ddecfc4-e289-4f07-a400-1be67ffc0314
0
@Override public String toString() { return ToStringBuilder.reflectionToString(this,ToStringStyle.MULTI_LINE_STYLE); }
ebc09535-bf97-4d90-9d5f-6c8bf9fde8aa
8
public synchronized int available() throws IOException { int avail = super.available(); int unencoded = precount - prepos + in.available(); if (encoder.getEncoder().getVbr()) { switch (mode) { case 0: // Narrowband // ogg header size = 27 + packetsPerOggPage // count ...
1aab92da-156c-4e34-abaf-05352ae9fbd9
8
@Override public Object getValueAt(int row, int col) { Order o = info.get(row); switch (col) { case 0 : return o.getOrderName(); case 1 : return o.printDate(o.getDueDate()); case 2 : return o.getSleeve().getMaterial().getName(); case 3 : r...
971f7902-9bf2-4aab-9d1e-d7591435e0cd
5
public void switchLabels() { // Only to switch Labels if necessary if (tabbedPane.getSelectedIndex() == 0) { if (fieldleft.hasFocus() || comboboxleft.hasFocus()) { label_l.setText("Von:"); label_r.setText("In:"); arrow.setVisible(true); arrow_o.setVisible(false); } else { label_r.setText("...
cb199b21-c8c5-406c-9927-3822f8d3389e
4
public RSA(BigInteger N, int E, BigInteger D, BigInteger P, BigInteger Q, BigInteger DP, BigInteger DQ, BigInteger C) { this.n = N; this.Exponent = E; this.Private = D; this.p = P; this.q = Q; this.dmp1 = DP; this.dmq1 = DQ; this.coeff = C; // adjust a few flags. Encryptable = (n != null && n != Ze...
a43cdfaf-5e17-4dbd-9ac5-fd4492f35407
4
public void visit(final EditorVisitor visitor) { // First visit ourself visitor.visitClassEditor(this); final EditorContext context = this.context(); // Visit each field final FieldInfo[] fields = this.fields(); for (int i = 0; i < fields.length; i++) { final FieldEditor fieldEditor = context.editField...
4077a38a-4fa6-4c02-9ea2-511df70a835f
8
@Override public void learnFromInstance(Instance inst, HoeffdingOptionTree ht) { this.observedClassDistribution.addToValue((int) inst.classValue(), inst.weight()); if (this.listAttributes == null) { this.numAttributes = (int) Math.floor(Math.sqrt(inst....
a08cb4f1-a1ac-439c-a748-665b225ea2a8
2
private void drawGrid(Graphics2D g2) { for (int y = 0; y < grid.height; y++) { for (int x = 0; x < grid.width; x++) { g2.setColor(Color.DARK_GRAY); g2.drawRect(x * BLOCK_SIZE, y * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE); } } }
b443e74c-0aad-45c8-acb2-57a8578c5f19
4
public void createReport(File newFile) { PrintWriter writer; try { writer = new PrintWriter(newFile); writer.write("Eagle Creek SiteMap Analyzer Report for: " + getFileName() + "\n"); writer.write(" ,Summary:, Total, Pages, Documents, Media" ...
a51f91a8-6d0e-41d9-ad42-8513dbc2911a
6
Space getForkSpace(Piece piece) { Space[] oppSpaceArray = getSpacesWithPiece(piece); Space[][] openSetsLast = getOpenSets(lastSpaceMoved); for (Space oppSpace : oppSpaceArray) { if (oppSpace != lastSpaceMoved) { Space[][] openOppSets = getOpenSets(oppSpace); for (Space[] oppSet : openOppSets) { fo...
a8138622-cfc2-4687-a9cf-45c8eadd35b0
1
public String display() { String theMessages = "Welcome to the Message Board\n\n"; for(int i = 0; i < messages.size(); i++) { theMessages = theMessages + this.messages.get(i).getMessage(); } return theMessages; }
a4edcc60-7121-4a5f-86f0-4339f64d88a3
5
public void addSettings(String date, String background1, String background2, String background3, String logo, String button) { Element settingsModule = doc.createElement("settings"); gameModule.appendChild(settingsModule); Element startdateElement = doc.createElement("startdate"); ...
5164f7df-a0a4-42cd-b357-be803aaf7170
2
private int nextStake(int i) { int nextStake = lastStakePlusSmax(i); if (leftOvers > 0.0) return leftoversPlusSmax(i); if (nextStake > endStake) return endStake; return nextStake; }
4ff8f926-ae93-4ffb-bab0-ab632393adea
2
public static String getScore(){ rover = head; String blank = ""; while(rover!=null){ if(rover.status == 1){ blank = blank + rover.name + " - " + rover.score + "\n"; } rover = rover.next; } return blank; }
8771900c-36b6-49d5-ae8b-0c19734d3157
6
@Override public OreLookup lookup(String player, Integer time, List<Integer> restrict) { OreLookup ore = new OreLookup(player); for (String w : plugin.getConfiguration().getWorlds()) { QueryParameters parameters = new QueryParameters(); parameters.addActionType("block-break",MatchRule.INCLUDE); pa...
479e24b2-80e7-4ba9-9c75-c1e180d63067
9
private boolean localPeak(int i, int j, int hw, int hh, int neighbourhood) { int dt, dr; long peak = houghAccumulator[i][j]; for (int k = -neighbourhood; k <= neighbourhood; k++) { for (int l = -neighbourhood; l <= neighbourhood; l++) { if (k == 0 && l == 0) ...
d5b88f95-db55-4e13-ab0e-0ffe02d3b6d4
3
public boolean isNonsquareSymmetrical(Matrix m) { MatrixIterator tr_itr = new MatrixIterator(m, TOPRIGHT); MatrixIterator bl_itr = new MatrixIterator(m, BOTTOMLEFT); while(tr_itr.hasNext() && bl_itr.hasNext()) { if(tr_itr.next() != bl_itr.next()) { return fal...
186f4313-f3aa-4b00-ab47-56eba7f18502
6
public boolean saveLevel(File levelFile, PXLE_Level levelToSave) { try { // THESE WILL US BUILD A DOC DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); ...
fd32b7dd-8406-4ddd-a3f4-a8881b7707f6
7
public static void makethefile(String infile, String outfile, int rootnote, String temperamentstring, double maxpitchbend, Boolean writemaxpitchbend, int selectProgram, int tuningroot, double tuningfrequency, int transposeamt, Boolean overwrite) throws MidiUnavailableException, InvalidMidiDataException, IOException { ...
07099a9b-f0cf-4c16-a520-7c82256ddc31
4
@Override public boolean[][] generateMaze() { List<Point> list = new ArrayList<Point>(); int last; this.maze[1][1] = false; last = this.addNeighbours(new Point(1,1), list); while(!list.isEmpty()){ int curi = this.rnd.nextInt() % last; ...
7f56687a-e572-4fd7-8ac7-ce9d6b39ca9b
6
protected void changeListActiveOrNon() { showList.clear(); if (cmbActiveNonActivePersons.getSelectedItem().equals(ACTIVE_PERSON)) { for (DBPerson dbPerson : DatabaseList.listOfStockHolders) { if (dbPerson.getAllStocks() != 0) { showList.add(dbPerson); } } } if (cmbActiveNonActivePersons.getSe...
bccbf71f-5a94-4b5a-abd6-752d01162cfd
4
private void boardSetup() { String[] colour = {"Black","White"}; int[] printRows = {0,1,2}; boolean offset = true; for(int i=0;i<2;i++) // loop for each player { for(int k=0; k<3;k++) // loop for each row (&^) { for(int j = (offset) ? 1 : 0 ; j<=7; j+=2) // loop for each disc, (&^^) { ...
02280dc3-3678-4c5c-a3f1-1790f1da5bb4
0
public AnimalInfo() { /** * Instantiates an animal object for each animal selection */ final Animal lion = new lion(); final Animal tiger = new tiger(); final Animal bear = new bear(); /** * Sets parameters for the JFrame */ setResizable(false); setIconImage(Toolkit.getDefaultToolkit().getImage("C:\\Users\\...
5bc9cf7f-8b43-4681-98a5-3e9a7b5dbfba
0
@Override public void paint(Graphics g) { // TODO Auto-generated method stub super.paint(g); //System.out.println("repainting"); this.drawFields(g); this.drawDate(g); }
504fb1ec-344b-41d4-8519-26709c42eb0d
0
public int getX() { return x; }
62edb53f-3d6d-4834-bee0-d93feebd67f3
2
public int compare(Atom a1, Atom a2) { // TODO: something like return Integer.compare(a1.layer,a2.layer) // would be more efficient if (a1.layer < a2.layer) return -1; else if(a1.layer > a2.layer) return 1; else return 0; }
107b1763-d8a7-4463-9572-d35dc66abcfe
1
public long read7bytes() throws IOException { long b0 = read(); long b1 = read(); long b2 = read(); long b3 = read(); long b4 = read(); long b5 = read(); long b6 = read(); if (le) return b0 | (b1 << 8) | (b2 << 16) | (b3 << 24) | (b4 << 32) | (b5 << 40) | (b6 << 48); else return b6 | (b5 << 8) ...
753ad51d-af92-418f-958b-408d7ec4ece2
2
private static int clamp(int p) { return p > 255 ? 255 : (p < 0 ? 0 : p); }
b36c1e9c-8f2f-4419-bfd8-a4b6a45c11c4
0
public void setButton(String text, int iD, int loc, boolean disabled) { buttonArray[loc].set(text, iD, disabled); }
d6eb5311-67d3-46a2-9cbf-483e43468f64
8
@Override public void e(float sideMot, float forMot) { if (this.passenger == null || !(this.passenger instanceof EntityHuman)) { super.e(sideMot, forMot); this.W = 0.5F; // Make sure the entity can walk over half slabs, // instead of jumping return; } EntityHuman human = (EntityHuman) this.passe...
c169e138-9b5b-47ae-bf67-3fbc9b713d25
2
public static void main(String[] args) { final String user; final String pass; if (args.length != 2) { user = ""; pass = ""; } else { user = args[0]; pass = args[1]; } EventQueue.invokeLater(new Runnable() { public void run() { try { Model model = new Model(user, pass); ...
e92a2609-de4a-46ec-b2d1-5d5aaf6a55e0
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...
b55a0570-d8f2-4d89-b19f-e0c257ef9b15
8
public static boolean searchinRotatedArrayWithDup(int[] A, int target) { int start = 0; int end=A.length-1; int mid; while(start<=end) { mid=(start+end)/2; if(A[mid]==target) return true; if(A[start]<A[mid]) ...
6d2b6c74-0201-48b4-bef4-f32e9fe9ba6a
7
private boolean executeCommand(String cmd, CommandSender sender, Iterator<String> args) { try { return (Boolean)commands.get(cmd).getClass().getMethod(cmd, CommandSender.class, Iterator.class).invoke(commands.get(cmd), sender, args); } catch(SecurityExcept...
b02b0e50-b120-4027-8da4-cfa8c1a9593b
1
public boolean enregistrerDepartVehicule(int numeroLocation){ System.out.println("ModeleLocations::enregistrerDepartVehicule()") ; Location location = rechercherLocation(numeroLocation) ; if(location != null){ location.setEtat(Location.EN_COURS) ; location.setDateDepart(new GregorianCalendar()) ; locatio...
7c751021-b660-4e3e-8459-bb4a56a237d5
9
public void setResponseCode(int responseCode) throws MessageAttributeException { switch (responseCode) { case 400: reason = "Bad Request"; break; case 401: reason = "Unauthorized"; break; case 420: reason = "Unkown Attribute"; break; case 430: reason = "Stale Credentials"; break; case 431: reason = "Integri...
3078378b-7c96-4084-8335-41c77e525868
8
protected int validateInput(String input, int numDigits) { if(input.equals("")) { return 0; } boolean negative = false; input = input.trim(); if(input.charAt(0) == '-') { negative = true; } //Goes thr...
5be7611c-be8d-4700-922b-ecaa0a447dd0
4
@Test public void testReceiveMultipleTimeout() { int noOfMessages = 5; try { consumer = new AbstractMessageConsumer(mockTopic) { }; assertNotNull(mockTopic.getTopicSubscriber()); HashSet<Message> messages = new HashSet<Message>(); for (int i = 0; i < noOfMessages; i++) { Message msg = new MockM...
2282412e-5fa1-4fe1-8881-2ae78892e88d
7
public int searchInsert(int[] A, int target) { //边界条件判断 if ( A.length==0 ) return 0; int end = A.length-1; int start = 0 ; if (A[start] >= target) return start; else if (A[end]< target ) return A.length; //二分查找 int mid = (end-start)/2; while ( end>=start) ...
ec7c567b-c146-44ef-8d86-985831588476
6
private List<MorrisLineAdjacent> getRowLineAdjacent() { List<MorrisLineAdjacent> lines = new ArrayList<MorrisLineAdjacent>(); boolean bl = this.hasLeft(); boolean br = this.hasRight(); MorrisLineAdjacent oneLine = null; if (bl && br) { //this is in the middle oneLine = new MorrisLineAdjacent(this, this.lef...
d48f3d45-6a2d-43b1-8dea-352c02fba863
2
private void findDeviceParser(String type) throws SAXException { if (type != null) { logger.info(String.format( Messages.getString("device_found"), type)); //$NON-NLS-1$ currentParser = parserFactory.getParser(type); if (currentParser != null) { logger.info(String.format(Messages.getString("pars...
27a92749-d3d4-4931-b6a3-67b4f74eb0b5
0
public BodyPart getBodypart(){ return bodypart; }
1d5b8441-46b0-48d3-955b-18bb896db871
3
public GaussianDialog(final Panel panel) { setTitle("Gaussian"); setBounds(0, 0, 350, 200); Dimension size = getToolkit().getScreenSize(); setLocation(size.width / 3 - getWidth() / 3, size.height / 3 - getHeight() / 3); this.setResizable(false); setLayout(null); JPanel paramPanel = new JPanel(); pa...
86ebe3de-eb73-4558-a56d-72130cddd76c
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 fe...
83136fa1-239c-453c-bf9a-561b39798768
7
public static String[] traitDesc(String trait) { /* * Traits for civs: * 3 Aggressive > +10% when attacking, 1 free promotion per unit * 3 Imperialistic > 2 health per city, > 1 extra trade route per city * 2 Refined > 2 culture per city, > +10% research speed * 4 Prosperous ...
29964a86-5ddf-4f78-ad44-9191496e577d
5
public Action choose(LightsOut.Player actor, Set<Action> options) { if(presses == null) { presses = new HashSet<Location>(); // linear algebra solution boolean[][] state = actor.state(); boolean[] s = stateVector(state); boolean[][] M = stateMatrix(state[0].length, state.length); gauss(M, s); ...
6f6c6f31-33cb-4795-a05c-60c1fc47d73d
8
public void actionPerformed(ActionEvent ae) { try { if (ae.getSource() == this.tmrReadLine) { try { if ((!this.continueRun) || (this.killThread) || (this.sktMyConnection_ConnectedAgent.isClosed())) { closeThread(); } } catch...
52b3ddf3-12d5-4e0c-8802-d3e3f34c66a8
9
public double HCRR(Instances train,Classifier[] cfsArray,List<Integer>[] classifyResult,List<Double> correctRateArray,double initCorrectRate,List<Double> currentResult,List<Integer> ClassifierNo){ double diversity;//差异性(差异性度量是κ度量,κ值越小,差异性越大) double tempDiversity; double correctRate;//正确率 double voteCorrectRate;...
be07a2d0-a391-437e-abef-aa598083a765
9
private int checkCross(int i, int j, Board b) { int points = 0; //ONLY IF "X" IS FOUND ASSUMING X IS COMPUTER if(b.board[i][j].equals("X")) { if(i==0) { if(j==0) { points+=checkConsecutiveX('r',i,j,b); points+=checkConsecutiveX('d',i,j,b); points+=checkConsecutiveONextToX('r',i,j...
72fac64f-2a59-47d3-a8bd-270183377c3d
0
public void addDocumentRepositoryListener(DocumentRepositoryListener l) { documentRepositoryListeners.add(l); }
a04e4524-66ad-4a1c-8435-d17f8a8598c2
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...
8017e6cf-0387-4a15-a375-fdc4f95207d2
2
@Override public void removeStock(Stock stock) { tx.begin(); for (SubProcess sp : stock.getSubProcesses()) { stock.removeSubProcess(sp); } for (StorageUnit su : stock.getStorageUnits()) { stock.removeStorageUnit(su); } em.merge(stock); em.remove(stock); tx.commit(); }
de65d986-408c-4a4f-a4f4-b56eeea396f7
0
public byte[] getEncoded() { return this.encoded; }
55976c02-f0da-480c-94fa-ec070ea75466
9
public double logScore(int nType, int nCardinality) { double fScore = 0.0; switch (nType) { case (Scoreable.BAYES): { for (int iSymbol = 0; iSymbol < m_nSymbols; iSymbol++) { fScore += Statistics.lnGamma(m_Counts[iSymbol]); } fScore -= Statistics.lnGamma(m_SumOfCounts); ...
d7b3c32c-c7cc-4fe4-9b1b-79ee4e8660a2
2
public OdigoiList() { con = new Mysql(); setTitle("Lista Odigwn"); /* vgazei to para8uro sto kedro tis othonis me diastaseis 355x40 */ Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); this.setBounds(dim.width/2-150, dim.height/2-125, 355, 400); /*--------------*/ this.setResizable(false); ge...
a923176d-6051-454b-888c-03cd65814e6b
3
private void init(final Stage primaryStage) { thisStage = primaryStage; thisStage.setTitle("Sliding Puzzle"); StackPane sPane = new StackPane(); Label label = new Label("Name: "); final TextField nameField = new TextField(); final Button setNameField = new Button("OK")...
a6e7850a-b9b8-4121-a3e7-55bb49ca0add
0
public void updateUptime(int uptime) { lastUptime = uptime; }
52285e8d-9bc4-436f-8480-02cc631efc8a
0
public boolean requiresPolygonIDs() { // not needed in this case... return false; }
b6231d0a-3ee6-4769-a56f-825593d7ba69
3
protected boolean validaCampos(){ boolean valida = true; if(txtCpf.getText().isEmpty() || txtDataNascimento.getText().isEmpty() || txtNome.getText().isEmpty()){ valida = false; }else { valida = true; } re...
0f5930bc-ff0b-4fd2-8abc-7d68d377511e
5
@Override public void valueChanged(TreeSelectionEvent e) { if(component != null) editor.remove(component); DialogNode node = getSelectedNode(); if(node == null) return; DefaultMutableTreeNode parent = (DefaultMutableTreeNode) node.getParent(); if(node.type == EnumNodeType.CATEGORY){ DialogC...
fc79c699-6605-4db5-90ee-4c4ff6cd8069
8
public void forceKillProt() { tmr.cancel(); if(runningServer != null) runningServer.kThread(); if(runningClient != null) runningClient.kThread(); forceKill = true; if(socket1 != null) { try { socket1.close(); } catch(IOException e){} } if(server != null) { try { server...
4d1eeb77-2c2c-4bcc-9624-8c10bacf47e5
7
public Date getNextArena() { Date returnDate = null; InaccurateTime newMax = Time.currentInnacurateTime(); ArrayList<Integer> ints = new ArrayList<>(); for (Date date : arenaMap.keySet()) { ints.add((int) date.getInaccurateTime().toNumberValue()); } int currentTime = getLargest(ints.toArray(new Integ...
1e8e6b2a-d417-4fc4-80bc-131adee9f10a
3
public Image getImage(){ switch(anim){ case 0: return bang0; case 1: return bang1; case 2: return bang2; default: return bang1; } }
dd5a869a-8922-4042-a4c9-5cb2188a5a67
1
public void setLocked(boolean locked) { if (mLocked != locked) { notifyOfLockedStateWillChange(); mLocked = locked; notifyOfLockedStateDidChange(); } }
199d3ed2-b011-444d-8791-e2a3bd5fac1a
4
public static void main(String[] args) { //Scanner initialisieren scanner = new Scanner(System.in); hero = new Hero(); System.out.println("Options: attack, arbitraryOption, quit"); //fancy Version einer Dauerschleife while(scanner.hasNext()) { /...
6fc67234-668b-4428-9c77-bd0d7faf1436
2
public Texture getTexture(String tex) { if(!textures.containsKey(tex)) { try { loadTexture(tex); } catch(Exception e) { System.out.println("Couldn't create texture!"); } } return textures.get(tex); }
f83bf255-6944-417f-a444-8e208c00672b
3
private static long toMillis(String value, TimeUnit unit) { if(value != null && !value.isEmpty()) { Matcher matcher = Pattern.compile("[0-9]+").matcher(value); if(!matcher.find()) return 0; return unit.toMillis(Integer.parseInt(matcher.group())); } return 0; }
bfea2c18-f7be-4b7a-8d18-e0754499ac7c
8
public boolean makeLocalBackup(String fileName) { //Copy local file to back-up location try { String backupDirectory = this.downloadLocation + File.separator + "Local_Backup"; if(this.fileSystemManager.getDirectory(backupDirectory) == null) { this.fileSystemManager.createDirectory(backupDirector...
49fb6eee-ad18-40c1-be12-990ac86f985a
2
private void getFloorPlanGetXY(String line, CellDescription cellDescription) { int startIndex; int endIndex; /*get x*/ startIndex = line.indexOf("xs") + 4; endIndex = line.indexOf('\'', startIndex); try { cellDescription.locX(Integer.parseInt(line.substring(startIndex, endIn...
4aee3a99-0b37-408a-82c9-6037ac434800
9
@EventHandler(priority = EventPriority.LOW) public void playerLogout( final PlayerDisconnectEvent e ) { int dcTime = MainConfig.playerDisconnectDelay; final BSPlayer p = PlayerManager.getPlayer( e.getPlayer() ); if ( dcTime > 0 ) { BungeeSuite.proxy.getScheduler().schedule( Bunge...
fa048813-5fd8-4c09-b477-74fc8a080804
9
public void next(int width, int height) { rotationAngle = (rotationAngle+10)%360; // scaleVal goes from 0 to 1, then 1 to 0, then starts over scaleArg = (float)((scaleArg == 1) ? scaleArg - 0.1 : scaleArg + 0.1); scale = (float)Math.cos(scaleArg); movClubX += inc_club; movDiamondX += inc_diamond; movHeart += ...
5fd53834-fe4d-4d41-a194-37799321d23d
8
private boolean isKingInCheck(Position kingPosition) { boolean inCheck = false; String colorCheck = whitePlayerTurn() ? "Black" : "White"; // System.out.println("\nPieces that can move for " + colorCheck + "'s Team"); for(int y = 0; y < maxWidth; y++) { for(int x = 0; x < maxHeight; x++) { Pie...
22bb67a9-70f2-481c-af80-23e3f477c45b
8
private void resubstitute(StringBuilder buffer) { for (int c = 0; c < buffer.length(); c++) { if (buffer.charAt(c) == '*') { char x = buffer.charAt(c - 1); buffer.setCharAt(c, x); } else if (buffer.charAt(c) == '$') { buffer.setCharAt(c, 's...