method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
cf119336-54de-44ae-a967-7b388d320e4a
1
public void visit_aastore(final Instruction inst) { stackHeight -= 3; if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } }
246382b1-5c8f-4896-815a-315e3b714706
4
void print(Node t, int n, boolean p) { if (n > 0) { for (int i = 0; i < n; i++) System.out.print(" "); } if (p) { if (t.getCar() != null) { t.getCar().print(n, true); } } else System.out...
6aa78c04-b85c-4303-894f-811a768c7b08
9
private static boolean comparerTabProduitsIdFourn (Produit[] tab, int[] tabTest, int n) { boolean pareil = true; int i = 0; try { if (tab == null && tabTest == null) { pareil = true; } else if (tab != null && tabTest != null && ...
e70bd0df-bc0e-442b-b2a7-67af02ba153f
4
@Override public SingleObject create() { where+=xvel; xvel+=rand.nextBoolean()?3:-3; xvel*=Math.abs(xvel)>10?0.8:2; xvel*=0<where && where<stage.getWidth()?1:-1; return new TornadoPart(where,stage.getHeight()-90,rand.nextInt(8)); }
a15a9669-f018-4785-bd1f-eb2b9ad24465
0
public AgentIO(SmallWorld smallWorld, MenuItem importMenuItem, MenuItem saveMenuItem) { this.smallWorld = smallWorld; this.importMenuItem = importMenuItem; this.saveMenuItem = saveMenuItem; }
920d8771-adb5-4a6a-a95d-0825d99b8e86
9
public boolean equals(Animation animation) { if(!name.equals(animation.getName())) return false; if(duration != animation.getDuration()) return false; if(hasSubAnimations()) if(subAnimations.size() != animation.getSubAnimations().size()) return false; else { for(int i=0; i<subAnimations.si...
b660bbab-32f7-4ae4-ba57-dfdaf8b3dc87
2
@Override public Cluster[] getClusters() { if (result == null || result.isEmpty()) { return null; } return result.toArray(new Cluster[0]); }
0e640882-1a5f-4915-97cd-5dc8581f7898
3
@EventHandler(ignoreCancelled = true) public void explode(EntityExplodeEvent eee) { Iterator<Block> iterator = eee.blockList().iterator(); while (iterator.hasNext()) { Block block = iterator.next(); try { if (explodeReinforcement(block)) { block....
6655a1cb-29da-460e-b645-e636cd0b86a3
2
public static void main(String[] args){ int count=0; for(int i=1;i<1e4;i++){ if(isLychrel(i)){ count++; } } System.out.println(count); }
d1cfe384-b4d6-4075-b302-1bec9eee3b2a
0
public int getY() { return y; }
3baf1f23-1256-4d31-89ce-ecde48348568
0
@Override public void setExecutionControl(ITesterExecutionControl executionControl) { this.executionControl = executionControl; }
b07c3afe-7d8d-436f-8cb5-0a6f62c7c2bb
1
public static OpponentCache getInstance(String scope) { if (cache.containsKey(scope)) { return cache.get(scope); } OpponentCache instance = new OpponentCache(); cache.put(scope, instance); return instance; }
372557ac-8af0-4910-87b8-1478bf21a600
4
public void actionPerformed(ActionEvent ae) { // your code here String string = ae.getActionCommand(); try { if(string.equals("Add")) processAdding(); if(string.equals("Delete")) processDeletion(); //if(string.equals("View Attendances") if(st...
7ec6af48-a4de-41d6-a478-3916652707c7
7
public StringBuffer printStatement(int indent, StringBuffer output) { printIndent(indent, output); if (qualification != null) qualification.printExpression(0, output).append('.'); if (typeArguments != null) { output.append('<'); int max = typeArguments.length - 1; for (int j = 0; j < max; j++) { typ...
9b4abe3b-e746-40a6-bcbe-4f0670c97fe2
4
public void close(){ try{ if(in!=null)in.close(); if(out!=null)out.close(); if(socket!=null)socket.close(); } catch(Exception e){ } in=null; out=null; socket=null; }
ea49bf11-20d8-4705-88ff-6f3860441a9a
4
public static void scaleImageTo256kb(Path img) throws IOException { File imgFile = img.toFile(); if (imgFile.length() <= BYTE) { return; } File newFile = Constants.PROGRAM_TMP_PATH.resolve(img.getFileName()).toFile(); BufferedImage i = ImageIO.read(imgFile); ...
0e9dd35e-8c12-4681-94ab-7898f28a32c8
6
public void paintComponent(Graphics g, DragAndDropClassObject classOne, DragAndDropClassObject classTwo){ Vector<Point> pointsOne = new Vector<Point>(); Vector<Point> pointsTwo = new Vector<Point>(); Vector<DragAndDropClassObject> ddClasses = new Vector<DragAndDropClassObject>(); ddClasses.add(class...
3ff3183d-934c-4641-baf4-3c673844279f
9
private void winner(Player player, Hand hand, int playerScore, int dealerScore) { if (dealerScore > 21 && playerScore <= 21) { this.output.println("Player Wins! Collect " + hand.getBet()); player.deposit(hand.getBet()); } else if (playerScore > 21 && dealerScore <= 21) { this.output.println("Player Loses....
8cb96850-b3a4-49b1-839d-08f73e8f8f8f
9
final Class133 method343(int ai[][], boolean flag, int i, int j, Class27_Sub1 class27Sub1, int k, int l, int i1, int j1, int k1, int ai1[][], int l1, Animation animation, int i2) { long l2; if (anIntArray574 != null) { l2 = ((k << 3) + (id << 10)) - -l1; } else { l2 = l1 ...
a97c0e95-b777-4ba2-a1ca-1b1c796e1574
1
public void display(){ System.out.println("rectID : "+rectID); System.out.println("rectName : "+rectName); System.out.println("linkedvideoname : "+linkedVideoName); System.out.println("linkedVideoStartFrame : "+linkedVideoStartFrame); System.out.println("numofkeyframes : "+numOfK...
d5601ef1-0b19-46e5-af2a-37af7a74d226
4
public static double readCorpus(Trie dictTrie,String filepath, HashSet<String> wrongWords ) throws IOException { BufferedReader reader; reader = new BufferedReader((new FileReader(filepath))); StringTokenizer lineTokenizer; String line; ...
3ef6f404-cd53-4cc5-bab1-17d8612d7f50
7
private int expandMinNode(int depth, int prevAlpha) { // if cutoff test is satisfied if (board.isGameOver() || depth == 0) return board.getBoardStats().getStrength(maxPlayer); Move[] moves = board.getPossibleMoves(minPlayer); int beta = MAX_POSSIBLE_STRENGTH; ...
7fa22441-4699-405c-a42b-5e3cfd063ac8
4
private void refresh(Font f){ image = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB); if(f == null){ f = image.getGraphics().getFont(); } fontMetrics = image.getGraphics().getFontMetrics(f); int height = fontMetrics.getHeight(); int width = fontMetrics.stringWidth(text); if(width == 0){...
3a22f4df-728e-4312-80bb-cd4db8d8ce2e
3
@Override public void deserialize(Buffer buf) { fightId = buf.readInt(); if (fightId < 0) throw new RuntimeException("Forbidden value on fightId = " + fightId + ", it doesn't respect the following condition : fightId < 0"); sourceId = buf.readInt(); if (sourceId < 0) ...
c800bcdb-fd54-40fc-a71b-1c265efad1bd
8
@Override public Component getComponentByID(int id) { Connection conn = null; PreparedStatement st = null; Component component = null; ResultSet row = null; try { conn = OracleDAOFactory.createConnection(); st = conn.prepareStatement(GET_COMPONENT_BY_ID); st.setInt(1,id); row = st.executeQuery();...
a086b576-1660-4e7d-834b-d9ae2dc5a9f5
6
public void cargarArbol() { //inicializo el arbol inicializarArbol(); //cargo las cuentas hijo r_con.Connection(); int count = 0; int aux = 0; Enumeration e = root1.breadthFirstEnumeration(); while (e.hasMoreElements()) { parent1 = (De...
94a783c4-095d-4105-a105-65b91bfbd9d0
1
public String getMovieName() { try { return em.createNamedQuery("Movie.findById", Movie.class) .setParameter("id", movieId) .getSingleResult() .getName(); } catch (NoResultException e) { return ""; } }
8ab948df-4318-4d55-8856-903d0e8f6003
9
public void plotZCoordinatesele (Graphics2D g2) { g2.setFont(new Font("Arial", 20, 12)); DecimalFormat f = new DecimalFormat("0.#"); int yInterval=50; float points = maxY / 4; for (int x = yInterval, j = 1; x < 250; x+=yInterval){ if(j>3) break; g2.drawString("-", 146-diff, 100 + x + 24); g2.dra...
4b87446d-abf5-45b5-a5f5-72dc7ae76834
0
public String getToolTip() { return "Attribute Editor"; }
658282ef-7430-411c-bdad-c921d677dc43
6
public void shutdownOutput (final SocketChannel sc, final Callback.TCPClient cb) { if ( !sc.isConnected() || !sc.isOpen() || sc.socket().isClosed() || sc.socket().isOutputShutdown()) {return;} if (this.isLoopThread()) { try { sc.socket().shutdownOutput();...
54d226ae-847e-45a4-8c7e-e69e9c9416d9
6
public boolean isSameTree(TreeNode p, TreeNode q) { if(p !=null && q !=null){ if(p.val == q.val){ return isSameTree(p.left , q.left) && isSameTree(p.right , q.right); }else{ return false; } }else if(p ==null && q == null){ return true; }else{ return false; } }
d709b465-255a-4562-b9cc-0ad70b5e8573
8
public ListNode getIntersectionNode(ListNode headA, ListNode headB) { if (headA == null || headB == null) { return null; } int aLen = getLen(headA); int bLen = getLen(headB); int diff = aLen - bLen; if (diff >= 0) { while (diff > 0) { headA = headA.next; diff--; } } else { diff = -dif...
4cf7828d-1b25-4a2d-bf85-8fa92cfc1a7f
5
public void tickAll() { for(int var1 = 0; var1 < this.all.size(); ++var1) { Entity var2; (var2 = (Entity)this.all.get(var1)).tick(); if(var2.removed) { this.all.remove(var1--); this.slot.init(var2.xOld, var2.yOld, var2.zOld).remove(var2); } else { ...
12b7ab1f-8983-4e49-8c0e-2e351e4e5e7c
3
public void loadMap(String file) { InputStream in = getClass().getResourceAsStream("/maps/" + file + ".map"); BufferedReader br = new BufferedReader(new InputStreamReader(in)); try { this.cols = Integer.parseInt(br.readLine()); this.rows = Integer.parseInt(br.readLine());...
2d1faa75-20a4-4fe1-ac88-1205a37beda7
8
public void createAndSaveUrl(String Path, String DistrictID) throws Exception{ Properties properties = new Properties(); properties.load(this.getClass().getResourceAsStream("/com/opendap/poc/ServerContentDownloader.properties")); String parent = new File(this.getClass().getResource("/boo.txt").getFile()).getPare...
66d6460a-48a6-456d-a367-475a2fd355d5
6
public List<Map<Integer, Integer>> buildRGBHistogram() { List<Map<Integer, Integer>> output = new ArrayList<Map<Integer, Integer>>(); Map<Integer, Integer> red = new TreeMap<Integer, Integer>(); Map<Integer, Integer> green = new TreeMap<Integer, Integer>(); Map<Integer, Integer> blue = new TreeMap<Integer, Inte...
986c1216-4b1e-4adb-bbc7-966be490d880
6
@Override public final BEXList children() { final int key = this._key_; final BEXFileLoader owner = this._owner_; switch (BEXLoader._typeOf_(key)) { case BEX_ELEM_NODE: { final int ref = BEXLoader._refOf_(key); final int contentRef = owner._chldContentRef_.get(ref); if (contentRef >= 0) re...
68707ebc-a587-459c-85b6-efc4acf1be9a
0
@Override public void execute(DebuggerVirtualMachine dvm) { dvm.setStepInPending(true); dvm.setRunning(true); }
888a7278-789a-4e5a-bff1-78f554715460
4
public void establishConnection() { try { // Load Driver Class.forName(DRIVER).newInstance(); // Establish connection connection = DriverManager.getConnection(URL); System.out.println(URL + " connected..."); } catch ( SQLException ex ) { ...
96a76776-d4b0-44a7-bba2-24fe126eca18
9
private String produceBorders() { BufferedImage bordersImage = null; if (ioflags.SAVE) bordersImage = new BufferedImage(chunksX * MyzoGEN.DIMENSION_X, chunksY * MyzoGEN.DIMENSION_Y, BufferedImage.TYPE_INT_ARGB); for (Tile tile : MyzoGEN.getOutput().getTilesArray().values()) { Point[] surrPoints = Utils.g...
ed669a99-029f-475d-ac46-d659d09e3902
0
@XmlElementDecl(namespace = "http://www.w3.org/2001/04/xmlenc#", name = "KeyReference", scope = ReferenceList.class) public JAXBElement<ReferenceType> createReferenceListKeyReference(ReferenceType value) { return new JAXBElement<ReferenceType>(_ReferenceListKeyReference_QNAME, ReferenceType.class, Reference...
93e4b01e-dc65-48a7-97d9-58a2e464d7cf
8
private void addServerNotifierAsListener() { EventsControlSystem ecs = rcs.getECS(); for (Integer decoder : model.getDecodersId()) { ecs.addListener(Protocol.EVENT_DECODER_STATE0, decoder, serverNotifier); ecs.addListener(Protocol.EVENT_DECODER_STATE1, decoder, serverNotifier); ...
1be88400-1d74-4293-9ebe-fdde229a8708
3
protected void writeRow() throws IOException { final Iterator<String> titlesIter = columnTitles.iterator(); while (titlesIter.hasNext()) { final String columnTitle = titlesIter.next(); if (getRowMap() != null) { if (titlesIter.hasNext()) { writ...
b3967b1d-971f-46ad-b43d-2688a9233112
7
private boolean colchete() { //<colchete> ::= “[“ <inteiro> “]” <colchete> | λ*/ boolean erro = false; if (!acabouListaTokens()) { nextToken(); if (tipoDoToken[1].equals(" [")) { if (!acabouListaTokens()) { nextToken(); ...
28d0f7a8-f984-4dbe-a43d-d8247528c90a
4
public static String capitalizeEveryWord(String string){ boolean lastWasSpace = false; char[] stringArray = string.toCharArray(); if(stringArray.length == 0){ return "-1"; } stringArray[0] = Character.toUpperCase(stringArray[0]); for (int x = 1;x <= stringArray.length - 1; x++){ if(stringArra...
bbdf116f-7e0a-4b96-ba96-ad8b10e7435a
5
public Maze(int nRows, int nCols) { act_rows = nRows/2; act_cols = nCols/2; rows = act_rows*2+1; cols = act_cols*2+1; feild = new RoomType[rows][cols]; current = new int[act_cols*2-1]; next = new int[act_cols*2-1]; /* Sets the maze to filled */ for(int i =0; i<feild[0].length...
be8a9dc9-6af7-408c-8ef6-e3b6eb2424dc
7
private ArrayList<String> splitMsg(String str) { ArrayList<String> array = new ArrayList<String>(); int curPos; int len = str.length(); int countLeft = 0, countRight = 0; int startIndex = 0; char ch; for (curPos = 0; curPos < len; ++curPos) { ch = str.charAt(curPos); ...
fdba7f0c-ecda-4823-996c-0f49af64e03c
3
void mapOutField(Object from, String from_out, Object to, String to_field) { if (from == ca.getComponent()) { throw new ComponentException("wrong connect:" + to_field); } ComponentAccess ca_from = lookup(from); Access from_access = ca_from.output(from_out); checkFA(from_access, from, from_out); try { ...
9783c980-9c11-4b7a-9808-e3645a59e1c6
3
public static Vector arrayListToVector (ArrayList someArrayList) { // if we've got a null param, leave if (someArrayList == null) { return null ; } // end if // try to create a vector Vector someVector = new Vector () ; // if we failed, leave if (someVector == null) { return null ; } // e...
14e91b72-9214-4acf-95f6-07c1028929a3
9
@Override public Object getValueAt(int rowIndex, int columnIndex) { if(columnIndex < 0 || columnIndex >= getColumnCount()) return null; if(rowIndex < 0 || rowIndex >= getRowCount()) return null; switch (columnIndex) { case 0: retu...
147692de-6efa-45a7-bb99-8476a10073d8
9
public boolean isSameTree2(TreeNode p, TreeNode q){ Stack<TreeNode> pstack = new Stack<TreeNode>(); Stack<TreeNode> qstack = new Stack<TreeNode>(); pstack.push(p); qstack.push(q); while(!pstack.isEmpty() && !qstack.isEmpty()){ p = pstack.pop(); q = qstack.pop(); if (p !=...
4c9a816a-0438-4da7-ab02-ae0c9a629dca
1
public String testStart(String appKey, String userKey, String testId) { try { appKey = URLEncoder.encode(appKey, "UTF-8"); userKey = URLEncoder.encode(userKey, "UTF-8"); testId = URLEncoder.encode(testId, "UTF-8"); } catch (UnsupportedEncodingException e) { ...
0fc60a0c-ef9e-48c0-9cdb-c213d746c8a3
9
public int maximalRectangle(char[][] matrix) { int numRows = matrix.length; if (numRows == 0) { return 0; } int numCols = matrix[0].length; if (numCols == 0) { return 0; } int maxArea = 0; int[] heights = new int[numCol...
e71ae338-a102-4c0c-a343-5678b765b180
1
private PaymentsAPI getPaymentApi() { if (paymentsApi == null) { paymentsApi = new PaymentsAPI(config); } return paymentsApi; }
9be64499-42f4-4d45-b6a4-1724638338d8
1
public void RenderAll(Shader shader, RenderingEngine renderingEngine) { Render(shader, renderingEngine); for(GameObject child : m_children) child.RenderAll(shader, renderingEngine); }
fff6f75f-442b-4ab4-a2f3-7bea68f79a5c
9
public static TreeMap<String, Double> processString(String line) { TreeMap<String, Double> output = new TreeMap<String, Double>(); StringTokenizer tokenizer = new StringTokenizer(line); while (tokenizer.hasMoreTokens()) { String token = tokenizer.nextToken() .replaceAll("[^\\p{Alpha}]+", "").toLowerCas...
aa8bb8fa-87b8-473e-bcb0-c52d21f77edf
3
public synchronized void addAnimation(String string, BufferedImage[] images) { if(this.getCurrentAnimationType().equals("")){ this.setCurrentAnimationType(string); } if(this.animations == null){ this.animations = new Hashtable<>(); } if(images == null){ images = new BufferedImage[0]; } this.anima...
422de317-1e63-45b6-a42b-2087b7928d6a
5
boolean matchOrEmpty(int pips, int x, int y) { return ((x < 0 || x >= w || y < 0 || y >= h) || (field[x][y] == -1) || (field[x][y] == pips)); }
e2a3b7e1-ecfa-46ce-ab37-4a9833d66268
5
boolean isSim() { return file != null && (file.getName().endsWith("sim") || file.getName().endsWith("luca") || file.getName().endsWith("fast") || file.getName().endsWith("esp") || file.getName().endsWith("dds")); }
988949c0-6415-4a34-953c-1bf12ef5a844
2
@Test public void testMatrix3fFloatArray() { float[] entries = new float[9]; for(int i = 0; i < 9; ++i) entries[i] = i; Matrix3f m = new Matrix3f(entries); for(int i = 0; i < 9; i++) assertEquals(m.entries[i],entries[i],EPSILON); }
88a89e88-4b9c-46fd-9ba4-40ab126d5b18
0
public DogTrack(int tracksize) { this.tracksize = tracksize; posFido = 0; posSpot = 0; posRover = 0; }
3a48655a-ef10-4525-9ddd-59a7a6d4022f
7
private void checkRoute(int[] route, int offset){ if(offset == salesman.n){ count++; if(count%100000 == 0){ System.out.println("check route "+count); } double cost = salesman.calculateCosts(route); if(minCosts < 0 || cost < minCosts){ minCosts = cost; System.arraycopy(route,0,min...
e66ff200-0d28-47bf-bf11-626ba74c1404
1
@Override public void changedMostRecentDocumentTouched(DocumentRepositoryEvent e) { if (e.getDocument() == null) { setEnabled(false); } else { setEnabled(true); } }
892f3489-ec7a-4dfb-b56f-10e6151eb072
8
private void splitCompounds(String equation, boolean reactantSide) throws SChemPException { StringTokenizer token = new StringTokenizer(equation, "+"); if(reactantSide) { reactantStrings = new String[token.countTokens()]; reactants = new Compound[reactantStrings.length]; rCoefficients = new int[react...
fe5be507-550e-4358-bb66-bb8ca2d9bf7b
2
int[] isoFromFixed(long date) { int weekyear = gjYearFromFixed(date - 3); int nextWeekyear; if (weekyear == -1) { nextWeekyear = 1; } else { nextWeekyear = weekyear + 1; } if (date >= fixedFromISO(nextWeekyear, 1, 1)) { weekyear = nextW...
51cdf442-c7a4-47e2-a875-69272c0d2e26
0
public void setClockForGroup(VectorClock clockForGroup) { this.clockForGroup = clockForGroup; }
0b4af6e1-0fe0-4779-a8a4-f49542c74866
6
private int calculaYparaPuntoCiclista(Ciclista cic, TreeMap<Integer, Integer> ar) { int yresu = 0; int dify = 0; int yacum = Constantes.ALTO_VENTANA / 4; boolean encontrado = false; Iterator<Entry<Integer, Integer>> it = ar.entrySet().iterator(); Iterator<Entry<Integer, Integer>> itaux = ar.entrySet().iterat...
eda43ee8-e480-4bf1-b12d-619d5aa70224
1
public static synchronized void playSound() { new Thread(new Runnable() { public void run() { try { InputStream in = new FileInputStream("sounds/goal.wav"); AudioStream as = new AudioStream(in); AudioPlayer.player.start(as); } catch (Exception e) { ...
c1ef33b2-2b18-444d-b9db-cdd103b5feeb
6
@EventHandler public void onSignChange(SignChangeEvent event) { if(!HotelCount.isAdmin(event.getPlayer()) && !HotelCount.canCreate(event.getPlayer())) return; if(event.getLine(0).equalsIgnoreCase("[Counter]")) { String region = event.getLine(1); int lo...
f9174e0d-e277-40a1-bc56-234dee070654
4
public ComboBoxModel<String> GetListClasse(){ //String columnNames[] = { "Lib Classe"}; DefaultComboBoxModel<String> defModel = new DefaultComboBoxModel<String>(); //defModel.setColumnIdentifiers(columnNames); try { DriverManager.registerDriver(new oracle.jdbc.d...
fefe1ad7-3dc3-43c1-9379-19b96d67bc97
3
public WumpusPerception addHunter(final AID senderAID) { if(log.isLoggable(Logger.INFO)) log.log(Logger.INFO, "addHunter()"); WumpusPerception perception = null; if (senderAID != null) { Hunter hunter = new Hunter(senderAID); if (!hunters.contains(hunter)) { this.hunters.add(hunter)...
5a9cde94-289a-4462-86db-f40e90d14a73
3
public static void createTables() throws SQLException, ClassNotFoundException { // database.plugin.debug("Creating SQLite tables..."); Class.forName("org.sqlite.JDBC"); Connection con = getConnection(); Statement stat = con.createStatement(); if (tableExists("Lifestones") == false) { System.out.println("C...
e248db3c-2679-4cc4-9e69-7bac398806ce
9
static public void main(String[] arguments) { String msg = null; // create the configuration Config config = new Config(); // see: // http://www.javaworld.com/javaworld/jw-08-2004/jw-0816-command.html?page=5 Options opt = new Options(arguments, 2); // convert fasta: arg1 = fasta files, arg2 = bases ...
32043b81-897d-4574-9574-7e5108e06dd7
0
@Basic @Column(name = "FUN_HABILITADO") public String getFunHabilitado() { return funHabilitado; }
ec639a48-d6f2-4f1a-82ae-d8a75f259dd5
6
public void printResult(DefaultTableModel table) { count = 100; try { while ((count > 0) && result.next()) { count--; Vector<String> data = new Vector<String>(); for (int i = 1; i <= resultMetaData.getColumnCount(); i++) { Object res = result.getObject(i); data.add( res == null ? "NULL" ...
ea9b681d-902d-46e8-aeeb-e33c512db057
9
@Override public void execute() throws BuildException { super.execute(); if (jdeHome == null) { throw new BuildException("jdehome not set"); } File lib = new File(jdeHome, "lib"); if (lib.isDirectory()) { Path apiPath = new Path(getProject()); apiPath.setLoc...
70ec78ca-a14e-4450-bb54-258a3085ceeb
7
private void validate() throws RrdException { if(dsName == null || dsName.length() == 0) { throw new RrdException("Invalid datasource name specified"); } if(!isValidDsType(dsType)) { throw new RrdException("Invalid datasource type specified: " + dsType); } if(heartbeat <= 0) { throw new RrdException(...
0f5502b0-48d7-4375-b19d-6d85b2a96964
5
public int surround(int y, int x, int[][] image){ int counter = 0; for(int i = y - 1; i <= y+1; i++) for(int j = x -1; j <= x+1; j++){ try{ if(image[i][j] == -16777216) counter++; }catch(Exception e){;} } if(image[y][x] == -16777216) counter--; return counter; }
b73b3dc7-1991-45a6-8365-b402047b6977
7
public void compileFilenamesList(CMFile F, String regex, Vector<String> V) { if((!F.canRead())||(!F.isDirectory())) return; final String[] list=F.list(); String path=F.getAbsolutePath(); if(!path.endsWith("/")) path+="/"; for(int l=0;l<list.length;l++) { final CMFile F2=new CMFile(path+list[l],nul...
57c03225-3eea-4478-a4e1-8fd99f5d5f9c
0
@Id @Column(name = "module_id") public String getModuleId() { return moduleId; }
0065f866-a667-4b4c-99cf-2e0e49a2986c
1
public static void checkfile() { File file = new File(Homework_datetimecheck.memberurl); boolean fexists = file.exists(); if (!fexists) { new add_new_user().setVisible(true); } ...
0aebd759-631c-4d73-b3b9-1b289001eb72
1
public static String replaceChatColors(String s) { for (ChatColor c : ChatColor.values()) { s = s.replaceAll("&" + c.getChar(), ChatColor.getByChar(c.getChar()) + ""); } return s; }
2feb86f4-7b4b-4537-842f-7cc834f98e95
6
public static String escape(String string) { char c; String s = string.trim(); StringBuffer sb = new StringBuffer(); int length = s.length(); for (int i = 0; i < length; i += 1) { c = s.charAt(i); if (c < ' ' || c == '+' || c == '%' ...
3918dc3e-5662-487c-9132-a0171085f981
8
public String toXmlString() { StringBuilder sb = new StringBuilder("<apon:address>"); if (this.line1 != null) { // optional sb.append("<apon:line1>" + this.line1 + "</apon:line1>"); } if (this.line2 != null) { // optional sb.append("<apon:line2>" + this.line2 + "</apon:line2>"); } if (this.lin...
320a381f-9a2d-40de-8b5e-ce382f821f93
3
public static void main(String[] args) { String[] stateList = CSVStrings.MALE_CSV.split("-"); String[] yearList = stateList[0].split(","); for (int i = 1; i < yearList.length; i++) { _populationByYearList.add(new PopulationYear(Integer.parseInt(yearList[i]))); } parse(stateList, ...
b3c98e3c-f0df-4187-a222-b859d936b333
1
private static void displayPatients(ResultSet rs)throws SQLException{ StringBuilder bf = new StringBuilder(); while (rs.next()){ bf.append(rs.getInt("pid")).append(": "); bf.append(rs.getString("firstname")).append(" "); bf.append(rs.getString("lastname")); System.out.println(bf.toString()); bf.de...
0ab7cdff-bab1-4655-9d97-8b4ad2b84fdf
9
public BoardNode[] startingNodes(int color){ int count = 0; if(color == 1){ int y; for(y = 1; y<7; y++){ if(this.getNode(0, y).getColor() == color){ count++; } } y = 1; BoardNode...
ef85b3da-96f8-4e4a-ac64-bd9502042d7c
9
public int divide(int dividend, int divisor) { int result = 0; if (Math.abs(dividend) < Math.abs(divisor) || dividend == 0 || divisor == 0) { return result; } boolean isPositive = true; if (dividend < 0 && divisor > 0 || dividend > 0 && divisor < 0) { isPo...
d4515073-1fec-4168-b962-5130783c8d08
7
@Override public void processOneGameTick(long lastFrameTime) { entityManager = LLP.entityManager; buffer = new BufferedImage(400, 400, BufferedImage.TYPE_INT_RGB); long offsetX = 0; long offsetY = 0; if (LLP.player != null) { offsetX = entityManager.getComponent(L...
4373f14b-71cf-4055-aba3-f1027a43a6a8
3
public String convertToString(HashMap map) { StringBuffer buf = new StringBuffer(); Iterator it = map.keySet().iterator(); while (it.hasNext()) { String key = (String) it.next(); String value = (String) map.get(key); try { buf.append(URLEncoder.encode(key, "UTF-8")); buf.append(DELIMITE...
21b251f3-2020-4739-9f08-4861a06fbcc7
8
public static String assertRationalMatrix(double[][] matrix) { if (matrix == null) { return "The matrix is null"; } int rows = matrix.length; if (rows <= 1) { return "The matrix does not have more than one row:" + NEWLINE + representMatrix(matrix, 3); } double[] firstRow = matrix[0]; i...
a34dc67f-ae7f-40c6-87ee-4f4c11487369
0
public void setMaxTries(int maxTries) { this.maxTries = maxTries; }
2384999a-508f-45c1-b1a9-a89cdcde8ea5
9
private ConnectionToClient findOpponent( ConnectionToClient client) throws NullPointerException { Long opponentId = -1L; // Default value for a long ClientNode clientNode = new ClientNode(-999L);; for( ClientNode node : clientList ) {// Iterate through all clients connected in the list // If listClient d...
28ba29a3-09c4-40f9-ae8c-f4dcc09c613a
9
@Override public void actionPerformed(ActionEvent event) { try { if (event.getSource() == buy) { Item item = (Item) merchantsInventory.getSelectedValue(); // select item in merchantsInventory JList startSel = merchantsInventory.getSelectedInde...
577122f0-9745-4e18-93e6-8145feb32afc
5
public Ocean toOcean() { Ocean newOcean = new Ocean(width, height, starveTime); int x=0; int y=0; for(TypeAndSizeAndStarve runs: runLength) for(int i = 0; i<runs.getSize(); i++){ if(y==width){ x++; y=0; } if(runs.getType() == 1){ newOcean.addShark(y, x, starveTime); y++; ...
79702d36-a2a1-400d-816b-407d55a76b99
3
public void registerInterestIn( Class<? extends Data>... someInterestedData ) { //iterate over the array of data types for( int i = 0; i < someInterestedData.length; ++i ) { //and add them to the interest list _interestedDataList.add( someInterestedData[i] ); } ...
ff525ee3-3940-4a55-8711-5c93ba9b2aea
3
private void saveMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveMenuItemActionPerformed // TODO add your handling code here: int returnVal = saveFileChooser.showSaveDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = saveFileChoos...
b2e0e580-771d-4245-8fde-b5d42ef7c40a
8
void prep(char grid[][]){ int n = grid.length; int m = grid[0].length; foldedOrWhite = new int[n][m]; foldedOrBlack = new int[n][m]; for(int i=0; i<n; i++){ for(int j=0; j<m; j++){ if(black(grid, i, j)) foldedOrWhite[i][j] = 0; else foldedOrWhite[i][j]...
fdde04a0-a39e-4673-9d39-f531c84f0b49
9
public static void readFromNetwork(int data) { System.out.println("Read from network: " + data); switch (data) { case 100: bronzeChest.removeItems(); LOCKS[3] = true; break; case 101: ROOMS[0].removeItem(silverKey);...
5aba724f-aa37-4393-8c40-2df43186af3a
0
public void setExpired(boolean expired) { this.expired = expired; }