method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
d4c166da-a165-4bfe-a1ea-a0f7d722c795
1
public static void main(String[] args) { Scanner in = new Scanner(System.in); int num1 = Integer.parseInt(in.next()); double num2 = Integer.parseInt(in.next()); if (num2 == 0) { System.out.println("Error: divide by zero!"); System.exit(0); } System...
29f3db99-3194-4f07-8b86-a7e18f8d4fe1
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); ...
0e513c95-d2ee-49fd-8df4-4e03df69c8b6
8
public static void main(String[] args) { Connection conn = null; Statement stat= null; ResultSet resultSet= null; try{ /* 1.注册数据库驱动, 不同的数据库要导入不同的驱动jar包。Driver就是这个包中的类。*/ /*---这种方式有两个不好的地方: * 1)查看Driver的源码,我们会发现在 new Driver()的时候,其实已经注册了一次驱动了。这样就造成注册了两次驱动。 * 2)这样写,让程序导入了com.mysql.jdbc.Driv...
3321d112-990a-4a35-9748-78e9b5e48d8b
7
public boolean read(InputStream in) throws IOException { _bytes=0; _pos=0; // read header do { int l=in.read(_buf,_bytes,__HDR_SIZE-_bytes); if (l<0) return false; _bytes+=l; } while (_bytes<__HDR_SIZE); ...
fbe15230-0f77-416c-97f5-d1e0fa04f80c
4
public void navigate(NavigationEvent event) { System.out.println("Navegar para: " + event.getDestination()); String dest = event.getDestination(); Tela tela = null; if(dest.equals("TelaLogin")){ tela = navegarTelaLogin(); } else if(dest.equal...
399c33f3-1fb2-42fc-8265-5f2aab365ddc
3
public static String read_String(String filename) { String out = " "; try { FileReader file = new FileReader(filename); BufferedReader in = new BufferedReader(file); String Zeile; while ((Zeile = in.readLine()) != null) { out = out + Zeile; } // in.close(); } catch (FileNotFoundException e)...
d289062f-71ef-4496-8668-9fbc6f8dd673
0
public Node getNode(int i) { return nodes.get(i); }
02791bbe-37ae-411f-a794-751231ca024c
9
private void createFileMenuBar(Stage primaryStage) { MenuItem load = new MenuItem("Load Expression"); MenuItem saveExpression = new MenuItem("Save Expression"); MenuItem saveTable = new MenuItem("Save LaTeX Table"); MenuItem reset = new MenuItem("Reset Fields"); MenuItem exit = new MenuItem("Exit"); fileM...
1269a1a6-f6c0-467b-915b-12b22add94c4
6
public Location getNewLocation(World world){ Location location_new = world.getSpawnLocation(); World eyeWorld = world; String worldName = world.getName(); for (String worldN : plugin.mainWorlds){ if (worldName.startsWith(worldN + "_")){ //World is a copy world eyeWorld = plugin.mainWorldsWorlds...
ad370c59-6be4-4280-abc3-5c08b7ca5bb1
3
@Override public void actionPerformed(ActionEvent e) { OutlinerDocument doc = (OutlinerDocument) Outliner.documents.getMostRecentDocumentTouched(); OutlinerCellRendererImpl textArea = doc.panel.layout.getUIComponent(doc.tree.getEditingNode()); if (textArea == null) { return; } Node node = textArea.n...
15e94ad1-7caa-475d-b792-e08acac64bcd
2
public boolean encryptSerializedKey(String password, String keyFilename, String keyFilenameEncrypted) { try { File f = new File(keyFilename); File fe = new File(keyFilenameEncrypted); f.createNewFile(); fe.createNewFile(); FileInputStream fis = new FileInputStream(keyFilename); FileOutputStream...
3d220053-07ac-4f67-9930-c36a48d988cd
7
public static void main(String[] args) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int[] a = new int[n]; int[] b = new int[n]; for(int i=0; i<n; i++){ StringTokenizer st = new Str...
809ad4e5-19f1-42c3-895d-76ff71fb9c5e
8
private static void checkWithOIDS(final PrintWriter writer, final PgTable oldTable, final PgTable newTable, final SearchPathHelper searchPathHelper) { if (oldTable.getWith() == null && newTable.getWith() == null || oldTable.getWith() != null && oldTable.ge...
35244718-b55e-44bb-86c2-3b55157ef811
8
private boolean jj_3R_69() { Token xsp; xsp = jj_scanpos; if (jj_3_41()) { jj_scanpos = xsp; if (jj_3_42()) { jj_scanpos = xsp; if (jj_3_43()) { jj_scanpos = xsp; if (jj_3_44()) { jj_scanpos = xsp; if (jj_3_45()) { jj_scanpos = xsp; if (jj_3_46()) { jj_scanpos = x...
af43ea06-d221-4015-8069-c9ae27e9b537
8
public void testErrors(){ boolean fail1 = true;//heap findMin boolean fail2 = true;//heap deleteMin boolean fail3 = true;//bst findMin boolean fail4 = true;//bst deleteMin try{ heap.findMin(); }catch(NoSuchElementException e){ fail1 = false; } try{ heap.deleteMin(); }catch(NoSuchElementEx...
1d8a586b-888f-4448-97f0-0c256707c104
6
public static Direction parse(String str){ return str.equalsIgnoreCase("north") ? Direction.NORTH : str.equalsIgnoreCase("east") ? Direction.EAST : str.equalsIgnoreCase("south") ? Direction.SOUTH : str.equalsIgnoreCase("west") ? Direction.WEST ...
5048f35d-1a25-4a00-9c9e-87d518608ec3
6
protected void createSubbands() { int i; if (mode == Frame.SINGLE_CHANNEL) for (i = 0; i < num_subbands; ++i) subbands[i] = new SubbandLayer2(i); else if (mode == Frame.JOINT_STEREO) { for (i = 0; i < header.intensity_stereo_bound(); ++i) subbands[i] = new SubbandLayer2Ste...
2c799d1f-7313-4892-a874-0640bebe055b
9
void load(String mundo) { int px = 0, py = 0, pdir = 0; try { String[] partes; partes = mundo.split("/"); px = Integer.valueOf(partes[1].split(";")[0]); py = Integer.valueOf(partes[1].split(";")[1]); pdir = Integer.valueOf(partes[1].split(";")[...
c47458a5-6e5b-432a-a212-7d092fcfe232
9
int insertKeyRehash(char val, int index, int hash, byte state) { // compute the double hash final int length = _set.length; int probe = 1 + (hash % (length - 2)); final int loopIndex = index; int firstRemoved = -1; /** * Look u...
ed8bea35-149b-42a1-aa98-05f2215c40b4
9
public void startModel() { if(!entities.isEmpty()){ return; } BufferedReader br; try { br = new BufferedReader(new InputStreamReader(new FileInputStream(getClass().getClassLoader().getResource("entities.txt").getFile()),"UTF-8")); String line; line = br.readLine(); while(line != null) { try {...
374821fc-5242-4f88-81f1-baab5fe17253
6
private void initMap(LayeredMap map) { for(int y=0; y<map.getHeight(); y++) { for(int x=0; x<map.getWidth(); x++) { // random grass if(Math.random() < 0.5) { map.set(LayerCodes.GROUND, x, y, FeatureCodes.GROUND + ColorCodes.GREEN); ...
6770a45d-04f0-4202-ac0a-5b025f1c0c30
8
@Override public DateTime convertControlValueToControlComparable(Object aValue) { if ( aValue instanceof DateTime ) { return (DateTime) aValue; } else if ( aValue instanceof XMLGregorianCalendar ) { return convertXMLGregorianCalendarToDateTime( (XMLGregorianCalendar) aValue, getTimezone() ); } els...
7f788fa3-485a-4d0e-8084-f30ba09d8d5b
2
private boolean insertSpecificValues(String table, List<String> columns, List<String> values) throws SQLException { StringBuilder query = new StringBuilder(128); query.append("INSERT INTO ").append(table).append(" ("); StringBuilder columnsStringBuilder = new StringBuilder(64); StringBuilder paramet...
18beb4b2-640d-4121-8f3d-9f4c6ed72a34
4
public static void saveAsOutlinerDocument(OutlinerDocument document, FileProtocol protocol) { // grab the current doc info DocumentInfo currentDocInfo = document.getDocumentInfo() ; // clone it DocumentInfo cloneDocInfo = null; try { cloneDocInfo = (DocumentInfo) currentDocInfo.clone(); } catch (Clone...
6a182017-c1b9-42a4-8e0b-2d8d6ad31306
3
public void loadSolutionFile() { // Load the file // Create a file chooser JFileChooser fc = new JFileChooser(basePath + player + "/" + FOLDER_SOLUTIONS); FileNameExtensionFilter sokfilter = new FileNameExtensionFilter( "Sokoban solution files (*.sol)", "sol"); // set the filter to only allow sol fil...
f283bc42-0693-47be-8aea-0e809b46bea0
2
public void setOrderList() { listModel.clear(); for (Order order : driver.getOrderDB().getSupplyOrderList()) { if(order.isStatus()) listModel.addElement(textAlignment(""+order.getId(), "" + order.getDateString(), "" +order.getPerson().getName(), "" +order.getCurrentlyLoggedInStaff().getName()...
94c83456-530c-4c57-a826-c4fa6aeceb20
8
private final void method2591(byte[] is, int[] is_11_, int[] is_12_, int i, int i_13_, int i_14_, int i_15_, int i_16_, int i_17_) { int i_18_ = -(i_14_ >> 2); i_14_ = -(i_14_ & 0x3); boolean bool = false; for (int i_19_ = -i_15_; i_19_ < 0; i_19_++) { for (int i_20_ = i_18_; i_20_ < 0; i_20_++) { ...
84986b90-d7af-41ab-b8a3-37b43bc21223
9
protected void paintEdge(Graphics g) { g.setColor(getForeground()); if (lineWidth > 0) { Graphics2D g2 = (Graphics2D) g; int c = BasicStroke.CAP_BUTT; int j = BasicStroke.JOIN_MITER; g2.setStroke(new BasicStroke(lineWidth, c, j)); if (gradientColor != null && !preview) { g2.setPaint(new Gradient...
b864ec7b-0f42-423b-b1e2-5bba35df338f
9
@Override public void actionPerformed(ActionEvent e) { try { JComboBox cb = (JComboBox) e.getSource(); String tri = (String) cb.getSelectedItem(); List<Serie> series = null; Fenetre fenetre = (Fenetre) cb.getTopLevelAncestor(); JPanel ...
8ba79995-e5d5-4fa4-a2a5-b1658ca29c59
7
@Override public int print(Graphics g, PageFormat pageFormat, int pageIndex) throws PrinterException { if (tripsOfDay.size() == 0) return NO_SUCH_PAGE; Font oldFont = g.getFont(); g.setFont(MainWindow.setupData.getPrintElementSetupList().getPrintElementSetup (PrintElementSetupList.FONT_SUMMARY_SH...
269c650f-9e35-4063-8caa-f003ed29ac7d
8
private void updateLookAndFeel() { // set Look&Feel String lookAndFeel = ""; try { setPropertyByParameter("lookandfeel"); lookAndFeel = userProps.getProperty("lookandfeel"); if (lookAndFeel.equals("windows")) { UIManager ...
5f634693-9267-499e-8509-391a88cf0f90
3
public static void quadraticProbing() { System.out.println("START OF QUADRATIC PROBING"); statsQuadratic = new ArrayList<Stats>(); for (int i = 100; i <= 10000; i += 100) { for (int j = 0; j < 50; j++) { List<Integer> list = MakeList.makePermutation(i); ...
36672b90-71ef-41ec-bcca-3a689d01808e
7
@Override public Object getValueAt(int rowIndex, int columnIndex) { ProduktDTO produkt = produktList.get(rowIndex); Object value = null; switch (columnIndex) { case 0: value = produkt.getProduktId(); break; case 1: value = produkt.getProduktNavn(); break; case 2: value = produkt.getFareNivea...
44942192-e2c8-41c5-88de-adad64d9cbbf
2
public static Long stoLong(String str){ Long i= null; if(str!=null){ try{ i = Long.parseLong(str.trim()); }catch(Exception e){ i = null; } }else{ i = null; } return i; }
9aac16f8-de4f-4644-9a0a-7b190a1c30da
0
public Match(IBomber[] bombers, File mapFile, int pointsPerTreasure, int pointsLostForDying, int dyingCooldown, int bombTimerDice, int bombTimerSides, int bombForce, int turns, double treasureChance, int port) { this.bombers = bombers; this.mapFile = mapFile; ...
5aab13f0-bc12-4736-b74b-aac1493a8a86
7
private static List<String> DoProcess(List<String> initials, List<HashMap<String, List<String>>> list) { if (initials.size() + list.size() != 6) { System.out.println("Problem!"); } if (list.isEmpty()) { if (initials.get(0).substring(0, 2).equals(initials.get(initials.siz...
fa2e4599-cad2-4a4e-88b4-8ad918f11894
6
private void placePiece(Command command) { Piece piece = null; String pieceType = command.getPiece(); String pieceColor = command.getPossiblePieceColor(); String pieceCode = command.getPossiblePieceCode(); String colorCode = command.getPossibleColorCode(); if (pieceType...
982848c0-cba2-49ce-aaba-5a5b5c16fe29
2
protected Object reportUnhandledCfaslOpcode(int cfaslOpcode) { String errorMessage; if (cfaslOpcode == -1) { throw new CfaslInputStreamClosedException("Cfasl connection closed by peer because of bad opcode: " + cfaslOpcode); } else { errorMessage = "Unknown cfasl opcode: " + cfaslOpcode; } ...
35af7d7f-bd8c-47d6-8485-21009ca21afb
4
public static void copyDir(File source, File target) throws IOException { if(source.isDirectory()) { if(!target.exists()) { target.mkdir(); } String files[] = source.list(); for (String file : files) { File srcFile = new File(source, file); File destFile = new...
cc1be554-b8ff-4cec-b7f5-8628dd9e2c15
8
private boolean isSafeToStandAt(int par1, int par2, int par3, int par4, int par5, int par6, Vec3D par7Vec3D, double par8, double par10) { int var12 = par1 - par4 / 2; int var13 = par3 - par6 / 2; if (!this.isPositionClear(var12, par2, var13, par4, par5, par6, par7Vec3D, par8, par10)) ...
b5f6df9b-056c-4a59-84eb-1aeb5f4e73f8
9
static void lsp_to_curve(float[] curve, int[] map, int n, int ln, float[] lsp, int m, float amp, float ampoffset){ int i; float wdel=M_PI/ln; for(i=0; i<m; i++) lsp[i]=Lookup.coslook(lsp[i]); int m2=(m/2)*2; i=0; while(i<n){ int k=map[i]; float p=.7071067812f; floa...
f9631c67-bfed-4be1-b79d-81f1188b81ac
7
protected static String fixReadableContent(String text) { while(text.startsWith("%0D")) text=text.substring(3); if((text.toUpperCase().trim().startsWith("IT SAYS `")) ||(text.toUpperCase().trim().startsWith("IT SAYS '"))) { text=text.trim().substring(9).trim(); if((text.endsWith("'"))||(text.endsWith(...
5f433d3d-4e2a-4ada-a39f-00b5eff68250
6
public UnixTimeSuperInterval(List<UnixTimeInterval> intervals) { if(intervals.size() > 0) { SortedSet<Long> startDates = new TreeSet<Long>(); SortedSet<Long> endDates = new TreeSet<Long>(); for(UnixTimeInterval interval : intervals) { if(interval.getStart() != null) { startDates.add(interval.getStar...
b70378e1-b238-4709-8ab1-4489a6403538
3
public static byte[] gzip(String input) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); GZIPOutputStream gzos = null; try { gzos = new GZIPOutputStream(baos); gzos.write(input.getBytes("UTF-8")); } catch (IOException e) { e.printStackTrace...
ad33fda1-fcc0-49a2-8f0d-9b7d4b0bf210
3
private void doUpdateJHS(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String jhsId = StringUtil.toString(request.getParameter("jhsId")); if(!StringUtil.isEmpty(jhsId)) { ObjectMapper mapper = new ObjectMapper(); Map result = ne...
b692d88d-c303-41c1-a895-ec1610363c22
8
public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals("Scholar Added") || e.getActionCommand().equals("Scholar Removed")) { populateScholarJList(); populateSerialJList(); populatePaperJList(); } else if(e.getActionCommand().equals("Journal Added") || e.getActionCommand().equals...
a1dcc9b1-110c-464b-9b8d-7d3bf1cf5280
0
public int getRequestStatus() { return this.requestStatus; }
5abd1f66-9a9c-4cd8-932d-59cfe80d0a7a
2
private boolean isTwoCardBadugi() { if (isColour() || isStreet()) { return false; } else { return true; } }
990067d5-491d-44e7-aa66-9785710effc0
0
public static String createChatMessage(String myName, String msg) { JSONObject jsonMsg = new JSONObject() .element( "code", "3" ) .element( "name", myName ) .element( "text", msg ) ; return jsonMsg.toString(); }
c512411a-c385-4126-bbdc-3c0f21462a76
6
public Stages(String localConfig, LocalResolver resolver) throws StagingException { this.resolver = resolver; if (resolver.getURLStreamHandlerFactory() != null) { try { URL.setURLStreamHandlerFactory(resolver .getURLStreamHandlerFactory()); } catch (SecurityException ignored) { } catch (Error ...
77c7541c-a686-473b-8013-1ae18ced1f6e
6
public void update(Player player) { // 重力で下向きに加速度がかかる vy += Map.GRAVITY; // x方向の当たり判定 // 移動先座標を求める double newX = x + vx; // 移動先座標で衝突するタイルの位置を取得 // x方向だけ考えるのでy座標は変化しないと仮定 Point tile = map.getTileCollision(this, newX, y); if (tile == null) { ...
a0372382-05ed-4734-97c3-051ee12517fd
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; AvaliacaoFisica other = (AvaliacaoFisica) obj; if (idAvaliacaoFisica == null) { if (other.idAvaliacaoFisica != null) return false; } els...
38a689d9-1174-42a3-baa8-e5e18f0abac8
8
public T_RES match(final RouteTreeNode<T_REQ, T_RES> rootNode, T_REQ req) { List<String> pathSegments = req.getPathSegments(); RouteTreeNode<T_REQ, T_RES> targetNode = rootNode; RouteMatchResult routeMatchResult = new RouteMatchResult(); int i; for (i = 0; i < pathSegments.size(...
be1229cf-6ce1-4289-bdcf-48bcdaa3be62
4
public Location getAdjacentLocation(Direction direction) { int column = ((direction == Direction.WEST) ? getColumn() - 1: (direction == Direction.EAST) ? getColumn() + 1 : getColumn()); int row = ((direction == Direction.NORTH) ? getRow() - 1 : (direction == Direction.SOUTH) ? getRow() + 1 : getRow())...
cb9954af-a91b-4a72-b2c4-bd2abe486a79
0
public int getTotal() { return totalPaymentToDate; }
38e9b9bc-5a62-4b5d-9483-afa4a28d8772
5
public void updateTopCard() { if (cardPile.isEmpty()) { if (cardFacade != null) { this.setTextureID(TextureManager.getCardTextureID(cardFacade)); } else { this.setTextureID(TextureManager.getTextureID("circle_empty")); } ...
d46bfebb-4ad6-43f9-81cc-afe41dff4a09
9
private String parseInfoText() throws SAXException, InterruptedException { _xmlStream.pullStartElement(); final StringBuilder textBuffer = new StringBuilder(); while(true) { if(_xmlStream.matchIgnorableCharacters()) { String text = _xmlStream.pullIgnorableCharacters().getText(); text = Pattern.compil...
dde1ee7c-1f14-4507-b5ba-184dfb99c20d
4
public static int addConnectionThread(Thread con) { boolean added = false; int num = 0; for(int k = 0;k<=5;k++) { if(MainThread.connectionThreads[k] == null && added == false) { MainThread.connectionThreads[k] = con; added = true; } } if(added = false) { return 99; } return ...
7d873e31-f8c2-4300-8099-d2ca69ce81a8
0
protected Icon getIcon() { java.net.URL url = getClass().getResource("/ICON/redo.jpg"); return new javax.swing.ImageIcon(url); }
008c94ff-a044-40b9-a0ae-02b2dd28a94a
3
private static Integer getVersion(final String versionData) { String[] vArray = versionData.split("\\s"); int version = 1; if (vArray.length == 2 && vArray[0].equals("version") && vArray[1].matches("[0-9]+")) { Integer.parseInt(vArray[1]); } el...
01e44d36-4ebe-4951-b65e-b220f74a1488
9
public static ConnectionManager createConnectionManager(String name, Properties settings) throws BootException { try { int maxc = Integer.parseInt(settings.getProperty(name + ".maxcon")); int timow = Integer.parseInt(settings.getProperty(name + ".time_to_warning")); int timo...
9b2ce4ed-c054-447a-b051-357afa6489df
1
private static long fac(int n){ if(f[n] != 0) return f[n]; f[n] = n*fac(n-1); return f[n]; }
8fd5c144-93b9-4ea6-a17b-05c6f11f5557
2
public void draw(GOut g) { super.draw(g); btncave.visible = !folded && mm.isCave(); if(!folded) g.image(grip, sz.sub(gzsz)); }
6a4e0564-954d-430f-8ffb-8cacd1941993
2
public static String formatFolderPath(String realpath) { if (StringUtil.isEmpty(realpath)) return null; realpath = realpath.replace('\\', '/'); if (!realpath.endsWith("/")) realpath = realpath + "/"; return realpath; }
28db7315-c620-427f-922c-fbcdfdc1afcd
0
@Override public void changedMostRecentDocumentTouched(DocumentRepositoryEvent e) { calculateEnabledState(e.getDocument()); }
a89609fa-18b2-4fab-8959-b410c5bf8195
9
public static void main(final String[] args) throws SQLException, ClassNotFoundException, IOException { final boolean objetivo2 = isProcessEnabled(args, "2"); final boolean objetivo3 = isProcessEnabled(args, "3"); final boolean objetivo4 = isProcessEnabled(args, "4"); if (! (objetivo2 ||...
d57ce236-6a37-400c-bf33-70161a6aebc2
8
final public Unit Variable(FieldDetails fieldDetails) throws ParseException { VariableUnit variable; String variableName = null; binaryExpression_AST expr = null; variableName = ID(); if (MODE == 0) { variable = (VariableUnit)SYMBOL_TABLE.add(variableName, UnitType.VARIABLE); } else { ...
ac9221db-25ee-476d-be99-abe4244442f4
2
public void searchElement(Element root, String elementName, Vector vect){ for (int i=0; i < root.getChildren().size(); i++){ Element child = (Element)root.getChildren().get(i); if (child.getName().equals(elementName)){ vect.addElement(child); }else{ searchElement(child, elementName, vect); ...
7646fb6d-feac-4cf8-90b4-4bf31eeaa596
2
@Override public boolean equals(Object obj) { if (obj instanceof Enrolment) { Enrolment enrol = (Enrolment)obj; return enrol.enrolledClass == this.enrolledClass && enrol.enrolledStudent == this.enrolledStudent; } return false; }
aa30c373-c393-416f-98fe-85a594f1329e
1
public void writeToFile(String content) { try { stream.write(replaceScandinavians(content).getBytes()); } catch (IOException e) { System.out.println("Error: " + e.getMessage()); } }
a00aeecd-ceea-4ef3-a7bf-36619aeffac8
0
public int getLength() { return this.index; }
20320e44-1682-47d2-9f0e-5727ac115f49
8
public static OntClass getSensorClassUsingObservedPhysicalQuantity(String observedPhysicalQuantity){ OntClass observingSensorClass = null; Property propertyObserves = aceCore.getProperty(iriSSNObserves); OntClass sensorOntClass = aceCore.getOntologyClass(iriSSNSensor); boolean foundClass = false; for(Exten...
499b87c4-d997-4b00-beef-645ec8e3a5c1
7
public void run() { try (PrintWriter out = new PrintWriter(socket.getOutputStream(), true); BufferedReader in = new BufferedReader(new InputStreamReader( socket.getInputStream()));) { String inputLine, outputLine; CommandInterpreter ci = new CommandInterpreter(); if (ci.checkInitialStatus()) ...
6769a825-c6f2-41d1-9222-7536f4cca71f
2
private void calculateMisalignmentWeigth(Node n, Set<Node> doneNodes) { if (!doneNodes.contains(n)) { for (int i = 0; i < n.getOutgoingLinksNumber(); i++) { calculateMisalignmentWeigth(n.getOutgoingLink(i).getOut_node(), doneNodes); } } n.ajErrorHiddenNode...
e6ec0010-2efb-4409-b7c3-513dff1213ef
4
@SuppressWarnings("serial") public MyTable() { data = new Object[30][5]; for (int i = 0; i < 30; i++) { data[i][0] = new Boolean(false); data[i][1] = "Column " + i; data[i][2] = (Math.random() > 0.5) ? new ImageIcon( JTableRenderer.class.getResource(IMAGE_PATH + "preferences.gif")...
fc357fc6-0981-43a6-8a84-499178c5def0
1
public synchronized boolean makeProxyClass(Class clazz) throws CannotCompileException, NotFoundException { String classname = clazz.getName(); if (proxyClasses.get(classname) != null) return false; else { CtClass ctclazz = produceProxyClass(classPool.get(class...
74c43c51-3c52-4a98-a69d-3f31e29a991a
2
public static void main(String[] args) { final Count count = new Count(); for (int i = 0; i < 100; i++) { new Thread(new Runnable() { @Override public void run() { count.add(); } }).start(); } tr...
f3c30364-9262-4326-8a2b-cc728cecd330
1
private JPanel getJPanel2() { if (jPanel == null) { GridBagConstraints gridBagConstraints11 = new GridBagConstraints(); gridBagConstraints11.gridx = 0; gridBagConstraints11.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints11.gridheight = 1; gridBagConstraints11.anchor = GridBagConstraints.NORTHW...
a08dac93-5253-40cc-8918-2b0823d8ce25
2
public void jump(boolean forceJump) { if (onGround || forceJump) { onGround = false; setVelocityY(JUMP_SPEED); } }
0f692b03-becf-4458-8334-ce6a12f23513
9
void createHMlut(int [] kernel, int [] lut){ int i, j, match, toMatch; for(i=0;i<512;i++) lut[i]=1; toMatch=0; for(j=0;j<9;j++){ if (kernel[j]!=2) toMatch++; } //System.out.println("Debug: to match: "+toMatch); //make lut for(i=0;i<512;i++){ match=0; for(j=0;j<9;j++){ if (kernel[j]...
40e81a15-ecc0-411e-89a0-d7bdca8c42b6
0
public TallennuksenKasitelijaTest() { }
0778d4bc-6e6f-4977-90b8-42ed06d06acd
1
public synchronized void stageTwo() { try { //do your work here Thread.sleep(1); } catch (InterruptedException e) { e.printStackTrace(); } list2.add(random.nextInt(100)); }
9e913a23-d01d-41f1-90f7-f69b85a55691
4
public void addSkills(final Characters player, final Characters enemy) { skillOne = new JButton("Skill 1"); add(skillOne); skillOne.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { combatLog = combatLog + "\n" + player.attack(enemy); updateLog(com...
3593d19b-aee3-426b-acc8-1f3c02c67170
2
public static void sendBroadcast( String message ) { for ( ProxiedPlayer p : proxy.getPlayers() ) { for ( String line : message.split( "\n" ) ) { p.sendMessage( line ); } } LoggingManager.log( message ); }
aa43416e-f8b0-4a76-8673-a49f2ae7b74e
9
private void setDefaultParameterDataset(final ConfigurationDefaultParameter[] defaultParameters, final SystemObject systemObject) throws IOException, ConfigurationChangeException { final AttributeGroup attributeGroup = (AttributeGroup)getObject("atg.defaultParameterdatensätze"); final Data data; if(defaultPara...
4506e88a-5143-4070-81e5-572b3eb41812
6
public int write(final ResultSet rs) throws IOException, SQLException { final ResultSetMetaData md = rs.getMetaData(); final int colCount = md.getColumnCount(); // Create a JTableModel to hold the data; map 1-origin SQL row/col to/from 0-origin JTable row/col TableModel dataModel = new TableModel() { publ...
730b8ec7-a7c2-48e7-9b35-5b718b6d17a1
1
public void setShadowIntensity(int intensity) { if (intensity < 0) { this.shadowIntensity = SkinConstants.DEFVALUE_FONTSHADOW; } else { this.shadowIntensity = intensity; } somethingChanged(); }
480ce842-2e8d-488a-80c6-a8de1d992d21
0
public boolean isEmpty() { return first == null; }
a104b77b-932d-4d70-a4f0-8c5d0e088322
9
private static boolean upgradeDatabase() { Connection connection = null; PreparedStatement statement = null; ResultSet results = null; String stepMessage = "check database version!"; try { connection = DriverManager.getConnection(url, username, password); statement = connection.prepareStatement(GET_SETT...
70b0186f-147f-4a44-ac05-f6e79a4c2354
1
public <E> void createSignature(Passable<E> toSign) throws UnsupportedEncodingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, NoSuchAlgorithmException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutput out = null; try { out = new ObjectOutputStrea...
33fc5e3e-fde9-4fa7-9636-38a2e12a982d
0
public int E() { return E; }
84cec4a1-b33d-45cc-9803-0dd8bf3303d9
6
public static void main(String args[]){ //Creating a colour scheme to test the renderer with Colour[] colours = new Colour[5]; final int MAP_SIZE = 5; for (int i=0; i<MAP_SIZE; i++) { switch (i) { case 0: Colour black = new Colour("#000000"); colours[i] = b...
2bb0e490-ce3a-4418-83e9-6d9cb7a8c0f3
1
public double distance(Point otherPoint) { double dist = Math.sqrt(Math.pow((this.x - otherPoint.x), 2) + Math.pow((this.y - otherPoint.y), 2)); if (dist == Double.NaN) dist = 0; return dist; }
9ce8893d-723a-4c49-a2ed-5a59a2f8a23e
7
public void logData(File file, PSystem system) { final String warnOrError = system.getWarningOrError(); if (warnOrError == null) { return; } synchronized (logDataInitized) { if (logData == null && logDataInitized.get() == false) { final String s = GraphvizUtils.getenvLogData(); if (s != null) { ...
6edbd5a4-3da1-4ee0-b54f-1fcc9dbd9c7f
8
public static String getExcString(Exception e) { if (e instanceof ArrayIndexOutOfBoundsException) { //Sets dialogue String dialogue = "An error has occured; an array has been referenced at the index " + e.getMessage() + ", which does not" + " exist."; //Specific dialogue for negative indexes if (Inte...
49c97ae0-9db3-4035-b6e3-4bb92969d3d1
3
private static JCheckBox[] getScreenCheckBoxes(AIProject project, boolean isMainProject) { List<AIScreen> tempScreensList = project.getScreensList(); JCheckBox[] screenCheckBoxLabels = new JCheckBox[tempScreensList.size()]; for (int i = 0; i < tempScreensList.size(); i++) { String tempScreenName = te...
73bd7af7-39c0-4854-b07f-4d5cca4567e9
2
private void initialConfigCheck(){ getConfig().options().copyDefaults(true); if(!(new File(this.getDataFolder(),"config.yml").exists())){ this.logMessage("Saving default configuration file."); this.saveDefaultConfig(); }else{ try { getConfig().save(new File(getDataFolder(),"config.yml")); } catch ...
bff8f887-1c20-49d1-ba80-5be4773d95d5
2
public static void main(String args[]){ long start = System.currentTimeMillis(); Scanner inputStream = null; try{ inputStream = new Scanner(new FileInputStream("myIntegers.txt")); } catch(FileNotFoundException e){ System.out.println("File test.txt was not found"); System.out.println...
31734365-265e-4030-a435-07ac3c2d5875
2
public void printEigenEnergy(int number) { double[] ee = getEigenEnergy(); if (ee.length == 0) { System.out.println("No eigen states found :-("); return; } int count = Math.min(number, ee.length); for (int i = 0; i < count; i++) { System.out.pr...
dd3f228e-7534-43c8-bb8f-25a0c61365be
7
public void removeMax() { if(count == 1) { queue[1] = null; return; } queue[1] = queue[count -1]; queue[count -1] = null; count--; int index = 1; while((index*2 < count) && (queue[index].compareTo(queue[index*2]) < 0 || queue[index].compareTo(queue[index*2+1]) < 0)) { if(queue[index*2] !...