method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
929170c7-f86c-4db3-a235-771e1145a951
4
public void print() { int printableHour; // hour value to be printed String amPm; // am or pm value to be printed if (error != null) { System.out.println(error); } else { // convert 24h to 12 h amPm = hour >= 12 ? "PM" : "AM"; // am or pm value to be ...
b02ac170-1694-4f6b-8969-cbf8172ebfde
9
static final public AbstractSyntaxTreeNode<DataTypeEnum,IValue> booleanFactorExpression() throws ParseException { Token t; AbstractSyntaxTreeNode<DataTypeEnum,IValue> node; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case ID: t = jj_consume_token(ID); {if (true) return new Var...
1a1e8182-d29f-4ec3-95d3-5ea5dcf04dba
7
protected PoliLine pop(PoliLine master, Point first, Point last) { Iterator<Point> cursor = master.iterator(); LinkedList<Point> poppedPoints = new LinkedList<Point>(); poppedPoints.add(first); boolean started = false; while (cursor.hasNext()) { Point x = cursor.next(); if (started && x.equals(last))...
ee63813b-1c4d-4371-9833-8463e3f85490
8
private boolean callInitMethods(final Plugin spawnedPlugin, final Method[] methods) throws IllegalAccessException { log("callinit/start", new OptionInfo("plugin", spawnedPlugin.getClass().getCanonicalName())); for (final Method method : methods) { log("callinit/method", new OptionInfo("method", method...
d2e2ac1f-87b5-4ea4-a843-bb001d8de339
8
public int longestValidParentheses(String s) { if (s == null || s.length() <= 1) { return 0; } int longest = 0; int[] longests = new int[s.length()]; longests[s.length() - 1] = 0; for (int i = s.length() - 2; i >= 0; i--) { longests[i] = 0; if (s.charAt(i) == ')') { longests[i] = 0; } els...
30594ebb-0675-40b1-9c19-f0aa9f7611d8
0
public Object get(){ return stackList.removeLast(); }
7ccbaef5-0f1d-4030-9f16-bdaee8698cee
8
public static int indexer(char x)throws IllegalLineException{ //takes in a char and returns int to be used for indexing with Expression Checker's dictionary //throws IllegalLineException when the char is not of expected type //the final return of 100 is never reached. switch(x){ case '|':case'&': return 0; ...
77fc58ee-8145-41c5-b27d-4331f6631d4d
3
public void run() { try { String line = reader.readLine(); while (line != null) { if (isErrorStream) System.err.println(line); else System.out.println(line); line = reader.readLine(); } reader.close(); } catch (IOException e) { e.printStackTrace(); } }
4cf95106-9db1-4590-8cfd-25b80e7c0044
2
public Temporada buscarTemporada(int idTemporada){ Temporada solucion = null; for (Temporada temporada : temporadas) if (temporada.obtenerNumeroTemporada() == idTemporada) solucion = temporada; return solucion; }
f4b9102d-08db-4b32-9199-98f7b6e86d75
1
public int depositAmount(int amount){ if(amount > 0) { bal += amount; System.out.println("\nRs "+amount+" is deposited into your Account"); } return bal; }
1eb300ea-ac6e-4895-94ae-7afe7387e08b
7
void initBlocks() { int xInicial=0; int yMas=10; switch(Level) { case 1: xInicial=(screenWidth-(Block.width*VBlocks))>>1; break; case 2: case 3: xInicial=Block.width>>1; } for(int x=0;x<VBlocks;x++) { int yTmp=yMas; for(int y=0;y<HBlocks;y++) { blocks[x][y]=new Block(...
6b7467d3-ea8a-4e4d-9fc6-c80bd6699f56
6
protected void processGlobalResourceARList(Sim_event ev) { LinkedList regionalList = null; // regional GIS list int eventTag = AbstractGIS.GIS_INQUIRY_RESOURCE_AR_LIST; boolean result = false; // for a first time request, it needs to call the system GIS first, // then asks...
9c6af0ff-42b0-4da1-8bab-142aa05fd312
6
public MultiBufferTest(int numBuffers, GraphicsDevice device) { try { GraphicsConfiguration gc = device.getDefaultConfiguration(); mainFrame = new Frame(gc); mainFrame.setUndecorated(true); mainFrame.setIgnoreRepaint(true); device.setFullScreenWindow(mainFrame); if (device.isDisplayChangeSupported()...
3fec816c-0cc9-495c-9157-300f7b48682e
7
public void run(){ // If there is not word to recognized or the word is empty then do not recognize if(word == null || word.trim().isEmpty()){ return; } // Get the highlighter DefaultHighlighter.DefaultHighlightPainter highLighter = FileUtils.getInstance().getHighligh...
7758b380-f3cb-478f-b24c-a9148335d3fd
1
public static Shape getShape(String color) { Circle circle = (Circle) circleMap.get(color); if (circle == null) { circle = new Circle(color); circleMap.put(color, circle); System.out.println("Creating Circle of " + color + " color."); } return circle; }
a5ed2cff-ca33-4fe2-b672-a5ab8e88ef1d
6
*/ private int stepCalc(int range) { if (range < 10) { return 1; } if (range < 20) { return 2; } if (range < 50) { return 5; } if (range < 100) { return 10; } if (range < 250) { return 25; } if (range < 500) { return 50; } return 100; }
0cc6dfe5-3efe-4812-9394-d33488db22e4
0
public int getAmountOfCitys(){ return amountOfCitys; }
c447cf38-b25b-4dee-abba-1b4f91872ae8
6
public static void main(String[] args) throws SecurityException { System.out.println(System.getProperty("java.runtime.version")); SecurityManager testManager = System.getSecurityManager(); if (testManager == null) { //final Unsafe unsafe = Unsafe.getUnsafe();//Doesn't work - protected to throw a security er...
932c6bb1-ac51-4eeb-a267-5a9e178f5fab
0
protected boolean test3 () { return true; }
1343426d-8a61-4bb1-803f-6f689d7ecb54
1
public void shiftLeft() { point.setLocation(location); point.translate(-1, 0); if (assertLegal(pane, block, point, block, location)) { free(); location.translate(-1, 0); calcShadowDrop(); draw(); } }
26206085-a7e0-4456-8acf-262fe5296f10
6
public HashMap<BasicMana, Integer> getMap() { HashMap<BasicMana, Integer> temp = new HashMap<BasicMana, Integer>(); if (this.black > 0) { temp.put(BasicMana.BLACK, this.black); } if (this.blue > 0) { temp.put(BasicMana.BLUE, this.blue); } if (this.red > 0) { temp.put(BasicMana.RED, this.red); } ...
55603d7d-1e67-4fb5-a613-10b43d28510b
4
public int setxattr(ByteBuffer path, ByteBuffer name, ByteBuffer value, int flags, int position) { if (xattrSupport == null) { return handleErrno(Errno.ENOTSUPP); } String pathStr = cs.decode(path).toString(); String nameStr = cs.decode(name).toString(); if (log != ...
5406781f-2fd5-48ae-a45a-69a0971740c2
9
public String getShortestExample(Boolean accept) { String path = ""; Queue<ArrayList<Integer>> holder = new LinkedList(); List<ArrayList<Integer>> visited = new LinkedList(); Map<ArrayList<Integer>, ArrayList<Integer>> vertmap = new HashMap<ArrayList<Integer>, ArrayList<Integer>>(); ...
eff17beb-ee9b-477b-ac46-6c08fc0bd3a8
2
public void releaseBuffer(ByteBuffer bb){ if(this.createCount.intValue() > maxBufferPoolSize && (this.usableCount.intValue() > (this.createCount.intValue() / 2) ) ){ bb = null; this.createCount.decrementAndGet(); }else{ this.queue.add(bb); this.usableCount.incrementAndGet(); } }
3968c75e-d1a7-4cf7-b220-b1d23f89a630
8
private void loadConfig(){ properties[0] = "left"; properties[1] = "right"; properties[2] = "up"; properties[3] = "down"; properties[4] = "protect"; properties[5] = "shoot"; properties[6] = "shoot2"; properties[7] = "sound"; if(file.canRead()) try { fstream = new FileInputStream(f...
3bb18e5f-ff2f-467b-8f94-b0a8a407fb1e
4
public void commit(){ Point p = GUI.getMousePosition(); if(GridWorldLife.brush){ Location l = GUI.panel.locationForPoint(p); if((prevLoc != null && !prevLoc.equals(l)) || prevSize != GridWorldLife.brushSize){ stroke(l, GridWorldLife.brushSize); prevLoc = l; prevSize = GridWorldLife.brushSize;...
a452cf5a-02c8-4eb8-8710-891e5e37a19a
4
public DebateGUI(User user, Debate debate) { super("Debate"); this.userLogin = user; this.debateSelected = debate; String[][] team = debateSelected.getTeam(); for (int i = 0; i < team.length; i++) { for (int j = 0; j < team[i].length; j++) { if (team[i][j].equals(userLogin.getName())) { if ( i == ...
646346c5-012b-44d0-96d8-4daca4d0a2ba
4
private static void launchServer() throws IOException { InetSocketAddress addr = new InetSocketAddress(Integer.valueOf(conf.getProperty(PORT))); HttpServer server = HttpServer.create(addr, 0); server.createContext("/", new HttpHandler() { public void handle(HttpExchange exchange...
33b3e94a-8bef-44db-90bb-dcab20871875
5
@SuppressWarnings("unchecked") @Override public int compareTo(Node o) { int toReturn; if (o == null) { toReturn = -1; } else if (c == null && o.c == null) { toReturn = 0; } else if (c == null) { toReturn = 1; } else if (o.c == null) { toReturn = -1; } else { toReturn = ((Compar...
d595d747-3973-497e-8dec-f629e00ea84e
1
private void read(DataInputStream in) throws IOException { accessFlags = in.readUnsignedShort(); name = in.readUnsignedShort(); descriptor = in.readUnsignedShort(); int n = in.readUnsignedShort(); attribute = new LinkedList(); for (int i = 0; i < n; ++i) attri...
7edc7593-6d16-403d-bfc5-3b19c661e00d
8
public int findIndexOfFileDescriptor(String filename, boolean delete) throws Exception { for(int i = 0; i < 3; i++){ if(oft.readDiskToBuffer(0, i) == -1) throw new Exception("Block not assigned"); byte[] memory = oft.getBuffer(0); for(int j = 0; j < memory.length; j = j + DIRECTORY_ENTRY_S...
8fb647b9-ef02-43cb-8fbb-60d4e23a0353
8
private List<LogicCell> next() { List<LogicCell> resultList = new ArrayList<>(); for (LogicCell cell : currentStep) { cell.neigbour = 0; nextStep.put(cell, cell); } for (LogicCell c : currentStep) { addNeighbors(c); } for (LogicCell cel...
874384a1-4a66-40a6-b6b5-6f12a36d9a52
5
public void render(Graphics g) { for (int y = 0; y < slots[0].length; y++) { slots[slots.length - 1][y].render(g); } if (Main.screen.game.invOpen()) for (int y = 0; y < slots[0].length; y++) { for (int x = 0; x < slots.length; x++) { if (x != slots.length - 1) slots[x][y].render(g); } ...
52078cca-4026-4cff-af69-5de9e52c919b
3
public void SetEngine(CoreEngine engine) { if(this.m_engine != engine) { this.m_engine = engine; for(GameComponent component : m_components) component.AddToEngine(engine); for(GameObject child : m_children) child.SetEngine(engine); } }
2f3a9ea3-2c90-4b89-ae76-47b57f071e91
0
public String getUsername() { return new String(probeData).trim(); }
e6386492-2bd5-43c5-878a-56202a7393eb
1
public void setLevel(int lvl){ if(Engine.DEBUG_MODE) this.stats[PROGRESSION] = lvl; rebuildStats(); }
6dea041d-9ab5-4d65-ab80-33cd482ad2a9
6
String unqualReason() { String reason = ""; if (!this.qualifyTest()) { reason = "Unqualified Reasons:\n"; } if (this.getMajorCrd() < 45) { reason = reason + "Less than 45 Major Credits\n"; } if (this.getUpperCrd() < 45) { reason = reason...
88747bab-82a2-409d-82c7-4fcf44b598e1
1
public final void setBiomeID(byte biomeID){ if(currentChunk == null)return; currentChunk.setBiomeID((int)getX(), (int)getZ(), biomeID); }
9ce08b15-9eff-48d9-8c0a-0a31e87f32f3
7
@Override public void rightMultiply(IMatrix other) { // TODO Auto-generated method stub for(int i=0;i<4;i++) for(int j=0;j<4;j++) copy[i][j]=0; for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { for (int k = 0; k < 4; k++) { copy[i][j]=copy[i][j] + this.get(k, i) * other.get(j, k...
b52b1102-4db1-4e6d-9eaf-c6229d0a919d
9
@Override public void mousePressed(MouseEvent ev) { if (ev.getButton() == MouseEvent.BUTTON1 && !ev.isPopupTrigger() && !(ev.isShiftDown() && ev.isControlDown())) { if ((ev.getModifiers() & InputEvent.CTRL_MASK) == InputEvent.CTRL_MASK || (ev.getModifiers() & InputEvent.ALT_MASK) == InputEvent.ALT_MASK) { Lis...
d7eee892-c10c-46a1-a9cc-91720943459f
2
private void flush() { if (logWriter != null) { logWriter.flush(); } if (errorLogWriter != null) { errorLogWriter.flush(); } }
96fefa27-3569-4ada-ae8b-912fa6fc303f
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...
35b5a053-6116-47ee-ba28-b0df67db99db
7
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if(!super.okMessage(myHost,msg)) return false; if(otherSide) return true; if(msg.target()==affected) { if(!(affected instanceof MOB)) return true; if((msg.source()!=msg.target()) &&(msg.tool() instanceof Abili...
5c34325f-5952-4f69-8a3b-141d55372c3f
6
public static void binarySearch(int[] arr, int data) { if (arr.length < 1) { System.out.println("null?"); return; } if (arr.length == 1) { if (data == arr[0]) { System.out.println("success.\t" + data + " -> arr[0]"); return; ...
4d14292a-1017-4f45-aebe-7832a578b9d1
2
private boolean checkCommand(){ try{ CommandScanner commandscanner = new CommandScanner(StockGameCommandType.values(), descriptor); commandscanner.checkCommandSyntax(shellreader); return true; }catch(WrongCommandException e){ shellwriter.println("Invalid Command"); shellwriter.flush(); return ...
ea87aa17-9bbf-47f2-9197-02a105dd2edb
7
public double weightedStandardDeviation_of_ComplexRealParts() { boolean hold = Stat.nFactorOptionS; if (nFactorReset) { if (nFactorOptionI) { Stat.nFactorOptionS = true; } else { Stat.nFactorOptionS = false; } } boolean hold2 = Stat.nEffOptionS; if (nEffReset) { if (nEffOptionI) { Stat...
d4fffad6-720e-49f8-bacf-f23902bccdec
5
public Object getField(Reference ref, Object obj) throws InterpreterException { Field f; try { Class clazz = TypeSignature.getClass(ref.getClazz()); try { f = clazz.getField(ref.getName()); } catch (NoSuchFieldException ex) { f = clazz.getDeclaredField(ref.getName()); } } catch (ClassNotFou...
3e183d3f-4476-49c7-b616-bf6b657c6668
2
void calcGravityForce() { double scalar; double dist; for(int i = 0; i < mass.length; i++) { dist = distances[i].length(); if(Math.abs(dist) > 0.001) { scalar = PhysConstantEnum.gravitationalConstant.value() * weight * mass[i] / (dist * dist * dist); distances[i].scalarMul((float)scalar); ...
e2e94295-b4c3-44c4-82d3-9d0caec5402b
6
private void drawArena() { drawArenaLine(Engine.NUM_COLUMNS); for(int y=Engine.NUM_LINES; y>=0; y--) { Util.print('#'); for(int x=0; x<Engine.NUM_COLUMNS; x++) { if( e.getCobra().isPosTrue(x,y) ) // Cobra Util.print('-'); else if( e.getTocaPermanente().isPosTrue(x,y) ) // Toca Permanente...
d9231e4b-f210-4ee7-a7ee-8b4c2da4ade0
2
@Override public int getScore(String p) { if(p.equals(player1)) { return this.score1; } else if (p.equals(player2)) { return this.score2; } return 0; }
2c2441e9-83db-4c73-91cd-7100f580233e
3
public void setLeft(PExp node) { if(this._left_ != null) { this._left_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } node.parent(this); } ...
dae3cf11-b7cd-4d6a-96cf-68f27485afeb
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Clause other = (Clause) obj; if (literals == null) { if (other.literals != null) return false; } else if (!literals.equals(other.literal...
88f0ce2e-23c9-4ad0-bbcd-4b943f36b8dd
6
protected boolean DelAccount(String accountFile, String id) throws ClassNotFoundException, IOException{ ArrayList<Account> accs = new ArrayList<Account>(); Account tempacc = null; ArrayList<Account> newaccs = new ArrayList<Account>(); try { obji = new ObjectInputStream(new FileInputStream(accountFile)); o...
35ae55cb-8f36-441d-a52c-ad51d825ee88
0
@Basic @Column(name = "PCA_USUARIO") public String getPcaUsuario() { return pcaUsuario; }
7ac27fc5-9475-43cc-9410-8051011dd2c9
5
private boolean checkPsd() throws IOException { byte[] a = new byte[24]; if (read(a) != a.length) { return false; } final byte[] PSD_MAGIC = {0x50, 0x53}; if (!equals(a, 0, PSD_MAGIC, 0, 2)) { return false; } format = FORMAT_PSD; width = getIntBigEndian(a, 16); height = getIntBigEndian(a, 12); ...
788bd94f-75e2-4743-9db0-694636a576b5
6
private static double computeCrc(int[][] squares) { //calculate CR double numerator = 0; //start by computing the numerator for (int row = 0; row < 4; row++) { double pi = 0; //nb of dots in this row divided by total number of dots for (int col = 0; col < 4; col++) { pi += squares[row][col]; ...
a0105d22-bea3-4175-a840-0132a2f93490
2
private void send(String message, boolean isText) { if (message.equals("")) return; if (isText) { message = client.getName() + ": " + message; message = "/m/" + message; } client.send(message.getBytes()); txtMessage.setText(""); }
14241e2c-dc42-4160-b504-73bb79752090
2
private boolean freeSpace() { for (int i = 0; i < components.getLength(); i++) { if (dropArea.intersects(components.get(i))) { JOptionPane.showMessageDialog(this, FREE_SPACE); return false; } } return true; }
c52bab1f-fddd-4935-831e-5129f7df2d63
2
public void fDistributionProbabilityPlot(int nu1, int nu2){ this.lastMethod = 15; // Check for suffient data points this.fDistributionNumberOfParameters = 0; if(this.numberOfDataPoints<3)throw new IllegalArgumentException("There must be at least three data points - prefe...
4d0ed484-1dc4-413a-859c-3a250329fe81
8
public int getItemIcon(ItemStack par1ItemStack, int par2) { int var3 = super.getItemIcon(par1ItemStack, par2); if (par1ItemStack.itemID == Item.fishingRod.shiftedIndex && this.fishEntity != null) { var3 = par1ItemStack.getIconIndex() + 16; } else { ...
a8e77eff-2e34-4ccc-b8dc-3199ae886642
7
public static void main(String[] args) { Random rnd = new Random(); System.out.println("------------------------------------"); System.out.println("Demo class java.util.Random"); System.out.println("------------------------------------"); // rnd.nextInt(MAX) +1 = generer un nombre aleatoire entre 1 et MAX. ...
ba318491-4fe7-4daa-a894-8874ea234bc8
1
public boolean newUser(User usertemp){ if(logUser(usertemp) == true) return false; return userList.add(usertemp); }
4ee31ba7-1d24-4aec-a68a-4f83d08c767a
3
protected void log(String text, LogLevel logLevel) { if (verbosity == LogLevel.ALL || logLevel == LogLevel.ERROR) super.log(text); else { if (logLevel == verbosity) super.log(text); } }
167f4231-00f7-4a3c-8244-8c3cfeb6e557
6
public synchronized boolean replaceAllPossibleFailingParts(WorkSheet ws) { if (ws.partsToReplace == null) { // nothing to replace ws.status = WorkSheet.Status.FINISHED; return true; } for (Iterator<Part> it = ws.partsToReplace.iterator(); it.hasNext();) { Part partToReplace = it.next(); PartType ty...
85f9a5e1-109d-4a6e-8de1-eb731699e9c5
3
public static List<String> getAllLines(File file) throws IOException { List<String> strings = new ArrayList<String>(); BufferedReader reader = null; try { reader = new BufferedReader(new FileReader(file)); } catch (FileNotFoundException e1) {} String line; try { while ((line = reader.readLine()) != ...
55ea33a2-e19a-45b8-9ddf-4560be4dfd59
4
private void killEnemy(EnemyShip enemy) { remaining--; if (enemy.wasKilledByPlayer()) { score += enemy.getScoreValue(); killedInLevel++; ScorePopup popup = new ScorePopup(screen, enemy); popup.setWorld(this); if (level.isLastWave() && killedInL...
c4209025-9abc-422c-bb83-87498bb7368d
4
public static void export(ArrayList<HashSet<Integer>> clusterList) { try { File csv = new File("D:\\File\\Dropbox\\Project\\minHashedAuthors.csv"); try (BufferedWriter bw = new BufferedWriter(new FileWriter(csv, true))) { bw.newLine(); bw.write("aid" + ","...
f5ffe0d8-55da-4768-aed0-436daa5be251
3
public void removeEmployee(int id){ for(int i = 0; i < numEmployees; i ++){ if(employees[i].getId() == id){ for(int j = i; j < numEmployees; j ++){ employees[j] = employees[j+1]; } numEmployees--; } } }
075d5337-6038-46ff-a594-bbb7383e55a3
4
public void addDataPoints(String group, DataPoints dp) { if (dp==null || dp.isEmpty()) return; group = group.toLowerCase(); if (!this.m_PointsSet.containsKey(group)) { this.m_PointsSet.put(group, dp); } else { for (DataPoint p: dp) this.m_PointsSet.get(group).addPoint(p.getX(), p.getY()); } ...
5aa7f3b3-d5ec-4469-adcf-1b8ae085018e
1
public boolean canDo(char symbol) { if (symbol == '{') return true; return false; }
0d2cba91-24bd-4be2-aaf9-eb274c83ae2b
1
public double getDouble(Object key) { Number n = get(key); if (n == null) { return (double) 0; } return n.doubleValue(); }
b879d2e4-bd73-49cd-abe7-fe3d6a1e92f9
1
public boolean isFresh() { return (this.lastAnnounce != null && (this.lastAnnounce.getTime() + FRESH_TIME_SECONDS * 1000 > new Date().getTime())); }
adfa241d-3592-4147-b7f5-ffdf4a0755fa
4
public String login(HttpServletRequest req, HttpServletResponse resp) { try { String queryString = req.getQueryString(); String name = queryString.split("&")[0]; String password = queryString.split("&")[1]; name = name.substring(10, name.length()); password = password.substring(14, password.length()...
3bef5be8-239a-4dd4-8cdd-0de5d26411d4
4
@Override public void update() { if (doc.isShowingAttributes()) { AttributeContainer node = doc.tree.getEditingNode(); model.keys.clear(); model.values.clear(); model.readOnly.clear(); clearSelection(); Iterator it = node.getAttributeKeys(); if (it != null) { while (it.hasNext()) { ...
4e5463a3-c215-4150-bcca-5f349afed683
5
public void move(int xa, int ya) { if(xa > 0) dir = 1; if(xa < 0) dir = 3; if(ya > 0) dir = 2; if(ya < 0) dir = 0; if(!collision()) { x += xa; y += ya; } }
e70b468b-4d1f-4faf-b35e-27a40c6e51af
4
@Override public void mouseReleased(MouseEvent me) { int x = me.getX(); int y = me.getY(); if (this.drawable != null) { // 最初の位置から変化があった場合のみmoveコマンドを実行する. if (!((x == this.startX) && (y == this.startY))) { // undoができるようにmoveコマンドを生成して実行する. // undoした時にはドラッグの開始位置に戻すために,一旦,最初の位置まで...
cc37e52b-b50c-46c9-96bd-e2f771dc02ad
8
public void actionPerformed(ActionEvent e){ String[] sa=new String[4]; if(e.getSource()==jbanalizar||e.getSource()==jmi1){ String cadaux=pa.getJtatexto().getText(); alva.analizar(cadaux); if(tam>=0){ for(int i=0;i<tam;i++){ pa.getJttabla().setValueAt("",i,0); pa.getJttabla().setValueAt("",i,1...
c8be1c3f-5894-4f95-b5ab-d1fc0878f692
3
public static void main(String[] args) { // Объявим конcтанту для размера массива int SIZE = 5; // Создаем массив, в котором есть другие массивы // Причем массивы не создаются - они равны NULL char[][] graph = new char[SIZE][]; // Цикл по элементам массива - все они по...
7782c0bc-f9c4-49ed-a847-26a73b9c8504
5
public void draw(Graphics g, Display d, int bottomPixelX, int bottomPixelY) { if(filter != null){ Graphics2D g2d = (Graphics2D) g; g2d.drawImage(image, filter, bottomPixelX-image.getWidth(null)/2, bottomPixelY-image.getHeight(null)); } else { Image i = getImage(d.getRotation()); if(i != null){ g.dra...
8950546a-c262-41bb-8320-220073388c69
7
public static boolean isRobotSafe(URL url) { String strHost = url.getHost(); // form URL of the robots.txt file String strRobot = "http://" + strHost + "/robots.txt"; URL urlRobot; try { urlRobot = new URL(strRobot); } catch (MalformedURLException e) { // something weird is happening, so don't trust ...
5ca697c2-bcb0-4d1e-8b90-79940e0ba7b1
7
public ArrayList<E>floyd (E saleDe, E vaA){ int[][] path=hacerMatrizPath(); for(int i=0; i<cantNodos; i++){ for(int j=0; j<cantNodos; j++){ System.out.print(path[j][i]+" "); } System.out.println("\n"); } System.out.println("\n"); ...
975a77d3-bf79-4a3f-aaa3-f8182d0ed5df
1
public Object[] formatoTabela(Pesquisa pesquisa) { return new Object[] { pesquisa.getId(), pesquisa.getTitulo(), pesquisa.getOrientador(), pesquisa.getPesquisadorResponsavel(), pesquisa.getColaboradores(), pesquisa.getAnoSubmissao(), pesquisa.getTempoDuracao(), pesquisa.getTipo(), pesquisa.getQua...
94ae64e9-809e-4862-b4af-919efa902f0e
6
public ListNode reverseBetween(ListNode head, int m, int n) { if (head == null || head.getNext() == null || m == n) { return head; } //create a preHead to comtrol the head node ListNode preHead = new ListNode(0); preHead.setNext(head); head = preHead; ...
4555b64b-e21c-4fc8-890f-c2a432f55052
4
private void analyseEndian(String line) throws AssemblerException { if (line.trim().length() == 0) return; if(foundEndian) throw new AssemblerException("Endian error: Endian already specified."); foundEndian = true; line = line.trim(); line = line.toLowerCase(); if (line.equals("big")) data.s...
051d8b97-3def-4868-b83a-c729fe841c2e
4
protected static Ptg calcLog( Ptg[] operands ) throws CalculationException { if( operands.length < 1 ) { return PtgCalculator.getNAError(); } double[] dd = PtgCalculator.getDoubleValueArray( operands ); if( dd == null ) { return new PtgErr( PtgErr.ERROR_NA );//20090130 KSC: propagate error } if( ...
5b76933c-b931-4982-9d52-a7948040b533
3
private void initialize(Frame header) throws DecoderException { // REVIEW: allow customizable scale factor float scalefactor = 32700.0f; int mode = header.mode(); int channels = mode==Frame.SINGLE_CHANNEL ? 1 : 2; // set up output buffer if not set up by client. if (output==null) output =...
70b78b9b-e0e6-45b1-858f-80181122976c
2
@Override public void removeProductType(ProductType productType) { tx.begin(); for (SubProcess sp : productType.getSubProcesses()) { for (Stock s : sp.getStocks()) { sp.removeStock(s); } em.merge(sp); em.remove(sp); } em.remove(productType); tx.commit(); }
921fd4a1-7480-4a0f-b439-a7b6bb3ff0ff
5
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Point point = (Point) o; if (Double.compare(point.x, x) != 0) return false; if (Double.compare(point.y, y) != 0) return false; return ...
d89d7995-556a-4a84-8545-15ca56bb0676
2
@Override public void run() { this.Run = true; while(Run) { try { Thread.sleep(this.Intervall); } catch (InterruptedException e) { e.printStackTrace(); } this.Panel.repaint(); this.Panel.Update(); ...
301c03e9-ec07-486b-ba15-e1a5346525b4
6
public static void main(String[] args) { if(args == null || args.length < 1) { System.err.println ("usage: java org.mcuosmipcuter.dog4sql.text.RandomWordFactory <length> [allowed] [disallowed]"); System.exit(1); } String rw = ""; try { if(args.length == 1) rw = getRandomWord(Integer.parseInt...
a1dc9806-4ec2-47fa-bfe1-315ca3ab2304
8
private int chkMycrds(){ int myrnk=0; if(crd1!=null&&crd2!=null){ myrnk+=crd1.getRankID(); myrnk+=crd2.getRankID(); if(crd1.getRankID()==crd2.getRankID()){ myrnk+=40; }else if(crd1.getRankID()-1==crd2.getRankID()||crd1.getRankID()+1==crd2.getRankID()){ myrnk+=20; } if(crd1.getSuitID()==cr...
d3141b4d-2619-468f-b029-7131cc5dfddc
5
public void body() { // wait for a little while // This to give a time for GridResource entities to register their // services to GIS (GridInformationService) entity. super.gridSimHold(GridSim.PAUSE); LinkedList resList = super.getGridResourceList(); // initialises a...
a856046e-d05b-4e8b-af1b-acec0bb4516e
4
public static Population evolvePopulation(Population pop) { Population newPopulation = new Population(pop.size(), false); // Keep our best individual if (elitism) { newPopulation.saveIndividual(0, pop.getFittest()); } // Crossover population int elitismOffset; if (elitism) { elitismOffset = 1...
42ef81ce-d28c-4f09-ab34-dc300a587be1
4
public static int max_min_number(int[][] grid) { int path[][] = new int[grid.length][grid[0].length]; int col, row; row = grid.length; col = grid[0].length; path[0][0] = grid[0][0]; for (int i = 1; i < row; i++) path[i][0] = Math.min(path[i-1][0],grid[i][0]); for (int j = 1; j < col; ...
0629d3e9-0353-4f4d-b5b6-c10c86d8139d
5
public Object readConst(final int item, final char[] buf) { int index = items[item]; switch (b[index - 1]) { case ClassWriter.INT: return new Integer(readInt(index)); case ClassWriter.FLOAT: return new Float(Float.intBitsToFloat(readInt(index))); case ClassWriter.LONG: return new Long(readLong(index)...
31d89cc6-a120-4400-9b06-d8f77d25c5c8
6
public void makePowerups() { Random rand = new Random(); /*Clear the powerup vector*/ powerups.clear(); /*Go through every brick and check which bricks should contain powerups*/ for(Brick brick : bricks) { /*The brick should contain a powerup*/ if(rand.nextFloat() <= POWERUP_PROB) { /*A...
15ea98d9-2d3c-452e-a18b-30e53846f018
6
protected void readAttributes(XMLStreamReader in) throws XMLStreamException { String newTypeId = in.getAttributeValue(null, "unit"); if (newTypeId == null) { newUnitType = null; } else { newUnitType = getSpecification().getType(newTypeId, UnitType.class); ...
d5dd0f5e-1610-4f6f-b0fb-c5ecc0ff75ba
7
private static HashMap<String, List<Integer>> getTaxaMap( int level) throws Exception { HashMap<String, List<Integer>> map = new HashMap<String, List<Integer>>(); BufferedReader reader = new BufferedReader(new FileReader(new File( ConfigReader.getGoranOct2015Dir() + File.separator + "PC_0016 Metagenomics ...
b412af02-f22d-47d0-bdd0-b018406b4d9f
7
@Override public void setAllMap(Map<? extends K, ? extends Collection<? extends V>> map) { for (Map.Entry<? extends K, ? extends Collection<? extends V>> en : map.entrySet()) { setAll(en.getKey(), en.getValue()); } }
aa9df648-0aa8-47da-a872-b35ae94aa7e2
6
final void close() throws IOException { if (!closed) { if (fieldsStream != null) { fieldsStream.close(); } if (isOriginal) { if (cloneableFieldsStream != null) { cloneableFieldsStream.close(); } if (cloneableIndexStream != null) { cloneableIndexS...