method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
4ab685d7-67c2-4bf2-a579-1355a0ae29c3
1
public void sendMessage(String msg) { try { writer.write(msg+"\n"); writer.flush(); } catch (IOException e) { System.out.println("Message send failed"); e.printStackTrace(); } }
5f9bb48e-ee88-4ddf-a969-78cc691c0b17
0
public static boolean getBooleanValue(String attr) { return Boolean.parseBoolean(prop.getProperty(attr)); }
05c2bdcf-357e-4cc7-84e9-9ea336301939
2
public Deck() { // Create an unshuffled deck of cards. deck = new Card[52]; int cardCt = 0; // How many cards have been created so far. for ( int nSuit = 0; nSuit <= 3; nSuit++ ) { for ( int nValue = 1; nValue <= 13; nValue++ ) { deck[cardCt] = new Card(nValue,nSui...
33f7cb3a-21c0-4152-b6fd-b772106acd9f
5
private Class<?> eliminateEnumSubclass(Class<?> cls) { Class<?> sup = cls.getSuperclass(); if (sup != null && sup.getSuperclass() == Enum.class) { return sup; } return cls; }
491fc4d2-337b-41c7-afaf-24ca0696d555
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 feel. * For details see http://down...
8c15fb58-ce13-4678-8fe3-68569d0b8493
7
@Override public void run() { try { this.mapper = new Mapper("mapper.yaml"); } catch (FileNotFoundException e) { e.printStackTrace(); return; } JarLoader.load("minecraft_server.jar"); this.playerList = new ReflxPlayerList(this); t...
1670971b-62dc-4647-9006-07156497b21d
7
private Object[] scanBlockScalarBreaks(int indent) { // See the specification for details. StringBuilder chunks = new StringBuilder(); Mark endMark = reader.getMark(); int ff = 0; int col = this.reader.getColumn(); while (col < indent && reader.peek(ff) == ' ') { ...
a8c424b7-aac8-45da-b00d-e7f95b27c5dd
8
final void method2380(AbstractToolkit var_ha, int i, boolean bool, Class318_Sub1 class318_sub1, int i_0_, byte i_1_, int i_2_) { do { try { anInt9970++; if (i_1_ > -106) method2402(-5, (byte) 56); if (!(class318_sub1 instanceof Class318_Sub1_Sub1_Sub2)) break; Class318_Sub1_Sub1_Sub2...
18da391a-6962-4e1a-9c45-0316077c474f
5
public void paintComponent(Graphics g){ super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; AffineTransform DEFAULT = g2.getTransform(); if(first!=null && !mazzo.isEmpty()) first.drawCartaBack(g2); if(!carteSpostate.isEmpty()){ ...
44581567-8fb0-4841-b721-38e5c7f70b21
5
public boolean verify(JComponent input) { boolean allow = true; if (input instanceof JFormattedTextField) { JFormattedTextField textField = (JFormattedTextField)input; AbstractFormatter formatter = textField.getFormatter(); if (formatter != null) { Str...
d1220a09-ccbd-4420-9bab-c3a9aa57d8b8
7
private void handleOptions(int keyCode) { switch (keyCode) { case DeviceSpecification.LSK: case DeviceSpecification.CLEAR: if (applicationState.lastState() == ApplicationState.MAIN_MENU) { applicationState.setState(ApplicationState....
25c2e5ce-b6a8-462a-a5eb-83f11517818f
0
public RegularEnvironment(RegularExpression expression) { super(expression); expression.addExpressionListener(new Listener()); }
f2876f64-51af-4d37-9c79-1a8467675aac
2
protected void brew(int[] buf) { assert buf.length % 2 == 1; int i, v0, v1, sum, n; i = 1; while (i < buf.length) { n = CUPS; v0 = buf[i]; v1 = buf[i + 1]; sum = 0; while (n-- > 0) { sum += SUGAR; ...
5758ab3b-0f16-4ded-8118-7aa878d07603
3
public static boolean check(int row, int col) { for (int prev = 1; prev < col; prev++) if (board[prev] == row // Verify row || (Math.abs(board[prev] - row) == Math.abs(prev - col))) // Verify // diagonals return false; return true; }
049e0141-ef65-43c3-bcb8-e0cbe35e5be3
9
static List<String> cortarPalabras (String texto, int cantidadDeLetras){ List<String> lstFinal= new ArrayList<String>(); StringBuilder builder= new StringBuilder(); if(texto.split(" ").length > 0){ String[] arrayAux = texto.split(" "); List<String> lstPalabras= Arrays.as...
8e713911-e291-4b67-999e-4f5014b2e451
3
public double resolveCollisionY(AABB other, double moveAmtY) { double newAmtY = moveAmtY; if (moveAmtY == 0.0) { return moveAmtY; } if (moveAmtY > 0) { // Our max == their min newAmtY = other.getMinY() - maxY; } else { // Our min == their max newAmtY = other.getMaxY() - minY; } if (Math.ab...
371e98b9-0f26-41d7-983c-ecd37ec9c85a
9
@Override public void run(int iterations) { // Do iterations for (int i = 0; i < iterations; i++) { // Find the best 5 paths of the generated paths LimitedPriorityQueue lpq = new LimitedPriorityQueue(queueLimit, new Double(1)); // shortestPathLength. ArrayList<int[][]> chromosomes = getChromosom...
028d1fde-4324-4297-b19f-a3e422971a55
2
public static List<Laureate> filterByBirthYear(List<Laureate> inputList, List<String> ListOfTerms) { List<Laureate> outputList = new ArrayList<Laureate>(); // parse input, keep what matchs the terms. for (Laureate Awinner : inputList) { if (ListOfTerms.contains(Awinner.getBirth())) ...
3447723d-4439-4c9a-b3b2-da2be7394305
7
private void initializeBuffer() { if (this.BufferGraphics != null) { this.BufferGraphics.dispose(); } if (this.BufferImage != null) this.BufferImage.flush(); Object localObject; if (this.ImageContainerParent == null) { localObject = this; } else { ImageConta...
90ab1d11-6431-4653-a50b-1b3345b139fe
0
public SplashWindow(Frame f, String imgName) { super(f); this.imgName = imgName; tk = Toolkit.getDefaultToolkit(); splashImage = loadSplashImage(); showSplashScreen(); //f.addWindowListener(new WindowListener()); }
58cd3172-abec-476d-b768-8cb4f07b74ad
4
private void submit_modify_buttonActionPerformed(ActionEvent evt, String courseIDToModify) { Instructor instructor_taken; String instField = instruct_combo.getSelectedItem().toString(); instField = instField.substring(instField.indexOf("-") + 2); int instID = Integer.parseInt(instField); instructor_taken =...
64a924cd-7aed-4098-9f58-69c479b5eec6
7
private void actionGetpiece (String key, String demande, OutputStream out) throws IOException { // Passer directement le string String[] tab = demande.split(" "); Object o = _hash.get(key); if (o != null){ Fichier f = (Fichier)o; if (_estMisAssertion) System.out.println("On me demande des pièce de mon...
5e207ca5-e813-4b30-afa0-cb73f05e22f9
5
@Override public void perform(CommandSender sender, String[] args) { List<String> GymTypes = instance.getConfig().getStringList("GymTypes"); if (args.length == 2) { if (args[0].equalsIgnoreCase("List")) { for (String i : GymTypes) { if (args[1].equalsIgnoreCase(i)) { Integer coun...
b2262dd8-f1ea-4f66-9ddd-eee43bf77c77
6
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SpacePort spacePort = (SpacePort) o; if (averageStartsCount != spacePort.averageStartsCount) return false; if (name != null ? !name.equals(spaceP...
53afa0c3-551e-47de-b55a-4fd2580d96e7
5
public static List fromCollection(Collection c) { if ((c != null) && (c instanceof List)) { return (List)c; } if ((c == null) || (c.size() == 0)) { return new ArrayList(); } List list = new ArrayList(c.size()); Iterator itr = c.iterator(); while (itr.hasNext()) { list.add(itr.next()); } ...
99e59a29-443f-49b2-845a-8678186a5163
6
public static void main(String args[]) { Scanner inFile = null; try { // Create a scanner to read the file, file name is parameter inFile = new Scanner(new File(System.getProperty("user.dir") + "/src/Files/numsort.dat")); } catch (FileNotFoundException e) { System.out.println("File not found!"); // St...
e2dfaddc-0bf5-455c-a164-facb7f6d31b3
8
private final void method511(int i) { anInt1003++; for (Class348_Sub23 class348_sub23 = (Class348_Sub23) aClass356_1011.method3484(0); class348_sub23 != null; class348_sub23 = (Class348_Sub23) aClass356_1011.method3482(i + 2)) { if (class348_sub23 != aClass348_Sub23_Sub2_1001) { while (((Clas...
1b38d853-a52b-47ad-80ea-6b1e0d530c41
2
protected void setSize(int size) { if (size < 0) { size = 9; } else if (size % 9 != 0) { size += 9 - (size % 9); } this.size = size; }
9e4ec4ae-ceee-4864-8e56-08517c3b8a84
5
@EventHandler public void onUpdate(UpdateEvent e) { if (e.getUpdateType() == UpdateType.SECOND) { boolean isInHill = false; while (!isInHill) { if (enterQueue.size() > 0) { if (!arena.getCuboid().contains(enterQueue.peek().getLocation())) { Chat.sendMessage(enterQueue.remove(), Me...
91ddd324-bf9d-45c9-a555-cb9c70c8d980
7
public ListNode mergeKLists(ListNode[] lists) { if (lists == null || lists.length == 0) { return null; } Stack<ListNode> s1 = new Stack<ListNode>(); Stack<ListNode> s2 = new Stack<ListNode>(); for (int i = 0; i < lists.length; i++) { s1.push(lists[i]); ...
f3bb0c18-3905-4045-9a67-b6df12444220
9
public int ScoreHand(Card[] Hand){ int Score=0; int Aces =0; System.out.println("---------------"); System.out.println(Hand[0].Value); System.out.println(Hand[1].Value); System.out.println(Hand[2].Value); System.out.println(Hand[3].Value); System.out.println("================"); for(int x=0;x<Hand.len...
278c9105-42ed-4c43-a9d3-e7fd8e340ffc
7
public FordFulkersonAlgorithm(IWeightedGraph<N, Number> originalGraph, N source, N sink) { WeightedGraph<N, Number> graph = new WeightedGraph<N, Number>(true); List<WeightedEdge<N, Number>> edges = originalGraph.getEdges(); for(WeightedEdge<N, Number> edge : edges) { graph.addNode(edge.from); graph.ad...
01ecc010-152d-4696-8526-3f2761633e0f
1
private final void closeElement() throws IOException { if (openElement) { w.write(">\n"); } openElement = false; }
f03c56ad-27a5-4716-950c-c09971532936
7
@NonNull public void parseJSONtoMap (URL u, String name, HashMap<String, String> h, boolean testEntries, String location) { try { String json = IOUtils.toString(u); JsonElement element = new JsonParser().parse(json); int i = 10; if (element.isJsonObject()) { ...
f77b199a-81e0-4172-b2e3-e858fef27ff2
6
public String nextCDATA() throws JSONException { char c; int i; StringBuilder sb = new StringBuilder(); for (; ; ) { c = next(); if (end()) { throw syntaxError("Unclosed CDATA"); } sb.append(c); i = sb.length() -...
eaa0de8d-06f7-4c7d-b8b3-a9a3af0a2df3
2
@Override public boolean run() { verbose = true; // Load reactome data Reactome reactome = new Reactome(); reactome.setVerbose(verbose); reactome.load(reactomeDir, geneIdsFile); // Load GTEX data if (verbose) Timer.showStdErr("Loading GTEx data"); Gtex gtex = new Gtex(); gtex.setVerbose(verbose); ...
390bdbf3-8969-45a9-992a-6d23040a4ae1
6
@SuppressWarnings("rawtypes") /** * Retrieve class names implementing the given interface existing somewhere in the basePackage */ public static List<String> getClassNamesImplementingInterface(Class interf, String basePackage) { List<String> classNames = new ArrayList<String>(); try { Class[] result = get...
70c4a077-034c-4a65-bb2b-111d8548017a
7
public byte[] decrypt(byte[] textEncrypted, String key){ byte[] decrypted = null; try{ //keygenerator.init(bits); // 192 and bits bits may not be available byte[] keyPadded = new byte[bits / 8]; for(int i = 0; i < bits / 8 && i < key.length(); i++){ keyPadded[i] = (byte)key.charAt(i); } /*...
2770cdaa-b9ac-4f66-a844-65570fc079ce
1
private void initialize(boolean check) { setLayout(new GridLayout(7, 1)); numberOfFilesLabel = new JLabel("Number of Files \t:\t "); lineOfCodeLabel = new JLabel("Lines of Code \t:\t "); commentsLabel = new JLabel("Commented Lines \t:\t "); blankLinesLabel = new JLabel("Blank Lines \t:\t "); totalLinesLabel...
166c5d1a-0d72-438b-9601-2858e244ece5
3
public void MostraPesquisa(List<Usuario> usuario) { while (tmUsuario.getRowCount() > 0) { tmUsuario.removeRow(0); } if (!usuario.isEmpty()) { String[] linha = new String[]{null, null}; for (int i = 0; i < usuario.size(); i++) { tmUsuario.addRow...
d3bb6a41-31a3-467b-8a51-74330903e190
3
public int canCompleteCircuit1(int[] gas, int[] cost) { for(int i =0;i< gas.length;i++){ if(gas[i] >= cost[i]){ if(canFinish(gas,cost,i)) return i; } } return -1; }
2d9c3ecd-c260-4202-b3c7-dd5f7d88d6d7
9
private static List<String> splitIntoIndividualLocants(String locantString) { List<String> individualLocants = new ArrayList<String>(); char[] charArray = locantString.toCharArray(); boolean inBracket =false; int indiceOfLastMatch =0; for (int i = 0; i < charArray.length; i++) { char c = charArray[i]; i...
6ed2b6ce-405b-44d3-a792-f50e75b85cef
6
private void calcProduction() { Arrays.fill(productionHolder, 0); for (Pattern pattern : plan.getPatterns()) { for (int i = 0; i < problem.size(); i++) { productionHolder[i] += pattern.getProduction(i); } } cachedUnderproductionAmount = 0; ...
09e104ef-85de-4271-8477-f690e8f23e8f
0
@Test public void pisteSetXJaSetYToimivat() { p.setX(10); assertTrue("Väärä siirretyn pisteen x", p.getX() == 10); p.setY(10); assertTrue("Väärä siirretyn pisteen y", p.getY() == 10); p.setXY(new Piste(20, 50)); assertTrue("Väärä siirretyn pisteen x", p.getX() == 20);...
5411c81a-a9c4-44fc-b741-ff6f0ca1c433
0
public ConvertRegularGrammarToFSA(GrammarEnvironment environment) { super("Convert Right-Linear Grammar to FA", null); this.environment = environment; }
e4f03a71-5948-4c14-be2f-80157a8ca72d
5
public boolean saveData(String data,String dataFile) { boolean test = false; if (test || m_test) { System.out.println("Saver :: saveData() BEGIN"); } try { setFile(dataFile); PrintWriter out = new PrintWriter(this.getFile()); //try...
2e2d7b53-c54f-4d42-b7ca-a19c3d5829a2
7
public void move(int Xa, int Ya) { if (Xa != 0 && Ya != 0) { move(Xa, 0); move(0, Ya); numSteps--; return; } numSteps++; if (!hasCollided(Xa, Ya)) { if (Ya < 0) { movingDir = 0; } if (Ya > 0) { movingDir = 1; } if (Xa < 0) { movingDir = 2; } if (Xa > 0) { movingD...
ed64ce79-e953-402e-b869-22fe2c95833a
3
public void validate(Object obj, Errors errors) { PriceIncrease pi = (PriceIncrease) obj; if (pi == null) { errors.rejectValue("percentage", "error.not-specified", null, "Value required."); } else { logger.info("Validating with " + pi + ": " + pi.getPercentage());...
ab176c8d-cd71-4887-9de2-4af0212fce90
4
public static void filledRectangle(double x, double y, double halfWidth, double halfHeight) { if (halfWidth < 0) throw new RuntimeException("half width can't be negative"); if (halfHeight < 0) throw new RuntimeException("half height can't be negative"); double xs = scaleX(x); double ys ...
3f680723-60e0-4bf6-ac02-68d8f3d41052
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 feel. * For details see http://down...
f9fb4047-c122-4670-a41a-9098be31ceea
9
public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5) { return (par5 == 1 && par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1)) || (par5 == 2 && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2)) || (par5 == 3 && par1World.isBlockSo...
b510a4d1-0d36-4c5c-815b-7e7abdd7d30c
6
private static Node<Integer> add_TailOnesDigitData_Internal(Node<Integer> num1, Node<Integer> num2, IntWrapper carry) { if (num1 == null && num2 == null) { return null; } Node<Integer> prevRes = null; if (num1 == null) { prevRes = add_TailOnesDigitData_Internal(nu...
6cf2b564-abfc-48e5-96b0-4845e6f4964d
0
public List<PhpposLogEntrada> getPosLogEntradasFromFecha(Date desde, Date hasta){ DetachedCriteria criteria = DetachedCriteria.forClass(PhpposLogEntrada.class); criteria.add(Restrictions.between("fechaCreacion", desde, hasta)); return ge...
9fad6e7a-7cf8-47bb-89a5-216536e973f0
6
@Override public void onCombatTick(int x, int y, Game game) { SinglePlayerGame spg = (SinglePlayerGame) game; List<Entity> neighbors = spg .getSquareNeighbors(x, y, 1); for (Entity entity : neighbors) { if (entity.id == human.id) { MortalEntity mor...
721bc0ea-fdad-40a2-90fc-eeaf7f3ad75f
1
public void loadWord() { WordLoader w1 = getWordLoader(); try { String wordString = w1.getWord(); word = new HMWord(wordString); } catch (Exception e) { e.printStackTrace(); } }
17e2aefc-d216-45ef-a8ea-56d307895288
6
private void loadAllClientReps(){//COMPLETE try { ResultSet dbAllClientReps = null; Statement statement; statement = connection.createStatement(); dbAllClientReps = statement.executeQuery( "SELECT ClientRep.clientRepID, ClientRep.organisationID, ClientRep....
7b1f4d64-ab9c-4371-ab6d-6bfb1c4e9b00
5
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if(sender instanceof Player) { Player player = (Player) sender; if(plugin.confirm.containsKey(player)) { String group = plugin.confirm.get(player); @SuppressWarnings("unchecked") ...
1fd664f1-8975-41d7-9cc7-cb44a38639ca
7
public float getRecall(String[] manualSummaries, String[] generatedSummaries){ String manualSummary,generatedSummary; int matchCount=0; int manualSummaryCount=0; String[] manualOneGram = null,generatedOneGram = null; if(manualSummaries==null || generatedSummaries==null || manualSummaries.length!=generatedSumm...
7af7d5eb-105b-417c-a825-ed17251fa4f6
4
public void checkType(Symtab st) { exp1.setScope(scope); exp1.checkType(st); exp2.setScope(scope); exp2.checkType(st); if (!exp1.getType(st).equals("int") && !exp1.getType(st).equals("decimal")) Main.error("type error in mult!"); if (!exp2.getType(st).equals("int") && !exp2.getType(st).equals("de...
8458b9fc-3284-4ac4-954b-55a6b3a2ab04
6
private static int alphaBeta(Configuration conf, int alpha, int beta,byte depth,byte max){ if ((conf.whoWin() != 0) || (depth >= max)){ return evaluation(conf); } else{ int meilleur = Integer.MIN_VALUE; for (Configuration fconf : listeFils(conf)) { int suiv=-alphaBeta(fconf, -beta, -alpha, (byte) (de...
cd7f581f-5990-420d-a86d-293d53db695f
2
public void setPWfieldBorderthickness(int[] border) { if ((border == null) || (border.length != 4)) { this.pwfield_Borderthickness = UIBorderthicknessInits.PWFIELD.getBorderthickness(); } else { this.pwfield_Borderthickness = border; } somethingChanged(); }
82bfface-904d-41d4-9ac4-ed2c3f9e4eb7
7
private void showLoans() { List<Book> books = library.getLoanedBooks(); List<Cd> CDs = library.getLoanedCds(); List<Magazine> magazines = library.getLoanedMagazines(); boolean done = false; do { printHeader("Books"); int index = 1; printBo...
ae9e3e46-8bc5-499e-822d-7be28333cf1a
0
@Test public void runTestButton4() throws IOException { InfoflowResults res = analyzeAPKFile("Callbacks_Button4.apk"); Assert.assertNotNull(res); Assert.assertEquals(1, res.size()); }
105a2bba-8123-45af-bdc7-df5a6450afe6
4
public static void main(String[] args) { if(args.length >= 1 && args[0].equals("debug")){ debug = true; } client1 = new Client(); try { //client1.buildGUI(); gui = new GUI(client1); config = new Config(); String tmp = config.getWindowTitle(); if (!tmp.equals("")) { client1.windowTitle = tm...
c0a6eaac-4ea5-4e6c-8b00-53c64a259416
3
public PlayerUpdate getUpdate(){ PlayerUpdate x = new PlayerUpdate(); if(sprite.equals(up)){ x.spriteDirection = "up"; } else if(sprite.equals(left)){ x.spriteDirection = "left"; } else if(sprite.equals(right)){ x.spriteDirection = "ri...
945848a2-bc1d-4580-ac67-e143b3f23e62
5
void render(){ for(int i = 0; i < 4; i++){ for(int j = 0; j < 4; j++){ int k = j*4+i; U.batch.draw(icons[j][i],U.h+U.SPRITESIZE, U.h-(k)*U.SPRITESIZE-U.SPRITESIZE*3/4,U.SPRITESIZE/2,U.SPRITESIZE/2); if(k%4 != 3){ if(statsArray[k] < minima[k]){ U.font.setColor(1, 0, 0, 1); U.batch.draw(...
ec29b6a5-ca3d-492d-887e-ea92a8e75f56
1
public String[] nextStrings(int n) throws IOException { String[] res = new String[n]; for (int i = 0; i < n; ++i) { res[i] = next(); } return res; }
b70ad491-752b-4b8b-8aca-4be2e28e829e
2
private static int serLane(int[] width, int i, int j) { int currentMin = MAX_N; for (; i <= j; i++) { if (width[i] < currentMin) { currentMin = width[i]; } } return currentMin; }
6f582484-e07e-4062-aaba-28de84c1940e
0
@Override public void setEmail(String email) { super.setEmail(email); }
a29db016-ffc9-4608-b03a-7c45a9864312
0
@Override public void destroy() { tree = null; oldValue = null; newValue = null; }
13bc116a-302c-4be6-93d2-6f6f4e0fbe91
1
public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { JComboBox combo = (JComboBox) e.getSource(); int index = combo.getSelectedIndex(); System.out.println("./files/img/" + images[index]); display.setIcon(new ImageIcon("./files/img/" + images[index])); } }
08d13e2a-2466-4957-be36-30a471617099
2
public boolean insideBase(Player player) { for (Region region : HyperPVP.getMap().getRegions(RegionType.TEAM)) { if (region.hasLocation(player.getLocation())) { return true; } } return false; }
2fbbb181-9215-4283-904b-a6855a21ae3d
9
public final GalaxyXSemanticParser.modifier_return modifier() throws RecognitionException { GalaxyXSemanticParser.modifier_return retval = new GalaxyXSemanticParser.modifier_return(); retval.start = input.LT(1); int modifier_StartIndex = input.index(); CommonTree root_0 = null; ...
fedabd91-478a-4ebc-b464-6a4335872a67
5
private void switchToSpeedHost() throws FatalError { if (Config.getSpeedHost() != null) { try { String page = Utils.getString("speed/index"); int pos = page.indexOf("speedlink"); if (pos < 0) throw new NotFound(); page = page.substring(pos); pos = page.indexOf("\""); if (pos < 0) ...
92533393-169a-40f2-b8b8-0f1af72c3141
9
private void initActions() { for (int i = 0; i < tools.length; ++i) { final Tool tool = tools[i]; String group = tool.group; if (group.equals("tool")) { tool.action = new Runnable() { public void run() { setPaintTool(tool.id); } }; } else if (group.equals("fill")) { tool.action...
f0936fad-cd86-4984-9c08-b6ab4966e356
1
public boolean _setSpeedX(int speedX) { if(speedX > -1) { this.speedX = speedX; return true; } else { return false; } }
fa86fe31-a9da-4a8e-964d-e4bb6c3f1160
9
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Message message1 = (Message) o; if (date != null ? !date.equals(message1.date) : message1.date != null) return false; if (message != null ? !me...
734149b7-43c1-48a1-8f56-5b55d68a5eea
8
@Override public boolean apply(final SliceIntArray input, final SliceIntArray output) { if ((!SliceIntArray.isValid(input)) || (!SliceIntArray.isValid(output))) return false; final int nbThreads = this.delegates.length; ArrayList<Callable<Boolean>> filterTasks = new ArrayList<Cal...
e8434a9c-b05f-4599-b824-1b5c241c907c
9
private static void dumpDynamicNpcs(RT6CacheSystem system) { NpcDefinitionLoader loader = system.npcLoader; ScriptLoader scriptLoader = system.scriptLoader; PrintWriter writer = null; try { writer = new PrintWriter(new File("dynamic_npcs.java")); } catch (FileNotFoundException e) { e.printStackTrace(); ...
c5c6b793-9bc5-46f7-a98f-db8ecfd1d25e
8
private List<Move> possibleMoves() { final boolean mustAttack = state.mustAttack(); final List<Move> result = new ArrayList<>(); if (!mustAttack) { result.add(Move.PASS); } for (byte from = 0; from < Move.N_BOARD_LOCATIONS; from++) { if (state.getOwner(fr...
4a492371-7144-47d6-bd10-c4773e1d1b01
8
private boolean processDot_r(int x, int y, int owner, boolean mask[][]) { if(isOnBorder(x, y)) { return false; } if(map[x][y].owner == owner && map[x][y].status) { return true; } if(mask[x][y]) { return true; } ...
11993633-508a-419b-a81c-47395e9ad533
6
public void drawBarChart( Object[] data, int ageInterval) { setPaint(Color.DARK_GRAY); RoundingMode roundingMode = getRoundingMode(); BigDecimal cellWidth = getCellWidth(); int originCol = getOriginCol(); TreeMap<Long, BigDecimal> femaleAgeInYearsPopulatio...
252137b2-c9aa-4c8e-be2f-4337c65f837b
1
public static void main(String args[]) throws Exception { for (int i = 0; i < 10; i++) { System.out.println(GUID.generate()); } }//main
f0461d7f-7083-4ad3-8ce1-6a2b255a48f0
5
@Override public String getMixedString(UnicodeSet localeAlphabet, int length) { if(length == 0) { return ""; } if(length <= 0) { throw new IllegalArgumentException("Length must be greater than 0."); } ArrayList<int[]> alphabets = this.getCharacterSetList(); alphabets.add(getCharArray(localeAlph...
84a25901-8ec8-4167-bc12-ed8dac268b38
7
private static void refreshAndSave(AbstractProject template, ImplementationBuildWrapper implementationBuildWrapper, XmlFile implementationXmlFile, String oldDescription, boolean oldDisabled, Map<TriggerDescriptor, Trigger> oldTriggers) throws IOException { TopLevelItem item = (TopLevelItem) Items.load(Jenkins.getInst...
87040e18-3f59-42a7-8ec9-75867a49fd5e
5
public void fillHuffTable(Node root) { if(root == null) return; else { if( root.character != - 1) { //System.out.print(root.frequency + "-[" + (char)root.character + "] "); Code newCode = new Code(code); huffTable[root.character] = newCode; //System.out.println(newCode.toString()); } ...
8e7a9624-62cd-4f05-9536-33d1ecaf5639
8
public void addCommands(Object o) { try { interpreter.set("current_interpreter", interpreter); evaluations = "import graphtea.graph.graph.*;" + evaluations; evaluations = "import graphtea.ui.lang.*;" + evaluations; } catch (EvalError evalError) { evalError...
62052281-c5e3-4ff2-830f-e1f0b595f235
3
private void decreaseKeyUnchecked(Entry entry, double priority) { /* First, change the node's priority. */ entry.mPriority = priority; /* If the node no longer has a higher priority than its parent, cut it. * Note that this also means that if we try to run a delete operation *...
ee62ff0d-d156-4db5-a644-99208a9b67f7
3
public static void writeImage(BufferedImage image, String fileName) throws IOException { if (fileName == null) return; int offset = fileName.lastIndexOf( "." ); if (offset == -1) { String message = "file suffix was not specified"; throw new IOException( message ); } String type = fileName.substrin...
a89a1a1f-d73c-44d5-9dd8-c2035a3d3491
1
public static double[] scale( double fac, double[] vector ) { int n = vector.length; double[] res = new double[n]; for ( int i = 0; i < n; ++i ) res[i] = fac * vector[i]; return(res); }
cc9d1de2-8b11-484f-ad13-8959c8ce0667
4
public ListNode rotateRight(ListNode head, int n) { if (head == null) return null; int size = 1; ListNode tail = head; while (tail.next != null) { tail = tail.next; size++; } n = n % size; if (n == 0) return head; ...
3e6ae97d-00fc-4131-878f-b2b654fc3991
9
public static int search(int[] A, int target){ if(A.length == 0){ return -1; } int l = 0; int r = A.length-1; while(l<=r){ int mid = (l+r)/2; if(A[mid] == target){ return mid; } //the A[l..mid] is sorted,...
e88e27ef-1440-4342-99c6-4d2677146588
2
public void setPrevCell(ProcessedCell c){ prevCell = c; if(c != null && c.getNextCell() != this){ c.setNextCell(this); } }
7baf1344-c049-4936-82b9-ffafbed38d37
4
public void UserAvgStarDist() { int totalUserCnt = 0; Map<Double, Integer> UserAvgStarMap = new TreeMap<Double, Integer>(); for (User user:userMap.values()) { //System.out.println("hello"); double score = roundScore(user.average_stars); totalUserCnt += 1; if (!UserAvgStarMap.containsKey(score)) { ...
c20de67f-39a8-497c-b56f-5f31c5230652
8
public boolean isSpeelveldKlaar(){ //kijkt of het speelveld klaar is om in te spelen if( obstructie == null || schutterAPositie == null || schutterAZone == null || schutterBPositie == null || schutterBZone == null || wind == null ...
e2b893e5-c385-4104-98ff-a3c1bab7b6b1
4
public void pulse() { if (cnt == 100/MAIN_TIMER_TICK_RATE) { cnt = 0; if (enlarging) { tmp++; enlarge(); } else { tmp--; shrink(); } correctSize(); if (tmp == 0) { ...
078127ca-b0a4-4b1b-9982-5bb7d93f97a3
5
private static void writeIntoFile(String fileName) throws IOException { BufferedWriter bw = null; try { File f = new File(fileName); bw = new BufferedWriter(new FileWriter(f)); for(String s : GenerateForSpim.getCommandMap().get(GenerateForSpim.DEFAULT_METHOD)) { bw.write(s); bw.newLine(); } ...
105af179-7948-4c25-bde3-94b80b870793
4
@Override public void move(Excel start, Excel finish) { if (start.getX() == begin.getX() && start.getY() == begin.getY()) { begin = finish; setColoredExes(); } if (start.getX() == end.getX() && start.getY() == end.getY()) { end = finish; setColoredExes(); } }
386d5b06-7796-4815-97a0-eb5a4a742cc1
4
public int getDiameter() { switch(getPlacementRank()) { case DEFINITIVE: return DEFINITIVE_SIZE; case EXPECTANT: return EXPECTANT_SIZE; case LATENT: return LATENT_SIZE; case UNDEFINED: ...
1f2402ed-9281-4db3-8804-3fa256520ab7
9
public static List<Tile> familarTile(IClientContext ctx) { final Tile location = ctx.players.local().tile(); List<Tile> tiles = new ArrayList<Tile>(); LogicailArea area = new LogicailArea(location.derive(-7, -7), location.derive(5, 5)); boolean edgeville = false; if (LocationAttribute.EDGEVILLE.isInLargeAre...