method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
d0d57463-b711-43aa-86e9-89bbe8cf280f
4
public InternetHeaders getControlHeaders () { final InternetHeaders headers = new InternetHeaders(); headers.addHeader(_name.getField(), _name.getFieldValue()); headers.addHeader(_version.getField(), _version.getFieldValue()); headers.addHeader(_section.getField(), _section.getFiel...
7d56611a-0604-4ce4-ac99-b8ccd169462a
8
public void Update() { //the following all increase the speed as a key is pressed // Calculating speed for moving up if (Canvas.keyboardKeyState(KeyEvent.VK_W)) { if (speedY >= TOP_SPEED * - 0.5) { speedY -= speedAccelerating; } else { sp...
2c92cfc9-4b86-41b4-a36b-55cc4dc41942
5
double getCharge() { double result = 0; switch (getMovie().getPriceCode()) { case Movie.REGULAR: result += 2; if (getDaysRented() > 2) result += (getDaysRented() - 2) * 1.5; break; case Movie.NEW_RELEASE: result += getDaysRented() * 3; break; case Movie.CHILDRENS: result += 1.5; if (getDaysRented() > 3) r...
db1786d5-09a1-42fa-8737-cc3f9c1ccf0c
3
public static String encrypt(final String text) { String encryptedText = null; TripleDesCipher cipher = new TripleDesCipher(); cipher.setKey("GWT_DES_KEY_16_BYTES".getBytes()); try { encryptedText = cipher.encrypt(String.valueOf(text)); } catch (DataLengthException e1) { e1.printStackTrace(); /...
e9db75a9-df6a-477f-90a2-61cde805c353
5
@SuppressWarnings ("unchecked" ) public ReflectMethod( Method method ) { Class<?>[] parameters = method.getParameterTypes(); int calculatedMaxSize = 0; reflects = new Reflect[parameters.length]; for (int i = 0; i < parameters.length; i++) { Reflect<Object> r...
171c623d-2a80-4868-ac44-8b3e3735cffd
1
@Override public boolean equals(Object o) { Point other = (Point)o; return x==other.x && y==other.y; }
f12f11c9-5db4-4e5d-a204-d11494f2eb67
1
private int getBowlScore(int[] bowl) { int score = 0; for (int i = 0; i < NFRUIT; i++) { score += bowl[i] * mPreferences[i]; } return score; }
b90b0aa3-d2eb-42f4-baf2-89a68acfd19b
5
public static double[] doLinearRegressionFromTo(int start,int end,double[][] args) //input int start, int end { //input double[1]=array of prices double[] answer = new double[3]; int ...
ca5ec8c6-bd91-4ea4-b646-9ec7deb4d802
6
public void add(T element) { // create a node for that element Node z = new Node(); z.key = element; Node y = null; Node x = root; // the root // loop while x is not null while (x != null) { // set y to x y = x; // compare the key of the element to be inserted with x int compare = z.key.comp...
fd3b38dd-842f-4d7e-90be-b8e748dc9033
2
@Test public void delMinReturnsCorrectOrderWithRandomInput() { Random r = new Random(); int[] expected = new int[100]; for (int i = 0; i < 100; i++) { int randomInteger = r.nextInt(5000); h.insert(new Vertex(0, randomInteger)); expected[i] = randomInteger;...
68013397-8c4c-4250-8026-34a19b239a35
1
public void doDelimitedWithPZMapErrors() { try { final String mapping = ConsoleMenu.getString("Mapping ", DelimitedWithPZMapErrors.getDefaultMapping()); final String data = ConsoleMenu.getString("Data ", DelimitedWithPZMapErrors.getDefaultDataFile()); DelimitedWithPZMapErro...
61a229a6-3140-4018-b4a9-fc9ba2fdac4e
5
@Override public List<Membre> findAll() { List<Membre> listM = new ArrayList<Membre>(); Statement st = null; ResultSet rs = null; try { st = this.connect().createStatement(); rs = st.executeQuery("select * from Membre"); System.out.println("recherc...
77294e04-9d16-4502-840c-16fb4af525d8
3
@Override public List<String> logInBuyer(String name, String passwd) { loggerMediator.info("Log in buyer " + name); List<String> serviceList; stateMgr.setBuyerState(); serviceList = stateMgr.getServiceList(name); if (serviceList!= null && !serviceList.isEmpty()) if (!logInUser(name, passwd, UserTypes....
52cf570b-34f7-457e-9d43-e152d712e358
0
public String getSector() { return Sector; }
a77308d1-016c-43e2-86a4-43ee5e93ad56
2
public boolean execGo(Direction d) { Command c = new GoCommand(d); if(c != null && c.execute()) { saveGameState(c); return true; //moved } return false; //not moved }
3a1bc069-b6e9-40f2-8c64-465af57c6809
0
private String getName() { return "RemoteServerConnection [" + name + ", Port: " + port + "]"; }
1a8749ac-2a10-4ebc-97ab-8c151366d4c2
5
private void tbListaClientesKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tbListaClientesKeyReleased System.out.println("Clicando"); if(evt.getKeyCode() == KeyEvent.VK_SPACE ){ try { concluido = true; this.dispose(); } catch...
839657e1-bc63-46e2-9c6a-cbf82781cc29
9
public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) { switch (ruleIndex) { case 1: return statement_list_sempred((Statement_listContext)_localctx, predIndex); case 8: return or_expression_sempred((Or_expressionContext)_localctx, predIndex); case 9: return and_expression_sempred((And_ex...
0655eed5-b202-4758-a841-a5e07197abad
3
private void chooseFile(final int whichFile) { final JFileChooser fileChooser = new JFileChooser(); fileChooser.showOpenDialog(this); File selectedFile = fileChooser.getSelectedFile(); if (selectedFile != null) { if (whichFile == 1) { targetBehaviorTxt.setText(fileChooser.getSelectedFile().getAbsolutePat...
d778901c-0e97-462d-a24a-55e10466b70a
6
private void InitializeComponents() { //Window Settings setSize(500, 300); setDefaultCloseOperation(EXIT_ON_CLOSE); //Main Panel pnlLobby = new JPanel(new GridLayout(1, 1)); pnlLobby.setBackground(Color.WHITE); this.add(pnlLobby); ...
6c0918e9-e74b-49c9-b7c8-1a17d3f48f27
5
public static void doEverything(int size, float scale, final int initialDelay, final int generationGap, final int redrawGap, final AutomataSheet firstSheet) { final CellFrame frame = new CellFrame(firstSheet); frame.setScale(scale); frame.setVisible(true); final Switch isRunning = new Switch...
399c45d3-7866-4c68-b142-4814c5e2c309
9
private static void addAlterStatistics(final PrintWriter writer, final PgTable oldTable, final PgTable newTable, final SearchPathHelper searchPathHelper) { @SuppressWarnings("CollectionWithoutInitialCapacity") final Map<String, Integer> stats = new HashMap<String, Integer>(); ...
18e9abec-6c57-4175-a9f6-ec51c3a6f427
1
@Override public void run() { for (int i = 0; i < COUNT; i++) { System.out.println("Loop:" + name + ", iteration:" + i + "."); } }
b05abf91-c29f-4acd-b22c-621decd68e44
7
@RequestMapping(method = RequestMethod.GET) public String generalTree(ModelMap map) { if (Feat.getFeats().isEmpty()) { Feat.loadFromSQL(); } ArrayList<FeatNode> nodes = new ArrayList<FeatNode>(); int count = 0; if (FeatNode.getNodes().isEmpty()) { ...
a47ef82f-0995-48c5-a9b9-a59119141e12
5
public static boolean selectItem(final int index) { if (index < 0) return false; WidgetChild[] boxes = getList(BOX_LIST); return getCurrentIndex() == index || index < boxes.length && boxes[index].getTextureId() != -1 && boxes[index].click(true) && new TimedCondition(1400) { @Override public bool...
62f04f8a-584e-482b-9477-b1a0b218adbc
1
public void updateUI() { super.updateUI(); if (titleLabel != null) { updateHeader(); } }
3a47822d-81bb-4a8b-9128-0ab2fe93f164
0
@Test public void EnsurePathIsParsedCorrectly() { Path path = new Path("alan/likes/warbyparker"); String patharray[] = path.getPathArray(); assertEquals(3, patharray.length); assertEquals("alan", patharray[0]); assertEquals("likes", patharray[1]); assertEquals("warbyparker", patharray[2]); }
87b4a153-a110-4d82-8fb3-173c91c910e2
8
private HashSet<String> getMatchesOutputSet(Vector<String> tagSet, String baseURL) { HashSet<String> retSet=new HashSet<String>(); Iterator<String> vIter=tagSet.iterator(); while (vIter.hasNext()) { String thisCheckPiece=vIter.next(); Iterator<Pattern> pIter=patternSet.iterator(); boo...
d380f2a1-fb21-48e3-b8c1-eb8a3dc22b5d
6
@Override public void actionPerformed(ActionEvent e) { String action = e.getActionCommand(); JButton buton; switch (action) { case "enviar": AudioChatService.escribirMensaje(); break; case "cambiarNombre": AudioChatService.cambiarNombre(); break; case "cambiarNombreCanal": AudioChatService....
0ac83580-1491-4f1f-ba8f-869c0b4753b7
2
private void setRange(Range newRange) { if (range != null) { range.clearDisplay(); } range = newRange; if (range != null) { range.display(); } }
c72e236c-0217-42e2-84e7-1d9c92095ca1
3
public int findEstimate(int k) { for (int i = 0; i < msgs.length; i++) { if (msgs[i] != null) { if (msgs[i].getDeltaP()[k] != -1) { return msgs[i].getDeltaP()[k]; } } } return -1; }
bff470cc-fda8-4352-81bb-b2cd86b46090
7
@Override public void computeFitness() { this.fitness = 0.0; AiInterface opponent = MinichessBeatRandCreature.globalRandomAi; boolean playAsWhite = GPConfig.getRandGen().nextBoolean(); int numOpponents = GPConfig.getTournySize() - 1; for (int i = 0; i < numOpponents; i...
0b312c27-3dc2-4388-b752-de3422efb051
2
private static String mangle(String nm) { StringBuilder buf = new StringBuilder(); for(int i = 0; i < nm.length(); i++) { char c = nm.charAt(i); if(c == '/') buf.append("_"); else buf.append(c); } return(buf.toString()); }
a51b8d71-883f-45c9-9a9a-6e97cdf5a3cd
2
private static String getTime(String time) { time = time.split(" ")[3]; time = (Integer.parseInt(time.split(":")[0]) > 12 ? Integer.parseInt(time.split(":")[0])-12 : time.split(":")[0]) + ":" +time.split(":")[1] +(Integer.parseInt(time.split(":")[0]) > 12 ? " PM" : " AM"); retur...
e8a0ba54-e989-42d8-94dc-fd3fa70860bf
6
private void convertRGBtoHSV() { float r; float g; float b; float max, min; float hsv[] = new float[3]; float delta; for (int i = 0; i < imageSize; i++) { r = redPixel[i]; g = greenPixel[i]; b = bluePixel[i]; r /= 25...
f1f93991-a0a6-4175-82b4-9523b734d1ff
2
private void setUpLabelImage(JLabel label, String image, int width, int height){ BufferedImage titleImage; try{ if(bookLayout == 1){ titleImage = ImageIO.read(new File("resources/buttons/"+image)); } else{ titleImage = ImageIO.read(new File("resources/buttons" +bookLayout + "/"+image)); } Ima...
e786c3fe-d86a-43ba-9b0a-d763e8be361a
8
private void readExcludedPackages() { fExcluded= new Vector(10); for (int i= 0; i < defaultExclusions.length; i++) fExcluded.addElement(defaultExclusions[i]); InputStream is= getClass().getResourceAsStream(EXCLUDED_FILE); if (is == null) return; Properties p= new Properties(); try { p.load(i...
5c60737a-4313-4975-80a5-5510af906cdc
1
public JobMaster (JobType whatToDo, AbstractPage rootPage, int threadsNumber) { if (threadsNumber <= 0) threadsNumber = CORETHREADS_NUMBER; executor = Executors.newFixedThreadPool(threadsNumber); assert (executor instanceof ThreadPoolExecutor); submittedPairs = new ConcurrentLinkedQueue<>(); this.whatT...
cfa4b079-8530-4de3-ba63-811d3dbc234c
0
public void pidWrite(double output) { set(output); }
5da15ba1-3bf6-4e23-bc77-d65ccc5cb815
5
public void transceive() throws IOException { String received; br = new BufferedReader(new InputStreamReader(newSS.getInputStream())); received = br.readLine(); String[] temp; PrintWriter pw = new PrintWriter(newSS.getOutputStream(), true); switch (received.charAt(0)) { case ('1'): pw.println(imdb.ge...
a6a78332-3344-4980-aa73-ac6e2cf60832
3
protected Resources() { this.bagFields = new HashSet<Field>(); for (Field f : getClass().getFields()) { if (Modifier.isPublic(f.getModifiers()) && ResourceBag.class.isAssignableFrom(f.getType())) { this.bagFields.add(f); } } }
92e326e4-d770-491d-996e-20d2a96e56c4
7
public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); System.out.println("Type gameboard config:"); String input = keyboard.nextLine(); Game game = new Game(input); System.out.println("Game initialized"); System.out.println(); System.out.println("Use the following ke...
96042a5f-27a8-4b57-b278-bf82ef84d313
2
public Markers randomIntervals(int numIntervals, int maxStart, int maxLength, int numChromo) { Markers ints = new Markers(); for (int ch = 1; ch <= numChromo; ch++) { for (int i = 0; i < numIntervals; i++) { int start = rand.nextInt(maxStart); int end = Math.min(start + rand.nextInt(maxLength), maxStart...
953133e7-2d94-4585-b415-14714525dcfe
5
public boolean step() { board[knight.y][knight.x] = VISITED; Point[] possibleMoves = getPossibleMoves(knight.x, knight.y); Random random = new Random(System.nanoTime()); if (possibleMoves.length > 0) { Point nextMove = possibleMoves[0]; int numOfPossibleMoves = getNumberOfPossibleMov...
45639509-b1f1-43b2-bbba-3a85541fc3a9
2
private Position getTertiaryPowerFailurePosition(Position secondaryPos, int directionInt) { // Calculate T1 Position final Position squareOne = (Direction.values()[directionInt]).newPosition(secondaryPos); // Calculate T2 Position final int dirIntTwo = (directionInt - 1 < 0) ? Direction.values().length - 1 :...
273f5792-9325-4d8c-b8ac-d7ce17589fc5
4
public void visitIf(If node, String args){ pp(indent() + (args.compareTo("elsif") == 0 ? "ELSIF " : "IF "), node.getStyle()); node.getCond().accept(this, args); pp(" THEN\n", node.getStyle()); n++; node.getIfBlock().accept(this, args); n--; if (node.getElseBlock() != null) { if(node.getElseBlock().getC...
b3bd7655-d483-435e-bdad-89cb0323cfbb
5
public static SwagStack stringToSwagStack(String swagString) { String[] swagPieces = swagString.split(","); SwagStack swagStack = new SwagStack(Integer.valueOf(swagPieces[0])); if (!swagPieces[1].equals("0")) { if (swagPieces[1].contains("-")) { Stri...
67b9c153-e9f9-46a0-9872-49d018361a76
2
@Override public void execute() { long next; synchronized (this) { while (frequence.addAndGet(0) <= 0) { try { wait(); } catch (InterruptedException e) { e.printStackTrace(); } } } next = System.currentTimeMillis() + 1000 / frequence.get(); getSimulateur().actionPerformed(null, ...
4d1e2624-3afb-44c3-b76f-b5606c3a8c5b
4
private void startDialog() { isRunning = true; checkFiles(); //Checks if all Data directories exist. dmPhase = new DMPhase(); //Creates the DMPhase, which loads all data //Goes through the StartDialog. do { phase.setPhaseResult(this); phase = phase.nextPhase(this); } while(!userLoggedIn && isRunning);...
c030296a-f828-42a2-9877-ed3d156701b4
3
public void busquedaDesordenada(T x){ Nodo<T> q = this.p; while(q.getLiga() != null && q.getValor() != x){ q = q.getLiga(); } if(q == null){ System.out.println("No se encontro el valor"); }else{ System.out.println("Se encontro el valor dentro de la lista"); } }
6aca040e-3779-4565-9caa-ab6ded5b5f64
8
@Override public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) { if(command.getName().equalsIgnoreCase("fchat")){ Player player = null; if(sender instanceof Player) player = (Player) sender; if(player != null){ if(!plugin.hasPermission(player, "default...
4fe13945-c3d0-4de7-9009-ce4328fcdb55
6
private void nextTurn() { // Used to switch turns. Called each time a valid move is made. if (hasWon(turn)) { // Check to see if the move the current player made was a winning move. gameOver = true; // If it was, then set gameOver to true; sendWin(turn); // Also, display a window informing the user(s) of wha...
5ef3e096-50a0-4c62-9597-f0180c679894
7
public static void main(String[] args) { // TODO Auto-generated method stub try { String pathName = args[0]; // takes in the path name from the command line File ipAddresses = new File(pathName); Scanner input = new Scanner(ipAddresses); MyCountingLinkedLists<String> list = new MyCountingLinkedLists<Str...
cb342a5c-4e2b-4c74-baec-f9c9cbdf4d86
1
public boolean isEnded() { if (endedInt == "1") { return true; } else { return false; } }
67224b39-5dd1-4bcf-bc0a-0e9a0f9e0790
4
@Override public void run() { while (true) { try { UpdChecker checker = new UpdChecker(); Map<String, String> updates = checker.check(); if (updates.size() > 0) { //SMS sending quantity of new entries at sl...
8e1b5423-7157-45d8-a143-e3f2c83c8cd6
0
public IrcClient(AprilonIrc plugin, String name) { this.Parent = plugin; this.Name = name; }
06dd8408-d0a0-4f9a-abfc-3cbe161e2a10
7
public boolean insertEntry(String name, String file) { System.out.println(this.getClass().toString()+"::insertEntry("+name+","+file+")"); fileName = makeSQLCompatible(file); // if file already in list, stop if(getIndexOf(file) != -1)return true; //System.out.println("In insert: ar...
1fa3d9d2-eedf-4622-b108-16768c93ea96
3
public Iterator getDictKeys() throws IOException { if (type == INDIRECT) { return dereference().getDictKeys(); } else if (type == DICTIONARY || type == STREAM) { return ((HashMap) value).keySet().iterator(); } // wrong type return new ArrayList().iterator...
83305869-1088-4b30-a963-7c54dd937464
9
protected void actionPerformed(GuiButton par1GuiButton) { if (!par1GuiButton.enabled) { return; } if (par1GuiButton.id == 5) { if (Minecraft.getOs() == EnumOS.MACOS) { try { System.out.pr...
10935acb-dc2c-4859-9524-a1e023ec1c11
6
public void handleShading(int intensity, int falloff, int lightX, int lightY, int lightZ) { for (int triangle = 0; triangle < triangleCount; triangle++) { int x = triangleX[triangle]; int y = triangleY[triangle]; int z = triangleZ[triangle]; if (triangleDrawType == null) { int colour = triangleColo...
c6a96b1f-a161-46b3-b890-e6b01bac725a
5
public static void maxHeapify(int[] A, int i, int heapSize){ int left = 2 * i + 1; int right = 2 * i + 2; //find the largest in A[i],A[left],A[right] int largest = i; if(left < heapSize && A[left] > A[largest]){ largest = left; } if(right < heapSize && A[right] > A[largest]){ largest = right; }...
4914d8d1-34a0-4955-a7a4-c46745763b1d
2
public static void main(String[] args) { String fullQuanlifiedFileName ="D:\\MyEclipseGen.java"; // "src/com/xin/A.java"; JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); try { FileOutputStream err = new FileOutputStream("D:\\err.txt"); int compilationResult = compiler.run(null...
54b3746a-8469-4a78-ad95-b2e0c823e165
4
private boolean normal(Publish p) { boolean sent = false; List<SubscriberParent> list = p.mapping.get(p.message.getClass()); if (list == null) { return false; } for (SubscriberParent sp : list) { Subscriber<?> s = sp.getSubscriber(); if (!predicateApplies(s, p.message)) { continue; } s.rece...
a418f980-d66a-458d-a6ab-a5b76eaa6c8b
0
private StopRangeComparator() { }
ee03fd4d-fd1e-4ea3-b833-961329754194
3
private boolean simula (int indexIniziale) { // indica se e' avvenuto un loop infinito: boolean loop = false; // cellaCorrente assume il valore della cella da cui deve iniziare la simulazione della macchina this.indexCorrente = indexIniziale; while (this.indexCo...
f3e4a7e7-5575-42a2-8039-9519e4830fab
4
public void run() { while (clientSocket.isConnected()) { try { BufferedReader inputStream = new BufferedReader( new InputStreamReader(clientSocket.getInputStream())); String message = inputStream.readLine(); System.out .println("[Server] Message received : " + message); if (mess...
9ca21063-598d-4966-a42b-e531443079b1
6
public static String escape(String string) { StringBuilder sb = new StringBuilder(string.length()); for (int i = 0, length = string.length(); i < length; i++) { char c = string.charAt(i); switch (c) { case '&': sb.append("&amp;"); break...
0ee40779-cad9-49f1-884b-49ef1145d863
9
@RequestMapping(value = "/users.htm", method = RequestMethod.GET) public ModelAndView setupListForm( @RequestParam(required = false, value = "tool") String tool, HttpServletRequest request, ModelMap model) { String vue = Consts.INDEX_VUE; List<User> users = null; ...
0789cf35-6024-4bbb-aead-2cd9b2be83cf
3
public void press(String msg, boolean cap){ if(!selected) return; if(text.length() >= length) return; if(cap) msg = msg.toUpperCase(); text = text + msg; wait = 10; }
b84437d2-5a84-476e-bcb3-8d4b48b92282
7
private void buy(Player hero) { System.out.println("What will you buy? Current Gold:" + hero.getGold()); //Prints the inventory of the shop String inven = ""; for (int i = 0; i < getInventory().length; i++) { inven += "[" + i + "]" + getInventory()[i].getName() + "(" + getIn...
9f02b73d-3dd4-49f3-8c66-fae5e5bbfb84
6
public void setImageLevel(TransparentImageLevel lev, int index) { if (index < 0 || index > MAX_IMG_LEVELS) { throw new IllegalArgumentException("Bad index for setImageLevel:" + index); } if (imgLevels[index] == null && lev != null) { // new one added numImgLev...
923c83f7-1ce5-4ea4-ae58-289235195f55
9
@Inject public void schedule( Scheduler scheduler ) throws Exception { if ( cronExpression == null && trigger == null ) { throw new ProvisionException( format( "Impossible to schedule Job '%s' without cron expression", jobClas...
b41a0f97-a7b0-4edf-812d-965210059ef4
7
public void move(int xa, int ya) { if (xa != 0 && ya != 0) { move(xa, 0); move(0, ya); return; } if (xa > 0) setDir(1); if (xa < 0) setDir(3); if (ya > 0) setDir(2); if (ya < 0) setDir(0); if (!collision(xa, ya)) { x += xa; y += ya; xL += xa; yT += ya; xR += xa; yB += ya; }...
fb01c10d-0753-42b9-bc42-092b06c2485f
4
private ArrayList<String> extractNGrams() { ArrayList<String> list = new ArrayList<String>(); NGram ngram = new NGram(); for(int i=0;i<text.length();++i) { ngram.addChar(text.charAt(i)); for(int n=1;n<=NGram.N_GRAM;++n){ String w = ngram.get(n); ...
e007a7ba-05b4-42c9-8e1f-50ffd29bbd3f
2
private Main(int rack_size, Player ai) throws Exception{ Main.rack_size = rack_size; WIN_HEIGHT = rack_size*Card.height+(rack_size-1)*Board.card_pad+2*Board.border_pad_ver+50; if (WIN_HEIGHT < 300) WIN_HEIGHT = 400; player_ai = ai; player_human = new PlayerGUI(this); game = Game.create( new Player[]{p...
71d96740-4eb4-41c3-ae57-b4ba766ddf7e
6
public static Class<? extends TrapEvent> fromString(String s) { if(s.equalsIgnoreCase("attack")) return TrapEventAttack.class; else if(s.equalsIgnoreCase("lpincrease")) return TrapEventLPIncrease.class; else if(s.equalsIgnoreCase("lpdecrease")) return TrapEventLPDecrease.class; else if(s.equalsIgnoreCa...
ec4a7c65-1694-4452-9c01-a6296d3f9c6b
2
public long askID() { System.out.println(ASK_ID); if (terminal.hasNext(ID_PATTERN)) {// verificamos que sea un id valido return Long.parseLong(terminal.nextLine()); } else if (terminal.hasNext(ID_PATTERN_SMALL))// para ahorrar tiempo se usan ids de tres digitos { ...
de712829-44b1-4b3a-ac0a-b580a75d7057
8
static Object getAnnotationType(Class clz, ClassPool cp, AnnotationsAttribute a1, AnnotationsAttribute a2) throws ClassNotFoundException { Annotation[] anno1, anno2; if (a1 == null) anno1 = null; else anno1 = a1.getAnnotati...
b627298c-5f40-431e-8e15-a3e5bb92d272
8
@Test public void testCancelAllJobs() { System.out.println("cancelAllJobs"); final Counter counter = new Counter(); c.setAssignmentListener(new AssignmentListener() { boolean run = true; @Override public void receiveTask(Assignment task) { ...
d67da17c-5336-4900-98bb-571d15124474
5
public SimulationEvent(int eventType, Object eventData) { if (eventType != EVENT_SIM_STARTED && eventType != EVENT_SIM_DONE && eventType != EVENT_SIM_CANCELLED && eventType != EVENT_SIM_ERROR && eventType != EVENT_SIM_PROGRESS ) { throw new...
e8ba81c5-cf6e-4573-9f53-cf16905d1c90
9
public void laufen(int geschwindigkeit, int delta) { // Macht Bewegung auf Y Ebene möglich y_Pos += speed_v; // Hier steht die Bewegung auf horizontaler Ebene. // Pfeiltaste links if (steuerung.isKeyDown(Input.KEY_A)) { x_Pos = x_Pos - geschwindigkeit; } // Pfeiltaste rechts if (steuerung.isKeyDown...
7c424c9d-6b3c-4d8a-8629-a3c807734413
8
private static int decode4to3( byte[] source, int srcOffset, byte[] destination, int destOffset, int options ) { // Lots of error checking and exception throwing if( source == null ){ throw new NullPointerException( "Source array was null." ); } // end if ...
16cddea7-43d0-4d32-80b9-0f01cd0e01b2
7
public void initToNull() { for(int j = 0; j < anInt437; j++) { for(int k = 0; k < anInt438; k++) { for(int i1 = 0; i1 < anInt439; i1++) groundArray[j][k][i1] = null; } } for(int l = 0; l < anInt472; l++) { for(int j1 = 0; j1 < anIntArray473[l]; j1++) aClass47ArrayArray474[l][j1] = ...
a2a1a7fe-3c2b-421f-b65f-24f0d2f2efb8
0
public Medicament() { }
d74447c1-1119-48ab-ba50-e0d82bb0616c
1
public void award_bonus(BigInteger threshold, BigInteger bonus) { if (getBalance().compareTo(threshold) >= 0) deposit(bonus); }
9a1b16d1-eacc-450d-8fce-7ad6472ac427
0
public void setId(String id) { questId = Integer.parseInt(id); }
e1f9d7cc-3849-4345-8282-bf390cf6f5f4
1
@Test public void haltInstrInvalidOpcodeTest() { try { instr = new HaltInstr(Opcode.LOAD); } catch (IllegalStateException e) { e.getMessage(); } assertNull(instr); //Instruction should only be instantiated with HALT opcode }
e64e3041-1456-4a98-9050-33fb29f2d77b
3
public boolean jsFunction_waitStartMoveGob(int gob, int timeout) { deprecated(); int curr = 0; if(timeout == 0) timeout = 10000; while(!JSBotUtils.isMoving(gob)) { if(curr > timeout) return false; Sleep(25); curr += 25; } return true; }
1a8dd2ca-cfcb-494d-a301-b35873cfa3ab
7
public void paint(GC gc, int width, int height) { if (!example.checkAdvancedGraphics()) return; Device device = gc.getDevice(); // array of coordinate points of polygon 1 (region 1) int [] polygon1 = new int [] {10, height/2, 9*width/16, 10, 9*width/16, height-10}; Region region1 = new Region(device); region1.a...
e5127c03-72b8-4897-a04b-def17e37b52f
7
public static void processWords(String str) throws FileNotFoundException { //String str="<DOC><DOCNO>1</DOCNO><TITLE>experimental investigation of the aerodynamics of awing in a slipstream .</TITLE><AUTHOR>brenckman,m.</AUTHOR><BIBLIO>j. ae. scs. 25, 1958, 324.</BIBLIO><TEXT> an experimental study of a wing in a pr...
9d35dbf7-4263-4c00-8be1-3b53cbe38e1a
7
protected BallNode mergeNodes(Vector<TempNode> list, int startIdx, int endIdx) throws Exception { for(int i=0; i<list.size(); i++) { TempNode n = (TempNode) list.get(i); n.anchor = calcPivot(n.points, new MyIdxList(), m_Instances); n.radius = calcRadius(n.points, new MyIdxList(), n.anchor...
84a94239-cbb8-44dc-b56c-53bee70783be
6
public String disparar() { String resultado = ""; if(numElementos > 0 ) { Random rnd = new Random(); int fila = rnd.nextInt(NUM_FILAS); int columna = rnd.nextInt(NUM_COLUMNAS); int porcentaje = rnd.nextInt(100); NaveAlien n1 = listaNavesAliens[fila][columna]; if(n1 != null ) { ...
2550bc45-d857-40b7-9e3e-296a7405d8a6
5
public AccountServiceError addUser(String login, String password) { if (isConnectionClosed()) openConnection(); if (isConnectionClosed()) return new AccountServiceError(AccountServiceError.Type.DB_noConnection); UserDataSetDAO dao = new UserDataSetDAO(dbconn); ...
20078029-36e1-481c-918f-4d7021a695e6
3
public String getEssensrationText() { String ration = ""; if ( this.essensration == 1 ) ration = "halb"; if ( this.essensration == 2 ) ration = "voll"; if ( this.essensration == 4 ) ration = "doppelt"; return ration; }
5ca74968-8c1c-46dd-ada7-33386a92bb68
2
public static File showOpenFileDialog(Frame parentFrame, String title){ FileDialog fileDialog = new FileDialog(parentFrame, title); fileDialog.setIconImage(MAIN_ICON.getImage()); fileDialog.setDirectory(HOME_DIRECTORY); fileDialog.setVisible(true); String directoryName = fileDial...
863092f2-d863-48d3-8b7f-feee0db114e6
6
private void writeOutput(List<List<Gate>> layersOfGates) { BufferedWriter fbw = null; try { fbw = new BufferedWriter(new OutputStreamWriter( new FileOutputStream(outputFile), charset)); int[] intHeaders = circuitParser.getOutputHeader(layersOfGates); String header = ""; for (int i = 0; i < intHead...
43f61318-544d-4986-beb1-38ff72a456e1
7
public Object handle(Message req) throws Exception { if(server_obj == null) { log.error(Util.getMessage("NoMethodHandlerIsRegisteredDiscardingRequest")); return null; } if(req == null || req.getLength() == 0) { log.error(Util.getMessage("MessageOrMessageBuffe...
077d6b29-b0df-4632-a2e9-e5496d33640e
0
public String getLibelle() { return libelle; }
a03b5710-3ea0-48b2-9f13-8cacc4f3ae18
1
public HunterPanel(World world) { this.model = world.getHunterList(); this.setBorder(new TitledBorder("Hunter")); this.setLayout(new FlowLayout(FlowLayout.LEFT));//new BorderLayout()); this.setPreferredSize(new Dimension(250,350)); this.setBounds(0, 0, 250, 350); //this.setSize(250,350); rowData = ne...
2afe8406-1978-4171-8a37-62bd54abfc55
6
public String winner() { int blackcount = 0; int whitecount = 0; for (int[] row : board) { for (int value : row) { if(value == B) blackcount++; else if(value == W) whitecount++; ...