method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
0f5eb36f-1e6a-4773-8a0b-ea37dc81e812
9
public boolean isBoxInFrustum(double par1, double par3, double par5, double par7, double par9, double par11) { for (int i = 0; i < 6; i++) { if ((double)frustum[i][0] * par1 + (double)frustum[i][1] * par3 + (double)frustum[i][2] * par5 + (double)frustum[i][3] <= 0.0D && (double)frustum[i...
dd0d0e6a-8c41-464d-9f25-bde3e8acc22e
6
private boolean jj_3R_56() { Token xsp; xsp = jj_scanpos; if (jj_3_38()) { jj_scanpos = xsp; if (jj_3_39()) { jj_scanpos = xsp; if (jj_3_40()) { jj_scanpos = xsp; if (jj_3_41()) { jj_scanpos = xsp; if (jj_3_42()) { jj_scanpos = xsp; if (jj_3_43()) return true; } ...
99f4e51a-d253-4c16-9207-0604b7a003cd
1
public InitStmt(final LocalExpr[] targets) { this.targets = new LocalExpr[targets.length]; for (int i = 0; i < targets.length; i++) { this.targets[i] = targets[i]; this.targets[i].setParent(this); } }
629244a9-011a-4bfd-a11c-53faf7be7ef8
7
private double recursiveDeterminant(Matrix matrix) { int n = matrix.getHeight(); if (n == 1) { return matrix.get(0, 0); } double res = 0.; for (int i = 0; i < n; i++) { Matrix newMatrix = new Matrix(n - 1, n - 1); for (int j = 0; j < n; j++) { for (int k = 1; k < n; k++) { if (j != i) { ...
2db91bf8-b1b7-4a06-afaa-c9d10906e082
0
public Integer getIdHistorialClinico() { return idHistorialClinico; }
4b6276bc-3352-492b-baf0-fe0ca74bea68
6
public boolean actionTendSpecimen(Actor actor, Fauna fauna) { final float upgrade = station.structure.upgradeLevel( SurveyStation.CAPTIVE_BREEDING ) ; float success = 1 + (upgrade / 2f) ; if (actor.traits.test(XENOZOOLOGY, ROUTINE_DC, 1)) success++ ; if (actor.traits.test(DOMESTICS , SIMPLE_D...
39ba2a42-1ef0-4c62-a3d5-a4399212629d
9
public void associar(String principal,String secundari) throws Excepcio { boolean sec=false,prin=false; LlocSecundari llocSec=null; LlocPrincipal llocPrin=null; Iterator<Lloc> it = llocs.iterator(); Lloc l; while (it.hasNext() && (!sec || !prin)) { l=it.next(); if (l instanceof LlocSecundari) { if...
ba9a62df-44ba-48f9-867b-8841f5b597aa
5
protected static boolean implementsAllIfaces(ClassInfo clazz, ClassInfo[] ifaces, ClassInfo[] otherIfaces) { big: for (int i = 0; i < otherIfaces.length; i++) { ClassInfo iface = otherIfaces[i]; if (clazz != null && iface.implementedBy(clazz)) continue big; for (int j = 0; j < ifaces.length; j++) { ...
c93578bc-3dff-450a-b145-4cb10f019828
5
public void sendBundle(Bundle bundle) { ServalNode uplinkNode = null; if (!capabilities.isEmpty()) { // Elect ourselves to send it uplinkNode = this; } else { // Check if anybody in the mesh (i.e. neighbours) have the capability to transmit it ...
ab61abfc-914a-4398-9977-718816e2714f
6
public int battleCalc(BaseClass test1,BaseClass test2){ if(test1.atk>test2.def){ System.out.println("atk"); damage=test1.atk-test2.def; if(isCritical(test1)){ damage=damage*2; System.out.println("CRIT"); } } if(test1.atk<test2.def){ damage=test2.def-test1.atk; if(isCritical(test2)){ ...
d21673d0-50e5-47ca-8178-7cce33c19a60
1
public void visit_lsub(final Instruction inst) { stackHeight -= 4; if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } stackHeight += 2; }
54d09b61-86c0-45cf-bea9-d1fb1a45d176
4
public int CloseDocument() { //Controllo se il documento è stato creato if (this._MyDocument != null) { //Ciclo per il numero di capitoli for (int i = 0; i < this._ChapterList.size(); i++) { try { //Aggiungo i capitoli al ...
15aa2156-d6c3-4b09-9423-8ef377d212c9
8
public static void main(String args[]){ CashBox pCashBox = new CashBox(); Selector pSelector = new Selector(); int drink; int money; int sugar; String choice; Scanner in = new Scanner(System.in); System.out.println("Insert coins: "); money = in.nextInt(); if (money!=0){ pCashBox.deposit(...
98e59b44-0d54-4d76-a869-c662168d6339
4
public Model getModel() { Model model = (Model) SpotAnimation.cache.get(id); if (model != null) { return model; } model = Model.getModel(modelId); if (model == null) { return null; } for (int i = 0; i < 6; i++) { if (srcColors[0] != 0) { model.swapColors(srcColors[i], destColors[i]); } }...
4131d092-4077-4b98-8567-a581fb3d79d3
4
@Override public Cell<V> cell(int row, int column) { if (exists(row, column)) { SortedSet<Cell<V>> tail = cells.tailSet(finder(row, column)); if (tail.size() > 0) { Cell<V> cell = tail.first(); if (cell.getRow() == row && cell.getColumn() == column) { ...
e04ba588-fafd-4d74-887f-3e21dedc40f9
5
@Override public Object getValue() { PropertyTree parent=this.getParent(); Object gt=parent.queryBestResult(MediaProperty.REPLAYGAIN_TRACK_GAIN); Float gainTrack=StringUtils.toFloat(gt); Object ga=parent.queryBestResult(MediaProperty.REPLAYGAIN_ALBUM_GAIN); Float gainAlbum=StringUtils.toFloat(ga); ...
c3f05ca0-63be-4753-8f78-50772d6b756b
0
public int getCurrentLineNumber() { return currentLineNumber; }
78bfdac9-c9a6-46a1-8a17-9b5fb2cbdd57
6
public static String numberToString(Number number) throws JSONException { if (number == null) { throw new JSONException("Null pointer"); } testValidity(number); // Shave off trailing zeros and decimal point, if possible. String string = number.toString(); if (string...
2881b9a4-71f2-4445-b9fa-fb0f64d622df
7
private void binOP(int idx) throws CompilationException { if (idx==9) unary(); else binOP(idx+1); int t; if (Debug.enabled) Debug.check((idx>=0)&&(idx<=9)); int v=(int)(idx<5?(0xA539CC68C652L>>>(idx*10)): (0x820820E6A928L>>>((idx-5)*10))); // m1= // ...
e0b653ae-6b58-4517-a757-e64287804ac2
8
public boolean passesTest(Instance inst) throws Exception { if (inst.isMissing(m_AttIndex)) return false; // missing values fail boolean isNominal = inst.attribute(m_AttIndex).isNominal(); double attribVal = inst.value(m_AttIndex); if (!m_Not) { if (isNominal) { if (((int) attribVal) != ...
34659e31-5945-4132-a172-c0bad44277cd
4
public static boolean areInOrder(Double a, Double b, Double c){ if(b > a && c > b) return true; if(b < a && c < b) return true; return false; }
d84406a0-8737-4086-ae78-ca97f8de37e4
2
private void clearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clearActionPerformed // TODO add your handling code here: //Cuando la pestaña de Nueva Variable desde cero está seleccionada: if (jTabbedPane1.getSelectedIndex() == 0) { name1.setText(""); ...
462bb815-f310-4bc3-bdd4-42d15fe7fe87
9
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = ""; StringBuilder out = new StringBuilder(); while ((line = in.readLine()) != null && line.length() != 0) { String[] words = line.trim().split("[ ]+"); char[]...
812be516-59e4-4b32-ad1c-e11356ff54d9
4
@Override public boolean include(Entry<? extends modelTable, ? extends Integer> entry) { Task task = (Task) TaskFactory.getInstance().get(entry.getIdentifier()); if (filter == null) { return task.getModelStatus().isEndUserStatus(); } else { ...
4835a9af-a63f-4285-8148-b292c632689e
2
public SimulatedPulseOx(SimulatedPatient patient, Spawner spawn, InitialJFrame app) { super("Simulated PulseOx"); this.patient = patient; application = app; spawner = spawn; title = new JLabel(" Simulated PulseOx"); title.setFont(new Font("Arial", Font.PLAIN, 38)); title.setForeground(Color.WHITE); ...
7d6403c4-c9b1-4f89-92cc-20470e95382a
1
public Control(int rId) { if (rId > 0) { // Settings zu beginn laden _settings = new MySqlDatabaseHelper().getSettings(rId); } }
d0990144-76f0-4e2b-ac00-979275f0005b
6
public List getMessByTime(String beginTme, String endTime,String rescueStatus) { String hql = ""; if(beginTme!=null&&!beginTme.trim().equals("")){ if(endTime!=null&&!endTime.trim().equals("")){ hql = "from Rescueapply r where r.applytime >=:beginTime and r.applytime <=:endTime" + rescueStatus; return thi...
f25c5f70-5e08-4b4c-a3a5-47cc0d94a6b5
3
public static Economy initEco(LegendPlugin self){ Plugin test = self.getServer().getPluginManager().getPlugin("Vault"); Economy eco; if(test != null && test instanceof Vault){ self.logger().info("Succesfully hooked to Vault !"); }else{ self.logger().info("Could not find Vault. Disabling..."); self.getP...
ea1dd344-1ea3-47ca-8116-8b6f2894225a
2
public boolean equals(Object ob) { if (super.equals(ob)) { Chocolate other = (Chocolate) ob; if (milky != other.milky) return false; } return true; }
141d579a-951f-4a57-bc39-a7685dfe0e42
1
public void testConstructor_Object5() throws Throwable { IntervalConverter oldConv = ConverterManager.getInstance().getIntervalConverter(""); IntervalConverter conv = new IntervalConverter() { public boolean isReadableInterval(Object object, Chronology chrono) { return false;...
870bafb1-b01b-4370-bf9d-92ec7349e92b
4
private boolean isRaceWon(int totalDistanceCovered){ boolean isRaceWon=false; if((Racer.winner==null)&&(totalDistanceCovered==100)){ String winnerName = Thread.currentThread().getName(); Racer.winner = winnerName; System.out.println("Winner is : "+Racer.winner); isRaceWon=true; }else if(Racer.w...
e4fa6178-7b86-4d07-912a-588105c3f424
0
public boolean getDown(){ return moveDown; }
e0681299-c9a4-46c6-adde-29edbae08d75
1
public final long getLong(int index) throws JSONException { Object o = get(index); return o instanceof Number ? ((Number)o).longValue() : (long)getDouble(index); }
c38d6d77-4249-4482-8d26-41a1127eea70
0
public void setStrength(double strength) { this.strength = strength; }
485a712a-c3ab-45b0-9b7d-01e88c76b282
6
public Object[][] rechercherEmplois(Region reg, Set<Competence> lesComps) { ArrayList<OffreAffiche> lesOfrAffiche = new ArrayList(); Object[][] resultat; OffreNoyauFonctionnel.printOutOffres(); ArrayList<Emploi> lstEmplois = OffreNoyauFonctionnel.getTblEmplois().get(reg.getRegn...
df2ae5af-5ae1-4e69-a4b0-f6be88a18e99
8
public boolean displayModesMatch(DisplayMode mode1, DisplayMode mode2) { if (mode1.getWidth() != mode2.getWidth() || mode1.getHeight() != mode2.getHeight()) { return false; } if (mode1.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI && mode2...
c0a391ed-d66b-48b6-85a3-85607dedce6e
5
public static void main(String[] args) { sf = HibernateUtil.getSessionFactory(); Session session = sf.openSession(); org.hibernate.Transaction tr = session.beginTransaction(); List<Employee> empList = new LinkedList<>(); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy...
ad935b42-1baa-4e8a-92e8-2c311f016363
3
public void clearFinal() { // Avoid concurrent modification exceptions. ArrayList list = new ArrayList(); list.addAll(configurationToButtonMap.values()); Iterator it = list.iterator(); while (it.hasNext()) { ConfigurationButton button = (ConfigurationButton) it.next(); if (button.state == Configuration...
eebd1372-d91d-49a6-995a-f67a69e553f4
5
public void addProperty(String property) { boolean excluded = property.startsWith("!"); if (excluded) { property = property.substring(1); } if (property.contains(".")) { String prefix = property.substring(0, property.indexOf('.')); String suffix = property.substring(prop...
cca9dd2b-3554-46a3-8975-f6dba3fb28c4
1
public static HashMap<String, Integer> sortByValue(HashMap<String, Integer> map) { List<Map.Entry<String, Integer>> list = new LinkedList<Map.Entry<String, Integer>>(map.entrySet()); Collections.sort(list, new Comparator<Map.Entry<String, Integer>>() { public int compare(Map.Entry<String, ...
97f0d80a-4426-478d-b737-3b672a9e8ca1
0
public Period getArrivalTime() { return this._arrivalTime; }
d102d50e-188b-4239-9b80-07f5ec2207a2
0
public boolean isChoked() { return this.choked; }
05ea039c-8d0b-425a-b8f4-f43c279b938e
0
public void setName(String value) { this._name = value; }
feea68e4-057d-4515-a1bd-65a1efbdf94b
2
public HttpRequest(String url, Map<String, String> params) { if (url == null) { throw new RuntimeException("Request URL cannot be null"); } this.url = url; if (params != null) { this.url += "?" + urlEncode(params); } }
e2834d66-66be-4bf1-b46a-23daddfef30c
0
@Override public void mouseEntered(MouseEvent e) { }
866e98ac-17be-453f-bfb3-15ff951d7b0a
1
public void setLeftUser(Integer[] leftUser) { this.leftUser = leftUser; for (Integer i : this.leftUser) { userIDtoMatchLoaded.remove(i); } }
56009d2e-a0f5-4e34-9f1e-9b20fdef19e3
3
public static boolean equateTokenList(List<Token> a, List<Token> b) { if(a.size()!=b.size()) return false; int i=0; for(Token t : b) { if(!t.equals(a.get(i))) { return false; } i++; } return true; }
c7669f75-1ec5-4098-a1e9-64aecb99c26b
8
public static NodeList addNumbers(Node head1, Node head2) { NodeList addition = new NodeList(); int carry = 0; while(head1 != null || head2 != null) { int result = carry + ((head1 != null) ? head1.data : 0) + ((head2 != null) ? head2.data : 0); carry = 0; if(result/10 == 1) carry = 1; addition.ins...
c4f43409-7955-497a-a6e7-04bde6315614
8
private void pickRandomDirection() { int rand = Game.random.nextInt(8); switch(rand) { case 0: d = Direction.NORTH; break; case 1: d = Direction.SOUTH; break; case 2: d = Direction.EAST; break; case 3: d = Direction.WEST; break; case 4: d = Direction.NORTHEAST; break; ca...
20f1f44f-f2ba-4d2f-910b-dec152c610d0
6
void decodeServiceStateData(OMMFilterEntry serviceFilterEntry) { OMMData serviceFilterEntryData = serviceFilterEntry.getData(); if (serviceFilterEntryData.getType() == OMMTypes.ELEMENT_LIST) { for (Iterator<?> eliter = ((OMMElementList)serviceFilterEntryData).iterator(); eliter ...
39c7aea6-bc03-4bbd-91ae-b6acc3053e32
7
private JSONWriter append(String string) throws JSONException { if (string == null) { throw new JSONException("Null pointer"); } if (this.mode == 'o' || this.mode == 'a') { try { if (this.comma && this.mode == 'a') { this.writer.write('...
73c171a2-9b2c-41e8-aa64-d1a9162ea469
8
public static void findMiniMax(int[] input){ int min = 0; int max = 0; if(input.length%2 ==0){ if(input[0] <= input[1]){ min = input[0]; max = input[1]; } else { min = input[0]; max = input[0]; } ...
332c855d-a0d6-4cfd-af97-f0ee7896117c
7
public Patient(Integer id){ if(id != null){ this.setId(id); String q = "SELECT patients.id," + "patients.last_name," + "patients.middle_name," + "patients.first_name," + "patients.age," + ...
f3d67246-6177-4d4d-a087-1970b521f316
8
public void buildClassifier(Instances data) throws Exception { // Make sure K value is in range if (m_KValue > data.numAttributes() - 1) m_KValue = data.numAttributes() - 1; if (m_KValue < 1) m_KValue = (int) Utils.log2(data.numAttributes()) + 1; // can classifier handle the data? getC...
f38dc145-8bac-4fb9-a2af-42f2d785261a
5
public void execute() { // List of new nodes with predecessors (as bfs state): nodes where we might still add a successor without going beyond the maxDistance. Queue<BFSState<N, E>> greyNodes = new LinkedList<BFSState<N, E>>(); // Set of nodes that have are certain to lie within the max distan...
1a407695-dc9f-409a-83ed-c3ca0c53f90a
2
public void visitInitStmt(final InitStmt stmt) { for (int i = 0; i < stmt.targets.length; i++) { if (stmt.targets[i] == from) { stmt.targets[i] = (LocalExpr) to; ((LocalExpr) to).setParent(stmt); return; } } stmt.visitChildren(this); }
0a730d61-3b05-4f95-bc1d-5ef1b5473651
6
@Override public void parse() throws IllegalArgumentException { try { setTimeStampFormat(TimeStampFormat.getTimeStampFormat(buffer[0])); } catch (IllegalArgumentException ex) { // ignore the bad value and set it to milliseconds so we can continue parsing the tag se...
4ea6729f-28fe-40ab-9985-659c791b6874
1
SocketCredentials ( int[] data ) { this.data = (byte) data[ 0 ]; if ( data.length == 4 ) { this.pid = data[ 1 ]; this.uid = data[ 2 ]; this.gid = data[ 3 ]; } else { this.pid = -1; this.uid = -1; this.gid = -1; ...
cfcd4a7c-879d-4680-9a60-e3de928ff36e
5
@Override public boolean pieceMovement(Point startPosition, Point endPosition) { Point difference = new Point(); difference.setLocation(endPosition.getX() - startPosition.getX(), endPosition.getY() - startPosition.getY()); if((Math.abs(difference.getX()) == 0 && Math.abs(difference.getY()) > 0) || (Math.a...
32888f33-6c17-4e19-8106-82ac14cb69d8
8
@Override public List<Apartamento> Buscar(Apartamento obj) { String consulta = "select ap from Apartamento ap"; String filtro = ""; HashMap<String, Object> parametros = new HashMap<String, Object>(); if (obj.getTipo()!= null) { if (filtro.length() > 0) { ...
babe1be2-5aab-43f6-a82f-b5e1dec6ddf9
1
public static void main(String[] args) { RealSubject realSubject = new RealSubject(); InvocationHandler handler = new ProxyDynamicSubject(realSubject); Class<?> classType = handler.getClass(); //下面代码一次性生产代理对象 Subject subject = (Subject) Proxy.newProxyInstance(classType.getClassLoader(), realSub...
1d44497b-b7bc-4f96-8e76-1192991e8d67
9
public void renderUpdate() { if(!wasHalf) MrVago.update(); contentPane.remove(panel); panel = new JPanel(); panel.setBackground(Color.WHITE); panel.setBounds(12, 12, 294, 305); contentPane.add(panel); panel.setLayout(null); contentPane.remove(panel_2); panel_2 = new JPanel(); panel_2.setBackg...
77a9eba2-7645-4543-80ad-cba370540342
7
private void validateFilePath(String filePath, String[] ext) throws IOException { try { //Creating a new file instance. File dir = new File(filePath); String targetImageFormat; boolean isSupportedImage = false; //Check if the specified file exists if (dir.exists()) { //Create an iterator f...
d4e12b2b-ae1e-4f3d-b102-fe72877414e1
3
public static List<Direction> get90DegreeDiretions(Direction d) { List<Direction> l = new ArrayList<>(); for (Direction e : Direction.values()) if (e.ordinal() != d.ordinal() && e.ordinal() != (d.ordinal() + 3) % 6) l.add(e); System.out.println(l); return l; }
5a80a342-46f5-4fab-8d93-4a4222e6060a
0
protected void reiniciar() { // TODO Auto-generated method stub textFieldName.setText(""); textFieldActivity.setText(""); comboBoxArea.setSelectedItem(CompanyType.Selecciona); formattedTextField.setText(""); formattedTextFieldRNC.setText(""); textFieldEmail.setText(""); formattedTextFieldFax.setText("")...
851a413a-ead6-4ddb-8eac-2947e8143540
4
private void okPressed(){ String singular = singularField.getText().trim().toLowerCase(); String plural = pluralField.getText().trim().toLowerCase(); if(singular.equals("")){ JOptionPane.showMessageDialog(dialog, "You need to supply a singular name for the ingredient.\n" + ...
537aed79-83bd-439c-816d-8244fe53f0f1
4
@Override public boolean isAllowedToBorrow(Loan loan, StockController stockController) { if (stockController.numberOfLoans(this) < 7) { if (loan.getQuantity() < 25) { if (CalendarController.differenceDate(loan.getStart(), loan.getEnd()) < 15) { ...
189024f6-8d39-4013-935f-a14027d5d775
5
public OptionGui() throws IOException { this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); this.setIconImage(new ImageUtil().getLogo()); //this.setLocationRelativeTo(null); setTitle(("Settings")); setBounds(100, 100, 506, 391); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(n...
453ad708-feb4-4bfe-b1a9-67edb184a3fe
5
@Override public void endElement(String uri, String localName, String qName) throws SAXException { String tipo = getTipo(); if(tipo.equals("getCPU")){//tag atual. Ex.: <host...> switch(qName){ //Cria um novo objeto token quando a tag eh encontrada case "name": docList.add(doc); break...
dd49fd79-b5cf-4b25-a1d7-0198ad44a53c
2
public void addWay(int pos, long wayId) { if (poligons.size() > pos && !ways.get(pos).contains(wayId)) ways.get(pos).add(wayId); }
c2f6d6ee-8c2b-4574-9d21-92f41922c3f7
6
@Override public void mouseClicked(MouseEvent e) { if (!follow && e.getButton() == MouseEvent.BUTTON1) { for (int i = -20; i <= 20; i++) { for (int i2 = -20; i2 <= 20; i2++) { final Tile t = Players.getLocal().getLocation().derive(i, i2); if (t.contains(e.getPoint())) { if (!t.equals(tile)) { ...
fc9522f3-434d-415a-a313-17e0a56a03ca
7
public WorldFillTask(Server theServer, Player player, String worldName, int fillDistance, int chunksPerRun, int tickFrequency) { this.server = theServer; this.notifyPlayer = player; this.fillDistance = fillDistance; this.tickFrequency = tickFrequency; this.chunksPerRun = chunksPerRun; this.world = server....
64bd5416-c16c-48b6-b0ac-72f22224387e
8
@EventHandler public void onPlayerInteract(PlayerInteractEvent event) { if (!event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) { return; } final SpoutPlayer player = SpoutManager.getPlayer(event.getPlayer()); if (SHIFT_HELD.containsKey(player.getUniqueId())) { if (!SHIFT_HELD.get(player.getUniqueId()))...
8c08d444-cb6b-47a1-a086-bc5f296e6a82
3
private void findGoalSprites(GameDescription game){ ArrayList<TerminationData> terminations = game.getTerminationConditions(); for(TerminationData td:terminations){ for(String sprite:td.sprites){ if(!goalSprites.contains(sprite)){ goalSprites.add(sprite); } } } }
9d0dd69c-7b1c-4c33-853a-a09b5343c4a4
3
public void compute() { if (hit || shooter == null) return; Battleground battleground = (Battleground)shooter.getArena(); Tanq target = battleground.getCollider(this); if (target != null) { hit = true; getBody().setAppliedForce(new Vector3D(0, 0, 0)); target.notifyInjury(getOwner()); getOwner().n...
9a06fa64-bbad-4be3-83e1-faf4583333e2
0
public void setCognome(String cognome) { this.cognome = cognome; }
7a42152c-0698-42df-baa2-0ccf27345cf4
8
public void setCurrentValues() { if (recent.isSelected()) { recent.doClick(); } else { bookmark.doClick(); } if (page.getSelectedText() != null) { int start = page.getSelectionStart(); int end = page.getSelectionEnd(); page.moveCaretPosition(end); page.requestFocusInWindow(); page.selec...
f704557c-c209-4372-8fae-369428a5fef7
7
private void addIgnore(long encodedName) { try { if (encodedName == 0L) { return; } if (ignoreCount >= 100) { pushMessage("Your ignore list is full. Max of 100 hit", 0, ""); return; } String s = TextUtil....
2a529c0b-5a2d-45d5-b50f-2992311f7a9a
8
public static void run_task_manager(File tasks) { System.out.println("System task manager is initialized ..."); Scanner scanner = new Scanner(new InputStreamReader(System.in)); TaskManager manager = new TaskManager(tasks); manager.runTask(); while(true) { if(manager.isDone(...
1afdd72e-3a2c-4e06-84b5-eea4f5f42f36
8
private boolean uhattuYlhaalta(int pelaajaNumero, int x, int y) { int i = 1; while(x-i >= 0 && kentta[x-i][y].onTyhja()) i++; if(x-i < 0) return false; if(kentta[x-i][y].getNappula().omistajanPelinumero() != pelaajaNumero) { if(i == 1 && kentta[x-i][y].getNa...
2ec682f7-b2be-4ca7-8547-1289634f637a
2
private void printNode(ITrieNode node, HashMap<Integer,Integer> frontier) { StringBuffer msg = new StringBuffer(String.valueOf(node.id)); msg.append(" ").append(node.value).append(" weight ").append(node.weight); msg.append("=>").append(node.getWeight(frontier)); System.out.println(msg.t...
d8c26fa6-51ae-436b-91e9-48cb6e4b5f31
7
public Book isAvailable(Book book, Connection con) { boolean hasToCreate = false; if (con == null) { try { con = DBConnection.getConnection(); hasToCreate = true; } catch (Exception e) { e.printStackTrace(); } } try { MasterBook masterbook = MasterBookDAL.findMasterBook( book.g...
0af1e1ef-d6fc-41f8-b0d6-53cf3649a347
1
@Override protected Class findClass(String name) throws ClassNotFoundException { synchronized (fileManager) { Output output = fileManager.map.remove(name); if (output != null) { byte[] array = output.toByteArray(); return defineClass(name, array, 0, ar...
44a5673f-f135-4522-8092-fe0d5f1f2ed5
4
protected static void manageInputCommandForServer(ServerInfo serverInfo) { BufferedReader commandReader = new BufferedReader(new InputStreamReader(System.in)); log.info("CREATE BufferedReader"); Thread chatServerThread = null; String commandLine = null; // manage server commands while (true) { System....
46336379-d011-457c-b007-44325b30742c
9
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request.getSession(); try{ Connection adaugareEvenimentConn = null; ResultSet adaugareEvenimentResult = null; Statement adaugareEvenimentStatement = null; ...
b8e56af6-6a89-449f-9dce-ec2854fda6fb
3
public static String excutePost(String targetURL, String urlParameters) { HttpsURLConnection connection = null; try { URL url = new URL(targetURL); connection = (HttpsURLConnection)url.openConnection(); connection.setRequestMethod("POST"); connection.setRequestProperty("Content-Typ...
7fd21242-0a5d-4c05-8fc1-84321c3508c1
4
public String distribute( String input ) { try { return (String) ( this.disMethod.invoke( this.distributor.newInstance(), input)); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStac...
580d2855-442b-4d23-9601-96ea27545b29
9
@Test public void test2() throws PersistitException { System.out.print("test2 "); final Exchange ex = _persistit.getExchange("persistit", "TransactionTest3", true); ex.clear().append("test2").remove(Key.GTEQ); final String[] expectedKeys = { "{\"test2\",\"a\",0}", "{\"test2\",\"a\",1...
4b944fb4-7f2c-4b30-bf8b-338c04efd8ea
7
public void run(){ if(lobbycount >= 1){ lobbycount--; game.setLobbyCount(lobbycount); for(CookieSlapPlayer cp : game.getPlayers().values()){ cp.getPlayer().setLevel(lobbycount); cp.getScoreboard().setScore("Starting in", game.getLobbyCount()); } ScoreboardUtils.get().setScoreAll(game, "...
8054f60d-99da-4e23-bdec-941c145cd55b
5
private String formatStateLabel(State state) { StringBuilder formatted = new StringBuilder(); if(direction.equals("TD") || direction.equals("DT")) { formatted.append('{'); } formatted.append(ensureTextIsValid(state.getName())); String description = state.getDescripti...
aa54266b-723d-4af6-b797-9eac9bce5b0d
2
public void test_08() { int nmerSize = 32; String seqStr[] = { "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" // , "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac" // Prepend 'c', append 'g' }; SuffixIndexerNmer<DnaSequence> seqIndex = new SuffixIndexerNmer<DnaSequence>(new DnaSubsequenceComparat...
a488650a-6915-4a27-b176-3092b95c7ac5
7
protected List<Object> getFeatureArrayFromMethods(Object o) { List<Object> features = new ArrayList<Object>(); Method[] methods = o.getClass().getMethods(); for(Method m : methods) { Annotation annotation = m.getAnnotation(NumericFeature.class); if(annotation == null) { annotation = m.getAnnotati...
7ce6e015-a6cc-4e12-9c46-2bf481effc30
6
public static void main(String[] args) throws IOException, FileNotFoundException{ long startTime = System.currentTimeMillis(); BufferedReader br = new BufferedReader(new FileReader("clustering_big.txt")); String line = br.readLine(); n = Integer.parseInt(line.split("(\\s)+")[0]); numBits = Integer.pars...
f4354496-49a4-4a23-946e-1b919213bd9f
6
public static void restart() throws IOException { try { // java binary String java = System.getProperty("java.home") + System.getProperty("file.separator") + "bin" + System.getProperty("file.separator") + "java"; // vm arguments List<String> vmArgumen...
afe37287-3cf9-421d-ba8b-c6fbf04f832a
1
public static TileLoader getInstance(){ if(instance == null){ instance = new TileLoader(); } return instance; }
0d0791fb-7eb6-4f56-b1a6-e2deb7b5d7d4
5
@Test public void numberOfFigureOnBoard() { HashSet<String> boards = new HashSet<>(); boards.add("nnnnnn\n" + "nnnnnn\n" + "nnnnnn\n" + "nnnnnn\n" + "nnnnnn\n" + "nnnnnn\n"); HashMap<String, Integ...
4a12bf89-098a-4457-81ad-4e89fabd55e3
2
public long ipToLong(byte[] address) { if (address.length != 4) { throw new IllegalArgumentException("byte array must be of length 4"); } long ipNum = 0; long multiplier = 1; for (int i = 3; i >= 0; i--) { int byteVal = (address[i] + 256) % 256; ...
8021f706-b908-4d28-8ac1-23d35740cb2d
8
public boolean isAncestor(mxGraphHierarchyNode otherNode) { // Firstly, the hash code of this node needs to be shorter than the // other node if (otherNode != null && hashCode != null && otherNode.hashCode != null && hashCode.length < otherNode.hashCode.length) { if (hashCode == otherNode.hashCode) {...
56e6ca24-d3db-447a-a50f-488ec9be2ef5
8
public double[] randomRehearsalSerialLearning(double[][] baseinputs, double[][] baseoutputs, double[][] serialinputs, double[][] serialoutputs, double maxerror, int bufferSize) { Random r = new Random(); double[] outputs = new double[serialinputs.length + 1]; double error = maxerror + 1; int counter = 0; ...
1178f4de-c4f3-48cd-bfb1-ed76c55c2e43
3
@SuppressWarnings("static-access") @Override public void mousePressed(MouseEvent e) { if(e.getButton() == e.BUTTON1){ Buttons1 button = (Buttons1)e.getSource(); button.pressed(1); } else if(e.getButton() == e.BUTTON2){ Buttons1 button = (Buttons1)e.getSource(); button.pressed(2); } else if(e.getButt...