method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
08fb6589-64ca-4a0a-8f2d-5076e9c0b3fc
8
public boolean equals( Object other ) { if ( ! ( other instanceof TObjectCharMap ) ) { return false; } TObjectCharMap that = ( TObjectCharMap ) other; if ( that.size() != this.size() ) { return false; } try { TObjectCharIterator iter = ...
0c4d0a67-e00b-47fc-8c96-80c84d4e1619
7
public void saveAll() { FileConfiguration f = getPlayerF(); String path = "players."; for (UUID uuid : balance.keySet()) { f.set(path + uuid.toString() + ".coins", balance.get(uuid)); } for (UUID uuid : currentKit.keySet()) { f.set(path + uuid.toString() + ".selected", currentKit.get(uuid).getName...
7aa73371-9ca5-4fb3-914e-e002e66186be
1
* @see LocalExpr * @see StoreExpr */ public void visit_astore(final Instruction inst) { final LocalVariable operand = (LocalVariable) inst.operand(); Expr expr = stack.peek(); if (expr.type().isAddress()) { Assert.isTrue(sub != null); Assert.isTrue(!saveValue); expr = stack.pop(Type.ADDRESS); s...
8864bbdb-7dcf-40f2-b850-f4bca5ca6f46
2
public void closeConnection() { try { if (con != null) { con.close(); } con = null; } catch (Exception e) { System.out.println(e.getMessage()); } }
4b95d66d-7636-47df-ad9e-651af00c0182
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Student other = (Student) obj; if (internalID == null) { if (other.internalID != null) return false; } else if (!internalID.equals(other...
ff91aa2b-5e4c-4c85-b683-c4e0339c6aa0
6
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((diagnosisComment == null) ? 0 : diagnosisComment.hashCode()); result = prime * result + ((diagnosisDate == null) ? 0 : diagnosisDate.hashCode()); result = prime * result + ((diagnosisName == nu...
ee51716b-aa85-4c3f-af20-1f66ec87bcf6
5
@Override public void handleLeftClick(double x, double y, SUIComponent concerned){ if(concerned == null) return; if(play.equals(concerned)){ frame.goTo(new PlayConfigPanel(frame)); } else if(skin_editor.equals(concerned)){ frame.goTo(new SkinEditorPanel(frame)); } else if(map_editor.equals(concern...
d22182e2-0c50-483a-a46c-2395ed009bc5
3
public void setDirection(int direction){ if(direction >= 360){ direction = direction % 360; } if(direction < 0){ while(direction < 0){ direction+=360; } } this._direction = direction; }
36180dd4-39af-4684-ae28-b1b1ad0a3ef9
4
public void changePlayerDirection(int d) { setDirection(d); switch (d) { case 1:// down playerR.setRegion(0, 0 + (currentStep * 42), 37, 42); currentDirection = Direction.DOWN; break; case 2:// up playerR.setRegion(37, 0 + (currentStep * 42), 37, 42); currentDirection = Direction.UP; b...
eb9267c2-11df-41a2-88bf-e7d1855d9e9e
1
@Override public int attack(double agility, double luck) { if(random.nextInt(100) < luck) { System.out.println("I set the monster on fire!"); return random.nextInt((int) agility) * 4; } return 0; }
f1d91381-c233-405d-8cf7-1e2d413628fb
5
public static void main(String[] args) { int option; double distance, speed, time; Scanner keyboard = new Scanner(System.in); DecimalFormat formatter = new DecimalFormat("#0.0000"); System.out.println(); System.out.println("Choose a medium through which a sound wave will travel"); System.out.print("(1...
1138332b-6c95-45ab-bf79-b94d52272a29
2
@Override public boolean isFull() { for (int i = 0; i < chairs.length; ++i) { if (chairs[i] == null) { return false; } } return true; }
f476fd85-7a89-4358-b098-1e3b713cece3
2
private void addOccupant(T occupant) { Class cl = occupant.getClass(); do { if ((cl.getModifiers() & Modifier.ABSTRACT) == 0) occupantClasses.add(cl); cl = cl.getSuperclass(); } while (cl != Object.class); }
858cedf9-04e2-46aa-9dbf-465e2dca6ed0
2
public boolean equals(Object other) { if (other instanceof Type) { Type type2 = (Type) other; return typeSig.equals(type2.typeSig) && instr == type2.instr; } return false; }
66097c13-6ebb-40d2-95b6-581d0f569f1e
0
@Override public void debuterTransaction() throws SQLException { getConnexion().setAutoCommit(false); }
dd3c56d8-ee26-4264-81f0-7c4b0eabb6da
3
private SelectableCapability getSelectable( int x, int y ) { float best = 0.f; SelectableCapability result = null; for( SelectableCapability selectable : site.getCapabilities() ) { float contains = selectable.contains( x, y ); if( contains >= best && contains > 0 ) { best = contains; result = selec...
a1a47b67-8dd1-4f6a-8aa6-f8511d451fdd
1
@Override public boolean decrementLives() { if (lives > 0) { lives--; return true; } return false; }
075812e6-eddb-47c9-afa8-0ccf48662dd9
6
public HexLocation getNeighborLoc(EdgeDirection dir) { switch (dir) { case NorthWest: return new HexLocation(x - 1, y); case North: return new HexLocation(x, y - 1); case NorthEast: return new HexLocation(x + 1, y - 1); case SouthWest: return new HexLocation(x - 1, y + 1); case South...
fc22789f-6c2a-442e-ae59-fa206d66d6ee
4
@Override public int hashCode() { int hash = 5; hash = 37 * hash + (this.normalTextFont != null ? this.normalTextFont.hashCode() : 0); hash = 37 * hash + (this.boldTextFont != null ? this.boldTextFont.hashCode() : 0); hash = 37 * hash + (this.colorPalette != null ? this.colorPalette....
b778877d-8d56-4fc5-8498-3bed064a10bc
9
public String diff() throws IOException { String answer = ""; answer += " Difference between the current Project-Directory and the latest version (ID: " + HEAD.ID +") \n \n"; File directory = new File(ProjectDirectory); File[] fileList = directory.listFiles(); if (fileList.length-index.size() != 2) { ...
87a91c98-8bfb-448b-8714-e7d605de023f
9
public static ArrayList<Post> getPage(int page) throws SQLException, NamingException { Connection conn = null; Statement stmt = null; ResultSet rs = null; ArrayList<Comment> comment = new ArrayList<Comment>(); ArrayList<Graffiti> graffiti = new ArrayList<Graffiti>(); if (page <= 0) { page = 1; } ...
e0917827-dac1-40ad-ae36-af11fd53b127
3
public static boolean isValid(List<Integer> index, int n) { int len = index.size(); for (int i = 0; i < index.size(); i++) { if (index.get(i) == n || Math.abs(n - index.get(i)) == Math.abs(len - i)) return false; } return true; }
57c864d9-8428-49be-9fe7-26873b514960
1
public void draw() { for (GameElement gameElement : gameElements) { gameElement.draw(); } }
4c3e8501-0ea4-4a79-b920-9d06263d9853
6
public void separateTrainTest4Spam() { int cvFold = 10; ArrayList<String> parentFakeList = new ArrayList<String>(); String parentFakeString = "448 348 294 329 317 212 327 127 262 148 307 139 40 325 224 234 233 430 357 78 191 150 424 206 125 484 293 73 456 111 141 68 106 183 215 402 209 159 34 156 280 265 458 65 3...
7d460596-8609-41d5-8478-dfdb3821fa10
2
private JFileChooser getFileChooser(String mode) { initFileFilter(mode); if ( mode.equals ( Constantes.SAVE ) || mode.equals ( Constantes.RAPPORT ) ) { chooser.setDialogType(JFileChooser.SAVE_DIALOG); } else { chooser.setDialogType(JFileChooser.OPEN_DIALOG); ...
23a30f1e-1807-4bfe-a815-bf8fb814e89b
4
@Override public boolean blocked(final Node n) { if (n == null) { return true; } else if (n.getPrev() == null || objectTiles.contains(n) || objectTiles.contains(n.getPrev())) { return false; } else { return super.blocked(n); } }
c4bb04df-3b2e-4507-a523-6c432f6894b2
0
public Branch(String name) { this.name = name; this.branchs = new ArrayList<Root>(); }
7c4420f9-de11-44f0-99f9-bf394b192ba4
1
void write(int b) { try { text[tsize++]=(byte)b; } catch (ArrayIndexOutOfBoundsException exc) { byte[] new_text=new byte[text.length<<1]; System.arraycopy(text, 0, new_text, 0, tsize-1); text=new_text; text[tsize-1]=(byte)b; }; };
0951bb50-cfb4-4045-860c-ddd6f4f2a226
5
private static void DownloadNewLauncher( ) { try { //progressCurr.setValue(0); String strPath = Utils.getWorkingDirectory() + File.separator+GlobalVar.LauncherFileName; File AppPath = new File(LauncherUpdater.class.getProtectionDomain().getCodeSource().getLocatio...
8f1bd505-6b50-43cd-8854-36332f974fef
7
public boolean sentientAttack(Sentient attacker, Sentient attackee) { int attackRoll = MapRand.randInt(20) + attacker.getAttack(); String attackerUppercase = attacker.getPronoun().substring(0, 1).toUpperCase() + attacker.getPronoun().substring(1); if (attackRoll >= attackee.getAC()) { int damage = attacker.get...
fcc12cc9-0709-4ca4-92d6-86f8fb2d5598
8
private boolean processSpecialKeysPressed(KeyEvent e) { int code = e.getKeyCode(); if(KeyEvent.VK_V == code && (e.getModifiers() & InputEvent.CTRL_MASK) == InputEvent.CTRL_MASK) { // ctrl-v copyRequest(KeyEvent.VK_CONTROL, KeyEvent.VK_V); return true; } if(KeyEvent.VK_INSERT == code && (e.ge...
2e3fb4ed-1f90-415a-bca1-d673c6901524
4
public Image drawZBuffer() throws IOException { BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); double denominateur = abs(zmax - zmin); System.out.println("denominateur : "+denominateur); for (int y = 0; y < height; y++) { for (int x = 0; ...
f0b53a42-94cb-4b5d-baf2-650a0e8548c7
0
public void setCodes(final Hashtable<String, K> codes) { this.codes = codes; }
ff747ac6-b906-49f6-846c-a6acba2a09cc
0
public static void main(String[] args) { FlyweightFactory ff = new FlyweightFactory(); Flyweight ccfw = ff.factory("ubuntu"); ccfw.func(); ff.checkFlyweight(); }
785b64b5-f18c-4ddf-a4d7-6090185fb452
4
protected boolean out_grouping_b(char [] s, int min, int max) { if (cursor <= limit_backward) return false; char ch = current.charAt(cursor - 1); if (ch > max || ch < min) { cursor--; return true; } ch -= min; if ((s[ch >> 3] & (0X1 << (ch & 0X7))) == 0) { cursor--; return true; } return...
9e89fd1e-b2f9-43cc-a1a8-bbc654aed622
9
@Override public Object execute(TransitionSystem ts, Unifier un, Term[] terms) throws Exception { WorldModel model = ((MartianArch) ts.getUserAgArch()).getModel(); Graph graph = model.getGraph(); Vertex myPosition = model.getMyVertex(); List<Vertex> notProbedNeighbors = graph.returnNotProbedNeighbors(myPosit...
b976f26a-262a-4cdb-917e-1f298e644324
6
@Override public void emitCode(GluonOutput code) { if (variable != null){ String varName = variable.getLabelName(); assignmentExp.emitCode(code); switch (assignmentOp){ case ASSIGN: break; case ASSIGN_ADD: code.code("MOV EBX, " + varName); code.code("ADD EAX, EBX"); break; ...
3b57fcd8-6d98-412d-919e-4994bc23e696
3
private static InetAddress parseInetAddress(String strIn) { InetAddress iaOut = null; String[] strBytes = null; byte[] arrBytes = null; if ( strIn.matches(EzimNetwork.regexpIPv4) || strIn.matches(EzimNetwork.regexpIPv6) ) { try { iaOut = InetAddress.getByName(strIn); } catch(Except...
22ba67bd-c707-4d96-930b-aaf4bc794cb9
4
public HashMap<String,ArrayList<String>> getMessages(String receiver){ HashMap<String,ArrayList<String>> messages = new HashMap<String,ArrayList<String>>(); Statement st; ResultSet rs; String query; ArrayList<String> temp = new ArrayList<String>(); String sender=null; String oldsender; try { st = co...
2bbf1fc7-7114-4260-8be6-ae3e1b28242c
1
public static void main(String[] args) { // TODO Auto-generated method stub System.out.println("Vechicle ICT project by Cyborgs"); Coordinate c1 = new Coordinate(1, 9.2); c1.print(); Node firstNode = new Node(c1, "Starting Node"); firstNode.print(); Node secondNode = new Node(new Coordinate(7, 4)...
621da2d8-1f2c-4d98-8a2b-6ee1d694eab6
9
public static Predicate.Op getOp(String s) throws simpledb.ParsingException { if (s.equals("=")) return Predicate.Op.EQUALS; if (s.equals(">")) return Predicate.Op.GREATER_THAN; if (s.equals(">=")) return Predicate.Op.GREATER_THAN_OR_EQ; if (s.equals("...
02b72280-2b31-4c29-919d-9cf22a6db2b7
9
protected Location resolveLocationUsingUserLocation(Map<String,Object> tweet) { String tweetLocation = Utils.getLocationFromTweet(tweet); if (tweetLocation != null) { String location = tweetLocation.replaceAll("\\p{Punct}", " ").replaceAll("\\s+", " ").toLowerCase().trim(); // Check if this is a known loc...
d20bd430-b7e2-4c1e-a8cf-d515257df532
5
final void method1716(boolean bool) { if (bool != false) method1716(false); anInt5962++; if (((Class348_Sub51) ((Class239) this).aClass348_Sub51_3136) .aClass239_Sub25_7271.method1830((byte) -119) && !Node.method2714(7351, ((Class348_Sub51) ((Class239) this).aClass348_Sub51_3136) .a...
6c1d3d7d-5ee3-4a30-8ef4-524f91142abd
0
public void setPath(String path) { this.path = path; }
402cc825-1e72-4886-96cb-4ae24437ebc8
8
public static ArrayList<String> getAllSenses(String line){ String sense = ""; ArrayList<String> words = getWords(line); for(int i = 1; i < words.size(); i++){ if(!words.get(i).equals("@")) sense += words.get(i); else break; } ArrayList<String> senses = new ArrayList<String>(); int count...
a3f842a0-4f38-4bfc-b1ec-eb12f3a7d406
1
@Override public boolean allowTarget( ConnectionableCapability item, ConnectionFlavor flavor ) { return item != this || allowSelfReference( flavor ); }
73bdd16b-cf6f-428d-9382-fc935108023e
2
public void Login() throws SQLException { try { Conexion.GetInstancia().Conectar(); ResultSet rs = Conexion.GetInstancia().EjecutarConsulta ("SELECT User_Empleado, Clave_Empleado, Tip_Empleado FROM Empleado WHERE User_Empleado ='"+ObEmpleado.getUser_Empleado()...
3126f71a-9d7f-4ec1-bddc-23766cd629a5
0
public int getNowDay() { return Integer.parseInt(sysNowTime[2]); }
812a555d-ae66-4f89-8dc3-bbe6aec54b83
7
public boolean isPalindrome(String s) { s = s.trim().toLowerCase(); if (s.length() == 0) return true; int l = 0, r = s.length() - 1; while (l <= r) { while (l < r && !isAlpha(s.charAt(l))) { l++; } while (r > l && !isAlpha(s...
32f0b8ca-82c9-48a0-aabb-db457f2f450f
2
private void init() { try { // Setup Parser factory = SAXParserFactory.newInstance(); factory.setValidating(false); parser = factory.newSAXParser(); reader = parser.getXMLReader(); reader.setContentHandler(this); reader.setErrorHandler(new SimpleSAXErrorHandler()); } catch (ParserConfig...
1a0f3888-6cc6-42f1-8be6-640a245f1ec1
7
private static Object valueOfField(Object obj, String fieldName) { Class<?> clazz = obj.getClass(); Field field = null; while (clazz != null) { for (Field declaredField : clazz.getDeclaredFields()) { if (fieldName.equals(declaredField.getName())) { ...
060310a3-c1f9-4b75-895e-c130a7e57d8a
0
public String getSenha() { return senha; }
43b3afb5-fd24-4f54-a636-a62b0aacb7bc
0
public boolean getVSycn() { return this.vSync; }
b493ba4b-4453-42c8-98a1-3dc34e42e13b
1
public void encodage() { //Ajout de la position du mot de depart //code.add(String.valueOf(positionChaine).charAt(0)); leCode = positionChaine +""; //Ajout de chaque dernier caractere de chaque ligne du tableur for(ArrayList<Character> mot : tableurTrie) { ...
8048a221-8bbd-4c55-8ebf-1e089dbe89ad
4
public Tree<String> traverseAnnotatedTree(Tree<String> tree) { if (tree.isLeaf()) { return tree; } List<Tree<String>> childrenList = tree.getChildren(); if (childrenList.size() == 1) { Tree<String> child = childrenList.get(0); String[] params0 = new String[4]; params0[0] = tree.getLabel(); para...
e7b7f79e-3104-4605-9ee9-c61b55178375
3
public synchronized void start() throws Exception { if (thread != null) { throw new Exception("ServerSocket already started."); } server = new ServerSocket(port, backlog); thread = new Thread(new Runnable() { /** run() * * Accepts connections and adds it to the managed list */ @Override...
306844e2-23a1-4904-9bf7-6ae1979174e1
5
public void PlayGame() { while(!Game.board.CheckGameComplete()) { if(Game.board.CheckGameDraw(Player.white)){ break; } White.Move(); if(Game.board.CheckGameComplete()){ UserInteractions.DisplayGreetings...
87146de4-b596-4007-ba35-d5f496464197
7
public String toString(){ String s; Exemplar cur = m_Exemplars; int i; if (m_MinArray == null) { return "No classifier built"; } int[] nbHypClass = new int[m_Train.numClasses()]; int[] nbSingleClass = new int[m_Train.numClasses()]; for(i = 0; i<nbHypClass.length; i++){ nbH...
5446bd18-b96a-4413-b352-c208872c2be3
5
public static int findLIS(int size) { int[] dp = new int[size]; Arrays.fill(dp, 1); int ans = 1; for (int i = 0; i < dp.length; i++) for (int j = 0; j < i; j++) if (match(j, i) && dp[i] + 1 > dp[j]) dp[i] = Math.max(dp[i], dp[j] + 1); for (int i = 0; i < dp.length; i++) ans = Math.max(ans, d...
19134344-e264-4858-8051-3916672cea5d
5
public int getColumn(Object element) { if( element instanceof Tree ) { Tree tree = (Tree) element; element = tree.getNode(); } if ((this.contextClass != null) && (this.contextClass.isInstance(element))) { try { return ((Integer)this.contextClass.getMethod("columnStart", new Class[0]).invo...
b3361584-ba2b-46ca-801e-257f1201d0f7
6
@Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if (cmd.getName().equalsIgnoreCase("stream")) { try{ if(args[0].equalsIgnoreCase("debug")){ ...
00079727-7776-4850-be89-7186e8832b34
7
@Override public void updateLot(List<String> optPlayerList) { final Environmental EV=affected; if(!(EV instanceof Room)) return; Room R=(Room)EV; boolean didAnything=false; try { List<Runnable> postWork=new ArrayList<Runnable>(); synchronized(("SYNC"+R.roomID()).intern()) { R=CMLib.map().g...
16ffdfdc-cd24-45a0-a4f8-25dc0e0cd935
8
public final int partitionByName(int lb, int ub) { Person pivotElement = allPersons[lb]; // store the left most value as the pivot element int max = logicalSize; int left = lb, right = ub; // store left and right as the unchanging values of lb and ub respectively. This is used for the final move of this method ...
ee97022c-5724-4f92-ae91-f1da0e51dc77
7
public com.actuate.schemas.SelectFilesResponse selectFiles( com.actuate.schemas.FileSearch fileSearch, String name, ArrayOfString nameList) { if (null == authenticationId) login(); com.actuate.schemas.ArrayOfString resultDef = newArrayOfString( new String[] { "Description", "FileType", ...
92bf839b-7865-45df-b405-6e0af6c3a0a9
6
public boolean fillChampion(Champion champion, Region region) throws RiotApiException { List<Champion> champions = getAllChampions(region); Champion newChampion = null; for(Champion c : champions) if((champion.getId() >= 0 && c.getId() == champion.getId()) || (c.getName() != null && c.getName().equals(champio...
b2e3a369-1b12-4efe-8133-bb7b515b1a2d
9
protected AbstractParserFactory makeParserFactory() throws MaltChainedException { Class<?> clazz = (Class<?>)manager.getOptionValue("singlemalt", "parsing_algorithm"); try { Class<?>[] params = new Class<?>[1]; params[0] = org.maltparserx.parser.Algorithm.class; Object[] arguments = new Object[params.leng...
0ba3f4f9-3cf5-4cf1-a0d1-6ab25fbba73a
4
private void determineX(int r, int s, double teta, Matrice bBarre) { for(int i = 0; i<this.X.getNbColumns(); i++) { if(i == r) { this.X.setValueAt(0, i, 0); } else if(i == s) { this.X.setValueAt(...
ed1c5dac-a0b4-45d8-8f07-1234e12de073
3
public double Dvn(double v[], double uv[]) { double w1, w2, vm; TRACE("Dvn"); /* Modulus */ w1 = 0.0; for (int i = 0; i < 3; i++) { w2 = v[i]; w1 += w2 * w2; } w1 = Math.sqrt(w1); vm = w1; /* Normalize the vector */ ...
4a0e0950-3155-4321-b904-426709e0cc88
7
public int[] revealedBox() { int minR = 1000, minC = 1000, maxR = 0, maxC = 0; for (int r = 0; r < revealed.length; r++) { for (int c = 0; c < revealed[0].length; c++) { if (revealed[r][c] != 0) { if (r < minR) minR = r; else if (r > maxR) maxR = r; if (c < minC) minC = c; else ...
06b2e1ef-71fa-4d60-84a6-599facb72644
4
@Override public void run() { while (!isStop) { try { Socket clientSocket = listener.accept(); ServerHandler serverHandler = new ServerHandler(clientSocket, records); handlers.add(serverHandler); threadPool.start(serverHandler); } catch (IOException e) { System.out.println(e.getMes...
7df76407-dfb4-42e0-9a12-452ec3bded5c
5
@Override protected void updateStronglyConnectedComponents_addConclusions(Literal literal) { Set<Rule> rules = theory.getRulesWithHead(literal); for (Rule rule : rules) { switch (rule.getRuleType()) { case STRICT: if (isLogInferenceProcess) getInferenceLogger().updateRuleInferenceStatus(rule.getOrig...
a9aa4636-c123-4ebf-bb29-62a21e091124
3
public void setAllocPolicy(int allocPolicy) { if ((allocPolicy < 0) || (allocPolicy > 1)) { throw new AssertionError((allocPolicy >= 0) && (allocPolicy <= 1)); } _allocPolicy = allocPolicy; }
785930d4-f298-45bc-aadf-0b78aba3ce11
6
public HashMap<String, Map<String, Integer>> GetOutRelation(int id) { ResultSet set = sqLconnection.Query(query + id); String author, subauthor; int count; String[] info, outauthors; boolean flag = false; HashMap<String, Integer> authorMap = new HashMap<>(); try { while (set.next()) { author = set....
5e7bacb7-e1d7-4ef6-9ca5-98cc5adbe25a
4
@Override public void keyReleased(KeyEvent e){ int code = e.getKeyCode(); if (code == KeyEvent.VK_LEFT || code == KeyEvent.VK_A || code == KeyEvent.VK_D || code == KeyEvent.VK_RIGHT){ player.stop(code); } }
a8b75c1c-ef5b-4651-bcee-82497b3ac335
7
public EigenvalueDecomposition (Matrix Arg) { double[][] A = Arg.getArray(); n = Arg.getColumnDimension(); V = new double[n][n]; d = new double[n]; e = new double[n]; issymmetric = true; for (int j = 0; (j < n) & issymmetric; j++) { for (int i = 0; (i < n) & issymmetr...
a3c1c20e-8759-4e62-94f4-c426d0785d1b
3
public static boolean isAllUnique(String s) { if ( s.length() > 256 ) return false; // by default, all values in boolean array are set to #f boolean[] charSet = new boolean[256]; for (int i=0 ; i != s.length(); ++i ) { int c = s.charAt(i); if ( charSet[c] ) { return false; } charSet[ c ] =...
0d6d1d8c-a936-4d0a-bf02-722ea46006da
6
public static Stella_Object yieldHardcodedCaseSymbolIdOrIds(Stella_Object casetest) { if (casetest == Stella.SYM_STELLA_OTHERWISE) { return (casetest); } { Symbol symbol = null; { Surrogate testValue000 = Stella_Object.safePrimaryType(casetest); if (testValue000 == Stella.SGT_STELLA_CO...
093b297f-ec9a-4b3b-b728-a3a1d1274559
1
public void testPrint_writerMethods() throws Exception { DateTime dt = new DateTime(2004, 6, 9, 10, 20, 30, 40, UTC); CharArrayWriter out = new CharArrayWriter(); f.printTo(out, dt); assertEquals("Wed 2004-06-09T10:20:30Z", out.toString()); out = new CharArrayWriter(); ...
8aa17d47-66e1-4cbf-96dd-c387d5a79aa4
4
public void addEvent(String s){ if(events[events.length-1]==null){ for(int index=0;index<events.length-1;index++){ if(events[index]!=null){ events[index]=s; return; } } } else{ for(int index=0;index<events.length-2;index++){ events[index]=events[index+1]; } events[events.lengt...
cf741ca8-2000-42e9-8192-c6b1fe685887
8
public boolean bottomConnect(int[][] currentBlockArray, int[][] pixels, int x, int z) { boolean connects = false; for(int i = 3; i < pixels.length && !connects; i++) { if( isCaveBG(currentBlockArray[x+i][z-1]) && isCaveBG(currentBlockArray[x+i-1][z-1]) && ...
76e81b72-c5da-4ee0-a27f-06d828b76dcd
4
public void setStartingPosition() { int randomCorner = (int) (Math.random() * 4); switch (randomCorner) { case 0: this.x = 0; this.y = 0; break; case 1: this.x = 450; this.y = 0; ...
43fe0868-9847-4f52-b554-e891aceeaa31
3
@Override public boolean retainAll(Collection<?> arg0) { boolean result = list.retainAll(arg0); if (result) try { save(); } catch (IOException ex) { System.err.println("Autosave failed - " + ex.getMessage()); ex.printStackTrace(...
02d56b2c-801c-41fd-ad8d-ca47d98a6f24
7
String checkSecurity(int iLevel, javax.servlet.http.HttpSession session, javax.servlet.http.HttpServletResponse response, javax.servlet.http.HttpServletRequest request){ try { Object o1 = session.getAttribute("UserID"); Object o2 = session.getAttribute("UserRights"); boolean bRedirect = false; ...
6acbb10f-9aee-4bf3-8e75-2b2f1f226480
8
@EventHandler(ignoreCancelled = true) public void rarpBlockFromTo(BlockFromToEvent event) { if (event.isCancelled()) { return; } Block blockFrom = event.getBlock(); boolean isWater = blockFrom.getTypeId() == 8 || blockFrom.getTypeId() == 9; boolean isLava = blockFrom.getTypeId() == 10 || blockFrom.getType...
b5297a22-de62-47bf-b7f7-770bfd429503
6
public final WaiprParser.triggers_return triggers() throws RecognitionException { WaiprParser.triggers_return retval = new WaiprParser.triggers_return(); retval.start = input.LT(1); CommonTree root_0 = null; Token char_literal40=null; Token char_literal42=null; ParserRuleReturnScope trigger39 =null; Par...
5f775a81-d6f6-4493-9e49-89934567e30e
1
@Override public boolean Input(double _deltaTime, MouseCursor mouse, Keyboard _keyboard) { //TODO: Check your input devices for changes. //If the game is active check for input. if(application.isFocused()) { } return true; }
c6bf8939-3f16-4d8f-bfbf-5ab423ec0ec1
1
public static String Reconstruct(int[] m) { String q = ""; char[] w = new char[m.length]; for (int x = 0; x < m.length; x++) { w[x] = (char) m[x]; q = q + w[x]; } return q; }
25521626-5a79-43a1-b6ba-f2c1d5cc5400
9
private void markExploredCell(String descriptor) throws ArenaTemplateException { String binStr = null; try{ binStr = hexToBinaryStr(descriptor); }catch(NumberFormatException e){ throw new ArenaTemplateException(2, "The descriptor contains some non-hex digit"); } if(binStr.length() != this.rowCount *...
3517a523-1262-4f09-9a2a-f9b2466c28c1
1
@Override public TextModifier getTextModifier() { TextModifier modifier = new TextModifier(); if(textColor != null) { modifier.addModifier(TextModValue.COLOR, textColor); } return modifier; }
fd1afb50-a63a-4891-a806-955d3de45c0a
2
public void visitNewExpr(final NewExpr expr) { // Keep track of the value number of expression that create new // objects. if (expr.valueNumber() != -1) { if (ValueFolding.DEBUG) { System.out.println("New " + expr); } news.set(expr.valueNumber()); } }
bc282c9c-4b9e-4c27-8a20-0ff7da1d955d
2
static double[][] transpose(double[][] A){ double[][] B = new double[A[0].length][A.length]; for(int i = 0; i < A.length; i++){ for(int j = 0; j < A[i].length; j++){ B[j][i] = A[i][j]; } } return B; }
926c9c93-b232-4c64-b278-b533057b2f33
1
public static int flip_bit_at(final int val, final int at_index) { assert(at_index >= 24); // we're only flipping bits in least sig byte of val final char[] chars = getZeroPaddedBinaryString(val).toCharArray(); chars[at_index] = chars[at_index] == '1' ? '0' : '1'; final int i = Integer.p...
940aa639-ecb8-4342-8238-b5836631f50b
1
public JSONArray getJSONArray(int index) throws JSONException { Object object = get(index); if (object instanceof JSONArray) { return (JSONArray)object; } throw new JSONException("JSONArray[" + index + "] is not a JSONArray."); }
e9910457-96e2-454a-8327-b316a47616cb
4
public static byte pedir_q_cuenta(){ byte aux=0; do{ try{ System.out.println("1. Ingreso en Cuenta Corriente"); System.out.println("2. Ingreso en Cuenta Ahorro"); System.out.print("OP => "); BufferedReader stdin=new BufferedReader(new InputStreamReader(System.in)); aux=Byte.parseByte(stdin.r...
e8687758-cb7a-4bb4-b4eb-8f8f7ef703e9
2
public void deleteByUserName(String userName) { EntityManager em = PersistenceManager.createEntityManager(); try { em.getTransaction().begin(); List<Openchatroomsmessage> ochrms = em.createNamedQuery("Openchatroomsmessage.GetByUser", Openchatroomsmessage.class) .setParameter("u", userName) .getRes...
2911aaa2-eef8-48b3-a783-add0cfab465b
8
private int getAbsoluteInsertionIndex(Row parent, int childInsertIndex) { int insertAt; int count; if (parent == null) { count = mModel.getRowCount(); insertAt = childInsertIndex; while (insertAt < count && mModel.getRowAtIndex(insertAt).getParent() != null) { insertAt++; } } else { int i = ...
3549a799-5e7c-4e09-82b9-d36f64492f50
2
static BigDecimal processUserSelection(VendingMachine vendingMachine, Scanner scanner, BigDecimal balance) { // user inputs coins to the vending machine - require a balance to store the current value of the balance // validate user inputs, i.e. have they entered a valid coin value? while(balance...
2defeee0-4ec3-49af-a0a5-f2dcc60c59ec
2
public boolean isNewCharacterOpen() { HUD hud = null; for (int i = (huds.size() - 1); i >= 0; i--) { hud = huds.get(i); if (hud.getName().equals("ScreenNewCharacter")) { return hud.getShouldRender(); } } return false; }
ce0e293e-f0f4-48af-88ec-eb836ab8030c
6
public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page ...
afb35df8-7958-47b0-b07e-eb438540bbcd
2
public static String entreeNonVide(String inviteDeChamp){ String retour = ""; Scanner sc = new Scanner(System.in); while(retour.isEmpty()){ System.out.print(inviteDeChamp); retour = sc.nextLine(); if(retour.isEmpty()) System.out.println("Le champ ne peut être vide, recommencez."); } return retour...